@lucascouts/claude-agent-tui 0.10.2 → 0.11.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.
@@ -583,6 +583,8 @@ export type ToolUpdateMeta = {
583
583
  claudeCode?: {
584
584
  toolName: string;
585
585
  toolResponse?: unknown;
586
+ skill?: string;
587
+ skillPath?: string;
586
588
  };
587
589
  terminal_info?: {
588
590
  terminal_id: string;
package/dist/acp-agent.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { AgentSideConnection, ndJsonStream, RequestError, } from "@agentclientprotocol/sdk";
2
2
  import { deleteSession, getSessionInfo, listSessions, } from "@anthropic-ai/claude-agent-sdk";
3
3
  import { randomUUID } from "node:crypto";
4
+ import { existsSync } from "node:fs";
4
5
  import * as os from "node:os";
5
6
  import * as path from "node:path";
6
7
  import packageJson from "../package.json" with { type: "json" };
7
8
  import { SettingsManager } from "./settings.js";
8
- import { applyTaskCreate, applyTaskUpdate, parseTaskCreateOutput, planEntries, registerHookCallback, taskStateToPlanEntries, toolInfoFromToolUse, toolUpdateFromDiffToolResponse, toolUpdateFromToolResult, } from "./tools.js";
9
+ import { applyTaskCreate, applyTaskUpdate, parseTaskCreateOutput, parseTaskListOutput, parseTaskUpdateOutput, applyTaskList, planEntries, registerHookCallback, taskStateToPlanEntries, toolInfoFromToolUse, toolUpdateFromDiffToolResponse, toolUpdateFromToolResult, } from "./tools.js";
9
10
  import { nodeToWebReadable, nodeToWebWritable, unreachable } from "./utils.js";
10
11
  // === SEAM(011): engine boundary — inject a temporary no-op engine so the agent
11
12
  // boots without the cut SDK query() path; the real PTY engine arrives in 013–015/023.
@@ -367,6 +368,59 @@ function computeSessionFingerprint(params) {
367
368
  const dirs = [...resolveAdditionalDirs(params)].sort();
368
369
  return JSON.stringify({ cwd: params.cwd, mcpServers: servers, additionalDirectories: dirs });
369
370
  }
371
+ /**
372
+ * Upstream #986 (v0.67.0) — build the `_meta.claudeCode` bag for one tool_use.
373
+ * Extracted from the four inline literals that used to build it so the Skill
374
+ * fields cannot land on some call sites and not others.
375
+ */
376
+ function claudeCodeMetaFromToolUse(toolUse, cwd) {
377
+ const skillName = toolUse.name === "Skill"
378
+ ? toolUse.input?.skill
379
+ : undefined;
380
+ const skillPath = skillName ? resolveSkillPath(skillName, cwd) : undefined;
381
+ return {
382
+ toolName: toolUse.name,
383
+ ...(skillName ? { skill: skillName } : {}),
384
+ ...(skillPath ? { skillPath } : {}),
385
+ };
386
+ }
387
+ /** Roots a skill's directory may sit under, relative to the directory the scope resolves to. */
388
+ const SKILL_CONTAINER_DIRS = [".claude/skills", ".agents/skills"];
389
+ /**
390
+ * Absolute path of a skill's `SKILL.md`, or `undefined` when none of the known layouts holds one.
391
+ *
392
+ * The `Skill` tool reports only the skill's name, so the file has to be located by probing the
393
+ * layouts skills actually use: project- and user-level `.claude/skills` (plus `.agents/skills`),
394
+ * and for a `<prefix>:<name>` spelling either a plugin (`.claude/plugins/<prefix>/skills/<name>`)
395
+ * or a directory-scoped skill (`<prefix>/.claude/skills/<name>`), which share that spelling. Only
396
+ * a path that exists on disk is returned, so a wrong guess costs nothing and clients never render
397
+ * a link to a missing file.
398
+ */
399
+ function resolveSkillPath(skillName, cwd) {
400
+ if (!cwd) {
401
+ return undefined;
402
+ }
403
+ const colon = skillName.indexOf(":");
404
+ const scope = colon < 0 ? undefined : skillName.slice(0, colon);
405
+ const name = colon < 0 ? skillName : skillName.slice(colon + 1);
406
+ if (!name) {
407
+ return undefined;
408
+ }
409
+ const candidates = [];
410
+ const addCandidates = (base) => {
411
+ for (const container of SKILL_CONTAINER_DIRS) {
412
+ candidates.push(path.join(base, container, name, "SKILL.md"));
413
+ }
414
+ };
415
+ if (scope) {
416
+ // A `<prefix>:<name>` skill is either directory-scoped or a plugin's; both look identical.
417
+ addCandidates(path.join(cwd, scope));
418
+ candidates.push(path.join(cwd, ".claude/plugins", scope, "skills", name, "SKILL.md"));
419
+ }
420
+ addCandidates(cwd);
421
+ addCandidates(os.homedir());
422
+ return candidates.find((candidate) => existsSync(candidate));
423
+ }
370
424
  // === SEAM(012/023): the engine binary is resolved from the user's PATH. After the 023 rewrite,
371
425
  // createSession no longer passes the SDK `pathToClaudeCodeExecutable`; the PTY engine (story 013)
372
426
  // spawns the subscription `claude` through the login shell (`bash -lc 'claude …'`), so it resolves
@@ -3101,8 +3155,8 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
3101
3155
  const update = {
3102
3156
  _meta: {
3103
3157
  claudeCode: {
3158
+ ...claudeCodeMetaFromToolUse(toolUse, options?.cwd),
3104
3159
  toolResponse,
3105
- toolName: toolUse.name,
3106
3160
  },
3107
3161
  },
3108
3162
  toolCallId: toolUseId,
@@ -3133,9 +3187,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
3133
3187
  // rather than emitting a duplicate tool_call.
3134
3188
  update = {
3135
3189
  _meta: {
3136
- claudeCode: {
3137
- toolName: chunk.name,
3138
- },
3190
+ claudeCode: claudeCodeMetaFromToolUse(chunk, options?.cwd),
3139
3191
  },
3140
3192
  toolCallId: chunk.id,
3141
3193
  sessionUpdate: "tool_call_update",
@@ -3148,9 +3200,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
3148
3200
  // send as tool_call with terminal_info for Bash tools.
3149
3201
  update = {
3150
3202
  _meta: {
3151
- claudeCode: {
3152
- toolName: chunk.name,
3153
- },
3203
+ claudeCode: claudeCodeMetaFromToolUse(chunk, options?.cwd),
3154
3204
  ...(chunk.name === "Bash" && supportsTerminalOutput
3155
3205
  ? { terminal_info: { terminal_id: chunk.id } }
3156
3206
  : {}),
@@ -3184,19 +3234,46 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
3184
3234
  toolUse.name === "TaskGet") {
3185
3235
  // Headless/SDK sessions emit Task* tools instead of TodoWrite.
3186
3236
  // TaskCreate / TaskUpdate mutate the accumulated task list; TaskList
3187
- // and TaskGet are read-only so we just suppress their tool_call /
3188
- // tool_result events. The plan update is emitted as a snapshot of
3189
- // the accumulated state, mirroring the legacy TodoWrite behavior.
3237
+ // RECONCILES it against the SDK's authoritative snapshot (upstream #974),
3238
+ // which is what repairs a resumed or compacted session whose creating
3239
+ // calls are no longer in replay history. TaskGet stays read-only and
3240
+ // suppressed. The plan update is emitted as a snapshot of the accumulated
3241
+ // state, mirroring the legacy TodoWrite behavior.
3242
+ //
3243
+ // Each parser is offered the structured `toolUseResult` FIRST and the
3244
+ // model-facing `chunk.content` second. That order is not cosmetic: the
3245
+ // measured transcripts put the structured object only in `toolUseResult`
3246
+ // and a short sentence in `content`, so reading `content` alone (as this
3247
+ // arm did before) parsed nothing at all.
3190
3248
  const isError = "is_error" in chunk && chunk.is_error;
3249
+ let shouldEmitTaskPlan = false;
3191
3250
  if (!isError) {
3192
3251
  if (toolUse.name === "TaskCreate") {
3193
- applyTaskCreate(taskState, toolUse.input, parseTaskCreateOutput(chunk.content));
3252
+ applyTaskCreate(taskState, toolUse.input, parseTaskCreateOutput(toolUseResult) ?? parseTaskCreateOutput(chunk.content));
3253
+ shouldEmitTaskPlan = true;
3194
3254
  }
3195
3255
  else if (toolUse.name === "TaskUpdate") {
3196
- applyTaskUpdate(taskState, toolUse.input);
3256
+ const input = toolUse.input;
3257
+ const output = parseTaskUpdateOutput(toolUseResult, input?.taskId) ??
3258
+ parseTaskUpdateOutput(chunk.content, input?.taskId);
3259
+ // Older transcripts carry no structured output, so the input-based
3260
+ // path is retained. When an output IS available, only a confirmed
3261
+ // update for the same task is applied — a TaskUpdate can fail
3262
+ // logically (unknown id) without the result being flagged is_error.
3263
+ if (!output || (output.success && output.taskId === input?.taskId)) {
3264
+ applyTaskUpdate(taskState, input);
3265
+ shouldEmitTaskPlan = true;
3266
+ }
3267
+ }
3268
+ else if (toolUse.name === "TaskList") {
3269
+ const output = parseTaskListOutput(toolUseResult) ?? parseTaskListOutput(chunk.content);
3270
+ if (output) {
3271
+ applyTaskList(taskState, output);
3272
+ shouldEmitTaskPlan = true;
3273
+ }
3197
3274
  }
3198
3275
  }
3199
- if (!isError && (toolUse.name === "TaskCreate" || toolUse.name === "TaskUpdate")) {
3276
+ if (shouldEmitTaskPlan) {
3200
3277
  update = {
3201
3278
  sessionUpdate: "plan",
3202
3279
  entries: taskStateToPlanEntries(taskState),
@@ -3227,9 +3304,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
3227
3304
  }
3228
3305
  update = {
3229
3306
  _meta: {
3230
- claudeCode: {
3231
- toolName: toolUse.name,
3232
- },
3307
+ claudeCode: claudeCodeMetaFromToolUse(toolUse, options?.cwd),
3233
3308
  ...(toolMeta?.terminal_exit ? { terminal_exit: toolMeta.terminal_exit } : {}),
3234
3309
  },
3235
3310
  toolCallId: chunk.tool_use_id,
package/dist/tools.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PlanEntry, ToolCallContent, ToolCallLocation, ToolKind } from "@agentclientprotocol/sdk";
2
2
  import { HookCallback } from "@anthropic-ai/claude-agent-sdk";
3
- import { TaskCreateInput, TaskCreateOutput, TaskUpdateInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools.js";
3
+ import { TaskCreateInput, TaskCreateOutput, TaskListOutput, TaskUpdateInput, TaskUpdateOutput } from "@anthropic-ai/claude-agent-sdk/sdk-tools.js";
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";
@@ -85,13 +85,49 @@ export type TaskEntry = {
85
85
  };
86
86
  export type TaskState = Map<string, TaskEntry>;
87
87
  /**
88
- * Best-effort parse of a TaskCreate tool_result content into the structured
89
- * TaskCreateOutput. The SDK delivers tool outputs either as a string or as
90
- * an array of TextBlockParam-like blocks containing JSON text; try both.
88
+ * Best-effort parse of a TaskCreate result. Upstream #974 (v0.67.0).
89
+ *
90
+ * MEASURED at port time, and the reason the textual fallback is not optional here: across 186
91
+ * Task* tool_use/tool_result pairs in the local transcripts, the model-facing `content` is ALWAYS
92
+ * the short sentence ("Task #1 created successfully: <subject>") and never JSON — the structured
93
+ * object lives in the message-level `toolUseResult`. The pre-#974 parser tried `JSON.parse` on
94
+ * `content` alone, so it returned `undefined` for every real TaskCreate and `applyTaskCreate`
95
+ * silently did nothing. On a resumed session, where the TaskCreated hook never fires, that left
96
+ * the plan empty.
91
97
  */
92
98
  export declare function parseTaskCreateOutput(content: unknown): TaskCreateOutput | undefined;
99
+ /**
100
+ * Best-effort parse of a TaskList result — the SDK's AUTHORITATIVE snapshot of the task list.
101
+ * Upstream #974 (v0.67.0).
102
+ *
103
+ * Both shapes are ported, and both are measured: the structured `{ tasks: [...] }` is what the
104
+ * single real TaskList in the local corpus carries in `toolUseResult`, and its `content` is the
105
+ * `#<id> [<status>] <subject>` listing the textual arm below parses. One sample is too few to drop
106
+ * either arm, so neither is dropped.
107
+ */
108
+ export declare function parseTaskListOutput(content: unknown): TaskListOutput | undefined;
109
+ /**
110
+ * Best-effort parse of a TaskUpdate result. Upstream #974 (v0.67.0).
111
+ *
112
+ * The point is the `success` flag: a TaskUpdate can fail LOGICALLY (unknown task id) while the
113
+ * tool_result itself is not flagged `is_error`. Applying the requested mutation in that case
114
+ * writes a task the CLI does not have. `expectedTaskId` lets the textual arm attribute a
115
+ * "Task #<id> not found" line when the structured output is absent.
116
+ */
117
+ export declare function parseTaskUpdateOutput(content: unknown, expectedTaskId?: string): TaskUpdateOutput | undefined;
93
118
  export declare function applyTaskCreate(state: TaskState, input: TaskCreateInput | undefined, output: TaskCreateOutput | undefined): void;
94
119
  export declare function applyTaskUpdate(state: TaskState, input: TaskUpdateInput | undefined): void;
120
+ /**
121
+ * Reconcile the accumulated task list against the SDK's authoritative TaskList snapshot.
122
+ * Upstream #974 (v0.67.0).
123
+ *
124
+ * This is what repairs a RESUMED or COMPACTED session: the TaskCreate calls that built the list
125
+ * may be gone from replay history, so the accumulated state under-reports. The snapshot replaces
126
+ * the list wholesale — entries it omits were deleted and must disappear — while `activeForm` and
127
+ * `description` are carried over from the previous entry, because the TaskList output does not
128
+ * carry them and dropping them would silently degrade the plan text.
129
+ */
130
+ export declare function applyTaskList(state: TaskState, output: TaskListOutput): void;
95
131
  export declare function taskStateToPlanEntries(state: TaskState): PlanEntry[];
96
132
  export declare function markdownEscape(text: string): string;
97
133
  /**
package/dist/tools.js CHANGED
@@ -310,6 +310,21 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
310
310
  : [],
311
311
  };
312
312
  }
313
+ // Upstream #986 (v0.67.0) — the `Skill` tool announces a skill being loaded.
314
+ // Without this case it falls through to `Other` and renders as a generic block
315
+ // titled "Skill" with the raw result text behind an expander. The skill NAME is
316
+ // the tool's only meaningful input, and it arrives as a real JSONL
317
+ // `tool_use.input.skill` (measured: 73 of 3 515 local transcripts), so this is
318
+ // readable from the disk-tail engine with no new source.
319
+ case "Skill": {
320
+ const input = toolUse.input;
321
+ const skillName = input?.skill;
322
+ return {
323
+ title: skillName ? `Load skill: ${skillName}` : "Load skill",
324
+ kind: "other",
325
+ content: [],
326
+ };
327
+ }
313
328
  case "Other": {
314
329
  const input = toolUse.input;
315
330
  let output;
@@ -622,6 +637,11 @@ toolUseResult) {
622
637
  }
623
638
  return {};
624
639
  }
640
+ // The result text is a bare "Launching skill: <name>" restatement of the title
641
+ // the tool_use already produced — suppress it, as Edit/Write suppress theirs.
642
+ case "Skill": {
643
+ return {};
644
+ }
625
645
  case "Edit": // Edit is handled in hooks
626
646
  case "Write": {
627
647
  return {};
@@ -784,45 +804,146 @@ function toAcpContentBlock(content, isError) {
784
804
  }
785
805
  export function planEntries(input) {
786
806
  return (input?.todos ?? []).map((todo) => ({
787
- content: todo.content,
807
+ // Upstream #974 (v0.67.0): an in-progress item reads better in its active voice
808
+ // ("Fixing the bug") than in its imperative subject ("Fix the bug") — that is what
809
+ // `activeForm` is for. Any other status keeps the subject. Story 020's drift note
810
+ // recorded this field as DROPPED; it is now carried, and that note is updated.
811
+ content: todo.status === "in_progress" && todo.activeForm ? todo.activeForm : todo.content,
788
812
  status: todo.status,
789
813
  priority: "medium",
790
814
  }));
791
815
  }
792
816
  /**
793
- * Best-effort parse of a TaskCreate tool_result content into the structured
794
- * TaskCreateOutput. The SDK delivers tool outputs either as a string or as
795
- * an array of TextBlockParam-like blocks containing JSON text; try both.
817
+ * Every text payload a tool_result can carry, in the order it should be tried: a bare string, or
818
+ * the `text` of each TextBlockParam-like block. Shared by the three Task* parsers so they cannot
819
+ * disagree about where a tool's output lives.
796
820
  */
797
- export function parseTaskCreateOutput(content) {
798
- const tryParse = (text) => {
821
+ function toolOutputTexts(content) {
822
+ if (typeof content === "string")
823
+ return [content];
824
+ if (!Array.isArray(content))
825
+ return [];
826
+ return content.flatMap((block) => block &&
827
+ typeof block === "object" &&
828
+ "type" in block &&
829
+ block.type === "text" &&
830
+ typeof block.text === "string"
831
+ ? [block.text]
832
+ : []);
833
+ }
834
+ /**
835
+ * The already-structured object (the JSONL `toolUseResult`), or the first text payload that parses
836
+ * as JSON and satisfies `isValid`. Returns `undefined` when neither holds — never a partial object,
837
+ * so every caller can treat a result as fully shaped.
838
+ */
839
+ function parseJsonToolOutput(content, isValid) {
840
+ if (content && typeof content === "object" && !Array.isArray(content) && isValid(content)) {
841
+ return content;
842
+ }
843
+ for (const text of toolOutputTexts(content)) {
799
844
  try {
800
845
  const parsed = JSON.parse(text);
801
- if (parsed &&
802
- typeof parsed === "object" &&
803
- parsed.task &&
804
- typeof parsed.task.id === "string") {
846
+ if (isValid(parsed))
805
847
  return parsed;
806
- }
807
848
  }
808
849
  catch {
809
- // ignore
850
+ // Not JSON — fall through to the caller's textual fallback.
810
851
  }
811
- return undefined;
812
- };
813
- if (typeof content === "string") {
814
- return tryParse(content);
815
852
  }
816
- if (Array.isArray(content)) {
817
- for (const block of content) {
818
- if (block && typeof block === "object" && "type" in block && block.type === "text") {
819
- const text = block.text;
820
- if (typeof text === "string") {
821
- const parsed = tryParse(text);
822
- if (parsed)
823
- return parsed;
824
- }
853
+ return undefined;
854
+ }
855
+ /**
856
+ * Best-effort parse of a TaskCreate result. Upstream #974 (v0.67.0).
857
+ *
858
+ * MEASURED at port time, and the reason the textual fallback is not optional here: across 186
859
+ * Task* tool_use/tool_result pairs in the local transcripts, the model-facing `content` is ALWAYS
860
+ * the short sentence ("Task #1 created successfully: <subject>") and never JSON — the structured
861
+ * object lives in the message-level `toolUseResult`. The pre-#974 parser tried `JSON.parse` on
862
+ * `content` alone, so it returned `undefined` for every real TaskCreate and `applyTaskCreate`
863
+ * silently did nothing. On a resumed session, where the TaskCreated hook never fires, that left
864
+ * the plan empty.
865
+ */
866
+ export function parseTaskCreateOutput(content) {
867
+ const structured = parseJsonToolOutput(content, (parsed) => Boolean(parsed) &&
868
+ typeof parsed === "object" &&
869
+ "task" in parsed &&
870
+ typeof parsed.task?.id === "string");
871
+ if (structured)
872
+ return structured;
873
+ for (const text of toolOutputTexts(content)) {
874
+ const match = /^Task #(\S+) created successfully: (.+)$/.exec(text.trim());
875
+ if (match)
876
+ return { task: { id: match[1], subject: match[2] } };
877
+ }
878
+ return undefined;
879
+ }
880
+ const TASK_STATUSES = new Set(["pending", "in_progress", "completed"]);
881
+ /**
882
+ * Best-effort parse of a TaskList result — the SDK's AUTHORITATIVE snapshot of the task list.
883
+ * Upstream #974 (v0.67.0).
884
+ *
885
+ * Both shapes are ported, and both are measured: the structured `{ tasks: [...] }` is what the
886
+ * single real TaskList in the local corpus carries in `toolUseResult`, and its `content` is the
887
+ * `#<id> [<status>] <subject>` listing the textual arm below parses. One sample is too few to drop
888
+ * either arm, so neither is dropped.
889
+ */
890
+ export function parseTaskListOutput(content) {
891
+ const structured = parseJsonToolOutput(content, (parsed) => Boolean(parsed) &&
892
+ typeof parsed === "object" &&
893
+ Array.isArray(parsed.tasks) &&
894
+ parsed.tasks.every((task) => Boolean(task) &&
895
+ typeof task.id === "string" &&
896
+ typeof task.subject === "string" &&
897
+ TASK_STATUSES.has(task.status)));
898
+ if (structured)
899
+ return structured;
900
+ for (const text of toolOutputTexts(content)) {
901
+ if (text.trim() === "No tasks found")
902
+ return { tasks: [] };
903
+ const tasks = [];
904
+ let clean = true;
905
+ for (const line of text.trim().split("\n")) {
906
+ const match = /^#(\S+) \[(pending|in_progress|completed)\] (.+?)(?: \(([^()]*)\))?(?: \[blocked by ((?:#[^,\]]+(?:, )?)+)\])?$/.exec(line);
907
+ // A single unparseable line means this text is not a task listing at all — take none of it
908
+ // rather than a truncated plan that reads as complete.
909
+ if (!match) {
910
+ clean = false;
911
+ break;
825
912
  }
913
+ tasks.push({
914
+ id: match[1],
915
+ subject: match[3],
916
+ status: match[2],
917
+ ...(match[4] ? { owner: match[4] } : {}),
918
+ blockedBy: match[5] ? match[5].split(", ").map((id) => id.slice(1)) : [],
919
+ });
920
+ }
921
+ if (clean && tasks.length > 0)
922
+ return { tasks };
923
+ }
924
+ return undefined;
925
+ }
926
+ /**
927
+ * Best-effort parse of a TaskUpdate result. Upstream #974 (v0.67.0).
928
+ *
929
+ * The point is the `success` flag: a TaskUpdate can fail LOGICALLY (unknown task id) while the
930
+ * tool_result itself is not flagged `is_error`. Applying the requested mutation in that case
931
+ * writes a task the CLI does not have. `expectedTaskId` lets the textual arm attribute a
932
+ * "Task #<id> not found" line when the structured output is absent.
933
+ */
934
+ export function parseTaskUpdateOutput(content, expectedTaskId) {
935
+ const structured = parseJsonToolOutput(content, (parsed) => Boolean(parsed) &&
936
+ typeof parsed === "object" &&
937
+ typeof parsed.success === "boolean" &&
938
+ typeof parsed.taskId === "string" &&
939
+ Array.isArray(parsed.updatedFields));
940
+ if (structured)
941
+ return structured;
942
+ for (const text of toolOutputTexts(content)) {
943
+ const notFound = /^Task #(\S+) not found$/.exec(text.trim());
944
+ const taskId = notFound?.[1] ?? expectedTaskId;
945
+ if (taskId && (notFound || text.trim() === "Failed to delete task")) {
946
+ return { success: false, taskId, updatedFields: [], error: text.trim() };
826
947
  }
827
948
  }
828
949
  return undefined;
@@ -858,9 +979,33 @@ export function applyTaskUpdate(state, input) {
858
979
  description: input.description ?? existing?.description,
859
980
  });
860
981
  }
982
+ /**
983
+ * Reconcile the accumulated task list against the SDK's authoritative TaskList snapshot.
984
+ * Upstream #974 (v0.67.0).
985
+ *
986
+ * This is what repairs a RESUMED or COMPACTED session: the TaskCreate calls that built the list
987
+ * may be gone from replay history, so the accumulated state under-reports. The snapshot replaces
988
+ * the list wholesale — entries it omits were deleted and must disappear — while `activeForm` and
989
+ * `description` are carried over from the previous entry, because the TaskList output does not
990
+ * carry them and dropping them would silently degrade the plan text.
991
+ */
992
+ export function applyTaskList(state, output) {
993
+ const previous = new Map(state);
994
+ state.clear();
995
+ for (const task of output.tasks) {
996
+ const existing = previous.get(task.id);
997
+ state.set(task.id, {
998
+ subject: task.subject,
999
+ status: task.status,
1000
+ activeForm: existing?.activeForm,
1001
+ description: existing?.description,
1002
+ });
1003
+ }
1004
+ }
861
1005
  export function taskStateToPlanEntries(state) {
862
1006
  return Array.from(state.values()).map((task) => ({
863
- content: task.subject,
1007
+ // Same rule as `planEntries` above — the two plan sources must not drift.
1008
+ content: task.status === "in_progress" && task.activeForm ? task.activeForm : task.subject,
864
1009
  status: task.status,
865
1010
  priority: "medium",
866
1011
  }));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.10.2",
6
+ "version": "0.11.0",
7
7
  "description": "Run the official Claude Code TUI in Zed's agent panel on your Claude Pro/Max subscription — an ACP-over-PTY bridge created for Anthropic's billing split (paused June 15; see README).",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",
@@ -64,19 +64,19 @@
64
64
  },
65
65
  "dependencies": {
66
66
  "@agentclientprotocol/sdk": "1.3.0",
67
- "@anthropic-ai/claude-agent-sdk": "0.3.220",
67
+ "@anthropic-ai/claude-agent-sdk": "0.3.232",
68
68
  "node-pty": "1.1.0",
69
69
  "zod": "^3.25.0 || ^4.0.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@anthropic-ai/sdk": "0.115.0",
72
+ "@anthropic-ai/sdk": "0.117.1",
73
73
  "@eslint/js": "10.0.1",
74
- "@types/node": "26.1.2",
75
- "@typescript-eslint/eslint-plugin": "8.65.0",
76
- "@typescript-eslint/parser": "8.65.0",
77
- "eslint": "10.8.0",
74
+ "@types/node": "26.2.0",
75
+ "@typescript-eslint/eslint-plugin": "8.67.0",
76
+ "@typescript-eslint/parser": "8.67.0",
77
+ "eslint": "10.8.1",
78
78
  "eslint-config-prettier": "10.1.8",
79
- "globals": "17.8.0",
79
+ "globals": "17.11.0",
80
80
  "prettier": "3.9.6",
81
81
  "ts-node": "10.9.2",
82
82
  "typescript": "6.0.3"