@lucascouts/claude-agent-acp-plus 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,564 @@
1
+ import { AuthenticateRequest, CancelNotification, ClientCapabilities, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, LogoutRequest, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, RequestPermissionRequest, RequestPermissionResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, WriteTextFileRequest, WriteTextFileResponse } from "@agentclientprotocol/sdk";
2
+ import { AgentInfo, CanUseTool, FastModeState, ModelInfo, Options, PermissionMode, PermissionUpdate, Query, SDKMessageOrigin, SDKPartialAssistantMessage, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
3
+ import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
4
+ import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
5
+ import { SettingsManager } from "./settings.js";
6
+ import { TaskState } from "./tools.js";
7
+ import { Pushable } from "./utils.js";
8
+ export declare const CLAUDE_CONFIG_DIR: string;
9
+ /**
10
+ * Logger interface for customizing logging output
11
+ */
12
+ export interface Logger {
13
+ log: (...args: any[]) => void;
14
+ error: (...args: any[]) => void;
15
+ }
16
+ type AccumulatedUsage = {
17
+ inputTokens: number;
18
+ outputTokens: number;
19
+ cachedReadTokens: number;
20
+ cachedWriteTokens: number;
21
+ };
22
+ /** Internal model-selection state. Mirrors the shape the ACP SDK exposed as
23
+ * `SessionModelState` before model selection moved entirely into
24
+ * `SessionConfigOption` (category "model"). Retained internally to track the
25
+ * current model and build the "model" config option. */
26
+ type SessionModelState = {
27
+ availableModels: Array<{
28
+ modelId: string;
29
+ name: string;
30
+ description?: string;
31
+ }>;
32
+ currentModelId: string;
33
+ };
34
+ /** One in-flight `prompt()` call. A persistent per-session consumer (see
35
+ * `runConsumer`) drains the SDK query stream for the whole session and settles
36
+ * each Turn's deferred when that turn's outcome is known, so `prompt()` itself
37
+ * holds no loop. Turns are processed FIFO: the SDK echoes queued user messages
38
+ * back in submission order, so `turnQueue[0]` is the turn currently running. */
39
+ type Turn = {
40
+ /** uuid stamped on the pushed `SDKUserMessage`; the SDK echoes it back so the
41
+ * consumer can match the replayed user message to this turn. */
42
+ promptUuid: string;
43
+ /** Local-only slash commands (e.g. `/clear`) return a result without an echo,
44
+ * so the consumer can't promote them via the replay; it falls back to
45
+ * promoting the queue head when the result arrives. */
46
+ isLocalOnlyCommand: boolean;
47
+ /** Set once the deferred has been resolved/rejected, so the consumer never
48
+ * settles a turn twice (idle + handoff + stream-end can all race). */
49
+ settled: boolean;
50
+ resolve: (response: PromptResponse) => void;
51
+ reject: (error: unknown) => void;
52
+ };
53
+ type Session = {
54
+ query: Query;
55
+ input: Pushable<SDKUserMessage>;
56
+ cancelled: boolean;
57
+ /** FIFO of in-flight prompts. The head is the turn the SDK is currently
58
+ * processing; later entries are queued and will be echoed in order. */
59
+ turnQueue?: Turn[];
60
+ /** The turn whose messages the consumer is currently attributing output to
61
+ * (the head of `turnQueue` once its user message has been echoed). */
62
+ activeTurn?: Turn | null;
63
+ /** Count of result messages the consumer should treat as orphans and skip
64
+ * (not promote/attribute to the current head). When cancel() settles+removes
65
+ * a queued turn, that turn's user message was already pushed to the SDK, so
66
+ * the SDK still runs it and emits a result with no uuid we can match. Because
67
+ * the SDK processes input FIFO, those orphan results arrive (in submission
68
+ * order) before the next live turn's, so skipping exactly this many leaves
69
+ * the genuine head untouched. Reset to 0 on every activation as a backstop
70
+ * against an SDK that drops queued input on interrupt (no orphan emitted). */
71
+ pendingOrphanResults?: number;
72
+ /** The long-lived consumer task. Lazily started on the first `prompt()` and
73
+ * kept alive for the session so between-turn/background messages are still
74
+ * drained and forwarded. */
75
+ consumer?: Promise<void>;
76
+ /** Set once the SDK query stream has terminated (it ran to `done` or threw a
77
+ * non-process error). The query iterator is not reusable afterward, so a
78
+ * later `prompt()` rejects instead of enqueueing onto a dead stream and
79
+ * hanging (or silently restarting a consumer that resolves `end_turn`
80
+ * without ever reaching the model). */
81
+ queryClosed?: boolean;
82
+ cwd: string;
83
+ /** Serialized snapshot of session-defining params (cwd, mcpServers) used to
84
+ * detect when loadSession/resumeSession is called with changed values. */
85
+ sessionFingerprint: string;
86
+ settingsManager: SettingsManager;
87
+ accumulatedUsage: AccumulatedUsage;
88
+ modes: SessionModeState;
89
+ models: SessionModelState;
90
+ modelInfos: ModelInfo[];
91
+ configOptions: SessionConfigOption[];
92
+ /** Custom main-thread agent personas the user (or a plugin/project) has
93
+ * configured, discovered via `supportedAgents()` with Claude Code's built-in
94
+ * subagents filtered out. Empty when none are configured, in which case the
95
+ * "agent" config option is omitted entirely. */
96
+ agents: AgentInfo[];
97
+ /** The currently selected main-thread agent name, or "default" for the
98
+ * standard Claude Code agent (no `agent` flag applied). */
99
+ currentAgent: string;
100
+ /** Whether Fast mode is currently enabled for this session. Tracked as the
101
+ * user's intent so it persists across model switches; the Fast mode config
102
+ * option is only surfaced while the selected model supports it. */
103
+ fastModeEnabled: boolean;
104
+ abortController: AbortController;
105
+ /** Signal the consumer races `query.next()` against. Aborted by cancel()
106
+ * (after a grace period) to force the active turn to settle "cancelled" when
107
+ * the SDK is wedged and `query.next()` never yields again (issue #680).
108
+ * Distinct from `abortController`: this only wakes the consumer; it does NOT
109
+ * touch the SDK query/subprocess. The consumer re-arms it after each fire.
110
+ * Undefined until the consumer is started by the first prompt. */
111
+ cancelController?: AbortController;
112
+ /** Pending grace-period timer that aborts `cancelController`. Cleared when the
113
+ * active turn settles normally so the backstop never fires after a clean
114
+ * cancel. */
115
+ forceCancelTimer?: ReturnType<typeof setTimeout>;
116
+ emitRawSDKMessages: boolean | SDKMessageFilter[];
117
+ /** Context window size of the last top-level assistant model, carried across
118
+ * prompts so mid-stream usage_update notifications report a correct `size`
119
+ * before the turn's first result message arrives. Defaults to
120
+ * DEFAULT_CONTEXT_WINDOW, refreshed from each result's modelUsage, and
121
+ * invalidated when the user switches the session's model. */
122
+ contextWindowSize: number;
123
+ /** Accumulated task list for the session, keyed by task ID. Task IDs are
124
+ * per-session, so this state must not be shared across sessions. */
125
+ taskState: TaskState;
126
+ /** Last session title we pushed to the client via `session_info_update`.
127
+ * The SDK auto-generates a title in a background task and persists it to the
128
+ * session file; we poll it on each turn-end (`session_state_changed: idle`)
129
+ * and only notify the client when it actually changes. Undefined until the
130
+ * first title is observed. */
131
+ lastTitle?: string;
132
+ /** Caches `tool_use` blocks by id so the matching `tool_result` can recover
133
+ * the tool name/input when mapping it to a `tool_call_update`. Per-session
134
+ * (tool_use ids are only unique within a session) and pruned at
135
+ * `tool_result` time so a long-running session doesn't accumulate every
136
+ * tool call for its whole lifetime. */
137
+ toolUseCache: ToolUseCache;
138
+ /** Tracks which tool_use ids we've already emitted a `tool_call` for, so the
139
+ * second source to encounter a tool call sends a `tool_call_update` instead
140
+ * of a duplicate `tool_call`. The SDK can invoke `canUseTool` (→ a permission
141
+ * request, which emits the tool_call eagerly so the client has it before
142
+ * being asked to approve it) either before or after the assistant message's
143
+ * tool_use block streams; this set makes the two paths converge regardless of
144
+ * order. Pruned at `tool_result` time alongside `toolUseCache`. */
145
+ emittedToolCalls: Set<string>;
146
+ /** Maps the ACP `messageId` we expose to clients (see `messageIdForGrouping`)
147
+ * to the SDK message uuid that the Agent SDK's rewind/resume APIs key on
148
+ * (`Query.rewindFiles` takes a user-message uuid; `resumeSessionAt` takes an
149
+ * `SDKAssistantMessage.uuid`). For assistant turns the two differ — the ACP
150
+ * id is the Anthropic API message id (`msg_…`), available at `message_start`
151
+ * so streamed chunks can carry it, while the uuid only arrives on the
152
+ * consolidated message — so a client can only ask to rewind/fork by the id it
153
+ * was given, and we need this table to translate it back.
154
+ *
155
+ * Populated as a byproduct of the message loop (the consolidated message
156
+ * carries both ids) and of `replaySessionHistory` on load, so no extra
157
+ * `getSessionMessages` read is needed at rewind time. Last-write-wins
158
+ * naturally yields the turn-boundary uuid when one `msg_…` spans several
159
+ * content-block messages.
160
+ *
161
+ * NOT READ YET — recorded now so the mapping exists if/when we wire up
162
+ * fork/rewind. */
163
+ messageIdToUuid: Map<string, string>;
164
+ };
165
+ export type SDKMessageFilter = {
166
+ type: string;
167
+ subtype?: string;
168
+ origin?: SDKMessageOrigin["kind"];
169
+ };
170
+ /**
171
+ * Extra metadata that can be given when creating a new session.
172
+ */
173
+ export type NewSessionMeta = {
174
+ claudeCode?: {
175
+ /**
176
+ * Options forwarded to Claude Code when starting a new session.
177
+ * Those parameters will be ignored and managed by ACP:
178
+ * - cwd
179
+ * - includePartialMessages
180
+ * - allowDangerouslySkipPermissions
181
+ * - permissionMode
182
+ * - canUseTool
183
+ * - executable
184
+ * Those parameters will be used and updated to work with ACP:
185
+ * - hooks (merged with ACP's hooks)
186
+ * - mcpServers (merged with ACP's mcpServers)
187
+ * - disallowedTools (merged with ACP's disallowedTools)
188
+ * - tools (passed through; defaults to claude_code preset if not provided)
189
+ */
190
+ options?: Options;
191
+ /**
192
+ * When set, raw SDK messages are emitted as extNotification("_claude/sdkMessage", message)
193
+ * in addition to normal processing.
194
+ * - true: emit all messages
195
+ * - false/undefined: emit nothing (default)
196
+ * - SDKMessageFilter[]: emit only messages matching at least one filter
197
+ */
198
+ emitRawSDKMessages?: boolean | SDKMessageFilter[];
199
+ };
200
+ additionalRoots?: string[];
201
+ };
202
+ /**
203
+ * Extra metadata for 'gateway' authentication requests.
204
+ */
205
+ type GatewayAuthMeta = {
206
+ /**
207
+ * These parameters are mapped to environment variables to:
208
+ * - Redirect API calls via baseUrl
209
+ * - Inject custom headers
210
+ * - Bypass the default Claude login requirement
211
+ */
212
+ gateway: {
213
+ baseUrl: string;
214
+ headers: Record<string, string>;
215
+ };
216
+ };
217
+ type GatewayAuthRequest = AuthenticateRequest & {
218
+ _meta?: GatewayAuthMeta;
219
+ };
220
+ /**
221
+ * Extra metadata that the agent provides for each tool_call / tool_update update.
222
+ */
223
+ export type ToolUpdateMeta = {
224
+ claudeCode?: {
225
+ toolName: string;
226
+ toolResponse?: unknown;
227
+ };
228
+ terminal_info?: {
229
+ terminal_id: string;
230
+ };
231
+ terminal_output?: {
232
+ terminal_id: string;
233
+ data: string;
234
+ };
235
+ terminal_exit?: {
236
+ terminal_id: string;
237
+ exit_code: number;
238
+ signal: string | null;
239
+ };
240
+ };
241
+ export type ToolUseCache = {
242
+ [key: string]: {
243
+ type: "tool_use" | "server_tool_use" | "mcp_tool_use";
244
+ id: string;
245
+ name: string;
246
+ input: unknown;
247
+ };
248
+ };
249
+ export declare function claudeCliPath(): Promise<string>;
250
+ /**
251
+ * Return user-message content with local-command marker tags removed, or
252
+ * `null` if nothing meaningful remains (caller should skip the message).
253
+ * Preserves real prose that's mixed in alongside the markers — e.g. a
254
+ * message like `<command-name>…</command-name>hi` becomes `hi`.
255
+ */
256
+ export declare function stripLocalCommandMetadata(content: unknown): unknown | null;
257
+ export declare function isLocalCommandMetadata(content: unknown): boolean;
258
+ export declare function resolvePermissionMode(defaultMode?: unknown, logger?: Logger): PermissionMode;
259
+ /**
260
+ * Builds the label for the "Always Allow" permission option so the user can see
261
+ * the exact scope they are committing to. Uses the SDK-provided suggestions
262
+ * when available (e.g. `Bash(npm test:*)`) and falls back to naming the whole
263
+ * tool so "Always Allow" is never a blank check without disclosure.
264
+ */
265
+ export declare function describeAlwaysAllow(suggestions: PermissionUpdate[] | undefined, toolName: string): string;
266
+ /**
267
+ * Client-facing surface the agent calls back into. This is the subset of ACP
268
+ * client methods the agent actually uses, expressed as a narrow interface so
269
+ * tests can supply lightweight mocks. In production it is backed by
270
+ * {@link ClientConnection} over the SDK's typed `AgentContext`.
271
+ */
272
+ export interface AcpClient {
273
+ sessionUpdate(params: SessionNotification): Promise<void>;
274
+ /** `signal`, when aborted, sends `$/cancel_request` for the in-flight
275
+ * permission request so the client can dismiss its prompt (and settle our
276
+ * await) instead of leaving the dialog open after the turn was cancelled. */
277
+ requestPermission(params: RequestPermissionRequest, signal?: AbortSignal): Promise<RequestPermissionResponse>;
278
+ readTextFile(params: ReadTextFileRequest): Promise<ReadTextFileResponse>;
279
+ writeTextFile(params: WriteTextFileRequest): Promise<WriteTextFileResponse>;
280
+ /** `signal`, when aborted, sends `$/cancel_request` for the in-flight
281
+ * elicitation so the client can dismiss its prompt and settle our await. */
282
+ unstable_createElicitation(params: CreateElicitationRequest, signal?: AbortSignal): Promise<CreateElicitationResponse>;
283
+ unstable_completeElicitation(params: CompleteElicitationNotification): Promise<void>;
284
+ /** Send a custom (extension) notification, e.g. `_claude/sdkMessage`. */
285
+ extNotification(method: string, params: Record<string, unknown>): Promise<void>;
286
+ }
287
+ export declare class ClaudeAcpAgent {
288
+ sessions: {
289
+ [key: string]: Session;
290
+ };
291
+ client: AcpClient;
292
+ clientCapabilities?: ClientCapabilities;
293
+ logger: Logger;
294
+ gatewayAuthRequest?: GatewayAuthRequest;
295
+ /** Grace period before a `session/cancel` forces a wedged prompt loop to
296
+ * return "cancelled". See {@link DEFAULT_FORCE_CANCEL_GRACE_MS}. Mutable so
297
+ * tests can shrink it. */
298
+ forceCancelGraceMs: number;
299
+ constructor(client: AcpClient, logger?: Logger);
300
+ initialize(request: InitializeRequest): Promise<InitializeResponse>;
301
+ newSession(params: NewSessionRequest): Promise<NewSessionResponse>;
302
+ unstable_forkSession(params: ForkSessionRequest): Promise<ForkSessionResponse>;
303
+ resumeSession(params: ResumeSessionRequest): Promise<ResumeSessionResponse>;
304
+ loadSession(params: LoadSessionRequest): Promise<LoadSessionResponse>;
305
+ listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse>;
306
+ /** Read the SDK-maintained title for a session and, if it changed since the
307
+ * last time we looked, notify the client with a `session_info_update`. The
308
+ * SDK has no push event for the title it auto-generates in the background, so
309
+ * we pull it at turn-end. A missing session file or read error is non-fatal:
310
+ * the title is best-effort and another turn will retry. */
311
+ private maybeUpdateSessionTitle;
312
+ authenticate(_params: AuthenticateRequest): Promise<void>;
313
+ logout(_params: LogoutRequest): Promise<void>;
314
+ prompt(params: PromptRequest): Promise<PromptResponse>;
315
+ /** Lazily start the per-session consumer that drains the SDK query stream for
316
+ * the session's whole life. Idempotent: only the first `prompt()` starts it. */
317
+ private ensureConsumer;
318
+ /** The single, long-lived consumer of the SDK query stream for a session. It
319
+ * forwards every message as ACP `sessionUpdate`s (so background/between-turn
320
+ * output streams live, not just while a prompt is awaiting) and settles each
321
+ * Turn's deferred when that turn ends. Replaces the per-prompt message loop;
322
+ * `params` only carries the (session-invariant) `sessionId`. */
323
+ private runConsumer;
324
+ cancel(params: CancelNotification): Promise<void>;
325
+ /** Mark a session's SDK query stream as permanently ended and release the
326
+ * resources tied to it: drop the consumer handle, dispose the settings
327
+ * watchers, end the input stream, and close the query (which terminates the
328
+ * subprocess). The query iterator is not revivable, so `prompt()`/`cancel()`
329
+ * consult `queryClosed` and fail/short-circuit instead of acting on a dead
330
+ * stream. Idempotent (guarded by `queryClosed`), so the consumer's done/error
331
+ * paths and a later `teardownSession` can all call it without double-releasing.
332
+ *
333
+ * Deliberately does NOT abort `session.abortController`: that controller may be
334
+ * CLIENT-supplied (`_meta.claudeCode.options.abortController`) and reused, so
335
+ * aborting it on a spontaneous stream end would cancel the client's own work
336
+ * or make a sibling session born aborted. `query.close()` already terminates
337
+ * the subprocess; aborting the signal belongs in `teardownSession` (explicit
338
+ * destroy), not here. Also does NOT remove the session from the map — that is
339
+ * `teardownSession`'s job — so prompt() can still answer with a clear "session
340
+ * ended" error after an unexpected stream close. The leftover session object
341
+ * is a lightweight husk (its heavy resources are released here) and is evicted
342
+ * on the next closeSession/deleteSession or when the connection's `dispose()`
343
+ * runs. */
344
+ private closeQueryStream;
345
+ /** Cleanly tear down a session: cancel in-flight work, release stream
346
+ * resources, and remove it from the session map. */
347
+ private teardownSession;
348
+ /** Tear down all active sessions. Called when the ACP connection closes. */
349
+ dispose(): Promise<void>;
350
+ closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse>;
351
+ deleteSession(params: DeleteSessionRequest): Promise<DeleteSessionResponse>;
352
+ setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
353
+ setSessionConfigOption(params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
354
+ private applySessionMode;
355
+ private replaySessionHistory;
356
+ readTextFile(params: ReadTextFileRequest): Promise<ReadTextFileResponse>;
357
+ writeTextFile(params: WriteTextFileRequest): Promise<WriteTextFileResponse>;
358
+ /** Forward a permission request to the client, wiring the tool call's
359
+ * `signal` through as a `cancellationSignal`. When the turn is cancelled
360
+ * while the client's prompt is still open the signal aborts, the SDK sends
361
+ * `$/cancel_request`, and the client settles the request (a `cancelled`
362
+ * outcome or a `requestCancelled` rejection). Either way we surface the same
363
+ * "Tool use aborted" the callers already expect, so a cancelled dialog no
364
+ * longer leaves the `await` hanging. */
365
+ private requestPermissionFromClient;
366
+ /** Emit the `tool_call` a permission request references if it hasn't been sent
367
+ * yet, so the client has the tool call before being asked to approve it. The
368
+ * matching streamed tool_use chunk later refines it with a `tool_call_update`
369
+ * instead of emitting a duplicate (see `emittedToolCalls`). Built via the same
370
+ * `toolCallNotification` helper as the streamed path so the two are identical.
371
+ * Tools the stream renders as a plan (TodoWrite) or suppresses (Task*) are
372
+ * skipped so a permission prompt for them never surfaces a stray tool_call. */
373
+ private ensureToolCallEmitted;
374
+ canUseTool(sessionId: string): CanUseTool;
375
+ /**
376
+ * Handle elicitation requests that originate from MCP servers by forwarding
377
+ * them to the client over ACP. Modes the client did not advertise (or
378
+ * requests we can't represent) are declined.
379
+ */
380
+ private handleMcpElicitation;
381
+ /**
382
+ * Present the built-in AskUserQuestion tool's questions as an ACP form
383
+ * elicitation and return the answers as the tool's `updatedInput`. Called from
384
+ * `canUseTool` since that is where the SDK routes the tool's permission check.
385
+ */
386
+ private handleAskUserQuestion;
387
+ /**
388
+ * Handle `request_user_dialog` control requests — blocking dialogs the CLI
389
+ * asks the host to render. Only kinds declared in `supportedDialogKinds`
390
+ * are ever emitted; everything unexpected is answered `cancelled` (the
391
+ * required answer for unrecognized kinds), which applies the dialog's
392
+ * default behavior CLI-side. Today the only declared kind is the
393
+ * refusal-fallback consent prompt, rendered as an ACP form elicitation.
394
+ */
395
+ private handleUserDialog;
396
+ private sendAvailableCommandsUpdate;
397
+ private updateConfigOption;
398
+ private applyConfigOptionValue;
399
+ /** Reconcile adapter model state after the SDK persistently swapped the
400
+ * session's model out from under us (refusal fallback). The SDK already
401
+ * made the switch, so this must NOT call `query.setModel` — it only
402
+ * updates our bookkeeping (currentModelId, context window, mode clamping,
403
+ * effort/Fast-mode options) via the same `applyConfigOptionValue` path a
404
+ * user-driven model change takes, then notifies the client. */
405
+ private syncModelAfterRefusalFallback;
406
+ /** Replace the Fast mode option in `session.configOptions` so it reflects
407
+ * `enabled` (and the client's current boolean-capability). A no-op when the
408
+ * option isn't present, so callers must confirm the current model surfaces
409
+ * it first. */
410
+ private refreshFastModeOption;
411
+ /** Toggle Fast mode for a session: push the SDK flag, record the user's
412
+ * intent, and refresh the Fast mode config option in place. Only reached
413
+ * once the option exists (i.e. the current model supports fast mode), so the
414
+ * option is guaranteed to be present in `configOptions`. */
415
+ private applyFastMode;
416
+ /** Reconcile the session's Fast mode toggle with an SDK-reported
417
+ * `fast_mode_state` (delivered on `system`/init and on user-turn `result`s).
418
+ * The SDK can flip fast mode independently of the user — e.g. back to `on`
419
+ * once a rate-limit `cooldown` clears — so we mirror definitive on/off
420
+ * changes into the config option and notify the client.
421
+ *
422
+ * Guards, in order:
423
+ * - absent state: nothing to reconcile.
424
+ * - no Fast mode option: the current model doesn't support fast mode, so the
425
+ * reported state reflects capability, not the user's intent. Leave the
426
+ * retained setting untouched so it's correct when a supporting model is
427
+ * reselected (the source of the earlier intent-clobber bug was mutating it
428
+ * here).
429
+ * - `cooldown`: a transient suspension of an already-enabled fast mode.
430
+ * Leave the toggle as-is rather than flapping it — and never let a stray
431
+ * cooldown spuriously enable a toggle the user has off. */
432
+ private syncFastModeState;
433
+ private getOrCreateSession;
434
+ /**
435
+ * Ensures the requested `cwd` is an absolute path that points at an existing
436
+ * directory before we create a session. Throws an `invalidParams` error with
437
+ * an actionable message so clients (e.g. Zed) can surface it to the user
438
+ * instead of failing later with an opaque SDK error.
439
+ */
440
+ private validateCwd;
441
+ private createSession;
442
+ }
443
+ export declare const BUILTIN_AGENT_NAMES: Set<string>;
444
+ export declare const DEFAULT_AGENT_ID = "default";
445
+ /** Discover user/plugin/project-configured main-thread agents, excluding the
446
+ * built-in subagents and the reserved "default" sentinel. Returns an empty
447
+ * list if discovery fails so a flaky control request never blocks session
448
+ * creation. */
449
+ export declare function discoverCustomAgents(q: Query): Promise<AgentInfo[]>;
450
+ /** Stable ids for the session config options surfaced via `configOptions`.
451
+ * Centralized so the option declarations in `buildConfigOptions` and the
452
+ * handlers in `setSessionConfigOption`/`applyConfigOptionValue` reference the
453
+ * same identifiers and can't drift apart. */
454
+ export declare const MODE_CONFIG_ID = "mode";
455
+ export declare const MODEL_CONFIG_ID = "model";
456
+ export declare const EFFORT_CONFIG_ID = "effort";
457
+ export declare const AGENT_CONFIG_ID = "agent";
458
+ export declare const FAST_MODE_CONFIG_ID = "fast";
459
+ /** Select-fallback values used when the client has not opted into boolean
460
+ * config options (see {@link createFastModeConfigOption}). */
461
+ export declare const FAST_MODE_ON = "on";
462
+ export declare const FAST_MODE_OFF = "off";
463
+ /** Map the SDK's tri-state `fast_mode_state` onto the boolean config toggle.
464
+ * `cooldown` (fast mode temporarily suspended after a rate limit, per the SDK
465
+ * docs) keeps the toggle on so it reflects the user's intent — only an
466
+ * explicit `off` clears it. */
467
+ export declare function fastModeStateEnabled(state: FastModeState): boolean;
468
+ /** Whether the Client advertised support for boolean session config options
469
+ * (`session.configOptions.boolean`). Agents MUST only send `type: "boolean"`
470
+ * config options to Clients that opt in; otherwise we fall back to a `select`.
471
+ * See https://agentclientprotocol.com/rfds/boolean-config-option. */
472
+ export declare function clientSupportsBooleanConfigOptions(clientCapabilities?: ClientCapabilities | null): boolean;
473
+ /** Build the Fast mode config option. When the Client supports boolean config
474
+ * options we expose a native `type: "boolean"` toggle; otherwise we degrade to
475
+ * a two-value `select` ("on"/"off") so older Clients still get a usable
476
+ * control. */
477
+ export declare function createFastModeConfigOption(enabled: boolean, useBooleanOption: boolean): SessionConfigOption;
478
+ /** Resolve the requested Fast mode value from a `session/set_config_option`
479
+ * request. Accepts a native boolean (boolean-capable Clients) or the
480
+ * "on"/"off" select-fallback strings. */
481
+ export declare function resolveFastModeEnabled(params: SetSessionConfigOptionRequest): boolean;
482
+ /** Per-model Fast mode state threaded into {@link buildConfigOptions}. The
483
+ * option is only surfaced when the current model `supported`s fast mode. */
484
+ export type FastModeOptionState = {
485
+ supported: boolean;
486
+ enabled: boolean;
487
+ /** Whether the Client opted into boolean config options. */
488
+ useBooleanOption: boolean;
489
+ };
490
+ export declare function buildConfigOptions(modes: SessionModeState, models: SessionModelState, modelInfos: ModelInfo[], currentEffortLevel?: string, agents?: AgentInfo[], currentAgent?: string, fastMode?: FastModeOptionState): SessionConfigOption[];
491
+ export declare function resolveModelPreference(models: ModelInfo[], preference: string): ModelInfo | null;
492
+ /**
493
+ * Restrict the SDK's model list to the user's `availableModels` allowlist
494
+ * (already merged-and-deduped across settings sources by `SettingsManager`).
495
+ * The user's exact entries become the model IDs surfaced via configOptions
496
+ * and passed to `setModel`, which prevents Claude Code from silently
497
+ * substituting a date-pinned variant (e.g. `haiku` →
498
+ * `claude-haiku-4-5-20251001`) that the user may not have access to.
499
+ *
500
+ * Display info and capability flags are copied from the closest SDK match so
501
+ * the UI still renders sensible names and effort levels.
502
+ *
503
+ * Semantics from https://code.claude.com/docs/en/model-config#restrict-model-selection:
504
+ * - `undefined` is handled by the caller (no allowlist applied).
505
+ * - The Default option is unaffected by `availableModels` — it always remains
506
+ * available, even when the allowlist is `[]`.
507
+ */
508
+ export declare function applyAvailableModelsAllowlist(sdkModels: ModelInfo[], allowlist: string[], settingsModelOverrides?: Record<string, string>): ModelInfo[];
509
+ export declare function promptToClaude(prompt: PromptRequest): SDKUserMessage;
510
+ /**
511
+ * Resolves the ACP `messageId` for a Claude SDK message (live) or a persisted
512
+ * transcript message (replay) so chunk grouping is identical in both views.
513
+ *
514
+ * Assistant turns are keyed by the Anthropic API message id (`message.id`),
515
+ * which is identical at `message_start`, on the consolidated assistant message,
516
+ * and in the persisted transcript — unlike the per-`stream_event` uuid, which is
517
+ * unique per event and never persisted. User messages have no API id, but they
518
+ * are never streamed, so their (stable) SDK uuid is used instead. ACP message
519
+ * ids are opaque strings, so no particular format is required.
520
+ */
521
+ export declare function messageIdForGrouping(message: {
522
+ type?: string;
523
+ uuid?: string | null;
524
+ message?: unknown;
525
+ }): string | undefined;
526
+ /**
527
+ * Convert an SDKAssistantMessage (Claude) to a SessionNotification (ACP).
528
+ * Only handles text, image, and thinking chunks for now.
529
+ */
530
+ export declare function toAcpNotifications(content: string | ContentBlockParam[] | BetaContentBlock[] | BetaRawContentBlockDelta[], role: "assistant" | "user", sessionId: string, toolUseCache: ToolUseCache, client: AcpClient, logger: Logger, options?: {
531
+ registerHooks?: boolean;
532
+ clientCapabilities?: ClientCapabilities;
533
+ parentToolUseId?: string | null;
534
+ cwd?: string;
535
+ taskState?: TaskState;
536
+ emittedToolCalls?: Set<string>;
537
+ messageId?: string;
538
+ }): SessionNotification[];
539
+ export declare function streamEventToAcpNotifications(message: SDKPartialAssistantMessage, sessionId: string, toolUseCache: ToolUseCache, client: AcpClient, logger: Logger, options?: {
540
+ clientCapabilities?: ClientCapabilities;
541
+ cwd?: string;
542
+ taskState?: TaskState;
543
+ emittedToolCalls?: Set<string>;
544
+ messageId?: string;
545
+ }): SessionNotification[];
546
+ /** Run a `session/prompt` while honoring `$/cancel_request` for it. ACP clients
547
+ * normally stop a turn with the `session/cancel` notification, but `signal`
548
+ * (the prompt request's abort signal) also fires when the client sends the
549
+ * generic `$/cancel_request` for this prompt — the protocol's complementary
550
+ * cancellation fallback. Route that to the same `agent.cancel` path so a client
551
+ * using only the generic mechanism still stops the turn (and the prompt
552
+ * resolves "cancelled" instead of running to completion).
553
+ *
554
+ * The listener is scoped to this call: once the prompt settles it is removed,
555
+ * so a later teardown-time abort of the (per-request) signal can't cancel a
556
+ * subsequent turn. `signal` also aborts on connection close, in which case
557
+ * cancelling the in-flight turn is the desired behavior anyway. */
558
+ export declare function runPromptWithCancellation(agent: Pick<ClaudeAcpAgent, "prompt" | "cancel" | "logger">, params: PromptRequest, signal: AbortSignal): Promise<PromptResponse>;
559
+ export declare function runAcp(): {
560
+ connection: import("@agentclientprotocol/sdk").AgentConnection;
561
+ agent: ClaudeAcpAgent;
562
+ };
563
+ export {};
564
+ //# sourceMappingURL=acp-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../src/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAGb,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,sB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