feat(opencode): show the model an opencode session runs in its tile and split headers

An opencode tile showed only the session name, while Claude Code, codex and
DeepSeek tiles add `· <model>`: opencode declared no `modelDetect`, so its
screen was never read for a model and it is launched without a model param.

opencode draws the model on its composer's agent row, directly above the
box's bottom edge: `┃  Build  Big Pickle OpenCode Zen`. Read from its own
1.3.0 source, the row is the agent, the model's name, the provider's name and
`· <variant>` when the model has one, and only colour tells model from
provider. So the field is all of it, exactly what opencode itself shows (the
owner's choice over a short id that only appears after the first reply).

- The pattern anchors on that row sitting directly above the `╹` edge, ends
  the field at a double space (where the 200-column layout's sidebar shares
  the row), skips the `No provider selected` placeholder, and takes the LAST
  such row in the window through a lookahead, so a composer-shaped row the
  agent prints higher up can never stand in for it. A test with a forged pair
  inside the window fails without the lookahead.
- It reads 8 rows: the home screen puts up to five rows of opencode's own
  chrome under the composer (key hints, a tip, the cwd/version row). The
  schema's `screenLines` bound goes from 4 to 8, the reader's own cap; the
  comment there records why a taller window is only safe with such a pattern.
- A permission prompt or shell mode hides the row; the last model is kept.

Measured against every captured opencode 1.3.0 frame (home screen and in
session, 40/60/120/200 columns, mid-turn and at rest, permission prompt):
the model was read everywhere it is drawn and nowhere else. Live on an
isolated instance from this branch, a restored opencode session published
`displayModel: Big Pickle OpenCode Zen` (source: screen) and its tile header
rendered `oc-home · Big Pickle OpenCode Zen`. The owner's own home-screen pane
on the 1.36.0 beta reads the same.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-10-09 03:37:42 +02:00
parent 7d8c188f83
commit 7e2b9ed8f6
5 changed files with 150 additions and 4 deletions
+4 -2
View File
@@ -385,8 +385,10 @@ const capabilitiesSchema = z
)
.optional(),
// Bounded hard, like watchingLines: every row it adds is one more row the agent
// itself may be able to write.
screenLines: z.number().int().min(1).max(4).optional(),
// itself may be able to write. 8 is the reader's own cap (readScreenModel); a
// window taller than the CLI's footer needs a pattern only that CLI's chrome can
// satisfy at its position, as opencode's does by taking the LAST composer row.
screenLines: z.number().int().min(1).max(8).optional(),
// Single tokens, bounded: each is compared against one captured field.
rejectWords: z.array(z.string().min(1).max(40).regex(/^\S+$/)).max(32).optional(),
// A NAMED reader (src/model-config-resolvers.ts), never code in config.
+16
View File
@@ -514,6 +514,22 @@ const OPENCODE: CliEntry = {
promptGlyph: '┃',
workingLine: '[⬝■]{8}',
},
// The composer's agent row, measured on live opencode 1.3.0 panes (home screen and in
// session, at 40, 60, 120 and 200 columns, 2026-10-09): `┃ Build Big Pickle OpenCode
// Zen`, directly above the box's bottom edge `╹▀▀▀`. opencode renders it as the agent,
// then the model's name, then the provider's name (then `· <variant>` when the model
// has one), and only colour tells model from provider, so the field is all of it: what
// opencode itself shows, owner's choice. A double space ends it, which is where the
// 200-column layout's sidebar shares the row. The lookahead takes the LAST such row in
// the window, so nothing the agent prints higher up can stand in for it; below the
// composer there is only opencode's own chrome (key hints, a tip, the cwd/version
// row), which is why the window can be 8 rows: the home screen puts up to 5 of those
// rows under it. A permission prompt or shell mode hides the row, and the last model
// is kept. `No provider ` is opencode's placeholder before a provider is connected.
modelDetect: {
screenLine: String.raw`┃ {2}[^\s·]+ {2}(?!No provider )([^ \n](?:[^ \n]| (?! ))*)(?: {2}.*)?\n *╹(?![\s\S]*\n *╹)`,
screenLines: 8,
},
// opencode's global config dir is xdg-basedir's `$XDG_CONFIG_HOME/opencode`.
mcpConfig: {
path: '.config/opencode/opencode.json',