@agentclientprotocol/claude-agent-acp 0.56.0 → 0.58.1
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 +26 -2
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +275 -53
- package/dist/elicitation.d.ts +6 -3
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +46 -44
- package/package.json +6 -6
package/dist/acp-agent.d.ts
CHANGED
|
@@ -66,8 +66,11 @@ type Session = {
|
|
|
66
66
|
* the SDK still runs it and emits a result with no uuid we can match. Because
|
|
67
67
|
* the SDK processes input FIFO, those orphan results arrive (in submission
|
|
68
68
|
* order) before the next live turn's, so skipping exactly this many leaves
|
|
69
|
-
* the genuine head untouched.
|
|
70
|
-
*
|
|
69
|
+
* the genuine head untouched. On CLIs with the interrupt receipt, orphans
|
|
70
|
+
* the interrupt dropped (absent from `still_queued`) are uncounted as soon
|
|
71
|
+
* as the receipt arrives (see cancel()). Reset to 0 on every activation as
|
|
72
|
+
* a backstop against a dropped queued input this can't see (older CLIs, a
|
|
73
|
+
* receipt lost to a failed control round-trip). */
|
|
71
74
|
pendingOrphanResults?: number;
|
|
72
75
|
/** The long-lived consumer task. Lazily started on the first `prompt()` and
|
|
73
76
|
* kept alive for the session so between-turn/background messages are still
|
|
@@ -489,6 +492,27 @@ export type FastModeOptionState = {
|
|
|
489
492
|
};
|
|
490
493
|
export declare function buildConfigOptions(modes: SessionModeState, models: SessionModelState, modelInfos: ModelInfo[], currentEffortLevel?: string, agents?: AgentInfo[], currentAgent?: string, fastMode?: FastModeOptionState): SessionConfigOption[];
|
|
491
494
|
export declare function resolveModelPreference(models: ModelInfo[], preference: string): ModelInfo | null;
|
|
495
|
+
/** Map the live model reported by a resumed session onto the picker's model
|
|
496
|
+
* list. The CLI restores a resumed session's model from the transcript's
|
|
497
|
+
* last assistant message, which records the concrete API id (e.g.
|
|
498
|
+
* "claude-opus-4-6") with any "[1m]" context hint dropped. Tiers, in order:
|
|
499
|
+
* 1. Exact match with the Default entry's resolution — when a named alias
|
|
500
|
+
* shares Default's resolvedModel verbatim, the live id can't tell the
|
|
501
|
+
* two apart, and a never-customized session should stay on Default.
|
|
502
|
+
* 2. Exact resolvedModel match on a named row. Checked before the
|
|
503
|
+
* hint-stripped Default comparison so a live "claude-sonnet-5[1m]" lands
|
|
504
|
+
* on the "sonnet[1m]" row rather than a Default that resolves to the
|
|
505
|
+
* bare "claude-sonnet-5" — the two rows differ in context window, which
|
|
506
|
+
* drives `contextWindowSize` and capability gating downstream.
|
|
507
|
+
* 3. Hint-stripped match with Default's resolution — a session that never
|
|
508
|
+
* left the default resumes as the bare transcript id, and shouldn't show
|
|
509
|
+
* a concrete picker entry.
|
|
510
|
+
* 4. `resolveModelPreference` over the picker entries.
|
|
511
|
+
* 5. A model with no picker counterpart (e.g. excluded by an
|
|
512
|
+
* `availableModels` allowlist) is tracked verbatim, mirroring
|
|
513
|
+
* `syncModelAfterRefusalFallback`: the picker shows no selection, but the
|
|
514
|
+
* model-dependent bookkeeping stays truthful to what the SDK is running. */
|
|
515
|
+
export declare function matchResumedModel(models: ModelInfo[], liveModel: string): ModelInfo;
|
|
492
516
|
/**
|
|
493
517
|
* Restrict the SDK's model list to the user's `availableModels` allowlist
|
|
494
518
|
* (already merged-and-deduped across settings sources by `SettingsManager`).
|
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,EAGL,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAGb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CAAC,CAAC;IAM/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,mBAAmB,EAAE,CAuSvB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,0BAA0B,EACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,SAAS,EACjB,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;IACtB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,mBAAmB,EAAE,CAoDvB;AAED;;;;;;;;;;;oEAWoE;AACpE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,EAC3D,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CAczB;AAED,wBAAgB,MAAM;;;EAqCrB"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -838,7 +838,7 @@ export class ClaudeAcpAgent {
|
|
|
838
838
|
if (session.activeTurn && !session.activeTurn.settled) {
|
|
839
839
|
session.pendingOrphanResults = (session.pendingOrphanResults ?? 0) + 1;
|
|
840
840
|
}
|
|
841
|
-
settleActive({ stopReason: "cancelled" });
|
|
841
|
+
settleActive({ stopReason: "cancelled", usage: sessionUsage(session) });
|
|
842
842
|
// If the session is being torn down, abandon the in-flight next()
|
|
843
843
|
// (swallowing any later rejection so it can't surface as unhandled)
|
|
844
844
|
// and stop; otherwise re-arm and keep consuming — `pendingNext`
|
|
@@ -863,9 +863,10 @@ export class ClaudeAcpAgent {
|
|
|
863
863
|
//
|
|
864
864
|
// Settle the turn that was in flight so its prompt() doesn't hang:
|
|
865
865
|
// cancelled if a cancel is pending, otherwise the accumulated outcome.
|
|
866
|
-
settleActive(
|
|
867
|
-
|
|
868
|
-
|
|
866
|
+
settleActive({
|
|
867
|
+
stopReason: session.cancelled ? "cancelled" : stopReason,
|
|
868
|
+
usage: sessionUsage(session),
|
|
869
|
+
});
|
|
869
870
|
// Queued turns the SDK never started never ran, so reject them rather
|
|
870
871
|
// than reporting a success (end_turn) — or a misleading "cancelled" —
|
|
871
872
|
// for a prompt that produced no output. (A cancel already settled the
|
|
@@ -1008,8 +1009,14 @@ export class ClaudeAcpAgent {
|
|
|
1008
1009
|
// the turn NOW so its session/prompt gets a terminal
|
|
1009
1010
|
// response, instead of leaving it hanging until the next
|
|
1010
1011
|
// prompt drains the wreckage.
|
|
1012
|
+
// A cancelled turn still consumed tokens: its dropped result
|
|
1013
|
+
// already fed the accumulator (the usage tally at the result
|
|
1014
|
+
// handler runs before the `session.cancelled` guard), so
|
|
1015
|
+
// report it — clients metering spend would otherwise lose
|
|
1016
|
+
// the interrupted turn's tokens entirely (issue #844). Zero
|
|
1017
|
+
// when the cancel pre-empted the result (wedge/force-cancel).
|
|
1011
1018
|
if (session.cancelled && session.activeTurn && !session.activeTurn.settled) {
|
|
1012
|
-
settleActive({ stopReason: "cancelled" });
|
|
1019
|
+
settleActive({ stopReason: "cancelled", usage: sessionUsage(session) });
|
|
1013
1020
|
}
|
|
1014
1021
|
else if (owedTrailingIdles > 0) {
|
|
1015
1022
|
// Absorb a settled turn's trailing idle. Also covers a
|
|
@@ -1247,6 +1254,15 @@ export class ClaudeAcpAgent {
|
|
|
1247
1254
|
lastRefusalExplanation = message.api_refusal_explanation ?? message.content;
|
|
1248
1255
|
}
|
|
1249
1256
|
break;
|
|
1257
|
+
// `control_request_progress` only reports on side_question
|
|
1258
|
+
// control requests, which this adapter never issues.
|
|
1259
|
+
// `background_tasks_changed` is a level signal (the full live
|
|
1260
|
+
// background-task set on every membership change) for surfaces
|
|
1261
|
+
// that render a background-activity indicator; turn lifecycle
|
|
1262
|
+
// here is driven by results/idle, so there is nothing to track.
|
|
1263
|
+
case "control_request_progress":
|
|
1264
|
+
case "background_tasks_changed":
|
|
1265
|
+
break;
|
|
1250
1266
|
default:
|
|
1251
1267
|
unreachable(message, this.logger);
|
|
1252
1268
|
break;
|
|
@@ -1468,7 +1484,7 @@ export class ClaudeAcpAgent {
|
|
|
1468
1484
|
// create a block the consolidated handler's `text.length > 0`
|
|
1469
1485
|
// guard can never consume, stalling the diff cursor and
|
|
1470
1486
|
// re-emitting the next block as a duplicate.
|
|
1471
|
-
if (chunk
|
|
1487
|
+
if (chunk?.text) {
|
|
1472
1488
|
const index = message.event.index;
|
|
1473
1489
|
const last = streamedBlocks[streamedBlocks.length - 1];
|
|
1474
1490
|
if (last && last.index === index && last.type === chunk.type) {
|
|
@@ -1573,7 +1589,9 @@ export class ClaudeAcpAgent {
|
|
|
1573
1589
|
// as the freshly-activated turn ending without a result
|
|
1574
1590
|
// (which would false-fail a healthy turn — issue #825).
|
|
1575
1591
|
owedTrailingIdles++;
|
|
1576
|
-
|
|
1592
|
+
// Before activateTurn resets the accumulator, so the
|
|
1593
|
+
// usage still belongs to the cancelled turn.
|
|
1594
|
+
settleActive({ stopReason: "cancelled", usage: sessionUsage(session) });
|
|
1577
1595
|
}
|
|
1578
1596
|
else {
|
|
1579
1597
|
settleActive({ stopReason: "end_turn", usage: sessionUsage(session) });
|
|
@@ -1782,13 +1800,10 @@ export class ClaudeAcpAgent {
|
|
|
1782
1800
|
// `conversation_reset` (from `/clear`, plan-mode exit, fresh-session
|
|
1783
1801
|
// flows) is safe to drop: turn lifecycle here is driven by
|
|
1784
1802
|
// results/idle, and the client owns its own transcript view.
|
|
1785
|
-
// `control_request_progress` only reports on side_question control
|
|
1786
|
-
// requests, which this adapter never issues.
|
|
1787
1803
|
case "tool_use_summary":
|
|
1788
1804
|
case "auth_status":
|
|
1789
1805
|
case "prompt_suggestion":
|
|
1790
1806
|
case "conversation_reset":
|
|
1791
|
-
case "control_request_progress":
|
|
1792
1807
|
break;
|
|
1793
1808
|
default:
|
|
1794
1809
|
unreachable(message);
|
|
@@ -1845,20 +1860,22 @@ export class ClaudeAcpAgent {
|
|
|
1845
1860
|
// they have no in-flight SDK work to interrupt. The active turn is settled
|
|
1846
1861
|
// by the consumer when it observes the interrupt's trailing idle (or via the
|
|
1847
1862
|
// backstop below). Mirrors the old pendingMessages cancellation.
|
|
1863
|
+
const orphanedUuids = [];
|
|
1848
1864
|
if (session.turnQueue) {
|
|
1849
|
-
let orphaned = 0;
|
|
1850
1865
|
for (const turn of session.turnQueue) {
|
|
1851
1866
|
if (turn !== session.activeTurn && !turn.settled) {
|
|
1852
1867
|
turn.settled = true;
|
|
1868
|
+
// Deliberately no `usage`: a queued turn never ran, so the session
|
|
1869
|
+
// accumulator (the active turn's tally) is not its spend.
|
|
1853
1870
|
turn.resolve({ stopReason: "cancelled" });
|
|
1854
|
-
|
|
1871
|
+
orphanedUuids.push(turn.promptUuid);
|
|
1855
1872
|
}
|
|
1856
1873
|
}
|
|
1857
1874
|
// Each removed queued turn's user message was already pushed to the SDK,
|
|
1858
1875
|
// which processes input FIFO and will still emit a result for it with no
|
|
1859
1876
|
// uuid to match. Count those so the consumer skips them (see
|
|
1860
1877
|
// ensureActiveTurn) rather than misattributing them to the head.
|
|
1861
|
-
session.pendingOrphanResults = (session.pendingOrphanResults ?? 0) +
|
|
1878
|
+
session.pendingOrphanResults = (session.pendingOrphanResults ?? 0) + orphanedUuids.length;
|
|
1862
1879
|
session.turnQueue = session.turnQueue.filter((turn) => turn === session.activeTurn && !turn.settled);
|
|
1863
1880
|
}
|
|
1864
1881
|
// Arm a backstop before interrupting: if a turn is actively consuming the
|
|
@@ -1882,7 +1899,29 @@ export class ClaudeAcpAgent {
|
|
|
1882
1899
|
cancelController.abort();
|
|
1883
1900
|
}, this.forceCancelGraceMs);
|
|
1884
1901
|
}
|
|
1885
|
-
await session.query.interrupt();
|
|
1902
|
+
const receipt = await session.query.interrupt();
|
|
1903
|
+
// On CLIs advertising `interrupt_receipt_v1`, the receipt's `still_queued`
|
|
1904
|
+
// lists exactly which queued messages survive the interrupt and will still
|
|
1905
|
+
// run. An orphaned turn whose uuid is absent was dropped by the interrupt
|
|
1906
|
+
// and will never emit a result — uncount it now instead of leaving a stale
|
|
1907
|
+
// skip that activateTurn's reset only clears once a later live ECHO
|
|
1908
|
+
// arrives: an echo-less result in between (a local-only command like
|
|
1909
|
+
// `/context`) would be wrongly swallowed by the leftover count. Subtracting
|
|
1910
|
+
// a count (rather than tracking uuids) stays race-safe against the
|
|
1911
|
+
// consumer draining concurrently: dropped uuids produce no results, so the
|
|
1912
|
+
// consumer's decrements only ever consume the still-queued share. Unknown
|
|
1913
|
+
// uuids in the receipt (internally-enqueued messages) are ignored, per its
|
|
1914
|
+
// contract. Older CLIs resolve `undefined` (guard the FIELD, not just the
|
|
1915
|
+
// receipt, so a bare `{}` success from a gateway can't read as "everything
|
|
1916
|
+
// was dropped") — keep the count-everything behavior and its
|
|
1917
|
+
// activation-time self-heal.
|
|
1918
|
+
if (Array.isArray(receipt?.still_queued) && orphanedUuids.length > 0) {
|
|
1919
|
+
const stillQueued = new Set(receipt.still_queued);
|
|
1920
|
+
const dropped = orphanedUuids.filter((uuid) => !stillQueued.has(uuid)).length;
|
|
1921
|
+
if (dropped > 0) {
|
|
1922
|
+
session.pendingOrphanResults = Math.max(0, (session.pendingOrphanResults ?? 0) - dropped);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1886
1925
|
}
|
|
1887
1926
|
/** Mark a session's SDK query stream as permanently ended and release the
|
|
1888
1927
|
* resources tied to it: drop the consumer handle, dispose the settings
|
|
@@ -2006,18 +2045,36 @@ export class ClaudeAcpAgent {
|
|
|
2006
2045
|
? option.options.flatMap((o) => ("options" in o ? o.options : [o]))
|
|
2007
2046
|
: [];
|
|
2008
2047
|
let validValue = allValues.find((o) => o.value === params.value);
|
|
2048
|
+
// The option's reported currentValue is always a valid target, even when
|
|
2049
|
+
// it has no options entry: a session running an out-of-picker model
|
|
2050
|
+
// (resumed onto an allowlist-excluded model, or a refusal fallback)
|
|
2051
|
+
// reports a currentValue that isn't selectable, and a client
|
|
2052
|
+
// round-tripping it must not get "Invalid value". It flows through the
|
|
2053
|
+
// normal apply path below — re-asserting an already-current value is
|
|
2054
|
+
// harmless and can repair SDK drift.
|
|
2055
|
+
if (!validValue && option.currentValue === params.value) {
|
|
2056
|
+
validValue = { value: params.value, name: params.value };
|
|
2057
|
+
}
|
|
2009
2058
|
// For model options, fall back to resolveModelPreference when the exact
|
|
2010
2059
|
// value doesn't match. This lets callers use human-friendly aliases like
|
|
2011
2060
|
// "opus" or "sonnet" instead of full model IDs like "claude-opus-4-6".
|
|
2061
|
+
// Resolve against session.modelInfos first: those entries carry
|
|
2062
|
+
// `resolvedModel`, so a full model id (in either hint spelling) lands on
|
|
2063
|
+
// the right row via the exact tier instead of a fuzzier one picking a
|
|
2064
|
+
// same-family sibling from a different context lane. The options-derived
|
|
2065
|
+
// list (which never carries `resolvedModel`) remains as a fallback for
|
|
2066
|
+
// resolutions that don't map back onto a selectable option (e.g. a fuzzy
|
|
2067
|
+
// hit on an out-of-picker verbatim entry).
|
|
2012
2068
|
if (!validValue && params.configId === MODEL_CONFIG_ID) {
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2069
|
+
const toOptionValue = (resolved) => resolved ? allValues.find((o) => o.value === resolved.value) : undefined;
|
|
2070
|
+
validValue = toOptionValue(resolveModelPreference(session.modelInfos, params.value));
|
|
2071
|
+
if (!validValue) {
|
|
2072
|
+
const optionInfos = allValues.map((o) => ({
|
|
2073
|
+
value: o.value,
|
|
2074
|
+
displayName: o.name,
|
|
2075
|
+
description: o.description ?? "",
|
|
2076
|
+
}));
|
|
2077
|
+
validValue = toOptionValue(resolveModelPreference(optionInfos, params.value));
|
|
2021
2078
|
}
|
|
2022
2079
|
}
|
|
2023
2080
|
if (!validValue) {
|
|
@@ -2966,10 +3023,42 @@ export class ClaudeAcpAgent {
|
|
|
2966
3023
|
const allowedModels = Array.isArray(settingsAvailableModels)
|
|
2967
3024
|
? applyAvailableModelsAllowlist(initializationResult.models, settingsAvailableModels, settingsModelOverrides)
|
|
2968
3025
|
: initializationResult.models;
|
|
2969
|
-
const models = await getAvailableModels(q, allowedModels, initializationResult.models, settingsManager, this.logger);
|
|
3026
|
+
const models = await getAvailableModels(q, allowedModels, initializationResult.models, settingsManager, this.logger, creationOpts.resume !== undefined);
|
|
2970
3027
|
// Gate `auto` (and future model-specific modes) on the resolved model's
|
|
2971
3028
|
// `ModelInfo`. See `buildAvailableModes` for the canonical SDK signal.
|
|
2972
|
-
|
|
3029
|
+
// A resumed session can be running a model outside the `availableModels`
|
|
3030
|
+
// allowlist (currentModelId is then the verbatim live id, see
|
|
3031
|
+
// `matchResumedModel`); its capabilities are still known to the SDK's
|
|
3032
|
+
// unfiltered list, so fall back to that before treating the model as
|
|
3033
|
+
// unknown — otherwise auto mode would be spuriously clamped and the
|
|
3034
|
+
// Fast-mode/Effort options hidden for a model that supports them.
|
|
3035
|
+
const allowlistedModelInfo = allowedModels.find((m) => m.value === models.currentModelId);
|
|
3036
|
+
const fallbackModelInfo = allowlistedModelInfo
|
|
3037
|
+
? undefined
|
|
3038
|
+
: (resolveModelPreference(initializationResult.models, models.currentModelId) ?? undefined);
|
|
3039
|
+
const currentModelInfo = allowlistedModelInfo ?? fallbackModelInfo;
|
|
3040
|
+
// Register the fallback-resolved capabilities under the verbatim live id
|
|
3041
|
+
// so every modelInfos consumer (buildConfigOptions' effort lookup, later
|
|
3042
|
+
// rebuilds via session.modelInfos) agrees with the gating below. The
|
|
3043
|
+
// picker options themselves come from `models.availableModels`, so this
|
|
3044
|
+
// adds no selectable entry. The spread keeps every capability flag
|
|
3045
|
+
// (current and future); the identity fields are overridden because the
|
|
3046
|
+
// fuzzy-matched sibling's resolvedModel/displayName/description can
|
|
3047
|
+
// describe a different context lane and would poison later resolvedModel
|
|
3048
|
+
// matching (syncModelAfterRefusalFallback) and context-window inference
|
|
3049
|
+
// (applyConfigOptionValue) if they traveled under this id.
|
|
3050
|
+
const modelInfos = fallbackModelInfo
|
|
3051
|
+
? [
|
|
3052
|
+
...allowedModels,
|
|
3053
|
+
{
|
|
3054
|
+
...fallbackModelInfo,
|
|
3055
|
+
value: models.currentModelId,
|
|
3056
|
+
displayName: models.currentModelId,
|
|
3057
|
+
description: "",
|
|
3058
|
+
resolvedModel: undefined,
|
|
3059
|
+
},
|
|
3060
|
+
]
|
|
3061
|
+
: allowedModels;
|
|
2973
3062
|
const availableModes = buildAvailableModes(currentModelInfo);
|
|
2974
3063
|
// Clamp `permissionMode` if the resolved session does not offer it. The
|
|
2975
3064
|
// common case is `permissions.defaultMode: "auto"` resolving to a model
|
|
@@ -3023,7 +3112,7 @@ export class ClaudeAcpAgent {
|
|
|
3023
3112
|
enabled: fastModeEnabled,
|
|
3024
3113
|
useBooleanOption: clientSupportsBooleanConfigOptions(this.clientCapabilities),
|
|
3025
3114
|
};
|
|
3026
|
-
const configOptions = buildConfigOptions(modes, models,
|
|
3115
|
+
const configOptions = buildConfigOptions(modes, models, modelInfos, settingsManager.getSettings().effortLevel, agents, currentAgent, fastMode);
|
|
3027
3116
|
// Apply the initial effort level to the SDK so it matches the UI default
|
|
3028
3117
|
const initialEffort = configOptions.find((o) => o.id === EFFORT_CONFIG_ID);
|
|
3029
3118
|
if (initialEffort &&
|
|
@@ -3048,14 +3137,20 @@ export class ClaudeAcpAgent {
|
|
|
3048
3137
|
},
|
|
3049
3138
|
modes,
|
|
3050
3139
|
models,
|
|
3051
|
-
modelInfos
|
|
3140
|
+
modelInfos,
|
|
3052
3141
|
configOptions,
|
|
3053
3142
|
agents,
|
|
3054
3143
|
currentAgent,
|
|
3055
3144
|
fastModeEnabled,
|
|
3056
3145
|
abortController,
|
|
3057
3146
|
emitRawSDKMessages: sessionMeta?.claudeCode?.emitRawSDKMessages ?? false,
|
|
3058
|
-
contextWindowSize:
|
|
3147
|
+
contextWindowSize:
|
|
3148
|
+
// Deliberately keyed to the allowlisted entry: a fallback-resolved
|
|
3149
|
+
// sibling's displayName/description can describe a different context
|
|
3150
|
+
// lane than the verbatim live id (e.g. an "opus[1m]" row matched for
|
|
3151
|
+
// a bare 200k id), so on the fallback path only the id itself is a
|
|
3152
|
+
// trustworthy window signal.
|
|
3153
|
+
inferContextWindowFromModel(models.currentModelId, allowlistedModelInfo?.displayName, allowlistedModelInfo?.description) ?? DEFAULT_CONTEXT_WINDOW,
|
|
3059
3154
|
taskState,
|
|
3060
3155
|
toolUseCache: {},
|
|
3061
3156
|
emittedToolCalls: new Set(),
|
|
@@ -3391,14 +3486,32 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
3391
3486
|
// Claude Code CLI persists display strings like "opus[1m]" in settings,
|
|
3392
3487
|
// but the SDK model list uses IDs like "claude-opus-4-6-1m".
|
|
3393
3488
|
const MODEL_CONTEXT_HINT_PATTERN = /\[(\d+m)\]$/i;
|
|
3489
|
+
// The id-suffix spelling of a context hint ("-1m" in "claude-opus-4-6-1m");
|
|
3490
|
+
// shared by the strip and canonicalize helpers below so the two can't drift.
|
|
3491
|
+
const CONTEXT_HINT_SUFFIX_PATTERN = /-(\d+m)$/i;
|
|
3492
|
+
/** Remove context-window hints — the display form "[1m]" and the SDK id
|
|
3493
|
+
* suffix form "-1m" — from a model string. Those digits describe context
|
|
3494
|
+
* size, not model identity or generation version. */
|
|
3495
|
+
function stripContextHints(s) {
|
|
3496
|
+
return s.replace(/\[\d+m\]/gi, "").replace(CONTEXT_HINT_SUFFIX_PATTERN, "");
|
|
3497
|
+
}
|
|
3498
|
+
/** Canonicalize a model id for exact comparison: trimmed, lowercased, with
|
|
3499
|
+
* the id-suffix hint spelling unified to the bracket form ("-1m" → "[1m]").
|
|
3500
|
+
* The hint itself is kept — bare and 1M ids must stay distinct. */
|
|
3501
|
+
function canonicalizeModelId(s) {
|
|
3502
|
+
return s.trim().toLowerCase().replace(CONTEXT_HINT_SUFFIX_PATTERN, "[$1]");
|
|
3503
|
+
}
|
|
3504
|
+
/** The context hint a model string carries ("1m" for either spelling), or
|
|
3505
|
+
* null for a bare id. */
|
|
3506
|
+
function contextHintOf(s) {
|
|
3507
|
+
return canonicalizeModelId(s).match(MODEL_CONTEXT_HINT_PATTERN)?.[1] ?? null;
|
|
3508
|
+
}
|
|
3394
3509
|
// Captures a model family version: `4-6`/`4.7` for dated generations, or a
|
|
3395
3510
|
// bare `5` for single-number ones like "Sonnet 5". Used to keep a pinned
|
|
3396
3511
|
// `claude-opus-4-6` from matching the `opus` alias once it points at 4.7.
|
|
3397
3512
|
const MODEL_FAMILY_VERSION_PATTERN = /\b(\d+)(?:[-.](\d+))?\b/;
|
|
3398
3513
|
function extractModelFamilyVersion(s) {
|
|
3399
|
-
|
|
3400
|
-
// size, not a model generation version.
|
|
3401
|
-
const match = s.replace(/\[\d+m\]/gi, "").match(MODEL_FAMILY_VERSION_PATTERN);
|
|
3514
|
+
const match = stripContextHints(s).match(MODEL_FAMILY_VERSION_PATTERN);
|
|
3402
3515
|
if (!match)
|
|
3403
3516
|
return null;
|
|
3404
3517
|
return match[2] ? `${match[1]}.${match[2]}` : match[1];
|
|
@@ -3451,25 +3564,38 @@ export function resolveModelPreference(models, preference) {
|
|
|
3451
3564
|
if (!trimmed)
|
|
3452
3565
|
return null;
|
|
3453
3566
|
const lower = trimmed.toLowerCase();
|
|
3454
|
-
// Exact match on value or display name
|
|
3567
|
+
// Exact match on value or display name. Values compare on the canonical
|
|
3568
|
+
// hint spelling so "opus-1m" hits an "opus[1m]" row (and vice versa).
|
|
3569
|
+
const canonicalPreference = canonicalizeModelId(trimmed);
|
|
3455
3570
|
const directMatch = models.find((model) => model.value === trimmed ||
|
|
3456
|
-
model.value
|
|
3571
|
+
canonicalizeModelId(model.value) === canonicalPreference ||
|
|
3457
3572
|
model.displayName.toLowerCase() === lower);
|
|
3458
3573
|
if (directMatch)
|
|
3459
3574
|
return directMatch;
|
|
3460
3575
|
// Exact match on the alias's canonical resolved id (e.g. a pinned
|
|
3461
3576
|
// "claude-sonnet-5" against the "sonnet" row's `resolvedModel`). SDK-
|
|
3462
3577
|
// reported and unambiguous, so it's tried before the fuzzier tiers below.
|
|
3463
|
-
//
|
|
3464
|
-
//
|
|
3465
|
-
// land on
|
|
3466
|
-
|
|
3578
|
+
// Compared on the canonical hint spelling so a "-1m"-suffix pin matches a
|
|
3579
|
+
// "[1m]"-spelled resolvedModel instead of falling into the substring tier
|
|
3580
|
+
// (which would land on the bare 200k sibling). "default" is skipped first
|
|
3581
|
+
// since it shares a resolvedModel with whichever alias the CLI currently
|
|
3582
|
+
// recommends — a specific pin should land on that named alias, not
|
|
3583
|
+
// "default".
|
|
3584
|
+
const matchesResolved = (model) => model.resolvedModel != null && canonicalizeModelId(model.resolvedModel) === canonicalPreference;
|
|
3585
|
+
const resolvedMatch = models.find((model) => model.value !== "default" && matchesResolved(model)) ??
|
|
3586
|
+
models.find(matchesResolved);
|
|
3467
3587
|
if (resolvedMatch)
|
|
3468
3588
|
return resolvedMatch;
|
|
3469
|
-
// Substring match
|
|
3589
|
+
// Substring match. Skips candidates whose context hint disagrees with the
|
|
3590
|
+
// preference's — a bare row must not absorb a 1M-hinted preference (nor
|
|
3591
|
+
// vice versa); such pairs fall through to the tokenized tier, which
|
|
3592
|
+
// weighs hints in its scoring and still finds the best same-family row.
|
|
3593
|
+
const preferenceHint = contextHintOf(trimmed);
|
|
3470
3594
|
const includesMatch = models.find((model) => {
|
|
3471
3595
|
if (!modelVersionsCompatible(trimmed, model))
|
|
3472
3596
|
return false;
|
|
3597
|
+
if (contextHintOf(model.value) !== preferenceHint)
|
|
3598
|
+
return false;
|
|
3473
3599
|
const value = model.value.toLowerCase();
|
|
3474
3600
|
const display = model.displayName.toLowerCase();
|
|
3475
3601
|
return value.includes(lower) || display.includes(lower) || lower.includes(value);
|
|
@@ -3493,6 +3619,51 @@ export function resolveModelPreference(models, preference) {
|
|
|
3493
3619
|
}
|
|
3494
3620
|
return bestMatch;
|
|
3495
3621
|
}
|
|
3622
|
+
/** Map the live model reported by a resumed session onto the picker's model
|
|
3623
|
+
* list. The CLI restores a resumed session's model from the transcript's
|
|
3624
|
+
* last assistant message, which records the concrete API id (e.g.
|
|
3625
|
+
* "claude-opus-4-6") with any "[1m]" context hint dropped. Tiers, in order:
|
|
3626
|
+
* 1. Exact match with the Default entry's resolution — when a named alias
|
|
3627
|
+
* shares Default's resolvedModel verbatim, the live id can't tell the
|
|
3628
|
+
* two apart, and a never-customized session should stay on Default.
|
|
3629
|
+
* 2. Exact resolvedModel match on a named row. Checked before the
|
|
3630
|
+
* hint-stripped Default comparison so a live "claude-sonnet-5[1m]" lands
|
|
3631
|
+
* on the "sonnet[1m]" row rather than a Default that resolves to the
|
|
3632
|
+
* bare "claude-sonnet-5" — the two rows differ in context window, which
|
|
3633
|
+
* drives `contextWindowSize` and capability gating downstream.
|
|
3634
|
+
* 3. Hint-stripped match with Default's resolution — a session that never
|
|
3635
|
+
* left the default resumes as the bare transcript id, and shouldn't show
|
|
3636
|
+
* a concrete picker entry.
|
|
3637
|
+
* 4. `resolveModelPreference` over the picker entries.
|
|
3638
|
+
* 5. A model with no picker counterpart (e.g. excluded by an
|
|
3639
|
+
* `availableModels` allowlist) is tracked verbatim, mirroring
|
|
3640
|
+
* `syncModelAfterRefusalFallback`: the picker shows no selection, but the
|
|
3641
|
+
* model-dependent bookkeeping stays truthful to what the SDK is running. */
|
|
3642
|
+
export function matchResumedModel(models, liveModel) {
|
|
3643
|
+
const live = canonicalizeModelId(liveModel);
|
|
3644
|
+
const defaultEntry = models.find((m) => m.value === "default");
|
|
3645
|
+
const defaultResolved = defaultEntry?.resolvedModel
|
|
3646
|
+
? canonicalizeModelId(defaultEntry.resolvedModel)
|
|
3647
|
+
: undefined;
|
|
3648
|
+
if (defaultEntry && defaultResolved === live) {
|
|
3649
|
+
return defaultEntry;
|
|
3650
|
+
}
|
|
3651
|
+
// No default-row exclusion needed: a default row matching `live` exactly
|
|
3652
|
+
// already returned at the tier above.
|
|
3653
|
+
const exactMatch = models.find((m) => m.resolvedModel && canonicalizeModelId(m.resolvedModel) === live);
|
|
3654
|
+
if (exactMatch)
|
|
3655
|
+
return exactMatch;
|
|
3656
|
+
if (defaultEntry &&
|
|
3657
|
+
defaultResolved &&
|
|
3658
|
+
stripContextHints(defaultResolved) === stripContextHints(live)) {
|
|
3659
|
+
return defaultEntry;
|
|
3660
|
+
}
|
|
3661
|
+
return (resolveModelPreference(models, liveModel) ?? {
|
|
3662
|
+
value: liveModel,
|
|
3663
|
+
displayName: liveModel,
|
|
3664
|
+
description: "",
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3496
3667
|
function resolveSettingsModel(models, settingsModel, logger) {
|
|
3497
3668
|
if (settingsModel === undefined) {
|
|
3498
3669
|
return null;
|
|
@@ -3572,14 +3743,30 @@ export function applyAvailableModelsAllowlist(sdkModels, allowlist, settingsMode
|
|
|
3572
3743
|
}
|
|
3573
3744
|
return result;
|
|
3574
3745
|
}
|
|
3575
|
-
|
|
3746
|
+
/** Read the model a resumed session is actually running (via the
|
|
3747
|
+
* `getContextUsage` control request — the same source `/context` prints) and
|
|
3748
|
+
* map it onto the picker. Best-effort: a control-request failure is logged
|
|
3749
|
+
* and returns null so callers keep their current choice; failing the whole
|
|
3750
|
+
* session/load over an unreadable report would be worse. */
|
|
3751
|
+
async function readResumedLiveModel(query, models, logger) {
|
|
3752
|
+
try {
|
|
3753
|
+
const liveModel = (await query.getContextUsage()).model;
|
|
3754
|
+
return liveModel ? matchResumedModel(models, liveModel) : null;
|
|
3755
|
+
}
|
|
3756
|
+
catch (error) {
|
|
3757
|
+
logger.error("Failed to read the resumed session's live model:", error);
|
|
3758
|
+
return null;
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
async function getAvailableModels(query, models, sdkModels, settingsManager, logger, isResumedSession) {
|
|
3576
3762
|
const settings = settingsManager.getSettings();
|
|
3577
3763
|
let currentModel = models[0];
|
|
3578
3764
|
let resolvedFromInput;
|
|
3579
3765
|
// Model priority (highest to lowest):
|
|
3580
3766
|
// 1. ANTHROPIC_MODEL environment variable
|
|
3581
3767
|
// 2. settings.model (user configuration)
|
|
3582
|
-
// 3.
|
|
3768
|
+
// 3. the resumed session's live model (resumed sessions only)
|
|
3769
|
+
// 4. models[0] (default first model)
|
|
3583
3770
|
if (process.env.ANTHROPIC_MODEL) {
|
|
3584
3771
|
const match = resolveModelPreference(models, process.env.ANTHROPIC_MODEL);
|
|
3585
3772
|
if (match) {
|
|
@@ -3594,21 +3781,49 @@ async function getAvailableModels(query, models, sdkModels, settingsManager, log
|
|
|
3594
3781
|
resolvedFromInput = settings.model;
|
|
3595
3782
|
}
|
|
3596
3783
|
}
|
|
3784
|
+
// A resumed session restores the model it was previously running (the CLI
|
|
3785
|
+
// re-reads it from the transcript), so without an env/settings override the
|
|
3786
|
+
// freshly-computed default above can disagree with what the session actually
|
|
3787
|
+
// runs — session/load then reports a model the session isn't using (issue
|
|
3788
|
+
// #845). Ask the CLI for the live model and reflect it. No `setModel` here:
|
|
3789
|
+
// the SDK is already running this model, and pushing a picker alias back
|
|
3790
|
+
// (e.g. "opus[1m]") could change the live model rather than describe it.
|
|
3791
|
+
if (resolvedFromInput === undefined && isResumedSession) {
|
|
3792
|
+
currentModel = (await readResumedLiveModel(query, models, logger)) ?? currentModel;
|
|
3793
|
+
}
|
|
3597
3794
|
// Skip the setModel round-trip when we can prove the SDK has already landed
|
|
3598
3795
|
// on the same model. Two cases qualify:
|
|
3599
|
-
// (a) No override applied — currentModel
|
|
3600
|
-
//
|
|
3796
|
+
// (a) No override applied — currentModel is the SDK's own default (or, on
|
|
3797
|
+
// resume, the live model read back from the SDK above); nothing to sync.
|
|
3601
3798
|
// (b) The resolver returned the user's input verbatim AND that value exists
|
|
3602
3799
|
// in the SDK's original model list — meaning no fuzzy match or
|
|
3603
3800
|
// allowlist rewrite was involved, and the SDK (which reads the same
|
|
3604
3801
|
// ANTHROPIC_MODEL / settings.json) will have arrived at the same entry.
|
|
3802
|
+
// This only holds for fresh sessions: a resumed session lands on the
|
|
3803
|
+
// transcript's model regardless of env/settings, so the override must
|
|
3804
|
+
// be re-asserted to keep the reported model truthful.
|
|
3605
3805
|
// Anything else (fuzzy match, allowlist-synthesized value, alias) gets a
|
|
3606
3806
|
// setModel call so we don't drift from the user's intended pin.
|
|
3607
3807
|
const sdkSawSameValue = sdkModels.some((m) => m.value === currentModel.value);
|
|
3608
3808
|
const skipSetModel = resolvedFromInput === undefined ||
|
|
3609
|
-
(currentModel.value === resolvedFromInput && sdkSawSameValue);
|
|
3809
|
+
(!isResumedSession && currentModel.value === resolvedFromInput && sdkSawSameValue);
|
|
3610
3810
|
if (!skipSetModel) {
|
|
3611
|
-
|
|
3811
|
+
try {
|
|
3812
|
+
await query.setModel(currentModel.value);
|
|
3813
|
+
}
|
|
3814
|
+
catch (error) {
|
|
3815
|
+
// On a fresh session the pin is a defining option — fail loudly. A
|
|
3816
|
+
// resumed session already runs fine on the transcript's model, so
|
|
3817
|
+
// failing the whole session/load over the re-assert would be worse
|
|
3818
|
+
// than loading with the pin unapplied (mirrors the setPermissionMode
|
|
3819
|
+
// containment in createSession). The SDK then stayed on the
|
|
3820
|
+
// transcript's model, so read that back rather than reporting the
|
|
3821
|
+
// pin the session isn't running.
|
|
3822
|
+
if (!isResumedSession)
|
|
3823
|
+
throw error;
|
|
3824
|
+
logger.error(`Failed to re-assert model "${currentModel.value}" on resume:`, error);
|
|
3825
|
+
currentModel = (await readResumedLiveModel(query, models, logger)) ?? currentModel;
|
|
3826
|
+
}
|
|
3612
3827
|
}
|
|
3613
3828
|
return {
|
|
3614
3829
|
availableModels: models.map((model) => ({
|
|
@@ -3837,6 +4052,9 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
|
|
|
3837
4052
|
const registerHooks = options?.registerHooks !== false;
|
|
3838
4053
|
const supportsTerminalOutput = options?.clientCapabilities?._meta?.["terminal_output"] === true;
|
|
3839
4054
|
if (typeof content === "string") {
|
|
4055
|
+
if (content.length === 0) {
|
|
4056
|
+
return [];
|
|
4057
|
+
}
|
|
3840
4058
|
const update = {
|
|
3841
4059
|
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
3842
4060
|
content: {
|
|
@@ -3862,15 +4080,18 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
|
|
|
3862
4080
|
let update = null;
|
|
3863
4081
|
switch (chunk.type) {
|
|
3864
4082
|
case "text":
|
|
3865
|
-
case "text_delta":
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
4083
|
+
case "text_delta": {
|
|
4084
|
+
if (chunk.text) {
|
|
4085
|
+
update = {
|
|
4086
|
+
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
4087
|
+
content: {
|
|
4088
|
+
type: "text",
|
|
4089
|
+
text: chunk.text,
|
|
4090
|
+
},
|
|
4091
|
+
};
|
|
4092
|
+
}
|
|
3873
4093
|
break;
|
|
4094
|
+
}
|
|
3874
4095
|
case "image":
|
|
3875
4096
|
update = {
|
|
3876
4097
|
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
@@ -3883,10 +4104,10 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
|
|
|
3883
4104
|
};
|
|
3884
4105
|
break;
|
|
3885
4106
|
case "thinking":
|
|
3886
|
-
case "thinking_delta":
|
|
4107
|
+
case "thinking_delta": {
|
|
3887
4108
|
// Recent models default `thinking.display` to "omitted", which streams
|
|
3888
4109
|
// signature-only thinking blocks whose text is empty.
|
|
3889
|
-
if (chunk.thinking
|
|
4110
|
+
if (chunk.thinking) {
|
|
3890
4111
|
update = {
|
|
3891
4112
|
sessionUpdate: "agent_thought_chunk",
|
|
3892
4113
|
content: {
|
|
@@ -3896,6 +4117,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
|
|
|
3896
4117
|
};
|
|
3897
4118
|
}
|
|
3898
4119
|
break;
|
|
4120
|
+
}
|
|
3899
4121
|
case "tool_use":
|
|
3900
4122
|
case "server_tool_use":
|
|
3901
4123
|
case "mcp_tool_use": {
|
package/dist/elicitation.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CreateElicitationResponse } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { CreateElicitationRequest } from "@agentclientprotocol/sdk";
|
|
2
3
|
import type { ElicitationRequest, ElicitationResult } from "@anthropic-ai/claude-agent-sdk";
|
|
3
4
|
import type { AskUserQuestionInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools.js";
|
|
4
5
|
/**
|
|
@@ -51,7 +52,8 @@ export declare function extractAskUserQuestions(input: Record<string, unknown>):
|
|
|
51
52
|
* question text, so the question text appears in exactly one place per field.
|
|
52
53
|
* Single-select questions use a titled `oneOf` enum; multi-select questions use
|
|
53
54
|
* an array with a titled `anyOf` item enum. The enum `const` is always the
|
|
54
|
-
* option label, since that is what the tool records as the answer
|
|
55
|
+
* option label, since that is what the tool records as the answer; an option's
|
|
56
|
+
* secondary text travels in the enum option's own `description` field.
|
|
55
57
|
*
|
|
56
58
|
* Each question is followed by its own optional free-text "custom answer" field
|
|
57
59
|
* (`question_<n>_custom`), mirroring the CLI's per-question "Other" box: the
|
|
@@ -76,7 +78,8 @@ export type AskUserQuestionOutcome = {
|
|
|
76
78
|
* custom-answer field (`question_<n>_custom`) takes precedence over that
|
|
77
79
|
* question's selection, since the user typed their own answer instead of
|
|
78
80
|
* picking one. Decline yields empty answers (the model is told the user skipped
|
|
79
|
-
* rather than the turn aborting); cancel
|
|
81
|
+
* rather than the turn aborting); cancel — and any custom/future action we
|
|
82
|
+
* don't understand — aborts the tool call.
|
|
80
83
|
*/
|
|
81
84
|
export declare function applyAskElicitationResponse(response: CreateElicitationResponse, toolInput: Record<string, unknown>, questions: AskUserQuestion[]): AskUserQuestionOutcome;
|
|
82
85
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,
|
|
1
|
+
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EACV,wBAAwB,EAKzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,6CAA6C,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,MAAM,GAChB,wBAAwB,GAAG,IAAI,CAyBjC;AAgBD;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,yBAAyB,GAClC,iBAAiB,CAUnB;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,EAAE,GAAG,IAAI,CAUhG;AAwBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,+BAA+B,CAC7C,SAA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
* Convert an MCP elicitation request (from the SDK's `onElicitation` callback)
|
|
4
5
|
* into an ACP `CreateElicitationRequest`. Returns `null` when the request can't
|
|
@@ -29,6 +30,17 @@ export function mcpElicitationToCreateRequest(request, sessionId) {
|
|
|
29
30
|
requestedSchema: normalizeElicitationSchema(request.requestedSchema),
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Content of an accepted elicitation response.
|
|
35
|
+
*
|
|
36
|
+
* Uses the SDK's validating guard rather than an `action === "accept"` check:
|
|
37
|
+
* the guard both narrows past the union's custom/future variant and validates
|
|
38
|
+
* the payload, so a malformed accept (right tag, ill-typed content) yields
|
|
39
|
+
* empty content — the same classification the SDK's wire validators apply.
|
|
40
|
+
*/
|
|
41
|
+
function acceptedElicitationContent(response) {
|
|
42
|
+
return CreateElicitationResponse.isAccept(response) ? (response.content ?? {}) : {};
|
|
43
|
+
}
|
|
32
44
|
/**
|
|
33
45
|
* Map an ACP elicitation response back to the MCP `ElicitResult` the SDK expects
|
|
34
46
|
* to hand back to the requesting server.
|
|
@@ -36,7 +48,7 @@ export function mcpElicitationToCreateRequest(request, sessionId) {
|
|
|
36
48
|
export function createElicitationResponseToElicitResult(response) {
|
|
37
49
|
switch (response.action) {
|
|
38
50
|
case "accept":
|
|
39
|
-
return { action: "accept", content: response
|
|
51
|
+
return { action: "accept", content: acceptedElicitationContent(response) };
|
|
40
52
|
case "decline":
|
|
41
53
|
return { action: "decline" };
|
|
42
54
|
case "cancel":
|
|
@@ -71,26 +83,12 @@ function questionCustomFieldKey(index) {
|
|
|
71
83
|
return `question_${index}_custom`;
|
|
72
84
|
}
|
|
73
85
|
/**
|
|
74
|
-
* `_meta` key under which a bridged enum option carries its
|
|
75
|
-
*
|
|
76
|
-
* Namespaced like the agent's other `_meta`
|
|
86
|
+
* `_meta` key under which a bridged enum option carries its `preview`, the one
|
|
87
|
+
* option field ACP's `EnumOption` still has no slot for (descriptions are
|
|
88
|
+
* first-class as of schema 1.19). Namespaced like the agent's other `_meta`
|
|
89
|
+
* extensions (`_claude/...`).
|
|
77
90
|
*/
|
|
78
91
|
const OPTION_META_KEY = "_claude/askUserQuestionOption";
|
|
79
|
-
/**
|
|
80
|
-
* Build the `_meta` payload that carries an option's structured `description`
|
|
81
|
-
* and optional `preview` for clients that can render them as distinct fields.
|
|
82
|
-
* Returns `undefined` when neither is present, so we don't emit an empty `_meta`.
|
|
83
|
-
*/
|
|
84
|
-
function askUserQuestionOptionMeta(option) {
|
|
85
|
-
const detail = {};
|
|
86
|
-
if (option.description) {
|
|
87
|
-
detail.description = option.description;
|
|
88
|
-
}
|
|
89
|
-
if (option.preview) {
|
|
90
|
-
detail.preview = option.preview;
|
|
91
|
-
}
|
|
92
|
-
return Object.keys(detail).length > 0 ? { [OPTION_META_KEY]: detail } : undefined;
|
|
93
|
-
}
|
|
94
92
|
/**
|
|
95
93
|
* Render the AskUserQuestion tool's questions as an ACP form elicitation.
|
|
96
94
|
*
|
|
@@ -98,7 +96,8 @@ function askUserQuestionOptionMeta(option) {
|
|
|
98
96
|
* question text, so the question text appears in exactly one place per field.
|
|
99
97
|
* Single-select questions use a titled `oneOf` enum; multi-select questions use
|
|
100
98
|
* an array with a titled `anyOf` item enum. The enum `const` is always the
|
|
101
|
-
* option label, since that is what the tool records as the answer
|
|
99
|
+
* option label, since that is what the tool records as the answer; an option's
|
|
100
|
+
* secondary text travels in the enum option's own `description` field.
|
|
102
101
|
*
|
|
103
102
|
* Each question is followed by its own optional free-text "custom answer" field
|
|
104
103
|
* (`question_<n>_custom`), mirroring the CLI's per-question "Other" box: the
|
|
@@ -113,19 +112,16 @@ export function askUserQuestionsToCreateRequest(questions, sessionId, toolCallId
|
|
|
113
112
|
const options = question.options.map((option) => {
|
|
114
113
|
const enumOption = {
|
|
115
114
|
const: option.label,
|
|
116
|
-
|
|
117
|
-
// only read `const`/`title` still surface the description. Clients that
|
|
118
|
-
// understand the `_meta` below should prefer its structured fields (and
|
|
119
|
-
// treat `const` as the clean label) rather than parsing this title.
|
|
120
|
-
title: option.description ? `${option.label} — ${option.description}` : option.label,
|
|
115
|
+
title: option.label,
|
|
121
116
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
if (option.description) {
|
|
118
|
+
enumOption.description = option.description;
|
|
119
|
+
}
|
|
120
|
+
// The SDK option's `preview` (mockups, code snippets, comparisons shown
|
|
121
|
+
// on focus) still has no structural slot in `EnumOption`, so forward it
|
|
122
|
+
// under ACP's reserved `_meta` extension point for clients that render it.
|
|
123
|
+
if (option.preview) {
|
|
124
|
+
enumOption._meta = { [OPTION_META_KEY]: { preview: option.preview } };
|
|
129
125
|
}
|
|
130
126
|
return enumOption;
|
|
131
127
|
});
|
|
@@ -165,16 +161,17 @@ export function askUserQuestionsToCreateRequest(questions, sessionId, toolCallId
|
|
|
165
161
|
* custom-answer field (`question_<n>_custom`) takes precedence over that
|
|
166
162
|
* question's selection, since the user typed their own answer instead of
|
|
167
163
|
* picking one. Decline yields empty answers (the model is told the user skipped
|
|
168
|
-
* rather than the turn aborting); cancel
|
|
164
|
+
* rather than the turn aborting); cancel — and any custom/future action we
|
|
165
|
+
* don't understand — aborts the tool call.
|
|
169
166
|
*/
|
|
170
167
|
export function applyAskElicitationResponse(response, toolInput, questions) {
|
|
171
|
-
if (response.action === "cancel") {
|
|
172
|
-
return { action: "cancel" };
|
|
173
|
-
}
|
|
174
168
|
if (response.action === "decline") {
|
|
175
169
|
return { action: "answered", updatedInput: { ...toolInput, answers: {} } };
|
|
176
170
|
}
|
|
177
|
-
|
|
171
|
+
if (response.action !== "accept") {
|
|
172
|
+
return { action: "cancel" };
|
|
173
|
+
}
|
|
174
|
+
const content = acceptedElicitationContent(response);
|
|
178
175
|
// Typed against the tool's own output schema so the answer/response shapes
|
|
179
176
|
// stay in sync with what the built-in tool's call() expects to read back.
|
|
180
177
|
const answers = {};
|
|
@@ -257,7 +254,7 @@ export function refusalFallbackToCreateRequest(prompt, sessionId) {
|
|
|
257
254
|
mode: "form",
|
|
258
255
|
sessionId,
|
|
259
256
|
message: `${prompt.originalModel} declined this request${category}. ` +
|
|
260
|
-
`Retry with ${prompt.fallbackModel}
|
|
257
|
+
`Retry with ${prompt.fallbackModel}?` +
|
|
261
258
|
guidance,
|
|
262
259
|
requestedSchema: {
|
|
263
260
|
type: "object",
|
|
@@ -265,8 +262,16 @@ export function refusalFallbackToCreateRequest(prompt, sessionId) {
|
|
|
265
262
|
[REFUSAL_FALLBACK_CHOICE_KEY]: {
|
|
266
263
|
type: "string",
|
|
267
264
|
oneOf: [
|
|
268
|
-
{
|
|
269
|
-
|
|
265
|
+
{
|
|
266
|
+
const: RETRY_FALLBACK_RESULT,
|
|
267
|
+
title: `Retry with ${prompt.fallbackModel}`,
|
|
268
|
+
description: `The session continues on ${prompt.fallbackModel}.`,
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
const: KEEP_REFUSAL_RESULT,
|
|
272
|
+
title: "Keep the refusal",
|
|
273
|
+
description: "You can send a new message.",
|
|
274
|
+
},
|
|
270
275
|
],
|
|
271
276
|
},
|
|
272
277
|
},
|
|
@@ -281,9 +286,6 @@ export function refusalFallbackToCreateRequest(prompt, sessionId) {
|
|
|
281
286
|
* switch the user didn't ask for.
|
|
282
287
|
*/
|
|
283
288
|
export function refusalFallbackResultFromResponse(response) {
|
|
284
|
-
|
|
285
|
-
return KEEP_REFUSAL_RESULT;
|
|
286
|
-
}
|
|
287
|
-
const choice = response.content?.[REFUSAL_FALLBACK_CHOICE_KEY];
|
|
289
|
+
const choice = acceptedElicitationContent(response)[REFUSAL_FALLBACK_CHOICE_KEY];
|
|
288
290
|
return choice === RETRY_FALLBACK_RESULT ? RETRY_FALLBACK_RESULT : KEEP_REFUSAL_RESULT;
|
|
289
291
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.58.1",
|
|
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",
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
"node": ">=22"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@agentclientprotocol/sdk": "1.1
|
|
67
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
66
|
+
"@agentclientprotocol/sdk": "1.2.1",
|
|
67
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.205",
|
|
68
68
|
"zod": "^3.25.0 || ^4.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@anthropic-ai/sdk": "0.110.0",
|
|
72
72
|
"@eslint/js": "10.0.1",
|
|
73
73
|
"@tsconfig/node22": "22.0.5",
|
|
74
|
-
"@types/node": "26.1.
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
76
|
-
"@typescript-eslint/parser": "8.
|
|
74
|
+
"@types/node": "26.1.1",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "8.63.0",
|
|
76
|
+
"@typescript-eslint/parser": "8.63.0",
|
|
77
77
|
"eslint": "10.6.0",
|
|
78
78
|
"eslint-config-prettier": "10.1.8",
|
|
79
79
|
"globals": "17.7.0",
|