@namzu/cli 7.0.0 → 8.0.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.
Files changed (47) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/doctor.d.ts.map +1 -1
  5. package/dist/commands/doctor.js +27 -3
  6. package/dist/commands/doctor.js.map +1 -1
  7. package/dist/commands/drain.d.ts +59 -0
  8. package/dist/commands/drain.d.ts.map +1 -0
  9. package/dist/commands/drain.js +301 -0
  10. package/dist/commands/drain.js.map +1 -0
  11. package/dist/commands/run-stream.d.ts +37 -9
  12. package/dist/commands/run-stream.d.ts.map +1 -1
  13. package/dist/commands/run-stream.js +108 -18
  14. package/dist/commands/run-stream.js.map +1 -1
  15. package/dist/doctor/checks/chain.d.ts.map +1 -1
  16. package/dist/doctor/checks/chain.js +11 -1
  17. package/dist/doctor/checks/chain.js.map +1 -1
  18. package/dist/doctor/checks/providers.d.ts +6 -1
  19. package/dist/doctor/checks/providers.d.ts.map +1 -1
  20. package/dist/doctor/checks/providers.js +7 -2
  21. package/dist/doctor/checks/providers.js.map +1 -1
  22. package/dist/doctor/checks/telemetry.d.ts +35 -1
  23. package/dist/doctor/checks/telemetry.d.ts.map +1 -1
  24. package/dist/doctor/checks/telemetry.js +64 -13
  25. package/dist/doctor/checks/telemetry.js.map +1 -1
  26. package/dist/doctor/checks/vault.d.ts +10 -1
  27. package/dist/doctor/checks/vault.d.ts.map +1 -1
  28. package/dist/doctor/checks/vault.js +11 -2
  29. package/dist/doctor/checks/vault.js.map +1 -1
  30. package/dist/doctor/registry.js +25 -1
  31. package/dist/doctor/registry.js.map +1 -1
  32. package/dist/exit-codes.d.ts +18 -1
  33. package/dist/exit-codes.d.ts.map +1 -1
  34. package/dist/exit-codes.js +17 -0
  35. package/dist/exit-codes.js.map +1 -1
  36. package/dist/tui/App.d.ts.map +1 -1
  37. package/dist/tui/App.js +224 -50
  38. package/dist/tui/App.js.map +1 -1
  39. package/dist/tui/agent.d.ts +57 -1
  40. package/dist/tui/agent.d.ts.map +1 -1
  41. package/dist/tui/agent.js +72 -3
  42. package/dist/tui/agent.js.map +1 -1
  43. package/dist/user-commands/store.d.ts +14 -1
  44. package/dist/user-commands/store.d.ts.map +1 -1
  45. package/dist/user-commands/store.js +6 -1
  46. package/dist/user-commands/store.js.map +1 -1
  47. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"AAUA,MAAM,4BAA4B,GAAG,KAAK,CAAA;AAC1C,MAAM,6BAA6B,GAAG,MAAM,CAAA;AAmC5C,MAAM,OAAO,cAAc;IACT,MAAM,GAA6B,IAAI,GAAG,EAAE,CAAA;IACrD,GAAG,CAAS;IAEpB,SAAS,CAAC,GAAW;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,QAAQ,CAAC,KAAkB;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACd,yBAAyB,KAAK,CAAC,EAAE,qEAAqE,CACtG,CAAA;QACF,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IACjC,CAAC;IAED,UAAU,CAAC,EAAU;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,IAAI;QACH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAA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ACJ,CAAC,CAAA;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC7E,CAAC"}
@@ -6,6 +6,22 @@
6
6
  * 1 EXIT_FAIL — one or more checks reported `fail`
7
7
  * 2 EXIT_NO_CONFIG — Namzu is not configured in this environment
8
8
  * (no checks registered, no config file found)
9
+ * 69 EXIT_UNAVAILABLE — sysexits EX_UNAVAILABLE; something the command
10
+ * needed was not there, so it could not ESTABLISH
11
+ * what it was asked to report. Distinct from 0 for
12
+ * the reason 2 is distinct from 1: a report that
13
+ * could not look tells you nothing about the part
14
+ * it did look at, and collapsing the two lets
15
+ * "healthy" and "did not check" share a number.
16
+ * Distinct from 70 because a check that timed out
17
+ * on a loaded machine is not a bug in this CLI.
18
+ *
19
+ * `namzu eval` spells the same idea `2`
20
+ * (`EVAL_EXIT.inconclusive`) and that is not an
21
+ * oversight: `doctor` had already spent 2 on "no
22
+ * checks registered", and giving one number two
23
+ * meanings inside one command is worse than giving
24
+ * one meaning two numbers across two.
9
25
  * 64 EXIT_USAGE — sysexits EX_USAGE; the caller's arguments are
