@aiwayds/dsh-tui-pi 2.23.0 → 2.24.0

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.
@@ -21,6 +21,6 @@ declare module '@deepseek-ai/dsh-llm' {
21
21
  /** The producer source of one dsh-tui-pi-injected user message. */
22
22
  export interface TuiPiMessageSource {
23
23
  kind: 'dsh-tui-pi';
24
- /** Which tui-pi surface produced the injection. */
25
- surface: 'btw' | 'steer' | 'wrapup';
24
+ /** Which tui-pi surface produced the injection (`wrapup-early`: the spin-detected early wrap-up). */
25
+ surface: 'btw' | 'steer' | 'wrapup' | 'wrapup-early';
26
26
  }
@@ -62,6 +62,15 @@ export declare const SPAWN_TOOLS: readonly string[];
62
62
  * `workflow` and `ralph` (fan-out loops) stay available.
63
63
  */
64
64
  export declare const NATIVE_SPAWN_TOOLS: readonly string[];
65
+ /**
66
+ * Spin-detected early-stop inputs (wayfinder ticket 05): a streak of this
67
+ * many consecutive high-segment spin verdicts arms the tighten-only ladder
68
+ * legs, and the wrap-up never fires before this round floor — everything
69
+ * looks repetitive in a young child's first rounds.
70
+ */
71
+ export declare const EARLY_STOP_SPIN_STREAK = 2;
72
+ /** The early wrap-up's rounds floor: `max(10, ⌊cap/3⌋)` of the child's cap. */
73
+ export declare function earlyFloor(cap: number): number;
65
74
  /**
66
75
  * Hide the plain `subagent` tool from ONE agent's tool catalog (best-effort).
67
76
  * The disableSubagent guard DENIES calls at execution; this additionally
@@ -115,6 +124,15 @@ export declare function markTuiSurface(agentCtx: Context): void;
115
124
  * if the summary does not land within it.
116
125
  */
117
126
  export declare function wrapupMessage(maxRounds: number, grace: number): string;
127
+ /**
128
+ * The spin-detected early wrap-up (wayfinder ticket 05): the attention
129
+ * ranking judged this child circling twice while still far from its cap.
130
+ * Same ask as `wrapupMessage` — stop tools, return a summary — but the
131
+ * reason is unproductive repetition, not budget exhaustion, and the tone
132
+ * leaves a door open in case the judgment is wrong (a resumed continuable
133
+ * child re-enters the ladder fresh).
134
+ */
135
+ export declare function wrapupMessageEarly(): string;
118
136
  /** The policy's live backstop — the bridge's per-child accessors. */
119
137
  export interface SubagentPolicyState {
120
138
  /** Current live (not settled) children — the count the `maxAgents` guard caps. */
@@ -126,6 +144,15 @@ export interface SubagentPolicyState {
126
144
  getRoundCount(childId: string): number;
127
145
  /** Whether one child already settled — a settled child is never re-awakened. */
128
146
  isSettled(childId: string): boolean;
147
+ /**
148
+ * The attention ranking's deny-copy hint (heuristic base, optional jev
149
+ * layer): the most attention-worthy live child, when one ranks above ok.
150
+ * Absent ⇒ the ranking has nothing to say and the denial copy stays as-is.
151
+ */
152
+ getAttentionHint?(): {
153
+ label: string;
154
+ detail: string;
155
+ } | undefined;
129
156
  /**
130
157
  * Forcibly stop one live child (the everything-stop's per-child idiom,
131
158
  * `cancel({kind:'user'}, {keepInbox:true})`): a one-shot run settles
@@ -134,6 +161,17 @@ export interface SubagentPolicyState {
134
161
  * inbox survive for later resume. `false` when nothing live was found.
135
162
  */
136
163
  cancelChild(childId: string): boolean;
164
+ /**
165
+ * The attention ranking's spin-strike state (wayfinder ticket 05's input):
166
+ * consecutive high-segment spin verdicts plus the clock of the latest —
167
+ * the ladder treats a strike as evidence only while fresh
168
+ * (`lastStrikeAt` within the stale window) and, for the early stop, only
169
+ * when it postdates the delivered wrap-up. Absent ⇒ no spin evidence.
170
+ */
171
+ getSpinState?(childId: string): {
172
+ streak: number;
173
+ lastStrikeAt: number;
174
+ };
137
175
  }
138
176
  /**
139
177
  * A hard stop the policy executed on one child, surfaced through the policy
@@ -142,12 +180,14 @@ export interface SubagentPolicyState {
142
180
  export interface HardStopRecord {
143
181
  /** The child session id the stop was issued to. */
144
182
  readonly childId: string;
145
- /** Round count at which the stop fired (`cap + grace`). */
183
+ /** Round count at which the stop fired (`cap + grace`, or earlier when spin-detected). */
146
184
  readonly round: number;
147
- /** The cap that was exceeded (per-agent when one resolved, else global). */
185
+ /** The cap that was exceeded (per-agent when one resolved, else the global). */
148
186
  readonly cap: number;
149
- /** The grace window that was exhausted. */
187
+ /** The grace window of the ladder that fired. */
150
188
  readonly grace: number;
189
+ /** Set when the stop fired BEFORE the grace window — the spin-detected early stop. */
190
+ readonly early?: true;
151
191
  }
152
192
  /**
153
193
  * Cumulative subagent-runtime counters since the policy was installed (this
@@ -49,6 +49,7 @@
49
49
  */
50
50
  import { createUserMessage } from '@deepseek-ai/dsh-llm';
51
51
  import { SessionId } from '@deepseek-ai/dsh-session';
52
+ import { SPIN_STRIKE_STALE_MS } from "./attention.js";
52
53
  import { readSubagentLimits } from "./theme-settings.js";
53
54
  /**
54
55
  * Tool names the maxAgents guard intercepts: the native subagent tool, the
@@ -72,6 +73,17 @@ export const SPAWN_TOOLS = [
72
73
  export const NATIVE_SPAWN_TOOLS = [
73
74
  'subagent',
74
75
  ];
76
+ /**
77
+ * Spin-detected early-stop inputs (wayfinder ticket 05): a streak of this
78
+ * many consecutive high-segment spin verdicts arms the tighten-only ladder
79
+ * legs, and the wrap-up never fires before this round floor — everything
80
+ * looks repetitive in a young child's first rounds.
81
+ */
82
+ export const EARLY_STOP_SPIN_STREAK = 2;
83
+ /** The early wrap-up's rounds floor: `max(10, ⌊cap/3⌋)` of the child's cap. */
84
+ export function earlyFloor(cap) {
85
+ return Math.max(10, Math.floor(cap / 3));
86
+ }
75
87
  /**
76
88
  * Hide the plain `subagent` tool from ONE agent's tool catalog (best-effort).
77
89
  * The disableSubagent guard DENIES calls at execution; this additionally
@@ -247,6 +259,20 @@ export function wrapupMessage(maxRounds, grace) {
247
259
  ? `${base} You have ${grace} more round${grace === 1 ? '' : 's'} before this run is force-stopped.`
248
260
  : base;
249
261
  }
262
+ /**
263
+ * The spin-detected early wrap-up (wayfinder ticket 05): the attention
264
+ * ranking judged this child circling twice while still far from its cap.
265
+ * Same ask as `wrapupMessage` — stop tools, return a summary — but the
266
+ * reason is unproductive repetition, not budget exhaustion, and the tone
267
+ * leaves a door open in case the judgment is wrong (a resumed continuable
268
+ * child re-enters the ladder fresh).
269
+ */
270
+ export function wrapupMessageEarly() {
271
+ return 'This run appears to be going in circles — repeating work without forward progress, '
272
+ + 'as judged by the dsh-tui attention policy. Do NOT call any more tools. Finish NOW with what you have: '
273
+ + 'summarize what was accomplished, state clearly what remains undone, and return that summary as your final answer. '
274
+ + 'If this judgment looks wrong, say so in the summary and stop.';
275
+ }
250
276
  /**
251
277
  * Install the subagent policy on the plugin root ctx.
252
278
  *
@@ -391,9 +417,18 @@ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
391
417
  }
392
418
  stats.denied += 1;
393
419
  const running = live.map((agent) => agent.label).join(', ');
420
+ // Attention-informed denial (Charter #6): when the ranking knows a
421
+ // live child that looks stalled/spinning, the denial names it — the
422
+ // model can surface "stop <label>" to the operator (or wait) instead
423
+ // of blindly parking the task. Pure advisory copy; the cap math above
424
+ // is untouched and the hint is undefined when the ranking is off.
425
+ const hint = state.getAttentionHint?.();
426
+ const hintLine = hint === undefined
427
+ ? ''
428
+ : ` The attention ranking flags "${hint.label}" (${hint.detail}) — if it looks wasted, surface stopping it to the operator (subagent viewer) to free a slot sooner.`;
394
429
  return `Agent limit reached (${effective}/${maxAgents}): ${running} still running — do NOT retry the spawn now. `
395
430
  + 'Call subagent_status for the live board, record this task in the todo list (todo_write, status pending), '
396
- + 'and execute it after a running agent finishes and frees a slot.';
431
+ + `and execute it after a running agent finishes and frees a slot.${hintLine}`;
397
432
  }));
398
433
  }
399
434
  // Workflow/ralph backstop: the worker thread fans children out through the
@@ -475,10 +510,42 @@ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
475
510
  if (caps === undefined)
476
511
  return;
477
512
  const { cap, grace } = caps;
478
- if (count < cap)
479
- return;
480
- // Stage 2: grace exhausted past a delivered wrap-up — force-stop.
513
+ // Spin-detected early ladder (wayfinder ticket 05): TIGHTEN-ONLY legs
514
+ // consuming the attention ranking's spin strikes. A strike counts as
515
+ // evidence only while FRESH (within the stale window) and, after a
516
+ // wrap-up, only when it POSTDATES the wrap-up — "still judged circling
517
+ // through the wrap-up" is a new judgment, not the one that triggered
518
+ // it. Never widens a cap, never adds grace, and stays completely inert
519
+ // without fresh spin evidence — the ladder below is byte-for-byte the
520
+ // old one.
521
+ const spin = state.getSpinState?.(childId) ?? { streak: 0, lastStrikeAt: 0 };
522
+ const spinFresh = spin.streak >= EARLY_STOP_SPIN_STREAK && Date.now() - spin.lastStrikeAt < SPIN_STRIKE_STALE_MS;
481
523
  if (injected.has(childId)) {
524
+ const injectedAtMs = injectedAt.get(childId) ?? 0;
525
+ const roundsSinceWrapup = count - (injectedRounds.get(childId) ?? 0);
526
+ // Early stage 2: the wrap-up was delivered, at least one more round
527
+ // burned, and a FRESH spinning verdict arrived AFTER the wrap-up —
528
+ // stop now instead of eating the grace window. Applies to the normal
529
+ // cap wrap-up too (the same freshness rule).
530
+ if (grace > 0 && spin.streak >= EARLY_STOP_SPIN_STREAK && spin.lastStrikeAt > injectedAtMs
531
+ && Date.now() - spin.lastStrikeAt < SPIN_STRIKE_STALE_MS && roundsSinceWrapup >= 1) {
532
+ if (hardStopped.has(childId))
533
+ return;
534
+ if (state.isSettled(childId))
535
+ return; // complied mid-flight: leave it
536
+ hardStopped.add(childId);
537
+ const stopped = state.cancelChild(childId);
538
+ if (stopped) {
539
+ try {
540
+ onHardStopSink?.({ childId, round: count, cap, grace, early: true });
541
+ }
542
+ catch {
543
+ // A reporting failure must not touch the stop itself.
544
+ }
545
+ }
546
+ return;
547
+ }
548
+ // Stage 2: grace exhausted past a delivered wrap-up — force-stop.
482
549
  if (grace <= 0)
483
550
  return; // pure-soft mode: warn only, never stop
484
551
  if (count < cap + grace)
@@ -505,6 +572,12 @@ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
505
572
  }
506
573
  return;
507
574
  }
575
+ // Early stage 1: far from the cap but the ranking judged the child
576
+ // circling twice — pull the wrap-up forward. The rounds floor keeps a
577
+ // young child (everything looks repetitive at round 2) out.
578
+ const earlyEligible = spinFresh && count >= earlyFloor(cap) && count < cap;
579
+ if (count < cap && !earlyEligible)
580
+ return;
508
581
  // Stage 1 gate order: settle check BEFORE agent lookup (a finished child
509
582
  // must not be woken for a pointless wrap-up), agent lookup before the
510
583
  // defer (a missing handle is skipped silently — cold or transiently
@@ -533,8 +606,8 @@ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
533
606
  return;
534
607
  try {
535
608
  const message = createUserMessage({
536
- content: [{ type: 'text', text: wrapupMessage(cap, grace) }],
537
- source: { kind: 'dsh-tui-pi', surface: 'wrapup' },
609
+ content: [{ type: 'text', text: earlyEligible ? wrapupMessageEarly() : wrapupMessage(cap, grace) }],
610
+ source: { kind: 'dsh-tui-pi', surface: earlyEligible ? 'wrapup-early' : 'wrapup' },
538
611
  });
539
612
  if (agent.status === 'running')
540
613
  agent.steer(message);
@@ -548,6 +621,8 @@ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
548
621
  return;
549
622
  }
550
623
  injected.add(childId);
624
+ injectedRounds.set(childId, count);
625
+ injectedAt.set(childId, Date.now());
551
626
  // Remember the label the cap was resolved from: stage 2 counts arrive
552
627
  // after the child may have dropped off the live board.
553
628
  if (label !== undefined)
@@ -558,6 +633,10 @@ export function applySubagentPolicy(ctx, state, resolveAgentCap) {
558
633
  const resolvedCaps = new Map();
559
634
  /** Labels remembered at wrap-up time, for stage-2 resolution after settle-off. */
560
635
  const injectedLabel = new Map();
636
+ /** Round count at which stage 1 fired — the early-stop "rounds since wrap-up" baseline. */
637
+ const injectedRounds = new Map();
638
+ /** Wall clock of the stage-1 delivery — the early stop demands a spin strike AFTER it. */
639
+ const injectedAt = new Map();
561
640
  /** Children whose stage-2 hard stop already fired (or found nothing to stop). */
562
641
  const hardStopped = new Set();
563
642
  /** Optional host sink for hard-stop records (the `⏻` marker fold). */
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-policy.js","sourceRoot":"","sources":["../src/subagent-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;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
23
  import type { SubagentPolicyStats } from './subagent-policy.ts';
24
+ import type { AttentionRow } from './attention.ts';
24
25
  /** The global tool name — deliberately NOT in SPAWN_TOOLS: this spawns nothing. */
25
26
  export declare const SUBAGENT_STATUS_TOOL_NAME = "subagent_status";
26
27
  /**
@@ -33,6 +34,13 @@ export interface SubagentRuntimeSource {
33
34
  views(): readonly AgentView[];
34
35
  /** The policy's admission counters. */
35
36
  stats(): SubagentPolicyStats;
37
+ /**
38
+ * The attention ranking, highest score first (heuristic base, jev upgrade
39
+ * when configured) — absent when no child is ranked. The board renders it
40
+ * as a priority section so the model plans around the neediest child
41
+ * instead of treating every live row evenly.
42
+ */
43
+ attention?(): readonly AttentionRow[] | undefined;
36
44
  }
