@agentclientprotocol/claude-agent-acp 0.89.2-preview.13 → 0.89.2-preview.14

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.
@@ -84,6 +84,12 @@ export declare class AcpToolCallRenderer {
84
84
  /** True when the renderer reports the history of a loaded session. */
85
85
  replay?: boolean);
86
86
  static for(capabilities: AcpClientCapabilities | null | undefined, replay?: boolean): AcpToolCallRenderer;
87
+ /**
88
+ * Whether the client keeps a tool call's `_meta` across reports: AIR merges
89
+ * its keys, and v2 stores it. Such a client gets no `toolResponse` text that
90
+ * the tool call's content already shows, which it would otherwise keep.
91
+ */
92
+ private get keepsMeta();
87
93
  /**
88
94
  * The status of a tool result. Claude Code reports a run that it aborted in
89
95
  * one of two ways: an error result whose `nonExecution` kind says so (a
@@ -169,7 +175,8 @@ export declare class AcpToolCallRenderer {
169
175
  /**
170
176
  * The report of a PostToolUse hook: the final change of an edit tool, and
171
177
  * the `status` and `isAsync` markers of the `tool_response`. The rest of the
172
- * `tool_response` repeats output that the content already carries.
178
+ * `tool_response` repeats output that the content already carries, such as
179
+ * the whole text of a written file.
173
180
  */
174
181
  hookResult(toolUse: Pick<ToolUse, "id" | "name">, toolResponse: unknown, cwd?: string): Promise<ToolCallUpdate | undefined>;
