@agentclientprotocol/claude-agent-acp 0.85.2-preview.1 → 0.85.2-preview.11

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 (45) hide show
  1. package/README.md +1 -0
  2. package/dist/acp-agent.d.ts +113 -27
  3. package/dist/acp-agent.d.ts.map +1 -1
  4. package/dist/acp-agent.js +477 -175
  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/diff.d.ts +42 -5
  9. package/dist/diff.d.ts.map +1 -1
  10. package/dist/diff.js +103 -26
  11. package/dist/mcp-command.d.ts +51 -0
  12. package/dist/mcp-command.d.ts.map +1 -0
  13. package/dist/mcp-command.js +321 -0
  14. package/dist/resumed-session.d.ts +16 -6
  15. package/dist/resumed-session.d.ts.map +1 -1
  16. package/dist/resumed-session.js +91 -25
  17. package/dist/session-mode.d.ts +14 -0
  18. package/dist/session-mode.d.ts.map +1 -1
  19. package/dist/session-mode.js +22 -0
  20. package/dist/tool-calls/client-capabilities.d.ts +16 -2
  21. package/dist/tool-calls/client-capabilities.d.ts.map +1 -1
  22. package/dist/tool-calls/client-capabilities.js +11 -3
  23. package/dist/tool-calls/reporters/file-edit.d.ts +1 -1
  24. package/dist/tool-calls/reporters/file-edit.d.ts.map +1 -1
  25. package/dist/tool-calls/reporters/file-edit.js +18 -14
  26. package/dist/turn-events.d.ts +71 -0
  27. package/dist/turn-events.d.ts.map +1 -0
  28. package/dist/turn-events.js +1 -0
  29. package/dist/usage-markdown.d.ts +2 -0
  30. package/dist/usage-markdown.d.ts.map +1 -1
  31. package/dist/usage-markdown.js +2 -1
  32. package/dist/utils.d.ts +12 -0
  33. package/dist/utils.d.ts.map +1 -1
  34. package/dist/utils.js +28 -0
  35. package/dist/v2/agent.d.ts.map +1 -1
  36. package/dist/v2/agent.js +27 -5
  37. package/dist/v2/prompt.d.ts +47 -0
  38. package/dist/v2/prompt.d.ts.map +1 -0
  39. package/dist/v2/prompt.js +153 -0
  40. package/dist/v2/session-update.d.ts.map +1 -1
  41. package/dist/v2/session-update.js +14 -0
  42. package/dist/v2/tool-call.d.ts +32 -0
  43. package/dist/v2/tool-call.d.ts.map +1 -0
  44. package/dist/v2/tool-call.js +42 -0
  45. package/package.json +2 -2
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The v2 form of a v1 tool call report.
3
+ *
4
+ * v1 reports a new tool call with `tool_call` and changes it with
5
+ * `tool_call_update`; v2 has one `tool_call_update` that upserts by
6
+ * `toolCallId`. Both leave a field that a report omits unchanged, and both
7
+ * replace `content` and `locations` as whole arrays. They differ on `null`:
8
+ * in v1 it leaves the field unchanged too, in v2 it clears the field, so `null`
9
+ * fields are left out.
10
+ *
11
+ * Diffs need what a v1 diff does not say, so the agent builds them in v2 form
12
+ * for a v2 client (`v2DiffContent`), and they pass as they are. Terminal
13
+ * content throws until the v2 surface translates it (step 4 of
14
+ * `docs/acp-v2.md`).
15
+ */
16
+ export function v2ToolCallUpdate(report) {
17
+ const patch = Object.fromEntries(Object.entries(report).filter(([key, value]) => value !== null && key !== "sessionUpdate" && key !== "content"));
18
+ return {
19
+ ...patch,
20
+ sessionUpdate: "tool_call_update",
21
+ ...(report.content != null ? { content: report.content.map(v2ToolCallContent) } : {}),
22
+ };
23
+ }
24
+ function v2ToolCallContent(item) {
25
+ switch (item.type) {
26
+ case "content":
27
+ // v2 content blocks are a superset of the v1 blocks.
28
+ return item;
29
+ case "diff":
30
+ if (isV2Diff(item))
31
+ return item;
32
+ // A v1 diff names one path, with old and new texts that can be a
33
+ // snippet: v2 cannot say which operation it is, nor give its patch.
34
+ throw new Error("An ACP v2 client cannot take a v1 diff");
35
+ default:
36
+ throw new Error(`The ACP v2 surface does not translate ${item.type} tool call content yet`);
37
+ }
38
+ }
39
+ /** A diff that the agent built in v2 form, which travels as v1 content. */
40
+ function isV2Diff(item) {
41
+ return "changes" in item;
42
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.85.2-preview.1",
6
+ "version": "0.85.2-preview.11",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@agentclientprotocol/sdk": "1.7.0",
69
- "@anthropic-ai/claude-agent-sdk": "0.3.286",
69
+ "@anthropic-ai/claude-agent-sdk": "0.3.287",
70
70
  "diff": "9.0.0",
71
71
  "zod": "4.6.5"
72
72
  },