@agentclientprotocol/claude-agent-acp 0.77.0 → 0.77.1-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ import { ContextCompactionMetadata } from "./context-compaction-meta.js";
13
13
  import { type SessionFailureState } from "./session-failure-extension.js";
14
14
  import { type ClaudeSubscriptionGuardState } from "./hide-claude-auth.js";
15
15
  import { type FileChangeAuditSupport, type FileChangeAuditTurnState } from "./file-change-audit.js";
16
+ import { ContextCompactionLifecycle } from "./context-compaction.js";
16
17
  import { TaskState } from "./tools.js";
17
18
  import { Pushable } from "./utils.js";
18
19
  import { MODE_CONFIG_ID } from "./session-mode.js";
@@ -513,6 +514,9 @@ export type Session = {
513
514
  /** Session-owned async task controller. Prompt cancellation intentionally
514
515
  * does not finish it because background work may outlive a prompt. */
515
516
  asyncTaskRuntime?: AsyncTaskRuntime;
517
+ /** The consumer's compaction lifecycle, exposed so the PostCompact hook can
518
+ * hand it the retained summary. */
519
+ contextCompaction?: ContextCompactionLifecycle;
516
520
  /** Whether any top-level assistant text reached the client since the last
517
521
  * stretch boundary. Set as a side effect of sending in the consumer's
518
522
  * `sendUpdate`, never at an emission site; read at the terminal `result`
@@ -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,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAGb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,cAAc,EAEd,mBAAmB,EACnB,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oE;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,CAAC,MAAM,CAAC,EAAE,MAAM;;;EAqDrC"}
package/dist/acp-agent.js CHANGED
@@ -28,7 +28,7 @@ import { SettingsManager } from "./settings.js";
28
28
  import { activeUsageLimitMessage, airSessionFailureCapabilityMeta, assistantMessageText, createSessionFailureState, isSyntheticUsageLimitMessage, providerFailureCategory, SessionFailureController, sessionFailureMeta, supportsAirSessionFailures, } from "./session-failure-extension.js";
29
29
  import { billsClaudeSubscription, CLAUDE_SUBSCRIPTION_NOT_SUPPORTED_MESSAGE, CLAUDE_SUBSCRIPTION_NOT_SUPPORTED_REASON, claudeLoginRequiredError, claudeSubscriptionNotSupportedError, holdsNonSubscriptionCredential, refuseClaudeSubscriptionTurn, shouldHideClaudeAuth, warnClaudeSubscriptionGuardDegraded, } from "./hide-claude-auth.js";
30
30
  import { AGENT_FILE_CHANGE_REPORT_CAPABILITY, agentFileChangeReportMeta, agentFileChangeReportRequestId, containsFileChangeAuditMarker, createFileChangeAuditSupport, createFileChangeAuditTurnState, FILE_CHANGE_AUDIT_SERVER_NAME, isFileChangeAuditReportPhase, isFileChangeAuditTool, supportsAgentFileChangeReport, } from "./file-change-audit.js";
31
- import { ContextCompactionLifecycle, contextCompactionMetadataFromBoundary, } from "./context-compaction.js";
31
+ import { ContextCompactionLifecycle, clientSupportsCompactionUpdates, contextCompactionMetadataFromBoundary, isCompactSummaryMessage, } from "./context-compaction.js";
32
32
  import { applyTaskCreate, applyTaskList, applyTaskUpdate, clearHookCallbacks, completeHookCallback, createPostToolUseHook, createTaskHook, parseTaskCreateOutput, parseTaskListOutput, parseTaskUpdateOutput, planEntries, registerHookCallback, taskStateToPlanEntries, toolInfoFromToolUse, toolUpdateFromDiffToolResponse, toolUpdateFromToolResult, unregisterHookCallback, } from "./tools.js";
33
33
  import { nodeToWebReadable, nodeToWebWritable, Pushable, unreachable } from "./utils.js";
34
34
  import { acceptedPlanToolResult, ExitPlanCoordinator, executionDiagnostic, exitPlanModeRawOutput, observeExitPlanToolResults, } from "./exit-plan.js";
@@ -1888,7 +1888,14 @@ export class ClaudeAcpAgent {
1888
1888
  * as the turn's answer. */
1889
1889
  const subagents = (session.nativeSubagentRuntime ??= new NativeSubagentRuntime(clientSupportsSubagents(this.clientCapabilities), params.sessionId, session, async (notification) => this.client.sessionUpdate(asSdkSessionNotification(notification)), this.logger));
1890
1890
  const asyncTasks = (session.asyncTaskRuntime ??= new AsyncTaskRuntime(clientSupportsAsyncTasks(this.clientCapabilities), params.sessionId, async (notification) => this.client.sessionUpdate(asSdkSessionNotification(notification))));
1891
- const compaction = new ContextCompactionLifecycle((notification) => sendUpdate(notification));
1891
+ const compaction = new ContextCompactionLifecycle((notification) => sendUpdate(notification), {
1892
+ sessionId: params.sessionId,
1893
+ presentation: clientSupportsCompactionUpdates(this.clientCapabilities)
1894
+ ? "compaction_update"
1895
+ : "tool_call",
1896
+ logError: (message, error) => this.logger.error(message, error),
1897
+ });
1898
+ session.contextCompaction = compaction;
1892
1899
  const sendUpdate = async (notification) => {
1893
1900
  const { update } = notification;
1894
1901
  const claudeMeta = update._meta?.claudeCode;
@@ -1913,7 +1920,9 @@ export class ClaudeAcpAgent {
1913
1920
  update.sessionUpdate === "agent_thought_chunk" ||
1914
1921
  update.sessionUpdate === "user_message_chunk" ||
1915
1922
  update.sessionUpdate === "tool_call" ||
1916
- update.sessionUpdate === "tool_call_update")) {
1923
+ update.sessionUpdate === "tool_call_update" ||
1924
+ update.sessionUpdate === "compaction_update" ||
1925
+ update.sessionUpdate === "compaction_summary_chunk")) {
1917
1926
  return;
1918
1927
  }