10
26
  * wrong. Distinct from 70 on purpose: 70 says the
11
27
  * CLI is broken and is worth a bug report, 64 says
@@ -26,7 +42,8 @@ export declare const EXIT_OK = 0;
26
42
  export declare const EXIT_FAIL = 1;
27
43
  export declare const EXIT_NO_CONFIG = 2;
28
44
  export declare const EXIT_USAGE = 64;
45
+ export declare const EXIT_UNAVAILABLE = 69;
29
46
  export declare const EXIT_INTERNAL_ERROR = 70;
30
47
  export declare const EXIT_UNTRUSTED = 77;
31
- export type CliExitCode = typeof EXIT_OK | typeof EXIT_FAIL | typeof EXIT_NO_CONFIG | typeof EXIT_USAGE | typeof EXIT_INTERNAL_ERROR | typeof EXIT_UNTRUSTED;
48
+ export type CliExitCode = typeof EXIT_OK | typeof EXIT_FAIL | typeof EXIT_NO_CONFIG | typeof EXIT_USAGE | typeof EXIT_UNAVAILABLE | typeof EXIT_INTERNAL_ERROR | typeof EXIT_UNTRUSTED;
32
49
  //# sourceMappingURL=exit-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,IAAI,CAAA;AACxB,eAAO,MAAM,SAAS,IAAI,CAAA;AAC1B,eAAO,MAAM,cAAc,IAAI,CAAA;AAC/B,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC,eAAO,MAAM,cAAc,KAAK,CAAA;AAEhC,MAAM,MAAM,WAAW,GACpB,OAAO,OAAO,GACd,OAAO,SAAS,GAChB,OAAO,cAAc,GACrB,OAAO,UAAU,GACjB,OAAO,mBAAmB,GAC1B,OAAO,cAAc,CAAA"}
1
+ {"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,OAAO,IAAI,CAAA;AACxB,eAAO,MAAM,SAAS,IAAI,CAAA;AAC1B,eAAO,MAAM,cAAc,IAAI,CAAA;AAC/B,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAClC,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC,eAAO,MAAM,cAAc,KAAK,CAAA;AAEhC,MAAM,MAAM,WAAW,GACpB,OAAO,OAAO,GACd,OAAO,SAAS,GAChB,OAAO,cAAc,GACrB,OAAO,UAAU,GACjB,OAAO,gBAAgB,GACvB,OAAO,mBAAmB,GAC1B,OAAO,cAAc,CAAA"}
@@ -6,6 +6,22 @@
6
6
  * 1 EXIT_FAIL — one or more checks reported `fail`
7
7
  * 2 EXIT_NO_CONFIG — Namzu is not configured in this environment
8
8
  * (no checks registered, no config file found)
9
+ * 69 EXIT_UNAVAILABLE — sysexits EX_UNAVAILABLE; something the command
10
+ * needed was not there, so it could not ESTABLISH
11
+ * what it was asked to report. Distinct from 0 for
12
+ * the reason 2 is distinct from 1: a report that
13
+ * could not look tells you nothing about the part
14
+ * it did look at, and collapsing the two lets
15
+ * "healthy" and "did not check" share a number.
16
+ * Distinct from 70 because a check that timed out
17
+ * on a loaded machine is not a bug in this CLI.
18
+ *
19
+ * `namzu eval` spells the same idea `2`
20
+ * (`EVAL_EXIT.inconclusive`) and that is not an
21
+ * oversight: `doctor` had already spent 2 on "no
22
+ * checks registered", and giving one number two
23
+ * meanings inside one command is worse than giving
24
+ * one meaning two numbers across two.
9
25
  * 64 EXIT_USAGE — sysexits EX_USAGE; the caller's arguments are
10
26
  * wrong. Distinct from 70 on purpose: 70 says the
11
27
  * CLI is broken and is worth a bug report, 64 says
@@ -26,6 +42,7 @@ export const EXIT_OK = 0;
26
42
  export const EXIT_FAIL = 1;
27
43
  export const EXIT_NO_CONFIG = 2;
28
44
  export const EXIT_USAGE = 64;
