@agentclientprotocol/claude-agent-acp 0.102.1-preview.1 → 0.102.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.
Files changed (203) hide show
  1. package/README.md +5 -1
  2. package/dist/acp-agent.d.ts +113 -439
  3. package/dist/acp-agent.d.ts.map +1 -1
  4. package/dist/acp-agent.js +362 -2409
  5. package/dist/acp-subagents.d.ts +1 -2
  6. package/dist/acp-subagents.d.ts.map +1 -1
  7. package/dist/auth-methods.d.ts +21 -0
  8. package/dist/auth-methods.d.ts.map +1 -0
  9. package/dist/auth-methods.js +68 -0
  10. package/dist/auth-status-reporter.d.ts +112 -0
  11. package/dist/auth-status-reporter.d.ts.map +1 -0
  12. package/dist/auth-status-reporter.js +253 -0
  13. package/dist/background-work.d.ts +12 -265
  14. package/dist/background-work.d.ts.map +1 -1
  15. package/dist/background-work.js +8 -558
  16. package/dist/client-system-prompt.d.ts +7 -0
  17. package/dist/client-system-prompt.d.ts.map +1 -1
  18. package/dist/client-system-prompt.js +24 -0
  19. package/dist/context-compaction.d.ts +20 -0
  20. package/dist/context-compaction.d.ts.map +1 -1
  21. package/dist/context-compaction.js +26 -0
  22. package/dist/context-window.d.ts +70 -0
  23. package/dist/context-window.d.ts.map +1 -0
  24. package/dist/context-window.js +132 -0
  25. package/dist/diff.d.ts +1 -1
  26. package/dist/diff.js +1 -1
  27. package/dist/elicitation.d.ts +66 -1
  28. package/dist/elicitation.d.ts.map +1 -1
  29. package/dist/elicitation.js +109 -0
  30. package/dist/file-change-audit.d.ts +4 -3
  31. package/dist/file-change-audit.d.ts.map +1 -1
  32. package/dist/file-change-audit.js +3 -2
  33. package/dist/mcp-oauth.d.ts +44 -0
  34. package/dist/mcp-oauth.d.ts.map +1 -0
  35. package/dist/mcp-oauth.js +142 -0
  36. package/dist/mcp-servers.d.ts +10 -0
  37. package/dist/mcp-servers.d.ts.map +1 -0
  38. package/dist/mcp-servers.js +29 -0
  39. package/dist/native-subagents.d.ts +18 -8
  40. package/dist/native-subagents.d.ts.map +1 -1
  41. package/dist/native-subagents.js +7 -35
  42. package/dist/permissions/presentation.d.ts +29 -0
  43. package/dist/permissions/presentation.d.ts.map +1 -1
  44. package/dist/permissions/presentation.js +38 -11
  45. package/dist/prompt-suggestions.d.ts +29 -0
  46. package/dist/prompt-suggestions.d.ts.map +1 -1
  47. package/dist/prompt-suggestions.js +45 -0
  48. package/dist/providers.d.ts +139 -0
  49. package/dist/providers.d.ts.map +1 -0
  50. package/dist/providers.js +286 -0
  51. package/dist/remote-control.d.ts +62 -0
  52. package/dist/remote-control.d.ts.map +1 -0
  53. package/dist/remote-control.js +78 -0
  54. package/dist/result-end.d.ts +39 -0
  55. package/dist/result-end.d.ts.map +1 -0
  56. package/dist/result-end.js +50 -0
  57. package/dist/serve.d.ts +7 -2
  58. package/dist/serve.d.ts.map +1 -1
  59. package/dist/serve.js +10 -5
  60. package/dist/session-config-ids.d.ts +1 -0
  61. package/dist/session-config-ids.d.ts.map +1 -1
  62. package/dist/session-config-ids.js +1 -0
  63. package/dist/session-config-options.d.ts +64 -0
  64. package/dist/session-config-options.d.ts.map +1 -0
  65. package/dist/session-config-options.js +162 -0
  66. package/dist/session-effort.d.ts +67 -0
  67. package/dist/session-effort.d.ts.map +1 -1
  68. package/dist/session-effort.js +98 -0
  69. package/dist/session-env.d.ts +22 -0
  70. package/dist/session-env.d.ts.map +1 -0
  71. package/dist/session-env.js +66 -0
  72. package/dist/session-fast-mode.d.ts +83 -0
  73. package/dist/session-fast-mode.d.ts.map +1 -0
  74. package/dist/session-fast-mode.js +142 -0
  75. package/dist/session-index/connection.d.ts +2 -5
  76. package/dist/session-index/connection.d.ts.map +1 -1
  77. package/dist/session-index/connection.js +3 -5
  78. package/dist/session-mode.d.ts +1 -0
  79. package/dist/session-mode.d.ts.map +1 -1
  80. package/dist/session-mode.js +1 -1
  81. package/dist/session-model.d.ts +41 -0
  82. package/dist/session-model.d.ts.map +1 -1
  83. package/dist/session-model.js +110 -45
  84. package/dist/session-notices.d.ts +44 -0
  85. package/dist/session-notices.d.ts.map +1 -1
  86. package/dist/session-notices.js +68 -0
  87. package/dist/session-titles.d.ts +34 -12
  88. package/dist/session-titles.d.ts.map +1 -1
  89. package/dist/session-titles.js +7 -6
  90. package/dist/session-usage.d.ts +125 -0
  91. package/dist/session-usage.d.ts.map +1 -0
  92. package/dist/session-usage.js +196 -0
  93. package/dist/streamed-text.d.ts +33 -0
  94. package/dist/streamed-text.d.ts.map +1 -0
  95. package/dist/streamed-text.js +71 -0
  96. package/dist/subagent-configuration.d.ts +32 -0
  97. package/dist/subagent-configuration.d.ts.map +1 -0
  98. package/dist/subagent-configuration.js +70 -0
  99. package/dist/subagent-replay.d.ts +18 -0
  100. package/dist/subagent-replay.d.ts.map +1 -1
  101. package/dist/subagent-replay.js +25 -15
  102. package/dist/tool-calls/client-capabilities.d.ts +8 -8
  103. package/dist/tool-calls/client-capabilities.js +4 -4
  104. package/dist/tool-calls/renderer.d.ts +4 -5
  105. package/dist/tool-calls/renderer.d.ts.map +1 -1
  106. package/dist/tool-calls/renderer.js +4 -5
  107. package/dist/turn-events.d.ts +6 -46
  108. package/dist/turn-events.d.ts.map +1 -1
  109. package/dist/v2/agent.d.ts +7 -11
  110. package/dist/v2/agent.d.ts.map +1 -1
  111. package/dist/v2/agent.js +751 -331
  112. package/dist/v2/air.d.ts +33 -0
  113. package/dist/v2/air.d.ts.map +1 -0
  114. package/dist/v2/air.js +29 -0
  115. package/dist/v2/auth.d.ts +97 -0
  116. package/dist/v2/auth.d.ts.map +1 -0
  117. package/dist/v2/auth.js +216 -0
  118. package/dist/v2/background.d.ts +27 -16
  119. package/dist/v2/background.d.ts.map +1 -1
  120. package/dist/v2/background.js +4 -32
  121. package/dist/v2/child-config.d.ts +55 -0
  122. package/dist/v2/child-config.d.ts.map +1 -0
  123. package/dist/v2/child-config.js +92 -0
  124. package/dist/v2/clear-context.d.ts +94 -0
  125. package/dist/v2/clear-context.d.ts.map +1 -0
  126. package/dist/v2/clear-context.js +176 -0
  127. package/dist/v2/commands.d.ts +46 -0
  128. package/dist/v2/commands.d.ts.map +1 -0
  129. package/dist/v2/commands.js +54 -0
  130. package/dist/v2/config.d.ts +187 -0
  131. package/dist/v2/config.d.ts.map +1 -0
  132. package/dist/v2/config.js +494 -0
  133. package/dist/v2/elicitation.d.ts +93 -0
  134. package/dist/v2/elicitation.d.ts.map +1 -0
  135. package/dist/v2/elicitation.js +160 -0
  136. package/dist/v2/file-changes.d.ts +61 -0
  137. package/dist/v2/file-changes.d.ts.map +1 -0
  138. package/dist/v2/file-changes.js +108 -0
  139. package/dist/v2/file-preview.d.ts +18 -0
  140. package/dist/v2/file-preview.d.ts.map +1 -0
  141. package/dist/v2/file-preview.js +29 -0
  142. package/dist/v2/initialize.d.ts +10 -24
  143. package/dist/v2/initialize.d.ts.map +1 -1
  144. package/dist/v2/initialize.js +4 -111
  145. package/dist/v2/outcome.d.ts +81 -0
  146. package/dist/v2/outcome.d.ts.map +1 -0
  147. package/dist/v2/outcome.js +165 -0
  148. package/dist/v2/permissions.d.ts +92 -0
  149. package/dist/v2/permissions.d.ts.map +1 -0
  150. package/dist/v2/permissions.js +162 -0
  151. package/dist/v2/prompt.d.ts +2 -42
  152. package/dist/v2/prompt.d.ts.map +1 -1
  153. package/dist/v2/prompt.js +2 -119
  154. package/dist/v2/remote-control.d.ts +41 -0
  155. package/dist/v2/remote-control.d.ts.map +1 -0
  156. package/dist/v2/remote-control.js +63 -0
  157. package/dist/v2/reports.d.ts +198 -0
  158. package/dist/v2/reports.d.ts.map +1 -0
  159. package/dist/v2/reports.js +487 -0
  160. package/dist/v2/restarts.d.ts +128 -0
  161. package/dist/v2/restarts.d.ts.map +1 -0
  162. package/dist/v2/restarts.js +348 -0
  163. package/dist/v2/session-requests.d.ts +20 -0
  164. package/dist/v2/session-requests.d.ts.map +1 -0
  165. package/dist/v2/session-requests.js +108 -0
  166. package/dist/v2/session-update.d.ts +2 -13
  167. package/dist/v2/session-update.d.ts.map +1 -1
  168. package/dist/v2/session-update.js +2 -22
  169. package/dist/v2/session.d.ts +340 -41
  170. package/dist/v2/session.d.ts.map +1 -1
  171. package/dist/v2/session.js +1223 -141
  172. package/dist/v2/setup.d.ts +49 -0
  173. package/dist/v2/setup.d.ts.map +1 -0
  174. package/dist/v2/setup.js +62 -0
  175. package/dist/v2/stopped-work.d.ts +123 -0
  176. package/dist/v2/stopped-work.d.ts.map +1 -0
  177. package/dist/v2/stopped-work.js +210 -0
  178. package/dist/v2/stream.d.ts +228 -0
  179. package/dist/v2/stream.d.ts.map +1 -0
  180. package/dist/v2/stream.js +506 -0
  181. package/dist/v2/subagent-replay.d.ts +115 -0
  182. package/dist/v2/subagent-replay.d.ts.map +1 -0
  183. package/dist/v2/subagent-replay.js +479 -0
  184. package/dist/v2/subscription-guard.d.ts +60 -0
  185. package/dist/v2/subscription-guard.d.ts.map +1 -0
  186. package/dist/v2/subscription-guard.js +84 -0
  187. package/dist/v2/tasks.d.ts +492 -0
  188. package/dist/v2/tasks.d.ts.map +1 -0
  189. package/dist/v2/tasks.js +1728 -0
  190. package/dist/v2/terminal.d.ts.map +1 -1
  191. package/dist/v2/terminal.js +6 -1
  192. package/dist/v2/tool-call.d.ts +3 -2
  193. package/dist/v2/tool-call.d.ts.map +1 -1
  194. package/dist/v2/update-translator.d.ts +36 -0
  195. package/dist/v2/update-translator.d.ts.map +1 -0
  196. package/dist/v2/update-translator.js +80 -0
  197. package/dist/workflow-progress.d.ts +23 -0
  198. package/dist/workflow-progress.d.ts.map +1 -1
  199. package/dist/workflow-progress.js +31 -8
  200. package/package.json +1 -1
  201. package/dist/v2/permission.d.ts +0 -28
  202. package/dist/v2/permission.d.ts.map +0 -1
  203. package/dist/v2/permission.js +0 -41
