@agentclientprotocol/claude-agent-acp 0.36.1 → 0.38.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.map +1 -1
- package/dist/acp-agent.js +202 -51
- package/package.json +8 -8
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,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,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;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,MAAM,CAAC;KACrB,CAAC;IACF,eAAe,CAAC,EAAE;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,aAAa,CAAC,EAAE;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,IAAI,EAAE,UAAU,GAAG,iBAAiB,GAAG,cAAc,CAAC;QACtD,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAsCrD;
|
|
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,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC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SvB;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;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,mBAAmB,EAAE,CAgDvB;AAED,wBAAgB,MAAM;;;EAWrB"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -78,9 +78,6 @@ 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
|
-
}
|
|
84
81
|
// Bypass Permissions doesn't work if we are a root/sudo user
|
|
85
82
|
const IS_ROOT = (process.geteuid?.() ?? process.getuid?.()) === 0;
|
|
86
83
|
const ALLOW_BYPASS = !IS_ROOT || !!process.env.IS_SANDBOX;
|
|
@@ -263,7 +260,7 @@ export class ClaudeAcpAgent {
|
|
|
263
260
|
},
|
|
264
261
|
};
|
|
265
262
|
}
|
|
266
|
-
if (
|
|
263
|
+
if (supportsTerminalAuth || supportsMetaTerminalAuth) {
|
|
267
264
|
terminalAuthMethods.push(remoteLoginMethod);
|
|
268
265
|
}
|
|
269
266
|
}
|
|
@@ -299,10 +296,8 @@ export class ClaudeAcpAgent {
|
|
|
299
296
|
},
|
|
300
297
|
};
|
|
301
298
|
}
|
|
302
|
-
if (!shouldHideClaudeAuth() && (supportsTerminalAuth || supportsMetaTerminalAuth)) {
|
|
303
|
-
terminalAuthMethods.push(claudeLoginMethod);
|
|
304
|
-
}
|
|
305
299
|
if (supportsTerminalAuth || supportsMetaTerminalAuth) {
|
|
300
|
+
terminalAuthMethods.push(claudeLoginMethod);
|
|
306
301
|
terminalAuthMethods.push(consoleLoginMethod);
|
|
307
302
|
}
|
|
308
303
|
}
|
|
@@ -433,6 +428,13 @@ export class ClaudeAcpAgent {
|
|
|
433
428
|
// forward it to clients as structured `data`, sparing them from
|
|
434
429
|
// pattern-matching on the human-readable message text.
|
|
435
430
|
let lastAssistantError;
|
|
431
|
+
// Tracks whether we're inside a compaction. The SDK emits the terminal
|
|
432
|
+
// `status` (compact_result success/failed) twice for a single failed
|
|
433
|
+
// compaction, and the two messages are indistinguishable — so we report the
|
|
434
|
+
// outcome only while a compaction is in progress, then clear this. A fresh
|
|
435
|
+
// `compacting` status sets it again, so every distinct compaction (e.g.
|
|
436
|
+
// repeated auto-compactions in a long turn) is still shown.
|
|
437
|
+
let compactionInProgress = false;
|
|
436
438
|
const userMessage = promptToClaude(params);
|
|
437
439
|
const promptUuid = randomUUID();
|
|
438
440
|
userMessage.uuid = promptUuid;
|
|
@@ -456,6 +458,7 @@ export class ClaudeAcpAgent {
|
|
|
456
458
|
}
|
|
457
459
|
session.promptRunning = true;
|
|
458
460
|
let handedOff = false;
|
|
461
|
+
let errored = false;
|
|
459
462
|
let stopReason = "end_turn";
|
|
460
463
|
try {
|
|
461
464
|
while (true) {
|
|
@@ -480,6 +483,7 @@ export class ClaudeAcpAgent {
|
|
|
480
483
|
break;
|
|
481
484
|
case "status": {
|
|
482
485
|
if (message.status === "compacting") {
|
|
486
|
+
compactionInProgress = true;
|
|
483
487
|
await this.client.sessionUpdate({
|
|
484
488
|
sessionId: message.session_id,
|
|
485
489
|
update: {
|
|
@@ -488,6 +492,30 @@ export class ClaudeAcpAgent {
|
|
|
488
492
|
},
|
|
489
493
|
});
|
|
490
494
|
}
|
|
495
|
+
else if (message.compact_result === "success" && compactionInProgress) {
|
|
496
|
+
// The SDK signals manual `/compact` completion with a status
|
|
497
|
+
// message carrying `compact_result`, not the `compact_boundary`
|
|
498
|
+
// message (which only fires when there's content to compact).
|
|
499
|
+
compactionInProgress = false;
|
|
500
|
+
await this.client.sessionUpdate({
|
|
501
|
+
sessionId: message.session_id,
|
|
502
|
+
update: {
|
|
503
|
+
sessionUpdate: "agent_message_chunk",
|
|
504
|
+
content: { type: "text", text: "\n\nCompacting completed." },
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
else if (message.compact_result === "failed" && compactionInProgress) {
|
|
509
|
+
compactionInProgress = false;
|
|
510
|
+
const reason = message.compact_error ? `: ${message.compact_error}` : ".";
|
|
511
|
+
await this.client.sessionUpdate({
|
|
512
|
+
sessionId: message.session_id,
|
|
513
|
+
update: {
|
|
514
|
+
sessionUpdate: "agent_message_chunk",
|
|
515
|
+
content: { type: "text", text: `\n\nCompacting failed${reason}` },
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
}
|
|
491
519
|
break;
|
|
492
520
|
}
|
|
493
521
|
case "compact_boundary": {
|
|
@@ -502,6 +530,10 @@ export class ClaudeAcpAgent {
|
|
|
502
530
|
// The alternative (no update) leaves the client showing e.g.
|
|
503
531
|
// "944k/1m" right after the user sees "Compacting completed",
|
|
504
532
|
// which is confusing and wrong.
|
|
533
|
+
//
|
|
534
|
+
// The "Compacting completed." text is emitted from the `status`
|
|
535
|
+
// handler (keyed on `compact_result`), not here, so the failure
|
|
536
|
+
// path gets a message too.
|
|
505
537
|
lastAssistantTotalUsage = 0;
|
|
506
538
|
lastAssistantUsage = null;
|
|
507
539
|
await this.client.sessionUpdate({
|
|
@@ -512,13 +544,6 @@ export class ClaudeAcpAgent {
|
|
|
512
544
|
size: session.contextWindowSize,
|
|
513
545
|
},
|
|
514
546
|
});
|
|
515
|
-
await this.client.sessionUpdate({
|
|
516
|
-
sessionId: message.session_id,
|
|
517
|
-
update: {
|
|
518
|
-
sessionUpdate: "agent_message_chunk",
|
|
519
|
-
content: { type: "text", text: "\n\nCompacting completed." },
|
|
520
|
-
},
|
|
521
|
-
});
|
|
522
547
|
break;
|
|
523
548
|
}
|
|
524
549
|
case "local_command_output": {
|
|
@@ -533,10 +558,50 @@ export class ClaudeAcpAgent {
|
|
|
533
558
|
}
|
|
534
559
|
case "session_state_changed": {
|
|
535
560
|
if (message.state === "idle") {
|
|
561
|
+
if (session.cancelled) {
|
|
562
|
+
stopReason = "cancelled";
|
|
563
|
+
}
|
|
536
564
|
return { stopReason, usage: sessionUsage(session) };
|
|
537
565
|
}
|
|
538
566
|
break;
|
|
539
567
|
}
|
|
568
|
+
case "memory_recall": {
|
|
569
|
+
const isSynthesis = message.mode === "synthesize";
|
|
570
|
+
const locations = isSynthesis
|
|
571
|
+
? []
|
|
572
|
+
: message.memories.map((m) => ({ path: m.path }));
|
|
573
|
+
const content = isSynthesis
|
|
574
|
+
? message.memories
|
|
575
|
+
.filter((m) => typeof m.content === "string")
|
|
576
|
+
.map((m) => ({
|
|
577
|
+
type: "content",
|
|
578
|
+
content: { type: "text", text: m.content },
|
|
579
|
+
}))
|
|
580
|
+
: [];
|
|
581
|
+
const count = message.memories.length;
|
|
582
|
+
const title = isSynthesis
|
|
583
|
+
? "Recalled synthesized memory"
|
|
584
|
+
: `Recalled ${count} ${count === 1 ? "memory" : "memories"}`;
|
|
585
|
+
await this.client.sessionUpdate({
|
|
586
|
+
sessionId: message.session_id,
|
|
587
|
+
update: {
|
|
588
|
+
sessionUpdate: "tool_call",
|
|
589
|
+
toolCallId: message.uuid,
|
|
590
|
+
title,
|
|
591
|
+
kind: "read",
|
|
592
|
+
status: "completed",
|
|
593
|
+
...(locations.length > 0 && { locations }),
|
|
594
|
+
...(content.length > 0 && { content }),
|
|
595
|
+
_meta: {
|
|
596
|
+
claudeCode: {
|
|
597
|
+
toolName: "memory_recall",
|
|
598
|
+
toolResponse: { mode: message.mode },
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
540
605
|
case "hook_started":
|
|
541
606
|
case "hook_progress":
|
|
542
607
|
case "hook_response":
|
|
@@ -547,11 +612,11 @@ export class ClaudeAcpAgent {
|
|
|
547
612
|
case "task_updated":
|
|
548
613
|
case "elicitation_complete":
|
|
549
614
|
case "plugin_install":
|
|
550
|
-
case "memory_recall":
|
|
551
615
|
case "notification":
|
|
552
616
|
case "api_retry":
|
|
553
617
|
case "mirror_error":
|
|
554
618
|
case "permission_denied":
|
|
619
|
+
case "thinking_tokens":
|
|
555
620
|
// Todo: process via status api: https://docs.claude.com/en/docs/claude-code/hooks#hook-output
|
|
556
621
|
break;
|
|
557
622
|
default:
|
|
@@ -760,7 +825,8 @@ export class ClaudeAcpAgent {
|
|
|
760
825
|
// /usage, /status, /model) arrive wrapped in these tags; pure-marker
|
|
761
826
|
// payloads (e.g. /compact's malformed output) strip to null and are
|
|
762
827
|
// skipped. Mirrors the replay path at replaySessionHistory.
|
|
763
|
-
if (
|
|
828
|
+
if (message.message.role !== "system" &&
|
|
829
|
+
typeof message.message.content === "string" &&
|
|
764
830
|
message.message.content.includes("<local-command-stdout>")) {
|
|
765
831
|
const stripped = stripLocalCommandMetadata(message.message.content);
|
|
766
832
|
if (typeof stripped === "string") {
|
|
@@ -791,6 +857,9 @@ export class ClaudeAcpAgent {
|
|
|
791
857
|
message.message.content[0].type === "text"))) {
|
|
792
858
|
break;
|
|
793
859
|
}
|
|
860
|
+
if (message.message.role === "system") {
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
794
863
|
if (message.type === "assistant" &&
|
|
795
864
|
message.message.model === "<synthetic>" &&
|
|
796
865
|
Array.isArray(message.message.content) &&
|
|
@@ -827,6 +896,30 @@ export class ClaudeAcpAgent {
|
|
|
827
896
|
throw new Error("Session did not end in result");
|
|
828
897
|
}
|
|
829
898
|
catch (error) {
|
|
899
|
+
errored = true;
|
|
900
|
+
// A failed turn typically leaves a trailing `session_state_changed: idle`
|
|
901
|
+
// (and possibly more) in the query iterator. If we don't drain it here,
|
|
902
|
+
// the next prompt's first `query.next()` consumes that stale idle and
|
|
903
|
+
// short-circuits to end_turn with zero usage
|
|
904
|
+
// Bounded so a misbehaving SDK can't hang the next prompt indefinitely.
|
|
905
|
+
try {
|
|
906
|
+
await session.query.interrupt();
|
|
907
|
+
const MAX_DRAIN = 100;
|
|
908
|
+
for (let i = 0; i < MAX_DRAIN; i++) {
|
|
909
|
+
const { value: m, done } = await session.query.next();
|
|
910
|
+
if (done || !m)
|
|
911
|
+
break;
|
|
912
|
+
if (m.type === "system" && m.subtype === "session_state_changed" && m.state === "idle") {
|
|
913
|
+
break;
|
|
914
|
+
}
|
|
915
|
+
if (i === MAX_DRAIN - 1) {
|
|
916
|
+
this.logger.error(`Session ${params.sessionId}: drained ${MAX_DRAIN} messages after error without observing idle`);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
catch (drainErr) {
|
|
921
|
+
this.logger.error(`Session ${params.sessionId}: failed to drain query after prompt error:`, drainErr);
|
|
922
|
+
}
|
|
830
923
|
if (error instanceof RequestError || !(error instanceof Error)) {
|
|
831
924
|
throw error;
|
|
832
925
|
}
|
|
@@ -847,10 +940,20 @@ export class ClaudeAcpAgent {
|
|
|
847
940
|
finally {
|
|
848
941
|
if (!handedOff) {
|
|
849
942
|
session.promptRunning = false;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
943
|
+
if (errored) {
|
|
944
|
+
// The query stream was just drained — handing pending prompts off
|
|
945
|
+
// onto it would let them race with the recovery. Cancel them so
|
|
946
|
+
// each waiting prompt() returns stopReason: "cancelled" and the
|
|
947
|
+
// client can decide whether to retry.
|
|
948
|
+
for (const pending of session.pendingMessages.values()) {
|
|
949
|
+
pending.resolve(true);
|
|
950
|
+
}
|
|
951
|
+
session.pendingMessages.clear();
|
|
952
|
+
}
|
|
953
|
+
else if (session.pendingMessages.size > 0) {
|
|
954
|
+
// This usually should not happen, but in case the loop finishes
|
|
955
|
+
// without claude sending all message replays, we resolve the
|
|
956
|
+
// next pending prompt call to ensure no prompts get stuck.
|
|
854
957
|
const next = [...session.pendingMessages.entries()].sort((a, b) => a[1].order - b[1].order)[0];
|
|
855
958
|
if (next) {
|
|
856
959
|
next[1].resolve(false);
|
|
@@ -1264,7 +1367,7 @@ export class ClaudeAcpAgent {
|
|
|
1264
1367
|
const newEffort = typeof newEffortOpt?.currentValue === "string" ? newEffortOpt.currentValue : undefined;
|
|
1265
1368
|
if (newEffort !== currentEffort) {
|
|
1266
1369
|
await session.query.applyFlagSettings({
|
|
1267
|
-
effortLevel: newEffort,
|
|
1370
|
+
effortLevel: toSdkEffortLevel(newEffort),
|
|
1268
1371
|
});
|
|
1269
1372
|
}
|
|
1270
1373
|
// Emit current_mode_update only after session.modes AND
|
|
@@ -1287,7 +1390,7 @@ export class ClaudeAcpAgent {
|
|
|
1287
1390
|
session.configOptions = session.configOptions.map((o) => o.id === configId && typeof o.currentValue === "string" ? { ...o, currentValue: value } : o);
|
|
1288
1391
|
if (configId === "effort") {
|
|
1289
1392
|
await session.query.applyFlagSettings({
|
|
1290
|
-
effortLevel: value,
|
|
1393
|
+
effortLevel: toSdkEffortLevel(value),
|
|
1291
1394
|
});
|
|
1292
1395
|
}
|
|
1293
1396
|
}
|
|
@@ -1545,11 +1648,6 @@ export class ClaudeAcpAgent {
|
|
|
1545
1648
|
}
|
|
1546
1649
|
throw error;
|
|
1547
1650
|
}
|
|
1548
|
-
if (shouldHideClaudeAuth() &&
|
|
1549
|
-
initializationResult.account.subscriptionType &&
|
|
1550
|
-
!this.gatewayAuthRequest) {
|
|
1551
|
-
throw RequestError.authRequired(undefined, "This integration does not support using claude.ai subscriptions.");
|
|
1552
|
-
}
|
|
1553
1651
|
// Apply user's `availableModels` allowlist from settings.json before any
|
|
1554
1652
|
// downstream model handling. The SDK only enforces this allowlist in its
|
|
1555
1653
|
// own UI, not in `initializationResult.models`, so we filter here to keep
|
|
@@ -1559,7 +1657,7 @@ export class ClaudeAcpAgent {
|
|
|
1559
1657
|
const allowedModels = Array.isArray(settingsAvailableModels)
|
|
1560
1658
|
? applyAvailableModelsAllowlist(initializationResult.models, settingsAvailableModels)
|
|
1561
1659
|
: initializationResult.models;
|
|
1562
|
-
const models = await getAvailableModels(q, allowedModels, settingsManager, this.logger);
|
|
1660
|
+
const models = await getAvailableModels(q, allowedModels, initializationResult.models, settingsManager, this.logger);
|
|
1563
1661
|
// Gate `auto` (and future model-specific modes) on the resolved model's
|
|
1564
1662
|
// `ModelInfo`. See `buildAvailableModes` for the canonical SDK signal.
|
|
1565
1663
|
const currentModelInfo = allowedModels.find((m) => m.value === models.currentModelId);
|
|
@@ -1598,7 +1696,9 @@ export class ClaudeAcpAgent {
|
|
|
1598
1696
|
const configOptions = buildConfigOptions(modes, models, allowedModels, settingsManager.getSettings().effortLevel);
|
|
1599
1697
|
// Apply the initial effort level to the SDK so it matches the UI default
|
|
1600
1698
|
const initialEffort = configOptions.find((o) => o.id === "effort");
|
|
1601
|
-
if (initialEffort &&
|
|
1699
|
+
if (initialEffort &&
|
|
1700
|
+
typeof initialEffort.currentValue === "string" &&
|
|
1701
|
+
initialEffort.currentValue !== "default") {
|
|
1602
1702
|
await q.applyFlagSettings({
|
|
1603
1703
|
effortLevel: initialEffort.currentValue,
|
|
1604
1704
|
});
|
|
@@ -1759,6 +1859,15 @@ function buildAvailableModes(modelInfo) {
|
|
|
1759
1859
|
}
|
|
1760
1860
|
return modes;
|
|
1761
1861
|
}
|
|
1862
|
+
// Translate a UI effort value into the flag-layer payload. The SDK
|
|
1863
|
+
// shallow-merges `applyFlagSettings`, drops `undefined` during JSON transport,
|
|
1864
|
+
// and only clears a key when an explicit `null` is sent — see
|
|
1865
|
+
// `applyFlagSettings` in @anthropic-ai/claude-agent-sdk. Mapping both the
|
|
1866
|
+
// `"default"` sentinel and `undefined` (effort option absent for the model) to
|
|
1867
|
+
// `null` ensures any previously-applied flag is actually cleared.
|
|
1868
|
+
function toSdkEffortLevel(value) {
|
|
1869
|
+
return value === undefined || value === "default" ? null : value;
|
|
1870
|
+
}
|
|
1762
1871
|
function buildConfigOptions(modes, models, modelInfos, currentEffortLevel) {
|
|
1763
1872
|
const options = [
|
|
1764
1873
|
{
|
|
@@ -1794,23 +1903,18 @@ function buildConfigOptions(modes, models, modelInfos, currentEffortLevel) {
|
|
|
1794
1903
|
? (currentModelInfo.supportedEffortLevels ?? [])
|
|
1795
1904
|
: [];
|
|
1796
1905
|
if (supportedLevels.length > 0) {
|
|
1797
|
-
const effortOptions =
|
|
1798
|
-
value:
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
const
|
|
1808
|
-
|
|
1809
|
-
: includes("xhigh")
|
|
1810
|
-
? "xhigh"
|
|
1811
|
-
: includes("high")
|
|
1812
|
-
? "high"
|
|
1813
|
-
: supportedLevels[0];
|
|
1906
|
+
const effortOptions = [
|
|
1907
|
+
{ value: "default", name: "Default" },
|
|
1908
|
+
...supportedLevels.map((level) => ({
|
|
1909
|
+
value: level,
|
|
1910
|
+
name: level
|
|
1911
|
+
.split(/[_-]/)
|
|
1912
|
+
.map((part) => (part ? part.charAt(0).toUpperCase() + part.slice(1) : part))
|
|
1913
|
+
.join(" "),
|
|
1914
|
+
})),
|
|
1915
|
+
];
|
|
1916
|
+
const includes = (l) => l === "default" || supportedLevels.includes(l);
|
|
1917
|
+
const validEffort = currentEffortLevel && includes(currentEffortLevel) ? currentEffortLevel : "default";
|
|
1814
1918
|
options.push({
|
|
1815
1919
|
id: "effort",
|
|
1816
1920
|
name: "Effort",
|
|
@@ -1826,6 +1930,25 @@ function buildConfigOptions(modes, models, modelInfos, currentEffortLevel) {
|
|
|
1826
1930
|
// Claude Code CLI persists display strings like "opus[1m]" in settings,
|
|
1827
1931
|
// but the SDK model list uses IDs like "claude-opus-4-6-1m".
|
|
1828
1932
|
const MODEL_CONTEXT_HINT_PATTERN = /\[(\d+m)\]$/i;
|
|
1933
|
+
// Captures a model family version such as `4-6` or `4.7` so we can keep
|
|
1934
|
+
// `claude-opus-4-6` from being copied onto the SDK's `opus` alias when that
|
|
1935
|
+
// alias currently resolves to a different family version (e.g. Opus 4.7).
|
|
1936
|
+
const MODEL_FAMILY_VERSION_PATTERN = /\b(\d+)[-.](\d+)\b/;
|
|
1937
|
+
function extractModelFamilyVersion(s) {
|
|
1938
|
+
const match = s.match(MODEL_FAMILY_VERSION_PATTERN);
|
|
1939
|
+
return match ? `${match[1]}.${match[2]}` : null;
|
|
1940
|
+
}
|
|
1941
|
+
function modelVersionsCompatible(preference, candidate) {
|
|
1942
|
+
const preferred = extractModelFamilyVersion(preference);
|
|
1943
|
+
if (!preferred)
|
|
1944
|
+
return true;
|
|
1945
|
+
const candidateVersion = extractModelFamilyVersion(candidate.value) ??
|
|
1946
|
+
extractModelFamilyVersion(candidate.displayName) ??
|
|
1947
|
+
extractModelFamilyVersion(candidate.description);
|
|
1948
|
+
if (!candidateVersion)
|
|
1949
|
+
return true;
|
|
1950
|
+
return preferred === candidateVersion;
|
|
1951
|
+
}
|
|
1829
1952
|
function tokenizeModelPreference(model) {
|
|
1830
1953
|
const lower = model.trim().toLowerCase();
|
|
1831
1954
|
const contextHint = lower.match(MODEL_CONTEXT_HINT_PATTERN)?.[1]?.toLowerCase();
|
|
@@ -1866,6 +1989,8 @@ function resolveModelPreference(models, preference) {
|
|
|
1866
1989
|
return directMatch;
|
|
1867
1990
|
// Substring match
|
|
1868
1991
|
const includesMatch = models.find((model) => {
|
|
1992
|
+
if (!modelVersionsCompatible(trimmed, model))
|
|
1993
|
+
return false;
|
|
1869
1994
|
const value = model.value.toLowerCase();
|
|
1870
1995
|
const display = model.displayName.toLowerCase();
|
|
1871
1996
|
return value.includes(lower) || display.includes(lower) || lower.includes(value);
|
|
@@ -1879,6 +2004,8 @@ function resolveModelPreference(models, preference) {
|
|
|
1879
2004
|
let bestMatch = null;
|
|
1880
2005
|
let bestScore = 0;
|
|
1881
2006
|
for (const model of models) {
|
|
2007
|
+
if (!modelVersionsCompatible(trimmed, model))
|
|
2008
|
+
continue;
|
|
1882
2009
|
const score = scoreModelMatch(model, tokens, contextHint);
|
|
1883
2010
|
if (0 < score && (!bestMatch || bestScore < score)) {
|
|
1884
2011
|
bestMatch = model;
|
|
@@ -1941,9 +2068,10 @@ function applyAvailableModelsAllowlist(sdkModels, allowlist) {
|
|
|
1941
2068
|
}
|
|
1942
2069
|
return result;
|
|
1943
2070
|
}
|
|
1944
|
-
async function getAvailableModels(query, models, settingsManager, logger) {
|
|
2071
|
+
async function getAvailableModels(query, models, sdkModels, settingsManager, logger) {
|
|
1945
2072
|
const settings = settingsManager.getSettings();
|
|
1946
2073
|
let currentModel = models[0];
|
|
2074
|
+
let resolvedFromInput;
|
|
1947
2075
|
// Model priority (highest to lowest):
|
|
1948
2076
|
// 1. ANTHROPIC_MODEL environment variable
|
|
1949
2077
|
// 2. settings.model (user configuration)
|
|
@@ -1952,15 +2080,32 @@ async function getAvailableModels(query, models, settingsManager, logger) {
|
|
|
1952
2080
|
const match = resolveModelPreference(models, process.env.ANTHROPIC_MODEL);
|
|
1953
2081
|
if (match) {
|
|
1954
2082
|
currentModel = match;
|
|
2083
|
+
resolvedFromInput = process.env.ANTHROPIC_MODEL;
|
|
1955
2084
|
}
|
|
1956
2085
|
}
|
|
1957
|
-
else {
|
|
2086
|
+
else if (typeof settings.model === "string") {
|
|
1958
2087
|
const match = resolveSettingsModel(models, settings.model, logger);
|
|
1959
2088
|
if (match) {
|
|
1960
2089
|
currentModel = match;
|
|
1961
|
-
|
|
2090
|
+
resolvedFromInput = settings.model;
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
// Skip the setModel round-trip when we can prove the SDK has already landed
|
|
2094
|
+
// on the same model. Two cases qualify:
|
|
2095
|
+
// (a) No override applied — currentModel stayed at models[0]; the SDK is on
|
|
2096
|
+
// its own default and we have nothing to sync.
|
|
2097
|
+
// (b) The resolver returned the user's input verbatim AND that value exists
|
|
2098
|
+
// in the SDK's original model list — meaning no fuzzy match or
|
|
2099
|
+
// allowlist rewrite was involved, and the SDK (which reads the same
|
|
2100
|
+
// ANTHROPIC_MODEL / settings.json) will have arrived at the same entry.
|
|
2101
|
+
// Anything else (fuzzy match, allowlist-synthesized value, alias) gets a
|
|
2102
|
+
// setModel call so we don't drift from the user's intended pin.
|
|
2103
|
+
const sdkSawSameValue = sdkModels.some((m) => m.value === currentModel.value);
|
|
2104
|
+
const skipSetModel = resolvedFromInput === undefined ||
|
|
2105
|
+
(currentModel.value === resolvedFromInput && sdkSawSameValue);
|
|
2106
|
+
if (!skipSetModel) {
|
|
2107
|
+
await query.setModel(currentModel.value);
|
|
1962
2108
|
}
|
|
1963
|
-
await query.setModel(currentModel.value);
|
|
1964
2109
|
return {
|
|
1965
2110
|
availableModels: models.map((model) => ({
|
|
1966
2111
|
modelId: model.value,
|
|
@@ -1972,6 +2117,7 @@ async function getAvailableModels(query, models, settingsManager, logger) {
|
|
|
1972
2117
|
}
|
|
1973
2118
|
function getAvailableSlashCommands(commands) {
|
|
1974
2119
|
const UNSUPPORTED_COMMANDS = [
|
|
2120
|
+
"clear",
|
|
1975
2121
|
"cost",
|
|
1976
2122
|
"keybindings-help",
|
|
1977
2123
|
"login",
|
|
@@ -2351,6 +2497,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
|
|
|
2351
2497
|
case "compaction":
|
|
2352
2498
|
case "compaction_delta":
|
|
2353
2499
|
case "advisor_tool_result":
|
|
2500
|
+
case "mid_conv_system":
|
|
2354
2501
|
break;
|
|
2355
2502
|
default:
|
|
2356
2503
|
unreachable(chunk, logger);
|
|
@@ -2388,7 +2535,11 @@ export function streamEventToAcpNotifications(message, sessionId, toolUseCache,
|
|
|
2388
2535
|
cwd: options?.cwd,
|
|
2389
2536
|
taskState: options?.taskState,
|
|
2390
2537
|
});
|
|
2391
|
-
// No content
|
|
2538
|
+
// No content. `ping` is a Messages-API keep-alive event that the SDK's
|
|
2539
|
+
// `BetaRawMessageStreamEvent` union doesn't include even though the
|
|
2540
|
+
// wire format emits it; the `as never` cast lets us no-op it here
|
|
2541
|
+
// instead of letting it fall through to `unreachable`.
|
|
2542
|
+
case "ping":
|
|
2392
2543
|
case "message_start":
|
|
2393
2544
|
case "message_delta":
|
|
2394
2545
|
case "message_stop":
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.38.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.22.
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
63
|
+
"@agentclientprotocol/sdk": "0.22.1",
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.154",
|
|
65
65
|
"zod": "^3.25.0 || ^4.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@anthropic-ai/sdk": "0.
|
|
68
|
+
"@anthropic-ai/sdk": "0.100.0",
|
|
69
69
|
"@eslint/js": "10.0.1",
|
|
70
|
-
"@types/node": "25.
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
72
|
-
"@typescript-eslint/parser": "8.
|
|
70
|
+
"@types/node": "25.9.1",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "8.60.0",
|
|
72
|
+
"@typescript-eslint/parser": "8.60.0",
|
|
73
73
|
"eslint": "10.4.0",
|
|
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.7"
|
|
80
80
|
}
|
|
81
81
|
}
|