Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
feat(tui): the panel is the default, and the banner lives in the transcript (#209)
Abdurrahman Fakhrul70d752cc4a30
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex b1c14e89..013dd510 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh**Added**+- `tui` the panel is the default, and the banner lives in the transcript- `tui` install the print sink the last change forgot, and migrate the modules that still print (#206)- `tui` a suspended panel really leaves the alternate screen, so an approval is readable (#205)- `tui` mid-turn writes go into the panel, and prompts suspend it instead of fighting it (#204)@@ -37,7 +38,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh**Docs**-- `tui` a handover for the panel track, so a pause costs nothing+- `tui` a handover for the panel track, so a pause costs nothing (#208)- handover for the next session, plus the entry this session was missing- `tui` name the four things between here and an alternate screen default (#199)diff --git a/docs/TUI-RENDERER-PLAN.md b/docs/TUI-RENDERER-PLAN.mdindex 292ed5c5..efde0092 100644--- a/docs/TUI-RENDERER-PLAN.md+++ b/docs/TUI-RENDERER-PLAN.md@@ -595,31 +595,33 @@ those two, and mouse/scrollbar/splits are additive after M5.| M5 | Alternate screen behind a flag, with teardown | DONE | PR #192; default off; teardown on exit, signals, execve, spawnSync || M6 | Transcript viewport and scrollbar | DONE | PR #193; 2000-line cap, follow mode, PgUp/PgDn/Ctrl+G/End, entrypoint 218 to 196 lines || M7 | Mouse | DONE | SGR 1000/1006 extended mode, wheel scrolls viewport, tab clicks switch session |-| M8 | Split panes, then flip the alt screen default | PARTIAL | PR #198; right-hand pane for todos, diff, files. Default flip NOT done, blockers in 8.1 |--### 8.1 What remains before the alternate screen can be the default--The pane landed and the flag works, but the default is still `off`. That is not caution about the-renderer, which is now complete. It is that a great deal of the TUI still prints instead of painting:--1. **26 modules print with `console.log`** under `scripts/mso-agent*.mjs` and- `scripts/mso-agent-cmd-*.mjs` (help, inspect, parity, jobs, todos, files, diff, edit diff,- approval UI, mentions, skills, status, layout). In the alternate screen a `console.log` writes at- the cursor, which is inside the frame the loop owns, so the next repaint fights it and a line can- survive in the wrong row. They need one print sink that appends to the viewport in panel mode and- prints as before in inline mode.-2. **DONE** - **The composer reports its row count dynamically**: `AgentComposer` exposes its current- painted row count via an `onRows(rows)` callback and `rowCount()` method. `mountScreenLoop` starts- at `PROMPT_ROWS = 3` and updates its reservation dynamically from reported rows, clamped between- 3 and terminalRows / 4. Verified in `scripts/mso-agent-composer-rows.test.ts`.-3. **Prompts and foreground subagents take over the composer area** (`promptApproval` in- `scripts/mso-agent-approval-ui.mjs`, `runForegroundSubagent`). They are line oriented, so in panel- mode they would need to be painted into the viewport and answered through the same key path.-4. **Turn-level failures bypass the stream sink**: `renderInteractionFailure` writes directly, so an- error raised mid-turn would land outside the frame.--Until those four are done, `--altscreen` stays a development switch, and `--oneshot`, non-TTY and CI-remain excluded by `altScreenRequested` regardless of the flag.+| M8 | Split panes, then flip the alt screen default | DONE | PR #198 the pane; default flipped here, inline is now the opt out (`--no-altscreen`) |++### 8.1 The default is now the panel++The four blockers are closed and the alternate screen is the default:++1. **Print sink**, `scripts/mso-agent-print.mjs`, installed by the screen loop as `session.printSink`+ and consumed by every command module. One whole release was lost here: #202 added the router and+ migrated twelve modules, but nothing installed the sink, so it fell through to `console.log` every+ time and looked correct in the diff. #206 installed it.+2. **Composer height**, reported through `onRows` and reserved exactly, capped at terminal rows minus+ four rather than a quarter of the terminal, which on a 12 row terminal was 3 and made the fix+ inert in the case it existed for.+3. **Approval prompts** suspend the panel, and suspension **leaves the alternate screen**. Detaching+ the sink alone was not enough: the prompt was painted into the buffer and the next repaint erased+ it, so the user answered a question that had vanished.+4. **Mid-turn writes** go through `turnPrinter`, including the activity row, which is forced to+ discrete lines in panel mode because a live spinner row draws at the cursor inside the frame.++The startup banner moved into the transcript for the same reason: it was printed before the first+frame and that frame erased it. The entrypoint captures it through an injectable print and the loop+prepends it to every render, trimmed to its last four lines in panel mode because the full banner is+31 lines and would occupy most of a 30 row viewport.++Inline mode is now the opt out, not the default: `--no-altscreen` or `MSO_ALT_SCREEN=0`. Non-TTY, CI+and `--oneshot` are still refused regardless, and an explicit opt out is silent rather than merely+inactive.Adjacent work that landed while this plan was being executed, and belongs to the same goal:`feat/agent-jobs-view` (#183, `/jobs` for background subagents) and `feat/tui-keybinds` (#182,diff --git a/scripts/mso-agent-altscreen.mjs b/scripts/mso-agent-altscreen.mjsindex 71fe5d68..3adb0757 100644--- a/scripts/mso-agent-altscreen.mjs+++ b/scripts/mso-agent-altscreen.mjs@@ -21,31 +21,31 @@ export function altScreenRequested({const args = Array.isArray(argv) ? argv : [];const environment = env || {};- const requested = Boolean(- args.includes("--altscreen") ||- args.includes("--alt-screen") ||- environment.MSO_ALT_SCREEN === "1" ||- environment.MSO_ALTSCREEN === "1"- );-- if (!requested) {- return { ok: false, enabled: false, requested: false, reason: "not_requested" };+ // The panel is the default now. Inline mode is the opt OUT, because a user who wants their+ // terminal's own scrollback has no other way to ask for it. `requested` still distinguishes "the+ // default" from "asked and refused" so the entrypoint only warns when the user actually asked.+ const declined = args.includes("--no-altscreen") || environment.MSO_ALT_SCREEN === "0" || environment.MSO_ALTSCREEN === "0";+ const explicit = args.includes("--altscreen") || args.includes("--alt-screen")+ || environment.MSO_ALT_SCREEN === "1" || environment.MSO_ALTSCREEN === "1";+ const requested = explicit || !declined;+ if (declined) {+ return { ok: false, enabled: false, requested: false, reason: "declined" };}if (isTTY !== true) {- return { ok: false, enabled: false, requested: true, reason: "not_tty" };+ return { ok: false, enabled: false, requested, reason: "not_tty" };}const ci = environment.CI;if (Boolean(ci && ci !== "0" && ci !== "false")) {- return { ok: false, enabled: false, requested: true, reason: "ci_environment" };+ return { ok: false, enabled: false, requested, reason: "ci_environment" };}if (args.includes("--oneshot") || args.includes("-z")) {- return { ok: false, enabled: false, requested: true, reason: "oneshot_mode" };+ return { ok: false, enabled: false, requested, reason: "oneshot_mode" };}- return { ok: true, enabled: true, requested: true, reason: null };+ return { ok: true, enabled: true, requested, reason: null };}// Enters alternate screen mode idempotently.diff --git a/scripts/mso-agent-altscreen.test.ts b/scripts/mso-agent-altscreen.test.tsindex ae9642ff..16d4bb1a 100644--- a/scripts/mso-agent-altscreen.test.ts+++ b/scripts/mso-agent-altscreen.test.ts@@ -21,25 +21,26 @@ class FakeOutput {}describe("MSO Agent alternate screen manager", () => {- it("no flag, no TTY, CI set, and one-shot mode each return false with a distinct reason", () => {- const noFlag = altScreenRequested({ argv: [], env: {}, isTTY: true });- expect(noFlag.ok).toBe(false);- expect(noFlag.reason).toBe("not_requested");-- const noTty = altScreenRequested({ argv: ["--altscreen"], env: {}, isTTY: false });+ it("no TTY, CI, one-shot and an explicit opt out each refuse with their own reason", () => {+ // The panel is the default, so the interesting cases are the four ways to be refused rather than+ // the four ways to ask for it.+ const declined = altScreenRequested({ argv: ["--no-altscreen"], env: {}, isTTY: true });+ expect(declined.ok).toBe(false);+ expect(declined.reason).toBe("declined");++ const noTty = altScreenRequested({ argv: [], env: {}, isTTY: false });expect(noTty.ok).toBe(false);expect(noTty.reason).toBe("not_tty");- const ciSet = altScreenRequested({ argv: ["--altscreen"], env: { CI: "true" }, isTTY: true });+ const ciSet = altScreenRequested({ argv: [], env: { CI: "true" }, isTTY: true });expect(ciSet.ok).toBe(false);expect(ciSet.reason).toBe("ci_environment");- const oneShot = altScreenRequested({ argv: ["--altscreen", "--oneshot", "inspect"], env: {}, isTTY: true });+ const oneShot = altScreenRequested({ argv: ["--oneshot", "inspect"], env: {}, isTTY: true });expect(oneShot.ok).toBe(false);expect(oneShot.reason).toBe("oneshot_mode");- const reasons = [noFlag.reason, noTty.reason, ciSet.reason, oneShot.reason];- expect(new Set(reasons).size).toBe(4);+ expect(new Set([declined.reason, noTty.reason, ciSet.reason, oneShot.reason]).size).toBe(4);});it("the flag plus a TTY returns true", () => {@@ -48,11 +49,16 @@ describe("MSO Agent alternate screen manager", () => {expect(result.reason).toBe(null);});- it("default is OFF and behaviour is byte-identical with no writes", () => {+ it("the panel is the default, and opting out writes nothing", () => {+ const onByDefault = altScreenRequested({ argv: [], env: {}, isTTY: true });+ expect(onByDefault.ok).toBe(true);++ // Opting out must be silent, not merely inactive: a user asking for their own scrollback should+ // not have escape sequences written at them.const output = new FakeOutput();- const result = altScreenRequested({ argv: [], env: {}, isTTY: true });- expect(result.ok).toBe(false);- if (result.ok) enterScreen(output);+ const declined = altScreenRequested({ argv: ["--no-altscreen"], env: {}, isTTY: true });+ expect(declined.ok).toBe(false);+ if (declined.ok) enterScreen(output);expect(output.chunks.length).toBe(0);});diff --git a/scripts/mso-agent-banner-lines.mjs b/scripts/mso-agent-banner-lines.mjsnew file mode 100644index 00000000..1a5c57af--- /dev/null+++ b/scripts/mso-agent-banner-lines.mjs@@ -0,0 +1,20 @@+// The startup banner belongs to the transcript, not to the screen it happens to be printed on. In+// panel mode a banner written before the first frame is erased by that frame, so the entrypoint+// captures it and the loop prepends it to every render instead.+export function withPreamble(preamble, lines) {+ const head = Array.isArray(preamble) ? preamble : [];+ if (!head.length) return lines;+ return [...head, "", ...lines];+}++// Collects banner output through printAgentBanner's injectable print, so nothing is written to the+// terminal before the panel owns it. `keep` trims the result to its last few non-empty lines: the+// full banner is 31 lines on a 100 column terminal, which would occupy most of a 30 row viewport and+// push the conversation out. The tail is the part that carries information (tools, skills, how to get+// help), so the artwork is what goes.+export function captureBanner(printBanner, s, agentSession, { keep = 0 } = {}) {+ const lines = [];+ printBanner(s, agentSession, { print: (line = "") => lines.push(String(line)) });+ if (!keep) return lines;+ return lines.filter((line) => String(line).trim().length > 0).slice(-keep);+}diff --git a/scripts/mso-agent-banner-lines.test.ts b/scripts/mso-agent-banner-lines.test.tsnew file mode 100644index 00000000..9be67706--- /dev/null+++ b/scripts/mso-agent-banner-lines.test.ts@@ -0,0 +1,94 @@+import { EventEmitter } from "node:events";+import { describe, expect, it } from "vitest";+import { captureBanner, withPreamble } from "./mso-agent-banner-lines.mjs";+import { mountScreenLoop } from "./mso-agent-screen-loop.mjs";++function fakeTty(isTTY = true) {+ const chunks: string[] = [];+ const output = new EventEmitter();+ Object.assign(output, {+ columns: 80,+ rows: 20,+ isTTY,+ write(value: string) {+ chunks.push(String(value));+ return true;+ },+ });+ return { output, chunks, all: () => chunks.join("") };+}++const session = () => ({+ agentSession: { id: "s1", name: "agent", title: "banner" },+ state: { config: { provider: "p", model: "m" } },+ history: [{ role: "user", text: "hello" }],+ usage: { totalTokens: 1 },+ statusBar: true,+ permission: "ask",+});++describe("banner belongs to the transcript, not to the screen", () => {+ it("prepends the banner and a blank separator to the transcript lines", () => {+ expect(withPreamble(["A", "B"], ["x"])).toEqual(["A", "B", "", "x"]);+ });++ it("returns the lines untouched when there is no banner", () => {+ expect(withPreamble(null, ["x"])).toEqual(["x"]);+ expect(withPreamble([], ["x"])).toEqual(["x"]);+ });++ it("captures banner output instead of writing it", () => {+ const written: string[] = [];+ const lines = captureBanner(+ (_s: any, _a: any, options: any) => {+ options.print("line one");+ options.print("line two");+ },+ {},+ {},+ );+ expect(lines).toEqual(["line one", "line two"]);+ expect(written).toEqual([]);+ });++ it("keeps the banner visible after a repaint, which is the whole point", () => {+ const { output, all } = fakeTty();+ const banner = ["-- MSO Agent --", "Welcome to MSO Agent!"];++ const loop = mountScreenLoop({+ session: session(),+ enabled: true,+ output,+ input: new EventEmitter(),+ colors: {},+ getSessions: () => [],+ preamble: () => banner,+ });++ // A banner written once before the first frame would be gone by now.+ loop.sync();++ expect(all()).toContain("Welcome to MSO Agent!");+ expect(all()).toContain("-- MSO Agent --");+ loop.dispose();+ });++ it("writes nothing at all when the panel is disabled, banner or not", () => {+ const { output, chunks } = fakeTty(false);+ const loop = mountScreenLoop({+ session: session(),+ enabled: false,+ output,+ input: new EventEmitter(),+ colors: {},+ preamble: () => ["Welcome to MSO Agent!"],+ });++ loop.paint();+ loop.sync();+ loop.follow();+ loop.dispose();++ expect(chunks).toEqual([]);+ });+});diff --git a/scripts/mso-agent-help.mjs b/scripts/mso-agent-help.mjsindex 1371e187..06bc5f4f 100644--- a/scripts/mso-agent-help.mjs+++ b/scripts/mso-agent-help.mjs@@ -45,7 +45,7 @@ export const HELP_LINES = [" /image <path> attach a local image to the next prompt"," /clear clear this session conversation"," /exit, /quit quit",- " --altscreen dev only: retain full terminal in alternate screen",+ " --no-altscreen keep the terminal's own scrollback instead of the retained panel","","Keyboard"," Ctrl+C clear input; empty prompt exits; active turn interrupts",diff --git a/scripts/mso-agent-pty.e2e.test.ts b/scripts/mso-agent-pty.e2e.test.tsindex 3da7686a..7ba51040 100644--- a/scripts/mso-agent-pty.e2e.test.ts+++ b/scripts/mso-agent-pty.e2e.test.ts@@ -58,8 +58,10 @@ function spawnAgentPty(serverUrl: string, cols = 100, rows = 30) {...process.env, HOME: tempHome, TERM: "xterm-256color",MSO_AGENT_BASE: serverUrl, MSO_AGENT_ORIGIN: serverUrl, MSO_AGENT_CLI: "mso", MSO_AGENT_VERSION: "1.13.1",};- delete env.CI; // Alt screen refuses execution in CI environment.- const child = pty.spawn(process.execPath, [path.join(__dirname, "mso-agent.mjs"), "--altscreen"], {+ // The panel is the default; CI still has to be cleared because altScreenRequested refuses there+ // by design, and this suite runs under CI on a normal day.+ delete env.CI;+ const child = pty.spawn(process.execPath, [path.join(__dirname, "mso-agent.mjs")], {cols, rows, cwd: __dirname, env: env as Record<string, string>,});return {diff --git a/scripts/mso-agent-runtime.mjs b/scripts/mso-agent-runtime.mjsindex 0a87758b..4fbc70da 100644--- a/scripts/mso-agent-runtime.mjs+++ b/scripts/mso-agent-runtime.mjs@@ -9,8 +9,8 @@ import { buildMemoryContext } from "../lib/agent/memory-context.mjs";import { latestIntentText } from "../lib/orchestration/capability-catalog.mjs";export { C, MSO_TITLE_ART } from "./mso-agent-ui.mjs";-export function printBanner(s, agentSession) {- return printAgentBanner(s, agentSession, { base: BASE, version: VERSION });+export function printBanner(s, agentSession, options = {}) {+ return printAgentBanner(s, agentSession, { base: BASE, version: VERSION, ...options });}function sessionSystem(agentSession, skillContext = null, memoryContext = null) {diff --git a/scripts/mso-agent-screen-loop.mjs b/scripts/mso-agent-screen-loop.mjsindex 2938b85d..41c92d5f 100644--- a/scripts/mso-agent-screen-loop.mjs+++ b/scripts/mso-agent-screen-loop.mjs@@ -8,6 +8,7 @@ import { transcriptLines } from "./mso-agent-transcript.mjs";import { appendStream, commitStream, createViewport, handleViewportKey, resetFollow, setLines } from "./mso-agent-viewport.mjs";import { renderViewport } from "./mso-agent-viewport-render.mjs";import { paneLines, paneWidth } from "./mso-agent-pane.mjs";+import { withPreamble } from "./mso-agent-banner-lines.mjs";import { clampPromptRows, PROMPT_ROWS } from "./mso-agent-composer-ui.mjs";export { clampPromptRows, PROMPT_ROWS } from "./mso-agent-composer-ui.mjs";@@ -24,6 +25,7 @@ export { clampPromptRows, PROMPT_ROWS } from "./mso-agent-composer-ui.mjs";* colors?: any,* getSessions?: () => Array<any>,* onTabClick?: (sessionId: string) => void | Promise<void>,+ * preamble?: (() => Array<string> | null) | null,* }} options*/export function mountScreenLoop({@@ -35,6 +37,7 @@ export function mountScreenLoop({getSessions = () => [],onTabClick,composer = null,+ preamble = null,} = {}) {if (!enabled || !session) {return {@@ -114,7 +117,7 @@ export function mountScreenLoop({const sync = () => {commitStream(viewport);- setLines(viewport, transcriptLines(session, { colors, width: geometry().transWidth }));+ setLines(viewport, withPreamble(preamble?.() ?? null, transcriptLines(session, { colors, width: geometry().transWidth })));paint();};@@ -176,7 +179,7 @@ export function mountScreenLoop({onMouse: (event) => dispatchMouse(event),});- setLines(viewport, transcriptLines(session, { colors, width: geometry().transWidth }));+ setLines(viewport, withPreamble(preamble?.() ?? null, transcriptLines(session, { colors, width: geometry().transWidth })));paint();const loop = {diff --git a/scripts/mso-agent-turn-print.mjs b/scripts/mso-agent-turn-print.mjsindex 6adb0e1f..516cb42f 100644--- a/scripts/mso-agent-turn-print.mjs+++ b/scripts/mso-agent-turn-print.mjs@@ -17,6 +17,21 @@ export function turnPrinter(session, fallback = console.log) {export const getTurnPrinter = turnPrinter;+// The live activity row draws at the cursor, which in panel mode is inside the frame the panel owns,+// so the row has to become discrete lines routed through the printer instead. Returns the begun+// activity, or null when the caller supplied one already.+export function turnActivity({ session, options = {}, Activity, fallbackColors = {} }) {+ if (options.activity) return options.activity.begin();+ const panelActive = Boolean(session?.streamSink);+ return new Activity({+ output: options.output || process.stdout,+ colors: fallbackColors,+ now: options.now,+ animate: panelActive ? false : options.animate,+ print: turnPrinter(session),+ }).begin();+}+export async function withPanelSuspended(loop, fn) {if (!loop || !loop.active) {return fn();diff --git a/scripts/mso-agent-turn.mjs b/scripts/mso-agent-turn.mjsindex b193e3bf..7f60b04d 100644--- a/scripts/mso-agent-turn.mjs+++ b/scripts/mso-agent-turn.mjs@@ -16,7 +16,7 @@ import { oneShotApproves } from "./mso-agent-oneshot.mjs";import { reasoningLine } from "./mso-agent-reasoning.mjs";import { parseEditResult, printEditDiff } from "./mso-agent-edit-diff.mjs";import { parseTodoCall, printTodoBlock, rememberTodos } from "./mso-agent-todos.mjs";-import { turnPrinter } from "./mso-agent-turn-print.mjs";+import { turnActivity, turnPrinter } from "./mso-agent-turn-print.mjs";function lazyAssistantOutput(session, options = {}) {if (options.quiet) return null;@@ -115,14 +115,7 @@ export async function agentRound(rl, session, skillContext = null, signal = undeconst calls = [];let finalText = "", rounds = 0;const agentName = session?.agentSession?.name || "agent";- const activity = options.quiet- ? null- : (options.activity || new AgentActivity({- output: options.output || process.stdout,- colors: C,- now: options.now,- animate: options.animate,- })).begin();+ const activity = options.quiet ? null : turnActivity({ session, options, Activity: AgentActivity, fallbackColors: C });const roundLimit = agentRoundLimit();beginSkillInvocation(session, skillContext, C);const print = options.print || turnPrinter(session);diff --git a/scripts/mso-agent-ui.mjs b/scripts/mso-agent-ui.mjsindex 4af18b07..85b03e1f 100644--- a/scripts/mso-agent-ui.mjs+++ b/scripts/mso-agent-ui.mjs@@ -136,15 +136,15 @@ function panelTitle(title, inner) {return `┌${rule("─", before)}${label}${rule("─", remaining - before)}┐`;}-export function printAgentBanner(s, agentSession, { base, version }) {+export function printAgentBanner(s, agentSession, { base, version, print = (line = "") => console.log(line) }) {const totalWidth = terminalWidth();const inner = totalWidth - 2;const titleArtWidth = Math.max(...MSO_TITLE_ART.map(width));if (totalWidth >= titleArtWidth) {const colors = titleColors();- MSO_TITLE_ART.forEach((line, index) => console.log(`${colors[index]}${C.bold}${line}${C.reset}`));- } else console.log(`${C.blue}${C.bold}── MSO Agent ──${C.reset}`);- console.log();+ MSO_TITLE_ART.forEach((line, index) => print(`${colors[index]}${C.bold}${line}${C.reset}`));+ } else print(`${C.blue}${C.bold}── MSO Agent ──${C.reset}`);+ print();const byScope = { read: 0, write: 0, exec: 0 };for (const tool of s.tools) byScope[tool.scope] = (byScope[tool.scope] || 0) + 1;@@ -156,7 +156,7 @@ export function printAgentBanner(s, agentSession, { base, version }) {const sessionName = `@${agentSession?.name || "agent"}`;const title = fit(`MSO Agent${version ? ` v${version}` : ""} · ${sessionName} · ${sessionTitle}`, inner - 2);- console.log(panelTitle(title, inner));+ print(panelTitle(title, inner));if (totalWidth >= 94) {const gap = 4;const leftWidth = Math.max(30, Math.floor((inner - gap) * 0.37));@@ -175,7 +175,7 @@ export function printAgentBanner(s, agentSession, { base, version }) {right.push("", `${C.bold}Available Skills${C.reset}`);for (const row of skills) right.push(kv(row.label, row.value, rightWidth));const rows = Math.max(left.length, right.length);- for (let i = 0; i < rows; i++) console.log(panelLine(left[i] || "", right[i] || "", leftWidth, rightWidth, gap));+ for (let i = 0; i < rows; i++) print(panelLine(left[i] || "", right[i] || "", leftWidth, rightWidth, gap));} else {const lines = [`${C.bold}Runtime${C.reset}`, kv("model", model, inner), kv("name", sessionName, inner), kv("session", sessionTitle, inner), kv("endpoint", base, inner), "",@@ -184,10 +184,10 @@ export function printAgentBanner(s, agentSession, { base, version }) {`${C.bold}Capabilities${C.reset}`, `${byScope.read} read · ${byScope.write} write · ${byScope.exec} exec · write/exec approval-gated`,`${C.bold}Infrastructure${C.reset}`, `${infra.ready.length}/${infra.total} ready · ${infra.ready.length ? infra.ready.join(" · ") : "run /integrations to connect"}`,];- for (const line of lines) console.log(panelSingle(line, inner));+ for (const line of lines) print(panelSingle(line, inner));}- console.log(`└${rule("─", inner)}┘`);- console.log(`${C.dim}${s.tools.length} tools · ${countSkills(s.skills)} skills · /skills · /<skill> · /help${C.reset}`);- console.log();- console.log(`${C.bold}Welcome to MSO Agent!${C.reset} Type your message or /help for commands.`);+ print(`└${rule("─", inner)}┘`);+ print(`${C.dim}${s.tools.length} tools · ${countSkills(s.skills)} skills · /skills · /<skill> · /help${C.reset}`);+ print();+ print(`${C.bold}Welcome to MSO Agent!${C.reset} Type your message or /help for commands.`);}diff --git a/scripts/mso-agent.mjs b/scripts/mso-agent.mjsindex 29a284d2..59d33063 100644--- a/scripts/mso-agent.mjs+++ b/scripts/mso-agent.mjs@@ -19,6 +19,7 @@ import { pathToFileURL } from "node:url";import { createQueue, dequeue } from "./mso-agent-queue.mjs";import { pendingImageBlock } from "./mso-agent-image.mjs";import { altScreenRequested, startAltScreen } from "./mso-agent-altscreen.mjs";+import { captureBanner } from "./mso-agent-banner-lines.mjs";import { visibleSessionRows } from "./mso-agent-sessions.mjs";import { chromeLines } from "./mso-agent-chrome.mjs";import { switchToSession } from "./mso-agent-cmd-session.mjs";@@ -51,7 +52,7 @@ async function main() {: (permissionMode(restartUi.permission)?.id || "ask");const [s, agentSession] = await Promise.all([state(), startupSession(requested, restartSessionId)]);if (!agentSession || agentSession.source !== "cli") throw new Error("could not establish a CLI MSO Agent session");- printBanner(s, agentSession);+ const bannerLines = altScreen.ok ? captureBanner(printBanner, s, agentSession, { keep: 4 }) : (printBanner(s, agentSession), null);session = {state: s,agentSession,@@ -75,6 +76,7 @@ async function main() {input: process.stdin,colors: C,getSessions: () => recentSessions,+ preamble: () => bannerLines,onTabClick: async (targetId) => {if (!targetId || targetId === session?.agentSession?.id) return;await switchToSession(rl, session, targetId);