Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(appshot): the full editor matches the area picker and gets its own button look
rubenluetke10-beep9b9c52d5685a
diff --git a/jarvis/ui/web/frontend/src/lib/appshotEditorModel.test.ts b/jarvis/ui/web/frontend/src/lib/appshotEditorModel.test.tsindex 74c11ba013..5a9602fb51 100644--- a/jarvis/ui/web/frontend/src/lib/appshotEditorModel.test.ts+++ b/jarvis/ui/web/frontend/src/lib/appshotEditorModel.test.ts@@ -61,7 +61,7 @@ describe("appshot editor model", () => {});describe("tools and keys", () => {- it("uses CleanShot X's one-letter keys, each once", () => {+ it("assigns a unique one-letter shortcut to each tool", () => {const keys = TOOL_KEYS.map((entry) => entry.key);expect(new Set(keys).size).toBe(keys.length);expect(toolForKey("V")).toBe("move");@@ -286,6 +286,12 @@ describe("grips", () => {expect(reshape(pen, "se", { x: 20, y: 20 }).points[1]).toEqual({ x: 20, y: 20 });const text = withId({ kind: "text", at: { x: 0, y: 0 }, text: "Hi", color: "#fff", size: 20, style: "plain" as const });expect(reshape(text, "se", { x: 0, y: 50 }, () => 20).size).toBe(40);+ // Text has a grip on every corner; the opposite corner stays put.+ expect(handles(text, () => 20).map((h) => h.id)).toEqual(["nw", "ne", "sw", "se"]);+ const shrunk = reshape(text, "nw", { x: 0, y: 12.5 }, (_line, size) => size);+ expect(shrunk.size).toBe(10);+ const box = bounds(shrunk, (_line, size) => size);+ expect([box.x + box.w, box.y + box.h]).toEqual([20, 25]);const badge = withId({ kind: "counter", at: { x: 0, y: 0 }, n: 1, color: "#f00", size: 12 });expect(reshape(badge, "size", { x: 30, y: 0 }).size).toBe(30);});diff --git a/jarvis/ui/web/frontend/src/lib/appshotEditorModel.ts b/jarvis/ui/web/frontend/src/lib/appshotEditorModel.tsindex 3b9d093d8c..984438dced 100644--- a/jarvis/ui/web/frontend/src/lib/appshotEditorModel.ts+++ b/jarvis/ui/web/frontend/src/lib/appshotEditorModel.ts@@ -4,10 +4,10 @@* around the result. Pure data + one renderer, so the on-screen canvas and* the exported PNG are painted by the same code.*- * The tool set and its one-letter keys follow CleanShot X's annotate tool+ * Each annotation tool has a one-letter shortcut* (V move, A arrow, L line, R rectangle, F filled rectangle, E ellipse,* D draw, M highlighter, T text, C counter, H spotlight, P redact, K crop,- * B background), so anyone who knows it can work here without looking.+ * B background) for quick access while editing.** A crop is an annotation too: the last one sets the visible part of the* picture, and undo brings the rest back.@@ -44,7 +44,7 @@ export interface Rect {export type TextStyle = "plain" | "label" | "outline";export type RedactMode = "pixelate" | "blur";/**- * ``tapered``: CleanShot X's arrow — a filled shape that starts as a fine+ * ``tapered``: a filled arrow shape that starts as a fine* point and swells towards a swept-back head. ``classic``: line plus head.* ``double``: a head at both ends.*/@@ -338,8 +338,8 @@ export function translate<T extends Draft>(op: T, dx: number, dy: number): T {/*** A grip on a selected annotation. Lines and arrows have one at each end- * (``from``, ``to``); boxes and strokes one at each corner; text a corner- * that scales its size; a counter one on its rim (``size``).+ * (``from``, ``to``); boxes, strokes and text one at each corner (text+ * scales its size with them); a counter one on its rim (``size``).*/export type HandleId = "from" | "to" | "nw" | "ne" | "sw" | "se" | "size";@@ -375,8 +375,6 @@ export function handles(op: Draft, measure?: MeasureText): Handle[] {return [];case "counter":return [{ id: "size", at: { x: op.at.x + op.size, y: op.at.y } }];- case "text":- return [{ id: "se", at: corner(bounds(op, measure), "se") }];default: {const box = bounds(op, measure);return (["nw", "ne", "sw", "se"] as const).map((id) => ({ id, at: corner(box, id) }));@@ -402,7 +400,8 @@ export function handleAt(op: Draft, p: Point, radius: number, measure?: MeasureT* ``original`` with grip ``handle`` dragged to ``p``. Always computed from* the shape as it was when the drag began, so a long drag never drifts.* An arrow's end follows the pointer; a box keeps the opposite corner- * fixed; a stroke scales from it; text grows with its corner; a counter's+ * fixed; a stroke scales from it; text grows or shrinks from it, font size+ * and all; a counter's* badge grows with its rim.*/export function reshape<T extends Draft>(original: T, handle: HandleId, p: Point, measure?: MeasureText): T {@@ -418,9 +417,17 @@ export function reshape<T extends Draft>(original: T, handle: HandleId, p: Pointcase "counter":return { ...op, size: Math.max(8, Math.hypot(p.x - op.at.x, p.y - op.at.y)) } as T;case "text": {+ // Any corner scales the text; the opposite corner stays where it was.+ if (handle === "from" || handle === "to" || handle === "size") return original;const box = bounds(op, measure);- const factor = Math.max(0.25, (p.y - box.y) / Math.max(1, box.h));- return { ...op, size: Math.max(8, Math.round(op.size * factor)) } as T;+ const anchor = corner(box, OPPOSITE[handle]);+ const factor = Math.max(0.1, Math.abs(p.y - anchor.y) / Math.max(1, box.h));+ const sized = { ...op, size: Math.max(8, Math.round(op.size * factor)) };+ const grown = bounds({ ...sized, at: { x: 0, y: 0 } }, measure);+ const pad = sized.style === "label" ? sized.size * 0.4 : 0;+ const left = handle === "ne" || handle === "se" ? anchor.x : anchor.x - grown.w;+ const top = handle === "sw" || handle === "se" ? anchor.y : anchor.y - grown.h;+ return { ...sized, at: { x: left + pad, y: top + pad } } as T;}case "pen":case "highlight": {@@ -590,7 +597,7 @@ export function contrastOn(hex: string): string {** Measured along the arrow: a fine tail point, a shaft that widens to the* neck, and a head whose barbs sweep back past the neck — the concave base- * that makes CleanShot X's arrow read as one confident stroke. Everything+ * that joins the shaft and head into one continuous shape. Everything* scales with the stroke width; a short arrow keeps its head in proportion.* Empty for an arrow too short to draw.*/diff --git a/jarvis/ui/web/frontend/src/views/AppshotEditor.tsx b/jarvis/ui/web/frontend/src/views/AppshotEditor.tsxindex ea0a825181..934cdaaf0c 100644--- a/jarvis/ui/web/frontend/src/views/AppshotEditor.tsx+++ b/jarvis/ui/web/frontend/src/views/AppshotEditor.tsx@@ -84,10 +84,10 @@ import { cn } from "@/lib/utils";import { useEventStore } from "@/store/events";/**- * The appshot editor — annotate a capture the way CleanShot X's annotate tool- * does: select/move, arrow, line, rectangle, filled rectangle, ellipse, draw,+ * The appshot editor — annotate a capture with select/move, arrow, line,+ * rectangle, filled rectangle, ellipse, draw,* highlighter, text (three styles), counter, spotlight, pixelate/blur, crop- * (free or fixed ratio) and a background frame, with undo/redo and CleanShot's+ * (free or fixed ratio) and a background frame, with undo/redo and* one-letter keys. The result can be copied, saved, or put back in place of* the appshot so the next message carries the edited picture.*@@ -96,14 +96,17 @@ import { useEventStore } from "@/store/events";* Downloads through the backend because the desktop WebView drops browser* downloads. In a plain browser both fall back to the browser's own paths.*- * The layout follows CleanShot X's editor window: a floating rounded window- * over a dimmed app, the tools as pills along the top with colour and size- * beside them, "Save" and "Done" at the top right, and a bottom bar with the- * zoom, a "Drag me" handle (a real file drag into any app, where the desktop- * shell has the native drag bridge) and the copy action.+ * The editor uses a floating rounded window over a dimmed app: one tool tray+ * of rounded-square buttons along the top (the active tool in the accent+ * colour), colour and size beside it, "Save", "Done" and close at the top+ * right, and a bottom bar with the zoom, a "Drag me" handle (a real file drag+ * into any app, where the desktop shell has the native drag bridge) and the+ * copy action. Its tools, keys and looks match the area picker's in-place+ * toolbar (``jarvis/appshot/picker``); the mouse wheel steps the size there+ * and here, and Enter finishes in both.*/-/** Toolbar order, as in CleanShot X: selection, shapes, text, effects, ink. */+/** Toolbar order: selection, shapes, text, effects, ink. */const TOOL_ORDER: readonly Tool[] = ["move","rect",@@ -780,7 +783,7 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overla} else if (mod && key === "s") {event.preventDefault();void save();- } else if (mod && event.key === "Enter") {+ } else if (event.key === "Enter" && !event.shiftKey) {event.preventDefault();void use();} else if ((event.key === "Delete" || event.key === "Backspace") && selectedId !== null) {@@ -890,10 +893,9 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaonClick={() => chooseTool(name)}data-testid={`appshot-editor-tool-${name}`}className={cn(- "flex h-7 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors",+ "flex h-7 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors","hover:bg-foreground/10 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",- (name === "crop" || name === "background") && "bg-foreground/10",- tool === name && "bg-foreground/20 text-foreground",+ tool === name && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",)}>{name === "filled" ? (@@ -925,30 +927,20 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overladata-testid="appshot-editor"data-variant={variant}>- {/* Top bar: close · crop and background · tools · colour and size · Save, Done. */}+ {/* Top bar: one tool tray (tools · crop and background) · colour and size · Save, Done, close. */}<div className="flex h-12 shrink-0 items-center gap-2 border-b border-border px-3">- <QuickTooltip content={`${label("close")} (Esc)`} side="bottom">- <button- type="button"- onClick={requestClose}- aria-label={label("close")}- data-testid="appshot-editor-close"- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-foreground/10 text-muted-foreground transition-colors hover:bg-destructive hover:text-destructive-foreground"- >- <X className="h-3.5 w-3.5" aria-hidden />- </button>- </QuickTooltip>- <div className="flex shrink-0 items-center gap-1">+ <div+ className="flex min-w-0 items-center gap-0.5 overflow-x-auto rounded-xl border border-border bg-foreground/[0.04] p-0.5"+ role="toolbar"+ aria-label={label("tools")}+ >+ {TOOL_ORDER.map(toolButton)}+ <div className="mx-0.5 h-5 w-px shrink-0 bg-border" aria-hidden />{toolButton("crop")}{toolButton("background")}</div>- <div className="h-5 w-px shrink-0 bg-border" aria-hidden />- <div className="flex min-w-0 items-center gap-0.5 overflow-x-auto" role="toolbar" aria-label={label("tools")}>- {TOOL_ORDER.map(toolButton)}- </div>- <div className="h-5 w-px shrink-0 bg-border" aria-hidden />- {/* Colour (a menu) and size (a slider), like CleanShot's style controls. */}+ {/* Colour (a menu) and size (a slider). */}<div className="relative shrink-0" data-editor-menu><QuickTooltip content={label("color")} side="bottom"><button@@ -957,9 +949,9 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaaria-expanded={menu === "style"}onClick={() => setMenu(menu === "style" ? "" : "style")}data-testid="appshot-editor-style"- className="flex h-7 items-center gap-1 rounded-full bg-foreground/10 pl-1.5 pr-1 transition-colors hover:bg-foreground/15"+ className="flex h-7 items-center gap-1 rounded-lg border border-border bg-foreground/[0.04] pl-1.5 pr-1 transition-colors hover:bg-foreground/10">- <span className="h-4 w-4 rounded-full border border-border-strong" style={{ backgroundColor: color }} />+ <span className="h-4 w-4 rounded-md border border-border-strong" style={{ backgroundColor: color }} /><ChevronDown className="h-3.5 w-3.5 text-muted-foreground" aria-hidden /></button></QuickTooltip>@@ -1035,8 +1027,8 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaaria-pressed={arrowStyle === style}onClick={() => setArrowStyle(style)}className={cn(- "flex h-7 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground",- arrowStyle === style && "bg-foreground/20 text-foreground",+ "flex h-7 w-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground",+ arrowStyle === style && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",)}><ArrowStyleIcon style={style} />@@ -1055,7 +1047,7 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaonClick={() => void save()}disabled={!image || busy !== ""}data-testid="appshot-editor-save"- className="flex h-7 items-center gap-1.5 rounded-full bg-foreground/10 px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-foreground/15 disabled:opacity-50"+ className="flex h-7 items-center gap-1.5 rounded-lg border border-border px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-foreground/10 disabled:opacity-50">{busy === "save" && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}{label("save")}@@ -1067,12 +1059,24 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaonClick={() => void use()}disabled={!image || busy !== ""}data-testid="appshot-editor-apply"- className="flex h-7 items-center gap-1.5 rounded-full bg-primary px-3.5 text-[13px] font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50"+ className="flex h-7 items-center gap-1.5 rounded-lg bg-primary px-3.5 text-[13px] font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50">{busy === "apply" && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}{label("done")}</button></QuickTooltip>+ <div className="mx-0.5 h-5 w-px shrink-0 bg-border" aria-hidden />+ <QuickTooltip content={`${label("close")} (Esc)`} side="bottom">+ <button+ type="button"+ onClick={requestClose}+ aria-label={label("close")}+ data-testid="appshot-editor-close"+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-destructive hover:text-destructive-foreground"+ >+ <X className="h-4 w-4" aria-hidden />+ </button>+ </QuickTooltip></div></div>@@ -1197,6 +1201,13 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaonPointerCancel={() => setGesture(null)}onPointerLeave={() => setHoverCursor(null)}onDoubleClick={onDoubleClick}+ onWheel={(event) => {+ // At "fit" nothing scrolls, so the wheel steps the size.+ if (zoom !== "fit" || event.ctrlKey || event.deltaY === 0) return;+ setWidthIndex((index) =>+ Math.max(0, Math.min(STROKE_LEVELS.length - 1, index + (event.deltaY < 0 ? 1 : -1))),+ );+ }}data-testid="appshot-editor-canvas"/>{typing && textScreen && (@@ -1245,7 +1256,7 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaaria-expanded={menu === "zoom"}onClick={() => setMenu(menu === "zoom" ? "" : "zoom")}data-testid="appshot-editor-zoom"- className="flex h-7 items-center gap-1 rounded-full bg-foreground/10 px-2.5 text-[13px] font-medium tabular-nums transition-colors hover:bg-foreground/15"+ className="flex h-7 items-center gap-1 rounded-lg border border-border px-2.5 text-[13px] font-medium tabular-nums transition-colors hover:bg-foreground/10">{zoomLabel}<ChevronDown className="h-3.5 w-3.5 text-muted-foreground" aria-hidden />@@ -1294,7 +1305,7 @@ export function AppshotEditor({ appshotId, onClose, onApplied, variant = "overlaonDragStart={(event) => event.preventDefault()}disabled={!image}data-testid="appshot-editor-drag"- className="flex h-7 cursor-grab select-none items-center gap-1.5 rounded-full bg-foreground/10 px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-foreground/15 active:cursor-grabbing disabled:opacity-50"+ className="flex h-7 cursor-grab select-none items-center gap-1.5 rounded-lg border border-border px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-foreground/10 active:cursor-grabbing disabled:opacity-50">{dragging ? <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden /> : <GripVertical className="h-3.5 w-3.5 text-muted-foreground" aria-hidden />}{label("drag_me")}@@ -1364,7 +1375,7 @@ function ArrowStyleIcon({ style }: { style: ArrowStyle }) {}const ROUND_ICON =- "flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground disabled:pointer-events-none disabled:opacity-40";+ "flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground disabled:pointer-events-none disabled:opacity-40";function Segmented({label,