45
+ export const EXIT_UNAVAILABLE = 69;
29
46
  export const EXIT_INTERNAL_ERROR = 70;
30
47
  export const EXIT_UNTRUSTED = 77;
31
48
  //# sourceMappingURL=exit-codes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAA;AACxB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAA;AAC1B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAC/B,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAA;AAC5B,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAA;AACxB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAA;AAC1B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAC/B,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAA;AAC5B,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAClC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/tui/App.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0DH,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE/D,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;CACxB;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,SAAS,MAAM,EAAE,CAY1F;AAGD,wBAAgB,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,QAAQ,2CAyoCpC"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/tui/App.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0DH,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE/D,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;CACxB;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,SAAS,MAAM,EAAE,CAY1F;AAGD,wBAAgB,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,QAAQ,2CA4zCpC"}
package/dist/tui/App.js CHANGED
@@ -121,6 +121,28 @@ export function App({ ctx }) {
121
121
  // turns attribute to the resumed conversation.
122
122
  const sessionsRef = useRef(null);
123
123
  const scopeRef = useRef(null);
124
+ /**
125
+ * How many times the operator has switched conversations.
126
+ *
127
+ * `abort()` returns long before the `for await` in `runTurn` unwinds, so an
128
+ * abandoned turn keeps producing events for a while after `/resume` has
129
+ * already replaced the screen. This counter is what tells those events they
130
+ * are late: a turn captures the value at send time and renders nothing once
131
+ * it stops matching.
132
+ *
133
+ * Bumped ONLY by `resumeConversation`. `/clear` resets the transcript too and
134
+ * stays in the same conversation — its turn's rows are still that
135
+ * conversation's rows and must keep arriving.
136
+ */
137
+ const conversationGenRef = useRef(0);
138
+ /**
139
+ * Whether a conversation has been chosen and is still being read.
140
+ *
141
+ * The picker keeps the screen for that interval, and `Esc` stops cancelling:
142
+ * the choice is already being acted on, so a press landing here would close
143
+ * the picker over a switch that happens anyway.
144
+ */
145
+ const resumeCommittedRef = useRef(false);
124
146
  const idRef = useRef(0);
125
147
  const nextId = useCallback(() => {
126
148
  idRef.current += 1;
@@ -370,31 +392,6 @@ export function App({ ctx }) {
370
392
  pushMessage('system', `Could not list conversations: ${err instanceof Error ? err.message : String(err)}`);
371
393
  }
372
394
  }, [ensureSessions, pushMessage]);
373
- // Load the chosen conversation into the transcript and continue in it.
374
- const resumeConversation = useCallback(async (conv) => {
375
- const sessions = sessionsRef.current;
376
- const scope = scopeRef.current;
377
- setPhase('ready');
378
- if (!sessions || !scope)
379
- return;
380
- try {
381
- const msgs = await loadConversation(sessions, conv.id);
382
- const restored = msgs
383
- .filter((m) => m.role === 'user' || m.role === 'assistant')
384
- .map((m) => ({
385
- id: nextId(),
386
- role: m.role,
387
- content: typeof m.content === 'string' ? m.content : '',
388
- }));
389
- resetTranscript();
390
- setMessages(restored);
391
- scope.sessionId = conv.id; // new turns now attribute to the resumed session
392
- pushMessage('system', `Resumed: ${conv.title}`);
393
- }
394
- catch (err) {
395
- pushMessage('system', `Could not resume: ${err instanceof Error ? err.message : String(err)}`);
396
- }
397
- }, [nextId, pushMessage]);
398
395
  // Resolve a pending permission prompt with the user's decision and tear
399
396
  // down the overlay. No-op if nothing is pending.
400
397
  const resolvePermission = useCallback((decision) => {
@@ -405,6 +402,123 @@ export function App({ ctx }) {
405
402
  if (resolve)
406
403
  resolve(decision);
407
404
  }, []);
405
+ /**
406
+ * Stop the running turn, and hand the screen back in a usable state.
407
+ *
408
+ * Returns whether there was one to stop, because the caller has different
409
+ * things to say in the two cases.
410
+ *
411
+ * The screen cleanup lives HERE, at the act that decided to stop, rather
412
+ * than in the turn's own `finally`. That was safe only while nothing could
413
+ * start another turn in between. `/resume` can — the abandoned loop unwinds
414
+ * long after the resumed conversation is on screen, and possibly after a
415
+ * turn in it has already begun — so a `finally` that resets the composer,
416
+ * the active tools and the abort handle would be resetting somebody else's.
417
+ *
418
+ * The pending permission prompt is settled first. A turn parked on that
419
+ * promise never reaches its own `finally` at all, so aborting alone would
420
+ * leave it hanging with its reply unsaved. It is the same decision Ctrl+C
421
+ * sends at that prompt, for the same reason.
422
+ */
423
+ const interruptTurn = useCallback(() => {
424
+ if (permissionResolveRef.current)
425
+ resolvePermission({ kind: 'reject', feedback: 'User interrupted.' });
426
+ const ac = abortRef.current;
427
+ if (!ac)
428
+ return false;
429
+ ac.abort();
430
+ // Dropped now so a second interrupt does not re-abort, and the queue with
431
+ // it: interrupting means stop, not "run the next one".
432
+ abortRef.current = null;
433
+ setQueued([]);
434
+ clearActiveTools();
435
+ setState('idle');
436
+ return true;
437
+ }, [clearActiveTools, resolvePermission]);
438
+ /**
439
+ * Load the chosen conversation into the transcript and continue in it.
440
+ *
441
+ * A turn may still be running when this happens — the composer stays live
442
+ * while the agent works, and a slash action is dispatched ahead of the
443
+ * message queue — and until this aborted it, three things went wrong at
444
+ * once. Its rows appended into the resumed transcript. Its queued follow-ups
445
+ * would have run against a conversation nobody asked them of. And, the one
446
+ * that outlived the process, its `appendMessages` wrote into the RESUMED
447
+ * conversation's durable record, because `sessionId` was mutated on a
448
+ * `RunScope` the running loop held the very same object of.
449
+ *
450
+ * The mutation below stays, and it is the sharing that makes it necessary:
451
+ * `createAgentSession` closed over this exact object and spreads it into
452
+ * every `query()`, so replacing it here would leave the agent attributing
453
+ * every future turn to the conversation the operator has left. `RunScope`
454
+ * says as much — `sessionId` is its one non-`readonly` field. What changed is
455
+ * on the other side: a turn now fixes its own destination when it starts
456
+ * (see `runTurn`), so a shared cursor moving under it can no longer decide
457
+ * where it lands.
458
+ *
459
+ * The abandoned turn is not dropped in silence. It goes on consuming its own
460
+ * events, so its reply is whole, and persists into the conversation it
461
+ * belongs to; the operator is told that here, because those rows are
462
+ * correctly absent from the transcript now in front of them, and a turn that
463
+ * vanishes with no account of where it went is the same defect as one that
464
+ * lands in the wrong place.
465
+ *
466
+ * Nothing is disturbed until the new conversation is actually in hand. A
467
+ * read that fails leaves a running turn running where it belongs, exactly as
468
+ * cancelling the picker does.
469
+ *
470
+ * And the picker stays up for the length of the read rather than handing the
471
+ * screen back first. A composer that is live over an unsettled switch takes
472
+ * a message with nowhere to go: queued against a conversation being left, and
473
+ * then either dropped by the interrupt below or sent to a conversation nobody
474
+ * addressed it to. The screen should not accept input for a conversation that
475
+ * is not decided yet, and a read is usually too fast to see.
476
+ */
477
+ const resumeConversation = useCallback(async (conv) => {
478
+ const sessions = sessionsRef.current;
479
+ const scope = scopeRef.current;
480
+ if (!sessions || !scope) {
481
+ setPhase('ready');
482
+ return;
483
+ }
484
+ // The operator has committed; `Esc` no longer cancels from here, or a
485
+ // press landing during the read would leave the picker closed and the
486
+ // switch happening anyway.
487
+ resumeCommittedRef.current = true;
488
+ let msgs;
489
+ try {
490
+ msgs = await loadConversation(sessions, conv.id);
491
+ }
492
+ catch (err) {
493
+ resumeCommittedRef.current = false;
494
+ setPhase('ready');
495
+ pushMessage('system', `Could not resume: ${err instanceof Error ? err.message : String(err)}`);
496
+ return;
497
+ }
498
+ resumeCommittedRef.current = false;
499
+ setPhase('ready');
500
+ const restored = msgs
501
+ .filter((m) => m.role === 'user' || m.role === 'assistant')
502
+ .map((m) => ({
503
+ id: nextId(),
504
+ role: m.role,
505
+ content: typeof m.content === 'string' ? m.content : '',
506
+ }));
507
+ const interrupted = interruptTurn();
508
+ conversationGenRef.current += 1;
509
+ resetTranscript();
510
+ setMessages(restored);
511
+ scope.sessionId = conv.id; // new turns now attribute to the resumed session
512
+ pushMessage('system', `Resumed: ${conv.title}`);
513
+ if (interrupted) {
514
+ // "is being saved", not "is saved". The write has not happened yet —
515
+ // it runs when the abandoned turn finishes unwinding, which is after
516
+ // this line — and a surface that reports a result it has not read is
517
+ // the defect class this whole change is about. If that write fails,
518
+ // the turn says so itself, in the same words `run-stream` uses.
519
+ pushMessage('system', 'The turn that was running was interrupted. Its reply so far is being saved to the conversation it started in, so it is not in the transcript above. A tool call already dispatched was not undone.');
520
+ }
521
+ }, [interruptTurn, nextId, pushMessage, resetTranscript]);
408
522
  // Bridge passed into session.send(): the agent calls this before a
409
523
  // non-read-only tool batch; it parks until the user presses y/n/a.
410
524
  const onPermission = useCallback((req) => new Promise((resolve) => {
@@ -547,6 +661,19 @@ export function App({ ctx }) {
547
661
  const st = { assistantId: null, text: '' };
548
662
  const ac = new AbortController();
549
663
  abortRef.current = ac;
664
+ // Where this turn will be saved, and which transcript its rows belong
665
+ // to. Both fixed HERE, at the one moment they are knowable.
666
+ //
667
+ // `/resume` can land between this line and the `finally` below, and
668
+ // `abort()` returns long before the loop unwinds — so after a mid-turn
669
+ // switch the finally ALWAYS runs on the far side of it. Reading
670
+ // `scopeRef.current` down there wrote this turn into whichever
671
+ // conversation happened to be open when it finished, and that record
672
+ // outlives the process. A string captured now cannot be reassigned by
673
+ // anyone.
674
+ const destination = scopeRef.current?.sessionId ?? null;
675
+ const turnGeneration = conversationGenRef.current;
676
+ const stillHere = () => conversationGenRef.current === turnGeneration;
550
677
  try {
551
678
  for await (const event of session.send(priorForSdk, {
552
679
  signal: ac.signal,
@@ -555,30 +682,77 @@ export function App({ ctx }) {
555
682
  onPermission: ctx.skipPermissions ? undefined : onPermission,
556
683
  extraSystem: composeSkillsPrompt(activeSkills) ?? undefined,
557
684
  })) {
558
- applyEvent(event, st);
685
+ // A turn the operator has left is consumed but not rendered: no row
686
+ // from it lands in a transcript it has nothing to do with, and its
687
+ // text keeps accumulating so that what gets saved does not depend
688
+ // on exactly when the switch happened.
689
+ //
690
+ // How much arrives after the switch is a property of the SESSION,
691
+ // not of this loop. The built-in one checks the signal at the top of
692
+ // each iteration and returns after a single `error: aborted`, so in
693
+ // practice very little does. The accumulation is here so a session
694
+ // that notices later — a different implementation, a generator
695
+ // parked in a tool call — still saves a whole reply rather than one
696
+ // truncated at the moment the operator happened to leave.
697
+ if (stillHere())
698
+ applyEvent(event, st);
699
+ else if (event.kind === 'delta')
700
+ st.text += event.text;
559
701
  }
560
702
  }
561
703
  catch (err) {
562
- if (st.assistantId)
563
- finalizeMessage(st.assistantId);
564
- pushMessage('system', `Error: ${err instanceof Error ? err.message : String(err)}`);
704
+ // Reported only where it means something. In the conversation the
705
+ // operator has moved on from, this row would be the same misplacement
706
+ // the generation exists to stop — and it would be the more confusing
707
+ // half of it, because an abort reads as an error.
708
+ if (stillHere()) {
709
+ if (st.assistantId)
710
+ finalizeMessage(st.assistantId);
711
+ pushMessage('system', `Error: ${err instanceof Error ? err.message : String(err)}`);
712
+ }
565
713
  }
566
714
  finally {
567
- abortRef.current = null;
568
- permissionResolveRef.current = null;
569
- permissionOpenedAtRef.current = null;
570
- setPermission(null);
571
- clearActiveTools();
572
- setState('idle');
573
- // Persist the turn to the SDK session store (best-effort) so it can
574
- // be resumed later. User message + the assistant's reply text.
715
+ // The screen belongs to the conversation on it, which after a
716
+ // `/resume` is no longer this turn's. `interruptTurn` already did this
717
+ // cleanup at the moment it decided to stop; repeating it here would
718
+ // clear the state of whatever has started since.
719
+ if (stillHere()) {
720
+ // Unguarded, and it can be: a second turn cannot start in the
721
+ // conversation this one is running in — the composer queues instead
722
+ // — so within one generation this handle is still ours. An
723
+ // `=== ac` comparison here read as prudence and was a check that
724
+ // could not fail, which teaches the next reader that the checks
725
+ // around it are decoration too.
726
+ abortRef.current = null;
727
+ permissionResolveRef.current = null;
728
+ permissionOpenedAtRef.current = null;
729
+ setPermission(null);
730
+ clearActiveTools();
731
+ setState('idle');
732
+ }
733
+ // Persisted either way, and into the conversation this turn was
734
+ // started in — captured above, never re-read.
735
+ //
736
+ // Best-effort is about not FAILING, not about staying quiet. The
737
+ // rejection used to be swallowed whole, and it is the one failure here
738
+ // that makes a LATER surface wrong: `/resume` comes back missing a
739
+ // turn that was on screen, and the next turn in that conversation
740
+ // silently lacks it as context, with nothing connecting either to a
741
+ // write that failed minutes ago. `run-stream` already says this, in
742
+ // these words and for this reason.
743
+ //
744
+ // Said wherever the operator is now, even when that is a different
745
+ // conversation, because there is no other channel and it is news they
746
+ // need. Naming the conversation is what keeps it from reading as a
747
+ // fault of the one in front of them.
575
748
  const sessions = sessionsRef.current;
576
- const scope = scopeRef.current;
577
- if (sessions && scope) {
749
+ if (sessions && destination) {
578
750
  const turn = [createUserMessage(text)];
579
751
  if (st.text.trim().length > 0)
580
752
  turn.push(createAssistantMessage(st.text));
581
- void appendMessages(sessions, scope.sessionId, turn).catch(() => { });
753
+ void appendMessages(sessions, destination, turn).catch((err) => {
754
+ pushMessage('system', `A turn was not saved to conversation ${destination}: ${err instanceof Error ? err.message : String(err)}. That conversation's history will not include it, and its next turn will not have it as context.`);
755
+ });
582
756
  }
583
757
  }
584
758
  }, [activeSkills, applyEvent, ctx.cwd, ctx.skipPermissions, finalizeMessage, messages, onPermission, pushMessage, session]);
@@ -877,6 +1051,12 @@ export function App({ ctx }) {
877
1051
  }
878
1052
  // Resume picker owns the keyboard while open.
879
1053
  if (phase === 'resume') {
1054
+ // Once a conversation is being read, the keyboard does nothing here.
1055
+ // The choice is already being acted on; a second Enter would start a
1056
+ // second read and an Esc would hand back a screen that is about to be
1057
+ // replaced regardless.
1058
+ if (resumeCommittedRef.current)
1059
+ return;
880
1060
  if (key.upArrow)
881
1061
  setSelectedResume((i) => Math.max(0, i - 1));
882
1062
  else if (key.downArrow)
@@ -948,9 +1128,7 @@ export function App({ ctx }) {
948
1128
  // Esc interrupts a running turn (Ctrl+C stays reserved for exit). Mirrors
949
1129
  // the Ctrl+C interrupt path: abort, drop the queue, one "Interrupted." line.
950
1130
  if (key.escape && abortRef.current) {
951
- abortRef.current.abort();
952
- abortRef.current = null;
953
- setQueued([]);
1131
+ interruptTurn();
954
1132
  pushMessage('system', 'Interrupted.');
955
1133
  return;
956
1134
  }
@@ -979,13 +1157,9 @@ export function App({ ctx }) {
979
1157
  }
980
1158
  if (key.ctrl && input === 'c') {
981
1159
  // A turn is running → first Ctrl+C interrupts it, not exits.
982
- if (abortRef.current) {
983
- abortRef.current.abort();
984
- // Drop the ref now so a second Ctrl+C arms exit instead of
985
- // re-aborting (which spammed "Interrupted." lines), and clear any
986
- // queued messages — interrupting means stop, not "run the next one".
987
- abortRef.current = null;
988
- setQueued([]);
1160
+ // Drops the ref, so a second Ctrl+C arms exit instead of re-aborting
1161
+ // (which spammed "Interrupted." lines).
1162
+ if (interruptTurn()) {
989
1163
  pushMessage('system', 'Interrupted.');
990
1164
  return;
991
1165
  }