37
45
  /**
38
46
  * Build the tool definition. `parameters` is empty — the board takes no
@@ -96,10 +96,26 @@ export function buildSubagentStatusTool(ctx, runtime) {
96
96
  .slice(0, SETTLED_ROWS);
97
97
  const head = `subagent board — live ${stats.live}/${cap} (dsh-tui.maxAgents, 0 = unlimited)`
98
98
  + ` · admitted ${stats.allowed} · denied ${stats.denied} · pruned ${stats.pruned} · in-flight ${stats.inFlight}`;
99
+ const attention = runtime.attention?.() ?? [];
100
+ const attentionRows = attention
101
+ .filter(row => row.info.tier !== 'ok')
102
+ .map(row => `attention: ${row.info.tier === 'critical' ? '⚠' : '·'} ${row.label} — ${row.info.source} score ${row.info.score.toFixed(2)}`
103
+ + `${row.info.tag !== undefined ? ` [${row.info.tag}]` : ''}, idle ${Math.round(row.stallMs / 1000)}s`);
104
+ // A settled continuable child keeps its session and inbox — resumable
105
+ // in place; the board names them so the model can point the operator
106
+ // at the recovery affordance instead of re-delegating from scratch.
107
+ const resumable = views.filter(view => view.outcome !== undefined && view.mode === 'continuable');
108
+ const resumableLine = resumable.length > 0
109
+ ? [`resumable continuable (sessions survive; ask the operator to resume in the subagent viewer): `
110
+ + resumable.map(view => `#${view.childId.slice(0, 8)} ${view.label}`).join(', ')]
111
+ : [];
99
112
  const rows = [
113
+ ...(attentionRows.length > 0 ? [`--- attention (${attention[0]?.info.source ?? 'heuristic'}) ---`] : []),
114
+ ...attentionRows,
100
115
  ...live.map(view => renderRow('live', view, now)),
101
116
  ...(settled.length > 0 ? ['--- recent settles ---'] : []),
102
117
  ...settled.map(view => renderRow('done', view, now)),
118
+ ...resumableLine,
103
119
  ];
104
120
  const text = rows.length === 0
105
121
  ? `${head}\n(no children yet — the board is empty)`
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-status-tool.js","sourceRoot":"","sources":["../src/subagent-status-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAInD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,mFAAmF;AACnF,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAA;AAE1D,qFAAqF;AACrF,MAAM,YAAY,GAAG,CAAC,CAAA;AAmBtB,2EAA2E;AAC3E,SAAS,cAAc,CAAC,EAAU;IAChC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IACtD,MAAM,OAAO,GAAG,YAAY,GAAG,EAAE,CAAA;IACjC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAA;IACrE,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,GAAG,OAAO,IAAI,MAAM,CAAC,OAAO,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M,KAAK,CAAC;gBAC5B,CAAC,CAAC,GAAG,IAAI,0CAA0C;gBACnD,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;YACjC,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAA;QAC1C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAY,EAAE,OAA8B;IACpF,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAA8B,CAAA;IAC3D,IAAI,KAAK,EAAE,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACnD,OAAO,KAAK,CAAC,QAAQ,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;AAC9D,CAAC"}
@@ -42,6 +42,7 @@ import type { Context } from '@deepseek-ai/cordis';
42
42
  import { type SessionEvent } from '@deepseek-ai/dsh-session';
43
43
  import { type Component, type SelectItem, type TUI } from '@earendil-works/pi-tui';
44
44
  import type { AgentView } from './dsh-events.ts';
45
+ import type { AttentionInfo } from './attention.ts';
45
46
  import type { DshSessionBridge } from './session.ts';
46
47
  import { type TuiTheme } from './theme/index.ts';
47
48
  /** Notice shown in the transcript after a steer message was delivered. */