1919
1928
  if (update.sessionUpdate === "agent_message_chunk") {
@@ -2723,13 +2732,13 @@ export class ClaudeAcpAgent {
2723
2732
  break;
2724
2733
  case "status": {
2725
2734
  if (message.status === "compacting") {
2726
- await compaction.start(message.session_id, message.uuid);
2735
+ await compaction.start(message.uuid);
2727
2736
  }
2728
2737
  else if (message.compact_result === "success") {
2729
- await compaction.finish(message.session_id, message.uuid, "completed");
2738
+ await compaction.finish(message.uuid, "completed");
2730
2739
  }
2731
2740
  else if (message.compact_result === "failed") {
2732
- await compaction.finish(message.session_id, message.uuid, "failed", {
2741
+ await compaction.finish(message.uuid, "failed", {
2733
2742
  ...(message.compact_error ? { error: message.compact_error } : {}),
2734
2743
  });
2735
2744
  }
@@ -2752,7 +2761,7 @@ export class ClaudeAcpAgent {
2752
2761
  // window.
2753
2762
  //
2754
2763
  const compactMetadata = message.compact_metadata;
2755
- await compaction.finish(message.session_id, message.uuid, "completed", compactMetadata ? contextCompactionMetadataFromBoundary(compactMetadata) : {}, true);
2764
+ await compaction.finish(message.uuid, "completed", compactMetadata ? contextCompactionMetadataFromBoundary(compactMetadata) : {}, true);
2756
2765
  const usedTokens = compactMetadata?.post_tokens ?? 0;
2757
2766
  lastAssistantUsage = null;
2758
2767
  lastAssistantTotalUsage = usedTokens;
@@ -2839,7 +2848,7 @@ export class ClaudeAcpAgent {
2839
2848
  // the interrupted turn's tokens entirely (issue #844). Zero
2840
2849
  // when the cancel pre-empted the result (wedge/force-cancel).
2841
2850
  if (session.cancelled && session.activeTurn && !session.activeTurn.settled) {
2842
- compaction.reset();
2851
+ await compaction.reset();
2843
2852
  settleActive(turnOutcome(session, "cancelled"));
2844
2853
  // An interrupt can pre-empt the turn's result entirely
2845
2854
  // (nothing ran the result-case `finally`), so close the
@@ -2904,7 +2913,7 @@ export class ClaudeAcpAgent {
2904
2913
  else if (!session.cancelled &&
2905
2914
  session.activeTurn &&
2906
2915
  !session.activeTurn.settled) {
2907
- compaction.reset();
2916
+ await compaction.reset();
2908
2917
  // Deliberately only the ACTIVE turn: a queued turn that
2909
2918
  // was never echoed is NOT failed here, because an idle
2910
2919
  // can legitimately precede the SDK picking up freshly
@@ -3795,6 +3804,17 @@ export class ClaudeAcpAgent {
3795
3804
  // then, so both branches no-op); cancellation is left to the
3796
3805
  // idle/abort path. settleActive is idempotent, so a duplicate
3797
3806
  // idle is a no-op.
3807
+ //
3808
+ // A result also closes this compaction lifecycle — before the
3809
+ // settle, so a `cancelled` terminal for an entity the runtime
3810
+ // left open lands inside the prompt response rather than after
3811
+ // it (clients may stop consuming at the response). Reset here
3812
+ // rather than at idle: an owed idle from this turn can arrive
3813
+ // after the next turn has already started and must not erase
3814
+ // that turn's compaction state.
3815
+ if (!isAutonomousResult) {
3816
+ await compaction.reset();
3817
+ }
3798
3818
  if (!session.cancelled) {
3799
3819
  settleOrDefer(turnOutcome(session, stopReason));
3800
3820
  }
@@ -3802,22 +3822,29 @@ export class ClaudeAcpAgent {
3802
3822
  finally {
3803
3823
  if (!isAutonomousResult) {
3804
3824
  session.emittedAssistantText = false;
3805
- // A result closes this compaction lifecycle. Reset here rather
3806
- // than at idle: an owed idle from this turn can arrive after
3807
- // the next turn has already started and must not erase that
3808
- // turn's compaction state.
3809
- compaction.reset();
3825
+ // The early exits above (cancelled guard, refusal) skip the
3826
+ // pre-settle reset; idempotent, so a no-op on the normal path.
3827
+ await compaction.reset();
3810
3828
  }
3811
3829
  }
3812
3830
  break;
3813
3831
  }
3814
3832
  case "stream_event": {
3815
- const isCompactionProgress = (message.event.type === "content_block_start" &&
3816
- message.event.content_block.type === "compaction") ||
3817
- (message.event.type === "content_block_delta" &&
3818
- message.event.delta.type === "compaction_delta");
3819
- if (isCompactionProgress) {
3820
- await compaction.heartbeat(message.session_id, message.uuid);
3833
+ // The API's compaction block streams the retained summary text;
3834
+ // `content` is null on the opening block and on a failed compaction.
3835
+ // Only the root conversation's compaction is the session's: a
3836
+ // subagent compacting its own context must not touch it.
3837
+ const compactionBlock = message.parent_tool_use_id !== null
3838
+ ? undefined
3839
+ : message.event.type === "content_block_start" &&
3840
+ message.event.content_block.type === "compaction"
3841
+ ? message.event.content_block
3842
+ : message.event.type === "content_block_delta" &&
3843
+ message.event.delta.type === "compaction_delta"
3844
+ ? message.event.delta
3845
+ : undefined;
3846
+ if (compactionBlock) {
3847
+ await compaction.heartbeat(message.uuid, compactionBlock.content ?? undefined);
3821
3848
  }
3822
3849
  // `message_start` carries the Anthropic API message id; capture it
3823
3850
  // so the streamed chunks that follow (whose delta events don't carry
@@ -4725,6 +4752,7 @@ export class ClaudeAcpAgent {
4725
4752
  }
4726
4753
  session.queryClosed = true;
4727
4754
  session.consumer = undefined;
4755
+ session.contextCompaction = undefined;
4728
4756
  session.settingsManager.dispose();
4729
4757
  session.input.end();
4730
4758
  session.query.close();
@@ -4897,6 +4925,7 @@ export class ClaudeAcpAgent {
4897
4925
  let replayingFileChangeAudit = false;
4898
4926
  const replayFileChangeAuditToolUseIds = new Set();
4899
4927
  const nativeReplayEnabled = clientSupportsSubagents(this.clientCapabilities);
4928
+ const replayCompactionUpdates = clientSupportsCompactionUpdates(this.clientCapabilities);
4900
4929
  const replayTerminalStates = new Map();
4901
4930
  const replayChildren = new Map();
4902
4931
  if (nativeReplayEnabled) {
@@ -5097,6 +5126,29 @@ export class ClaudeAcpAgent {
5097
5126
  continue;
5098
5127
  }
5099
5128
  }
5129
+ // Claude persists the retained summary as a user message framed with
5130
+ // continuation instructions for the model. Clients on the compaction
5131
+ // contract get it materialized as the completed compaction entity at
5132
+ // this transcript position (the boundary's own system record comes back
5133
+ // from getSessionMessages without its metadata, so the summary message
5134
+ // is the one durable marker); other clients keep the transcript text.
5135
+ // The entity is keyed by the summary message's uuid, which differs from
5136
+ // the live id (the `compacting` status uuid) — replay is terminal-first
5137
+ // by the RFD, and no client merges a replay into a live entity store.
5138
+ // A subagent's own compaction summary is not the root session's, and a
5139
+ // summary whose framing is unrecognized stays visible as transcript
5140
+ // text rather than vanishing behind a summary-less entity.
5141
+ if (replayCompactionUpdates &&
5142
+ isCompactSummaryMessage(message) &&
5143
+ parentToolUseId === null &&
5144
+ typeof message.uuid === "string" &&
5145
+ message.uuid.length > 0) {
5146
+ const replayCompaction = new ContextCompactionLifecycle((notification) => this.client.sessionUpdate(notification), { sessionId, presentation: "compaction_update" });
5147
+ if (replayCompaction.recordSummary(assistantMessageText(message.message))) {
5148
+ await replayCompaction.finish(message.uuid, "completed");
5149
+ continue;
5150
+ }
5151
+ }
5100
5152
  for (const notification of toAcpNotifications(
5101
5153
  // @ts-expect-error - untyped in SDK but we handle all of these
5102
5154
  content,
@@ -6168,6 +6220,26 @@ export class ClaudeAcpAgent {
6168
6220
  ],
6169
6221
  },
6170
6222
  ],
6223
+ // The retained summary reaches the SDK stream only as the persisted
6224
+ // user message that frames it with model-facing continuation
6225
+ // instructions; the hook carries the raw summary for the ACP
6226
+ // compaction_update. The CLI awaits this hook before emitting the
6227
+ // compaction's terminal frames, so the summary is normally recorded
6228
+ // while the entity is still in progress and rides on the terminal
6229
+ // update. Subagent compactions stay out of the root session's entity.
6230
+ PostCompact: [
6231
+ ...(userProvidedOptions?.hooks?.PostCompact || []),
6232
+ {
6233
+ hooks: [
6234
+ async (input) => {
6235
+ if (input.hook_event_name === "PostCompact" && !input.agent_id) {
6236
+ this.sessions[sessionId]?.contextCompaction?.recordSummary(input.compact_summary);
6237
+ }
6238
+ return { continue: true };
6239
+ },
6240
+ ],
6241
+ },
6242
+ ],
6171
6243
  ...(fileChangeAuditSupport
6172
6244
  ? {
6173
6245
  Stop: [
@@ -1,14 +1,52 @@
1
- import { SessionNotification } from "@agentclientprotocol/sdk";
1
+ import { ClientCapabilities, SessionNotification } from "@agentclientprotocol/sdk";
2
2
  import { ContextCompactionMetadata } from "./context-compaction-meta.js";
3
3
  type CompactionStatus = "completed" | "failed";
4
+ type TerminalStatus = CompactionStatus | "cancelled";
5
+ /**
6
+ * How compaction reaches the client.
7
+ *
8
+ * - `compaction_update`: the ACP session-compaction contract (ID-addressed
9
+ * `compaction_update` / `compaction_summary_chunk`), used when the v1 client
10
+ * advertises `clientCapabilities.session.compaction`.
11
+ * - `tool_call`: the legacy synthetic "Compact conversation" tool call, kept
12
+ * for clients that do not advertise the capability.
13
+ */
14
+ export type CompactionPresentation = "tool_call" | "compaction_update";
4
15
  type CompactionState = {
5
- toolCallId: string;
6
- terminalStatus?: CompactionStatus;
16
+ /** Doubles as the toolCallId under the legacy presentation. */
17
+ compactionId: string;
18
+ terminalStatus?: TerminalStatus;
7
19
  heartbeatSent: boolean;
20
+ /** User-displayable summary reported by the PostCompact hook. While the
21
+ * compaction is in progress it awaits the terminal update; on a `completed`
22
+ * state it has been sent. */
23
+ summary?: string;
8
24
  };
9
25
  type SendUpdate = (notification: SessionNotification) => Promise<void>;
26
+ export type ContextCompactionLifecycleOptions = {
27
+ sessionId: string;
28
+ presentation?: CompactionPresentation;
29
+ /** Receives failures of the send that must not propagate: the turn-boundary
30
+ * `cancelled` terminal. */
31
+ logError?: (message: string, error: unknown) => void;
32
+ };
33
+ export declare function clientSupportsCompactionUpdates(capabilities?: ClientCapabilities | null): boolean;
34
+ /**
35
+ * Reduce Claude's compaction output to the user-displayable summary.
36
+ *
37
+ * The PostCompact hook reports the model's raw output, which wraps the
38
+ * summary in `<summary>` tags (often preceded by an `<analysis>` block). The
39
+ * persisted transcript instead frames the same summary with continuation
40
+ * instructions for the model. Neither framing belongs in the ACP `summary`,
41
+ * and a continuation prompt whose framing is not recognized yields no summary
42
+ * at all rather than model-facing instructions.
43
+ */
44
+ export declare function compactionSummaryText(raw: string): string | undefined;
45
+ /** True for the post-compaction user message Claude Code persists (and
46
+ * `getSessionMessages` returns) with the summary of the dropped history. */
47
+ export declare function isCompactSummaryMessage(message: unknown): boolean;
10
48
  /**
11
- * Translates Claude's compaction signals into one idempotent ACP tool lifecycle.
49
+ * Translates Claude's compaction signals into one idempotent ACP lifecycle.
12
50
  *
13
51
  * The SDK can duplicate terminal compact_result messages and can omit the
14
52
  * opening status on replay. State therefore lives until the owning turn's
@@ -20,18 +58,66 @@ export declare class ContextCompactionLifecycle {
20
58
  private activeCompaction;
21
59
  private outputDelivered;
22
60
  private duplicateErrorOutput;
23
- constructor(sendUpdate: SendUpdate);
61
+ /** Summary reported by PostCompact before the opening status was consumed.
62
+ * Deliberately survives `reset()`: the CLI awaits the hook before emitting
63
+ * the compaction's terminal frames, so a pending summary always belongs to
64
+ * a compaction whose frames are still ahead of the consumer — possibly
65
+ * queued behind a previous turn's result. */
66
+ private pendingSummary;
67
+ private readonly sessionId;
68
+ readonly presentation: CompactionPresentation;
69
+ private readonly logError;
70
+ constructor(sendUpdate: SendUpdate, options: ContextCompactionLifecycleOptions);
24
71
  get hasDeliveredOutput(): boolean;
25
- reset(): void;
72
+ /**
73
+ * Close the lifecycle at a turn boundary (result, cancel, idle-abandon).
74
+ *
75
+ * A `compaction_update` entity still `in_progress` here never received its
76
+ * terminal signal from the runtime and gets its one terminal status,
77
+ * `cancelled`. The legacy tool call is deliberately left as it was (an
78
+ * `in_progress` call): ACP `ToolCallStatus` has no cancelled state and that
79
+ * presentation's behavior predates this lifecycle. Never throws — a failed
80
+ * send is logged, so callers can settle the turn unconditionally.
81
+ */
82
+ reset(): Promise<void>;
26
83
  /**
27
84
  * Claude also emits a failed manual compaction's error as local-command
28
- * stdout. Consume that one duplicate after the tool lifecycle carried it,
85
+ * stdout. Consume that one duplicate after the lifecycle carried it,
29
86
  * without hiding unrelated command output.
30
87
  */
31
88
  consumeDuplicateErrorOutput(content: string): boolean;
32
- start(sessionId: string, toolCallId: string): Promise<CompactionState>;
33
- heartbeat(sessionId: string, fallbackId: string): Promise<void>;
34
- finish(sessionId: string, fallbackId: string, status: CompactionStatus, metadata?: Omit<ContextCompactionMetadata, "version">, enrichTerminal?: boolean): Promise<void>;
89
+ start(compactionId: string): Promise<CompactionState>;
90
+ /**
91
+ * Streaming progress from the API's compaction content block.
92
+ *
93
+ * Under `compaction_update` the block's text is the retained summary and
94
+ * streams as `compaction_summary_chunk`s — but only into an entity the CLI
95
+ * announced with its `compacting` status. The block alone carries no
96
+ * terminal signal, so opening an entity from it would leave nothing but the
97
+ * turn-boundary `cancelled` to close a compaction that succeeded. The legacy
98
+ * tool call keeps its historical behavior: open on first sight, re-assert
99
+ * `in_progress` once.
100
+ */
101
+ heartbeat(fallbackId: string, summaryChunk?: string): Promise<void>;
102
+ /**
103
+ * The PostCompact hook's summary. The CLI awaits the hook before emitting
104
+ * the compaction's terminal frames, so the summary lands while its
105
+ * compaction is `in_progress` and rides on the terminal update. Anything
106
+ * else — no entity yet, or the entity is a previous, already-terminal
107
+ * compaction of the same turn whose status frame the consumer is still
108
+ * catching up to — belongs to the compaction whose frames are ahead of the
109
+ * consumer, and waits for it. Only the `compaction_update` presentation
110
+ * carries the summary; the legacy tool call never exposed it. Never throws:
111
+ * it runs detached from a hook callback. Returns whether a summary was
112
+ * retained.
113
+ */
114
+ recordSummary(rawSummary: unknown): boolean;
115
+ finish(compactionId: string, status: CompactionStatus, metadata?: Omit<ContextCompactionMetadata, "version">, enrichTerminal?: boolean): Promise<void>;
116
+ /** Make `compactionId` the active entity, moving a pending hook summary onto
117
+ * it, and mark compaction output as delivered for the owning turn. */
118
+ private open;
119
+ private send;
120
+ private sendQuietly;
35
121
  }
36
122
  export declare function contextCompactionMetadataFromBoundary(compactMetadata: {
37
123
  trigger: "manual" | "auto";
@@ -1 +1 @@
1
- {"version":3,"file":"context-compaction.d.ts","sourceRoot":"","sources":["../src/context-compaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,yBAAyB,EAE1B,MAAM,8BAA8B,CAAC;AAEtC,KAAK,gBAAgB,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/C,KAAK,eAAe,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,UAAU,GAAG,CAAC,YAAY,EAAE,mB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AAE,sBAAsB,CAAC;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4C;gBAGlD,UAAU,EAAE,UAAU,EACvC,OAAO,EAAE,iCAAiC;IAO5C,IAAI,kBAAkB,IAAI,OAAO,CAEhC;IAED;;;;;;;;;OASG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB5B;;;;OAIG;IACH,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAW/C,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA0B3D;;;;;;;;;;OAUG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBzE;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO;IAcrC,MAAM,CACV,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,GAAE,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAM,EACzD,cAAc,UAAQ,GACrB,OAAO,CAAC,IAAI,CAAC;IA6DhB;2EACuE;IACvE,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,IAAI;YAIE,WAAW;CAO1B;AAED,wBAAgB,qCAAqC,CAAC,eAAe,EAAE;IACrE,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAW7C"}
@@ -1,6 +1,87 @@
1
1
  import { createContextCompactionMeta, } from "./context-compaction-meta.js";
2
+ export function clientSupportsCompactionUpdates(capabilities) {
3
+ const compaction = capabilities?.session?.compaction;
4
+ return typeof compaction === "object" && compaction !== null && !Array.isArray(compaction);
5
+ }
6
+ /** Tags on their own line, as the model emits them; a summary that merely
7
+ * quotes `<summary>` mid-sentence must not be truncated at the mention. */
8
+ const SUMMARY_OPEN_LINE = /^[ \t]*<summary>[ \t]*\r?\n/gim;
9
+ const SUMMARY_CLOSE_LINE = /^[ \t]*<\/summary>[ \t]*$/gim;
10
+ /** The model's private reasoning block that precedes the summary; stripped
11
+ * first so a `<summary>` it merely mentions cannot anchor the summary span,
12
+ * and even when the summary tags themselves are missing. Own-line tags
13
+ * anywhere; inline tags only as a leading block, since a summary body may
14
+ * quote both tag names. */
15
+ const ANALYSIS_BLOCKS = [
16
+ /^[ \t]*<analysis>[ \t]*\r?\n[\s\S]*?\n[ \t]*<\/analysis>[ \t]*$/gim,
17
+ /^\s*<analysis>[\s\S]*?<\/analysis>/i,
18
+ ];
19
+ /** The framing Claude Code wraps around the retained summary when it persists
20
+ * it as the post-compaction user message. */
21
+ const CONTINUATION_PREAMBLE = /^\s*This session is being continued from a previous conversation/i;
22
+ const PERSISTED_PREAMBLE = /^\s*This session is being continued from a previous conversation[^\n]*\n+Summary:[ \t]*\r?\n/;
23
+ const PERSISTED_TRAILERS = [
24
+ /\n+If you need specific details from before compaction[\s\S]*$/,
25
+ /\n+(?:Please )?[Cc]ontinue the conversation from where it left (?:it )?off[\s\S]*$/,
26
+ ];
2
27
  /**
3
- * Translates Claude's compaction signals into one idempotent ACP tool lifecycle.
28
+ * Reduce Claude's compaction output to the user-displayable summary.
29
+ *
30
+ * The PostCompact hook reports the model's raw output, which wraps the
31
+ * summary in `<summary>` tags (often preceded by an `<analysis>` block). The
32
+ * persisted transcript instead frames the same summary with continuation
33
+ * instructions for the model. Neither framing belongs in the ACP `summary`,
34
+ * and a continuation prompt whose framing is not recognized yields no summary
35
+ * at all rather than model-facing instructions.
36
+ */
37
+ export function compactionSummaryText(raw) {
38
+ let text = raw;
39
+ for (const block of ANALYSIS_BLOCKS) {
40
+ text = text.replace(block, "");
41
+ }
42
+ const tagged = taggedSummary(text);
43
+ if (tagged !== undefined) {
44
+ text = tagged;
45
+ }
46
+ else if (CONTINUATION_PREAMBLE.test(text)) {
47
+ const body = text.replace(PERSISTED_PREAMBLE, "");
48
+ if (body === text)
49
+ return undefined;
50
+ text = body;
51
+ for (const trailer of PERSISTED_TRAILERS) {
52
+ text = text.replace(trailer, "");
53
+ }
54
+ }
55
+ text = text.trim();
56
+ return text.length > 0 ? text : undefined;
57
+ }
58
+ function taggedSummary(raw) {
59
+ const close = [...raw.matchAll(SUMMARY_CLOSE_LINE)].at(-1);
60
+ if (close?.index !== undefined) {
61
+ const open = [...raw.slice(0, close.index).matchAll(SUMMARY_OPEN_LINE)].at(-1);
62
+ if (open?.index !== undefined) {
63
+ return raw.slice(open.index + open[0].length, close.index);
64
+ }
65
+ }
66
+ // Inline tags: the widest span, so a quoted `</summary>` inside the body
67
+ // does not end it early. Plain index scans keep an unterminated tag linear.
68
+ const openInline = raw.search(/<summary>/i);
69
+ const closeInline = raw.toLowerCase().lastIndexOf("</summary>");
70
+ if (openInline >= 0 && closeInline > openInline) {
71
+ return raw.slice(openInline + "<summary>".length, closeInline);
72
+ }
73
+ return undefined;
74
+ }
75
+ /** True for the post-compaction user message Claude Code persists (and
76
+ * `getSessionMessages` returns) with the summary of the dropped history. */
77
+ export function isCompactSummaryMessage(message) {
78
+ return (typeof message === "object" &&
79
+ message !== null &&
80
+ message.type === "user" &&
81
+ message.isCompactSummary === true);
82
+ }
83
+ /**
84
+ * Translates Claude's compaction signals into one idempotent ACP lifecycle.
4
85
  *
5
86
  * The SDK can duplicate terminal compact_result messages and can omit the
6
87
  * opening status on replay. State therefore lives until the owning turn's
@@ -12,20 +93,51 @@ export class ContextCompactionLifecycle {
12
93
  activeCompaction;
13
94
  outputDelivered = false;
14
95
  duplicateErrorOutput;
15
- constructor(sendUpdate) {
96
+ /** Summary reported by PostCompact before the opening status was consumed.
97
+ * Deliberately survives `reset()`: the CLI awaits the hook before emitting
98
+ * the compaction's terminal frames, so a pending summary always belongs to
99
+ * a compaction whose frames are still ahead of the consumer — possibly
100
+ * queued behind a previous turn's result. */
101
+ pendingSummary;
102
+ sessionId;
103
+ presentation;
104
+ logError;
105
+ constructor(sendUpdate, options) {
16
106
  this.sendUpdate = sendUpdate;
107
+ this.sessionId = options.sessionId;
108
+ this.presentation = options.presentation ?? "tool_call";
109
+ this.logError = options.logError ?? (() => { });
17
110
  }
18
111
  get hasDeliveredOutput() {
19
112
  return this.outputDelivered;
20
113
  }
21
- reset() {
114
+ /**
115
+ * Close the lifecycle at a turn boundary (result, cancel, idle-abandon).
116
+ *
117
+ * A `compaction_update` entity still `in_progress` here never received its
118
+ * terminal signal from the runtime and gets its one terminal status,
119
+ * `cancelled`. The legacy tool call is deliberately left as it was (an
120
+ * `in_progress` call): ACP `ToolCallStatus` has no cancelled state and that
121
+ * presentation's behavior predates this lifecycle. Never throws — a failed
122
+ * send is logged, so callers can settle the turn unconditionally.
123
+ */
124
+ async reset() {
125
+ const state = this.activeCompaction;
22
126
  this.activeCompaction = undefined;
23
127
  this.outputDelivered = false;
24
128
  this.duplicateErrorOutput = undefined;
129
+ if (!state || state.terminalStatus || this.presentation !== "compaction_update")
130
+ return;
131
+ state.terminalStatus = "cancelled";
132
+ await this.sendQuietly({
133
+ sessionUpdate: "compaction_update",
134
+ compactionId: state.compactionId,
135
+ status: "cancelled",
136
+ }, "cancelled compaction");
25
137
  }
26
138
  /**
27
139
  * Claude also emits a failed manual compaction's error as local-command
28
- * stdout. Consume that one duplicate after the tool lifecycle carried it,
140
+ * stdout. Consume that one duplicate after the lifecycle carried it,
29
141
  * without hiding unrelated command output.
30
142
  */
31
143
  consumeDuplicateErrorOutput(content) {
@@ -36,92 +148,174 @@ export class ContextCompactionLifecycle {
36
148
  this.duplicateErrorOutput = undefined;
37
149
  return true;
38
150
  }
39
- async start(sessionId, toolCallId) {
151
+ async start(compactionId) {
40
152
  if (this.activeCompaction && !this.activeCompaction.terminalStatus) {
41
153
  return this.activeCompaction;
42
154
  }
43
- this.activeCompaction = { toolCallId, heartbeatSent: false };
44
- this.outputDelivered = true;
45
- await this.sendUpdate({
46
- sessionId,
47
- update: {
48
- sessionUpdate: "tool_call",
49
- toolCallId,
50
- title: "Compact conversation",
51
- kind: "think",
155
+ const state = this.open(compactionId);
156
+ if (this.presentation === "compaction_update") {
157
+ await this.send({
158
+ sessionUpdate: "compaction_update",
159
+ compactionId,
52
160
  status: "in_progress",
53
- _meta: compactionToolMeta(),
54
- },
161
+ _meta: createContextCompactionMeta(),
162
+ });
163
+ return state;
164
+ }
165
+ await this.send({
166
+ sessionUpdate: "tool_call",
167
+ toolCallId: compactionId,
168
+ title: "Compact conversation",
169
+ kind: "think",
170
+ status: "in_progress",
171
+ _meta: compactionToolMeta(),
55
172
  });
56
- return this.activeCompaction;
173
+ return state;
57
174
  }
58
- async heartbeat(sessionId, fallbackId) {
59
- const state = this.activeCompaction ?? (await this.start(sessionId, fallbackId));
175
+ /**
176
+ * Streaming progress from the API's compaction content block.
177
+ *
178
+ * Under `compaction_update` the block's text is the retained summary and
179
+ * streams as `compaction_summary_chunk`s — but only into an entity the CLI
180
+ * announced with its `compacting` status. The block alone carries no
181
+ * terminal signal, so opening an entity from it would leave nothing but the
182
+ * turn-boundary `cancelled` to close a compaction that succeeded. The legacy
183
+ * tool call keeps its historical behavior: open on first sight, re-assert
184
+ * `in_progress` once.
185
+ */
186
+ async heartbeat(fallbackId, summaryChunk) {
187
+ if (this.presentation === "compaction_update") {
188
+ const state = this.activeCompaction;
189
+ if (!state || state.terminalStatus || !summaryChunk)
190
+ return;
191
+ await this.send({
192
+ sessionUpdate: "compaction_summary_chunk",
193
+ compactionId: state.compactionId,
194
+ content: { type: "text", text: summaryChunk },
195
+ });
196
+ return;
197
+ }
198
+ const state = this.activeCompaction ?? (await this.start(fallbackId));
60
199
  if (state.terminalStatus || state.heartbeatSent)
61
200
  return;
62
201
  state.heartbeatSent = true;
63
- await this.sendUpdate({
64
- sessionId,
65
- update: {
66
- sessionUpdate: "tool_call_update",
67
- toolCallId: state.toolCallId,
68
- status: "in_progress",
69
- _meta: compactionToolMeta(),
70
- },
202
+ await this.send({
203
+ sessionUpdate: "tool_call_update",
204
+ toolCallId: state.compactionId,
205
+ status: "in_progress",
206
+ _meta: compactionToolMeta(),
71
207
  });
72
208
  }
73
- async finish(sessionId, fallbackId, status, metadata = {}, enrichTerminal = false) {
74
- const rawOutput = Object.keys(metadata).length > 0 ? metadata : undefined;
75
- if (!this.activeCompaction) {
76
- this.activeCompaction = {
77
- toolCallId: fallbackId,
78
- heartbeatSent: false,
79
- terminalStatus: status,
80
- };
81
- this.outputDelivered = true;
82
- if (status === "failed" && metadata.error) {
83
- this.duplicateErrorOutput = metadata.error;
84
- }
85
- await this.sendUpdate({
86
- sessionId,
87
- update: {
88
- sessionUpdate: "tool_call",
89
- toolCallId: fallbackId,
90
- title: "Compact conversation",
91
- kind: "think",
92
- status,
93
- ...(status === "failed" && metadata.error
94
- ? { content: [compactionErrorContent(metadata.error)] }
95
- : {}),
96
- ...(rawOutput ? { rawOutput } : {}),
97
- _meta: compactionToolMeta(metadata),
98
- },
99
- });
100
- return;
101
- }
209
+ /**
210
+ * The PostCompact hook's summary. The CLI awaits the hook before emitting
211
+ * the compaction's terminal frames, so the summary lands while its
212
+ * compaction is `in_progress` and rides on the terminal update. Anything
213
+ * else — no entity yet, or the entity is a previous, already-terminal
214
+ * compaction of the same turn whose status frame the consumer is still
215
+ * catching up to — belongs to the compaction whose frames are ahead of the
216
+ * consumer, and waits for it. Only the `compaction_update` presentation
217
+ * carries the summary; the legacy tool call never exposed it. Never throws:
218
+ * it runs detached from a hook callback. Returns whether a summary was
219
+ * retained.
220
+ */
221
+ recordSummary(rawSummary) {
222
+ if (this.presentation !== "compaction_update" || typeof rawSummary !== "string")
223
+ return false;
224
+ const summary = compactionSummaryText(rawSummary);
225
+ if (!summary)
226
+ return false;
102
227
  const state = this.activeCompaction;
103
- if (state.terminalStatus && !enrichTerminal)
104
- return;
105
- const firstTerminal = state.terminalStatus === undefined;
106
- if (firstTerminal)
228
+ if (state && !state.terminalStatus) {
229
+ state.summary = summary;
230
+ }
231
+ else {
232
+ this.pendingSummary = summary;
233
+ }
234
+ return true;
235
+ }
236
+ async finish(compactionId, status, metadata = {}, enrichTerminal = false) {
237
+ // The opening status can be missed (replay, or a terminal-only runtime):
238
+ // the first update for the ID is then already terminal.
239
+ const opened = this.activeCompaction === undefined;
240
+ const firstTerminal = !this.activeCompaction?.terminalStatus;
241
+ const state = this.activeCompaction ?? this.open(compactionId, status);
242
+ if (firstTerminal) {
107
243
  state.terminalStatus = status;
244
+ }
245
+ else if (!enrichTerminal) {
246
+ return;
247
+ }
108
248
  if (status === "failed" && metadata.error) {
109
249
  this.duplicateErrorOutput = metadata.error;
110
250
  }
111
- await this.sendUpdate({
112
- sessionId,
113
- update: {
114
- sessionUpdate: "tool_call_update",
115
- toolCallId: state.toolCallId,
116
- ...(firstTerminal ? { status } : {}),
117
- ...(status === "failed" && metadata.error
118
- ? { content: [compactionErrorContent(metadata.error)] }
119
- : {}),
251
+ const terminalStatus = state.terminalStatus ?? status;
252
+ const hasMetadata = Object.keys(metadata).length > 0;
253
+ if (this.presentation === "compaction_update") {
254
+ const summary = firstTerminal && terminalStatus === "completed" ? state.summary : undefined;
255
+ await this.send({
256
+ sessionUpdate: "compaction_update",
257
+ compactionId: state.compactionId,
258
+ status: terminalStatus,
259
+ ...(summary !== undefined ? { summary: [{ type: "text", text: summary }] } : {}),
260
+ ...(terminalStatus === "failed" && metadata.error ? { error: metadata.error } : {}),
261
+ // `_meta` is a replace-patch: seed it with the first terminal, then
262
+ // only re-send it when the boundary adds facts, so a status-only
263
+ // duplicate can't wipe the token counts.
264
+ ...(firstTerminal || hasMetadata ? { _meta: createContextCompactionMeta(metadata) } : {}),
265
+ });
266
+ return;
267
+ }
268
+ const rawOutput = hasMetadata ? metadata : undefined;
269
+ const errorContent = status === "failed" && metadata.error
270
+ ? { content: [compactionErrorContent(metadata.error)] }
271
+ : {};
272
+ if (opened) {
273
+ await this.send({
274
+ sessionUpdate: "tool_call",
275
+ toolCallId: state.compactionId,
276
+ title: "Compact conversation",
277
+ kind: "think",
278
+ status,
279
+ ...errorContent,
120
280
  ...(rawOutput ? { rawOutput } : {}),
121
281
  _meta: compactionToolMeta(metadata),
122
- },
282
+ });
283
+ return;
284
+ }
285
+ await this.send({
286
+ sessionUpdate: "tool_call_update",
287
+ toolCallId: state.compactionId,
288
+ ...(firstTerminal ? { status } : {}),
289
+ ...errorContent,
290
+ ...(rawOutput ? { rawOutput } : {}),
291
+ _meta: compactionToolMeta(metadata),
123
292
  });
124
293
  }
294
+ /** Make `compactionId` the active entity, moving a pending hook summary onto
295
+ * it, and mark compaction output as delivered for the owning turn. */
296
+ open(compactionId, terminalStatus) {
297
+ const state = {
298
+ compactionId,
299
+ heartbeatSent: false,
300
+ ...(terminalStatus ? { terminalStatus } : {}),
301
+ ...(this.pendingSummary !== undefined ? { summary: this.pendingSummary } : {}),
302
+ };
303
+ this.pendingSummary = undefined;
304
+ this.activeCompaction = state;
305
+ this.outputDelivered = true;
306
+ return state;
307
+ }
308
+ send(update) {
309
+ return this.sendUpdate({ sessionId: this.sessionId, update });
310
+ }
311
+ async sendQuietly(update, what) {
312
+ try {
313
+ await this.send(update);
314
+ }
315
+ catch (error) {
316
+ this.logError(`Failed to send the ${what} update for session ${this.sessionId}`, error);
317
+ }
318
+ }
125
319
  }
126
320
  export function contextCompactionMetadataFromBoundary(compactMetadata) {
127
321
  return {
@@ -57,8 +57,9 @@ export declare function extractAskUserQuestions(input: Record<string, unknown>):
57
57
  *
58
58
  * Each question is followed by its own optional free-text "custom answer" field
59
59
  * (`question_<n>_custom`), mirroring the CLI's per-question "Other" box: the
60
- * user can type their own answer instead of (or, for a multi-select question,
61
- * as well as) picking an option, scoped to that specific question. Nothing is
60
+ * user can type their own answer instead of picking an option, add it to a
61
+ * multi-select's picks, or attach it as a note to a single-select's pick (see
62
+ * `applyAskElicitationResponse`), scoped to that specific question. Nothing is
62
63
  * marked required, so the user can also just skip — matching the built-in tool,
63
64
  * which always offers Skip + a free-text box.
64
65
  */
@@ -77,11 +78,15 @@ export type AskUserQuestionOutcome = {
77
78
  * `answers` as a `{ [questionText]: label }` map — the key shape the tool's own
78
79
  * `call()` reads — with multi-selects comma-joined in the CLI's own quoted form
79
80
  * (see `joinMultiSelectAnswer`). A non-empty per-question custom-answer field
80
- * (`question_<n>_custom`) replaces the selection of a single-select question,
81
- * since the user typed their own answer instead of picking one, and joins the
82
- * selection of a multi-select question, where the two fields are independent
83
- * and filling both means both. Decline yields empty answers (the model is told
84
- * the user skipped rather than the turn aborting); cancel — and any
81
+ * (`question_<n>_custom`) joins the selection of a multi-select question, where
82
+ * the two fields are independent and filling both means both. For a
83
+ * single-select question it is the answer when nothing was picked (the user
84
+ * typed their own instead), and otherwise travels beside the pick as the
85
+ * tool's own per-question `annotations[question].notes` — the slot the CLI
86
+ * uses for free text attached to a selection and renders to the model as
87
+ * `"Q"="A" notes: ...` — so a client that presents the box as a notes field
88
+ * cannot make the selection disappear. Decline yields empty answers (the model
89
+ * is told the user skipped rather than the turn aborting); cancel — and any
85
90
  * custom/future action we don't understand — aborts the tool call.
86
91
  */
87
92
  export declare function applyAskElicitationResponse(response: CreateElicitationResponse, toolInput: Record<string, unknown>, questions: AskUserQuestion[]): AskUserQuestionOutcome;
@@ -1 +1 @@
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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@ -108,8 +108,9 @@ const CUSTOM_ANSWER_META_KEY = "_askUserQuestionCustomAnswer";
108
108
  *
109
109
  * Each question is followed by its own optional free-text "custom answer" field
110
110
  * (`question_<n>_custom`), mirroring the CLI's per-question "Other" box: the
111
- * user can type their own answer instead of (or, for a multi-select question,
112
- * as well as) picking an option, scoped to that specific question. Nothing is
111
+ * user can type their own answer instead of picking an option, add it to a
112
+ * multi-select's picks, or attach it as a note to a single-select's pick (see
113
+ * `applyAskElicitationResponse`), scoped to that specific question. Nothing is
113
114
  * marked required, so the user can also just skip — matching the built-in tool,
114
115
  * which always offers Skip + a free-text box.
115
116
  */
@@ -146,7 +147,7 @@ export function askUserQuestionsToCreateRequest(questions, sessionId, toolCallId
146
147
  title: "Other",
147
148
  description: question.multiSelect
148
149
  ? "Type your own answer to add to your selection above (optional)."
149
- : "Type your own answer instead of choosing an option above (optional).",
150
+ : "Type your own answer, or add a note to the option you chose above (optional).",
150
151
  _meta: {
151
152
  [CUSTOM_ANSWER_META_KEY]: {
152
153
  questionId: questionFieldKey(index),
@@ -187,11 +188,15 @@ function joinMultiSelectAnswer(items) {
187
188
  * `answers` as a `{ [questionText]: label }` map — the key shape the tool's own
188
189
  * `call()` reads — with multi-selects comma-joined in the CLI's own quoted form
189
190
  * (see `joinMultiSelectAnswer`). A non-empty per-question custom-answer field
190
- * (`question_<n>_custom`) replaces the selection of a single-select question,
191
- * since the user typed their own answer instead of picking one, and joins the
192
- * selection of a multi-select question, where the two fields are independent
193
- * and filling both means both. Decline yields empty answers (the model is told
194
- * the user skipped rather than the turn aborting); cancel — and any
191
+ * (`question_<n>_custom`) joins the selection of a multi-select question, where
192
+ * the two fields are independent and filling both means both. For a
193
+ * single-select question it is the answer when nothing was picked (the user
194
+ * typed their own instead), and otherwise travels beside the pick as the
195
+ * tool's own per-question `annotations[question].notes` — the slot the CLI
196
+ * uses for free text attached to a selection and renders to the model as
197
+ * `"Q"="A" notes: ...` — so a client that presents the box as a notes field
198
+ * cannot make the selection disappear. Decline yields empty answers (the model
199
+ * is told the user skipped rather than the turn aborting); cancel — and any
195
200
  * custom/future action we don't understand — aborts the tool call.
196
201
  */
197
202
  export function applyAskElicitationResponse(response, toolInput, questions) {
@@ -205,6 +210,7 @@ export function applyAskElicitationResponse(response, toolInput, questions) {
205
210
  // Typed against the tool's own output schema so the answer/response shapes
206
211
  // stay in sync with what the built-in tool's call() expects to read back.
207
212
  const answers = {};
213
+ const annotations = {};
208
214
  questions.forEach((question, index) => {
209
215
  const custom = content[questionCustomFieldKey(index)];
210
216
  const customText = typeof custom === "string" ? custom.trim() : "";
@@ -214,21 +220,42 @@ export function applyAskElicitationResponse(response, toolInput, questions) {
214
220
  : Array.isArray(value)
215
221
  ? value.filter((item) => item !== undefined && item !== null && item !== "").map(String)
216
222
  : [String(value)];
217
- // A single-select question is answered by exactly one thing, so a typed
218
- // custom answer replaces the pick: the user wrote their own answer instead
219
- // of choosing an option. A multi-select is additive, and the form offers
220
- // the selection and the custom box as independent fields — a user who
221
- // fills both means both, so the typed answer joins the checked options.
222
- const items = customText === "" ? picks : question.multiSelect ? [...picks, customText] : [customText];
223
- // A single-select normally holds one item; the plain join only matters if a
224
- // client hands back an array for it, and then mirrors the old behavior.
225
- const text = question.multiSelect ? joinMultiSelectAnswer(items) : items.join(", ");
226
- if (text === "") {
223
+ // A multi-select is additive, and the form offers the selection and the
224
+ // custom box as independent fields — a user who fills both means both, so
225
+ // the typed answer joins the checked options.
226
+ if (question.multiSelect) {
227
+ const text = joinMultiSelectAnswer(customText === "" ? picks : [...picks, customText]);
228
+ if (text !== "") {
229
+ answers[question.question] = text;
230
+ }
231
+ return;
232
+ }
233
+ // A single-select question is answered by exactly one thing. With no option
234
+ // picked, the typed text is that answer (the CLI's "Other"). With an option
235
+ // picked as well, the pick stays the answer and the text rides along as the
236
+ // tool's per-question `notes` annotation, so neither is lost. A single-select
237
+ // normally holds one item; the plain join only matters if a client hands
238
+ // back an array for it, and then mirrors the old behavior.
239
+ const picked = picks.join(", ");
240
+ if (picked === "") {
241
+ if (customText !== "") {
242
+ answers[question.question] = customText;
243
+ }
227
244
  return;
228
245
  }
229
- answers[question.question] = text;
246
+ answers[question.question] = picked;
247
+ if (customText !== "") {
248
+ annotations[question.question] = { notes: customText };
249
+ }
230
250
  });
231
- return { action: "answered", updatedInput: { ...toolInput, answers } };
251
+ return {
252
+ action: "answered",
253
+ updatedInput: {
254
+ ...toolInput,
255
+ answers,
256
+ ...(Object.keys(annotations).length > 0 ? { annotations } : {}),
257
+ },
258
+ };
232
259
  }
233
260
  /**
234
261
  * Coerce an arbitrary MCP `requestedSchema` into an ACP `ElicitationSchema`.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.77.0",
6
+ "version": "0.77.1-preview.2",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",