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(verse): walk up to a desk monitor and take over its coding agent (#960)
Ruben Lütkead904fc6cd1d
diff --git a/docs/verse/README.md b/docs/verse/README.mdindex 288e2b3875..0b71c358de 100644--- a/docs/verse/README.md+++ b/docs/verse/README.md@@ -64,6 +64,17 @@ or elite and fight a 1v1 blaster duel against a bot, best of three; Esc pauses,Esc again leaves and puts the commander back on the deck. See[`combat.md`](combat.md).+**Taking over a terminal.** Every desk monitor in Reactor Engineering that+shows a coding pane is a station: within reach, E offers *Take over the+terminal* and opens the pane's screen large (`hud/TakeoverPanel.tsx`). For a+pane the IDE has mounted, every key goes straight to the agent as typed in the+IDE (Enter, arrows, Tab, Esc interrupts, Ctrl+C, a paste arrives bracketed),+through the IDE's own pane-input event with `focus: false`, so the hidden pane+never steals the keyboard; Ctrl+Q or the close button leaves. A pane the IDE+has not mounted shows the server's replay and takes a whole prompt per send+(`/api/agentic-ide/terminals/{name}/prompt`, uncomposed). The master station's+grid screens are not stations: they show every pane at once.+**Views.** The tool rail's switch offers the **bird's-eye** view, **thirdperson** and **first person**; 1, 2 and 3 pick one and V cycles them (the lastchoice is remembered). The bird's-eye view pulls the camera back over thediff --git a/dodaios/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/dodaios/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 03c2cd0bfb..9e1babe105 100644--- a/dodaios/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/dodaios/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -2804,7 +2804,7 @@ export function AgenticTerminal({const detail = (event as CustomEvent<PaneInputDetail>).detail;if (detail?.pane !== name || (workspaceId && detail.workspaceId !== workspaceId)) return;termRef.current?.input(detail.data);- termRef.current?.focus();+ if (detail.focus !== false) termRef.current?.focus();};window.addEventListener(PANE_INPUT_EVENT, onInput);return () => window.removeEventListener(PANE_INPUT_EVENT, onInput);diff --git a/dodaios/ui/web/frontend/src/components/agentic/ideHotkeys.ts b/dodaios/ui/web/frontend/src/components/agentic/ideHotkeys.tsindex 280193bddd..6dfc6e69e4 100644--- a/dodaios/ui/web/frontend/src/components/agentic/ideHotkeys.ts+++ b/dodaios/ui/web/frontend/src/components/agentic/ideHotkeys.ts@@ -441,4 +441,10 @@ export interface PaneCommandDetail { workspaceId: string; pane: string; command:/** The window event that types text into one pane's terminal, as if from the keyboard. */export const PANE_INPUT_EVENT = "jarvis:ide-pane-input";-export interface PaneInputDetail { workspaceId: string; pane: string; data: string }+export interface PaneInputDetail {+ workspaceId: string;+ pane: string;+ data: string;+ /** False: type without focusing the pane (the Verse types into a pane the IDE has hidden). */+ focus?: boolean;+}diff --git a/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx b/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsxindex 0f467c3010..9eb3f0108e 100644--- a/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx+++ b/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx@@ -70,6 +70,8 @@ import { LightsLayer } from "./effects/LightsLayer";import { FloatingLabels, type PlateInfo } from "./hud/FloatingLabels";import { CrewCard, type CrewCardInfo } from "./hud/CrewCard";import { LiftPanel } from "./hud/LiftPanel";+import { TakeoverPanel } from "./hud/TakeoverPanel";+import { isTerminalFace } from "./effects/ScreensLayer";import { DeckTitle, StatsReadout, Toolbar } from "./hud/DeckBar";import { LauncherPanel } from "./hud/LauncherPanel";import { SimulatorPanel } from "./hud/SimulatorPanel";@@ -116,7 +118,10 @@ const DOORS_MS = 460;const DOORS_GIVE_UP_MS = 5000;type Hover = { kind: "crew"; id: string } | { kind: "station"; id: string } | null;-type Panel = "lift" | "launcher" | "games" | "settings" | "duel" | null;+type Panel = "lift" | "launcher" | "games" | "settings" | "duel" | "takeover" | null;++/** Station ids of the desk terminals the commander can take over: `takeover:<screen socket>`. */+const TAKEOVER = "takeover:";/** The deck the duel arena overlays (Reactor Engineering). */const ARENA_DECK = REACTOR_ARENA.deck as DeckId;@@ -173,6 +178,8 @@ export function VerseStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenGconst [hover, setHover] = useState<Hover>(null);const [selected, setSelected] = useState<string | null>(null);const [panel, setPanel] = useState<Panel>(null);+ /** The desk screen whose terminal the commander has taken over. */+ const [takeover, setTakeover] = useState<string | null>(null);const [notice, setNotice] = useState<string | null>(null);/** The deck the lift is riding to while its doors are shut; null when they are open. */const [doors, setDoors] = useState<DeckId | null>(null);@@ -421,18 +428,39 @@ export function VerseStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenGconst floor = deck.rooms.find((r) => r.id === REACTOR_ARENA.room)?.floorY ?? 0;return REACTOR_ARENA.terminals.map((tm) => ({ id: `duel:${tm.id}`, kind: "games" as const, room: REACTOR_ARENA.room, x: tm.x, y: floor, z: tm.z, sockets: {} }));}, [deck]);+ // Every desk monitor that shows one coding pane is a terminal the commander can walk up to and take over.+ const takeoverTerminals = useMemo<Station[]>(() => {+ if (!deck) return [];+ const out: Station[] = [];+ for (const socket of deck.sockets) {+ if (socket.kind !== "screen" || !terminalSockets.has(socket.id) || socket.station === "master") continue;+ out.push({ id: `${TAKEOVER}${socket.id}`, kind: "coding_launcher", room: socket.room, x: socket.x, y: socket.y, z: socket.z, sockets: {} });+ }+ return out;+ }, [deck, terminalSockets]);+ const takeoverTile = useCallback((stationId: string | null) => {+ if (!stationId?.startsWith(TAKEOVER)) return null;+ const face = faces.get(stationId.slice(TAKEOVER.length));+ return face && isTerminalFace(face) && face.tiles.length === 1 ? face.tiles[0] : null;+ }, [faces]);+ const takeoverRef = useRef(takeoverTile);+ takeoverRef.current = takeoverTile;const stationAtHand = useCallback((): Station | null => {const d = runtime.deck;const pose = runtime.poses.get(COMMANDER_ID);if (!d || !pose) return null;const facing = runtime.eye ? runtime.shoulder.forward() : { x: Math.sin(pose.yaw), z: Math.cos(pose.yaw) };- return stationWithin(duelTerminals.length ? [...d.stations, ...duelTerminals] : d.stations, pose.x, pose.z, undefined, facing);- }, [runtime, duelTerminals]);+ // A desk without a pane on its screen has nothing to take over.+ const desks = takeoverTerminals.filter((s) => takeoverRef.current(s.id) !== null);+ const extra = [...duelTerminals, ...desks];+ return stationWithin(extra.length ? [...d.stations, ...extra] : d.stations, pose.x, pose.z, undefined, facing);+ }, [runtime, duelTerminals, takeoverTerminals]);// The use key works the station at hand.const workNearStation = useCallback(() => {const station = stationAtHand();if (station?.id.startsWith("duel:")) { setPanel("duel"); return; }+ if (station?.id.startsWith(TAKEOVER)) { setTakeover(station.id); setPanel("takeover"); return; }if (station) activateStation(station);}, [stationAtHand, activateStation]);@@ -858,9 +886,12 @@ export function VerseStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenGconst id = pointed ? hover.id : nearStation;const terminal = id ? duelTerminals.find((s) => s.id === id) : undefined;if (terminal) return { station: terminal, name: t("verse.duel.terminal"), action: t("verse.duel.start"), key: "E" };+ const desk = id?.startsWith(TAKEOVER) ? takeoverTerminals.find((s) => s.id === id) : undefined;+ const deskTile = desk ? takeoverTile(desk.id) : null;+ if (desk && deskTile) return { station: desk, name: deskTile.header.title, action: t("verse.takeover.action"), key: "E" };const station = id ? deck.stations.find((s) => s.id === id) : undefined;return station ? { station, name: t(`verse.station.${station.kind}.name`), action: t(`verse.station.${station.kind}.action`), key: pointed ? null : "E" } : null;- }, [hover, nearStation, deck, t, duelTerminals]);+ }, [hover, nearStation, deck, t, duelTerminals, takeoverTerminals, takeoverTile]);const card = useMemo<CrewCardInfo | null>(() => {const m = selected ? life.crew.get(selected) : undefined;if (!m) return null;@@ -993,6 +1024,10 @@ export function VerseStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenG{panel === "duel" && !dueling && (<DuelPanel t={t} ride={deckId !== ARENA_DECK && !duelAnyDeck()} last={duelChoice} onStart={startDuel} onClose={() => setPanel(null)} />)}+ {panel === "takeover" && (() => {+ const tile = takeoverTile(takeover);+ return tile ? <TakeoverPanel tile={tile} t={t} onClose={() => { setPanel(null); setTakeover(null); }} /> : null;+ })()}{panel === "settings" && <ViewSettingsPanel t={t} tier={eyeOn ? runtime.stats.tier : ""} onClose={() => setPanel(null)} />}<RanksOverlay active={awake} crew={officers} companionName={lead?.name} />{import.meta.env.DEV && <StatsReadout runtime={runtime} />}diff --git a/dodaios/ui/web/frontend/src/components/society/verse/effects/ScreensLayer.tsx b/dodaios/ui/web/frontend/src/components/society/verse/effects/ScreensLayer.tsxindex 50fd1468d4..43263622b0 100644--- a/dodaios/ui/web/frontend/src/components/society/verse/effects/ScreensLayer.tsx+++ b/dodaios/ui/web/frontend/src/components/society/verse/effects/ScreensLayer.tsx@@ -61,14 +61,14 @@ function faceContent(face: ScreenView): string {}/** What a terminal tile shows right now: the live buffer's version, or the replay's stamp. */-function tileStamp(tile: TerminalTileFace): string {+export function tileStamp(tile: TerminalTileFace): string {const live = liveTerminal(tile.workspaceId, tile.names);if (live) return `L${live.version}`;const f = tile.fallback;return f ? `F${f.at}:${f.cursor?.join(",") ?? ""}` : "-";}-function tileSnapshot(tile: TerminalTileFace): GridTile {+export function tileSnapshot(tile: TerminalTileFace): GridTile {const live = liveTerminal(tile.workspaceId, tile.names);if (live) return { header: tile.header, snap: snapshotXterm(live.term) };if (tile.fallback) return { header: tile.header, snap: snapshotText(tile.fallback, themeFor("dark")) };diff --git a/dodaios/ui/web/frontend/src/components/society/verse/effects/terminalKeys.ts b/dodaios/ui/web/frontend/src/components/society/verse/effects/terminalKeys.tsnew file mode 100644index 0000000000..ac3a5e2032--- /dev/null+++ b/dodaios/ui/web/frontend/src/components/society/verse/effects/terminalKeys.ts@@ -0,0 +1,53 @@+/**+ * Keys pressed while the commander has taken over a desk terminal, as the+ * bytes a terminal sends for them (xterm's defaults: Enter is CR, Backspace+ * DEL, arrows and Home/End in normal cursor mode). Pure.+ */+export interface KeyLike {+ key: string;+ ctrlKey: boolean;+ altKey: boolean;+ metaKey: boolean;+ shiftKey: boolean;+}++const NAMED: Readonly<Record<string, string>> = {+ Enter: "\r",+ Backspace: "\x7f",+ Tab: "\t",+ Escape: "\x1b",+ ArrowUp: "\x1b[A",+ ArrowDown: "\x1b[B",+ ArrowRight: "\x1b[C",+ ArrowLeft: "\x1b[D",+ Home: "\x1b[H",+ End: "\x1b[F",+ Delete: "\x1b[3~",+ PageUp: "\x1b[5~",+ PageDown: "\x1b[6~",+ Insert: "\x1b[2~",+};++/** The terminal input for one key press, or null for a key that sends nothing (a lone modifier, F-keys). */+export function keyToTerminalData(e: KeyLike): string | null {+ if (e.metaKey) return null;+ if (e.key === "Tab" && e.shiftKey) return "\x1b[Z";+ const named = NAMED[e.key];+ if (named) return e.altKey ? `\x1b${named}` : named;+ if (e.key.length !== 1) return null;+ if (e.ctrlKey && !e.altKey) {+ const c = e.key.toLowerCase();+ if (c >= "a" && c <= "z") return String.fromCharCode(c.charCodeAt(0) - 96);+ if (c === " " || c === "@" || c === "2") return "\x00";+ if (c === "[") return "\x1b";+ if (c === "\\") return "\x1c";+ if (c === "]") return "\x1d";+ return null;+ }+ return e.altKey ? `\x1b${e.key}` : e.key;+}++/** Ctrl+Q leaves the terminal (Escape belongs to the agent: it interrupts it). */+export function leavesTakeover(e: KeyLike): boolean {+ return e.ctrlKey && !e.altKey && !e.metaKey && e.key.toLowerCase() === "q";+}diff --git a/dodaios/ui/web/frontend/src/components/society/verse/hud/TakeoverPanel.tsx b/dodaios/ui/web/frontend/src/components/society/verse/hud/TakeoverPanel.tsxnew file mode 100644index 0000000000..e35b1cc941--- /dev/null+++ b/dodaios/ui/web/frontend/src/components/society/verse/hud/TakeoverPanel.tsx@@ -0,0 +1,145 @@+/**+ * The commander takes over a desk terminal: the coding pane's screen, large,+ * and the keyboard goes to the agent as if typed in the IDE.+ *+ * A pane the IDE has mounted gets every key as it is pressed (Enter, arrows,+ * Escape, Ctrl+C, paste), through the same window event the IDE's own key+ * menu uses, without moving focus to the hidden pane. A pane the IDE has not+ * mounted shows the server's replay and takes a whole prompt at a time.+ * Ctrl+Q or the close button leaves; Escape belongs to the agent.+ */+import { useEffect, useRef, useState } from "react";+import { PANE_INPUT_EVENT, type PaneInputDetail } from "@/components/agentic/ideHotkeys";+import { promptTerminal } from "@/lib/agenticIdeApi";+import { liveTerminal } from "@/lib/liveTerminals";+import { tileSnapshot, tileStamp } from "../effects/ScreensLayer";+import { paintTerminalTile, type TerminalTileFace } from "../effects/terminalCanvas";+import { keyToTerminalData, leavesTakeover } from "../effects/terminalKeys";+import { VerseDialog } from "./VerseDialog";++interface Props {+ tile: TerminalTileFace;+ t: (key: string) => string;+ onClose: () => void;+}++/** Type `data` into the pane, as the IDE's key menu does; the pane keeps its focus where it was. */+export function typeIntoPane(tile: Pick<TerminalTileFace, "workspaceId" | "names">, data: string): void {+ for (const pane of new Set(tile.names)) {+ const detail: PaneInputDetail = { workspaceId: tile.workspaceId, pane, data, focus: false };+ window.dispatchEvent(new CustomEvent(PANE_INPUT_EVENT, { detail }));+ }+}++export function TakeoverPanel({ tile, t, onClose }: Props) {+ const canvas = useRef<HTMLCanvasElement>(null);+ const keys = useRef<HTMLTextAreaElement>(null);+ const live = !!liveTerminal(tile.workspaceId, tile.names);+ const [draft, setDraft] = useState("");+ const [sending, setSending] = useState(false);+ const [error, setError] = useState<string | null>(null);++ // Repaint whenever the pane's screen changes (and for the cursor blink).+ const tileRef = useRef(tile);+ tileRef.current = tile;+ useEffect(() => {+ let frame = 0;+ let painted = "";+ const paint = () => {+ frame = requestAnimationFrame(paint);+ const el = canvas.current;+ if (!el) return;+ const dpr = Math.min(2, window.devicePixelRatio || 1);+ const w = Math.round(el.clientWidth * dpr), h = Math.round(el.clientHeight * dpr);+ const blink = Math.floor(performance.now() / 530) % 2 === 0;+ const stamp = `${tileStamp(tileRef.current)}|${w}x${h}|${blink}`;+ if (stamp === painted || w === 0 || h === 0) return;+ painted = stamp;+ if (el.width !== w) el.width = w;+ if (el.height !== h) el.height = h;+ const ctx = el.getContext("2d");+ if (!ctx) return;+ const shot = tileSnapshot(tileRef.current);+ paintTerminalTile(ctx, 0, 0, w, h, shot.header, shot.snap, blink);+ };+ paint();+ return () => cancelAnimationFrame(frame);+ }, []);++ const onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {+ if (leavesTakeover(e)) { e.preventDefault(); onClose(); return; }+ // Ctrl+V / Shift+Insert paste through the paste event below.+ if ((e.ctrlKey && e.key.toLowerCase() === "v") || (e.shiftKey && e.key === "Insert")) return;+ const data = keyToTerminalData(e);+ if (data === null) return;+ e.preventDefault();+ e.stopPropagation();+ typeIntoPane(tile, data);+ };+ const onPaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {+ const text = e.clipboardData.getData("text");+ e.preventDefault();+ // Bracketed so a TUI takes a multi-line paste as one paste, not as Enter presses.+ if (text) typeIntoPane(tile, `\x1b[200~${text}\x1b[201~`);+ };++ const send = async () => {+ const prompt = draft.trim();+ if (!prompt || sending) return;+ setSending(true);+ setError(null);+ try {+ await promptTerminal(tile.names[0], prompt, { workspaceId: tile.workspaceId, compose: false });+ setDraft("");+ } catch (err) {+ setError(err instanceof Error ? err.message : String(err));+ } finally {+ setSending(false);+ }+ };++ return (+ <VerseDialog+ title={`${t("verse.takeover.title")} · ${tile.header.title}`}+ closeLabel={t("verse.card.close")}+ onClose={onClose}+ className="verse-takeover"+ initialFocus={live ? keys : undefined}+ escapeCloses={false}+ >+ <div className="verse-takeover-screen" onMouseDown={(e) => { if (live) { e.preventDefault(); keys.current?.focus(); } }}>+ <canvas ref={canvas} className="verse-takeover-canvas" aria-label={tile.header.title} />+ {live && (+ <textarea+ ref={keys}+ className="verse-takeover-keys"+ aria-label={t("verse.takeover.keys")}+ value=""+ onChange={() => undefined}+ onKeyDown={onKeyDown}+ onPaste={onPaste}+ spellCheck={false}+ autoComplete="off"+ />+ )}+ </div>+ {live ? (+ <p className="verse-takeover-hint">{t("verse.takeover.hint_live")}</p>+ ) : (+ <form className="verse-takeover-prompt" onSubmit={(e) => { e.preventDefault(); void send(); }}>+ <input+ className="verse-takeover-input"+ value={draft}+ onChange={(e) => setDraft(e.target.value)}+ onKeyDown={(e) => { if (leavesTakeover(e)) { e.preventDefault(); onClose(); } }}+ placeholder={t("verse.takeover.placeholder")}+ aria-label={t("verse.takeover.placeholder")}+ autoFocus+ />+ <button type="submit" className="verse-btn" data-primary="true" disabled={sending || !draft.trim()}>{t("verse.takeover.send")}</button>+ {error && <p className="verse-takeover-error" role="alert">{error}</p>}+ </form>+ )}+ </VerseDialog>+ );+}diff --git a/dodaios/ui/web/frontend/src/components/society/verse/hud/VerseDialog.tsx b/dodaios/ui/web/frontend/src/components/society/verse/hud/VerseDialog.tsxindex 50c21ba748..5f4ecc3a61 100644--- a/dodaios/ui/web/frontend/src/components/society/verse/hud/VerseDialog.tsx+++ b/dodaios/ui/web/frontend/src/components/society/verse/hud/VerseDialog.tsx@@ -36,10 +36,12 @@ interface Props {initialFocus?: RefObject<HTMLElement | null>;/** False when the caller outlives the dialog and puts focus back itself. */returnFocus?: boolean;+ /** False when Escape belongs to what the dialog holds (a taken-over terminal); the close button still closes. */+ escapeCloses?: boolean;children: ReactNode;}-export function VerseDialog({ title, closeLabel, onClose, className, initialFocus, returnFocus = true, children }: Props) {+export function VerseDialog({ title, closeLabel, onClose, className, initialFocus, returnFocus = true, escapeCloses = true, children }: Props) {useReturnFocus(returnFocus);return (<Dialog.Root open onOpenChange={(open) => { if (!open) onClose(); }}>@@ -55,7 +57,7 @@ export function VerseDialog({ title, closeLabel, onClose, className, initialFocu// useReturnFocus puts the opener back; Radix would aim at a trigger these dialogs do not have.onCloseAutoFocus={(e) => e.preventDefault()}// Escape closes the dialog only, not the stage's selection behind it.- onEscapeKeyDown={(e) => e.stopPropagation()}+ onEscapeKeyDown={(e) => { if (escapeCloses) e.stopPropagation(); else e.preventDefault(); }}><header className="verse-dialog-head"><Dialog.Title asChild>diff --git a/dodaios/ui/web/frontend/src/components/society/verse/hud/takeover.test.tsx b/dodaios/ui/web/frontend/src/components/society/verse/hud/takeover.test.tsxnew file mode 100644index 0000000000..5d83457443--- /dev/null+++ b/dodaios/ui/web/frontend/src/components/society/verse/hud/takeover.test.tsx@@ -0,0 +1,66 @@+import { fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";+import type { Terminal } from "@xterm/xterm";+import { PANE_INPUT_EVENT, type PaneInputDetail } from "@/components/agentic/ideHotkeys";+import { registerLiveTerminal } from "@/lib/liveTerminals";+import { keyToTerminalData, leavesTakeover } from "../effects/terminalKeys";+import { TakeoverPanel } from "./TakeoverPanel";++const key = (k: string, mods: Partial<{ ctrlKey: boolean; altKey: boolean; metaKey: boolean; shiftKey: boolean }> = {}) =>+ ({ key: k, ctrlKey: false, altKey: false, metaKey: false, shiftKey: false, ...mods });++describe("keys to a taken-over terminal", () => {+ it("sends what a terminal sends", () => {+ expect(keyToTerminalData(key("a"))).toBe("a");+ expect(keyToTerminalData(key("A", { shiftKey: true }))).toBe("A");+ expect(keyToTerminalData(key("Enter"))).toBe("\r");+ expect(keyToTerminalData(key("Backspace"))).toBe("\x7f");+ expect(keyToTerminalData(key("Escape"))).toBe("\x1b");+ expect(keyToTerminalData(key("ArrowUp"))).toBe("\x1b[A");+ expect(keyToTerminalData(key("Tab", { shiftKey: true }))).toBe("\x1b[Z");+ expect(keyToTerminalData(key("c", { ctrlKey: true }))).toBe("\x03");+ expect(keyToTerminalData(key("b", { altKey: true }))).toBe("\x1bb");+ expect(keyToTerminalData(key("Shift", { shiftKey: true }))).toBeNull();+ expect(keyToTerminalData(key("F5"))).toBeNull();+ });++ it("leaves on Ctrl+Q only", () => {+ expect(leavesTakeover(key("q", { ctrlKey: true }))).toBe(true);+ expect(leavesTakeover(key("Escape"))).toBe(false);+ expect(leavesTakeover(key("q"))).toBe(false);+ });+});++describe("TakeoverPanel", () => {+ const t = (k: string) => k;+ const tile = { header: { title: "Mika", status: "Working", tone: "live" as const }, workspaceId: "ws1", names: ["mika", "mika"] };+ let unregister: (() => void) | null = null;+ afterEach(() => { unregister?.(); unregister = null; });++ it("types every key into the live pane without taking its focus, once per pane, and Ctrl+Q leaves", () => {+ const term = { cols: 80, rows: 24, buffer: { active: { length: 0, viewportY: 0, getLine: () => undefined, cursorX: 0, cursorY: 0 } }, options: { theme: {} } } as unknown as Terminal;+ unregister = registerLiveTerminal("ws1", "mika", term);+ const seen: PaneInputDetail[] = [];+ const listen = (e: Event) => seen.push((e as CustomEvent<PaneInputDetail>).detail);+ window.addEventListener(PANE_INPUT_EVENT, listen);+ const onClose = vi.fn();+ render(<TakeoverPanel tile={tile} t={t} onClose={onClose} />);+ const keys = screen.getByLabelText("verse.takeover.keys");+ fireEvent.keyDown(keys, { key: "h" });+ fireEvent.keyDown(keys, { key: "Enter" });+ fireEvent.keyDown(keys, { key: "Escape" });+ expect(seen.map((d) => d.data)).toEqual(["h", "\r", "\x1b"]);+ expect(seen.every((d) => d.focus === false && d.workspaceId === "ws1" && d.pane === "mika")).toBe(true);+ // Escape went to the agent; the terminal stays open.+ expect(onClose).not.toHaveBeenCalled();+ fireEvent.keyDown(keys, { key: "q", ctrlKey: true });+ expect(onClose).toHaveBeenCalledTimes(1);+ window.removeEventListener(PANE_INPUT_EVENT, listen);+ });++ it("offers a prompt line for a pane the IDE has not mounted", () => {+ render(<TakeoverPanel tile={{ ...tile, workspaceId: "elsewhere" }} t={t} onClose={() => undefined} />);+ expect(screen.queryByLabelText("verse.takeover.keys")).toBeNull();+ expect(screen.getByPlaceholderText("verse.takeover.placeholder")).toBeTruthy();+ });+});diff --git a/dodaios/ui/web/frontend/src/components/society/verse/verse.css b/dodaios/ui/web/frontend/src/components/society/verse/verse.cssindex 6af3eecf18..2da5dfce60 100644--- a/dodaios/ui/web/frontend/src/components/society/verse/verse.css+++ b/dodaios/ui/web/frontend/src/components/society/verse/verse.css@@ -540,3 +540,14 @@@media (prefers-reduced-motion: reduce) {.verse-switch i { transition: none; }}++/* A desk terminal the commander has taken over: the pane large, the keyboard to the agent. */+.verse-dialog.verse-takeover { width: min(1180px, calc(100% - 32px)); }+.verse-takeover-screen { position: relative; height: min(64vh, 680px); background: #0b0c0f; cursor: text; }+.verse-takeover-canvas { display: block; width: 100%; height: 100%; }+.verse-takeover-screen:focus-within { outline: 1px solid var(--verse-line-strong); outline-offset: -1px; }+.verse-takeover-keys { position: absolute; inset: 0; opacity: 0; resize: none; border: 0; padding: 0; caret-color: transparent; cursor: text; }+.verse-takeover-hint { margin: 0; padding: 10px 14px; font-size: 12px; color: var(--verse-ink); opacity: 0.7; }+.verse-takeover-prompt { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; }+.verse-takeover-input { flex: 1 1 260px; min-width: 0; padding: 8px 10px; background: transparent; color: var(--verse-ink); border: 1px solid var(--verse-line-strong); font: inherit; font-size: 13px; }+.verse-takeover-error { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--verse-red); }diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.jsonindex 82197f7feb..25023635e7 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json@@ -260,6 +260,14 @@"board": {"on": "Hoverboard ausgeklappt: WASD gleitet, Shift gibt Schub. B klappt es wieder ein.","off": "Hoverboard eingeklappt."+ },+ "takeover": {+ "title": "Terminal",+ "action": "Terminal übernehmen",+ "keys": "Tastatur an den Agenten",+ "hint_live": "Deine Tasten gehen direkt an den Agenten: tippen, Enter schickt ab, Esc unterbricht ihn, Strg+V fügt ein. Strg+Q verlässt das Terminal.",+ "placeholder": "Prompt für diesen Agenten",+ "send": "Senden"}}}diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.jsonindex 3a39eba43c..9b0df71329 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json@@ -260,6 +260,14 @@"board": {"on": "Hoverboard out: WASD glides, Shift boosts. B folds it away.","off": "Hoverboard folded away."+ },+ "takeover": {+ "title": "Terminal",+ "action": "Take over the terminal",+ "keys": "Keyboard to the agent",+ "hint_live": "Your keys go straight to the agent: type, Enter sends, Esc interrupts it, Ctrl+V pastes. Ctrl+Q leaves the terminal.",+ "placeholder": "Prompt for this agent",+ "send": "Send"}}}diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.jsonindex fd238fbc4f..f862047022 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json@@ -260,6 +260,14 @@"board": {"on": "Hoverboard desplegado: WASD planea, Shift da impulso. B lo pliega.","off": "Hoverboard plegado."+ },+ "takeover": {+ "title": "Terminal",+ "action": "Tomar el terminal",+ "keys": "Teclado al agente",+ "hint_live": "Tus teclas van directamente al agente: escribe, Intro envía, Esc lo interrumpe, Ctrl+V pega. Ctrl+Q sale del terminal.",+ "placeholder": "Prompt para este agente",+ "send": "Enviar"}}}diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.jsonindex 8af1414d0b..4a003df99d 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json@@ -260,6 +260,14 @@"board": {"on": "Hoverboard aberto: WASD desliza, Shift dá impulso. B o recolhe.","off": "Hoverboard recolhido."+ },+ "takeover": {+ "title": "Terminal",+ "action": "Assumir o terminal",+ "keys": "Teclado para o agente",+ "hint_live": "Suas teclas vão direto para o agente: digite, Enter envia, Esc o interrompe, Ctrl+V cola. Ctrl+Q sai do terminal.",+ "placeholder": "Prompt para este agente",+ "send": "Enviar"}}}diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.jsonindex 175dc4fea0..bf66885159 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json@@ -260,6 +260,14 @@"board": {"on": "悬浮板已展开:WASD 滑行,Shift 加速。按 B 收起。","off": "悬浮板已收起。"+ },+ "takeover": {+ "title": "终端",+ "action": "接管终端",+ "keys": "键盘输入给代理",+ "hint_live": "按键直接发送给代理:输入文字,Enter 发送,Esc 中断,Ctrl+V 粘贴。Ctrl+Q 离开终端。",+ "placeholder": "给这个代理的提示",+ "send": "发送"}}}