@agentclientprotocol/claude-agent-acp 0.85.2-preview.2 → 0.85.2-preview.20

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 (68) hide show
  1. package/README.md +1 -0
  2. package/dist/acp-agent.d.ts +100 -23
  3. package/dist/acp-agent.d.ts.map +1 -1
  4. package/dist/acp-agent.js +528 -183
  5. package/dist/air-extension.d.ts +2 -0
  6. package/dist/air-extension.d.ts.map +1 -1
  7. package/dist/air-extension.js +2 -0
  8. package/dist/clear-context-coordinator.d.ts +1 -0
  9. package/dist/clear-context-coordinator.d.ts.map +1 -1
  10. package/dist/clear-context-coordinator.js +2 -1
  11. package/dist/diff.d.ts +45 -8
  12. package/dist/diff.d.ts.map +1 -1
  13. package/dist/diff.js +111 -30
  14. package/dist/mcp-command.d.ts +51 -0
  15. package/dist/mcp-command.d.ts.map +1 -0
  16. package/dist/mcp-command.js +321 -0
  17. package/dist/permissions/presentation.d.ts +17 -2
  18. package/dist/permissions/presentation.d.ts.map +1 -1
  19. package/dist/permissions/presentation.js +4 -0
  20. package/dist/resumed-session.d.ts +16 -6
  21. package/dist/resumed-session.d.ts.map +1 -1
  22. package/dist/resumed-session.js +91 -25
  23. package/dist/session-config-ids.d.ts +1 -0
  24. package/dist/session-config-ids.d.ts.map +1 -1
  25. package/dist/session-config-ids.js +1 -0
  26. package/dist/session-mode.d.ts +14 -0
  27. package/dist/session-mode.d.ts.map +1 -1
  28. package/dist/session-mode.js +22 -0
  29. package/dist/tool-calls/client-capabilities.d.ts +20 -2
  30. package/dist/tool-calls/client-capabilities.d.ts.map +1 -1
  31. package/dist/tool-calls/client-capabilities.js +14 -4
  32. package/dist/tool-calls/renderer.d.ts.map +1 -1
  33. package/dist/tool-calls/renderer.js +3 -2
  34. package/dist/tool-calls/reporters/file-edit.d.ts +1 -1
  35. package/dist/tool-calls/reporters/file-edit.d.ts.map +1 -1
  36. package/dist/tool-calls/reporters/file-edit.js +20 -14
  37. package/dist/turn-events.d.ts +11 -5
  38. package/dist/turn-events.d.ts.map +1 -1
  39. package/dist/usage-markdown.d.ts +2 -0
  40. package/dist/usage-markdown.d.ts.map +1 -1
  41. package/dist/usage-markdown.js +2 -1
  42. package/dist/utils.d.ts +12 -0
  43. package/dist/utils.d.ts.map +1 -1
  44. package/dist/utils.js +28 -0
  45. package/dist/v2/agent.d.ts.map +1 -1
  46. package/dist/v2/agent.js +121 -17
  47. package/dist/v2/initialize.d.ts +2 -5
  48. package/dist/v2/initialize.d.ts.map +1 -1
  49. package/dist/v2/initialize.js +23 -6
  50. package/dist/v2/permission.d.ts +25 -0
  51. package/dist/v2/permission.d.ts.map +1 -0
  52. package/dist/v2/permission.js +38 -0
  53. package/dist/v2/prompt.d.ts +47 -0
  54. package/dist/v2/prompt.d.ts.map +1 -0
  55. package/dist/v2/prompt.js +153 -0
  56. package/dist/v2/session-update.d.ts +6 -0
  57. package/dist/v2/session-update.d.ts.map +1 -1
  58. package/dist/v2/session-update.js +27 -0
  59. package/dist/v2/session.d.ts +15 -4
  60. package/dist/v2/session.d.ts.map +1 -1
  61. package/dist/v2/session.js +20 -6
  62. package/dist/v2/terminal.d.ts +42 -0
  63. package/dist/v2/terminal.d.ts.map +1 -0
  64. package/dist/v2/terminal.js +95 -0
  65. package/dist/v2/tool-call.d.ts +38 -0
  66. package/dist/v2/tool-call.d.ts.map +1 -0
  67. package/dist/v2/tool-call.js +49 -0
  68. package/package.json +2 -2
