@agentclientprotocol/claude-agent-acp 0.24.0 → 0.24.2
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.map +1 -1
- package/dist/acp-agent.js +16 -33
- package/package.json +2 -2
- package/dist/static-entry.d.ts +0 -2
- package/dist/static-entry.d.ts.map +0 -1
- package/dist/static-entry.js +0 -9
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,EAClB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,
|
|
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,k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EAAE,MAAM,GAAG,iBAAiB,EAAE,GAAG,gBAAgB,EAAE,GAAG,wBAAwB,EAAE,EACvF,IAAI,EAAE,WAAW,GAAG,MAAM,EAC1B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GACA,mBAAmB,EAAE,CAmPvB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,0BAA0B,EACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GACA,mBAAmB,EAAE,CA0CvB;AAED,wBAAgB,MAAM,SAMrB"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -234,15 +234,11 @@ export class ClaudeAcpAgent {
|
|
|
234
234
|
const userMessage = promptToClaude(params);
|
|
235
235
|
const promptUuid = randomUUID();
|
|
236
236
|
userMessage.uuid = promptUuid;
|
|
237
|
-
let promptReplayed = false;
|
|
238
237
|
// These local-only commands return a result without replaying the user
|
|
239
238
|
// message. Mark promptReplayed=true so their result isn't consumed as a
|
|
240
239
|
// background task result.
|
|
241
240
|
const firstText = params.prompt[0]?.type === "text" ? params.prompt[0].text : "";
|
|
242
241
|
const isLocalOnlyCommand = firstText.startsWith("/") && LOCAL_ONLY_COMMANDS.has(firstText.split(" ", 1)[0]);
|
|
243
|
-
if (isLocalOnlyCommand) {
|
|
244
|
-
promptReplayed = true;
|
|
245
|
-
}
|
|
246
242
|
if (session.promptRunning) {
|
|
247
243
|
session.input.push(userMessage);
|
|
248
244
|
const order = session.nextPendingOrder++;
|
|
@@ -252,15 +248,13 @@ export class ClaudeAcpAgent {
|
|
|
252
248
|
if (cancelled) {
|
|
253
249
|
return { stopReason: "cancelled" };
|
|
254
250
|
}
|
|
255
|
-
// The replay resolved the promise, mark in this loop too,
|
|
256
|
-
// so we don't treat the next result as a background task's result.
|
|
257
|
-
promptReplayed = true;
|
|
258
251
|
}
|
|
259
252
|
else {
|
|
260
253
|
session.input.push(userMessage);
|
|
261
254
|
}
|
|
262
255
|
session.promptRunning = true;
|
|
263
256
|
let handedOff = false;
|
|
257
|
+
let stopReason = "end_turn";
|
|
264
258
|
try {
|
|
265
259
|
while (true) {
|
|
266
260
|
const { value: message, done } = await session.query.next();
|
|
@@ -298,7 +292,6 @@ export class ClaudeAcpAgent {
|
|
|
298
292
|
content: { type: "text", text: "\n\nCompacting completed." },
|
|
299
293
|
},
|
|
300
294
|
});
|
|
301
|
-
promptReplayed = true;
|
|
302
295
|
break;
|
|
303
296
|
}
|
|
304
297
|
case "local_command_output": {
|
|
@@ -309,12 +302,11 @@ export class ClaudeAcpAgent {
|
|
|
309
302
|
content: { type: "text", text: message.content },
|
|
310
303
|
},
|
|
311
304
|
});
|
|
312
|
-
promptReplayed = true;
|
|
313
305
|
break;
|
|
314
306
|
}
|
|
315
307
|
case "session_state_changed": {
|
|
316
308
|
if (message.state === "idle") {
|
|
317
|
-
return { stopReason
|
|
309
|
+
return { stopReason, usage: sessionUsage(session) };
|
|
318
310
|
}
|
|
319
311
|
break;
|
|
320
312
|
}
|
|
@@ -358,29 +350,18 @@ export class ClaudeAcpAgent {
|
|
|
358
350
|
},
|
|
359
351
|
});
|
|
360
352
|
}
|
|
361
|
-
// Check cancelled before promptReplayed — when a cancel races
|
|
362
|
-
// with the first result, promptReplayed is still false and the
|
|
363
|
-
// result would be consumed as a background task, blocking the
|
|
364
|
-
// loop forever (see #442).
|
|
365
353
|
if (session.cancelled) {
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
if (!promptReplayed) {
|
|
369
|
-
// This result is from a background task that finished after
|
|
370
|
-
// the previous prompt loop ended. Consume it and continue
|
|
371
|
-
// waiting for our own prompt's result.
|
|
372
|
-
this.logger.log(`Session ${params.sessionId}: consuming background task result`);
|
|
354
|
+
stopReason = "cancelled";
|
|
373
355
|
break;
|
|
374
356
|
}
|
|
375
|
-
// Build the usage response
|
|
376
|
-
const usage = sessionUsage(session);
|
|
377
357
|
switch (message.subtype) {
|
|
378
358
|
case "success": {
|
|
379
359
|
if (message.result.includes("Please run /login")) {
|
|
380
360
|
throw RequestError.authRequired();
|
|
381
361
|
}
|
|
382
362
|
if (message.stop_reason === "max_tokens") {
|
|
383
|
-
|
|
363
|
+
stopReason = "max_tokens";
|
|
364
|
+
break;
|
|
384
365
|
}
|
|
385
366
|
if (message.is_error) {
|
|
386
367
|
throw RequestError.internalError(undefined, message.result);
|
|
@@ -396,12 +377,14 @@ export class ClaudeAcpAgent {
|
|
|
396
377
|
}
|
|
397
378
|
case "error_during_execution": {
|
|
398
379
|
if (message.stop_reason === "max_tokens") {
|
|
399
|
-
|
|
380
|
+
stopReason = "max_tokens";
|
|
381
|
+
break;
|
|
400
382
|
}
|
|
401
383
|
if (message.is_error) {
|
|
402
384
|
throw RequestError.internalError(undefined, message.errors.join(", ") || message.subtype);
|
|
403
385
|
}
|
|
404
|
-
|
|
386
|
+
stopReason = "end_turn";
|
|
387
|
+
break;
|
|
405
388
|
}
|
|
406
389
|
case "error_max_budget_usd":
|
|
407
390
|
case "error_max_turns":
|
|
@@ -409,7 +392,8 @@ export class ClaudeAcpAgent {
|
|
|
409
392
|
if (message.is_error) {
|
|
410
393
|
throw RequestError.internalError(undefined, message.errors.join(", ") || message.subtype);
|
|
411
394
|
}
|
|
412
|
-
|
|
395
|
+
stopReason = "max_turn_requests";
|
|
396
|
+
break;
|
|
413
397
|
default:
|
|
414
398
|
unreachable(message, this.logger);
|
|
415
399
|
break;
|
|
@@ -433,9 +417,6 @@ export class ClaudeAcpAgent {
|
|
|
433
417
|
// Check for prompt replay
|
|
434
418
|
if (message.type === "user" && "uuid" in message && message.uuid) {
|
|
435
419
|
if (message.uuid === promptUuid) {
|
|
436
|
-
// Our own prompt was replayed back — we're now processing
|
|
437
|
-
// our prompt's response (not a background task's).
|
|
438
|
-
promptReplayed = true;
|
|
439
420
|
break;
|
|
440
421
|
}
|
|
441
422
|
const pending = session.pendingMessages.get(message.uuid);
|
|
@@ -899,7 +880,8 @@ export class ClaudeAcpAgent {
|
|
|
899
880
|
const mcpServers = {};
|
|
900
881
|
if (Array.isArray(params.mcpServers)) {
|
|
901
882
|
for (const server of params.mcpServers) {
|
|
902
|
-
if ("type" in server) {
|
|
883
|
+
if ("type" in server && (server.type === "http" || server.type === "sse")) {
|
|
884
|
+
// HTTP or SSE type MCP server
|
|
903
885
|
mcpServers[server.name] = {
|
|
904
886
|
type: server.type,
|
|
905
887
|
url: server.url,
|
|
@@ -909,6 +891,7 @@ export class ClaudeAcpAgent {
|
|
|
909
891
|
};
|
|
910
892
|
}
|
|
911
893
|
else {
|
|
894
|
+
// Stdio type MCP server (with or without explicit type field)
|
|
912
895
|
mcpServers[server.name] = {
|
|
913
896
|
type: "stdio",
|
|
914
897
|
command: server.command,
|
|
@@ -1300,10 +1283,10 @@ export function promptToClaude(prompt) {
|
|
|
1300
1283
|
case "text": {
|
|
1301
1284
|
let text = chunk.text;
|
|
1302
1285
|
// change /mcp:server:command args -> /server:command (MCP) args
|
|
1303
|
-
const mcpMatch = text.match(/^\/mcp:([^:\s]+):(\S+)(
|
|
1286
|
+
const mcpMatch = text.match(/^\/mcp:([^:\s]+):(\S+)(?:\s(.*))?$/);
|
|
1304
1287
|
if (mcpMatch) {
|
|
1305
1288
|
const [, server, command, args] = mcpMatch;
|
|
1306
|
-
text = `/${server}:${command} (MCP)${args
|
|
1289
|
+
text = `/${server}:${command} (MCP)${args ? ` ${args}` : ""}`;
|
|
1307
1290
|
}
|
|
1308
1291
|
content.push({ type: "text", text });
|
|
1309
1292
|
break;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.24.
|
|
6
|
+
"version": "0.24.2",
|
|
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",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@agentclientprotocol/sdk": "0.17.0",
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.84",
|
|
65
65
|
"zod": "^3.25.0 || ^4.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
package/dist/static-entry.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-entry.d.ts","sourceRoot":"","sources":["../src/static-entry.ts"],"names":[],"mappings":""}
|
package/dist/static-entry.js
DELETED