@agentclientprotocol/claude-agent-acp 0.109.1-preview.5 → 0.109.1-preview.6
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/README.md +6 -5
- package/dist/client-system-prompt.d.ts +6 -4
- package/dist/client-system-prompt.d.ts.map +1 -1
- package/dist/client-system-prompt.js +7 -2
- package/dist/context-compaction.d.ts.map +1 -1
- package/dist/context-compaction.js +4 -3
- package/dist/plans.d.ts +4 -4
- package/dist/serve.d.ts +1 -1
- package/dist/serve.js +1 -1
- package/dist/tool-calls/reporters/search.d.ts +7 -3
- package/dist/tool-calls/reporters/search.d.ts.map +1 -1
- package/dist/tool-calls/reporters/search.js +9 -4
- package/dist/v1/acp-agent.d.ts +1 -1
- package/dist/v1/acp-agent.js +1 -1
- package/dist/v2/agent.js +2 -2
- package/dist/v2/permissions.d.ts +1 -1
- package/dist/v2/permissions.js +1 -1
- package/dist/v2/reports.d.ts +4 -0
- package/dist/v2/reports.d.ts.map +1 -1
- package/dist/v2/reports.js +10 -1
- package/dist/v2/session-update.js +3 -3
- package/dist/v2/tool-call.d.ts.map +1 -1
- package/dist/v2/tool-call.js +23 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,11 +58,11 @@ npm run build:binary
|
|
|
58
58
|
npm run smoke:binary # add `-- --full` to drive a real session; needs a Claude login
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
###
|
|
61
|
+
### ACP v2 (Preview)
|
|
62
62
|
|
|
63
|
-
The adapter also serves
|
|
64
|
-
a client that asks for protocol version 2 or later in `initialize` gets v2, and every other
|
|
65
|
-
gets v1.
|
|
63
|
+
The adapter also serves [ACP v2](https://agentclientprotocol.com/protocol/v2/overview), which is in
|
|
64
|
+
Preview: a client that asks for protocol version 2 or later in `initialize` gets v2, and every other
|
|
65
|
+
client gets v1. v2 is not frozen yet, and this surface changes with it.
|
|
66
66
|
|
|
67
67
|
`CLAUDE_AGENT_ACP_PROTOCOL` limits the adapter to one version. With `v1`, a client that asks
|
|
68
68
|
for v2 is negotiated down to v1. With `v2`, the adapter rejects the `initialize` of a v1 client.
|
|
@@ -77,7 +77,8 @@ compaction, display terminals for commands, permission requests, elicitation, pr
|
|
|
77
77
|
|
|
78
78
|
`session/prompt` takes an `idempotencyKey`: a prompt that a client sends again with the same key
|
|
79
79
|
is inserted once, and the retry gets the first `messageId`. The key is known for as long as Claude
|
|
80
|
-
Code stores the message, also after a restart.
|
|
80
|
+
Code stores the message, also after a restart. A prompt that Claude Code does not store, such as a
|
|
81
|
+
local command, keeps its key until `session/close` or the end of the connection.
|
|
81
82
|
|
|
82
83
|
The adapter announces a session cursor (`cursor_update`) before each user message that follows
|
|
83
84
|
another entry of the conversation, live and in a replay. `session/fork` with its `cursorId` copies
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The client-provided system prompt of the
|
|
2
|
+
* The client-provided system prompt of the `systemPrompt` field on
|
|
3
3
|
* `session/new`, `session/load`, `session/resume`, and `session/fork`.
|
|
4
4
|
*
|
|
5
5
|
* - `append` keeps the Claude Code preset and adds the text after it, the
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* The CLI records the system prompt of a conversation on its first request
|
|
12
12
|
* and reuses it on resume, so a different `systemPrompt` on a later
|
|
13
|
-
* `session/resume` takes effect at the next compaction.
|
|
13
|
+
* `session/resume` takes effect at the next compaction. ACP allows this
|
|
14
14
|
* deferral.
|
|
15
15
|
*/
|
|
16
16
|
import type { Options } from "@anthropic-ai/claude-agent-sdk";
|
|
@@ -28,8 +28,10 @@ export type ClientSystemPrompt = {
|
|
|
28
28
|
/**
|
|
29
29
|
* The mode and text of a `systemPrompt`, or `undefined` when the request has
|
|
30
30
|
* none. Throws `invalid_params` for a mode other than `append` and `override`
|
|
31
|
-
* and for a content block other than text:
|
|
32
|
-
* session, for a prompt the agent cannot apply.
|
|
31
|
+
* and for a content block other than text: ACP requires an error, and no
|
|
32
|
+
* session, for a prompt the agent cannot apply. Also for an empty `content`
|
|
33
|
+
* list, which a client must not send: the v2 schema rejects it before this
|
|
34
|
+
* runs, and a v1 client gets the same answer.
|
|
33
35
|
*/
|
|
34
36
|
export declare function clientSystemPrompt(systemPrompt: SystemPrompt | null | undefined): ClientSystemPrompt | undefined;
|
|
35
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-system-prompt.d.ts","sourceRoot":"","sources":["../src/client-system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,mCAAmC,CAAC;AAE3C,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB;;;;CAEuB,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E
|
|
1
|
+
{"version":3,"file":"client-system-prompt.d.ts","sourceRoot":"","sources":["../src/client-system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,mCAAmC,CAAC;AAE3C,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB;;;;CAEuB,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAC5C,kBAAkB,GAAG,SAAS,CA0BhC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,EAC1B,kBAAkB,EAAE,MAAM,GAAG,SAAS,GACrC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAMtC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,kBAAkB,GAAG,SAAS,EAC5C,UAAU,EAAE,OAAO,EACnB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAetC"}
|
|
@@ -6,8 +6,10 @@ export const SYSTEM_PROMPT_CAPABILITY = {
|
|
|
6
6
|
/**
|
|
7
7
|
* The mode and text of a `systemPrompt`, or `undefined` when the request has
|
|
8
8
|
* none. Throws `invalid_params` for a mode other than `append` and `override`
|
|
9
|
-
* and for a content block other than text:
|
|
10
|
-
* session, for a prompt the agent cannot apply.
|
|
9
|
+
* and for a content block other than text: ACP requires an error, and no
|
|
10
|
+
* session, for a prompt the agent cannot apply. Also for an empty `content`
|
|
11
|
+
* list, which a client must not send: the v2 schema rejects it before this
|
|
12
|
+
* runs, and a v1 client gets the same answer.
|
|
11
13
|
*/
|
|
12
14
|
export function clientSystemPrompt(systemPrompt) {
|
|
13
15
|
if (systemPrompt == null)
|
|
@@ -16,6 +18,9 @@ export function clientSystemPrompt(systemPrompt) {
|
|
|
16
18
|
if (mode !== "append" && mode !== "override") {
|
|
17
19
|
throw RequestError.invalidParams({ systemPrompt: { mode } }, `Unsupported systemPrompt mode: ${mode}`);
|
|
18
20
|
}
|
|
21
|
+
if (content.length === 0) {
|
|
22
|
+
throw RequestError.invalidParams({ systemPrompt: { content } }, "systemPrompt content is empty. Send at least one text block, or leave systemPrompt out.");
|
|
23
|
+
}
|
|
19
24
|
const text = [];
|
|
20
25
|
for (const block of content) {
|
|
21
26
|
if (block.type !== "text") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-compaction.d.ts","sourceRoot":"","sources":["../src/context-compaction.ts"],"names":[],"mappings":"A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AAW;CAO1B;AAoBD,+FAA+F;AAC/F,wBAAgB,qCAAqC,CACnD,eAAe,EAAE;IACf,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,EAAE,cAAsB,EAAE,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5D,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAW5C"}
|
|
@@ -311,9 +311,10 @@ export class ContextCompactionLifecycle {
|
|
|
311
311
|
status: terminalStatus,
|
|
312
312
|
...(summary !== undefined ? { summary: [{ type: "text", text: summary }] } : {}),
|
|
313
313
|
...(terminalStatus === "failed" && metadata.error ? { error: metadata.error } : {}),
|
|
314
|
-
// `_meta` is
|
|
315
|
-
//
|
|
316
|
-
//
|
|
314
|
+
// A `_meta` that is sent replaces the facts a client holds (the
|
|
315
|
+
// whole `_meta` on v1, its `jetbrains` key on v2): seed it with the
|
|
316
|
+
// first terminal, then only re-send it when the boundary adds facts,
|
|
317
|
+
// so a status-only duplicate can't wipe the token counts.
|
|
317
318
|
// The standard `error` field carries the error, so `_meta` does not.
|
|
318
319
|
// Only AIR gets the compaction facts.
|
|
319
320
|
...(this.airClient && (firstTerminal || hasMetadata)
|
package/dist/plans.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The session updates that show the session's plans. A client
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The session updates that show the session's plans. A v2 client, and a v1
|
|
3
|
+
* client that advertises the `plan` capability, tracks plans by ID and gets
|
|
4
|
+
* `plan_update` and `plan_removed`; any other v1 client gets the legacy `plan`
|
|
5
|
+
* update, which holds one ID-less plan per session.
|
|
6
6
|
*/
|
|
7
7
|
import type { PlanEntry, PlanItems, PlanRemoved, SessionNotification } from "@agentclientprotocol/sdk/unstable";
|
|
8
8
|
type PlanRemovalUpdate = PlanRemoved & {
|
package/dist/serve.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare function serveAcp(logger: Logger | undefined, options: {
|
|
|
24
24
|
/**
|
|
25
25
|
* Routes a connection to the protocol version that the client negotiates in
|
|
26
26
|
* `initialize`. With `auto`, a client that requests version 2 or later gets
|
|
27
|
-
*
|
|
27
|
+
* ACP v2, and every other client gets ACP v1. With `v1`, a v2
|
|
28
28
|
* client is negotiated down to v1. With `v2`, the router rejects the
|
|
29
29
|
* `initialize` of a v1 client as an unsupported protocol version. `onAgent`
|
|
30
30
|
* receives the agent of a v1 connection (`ClaudeAcpAgent`) once the router
|
package/dist/serve.js
CHANGED
|
@@ -38,7 +38,7 @@ export function serveAcp(logger, options) {
|
|
|
38
38
|
/**
|
|
39
39
|
* Routes a connection to the protocol version that the client negotiates in
|
|
40
40
|
* `initialize`. With `auto`, a client that requests version 2 or later gets
|
|
41
|
-
*
|
|
41
|
+
* ACP v2, and every other client gets ACP v1. With `v1`, a v2
|
|
42
42
|
* client is negotiated down to v1. With `v2`, the router rejects the
|
|
43
43
|
* `initialize` of a v1 client as an unsupported protocol version. `onAgent`
|
|
44
44
|
* receives the agent of a v1 connection (`ClaudeAcpAgent`) once the router
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { ToolReporter, ToolUseFacts } from "../facts.js";
|
|
2
|
-
/**
|
|
1
|
+
import type { ToolReporter, ToolUseContext, ToolUseFacts } from "../facts.js";
|
|
2
|
+
/**
|
|
3
|
+
* Glob: the file list is the result to show. A v1 client gets the path and
|
|
4
|
+
* the pattern as Markdown code spans, like upstream. A v2 tool call title is
|
|
5
|
+
* plain text, so a v2 client gets them as they are.
|
|
6
|
+
*/
|
|
3
7
|
export declare class GlobReporter implements ToolReporter {
|
|
4
|
-
toolUse(input: unknown): ToolUseFacts;
|
|
8
|
+
toolUse(input: unknown, { capabilities }: ToolUseContext): ToolUseFacts;
|
|
5
9
|
}
|
|
6
10
|
/** Grep: the title is the equivalent grep command line. */
|
|
7
11
|
export declare class GrepReporter implements ToolReporter {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tool-calls/reporters/search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tool-calls/reporters/search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,EAAE,cAAc,GAAG,YAAY;CAaxE;AAED,2DAA2D;AAC3D,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY;CAoBtC;AAgBD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK3D"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { inputString } from "../content.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Glob: the file list is the result to show. A v1 client gets the path and
|
|
4
|
+
* the pattern as Markdown code spans, like upstream. A v2 tool call title is
|
|
5
|
+
* plain text, so a v2 client gets them as they are.
|
|
6
|
+
*/
|
|
3
7
|
export class GlobReporter {
|
|
4
|
-
toolUse(input) {
|
|
8
|
+
toolUse(input, { capabilities }) {
|
|
5
9
|
const glob = input;
|
|
6
10
|
const searchPath = inputString(input, "path");
|
|
11
|
+
const code = (text) => (capabilities.v2 ? text : `\`${text}\``);
|
|
7
12
|
let label = "Find";
|
|
8
13
|
if (searchPath)
|
|
9
|
-
label += `
|
|
14
|
+
label += ` ${code(searchPath)}`;
|
|
10
15
|
if (glob?.pattern)
|
|
11
|
-
label += `
|
|
16
|
+
label += ` ${code(glob.pattern)}`;
|
|
12
17
|
return {
|
|
13
18
|
title: label,
|
|
14
19
|
kind: "search",
|
package/dist/v1/acp-agent.d.ts
CHANGED
|
@@ -1508,7 +1508,7 @@ export declare class ClaudeAcpAgent {
|
|
|
1508
1508
|
*
|
|
1509
1509
|
* Call it in the same synchronous step as the handler's `return`: an
|
|
1510
1510
|
* `await` between them would let the timer run before the response. The ACP
|
|
1511
|
-
* SDK (2.
|
|
1511
|
+
* SDK (2.9.0) gives a request handler no responder and no after-response
|
|
1512
1512
|
* hook, so the order rests on two things that its source shows and its API
|
|
1513
1513
|
* does not promise. `registerAppRequest` queues the response in the
|
|
1514
1514
|
* microtask that follows the handler's return, with no macrotask in
|
package/dist/v1/acp-agent.js
CHANGED
|
@@ -7038,7 +7038,7 @@ export class ClaudeAcpAgent {
|
|
|
7038
7038
|
*
|
|
7039
7039
|
* Call it in the same synchronous step as the handler's `return`: an
|
|
7040
7040
|
* `await` between them would let the timer run before the response. The ACP
|
|
7041
|
-
* SDK (2.
|
|
7041
|
+
* SDK (2.9.0) gives a request handler no responder and no after-response
|
|
7042
7042
|
* hook, so the order rests on two things that its source shows and its API
|
|
7043
7043
|
* does not promise. `registerAppRequest` queues the response in the
|
|
7044
7044
|
* microtask that follows the handler's return, with no macrotask in
|
package/dist/v2/agent.js
CHANGED
|
@@ -559,7 +559,7 @@ class V2Agent {
|
|
|
559
559
|
}
|
|
560
560
|
const fields = (config, commands) => ({
|
|
561
561
|
configOptions: config.options(),
|
|
562
|
-
//
|
|
562
|
+
// An omitted list means none, like an empty one.
|
|
563
563
|
...(commands.length > 0 ? { availableCommands: commands } : {}),
|
|
564
564
|
});
|
|
565
565
|
const listed = (commands) => commands.list().catch((error) => {
|
|
@@ -752,7 +752,7 @@ class V2Agent {
|
|
|
752
752
|
});
|
|
753
753
|
return {
|
|
754
754
|
configOptions: session.config.options(),
|
|
755
|
-
//
|
|
755
|
+
// An omitted list means none, like an empty one.
|
|
756
756
|
...(commands.length > 0 ? { availableCommands: commands } : {}),
|
|
757
757
|
};
|
|
758
758
|
}
|
package/dist/v2/permissions.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export declare function v2PermissionRequest(request: AcpPermissionRequest): v2.R
|
|
|
82
82
|
/**
|
|
83
83
|
* The v1 form of the answer to a permission request.
|
|
84
84
|
*
|
|
85
|
-
* v2 adds outcomes that v1 does not know, which
|
|
85
|
+
* v2 adds outcomes that v1 does not know, which v2 says are no
|
|
86
86
|
* approval. They become `cancelled`. In v2, `cancelled` also means that the
|
|
87
87
|
* user dismissed the prompt or the client declined it by policy. So the v2
|
|
88
88
|
* core reads a `cancelled` outcome as the user refusing the tool, unless a
|
package/dist/v2/permissions.js
CHANGED
|
@@ -145,7 +145,7 @@ export function v2PermissionRequest(request) {
|
|
|
145
145
|
/**
|
|
146
146
|
* The v1 form of the answer to a permission request.
|
|
147
147
|
*
|
|
148
|
-
* v2 adds outcomes that v1 does not know, which
|
|
148
|
+
* v2 adds outcomes that v1 does not know, which v2 says are no
|
|
149
149
|
* approval. They become `cancelled`. In v2, `cancelled` also means that the
|
|
150
150
|
* user dismissed the prompt or the client declined it by policy. So the v2
|
|
151
151
|
* core reads a `cancelled` outcome as the user refusing the tool, unless a
|
package/dist/v2/reports.d.ts
CHANGED
|
@@ -87,6 +87,8 @@ export declare class SessionReports {
|
|
|
87
87
|
private lastModel;
|
|
88
88
|
/** A `rate_limit_event` that came before the turn had usage to report it with. */
|
|
89
89
|
private pendingRateLimit;
|
|
90
|
+
/** The last result's `usage_update` carried `_claude/origin`, so the client holds it. */
|
|
91
|
+
private originReported;
|
|
90
92
|
/** The normalized texts of the turn's notices (see {@link repeats}). */
|
|
91
93
|
private noticeTexts;
|
|
92
94
|
/** The context window of the session's model (see `context-window.ts`). */
|
|
@@ -214,6 +216,8 @@ export declare class SessionReports {
|
|
|
214
216
|
/**
|
|
215
217
|
* Sends a `usage_update` with the model the usage belongs to and any
|
|
216
218
|
* pending rate limit in `_meta`, as ACP's usage_update has no field for them.
|
|
219
|
+
* A v2 client keeps each `_meta` key until an update replaces or removes it,
|
|
220
|
+
* so `_claude/model` and `_claude/rateLimit` are the last ones reported.
|
|
217
221
|
*/
|
|
218
222
|
private sendUsage;
|
|
219
223
|
}
|
package/dist/v2/reports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../../src/v2/reports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,KAAK,EACV,SAAS,EAET,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,QAAQ,EACT,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAYlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAgBzF,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uGAAuG;IACvG,QAA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AAY,IAAI,IAAI;IASpB;0CACsC;IACtC,4BAA4B,IAAI,OAAO;IAIvC,sFAAsF;IACtF,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAKxC,OAAO,IAAI,IAAI;IAMf,4EAA4E;IAC5E,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAMtC,gFAAgF;IAChF,WAAW,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAyCtD;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAS7C;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IA0BvC;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO;IAoFpC;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IA4BzB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAc1B,uEAAuE;IACvE,OAAO,CAAC,eAAe;IAKvB;;;;;OAKG;IACH,OAAO,CAAC,SAAS;CAclB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAChC,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAqBhC"}
|
package/dist/v2/reports.js
CHANGED
|
@@ -25,6 +25,8 @@ export class SessionReports {
|
|
|
25
25
|
lastModel = null;
|
|
26
26
|
/** A `rate_limit_event` that came before the turn had usage to report it with. */
|
|
27
27
|
pendingRateLimit = null;
|
|
28
|
+
/** The last result's `usage_update` carried `_claude/origin`, so the client holds it. */
|
|
29
|
+
originReported = false;
|
|
28
30
|
/** The normalized texts of the turn's notices (see {@link repeats}). */
|
|
29
31
|
noticeTexts = [];
|
|
30
32
|
/** The context window of the session's model (see `context-window.ts`). */
|
|
@@ -330,12 +332,17 @@ export class SessionReports {
|
|
|
330
332
|
}
|
|
331
333
|
if (this.lastTotal === null)
|
|
332
334
|
return;
|
|
335
|
+
// `_meta` on a v2 `usage_update` patches what the client stores, key by
|
|
336
|
+
// key. `null` removes the origin that an earlier result left, such as
|
|
337
|
+
// `{ kind: "task-notification" }`, when this result has none.
|
|
338
|
+
const origin = message.origin ?? (this.originReported ? null : undefined);
|
|
339
|
+
this.originReported = message.origin != null;
|
|
333
340
|
this.sendUsage({
|
|
334
341
|
sessionUpdate: "usage_update",
|
|
335
342
|
used: this.lastTotal,
|
|
336
343
|
size: this.contextWindow,
|
|
337
344
|
cost: { amount: message.total_cost_usd, currency: "USD" },
|
|
338
|
-
...(
|
|
345
|
+
...(origin !== undefined ? { _meta: { "_claude/origin": origin } } : {}),
|
|
339
346
|
});
|
|
340
347
|
}
|
|
341
348
|
/**
|
|
@@ -483,6 +490,8 @@ export class SessionReports {
|
|
|
483
490
|
/**
|
|
484
491
|
* Sends a `usage_update` with the model the usage belongs to and any
|
|
485
492
|
* pending rate limit in `_meta`, as ACP's usage_update has no field for them.
|
|
493
|
+
* A v2 client keeps each `_meta` key until an update replaces or removes it,
|
|
494
|
+
* so `_claude/model` and `_claude/rateLimit` are the last ones reported.
|
|
486
495
|
*/
|
|
487
496
|
sendUsage(update) {
|
|
488
497
|
let meta = { ...(update._meta ?? {}) };
|
|
@@ -34,17 +34,17 @@ export function v2SessionUpdate(update) {
|
|
|
34
34
|
case "tool_call_update":
|
|
35
35
|
return v2ToolCallUpdate(update);
|
|
36
36
|
case "plan": {
|
|
37
|
-
//
|
|
37
|
+
// v2 has plan operations without a capability, so the agent sends the
|
|
38
38
|
// checklist as `plan_update`; a legacy plan converts the same way.
|
|
39
39
|
const converted = checklistPlanOperation(update.entries);
|
|
40
40
|
return update._meta != null ? { ...converted, _meta: update._meta } : converted;
|
|
41
41
|
}
|
|
42
42
|
case "plan_update":
|
|
43
43
|
case "plan_removed":
|
|
44
|
-
// v1's
|
|
44
|
+
// v1's plan operations have v2's shape.
|
|
45
45
|
return update;
|
|
46
46
|
case "subagent_update": {
|
|
47
|
-
//
|
|
47
|
+
// It has the same shape in v1 and v2.
|
|
48
48
|
const { state, ...association } = update;
|
|
49
49
|
return { ...association, ...(state != null ? { state: v2SubagentState(state) } : {}) };
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAmB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,KAAK,KAAK,EAAE,MAAM,mDAAmD,CAAC;AAE7E,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;AAcD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAM9E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,GAAG,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"tool-call.d.ts","sourceRoot":"","sources":["../../src/v2/tool-call.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAmB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,KAAK,KAAK,EAAE,MAAM,mDAAmD,CAAC;AAE7E,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;AAcD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAM9E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,GAAG,EAAE,CAAC,cAAc,CAYtF"}
|
package/dist/v2/tool-call.js
CHANGED
|
@@ -51,9 +51,31 @@ export function v2ToolCallPatch(toolCall) {
|
|
|
51
51
|
const patch = Object.fromEntries(Object.entries(toolCall).filter(([key, value]) => value !== null && key !== "sessionUpdate" && key !== "content"));
|
|
52
52
|
return {
|
|
53
53
|
...patch,
|
|
54
|
-
...(toolCall.content != null
|
|
54
|
+
...(toolCall.content != null
|
|
55
|
+
? { content: separateParagraphs(toolCall.content).map(v2ToolCallContent) }
|
|
56
|
+
: {}),
|
|
55
57
|
};
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* v2 reads adjacent text items as one continuous text, which a client joins
|
|
61
|
+
* without a separator. The agent's text items are separate paragraphs, such
|
|
62
|
+
* as one per question of an AskUserQuestion or one per block of a tool
|
|
63
|
+
* result, so each one that another text item follows ends with a blank line.
|
|
64
|
+
* Without it, two fenced error blocks would join into "```\nA\n``````\nB\n```".
|
|
65
|
+
*/
|
|
66
|
+
function separateParagraphs(content) {
|
|
67
|
+
return content.map((item, index) => {
|
|
68
|
+
const next = content[index + 1];
|
|
69
|
+
if (!isText(item) || !next || !isText(next))
|
|
70
|
+
return item;
|
|
71
|
+
const { text } = item.content;
|
|
72
|
+
const separator = text.endsWith("\n\n") ? "" : text.endsWith("\n") ? "\n" : "\n\n";
|
|
73
|
+
return { ...item, content: { ...item.content, text: text + separator } };
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function isText(item) {
|
|
77
|
+
return item.type === "content" && item.content.type === "text";
|
|
78
|
+
}
|
|
57
79
|
function v2ToolCallContent(item) {
|
|
58
80
|
switch (item.type) {
|
|
59
81
|
case "content":
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.109.1-preview.
|
|
6
|
+
"version": "0.109.1-preview.6",
|
|
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",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"node": ">=22"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@agentclientprotocol/sdk": "2.
|
|
71
|
+
"@agentclientprotocol/sdk": "2.9.0",
|
|
72
72
|
"@anthropic-ai/claude-agent-sdk": "0.3.328",
|
|
73
73
|
"diff": "9.0.0",
|
|
74
74
|
"zod": "4.6.7"
|