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