@aiwayds/dsh-tui-pi 2.10.0 → 2.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,28 +7,32 @@
7
7
  * - `maxAgents` caps concurrent live children. A `tools.guard` registered on
8
8
  * the plugin root ctx denies model-facing spawn tools once the bridge's
9
9
  * live child count meets the cap. The live-child COUNT covers every child
10
- * in the process, but like `disableSubagent` the DENIAL is scoped to
11
- * sessions this bridge created or resumed (`TUI_SURFACE_KEY`): unmarked
12
- * callers fail open. The workflow/ralph fan-out bypasses the tool pipeline (its worker thread
13
- * spawns through the subagent provider directly), so a `subagent/start`
14
- * listener prunes any newcomer that slips past the guard.
10
+ * in the process, but the DENIAL scope is "belongs to this TUI": a caller
11
+ * carrying the surface marker, or any live descendant of a marked root
12
+ * (the ancestor walk closes the host-created-children hole). Foreign
13
+ * roots fail open. The workflow/ralph fan-out bypasses the tool pipeline
14
+ * (its worker thread spawns through the subagent provider directly), so a
15
+ * `subagent/start` listener prunes any newcomer that slips past the guard
16
+ * — same ownership scope, decided by the child's parent ancestry.
15
17
  * - `disableSubagent` disables the plain native `subagent` tool: its calls
16
- * are denied for every TUI session (and it is hidden from the main
18
+ * are denied for every TUI-scoped caller (and it is hidden from the main
17
19
  * agent's catalog), so delegation goes through registered agent
18
20
  * definitions (`~/.dsh/agents/*.md` via the registry's `use_agent`).
19
- * `subagent_fork`, `workflow` and `ralph` stay available. Enforcement is
20
- * scoped to sessions this bridge created or resumed (see
21
- * `TUI_SURFACE_KEY`): the guard reads the calling agent's surface marker
22
- * and FAILS OPEN for everything else, so a future web-profile deployment
23
- * of this plugin never disables the native tool inside Web UI sessions.
21
+ * `subagent_fork`, `workflow` and `ralph` stay available.
24
22
  * - `maxRounds` caps a child's assistant messages (each LLM round-trip is
25
- * one "round"): on the bridge's `onRoundCount` the policy injects one
26
- * plugin-sourced user message telling the child to wrap up via `steer()`
27
- * while the child runs (consumed at the next STEP boundary, the very next
28
- * LLM round-trip) or `followup()` when idle, mirroring the Ctrl+G steer
29
- * routing. The child's log shows the injection with a `⚡` marker on the
30
- * compact line and in the subagent viewer, so an ignored wrap-up is
31
- * visible, not silent.
23
+ * one "round") through a TWO-STAGE ladder. Stage 1: at the cap the
24
+ * per-agent tier when the child's label resolves to an agent .md
25
+ * `maxRounds` frontmatter key, else the global setting the policy
26
+ * injects one plugin-sourced user message telling the child to wrap up
27
+ * (`steer()` while running, `followup()` when idle). Stage 2: after
28
+ * `maxRoundsGrace` further rounds, `state.cancelChild` force-stops the
29
+ * run — code, not persuasion; a one-shot run settles `aborted` with its
30
+ * partial output in the parent's tool result, a continuable child's
31
+ * session and inbox survive for resume. `grace: 0` collapses the ladder
32
+ * to the historical warn-only behavior. Every injection carries a `⚡`
33
+ * marker in the compact line and the subagent viewer; every hard stop is
34
+ * reported to the bridge for the `⏻` marker — an ignored wrap-up is
35
+ * visible, and so is its enforcement.
32
36
  */
33
37
  import { createUserMessage } from '@deepseek-ai/dsh-llm';
34
38
  import { SessionId } from '@deepseek-ai/dsh-session';
@@ -132,17 +136,94 @@ function isTuiSurfaceAgent(agent) {
132
136
  return false;
133
137
  }
134
138
  }