@@ -1,8 +1,9 @@
1
- import { AgentApp, AuthenticateRequest, AvailableCommand, CancelNotification, ClientCapabilities, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, DisableProviderRequest, DisableProviderResponse, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListProvidersRequest, ListProvidersResponse, McpServer, LlmProtocol, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, LogoutRequest, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, SetProviderRequest, SetProviderResponse, RequestPermissionResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, WriteTextFileRequest, WriteTextFileResponse } from "@agentclientprotocol/sdk/unstable";
2
- import type { ForegroundEvents, TurnEvents, TurnOutcome } from "./turn-events.js";
3
- import { AgentInfo, CanUseTool, FastModeDisabledReason, FastModeState, ModelInfo, Options, PermissionMode, Query, SDKMessageOrigin, SDKPartialAssistantMessage, SDKUserMessage, Settings } from "@anthropic-ai/claude-agent-sdk";
1
+ import { AgentApp, AuthenticateRequest, AvailableCommand, CancelNotification, ClientCapabilities, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, DisableProviderRequest, DisableProviderResponse, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListProvidersRequest, ListProvidersResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, LogoutRequest, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, SetProviderRequest, SetProviderResponse, RequestPermissionResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, WriteTextFileRequest, WriteTextFileResponse } from "@agentclientprotocol/sdk/unstable";
2
+ import type { TurnEvents, TurnOutcome } from "./turn-events.js";
3
+ import { AgentInfo, CanUseTool, FastModeDisabledReason, ModelInfo, Options, PermissionMode, Query, SDKMessage, SDKMessageOrigin, SDKPartialAssistantMessage, SDKUserMessage, Settings, SlashCommand } from "@anthropic-ai/claude-agent-sdk";
4
4
  import { GoalRequest, GoalControlResponse, GoalSnapshot } from "./goal-extension.js";
5
5
  import { type SubagentChecklists } from "./plans.js";
6
+ import { PromptSuggestions } from "./prompt-suggestions.js";
6
7
  import { SessionTitles } from "./session-titles.js";
7
8
  import { AcpSessionNotification } from "./acp-subagents.js";
8
9
  import { NativeSubagent, NativeSubagentRuntime } from "./native-subagents.js";
@@ -10,7 +11,7 @@ import * as sessionIndex from "./session-index/connection.js";
10
11
  import type { BatchGetSessionsRequest, RenameSessionRequest, SessionIdRequest } from "./session-index/service.js";
11
12
  import type { ListSubscribeRequest, ListUnsubscribeRequest } from "./session-index/list-subscriptions.js";
12
13
  import { AsyncTaskRuntime } from "./async-tasks.js";
13
- import { type BackgroundSink, SessionBackgroundWork } from "./background-work.js";
14
+ import { SessionBackgroundWork } from "./background-work.js";
14
15
  import { type AuthStatus, type AuthStatusKind } from "./auth-status.js";
15
16
  import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
16
17
  import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
@@ -22,15 +23,18 @@ import { type FileChangeReportTurnState, type NativeFileChangeReporter } from ".
22
23
  import { ContextCompactionLifecycle } from "./context-compaction.js";
23
24
  import { IdleCompaction } from "./idle-compaction.js";
24
25
  import { TaskState } from "./tools.js";
26
+ import { type AccumulatedUsage, type ModelTokenTally } from "./session-usage.js";
25
27
  import { ToolCallFieldTracker } from "./tool-calls/field-tracker.js";
26
28
  import { ClientCapabilities as ToolCallClientCapabilities } from "./tool-calls/client-capabilities.js";
27
29
  import { Pushable } from "./utils.js";
28
30
  export { DEFAULT_AGENT_ID } from "./session-config-ids.js";
29
- import { MODE_CONFIG_ID } from "./session-mode.js";
30
31
  import { type SessionModelState } from "./session-model.js";
