@agentclientprotocol/claude-agent-acp 0.91.1-preview.3 → 0.91.1-preview.5
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.
- package/dist/acp-agent.d.ts +9 -0
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +84 -7
- package/dist/client-system-prompt.d.ts +41 -0
- package/dist/client-system-prompt.d.ts.map +1 -0
- package/dist/client-system-prompt.js +40 -0
- package/dist/native-subagents.d.ts +58 -3
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +174 -9
- package/dist/subagent-history.d.ts +5 -0
- package/dist/subagent-history.d.ts.map +1 -1
- package/dist/subagent-history.js +62 -9
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +54 -9
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +3 -0
- package/dist/v2/prompt.d.ts +2 -1
- package/dist/v2/prompt.d.ts.map +1 -1
- package/dist/v2/prompt.js +1 -1
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +24 -5
- package/dist/v2/terminal.js +2 -3
- package/dist/v2/tool-call-meta.d.ts +22 -13
- package/dist/v2/tool-call-meta.d.ts.map +1 -1
- package/dist/v2/tool-call-meta.js +44 -16
- package/package.json +2 -2
package/dist/v2/terminal.js
CHANGED
|
@@ -69,9 +69,8 @@ export class V2Terminals {
|
|
|
69
69
|
/**
|
|
70
70
|
* The report without the extension's keys, or undefined when it carried
|
|
71
71
|
* nothing else but `_meta`: the output report of a command carries the output
|
|
72
|
-
* alone, and only the stamps that every report of the tool call repeats.
|
|
73
|
-
*
|
|
74
|
-
* other keys that the tool call holds.
|
|
72
|
+
* alone, and only the stamps that every report of the tool call repeats. The
|
|
73
|
+
* client already holds those stamps, so the report goes without them.
|
|
75
74
|
*/
|
|
76
75
|
function withoutTerminalKeys(report) {
|
|
77
76
|
if (!report._meta || !TERMINAL_KEYS.some((key) => key in report._meta))
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The agent gives each v1 tool call report the `_meta` keys of that report.
|
|
6
6
|
* An AIR client merges them by key (see `ToolCallFieldTracker`), and another
|
|
7
|
-
* v1 client reads them per report. A v2 client
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* v1 client reads them per report. A v2 client patches its stored `_meta` by
|
|
8
|
+
* top-level key: a key the report leaves out keeps its value, a key set to
|
|
9
|
+
* `null` is removed, and any other value replaces the key whole, nested
|
|
10
|
+
* objects included.
|
|
11
11
|
*
|
|
12
12
|
* {@link V2ToolCallMeta} therefore keeps the merged `_meta` of each tool call,
|
|
13
13
|
* with the `claudeCode` keys merged one by one and every other key replaced
|
|
14
|
-
* whole, as `ToolCallFieldTracker` models it. A report
|
|
15
|
-
* all of
|
|
14
|
+
* whole, as `ToolCallFieldTracker` models it. A report carries the top-level
|
|
15
|
+
* keys that changed: all of `claudeCode` when one of its keys changed, since
|
|
16
|
+
* the client does not merge it, and `null` for a key that is gone. A report
|
|
17
|
+
* that changes nothing carries no `_meta`.
|
|
16
18
|
*
|
|
17
19
|
* `claudeCode.toolName` repeats the name of the tool, which v2 has a field
|
|
18
20
|
* for. It becomes the `name` of a tool call that has none yet, and is left out
|
|
@@ -24,16 +26,23 @@ export declare class V2ToolCallMeta {
|
|
|
24
26
|
/** The stored `_meta` of each tool call, by session and tool call, oldest first. */
|
|
25
27
|
private readonly calls;
|
|
26
28
|
/**
|
|
27
|
-
* `report
|
|
28
|
-
* without `_meta` when it
|
|
29
|
-
* call for the first time.
|
|
30
|
-
*
|
|
29
|
+
* The v2 reports of `report`: the report with the `_meta` keys it changes,
|
|
30
|
+
* without `_meta` when it changes none, and with `name` when it names the
|
|
31
|
+
* tool call for the first time.
|
|
32
|
+
*
|
|
33
|
+
* `starts` says that the report starts the tool call (a v1 `tool_call`),
|
|
34
|
+
* which forgets what an earlier one with the same id stored: the report sets
|
|
35
|
+
* `null` for each of its keys. `replaying` says that the client may hold
|
|
36
|
+
* `_meta` of the tool call from before this connection, for example from an
|
|
37
|
+
* earlier live session. A replayed start of a tool call this connection has
|
|
38
|
+
* not reported then clears it with `_meta: null`, and a second report sets
|
|
39
|
+
* the current keys.
|
|
31
40
|
*/
|
|
32
|
-
apply<Report extends ToolCall | ToolCallUpdate>(sessionId: string, report: Report, starts: boolean): Report;
|
|
41
|
+
apply<Report extends ToolCall | ToolCallUpdate>(sessionId: string, report: Report, starts: boolean, replaying?: boolean): [Report] | [Report, ToolCallUpdate];
|
|
33
42
|
/**
|
|
34
43
|
* The tool call of a permission request's subject: like {@link apply}, but
|
|
35
|
-
* with
|
|
36
|
-
*
|
|
44
|
+
* with every stored `_meta` key even when the subject changes nothing, since
|
|
45
|
+
* a client can show the request from the request alone.
|
|
37
46
|
*/
|
|
38
47
|
subject<Report extends ToolCall | ToolCallUpdate>(sessionId: string, toolCall: Report): Report;
|
|
39
48
|
/** Forgets the tool calls of a session, when it closes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call-meta.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call-meta.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-call-meta.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAOzE,qBAAa,cAAc;IACzB,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqD;IAE3E;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,SAAS,QAAQ,GAAG,cAAc,EAC5C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,SAAS,UAAQ,GAChB,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC;IA6CtC;;;;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"}
|
|
@@ -4,14 +4,23 @@ export class V2ToolCallMeta {
|
|
|
4
4
|
/** The stored `_meta` of each tool call, by session and tool call, oldest first. */
|
|
5
5
|
calls = new Map();
|
|
6
6
|
/**
|
|
7
|
-
* `report
|
|
8
|
-
* without `_meta` when it
|
|
9
|
-
* call for the first time.
|
|
10
|
-
*
|
|
7
|
+
* The v2 reports of `report`: the report with the `_meta` keys it changes,
|
|
8
|
+
* without `_meta` when it changes none, and with `name` when it names the
|
|
9
|
+
* tool call for the first time.
|
|
10
|
+
*
|
|
11
|
+
* `starts` says that the report starts the tool call (a v1 `tool_call`),
|
|
12
|
+
* which forgets what an earlier one with the same id stored: the report sets
|
|
13
|
+
* `null` for each of its keys. `replaying` says that the client may hold
|
|
14
|
+
* `_meta` of the tool call from before this connection, for example from an
|
|
15
|
+
* earlier live session. A replayed start of a tool call this connection has
|
|
16
|
+
* not reported then clears it with `_meta: null`, and a second report sets
|
|
17
|
+
* the current keys.
|
|
11
18
|
*/
|
|
12
|
-
apply(sessionId, report, starts) {
|
|
19
|
+
apply(sessionId, report, starts, replaying = false) {
|
|
13
20
|
const key = `${sessionId} ${report.toolCallId}`;
|
|
14
|
-
const
|
|
21
|
+
const previous = this.calls.get(key);
|
|
22
|
+
const held = previous?.meta ?? {};
|
|
23
|
+
const call = (!starts && previous) || { meta: {}, named: false };
|
|
15
24
|
this.remember(key, call);
|
|
16
25
|
const { _meta, ...fields } = report;
|
|
17
26
|
const result = fields;
|
|
@@ -25,28 +34,47 @@ export class V2ToolCallMeta {
|
|
|
25
34
|
}
|
|
26
35
|
const meta = { ...call.meta };
|
|
27
36
|
for (const [name, value] of Object.entries(_meta ?? {})) {
|
|
28
|
-
if (name
|
|
37
|
+
if (name === "claudeCode")
|
|
38
|
+
continue;
|
|
39
|
+
// `null` removes the key in v2, so it is not stored.
|
|
40
|
+
if (value === null)
|
|
41
|
+
delete meta[name];
|
|
42
|
+
else
|
|
29
43
|
meta[name] = value;
|
|
30
44
|
}
|
|
31
45
|
if (Object.keys(claudeCode).length > 0) {
|
|
32
46
|
meta.claudeCode = { ...asRecord(call.meta.claudeCode), ...claudeCode };
|
|
33
47
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
result._meta =
|
|
48
|
+
call.meta = meta;
|
|
49
|
+
if (starts && replaying && !previous) {
|
|
50
|
+
result._meta = null;
|
|
51
|
+
if (Object.keys(meta).length === 0)
|
|
52
|
+
return [result];
|
|
53
|
+
return [result, { toolCallId: report.toolCallId, _meta: meta }];
|
|
37
54
|
}
|
|
38
|
-
|
|
55
|
+
const patch = {};
|
|
56
|
+
for (const name of Object.keys(held)) {
|
|
57
|
+
if (!(name in meta))
|
|
58
|
+
patch[name] = null;
|
|
59
|
+
}
|
|
60
|
+
for (const [name, value] of Object.entries(meta)) {
|
|
61
|
+
if (JSON.stringify(value) !== JSON.stringify(held[name]))
|
|
62
|
+
patch[name] = value;
|
|
63
|
+
}
|
|
64
|
+
if (Object.keys(patch).length > 0)
|
|
65
|
+
result._meta = patch;
|
|
66
|
+
return [result];
|
|
39
67
|
}
|
|
40
68
|
/**
|
|
41
69
|
* The tool call of a permission request's subject: like {@link apply}, but
|
|
42
|
-
* with
|
|
43
|
-
*
|
|
70
|
+
* with every stored `_meta` key even when the subject changes nothing, since
|
|
71
|
+
* a client can show the request from the request alone.
|
|
44
72
|
*/
|
|
45
73
|
subject(sessionId, toolCall) {
|
|
46
|
-
const result = this.apply(sessionId, toolCall, false);
|
|
74
|
+
const [result] = this.apply(sessionId, toolCall, false);
|
|
47
75
|
const stored = this.calls.get(`${sessionId} ${toolCall.toolCallId}`)?.meta ?? {};
|
|
48
|
-
if (
|
|
49
|
-
result._meta = stored;
|
|
76
|
+
if (Object.keys(stored).length > 0)
|
|
77
|
+
result._meta = { ...result._meta, ...stored };
|
|
50
78
|
return result;
|
|
51
79
|
}
|
|
52
80
|
/** Forgets the tool calls of a session, when it closes. */
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.91.1-preview.
|
|
6
|
+
"version": "0.91.1-preview.5",
|
|
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,7 +65,7 @@
|
|
|
65
65
|
"node": ">=22"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@agentclientprotocol/sdk": "1.
|
|
68
|
+
"@agentclientprotocol/sdk": "1.9.0",
|
|
69
69
|
"@anthropic-ai/claude-agent-sdk": "0.3.300",
|
|
70
70
|
"diff": "9.0.0",
|
|
71
71
|
"zod": "4.6.7"
|