@agentclientprotocol/claude-agent-acp 0.102.1-preview.1 → 0.102.1-preview.3
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.
- package/README.md +5 -1
- package/dist/acp-agent.d.ts +93 -622
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +369 -3474
- package/dist/acp-client.d.ts +28 -0
- package/dist/acp-client.d.ts.map +1 -0
- package/dist/acp-client.js +1 -0
- package/dist/acp-subagents.d.ts +1 -2
- package/dist/acp-subagents.d.ts.map +1 -1
- package/dist/auth-methods.d.ts +21 -0
- package/dist/auth-methods.d.ts.map +1 -0
- package/dist/auth-methods.js +68 -0
- package/dist/auth-status-reporter.d.ts +112 -0
- package/dist/auth-status-reporter.d.ts.map +1 -0
- package/dist/auth-status-reporter.js +253 -0
- package/dist/background-work.d.ts +12 -265
- package/dist/background-work.d.ts.map +1 -1
- package/dist/background-work.js +8 -558
- package/dist/client-system-prompt.d.ts +7 -0
- package/dist/client-system-prompt.d.ts.map +1 -1
- package/dist/client-system-prompt.js +24 -0
- package/dist/context-compaction.d.ts +20 -0
- package/dist/context-compaction.d.ts.map +1 -1
- package/dist/context-compaction.js +26 -0
- package/dist/context-window.d.ts +70 -0
- package/dist/context-window.d.ts.map +1 -0
- package/dist/context-window.js +132 -0
- package/dist/diff.d.ts +1 -1
- package/dist/diff.js +1 -1
- package/dist/elicitation.d.ts +66 -1
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +109 -0
- package/dist/file-change-audit.d.ts +4 -3
- package/dist/file-change-audit.d.ts.map +1 -1
- package/dist/file-change-audit.js +3 -2
- package/dist/lib.d.ts +5 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +3 -1
- package/dist/logger.d.ts +10 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +1 -0
- package/dist/mcp-oauth.d.ts +44 -0
- package/dist/mcp-oauth.d.ts.map +1 -0
- package/dist/mcp-oauth.js +142 -0
- package/dist/mcp-servers.d.ts +10 -0
- package/dist/mcp-servers.d.ts.map +1 -0
- package/dist/mcp-servers.js +29 -0
- package/dist/message-filters.d.ts +43 -0
- package/dist/message-filters.d.ts.map +1 -0
- package/dist/message-filters.js +197 -0
- package/dist/native-subagents.d.ts +18 -8
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +7 -35
- package/dist/new-session-meta.d.ts +40 -0
- package/dist/new-session-meta.d.ts.map +1 -0
- package/dist/new-session-meta.js +1 -0
- package/dist/permissions/presentation.d.ts +29 -0
- package/dist/permissions/presentation.d.ts.map +1 -1
- package/dist/permissions/presentation.js +38 -11
- package/dist/prompt-suggestions.d.ts +29 -0
- package/dist/prompt-suggestions.d.ts.map +1 -1
- package/dist/prompt-suggestions.js +45 -0
- package/dist/prompt-to-claude.d.ts +10 -0
- package/dist/prompt-to-claude.d.ts.map +1 -0
- package/dist/prompt-to-claude.js +120 -0
- package/dist/providers.d.ts +139 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +286 -0
- package/dist/remote-control.d.ts +62 -0
- package/dist/remote-control.d.ts.map +1 -0
- package/dist/remote-control.js +78 -0
- package/dist/result-end.d.ts +68 -0
- package/dist/result-end.d.ts.map +1 -0
- package/dist/result-end.js +84 -0
- package/dist/sdk-to-acp.d.ts +93 -0
- package/dist/sdk-to-acp.d.ts.map +1 -0
- package/dist/sdk-to-acp.js +635 -0
- package/dist/serve.d.ts +9 -3
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +10 -5
- package/dist/session-config-ids.d.ts +1 -0
- package/dist/session-config-ids.d.ts.map +1 -1
- package/dist/session-config-ids.js +1 -0
- package/dist/session-config-options.d.ts +64 -0
- package/dist/session-config-options.d.ts.map +1 -0
- package/dist/session-config-options.js +162 -0
- package/dist/session-effort.d.ts +67 -0
- package/dist/session-effort.d.ts.map +1 -1
- package/dist/session-effort.js +98 -0
- package/dist/session-env.d.ts +22 -0
- package/dist/session-env.d.ts.map +1 -0
- package/dist/session-env.js +66 -0
- package/dist/session-fast-mode.d.ts +83 -0
- package/dist/session-fast-mode.d.ts.map +1 -0
- package/dist/session-fast-mode.js +142 -0
- package/dist/session-index/connection.d.ts +5 -6
- package/dist/session-index/connection.d.ts.map +1 -1
- package/dist/session-index/connection.js +3 -5
- package/dist/session-mode.d.ts +1 -0
- package/dist/session-mode.d.ts.map +1 -1
- package/dist/session-mode.js +1 -1
- package/dist/session-model.d.ts +41 -0
- package/dist/session-model.d.ts.map +1 -1
- package/dist/session-model.js +110 -45
- package/dist/session-notices.d.ts +44 -0
- package/dist/session-notices.d.ts.map +1 -1
- package/dist/session-notices.js +68 -0
- package/dist/session-titles.d.ts +34 -12
- package/dist/session-titles.d.ts.map +1 -1
- package/dist/session-titles.js +7 -6
- package/dist/session-usage.d.ts +125 -0
- package/dist/session-usage.d.ts.map +1 -0
- package/dist/session-usage.js +196 -0
- package/dist/slash-commands.d.ts +10 -0
- package/dist/slash-commands.d.ts.map +1 -0
- package/dist/slash-commands.js +99 -0
- package/dist/streamed-text.d.ts +33 -0
- package/dist/streamed-text.d.ts.map +1 -0
- package/dist/streamed-text.js +71 -0
- package/dist/subagent-configuration.d.ts +32 -0
- package/dist/subagent-configuration.d.ts.map +1 -0
- package/dist/subagent-configuration.js +70 -0
- package/dist/subagent-replay.d.ts +18 -0
- package/dist/subagent-replay.d.ts.map +1 -1
- package/dist/subagent-replay.js +25 -15
- package/dist/tool-calls/client-capabilities.d.ts +8 -8
- package/dist/tool-calls/client-capabilities.js +4 -4
- package/dist/tool-calls/renderer.d.ts +4 -5
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +4 -5
- package/dist/turn-events.d.ts +6 -46
- package/dist/turn-events.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/v2/agent.d.ts +7 -11
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +751 -331
- package/dist/v2/air.d.ts +33 -0
- package/dist/v2/air.d.ts.map +1 -0
- package/dist/v2/air.js +29 -0
- package/dist/v2/auth.d.ts +97 -0
- package/dist/v2/auth.d.ts.map +1 -0
- package/dist/v2/auth.js +216 -0
- package/dist/v2/background.d.ts +27 -16
- package/dist/v2/background.d.ts.map +1 -1
- package/dist/v2/background.js +4 -32
- package/dist/v2/child-config.d.ts +55 -0
- package/dist/v2/child-config.d.ts.map +1 -0
- package/dist/v2/child-config.js +92 -0
- package/dist/v2/clear-context.d.ts +94 -0
- package/dist/v2/clear-context.d.ts.map +1 -0
- package/dist/v2/clear-context.js +176 -0
- package/dist/v2/commands.d.ts +46 -0
- package/dist/v2/commands.d.ts.map +1 -0
- package/dist/v2/commands.js +54 -0
- package/dist/v2/config.d.ts +187 -0
- package/dist/v2/config.d.ts.map +1 -0
- package/dist/v2/config.js +494 -0
- package/dist/v2/elicitation.d.ts +93 -0
- package/dist/v2/elicitation.d.ts.map +1 -0
- package/dist/v2/elicitation.js +160 -0
- package/dist/v2/file-changes.d.ts +61 -0
- package/dist/v2/file-changes.d.ts.map +1 -0
- package/dist/v2/file-changes.js +108 -0
- package/dist/v2/file-preview.d.ts +18 -0
- package/dist/v2/file-preview.d.ts.map +1 -0
- package/dist/v2/file-preview.js +29 -0
- package/dist/v2/initialize.d.ts +10 -24
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +4 -111
- package/dist/v2/outcome.d.ts +81 -0
- package/dist/v2/outcome.d.ts.map +1 -0
- package/dist/v2/outcome.js +166 -0
- package/dist/v2/permissions.d.ts +92 -0
- package/dist/v2/permissions.d.ts.map +1 -0
- package/dist/v2/permissions.js +162 -0
- package/dist/v2/prompt.d.ts +2 -42
- package/dist/v2/prompt.d.ts.map +1 -1
- package/dist/v2/prompt.js +2 -119
- package/dist/v2/remote-control.d.ts +41 -0
- package/dist/v2/remote-control.d.ts.map +1 -0
- package/dist/v2/remote-control.js +63 -0
- package/dist/v2/reports.d.ts +198 -0
- package/dist/v2/reports.d.ts.map +1 -0
- package/dist/v2/reports.js +487 -0
- package/dist/v2/restarts.d.ts +128 -0
- package/dist/v2/restarts.d.ts.map +1 -0
- package/dist/v2/restarts.js +348 -0
- package/dist/v2/session-requests.d.ts +20 -0
- package/dist/v2/session-requests.d.ts.map +1 -0
- package/dist/v2/session-requests.js +108 -0
- package/dist/v2/session-update.d.ts +2 -13
- package/dist/v2/session-update.d.ts.map +1 -1
- package/dist/v2/session-update.js +2 -22
- package/dist/v2/session.d.ts +340 -41
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +1224 -141
- package/dist/v2/setup.d.ts +49 -0
- package/dist/v2/setup.d.ts.map +1 -0
- package/dist/v2/setup.js +62 -0
- package/dist/v2/stopped-work.d.ts +123 -0
- package/dist/v2/stopped-work.d.ts.map +1 -0
- package/dist/v2/stopped-work.js +210 -0
- package/dist/v2/stream.d.ts +229 -0
- package/dist/v2/stream.d.ts.map +1 -0
- package/dist/v2/stream.js +507 -0
- package/dist/v2/subagent-replay.d.ts +115 -0
- package/dist/v2/subagent-replay.d.ts.map +1 -0
- package/dist/v2/subagent-replay.js +479 -0
- package/dist/v2/subscription-guard.d.ts +60 -0
- package/dist/v2/subscription-guard.d.ts.map +1 -0
- package/dist/v2/subscription-guard.js +84 -0
- package/dist/v2/tasks.d.ts +492 -0
- package/dist/v2/tasks.d.ts.map +1 -0
- package/dist/v2/tasks.js +1728 -0
- package/dist/v2/terminal.d.ts.map +1 -1
- package/dist/v2/terminal.js +6 -1
- package/dist/v2/tool-call.d.ts +3 -2
- package/dist/v2/tool-call.d.ts.map +1 -1
- package/dist/v2/update-translator.d.ts +36 -0
- package/dist/v2/update-translator.d.ts.map +1 -0
- package/dist/v2/update-translator.js +80 -0
- package/dist/workflow-progress.d.ts +23 -0
- package/dist/workflow-progress.d.ts.map +1 -1
- package/dist/workflow-progress.js +31 -8
- package/package.json +1 -1
- package/dist/v2/permission.d.ts +0 -28
- package/dist/v2/permission.d.ts.map +0 -1
- package/dist/v2/permission.js +0 -41
|
@@ -1,287 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commands of a session that went to the background, for a client that
|
|
3
|
+
* renders terminals from the terminal extension and is not AIR (AIR shows a
|
|
4
|
+
* command through its async tasks): the display terminal of each command
|
|
5
|
+
* runs from its Bash tool result until its task ends.
|
|
6
|
+
*/
|
|
1
7
|
import type { AcpSessionNotification } from "./acp-subagents.js";
|
|
2
|
-
|
|
3
|
-
import { type AcpToolCallRenderer } from "./tool-calls/renderer.js";
|
|
4
|
-
import { BackgroundOutputTail } from "./background-output.js";
|
|
5
|
-
import type { TaskProgressFields } from "./async-tasks.js";
|
|
6
|
-
import { type WorkflowSnapshot } from "./workflow-progress.js";
|
|
7
|
-
/** An item of a `background` list. */
|
|
8
|
-
export type BackgroundItem = {
|
|
9
|
-
type: "terminal";
|
|
10
|
-
terminalId: string;
|
|
11
|
-
} | {
|
|
12
|
-
type: "tool_call";
|
|
13
|
-
toolCallId: string;
|
|
14
|
-
} | {
|
|
15
|
-
type: "subagent";
|
|
16
|
-
sessionId: string;
|
|
17
|
-
};
|
|
18
|
-
/** The display terminal of a command that went to the background (see `Session.backgroundTerminals`). */
|
|
8
|
+
/** The display terminal of a command that went to the background. */
|
|
19
9
|
export interface BackgroundTerminal {
|
|
20
10
|
/** The Bash tool call, whose id names the terminal. */
|
|
21
11
|
toolCallId: string;
|
|
22
12
|
/** The subagent tool call that ran the command, if any. */
|
|
23
13
|
parentToolUseId?: string;
|
|
24
|
-
/** The file that Claude Code writes the command's output to, from the Bash result. */
|
|
25
|
-
outputFilePath?: string;
|
|
26
|
-
/** Reads that file into the terminal while the command runs. */
|
|
27
|
-
output?: BackgroundOutputTail;
|
|
28
|
-
}
|
|
29
|
-
/** A tool call whose task runs on in the background (see `Session.backgroundToolCalls`). */
|
|
30
|
-
export interface BackgroundToolCall {
|
|
31
|
-
toolCallId: string;
|
|
32
|
-
/**
|
|
33
|
-
* The tool use of the call, which Claude Code no longer caches after its
|
|
34
|
-
* result. Undefined for a call that the adapter started for a task (see
|
|
35
|
-
* `SessionBackgroundWork.adoptTasks`), which has `title` instead.
|
|
36
|
-
*/
|
|
37
|
-
toolUse?: {
|
|
38
|
-
name: string;
|
|
39
|
-
input: unknown;
|
|
40
|
-
};
|
|
41
|
-
/** The title of a call that the adapter started for a task: the task's description. */
|
|
42
|
-
title?: string;
|
|
43
|
-
/** The subagent tool call that made the call, if any. */
|
|
44
|
-
parentToolUseId?: string;
|
|
45
|
-
paused?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** How a background task ended, as Claude Code reports it. Undefined when it did not say. */
|
|
48
|
-
export type BackgroundTaskEnd = "completed" | "failed" | "stopped" | undefined;
|
|
49
|
-
/** The live background task set of `background_tasks_changed`, by task id. */
|
|
50
|
-
export type BackgroundLevel = Map<string, {
|
|
51
|
-
ambient: boolean;
|
|
52
|
-
taskType: string;
|
|
53
|
-
description: string;
|
|
54
|
-
parentTaskId?: string;
|
|
55
|
-
progress?: WorkflowCardProgress;
|
|
56
|
-
}>;
|
|
57
|
-
/** What a workflow card shows: the task's progress fields and its latest phase and agent list. */
|
|
58
|
-
export type WorkflowCardProgress = TaskProgressFields & {
|
|
59
|
-
workflow?: WorkflowSnapshot;
|
|
60
|
-
};
|
|
61
|
-
/** The work state of a session, as its `state_update` names it. */
|
|
62
|
-
export type WorkStateName = "idle" | "running" | "requires_action" | "unknown";
|
|
63
|
-
/** A new list of the session `sessionId`, with what its repeated state needs. */
|
|
64
|
-
export interface BackgroundReport {
|
|
65
|
-
sessionId: string;
|
|
66
|
-
items: BackgroundItem[];
|
|
67
|
-
/** The session's work state now, or undefined when it has none yet. */
|
|
68
|
-
state: WorkStateName | undefined;
|
|
69
|
-
/** The parent of a subagent session, which mirrors the child's state. */
|
|
70
|
-
parentSessionId?: string;
|
|
71
|
-
}
|
|
72
|
-
/** Where the agent reports the lists (see the agent's `background` option). */
|
|
73
|
-
export interface BackgroundSink {
|
|
74
|
-
/** The list of a session changed, or is reported for the first time. */
|
|
75
|
-
changed(report: BackgroundReport): void;
|
|
76
|
-
/** The session ended: its list is no longer reported. */
|
|
77
|
-
forget(sessionId: string): void;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The state of a session that other modules own, and that the background
|
|
81
|
-
* work reads: Claude Code's tasks as the consumer tracks them, the subagent
|
|
82
|
-
* sessions, and the query that stops a task.
|
|
83
|
-
*/
|
|
84
|
-
export interface BackgroundOwner {
|
|
85
|
-
liveBackgroundTasks: Map<string, {
|
|
86
|
-
parentToolUseId?: string;
|
|
87
|
-
isSubagent: boolean;
|
|
88
|
-
}>;
|
|
89
|
-
nativeSubagentsByTaskId?: Map<string, NativeSubagent>;
|
|
90
|
-
query: {
|
|
91
|
-
stopTask(taskId: string): Promise<void>;
|
|
92
|
-
};
|
|
93
14
|
}
|
|
94
|
-
/**
|
|
95
|
-
export type LevelTask = {
|
|
96
|
-
task_id: string;
|
|
97
|
-
task_type: string;
|
|
98
|
-
description: string;
|
|
99
|
-
parent_task_id?: string;
|
|
100
|
-
ambient?: boolean;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* The background work of one root session, and of its subagent sessions: the
|
|
104
|
-
* terminals and tool calls of the tasks that run in the background, and what
|
|
105
|
-
* the client is told of them.
|
|
106
|
-
*
|
|
107
|
-
* Terminals are kept for every client that renders them, as before the
|
|
108
|
-
* background lists. The rest is kept only when `reported`.
|
|
109
|
-
*/
|
|
15
|
+
/** The terminals of the commands that one root session, and its subagents, run in the background. */
|
|
110
16
|
export declare class SessionBackgroundWork {
|
|
111
17
|
private readonly sessionId;
|
|
112
|
-
readonly reported: boolean;
|
|
113
|
-
/** Claude Code's live background task set, from its last `background_tasks_changed`. */
|
|
114
|
-
private level;
|
|
115
18
|
/** The terminals of the commands that went to the background, by task id. */
|
|
116
19
|
private readonly terminals;
|
|
117
|
-
|
|
118
|
-
private readonly toolCalls;
|
|
119
|
-
/**
|
|
120
|
-
* The tool calls that returned, oldest first. A task that a call started
|
|
121
|
-
* is part of that call until it returns, and the foreground work waits on
|
|
122
|
-
* it. The task's `task_started` can come after the call returned. Bounded
|
|
123
|
-
* by {@link MAX_RETURNED_CALLS}: a task joins the level around the time its
|
|
124
|
-
* call returns.
|
|
125
|
-
*/
|
|
126
|
-
private readonly returned;
|
|
127
|
-
/**
|
|
128
|
-
* `reported`: whether the client gets the lists. Only when Claude Code's
|
|
129
|
-
* interrupt spares background tasks, as `perTaskStopAffordance` makes it.
|
|
130
|
-
*/
|
|
131
|
-
constructor(sessionId: string, reported: boolean);
|
|
20
|
+
constructor(sessionId: string);
|
|
132
21
|
/**
|
|
133
22
|
* Keeps the display terminal of the command `taskId` running after its Bash
|
|
134
23
|
* result, until its task ends (see `withRunningTerminal`).
|
|
135
24
|
*/
|
|
136
25
|
terminalStarted(taskId: string, terminal: BackgroundTerminal): void;
|
|
137
26
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* - The returned calls no longer hold the tasks that they started.
|
|
141
|
-
* - Each call whose task goes on in the background is registered: a
|
|
142
|
-
* `Monitor` or `Workflow` call, whose structured result names its task,
|
|
143
|
-
* or a call that a live task names as its tool use, such as a
|
|
144
|
-
* backgrounded MCP call. The task must be in the level: one that ended
|
|
145
|
-
* already leaves its call as it is. Claude Code marks every live-update
|
|
146
|
-
* watcher `ambient`, including the task of a `Monitor` call; a call
|
|
147
|
-
* started it, so it is work the client can see and stop, and is
|
|
148
|
-
* registered all the same. Ambient tasks without a call of their own,
|
|
149
|
-
* such as watchers Claude Code starts by itself, are never registered.
|
|
150
|
-
*
|
|
151
|
-
* Returns the ids of the registered calls, whose result then reports
|
|
152
|
-
* `in_progress` (see `withRunningToolCall`).
|
|
153
|
-
*/
|
|
154
|
-
toolResults(owner: BackgroundOwner, content: unknown, toolUseResult: unknown, toolUses: Record<string, {
|
|
155
|
-
name: string;
|
|
156
|
-
input: unknown;
|
|
157
|
-
}>, parentToolUseId: string | null): Set<string>;
|
|
158
|
-
/**
|
|
159
|
-
* Starts reading the output of the background command `taskId` into its
|
|
160
|
-
* terminal, when the client gets the lists and the Bash result named the
|
|
161
|
-
* command's output file. `send` sends an update of the terminal's tool
|
|
162
|
-
* call, routed as the call's other updates. Called once the Bash result's
|
|
163
|
-
* own updates are sent: the first output replaces the placeholder that they
|
|
164
|
-
* gave the terminal.
|
|
165
|
-
*/
|
|
166
|
-
followOutput(taskId: string, send: Send): void;
|
|
167
|
-
/**
|
|
168
|
-
* The task `taskId` ended. Reads the rest of its command's output, then
|
|
169
|
-
* exits its terminal, and gives a tool call whose task it was its final
|
|
170
|
-
* status: `cancelled` for a task that Claude Code stopped, and `completed`
|
|
171
|
-
* for one that ended without saying how, such as one that the level
|
|
172
|
-
* dropped: it no longer runs, and reported no failure. Claude Code reports
|
|
173
|
-
* no exit code for a command, and `completed` does not mean 0: Claude Code
|
|
174
|
-
* accepts some non-zero codes as a success, such as grep's 1.
|
|
175
|
-
*/
|
|
176
|
-
taskEnded(taskId: string, end: BackgroundTaskEnd, send: Send): Promise<void>;
|
|
177
|
-
/**
|
|
178
|
-
* The update that reports the background tool call of the task `taskId` as
|
|
179
|
-
* `paused`, or as `in_progress` again, when `paused` changes it. Claude Code
|
|
180
|
-
* pauses a workflow this way.
|
|
27
|
+
* The task `taskId` ended: exits its command's terminal, with no exit code.
|
|
28
|
+
* Claude Code reports no exit code for a command.
|
|
181
29
|
*/
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Updates an existing workflow card without changing its work state. A
|
|
185
|
-
* report without `workflow` keeps the last phase and agent list.
|
|
186
|
-
*/
|
|
187
|
-
taskProgress(taskId: string, progress: WorkflowCardProgress): AcpSessionNotification | undefined;
|
|
188
|
-
/**
|
|
189
|
-
* The latest progress of the workflow calls in `toolCallIds`.
|
|
190
|
-
*
|
|
191
|
-
* A task can report progress before its launch tool returns. Those fields
|
|
192
|
-
* wait in the live task level and are sent after the launch result.
|
|
193
|
-
*/
|
|
194
|
-
toolCallProgress(toolCallIds: ReadonlySet<string>): AcpSessionNotification[];
|
|
195
|
-
/**
|
|
196
|
-
* Takes Claude Code's new live background task set. The terminals and tool
|
|
197
|
-
* calls whose tasks it no longer holds end first, before a list drops them,
|
|
198
|
-
* as v2 requires. A terminal or tool call is registered at its tool result,
|
|
199
|
-
* after its task joined the level, so a later level without the task means
|
|
200
|
-
* that it ended. Claude Code usually sends a task's end before that level,
|
|
201
|
-
* which ends them first, but the SDK does not promise that order.
|
|
202
|
-
*/
|
|
203
|
-
levelChanged(tasks: LevelTask[], send: Send): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
* The query closed: Claude Code's background tasks end with its process.
|
|
206
|
-
* Stops reading output, and returns the updates that exit the root
|
|
207
|
-
* session's terminals and cancel its tool calls. The level empties, so the
|
|
208
|
-
* next lists are empty. A subagent's command or tool call is left as it
|
|
209
|
-
* was: it is on the child's stream, which the closed query's routing owned.
|
|
210
|
-
*/
|
|
211
|
-
queryClosed(): AcpSessionNotification[];
|
|
212
|
-
/**
|
|
213
|
-
* Starts a tool call for each live task that no terminal or tool call
|
|
214
|
-
* stands for yet, and returns the `tool_call`s to send: v2 lists background work only by an entity
|
|
215
|
-
* the client knows. Such a task is one that no tool call started, such as
|
|
216
|
-
* one a hook started, or one whose tool call returned, with its final
|
|
217
|
-
* status, before the task started. The call has the task's description as
|
|
218
|
-
* its title, is `in_progress`, and ends with the task (see `taskEnded`). A
|
|
219
|
-
* task that an announced subagent session runs gets its call on that
|
|
220
|
-
* session's stream. Ambient tasks are housekeeping and get no call.
|
|
221
|
-
*
|
|
222
|
-
* The agent sends them before each list it publishes, so the call comes
|
|
223
|
-
* before the first list that names it, as v2 requires.
|
|
224
|
-
*/
|
|
225
|
-
adoptTasks(owner: BackgroundOwner): AcpSessionNotification[];
|
|
226
|
-
/**
|
|
227
|
-
* The `background` list of the root session and of each of its announced
|
|
228
|
-
* subagent sessions, with what their repeated states need, deeper sessions
|
|
229
|
-
* first and the root last: a child's own list goes out before its parent's
|
|
230
|
-
* list drops it. Each list is empty while the level has not been reported:
|
|
231
|
-
* Claude Code sends none before the first background task starts.
|
|
232
|
-
*/
|
|
233
|
-
reports(owner: BackgroundOwner, rootState: WorkStateName): BackgroundReport[];
|
|
234
|
-
/**
|
|
235
|
-
* The current state of each background tool call in `toolCallIds`: the
|
|
236
|
-
* call as `renderer` shows its tool use, with its status now (see
|
|
237
|
-
* `ClaudeAcpAgent.publishBackgroundToolCalls`).
|
|
238
|
-
*/
|
|
239
|
-
toolCallStates(toolCallIds: string[], renderer: AcpToolCallRenderer, cwd: string): AcpSessionNotification[];
|
|
240
|
-
/**
|
|
241
|
-
* The task of the terminal or tool call `target` that the session
|
|
242
|
-
* `sessionId` lists, or undefined when it lists no such item.
|
|
243
|
-
*/
|
|
244
|
-
listedTask(owner: BackgroundOwner, sessionId: string, target: BackgroundTarget): string | undefined;
|
|
30
|
+
taskEnded(taskId: string, send: Send): Promise<void>;
|
|
245
31
|
}
|
|
246
32
|
type Send = (notification: AcpSessionNotification) => Promise<void>;
|
|
247
|
-
/** A terminal or tool call that `terminal/cancel` or `tool_call/cancel` names. */
|
|
248
|
-
export type BackgroundTarget = {
|
|
249
|
-
terminalId: string;
|
|
250
|
-
} | {
|
|
251
|
-
toolCallId: string;
|
|
252
|
-
};
|
|
253
|
-
/**
|
|
254
|
-
* Stops the task of a terminal or tool call that the session `sessionId`
|
|
255
|
-
* lists (v2 `terminal/cancel` and `tool_call/cancel`). `sessions` are the
|
|
256
|
-
* root sessions: a subagent session's list is built with its root's. The
|
|
257
|
-
* terminal exits, or the tool call gets its final status, when Claude Code
|
|
258
|
-
* reports the task stopped.
|
|
259
|
-
*/
|
|
260
|
-
export declare function cancelBackgroundWork(sessions: Array<BackgroundOwner & {
|
|
261
|
-
background?: SessionBackgroundWork;
|
|
262
|
-
}>, sessionId: string, target: BackgroundTarget): Promise<void>;
|
|
263
|
-
/**
|
|
264
|
-
* Publishes the lists of each session that reports them, each time one
|
|
265
|
-
* changes. The sink sends them to the client synchronously, so a list follows
|
|
266
|
-
* the updates sent before it.
|
|
267
|
-
*/
|
|
268
|
-
export declare class BackgroundWorkReporter {
|
|
269
|
-
private readonly sink?;
|
|
270
|
-
/** The list last published for each session, as JSON, and the root session it is built with. */
|
|
271
|
-
private readonly published;
|
|
272
|
-
constructor(sink?: BackgroundSink | undefined);
|
|
273
|
-
/** Whether the lists are reported at all. */
|
|
274
|
-
get enabled(): boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Publishes each list of the root session `rootSessionId` that changed. The
|
|
277
|
-
* first call for a session publishes its list, also when it is empty.
|
|
278
|
-
* `rootState` is the root session's state now.
|
|
279
|
-
*/
|
|
280
|
-
sync(rootSessionId: string, session: BackgroundOwner & {
|
|
281
|
-
background?: SessionBackgroundWork;
|
|
282
|
-
}, rootState: WorkStateName): void;
|
|
283
|
-
/** The root session `rootSessionId` ended, and its subagent sessions with it. */
|
|
284
|
-
forget(rootSessionId: string): void;
|
|
285
|
-
}
|
|
286
33
|
export {};
|
|
287
34
|
//# sourceMappingURL=background-work.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-work.d.ts","sourceRoot":"","sources":["../src/background-work.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"background-work.d.ts","sourceRoot":"","sources":["../src/background-work.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qGAAqG;AACrG,qBAAa,qBAAqB;IAIpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAHtC,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;gBAEtC,SAAS,EAAE,MAAM;IAE9C;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAInE;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAM3D;AAED,KAAK,IAAI,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|