@lucascouts/claude-agent-acp-plus 0.2.0 → 0.3.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.
@@ -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. Reset to 0 on every activation as a backstop
70
- * against an SDK that drops queued input on interrupt (no orphan emitted). */
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
@@ -563,6 +566,27 @@ export declare function buildConfigOptions(modes: SessionModeState, models: Sess
563
566
  * callers/tests) omits the row. */
564
567
  thinkingEnabled?: boolean): SessionConfigOption[];
565
568
  export declare function resolveModelPreference(models: ModelInfo[], preference: string): ModelInfo | null;
569
+ /** Map the live model reported by a resumed session onto the picker's model
570
+ * list. The CLI restores a resumed session's model from the transcript's
571
+ * last assistant message, which records the concrete API id (e.g.
572
+ * "claude-opus-4-6") with any "[1m]" context hint dropped. Tiers, in order:
573
+ * 1. Exact match with the Default entry's resolution — when a named alias
574
+ * shares Default's resolvedModel verbatim, the live id can't tell the
575
+ * two apart, and a never-customized session should stay on Default.
576
+ * 2. Exact resolvedModel match on a named row. Checked before the
577
+ * hint-stripped Default comparison so a live "claude-sonnet-5[1m]" lands
578
+ * on the "sonnet[1m]" row rather than a Default that resolves to the
579
+ * bare "claude-sonnet-5" — the two rows differ in context window, which
580
+ * drives `contextWindowSize` and capability gating downstream.
581
+ * 3. Hint-stripped match with Default's resolution — a session that never
582
+ * left the default resumes as the bare transcript id, and shouldn't show
583
+ * a concrete picker entry.
584
+ * 4. `resolveModelPreference` over the picker entries.
585
+ * 5. A model with no picker counterpart (e.g. excluded by an
586
+ * `availableModels` allowlist) is tracked verbatim, mirroring
587
+ * `syncModelAfterRefusalFallback`: the picker shows no selection, but the
588
+ * model-dependent bookkeeping stays truthful to what the SDK is running. */
589
+ export declare function matchResumedModel(models: ModelInfo[], liveModel: string): ModelInfo;
566
590
  /**
567
591
  * The exported picker-list boundary: {@link buildAllowlistedModels} (the
568
592
  * user's `availableModels` allowlist semantics — see its doc) composed with
@@ -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,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,wBAAwB,EACxB,yBAAyB,EACzB,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,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EAEV,aAAa,EAKb,SAAS,EAIT,OAAO,EACP,cAAc,EAEd,gBAAgB,EAChB,KAAK,EAKL,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO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E,SAAS,CAAC;IAOtB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,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
@@ -963,7 +963,7 @@ export class ClaudeAcpAgent {
963
963
  if (session.activeTurn && !session.activeTurn.settled) {
964
964
  session.pendingOrphanResults = (session.pendingOrphanResults ?? 0) + 1;
965
965
  }
966
- settleActive({ stopReason: "cancelled" });
966
+ settleActive({ stopReason: "cancelled", usage: sessionUsage(session) });
967
967
  // If the session is being torn down — or this consumer was
968
968
  // superseded by a lazy query recreate — abandon the in-flight
969
969
  // next() (swallowing any later rejection so it can't surface as
@@ -1000,9 +1000,10 @@ export class ClaudeAcpAgent {
1000
1000
  //
1001
1001
  // Settle the turn that was in flight so its prompt() doesn't hang:
1002
1002
  // cancelled if a cancel is pending, otherwise the accumulated outcome.
1003
- settleActive(session.cancelled
1004
- ? { stopReason: "cancelled" }
1005
- : { stopReason, usage: sessionUsage(session) });
1003
+ settleActive({
1004
+ stopReason: session.cancelled ? "cancelled" : stopReason,
1005
+ usage: sessionUsage(session),
1006
+ });
1006
1007
  // Queued turns the SDK never started never ran, so reject them rather
1007
1008
  // than reporting a success (end_turn) — or a misleading "cancelled" —
1008
1009
  // for a prompt that produced no output. (A cancel already settled the
@@ -1145,8 +1146,14 @@ export class ClaudeAcpAgent {
1145
1146
  // the turn NOW so its session/prompt gets a terminal
1146
1147
  // response, instead of leaving it hanging until the next
1147
1148
  // prompt drains the wreckage.
1149
+ // A cancelled turn still consumed tokens: its dropped result
1150
+ // already fed the accumulator (the usage tally at the result
1151
+ // handler runs before the `session.cancelled` guard), so
1152
+ // report it — clients metering spend would otherwise lose
1153
+ // the interrupted turn's tokens entirely (issue #844). Zero
1154
+ // when the cancel pre-empted the result (wedge/force-cancel).
1148
1155
  if (session.cancelled && session.activeTurn && !session.activeTurn.settled) {
1149
- settleActive({ stopReason: "cancelled" });
1156
+ settleActive({ stopReason: "cancelled", usage: sessionUsage(session) });
1150
1157
  }
1151
1158
  else if (owedTrailingIdles > 0) {
1152
1159
  // Absorb a settled turn's trailing idle. Also covers a
@@ -1611,7 +1618,7 @@ export class ClaudeAcpAgent {
1611
1618
  // create a block the consolidated handler's `text.length > 0`
1612
1619
  // guard can never consume, stalling the diff cursor and
1613
1620
  // re-emitting the next block as a duplicate.
1614
- if (chunk && chunk.text.length > 0) {
1621
+ if (chunk?.text) {
1615
1622
  const index = message.event.index;
1616
1623
  const last = streamedBlocks[streamedBlocks.length - 1];
1617
1624
  if (last && last.index === index && last.type === chunk.type) {
@@ -1716,7 +1723,9 @@ export class ClaudeAcpAgent {
1716
1723
  // as the freshly-activated turn ending without a result
1717
1724
  // (which would false-fail a healthy turn — issue #825).
1718
1725
  owedTrailingIdles++;
1719
- settleActive({ stopReason: "cancelled" });
1726
+ // Before activateTurn resets the accumulator, so the
1727
+ // usage still belongs to the cancelled turn.
1728
+ settleActive({ stopReason: "cancelled", usage: sessionUsage(session) });
1720
1729
  }
1721
1730
  else {
1722
1731
  settleActive({ stopReason: "end_turn", usage: sessionUsage(session) });
@@ -2001,20 +2010,22 @@ export class ClaudeAcpAgent {
2001
2010
  // they have no in-flight SDK work to interrupt. The active turn is settled
2002
2011
  // by the consumer when it observes the interrupt's trailing idle (or via the
2003
2012
  // backstop below). Mirrors the old pendingMessages cancellation.
2013
+ const orphanedUuids = [];
2004
2014
  if (session.turnQueue) {
2005
- let orphaned = 0;
2006
2015
  for (const turn of session.turnQueue) {
2007
2016
  if (turn !== session.activeTurn && !turn.settled) {
2008
2017
  turn.settled = true;
2018
+ // Deliberately no `usage`: a queued turn never ran, so the session
2019
+ // accumulator (the active turn's tally) is not its spend.
2009
2020
  turn.resolve({ stopReason: "cancelled" });
2010
- orphaned++;
2021
+ orphanedUuids.push(turn.promptUuid);
2011
2022
  }
2012
2023
  }
2013
2024
  // Each removed queued turn's user message was already pushed to the SDK,
2014
2025
  // which processes input FIFO and will still emit a result for it with no
2015
2026
  // uuid to match. Count those so the consumer skips them (see
2016
2027
  // ensureActiveTurn) rather than misattributing them to the head.
2017
- session.pendingOrphanResults = (session.pendingOrphanResults ?? 0) + orphaned;
2028
+ session.pendingOrphanResults = (session.pendingOrphanResults ?? 0) + orphanedUuids.length;
2018
2029
  session.turnQueue = session.turnQueue.filter((turn) => turn === session.activeTurn && !turn.settled);
2019
2030
  }
2020
2031
  // Arm a backstop before interrupting: if a turn is actively consuming the
@@ -2038,7 +2049,29 @@ export class ClaudeAcpAgent {
2038
2049
  cancelController.abort();
2039
2050
  }, this.forceCancelGraceMs);
2040
2051
  }
2041
- await session.query.interrupt();
2052
+ const receipt = await session.query.interrupt();
2053
+ // On CLIs advertising `interrupt_receipt_v1`, the receipt's `still_queued`
2054
+ // lists exactly which queued messages survive the interrupt and will still
2055
+ // run. An orphaned turn whose uuid is absent was dropped by the interrupt
2056
+ // and will never emit a result — uncount it now instead of leaving a stale
2057
+ // skip that activateTurn's reset only clears once a later live ECHO
2058
+ // arrives: an echo-less result in between (a local-only command like
2059
+ // `/context`) would be wrongly swallowed by the leftover count. Subtracting
2060
+ // a count (rather than tracking uuids) stays race-safe against the
2061
+ // consumer draining concurrently: dropped uuids produce no results, so the
2062
+ // consumer's decrements only ever consume the still-queued share. Unknown
2063
+ // uuids in the receipt (internally-enqueued messages) are ignored, per its
2064
+ // contract. Older CLIs resolve `undefined` (guard the FIELD, not just the
2065
+ // receipt, so a bare `{}` success from a gateway can't read as "everything
2066
+ // was dropped") — keep the count-everything behavior and its
2067
+ // activation-time self-heal.
2068
+ if (Array.isArray(receipt?.still_queued) && orphanedUuids.length > 0) {
2069
+ const stillQueued = new Set(receipt.still_queued);
2070
+ const dropped = orphanedUuids.filter((uuid) => !stillQueued.has(uuid)).length;
2071
+ if (dropped > 0) {
2072
+ session.pendingOrphanResults = Math.max(0, (session.pendingOrphanResults ?? 0) - dropped);
2073
+ }
2074
+ }
2042
2075
  }
2043
2076
  /** Mark a session's SDK query stream as permanently ended and release the
2044
2077
  * resources tied to it: drop the consumer handle, dispose the settings
@@ -2196,22 +2229,40 @@ export class ClaudeAcpAgent {
2196
2229
  ? option.options.flatMap((o) => ("options" in o ? o.options : [o]))
2197
2230
  : [];
2198
2231
  let validValue = allValues.find((o) => o.value === params.value);
2232
+ // The option's reported currentValue is always a valid target, even when
2233
+ // it has no options entry: a session running an out-of-picker model
2234
+ // (resumed onto an allowlist-excluded model, or a refusal fallback)
2235
+ // reports a currentValue that isn't selectable, and a client
2236
+ // round-tripping it must not get "Invalid value". It flows through the
2237
+ // normal apply path below — re-asserting an already-current value is
2238
+ // harmless and can repair SDK drift.
2239
+ if (!validValue && option.currentValue === params.value) {
2240
+ validValue = { value: params.value, name: params.value };
2241
+ }
2199
2242
  // For model options, fall back to resolveModelPreference when the exact
2200
2243
  // value doesn't match. This lets callers use human-friendly aliases like
2201
2244
  // "opus" or "sonnet" instead of full model IDs like "claude-opus-4-6".
2245
+ // Resolve against session.modelInfos first: those entries carry
2246
+ // `resolvedModel`, so a full model id (in either hint spelling) lands on
2247
+ // the right row via the exact tier instead of a fuzzier one picking a
2248
+ // same-family sibling from a different context lane. The options-derived
2249
+ // list (which never carries `resolvedModel`) remains as a fallback for
2250
+ // resolutions that don't map back onto a selectable option (e.g. a fuzzy
2251
+ // hit on an out-of-picker verbatim entry).
2202
2252
  // No deprecation filter here (R4.2, no double work): this list is rebuilt
2203
2253
  // from the RENDERED option rows, which flow from the already-filtered
2204
2254
  // picker list (`hideDeprecatedModels` at every session-creation branch) —
2205
2255
  // so hidden rows are not selectable via aliases either.
2206
2256
  if (!validValue && params.configId === MODEL_CONFIG_ID) {
2207
- const modelInfos = allValues.map((o) => ({
2208
- value: o.value,
2209
- displayName: o.name,
2210
- description: o.description ?? "",
2211
- }));
2212
- const resolved = resolveModelPreference(modelInfos, params.value);
2213
- if (resolved) {
2214
- validValue = allValues.find((o) => o.value === resolved.value);
2257
+ const toOptionValue = (resolved) => resolved ? allValues.find((o) => o.value === resolved.value) : undefined;
2258
+ validValue = toOptionValue(resolveModelPreference(session.modelInfos, params.value));
2259
+ if (!validValue) {
2260
+ const optionInfos = allValues.map((o) => ({
2261
+ value: o.value,
2262
+ displayName: o.name,
2263
+ description: o.description ?? "",
2264
+ }));
2265
+ validValue = toOptionValue(resolveModelPreference(optionInfos, params.value));
2215
2266
  }
2216
2267
  }
2217
2268
  if (!validValue) {
@@ -3485,12 +3536,49 @@ export class ClaudeAcpAgent {
3485
3536
  const allowedModels = Array.isArray(settingsAvailableModels)
3486
3537
  ? applyAvailableModelsAllowlist(initializationResult.models, settingsAvailableModels, settingsModelOverrides, this.logger)
3487
3538
  : hideDeprecatedModels(initializationResult.models, this.logger);
3488
- const models = await getAvailableModels(q, catalogModels, allowedModels, initializationResult.models, settingsManager, this.logger);
3539
+ const models = await getAvailableModels(q, catalogModels, allowedModels, initializationResult.models, settingsManager, this.logger, creationOpts.resume !== undefined);
3489
3540
  // Gate `auto` (and future model-specific modes) on the resolved model's
3490
3541
  // `ModelInfo`. See `buildAvailableModes` for the canonical SDK signal.
3491
3542
  // Looked up in the UNfiltered catalog: a session honoring a persisted
3492
3543
  // deprecated preference must keep that model's real capabilities (R4.3).
3493
- const currentModelInfo = catalogModels.find((m) => m.value === models.currentModelId);
3544
+ // A resumed session can also be running a model outside the
3545
+ // `availableModels` allowlist (currentModelId is then the verbatim live
3546
+ // id, see `matchResumedModel`); its capabilities are still known to the
3547
+ // SDK's unfiltered list, so fall back to that before treating the model
3548
+ // as unknown — otherwise auto mode would be spuriously clamped and the
3549
+ // Fast-mode/Effort options hidden for a model that supports them.
3550
+ const catalogModelInfo = catalogModels.find((m) => m.value === models.currentModelId);
3551
+ const fallbackModelInfo = catalogModelInfo
3552
+ ? undefined
3553
+ : (resolveModelPreference(initializationResult.models, models.currentModelId) ?? undefined);
3554
+ const currentModelInfo = catalogModelInfo ?? fallbackModelInfo;
3555
+ // Register the fallback-resolved capabilities under the verbatim live id
3556
+ // so every modelInfos consumer (buildConfigOptions' effort lookup, later
3557
+ // rebuilds via session.modelInfos) agrees with the gating below. The
3558
+ // picker options themselves come from `models.availableModels`, so this
3559
+ // adds no selectable entry. The spread keeps every capability flag
3560
+ // (current and future); the identity fields are overridden because the
3561
+ // fuzzy-matched sibling's resolvedModel/displayName/description can
3562
+ // describe a different context lane and would poison later resolvedModel
3563
+ // matching (syncModelAfterRefusalFallback) and context-window inference
3564
+ // (applyConfigOptionValue) if they traveled under this id.
3565
+ // Built on the UNfiltered catalog, NOT the picker list: `modelInfos` is
3566
+ // never rendered (picker rows come from `models.availableModels`) — it
3567
+ // feeds capability lookups and `resolveModelPreference` (refusal
3568
+ // fallback), which must keep seeing deprecated rows (R4.3,
3569
+ // visibility-only filter).
3570
+ const modelInfos = fallbackModelInfo
3571
+ ? [
3572
+ ...catalogModels,
3573
+ {
3574
+ ...fallbackModelInfo,
3575
+ value: models.currentModelId,
3576
+ displayName: models.currentModelId,
3577
+ description: "",
3578
+ resolvedModel: undefined,
3579
+ },
3580
+ ]
3581
+ : catalogModels;
3494
3582
  const availableModes = buildAvailableModes(currentModelInfo);
3495
3583
  // Clamp `permissionMode` if the resolved session does not offer it. The
3496
3584
  // common case is `permissions.defaultMode: "auto"` resolving to a model
@@ -3544,12 +3632,13 @@ export class ClaudeAcpAgent {
3544
3632
  enabled: fastModeEnabled,
3545
3633
  };
3546
3634
  const configOptions = buildConfigOptions(modes, models,
3547
- // The UNfiltered catalog, matching the model-switch rebuild (which
3548
- // passes `session.modelInfos`): `buildConfigOptions` reads this argument
3549
- // only for the current model's effort capabilities — picker rows come
3550
- // from `models.availableModels` — so a deprecated current model keeps
3551
- // its effort option without leaking hidden rows (R4.3).
3552
- catalogModels, settingsManager.getSettings().effortLevel, agents, currentAgent, fastMode,
3635
+ // Catalog-based (see `modelInfos` above), matching the model-switch
3636
+ // rebuild (which passes `session.modelInfos`): `buildConfigOptions`
3637
+ // reads this argument only for the current model's effort capabilities
3638
+ // — picker rows come from `models.availableModels` — so a deprecated
3639
+ // current model keeps its effort option without leaking hidden rows
3640
+ // (R4.3).
3641
+ modelInfos, settingsManager.getSettings().effortLevel, agents, currentAgent, fastMode,
3553
3642
  // A fresh session's Thinking intent is untouched (undefined), so the
3554
3643
  // display follows the env-driven state. `thinking` already holds
3555
3644
  // effectiveThinkingConfig(undefined, MAX_THINKING_TOKENS) from above, so
@@ -3583,18 +3672,24 @@ export class ClaudeAcpAgent {
3583
3672
  },
3584
3673
  modes,
3585
3674
  models,
3586
- // The UNfiltered catalog, NOT the picker list: `modelInfos` is never
3587
- // rendered (picker rows come from `models.availableModels`) — it feeds
3675
+ // Catalog-based, NOT the picker list: `modelInfos` is never rendered
3676
+ // (picker rows come from `models.availableModels`) — it feeds
3588
3677
  // capability lookups and `resolveModelPreference` (refusal fallback),
3589
3678
  // which must keep seeing deprecated rows (R4.3, visibility-only filter).
3590
- modelInfos: catalogModels,
3679
+ modelInfos,
3591
3680
  configOptions,
3592
3681
  agents,
3593
3682
  currentAgent,
3594
3683
  fastModeEnabled,
3595
3684
  abortController,
3596
3685
  emitRawSDKMessages: sessionMeta?.claudeCode?.emitRawSDKMessages ?? false,
3597
- contextWindowSize: inferContextWindowFromModel(models.currentModelId, currentModelInfo?.displayName, currentModelInfo?.description) ?? DEFAULT_CONTEXT_WINDOW,
3686
+ contextWindowSize:
3687
+ // Deliberately keyed to the catalog entry: a fallback-resolved
3688
+ // sibling's displayName/description can describe a different context
3689
+ // lane than the verbatim live id (e.g. an "opus[1m]" row matched for
3690
+ // a bare 200k id), so on the fallback path only the id itself is a
3691
+ // trustworthy window signal.
3692
+ inferContextWindowFromModel(models.currentModelId, catalogModelInfo?.displayName, catalogModelInfo?.description) ?? DEFAULT_CONTEXT_WINDOW,
3598
3693
  taskState,
3599
3694
  toolUseCache: {},
3600
3695
  emittedToolCalls: new Set(),
@@ -3932,14 +4027,32 @@ thinkingEnabled) {
3932
4027
  // Claude Code CLI persists display strings like "opus[1m]" in settings,
3933
4028
  // but the SDK model list uses IDs like "claude-opus-4-6-1m".
3934
4029
  const MODEL_CONTEXT_HINT_PATTERN = /\[(\d+m)\]$/i;
4030
+ // The id-suffix spelling of a context hint ("-1m" in "claude-opus-4-6-1m");
4031
+ // shared by the strip and canonicalize helpers below so the two can't drift.
4032
+ const CONTEXT_HINT_SUFFIX_PATTERN = /-(\d+m)$/i;
4033
+ /** Remove context-window hints — the display form "[1m]" and the SDK id
4034
+ * suffix form "-1m" — from a model string. Those digits describe context
4035
+ * size, not model identity or generation version. */
4036
+ function stripContextHints(s) {
4037
+ return s.replace(/\[\d+m\]/gi, "").replace(CONTEXT_HINT_SUFFIX_PATTERN, "");
4038
+ }
4039
+ /** Canonicalize a model id for exact comparison: trimmed, lowercased, with
4040
+ * the id-suffix hint spelling unified to the bracket form ("-1m" → "[1m]").
4041
+ * The hint itself is kept — bare and 1M ids must stay distinct. */
4042
+ function canonicalizeModelId(s) {
4043
+ return s.trim().toLowerCase().replace(CONTEXT_HINT_SUFFIX_PATTERN, "[$1]");
4044
+ }
4045
+ /** The context hint a model string carries ("1m" for either spelling), or
4046
+ * null for a bare id. */
4047
+ function contextHintOf(s) {
4048
+ return canonicalizeModelId(s).match(MODEL_CONTEXT_HINT_PATTERN)?.[1] ?? null;
4049
+ }
3935
4050
  // Captures a model family version: `4-6`/`4.7` for dated generations, or a
