@agentclientprotocol/claude-agent-acp 0.99.2-preview.1 → 0.99.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 (42) hide show
  1. package/README.md +8 -0
  2. package/dist/acp-agent.d.ts +60 -18
  3. package/dist/acp-agent.d.ts.map +1 -1
  4. package/dist/acp-agent.js +325 -100
  5. package/dist/diff.d.ts +1 -1
  6. package/dist/diff.js +5 -5
  7. package/dist/elicitation.d.ts +1 -2
  8. package/dist/elicitation.d.ts.map +1 -1
  9. package/dist/elicitation.js +34 -16
  10. package/dist/fork-session.d.ts.map +1 -1
  11. package/dist/fork-session.js +23 -0
  12. package/dist/native-subagents.d.ts +49 -3
  13. package/dist/native-subagents.d.ts.map +1 -1
  14. package/dist/native-subagents.js +118 -4
  15. package/dist/session-index/service.d.ts +3 -1
  16. package/dist/session-index/service.d.ts.map +1 -1
  17. package/dist/session-index/service.js +5 -10
  18. package/dist/startup-failure.d.ts +16 -0
  19. package/dist/startup-failure.d.ts.map +1 -0
  20. package/dist/startup-failure.js +38 -0
  21. package/dist/subagent-history.d.ts +8 -1
  22. package/dist/subagent-history.d.ts.map +1 -1
  23. package/dist/subagent-history.js +40 -1
  24. package/dist/subagent-replay.d.ts +19 -3
  25. package/dist/subagent-replay.d.ts.map +1 -1
  26. package/dist/subagent-replay.js +46 -4
  27. package/dist/tool-calls/reporters/interaction.d.ts.map +1 -1
  28. package/dist/tool-calls/reporters/interaction.js +8 -3
  29. package/dist/v2/agent.d.ts.map +1 -1
  30. package/dist/v2/agent.js +42 -17
  31. package/dist/v2/initialize.d.ts +16 -1
  32. package/dist/v2/initialize.d.ts.map +1 -1
  33. package/dist/v2/initialize.js +26 -3
  34. package/dist/v2/permission.d.ts +5 -2
  35. package/dist/v2/permission.d.ts.map +1 -1
  36. package/dist/v2/permission.js +5 -2
  37. package/dist/v2/prompt.d.ts +2 -1
  38. package/dist/v2/prompt.d.ts.map +1 -1
  39. package/dist/v2/prompt.js +5 -1
  40. package/dist/v2/session.d.ts.map +1 -1
  41. package/dist/v2/session.js +21 -9
  42. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/v2/prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,mDAAmD,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAuC,MAAM,mBAAmB,CAAC;AAE/F;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,EAAE,CAAC,aAAa,EACxB,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,KAAK,IAAI,GACvC,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,CAiC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,KAAK,IAAI,GAAG,gBAAgB,CAoBvF;AAgCD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,aAAa,GAAG,aAAa,CAkBvF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CAcnE"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/v2/prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,mDAAmD,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAuC,MAAM,mBAAmB,CAAC;AAE/F;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,EAAE,CAAC,aAAa,EACxB,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,KAAK,IAAI,GACvC,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,CAiC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,KAAK,IAAI,GAAG,gBAAgB,CAoBvF;AAgCD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,aAAa,GAAG,aAAa,CAqBvF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CAcnE"}