@@ -143,9 +144,12 @@ export declare function eventLines(events: readonly SessionEvent[]): string[];
143
144
  * then the five most recent settled ones (newest settle first). Each row
144
145
  * reads `⠋ label [mode] · rounds N[/max] · model` with the token spend, the
145
146
  * dsh-dcp compaction count (when > 0) and elapsed seconds in the muted
146
- * description column.
147
+ * description column. The row order is the CALLER's sort (started-at
148
+ * default; attention-score or rounds order when toggled) — `attention` here
149
+ * only decorates: `⚠` marks a critical-tier ranking, `↻` marks a settled
150
+ * continuable child whose session survives for resume.
147
151
  */
148
- export declare function pickerItems(views: readonly AgentView[], getRoundCount: (childId: string) => number, maxRounds: number, getCompactionCount?: (childId: string) => number): SelectItem[];
152
+ export declare function pickerItems(views: readonly AgentView[], getRoundCount: (childId: string) => number, maxRounds: number, getCompactionCount?: (childId: string) => number, attention?: (childId: string) => AttentionInfo | undefined): SelectItem[];
149
153
  /**
150
154
  * The model tail of a `provider/model` route (`opencode-go/hy3` → `hy3`),
151
155
  * for scan-friendly list rows; `undefined` for an unknown route or a
@@ -299,9 +299,12 @@ export function eventLines(events) {
299
299
  * then the five most recent settled ones (newest settle first). Each row
300
300
  * reads `⠋ label [mode] · rounds N[/max] · model` with the token spend, the
301
301
  * dsh-dcp compaction count (when > 0) and elapsed seconds in the muted
302
- * description column.
302
+ * description column. The row order is the CALLER's sort (started-at
303
+ * default; attention-score or rounds order when toggled) — `attention` here
304
+ * only decorates: `⚠` marks a critical-tier ranking, `↻` marks a settled
305
+ * continuable child whose session survives for resume.
303
306
  */
