@lucascouts/claude-agent-tui 0.14.13 → 0.15.1

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Effort levels offered for reasoning-capable models — the SDK's `supportedEffortLevels` vocabulary.
3
- * Story 060: exported so the ultracode guard test can assert membership stays the five real levels
4
- * (it must NEVER contain {@link ULTRACODE_EFFORT}; the real `--effort` enum is exactly this set).
3
+ * Exactly the real `--effort` enum. Ultracode is NOT a level (item 84): it is its own switch, see
4
+ * {@link ULTRACODE_CONFIG_ID}.
5
5
  */
6
6
  export const REASONING_EFFORT_LEVELS = [
7
7
  "low",
@@ -10,17 +10,6 @@ export const REASONING_EFFORT_LEVELS = [
10
10
  "xhigh",
11
11
  "max",
12
12
  ];
13
- /**
14
- * Story 060 — the "ultracode" pseudo-level sentinel for the effort selector. NOT a real `--effort`
15
- * value (claude 2.1.195 rejects `--effort ultracode`; the enum stays {@link REASONING_EFFORT_LEVELS}).
16
- * Selecting it maps to `--effort xhigh` PLUS activating the ultracode keyword-trigger for the session
17
- * (story 060 Task 3). Kept OUT of REASONING_EFFORT_LEVELS so no real-effort code path ever emits it.
18
- */
19
- export const ULTRACODE_EFFORT = "ultracode";
20
- /** The real effort level the ultracode pseudo-level maps to (its documented effort component). */
21
- export const ULTRACODE_EFFORT_LEVEL = "xhigh";
22
- /** Selector label — makes clear it is xhigh + orchestration, NOT a duplicate of the plain `xhigh` entry. */
23
- export const ULTRACODE_EFFORT_LABEL = "ultracode (xhigh + orchestration)";
24
13
  /**
25
14
  * The FALLBACK model list — no longer what the picker normally shows.
26
15
  *
@@ -56,12 +45,14 @@ export const ULTRACODE_EFFORT_LABEL = "ultracode (xhigh + orchestration)";
56
45
  * A tier alias always points at the newest member of its family, so these rows do NOT age out on a
57
46
  * model launch — only the version text in the row does. Verified 2026-09-23:
58
47
  * `opus` → `claude-opus-5-5`, `fable` → `claude-fable-5-1`, `sonnet` → `claude-sonnet-5`,
59
- * `haiku` → `claude-haiku-4-5-20251001`.
48
+ * `haiku` → `claude-haiku-4-5-20251001`. Re-read 2026-10-14 from CLI 2.1.299's live
49
+ * `supportedModels()`: `sonnet` → `claude-sonnet-5-5`, `haiku` → `claude-haiku-5-5` (both moved in
50
+ * CLI 2.1.293).
60
51
  *
61
- * Effort-capable models (`default`/`fable`/`opus`/`sonnet`) carry `supportsEffort` +
62
- * `supportedEffortLevels`; `haiku` advertises none. `supportsAutoMode: true` on the same four surfaces
63
- * the `auto` permission mode (a model classifier) — the original drops `auto` on `haiku` (the SDK signal
64
- * `reconcileModeFromTranscript` clamps), so haiku omits it.
52
+ * Every row is effort-capable (`supportsEffort` + `supportedEffortLevels`) and carries
53
+ * `supportsAutoMode: true`, which surfaces the `auto` permission mode (a model classifier). `haiku`
54
+ * used to advertise neither: Haiku 4.5 had no effort levels and the original drops `auto` on it.
55
+ * Haiku 5.5 has both, per the live CLI rows.
65
56
  */
66
57
  export const MODEL_CATALOG = [
67
58
  {
@@ -98,22 +89,31 @@ export const MODEL_CATALOG = [
98
89
  },
99
90
  {
100
91
  value: "sonnet",
101
- displayName: "Sonnet 5",
102
- description: "Sonnet 5 with 1M context · Efficient for routine tasks",
92
+ // Item 93: `sonnet` resolves to `claude-sonnet-5-5` since CLI 2.1.293 (the baked-in catalogue's
93
+ // `aliases.sonnet.default`); the tagline is the live row's, verbatim (CLI 2.1.299).
94
+ displayName: "Sonnet 5.5",
95
+ description: "Sonnet 5.5 with 1M context · Most efficient for simpler tasks",
103
96
  supportsEffort: true,
104
97
  supportedEffortLevels: REASONING_EFFORT_LEVELS,
105
98
  supportsAutoMode: true,
106
99
  },
107
100
  {
108
101
  value: "haiku",
109
- displayName: "Haiku 4.5",
110
- description: "Haiku 4.5 · Fastest for quick answers",
102
+ // Item 93: `haiku` resolves to `claude-haiku-5-5` since CLI 2.1.293 — native 1M context, 128k
103
+ // output, and the full effort set (`capabilities: ["effort","max_effort","xhigh_effort",…]` in the
104
+ // baked-in catalogue). The live `supportedModels()` row (CLI 2.1.299) carries `supportsEffort`,
105
+ // all five levels and `supportsAutoMode`, so the fallback row does too.
106
+ displayName: "Haiku 5.5",
107
+ description: "Haiku 5.5 with 1M context · Fastest for quick answers",
108
+ supportsEffort: true,
109
+ supportedEffortLevels: REASONING_EFFORT_LEVELS,
110
+ supportsAutoMode: true,
111
111
  },
112
112
  ];
113
113
  /**
114
114
  * Story 068 (R1, R1.1, R2) — the REAL per-alias context window, keyed by the EXACT {@link MODEL_CATALOG}
115
- * `value`. These windows are NOT uniform: `default`/`fable`/`opus`/`sonnet` are natively 1M and `haiku`
116
- * is 200K. This map is the single source of truth that `inferContextWindowFromModel` (acp-agent.ts)
115
+ * `value`. Every alias is natively 1M today; `haiku` was 200K until it moved to Haiku 5.5 (item 93).
116
+ * Older generations are NOT uniform, which is why {@link MODEL_ID_CONTEXT_WINDOWS} refines per turn. This map is the single source of truth that `inferContextWindowFromModel` (acp-agent.ts)
117
117
  * consults BEFORE the `\b1m\b` regex fallback — the bug it fixes is `opus` having wrongly reported 200K
118
118
  * (the regex only ever matched the literal `1m` token).
119
119
  *
@@ -129,7 +129,8 @@ export const MODEL_CONTEXT_WINDOWS = {
129
129
  fable: 1_000_000,
130
130
  opus: 1_000_000,
131
131
  sonnet: 1_000_000,
132
- haiku: 200_000,
132
+ // Item 93: Haiku 5.5 is native 1M. Seeding 200K made every Haiku turn report 5x the real usage.
133
+ haiku: 1_000_000,
133
134
  };
134
135
  /**
135
136
  * Story 069 (R1.1) — the REAL context window per concrete model ID, mirroring the claude CLI's
@@ -150,10 +151,12 @@ export const MODEL_ID_CONTEXT_WINDOWS = {
150
151
  "claude-opus-4-6": 200_000,
151
152
  "claude-fable-5-1": 1_000_000,
152
153
  "claude-fable-5": 1_000_000,
154
+ "claude-sonnet-5-5": 1_000_000,
153
155
  "claude-sonnet-5": 1_000_000,
154
156
  "claude-sonnet-4-6": 200_000,
155
157
  "claude-sonnet-4-5-20250929": 200_000,
156
158
  "claude-sonnet-4-20250514": 200_000,
159
+ "claude-haiku-5-5": 1_000_000,
157
160
  "claude-haiku-4-5": 200_000,
158
161
  };
159
162
  /**
@@ -351,5 +354,118 @@ export function classifyFastModeSignal(raw) {
351
354
  return "available";
352
355
  return "pending"; // panel not rendered yet → keep waiting within the caller's bounded window
353
356
  }
357
+ // --- Item 84 — Ultracode as its own switch ----------------------------------------------------------
358
+ // Ultracode is "standing dynamic-workflow orchestration at any effort level", session-scoped. It used
359
+ // to be an `ultracode (xhigh + orchestration)` notch in the effort select (story 060) that forced
360
+ // xhigh, prefixed every prompt with the `ultracode` keyword and wrote a settings key the CLI does not
361
+ // read. The CLI (2.1.296+) exposes it as `/effort ultracode on|off`, independent of the effort level,
362
+ // and that is what this switch drives — built like the fast-mode option above.
363
+ /** Item 84 — the Ultracode config-option id. */
364
+ export const ULTRACODE_CONFIG_ID = "ultracode";
365
+ /**
366
+ * Item 84 — the CLI command that turns Ultracode on or off for the session. Always the explicit
367
+ * `on|off` form: never a bare `/effort ultracode`, whose meaning the CLI has changed between builds.
368
+ */
369
+ export function ultracodeCommand(on) {
370
+ return on ? "/effort ultracode on" : "/effort ultracode off";
371
+ }
372
+ /**
373
+ * Item 84 — can this model run Ultracode? The CLI's own gate is "workflows are enabled AND the model
374
+ * supports xhigh"; the first half is not knowable from here (managed settings, org policy, env), so
375
+ * this checks the second and the CLI's refusal reply ({@link classifyUltracodeReply}) covers the rest.
376
+ */
377
+ export function isUltracodeCapableModel(info) {
378
+ return info?.supportsEffort === true && (info.supportedEffortLevels ?? []).includes("xhigh");
379
+ }
380
+ /** Item 84 — the switch is on while this is true; a boolean payload or the on/off select string. */
381
+ export function resolveUltracodeEnabled(value) {
382
+ if (typeof value === "boolean")
383
+ return value;
384
+ return value === FAST_MODE_ON;
385
+ }
386
+ const ULTRACODE_DESCRIPTION = "Run dynamic workflows on every task (/effort ultracode).";
387
+ /**
388
+ * Item 84 — build the `ultracode` config option: `type:"boolean"` when the client advertised boolean
389
+ * config options, else an on/off select, exactly as {@link createFastModeConfigOption} does. When the
390
+ * CLI refused the last attempt, `refusal` is appended to the description so the reason the switch
391
+ * went back off is visible where the switch is.
392
+ */
393
+ export function createUltracodeConfigOption(enabled, useBooleanOption, refusal) {
394
+ const base = {
395
+ id: ULTRACODE_CONFIG_ID,
396
+ name: "Ultracode",
397
+ description: refusal ? `${ULTRACODE_DESCRIPTION} Off: ${refusal}` : ULTRACODE_DESCRIPTION,
398
+ category: "model_config",
399
+ };
400
+ if (useBooleanOption) {
401
+ return { ...base, type: "boolean", currentValue: enabled };
402
+ }
403
+ return {
404
+ ...base,
405
+ type: "select",
406
+ currentValue: enabled ? FAST_MODE_ON : FAST_MODE_OFF,
407
+ options: [
408
+ { value: FAST_MODE_OFF, name: "Off", description: "No standing orchestration." },
409
+ {
410
+ value: FAST_MODE_ON,
411
+ name: "On",
412
+ description: "Dynamic workflows on every task, at the current effort level.",
413
+ },
414
+ ],
415
+ };
416
+ }
417
+ /**
418
+ * Turn PTY output into plain text for phrase matching. Unlike {@link stripControlSequences}, a cursor-
419
+ * forward (`ESC [ n C`) becomes a space: Ink may draw a space by moving the cursor, and dropping it
420
+ * would glue two words together. Whitespace runs (line wraps included) collapse to one space.
421
+ */
422
+ function ptyTextForMatching(raw) {
423
+ // eslint-disable-next-line no-control-regex
424
+ const spaced = raw.replace(/\x1b\[\d*C/g, " ");
425
+ return stripControlSequences(spaced).replace(/\s+/g, " ");
426
+ }
427
+ /**
428
+ * Item 84 — classify the CLI's reply to `/effort ultracode on`. The two refusals are the CLI's own
429
+ * strings (claude 2.1.299, `/effort` handler):
430
+ * `Ultracode needs dynamic workflows enabled (see /config). Valid options are: …`
431
+ * `Ultracode isn't available on <model>. Valid options are: …`
432
+ * and its confirmation is `Ultracode on (this session only): …`. When the captured text holds more
433
+ * than one (a repaint can carry an older answer), the one written LAST is the answer to this command.
434
+ */
435
+ export function classifyUltracodeReply(raw) {
436
+ const text = ptyTextForMatching(raw);
437
+ const last = (re) => {
438
+ let found;
439
+ for (const match of text.matchAll(re))
440
+ found = { at: match.index ?? 0, match };
441
+ return found;
442
+ };
443
+ const candidates = [];
444
+ const workflows = last(/ultracode needs dynamic workflows enabled/gi);
445
+ if (workflows) {
446
+ candidates.push({
447
+ at: workflows.at,
448
+ reply: {
449
+ kind: "refused",
450
+ reason: "Ultracode needs dynamic workflows enabled (see /config).",
451
+ },
452
+ });
453
+ }
454
+ const model = last(/ultracode isn['\u2019]?t available on (\S+)/gi);
455
+ if (model) {
456
+ const name = model.match[1].replace(/\.$/, "");
457
+ candidates.push({
458
+ at: model.at,
459
+ reply: { kind: "refused", reason: `Ultracode isn't available on ${name}.` },
460
+ });
461
+ }
462
+ const on = last(/ultracode on \(this session only\)/gi);
463
+ if (on)
464
+ candidates.push({ at: on.at, reply: { kind: "on" } });
465
+ if (candidates.length === 0)
466
+ return { kind: "pending" };
467
+ candidates.sort((a, b) => b.at - a.at);
468
+ return candidates[0].reply;
469
+ }
354
470
  /** The safe fallback entry, kept as a named export so callers can seed/anchor on it without a lookup. */
355
471
  export const DEFAULT_MODEL_INFO = MODEL_CATALOG[0];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The permission mode the transcript at `filePath` last recorded, or undefined when it records none,
3
+ * the last one is a `plan` that was exited, or the file cannot be read. Reads backwards in
4
+ * {@link TAIL_CHUNK_BYTES} chunks, so a long transcript costs only its tail.
5
+ */
6
+ export declare function readTranscriptPermissionMode(filePath: string): Promise<string | undefined>;
@@ -0,0 +1,104 @@
1
+ // Item 107 — the permission mode a loaded session was last in, read from the end of its transcript.
2
+ //
3
+ // Ported from the plus adapter's `readResumedPermissionMode` (its 0.23.5; upstream #1218's mode half)
4
+ // and adapted to the transcripts this adapter reads. Plus runs the SDK, whose transcripts record the
5
+ // mode only on prompt records. This adapter drives the INTERACTIVE CLI, which also writes
6
+ // `permission-mode` records — several per session, and the only mode record in a short session — and
7
+ // the live pump already reconciles from them (story 046). So both count here, and the tail-most wins.
8
+ //
9
+ // A `plan` before a later `plan_mode_exit` attachment is not the current mode and gives none: leaving
10
+ // plan mode through ExitPlanMode writes the attachment, not a mode. The search stops at the first mode,
11
+ // or at a human prompt that records none (a transcript that does not record modes). Sidechain
12
+ // (subagent) records are ignored. Best-effort: any failure gives undefined and the caller keeps its
13
+ // default.
14
+ import { open } from "node:fs/promises";
15
+ /** The size of one backward read of a transcript. */
16
+ const TAIL_CHUNK_BYTES = 64 * 1024;
17
+ /** Visits transcript lines from the end. */
18
+ class PermissionModeScan {
19
+ constructor() {
20
+ this.planExited = false;
21
+ }
22
+ /** Visit the previous line. Return true when the search is over. */
23
+ visit(line) {
24
+ let parsed;
25
+ // Most lines carry no marker of interest; the check skips their JSON parse.
26
+ const record = (marker) => {
27
+ if (line.indexOf(marker) < 0)
28
+ return undefined;
29
+ if (parsed === undefined)
30
+ parsed = parseMainThreadRecord(line);
31
+ return parsed ?? undefined;
32
+ };
33
+ const modeEntry = record('"permissionMode"');
34
+ if ((modeEntry?.type === "user" || modeEntry?.type === "permission-mode") &&
35
+ typeof modeEntry.permissionMode === "string" &&
36
+ modeEntry.permissionMode.trim() !== "") {
37
+ const mode = modeEntry.permissionMode.trim();
38
+ if (!(this.planExited && mode === "plan"))
39
+ this.mode = mode;
40
+ return true;
41
+ }
42
+ if (record('"plan_mode_exit"')?.attachment?.type === "plan_mode_exit") {
43
+ this.planExited = true;
44
+ return false;
45
+ }
46
+ const human = record('"human"');
47
+ return human?.type === "user" && human.origin?.kind === "human";
48
+ }
49
+ }
50
+ /** The parsed record of one line, or null for a subagent record or a bad line. */
51
+ function parseMainThreadRecord(line) {
52
+ let entry;
53
+ try {
54
+ entry = JSON.parse(line.toString("utf8"));
55
+ }
56
+ catch {
57
+ return null;
58
+ }
59
+ if (!entry || typeof entry !== "object")
60
+ return null;
61
+ const record = entry;
62
+ return record.isSidechain === true ? null : record;
63
+ }
64
+ /**
65
+ * The permission mode the transcript at `filePath` last recorded, or undefined when it records none,
66
+ * the last one is a `plan` that was exited, or the file cannot be read. Reads backwards in
67
+ * {@link TAIL_CHUNK_BYTES} chunks, so a long transcript costs only its tail.
68
+ */
69
+ export async function readTranscriptPermissionMode(filePath) {
70
+ let handle;
71
+ try {
72
+ handle = await open(filePath, "r");
73
+ }
74
+ catch {
75
+ return undefined;
76
+ }
77
+ const scan = new PermissionModeScan();
78
+ try {
79
+ let end = (await handle.stat()).size;
80
+ // The bytes of the line whose start is not read yet, in file order.
81
+ let pending = [];
82
+ while (end > 0) {
83
+ const start = Math.max(0, end - TAIL_CHUNK_BYTES);
84
+ let chunk = Buffer.alloc(end - start);
85
+ await handle.read(chunk, 0, chunk.length, start);
86
+ for (let at = chunk.lastIndexOf(0x0a); at >= 0; at = chunk.lastIndexOf(0x0a)) {
87
+ if (scan.visit(Buffer.concat([chunk.subarray(at + 1), ...pending])))
88
+ return scan.mode;
89
+ pending = [];
90
+ chunk = chunk.subarray(0, at);
91
+ }
92
+ pending.unshift(chunk);
93
+ end = start;
94
+ }
95
+ scan.visit(Buffer.concat(pending));
96
+ return scan.mode;
97
+ }
98
+ catch {
99
+ return undefined;
100
+ }
101
+ finally {
102
+ await handle.close();
103
+ }
104
+ }
package/dist/tools.d.ts CHANGED
@@ -4,6 +4,7 @@ import { TaskCreateInput, TaskCreateOutput, TaskListOutput, TaskUpdateInput, Tas
4
4
  import { ToolResultBlockParam, WebSearchToolResultBlockParam } from "@anthropic-ai/sdk/resources";
5
5
  import { BetaBashCodeExecutionToolResultBlockParam, BetaCodeExecutionToolResultBlockParam, BetaRequestMCPToolResultBlockParam, BetaTextEditorCodeExecutionToolResultBlockParam, BetaToolResultBlockParam, BetaToolSearchToolResultBlockParam, BetaWebFetchToolResultBlockParam, BetaWebSearchToolResultBlockParam } from "@anthropic-ai/sdk/resources/beta.mjs";
6
6
  import { Logger } from "./acp-agent.js";
7
+ import type { BackgroundTaskEnd } from "./background-task-end.js";
7
8
  interface ToolInfo {
8
9
  title: string;
9
10
  kind: ToolKind;
@@ -24,11 +25,24 @@ interface ToolUpdate {
24
25
  };
25
26
  terminal_exit?: {
26
27
  terminal_id: string;
27
- exit_code: number;
28
+ exit_code: number | null;
28
29
  signal: string | null;
29
30
  };
30
31
  };
31
32
  }
33
+ /**
34
+ * Item 92 (upstream #1312) — how a backgrounded Bash's terminal exit is reported at its tool result.
35
+ * The result only announces the command; the command's end arrives later as a task notification.
36
+ */
37
+ export type BackgroundExitPolicy = {
38
+ /** The task's end, when the transcript already holds its notification (keyed by tool_use id). */
39
+ ended: (toolUseId: string) => BackgroundTaskEnd | undefined;
40
+ /**
41
+ * Leave the exit out while the task runs. Only the live pump sets this, because only it sends the
42
+ * exit later ({@link ClaudeAcpAgent} `flushBackgroundExits`); every other caller exits at the result.
43
+ */
44
+ holdRunning: boolean;
45
+ };
32
46
  /**
33
47
  * Convert an absolute file path to a project-relative path for display.
34
48
  * Returns the original path if it's outside the project directory or if no cwd is provided.
@@ -61,7 +75,7 @@ export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockPara
61
75
  name?: string;
62
76
  id?: string;
63
77
  input?: unknown;
64
- } | undefined, supportsTerminalOutput?: boolean, toolUseResult?: unknown): ToolUpdate;
78
+ } | undefined, supportsTerminalOutput?: boolean, toolUseResult?: unknown, background?: BackgroundExitPolicy): ToolUpdate;
65
79
  export type ClaudePlanEntry = {
66
80
  content: string;
67
81
  status: "pending" | "in_progress" | "completed";
package/dist/tools.js CHANGED
@@ -1,4 +1,12 @@
1
1
  import path from "node:path";
2
+ /**
3
+ * Upstream #1252: the exit code Claude Code's text of a failed command names. It starts that text with
4
+ * `Exit code N`; a failure that names none (a denial, a command that could not start) yields undefined.
5
+ */
6
+ function failureExitCode(text) {
7
+ const match = text.match(/^Exit code (\d+)(?:\n|$)/);
8
+ return match ? Number(match[1]) : undefined;
9
+ }
2
10
  /**
3
11
  * Convert an absolute file path to a project-relative path for display.
4
12
  * Returns the original path if it's outside the project directory or if no cwd is provided.
@@ -451,7 +459,10 @@ export function toolUpdateFromToolResult(toolResult, toolUse, supportsTerminalOu
451
459
  // `diff-enriched-reader.ts`. Upstream notes its own structured renders go dark on replay because
452
460
  // `getSessionMessages` doesn't expose this field — the fork reads the transcript directly, so the
453
461
  // structured path is available on BOTH the live tail and `session/load`.
454
- toolUseResult) {
462
+ toolUseResult,
463
+ // Item 92 (#1312): how a backgrounded Bash's exit is reported. Absent → exit at the result, with
464
+ // null as the (unknown) code.
465
+ background) {
455
466
  if ("is_error" in toolResult &&
456
467
  toolResult.is_error &&
457
468
  toolResult.content &&
@@ -563,6 +574,8 @@ toolUseResult) {
563
574
  // 3. Plain string content from a regular tool_result
564
575
  // 4. Array content (e.g. [{ type: "text", text: "..." }])
565
576
  let output = "";
577
+ // `null` is an exit whose code nobody knows (a replayed backgrounded command); Zeo reads it as
578
+ // "not failed", so a failure always carries a number — the one its text names, else 1.
566
579
  let exitCode = isError ? 1 : 0;
567
580
  const structuredBash = structuredResult(toolUseResult);
568
581
  if (structuredBash &&
@@ -610,6 +623,28 @@ toolUseResult) {
610
623
  typeof result[0].text === "string") {
611
624
  output = result.map((c) => c.text).join("\n");
612
625
  }
626
+ // Upstream #1252: a failed command's text starts with `Exit code N` when the command itself
627
+ // exited non-zero. Report N instead of the conventional 1; a failure naming no code keeps 1.
628
+ if (isError) {
629
+ const named = failureExitCode(output);
630
+ if (named !== undefined && named !== 0)
631
+ exitCode = named;
632
+ }
633
+ // Upstream #1312: a backgrounded command is still running when its result arrives — the result
634
+ // only announces it. Its exit comes from the task's notification: at the result when the
635
+ // transcript already holds it, otherwise from the live pump once it lands (`holdRunning`), or —
636
+ // for callers that cannot send it later (replay, nested rows) — at the result with no code.
637
+ const backgroundTaskId = structuredBash?.backgroundTaskId;
638
+ let holdExit = false;
639
+ if (backgroundTaskId !== undefined && !isError) {
640
+ const end = terminalId !== undefined ? background?.ended(terminalId) : undefined;
641
+ if (end)
642
+ exitCode = end.exitCode;
643
+ else if (background?.holdRunning)
644
+ holdExit = true;
645
+ else
646
+ exitCode = null;
647
+ }
613
648
  // Without a terminal id there is nothing the client can reconcile these metas against, and
614
649
  // emitting them anyway strands the output: a client that buffers output/exit for terminals it
615
650
  // has not been told about (Zed keeps them in `pending_terminal_output`/`pending_terminal_exit`,
@@ -626,11 +661,15 @@ toolUseResult) {
626
661
  terminal_id: terminalId,
627
662
  data: output,
628
663
  },
629
- terminal_exit: {
630
- terminal_id: terminalId,
631
- exit_code: exitCode,
632
- signal: null,
633
- },
664
+ ...(holdExit
665
+ ? {}
666
+ : {
667
+ terminal_exit: {
668
+ terminal_id: terminalId,
669
+ exit_code: exitCode,
670
+ signal: null,
671
+ },
672
+ }),
634
673
  },
635
674
  };
636
675
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.14.13",
6
+ "version": "0.15.1",
7
7
  "description": "Runs the official Claude Code TUI over a PTY and exposes it via ACP, so Claude Code threads render natively in Zed's agent panel. Built for Anthropic's June 2026 billing split (since paused).",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",
@@ -35,7 +35,7 @@
35
35
  "format": "prettier --write .",
36
36
  "format:check": "prettier --check .",
37
37
  "check": "npm run lint && npm run format:check",
38
- "test": "npm run build && node --experimental-strip-types --test test/*.test.ts",
38
+ "test": "npm run build && node --experimental-strip-types --import ./test/helpers/test-setup.ts --test test/*.test.ts",
39
39
  "smoke:live": "node experiments/smoke-live.mjs",
40
40
  "prepublishOnly": "npm run build"
41
41
  },