@@ -17,6 +17,8 @@ export declare const AIR_SKILL_KEY = "skill";
17
17
  export declare const AIR_CONTEXT_COMPACTION_KEY = "contextCompaction";
18
18
  export declare const AIR_GOAL_KEY = "goal";
19
19
  export declare const AIR_KIND_KEY = "kind";
20
+ /** The absolute path of the `SKILL.md` of a skill command in `available_commands_update`. */
21
+ export declare const AIR_SKILL_PATH_KEY = "skillPath";
20
22
  export declare const AIR_PERMISSION_KEY = "permission";
21
23
  export declare const AIR_CUSTOM_ANSWER_KEY = "customAn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E,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,GAAG,YAAY,EAAE,MAAM,EAAE,2BAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EAChD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAErC;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAKnF;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAY9F"}
@@ -17,6 +17,8 @@ export const AIR_SKILL_KEY = "skill";
17
17
  export const AIR_CONTEXT_COMPACTION_KEY = "contextCompaction";
18
18
  export const AIR_GOAL_KEY = "goal";
19
19
  export const AIR_KIND_KEY = "kind";
20
+ /** The absolute path of the `SKILL.md` of a skill command in `available_commands_update`. */
21
+ export const AIR_SKILL_PATH_KEY = "skillPath";
20
22
  export const AIR_PERMISSION_KEY = "permission";
21
23
  export const AIR_CUSTOM_ANSWER_KEY = "customAnswer";
22
24
  /**
@@ -29,6 +29,7 @@ export type ClearContextSession<Turn extends ClearContextTurn = ClearContextTurn
29
29
  currentModelId: string;
30
30
  };
31
31
  configOptions: SessionConfigOption[];
32
+ currentAgent: string;
32
33
  fastModeEnabled: boolean;
33
34
  effortPinnedLevel?: string;
34
35
  activeTurn?: Turn | null;
@@ -1 +1 @@
1
- {"version":3,"file":"clear-context-coordinator.d.ts","sourceRoot":"","sources":["../src/clear-context-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,KAAK,EAGV,cAAc,EACd,cAAc,EACf,MAAM,gCAAgC,CAAC;AAGxC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC3C,CAAC;AAEF;;+EAE+E;AAC/E,MAAM,MAAM,mBAAmB,CAAC,IAAI,SAAS,gBAAgB,GAAG,gBAAgB,IAAI;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC,gBAAgB,EAAE,KAAK,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9C,MAAM,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,eAAe,E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,CAAC;IACzF,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACjD,CAAC;AAiCF;;kEAEkE;AAClE,wBAAsB,0BAA0B,CAC9C,IAAI,SAAS,gBAAgB,EAC7B,OAAO,SAAS,mBAAmB,CAAC,IAAI,CAAC,EAEzC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,2BAA2B,CAAC,OAAO,EAAE,IAAI,CAAC,EAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAkDf"}
@@ -1,4 +1,4 @@
1
- import { DEFAULT_MODEL_ID } from "./session-config-ids.js";
1
+ import { DEFAULT_AGENT_ID, DEFAULT_MODEL_ID } from "./session-config-ids.js";
2
2
  function restartParams(session) {
3
3
  const originalParams = session.creationParams ?? { cwd: session.cwd, mcpServers: [] };
4
4
  const originalMeta = originalParams._meta;
@@ -18,6 +18,7 @@ function restartParams(session) {
18
18
  ...(session.models.currentModelId !== DEFAULT_MODEL_ID
19
19
  ? { model: session.models.currentModelId }
20
20
  : {}),
21
+ ...(session.currentAgent !== DEFAULT_AGENT_ID ? { agent: session.currentAgent } : {}),
21
22
  ...(session.effortPinnedLevel !== undefined
22
23
  ? { effort: session.effortPinnedLevel }
23
24
  : {}),
package/dist/diff.d.ts CHANGED
@@ -23,6 +23,17 @@ interface PatchHunk {
23
23
  }
24
24
  /** The kind of file change that a git patch describes. */
25
25
  type FileChange = "create" | "update";
