@agentclientprotocol/claude-agent-acp 0.102.1-preview.1 → 0.102.1-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/acp-agent.d.ts +113 -439
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +362 -2409
- 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/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/native-subagents.d.ts +18 -8
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +7 -35
- 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/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 +39 -0
- package/dist/result-end.d.ts.map +1 -0
- package/dist/result-end.js +50 -0
- package/dist/serve.d.ts +7 -2
- 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 +2 -5
- 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/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/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 +165 -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 +1223 -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 +228 -0
- package/dist/v2/stream.d.ts.map +1 -0
- package/dist/v2/stream.js +506 -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
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { isReplayHiddenMetaMessage, isSyntheticLoginMessage, messageIdForGrouping, stripLocalCommandMetadata, streamEventToAcpNotifications, toAcpNotifications, } from "../acp-agent.js";
|
|
2
|
+
import { isCompactSummaryMessage, replayCompactSummary } from "../context-compaction.js";
|
|
3
|
+
import { ClientCapabilities } from "../tool-calls/client-capabilities.js";
|
|
4
|
+
import { ToolCallFieldTracker } from "../tool-calls/field-tracker.js";
|
|
5
|
+
import { AcpToolCallRenderer, V2_CANCELLED } from "../tool-calls/renderer.js";
|
|
6
|
+
import { changedTaskPlanEntries, unregisterHookCallback } from "../tools.js";
|
|
7
|
+
import { recordStreamedDelta, unstreamedRemainder } from "../streamed-text.js";
|
|
8
|
+
import { replayClear } from "./update-translator.js";
|
|
9
|
+
/** Every v2 client gets the same tool call reports: v2 diffs and display terminals. */
|
|
10
|
+
const V2_TOOL_CALL_CAPABILITIES = ClientCapabilities.from(undefined, { v2: true });
|
|
11
|
+
/**
|
|
12
|
+
* The v1 capabilities the shared mapping reads. Every v2 client takes
|
|
13
|
+
* `plan_update` with a markdown plan, so an approved ExitPlanMode's plan
|
|
14
|
+
* goes out as one. Every v2 client also gets a session per subagent
|
|
15
|
+
* (`tasks.ts`), so a subagent's TodoWrite checklist is that session's `plan`
|
|
16
|
+
* rather than `plan:<parentToolUseId>` in its parent's session.
|
|
17
|
+
*/
|
|
18
|
+
const V2_CLIENT_CAPABILITIES = { plan: {}, subagents: {} };
|
|
19
|
+
export class SessionOutput {
|
|
20
|
+
sessionId;
|
|
21
|
+
cwd;
|
|
22
|
+
translator;
|
|
23
|
+
send;
|
|
24
|
+
logger;
|
|
25
|
+
subagent;
|
|
26
|
+
toolUseCache = {};
|
|
27
|
+
emittedToolCalls = new Set();
|
|
28
|
+
/** What the client holds of each open tool call: an update carries only what changed. */
|
|
29
|
+
toolCallFields = new ToolCallFieldTracker();
|
|
30
|
+
streamedToolInputs = new Map();
|
|
31
|
+
/** The session's Task* list (TaskCreate, TaskUpdate, TaskList), sent as plan updates. */
|
|
32
|
+
taskState = new Map();
|
|
33
|
+
/** The text and thinking that streamed as deltas since the last message started or ended. */
|
|
34
|
+
streamedBlocks = [];
|
|
35
|
+
/** The id of the assistant message that is streaming. */
|
|
36
|
+
streamingMessageId;
|
|
37
|
+
/** Whether any agent text went out since {@link resetAgentText}. */
|
|
38
|
+
agentText = false;
|
|
39
|
+
/** During {@link replay}, the messages that it has cleared so far. */
|
|
40
|
+
replayCleared;
|
|
41
|
+
/** The open tool calls whose tool use reached a complete assistant message: Claude Code runs them. */
|
|
42
|
+
dispatched = new Set();
|
|
43
|
+
/**
|
|
44
|
+
* Whether the output comes from work that a `session/cancel` stopped, until
|
|
45
|
+
* its idle. The session's streamed deltas still go out,
|
|
46
|
+
* and of its consolidated messages only the tool results of the calls that
|
|
47
|
+
* the client holds, where an error result ends a run that the cancel
|
|
48
|
+
* aborted (`cancelled`). On the root, this covers the main conversation's
|
|
49
|
+
* messages. A foreground subagent's session sets it at the root's cancel,
|
|
50
|
+
* until its run ends (see `SessionTasks.cancelForeground`).
|
|
51
|
+
*/
|
|
52
|
+
cancelled = false;
|
|
53
|
+
/** Whether `message` is of the work that a cancel stopped (see {@link cancelled}). */
|
|
54
|
+
stoppedWork(message) {
|
|
55
|
+
return this.cancelled && (this.subagent || message.parent_tool_use_id === null);
|
|
56
|
+
}
|
|
57
|
+
/** During {@link replay}, the replayed tool uses, apart from the live ones. */
|
|
58
|
+
replayToolUses;
|
|
59
|
+
/** During {@link replay}, what the session's subagents ask of it. */
|
|
60
|
+
replayHooks;
|
|
61
|
+
/** During {@link replay}, the replayed tool calls without a final status. */
|
|
62
|
+
replayUnfinished;
|
|
63
|
+
/** Set by the session's tasks: rewrites the live updates (see {@link OutputRoute}). */
|
|
64
|
+
route;
|
|
65
|
+
/** Set by the session around one message: rewrites its updates before {@link route}. */
|
|
66
|
+
rewrite;
|
|
67
|
+
constructor(sessionId, cwd, translator, send, logger,
|
|
68
|
+
/**
|
|
69
|
+
* Whether this is a subagent's session. Its messages keep the
|
|
70
|
+
* `parent_tool_use_id` of the Agent call that launched it, and its text
|
|
71
|
+
* streams (`forwardSubagentText`).
|
|
72
|
+
*/
|
|
73
|
+
subagent = false) {
|
|
74
|
+
this.sessionId = sessionId;
|
|
75
|
+
this.cwd = cwd;
|
|
76
|
+
this.translator = translator;
|
|
77
|
+
this.send = send;
|
|
78
|
+
this.logger = logger;
|
|
79
|
+
this.subagent = subagent;
|
|
80
|
+
}
|
|
81
|
+
/** Tool updates that a hook callback sends outside the stream (an Edit's diff). */
|
|
82
|
+
hookClient = {
|
|
83
|
+
sessionUpdate: async (notification) => this.emit([notification]),
|
|
84
|
+
};
|
|
85
|
+
/** A partial assistant message: one event of the streaming API response. */
|
|
86
|
+
streamEvent(message) {
|
|
87
|
+
// A subagent's stream goes to its own session (see `tasks.ts`).
|
|
88
|
+
if (message.parent_tool_use_id !== null && !this.subagent)
|
|
89
|
+
return;
|
|
90
|
+
if (message.event.type === "message_start") {
|
|
91
|
+
this.streamingMessageId = message.event.message.id;
|
|
92
|
+
// A message that never reached its consolidated message, such as one an
|
|
93
|
+
// interrupt cut short, leaves its record behind.
|
|
94
|
+
this.streamedBlocks.length = 0;
|
|
95
|
+
}
|
|
96
|
+
recordStreamedDelta(this.streamedBlocks, message.event);
|
|
97
|
+
this.emit(streamEventToAcpNotifications(message, this.sessionId, this.toolUseCache, this.hookClient, this.logger, {
|
|
98
|
+
toolCallCapabilities: V2_TOOL_CALL_CAPABILITIES,
|
|
99
|
+
cwd: this.cwd,
|
|
100
|
+
emittedToolCalls: this.emittedToolCalls,
|
|
101
|
+
toolCallFields: this.toolCallFields,
|
|
102
|
+
messageId: this.streamingMessageId,
|
|
103
|
+
streamedToolInputs: this.streamedToolInputs,
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A consolidated assistant message. Of its text and thinking, only what did
|
|
108
|
+
* not stream as deltas goes out (`unstreamedRemainder`):
|
|
109
|
+
* the tail of a block whose stream was cut short, or the whole message when
|
|
110
|
+
* it never streamed (a gateway without streaming). Its tool uses then get
|
|
111
|
+
* their complete input. A subagent's message on the root session goes
|
|
112
|
+
* without its text, which belongs to the subagent's own session. After a
|
|
113
|
+
* cancel, the stopped work's message is dropped (see {@link cancelled}).
|
|
114
|
+
*/
|
|
115
|
+
assistant(message) {
|
|
116
|
+
const messageId = messageIdForGrouping(message);
|
|
117
|
+
for (const block of message.message.content) {
|
|
118
|
+
if (block.type === "tool_use")
|
|
119
|
+
this.dispatched.add(block.id);
|
|
120
|
+
}
|
|
121
|
+
const ownText = message.parent_tool_use_id === null || this.subagent;
|
|
122
|
+
const content = ownText
|
|
123
|
+
? unstreamedRemainder(message.message.content, this.streamedBlocks)
|
|
124
|
+
: message.message.content.filter((block) => block.type !== "text" && block.type !== "thinking");
|
|
125
|
+
if (ownText)
|
|
126
|
+
this.streamedBlocks.length = 0;
|
|
127
|
+
if (this.stoppedWork(message))
|
|
128
|
+
return;
|
|
129
|
+
this.content(content, "assistant", message.parent_tool_use_id, { messageId });
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A user message that Claude Code adds: the results of tool uses. Its other
|
|
133
|
+
* blocks (command output, reminders, a prompt's echo) are not output.
|
|
134
|
+
* `transform` rewrites each update before it goes out, such as a background
|
|
135
|
+
* command's result, whose terminal keeps running.
|
|
136
|
+
*/
|
|
137
|
+
toolResults(message, transform = (n) => n) {
|
|
138
|
+
if (!Array.isArray(message.message.content))
|
|
139
|
+
return;
|
|
140
|
+
const all = message.message.content.filter((block) => block.type === "tool_result");
|
|
141
|
+
// After a cancel, only the results of the calls that the client holds (see {@link cancelled}).
|
|
142
|
+
const results = this.stoppedWork(message)
|
|
143
|
+
? all.filter((block) => this.emittedToolCalls.has(block.tool_use_id))
|
|
144
|
+
: all;
|
|
145
|
+
if (results.length === 0)
|
|
146
|
+
return;
|
|
147
|
+
this.content(results, "user", message.parent_tool_use_id, {
|
|
148
|
+
// `tool_use_result` describes the one result of its message.
|
|
149
|
+
toolUseResult: results.length === all.length ? message.tool_use_result : undefined,
|
|
150
|
+
toolResultMeta: message.tool_result_meta,
|
|
151
|
+
cancelled: this.cancelled,
|
|
152
|
+
}, transform);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Shows `content`, the exact patch of an Edit or Write, on its tool call
|
|
156
|
+
* before the tool runs (see `file-preview.ts`). The streamed input's diff
|
|
157
|
+
* does not replace the patch. A hook can come before the streamed tool_use,
|
|
158
|
+
* and a workflow's tools run hooks without ever streaming their use or
|
|
159
|
+
* result: the patch then waits for the tool call's first publication (by the
|
|
160
|
+
* stream or a permission request), instead of showing a tool call that would
|
|
161
|
+
* never end.
|
|
162
|
+
*/
|
|
163
|
+
preview(toolCallId, content) {
|
|
164
|
+
if (!this.emittedToolCalls.has(toolCallId)) {
|
|
165
|
+
this.toolCallFields.stagePreview(toolCallId, content);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const update = { sessionUpdate: "tool_call_update", toolCallId, content };
|
|
169
|
+
if (!this.toolCallFields.apply(update))
|
|
170
|
+
return;
|
|
171
|
+
this.toolCallFields.pinContent(toolCallId, content);
|
|
172
|
+
this.emit([{ sessionId: this.sessionId, update }]);
|
|
173
|
+
}
|
|
174
|
+
/** Whether the stream mapped the tool call `toolCallId`, shown or routed away. */
|
|
175
|
+
holds(toolCallId) {
|
|
176
|
+
return this.emittedToolCalls.has(toolCallId);
|
|
177
|
+
}
|
|
178
|
+
/** The tool uses of the session's tool calls, by id. */
|
|
179
|
+
toolUses() {
|
|
180
|
+
return this.toolUseCache;
|
|
181
|
+
}
|
|
182
|
+
/** Sends v1-shaped updates of the session, as the shared mapping makes them. */
|
|
183
|
+
emitV1(notifications) {
|
|
184
|
+
this.emit(notifications);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* A tool's progress beat, on its tool call: the beat's own `tool_use_id`
|
|
188
|
+
* when the client holds that call, else the call it runs in
|
|
189
|
+
* (`parent_tool_use_id`), such as the Agent call of a subagent's tool or
|
|
190
|
+
* a heartbeat's derived id. A beat for a call that returned is dropped.
|
|
191
|
+
*/
|
|
192
|
+
toolProgress(message) {
|
|
193
|
+
const toolCallId = this.emittedToolCalls.has(message.tool_use_id)
|
|
194
|
+
? message.tool_use_id
|
|
195
|
+
: message.parent_tool_use_id;
|
|
196
|
+
if (toolCallId === null || !this.emittedToolCalls.has(toolCallId))
|
|
197
|
+
return;
|
|
198
|
+
// A subagent's beat, on its own session, names the Agent call that runs
|
|
199
|
+
// it. A tool call is never its own parent.
|
|
200
|
+
const parentToolUseId = this.subagent && message.parent_tool_use_id !== toolCallId
|
|
201
|
+
? (message.parent_tool_use_id ?? undefined)
|
|
202
|
+
: undefined;
|
|
203
|
+
const beat = new AcpToolCallRenderer(V2_TOOL_CALL_CAPABILITIES).progress({
|
|
204
|
+
toolCallId,
|
|
205
|
+
toolName: message.tool_name,
|
|
206
|
+
parentToolUseId,
|
|
207
|
+
elapsedTimeSeconds: message.elapsed_time_seconds,
|
|
208
|
+
subagentType: message.subagent_type,
|
|
209
|
+
subagentRetry: message.subagent_retry,
|
|
210
|
+
});
|
|
211
|
+
if (this.toolCallFields.apply(beat))
|
|
212
|
+
this.emit([{ sessionId: this.sessionId, update: beat }]);
|
|
213
|
+
}
|
|
214
|
+
/** Claude Code recalled memories: a completed read tool call. */
|
|
215
|
+
memoryRecall(message) {
|
|
216
|
+
this.emit([
|
|
217
|
+
{
|
|
218
|
+
sessionId: this.sessionId,
|
|
219
|
+
update: new AcpToolCallRenderer(V2_TOOL_CALL_CAPABILITIES).memoryRecall(message),
|
|
220
|
+
},
|
|
221
|
+
]);
|
|
222
|
+
}
|
|
223
|
+
/** The Task* list changed outside a tool result (the TaskCreated and TaskCompleted hooks). */
|
|
224
|
+
taskPlanChanged() {
|
|
225
|
+
const entries = changedTaskPlanEntries(this.taskState, false);
|
|
226
|
+
if (entries)
|
|
227
|
+
this.emit([{ sessionId: this.sessionId, update: { sessionUpdate: "plan", entries } }]);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The tool call of a permission request that the stream never shows, such
|
|
231
|
+
* as SandboxNetworkAccess's, before the request: the client holds it, and
|
|
232
|
+
* {@link toolCallStatus} ends it once the request is answered, as on v1
|
|
233
|
+
* (`ensureToolCallEmitted`).
|
|
234
|
+
*/
|
|
235
|
+
permissionToolCall(toolName, toolCallId, input) {
|
|
236
|
+
if (this.emittedToolCalls.has(toolCallId))
|
|
237
|
+
return;
|
|
238
|
+
this.emittedToolCalls.add(toolCallId);
|
|
239
|
+
const update = new AcpToolCallRenderer(V2_TOOL_CALL_CAPABILITIES).toolCall({ id: toolCallId, name: toolName, input }, { cwd: this.cwd });
|
|
240
|
+
this.toolCallFields.apply(update);
|
|
241
|
+
this.emit([{ sessionId: this.sessionId, update }]);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* The tool call that the adapter starts for a background task that no tool
|
|
245
|
+
* call stands for (see `SessionTasks.adoptTasks`). It ends with the task.
|
|
246
|
+
*/
|
|
247
|
+
taskToolCall(update) {
|
|
248
|
+
this.emittedToolCalls.add(update.toolCallId);
|
|
249
|
+
this.toolCallFields.apply(update);
|
|
250
|
+
this.emit([{ sessionId: this.sessionId, update }]);
|
|
251
|
+
}
|
|
252
|
+
/** A workflow's latest progress on its tool call, as its title and body (`workflowCard`). */
|
|
253
|
+
taskToolCallProgress(toolCallId, card) {
|
|
254
|
+
this.emit([
|
|
255
|
+
{
|
|
256
|
+
sessionId: this.sessionId,
|
|
257
|
+
update: { sessionUpdate: "tool_call_update", toolCallId, ...card },
|
|
258
|
+
},
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Claude Code denied a tool use without asking (a rule, the classifier or
|
|
263
|
+
* the mode): its tool call fails with the reason. A tool
|
|
264
|
+
* call that the client does not hold, such as dropped work's, is left out.
|
|
265
|
+
*/
|
|
266
|
+
permissionDenied(message, parentToolUseId) {
|
|
267
|
+
// Its PostToolUse hook never runs.
|
|
268
|
+
unregisterHookCallback(message.tool_use_id);
|
|
269
|
+
if (!this.emittedToolCalls.has(message.tool_use_id))
|
|
270
|
+
return;
|
|
271
|
+
const denied = new AcpToolCallRenderer(V2_TOOL_CALL_CAPABILITIES).permissionDenied({
|
|
272
|
+
toolCallId: message.tool_use_id,
|
|
273
|
+
toolName: message.tool_name,
|
|
274
|
+
...(parentToolUseId !== undefined ? { parentToolUseId } : {}),
|
|
275
|
+
decisionReasonType: message.decision_reason_type,
|
|
276
|
+
decisionReason: message.decision_reason,
|
|
277
|
+
message: message.message,
|
|
278
|
+
});
|
|
279
|
+
// A denial is final, so it replaces a pinned approval patch.
|
|
280
|
+
if (this.toolCallFields.apply(denied, { replacePinnedContent: true })) {
|
|
281
|
+
this.emit([{ sessionId: this.sessionId, update: denied }]);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/** Sets the status of a tool call, such as a background task's when it ends. */
|
|
285
|
+
toolCallStatus(toolCallId, status) {
|
|
286
|
+
if (FINAL_STATUSES.has(status))
|
|
287
|
+
this.unfinished.delete(toolCallId);
|
|
288
|
+
this.send({ sessionUpdate: "tool_call_update", toolCallId, status });
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Replays the stored history of the session: its prompts, Claude's
|
|
292
|
+
* messages and its tool calls, as the live session sent them. Subagent
|
|
293
|
+
* transcripts are left out, as live. The client may hold the replayed
|
|
294
|
+
* messages already, so each message is cleared before its first chunk.
|
|
295
|
+
* `hooks` replays the subagents' own histories to their sessions.
|
|
296
|
+
*
|
|
297
|
+
* A replayed tool call that the history gives no result, such as one that
|
|
298
|
+
* ran when Claude Code was killed, ends `failed` after the replay, as v2
|
|
299
|
+
* asks of replayed work that no longer runs. The calls that the live
|
|
300
|
+
* session holds open, and those in `live` (its background work), go on.
|
|
301
|
+
* `running` rewrites the replayed results of that background work as live,
|
|
302
|
+
* so that they do not end it (see `SessionTasks.replayedBackground`).
|
|
303
|
+
*/
|
|
304
|
+
replay(messages, hooks, live = new Set(), running) {
|
|
305
|
+
this.replayCleared = new Set();
|
|
306
|
+
this.replayHooks = hooks;
|
|
307
|
+
const unfinished = (this.replayUnfinished = new Set());
|
|
308
|
+
try {
|
|
309
|
+
for (const message of messages) {
|
|
310
|
+
if (message.parent_tool_use_id !== null || isReplayHiddenMetaMessage(message))
|
|
311
|
+
continue;
|
|
312
|
+
// Claude Code's sign-in message, which the live session did not show either.
|
|
313
|
+
if (message.type === "assistant" && isSyntheticLoginMessage(message.message))
|
|
314
|
+
continue;
|
|
315
|
+
// A compaction's summary message replays as the completed compaction.
|
|
316
|
+
// `emit` sends at once, before the call returns, so the update keeps
|
|
317
|
+
// its place among the replayed messages.
|
|
318
|
+
if (isCompactSummaryMessage(message) && message.uuid) {
|
|
319
|
+
void replayCompactSummary(message, async (n) => this.emit([n]), {
|
|
320
|
+
sessionId: this.sessionId,
|
|
321
|
+
});
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
hooks?.replaying?.(message);
|
|
325
|
+
const inner = message.message;
|
|
326
|
+
if (message.type === "assistant" && Array.isArray(inner.content)) {
|
|
327
|
+
this.content(inner.content, "assistant", null, {
|
|
328
|
+
messageId: inner.id ?? message.uuid,
|
|
329
|
+
replay: true,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
else if (message.type === "user" && inner.content !== undefined) {
|
|
333
|
+
// `null`: the message was command metadata alone.
|
|
334
|
+
let content = stripLocalCommandMetadata(inner.content);
|
|
335
|
+
if (content !== null && hooks?.userContent)
|
|
336
|
+
content = hooks.userContent(message, content);
|
|
337
|
+
if (content === null)
|
|
338
|
+
continue;
|
|
339
|
+
this.content(content, "user", null, { messageId: message.uuid, replay: true }, running);
|
|
340
|
+
}
|
|
341
|
+
hooks?.replayed(message);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
finally {
|
|
345
|
+
this.replayCleared = undefined;
|
|
346
|
+
this.replayToolUses = undefined;
|
|
347
|
+
this.replayHooks = undefined;
|
|
348
|
+
this.replayUnfinished = undefined;
|
|
349
|
+
}
|
|
350
|
+
for (const toolCallId of unfinished) {
|
|
351
|
+
if (this.unfinished.has(toolCallId) || live.has(toolCallId))
|
|
352
|
+
continue;
|
|
353
|
+
this.send({ sessionUpdate: "tool_call_update", toolCallId, status: "failed" });
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/** Agent text that is not a model message, such as a local command's result. */
|
|
357
|
+
agentMessage(text, messageId) {
|
|
358
|
+
this.content(text, "assistant", null, { messageId });
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* A user message that this session did not send, such as one typed in
|
|
362
|
+
* another client over Remote Control: rendered as a replayed one is,
|
|
363
|
+
* without its command metadata.
|
|
364
|
+
*/
|
|
365
|
+
userMessage(content, messageId) {
|
|
366
|
+
const shown = stripLocalCommandMetadata(content);
|
|
367
|
+
if (shown !== null)
|
|
368
|
+
this.content(shown, "user", null, { messageId });
|
|
369
|
+
}
|
|
370
|
+
/** Whether agent text went out since the last {@link resetAgentText}. */
|
|
371
|
+
hasAgentText() {
|
|
372
|
+
return this.agentText;
|
|
373
|
+
}
|
|
374
|
+
resetAgentText() {
|
|
375
|
+
this.agentText = false;
|
|
376
|
+
}
|
|
377
|
+
content(content, role, parentToolUseId, options, transform = (n) => n) {
|
|
378
|
+
// A replay renders the history on its own: each
|
|
379
|
+
// replayed tool call goes out whole, whatever the live session sent.
|
|
380
|
+
const live = !options.replay;
|
|
381
|
+
this.emit(toAcpNotifications(content, role, this.sessionId, live ? this.toolUseCache : (this.replayToolUses ??= {}), this.hookClient, this.logger, {
|
|
382
|
+
clientCapabilities: V2_CLIENT_CAPABILITIES,
|
|
383
|
+
toolCallCapabilities: V2_TOOL_CALL_CAPABILITIES,
|
|
384
|
+
cwd: this.cwd,
|
|
385
|
+
...(live
|
|
386
|
+
? { emittedToolCalls: this.emittedToolCalls, toolCallFields: this.toolCallFields }
|
|
387
|
+
: {}),
|
|
388
|
+
taskState: this.taskState,
|
|
389
|
+
parentToolUseId,
|
|
390
|
+
// A replayed tool use runs no hook that could report its result.
|
|
391
|
+
registerHooks: !options.replay,
|
|
392
|
+
...options,
|
|
393
|
+
}).map(transform));
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Gives each tool call that has no final status yet the final `status`,
|
|
397
|
+
* except those in `keep` (background work, which goes on). For the end of
|
|
398
|
+
* stopped work: v2 asks for a final status of its tool calls before the idle.
|
|
399
|
+
* With `exitTerminals`, a command's terminal exits with its call, with no
|
|
400
|
+
* exit code. Returns the ids of the calls it ended.
|
|
401
|
+
*/
|
|
402
|
+
finishUnfinished(status, keep = new Set(), { exitTerminals = false } = {}) {
|
|
403
|
+
const finished = [];
|
|
404
|
+
for (const toolCallId of [...this.unfinished]) {
|
|
405
|
+
if (keep.has(toolCallId))
|
|
406
|
+
continue;
|
|
407
|
+
this.unfinished.delete(toolCallId);
|
|
408
|
+
finished.push(toolCallId);
|
|
409
|
+
if (!exitTerminals) {
|
|
410
|
+
this.send({ sessionUpdate: "tool_call_update", toolCallId, status });
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
// The translator ignores `terminal_exit` for a call without a terminal.
|
|
414
|
+
this.emit([
|
|
415
|
+
{
|
|
416
|
+
sessionId: this.sessionId,
|
|
417
|
+
update: {
|
|
418
|
+
sessionUpdate: "tool_call_update",
|
|
419
|
+
toolCallId,
|
|
420
|
+
status: status === "cancelled" ? V2_CANCELLED : status,
|
|
421
|
+
_meta: { terminal_exit: { terminal_id: toolCallId, exit_code: null, signal: null } },
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
]);
|
|
425
|
+
}
|
|
426
|
+
return finished;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Ends the open tool calls that will get no result, for the end of the work
|
|
430
|
+
* (see `AcpToolCallRenderer.unfinished`), before its idle. After a cancel
|
|
431
|
+
* (`stopped`), every open call ends `cancelled`. Otherwise only the calls
|
|
432
|
+
* that Claude dropped before they ran end, `cancelled` too: a streamed
|
|
433
|
+
* tool_use that no complete message holds. A call that runs, such as one in
|
|
434
|
+
* the background, gets Claude Code's result. A command's report also ends
|
|
435
|
+
* its terminal. The call is forgotten, so a late result changes nothing.
|
|
436
|
+
* The calls in `keep` stay open, such as one whose task runs in the background.
|
|
437
|
+
*/
|
|
438
|
+
closeUnfinished(stopped, keep = new Set()) {
|
|
439
|
+
const renderer = new AcpToolCallRenderer(V2_TOOL_CALL_CAPABILITIES);
|
|
440
|
+
for (const toolCallId of [...this.unfinished]) {
|
|
441
|
+
if (keep.has(toolCallId))
|
|
442
|
+
continue;
|
|
443
|
+
const ran = this.dispatched.has(toolCallId);
|
|
444
|
+
if (ran && !stopped)
|
|
445
|
+
continue;
|
|
446
|
+
const report = renderer.unfinished({ toolCallId, ran, cancelled: stopped });
|
|
447
|
+
const toolUse = this.toolUseCache[toolCallId];
|
|
448
|
+
const terminalExit = toolUse && renderer.terminalExit(toolUse);
|
|
449
|
+
if (terminalExit)
|
|
450
|
+
report._meta = { ...report._meta, ...terminalExit };
|
|
451
|
+
this.emittedToolCalls.delete(toolCallId);
|
|
452
|
+
delete this.toolUseCache[toolCallId];
|
|
453
|
+
this.toolCallFields.delete(toolCallId);
|
|
454
|
+
this.emit([{ sessionId: this.sessionId, update: report }]);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
/** The tool calls that the client holds without a final status. */
|
|
458
|
+
unfinished = new Set();
|
|
459
|
+
/** Called with each live agent text chunk, for the session's title. */
|
|
460
|
+
onAgentText;
|
|
461
|
+
emit(notifications) {
|
|
462
|
+
// A replay routes only what its hooks ask: the live routing tracks live calls.
|
|
463
|
+
const route = this.replayCleared !== undefined ? this.replayHooks?.route : this.route;
|
|
464
|
+
// Each update is routed once the ones before it went out: a route can
|
|
465
|
+
// send updates of its own, such as a child's announcement or a
|
|
466
|
+
// hand-back's two messages, which then keep their place.
|
|
467
|
+
for (const original of notifications) {
|
|
468
|
+
const notification = this.rewrite ? this.rewrite(original) : original;
|
|
469
|
+
for (const { update } of route ? route(notification) : [notification])
|
|
470
|
+
this.sendOne(update);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
sendOne(update) {
|
|
474
|
+
const replaying = this.replayCleared !== undefined;
|
|
475
|
+
if (update.sessionUpdate === "agent_message_chunk") {
|
|
476
|
+
this.agentText = true;
|
|
477
|
+
if (!replaying)
|
|
478
|
+
this.onAgentText?.(update.content);
|
|
479
|
+
}
|
|
480
|
+
for (const v2Update of this.translator.updates(this.sessionId, update, replaying)) {
|
|
481
|
+
const clear = this.replayCleared && replayClear(this.replayCleared, v2Update);
|
|
482
|
+
if (clear)
|
|
483
|
+
this.send(clear);
|
|
484
|
+
if (v2Update.sessionUpdate === "tool_call_update") {
|
|
485
|
+
const { toolCallId, status } = v2Update;
|
|
486
|
+
if (status != null && replaying) {
|
|
487
|
+
if (FINAL_STATUSES.has(status))
|
|
488
|
+
this.replayUnfinished?.delete(toolCallId);
|
|
489
|
+
else
|
|
490
|
+
this.replayUnfinished?.add(toolCallId);
|
|
491
|
+
}
|
|
492
|
+
else if (status != null) {
|
|
493
|
+
if (FINAL_STATUSES.has(status)) {
|
|
494
|
+
this.unfinished.delete(toolCallId);
|
|
495
|
+
this.dispatched.delete(toolCallId);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
this.unfinished.add(toolCallId);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
this.send(v2Update);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
const FINAL_STATUSES = new Set(["completed", "failed", "cancelled"]);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type * as v2 from "@agentclientprotocol/sdk/experimental/v2/unstable";
|
|
2
|
+
import type { SessionConfigOption } from "@agentclientprotocol/sdk/unstable";
|
|
3
|
+
import type { SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
4
|
+
import type { Logger } from "../acp-agent.js";
|
|
5
|
+
import { type SubagentModels } from "../native-subagents.js";
|
|
6
|
+
import type { V2UpdateTranslator } from "./update-translator.js";
|
|
7
|
+
import { SessionOutput, type ReplayHooks } from "./stream.js";
|
|
8
|
+
/** What the replay needs of its root session. */
|
|
9
|
+
export interface ReplayHost {
|
|
10
|
+
readonly sessionId: string;
|
|
11
|
+
readonly cwd: string;
|
|
12
|
+
readonly logger: Logger;
|
|
13
|
+
readonly translator: V2UpdateTranslator;
|
|
14
|
+
/** Sends an update of the root session or one of its children. */
|
|
15
|
+
send(notification: v2.UpdateSessionNotification): void;
|
|
16
|
+
models(): SubagentModels;
|
|
17
|
+
}
|
|
18
|
+
/** What the live session knows of the replayed children. */
|
|
19
|
+
export interface LiveChildren {
|
|
20
|
+
/** Whether the live session tracks the child session `sessionId`. */
|
|
21
|
+
tracks(sessionId: string): boolean;
|
|
22
|
+
/** The configuration that the client last got for the live child `sessionId`, if any. */
|
|
23
|
+
configuration(sessionId: string): SessionConfigOption[] | undefined;
|
|
24
|
+
}
|
|
25
|
+
export declare class SubagentReplay {
|
|
26
|
+
private readonly host;
|
|
27
|
+
private readonly history;
|
|
28
|
+
/** The transcript of each child, by agent id. */
|
|
29
|
+
private readonly transcripts;
|
|
30
|
+
private readonly live;
|
|
31
|
+
/** The children, by the id of the call that launched each. */
|
|
32
|
+
private readonly children;
|
|
33
|
+
private readonly sendMessages;
|
|
34
|
+
/** The SubagentHandback calls, with their report and whether their result failed. */
|
|
35
|
+
private readonly handbacks;
|
|
36
|
+
/** Launches without metadata, which the replay leaves out. */
|
|
37
|
+
private readonly omitted;
|
|
38
|
+
/** Children whose transcript could not be read: only their association is replayed. */
|
|
39
|
+
private withoutHistory;
|
|
40
|
+
private rootOutput;
|
|
41
|
+
private constructor();
|
|
42
|
+
/**
|
|
43
|
+
* Reads the subagent history that `messages`, the session's transcript,
|
|
44
|
+
* launched, with every child's transcript. Undefined when it launched none.
|
|
45
|
+
*/
|
|
46
|
+
static load(host: ReplayHost, messages: SessionMessage[], live?: LiveChildren): Promise<SubagentReplay | undefined>;
|
|
47
|
+
/** The hooks of the replay of the root session's history (`messages`). */
|
|
48
|
+
hooks(output: SessionOutput, messages: SessionMessage[]): ReplayHooks;
|
|
49
|
+
/**
|
|
50
|
+
* Ends the replay: every child's end, on its parent, then once on its own
|
|
51
|
+
* stream, and the notice when subagent history is missing.
|
|
52
|
+
*/
|
|
53
|
+
finish(): void;
|
|
54
|
+
/**
|
|
55
|
+
* After the response, as the v1 core sends them (`currentStates`): the
|
|
56
|
+
* current state of each replayed child that the live session does not
|
|
57
|
+
* track, since its process is gone, so its replayed end. A `cwd` that is
|
|
58
|
+
* gone, such as a worktree that Claude Code removed, is cleared. Then each
|
|
59
|
+
* replayed child's configuration, when it is not the `model` that the
|
|
60
|
+
* replay sent: the live child's, else the model of its latest response, by
|
|
61
|
+
* the session's model list.
|
|
62
|
+
*/
|
|
63
|
+
afterResponse(): void;
|
|
64
|
+
private sendConfiguration;
|
|
65
|
+
private sendEndState;
|
|
66
|
+
private ownerHooks;
|
|
67
|
+
/**
|
|
68
|
+
* Registers the launches, the launch results, the SendMessage calls and the
|
|
69
|
+
* SubagentHandback calls in `messages`, of the session `ownerSessionId`.
|
|
70
|
+
*/
|
|
71
|
+
private scan;
|
|
72
|
+
private registerLaunch;
|
|
73
|
+
/**
|
|
74
|
+
* A replayed update of a tool call of `output`, the session of `owner`
|
|
75
|
+
* when it is a child's. The client is not shown the launch of a replayed
|
|
76
|
+
* child, a SendMessage call whose message the replay delivered, or a
|
|
77
|
+
* successful SubagentHandback call: a foreground launch's completed result
|
|
78
|
+
* goes out as the child's reply, a delivered SendMessage as the sender's
|
|
79
|
+
* outgoing message, and a hand-back as the child's message to its parent.
|
|
80
|
+
*/
|
|
81
|
+
private route;
|
|
82
|
+
/**
|
|
83
|
+
* Before a message of `owner`'s history (the root's when undefined): a
|
|
84
|
+
* child's response with another model sends its `model` again, and a
|
|
85
|
+
* persisted task notification of a child is the state its work ended in.
|
|
86
|
+
*/
|
|
87
|
+
private replaying;
|
|
88
|
+
/** After a message that launched children: each is announced, and its history replays. */
|
|
89
|
+
private replayed;
|
|
90
|
+
private announce;
|
|
91
|
+
/** The `model` of a response of `child`, when it is not the one the client holds. */
|
|
92
|
+
private sendModel;
|
|
93
|
+
/**
|
|
94
|
+
* The rest of a child's user message to replay, or `null` when nothing is
|
|
95
|
+
* left, after its text went out as the child's incoming `session_message`.
|
|
96
|
+
* The first text is the prompt of the launch. A message that a SendMessage
|
|
97
|
+
* call delivered (`origin.kind: "coordinator"`) is another incoming
|
|
98
|
+
* message. Any other text is Claude Code's, such as "[Request interrupted
|
|
99
|
+
* by user]", which the live child session does not show. Tool results stay.
|
|
100
|
+
*/
|
|
101
|
+
private childContent;
|
|
102
|
+
/**
|
|
103
|
+
* A message that a SendMessage call delivered to `child` (see
|
|
104
|
+
* `deliveredCall`). With the call, the message has the call's id and text
|
|
105
|
+
* and its sender, as live, and, unless the replay already showed the call
|
|
106
|
+
* as a tool call, it replaces the call: the sender's view goes out at the
|
|
107
|
+
* call (see {@link route}). Without the call, it has its transcript id and
|
|
108
|
+
* the delivered text.
|
|
109
|
+
*/
|
|
110
|
+
private sendDelivery;
|
|
111
|
+
private sendPrompt;
|
|
112
|
+
private outputOf;
|
|
113
|
+
private cwdOf;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=subagent-replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-replay.d.ts","sourceRoot":"","sources":["../../src/v2/subagent-replay.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,KAAK,EAAE,MAAM,mDAAmD,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAYL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAgBhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9D,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,kEAAkE;IAClE,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,yBAAyB,GAAG,IAAI,CAAC;IACvD,MAAM,IAAI,cAAc,CAAC;CAC1B;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,yFAAyF;IACzF,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,EAAE,GAAG,SAAS,CAAC;CACrE;AAwCD,qBAAa,cAAc;IAgBvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,iDAAiD;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAnBvB,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyB;IACtD,qFAAqF;IACrF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGtB;IACJ,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,uFAAuF;IACvF,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,UAAU,CAA4B;IAE9C,OAAO;IAQP;;;OAGG;WACU,IAAI,CACf,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,cAAc,EAAE,EAC1B,IAAI,GAAE,YAA+B,GACpC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAiBtC,0EAA0E;IAC1E,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,WAAW;IAMrE;;;OAGG;IACH,MAAM,IAAI,IAAI;IA0Bd;;;;;;;;OAQG;IACH,aAAa,IAAI,IAAI;IAQrB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,UAAU;IAWlB;;;OAGG;IACH,OAAO,CAAC,IAAI;IAmCZ,OAAO,CAAC,cAAc;IAsBtB;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;IAuDb;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAYjB,0FAA0F;IAC1F,OAAO,CAAC,QAAQ;IAiBhB,OAAO,CAAC,QAAQ;IAiChB,qFAAqF;IACrF,OAAO,CAAC,SAAS;IAcjB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAgBpB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,KAAK;CAKd"}
|