31
- import { type UltracodeOptionState } from "./session-ultracode.js";
32
+ import { type GatewayAuthRequest, type ProviderConfig } from "./providers.js";
33
+ export { AGENT_CONFIG_ID, BUILTIN_AGENT_NAMES, buildConfigOptions, clientSupportsBooleanConfigOptions, clientSupportsRecommendedConfigValue, type ConfigOptionPresentation, discoverCustomAgents, MODE_CONFIG_ID, } from "./session-config-options.js";
34
+ export { createFastModeConfigOption, FAST_MODE_CONFIG_ID, FAST_MODE_OFF, FAST_MODE_ON, fastModeStateEnabled, type FastModeOptionState, normalizeFastModeDisabledReason, resolveFastModeEnabled, } from "./session-fast-mode.js";
32
35
  export { EFFORT_CONFIG_ID, settingsEffortForModel } from "./session-effort.js";
33
36
  export { applyAvailableModelsAllowlist, matchResumedModel, MODEL_CONFIG_ID, resolveModelPreference, } from "./session-model.js";
37
+ export { isLoginRequiredText } from "./result-end.js";
34
38
  /**
35
39
  * Logger interface for customizing logging output
36
40
  */
@@ -40,15 +44,6 @@ export interface Logger {
40
44
  /** Optional: a caller that supplies no `warn` gets its warnings on `error`. */
41
45
  warn?: (...args: any[]) => void;
42
46
  }
43
- type AccumulatedUsage = {
44
- inputTokens: number;
45
- outputTokens: number;
46
- cachedReadTokens: number;
47
- cachedWriteTokens: number;
48
- };
49
- /** Per-model token tallies keyed by the model id the SDK reported them under
50
- * (its resolved spelling, e.g. "claude-opus-5[1m]"). */
51
- type ModelTokenTally = Record<string, AccumulatedUsage>;
52
47
  /** The structured replacement for the text of a local command that Claude
53
48
  * Code runs itself, such as `/usage` or `/mcp`. */
