@agentclientprotocol/claude-agent-acp 0.38.0 → 0.40.0
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 +13 -2
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +44 -20
- package/package.json +8 -8
package/dist/acp-agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent, AgentSideConnection, AuthenticateRequest, CancelNotification, ClientCapabilities, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption,
|
|
1
|
+
import { Agent, AgentSideConnection, AuthenticateRequest, CancelNotification, ClientCapabilities, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, TerminalHandle, TerminalOutputResponse, WriteTextFileRequest, WriteTextFileResponse } from "@agentclientprotocol/sdk";
|
|
2
2
|
import { CanUseTool, ModelInfo, Options, PermissionMode, PermissionUpdate, Query, SDKMessageOrigin, SDKPartialAssistantMessage, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
3
3
|
import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
|
|
4
4
|
import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
|
|
@@ -19,6 +19,18 @@ type AccumulatedUsage = {
|
|
|
19
19
|
cachedReadTokens: number;
|
|
20
20
|
cachedWriteTokens: number;
|
|
21
21
|
};
|
|
22
|
+
/** Internal model-selection state. Mirrors the shape the ACP SDK exposed as
|
|
23
|
+
* `SessionModelState` before model selection moved entirely into
|
|
24
|
+
* `SessionConfigOption` (category "model"). Retained internally to track the
|
|
25
|
+
* current model and build the "model" config option. */
|
|
26
|
+
type SessionModelState = {
|
|
27
|
+
availableModels: Array<{
|
|
28
|
+
modelId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
}>;
|
|
32
|
+
currentModelId: string;
|
|
33
|
+
};
|
|
22
34
|
type Session = {
|
|
23
35
|
query: Query;
|
|
24
36
|
input: Pushable<SDKUserMessage>;
|
|
@@ -189,7 +201,6 @@ export declare class ClaudeAcpAgent implements Agent {
|
|
|
189
201
|
dispose(): Promise<void>;
|
|
190
202
|
closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse>;
|
|
191
203
|
unstable_deleteSession(params: DeleteSessionRequest): Promise<DeleteSessionResponse>;
|
|
192
|
-
unstable_setSessionModel(params: SetSessionModelRequest): Promise<SetSessionModelResponse | void>;
|
|
193
204
|
setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
|
|
194
205
|
setSessionConfigOption(params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
|
|
195
206
|
private applySessionMode;
|
package/dist/acp-agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../src/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EAEnB,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../src/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EAEnB,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAKV,SAAS,EAET,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,KAAK,EAIL,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAKlG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EASL,SAAS,EAKV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAwC,QAAQ,EAAe,MAAM,YAAY,CAAC;AAEzF,eAAO,MAAM,iBAAiB,QACuC,CAAC;AAgBtE;;GAEG;A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MAAM;;;EAWrB"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -78,6 +78,9 @@ function isMuslLibc() {
|
|
|
78
78
|
const report = process.report?.getReport();
|
|
79
79
|
return !report?.header?.glibcVersionRuntime;
|
|
80
80
|
}
|
|
81
|
+
function shouldHideClaudeAuth() {
|
|
82
|
+
return process.argv.includes("--hide-claude-auth");
|
|
83
|
+
}
|
|
81
84
|
// Bypass Permissions doesn't work if we are a root/sudo user
|
|
82
85
|
const IS_ROOT = (process.geteuid?.() ?? process.getuid?.()) === 0;
|
|
83
86
|
const ALLOW_BYPASS = !IS_ROOT || !!process.env.IS_SANDBOX;
|
|
@@ -89,9 +92,39 @@ const LOCAL_ONLY_COMMANDS = new Set(["/context", "/heapdump", "/extra-usage"]);
|
|
|
89
92
|
// payload in these XML-like markers that the CLI uses for its own display.
|
|
90
93
|
// The live prompt loop drops them; replay must strip them too or they leak
|
|
91
94
|
// into the UI on session/load.
|
|
92
|
-
const
|
|
95
|
+
const LOCAL_COMMAND_MARKERS = [
|
|
96
|
+
"command-name",
|
|
97
|
+
"command-message",
|
|
98
|
+
"command-args",
|
|
99
|
+
"local-command-stdout",
|
|
100
|
+
"local-command-stderr",
|
|
101
|
+
].map((tag) => ({ open: `<${tag}>`, close: `</${tag}>` }));
|
|
102
|
+
// Single-pass scanner that removes each `<tag>…</tag>` marker (matching the
|
|
103
|
+
// nearest closing tag of the same name, like a lazy regex would).
|
|
93
104
|
function stripMarkerTags(text) {
|
|
94
|
-
|
|
105
|
+
const dead = new Set();
|
|
106
|
+
let result = "";
|
|
107
|
+
let copiedUpTo = 0;
|
|
108
|
+
let i = 0;
|
|
109
|
+
while (i < text.length) {
|
|
110
|
+
if (text[i] === "<") {
|
|
111
|
+
const marker = LOCAL_COMMAND_MARKERS.find((m) => !dead.has(m.open) && text.startsWith(m.open, i));
|
|
112
|
+
if (marker) {
|
|
113
|
+
const end = text.indexOf(marker.close, i + marker.open.length);
|
|
114
|
+
if (end !== -1) {
|
|
115
|
+
result += text.slice(copiedUpTo, i);
|
|
116
|
+
i = copiedUpTo = end + marker.close.length;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
// No closing marker remains anywhere ahead, and `indexOf` only ever
|
|
120
|
+
// searches forward from here on, so stop treating this tag as an
|
|
121
|
+
// opener — that avoids rescanning the tail for it on every match.
|
|
122
|
+
dead.add(marker.open);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
return result + text.slice(copiedUpTo);
|
|
95
128
|
}
|
|
96
129
|
/**
|
|
97
130
|
* Return user-message content with local-command marker tags removed, or
|
|
@@ -260,7 +293,7 @@ export class ClaudeAcpAgent {
|
|
|
260
293
|
},
|
|
261
294
|
};
|
|
262
295
|
}
|
|
263
|
-
if (supportsTerminalAuth || supportsMetaTerminalAuth) {
|
|
296
|
+
if (!shouldHideClaudeAuth() && (supportsTerminalAuth || supportsMetaTerminalAuth)) {
|
|
264
297
|
terminalAuthMethods.push(remoteLoginMethod);
|
|
265
298
|
}
|
|
266
299
|
}
|
|
@@ -296,8 +329,10 @@ export class ClaudeAcpAgent {
|
|
|
296
329
|
},
|
|
297
330
|
};
|
|
298
331
|
}
|
|
299
|
-
if (supportsTerminalAuth || supportsMetaTerminalAuth) {
|
|
332
|
+
if (!shouldHideClaudeAuth() && (supportsTerminalAuth || supportsMetaTerminalAuth)) {
|
|
300
333
|
terminalAuthMethods.push(claudeLoginMethod);
|
|
334
|
+
}
|
|
335
|
+
if (supportsTerminalAuth || supportsMetaTerminalAuth) {
|
|
301
336
|
terminalAuthMethods.push(consoleLoginMethod);
|
|
302
337
|
}
|
|
303
338
|
}
|
|
@@ -1008,19 +1043,6 @@ export class ClaudeAcpAgent {
|
|
|
1008
1043
|
await deleteSession(params.sessionId);
|
|
1009
1044
|
return {};
|
|
1010
1045
|
}
|
|
1011
|
-
async unstable_setSessionModel(params) {
|
|
1012
|
-
const session = this.sessions[params.sessionId];
|
|
1013
|
-
if (!session) {
|
|
1014
|
-
throw new Error("Session not found");
|
|
1015
|
-
}
|
|
1016
|
-
// Resolve aliases (e.g. "opus", "opus[1m]") to canonical model IDs so
|
|
1017
|
-
// downstream lookups in modelInfos succeed and the effort option isn't
|
|
1018
|
-
// silently dropped.
|
|
1019
|
-
const resolved = resolveModelPreference(session.modelInfos, params.modelId);
|
|
1020
|
-
const modelId = resolved?.value ?? params.modelId;
|
|
1021
|
-
await session.query.setModel(modelId);
|
|
1022
|
-
await this.updateConfigOption(params.sessionId, "model", modelId);
|
|
1023
|
-
}
|
|
1024
1046
|
async setSessionMode(params) {
|
|
1025
1047
|
if (!this.sessions[params.sessionId]) {
|
|
1026
1048
|
throw new Error("Session not found");
|
|
@@ -1403,7 +1425,6 @@ export class ClaudeAcpAgent {
|
|
|
1403
1425
|
return {
|
|
1404
1426
|
sessionId: params.sessionId,
|
|
1405
1427
|
modes: existingSession.modes,
|
|
1406
|
-
models: existingSession.models,
|
|
1407
1428
|
configOptions: existingSession.configOptions,
|
|
1408
1429
|
};
|
|
1409
1430
|
}
|
|
@@ -1423,7 +1444,6 @@ export class ClaudeAcpAgent {
|
|
|
1423
1444
|
return {
|
|
1424
1445
|
sessionId: response.sessionId,
|
|
1425
1446
|
modes: response.modes,
|
|
1426
|
-
models: response.models,
|
|
1427
1447
|
configOptions: response.configOptions,
|
|
1428
1448
|
};
|
|
1429
1449
|
}
|
|
@@ -1648,6 +1668,11 @@ export class ClaudeAcpAgent {
|
|
|
1648
1668
|
}
|
|
1649
1669
|
throw error;
|
|
1650
1670
|
}
|
|
1671
|
+
if (shouldHideClaudeAuth() &&
|
|
1672
|
+
initializationResult.account.subscriptionType &&
|
|
1673
|
+
!this.gatewayAuthRequest) {
|
|
1674
|
+
throw RequestError.authRequired(undefined, "This integration does not support using claude.ai subscriptions.");
|
|
1675
|
+
}
|
|
1651
1676
|
// Apply user's `availableModels` allowlist from settings.json before any
|
|
1652
1677
|
// downstream model handling. The SDK only enforces this allowlist in its
|
|
1653
1678
|
// own UI, not in `initializationResult.models`, so we filter here to keep
|
|
@@ -1730,7 +1755,6 @@ export class ClaudeAcpAgent {
|
|
|
1730
1755
|
};
|
|
1731
1756
|
return {
|
|
1732
1757
|
sessionId,
|
|
1733
|
-
models,
|
|
1734
1758
|
modes,
|
|
1735
1759
|
configOptions,
|
|
1736
1760
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.40.0",
|
|
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",
|
|
@@ -60,22 +60,22 @@
|
|
|
60
60
|
"author": "Zed Industries",
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@agentclientprotocol/sdk": "0.
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
63
|
+
"@agentclientprotocol/sdk": "0.24.0",
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.160",
|
|
65
65
|
"zod": "^3.25.0 || ^4.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@anthropic-ai/sdk": "0.100.
|
|
68
|
+
"@anthropic-ai/sdk": "0.100.1",
|
|
69
69
|
"@eslint/js": "10.0.1",
|
|
70
70
|
"@types/node": "25.9.1",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "8.60.
|
|
72
|
-
"@typescript-eslint/parser": "8.60.
|
|
73
|
-
"eslint": "10.4.
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "8.60.1",
|
|
72
|
+
"@typescript-eslint/parser": "8.60.1",
|
|
73
|
+
"eslint": "10.4.1",
|
|
74
74
|
"eslint-config-prettier": "10.1.8",
|
|
75
75
|
"globals": "17.6.0",
|
|
76
76
|
"prettier": "3.8.3",
|
|
77
77
|
"ts-node": "10.9.2",
|
|
78
78
|
"typescript": "6.0.3",
|
|
79
|
-
"vitest": "4.1.
|
|
79
|
+
"vitest": "4.1.8"
|
|
80
80
|
}
|
|
81
81
|
}
|