26
+ /**
27
+ * The diff that carries an exact patch: AIR's `diffPatch` extension of a v1
28
+ * diff, or an ACP v2 diff.
29
+ */
30
+ export type PatchForm = "air" | "v2";
31
+ /**
32
+ * How a git patch names its file. `git` is git's own form: the leading slash
33
+ * dropped and the `a/` and `b/` prefixes added. `absolute` is the form of an
34
+ * ACP v2 `git_patch`, whose paths must be absolute: the path itself.
35
+ */
36
+ type GitPatchPaths = "git" | "absolute";
26
37
  /**
27
38
  * Builds the exact patch shown before Claude runs an Edit or Write tool.
28
39
  *
@@ -35,14 +46,14 @@ type FileChange = "create" | "update";
35
46
  * normalizes quotes or fails.
36
47
  *
37
48
  * A Write always gets content that shows the change: the patch, the standard
38
- * diff of a text that cannot have an exact patch, or a notice that the Write
39
- * overwrites a file that the adapter cannot show.
49
+ * diff (in v2, the change alone) of a text that cannot have an exact patch, or
50
+ * a notice that the Write overwrites a file that the adapter cannot show.
40
51
  *
41
52
  * The preview uses the tool input as it is. Claude can still remove the
42
53
  * trailing whitespace of a line before it writes. The PostToolUse hook then
43
54
  * sends the patch of the written file.
44
55
  */
45
- export declare function previewPatchContent(toolName: string, input: Record<string, unknown>, cwd?: string): Promise<ToolCallContent[] | undefined>;
56
+ export declare function previewPatchContent(toolName: string, input: Record<string, unknown>, cwd?: string, form?: PatchForm): Promise<ToolCallContent[] | undefined>;
46
57
  /**
47
58
  * Builds the git patch for a finished Edit or Write from the file on disk.
48
59
  *
@@ -54,7 +65,7 @@ export declare function previewPatchContent(toolName: string, input: Record<stri
54
65
  * A written file that contains a CR or a byte order mark is declined, because
55
66
  * Claude removed those bytes from `originalFile`.
56
67
  */