139
+ /**
140
+ * The id string of one live agent, when it exposes one.
141
+ */
142
+ /**
143
+ * Whether the caller belongs to THIS TUI, directly (a surface-marked scope)
144
+ * or through descent from a marked root — the ancestor walk.
145
+ *
146
+ * The marker is only provided on the session setups the TUI itself runs
147
+ * (create and resume): child agents are created by the HOST's subagent
148
+ * materialization, whose setup is fixed and carries no marker, so a child
149
+ * delegating further (a `deep >= 1` agent spawning grandchildren, or any
150
+ * spawn tool call made from inside a child) read as unmarked and failed
151
+ * open. The walk closes that hole along live parentage: starting from the
152
+ * caller's `session.header.parentSession`, it steps through the in-process
153
+ * agent registry (`ctx.agents.get`) and checks each ancestor for the
154
+ * marker.
155
+ *
156
+ * Bounded and defensive: at most {@link ANCESTOR_WALK_MAX_DEPTH} hops
157
+ * (real delegation chains are shallow — dsh's own native `maxDepth` default
158
+ * is 3), a visited set guards against corrupt/cyclic headers, and every
159
+ * structural read is try-guarded. Any miss (absent parent header, a parent
160
+ * not live in this process, a thrown registry access) terminates the walk
161
+ * as NOT TUI-owned — fail-open preserved for foreign roots (a feishu-created
162
+ * session and its subtree never became enforceable here).
163
+ */
164
+ function callerBelongsToTui(ctx, agent) {
165
+ if (isTuiSurfaceAgent(agent))
166
+ return true;
167
+ // The walk needs the caller's session header; read it defensively.
168
+ let header;
169
+ try {
170
+ header = agent?.session?.header;
171
+ }
172
+ catch {
173
+ return false;
174
+ }
175
+ const visited = new Set();
176
+ let parentId = header?.parentSession;
177
+ for (let depth = 0; depth < ANCESTOR_WALK_MAX_DEPTH && parentId !== undefined; depth += 1) {
178
+ const key = String(parentId);
179
+ if (visited.has(key))
180
+ return false;
181
+ visited.add(key);
182
+ let ancestor;
183
+ try {
184
+ ancestor = ctx.agents.get(SessionId(parentId));
185
+ }
186
+ catch {
187
+ return false;
188
+ }
189
+ if (ancestor === undefined)
190
+ return false;
191
+ if (isTuiSurfaceAgent(ancestor))
192
+ return true;
193
+ // Step up: the ancestor's own header (its parentSession is another
194
+ // agent's session id), never the caller's again — the visited set makes
195
+ // that case unreachable anyway.
196
+ let next;
197
+ try {
198
+ next = ancestor.session?.header?.parentSession;
199
+ }
200
+ catch {
201
+ return false;
202
+ }
203
+ if (next === undefined || String(next) === key)
204
+ return false;
205
+ parentId = next;
206
+ }
207
+ return false;
208
+ }
209
+ /** Walk depth cap: dsh's native depth default is 3; 4 hops cover it with room. */
210
+ const ANCESTOR_WALK_MAX_DEPTH = 4;
135
211
  /**
136
212
  * The wrap-up message injected into a child that reached `maxRounds`.
137
213
  * English and directive on purpose: it is a policy instruction to the child
138
214
  * LLM, and a soft "please summarize" (the earlier one-line Chinese request)
139
215
  * was routinely ignored while the child kept calling tools. It names the
140
- * limit, forbids further tool calls, and demands a final-answer summary.
216
+ * limit, forbids further tool calls, and demands a final-answer summary
217
+ * and, with a positive grace window, warns that the run is force-stopped
218
+ * if the summary does not land within it.
141
219
  */
