@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
@@ -0,0 +1,49 @@
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 references a display terminal, as in v2: a v2 client has no client
14
+ * terminals, so the agent's only terminals are those of its terminal extension
15
+ * (see `terminal.ts`).
16
+ */
17
+ export function v2ToolCallUpdate(report) {
18
+ return { ...v2ToolCallPatch(report), sessionUpdate: "tool_call_update" };
19
+ }
20
+ /**
21
+ * The v2 form of the fields of a v1 tool call report, which a session update
22
+ * and the subject of a permission request carry. See {@link v2ToolCallUpdate}.
23
+ */
24
+ export function v2ToolCallPatch(toolCall) {
25
+ const patch = Object.fromEntries(Object.entries(toolCall).filter(([key, value]) => value !== null && key !== "sessionUpdate" && key !== "content"));
26
+ return {
27
+ ...patch,
28
+ ...(toolCall.content != null ? { content: toolCall.content.map(v2ToolCallContent) } : {}),
29
+ };
30
+ }
31
+ function v2ToolCallContent(item) {
32
+ switch (item.type) {
33
+ case "content":
34
+ // v2 content blocks are a superset of the v1 blocks.
35
+ return item;
36
+ case "terminal":
37
+ return item;
38
+ default:
39
+ if (isV2Diff(item))
40
+ return item;
41
+ // A v1 diff names one path, with old and new texts that can be a
42
+ // snippet: v2 cannot say which operation it is, nor give its patch.
43
+ throw new Error("An ACP v2 client cannot take a v1 diff");
44
+ }
45
+ }
46
+ /** A diff that the agent built in v2 form, which travels as v1 content. */
47
+ function isV2Diff(item) {
48
+ return "changes" in item;
49
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.85.2-preview.2",
6
+ "version": "0.85.2-preview.20",
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
  },