304
- export function pickerItems(views, getRoundCount, maxRounds, getCompactionCount = () => 0) {
307
+ export function pickerItems(views, getRoundCount, maxRounds, getCompactionCount = () => 0, attention) {
305
308
  const running = views.filter(view => view.outcome === undefined);
306
309
  const settled = views
307
310
  .filter((view) => view.outcome !== undefined && view.endedAt !== undefined)
@@ -326,11 +329,17 @@ export function pickerItems(views, getRoundCount, maxRounds, getCompactionCount
326
329
  // `⚡ injected` — a policy wrap-up (or steer) reached this child; shows
327
330
  // the injection landed even when the child LLM then ignored it.
328
331
  // `⏻ stopped` — the policy FORCE-stopped it (grace exhausted).
332
+ // `⚠` — the attention ranking ranks this child critical (heuristic base,
333
+ // jev upgrade); `↻` — a settled continuable child, resumable in place.
329
334
  const injected = view.injectedAt !== undefined ? ` ${t('viewer.injected')}` : '';
330
- const stopped = view.hardStop !== undefined ? ` ${t('viewer.stopped')}` : '';
335
+ const stopped = view.hardStop !== undefined
336
+ ? ` ${view.hardStop.early === true ? t('viewer.stoppedEarly') : t('viewer.stopped')}`
337
+ : '';
338
+ const attentionMark = attention?.(view.childId)?.tier === 'critical' ? ' ⚠' : '';
339
+ const resumableMark = view.outcome !== undefined && view.mode === 'continuable' ? ' ↻' : '';
331
340
  return {
332
341
  value: view.childId,
333
- label: `${statusGlyph(view)} ${view.label}${mode}: ${roundsText}${stopped}${injected}${modelShort !== undefined ? ` · ${modelShort}` : ''}`,
342
+ label: `${statusGlyph(view)} ${view.label}${mode}: ${roundsText}${stopped}${injected}${attentionMark}${resumableMark}${modelShort !== undefined ? ` · ${modelShort}` : ''}`,
334
343
  ...(description !== '' ? { description } : {}),
335
344
  };
336
345
  });
@@ -565,9 +574,12 @@ export class SubagentViewerPanel {
565
574
  // synthetic in-transcript line (render-layer composition, the same shape
566
575
  // as the dsh-dcp compaction marker), NOT a log event. It states the
567
576
  // round it fired at and the cap it enforced so the stop reads as policy,
568
- // never as a mysterious failure.
577
+ // never as a mysterious failure. The early variant names the spin
578
+ // judgment instead of claiming a grace exhaustion that never happened.
569
579
  if (view?.hardStop !== undefined) {
570
- out.push(fns.subtle(clipToWidth(t('viewer.hardStopped', { round: view.hardStop.round, cap: view.hardStop.cap }), wrap)));
580
+ out.push(fns.subtle(clipToWidth(view.hardStop.early === true
581
+ ? t('viewer.hardStoppedEarly', { round: view.hardStop.round, cap: view.hardStop.cap })
582
+ : t('viewer.hardStopped', { round: view.hardStop.round, cap: view.hardStop.cap }), wrap)));
571
583
  }
572
584
  const slice = lines.slice(this.scrollTop, this.scrollTop + this.bodyRows);
573
585
  if (slice.length === 0) {
@@ -846,16 +858,24 @@ export async function openSubagentViewer(ctx, tui, theme, bridge, restoreFocus)
846
858
  // the unbound method through to the pure item builder. `buildItems`
847
859
  // re-reads the limits live on every tick, so a maxRounds change
848
860
  // hot-applies while the picker stays open (no more open-time snapshot).
849
- // `sortByRounds` (the `s` toggle) flips the row order to rounds
850
- // descending — the "which child burns hottest" view.
861
+ // `sortByAttention` (default on, `r` toggles) orders running rows by the
862
+ // attention ranking — the "which child needs my eye first" view, the
863
+ // heuristic base with the jev upgrade when configured. `sortByRounds`
864
+ // (the `s` toggle) flips the row order to rounds descending — the "which
865
+ // child burns hottest" view — and wins while selected.
851
866
  let sortByRounds = false;
867
+ let sortByAttention = true;
868
+ const attentionLookup = (childId) => bridge.getAttention(childId);
852
869
  const buildItems = () => {
853
870
  const views = [...bridge.getAgentViews()];
854
871
  if (sortByRounds) {
855
872
  views.sort((a, b) => bridge.getRoundCount(b.childId) - bridge.getRoundCount(a.childId));
856
- return pickerItems(views, childId => bridge.getRoundCount(childId), readSubagentLimits(ctx).maxRounds, childId => bridge.getChildCompactionCount(childId));
857
873
  }
858
- return pickerItems(views, childId => bridge.getRoundCount(childId), readSubagentLimits(ctx).maxRounds, childId => bridge.getChildCompactionCount(childId));
874
+ else if (sortByAttention) {
875
+ views.sort((a, b) => (attentionLookup(b.childId)?.score ?? 0) - (attentionLookup(a.childId)?.score ?? 0)
876
+ || a.startedAt - b.startedAt);
877
+ }
878
+ return pickerItems(views, childId => bridge.getRoundCount(childId), readSubagentLimits(ctx).maxRounds, childId => bridge.getChildCompactionCount(childId), attentionLookup);
859
879
  };
860
880
  const items = buildItems();
861
881
  if (items.length === 0) {
@@ -874,6 +894,10 @@ export async function openSubagentViewer(ctx, tui, theme, bridge, restoreFocus)
874
894
  sortByRounds = !sortByRounds;
875
895
  return true; // rebuilt on the next tick; render immediately
876
896
  }
897
+ if (key === 'r') {
898
+ sortByAttention = !sortByAttention;
899
+ return true;
900
+ }
877
901
  if (key === 'K') {
878
902
  const stopped = bridge.cancelAllChildren();
879
903
  // Feedback rides the same toast channel as the per-viewer stop.