142
- export function wrapupMessage(maxRounds) {
143
- return `Round limit reached (${maxRounds} LLM round-trips, set by the dsh-tui maxRounds policy). `
220
+ export function wrapupMessage(maxRounds, grace) {
221
+ const base = `Round limit reached (${maxRounds} LLM round-trips, set by the dsh-tui maxRounds policy). `
144
222
  + 'Do NOT call any more tools. Finish this task NOW: summarize what you have accomplished so far, '
145
223
  + 'state clearly what remains undone, and return that summary as your final answer.';
224
+ return grace > 0
225
+ ? `${base} You have ${grace} more round${grace === 1 ? '' : 's'} before this run is force-stopped.`
226
+ : base;
146
227
  }
147
228
  /**
148
229
  * Install the subagent policy on the plugin root ctx.
@@ -151,11 +232,15 @@ export function wrapupMessage(maxRounds) {
151
232
  * is defensive: a settings-less deployment resolves the defaults, so the
152
233
  * policy still enforces its documented caps.
153
234
  * @param state - the host's live view (bridge.getLiveChildren /
154
- * bridge.getRoundCount). The guard and the round injection read it at every
235
+ * bridge.getRoundCount). The guard and the round ladder read it at every
155
236
  * decision — no snapshot, no watch.
237
+ * @param resolveAgentCap - the per-agent round cap lookup (agent .md
238
+ * frontmatter `maxRounds` via the registry contract). `undefined`/throwing
239
+ * resolutions fall back to the global cap, never widen it. Omitted = the
240
+ * global cap always applies.
156
241
  * @returns the policy handle wired to the bridge's `onRoundCount`.
157
242
  */
158
- export function applySubagentPolicy(ctx, state) {
243
+ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
159
244
  const disposers = [];
160
245
  const injected = new Set();
161
246
  /** Set by dispose: a pending deferred injection must not fire afterwards. */
@@ -189,7 +274,11 @@ export function applySubagentPolicy(ctx, state) {
189
274
  disposers.push(tools.guard((exec) => {
190
275
  if (!SPAWN_TOOLS.includes(exec.name))
191
276
  return undefined;
192
- if (!isTuiSurfaceAgent(exec.agent))
277
+ // Enforcement scope: the caller carries the surface marker OR descends
278
+ // from a marked root (the ancestor walk closes the child-delegation
279
+ // hole — host-created children carry no marker of their own). Foreign
280
+ // roots still fail open.
281
+ if (!callerBelongsToTui(ctx, exec.agent))
193
282
  return undefined;
194
283
  if (readSubagentLimits(ctx).disableSubagent && NATIVE_SPAWN_TOOLS.includes(exec.name)) {
195
284
  return `Tool "subagent" is disabled here - delegation goes through registered agents. `
@@ -202,7 +291,7 @@ export function applySubagentPolicy(ctx, state) {
202
291
  if (live.length < maxAgents)
203
292
  return undefined;
204
293
  const running = live.map((agent) => agent.label).join(', ');
205
- return `Agent limit reached (${live.length}/${maxAgents}): ${running} still running — wait for one to finish or use list_agents before spawning more.`;
294
+ return `Agent limit reached (${live.length}/${maxAgents}): ${running} still running — wait for them to finish before spawning more.`;
206
295
  }));
207
296
  }
208
297
  // Workflow/ralph backstop: the worker thread fans children out through the
@@ -211,6 +300,12 @@ export function applySubagentPolicy(ctx, state) {
211
300
  // foreign to this bundle's type environment (`@deepseek-ai/dsh-subagent` is
212
301
  // not installed), so the subscription rides the base event bus rather than
213
302
  // the typed `ctx.on`.
303
+ //
304
+ // Scope: the event payload names only the child, no caller, so TUI
305
+ // ownership is decided by the child's own ancestry — a child whose live
306
+ // parent chain roots at a marked TUI session is prunable; a foreign root
307
+ // (feishu, web) never is. The walk runs on the child's PARENT, which is
308
+ // exactly the surface the guard caller would have been — one hop saved.
214
309
  const eventDisposer = ctx.events.on('subagent/start', (info) => {
215
310
  if (info?.id === undefined)
216
311
  return;
@@ -225,6 +320,15 @@ export function applySubagentPolicy(ctx, state) {
225
320
  const live = state.getLive().filter(view => view.childId !== String(info.id));
226
321
  if (live.length < maxAgents)
227
322
  return;
323
+ // Ownership check AFTER the cheap count gate: only an overshooting
324
+ // newcomer whose tree roots here gets cancelled.
325
+ const child = ctx.agents.get(info.id);
326
+ const parentSession = child?.session?.header?.parentSession;
327
+ const parent = typeof parentSession !== 'string' || parentSession === ''
328
+ ? undefined
329
+ : ctx.agents.get(SessionId(parentSession));
330
+ if (parent === undefined || !callerBelongsToTui(ctx, parent))
331
+ return;
228
332
  ctx.agents.get(info.id)?.cancel({
229
333
  kind: 'hook',
230
334
  reason: 'over the dsh-tui maxAgents policy cap — prune a fan-out child',
@@ -232,16 +336,21 @@ export function applySubagentPolicy(ctx, state) {
232
336
  });
233
337
  disposers.push(eventDisposer);
234
338
  /**
235
- * Bridge round-count sink: inject the summary message exactly once per
236
- * child, at the first message count that reaches a positive `maxRounds`. A
237
- * missing agent (cold, or transiently unregistered) is skipped silently; a
238
- * settled child is skipped too injecting into a finished one would wake
239
- * it for a pointless wrap-up round (continuable children that resume later
240
- * get their chance on the next counted round). Repeated injections are
241
- * impossible by construction (the `injected` set is only written once per
242
- * child, and only after a successful send) including the wrap-up's
243
- * OWN assistant message, which pushes the count past `maxRounds` and must
244
- * not re-trigger.
339
+ * Bridge round-count sink, driving the two-stage ladder:
340
+ *
341
+ * Stage 1 wrap-up injection at the first count reaching the cap
342
+ * (per-agent when one resolves for this child's label, else the global
343
+ * `maxRounds`): exactly one plugin-sourced message telling the child to
344
+ * finish now. Most children comply here; the ladder ends for them.
345
+ *
346
+ * Stage 2 hard stop at `cap + grace` when the child kept burning rounds
347
+ * past the wrap-up: `state.cancelChild` force-stops the run (code, not
348
+ * persuasion), the stop is reported through `onHardStop` for the `⏻`
349
+ * marker, and the child's stage state is cleared (a continuable child
350
+ * resumed later re-enters the ladder at its next counted round).
351
+ *
352
+ * `grace: 0` collapses the ladder to stage 1 only — the historical
353
+ * pure-soft behavior.
245
354
  *
246
355
  * Delivery is ROUTED by the child's live status (the same split the Ctrl+G
247
356
  * steer flow uses): a RUNNING child takes `steer()` — consumed at the next
@@ -252,13 +361,48 @@ export function applySubagentPolicy(ctx, state) {
252
361
  * (its own ordinary turn).
253
362
  */
254
363
  function onRoundCount(childId, count) {
255
- if (injected.has(childId))
364
+ if (disposed)
365
+ return;
366
+ const label = state.getLive().find(view => view.childId === childId)?.label
367
+ ?? injectedLabel.get(childId);
368
+ const caps = resolveCaps(childId, label);
369
+ if (caps === undefined)
256
370
  return;
257
- const maxRounds = readSubagentLimits(ctx).maxRounds;
258
- if (maxRounds <= 0)
371
+ const { cap, grace } = caps;
372
+ if (count < cap)
259
373
  return;
260
- if (count < maxRounds)
374
+ // Stage 2: grace exhausted past a delivered wrap-up — force-stop.
375
+ if (injected.has(childId)) {
376
+ if (grace <= 0)
377
+ return; // pure-soft mode: warn only, never stop
378
+ if (count < cap + grace)
379
+ return;
380
+ // Already stopped for this stage (the stop's own settlement events
381
+ // can re-enter onRoundCount before the view settles): no-op.
382
+ if (hardStopped.has(childId))
383
+ return;
384
+ if (state.isSettled(childId))
385
+ return; // self-completed in time: leave it
386
+ hardStopped.add(childId);
387
+ const stopped = state.cancelChild(childId);
388
+ if (stopped) {
389
+ try {
390
+ onHardStopSink?.({ childId, round: count, cap, grace });
391
+ }
392
+ catch {
393
+ // A reporting failure must not touch the stop itself.
394
+ }
395
+ }
396
+ else {
397
+ // Nothing live to stop (a raced settle/vanished handle) — keep the
398
+ // stage marker so later counts of the same ladder cannot re-arm.
399
+ }
261
400
  return;
401
+ }
402
+ // Stage 1 gate order: settle check BEFORE agent lookup (a finished child
403
+ // must not be woken for a pointless wrap-up), agent lookup before the
404
+ // defer (a missing handle is skipped silently — cold or transiently
405
+ // unregistered).
262
406
  if (state.isSettled(childId))
263
407
  return;
264
408
  const agent = ctx.agents.get(SessionId(childId));
@@ -283,7 +427,7 @@ export function applySubagentPolicy(ctx, state) {
283
427
  return;
284
428
  try {
285
429
  const message = createUserMessage({
286
- content: [{ type: 'text', text: wrapupMessage(maxRounds) }],
430
+ content: [{ type: 'text', text: wrapupMessage(cap, grace) }],
287
431
  source: { kind: 'plugin', plugin: 'dsh-tui-pi' },
288
432
  });
289
433
  if (agent.status === 'running')
@@ -298,10 +442,57 @@ export function applySubagentPolicy(ctx, state) {
298
442
  return;
299
443
  }
300
444
  injected.add(childId);
445
+ // Remember the label the cap was resolved from: stage 2 counts arrive
446
+ // after the child may have dropped off the live board.
447
+ if (label !== undefined)
448
+ injectedLabel.set(childId, label);
301
449
  });
302
450
  }
451
+ /** Per-child resolved caps, frozen at the first crossing (stage 1 or 2). */
452
+ const resolvedCaps = new Map();
453
+ /** Labels remembered at wrap-up time, for stage-2 resolution after settle-off. */
454
+ const injectedLabel = new Map();
455
+ /** Children whose stage-2 hard stop already fired (or found nothing to stop). */
456
+ const hardStopped = new Set();
457
+ /** Optional host sink for hard-stop records (the `⏻` marker fold). */
458
+ let onHardStopSink;
459
+ /**
460
+ * Resolve one child's effective caps. Per-agent first (the label→cap
461
+ * lookup through the registry contract — an agent without a frontmatter
462
+ * `maxRounds`, an ambiguous display name, or any lookup failure falls
463
+ * back to the global cap), grace always from the live settings. Resolved
464
+ * once per child and cached: the ladder's stage 2 must not shift its cap
465
+ * mid-flight (a settings edit mid-run would otherwise move the goalposts
466
+ * between warn and stop).
467
+ */
468
+ function resolveCaps(childId, label) {
469
+ const cached = resolvedCaps.get(childId);
470
+ if (cached !== undefined)
471
+ return cached;
472
+ const limits = readSubagentLimits(ctx);
473
+ const globalCap = limits.maxRounds;
474
+ if (globalCap <= 0)
475
+ return undefined;
476
+ let cap = globalCap;
477
+ if (label !== undefined && resolveAgentCap !== undefined) {
478
+ try {
479
+ const perAgent = resolveAgentCap(label);
480
+ if (perAgent !== undefined && perAgent > 0)
481
+ cap = perAgent;
482
+ }
483
+ catch {
484
+ // A throwing lookup is a global-cap lookup.
485
+ }
486
+ }
487
+ const caps = { cap, grace: limits.maxRoundsGrace };
488
+ resolvedCaps.set(childId, caps);
489
+ return caps;
490
+ }
303
491
  return {
304
492
  onRoundCount,
493
+ set onHardStop(sink) {
494
+ onHardStopSink = sink;
495
+ },
305
496
  dispose() {
306
497
  disposed = true;
307
498
  for (const dispose of disposers.splice(0)) {
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-policy.js","sourceRoot":"","sources":["../src/subagent-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sB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EAAE,CAAA;QAChE,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO;QACL,YAAY;QACZ,IAAI,UAAU,CAAC,IAAoD;YACjE,cAAc,GAAG,IAAI,CAAA;QACvB,CAAC;QACD,OAAO;YACL,QAAQ,GAAG,IAAI,CAAA;YACf,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1C,IAAI,CAAC;oBAAC,OAAO,EAAE,CAAA;gBAAC,CAAC;gBAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -48,8 +48,8 @@ import { type TuiTheme } from './theme/index.ts';
48
48
  export declare const STEER_SENT_NOTICE = "Steer message sent";
49
49
  /** Notice shown when the target child can no longer receive steering. */
50
50
  export declare const STEER_ENDED_NOTICE = "This subagent has ended \u2014 steering unavailable";
51
- /** Transcript footer for a RUNNING child: x ×2 stops it. */
52
- export declare const VIEWER_FOOTER_RUNNING = "\u2191\u2193 scroll \u00B7 Esc close \u00B7 x \u00D72 stop \u00B7 Enter steer";
51
+ /** Transcript footer for a RUNNING child: x ×2 or k ×2 stops it. */
52
+ export declare const VIEWER_FOOTER_RUNNING = "\u2191\u2193 scroll \u00B7 Esc close \u00B7 x \u00D72 / k \u00D72 stop \u00B7 Enter steer";
53
53
  /** Transcript footer for a SETTLED child: nothing to stop, x ×2 closes. */
54
54
  export declare const VIEWER_FOOTER_SETTLED = "\u2191\u2193 scroll \u00B7 Esc close \u00B7 x \u00D72 close \u00B7 Enter steer";
55
55
  /**
@@ -129,6 +129,8 @@ export declare function buildSteerMessage(text: string): {
129
129
  * a retry instead of losing the message silently.
130
130
  */
131
131
  export declare function deliverSubagentSteer(view: AgentView | undefined, agent: SteerableAgent | undefined, text: string): SteerDelivery;
132
+ /** Human elapsed display: under a minute as `42.1s`, then `3m12s`. */
133
+ export declare function formatElapsed(ms: number): string;
132
134
  /**
133
135
  * The one human-readable line per buffered event. `callNames` pairs
134
136
  * `tool/result` rows back to their `tool/call` name (call ids are opaque).
@@ -142,11 +144,17 @@ export declare function eventLines(events: readonly SessionEvent[]): string[];
142
144
  /**
143
145
  * The picker rows: running children first (the live items the key is for),
144
146
  * then the five most recent settled ones (newest settle first). Each row
145
- * reads `⠋ label [mode] · rounds N[/max]` with the token spend, the dsh-dcp
146
- * compaction count (when > 0) and elapsed seconds in the muted description
147
- * column.
147
+ * reads `⠋ label [mode] · rounds N[/max] · model` with the token spend, the
148
+ * dsh-dcp compaction count (when > 0) and elapsed seconds in the muted
149
+ * description column.
148
150
  */
149
151
  export declare function pickerItems(views: readonly AgentView[], getRoundCount: (childId: string) => number, maxRounds: number, getCompactionCount?: (childId: string) => number): SelectItem[];
152
+ /**
153
+ * The model tail of a `provider/model` route (`opencode-go/hy3` → `hy3`),
154
+ * for scan-friendly list rows; `undefined` for an unknown route or a
155
+ * slash-less one (nothing meaningful to shorten).
156
+ */
157
+ export declare function shortModelName(route: string | undefined): string | undefined;
150
158
  /**
151
159
  * The next selected index after a picker items swap, preserving the selection
152
160
  * by item value. `previous === undefined` (no selection yet) starts at 0; a
@@ -182,6 +190,8 @@ export declare class SubagentViewerPanel implements Component {
182
190
  private timer;
183
191
  /** Timestamp of the last handled `x` press; 0 = none (the double-press arm). */
184
192
  private lastXPress;
193
+ /** Timestamp of the last handled `k` press; 0 = none (the double-press arm). */
194
+ private lastKPress;
185
195
  /** Current scroll offset into the transcript lines. */
186
196
  private scrollTop;
187
197
  /** Whether the view is pinned to the log tail (default, re-set on the bottom). */
@@ -200,8 +210,15 @@ export declare class SubagentViewerPanel implements Component {
200
210
  showNotice(text: string): void;
201
211
  /** Scroll the window; re-attach to the tail when it reaches the bottom. */
202
212
  private scrollBy;
203
- /** One-line child summary: colored status, the rest in the accent bold. */
204
- private headerLine;
213
+ /**
214
+ * The three-line header (layout A): identity + status, the model route
215
+ * line, the activity/budget line. The route line puts the child's LLM
216
+ * route (`provider/model` + thinking) first and demotes the subagent
217
+ * transport (`spawn` — near-zero information) to the tail; the old single
218
+ * line conflated the two under one `provider` field. Narrow terminals
219
+ * truncate in a fixed order: transport first, then elapsed, route last.
220
+ */
221
+ private headerLines;
205
222
  }
206
223
  /** Options for the steer input overlay — see {@link SteerInputPanel}. */
207
224
  export interface SteerInputOptions {