From 882016e0802337c19b830e49a49e151162901b5e Mon Sep 17 00:00:00 2001 From: Cato <41178744+catomean@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:19:23 +0200 Subject: [PATCH] fix(terminal): a command is typed then entered, one Loki sheet on the phone, Keys keeps the terminal (#1316) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From a phone the owner switched the model and the session answered "Model 'opusWhy is the name of the repo…' not found": the command and its Enter went in one write, Claude Code read it as a paste, the Enter became a newline, and the next message was typed after it. Then "What's going on?" opened a sheet with a second composer and a second model picker, which led to Loki chat and its own "Choose a model". - Every command button types its words, then Enter as its own keystroke after a beat (lib/session-keystrokes typeCommand), and commands queue behind each other so two quick taps never interleave. Covers the model sheet, the commands sheet, the screen's action chips, the rail's "Type it" steps and a "/model opus" typed in the box. - On a phone, "What's going on?" opens the answer: TerminalLokiRail in sheet form has no composer, no model picker, no run-status filler, a visible question button and one link to continue in Loki chat. - Keys open hides the next-step row, so the terminal keeps its lines. - Loki's model picker is named as Loki's ("Loki answers with"), and on a phone its button shows the model's name beside the count instead of "your key" alone. Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx Co-authored-by: Claude --- CLAUDE.md | 15 ++- scripts/test/model-picker-browser.ts | 2 +- scripts/test/session-sheet-browser.ts | 74 ++++++++++--- scripts/test/terminal-commands.ts | 43 +++++++- scripts/test/terminal-loki-sheet.ts | 62 +++++++++++ scripts/test/terminal-session-box.ts | 4 + src/app/globals.css | 14 ++- src/components/loki/ModelPicker.tsx | 6 +- src/components/terminal/SessionComposer.tsx | 4 +- src/components/terminal/SessionInfo.tsx | 3 +- src/components/terminal/TerminalActions.tsx | 7 +- src/components/terminal/TerminalComposer.tsx | 3 +- src/components/terminal/TerminalLokiRail.tsx | 107 +++++++++++++------ src/components/terminal/TerminalSurface.tsx | 16 +-- src/lib/session-keystrokes.ts | 47 +++++++- src/lib/terminal-commands.ts | 15 ++- 16 files changed, 347 insertions(+), 75 deletions(-) create mode 100644 scripts/test/terminal-loki-sheet.ts diff --git a/CLAUDE.md b/CLAUDE.md index 8e046eb9e..04ca6fdf2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -140,7 +140,20 @@ src/ │ │ button on the terminal's corner — never a second text │ │ box. While the phone keyboard is up, the app bar and the │ │ view switch step aside and next steps go to one row -│ │ (`fc-keyboard-open` in globals.css). +│ │ (`fc-keyboard-open` in globals.css). Keys open hides +│ │ the next-step row. A command button anywhere TYPES its +│ │ words, then Enter as its own keystroke (lib/session- +│ │ keystrokes typeCommand) — in one write Claude Code reads +│ │ "/model opus\r" as a paste and the CR as a newline. +│ │ Three surfaces talk, on purpose, and only three: the +│ │ session box (the agent), TerminalLokiRail (Loki about +│ │ this session — beside it on a wide screen; on a phone +│ │ "What's going on?" opens it as a SHEET showing the +│ │ answer and its steps, with no composer and no model +│ │ picker, `presentation="sheet"`), and /loki (Loki chat). +│ │ Two "models" exist and are named apart: the agent's +│ │ (SessionInfo chip, "Opus 5.5") and the one answering +│ │ Loki (loki/ModelPicker, "Loki answers with"). │ │ See docs/development/responsive-design.md. │ ├── activity/ → ActivityView, EventStream, DigestPanel (fleet activity timeline + digests) │ ├── today/ → StickyNoteCard (captures; Loki "add X to my list"), CalendarCard, WeatherCard, CommitmentsCard, SubscriptionsCard, HabitsList diff --git a/scripts/test/model-picker-browser.ts b/scripts/test/model-picker-browser.ts index 225d6e8a8..0cf9d10fe 100644 --- a/scripts/test/model-picker-browser.ts +++ b/scripts/test/model-picker-browser.ts @@ -107,7 +107,7 @@ async function main() { await trigger.getByText("1 left").waitFor(); assert.equal(budgetCalls, 1); await trigger.click(); - const dialog = page.getByRole("dialog", { name: "Choose a model" }); + const dialog = page.getByRole("dialog", { name: "Loki answers with" }); await dialog.getByText("Budget reading 2", { exact: true }).waitFor(); assert.equal(await dialog.getByRole("button", { name: /Grok 4.7/ }).isEnabled(), true); assert.equal(await dialog.getByRole("button", { name: /GPT-OSS 120B/ }).isVisible(), false); diff --git a/scripts/test/session-sheet-browser.ts b/scripts/test/session-sheet-browser.ts index e375e7e12..e154e9ed8 100644 --- a/scripts/test/session-sheet-browser.ts +++ b/scripts/test/session-sheet-browser.ts @@ -28,10 +28,10 @@ async function main() { stdin: { resolveDir: process.cwd(), loader: "jsx", - contents: `import React from 'react';import{createRoot}from'react-dom/client';import{ClaudeChatView}from'./src/components/terminal/ClaudeChatView';import{TerminalMobileHeader}from'./src/components/terminal/TerminalMobileHeader';import{MobileNav}from'./src/components/shell/MobileNav';import{SessionComposer}from'./src/components/terminal/SessionComposer';import{TerminalMobileDock}from'./src/components/terminal/TerminalMobileDock';import{badgeNames}from'./src/components/terminal/terminal-strip-tabs'; + contents: `import React from 'react';import{createRoot}from'react-dom/client';import{ClaudeChatView}from'./src/components/terminal/ClaudeChatView';import{TerminalMobileHeader}from'./src/components/terminal/TerminalMobileHeader';import{MobileNav}from'./src/components/shell/MobileNav';import{SessionComposer}from'./src/components/terminal/SessionComposer';import{TerminalMobileDock}from'./src/components/terminal/TerminalMobileDock';import{badgeNames}from'./src/components/terminal/terminal-strip-tabs';import{TerminalLokiRail}from'./src/components/terminal/TerminalLokiRail';import{TerminalLokiSheet}from'./src/components/terminal/TerminalExplain'; const roster=[{id:'claude',label:'Claude'},{id:'codex',label:'Codex'}]; const root=createRoot(document.getElementById('app')); - window.mount=(fixture)=>{window.fixture=fixture;const agent=badgeNames(fixture.badge,roster);root.render(
Loki
{}} immersive={false} onToggleImmersive={()=>{}} view={fixture.terminal?"terminal":"chat"} onViewChange={()=>{}}/>{fixture.terminal?
terminal
{}} keysOpen={false} onKeysOpenChange={()=>{}} immersive={false} session={{tab:'center-som',channel:'cloud',agent:'claude',onKey:async bytes=>{window.written.push(bytes)}}} box={tools=>{window.written.push(bytes)}} live agent="claude" agentLabel={agent} suggestions={["run the project's unit tests","open the main source file for review"]} onExplain={()=>{}} project="center-som" density="comfortable" tools={tools}/>}/>
:{}} onKey={async bytes=>{window.written.push(bytes)}} onShowTerminal={()=>{}} onExplain={()=>{}}/>}
)};window.written=[];`, + window.mount=(fixture)=>{window.fixture=fixture;const agent=badgeNames(fixture.badge,roster);root.render(
Loki
{}} immersive={false} onToggleImmersive={()=>{}} view={fixture.terminal?"terminal":"chat"} onViewChange={()=>{}}/>{fixture.terminal?
terminal
{}} keysOpen={false} onKeysOpenChange={()=>{}} immersive={false} session={{tab:'center-som',channel:'cloud',agent:'claude',onKey:async bytes=>{window.written.push(bytes)}}} box={tools=>{window.written.push(bytes)}} live agent="claude" agentLabel={agent} suggestions={["run the project's unit tests","open the main source file for review"]} onExplain={()=>{}} project="center-som" density="comfortable" tools={tools}/>}/>
:{}} onKey={async bytes=>{window.written.push(bytes)}} onShowTerminal={()=>{}} onExplain={()=>{}}/>}
{fixture.loki&&{}}>{}} askOnly agent="claude" onKey={()=>{}}/>}
)};window.written=[];`, }, bundle: true, write: false, @@ -242,10 +242,13 @@ async function main() { ); await page.screenshot({ path: ".tmp/session-sheet/commands-390.png" }); await commands.getByText("Use Opus").click(); + await page.waitForFunction( + () => (window as unknown as { written: string[] }).written.length === 2, + ); assert.deepEqual( await page.evaluate(() => (window as unknown as { written: string[] }).written), - ["/model opus\r"], - "a command in the sheet is typed into the session", + ["/model opus", "\r"], + "a command in the sheet is typed into the session, Enter on its own", ); await page.evaluate(() => Object.assign(window, { written: [] })); await page.keyboard.press("Escape"); @@ -284,11 +287,17 @@ async function main() { // sheet stays open saying what is changing. await sheet.getByRole("button", { name: "Sonnet" }).click(); await sheet.getByRole("button", { name: "High", exact: true }).click(); + // The command and its Enter are separate writes with a beat between, + // and the second command waits for the first's Enter — two quick taps + // never interleave (lib/session-keystrokes typeCommand). + await page.waitForFunction( + () => (window as unknown as { written: string[] }).written.length === 4, + ); const written = await page.evaluate(() => (window as unknown as { written: string[] }).written); assert.deepEqual( written, - ["/model sonnet\r", "/effort high\r"], - "each choice is the command with the choice named", + ["/model sonnet", "\r", "/effort high", "\r"], + "each choice is the command with the choice named, then Enter on its own", ); assert.ok( await sheet.getByText("Switching to Sonnet").isVisible(), @@ -319,10 +328,9 @@ async function main() { ); // A choice already in force sends nothing. await sheet.getByRole("button", { name: "Sonnet" }).click(); - assert.equal( - (await page.evaluate(() => (window as unknown as { written: string[] }).written)).length, - 2, - ); + await page.waitForTimeout(300); + const after = await page.evaluate(() => (window as unknown as { written: string[] }).written); + assert.equal(after.length, 4, `a choice in force sends nothing (got ${JSON.stringify(after)})`); // Claude Code answers in the log the moment it switches: the sheet, // still open, settles on its word — not on the next answer. @@ -368,9 +376,12 @@ async function main() { // A family the account cannot use: Claude Code's refusal, in its words, // and the model in force stays marked. await sheet.getByRole("button", { name: "Fable" }).click(); + await page.waitForFunction( + () => (window as unknown as { written: string[] }).written.at(-1) === "\r", + ); assert.equal( - (await page.evaluate(() => (window as unknown as { written: string[] }).written)).at(-1), - "/model fable\r", + (await page.evaluate(() => (window as unknown as { written: string[] }).written)).at(-2), + "/model fable", ); await mount({ key: "chat2", @@ -402,6 +413,45 @@ async function main() { await page.screenshot({ path: ".tmp/session-sheet/sheet-refused-390.png" }); await page.keyboard.press("Escape"); + // "What's going on?" on a phone: a sheet with the question, room for + // the answer, and one way to Loki chat — no second box, no second model + // picker, nothing about the run when nothing is tracked. + await mount({ + key: "chat2", + items, + connected: true, + received: true, + sessionId: "s", + badge: "claude", + loki: true, + }); + const loki = page.getByRole("dialog").filter({ hasText: "Loki on Center SOM" }); + await loki.waitFor(); + const lokiBox = await loki.evaluate((d) => { + const r = d.getBoundingClientRect(); + return { + top: Math.round(r.top), + bottom: Math.round(r.bottom), + composers: d.querySelectorAll(".ck-composer").length, + pickers: d.querySelectorAll(".ui-loki-model-trigger").length, + text: d.textContent ?? "", + }; + }); + assert.ok(lokiBox.top >= 0 && lokiBox.bottom <= 780, "the sheet is on screen"); + assert.equal(lokiBox.composers, 0, "no second box in it"); + assert.equal(lokiBox.pickers, 0, "no second model picker in it"); + assert.ok(!lokiBox.text.includes("Nothing running"), "no run-status filler"); + assert.ok( + await loki.getByRole("button", { name: "What's going on?" }).isVisible(), + "the question is there to ask", + ); + assert.ok( + await loki.getByRole("link", { name: /Continue in Loki chat/ }).isVisible(), + "and one way to Loki chat", + ); + await page.screenshot({ path: ".tmp/session-sheet/loki-sheet-390.png" }); + await page.keyboard.press("Escape"); + // An older runner sends no reply: the next answer naming the model // settles it instead. await mount({ diff --git a/scripts/test/terminal-commands.ts b/scripts/test/terminal-commands.ts index 1e0830100..64f950ffa 100644 --- a/scripts/test/terminal-commands.ts +++ b/scripts/test/terminal-commands.ts @@ -5,7 +5,8 @@ * nothing on the page told them the answer was a command. */ import { commandsFor } from "@/config/agent-commands"; -import { commandIn, commandGuide, screenActions } from "@/lib/terminal-commands"; +import { commandIn, commandGuide, runAction, screenActions } from "@/lib/terminal-commands"; +import { typeCommand } from "@/lib/session-keystrokes"; import { summaryPrompt, terminalContextAttachment } from "@/lib/terminal-summary"; let passed = 0; @@ -21,6 +22,7 @@ const signedOut = screenActions( ); check("signed out → /login, first", signedOut[0]?.display === "/login"); check("typed with Enter", signedOut[0]?.bytes === "/login\r"); +check("a command is TYPED: the words, then Enter on its own", signedOut[0]?.typed === "/login"); check("says why in plain words", /signed out/i.test(signedOut[0]?.why ?? "")); check( @@ -92,4 +94,41 @@ check( ctx.content.includes("Invalid API key"), ); -console.log(`\n${passed} passed`); +// A command and its Enter are two writes with a beat between: in one write +// Claude Code reads them as a paste, the CR becomes a newline, and the next +// message is typed after the half-typed command ("/model opusWhy is the +// name of the repo…" → "Model 'opusWhy…' not found", owner, 2026-10-19). +const typed = (async () => { + const writes: { bytes: string; at: number }[] = []; + const record = (bytes: string) => { + writes.push({ bytes, at: Date.now() }); + }; + await typeCommand(record, "/model opus\r"); + check( + "the words first, Enter second, as separate writes", + writes.map((w) => w.bytes).join("|") === "/model opus|\r", + ); + check("with a beat between them", writes[1]!.at - writes[0]!.at >= 100); + writes.length = 0; + await runAction(record, signedOut[0]!); + check("a screen action that is a command is typed the same way", writes.length === 2); + await runAction(record, { id: "k", label: "Enter", display: "⏎", bytes: "\r", why: "" }); + check("a key is still its bytes, at once", writes.at(-1)!.bytes === "\r" && writes.length === 3); + writes.length = 0; + // Two commands at once (Sonnet, then High, tapped within the beat) go one + // after the other, each with its own Enter — never "/model sonnet/effort high". + await Promise.all([typeCommand(record, "/model sonnet"), typeCommand(record, "/effort high")]); + check( + "two quick commands never interleave", + writes.map((w) => w.bytes).join("|") === "/model sonnet|\r|/effort high|\r", + ); +})(); + +// The runner loads this file without top-level await: finish on the promise. +typed.then( + () => console.log(`\n${passed} passed`), + (e: unknown) => { + console.error(e instanceof Error ? e.message : e); + process.exit(1); + }, +); diff --git a/scripts/test/terminal-loki-sheet.ts b/scripts/test/terminal-loki-sheet.ts new file mode 100644 index 000000000..407b7aa45 --- /dev/null +++ b/scripts/test/terminal-loki-sheet.ts @@ -0,0 +1,62 @@ +/** + * "What's going on?" on a phone opens the ANSWER, not a second chat: Loki's + * panel in sheet form has no box of its own, no model picker, no run-status + * filler — the answer, its next steps, and one way to Loki chat. The rail + * beside the session on a wide screen keeps all of that. + * + * The phone's sheet used to be the whole rail (owner, 2026-10-19: "too + * many different screens… spaghetti UI"): "Nothing running on Xhiva Art. + * Send a task below…" above an answer, above a composer with Loki's model + * picker reading "Auto" — a hand's width from the session box reading + * "Opus 5.5". + * + * Run: npx tsx scripts/test/terminal-loki-sheet.ts + */ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { createElement } from "react"; +import { renderToStaticMarkup } from "react-dom/server"; +import { TerminalLokiRail } from "@/components/terminal/TerminalLokiRail"; + +const render = (presentation: "rail" | "sheet") => + renderToStaticMarkup( + createElement(TerminalLokiRail, { + presentation, + project: "Xhiva Art", + tab: "xhiva-art", + runId: null, + ptyState: "live", + projectId: null, + canSwitchAgent: false, + onSwitchAgent: () => {}, + askOnly: true, + agent: "claude", + onKey: () => {}, + }), + ); + +const sheet = render("sheet"); +assert.ok(!sheet.includes("ck-composer"), "the sheet has no composer of its own"); +assert.ok(!sheet.includes("ui-loki-model-trigger"), "and no model picker of Loki's"); +assert.ok(!sheet.includes("Nothing running on"), "no run-status filler"); +assert.ok(!sheet.includes("Checking this run"), "no run-status filler while loading"); +assert.ok(sheet.includes("Continue in Loki chat"), "one way to Loki chat, at the foot"); +assert.ok(sheet.includes("Loki on Xhiva Art"), "it says whose session it reads"); +assert.ok( + /aria-label="What's going on\?"[^>]*>(?:(?!sr-only).)*What's going on\?/s.test(sheet), + "the question is a labelled button, visible at phone width", +); +assert.ok(!sheet.includes('aria-label="Open the full Loki chat"'), "no second link up top"); + +const rail = render("rail"); +assert.ok(rail.includes("ck-composer"), "the rail beside the session keeps its Ask box"); +assert.ok(rail.includes("Nothing running on"), "and says what the run is doing"); +assert.ok(!rail.includes("Continue in Loki chat"), "with the chat link in its header instead"); + +// The surface renders the one panel in the split as the rail and in the +// phone's sheet as the sheet — one component, told which it is. +const surface = readFileSync("src/components/terminal/TerminalSurface.tsx", "utf8"); +assert.match(surface, / readFileSync(join(process.cwd(), "src/components/ter ok(!/inputMode|TerminalInputSwitch|TabVoiceMic/.test(read(f)), `${f}: no input-mode switch`); ok(!surface.includes(" {open && !phone && ( -
+
{list}
)} @@ -366,7 +366,7 @@ export function ModelPicker({ id={headingId} className="flex-1 text-center text-base font-semibold text-text-primary" > - Choose a model + Loki answers with
diff --git a/src/components/terminal/SessionComposer.tsx b/src/components/terminal/SessionComposer.tsx index 3d9d800b7..bca5b2e7a 100644 --- a/src/components/terminal/SessionComposer.tsx +++ b/src/components/terminal/SessionComposer.tsx @@ -9,7 +9,7 @@ import type { BuilderChannel } from "@/lib/event-stream-types"; import { useDispatchLiveStatus } from "@/hooks/use-dispatch-live-status"; import { dispatchToneDotClass } from "@/lib/dispatch-status"; import { commandIn } from "@/lib/terminal-commands"; -import { ESC, typeMessage } from "@/lib/session-keystrokes"; +import { ESC, typeCommand, typeMessage } from "@/lib/session-keystrokes"; import { SuggestionChips } from "./SuggestionChips"; import { LokiFiles } from "./LokiFiles"; import { SessionPicker } from "./SessionPicker"; @@ -163,7 +163,7 @@ export function SessionComposer({ try { const command = attachments.length === 0 ? commandIn(message, agent) : null; if (command) { - await onKey(`${command}\r`); + await typeCommand(onKey, command); setSent({ kind: "typed", what: command }); return true; } diff --git a/src/components/terminal/SessionInfo.tsx b/src/components/terminal/SessionInfo.tsx index db5f14a35..be9d70dcd 100644 --- a/src/components/terminal/SessionInfo.tsx +++ b/src/components/terminal/SessionInfo.tsx @@ -16,6 +16,7 @@ import { type TranscriptItem, } from "@/lib/claude-transcript"; import type { BuilderChannel } from "@/lib/constants/statuses"; +import { typeCommand } from "@/lib/session-keystrokes"; import { cn } from "@/lib/utils"; /** @@ -153,7 +154,7 @@ export function SessionInfo({ const modelListCmd = commandOfKind(agent, "model"); const effortCmd = commandOfKind(agent, "effort"); const agentName = agent === "claude" ? "Claude Code" : "The agent"; - const type = (text: string) => void onKey(`${text}\r`); + const type = (text: string) => void typeCommand(onKey, text); // The chip names the model and nothing else, like the Claude app's: with // the mode beside it, "Opus 5.5 · Auto" truncated in the terminal view's diff --git a/src/components/terminal/TerminalActions.tsx b/src/components/terminal/TerminalActions.tsx index d3c306859..8ab876e02 100644 --- a/src/components/terminal/TerminalActions.tsx +++ b/src/components/terminal/TerminalActions.tsx @@ -3,7 +3,8 @@ import { useEffect, useState, type MutableRefObject } from "react"; import { Lightbulb, SquareTerminal } from "lucide-react"; import { commandsFor } from "@/config/agent-commands"; -import { commandAction, type TerminalAction } from "@/lib/terminal-commands"; +import { runAction, type TerminalAction } from "@/lib/terminal-commands"; +import { typeCommand } from "@/lib/session-keystrokes"; import { useScreenActions } from "./use-screen-actions"; /** @@ -64,7 +65,7 @@ export function TerminalActions({ const [typed, setTyped] = useTypedNotice(); if (actions.length === 0 && !typed) return null; const run = (a: TerminalAction) => { - onKey(a.bytes); + void runAction(onKey, a); setTyped(a.display); }; return ( @@ -129,7 +130,7 @@ export function TerminalCommandList({ type="button" className="ui-term-command" onClick={() => { - onKey(commandAction(c, c.hint).bytes); + void typeCommand(onKey, c.text); setTyped(c.text); }} > diff --git a/src/components/terminal/TerminalComposer.tsx b/src/components/terminal/TerminalComposer.tsx index 9e436f83b..33a816ff7 100644 --- a/src/components/terminal/TerminalComposer.tsx +++ b/src/components/terminal/TerminalComposer.tsx @@ -10,6 +10,7 @@ import type { SessionAsk } from "@/hooks/use-session-ask"; import { useDispatchLiveStatus } from "@/hooks/use-dispatch-live-status"; import { dispatchToneDotClass } from "@/lib/dispatch-status"; import { commandIn } from "@/lib/terminal-commands"; +import { typeCommand } from "@/lib/session-keystrokes"; import { SuggestionChips } from "./SuggestionChips"; import { TerminalCommandList } from "./TerminalActions"; import { terminalComposerModes, type SessionComposerMode } from "./terminal-composer-modes"; @@ -143,7 +144,7 @@ export function TerminalComposer({ } const command = onKey && attachments.length === 0 ? commandIn(prompt, agent) : null; if (command) { - onKey?.(`${command}\r`); + if (onKey) void typeCommand(onKey, command); setError(null); setTypedCommand(command); return true; diff --git a/src/components/terminal/TerminalLokiRail.tsx b/src/components/terminal/TerminalLokiRail.tsx index cf08b7da1..a5cdc9739 100644 --- a/src/components/terminal/TerminalLokiRail.tsx +++ b/src/components/terminal/TerminalLokiRail.tsx @@ -29,6 +29,7 @@ import { import { LOKI_STATUS_COPY } from "@/lib/loki/stream"; import type { LiveTurn } from "@/hooks/use-loki-stream"; import { commandIn } from "@/lib/terminal-commands"; +import { typeCommand } from "@/lib/session-keystrokes"; import { TerminalComposer } from "./TerminalComposer"; /** @@ -79,9 +80,19 @@ export function TerminalLokiRail({ onStep, agent = null, onKey, + presentation = "rail", }: { /** The CLI running in the tab — which commands a step may type. */ agent?: string | null; + /** `rail`: the panel beside the session on a wide screen — run status, + * the conversation, its own Ask box. `sheet`: what "What's going on?" + * opens on a phone — the ANSWER, its next steps, and a way to Loki chat; + * no second composer, no second model picker, no run-status filler. + * The phone's sheet used to be the whole rail: "Nothing running on Xhiva + * Art. Send a task below…" over an answer, under a box of its own with + * Loki's model picker reading "Auto" beside the session box's "Opus 5.5" + * (owner, 2026-10-19: "spaghetti UI"). */ + presentation?: "rail" | "sheet"; /** Types into the session (the keyboard's path). A step that is the agent's * own command ("/model opus") goes here: Inject would wrap it in project * context and the agent would read a sentence about a model. */ @@ -235,15 +246,19 @@ export function TerminalLokiRail({ view?.stalled && view.diagnostic && view.diagnostic !== view.nextAction ? view.diagnostic : null; - const hasStatusBody = Boolean( - (loading && !view) || error || !view || lines.summary || lines.next || diagnostic, - ); + const sheet = presentation === "sheet"; + // The sheet says nothing about the run unless there is something to say: + // a tracked run's status, a stall, or a dead provider. "Checking this + // run…" and "Nothing running…" are the rail's, where there is room. + const filler = !sheet && ((loading && !view) || (!loading && !view && !error)); + const hasStatusBody = Boolean(filler || error || lines.summary || lines.next || diagnostic); const hasBody = hasStatusBody || Boolean(view?.quotaDeath && canSwitchAgent); + const quiet = sheet && !hasBody && session.messages.length === 0 && !session.live; return ( -