175
182
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/tool-calls/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,qBAAqB,EAC3C,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE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AAE,KAAK,EAAE,YAAY,GAAG,eAAe,EAAE;IAS1E;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,cAAc;CA0BtF"}
@@ -40,6 +40,14 @@ export class AcpToolCallRenderer {
40
40
  static for(capabilities, replay = false) {
41
41
  return new AcpToolCallRenderer(ClientCapabilities.from(capabilities), replay);
42
42
  }
43
+ /**
44
+ * Whether the client keeps a tool call's `_meta` across reports: AIR merges
45
+ * its keys, and v2 stores it. Such a client gets no `toolResponse` text that
46
+ * the tool call's content already shows, which it would otherwise keep.
47
+ */
48
+ get keepsMeta() {
49
+ return this.capabilities.air.client || this.capabilities.v2;
50
+ }
43
51
  /**
44
52
  * The status of a tool result. Claude Code reports a run that it aborted in
45
53
  * one of two ways: an error result whose `nonExecution` kind says so (a
@@ -346,14 +354,15 @@ export class AcpToolCallRenderer {
346
354
  /**
347
355
  * The report of a PostToolUse hook: the final change of an edit tool, and
348
356
  * the `status` and `isAsync` markers of the `tool_response`. The rest of the
349
- * `tool_response` repeats output that the content already carries.
357
+ * `tool_response` repeats output that the content already carries, such as
358
+ * the whole text of a written file.
350
359
  */
351
360
  async hookResult(toolUse, toolResponse, cwd) {
352
361
  const reporter = reporterFor(toolUse.name);
353
362
  const change = reporter.hookResult
354
363
  ? await reporter.hookResult(toolResponse, { cwd, capabilities: this.capabilities })
355
364
  : {};
356
- if (!this.capabilities.air.client) {
365
+ if (!this.keepsMeta) {
357
366
  // The upstream shape: the whole tool_response, on every hook.
358
367
  return {
359
368
  _meta: { claudeCode: { toolResponse, toolName: toolUse.name } },
@@ -409,9 +418,10 @@ export class AcpToolCallRenderer {
409
418
  */
410
419
  permissionDenied(denial) {
411
420
  const reason = denial.decisionReason ?? denial.message;
412
- // AIR gets the SDK message only when it differs from the reason, which
413
- // the content shows. Every other client gets the upstream toolResponse.
414
- const extraMessage = !this.capabilities.air.client
421
+ // AIR and v2 get the SDK message only when it differs from the reason,
422
+ // which the content shows. Every other client gets the upstream
423
+ // toolResponse.
424
+ const extraMessage = !this.keepsMeta
415
425
  ? { decisionReason: denial.decisionReason, message: denial.message }
416
426
  : denial.decisionReason !== undefined &&
417
427
  denial.message !== undefined &&
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/v2/agent.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAkB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAmB9E;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,QAAQ,CA0Eb"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/v2/agent.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAkB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAoB9E;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,QAAQ,CA2Eb"}
package/dist/v2/agent.js CHANGED
@@ -6,6 +6,7 @@ import { v2Foreground, v2Prompt } from "./prompt.js";
6
6
  import { v1ForkSessionRequest, v1NewSessionRequest, v1RestoreSessionRequest, v1SetSessionConfigOptionRequest, v2AvailableCommands, v2ConfigOptions, v2NewSessionResponse, v2ResumeSessionResponse, } from "./session.js";
7
7
  import { v2SessionUpdate } from "./session-update.js";
8
8
  import { V2Terminals } from "./terminal.js";
9
+ import { V2ToolCallMeta } from "./tool-call-meta.js";
9
10
  /**
10
11
  * The ACP v2 surface, for one connection.
11
12
  *
@@ -66,6 +67,7 @@ export function v2AgentApp(logger, onAgent) {
66
67
  .onRequest(v2.methods.agent.session.close, async ({ params }) => {
67
68
  const response = await agent.closeSession(params);
68
69
  client.terminals.forget(params.sessionId);
70
+ client.toolCallMeta.forget(params.sessionId);
69
71
  return response;
70
72
  })
71
73
  .onRequest(v2.methods.agent.session.delete, ({ params }) => agent.deleteSession(params))
@@ -110,6 +112,8 @@ class V2ClientConnection {
110
112
  replays = new Map();
111
113
  /** The display terminals of the commands that the agent runs. */
112
114
  terminals = new V2Terminals();
115
+ /** The `_meta` that the client stores for each tool call. */
116
+ toolCallMeta = new V2ToolCallMeta();
113
117
  constructor(ctx, logger) {
114
118
  this.ctx = ctx;
115
119
  this.logger = logger;
@@ -162,7 +166,8 @@ class V2ClientConnection {
162
166
  }
163
167
  /**
164
168
  * The v2 updates of a v1 update: for a tool call report, the updates of its
165
- * terminal first, then the report itself (see {@link V2Terminals}).
169
+ * terminal first (see {@link V2Terminals}), then the report itself, with the
170
+ * `_meta` that the client stores (see {@link V2ToolCallMeta}).
166
171
  */
167
172
  v2Updates(sessionId, update) {
168
173
  if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
@@ -170,7 +175,10 @@ class V2ClientConnection {
170
175
  return v2Update ? [v2Update] : [];
171
176
  }
172
177
  const { terminal, report } = this.terminals.split(sessionId, update);
173
- const reportUpdate = report && v2SessionUpdate(report);
178
+ if (!report)
179
+ return terminal;
180
+ const starts = report.sessionUpdate === "tool_call";
181
+ const reportUpdate = v2SessionUpdate(this.toolCallMeta.apply(sessionId, report, starts));
174
182
  return [...terminal, ...(reportUpdate ? [reportUpdate] : [])];
175
183
  }
176
184
  /**
@@ -192,7 +200,9 @@ class V2ClientConnection {
192
200
  return emptyMessage(kind, messageId);
193
201
  }
194
202
  async requestPermission(params, signal) {
195
- const response = await this.ctx.request(v2.methods.client.session.requestPermission, v2PermissionRequest(params), { cancellationSignal: signal });
203
+ // The subject is an update of the tool call, with its stored `_meta`.
204
+ const toolCall = this.toolCallMeta.subject(params.sessionId, params.toolCall);
205
+ const response = await this.ctx.request(v2.methods.client.session.requestPermission, v2PermissionRequest({ ...params, toolCall }), { cancellationSignal: signal });
196
206
  return v1PermissionResponse(response);
197
207
  }
198
208
  // Elicitation is the same in v1 and v2.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The `_meta` of the tool calls of one ACP v2 connection, as the client stores
3
+ * it.
4
+ *
5
+ * The agent gives each v1 tool call report the `_meta` keys of that report.
6
+ * An AIR client merges them by key (see `ToolCallFieldTracker`), and another
7
+ * v1 client reads them per report. A v2 client stores a tool call's `_meta`,
8
+ * and a report that carries `_meta` replaces it. So the earlier keys must
9
+ * travel again, or the `{ toolName }` of a tool's result would replace, for
10
+ * example, the reason of the denial before it.
11
+ *
12
+ * {@link V2ToolCallMeta} therefore keeps the merged `_meta` of each tool call,
13
+ * with the `claudeCode` keys merged one by one and every other key replaced
14
+ * whole, as `ToolCallFieldTracker` models it. A report that changes it carries
15
+ * all of it; a report that changes nothing carries no `_meta`.
16
+ *
17
+ * `claudeCode.toolName` repeats the name of the tool, which v2 has a field
18
+ * for. It becomes the `name` of a tool call that has none yet, and is left out
19
+ * of the stored `_meta`. Subagent routing reads it before this, on the agent's
20
+ * v1 reports.
21
+ */
22
+ import type { ToolCall, ToolCallUpdate } from "@agentclientprotocol/sdk";
23
+ export declare class V2ToolCallMeta {
24
+ /** The stored `_meta` of each tool call, by session and tool call, oldest first. */
25
+ private readonly calls;
26
+ /**
27
+ * `report` with the tool call's whole `_meta` when the report changes it,
28
+ * without `_meta` when it does not, and with `name` when it names the tool
29
+ * call for the first time. `starts` says that the report starts the tool
30
+ * call (a v1 `tool_call`), which forgets what an earlier one stored.
31
+ */
32
+ apply<Report extends ToolCall | ToolCallUpdate>(sessionId: string, report: Report, starts: boolean): Report;
33
+ /**
34
+ * The tool call of a permission request's subject: like {@link apply}, but
35
+ * with the tool call's whole `_meta` even when the subject changes nothing,
36
+ * since a client can show the request from the request alone.
37
+ */
38
+ subject<Report extends ToolCall | ToolCallUpdate>(sessionId: string, toolCall: Report): Report;
39
+ /** Forgets the tool calls of a session, when it closes. */
40
+ forget(sessionId: string): void;
41
+ /** Stores the entry as the most recent one, and forgets the oldest one past the limit. */
42
+ private remember;
43
+ }
44
+ //# sourceMappingURL=tool-call-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-meta.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAOzE,qBAAa,cAAc;IACzB,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqD;IAE3E;;;;;OAKG;IACH,KAAK,CAAC,MAAM,SAAS,QAAQ,GAAG,cAAc,EAC5C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,MAAM;IA6BT;;;;OAIG;IACH,OAAO,CAAC,MAAM,SAAS,QAAQ,GAAG,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAO9F,2DAA2D;IAC3D,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAM/B,0FAA0F;IAC1F,OAAO,CAAC,QAAQ;CAQjB"}
@@ -0,0 +1,72 @@
1
+ /** The number of tool calls whose `_meta` a connection remembers. */
2
+ const TOOL_CALL_LIMIT = 2048;
3
+ export class V2ToolCallMeta {
4
+ /** The stored `_meta` of each tool call, by session and tool call, oldest first. */
5
+ calls = new Map();
6
+ /**
7
+ * `report` with the tool call's whole `_meta` when the report changes it,
8
+ * without `_meta` when it does not, and with `name` when it names the tool
9
+ * call for the first time. `starts` says that the report starts the tool
10
+ * call (a v1 `tool_call`), which forgets what an earlier one stored.
11
+ */
12
+ apply(sessionId, report, starts) {
13
+ const key = `${sessionId} ${report.toolCallId}`;
14
+ const call = (!starts && this.calls.get(key)) || { meta: {}, named: false };
15
+ this.remember(key, call);
16
+ const { _meta, ...fields } = report;
17
+ const result = fields;
18
+ const { toolName, ...claudeCode } = asRecord(_meta?.claudeCode) ?? {};
19
+ if (report.name != null) {
20
+ call.named = true;
21
+ }
22
+ else if (!call.named && typeof toolName === "string") {
23
+ result.name = toolName;
24
+ call.named = true;
25
+ }
26
+ const meta = { ...call.meta };
27
+ for (const [name, value] of Object.entries(_meta ?? {})) {
28
+ if (name !== "claudeCode")
29
+ meta[name] = value;
30
+ }
31
+ if (Object.keys(claudeCode).length > 0) {
32
+ meta.claudeCode = { ...asRecord(call.meta.claudeCode), ...claudeCode };
33
+ }
34
+ if (JSON.stringify(meta) !== JSON.stringify(call.meta)) {
35
+ call.meta = meta;
36
+ result._meta = meta;
37
+ }
38
+ return result;
39
+ }
40
+ /**
41
+ * The tool call of a permission request's subject: like {@link apply}, but
42
+ * with the tool call's whole `_meta` even when the subject changes nothing,
43
+ * since a client can show the request from the request alone.
44
+ */
45
+ subject(sessionId, toolCall) {
46
+ const result = this.apply(sessionId, toolCall, false);
47
+ const stored = this.calls.get(`${sessionId} ${toolCall.toolCallId}`)?.meta ?? {};
48
+ if (result._meta === undefined && Object.keys(stored).length > 0)
49
+ result._meta = stored;
50
+ return result;
51
+ }
52
+ /** Forgets the tool calls of a session, when it closes. */
53
+ forget(sessionId) {
54
+ for (const key of this.calls.keys()) {
55
+ if (key.startsWith(`${sessionId} `))
56
+ this.calls.delete(key);
57
+ }
58
+ }
59
+ /** Stores the entry as the most recent one, and forgets the oldest one past the limit. */
60
+ remember(key, call) {
61
+ this.calls.delete(key);
62
+ this.calls.set(key, call);
63
+ if (this.calls.size > TOOL_CALL_LIMIT) {
64
+ const oldest = this.calls.keys().next().value;
65
+ if (oldest !== undefined)
66
+ this.calls.delete(oldest);
67
+ }
68
+ }
69
+ }
70
+ function asRecord(value) {
71
+ return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
72
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.89.2-preview.13",
6
+ "version": "0.89.2-preview.14",
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",