@agentclientprotocol/claude-agent-acp 0.85.2-preview.16 → 0.85.2-preview.17
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/tool-calls/client-capabilities.d.ts +6 -2
- package/dist/tool-calls/client-capabilities.d.ts.map +1 -1
- package/dist/tool-calls/client-capabilities.js +4 -2
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +28 -13
- package/dist/v2/terminal.d.ts +42 -0
- package/dist/v2/terminal.d.ts.map +1 -0
- package/dist/v2/terminal.js +95 -0
- package/dist/v2/tool-call.d.ts +3 -2
- package/dist/v2/tool-call.d.ts.map +1 -1
- package/dist/v2/tool-call.js +6 -5
- package/package.json +1 -1
|
@@ -19,7 +19,9 @@ export declare class ClientCapabilities {
|
|
|
19
19
|
/**
|
|
20
20
|
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
21
21
|
* optional git patch, which a v1 diff cannot express. Only the v2 surface
|
|
22
|
-
* sets this, never the capabilities that a client sends.
|
|
22
|
+
* sets this, never the capabilities that a client sends. A v2 client also
|
|
23
|
+
* takes the terminal extension (`terminalOutput`), which the v2 surface
|
|
24
|
+
* sends as display terminals.
|
|
23
25
|
*/
|
|
24
26
|
readonly v2: boolean;
|
|
25
27
|
constructor(
|
|
@@ -34,7 +36,9 @@ export declare class ClientCapabilities {
|
|
|
34
36
|
/**
|
|
35
37
|
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
36
38
|
* optional git patch, which a v1 diff cannot express. Only the v2 surface
|
|
37
|
-
* sets this, never the capabilities that a client sends.
|
|
39
|
+
* sets this, never the capabilities that a client sends. A v2 client also
|
|
40
|
+
* takes the terminal extension (`terminalOutput`), which the v2 surface
|
|
41
|
+
* sends as display terminals.
|
|
38
42
|
*/
|
|
39
43
|
v2?: boolean);
|
|
40
44
|
static from(capabilities: AcpClientCapabilities | null | undefined, { v2 }?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-capabilities.d.ts","sourceRoot":"","sources":["../../src/tool-calls/client-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAS5F;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAE3B,wGAAwG;IACxG,QAAQ,CAAC,cAAc,EAAE,OAAO;IAChC,4FAA4F;IAC5F,QAAQ,CAAC,mBAAmB,EAAE,OAAO;IACrC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,OAAO;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,eAAe;IAC7B
|
|
1
|
+
{"version":3,"file":"client-capabilities.d.ts","sourceRoot":"","sources":["../../src/tool-calls/client-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAS5F;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAE3B,wGAAwG;IACxG,QAAQ,CAAC,cAAc,EAAE,OAAO;IAChC,4FAA4F;IAC5F,QAAQ,CAAC,mBAAmB,EAAE,OAAO;IACrC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,OAAO;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,eAAe;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO;;IAfpB,wGAAwG;IAC/F,cAAc,GAAE,OAAe;IACxC,4FAA4F;IACnF,mBAAmB,GAAE,OAAe;IAC7C,qFAAqF;IAC5E,SAAS,GAAE,OAAe;IACnC,yDAAyD;IAChD,GAAG,GAAE,eAAwB;IACtC;;;;;;OAMG;IACM,EAAE,GAAE,OAAe;IAG9B,MAAM,CAAC,IAAI,CACT,YAAY,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,EACtD,EAAE,EAAU,EAAE,GAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAA;KAAO,GACpC,kBAAkB;CAkBtB;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -25,7 +25,9 @@ export class ClientCapabilities {
|
|
|
25
25
|
/**
|
|
26
26
|
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
27
27
|
* optional git patch, which a v1 diff cannot express. Only the v2 surface
|
|
28
|
-
* sets this, never the capabilities that a client sends.
|
|
28
|
+
* sets this, never the capabilities that a client sends. A v2 client also
|
|
29
|
+
* takes the terminal extension (`terminalOutput`), which the v2 surface
|
|
30
|
+
* sends as display terminals.
|
|
29
31
|
*/
|
|
30
32
|
v2 = false) {
|
|
31
33
|
this.terminalOutput = terminalOutput;
|
|
@@ -37,7 +39,7 @@ export class ClientCapabilities {
|
|
|
37
39
|
static from(capabilities, { v2 = false } = {}) {
|
|
38
40
|
const meta = capabilities?._meta;
|
|
39
41
|
const terminalOutputDelta = meta?.["terminal_output_delta"] === true;
|
|
40
|
-
return new ClientCapabilities(terminalOutputDelta || meta?.["terminal_output"] === true, terminalOutputDelta, clientSupportsAirCapability(capabilities, AIR_DIFF_PATCH_CAPABILITY), {
|
|
42
|
+
return new ClientCapabilities(v2 || terminalOutputDelta || meta?.["terminal_output"] === true, terminalOutputDelta, clientSupportsAirCapability(capabilities, AIR_DIFF_PATCH_CAPABILITY), {
|
|
41
43
|
client: isAirClient(capabilities),
|
|
42
44
|
rawInputRendering: clientSupportsAirCapability(capabilities, AIR_RAW_INPUT_RENDERING_CAPABILITY),
|
|
43
45
|
planFile: clientSupportsAirCapability(capabilities, AIR_PLAN_FILE_CAPABILITY),
|
package/dist/v2/agent.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAiB9E;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,QAAQ,CA6Cb"}
|
package/dist/v2/agent.js
CHANGED
|
@@ -5,6 +5,7 @@ import { v1PermissionResponse, v2PermissionRequest } from "./permission.js";
|
|
|
5
5
|
import { v2Prompt } from "./prompt.js";
|
|
6
6
|
import { v1NewSessionRequest, v1RestoreSessionRequest, v1SetSessionConfigOptionRequest, v2ConfigOptions, v2NewSessionResponse, v2ResumeSessionResponse, } from "./session.js";
|
|
7
7
|
import { v2SessionUpdate } from "./session-update.js";
|
|
8
|
+
import { V2Terminals } from "./terminal.js";
|
|
8
9
|
/**
|
|
9
10
|
* The ACP v2 surface, for one connection.
|
|
10
11
|
*
|
|
@@ -33,7 +34,11 @@ export function v2AgentApp(logger, onAgent) {
|
|
|
33
34
|
? await agent.resumeSession(restore.request)
|
|
34
35
|
: await client.replaying(params.sessionId, () => agent.loadSession(restore.request)));
|
|
35
36
|
})
|
|
36
|
-
.onRequest(v2.methods.agent.session.close, ({ params }) =>
|
|
37
|
+
.onRequest(v2.methods.agent.session.close, async ({ params }) => {
|
|
38
|
+
const response = await agent.closeSession(params);
|
|
39
|
+
client.terminals.forget(params.sessionId);
|
|
40
|
+
return response;
|
|
41
|
+
})
|
|
37
42
|
.onRequest(v2.methods.agent.session.delete, ({ params }) => agent.deleteSession(params))
|
|
38
43
|
.onRequest(v2.methods.agent.session.setConfigOption, async ({ params }) => {
|
|
39
44
|
const { configOptions, ...response } = await agent.setSessionConfigOption(v1SetSessionConfigOptionRequest(params));
|
|
@@ -56,6 +61,8 @@ class V2ClientConnection {
|
|
|
56
61
|
* replay has cleared so far.
|
|
57
62
|
*/
|
|
58
63
|
replays = new Map();
|
|
64
|
+
/** The display terminals of the commands that the agent runs. */
|
|
65
|
+
terminals = new V2Terminals();
|
|
59
66
|
constructor(ctx, logger) {
|
|
60
67
|
this.ctx = ctx;
|
|
61
68
|
this.logger = logger;
|
|
@@ -98,18 +105,26 @@ class V2ClientConnection {
|
|
|
98
105
|
return this.ctx.notify(method, params);
|
|
99
106
|
}
|
|
100
107
|
async sessionUpdate({ update, ...notification }) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
return;
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
// another call sends meanwhile cannot come between them.
|
|
107
|
-
await Promise.all(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
const updates = this.v2Updates(notification.sessionId, update).flatMap((v2Update) => {
|
|
109
|
+
const clear = this.replayClear(notification.sessionId, v2Update);
|
|
110
|
+
return clear ? [clear, v2Update] : [v2Update];
|
|
111
|
+
});
|
|
112
|
+
// Every update goes to the connection before any is awaited, so an update
|
|
113
|
+
// that another call sends meanwhile cannot come between them.
|
|
114
|
+
await Promise.all(updates.map((v2Update) => this.ctx.notify(v2.methods.client.session.update, { ...notification, update: v2Update })));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The v2 updates of a v1 update: for a tool call report, the updates of its
|
|
118
|
+
* terminal first, then the report itself (see {@link V2Terminals}).
|
|
119
|
+
*/
|
|
120
|
+
v2Updates(sessionId, update) {
|
|
121
|
+
if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
|
|
122
|
+
const v2Update = v2SessionUpdate(update);
|
|
123
|
+
return v2Update ? [v2Update] : [];
|
|
124
|
+
}
|
|
125
|
+
const { terminal, report } = this.terminals.split(sessionId, update);
|
|
126
|
+
const reportUpdate = report && v2SessionUpdate(report);
|
|
127
|
+
return [...terminal, ...(reportUpdate ? [reportUpdate] : [])];
|
|
113
128
|
}
|
|
114
129
|
/**
|
|
115
130
|
* The update that clears the message of a replayed chunk, when it is the
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-owned display terminals for the commands that the agent runs.
|
|
3
|
+
*
|
|
4
|
+
* The agent reports a command through the terminal extension of ACP v1
|
|
5
|
+
* clients, as codex-acp does: `_meta.terminal_info` names the terminal of a
|
|
6
|
+
* tool call, whose content references it; `terminal_output` (a snapshot) or
|
|
7
|
+
* `terminal_output_delta` (a chunk) carries the output, and `terminal_exit` the
|
|
8
|
+
* exit. ACP v2 standardizes this as display-only terminals: the same content
|
|
9
|
+
* reference, and `terminal_update` and `terminal_output_chunk` for the
|
|
10
|
+
* terminal's state. The agent reports to a v2 client as to a client of the
|
|
11
|
+
* extension (`ToolCallClientCapabilities.from`), and {@link V2Terminals} turns
|
|
12
|
+
* the extension's keys into those updates.
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolCall, ToolCallUpdate } from "@agentclientprotocol/sdk";
|
|
15
|
+
import type * as v2 from "@agentclientprotocol/sdk/experimental/v2";
|
|
16
|
+
type V1ToolCallReport = (ToolCall & {
|
|
17
|
+
sessionUpdate: "tool_call";
|
|
18
|
+
}) | (ToolCallUpdate & {
|
|
19
|
+
sessionUpdate: "tool_call_update";
|
|
20
|
+
});
|
|
21
|
+
/** The terminal updates of the tool call reports of one v2 connection. */
|
|
22
|
+
export declare class V2Terminals {
|
|
23
|
+
/** The terminal and the last reported command of each running command, by session and tool call. */
|
|
24
|
+
private readonly running;
|
|
25
|
+
/**
|
|
26
|
+
* The terminal updates that a tool call report carries in the extension's
|
|
27
|
+
* keys, and the report without them, or undefined when nothing else is left
|
|
28
|
+
* in it.
|
|
29
|
+
*
|
|
30
|
+
* The extension names no command, so the terminal gets the command of the
|
|
31
|
+
* tool call's `rawInput` once a report carries it: the first report of a
|
|
32
|
+
* streamed tool use has no input yet.
|
|
33
|
+
*/
|
|
34
|
+
split(sessionId: string, report: V1ToolCallReport): {
|
|
35
|
+
terminal: v2.SessionUpdate[];
|
|
36
|
+
report: V1ToolCallReport | undefined;
|
|
37
|
+
};
|
|
38
|
+
/** Forgets the terminals of a session. */
|
|
39
|
+
forget(sessionId: string): void;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/v2/terminal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEpE,KAAK,gBAAgB,GACjB,CAAC,QAAQ,GAAG;IAAE,aAAa,EAAE,WAAW,CAAA;CAAE,CAAC,GAC3C,CAAC,cAAc,GAAG;IAAE,aAAa,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC;AAiB7D,0EAA0E;AAC1E,qBAAa,WAAW;IACtB,oGAAoG;IACpG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+D;IAEvF;;;;;;;;OAQG;IACH,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,gBAAgB,GACvB;QAAE,QAAQ,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC;QAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAA;KAAE;IAuCzE,0CAA0C;IAC1C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAKhC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const TERMINAL_KEYS = [
|
|
2
|
+
"terminal_info",
|
|
3
|
+
"terminal_output",
|
|
4
|
+
"terminal_output_delta",
|
|
5
|
+
"terminal_exit",
|
|
6
|
+
];
|
|
7
|
+
/** The terminal updates of the tool call reports of one v2 connection. */
|
|
8
|
+
export class V2Terminals {
|
|
9
|
+
/** The terminal and the last reported command of each running command, by session and tool call. */
|
|
10
|
+
running = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* The terminal updates that a tool call report carries in the extension's
|
|
13
|
+
* keys, and the report without them, or undefined when nothing else is left
|
|
14
|
+
* in it.
|
|
15
|
+
*
|
|
16
|
+
* The extension names no command, so the terminal gets the command of the
|
|
17
|
+
* tool call's `rawInput` once a report carries it: the first report of a
|
|
18
|
+
* streamed tool use has no input yet.
|
|
19
|
+
*/
|
|
20
|
+
split(sessionId, report) {
|
|
21
|
+
const meta = (report._meta ?? {});
|
|
22
|
+
const key = `${sessionId} ${report.toolCallId}`;
|
|
23
|
+
if (meta.terminal_info)
|
|
24
|
+
this.running.set(key, { terminalId: meta.terminal_info.terminal_id });
|
|
25
|
+
const terminal = [];
|
|
26
|
+
const running = this.running.get(key);
|
|
27
|
+
if (running) {
|
|
28
|
+
const command = commandOf(report.rawInput);
|
|
29
|
+
const newCommand = command !== undefined && command !== running.command;
|
|
30
|
+
if (newCommand)
|
|
31
|
+
running.command = command;
|
|
32
|
+
const { terminal_output: output, terminal_output_delta: delta, terminal_exit: exit } = meta;
|
|
33
|
+
if (meta.terminal_info || newCommand || output || exit) {
|
|
34
|
+
terminal.push({
|
|
35
|
+
sessionUpdate: "terminal_update",
|
|
36
|
+
terminalId: running.terminalId,
|
|
37
|
+
...(newCommand ? { command } : {}),
|
|
38
|
+
...(output ? { output: { data: base64(output.data) } } : {}),
|
|
39
|
+
...(exit
|
|
40
|
+
? {
|
|
41
|
+
exitStatus: {
|
|
42
|
+
exitCode: exit.exit_code,
|
|
43
|
+
...(exit.signal != null ? { signal: exit.signal } : {}),
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
: {}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (delta) {
|
|
50
|
+
terminal.push({
|
|
51
|
+
sessionUpdate: "terminal_output_chunk",
|
|
52
|
+
terminalId: running.terminalId,
|
|
53
|
+
data: base64(delta.data),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (exit)
|
|
57
|
+
this.running.delete(key);
|
|
58
|
+
}
|
|
59
|
+
return { terminal, report: withoutTerminalKeys(report) };
|
|
60
|
+
}
|
|
61
|
+
/** Forgets the terminals of a session. */
|
|
62
|
+
forget(sessionId) {
|
|
63
|
+
for (const key of this.running.keys()) {
|
|
64
|
+
if (key.startsWith(`${sessionId} `))
|
|
65
|
+
this.running.delete(key);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The report without the extension's keys, or undefined when it carried
|
|
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. In v2
|
|
73
|
+
* a concrete `_meta` replaces the stored one, so sending them would drop the
|
|
74
|
+
* other keys that the tool call holds.
|
|
75
|
+
*/
|
|
76
|
+
function withoutTerminalKeys(report) {
|
|
77
|
+
if (!report._meta || !TERMINAL_KEYS.some((key) => key in report._meta))
|
|
78
|
+
return report;
|
|
79
|
+
const meta = Object.fromEntries(Object.entries(report._meta).filter(([key]) => !TERMINAL_KEYS.includes(key)));
|
|
80
|
+
const stripped = { ...report };
|
|
81
|
+
if (Object.keys(meta).length > 0)
|
|
82
|
+
stripped._meta = meta;
|
|
83
|
+
else
|
|
84
|
+
delete stripped._meta;
|
|
85
|
+
const fields = Object.keys(stripped).filter((key) => key !== "sessionUpdate" && key !== "toolCallId" && key !== "_meta");
|
|
86
|
+
return fields.length > 0 || report.sessionUpdate === "tool_call" ? stripped : undefined;
|
|
87
|
+
}
|
|
88
|
+
function commandOf(rawInput) {
|
|
89
|
+
const command = rawInput?.command;
|
|
90
|
+
return typeof command === "string" && command.length > 0 ? command : undefined;
|
|
91
|
+
}
|
|
92
|
+
/** The output bytes, base64-encoded as a v2 terminal carries them. */
|
|
93
|
+
function base64(text) {
|
|
94
|
+
return Buffer.from(text, "utf8").toString("base64");
|
|
95
|
+
}
|
package/dist/v2/tool-call.d.ts
CHANGED
|
@@ -24,8 +24,9 @@ type V2ToolCallUpdate = v2.ToolCallUpdate & {
|
|
|
24
24
|
*
|
|
25
25
|
* Diffs need what a v1 diff does not say, so the agent builds them in v2 form
|
|
26
26
|
* for a v2 client (`v2DiffContent`), and they pass as they are. Terminal
|
|
27
|
-
* content
|
|
28
|
-
*
|
|
27
|
+
* content references a display terminal, as in v2: a v2 client has no client
|
|
28
|
+
* terminals, so the agent's only terminals are those of its terminal extension
|
|
29
|
+
* (see `terminal.ts`).
|
|
29
30
|
*/
|
|
30
31
|
export declare function v2ToolCallUpdate(report: V1ToolCallReport): V2ToolCallUpdate;
|
|
31
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAmB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEpE,KAAK,gBAAgB,GACjB,CAAC,QAAQ,GAAG;IAAE,aAAa,EAAE,WAAW,CAAA;CAAE,CAAC,GAC3C,CAAC,cAAc,GAAG;IAAE,aAAa,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC;AAE7D,KAAK,gBAAgB,GAAG,EAAE,CAAC,cAAc,GAAG;IAAE,aAAa,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAElF
|
|
1
|
+
{"version":3,"file":"tool-call.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAmB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEpE,KAAK,gBAAgB,GACjB,CAAC,QAAQ,GAAG;IAAE,aAAa,EAAE,WAAW,CAAA;CAAE,CAAC,GAC3C,CAAC,cAAc,GAAG;IAAE,aAAa,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC;AAE7D,KAAK,gBAAgB,GAAG,EAAE,CAAC,cAAc,GAAG;IAAE,aAAa,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAElF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAE3E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,GAAG,EAAE,CAAC,cAAc,CAUtF"}
|
package/dist/v2/tool-call.js
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Diffs need what a v1 diff does not say, so the agent builds them in v2 form
|
|
12
12
|
* for a v2 client (`v2DiffContent`), and they pass as they are. Terminal
|
|
13
|
-
* content
|
|
14
|
-
*
|
|
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`).
|
|
15
16
|
*/
|
|
16
17
|
export function v2ToolCallUpdate(report) {
|
|
17
18
|
return { ...v2ToolCallPatch(report), sessionUpdate: "tool_call_update" };
|
|
@@ -32,14 +33,14 @@ function v2ToolCallContent(item) {
|
|
|
32
33
|
case "content":
|
|
33
34
|
// v2 content blocks are a superset of the v1 blocks.
|
|
34
35
|
return item;
|
|
35
|
-
case "
|
|
36
|
+
case "terminal":
|
|
37
|
+
return item;
|
|
38
|
+
default:
|
|
36
39
|
if (isV2Diff(item))
|
|
37
40
|
return item;
|
|
38
41
|
// A v1 diff names one path, with old and new texts that can be a
|
|
39
42
|
// snippet: v2 cannot say which operation it is, nor give its patch.
|
|
40
43
|
throw new Error("An ACP v2 client cannot take a v1 diff");
|
|
41
|
-
default:
|
|
42
|
-
throw new Error(`The ACP v2 surface does not translate ${item.type} tool call content yet`);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
/** A diff that the agent built in v2 form, which travels as v1 content. */
|
package/package.json
CHANGED