54
49
  type LocalCommandMarkdown = {
@@ -318,9 +313,6 @@ type OpenUserInput = {
318
313
  /** The subagent that asked: absent for the main conversation and for a
319
314
  * request that names no agent. */
320
315
  agentID?: string;
321
- /** Set by a cancel that comes while the request is open (see
322
- * `withPendingUserInput`). */
323
- cancelled?: boolean;
324
316
  };
325
317
  export type Session = {
326
318
  query: Query;
@@ -363,15 +355,8 @@ export type Session = {
363
355
  /** Last goal snapshot sent to the ACP client, used to roll back an
364
356
  * optimistic `/goal` update when the command itself fails. */
365
357
  lastPublishedGoal?: GoalSnapshot | null;
366
- /** Last follow-up prompt sent to the ACP client (`null` after a clear), so an
367
- * unchanged prediction is not re-notified. Undefined until the first push. */
368
- lastPublishedPromptSuggestion?: string | null;
369
- /** Whether an arriving `prompt_suggestion` still answers the turn the user is
370
- * waiting on: set at a turn's result, cleared when the next prompt arrives.
371
- * A prediction the user outran — the next prompt was sent before the
372
- * prediction was read off the stream — follows a turn that is already
373
- * answered, so it is dropped instead of published mid-turn. */
374
- promptSuggestionExpected?: boolean;
358
+ /** The follow-up prompt the client holds, for an AIR client only. */
359
+ promptSuggestions?: PromptSuggestions;
375
360
  /** Count of result messages the consumer should treat as orphans and skip
376
361
  * (not promote/attribute to the current head). When cancel() settles+removes
377
362
  * a queued turn, that turn's user message was already pushed to the SDK, so
@@ -585,8 +570,7 @@ export type Session = {
585
570
  forwardSubagentText: boolean;
586
571
  /** The ACP permission and elicitation requests that await user input.
587
572
  * Parallel subagents can ask concurrently. Steering stays non-interrupting
588
- * while any request is open; the foreground work awaits the user while one
589
- * that blocks it is open (see {@link blocksForeground}). */
573
+ * while any request is open, and the idle compaction waits until none is. */
590
574
  openUserInputs?: Set<OpenUserInput>;
591
575
  /** Context window size of the session's current model, carried across
592
576
  * prompts so mid-stream usage_update notifications report a correct `size`
@@ -650,8 +634,8 @@ export type Session = {
650
634
  /** The tool uses that the consumer reached in the stream, each with whether
651
635
  * it dropped it as output of the work a cancel stopped (`true`, see
652
636
  * `dropsStoppedWorkOutput`). The first sight of a tool use decides: its
653
- * streamed start, or its complete message. `canUseTool` and the v2 preview
654
- * hook read it (see `isStoppedWorkToolUse`). The oldest entries are
637
+ * streamed start, or its complete message. `canUseTool` reads it (see
638
+ * `isStoppedWorkToolUse`). The oldest entries are
655
639
  * dropped. */
656
640
  reachedToolUses?: Map<string, boolean>;
657
641
  /** What waits for the consumer to reach each tool use (see
@@ -757,17 +741,14 @@ export type Session = {
757
741
  * `perTaskStopAffordance`: then it spares both, and the client is expected
758
742
  * to stop each one itself. A client that can cancel one subagent gets the
759
743
  * declaration, but it has no control for a workflow unless it is AIR with
760
- * `asyncTasks` (`_session/async_task/stop`), or gets the session's
761
- * background work (`background.reported`, with `tool_call/cancel`), which
762
- * `session/cancel` must leave running. So for any other such client the
744
+ * `asyncTasks` (`_session/async_task/stop`). So for any other such client the
763
745
  * adapter stops the workflows after the interrupt, as the interrupt did
764
746
  * before. */
765
747
  stopsWorkflowsOnCancel?: boolean;
766
- /** The tasks that Claude Code runs in the background for the session: the
767
- * terminals of commands, kept for a client that renders terminals and is
768
- * not AIR (AIR shows a command through its async tasks), and, when the
769
- * client gets the session's background work, the tool calls of tasks and
770
- * the `background` lists. Per CLI process, as is a session. */
748
+ /** The terminals of the commands that Claude Code runs in the background
749
+ * for the session, kept for a client that renders terminals and is not
750
+ * AIR (AIR shows a command through its async tasks). Per CLI process, as
751
+ * is a session. */
771
752
  background: SessionBackgroundWork;
772
753
  /** The parent tool call of each subagent that a settle bookend removed from
773
754
  * `liveBackgroundTasks`. The SDK can resume such a subagent under the same
@@ -901,6 +882,29 @@ export type Session = {
901
882
  /** The in-flight recreation, so turns that arrive together share one. */
902
883
  signOutRespawn?: Promise<void>;
903
884
  } & sessionIndex.SessionIndexFields;
885
+ /** Result-message origin kinds that mark an AUTONOMOUS cycle — work the
886
+ * model did on its own (a task-notification followup, a peer/coordinator/
887
+ * observer message it handled) rather than the user's prompt. Absent,
888
+ * `human`, and `channel` origins are the user's own turn (this adapter's
889
+ * prompts arrive as the ACP channel on some CLI configurations — ALL
890
+ * channel servers are treated as user, so a foreign channel integration's
891
+ * autonomously-handled result is misclassified as the user's; accepted,
892
+ * see below), and `auto-continuation` continues the user's turn, so its
893
+ * result is the turn's real terminal.
894
+ *
895
+ * Deliberately fail-OPEN: an unknown future kind defaults to the user
896
+ * lane — including `unclassified` (SDK 0.3.232+), the CLI's own "couldn't
897
+ * attribute this" marker, which gets the same safe default. Misrouting a
898
+ * USER result into the autonomous lane hangs the prompt un-detectably
899
+ * (the result is skipped, its trailing idle absorbed as owed, so the
900
+ * #825 detector can't fire); misrouting an autonomous result into the
901
+ * user lane is the bounded misattribution class this set exists to
902
+ * reduce.
903
+ *
904
+ * Exception: a result from one of these origins that names a pending prompt
905
+ * in `user_message_uuids` consumed that folded prompt and takes the user
906
+ * lane (see the result handler). */
907
+ export declare const AUTONOMOUS_RESULT_ORIGINS: ReadonlySet<SDKMessageOrigin["kind"]>;
904
908
  /** Compute a stable fingerprint of the session-defining params so we can
905
909
  * detect when a loadSession/resumeSession call requires tearing down and
906
910
  * recreating the underlying Query process. Every option classified in
@@ -953,57 +957,6 @@ export type NewSessionMeta = {
953
957
  };
954
958
  additionalRoots?: string[];
955
959
  };
956
- /**
957
- * Extra metadata for 'gateway' authentication requests.
958
- */
959
- type GatewayAuthMeta = {
960
- /**
961
- * These parameters are mapped to environment variables to:
962
- * - Redirect API calls via baseUrl
963
- * - Inject custom headers
964
- * - Bypass the default Claude login requirement
965
- *
966
- * Both members are optional in the type because the payload arrives
967
- * unvalidated from the client. `authenticate` rejects a request that lacks a
968
- * usable `baseUrl`.
969
- */
970
- gateway?: {
971
- baseUrl?: string;
972
- headers?: Record<string, string>;
973
- };
974
- };
975
- type GatewayAuthRequest = AuthenticateRequest & {
976
- _meta?: GatewayAuthMeta;
977
- };
978
- /**
979
- * Resolved, non-secret + secret routing config for the `main` provider. This is
980
- * the shared shape produced by both `providers/set` and the legacy gateway auth
981
- * path, and consumed by {@link createEnvForProvider}. `null` means the provider
982
- * is unconfigured (no client-managed routing in effect).
983
- */
984
- type ProviderConfig = {
985
- apiType: LlmProtocol;
986
- baseUrl: string;
987
- headers: Record<string, string>;
988
- /** Present only for `apiType === "vertex"`. */
989
- vertex?: {
990
- projectId: string;
991
- region: string;
992
- };
993
- /**
994
- * Model ids an `anthropic` or `bedrock` gateway listed when it was set via
995
- * `providers/set`; the model picker offers only these. Absent when the
996
- * listing failed or the config came from elsewhere (gateway `authenticate`),
997
- * so nothing is narrowed.
998
- */
999
- listedModels?: string[];
1000
- /**
1001
- * The cross-region prefix of the model ids a `bedrock` gateway
1002
- * listed (`eu` for `eu.anthropic.claude-sonnet-5`), passed to the CLI as
1003
- * `ANTHROPIC_BEDROCK_REGION_PREFIX` so it calls the models under that prefix.
1004
- */
1005
- bedrockRegionPrefix?: string;
1006
- };
1007
960
  export type { ToolUpdateMeta } from "./tool-calls/renderer.js";
1008
961
  export type ToolUseCache = {
1009
962
  [key: string]: {
@@ -1038,14 +991,6 @@ export type StreamedToolInputCache = Map<string, Map<number, StreamedToolInput>>
1038
991
  */
1039
992
  export declare function stripLocalCommandMetadata(content: unknown): unknown | null;
1040
993
  export declare function isLocalCommandMetadata(content: unknown): boolean;
1041
- /**
1042
- * True when CLI error text tells the user to sign in with `/login`. The CLI
1043
- * words this several ways — "Not logged in · Please run /login", "Not logged
1044
- * in · Run /login", "Login expired · Run /login to sign in again, or
1045
- * re-authenticate your Anthropic profile" — so match the "run /login"
1046
- * instruction rather than one sentence.
1047
- */
1048
- export declare function isLoginRequiredText(text: string): boolean;
1049
994
  /**
1050
995
  * True for the synthetic assistant message the CLI injects into the transcript
1051
996
  * when a turn fails authentication (e.g. "Not logged in · Please run /login",
@@ -1118,27 +1063,11 @@ export declare class ClaudeAcpAgent {
1118
1063
  /** Per session: queue that runs mode/config changes and query restarts one at a time. */
1119
1064
  private readonly configurationChanges;
1120
1065
  private readonly exitPlan;
1121
- /** Last auth identity reported to the client, connection-scoped like
1122
- * `authenticate`/`logout`. Undefined means "not determined yet". */
1123
- currentAuthStatus?: AuthStatus;
1124
- private authStatusSettings?;
1125
- private authStatusHelper?;
1126
- /** In-flight `claude auth status --json` probe, shared by every caller so
1127
- * a concurrent `initialize` and start-of-prompt read never spawn two CLI
1128
- * processes. */
1129
- private cliAuthProbe;
1130
- /** Counts auth-affecting events (`authenticate`, `logout`) on this
1131
- * connection. A probe records it at start and publishes only if it has not
1132
- * moved, so a slow read can never overwrite a newer login or logout. */
1133
- private authEpoch;
1134
- /** Keeps the "session account told us nothing" note to one line per process
1135
- * instead of one per session. */
1136
- private loggedUninformativeAccount;
1137
- /** Same, for the "client provider override active" note. */
1138
- private loggedOverriddenAccount;
1139
- /** Same, for the "the CLI probe timed out" warning: a wedged CLI stays wedged
1140
- * and would otherwise warn once per probe, i.e. once per user prompt. */
1141
- private loggedProbeTimeout;
1066
+ /** The connection's `authStatus` state and pushes, connection-scoped like
1067
+ * `authenticate`/`logout`. */
1068
+ private readonly authStatus;
1069
+ /** Last auth identity reported to the client. Undefined means "not determined yet". */
1070
+ get currentAuthStatus(): AuthStatus | undefined;
1142
1071
  /** Grace period before a `session/cancel` forces a wedged prompt loop to
1143
1072
  * return "cancelled". See {@link DEFAULT_FORCE_CANCEL_GRACE_MS}. Mutable so
1144
1073
  * tests can shrink it. */
@@ -1146,12 +1075,6 @@ export declare class ClaudeAcpAgent {
1146
1075
  /** How long `canUseTool` or a hook waits for the consumer to reach a tool
1147
1076
  * use (see `isStoppedWorkToolUse`). Mutable so tests can shrink it. */
1148
1077
  toolUseWaitMs: number;
1149
- /**
1150
- * The connection serves ACP v2 (`src/v2/`). The agent still speaks v1
1151
- * types, except for the tool call content that v2 needs and v1 cannot
1152
- * express: see {@link ToolCallClientCapabilities.v2}.
1153
- */
1154
- private readonly v2;
1155
1078
  /**
1156
1079
  * The subagent replay of each session's last load, until
1157
1080
  * {@link publishCurrentSubagentStates} sends its children's current states.
@@ -1163,10 +1086,6 @@ export declare class ClaudeAcpAgent {
1163
1086
  * {@link publishReplayedChildModels}.
1164
1087
  */
1165
1088
  private readonly replayedChildModels;
1166
- /** See the `foreground` constructor option. */
1167
- private readonly foregroundEvents?;
1168
- /** See the `background` constructor option. */
1169
- private readonly backgroundWork;
1170
1089
  /** Counts the prompts `startTurn()` has received, across sessions. */
1171
1090
  private promptsReceived;
1172
1091
  /** Per session, the `promptsReceived` count when its last cancel started.
@@ -1174,39 +1093,23 @@ export declare class ClaudeAcpAgent {
1174
1093
  * yet ends as cancelled instead of being queued. */
1175
1094
  private readonly cancelledThrough;
1176
1095
  /**
1177
- * The foreground work of each session while it runs, by the session id that
1178
- * the client knows, on every connection: only the `foreground` option
1179
- * reports it. A clear-context restart replaces the Claude Code session
1180
- * behind that id and moves the running turn to it, so the work belongs to the
1181
- * id, not to a {@link Session}.
1096
+ * The owner of the foreground work of each session while it runs (see
1097
+ * {@link ForegroundOwner}), by the session id that the client knows. A
1098
+ * clear-context restart replaces the Claude Code session behind that id and
1099
+ * moves the running turn to it, so the work belongs to the id, not to a
1100
+ * {@link Session}.
1182
1101
  */
1183
1102
  private readonly foregroundWork;
1184
1103
  /** The session index (docs/air-extensions.md, "Session index"). */
1185
1104
  private readonly sessionIndex;
1186
1105
  /**
1187
1106
  * Whether a turn ends at its result while background subagents that it
1188
- * spawned or resumed still run. Only an ACP v1 AIR client that declares
1107
+ * spawned or resumed still run. Only an AIR client that declares
1189
1108
  * `backgroundSubagents` gets this. Every other client keeps the hold of
1190
1109
  * `Turn.deferredSettle`.
1191
1110
  */
1192
1111
  private endsTurnsWithLiveSubagents;
1193
- constructor(client: AcpClient, logger?: Logger, options?: {
1194
- v2?: boolean;
1195
- /**
1196
- * Where the agent reports a session's foreground work (see
1197
- * {@link ForegroundEvents}), called each time work starts in the session
1198
- * `sessionId`. Without it, nothing reports the work, which the agent
1199
- * still tracks: a v1 client has no session state, and learns that a turn
1200
- * ended from its prompt response.
1201
- */
1202
- foreground?: (sessionId: string) => ForegroundEvents;
1203
- /**
1204
- * Where the agent reports the background work of each session (see
1205
- * `background-work.ts`): once when the session starts, and each time
1206
- * the work changes. Without it, nothing reports the work.
1207
- */
1208
- background?: BackgroundSink;
1209
- });
1112
+ constructor(client: AcpClient, logger?: Logger);
1210
1113
  initialize(request: InitializeRequest): Promise<InitializeResponse>;
1211
1114
  newSession(params: NewSessionRequest): Promise<NewSessionResponse>;
1212
1115
  /**
@@ -1257,66 +1160,12 @@ export declare class ClaudeAcpAgent {
1257
1160
  }>;
1258
1161
  /**
1259
1162
  * `authenticate` — the legacy gateway methods store a provider override that
1260
- * every later session reads. Validate the payload here, with the same base
1261
- * URL rule as `providers/set`. An unchecked payload either throws a
1262
- * `TypeError` deep in session creation, or installs an empty base URL that
1263
- * silently turns the `--hide-claude-auth` subscription guard off.
1264
- *
1265
- * A call that carries no gateway payload at all keeps its historical
1266
- * meaning: it installs no override and succeeds. That has always been a
1267
- * no-op here, and a client that probes the method this way must keep
1268
- * working. Only a payload that IS present has to be usable.
1163
+ * every later session reads, once {@link validatedGatewayAuthRequest} accepts
1164
+ * its payload.
1269
1165
  */
1270
1166
  authenticate(_params: AuthenticateRequest): Promise<void>;
1271
- /**
1272
- * Stores `next` and pushes it to the client.
1273
- *
1274
- * A push goes out only when the payload changed. The identity is read on many
1275
- * occasions — each session create, each guarded turn, the start of each user
1276
- * prompt — and almost all of them see the same login. Clients replace their
1277
- * whole state on each update and tolerate duplicates, so a repeat is
1278
- * harmless, but it is also pure noise; {@link sameAuthStatus} drops it.
1279
- *
1280
- * What the agent owes is truth — a stale or uninformative source must not
1281
- * reach here at all (see the epoch check in the probe and the guards at
1282
- * session create).
1283
- */
1167
+ /** Stores `next` and pushes it to the client when it changed (see {@link AuthStatusReporter.set}). */
1284
1168
  setAuthStatus(next: AuthStatus | undefined): void;
1285
- /**
1286
- * Report the identity behind a session's `AccountInfo`.
1287
- *
1288
- * `AccountInfo` is richer than the CLI probe (it is what the live query
1289
- * actually authenticates with). Called before the `--hide-claude-auth` guard
1290
- * may refuse the session or the turn: that flag blocks the *use* of a
1291
- * subscription, it does not make the state secret, and a refusal is when the
1292
- * client most needs to know the account it was refused for.
1293
- *
1294
- * Two cases skip it:
1295
- *
1296
- * - ACP gateway *authentication* (`gatewayAuthRequest`): the gateway, not
1297
- * this account, is the agent-owned identity — already reported as
1298
- * `kind: "gateway"` by `authenticate`.
1299
- * - A client-driven provider override (`providers/set`): the session then
1300
- * routes through the client's endpoint and `AccountInfo` describes that
1301
- * route (e.g. `apiProvider: "gateway"`), which is NOT agent-owned state.
1302
- * `authStatus` reports the agent's own login only, so the CLI probe —
1303
- * which reads the credential store the override never touches — stays
1304
- * authoritative.
1305
- *
1306
- * An account with no identity signal (e.g. `{apiProvider: "firstParty"}`
1307
- * under an apiKeyHelper) means "nothing to add", not "logged out" — keep
1308
- * what the CLI probe already established instead of overwriting it.
1309
- */
1310
- private useAuthStatusSettings;
1311
- private publishSessionAccountIdentity;
1312
- /** Shares one in-flight `claude auth status --json` run between callers. The
1313
- * promise is released once settled so a later call re-probes instead of
1314
- * replaying a stale verdict. `fresh` forces a new run even when one is in
1315
- * flight — `logout` needs a read that started after the credentials were
1316
- * cleared. */
1317
- private probeCliAuthStatus;
1318
- /** Never rejects: an unavailable CLI means "not reported", not an error. */
1319
- private runCliAuthProbe;
1320
1169
  /**
1321
1170
  * Feed the completed probe to the `--hide-claude-auth` guard.
1322
1171
  *
@@ -1337,10 +1186,9 @@ export declare class ClaudeAcpAgent {
1337
1186
  private markSessionsWhoseAccountKindChanged;
1338
1187
  unstable_listProviders(_params: ListProvidersRequest): Promise<ListProvidersResponse>;
1339
1188
  /**
1340
- * `providers/set` — replace the full configuration for the `main` provider.
1341
- * Rejects unknown IDs, unsupported protocols, and empty/invalid base URLs with
1342
- * `invalid_params`. Config is process-scoped and applies to sessions created or
1343
- * loaded after this call.
1189
+ * `providers/set` — replace the full configuration for the `main` provider
1190
+ * (validated by {@link providerConfigFromSetRequest}). Config is
1191
+ * process-scoped and applies to sessions created or loaded after this call.
1344
1192
  */
1345
1193
  unstable_setProvider(params: SetProviderRequest): Promise<SetProviderResponse>;
1346
1194
  /**
@@ -1348,16 +1196,7 @@ export declare class ClaudeAcpAgent {
1348
1196
  * backend slot and restores the agent's native routing state.
1349
1197
  */
1350
1198
  unstable_disableProvider(params: DisableProviderRequest): Promise<DisableProviderResponse>;
1351
- /**
1352
- * The model ids the gateway in `config` lists, read before `providers/set`
1353
- * returns so the sessions it recreates already offer only those, and for
1354
- * `bedrock` the region prefix picked from them. Setting the same gateway
1355
- * again reuses the previous listing. `vertex` gateways are not listed.
1356
- * Throws a {@link GatewayListingError} when the listing fails.
1357
- */
1358
- private listProviderModels;
1359
1199
  resolveProviderConfig(): ProviderConfig | null;
1360
- private defaultProviderConfig;
1361
1200
  logout(_params: LogoutRequest): Promise<void>;
1362
1201
  /** The structured replacement for a prompt that is exactly `/usage` or a
1363
1202
  * `/mcp` command. Claude Code runs the command, and the replacement takes
@@ -1371,8 +1210,7 @@ export declare class ClaudeAcpAgent {
1371
1210
  *
1372
1211
  * A content block that the agent does not advertise, such as `audio`, fails
1373
1212
  * the request with invalid params (-32602) before anything is queued:
1374
- * `promptToClaude` would drop it. v2 prompts reach `startTurn` through
1375
- * `v1PromptRequest`, which rejects these blocks itself.
1213
+ * `promptToClaude` would drop it.
1376
1214
  */
1377
1215
  prompt(params: PromptRequest, origin?: TurnOrigin): Promise<PromptResponse>;
1378
1216
  /**
@@ -1382,7 +1220,7 @@ export declare class ClaudeAcpAgent {
1382
1220
  * before this resolves.
1383
1221
  */
1384
1222
  startTurn(params: PromptRequest, events: TurnEvents, origin?: TurnOrigin): Promise<void>;
1385
- /** Connects Remote Control (again, if it is already on) or disconnects it. */
1223
+ /** Runs the command, and sends its reply (see `runRemoteControlCommand`). */
1386
1224
  private runRemoteControlCommand;
1387
1225
  /** `--hide-claude-auth` applies only to the CLI's own login. A provider
1388
1226
  * override (`providers/set` or gateway `authenticate`) routes traffic away
@@ -1472,9 +1310,10 @@ export declare class ClaudeAcpAgent {
1472
1310
  goal(params: GoalRequest): Promise<GoalControlResponse>;
1473
1311
  private publishGoal;
1474
1312
  /**
1475
- * Publishes the follow-up prompt the CLI predicted for the next turn, or
1476
- * `null` to clear the one the client holds. Only AIR renders it, so only AIR
1477
- * gets the key; see `docs/air-extensions.md`.
1313
+ * Sends the `_meta` of a session's {@link PromptSuggestions}: the follow-up
1314
+ * prompt the CLI predicted for the next turn, or the clear of the one the
1315
+ * client holds. Only AIR renders it, so only an AIR session has the state;
1316
+ * see `docs/air-extensions.md`.
1478
1317
  */
1479
1318
  private publishPromptSuggestion;
1480
1319
  private publishTaskPlan;
@@ -1599,40 +1438,14 @@ export declare class ClaudeAcpAgent {
1599
1438
  private closeQueryStream;
1600
1439
  /** Cleanly tear down a session: cancel in-flight work, release stream
1601
1440
  * resources, and remove it from the session map. Returns once the turns it
1602
- * cancels have ended, so their end (a v1 `session/prompt` response, a v2
1603
- * `idle` state) goes out before the caller answers: ACP v2's
1604
- * `session/close` cancels "as if `session/cancel` had been called", then
1605
- * frees the session. A wedged consumer holds it at most
1441
+ * cancels have ended, so their `session/prompt` responses go out before
1442
+ * the caller answers. A wedged consumer holds it at most
1606
1443
  * {@link TEARDOWN_TURN_END_TIMEOUT_MS}. */
1607
1444
  private teardownSession;
1608
1445
  /** Tear down all active sessions. Called when the ACP connection closes. */
1609
1446
  dispose(): Promise<void>;
1610
1447
  /** Idempotent: a session that is not loaded here is already closed. */
1611
1448
  closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse>;
1612
- /** Stops a command running in the background (v2 `terminal/cancel`, see
1613
- * {@link cancelBackgroundWork}). */
1614
- cancelBackgroundTerminal(params: {
1615
- sessionId: string;
1616
- terminalId: string;
1617
- }): Promise<void>;
1618
- /** Stops the task of a tool call running in the background (v2
1619
- * `tool_call/cancel`, see {@link cancelBackgroundWork}). */
1620
- cancelBackgroundToolCall(params: {
1621
- sessionId: string;
1622
- toolCallId: string;
1623
- }): Promise<void>;
1624
- /** Sends the current state of each tool call in `toolCallIds` that the root
1625
- * session `sessionId` runs in the background: the call as its tool use
1626
- * shows it, with its status now. v2 requires it for each tool call that a
1627
- * `session/resume` snapshot lists. A failure is logged, as for
1628
- * {@link publishLiveSubagents}. */
1629
- publishBackgroundToolCalls(sessionId: string, toolCallIds: string[]): Promise<void>;
1630
- /** Sends the current `subagent_update` of each live subagent session in
1631
- * `children`, of the session `sessionId` (see
1632
- * {@link NativeSubagentRuntime.currentUpdate}). v2 requires it for each
1633
- * child that a `session/resume` snapshot lists. A failure is logged, as
1634
- * for {@link publishCurrentSubagentStates}. */
1635
- publishLiveSubagents(sessionId: string, children: string[]): Promise<void>;
1636
1449
  /** Per client: see {@link sessionIndex.SessionIndexConnection.deleteSession}. */
1637
1450
  deleteSession(params: DeleteSessionRequest): Promise<DeleteSessionResponse>;
1638
1451
  setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
@@ -1651,65 +1464,32 @@ export declare class ClaudeAcpAgent {
1651
1464
  * conversation) as awaiting user input for exactly the lifetime of its
1652
1465
  * promise (see `Session.openUserInputs`). Steering consults the open
1653
1466
  * requests synchronously, so a message arriving while any permission or
1654
- * elicitation card is open uses non-interrupting SDK delivery.
1655
- *
1656
- * `signal` aborts when Claude Code withdraws the request, which is not an
1657
- * answer. Example: the user cancels while a permission request is open.
1658
- * Claude Code's interrupt withdraws it as it stops the work, and the work
1659
- * ends `idle cancelled` right after. The end of the request then reports
1660
- * no `running`: the client would see `requires_action`, `running`, `idle
1661
- * cancelled`. A withdrawal without a cancel means that something else
1662
- * answered the request in the user's place, such as a `PermissionRequest`
1663
- * hook, and the work goes on, so the end reports `running`. */
1467
+ * elicitation card is open uses non-interrupting SDK delivery. */
1664
1468
  private withPendingUserInput;
1665
- /** Report whether the session's foreground work awaits the user: exactly
1666
- * while a permission request or question that blocks it is open (see
1667
- * {@link blocksForeground}). A request does not say which prompt it is for,
1668
- * and Claude Code can ask for a queued prompt before the consumer activates
1669
- * it, so a request is not tied to the work that was running when it
1670
- * opened. Called when a request opens or closes, when a turn activates, and
1671
- * when a task registers or moves to the background.
1672
- *
1673
- * When the last request ends, the work reports `running` again, unless a
1674
- * cancel withdrew that request (`withdrawnByCancel`, see
1675
- * {@link withPendingUserInput}): the work is being stopped, and reports its
1676
- * end next. */
1677
- private syncAwaitingUser;
1678
1469
  /** Whether Claude is working in the session `sessionId`: an unsettled turn in
1679
1470
  * its queue, or foreground work that no turn owns, such as a cycle that
1680
1471
  * Claude Code started on its own. */
1681
1472
  private claudeIsWorking;
1682
- /** Sends the current title and `updatedAt` of the session `sessionId` as a
1683
- * `session_info_update` (see {@link SessionTitles.publishCurrent}). A
1684
- * failure is logged: the info is optional, so it does not fail a resume. */
1685
- publishCurrentSessionInfo(sessionId: string): Promise<void>;
1686
- /** The foreground state of the session `sessionId` now, as v2's
1687
- * `state_update` names it: `idle` while no work runs, `requires_action`
1688
- * while the work awaits the user (see {@link syncAwaitingUser}), and
1689
- * `running` otherwise. */
1690
- foregroundState(sessionId: string): "idle" | "running" | "requires_action";
1691
1473
  /** Make `owner` the foreground work of the session `sessionId` (see
1692
- * {@link ForegroundEvents}): it reports `running`, then waits at once if a
1693
- * request is open. If work already runs, it goes on under `owner` and
1694
- * reports nothing new: a turn takes over a cycle that Claude Code started on
1695
- * its own, and only the owner's end ends the work. */
1474
+ * {@link ForegroundOwner}). If work already runs, it goes on under
1475
+ * `owner`: a turn takes over a cycle that Claude Code started on its own,
1476
+ * and only the owner's end ends the work. */
1696
1477
  private startForeground;
1697
- /** End the foreground work of the session `sessionId` with `outcome`, or as
1698
- * failed with `error`, if `owner` is that work. */
1478
+ /** End the foreground work of the session `sessionId`, if `owner` is that
1479
+ * work. */
1699
1480
  private endForeground;
1700
1481
  /** Start a model cycle that Claude Code started on its own as the foreground
1701
- * work (see {@link ForegroundEvents}) when `message` is its first output:
1482
+ * work (see {@link ForegroundOwner}) when `message` is its first output:
1702
1483
  * model output of the main conversation (not a subagent's) while no work
1703
1484
  * runs. That includes a turn that v1 holds for its background subagents,
1704
1485
  * whose work ended at its result, so its follow-up is a cycle. Output of
1705
1486
  * the work a cancel stopped starts nothing (see Session.cancelled). */
1706
1487
  private startAutonomousCycle;
1707
- /** Whether the client has been told that the session's work ended: on v2 by
1708
- * an idle state, so no foreground work is open, including a cycle that
1709
- * Claude Code started on its own; on v1 by the response to the turn's
1710
- * prompt, so no turn is active. v1 reports nothing for a cycle, so its end
1711
- * is its result or idle: until then, Claude Code's results for the cycle's
1712
- * tool calls still reach the client after a cancel. */
1488
+ /** Whether the client has been told that the session's work ended: by the
1489
+ * response to the turn's prompt, so no turn is active. The client is told
1490
+ * nothing of a cycle, so its end is its result or idle: until then, Claude
1491
+ * Code's results for the cycle's tool calls still reach the client after a
1492
+ * cancel. */
1713
1493
  private workEndReported;
1714
1494
  /** Whether the consumer drops what it reaches now as output of the work a
1715
1495
  * cancel stopped: the client has been told that the work ended, and the
@@ -1769,9 +1549,9 @@ export declare class ClaudeAcpAgent {
1769
1549
  /** `signal`, also aborted when `teardownSession` aborts the
1770
1550
  * `abortController` of session `sessionId`. Claude Code aborts a callback's
1771
1551
  * own signal when its query closes, but not necessarily before
1772
- * `session/close` responds, and v2 requires every pending permission
1773
- * request and elicitation of the session to be cancelled with
1774
- * `$/cancel_request` before that response. */
1552
+ * `session/close` responds, and every pending permission request and
1553
+ * elicitation of the session is cancelled with `$/cancel_request` before
1554
+ * that response. */
1775
1555
  private untilSessionClosed;
1776
1556
  /** Settle the tool call `ensureToolCallEmitted` emitted for a
1777
1557
  * SandboxNetworkAccess request once the request is answered. The callback
@@ -1810,41 +1590,24 @@ export declare class ClaudeAcpAgent {
1810
1590
  */
1811
1591
  private subagentModels;
1812
1592
  private subagentConfigurationHook;
1813
- /**
1814
- * Captures pre-execution patches for v2 Edit and Write tool calls.
1815
- *
1816
- * A v2 diff cannot hold the input's snippet, so the patch needs the file as
1817
- * it was before the tool runs. Claude Code waits for the hook before running
1818
- * the tool. If its streamed tool use has not arrived, the patch waits for
1819
- * the tool call's first publication. The hook makes no permission decision,
1820
- * and a failure only leaves the preview out.
1821
- */
1822
- private fileChangePreviewHook;
1823
- private previewFileChange;
1824
1593
  canUseTool(sessionId: string): CanUseTool;
1825
1594
  /**
1826
1595
  * Handle elicitation requests that originate from MCP servers by forwarding
1827
- * them to the client over ACP. Only the user's own decline reaches the MCP
1828
- * server as `decline`. A request the user never saw, because the client did
1829
- * not advertise its mode, we can't represent it, or the client answered with
1830
- * an error, is a `cancel`.
1596
+ * them to the client over ACP (see {@link answerMcpElicitation}).
1831
1597
  */
1832
1598
  private handleMcpElicitation;
1833
1599
  /**
1834
1600
  * Present the built-in AskUserQuestion tool's questions as an ACP form
1835
- * elicitation and return the answers as the tool's `updatedInput`. Called from
1836
- * `canUseTool` since that is where the SDK routes the tool's permission check.
1837
- * The elicitation goes to `requestSessionId`, a subagent's child session for
1838
- * a question it asks, and blocks the turn of `sessionId`.
1601
+ * elicitation and return the answers as the tool's `updatedInput` (see
1602
+ * {@link answerAskUserQuestion}). Called from `canUseTool` since that is
1603
+ * where the SDK routes the tool's permission check. The elicitation goes to
1604
+ * `requestSessionId`, a subagent's child session for a question it asks,
1605
+ * and blocks the turn of `sessionId`.
1839
1606
  */
1840
1607
  private handleAskUserQuestion;
1841
1608
  /**
1842
1609
  * Handle `request_user_dialog` control requests — blocking dialogs the CLI
1843
- * asks the host to render. Only kinds declared in `supportedDialogKinds`
1844
- * are ever emitted; everything unexpected is answered `cancelled` (the
1845
- * required answer for unrecognized kinds), which applies the dialog's
1846
- * default behavior CLI-side. Today the only declared kind is the
1847
- * refusal-fallback consent prompt, rendered as an ACP form elicitation.
1610
+ * asks the host to render (see {@link answerUserDialog}).
1848
1611
  */
1849
1612
  private handleUserDialog;
1850
1613
  /**
@@ -1869,17 +1632,9 @@ export declare class ClaudeAcpAgent {
1869
1632
  /**
1870
1633
  * The work that follows a session setup response: the session's commands,
1871
1634
  * the current states of the subagents a load replayed, and MCP server
1872
- * authentication. On v2 the setup handlers of `src/v2/agent.ts` do this
1873
- * work once they have sent their response, so it does nothing here.
1635
+ * authentication.
1874
1636
  */
1875
1637
  private afterSetupResponse;
1876
- /**
1877
- * Starts OAuth in the background for the servers of `mcpServers` that
1878
- * Claude Code reports as needing it, which sends the client a URL
1879
- * elicitation. The v2 surface calls it after the setup response, since v2
1880
- * asks for no elicitation before the `session/new` response.
1881
- */
1882
- authenticateMcpServers(sessionId: string, mcpServers: McpServer[]): void;
1883
1638
  /**
1884
1639
  * Sends the current state of each subagent that the last load of
1885
1640
  * `sessionId` replayed (see {@link RfdSubagentReplay.currentStates}). Run it
@@ -1898,21 +1653,12 @@ export declare class ClaudeAcpAgent {
1898
1653
  private publishReplayedChildModels;
1899
1654
  private updateConfigOption;
1900
1655
  /**
1901
- * Refine a heuristic context window with `getContextUsage().rawMaxTokens`,
1902
- * without blocking the caller. The text heuristic misses natively-1M models
1903
- * whose picker rows carry no "1m" token (e.g. `sonnet`, and since CLI
1904
- * 2.1.283 `opus`/`default`), so those would otherwise show 200k until the
1905
- * first result's modelUsage arrives.
1906
- *
1907
- * Never awaited: SDK control requests are serialized, so awaiting here
1908
- * would delay session/new or a model switch (~15s on older CLIs, issues
1909
- * #886/#880; ~0.5s on 2.1.283). Requests the `summary` detail instead of
1910
- * the default `full` breakdown, which issues one `messages/count_tokens`
1911
- * call per category (~18 for a bare session) and hit rate limits on every
1912
- * model switch; `summary` answers locally with the same `rawMaxTokens`.
1913
- *
1914
- * Does not write `contextWindowCache` (that stays keyed to the
1915
- * `result.modelUsage` spellings) — a later result still overwrites this.
1656
+ * Refine a heuristic context window with `getContextUsage().rawMaxTokens`
1657
+ * (`readContextWindow`), without blocking the caller. The text heuristic
1658
+ * misses natively-1M models whose picker rows carry no "1m" token (e.g.
1659
+ * `sonnet`, and since CLI 2.1.283 `opus`/`default`), so those would
1660
+ * otherwise show 200k until the first result's modelUsage arrives. A later
1661
+ * result still overwrites this.
1916
1662
  */
1917
1663
  private refreshContextWindowInBackground;
1918
1664
  private applyConfigOptionValue;
@@ -1944,25 +1690,14 @@ export declare class ClaudeAcpAgent {
1944
1690
  * `fast_mode_state` (delivered on `system`/init and on user-turn `result`s).
1945
1691
  * The SDK can flip fast mode independently of the user — e.g. back to `on`
1946
1692
  * once a rate-limit `cooldown` clears — so we mirror definitive on/off
1947
- * changes into the config option and notify the client.
1948
- *
1949
- * Guards, in order:
1950
- * - absent state: nothing to reconcile.
1951
- * - no Fast mode option: the current model doesn't support fast mode, so the
1952
- * reported state reflects capability, not the user's intent. Leave the
1953
- * retained setting untouched so it's correct when a supporting model is
1954
- * reselected (the source of the earlier intent-clobber bug was mutating it
1955
- * here).
1956
- * - `cooldown`: a transient suspension of an already-enabled fast mode.
1957
- * Leave the toggle as-is rather than flapping it — and never let a stray
1958
- * cooldown spuriously enable a toggle the user has off.
1693
+ * changes into the config option and notify the client (see
1694
+ * {@link fastModeStateChange}).
1959
1695
  *
1960
- * `reason` is the SDK's `fast_mode_disabled_reason`, reported alongside the
1961
- * state. Only explainable reasons are retained (see
1962
- * {@link normalizeFastModeDisabledReason}), so the comparison below tracks
1963
- * exactly what the user can see: a routine `sdk_opt_in_required` report on
1964
- * every turn's result can't churn the option, while a real blocker updates
1965
- * the description even when the toggle's own value is unchanged. */
1696
+ * Without a Fast mode option the current model doesn't support fast mode,
1697
+ * so the reported state reflects capability, not the user's intent. The
1698
+ * retained setting stays untouched so it's correct when a supporting model
1699
+ * is reselected (the source of the earlier intent-clobber bug was mutating
1700
+ * it here). */
1966
1701
  private syncFastModeState;
1967
1702
  private getOrCreateSession;
1968
1703
  /**
@@ -1994,75 +1729,14 @@ export declare class ClaudeAcpAgent {
1994
1729
  /** Tell a capable client when a non-auth error ends a session during a provider switch. */
1995
1730
  private reportSessionLostOnProviderUpdate;
1996
1731
  }
1997
- export declare const BUILTIN_AGENT_NAMES: Set<string>;
1998
- /** Discover user/plugin/project-configured main-thread agents, excluding the
1999
- * built-in subagents and the reserved "default" sentinel. Returns an empty
2000
- * list if discovery fails so a flaky control request never blocks session
2001
- * creation. */
2002
- export declare function discoverCustomAgents(q: Query): Promise<AgentInfo[]>;
2003
- /** Stable ids for the session config options surfaced via `configOptions`.
2004
- * Centralized so the option declarations in `buildConfigOptions` and the
2005
- * handlers in `setSessionConfigOption`/`applyConfigOptionValue` reference the
2006
- * same identifiers and can't drift apart. */
2007
- export { MODE_CONFIG_ID };
2008
- export declare const AGENT_CONFIG_ID = "agent";
2009
- export declare const FAST_MODE_CONFIG_ID = "fast";
2010
- /** Select-fallback values used when the client has not opted into boolean
2011
- * config options (see {@link createFastModeConfigOption}). */
2012
- export declare const FAST_MODE_ON = "on";
2013
- export declare const FAST_MODE_OFF = "off";
2014
- /** Map the SDK's tri-state `fast_mode_state` onto the boolean config toggle.
2015
- * `cooldown` (fast mode temporarily suspended after a rate limit, per the SDK
2016
- * docs) keeps the toggle on so it reflects the user's intent — only an
2017
- * explicit `off` clears it. */
2018
- export declare function fastModeStateEnabled(state: FastModeState): boolean;
2019
- /** Normalize an SDK-reported `fast_mode_disabled_reason` to the one we retain:
2020
- * a reason we have an explanation for, else `undefined`. Keeping only
2021
- * explainable reasons means state comparisons (see `syncFastModeState`) track
2022
- * exactly what the user can see, so routine reports like
2023
- * `sdk_opt_in_required` never churn the config option. */
2024
- export declare function normalizeFastModeDisabledReason(reason: FastModeDisabledReason | undefined): FastModeDisabledReason | undefined;
2025
- /** Whether the Client advertised support for boolean session config options
2026
- * (`session.configOptions.boolean`). Agents MUST only send `type: "boolean"`
2027
- * config options to Clients that opt in; otherwise we fall back to a `select`.
2028
- * See https://agentclientprotocol.com/rfds/boolean-config-option. */
2029
- export declare function clientSupportsBooleanConfigOptions(clientCapabilities?: ClientCapabilities | null): boolean;
2030
- /** Whether the Client advertised the AIR `recommendedValue` capability for
2031
- * select-style model and effort options. Missing or malformed AIR metadata
2032
- * retains the legacy `default` entries. */
2033
- export declare function clientSupportsRecommendedConfigValue(clientCapabilities?: ClientCapabilities | null): boolean;
2034
- /** Build the Fast mode config option. When the Client supports boolean config
2035
- * options we expose a native `type: "boolean"` toggle; otherwise we degrade to
2036
- * a two-value `select` ("on"/"off") so older Clients still get a usable
2037
- * control.
2038
- *
2039
- * `disabledReason` (the SDK's `fast_mode_disabled_reason`) is folded into the
2040
- * description while the toggle reads off, so a user whose account or provider
2041
- * can't serve Fast mode sees why instead of a switch that silently refuses to
2042
- * stay on. Ignored while enabled: a reason reported alongside an `on`/`cooldown`
2043
- * state isn't blocking anything right now. */
2044
- export declare function createFastModeConfigOption(enabled: boolean, useBooleanOption: boolean, disabledReason?: FastModeDisabledReason): SessionConfigOption;
2045
- /** Resolve the requested Fast mode value from a `session/set_config_option`
2046
- * request. Accepts a native boolean (boolean-capable Clients) or the
2047
- * "on"/"off" select-fallback strings. */
2048
- export declare function resolveFastModeEnabled(params: SetSessionConfigOptionRequest): boolean;
2049
- /** Per-model Fast mode state threaded into {@link buildConfigOptions}. The
2050
- * option is only surfaced when the current model `supported`s fast mode. */
2051
- export type FastModeOptionState = {
2052
- supported: boolean;
2053
- enabled: boolean;
2054
- /** Whether the Client opted into boolean config options. */
2055
- useBooleanOption: boolean;
2056
- /** Latest explainable `fast_mode_disabled_reason`, folded into the option's
2057
- * description while the toggle reads off. */
2058
- disabledReason?: FastModeDisabledReason;
2059
- };
2060
- export type ConfigOptionPresentation = {
2061
- /** Replace ambiguous `default` rows with concrete values and advertise the
2062
- * SDK/adapter recommendation as `_meta.jetbrains.air.recommendedValue`. */
2063
- useRecommendedValue: boolean;
2064
- };
2065
- export declare function buildConfigOptions(modes: SessionModeState, models: SessionModelState, modelInfos: ModelInfo[], currentEffortLevel?: string, agents?: AgentInfo[], currentAgent?: string, fastMode?: FastModeOptionState, presentation?: ConfigOptionPresentation, ultracode?: UltracodeOptionState): SessionConfigOption[];
1732
+ /** Whether Claude Code ended the work of `result` because an interrupt
1733
+ * stopped it, while the model streamed or while a tool ran. */
1734
+ export declare function isAbortedResult(result: Extract<SDKMessage, {
1735
+ type: "result";
1736
+ }>): boolean;
1737
+ export declare function getAvailableSlashCommands(commands: SlashCommand[], terminalCommands?: readonly string[], airSkillCwd?: string, skillPaths?: Map<string, string | undefined>, query?: Query, skillFiles?: ReadonlyMap<string, {
1738
+ path?: string;
1739
+ }>): AvailableCommand[];
2066
1740
  export declare function promptToClaude(prompt: PromptRequest): SDKUserMessage;
2067
1741
  /**
2068
1742
  * Resolves the ACP `messageId` for a Claude SDK message (live) or a persisted