57
- export declare function patchUpdateFromDiffToolResponse(toolResponse: unknown): Promise<{
68
+ export declare function patchUpdateFromDiffToolResponse(toolResponse: unknown, form?: PatchForm): Promise<{
58
69
  content: ToolCallContent[];
59
70
  locations: ToolCallLocation[];
60
71
  } | undefined>;
@@ -69,13 +80,39 @@ export declare function toolUpdateFromDiffToolResponse(toolResponse: unknown): {
69
80
  content?: ToolCallContent[];
70
81
  locations?: ToolCallLocation[];
71
82
  };
83
+ /**
84
+ * The ACP v2 diff of a finished Edit or Write: the exact patch of
85
+ * {@link patchUpdateFromDiffToolResponse} when it can be built, else the
86
+ * change with a patch from what the toolResponse holds.
87
+ *
88
+ * The fallback patch of an update comes from the `structuredPatch`, which is
89
+ * display data (see {@link patchUpdateFromDiffToolResponse}). That is enough
90
+ * for a v2 patch, which is renderable text, not a patch to apply. An update
91
+ * without hunks, such as one whose previous content was too large to diff,
92
+ * gets the change alone. An Edit with an empty `old_string` reports the same
93
+ * response for a created file and a filled empty one, so it gets no diff.
94
+ */
95
+ export declare function v2UpdateFromDiffToolResponse(toolResponse: unknown): Promise<{
96
+ content?: ToolCallContent[];
97
+ locations?: ToolCallLocation[];
98
+ }>;
72
99
  /**
73
100
  * The text of one git patch for `filePath`.
74
101
  *
75
- * The headers follow `git diff`: the path loses its leading slash, gets the
76
- * `a/` and `b/` prefixes, and is quoted when git would quote it. A created
77
- * file gets its mode line and a `/dev/null` side.
102
+ * The headers follow `git diff`: the path is quoted when git would quote it,
103
+ * and a created file gets its mode line and a `/dev/null` side. With `git`
104
+ * paths, the path loses its leading slash and gets the `a/` and `b/` prefixes.
105
+ */
106
+ export declare function gitPatchText(filePath: string, change: FileChange, hunks: PatchHunk[], paths?: GitPatchPaths): string;
107
+ /**
108
+ * The ACP v2 diff of a change to the text file `filePath`: the change and,
109
+ * given hunks, its git patch.
110
+ *
111
+ * The agent builds tool call content in v1 types, and v1 cannot express a v2
112
+ * diff, so the diff travels as v1 content. Nothing in the agent reads inside a
113
+ * diff, and only a v2 client gets one: the v2 surface sends it as it is
114
+ * (`src/v2/tool-call.ts`).
78
115
  */
79
- export declare function gitPatchText(filePath: string, change: FileChange, hunks: PatchHunk[]): string;
116
+ export declare function v2DiffContent(filePath: string, change: FileChange, hunks?: PatchHunk[]): ToolCallContent;
80
117
  export {};
81
118
  //# sourceMappingURL=diff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAQ7E;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAo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AY,CAC1B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAAE,EAClB,KAAK,GAAE,aAAqB,GAC3B,MAAM,CAMR;AA2OD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,UAAU,EAClB,KAAK,CAAC,EAAE,SAAS,EAAE,GAClB,eAAe,CAajB"}
package/dist/diff.js CHANGED
@@ -37,14 +37,14 @@ const NO_NEWLINE_MARKER = "\";
37
37
  * normalizes quotes or fails.
38
38
  *
39
39
  * A Write always gets content that shows the change: the patch, the standard
40
- * diff of a text that cannot have an exact patch, or a notice that the Write
41
- * overwrites a file that the adapter cannot show.
40
+ * diff (in v2, the change alone) of a text that cannot have an exact patch, or
41
+ * a notice that the Write overwrites a file that the adapter cannot show.
42
42
  *
43
43
  * The preview uses the tool input as it is. Claude can still remove the
44
44
  * trailing whitespace of a line before it writes. The PostToolUse hook then
45
45
  * sends the patch of the written file.
46
46
  */
47
- export async function previewPatchContent(toolName, input, cwd) {
47
+ export async function previewPatchContent(toolName, input, cwd, form = "air") {
48
48
  if (toolName === "Edit") {
49
49
  const edit = input;
50
50
  if (typeof edit.file_path !== "string" ||
@@ -67,7 +67,7 @@ export async function previewPatchContent(toolName, input, cwd) {
67
67
  if (oldText !== null && (oldText.trim() !== "" || oldText.includes("\uFEFF"))) {
68
68
  return undefined;
69
69
  }
70
- return optionalContent(filePatch(filePath, oldText, newString)?.content);
70
+ return exactPatch(filePath, oldText, newString, form);
71
71
  }
72
72
  if (oldText === null)
73
73
  return undefined;
@@ -78,7 +78,7 @@ export async function previewPatchContent(toolName, input, cwd) {
78
78
  return undefined;
79
79
  }
80
80
  const newText = replacedText(oldText, oldString, newString, edit.replace_all === true);
81
- return optionalContent(filePatch(filePath, oldText, newText)?.content);
81
+ return exactPatch(filePath, oldText, newText, form);
82
82
  }
83
83
  if (toolName === "Write") {
84
84
  const write = normalizeWriteInput(input);
@@ -104,12 +104,14 @@ export async function previewPatchContent(toolName, input, cwd) {
104
104
  if (oldText === content)
105
105
  return undefined;
106
106
  const standard = [
107
- { type: "diff", path: write.file_path, oldText, newText: content },
107
+ form === "v2"
108
+ ? v2DiffContent(filePath, oldText === null ? "create" : "update")
109
+ : { type: "diff", path: write.file_path, oldText, newText: content },
108
110
  ];
109
111
  if (!isPatchableText(content))
110
112
  return standard;
111
113
  // A dense change can exceed the diff budget. The approval then shows the standard diff.
112
- return optionalContent(filePatch(filePath, oldText, content)?.content) ?? standard;
114
+ return exactPatch(filePath, oldText, content, form) ?? standard;
113
115
  }
114
116
  return undefined;
115
117
  }
@@ -151,7 +153,7 @@ function replacedText(fileText, oldString, newString, replaceAll) {
151
153
  * A written file that contains a CR or a byte order mark is declined, because
152
154
  * Claude removed those bytes from `originalFile`.
153
155
  */
154
- export async function patchUpdateFromDiffToolResponse(toolResponse) {
156
+ export async function patchUpdateFromDiffToolResponse(toolResponse, form = "air") {
155
157
  if (!toolResponse || typeof toolResponse !== "object")
156
158
  return undefined;
157
159
  const response = toolResponse;
@@ -185,11 +187,11 @@ export async function patchUpdateFromDiffToolResponse(toolResponse) {
185
187
  return undefined;
186
188
  if (response.type === "create" && newText !== response.content)
187
189
  return undefined;
188
- const patch = filePatch(response.filePath, oldText, newText);
190
+ const patch = filePatch(oldText, newText);
189
191
  if (!patch)
190
192
  return undefined;
191
193
  return {
192
- content: [patch.content],
194
+ content: [patchContent(response.filePath, patch, form)],
193
195
  // A created file keeps the location of its Write tool call.
194
196
  locations: oldText === null
195
197
  ? [{ path: response.filePath }]
@@ -274,26 +276,75 @@ export function toolUpdateFromDiffToolResponse(toolResponse) {
274
276
  result.locations = locations;
275
277
  return result;
276
278
  }
279
+ /**
280
+ * The ACP v2 diff of a finished Edit or Write: the exact patch of
281
+ * {@link patchUpdateFromDiffToolResponse} when it can be built, else the
282
+ * change with a patch from what the toolResponse holds.
283
+ *
284
+ * The fallback patch of an update comes from the `structuredPatch`, which is
285
+ * display data (see {@link patchUpdateFromDiffToolResponse}). That is enough
286
+ * for a v2 patch, which is renderable text, not a patch to apply. An update
287
+ * without hunks, such as one whose previous content was too large to diff,
288
+ * gets the change alone. An Edit with an empty `old_string` reports the same
289
+ * response for a created file and a filled empty one, so it gets no diff.
290
+ */
291
+ export async function v2UpdateFromDiffToolResponse(toolResponse) {
292
+ const exact = await patchUpdateFromDiffToolResponse(toolResponse, "v2");
293
+ if (exact)
294
+ return exact;
295
+ if (!toolResponse || typeof toolResponse !== "object")
296
+ return {};
297
+ const response = toolResponse;
298
+ const filePath = response.filePath;
299
+ if (typeof filePath !== "string")
300
+ return {};
301
+ if (response.type === "create") {
302
+ const hunk = typeof response.content === "string" && isPatchableText(response.content)
303
+ ? wholeFileHunk(response.content)
304
+ : undefined;
305
+ return {
306
+ content: [v2DiffContent(filePath, "create", hunk && [hunk])],
307
+ locations: [{ path: filePath }],
308
+ };
309
+ }
310
+ if (response.type === undefined && response.oldString === "" && response.originalFile === "") {
311
+ return {};
312
+ }
313
+ // A Write whose content is the previous text changed nothing.
314
+ if (response.type === "update" && response.content === response.originalFile)
315
+ return {};
316
+ const hunks = Array.isArray(response.structuredPatch) && response.structuredPatch.length > 0
317
+ ? response.structuredPatch
318
+ : undefined;
319
+ return {
320
+ content: [v2DiffContent(filePath, "update", hunks)],
321
+ locations: hunks
322
+ ? hunks.map(({ newStart }) => ({ path: filePath, line: newStart }))
323
+ : [{ path: filePath }],
324
+ };
325
+ }
277
326
  /**
278
327
  * The text of one git patch for `filePath`.
279
328
  *
280
- * The headers follow `git diff`: the path loses its leading slash, gets the
281
- * `a/` and `b/` prefixes, and is quoted when git would quote it. A created
282
- * file gets its mode line and a `/dev/null` side.
329
+ * The headers follow `git diff`: the path is quoted when git would quote it,
330
+ * and a created file gets its mode line and a `/dev/null` side. With `git`
331
+ * paths, the path loses its leading slash and gets the `a/` and `b/` prefixes.
283
332
  */
284
- export function gitPatchText(filePath, change, hunks) {
333
+ export function gitPatchText(filePath, change, hunks, paths = "git") {
285
334
  return [
286
- ...gitPatchHeader(filePath, change),
335
+ ...gitPatchHeader(filePath, change, paths),
287
336
  ...hunks.flatMap((hunk) => [hunkHeader(hunk), ...hunk.lines]),
288
337
  "",
289
338
  ].join("\n");
290
339
  }
291
- function gitPatchHeader(filePath, change) {
292
- // git drops one leading slash of an absolute path; a Windows path gets
293
- // forward slashes so the header names the same file on every platform.
294
- const name = filePath.replaceAll("\\", "/").replace(/^\/+/u, "");
295
- const oldName = quoteGitPath("a/", name);
296
- const newName = quoteGitPath("b/", name);
340
+ function gitPatchHeader(filePath, change, paths) {
341
+ // A Windows path gets forward slashes so the header names the same file on
342
+ // every platform.
343
+ const slashed = filePath.replaceAll("\\", "/");
344
+ // git drops one leading slash of an absolute path.
345
+ const name = paths === "git" ? slashed.replace(/^\/+/u, "") : slashed;
346
+ const oldName = quoteGitPath(paths === "git" ? "a/" : "", name);
347
+ const newName = quoteGitPath(paths === "git" ? "b/" : "", name);
297
348
  // git ends a ---/+++ name that contains a space with a tab, for GNU patch.
298
349
  const tab = name.includes(" ") ? "\t" : "";
299
350
  return [
@@ -400,15 +451,15 @@ function textLines(text) {
400
451
  return text.match(/[^\n]*\n|[^\n]+$/g) ?? [];
401
452
  }
402
453
  /**
403
- * The git patch of a file change and its hunks. Returns undefined when
404
- * nothing changed or the diff runs out of its time budget.
454
+ * The patch of a change from `oldText`, null for a missing file, to
455
+ * `newText`. Returns undefined when nothing changed or the diff runs out of
456
+ * its time budget.
405
457
  */
406
- function filePatch(filePath, oldText, newText) {
458
+ function filePatch(oldText, newText) {
407
459
  const hunks = diffHunks(oldText, newText);
408
460
  if (!hunks || hunks.length === 0)
409
461
  return undefined;
410
- const change = oldText === null ? "create" : "update";
411
- return { content: patchContent(filePath, gitPatchText(filePath, change, hunks)), hunks };
462
+ return { change: oldText === null ? "create" : "update", hunks };
412
463
  }
413
464
  /**
414
465
  * Reads a file as patch input.
@@ -472,8 +523,16 @@ function isPatchableText(text) {
472
523
  !text.includes("\0") &&
473
524
  !text.includes("\r"));
474
525
  }
475
- function optionalContent(content) {
476
- return content ? [content] : undefined;
526
+ /** The exact patch content of a change, or undefined when it has no patch. */
527
+ function exactPatch(filePath, oldText, newText, form) {
528
+ const patch = filePatch(oldText, newText);
529
+ return patch && [patchContent(filePath, patch, form)];
530
+ }
531
+ /** The content that carries a patch, in the given form. */
532
+ function patchContent(filePath, patch, form) {
533
+ return form === "v2"
534
+ ? v2DiffContent(filePath, patch.change, patch.hunks)
535
+ : airPatchContent(filePath, patch);
477
536
  }
478
537
  /**
479
538
  * A diff block in the AIR patch form.
@@ -481,7 +540,7 @@ function optionalContent(content) {
481
540
  * `oldText: null` and `newText: ""` only satisfy the ACP schema. The adapter
482
541
  * sends this form only to a client that advertised `diffPatch`.
483
542
  */
484
- function patchContent(filePath, text) {
543
+ function airPatchContent(filePath, { change, hunks }) {
485
544
  return {
486
545
  type: "diff",
487
546
  path: filePath,
@@ -490,10 +549,32 @@ function patchContent(filePath, text) {
490
549
  _meta: withAirMeta(undefined, AIR_DIFF_PATCH_CAPABILITY, {
491
550
  version: 1,
492
551
  format: "git_patch",
493
- text,
552
+ text: gitPatchText(filePath, change, hunks),
494
553
  }),
495
554
  };
496
555
  }
556
+ /**
557
+ * The ACP v2 diff of a change to the text file `filePath`: the change and,
558
+ * given hunks, its git patch.
559
+ *
560
+ * The agent builds tool call content in v1 types, and v1 cannot express a v2
561
+ * diff, so the diff travels as v1 content. Nothing in the agent reads inside a
562
+ * diff, and only a v2 client gets one: the v2 surface sends it as it is
563
+ * (`src/v2/tool-call.ts`).
564
+ */
565
+ export function v2DiffContent(filePath, change, hunks) {
566
+ const fileChange = change === "create"
567
+ ? { operation: "add", path: filePath, fileType: "text" }
568
+ : { operation: "modify", path: filePath, fileType: "text" };
569
+ const diff = {
570
+ type: "diff",
571
+ changes: [fileChange],
572
+ ...(hunks?.length
573
+ ? { patch: { format: "git_patch", text: gitPatchText(filePath, change, hunks, "absolute") } }
574
+ : {}),
575
+ };
576
+ return diff;
577
+ }
497
578
  function resolveToolPath(filePath, cwd) {
498
579
  return path.isAbsolute(filePath) ? filePath : path.resolve(cwd ?? process.cwd(), filePath);
499
580
  }
@@ -0,0 +1,51 @@
1
+ import type { AvailableCommand } from "@agentclientprotocol/sdk";
2
+ import type { McpServerStatus, Query } from "@anthropic-ai/claude-agent-sdk";
3
+ /** The `/mcp` entry of `available_commands_update`. The adapter shows the
4
+ * servers as a list, and runs a reconnect, an enable, or a disable through
5
+ * the SDK control API. */
6
+ export declare const MCP_AVAILABLE_COMMAND: AvailableCommand;
7
+ /** A `/mcp` prompt that gets a replacement for its Claude Code text. `all` is
8
+ * true for `all` and for a reconnect without a server name, as in Claude
9
+ * Code. `server` is undefined for an enable or a disable without a name. */
10
+ export type McpCommand = {
11
+ action: "status";
12
+ } | {
13
+ action: "reconnect" | "enable" | "disable";
14
+ all: boolean;
15
+ server?: string;
16
+ };
17
+ /** Parse a prompt that is exactly `/mcp`, or `/mcp reconnect`, `/mcp enable`,
18
+ * or `/mcp disable` with an optional server name or `all`. Any other `/mcp`
19
+ * argument gives null, and the prompt gets no replacement. */
20
+ export declare function parseMcpCommand(text: string): McpCommand | null;
21
+ /** Read the MCP server status for the list after a `/mcp` command. Resolves
22
+ * to null when the read fails, takes too long, or `signal` aborts. Then the
23
+ * turn keeps the text of Claude Code. */
24
+ export declare function readMcpServerStatus(query: Pick<Query, "mcpServerStatus">, signal: AbortSignal, logError: (message: string) => void): Promise<McpServerStatus[] | null>;
25
+ /** Make an MCP error short and readable for one list item. The result has
26
+ * no leading wrapper segments, at most two sentences, and at most
27
+ * `MAX_ERROR_LENGTH` code points. A wrapper before an error code stays, so
28
+ * an error code is never alone. The result is empty for an error with only
29
+ * whitespace. */
30
+ export declare function cleanMcpError(error: string): string;
31
+ /** Markdown for `/mcp`: a summary line, one group of servers for each
32
+ * status, and the disabled servers on one line. A list reads better than a
33
+ * table in a narrow chat. */
34
+ export declare function formatMcpStatus(statuses: McpServerStatus[]): string;
35
+ /** The SDK query methods that `/mcp` uses. */
36
+ export type McpControlQuery = Pick<Query, "mcpServerStatus" | "reconnectMcpServer" | "toggleMcpServer">;
37
+ /** The result of {@link runMcpCommand}. `markdown` is null when the turn
38
+ * keeps the text of Claude Code. `reconnected` holds the servers that the
39
+ * adapter tried to reconnect. */
40
+ export type McpCommandOutcome = {
41
+ markdown: string | null;
42
+ reconnected: string[];
43
+ };
44
+ /** Run a `/mcp` command after Claude Code sent `originalOutput`, its text for
45
+ * the command. Claude Code refuses a reconnect, an enable, and a disable in
46
+ * SDK mode, so the adapter runs them through the SDK control API. The result
47
+ * of each server goes above the server list. An error of one server does
48
+ * not stop the others. When the first status read fails or `signal`
49
+ * aborts, the turn keeps the text of Claude Code. */
50
+ export declare function runMcpCommand(query: McpControlQuery, command: McpCommand, originalOutput: string, signal: AbortSignal, logError: (message: string) => void): Promise<McpCommandOutcome>;
51
+ //# sourceMappingURL=mcp-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-command.d.ts","sourceRoot":"","sources":["../src/mcp-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAI7E;;2BAE2B;AAC3B,eAAO,MAAM,qBAAqB,EAAE,gBAInC,CAAC;AAQF;;6EAE6E;AAC7E,MAAM,MAAM,UAAU,GAClB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GACpB;IAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF;;+DAE+D;AAC/D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAW/D;AAED;;0CAE0C;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