Skip to content

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.

feat(agentic): terminal zoom helpers and two-line voice bubble headline

rubenluetke10-beep722c15cd13d1
diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubbleNotice.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubbleNotice.tsx
index 5545f9ae36..e3cbfd42f6 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubbleNotice.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubbleNotice.tsx
@@ -136,7 +136,10 @@ export function VoiceBubbleNotice({
const body = (
<>
- <span className="block truncate text-[12px] font-semibold leading-snug text-foreground">
+ {/* Two lines rather than one truncated one: this is the sentence that
+ tells the user WHICH of their agents this is about, and half of it is
+ often the half that names the thing. */}
+ <span className="line-clamp-2 text-[12px] font-semibold leading-snug text-foreground">
{headline}
</span>
<span className="mt-0.5 block truncate text-[11px] leading-snug text-muted-foreground">
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts
new file mode 100644
index 0000000000..35dcf93feb
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts
@@ -0,0 +1,170 @@
+import { describe, expect, it, vi } from "vitest";
+
+import { installZoomKeyBridge, zoomIntentFor, type ZoomIntent } from "./terminalZoom";
+
+function press(init: KeyboardEventInit): KeyboardEvent {
+ return new KeyboardEvent("keydown", { cancelable: true, ...init });
+}
+
+describe("recognising the zoom chords on Windows and Linux", () => {
+ const pc = { isMac: false };
+
+ it("takes Ctrl and the plus key — the reported ask", () => {
+ expect(zoomIntentFor(press({ key: "+", ctrlKey: true }), pc)).toBe("in");
+ });
+
+ it("takes the US spelling of the same chord, with and without Shift", () => {
+ expect(zoomIntentFor(press({ key: "=", ctrlKey: true }), pc)).toBe("in");
+ expect(zoomIntentFor(press({ key: "+", ctrlKey: true, shiftKey: true }), pc)).toBe(
+ "in",
+ );
+ });
+
+ it("takes Ctrl and minus, and Ctrl+0 as the way back to the default", () => {
+ expect(zoomIntentFor(press({ key: "-", ctrlKey: true }), pc)).toBe("out");
+ expect(zoomIntentFor(press({ key: "_", ctrlKey: true }), pc)).toBe("out");
+ expect(zoomIntentFor(press({ key: "0", ctrlKey: true }), pc)).toBe("reset");
+ });
+
+ it("takes the numeric keypad, which `key` alone stops naming without NumLock", () => {
+ // NumLock off: the keypad still reports its code, but `key` is a name the
+ // chord table does not contain.
+ expect(
+ zoomIntentFor(press({ key: "Insert", code: "Numpad0", ctrlKey: true }), pc),
+ ).toBe("reset");
+ expect(zoomIntentFor(press({ key: "+", code: "NumpadAdd", ctrlKey: true }), pc)).toBe(
+ "in",
+ );
+ expect(
+ zoomIntentFor(press({ key: "-", code: "NumpadSubtract", ctrlKey: true }), pc),
+ ).toBe("out");
+ });
+
+ it("leaves AltGr+plus alone — that is the tilde a German layout types", () => {
+ expect(
+ zoomIntentFor(press({ key: "~", ctrlKey: true, altKey: true }), pc),
+ ).toBeNull();
+ expect(
+ zoomIntentFor(press({ key: "+", ctrlKey: true, altKey: true }), pc),
+ ).toBeNull();
+ });
+
+ it("leaves the unmodified key and the wrong modifier alone", () => {
+ expect(zoomIntentFor(press({ key: "+" }), pc)).toBeNull();
+ // Win+plus is the Windows magnifier, not this.
+ expect(zoomIntentFor(press({ key: "+", metaKey: true }), pc)).toBeNull();
+ });
+
+ it("leaves every other Ctrl chord alone", () => {
+ expect(zoomIntentFor(press({ key: "c", ctrlKey: true }), pc)).toBeNull();
+ expect(zoomIntentFor(press({ key: "1", ctrlKey: true }), pc)).toBeNull();
+ });
+});
+
+describe("recognising the zoom chords on an Apple keyboard", () => {
+ const mac = { isMac: true };
+
+ it("takes Cmd and the plus, minus and zero keys", () => {
+ expect(zoomIntentFor(press({ key: "+", metaKey: true }), mac)).toBe("in");
+ expect(zoomIntentFor(press({ key: "-", metaKey: true }), mac)).toBe("out");
+ expect(zoomIntentFor(press({ key: "0", metaKey: true }), mac)).toBe("reset");
+ });
+
+ it("leaves Ctrl+minus alone there — inside a terminal that is a control code", () => {
+ expect(zoomIntentFor(press({ key: "-", ctrlKey: true }), mac)).toBeNull();
+ expect(
+ zoomIntentFor(press({ key: "-", metaKey: true, ctrlKey: true }), mac),
+ ).toBeNull();
+ });
+});
+
+/** A window stand-in that hands the captured keystroke back to the test. */
+function fakeTarget(): {
+ addEventListener: EventTarget["addEventListener"];
+ removeEventListener: EventTarget["removeEventListener"];
+ fire: (event: KeyboardEvent) => void;
+ captured: boolean;
+ listeners: number;
+} {
+ const handlers = new Set<EventListener>();
+ const state = {
+ addEventListener: ((_type: string, handler: EventListener, options?: unknown) => {
+ state.captured = options === true;
+ handlers.add(handler);
+ state.listeners = handlers.size;
+ }) as EventTarget["addEventListener"],
+ removeEventListener: ((_type: string, handler: EventListener) => {
+ handlers.delete(handler);
+ state.listeners = handlers.size;
+ }) as EventTarget["removeEventListener"],
+ fire: (event: KeyboardEvent) => {
+ for (const handler of handlers) handler(event);
+ },
+ captured: false,
+ listeners: 0,
+ };
+ return state;
+}
+
+describe("the zoom key bridge", () => {
+ it("claims the chord so neither the WebView nor the pane also acts on it", () => {
+ const target = fakeTarget();
+ const applied: ZoomIntent[] = [];
+ installZoomKeyBridge(target, {
+ isMac: false,
+ enabled: () => true,
+ apply: (intent) => applied.push(intent),
+ });
+
+ const event = press({ key: "+", ctrlKey: true });
+ const stopPropagation = vi.spyOn(event, "stopPropagation");
+ target.fire(event);
+
+ expect(applied).toEqual(["in"]);
+ expect(event.defaultPrevented).toBe(true);
+ expect(stopPropagation).toHaveBeenCalled();
+ // Ahead of every pane's own key handling, which is the only phase that can
+ // see a keystroke typed into an xterm textarea.
+ expect(target.captured).toBe(true);
+ });
+
+ it("lets everything else through untouched", () => {
+ const target = fakeTarget();
+ const apply = vi.fn();
+ installZoomKeyBridge(target, { isMac: false, enabled: () => true, apply });
+
+ const event = press({ key: "a" });
+ target.fire(event);
+
+ expect(apply).not.toHaveBeenCalled();
+ expect(event.defaultPrevented).toBe(false);
+ });
+
+ it("stays out of the way while the workspace is not the section on screen", () => {
+ const target = fakeTarget();
+ const apply = vi.fn();
+ let onScreen = false;
+ installZoomKeyBridge(target, { isMac: false, enabled: () => onScreen, apply });
+
+ const hidden = press({ key: "+", ctrlKey: true });
+ target.fire(hidden);
+ expect(apply).not.toHaveBeenCalled();
+ expect(hidden.defaultPrevented).toBe(false);
+
+ onScreen = true;
+ target.fire(press({ key: "+", ctrlKey: true }));
+ expect(apply).toHaveBeenCalledWith("in");
+ });
+
+ it("removes its listener on cleanup", () => {
+ const target = fakeTarget();
+ const dispose = installZoomKeyBridge(target, {
+ isMac: false,
+ enabled: () => true,
+ apply: vi.fn(),
+ });
+ expect(target.listeners).toBe(1);
+ dispose();
+ expect(target.listeners).toBe(0);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts
new file mode 100644
index 0000000000..6c1b7c4c46
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts
@@ -0,0 +1,108 @@
+/**
+ * Ctrl/Cmd + `+` / `-` / `0` resizes the terminal text, the way a browser zooms.
+ *
+ * ## Why this file has to exist
+ *
+ * The workspace toolbar already carries a text-size stepper, but nobody looks
+ * up at a toolbar to make the text they are reading bigger — they press the
+ * chord every other application on their machine binds to it. A terminal is the
+ * worst place to be missing it, because a pane's text is the smallest text on
+ * the screen and the grid keeps shrinking it as more agents are opened.
+ *
+ * The chord cannot be left to the surrounding app either. The desktop shell is
+ * an embedded WebView with no address bar and no menu, so the browser's own
+ * zoom would scale the WHOLE window — toolbar, prompt box, every pane at once —
+ * with no visible control to undo it again. Claiming the keystroke here both
+ * gives it the meaning the user wants and keeps the app's own layout still: the
+ * `preventDefault` below is what stops the page zoom from happening as well.
+ *
+ * ## Which chords count, and which must NOT
+ *
+ * * **The platform modifier only** — Cmd on macOS, Ctrl on Windows and Linux.
+ * The other one is left alone: Ctrl+<key> is a control code inside a terminal
+ * on macOS, and Win+`+` belongs to the Windows magnifier.
+ * * **Alt is disqualifying.** European layouts deliver AltGr as Ctrl+Alt, and
+ * on a German keyboard AltGr+`+` is `~` — the tilde a user types into a shell
+ * path all day. A zoom that swallowed it would be a worse bug than the
+ * missing shortcut (same reasoning as ./terminalNewline).
+ * * **Both spellings of each step.** `+` is its own key on a German layout but
+ * Shift+`=` on a US one, so `=` counts as zoom-in and `_` as zoom-out; the
+ * numeric keypad is matched by `code`, which is the only thing that still
+ * identifies it when NumLock is off.
+ */
+
+/** Which way the user asked the terminal text to go. */
+export type ZoomIntent = "in" | "out" | "reset";
+
+export interface ZoomChordOptions {
+ /** Cmd is the modifier on Apple keyboards, Ctrl everywhere else. */
+ isMac: boolean;
+}
+
+/** Physical keypad keys, which `key` alone stops identifying without NumLock. */
+const KEYPAD_IN = "NumpadAdd";
+const KEYPAD_OUT = "NumpadSubtract";
+const KEYPAD_RESET = "Numpad0";
+
+/**
+ * What this keystroke means for the terminal text size, or `null` for anything
+ * that is not one of the three zoom chords.
+ */
+export function zoomIntentFor(
+ event: Pick<KeyboardEvent, "key" | "code" | "ctrlKey" | "metaKey" | "altKey">,
+ { isMac }: ZoomChordOptions,
+): ZoomIntent | null {
+ // AltGr (Ctrl+Alt on European layouts) types characters people need in a
+ // shell — it must never be read as a modifier here.
+ if (event.altKey) return null;
+ if (isMac ? !event.metaKey || event.ctrlKey : !event.ctrlKey || event.metaKey) {
+ return null;
+ }
+ if (event.key === "+" || event.key === "=" || event.code === KEYPAD_IN) return "in";
+ if (event.key === "-" || event.key === "_" || event.code === KEYPAD_OUT) return "out";
+ if (event.key === "0" || event.code === KEYPAD_RESET) return "reset";
+ return null;
+}
+
+export interface ZoomKeyBridgeOptions extends ZoomChordOptions {
+ /**
+ * Is the workspace the user is actually looking at?
+ *
+ * Asked per keystroke rather than captured once, because the Agentic IDE is
+ * hidden instead of unmounted when another section is opened — a grid parked
+ * behind the settings screen must not resize its panes while the user zooms
+ * something else.
+ */
+ enabled: () => boolean;
+ /** Apply the step. Clamping and remembering it belong to the caller. */
+ apply: (intent: ZoomIntent) => void;
+}
+
+/**
+ * Claim the zoom chords on `target`, returning a cleanup function.
+ *
+ * Registered in the CAPTURE phase, and that is the load-bearing detail: the
+ * keystroke is typed into an xterm pane, whose textarea both reads the key and
+ * cancels it, so a listener waiting for the event to bubble would never see it.
+ * Capturing on the window puts this ahead of every pane, and `stopPropagation`
+ * then keeps the chord from also arriving at the agent as a control code.
+ */
+export function installZoomKeyBridge(
+ target: Pick<EventTarget, "addEventListener" | "removeEventListener">,
+ { isMac, enabled, apply }: ZoomKeyBridgeOptions,
+): () => void {
+ const onKeyDown = (event: Event) => {
+ const key = event as KeyboardEvent;
+ if (!enabled()) return;
+ const intent = zoomIntentFor(key, { isMac });
+ if (intent === null) return;
+ // Stops the WebView's own page zoom (the reason this is a shortcut the app
+ // has to claim rather than inherit) and keeps the pane from typing it.
+ event.preventDefault();
+ event.stopPropagation();
+ apply(intent);
+ };
+
+ target.addEventListener("keydown", onKeyDown, true);
+ return () => target.removeEventListener("keydown", onKeyDown, true);
+}