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(office): give the session panel a live terminal window

rubenluetke10-beep8ee2c3f18c40
diff --git a/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx b/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx
index e85f354863..4601c0052b 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx
@@ -1,6 +1,6 @@
/**
- * A coding session on the coding floor, as a command panel: the live terminal
- * screen, a box to prompt the agent directly, one-tap orders, the recent
+ * A coding session on the coding floor, as a command panel: a small live
+ * window onto its terminal, a box to prompt the agent directly, one-tap orders, the recent
* prompts, and the session actions (open, stop, fork, close) next to the map
* actions (walk there, call over, show).
*
@@ -14,20 +14,15 @@ import { useT } from "@/i18n";
import {
closeTerminal, fetchPromptHistory, forkTerminal, interruptTerminal, promptTerminal, type PromptHistoryItem,
} from "@/lib/agenticIdeApi";
-import { fetchPaneScreens } from "@/lib/paneScreensApi";
import { useWorkspacePanesStore } from "@/store/workspacePanes";
import type { PaneOccupant } from "./codingFloor";
import { player, useOfficeStore } from "./officeStore";
import { agentPositions } from "./walkerRegistry";
import { CALL_MS } from "./AgentTalkPanel";
+import { PaneLiveScreen } from "./PaneLiveScreen";
import "./officeTalk.css";
import "./missionControl.css";
-/** The live screen refreshes this often while the panel is open (jittered, AP-33). */
-const SCREEN_MS = 1100;
-const SCREEN_JITTER_MS = 400;
-/** Terminal rows the panel shows: the bottom of the screen, where the agent writes. */
-const SCREEN_ROWS = 12;
/** Recent prompts offered for re-use. */
const HISTORY_ITEMS = 4;
/** A second press within this window confirms closing the session. */
@@ -36,13 +31,6 @@ const CONFIRM_MS = 4000;
/** One-tap orders; the label is the chip, the text is what the agent receives. */
export const QUICK_ORDERS = ["continue", "status", "tests", "commit"] as const;
-/** The bottom `rows` non-empty-trailing rows of a screen. Pure. */
-export function screenTail(lines: readonly string[], rows: number): string[] {
- let end = lines.length;
- while (end > 0 && !lines[end - 1].trim()) end -= 1;
- return lines.slice(Math.max(0, end - rows), end);
-}
-
function sinceLabel(at: number | null, t: (key: string) => string): string {
if (!at) return "";
const seconds = Math.max(0, Date.now() / 1000 - at);
@@ -52,31 +40,6 @@ function sinceLabel(at: number | null, t: (key: string) => string): string {
return t("society.office.since_days").replace("{0}", String(Math.floor(seconds / 86400)));
}
-function useLiveScreen(workspaceId: string, key: string): string[] | null {
- const [rows, setRows] = useState<string[] | null>(null);
- useEffect(() => {
- let alive = true;
- let timer: ReturnType<typeof setTimeout>;
- let failing = false;
- setRows(null);
- const tick = async () => {
- try {
- const [screen] = await fetchPaneScreens([{ workspaceId, key }]);
- if (alive) setRows(screen ? screenTail(screen.lines, SCREEN_ROWS) : []);
- failing = false;
- } catch (err) {
- // The last good screen stays up; only the first failure of a streak is worth a line.
- if (!failing) console.warn("Pane screen unavailable", err);
- failing = true;
- }
- if (alive) timer = setTimeout(() => void tick(), SCREEN_MS + Math.random() * SCREEN_JITTER_MS);
- };
- void tick();
- return () => { alive = false; clearTimeout(timer); };
- }, [workspaceId, key]);
- return rows;
-}
-
type Note = { tone: "ok" | "error"; text: string } | null;
export function PaneCommandPanel({ occupant, onOpen, onClose }: { occupant: PaneOccupant; onOpen: () => void; onClose: () => void }) {
@@ -92,7 +55,6 @@ export function PaneCommandPanel({ occupant, onOpen, onClose }: { occupant: Pane
const [note, setNote] = useState<Note>(null);
const [confirmClose, setConfirmClose] = useState(false);
const [history, setHistory] = useState<PromptHistoryItem[]>([]);
- const screen = useLiveScreen(pane.workspace_id, pane.key);
const where = agentPositions.get(agent.agentId);
const live = pane.status === "live";
const canPrompt = live && pane.accepts_prompts;
@@ -184,59 +146,62 @@ export function PaneCommandPanel({ occupant, onOpen, onClose }: { occupant: Pane
<button type="button" className="office-icon-button" onClick={onClose} aria-label={t("society.office.close")}>×</button>
</header>
- {recap && <p className="office-cmd-topic" title={recap}><strong>{t("society.office.pane_recap")}</strong> {recap}</p>}
-
- <pre className="office-cmd-screen" aria-label={t("society.office.cmd_screen").replace("{0}", agent.name)} aria-live="off">
- {screen === null ? t("society.office.cmd_screen_loading") : screen.length === 0 ? t("society.office.cmd_screen_empty") : screen.join("\n")}
- </pre>
+ <div className="office-cmd-body">
+ <PaneLiveScreen workspaceId={pane.workspace_id} paneKey={pane.key} title={pane.display_name || pane.name}
+ dot={occupant.dot} stateLabel={t(`society.office.pane_state_${occupant.stateKey}`)} agentName={agent.name} onOpen={onOpen} />
- <div className="office-cmd-quick" role="group" aria-label={t("society.office.cmd_quick")}>
- {QUICK_ORDERS.map((order) => (
- <button key={order} type="button" disabled={!canPrompt || sending} title={t(`society.office.cmd_order_${order}_text`)}
- onClick={() => void send(t(`society.office.cmd_order_${order}_text`))}>
- {t(`society.office.cmd_order_${order}`)}
- </button>
- ))}
- </div>
-
- <div className="office-talk-composer">
- <textarea ref={input} rows={1} value={value} maxLength={8000} disabled={!canPrompt}
- placeholder={t("society.office.cmd_placeholder").replace("{0}", agent.name)}
- aria-label={t("society.office.cmd_placeholder").replace("{0}", agent.name)}
- onChange={(e) => setValue(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); void send(value); }
- // Escape leaves the box so the arrow keys walk again; a second Escape closes the panel.
- else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); panel.current?.focus({ preventScroll: true }); }
- }} />
- {working && !value.trim()
- ? <button type="button" className="office-talk-send" data-stop onClick={stop}
- aria-label={t("society.office.cmd_stop")} title={t("society.office.cmd_stop")}><Square aria-hidden /></button>
- : <button type="button" className="office-talk-send" disabled={!canPrompt || sending || !value.trim()} onClick={() => void send(value)}
- aria-label={t("society.office.cmd_send")} title={t("society.office.cmd_send")}><ArrowUp aria-hidden /></button>}
- </div>
- <div className="office-cmd-row">
- <label className="office-cmd-check">
- <input type="checkbox" checked={sharpen} onChange={(e) => setSharpen(e.target.checked)} />
- <span>{t("society.office.cmd_sharpen")}</span>
- </label>
- <span className="office-talk-status" role="status" data-tone={note?.tone}>{sending ? t("society.office.cmd_sending") : note?.text ?? status}</span>
- </div>
+ <div className="office-cmd-side">
+ {recap && <p className="office-cmd-topic" title={recap}><strong>{t("society.office.pane_recap")}</strong> {recap}</p>}
- {history.length > 0 && (
- <details className="office-cmd-history">
- <summary>{t("society.office.cmd_history").replace("{0}", String(history.length))}</summary>
- <ul>
- {history.map((item) => (
- <li key={item.id}>
- <button type="button" title={t("society.office.cmd_reuse")} onClick={() => { setValue(item.text); input.current?.focus(); }}>
- {item.text}
- </button>
- </li>
+ <div className="office-cmd-quick" role="group" aria-label={t("society.office.cmd_quick")}>
+ {QUICK_ORDERS.map((order) => (
+ <button key={order} type="button" disabled={!canPrompt || sending} title={t(`society.office.cmd_order_${order}_text`)}
+ onClick={() => void send(t(`society.office.cmd_order_${order}_text`))}>
+ {t(`society.office.cmd_order_${order}`)}
+ </button>
))}
- </ul>
- </details>
- )}
+ </div>
+
+ <div className="office-talk-composer">
+ <textarea ref={input} rows={1} value={value} maxLength={8000} disabled={!canPrompt}
+ placeholder={t("society.office.cmd_placeholder").replace("{0}", agent.name)}
+ aria-label={t("society.office.cmd_placeholder").replace("{0}", agent.name)}
+ onChange={(e) => setValue(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); void send(value); }
+ // Escape leaves the box so the arrow keys walk again; a second Escape closes the panel.
+ else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); panel.current?.focus({ preventScroll: true }); }
+ }} />
+ {working && !value.trim()
+ ? <button type="button" className="office-talk-send" data-stop onClick={stop}
+ aria-label={t("society.office.cmd_stop")} title={t("society.office.cmd_stop")}><Square aria-hidden /></button>
+ : <button type="button" className="office-talk-send" disabled={!canPrompt || sending || !value.trim()} onClick={() => void send(value)}
+ aria-label={t("society.office.cmd_send")} title={t("society.office.cmd_send")}><ArrowUp aria-hidden /></button>}
+ </div>
+ <div className="office-cmd-row">
+ <label className="office-cmd-check">
+ <input type="checkbox" checked={sharpen} onChange={(e) => setSharpen(e.target.checked)} />
+ <span>{t("society.office.cmd_sharpen")}</span>
+ </label>
+ <span className="office-talk-status" role="status" data-tone={note?.tone}>{sending ? t("society.office.cmd_sending") : note?.text ?? status}</span>
+ </div>
+
+ {history.length > 0 && (
+ <details className="office-cmd-history">
+ <summary>{t("society.office.cmd_history").replace("{0}", String(history.length))}</summary>
+ <ul>
+ {history.map((item) => (
+ <li key={item.id}>
+ <button type="button" title={t("society.office.cmd_reuse")} onClick={() => { setValue(item.text); input.current?.focus(); }}>
+ {item.text}
+ </button>
+ </li>
+ ))}
+ </ul>
+ </details>
+ )}
+ </div>
+ </div>
<div className="office-talk-tools office-cmd-tools" role="toolbar" aria-label={t("society.office.talk_tools")}>
<button type="button" onClick={onOpen} title={t("society.office.pane_open")}>
diff --git a/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx b/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx
new file mode 100644
index 0000000000..067d24f341
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx
@@ -0,0 +1,148 @@
+/**
+ * A small live window onto one coding session's terminal, for the session's
+ * command panel: a title bar with the run state and a "Live" beat, and below
+ * it the bottom of the real screen, cursor included, with the font fitted to
+ * the pane's own column count so a narrow TUI fills the window instead of
+ * hugging its left edge.
+ *
+ * It reads the same in-memory screen feed as the desk monitors, at their
+ * near-live rate, jittered (AP-33); an unchanged screen never re-renders.
+ */
+import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from "react";
+import { Maximize2 } from "lucide-react";
+import { useT } from "@/i18n";
+import { fetchPaneScreens, type PaneScreen } from "@/lib/paneScreensApi";
+import { screenChanged, visibleRows } from "./terminalScreen";
+
+const POLL_MIN_MS = 450;
+const POLL_JITTER_MS = 250;
+/** Font bounds in CSS pixels: a wide TUI shrinks the text, a narrow one never blows it up. */
+const MIN_FONT = 10, MAX_FONT = 14;
+/** Wider terminals than this are cut on the right rather than shrunk further. */
+const MAX_FIT_COLS = 120;
+/** A monospace glyph is about this wide per pixel of font size. */
+const CHAR_RATIO = 0.6;
+const LINE_RATIO = 1.3;
+/** Inner padding of the screen, matching `.office-live-body` in the CSS. */
+const PAD = 10;
+
+export interface LiveGrid { font: number; lineH: number; cols: number; fit: number }
+
+/** Font and grid for a terminal `cols` wide in a box of `width` x `height`. Pure. */
+export function liveGrid(cols: number, width: number, height: number): LiveGrid {
+ const inner = Math.max(0, width - 2 * PAD);
+ const want = Math.max(20, Math.min(cols || 80, MAX_FIT_COLS));
+ const font = Math.max(MIN_FONT, Math.min(MAX_FONT, Math.floor(inner / (want * CHAR_RATIO))));
+ const lineH = Math.round(font * LINE_RATIO);
+ return {
+ font,
+ lineH,
+ cols: Math.max(1, Math.floor(inner / (font * CHAR_RATIO))),
+ fit: Math.max(1, Math.floor((height - 2 * PAD) / lineH)),
+ };
+}
+
+function useLiveScreen(workspaceId: string, key: string): PaneScreen | null | undefined {
+ // undefined = not loaded yet, null = the feed does not know this pane.
+ const [screen, setScreen] = useState<PaneScreen | null | undefined>(undefined);
+ useEffect(() => {
+ let alive = true;
+ let failing = false;
+ let timer: ReturnType<typeof setTimeout>;
+ setScreen(undefined);
+ const tick = async () => {
+ try {
+ const [next] = await fetchPaneScreens([{ workspaceId, key }]);
+ if (!alive) return;
+ failing = false;
+ setScreen((prev) => (next ? (prev && !screenChanged(prev, next) ? prev : next) : null));
+ } catch (err) {
+ // The last good screen stays up; only the first failure of a streak is worth a line.
+ if (!failing) console.warn("Pane screen unavailable", err);
+ failing = true;
+ }
+ if (alive) timer = setTimeout(() => void tick(), POLL_MIN_MS + Math.random() * POLL_JITTER_MS);
+ };
+ timer = setTimeout(() => void tick(), Math.random() * POLL_JITTER_MS);
+ return () => { alive = false; clearTimeout(timer); };
+ }, [workspaceId, key]);
+ return screen;
+}
+
+function useBoxSize(ref: RefObject<HTMLElement | null>): { width: number; height: number } {
+ const [size, setSize] = useState({ width: 0, height: 0 });
+ useLayoutEffect(() => {
+ const el = ref.current;
+ if (!el) return;
+ const measure = () => {
+ const width = el.clientWidth, height = el.clientHeight;
+ setSize((prev) => (prev.width === width && prev.height === height ? prev : { width, height }));
+ };
+ measure();
+ if (typeof ResizeObserver === "undefined") return;
+ const observer = new ResizeObserver(measure);
+ observer.observe(el);
+ return () => observer.disconnect();
+ }, [ref]);
+ return size;
+}
+
+export function PaneLiveScreen({ workspaceId, paneKey, title, dot, stateLabel, agentName, onOpen }: {
+ workspaceId: string;
+ paneKey: string;
+ title: string;
+ /** The IDE's dot reading of the pane: working / waiting / idle / error. */
+ dot: string;
+ stateLabel: string;
+ agentName: string;
+ onOpen: () => void;
+}) {
+ const t = useT();
+ const body = useRef<HTMLDivElement>(null);
+ const screen = useLiveScreen(workspaceId, paneKey);
+ const { width, height } = useBoxSize(body);
+ const grid = liveGrid(screen?.cols ?? 80, width, height);
+ const view = screen ? visibleRows(screen.lines, grid.fit, screen.cursor) : null;
+ const cursor = screen?.cursor && view ? [screen.cursor[0] - view.first, screen.cursor[1]] as const : null;
+ const working = dot === "working";
+ const empty = !view || view.rows.every((row) => !row.trim());
+
+ return (
+ <section className="office-live" data-dot={dot} aria-label={t("society.office.cmd_screen").replace("{0}", agentName)}>
+ <header className="office-live-bar">
+ <i className="office-dot" data-dot={dot} aria-hidden />
+ <span className="office-live-title" title={title}>{title}</span>
+ <span className="office-live-state">{stateLabel}</span>
+ {working && <span className="office-live-beat">{t("society.office.cmd_live")}</span>}
+ {screen && <span className="office-live-size">{screen.cols}×{screen.rows}</span>}
+ <button type="button" className="office-live-open" onClick={onOpen}
+ title={t("society.office.cmd_screen_open")} aria-label={t("society.office.cmd_screen_open")}>
+ <Maximize2 aria-hidden />
+ </button>
+ </header>
+ <div ref={body} className="office-live-body" onDoubleClick={onOpen}>
+ {empty ? (
+ <p className="office-live-empty">
+ {screen === undefined ? t("society.office.cmd_screen_loading") : t("society.office.cmd_screen_empty")}
+ </p>
+ ) : (
+ <pre className="office-live-rows" aria-live="off" style={{ fontSize: grid.font, lineHeight: `${grid.lineH}px` }}>
+ {view!.rows.map((row, i) => {
+ const line = row.length > grid.cols ? `${row.slice(0, grid.cols - 1)}…` : row;
+ if (!cursor || cursor[0] !== i || cursor[1] >= grid.cols) return <div key={i}>{line || " "}</div>;
+ const col = cursor[1];
+ const padded = line.padEnd(col + 1, " ");
+ return (
+ <div key={i}>
+ {padded.slice(0, col)}
+ <span className="office-live-cursor">{padded[col]}</span>
+ {padded.slice(col + 1)}
+ </div>
+ );
+ })}
+ </pre>
+ )}
+ </div>
+ </section>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/missionControl.css b/jarvis/ui/web/frontend/src/components/society/office/missionControl.css
index 92ba4ec50b..40e1ddffd8 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/missionControl.css
+++ b/jarvis/ui/web/frontend/src/components/society/office/missionControl.css
@@ -4,7 +4,46 @@
/* ---- session command panel -------------------------------------------- */
.office-cmd-topic { margin:8px 12px 0; font-size:12px; line-height:1.4; color:hsl(var(--muted-foreground)); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.office-cmd-topic strong { color:hsl(var(--foreground)); font-weight:600; margin-right:4px; }
-.office-cmd-screen { margin:8px 10px 0; padding:8px 10px; min-height:72px; max-height:176px; overflow:auto; border-radius:10px; border:1px solid hsl(var(--border)); background:hsl(var(--muted)); color:hsl(var(--foreground)); font:11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space:pre; text-shadow:none; }
+/* The panel reads as one terminal window with its controls beside it: wide
+ (the compact office stretches the panel across the view) puts the live
+ window left and the controls right; narrow stacks them. */
+.office-panel-slot:has(> .office-cmd) { width:min(480px, calc(100% - 28px)); }
+.office-stage-compact .office-panel-slot:has(> .office-cmd) { width:calc(100% - 16px); }
+.office-cmd { container-type:inline-size; }
+.office-cmd-body { display:flex; flex-direction:column; min-height:0; overflow:auto; }
+.office-cmd-side { display:flex; flex-direction:column; min-width:0; }
+.office-live { display:flex; flex-direction:column; margin:10px 10px 0; min-height:0; border:1px solid hsl(var(--border-strong, var(--border))); border-radius:10px; overflow:hidden; background:hsl(var(--muted)); }
+.office-live[data-dot="working"] { border-color:hsl(var(--success) / .55); box-shadow:0 0 0 1px hsl(var(--success) / .15); }
+.office-live[data-dot="waiting"] { border-color:hsl(var(--warning) / .6); }
+.office-live-bar .office-dot[data-dot="working"] { background:hsl(var(--success)); }
+.office-live-bar .office-dot[data-dot="waiting"] { background:hsl(var(--warning)); }
+.office-live[data-dot="error"] { border-color:hsl(var(--destructive) / .55); }
+.office-live-bar { display:flex; align-items:center; gap:7px; min-width:0; padding:5px 6px 5px 10px; border-bottom:1px solid hsl(var(--border)); background:hsl(var(--secondary)); font-size:11px; color:hsl(var(--muted-foreground)); }
+.office-live-title { flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; color:hsl(var(--foreground)); }
+.office-live-state { flex:none; white-space:nowrap; }
+.office-live-beat { flex:none; display:inline-flex; align-items:center; gap:4px; padding:1px 6px; border-radius:6px; background:hsl(var(--success) / .14); color:hsl(var(--success)); font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
+.office-live-beat::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; animation:office-live-beat 1.4s ease-in-out infinite; }
+@keyframes office-live-beat { 50% { opacity:.25; } }
+.office-live-size { flex:none; margin-left:auto; font:10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity:.8; }
+.office-live-open { flex:none; display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; margin-left:auto; border:0; border-radius:6px; background:none; color:hsl(var(--muted-foreground)); cursor:pointer; }
+.office-live-size + .office-live-open { margin-left:2px; }
+.office-live-open svg { width:14px; height:14px; }
+.office-live-open:hover { background:hsl(var(--background)); color:hsl(var(--foreground)); }
+.office-live-open:focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:1px; }
+/* Fixed height, rows absolutely placed: the grid is fitted to this box, so the
+ text can never feed back into its size. */
+.office-live-body { position:relative; height:clamp(150px, 26vh, 240px); cursor:zoom-in; }
+.office-live-rows { position:absolute; inset:10px; margin:0; overflow:hidden; display:flex; flex-direction:column; justify-content:flex-end; color:hsl(var(--foreground)); font-family:ui-monospace, 'Cascadia Mono', SFMono-Regular, Menlo, Consolas, monospace; white-space:pre; text-shadow:none; }
+.office-live-rows > div { overflow:hidden; }
+.office-live-cursor { background:hsl(var(--foreground) / .85); color:hsl(var(--muted)); }
+.office-live-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; margin:0; font-size:12px; color:hsl(var(--muted-foreground)); }
+@container (min-width:720px) {
+ .office-cmd-body { display:grid; grid-template-columns:minmax(0, 1.6fr) minmax(300px, 1fr); align-items:stretch; }
+ .office-cmd-body > .office-live { margin:10px 0 0 10px; }
+ .office-cmd-body .office-live-body { height:auto; flex:1 1 auto; min-height:220px; }
+ .office-cmd-side { justify-content:flex-end; padding-bottom:2px; }
+}
+@media (prefers-reduced-motion:reduce) { .office-live-beat::before { animation:none; } }
.office-cmd-quick { display:flex; flex-wrap:wrap; gap:5px; margin:8px 10px; }
.office-cmd-quick button, .office-mc-chips button { padding:4px 10px; border:1px solid hsl(var(--border)); border-radius:999px; background:hsl(var(--background)); color:hsl(var(--foreground)); font-size:11px; font-weight:600; cursor:pointer; }
.office-cmd-quick button:hover:not(:disabled), .office-mc-chips button:hover:not(:disabled) { background:hsl(var(--secondary)); }
diff --git a/jarvis/ui/web/frontend/src/components/society/office/missionControl.test.ts b/jarvis/ui/web/frontend/src/components/society/office/missionControl.test.ts
index 1387d2030b..57e7727d8c 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/missionControl.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/missionControl.test.ts
@@ -2,7 +2,8 @@ import { describe, expect, it } from "vitest";
import type { AgentStatus } from "@/lib/agenticIdeApi";
import type { PaneOccupant } from "./codingFloor";
import { launchableAgents, pickAll } from "./MissionControlPanel";
-import { QUICK_ORDERS, screenTail } from "./PaneCommandPanel";
+import { QUICK_ORDERS } from "./PaneCommandPanel";
+import { liveGrid } from "./PaneLiveScreen";
const cli = (name: string, extra: Partial<AgentStatus> = {}): AgentStatus => ({
name, display_name: name, installed: true, version: null, install_command: null, ...extra,
@@ -12,10 +13,16 @@ const occupant = (id: string, state: PaneOccupant["agent"]["state"]): PaneOccupa
({ agent: { agentId: id, state } } as PaneOccupant);
describe("pane command panel", () => {
- it("shows the bottom of the terminal, without the blank rows under the cursor", () => {
- expect(screenTail(["a", "b", "c", "", " "], 2)).toEqual(["b", "c"]);
- expect(screenTail(["", ""], 5)).toEqual([]);
- expect(screenTail(["one"], 12)).toEqual(["one"]);
+ it("fits the live window's font to the pane's width, within bounds", () => {
+ // A narrow 40-column TUI in a wide window grows to the cap instead of hugging the left edge.
+ expect(liveGrid(40, 900, 240).font).toBe(14);
+ // A wide 200-column terminal shrinks to the floor and is cut on the right.
+ const wide = liveGrid(200, 500, 240);
+ expect(wide.font).toBe(10);
+ expect(wide.cols).toBe(80);
+ // As many rows as the height holds, never zero.
+ expect(liveGrid(80, 600, 240).fit).toBe(Math.floor(220 / Math.round(liveGrid(80, 600, 240).font * 1.3)));
+ expect(liveGrid(80, 0, 0).fit).toBe(1);
});
it("offers the four one-tap orders", () => {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index 17b6e60910..2d023423d4 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -911,6 +911,8 @@
"cmd_screen": "Live-Bildschirm von {0}",
"cmd_screen_loading": "Bildschirm wird geladen…",
"cmd_screen_empty": "Noch nichts auf dem Bildschirm.",
+ "cmd_live": "Live",
+ "cmd_screen_open": "Ganzes Terminal öffnen",
"cmd_quick": "Schnellaufträge",
"cmd_order_continue": "Weiter",
"cmd_order_continue_text": "Mach weiter.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index f5bab56291..a8aa665abb 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -911,6 +911,8 @@
"cmd_screen": "Live screen of {0}",
"cmd_screen_loading": "Loading the screen…",
"cmd_screen_empty": "Nothing on the screen yet.",
+ "cmd_live": "Live",
+ "cmd_screen_open": "Open the full terminal",
"cmd_quick": "Quick orders",
"cmd_order_continue": "Continue",
"cmd_order_continue_text": "Continue.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index f87a09513f..25155f1038 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -911,6 +911,8 @@
"cmd_screen": "Pantalla en vivo de {0}",
"cmd_screen_loading": "Cargando la pantalla…",
"cmd_screen_empty": "Todavía no hay nada en la pantalla.",
+ "cmd_live": "En vivo",
+ "cmd_screen_open": "Abrir la terminal completa",
"cmd_quick": "Órdenes rápidas",
"cmd_order_continue": "Continuar",
"cmd_order_continue_text": "Continúa.",