The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(runtime): enhance pane inspection for Copilot and OpenCode gutter boxes
Dev jacobc3a765d732d7
diff --git a/cli/src/lib/runtimeProfileController.spec.ts b/cli/src/lib/runtimeProfileController.spec.tsindex a24b9386d..99eb504ec 100644--- a/cli/src/lib/runtimeProfileController.spec.ts+++ b/cli/src/lib/runtimeProfileController.spec.ts@@ -78,6 +78,38 @@ describe('runtime pane parsing', () => {)).toMatchObject({ idle: true, draft: false })})+ it('reads copilot, whose composer carries no marker while its sent messages do', () => {+ // Copied off a live pane. Copilot echoes every message the user has ALREADY SENT into the+ // transcript as `❯ <text>` in full brightness, and draws its composer as a `┃` box that carries+ // no marker at all — so the generic reader walked back to the last echo and read `hi`, a message+ // sent minutes ago, as a draft. Copilot was never idle for the life of the agent, and every+ // model switch came back AGENT_BUSY over an empty prompt.+ const pane = (composer: string) => [+ ' ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄',+ ' \u001b[38;2;240;246;252m❯ hi\u001b[39m',+ ' ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀',+ ' ● Hi! What would you like to work on?',+ ' \u001b[38;2;145;152;161m~/Downloads/20260907\u001b[39m',+ '\u001b[38;2;129;139;152m╻\u001b[38;2;20;27;34m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄',+ `\u001b[38;2;129;139;152m┃\u001b[39m\u001b[48;2;20;27;34m${composer}`,+ '\u001b[38;2;129;139;152m\u001b[49m╹\u001b[38;2;20;27;34m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀',+ '\u001b[39m ← open sidebar · / commands · ? help · tab next tab',+ ].join('\n')++ expect(inspectRuntimePane('copilot', pane(''))).toMatchObject({ idle: true, draft: false })+ // Copilot's box has no status strip, so its single gutter line IS the composer. Dropping it the+ // way opencode's last row is dropped would read a real draft as an empty prompt and respawn the+ // pane out from under it.+ expect(inspectRuntimePane('copilot', pane(' fix the parser'))).toMatchObject({ idle: false, draft: true })+ // A picker or a permission prompt REPLACES the box, so there is no gutter on screen and the pane+ // reads not-idle without [DIALOG_UI] having to name copilot's dialogs.+ expect(inspectRuntimePane('copilot', [+ '│ Do you want to allow this access?',+ '│ ❯ 1. Yes',+ '│ 2. No, and tell Copilot what to do differently (Esc to stop)',+ ].join('\n'))).toMatchObject({ idle: false })+ })+it('does not read a truecolor foreground as a dim placeholder', () => {// `38;2;<r>;<g>;<b>` carries a literal 2 that is a colour-space selector, not the dim attribute.// Counting it would make a line the user had TYPED look like an empty composer — the onediff --git a/cli/src/lib/runtimeProfileController.ts b/cli/src/lib/runtimeProfileController.tsindex aa6115ad4..3e46487e6 100644--- a/cli/src/lib/runtimeProfileController.ts+++ b/cli/src/lib/runtimeProfileController.ts@@ -143,7 +143,8 @@ function promptMarker(engine: RegisteredSession['engine']): RegExp {export function inspectRuntimePane(engine: RegisteredSession['engine'], capture: string): PaneInspection {if (engine === 'pi') return inspectPiPane(capture)- if (engine === 'opencode') return inspectOpencodePane(capture)+ if (engine === 'opencode') return inspectGutterBoxPane(capture, true)+ if (engine === 'copilot') return inspectGutterBoxPane(capture, false)const rawLines = capture.split('\n')const marks = promptMarker(engine)const promptIndex = rawLines.findLastIndex((line) => {@@ -176,29 +177,38 @@ export function inspectRuntimePane(engine: RegisteredSession['engine'], capture:*/const DIALOG_UI = /Select Model(?: and Effort)?|Select Reasoning Level|Advanced Reasoning|Available models|Models matching|Edit Parameters|Type to filter.*Tab to edit|Esc to go back|Press enter to confirm|Do you want to proceed|Allow this action|permission required|Starting MCP servers?/i-/** The rule OpenCode closes its composer box with: `╹▀▀▀▀…`. */-const OPENCODE_BOX_RULE = /[─▀▁▔]{8,}/u+/** The rule a gutter-box composer is closed with: `╹▀▀▀▀…`. */+const GUTTER_BOX_RULE = /[─▀▁▔]{8,}/u/**- * OpenCode's composer is a BOX, and its `┃` gutter does not stop at the text.+ * A composer drawn as a BOX with a `┃` gutter — OpenCode's and Copilot's, which are the same shape.*- * The last gutter line is the box's own STATUS strip — `Build · <model> · <account>`, sitting- * directly on the rule that closes the box. The generic reader takes the last line carrying the- * marker, which is that strip, and reads what the BOX says about itself as something the user typed.- * So every opencode pane was permanently "holding a draft": never idle, and every retarget and model- * switch refused as AGENT_BUSY over an empty composer. Same symptom hermes had, opposite cause —- * there the placeholder was not recognised, here the wrong line was read.+ * The generic reader cannot read either one. OpenCode's `┃` does not stop at the text: the last+ * gutter line is the box's own STATUS strip — `Build · <model> · <account>`, sitting directly on+ * the rule that closes the box — so taking the last line carrying the marker reads what the BOX says+ * about itself as something the user typed. Copilot fails one step earlier: its composer carries no+ * `›`/`❯` at all, while every message the user has ALREADY SENT is echoed into the transcript as+ * `❯ <text>` in full brightness, so the generic reader walks back to the last of those and reads a+ * sent message as a draft. Either way the pane was permanently "holding a draft": never idle, and+ * every retarget and model switch refused as AGENT_BUSY over an empty composer. Third variant of the+ * failure hermes had — there the placeholder was not recognised, here the wrong line is read.*- * The composer is therefore the gutter MINUS that strip, and the strip is identified by WHERE it is- * — the gutter line the closing rule sits under — rather than by what it says, which is three- * variable fields that change with the model, the mode and the account. When no rule follows, no- * strip is assumed and every gutter line counts as composer: a layout we do not recognise must not- * silently swallow a line the user typed in.+ * [hasStatusStrip] is the one thing that differs between the two, and it is OpenCode's alone. The+ * strip is identified by WHERE it is — the gutter line the closing rule sits under — rather than by+ * what it says, which is three variable fields that change with the model, the mode and the account.+ * When no rule follows, no strip is assumed and every gutter line counts as composer: a layout we do+ * not recognise must not silently swallow a line the user typed in. Copilot's box has no strip, so+ * its single gutter line IS the composer and dropping it would read a real draft as an empty prompt+ * — the one direction this must never be wrong in.** Every gutter line is checked, not just the last: a long message wraps down the box, and reading* one line of it would call a full composer empty.+ *+ * A dialog needs no special case in either engine: both REPLACE the composer with the picker or the+ * permission prompt, so no gutter is on screen at all and the pane reads not-idle from the empty run+ * below rather than from [DIALOG_UI].*/-function inspectOpencodePane(capture: string): PaneInspection {+function inspectGutterBoxPane(capture: string, hasStatusStrip: boolean): PaneInspection {const rawLines = capture.split('\n')const marks = /┃/u// The LAST contiguous run of gutter lines. Earlier runs are previous composers still in scrollback@@ -210,8 +220,8 @@ function inspectOpencodePane(capture: string): PaneInspection {}if (gutter.length === 0) return { idle: false, plan: false, dialog: false, draft: false }const last = gutter[gutter.length - 1]- const closed = last + 1 < rawLines.length && OPENCODE_BOX_RULE.test(stripAnsi(rawLines[last + 1]))- const composer = closed ? gutter.slice(0, -1) : gutter+ const closed = last + 1 < rawLines.length && GUTTER_BOX_RULE.test(stripAnsi(rawLines[last + 1]))+ const composer = hasStatusStrip && closed ? gutter.slice(0, -1) : gutterconst currentUi = stripAnsi(rawLines.slice(gutter[0]).join('\n')).replace(/\u00a0/g, ' ')const dialog = DIALOG_UI.test(currentUi)const draft = composer.some((index) => {