3936
4051
  // bare `5` for single-number ones like "Sonnet 5". Used to keep a pinned
3937
4052
  // `claude-opus-4-6` from matching the `opus` alias once it points at 4.7.
3938
4053
  const MODEL_FAMILY_VERSION_PATTERN = /\b(\d+)(?:[-.](\d+))?\b/;
3939
4054
  function extractModelFamilyVersion(s) {
3940
- // Strip "[1m]"-style context hints first — that digit is context window
3941
- // size, not a model generation version.
3942
- const match = s.replace(/\[\d+m\]/gi, "").match(MODEL_FAMILY_VERSION_PATTERN);
4055
+ const match = stripContextHints(s).match(MODEL_FAMILY_VERSION_PATTERN);
3943
4056
  if (!match)
3944
4057
  return null;
3945
4058
  return match[2] ? `${match[1]}.${match[2]}` : match[1];
@@ -3992,25 +4105,38 @@ export function resolveModelPreference(models, preference) {
3992
4105
  if (!trimmed)
3993
4106
  return null;
3994
4107
  const lower = trimmed.toLowerCase();
3995
- // Exact match on value or display name
4108
+ // Exact match on value or display name. Values compare on the canonical
4109
+ // hint spelling so "opus-1m" hits an "opus[1m]" row (and vice versa).
4110
+ const canonicalPreference = canonicalizeModelId(trimmed);
3996
4111
  const directMatch = models.find((model) => model.value === trimmed ||
3997
- model.value.toLowerCase() === lower ||
4112
+ canonicalizeModelId(model.value) === canonicalPreference ||
3998
4113
  model.displayName.toLowerCase() === lower);
3999
4114
  if (directMatch)
4000
4115
  return directMatch;
4001
4116
  // Exact match on the alias's canonical resolved id (e.g. a pinned
4002
4117
  // "claude-sonnet-5" against the "sonnet" row's `resolvedModel`). SDK-
4003
4118
  // reported and unambiguous, so it's tried before the fuzzier tiers below.
4004
- // "default" is skipped first since it shares a resolvedModel with
4005
- // whichever alias the CLI currently recommends a specific pin should
4006
- // land on that named alias, not "default".
4007
- const resolvedMatch = models.find((model) => model.value !== "default" && model.resolvedModel?.toLowerCase() === lower) ?? models.find((model) => model.resolvedModel?.toLowerCase() === lower);
4119
+ // Compared on the canonical hint spelling so a "-1m"-suffix pin matches a
4120
+ // "[1m]"-spelled resolvedModel instead of falling into the substring tier
4121
+ // (which would land on the bare 200k sibling). "default" is skipped first
4122
+ // since it shares a resolvedModel with whichever alias the CLI currently
4123
+ // recommends — a specific pin should land on that named alias, not
4124
+ // "default".
4125
+ const matchesResolved = (model) => model.resolvedModel != null && canonicalizeModelId(model.resolvedModel) === canonicalPreference;
4126
+ const resolvedMatch = models.find((model) => model.value !== "default" && matchesResolved(model)) ??
4127
+ models.find(matchesResolved);
4008
4128
  if (resolvedMatch)
4009
4129
  return resolvedMatch;
4010
- // Substring match
4130
+ // Substring match. Skips candidates whose context hint disagrees with the
4131
+ // preference's — a bare row must not absorb a 1M-hinted preference (nor
4132
+ // vice versa); such pairs fall through to the tokenized tier, which
4133
+ // weighs hints in its scoring and still finds the best same-family row.
4134
+ const preferenceHint = contextHintOf(trimmed);
4011
4135
  const includesMatch = models.find((model) => {
4012
4136
  if (!modelVersionsCompatible(trimmed, model))
4013
4137
  return false;
4138
+ if (contextHintOf(model.value) !== preferenceHint)
4139
+ return false;
4014
4140
  const value = model.value.toLowerCase();
4015
4141
  const display = model.displayName.toLowerCase();
4016
4142
  return value.includes(lower) || display.includes(lower) || lower.includes(value);
@@ -4034,6 +4160,51 @@ export function resolveModelPreference(models, preference) {
4034
4160
  }
4035
4161
  return bestMatch;
4036
4162
  }
4163
+ /** Map the live model reported by a resumed session onto the picker's model
4164
+ * list. The CLI restores a resumed session's model from the transcript's
4165
+ * last assistant message, which records the concrete API id (e.g.
4166
+ * "claude-opus-4-6") with any "[1m]" context hint dropped. Tiers, in order:
4167
+ * 1. Exact match with the Default entry's resolution — when a named alias
4168
+ * shares Default's resolvedModel verbatim, the live id can't tell the
4169
+ * two apart, and a never-customized session should stay on Default.
4170
+ * 2. Exact resolvedModel match on a named row. Checked before the
4171
+ * hint-stripped Default comparison so a live "claude-sonnet-5[1m]" lands
4172
+ * on the "sonnet[1m]" row rather than a Default that resolves to the
4173
+ * bare "claude-sonnet-5" — the two rows differ in context window, which
4174
+ * drives `contextWindowSize` and capability gating downstream.
4175
+ * 3. Hint-stripped match with Default's resolution — a session that never
4176
+ * left the default resumes as the bare transcript id, and shouldn't show
4177
+ * a concrete picker entry.
4178
+ * 4. `resolveModelPreference` over the picker entries.
4179
+ * 5. A model with no picker counterpart (e.g. excluded by an
4180
+ * `availableModels` allowlist) is tracked verbatim, mirroring
4181
+ * `syncModelAfterRefusalFallback`: the picker shows no selection, but the
4182
+ * model-dependent bookkeeping stays truthful to what the SDK is running. */
4183
+ export function matchResumedModel(models, liveModel) {
4184
+ const live = canonicalizeModelId(liveModel);
4185
+ const defaultEntry = models.find((m) => m.value === "default");
4186
+ const defaultResolved = defaultEntry?.resolvedModel
4187
+ ? canonicalizeModelId(defaultEntry.resolvedModel)
4188
+ : undefined;
4189
+ if (defaultEntry && defaultResolved === live) {
4190
+ return defaultEntry;
4191
+ }
4192
+ // No default-row exclusion needed: a default row matching `live` exactly
4193
+ // already returned at the tier above.
4194
+ const exactMatch = models.find((m) => m.resolvedModel && canonicalizeModelId(m.resolvedModel) === live);
4195
+ if (exactMatch)
4196
+ return exactMatch;
4197
+ if (defaultEntry &&
4198
+ defaultResolved &&
4199
+ stripContextHints(defaultResolved) === stripContextHints(live)) {
4200
+ return defaultEntry;
4201
+ }
4202
+ return (resolveModelPreference(models, liveModel) ?? {
4203
+ value: liveModel,
4204
+ displayName: liveModel,
4205
+ description: "",
4206
+ });
4207
+ }
4037
4208
  function resolveSettingsModel(models, settingsModel, logger) {
4038
4209
  if (settingsModel === undefined) {
4039
4210
  return null;
@@ -4161,6 +4332,21 @@ function hideDeprecatedModels(models, logger) {
4161
4332
  export function applyAvailableModelsAllowlist(sdkModels, allowlist, settingsModelOverrides, logger) {
4162
4333
  return hideDeprecatedModels(buildAllowlistedModels(sdkModels, allowlist, settingsModelOverrides), logger);
4163
4334
  }
4335
+ /** Read the model a resumed session is actually running (via the
4336
+ * `getContextUsage` control request — the same source `/context` prints) and
4337
+ * map it onto the picker. Best-effort: a control-request failure is logged
4338
+ * and returns null so callers keep their current choice; failing the whole
4339
+ * session/load over an unreadable report would be worse. */
4340
+ async function readResumedLiveModel(query, models, logger) {
4341
+ try {
4342
+ const liveModel = (await query.getContextUsage()).model;
4343
+ return liveModel ? matchResumedModel(models, liveModel) : null;
4344
+ }
4345
+ catch (error) {
4346
+ logger.error("Failed to read the resumed session's live model:", error);
4347
+ return null;
4348
+ }
4349
+ }
4164
4350
  async function getAvailableModels(query,
4165
4351
  /** Deprecation-UNfiltered catalog (allowlist-applied when configured):
4166
4352
  * preference resolution and the default pick read this list so a persisted
@@ -4170,14 +4356,15 @@ models,
4170
4356
  * rows (R4.2). The resolved `currentModelId` may legitimately be absent
4171
4357
  * from these rows (deprecated persisted preference) — the picker then
4172
4358
  * shows no selection, mirroring the refusal-fallback bookkeeping. */
4173
- pickerModels, sdkModels, settingsManager, logger) {
4359
+ pickerModels, sdkModels, settingsManager, logger, isResumedSession) {
4174
4360
  const settings = settingsManager.getSettings();
4175
4361
  let currentModel = models[0];
4176
4362
  let resolvedFromInput;
4177
4363
  // Model priority (highest to lowest):
4178
4364
  // 1. ANTHROPIC_MODEL environment variable
4179
4365
  // 2. settings.model (user configuration)
4180
- // 3. models[0] (default first model)
4366
+ // 3. the resumed session's live model (resumed sessions only)
4367
+ // 4. models[0] (default first model)
4181
4368
  if (process.env.ANTHROPIC_MODEL) {
4182
4369
  const match = resolveModelPreference(models, process.env.ANTHROPIC_MODEL);
4183
4370
  if (match) {
@@ -4192,21 +4379,49 @@ pickerModels, sdkModels, settingsManager, logger) {
4192
4379
  resolvedFromInput = settings.model;
4193
4380
  }
4194
4381
  }
4382
+ // A resumed session restores the model it was previously running (the CLI
4383
+ // re-reads it from the transcript), so without an env/settings override the
4384
+ // freshly-computed default above can disagree with what the session actually
4385
+ // runs — session/load then reports a model the session isn't using (issue
4386
+ // #845). Ask the CLI for the live model and reflect it. No `setModel` here:
4387
+ // the SDK is already running this model, and pushing a picker alias back
4388
+ // (e.g. "opus[1m]") could change the live model rather than describe it.
4389
+ if (resolvedFromInput === undefined && isResumedSession) {
4390
+ currentModel = (await readResumedLiveModel(query, models, logger)) ?? currentModel;
4391
+ }
4195
4392
  // Skip the setModel round-trip when we can prove the SDK has already landed
4196
4393
  // on the same model. Two cases qualify:
4197
- // (a) No override applied — currentModel stayed at models[0]; the SDK is on
4198
- // its own default and we have nothing to sync.
4394
+ // (a) No override applied — currentModel is the SDK's own default (or, on
4395
+ // resume, the live model read back from the SDK above); nothing to sync.
4199
4396
  // (b) The resolver returned the user's input verbatim AND that value exists
4200
4397
  // in the SDK's original model list — meaning no fuzzy match or
4201
4398
  // allowlist rewrite was involved, and the SDK (which reads the same
4202
4399
  // ANTHROPIC_MODEL / settings.json) will have arrived at the same entry.
4400
+ // This only holds for fresh sessions: a resumed session lands on the
4401
+ // transcript's model regardless of env/settings, so the override must
4402
+ // be re-asserted to keep the reported model truthful.
4203
4403
  // Anything else (fuzzy match, allowlist-synthesized value, alias) gets a
4204
4404
  // setModel call so we don't drift from the user's intended pin.
4205
4405
  const sdkSawSameValue = sdkModels.some((m) => m.value === currentModel.value);
4206
4406
  const skipSetModel = resolvedFromInput === undefined ||
4207
- (currentModel.value === resolvedFromInput && sdkSawSameValue);
4407
+ (!isResumedSession && currentModel.value === resolvedFromInput && sdkSawSameValue);
4208
4408
  if (!skipSetModel) {
4209
- await query.setModel(currentModel.value);
4409
+ try {
4410
+ await query.setModel(currentModel.value);
4411
+ }
4412
+ catch (error) {
4413
+ // On a fresh session the pin is a defining option — fail loudly. A
4414
+ // resumed session already runs fine on the transcript's model, so
4415
+ // failing the whole session/load over the re-assert would be worse
4416
+ // than loading with the pin unapplied (mirrors the setPermissionMode
4417
+ // containment in createSession). The SDK then stayed on the
4418
+ // transcript's model, so read that back rather than reporting the
4419
+ // pin the session isn't running.
4420
+ if (!isResumedSession)
4421
+ throw error;
4422
+ logger.error(`Failed to re-assert model "${currentModel.value}" on resume:`, error);
4423
+ currentModel = (await readResumedLiveModel(query, models, logger)) ?? currentModel;
4424
+ }
4210
4425
  }
4211
4426
  return {
4212
4427
  availableModels: pickerModels.map((model) => ({
@@ -4474,8 +4689,8 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
4474
4689
  let update = null;
4475
4690
  switch (chunk.type) {
4476
4691
  case "text":
4477
- case "text_delta":
4478
- if (chunk.text.length > 0) {
4692
+ case "text_delta": {
4693
+ if (chunk.text) {
4479
4694
  update = {
4480
4695
  sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
4481
4696
  content: {
@@ -4485,6 +4700,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
4485
4700
  };
4486
4701
  }
4487
4702
  break;
4703
+ }
4488
4704
  case "image":
4489
4705
  update = {
4490
4706
  sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
@@ -4497,10 +4713,10 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
4497
4713
  };
4498
4714
  break;
4499
4715
  case "thinking":
4500
- case "thinking_delta":
4716
+ case "thinking_delta": {
4501
4717
  // Recent models default `thinking.display` to "omitted", which streams
4502
4718
  // signature-only thinking blocks whose text is empty.
4503
- if (chunk.thinking.length > 0) {
4719
+ if (chunk.thinking) {
4504
4720
  update = {
4505
4721
  sessionUpdate: "agent_thought_chunk",
4506
4722
  content: {
@@ -4510,6 +4726,7 @@ export function toAcpNotifications(content, role, sessionId, toolUseCache, clien
4510
4726
  };
4511
4727
  }
4512
4728
  break;
4729
+ }
4513
4730
  case "tool_use":
4514
4731
  case "server_tool_use":
4515
4732
  case "mcp_tool_use": {
@@ -1,4 +1,5 @@
1
- import type { CreateElicitationRequest, CreateElicitationResponse } from "@agentclientprotocol/sdk";
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
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAM1B,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;AAyCD;;;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,SAAS,EAAE,eAAe,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,eAAe,EAAE,GAC3B,sBAAsB,CAkCxB;AAgBD;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,qBAAqB,GAAG,IAAI,CAW9B;AAYD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,MAAM,GAChB,wBAAwB,CA+B1B;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,CAG7F"}
@@ -1,4 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { CreateElicitationResponse } from "@agentclientprotocol/sdk";
2
3
  /**
3
4
  * 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,38 +30,16 @@ export function mcpElicitationToCreateRequest(request, sessionId) {
29
30
  requestedSchema: normalizeElicitationSchema(request.requestedSchema),
30
31
  };
31
32
  }
32
- /** A wire value allowed in elicitation form content. */
33
- function isElicitationContentValue(value) {
34
- return (typeof value === "string" ||
35
- typeof value === "number" ||
36
- typeof value === "boolean" ||
37
- (Array.isArray(value) && value.every((item) => typeof item === "string")));
38
- }
39
33
  /**
40
34
  * Content of an accepted elicitation response.
41
35
  *
42
- * The response union includes a custom/future-action variant whose `action` is
43
- * plain `string`, so a positive `=== "accept"` check can never narrow it away
44
- * and `content` reads as `unknown`. Rather than asserting which union member
45
- * this is, validate the values: the SDK's own wire validation has the same
46
- * blind spot (an accept response with malformed content parses via the
47
- * catch-all variant), so ill-typed values are dropped here either way.
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.
48
40
  */
49
41
  function acceptedElicitationContent(response) {
50
- if (response.action !== "accept") {
51
- return {};
52
- }
53
- const { content } = response;
54
- if (!content || typeof content !== "object") {
55
- return {};
56
- }
57
- const validated = {};
58
- for (const [key, value] of Object.entries(content)) {
59
- if (isElicitationContentValue(value)) {
60
- validated[key] = value;
61
- }
62
- }
63
- return validated;
42
+ return CreateElicitationResponse.isAccept(response) ? (response.content ?? {}) : {};
64
43
  }
65
44
  /**
66
45
  * Map an ACP elicitation response back to the MCP `ElicitResult` the SDK expects
@@ -45,7 +45,7 @@ export function parseRewindInvocation(promptText) {
45
45
  if (/[\r\n]/.test(promptText.trim())) {
46
46
  return null;
47
47
  }
48
- const match = /^\/rewind(?:\s+(.*))?$/.exec(promptText.trim());
48
+ const match = promptText.trim().match(/^\/rewind(?:\s+(\S.*))?$/);
49
49
  if (!match) {
50
50
  return null;
51
51
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.0",
6
+ "version": "0.3.0",
7
7
  "description": "ACP adapter for the Claude Agent SDK with VS Code-parity UX for Zed and other ACP clients — checkbox multi-select questions, refusal consent dialog, dynamic agent name. Fork of claude-agent-acp.",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",
@@ -61,24 +61,24 @@
61
61
  "author": "Zed Industries",
62
62
  "license": "Apache-2.0",
63
63
  "engines": {
64
- "node": ">=22"
64
+ "node": ">=24"
65
65
  },
66
66
  "dependencies": {
67
67
  "@agentclientprotocol/sdk": "1.2.1",
68
- "@anthropic-ai/claude-agent-sdk": "0.3.204",
68
+ "@anthropic-ai/claude-agent-sdk": "0.3.206",
69
69
  "zod": "^3.25.0 || ^4.0.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@anthropic-ai/sdk": "0.110.0",
72
+ "@anthropic-ai/sdk": "0.111.0",
73
73
  "@eslint/js": "10.0.1",
74
- "@tsconfig/node22": "22.0.5",
74
+ "@tsconfig/node24": "24.0.4",
75
75
  "@types/node": "26.1.1",
76
76
  "@typescript-eslint/eslint-plugin": "8.63.0",
77
77
  "@typescript-eslint/parser": "8.63.0",
78
- "eslint": "10.6.0",
78
+ "eslint": "10.7.0",
79
79
  "eslint-config-prettier": "10.1.8",
80
80
  "globals": "17.7.0",
81
- "prettier": "3.9.4",
81
+ "prettier": "3.9.5",
82
82
  "ts-node": "10.9.2",
83
83
  "typescript": "6.0.3",
84
84
  "vitest": "4.1.10"