package/dist/v2/prompt.js CHANGED
@@ -129,9 +129,13 @@ function idle({ stopReason, usage, _meta }) {
129
129
  * so such a block fails the request with invalid params (-32602) rather than
130
130
  * being dropped from the prompt. The same goes for an embedded blob that
131
131
  * Claude cannot read, e.g. an `application/zip` resource: `promptToClaude`
132
- * would drop it.
132
+ * would drop it. An empty `prompt` fails the same way: v2 requires at least
133
+ * one content block.
133
134
  */
134
135
  export function v1PromptRequest({ prompt, ...request }) {
136
+ if (prompt.length === 0) {
137
+ throw RequestError.invalidParams({ prompt }, "`prompt` must hold at least one content block");
138
+ }
135
139
  return {
136
140
  ...request,
137
141
  prompt: prompt.map((block) => {
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/v2/session.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBA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ientprotocol/sdk/unstable";
7
7
  import * as v2 from "@agentclientprotocol/sdk/experimental/v2/unstable";
8
+ import { V2_SESSION_CAPABILITIES } from "./initialize.js";
8
9
  import { v1ContentBlock } from "./prompt.js";
9
10
  export function v1NewSessionRequest(params) {
10
11
  const { mcpServers, systemPrompt, ...request } = params;
11
12
  // v1 requires the list; v2 treats an omitted list as an empty one.
12
13
  return {
13
14
  ...request,
14
- mcpServers: (mcpServers ?? []).map(v1McpServer),
15
+ mcpServers: v1McpServers(mcpServers) ?? [],
15
16
  ...v1SystemPromptField(systemPrompt),
16
17
  };
17
18
  }
@@ -30,15 +31,16 @@ export function v1RestoreSessionRequest(params) {
30
31
  if (replayFrom == null) {
31
32
  return {
32
33
  method: "resume",
33
- request: { ...request, ...(mcpServers ? { mcpServers: mcpServers.map(v1McpServer) } : {}) },
34
+ request: { ...request, ...(mcpServers ? { mcpServers: v1McpServers(mcpServers) } : {}) },
34
35
  };
35
36
  }
37
+ const servers = v1McpServers(mcpServers);
36
38
  if (replayFrom.type !== "start") {
37
39
  throw RequestError.invalidParams({ replayFrom }, `Replaying from a ${replayFrom.type} cursor is not supported`);
38
40
  }
39
41
  return {
40
42
  method: "load",
41
- request: { ...request, mcpServers: (mcpServers ?? []).map(v1McpServer) },
43
+ request: { ...request, mcpServers: servers ?? [] },
42
44
  };
43
45
  }
44
46
  /**
@@ -49,7 +51,7 @@ export function v1ForkSessionRequest(params) {
49
51
  const { mcpServers, systemPrompt, ...request } = params;
50
52
  return {
51
53
  ...request,
52
- ...(mcpServers ? { mcpServers: mcpServers.map(v1McpServer) } : {}),
54
+ ...(mcpServers ? { mcpServers: v1McpServers(mcpServers) } : {}),
53
55
  ...v1SystemPromptField(systemPrompt),
54
56
  };
55
57
  }
@@ -120,13 +122,23 @@ export function v2AvailableCommands(commands) {
120
122
  function v2ConfigOptionsField(options) {
121
123
  return options != null ? { configOptions: v2ConfigOptions(options) } : {};
122
124
  }
125
+ /**
126
+ * The v1 list of the MCP servers of a v2 setup request, or undefined for no
127
+ * list. A request with two servers of the same `name`, or with a transport
128
+ * that the agent does not advertise in `session.mcp` (such as `acp` or a
129
+ * custom `_` type), fails with invalid params (-32602): the v1 session setup
130
+ * would otherwise drop the server without telling the client.
131
+ */
132
+ function v1McpServers(servers) {
133
+ if (servers == null)
134
+ return undefined;
135
+ v2.assertSupportedMcpServers(servers, V2_SESSION_CAPABILITIES.mcp);
136
+ return servers.map(v1McpServer);
137
+ }
123
138
  /**
124
139
  * v2 requires a `type` on every transport and makes the empty lists optional.
125
140
  * The agent recognizes a v1 stdio server by its missing `type`, so the v2 tag
126
- * is dropped. Any other transport, such as `acp` or a custom `_` type, fails
127
- * the request with invalid params (-32602): the agent advertises only stdio
128
- * and HTTP, and the v1 session setup would otherwise drop the server without
129
- * telling the client.
141
+ * is dropped. {@link v1McpServers} has already rejected every other transport.
130
142
  */
131
143
  function v1McpServer(server) {
132
144
  if (v2.McpServer.isStdio(server)) {
@@ -136,5 +148,5 @@ function v1McpServer(server) {
136
148
  if (v2.McpServer.isHttp(server)) {
137
149
  return { ...server, headers: server.headers ?? [] };
138
150
  }
139
- throw RequestError.invalidParams({ type: server.type }, `MCP servers of type ${server.type} are not supported`);
151
+ throw new Error(`Unreachable: MCP server of type ${server.type} passed the transport check`);
140
152
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.99.2-preview.1",
6
+ "version": "0.99.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",
@@ -65,8 +65,8 @@
65
65
  "node": ">=22"
66
66
  },
67
67
  "dependencies": {
68
- "@agentclientprotocol/sdk": "2.1.0",
69
- "@anthropic-ai/claude-agent-sdk": "0.3.312",
68
+ "@agentclientprotocol/sdk": "2.4.0",
69
+ "@anthropic-ai/claude-agent-sdk": "0.3.316",
70
70
  "diff": "9.0.0",
71
71
  "zod": "4.6.7"
72
72
  },
@@ -74,14 +74,14 @@
74
74
  "@anthropic-ai/sdk": "1.3.0",
75
75
  "@eslint/js": "10.0.1",
76
76
  "@tsconfig/node22": "22.0.6",
77
- "@types/node": "26.6.5",
77
+ "@types/node": "26.6.6",
78
78
  "@typescript-eslint/eslint-plugin": "8.72.1",
79
79
  "@typescript-eslint/parser": "8.72.1",
80
80
  "ajv": "8.20.0",
81
81
  "ajv-formats": "3.0.1",
82
- "eslint": "10.13.0",
82
+ "eslint": "10.14.0",
83
83
  "eslint-config-prettier": "10.1.8",
84
- "globals": "17.13.0",
84
+ "globals": "17.14.0",
85
85
  "prettier": "3.9.10",
86
86
  "typescript": "6.0.3",
87
87
  "vitest": "5.0.5"