@langchain/langgraph-sdk 1.5.6 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/index.d.cts +5 -1
  2. package/dist/index.d.ts +5 -1
  3. package/dist/react/index.cjs +6 -0
  4. package/dist/react/index.d.cts +7 -2
  5. package/dist/react/index.d.ts +7 -2
  6. package/dist/react/index.js +2 -1
  7. package/dist/react/stream.cjs.map +1 -1
  8. package/dist/react/stream.custom.cjs +36 -7
  9. package/dist/react/stream.custom.cjs.map +1 -1
  10. package/dist/react/stream.custom.d.cts.map +1 -1
  11. package/dist/react/stream.custom.d.ts.map +1 -1
  12. package/dist/react/stream.custom.js +36 -7
  13. package/dist/react/stream.custom.js.map +1 -1
  14. package/dist/react/stream.d.cts +51 -31
  15. package/dist/react/stream.d.cts.map +1 -1
  16. package/dist/react/stream.d.ts +51 -31
  17. package/dist/react/stream.d.ts.map +1 -1
  18. package/dist/react/stream.js.map +1 -1
  19. package/dist/react/stream.lgp.cjs +45 -13
  20. package/dist/react/stream.lgp.cjs.map +1 -1
  21. package/dist/react/stream.lgp.js +45 -13
  22. package/dist/react/stream.lgp.js.map +1 -1
  23. package/dist/react/types.d.cts +5 -88
  24. package/dist/react/types.d.cts.map +1 -1
  25. package/dist/react/types.d.ts +5 -88
  26. package/dist/react/types.d.ts.map +1 -1
  27. package/dist/react-ui/client.cjs.map +1 -1
  28. package/dist/react-ui/client.d.cts +5 -3
  29. package/dist/react-ui/client.d.cts.map +1 -1
  30. package/dist/react-ui/client.d.ts +5 -3
  31. package/dist/react-ui/client.d.ts.map +1 -1
  32. package/dist/react-ui/client.js.map +1 -1
  33. package/dist/schema.d.cts.map +1 -1
  34. package/dist/schema.d.ts.map +1 -1
  35. package/dist/types.stream.d.ts.map +1 -1
  36. package/dist/ui/manager.cjs +140 -14
  37. package/dist/ui/manager.cjs.map +1 -1
  38. package/dist/ui/manager.js +140 -14
  39. package/dist/ui/manager.js.map +1 -1
  40. package/dist/ui/stream/agent.d.cts +143 -0
  41. package/dist/ui/stream/agent.d.cts.map +1 -0
  42. package/dist/ui/stream/agent.d.ts +143 -0
  43. package/dist/ui/stream/agent.d.ts.map +1 -0
  44. package/dist/ui/stream/base.d.cts +144 -0
  45. package/dist/ui/stream/base.d.cts.map +1 -0
  46. package/dist/ui/stream/base.d.ts +144 -0
  47. package/dist/ui/stream/base.d.ts.map +1 -0
  48. package/dist/ui/stream/deep-agent.d.cts +277 -0
  49. package/dist/ui/stream/deep-agent.d.cts.map +1 -0
  50. package/dist/ui/stream/deep-agent.d.ts +277 -0
  51. package/dist/ui/stream/deep-agent.d.ts.map +1 -0
  52. package/dist/ui/stream/index.d.cts +172 -0
  53. package/dist/ui/stream/index.d.cts.map +1 -0
  54. package/dist/ui/stream/index.d.ts +172 -0
  55. package/dist/ui/stream/index.d.ts.map +1 -0
  56. package/dist/ui/subagents.cjs +593 -0
  57. package/dist/ui/subagents.cjs.map +1 -0
  58. package/dist/ui/subagents.d.cts +291 -0
  59. package/dist/ui/subagents.d.cts.map +1 -0
  60. package/dist/ui/subagents.d.ts +291 -0
  61. package/dist/ui/subagents.d.ts.map +1 -0
  62. package/dist/ui/subagents.js +589 -0
  63. package/dist/ui/subagents.js.map +1 -0
  64. package/dist/ui/types.d.cts +384 -5
  65. package/dist/ui/types.d.cts.map +1 -1
  66. package/dist/ui/types.d.ts +384 -5
  67. package/dist/ui/types.d.ts.map +1 -1
  68. package/package.json +6 -3
@@ -0,0 +1,291 @@
1
+ import { DefaultToolCall, Message } from "../types.messages.js";
2
+ import { SubagentStream } from "./types.js";
3
+
4
+ //#region src/ui/subagents.d.ts
5
+
6
+ /**
7
+ * Checks if a namespace indicates a subagent/subgraph message.
8
+ *
9
+ * Subagent namespaces contain a "tools:" segment indicating they
10
+ * originate from a tool call that spawned a subgraph.
11
+ *
12
+ * @param namespace - The namespace array from stream events (or checkpoint_ns string)
13
+ * @returns True if this is a subagent namespace
14
+ */
15
+ declare function isSubagentNamespace(namespace: string[] | string | undefined): boolean;
16
+ /**
17
+ * Extracts the tool call ID from a namespace path.
18
+ *
19
+ * Namespaces follow the pattern: ["tools:call_abc123", "model_request:xyz", ...]
20
+ * This function extracts "call_abc123" from the first "tools:" segment.
21
+ *
22
+ * @param namespace - The namespace array from stream events
23
+ * @returns The tool call ID, or undefined if not found
24
+ */
25
+ declare function extractToolCallIdFromNamespace(namespace: string[] | undefined): string | undefined;
26
+ /**
27
+ * Calculates the depth of a subagent based on its namespace.
28
+ * Counts the number of "tools:" segments in the namespace.
29
+ *
30
+ * @param namespace - The namespace array
31
+ * @returns The depth (0 for main agent, 1+ for subagents)
32
+ */
33
+ declare function calculateDepthFromNamespace(namespace: string[] | undefined): number;
34
+ /**
35
+ * Extracts the parent tool call ID from a namespace.
36
+ *
37
+ * For nested subagents, the namespace looks like:
38
+ * ["tools:parent_id", "tools:child_id", ...]
39
+ *
40
+ * @param namespace - The namespace array
41
+ * @returns The parent tool call ID, or null if this is a top-level subagent
42
+ */
43
+ declare function extractParentIdFromNamespace(namespace: string[] | undefined): string | null;
44
+ /**
45
+ * Options for SubagentManager.
46
+ */
47
+ interface SubagentManagerOptions {
48
+ /**
49
+ * Tool names that indicate subagent invocation.
50
+ * Defaults to ["task"].
51
+ */
52
+ subagentToolNames?: string[];
53
+ /**
54
+ * Callback when subagent state changes.
55
+ */
56
+ onSubagentChange?: () => void;
57
+ }
58
+ /**
59
+ * Manages subagent execution state.
60
+ *
61
+ * Tracks subagents from the moment they are invoked (AI message with tool calls)
62
+ * through streaming to completion (tool message result).
63
+ */
64
+ declare class SubagentManager<ToolCall = DefaultToolCall> {
65
+ private subagents;
66
+ /**
67
+ * Maps namespace IDs (pregel task IDs) to tool call IDs.
68
+ * LangGraph subgraphs use internal pregel task IDs in their namespace,
69
+ * which are different from the tool_call_id used to invoke them.
70
+ */
71
+ private namespaceToToolCallId;
72
+ /**
73
+ * Pending namespace matches that couldn't be resolved immediately.
74
+ * These are retried when new tool calls are registered.
75
+ */
76
+ private pendingMatches;
77
+ /**
78
+ * Message managers for each subagent.
79
+ * Uses the same MessageTupleManager as the main stream for proper
80
+ * message chunk concatenation.
81
+ */
82
+ private messageManagers;
83
+ private subagentToolNames;
84
+ private onSubagentChange?;
85
+ constructor(options?: SubagentManagerOptions);
86
+ /**
87
+ * Get or create a MessageTupleManager for a subagent.
88
+ */
89
+ private getMessageManager;
90
+ /**
91
+ * Get messages for a subagent with proper chunk concatenation.
92
+ * This mirrors how the main stream handles messages.
93
+ */
94
+ private getMessagesForSubagent;
95
+ /**
96
+ * Create a complete SubagentStream object with all derived properties.
97
+ * This ensures consistency with UseStream interface.
98
+ */
99
+ private createSubagentStream;
100
+ /**
101
+ * Get the tool call ID for a given namespace ID.
102
+ * Returns the namespace ID itself if no mapping exists.
103
+ */
104
+ getToolCallIdFromNamespace(namespaceId: string): string;
105
+ /**
106
+ * Try to match a subgraph to a pending subagent by description.
107
+ * Creates a mapping from namespace ID to tool call ID if a match is found.
108
+ *
109
+ * Uses a multi-pass matching strategy:
110
+ * 1. Exact description match
111
+ * 2. Description contains/partial match
112
+ * 3. Any unmapped pending subagent (fallback)
113
+ *
114
+ * @param namespaceId - The namespace ID (pregel task ID) from the subgraph
115
+ * @param description - The description from the subgraph's initial message
116
+ * @returns The matched tool call ID, or undefined if no match
117
+ */
118
+ matchSubgraphToSubagent(namespaceId: string, description: string): string | undefined;
119
+ /**
120
+ * Check if a tool call is a subagent invocation.
121
+ */
122
+ isSubagentToolCall(toolName: string): boolean;
123
+ /**
124
+ * Check if a subagent_type value is valid.
125
+ * Valid types are proper identifiers like "weather-scout", "experience-curator".
126
+ */
127
+ private isValidSubagentType;
128
+ /**
129
+ * Check if a subagent should be shown to the user.
130
+ * Subagents are only shown once they've actually started running.
131
+ *
132
+ * This filters out:
133
+ * - Pending subagents that haven't been matched to a namespace yet
134
+ * - Streaming artifacts with partial/corrupted data
135
+ *
136
+ * The idea is: we register subagents internally when we see tool calls,
137
+ * but we only show them to the user once LangGraph confirms they're
138
+ * actually executing (via namespace events).
139
+ */
140
+ private isValidSubagent;
141
+ /**
142
+ * Build a complete SubagentStream from internal state.
143
+ * Adds messages and derived properties.
144
+ */
145
+ private buildExecution;
146
+ /**
147
+ * Get all subagents as a Map.
148
+ * Filters out incomplete/phantom subagents that lack subagent_type.
149
+ */
150
+ getSubagents(): Map<string, SubagentStream<Record<string, unknown>, ToolCall>>;
151
+ /**
152
+ * Get all currently running subagents.
153
+ * Filters out incomplete/phantom subagents.
154
+ */
155
+ getActiveSubagents(): SubagentStream<Record<string, unknown>, ToolCall>[];
156
+ /**
157
+ * Get a specific subagent by tool call ID.
158
+ */
159
+ getSubagent(toolCallId: string): SubagentStream<Record<string, unknown>, ToolCall> | undefined;
160
+ /**
161
+ * Get all subagents of a specific type.
162
+ */
163
+ getSubagentsByType(type: string): SubagentStream<Record<string, unknown>, ToolCall>[];
164
+ /**
165
+ * Get all subagents triggered by a specific AI message.
166
+ *
167
+ * @param messageId - The ID of the AI message.
168
+ * @returns Array of subagent streams triggered by that message.
169
+ */
170
+ getSubagentsByMessage(messageId: string): SubagentStream<Record<string, unknown>, ToolCall>[];
171
+ /**
172
+ * Parse tool call args, handling both object and string formats.
173
+ * During streaming, args might come as a string that needs parsing.
174
+ */
175
+ private parseArgs;
176
+ /**
177
+ * Register new subagent(s) from AI message tool calls.
178
+ *
179
+ * Called when an AI message is received with tool calls.
180
+ * Creates pending subagent entries for each subagent tool call.
181
+ *
182
+ * @param toolCalls - The tool calls from an AI message
183
+ * @param aiMessageId - The ID of the AI message that triggered the tool calls
184
+ */
185
+ registerFromToolCalls(toolCalls: Array<{
186
+ id?: string;
187
+ name: string;
188
+ args: Record<string, unknown> | string;
189
+ }>, aiMessageId?: string | null): void;
190
+ /**
191
+ * Retry matching pending namespaces to newly registered tool calls.
192
+ */
193
+ private retryPendingMatches;
194
+ /**
195
+ * Mark a subagent as running and update its namespace.
196
+ *
197
+ * Called when update events are received with a namespace indicating
198
+ * which subagent is streaming.
199
+ *
200
+ * @param toolCallId - The tool call ID of the subagent
201
+ * @param options - Additional update options
202
+ */
203
+ markRunning(toolCallId: string, options?: {
204
+ namespace?: string[];
205
+ }): void;
206
+ /**
207
+ * Mark a subagent as running using a namespace ID.
208
+ * Resolves the namespace ID to the actual tool call ID via the mapping.
209
+ *
210
+ * @param namespaceId - The namespace ID (pregel task ID) from the subgraph
211
+ * @param namespace - The full namespace array
212
+ */
213
+ markRunningFromNamespace(namespaceId: string, namespace?: string[]): void;
214
+ /**
215
+ * Add a serialized message to a subagent from stream events.
216
+ *
217
+ * This method handles the raw serialized message data from SSE events.
218
+ * Uses MessageTupleManager for proper chunk concatenation, matching
219
+ * how the main stream handles messages.
220
+ *
221
+ * @param namespaceId - The namespace ID (pregel task ID) from the stream
222
+ * @param serialized - The serialized message from the stream
223
+ * @param metadata - Optional metadata from the stream event
224
+ */
225
+ addMessageToSubagent(namespaceId: string, serialized: Message<DefaultToolCall>, metadata?: Record<string, unknown>): void;
226
+ /**
227
+ * Update subagent values from a values stream event.
228
+ *
229
+ * Called when a values event is received from a subagent's namespace.
230
+ * This populates the subagent's state values, making them accessible
231
+ * via the `values` property.
232
+ *
233
+ * @param namespaceId - The namespace ID (pregel task ID) from the stream
234
+ * @param values - The state values from the stream event
235
+ */
236
+ updateSubagentValues(namespaceId: string, values: Record<string, unknown>): void;
237
+ /**
238
+ * Complete a subagent with a result.
239
+ *
240
+ * Called when a tool message is received for the subagent.
241
+ *
242
+ * @param toolCallId - The tool call ID of the subagent
243
+ * @param result - The result content
244
+ * @param status - The final status (complete or error)
245
+ */
246
+ complete(toolCallId: string, result: string, status?: "complete" | "error"): void;
247
+ /**
248
+ * Clear all subagent state.
249
+ */
250
+ clear(): void;
251
+ /**
252
+ * Process a tool message to complete a subagent.
253
+ *
254
+ * @param toolCallId - The tool call ID from the tool message
255
+ * @param content - The result content
256
+ * @param status - Whether the tool execution was successful
257
+ */
258
+ processToolMessage(toolCallId: string, content: string, status?: "success" | "error"): void;
259
+ /**
260
+ * Reconstruct subagent state from historical messages.
261
+ *
262
+ * This method parses an array of messages (typically from thread history)
263
+ * to identify subagent executions and their results. It's used to restore
264
+ * subagent state after:
265
+ * - Page refresh (when stream has already completed)
266
+ * - Loading thread history
267
+ * - Navigating between threads
268
+ *
269
+ * The reconstruction process:
270
+ * 1. Find AI messages with tool calls matching subagent tool names
271
+ * 2. Find corresponding tool messages with results
272
+ * 3. Create SubagentStream entries with "complete" status
273
+ *
274
+ * Note: Internal subagent messages (their streaming conversation) are not
275
+ * reconstructed since they are not persisted in the main thread state.
276
+ *
277
+ * @param messages - Array of messages from thread history
278
+ * @param options - Optional configuration
279
+ * @param options.skipIfPopulated - If true, skip reconstruction if subagents already exist
280
+ */
281
+ reconstructFromMessages(messages: Message<DefaultToolCall>[], options?: {
282
+ skipIfPopulated?: boolean;
283
+ }): void;
284
+ /**
285
+ * Check if any subagents are currently tracked.
286
+ */
287
+ hasSubagents(): boolean;
288
+ }
289
+ //#endregion
290
+ export { SubagentManager, calculateDepthFromNamespace, extractParentIdFromNamespace, extractToolCallIdFromNamespace, isSubagentNamespace };
291
+ //# sourceMappingURL=subagents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagents.d.ts","names":["Message","DefaultToolCall","SubagentStream","isSubagentNamespace","extractToolCallIdFromNamespace","calculateDepthFromNamespace","extractParentIdFromNamespace","SubagentManagerOptions","SubagentManager","Record","ToolCall","Map","Array"],"sources":["../../src/ui/subagents.d.ts"],"sourcesContent":["import type { Message, DefaultToolCall } from \"../types.messages.js\";\nimport type { SubagentStream } from \"./types.js\";\n/**\n * Checks if a namespace indicates a subagent/subgraph message.\n *\n * Subagent namespaces contain a \"tools:\" segment indicating they\n * originate from a tool call that spawned a subgraph.\n *\n * @param namespace - The namespace array from stream events (or checkpoint_ns string)\n * @returns True if this is a subagent namespace\n */\nexport declare function isSubagentNamespace(namespace: string[] | string | undefined): boolean;\n/**\n * Extracts the tool call ID from a namespace path.\n *\n * Namespaces follow the pattern: [\"tools:call_abc123\", \"model_request:xyz\", ...]\n * This function extracts \"call_abc123\" from the first \"tools:\" segment.\n *\n * @param namespace - The namespace array from stream events\n * @returns The tool call ID, or undefined if not found\n */\nexport declare function extractToolCallIdFromNamespace(namespace: string[] | undefined): string | undefined;\n/**\n * Calculates the depth of a subagent based on its namespace.\n * Counts the number of \"tools:\" segments in the namespace.\n *\n * @param namespace - The namespace array\n * @returns The depth (0 for main agent, 1+ for subagents)\n */\nexport declare function calculateDepthFromNamespace(namespace: string[] | undefined): number;\n/**\n * Extracts the parent tool call ID from a namespace.\n *\n * For nested subagents, the namespace looks like:\n * [\"tools:parent_id\", \"tools:child_id\", ...]\n *\n * @param namespace - The namespace array\n * @returns The parent tool call ID, or null if this is a top-level subagent\n */\nexport declare function extractParentIdFromNamespace(namespace: string[] | undefined): string | null;\n/**\n * Options for SubagentManager.\n */\nexport interface SubagentManagerOptions {\n /**\n * Tool names that indicate subagent invocation.\n * Defaults to [\"task\"].\n */\n subagentToolNames?: string[];\n /**\n * Callback when subagent state changes.\n */\n onSubagentChange?: () => void;\n}\n/**\n * Manages subagent execution state.\n *\n * Tracks subagents from the moment they are invoked (AI message with tool calls)\n * through streaming to completion (tool message result).\n */\nexport declare class SubagentManager<ToolCall = DefaultToolCall> {\n private subagents;\n /**\n * Maps namespace IDs (pregel task IDs) to tool call IDs.\n * LangGraph subgraphs use internal pregel task IDs in their namespace,\n * which are different from the tool_call_id used to invoke them.\n */\n private namespaceToToolCallId;\n /**\n * Pending namespace matches that couldn't be resolved immediately.\n * These are retried when new tool calls are registered.\n */\n private pendingMatches;\n /**\n * Message managers for each subagent.\n * Uses the same MessageTupleManager as the main stream for proper\n * message chunk concatenation.\n */\n private messageManagers;\n private subagentToolNames;\n private onSubagentChange?;\n constructor(options?: SubagentManagerOptions);\n /**\n * Get or create a MessageTupleManager for a subagent.\n */\n private getMessageManager;\n /**\n * Get messages for a subagent with proper chunk concatenation.\n * This mirrors how the main stream handles messages.\n */\n private getMessagesForSubagent;\n /**\n * Create a complete SubagentStream object with all derived properties.\n * This ensures consistency with UseStream interface.\n */\n private createSubagentStream;\n /**\n * Get the tool call ID for a given namespace ID.\n * Returns the namespace ID itself if no mapping exists.\n */\n getToolCallIdFromNamespace(namespaceId: string): string;\n /**\n * Try to match a subgraph to a pending subagent by description.\n * Creates a mapping from namespace ID to tool call ID if a match is found.\n *\n * Uses a multi-pass matching strategy:\n * 1. Exact description match\n * 2. Description contains/partial match\n * 3. Any unmapped pending subagent (fallback)\n *\n * @param namespaceId - The namespace ID (pregel task ID) from the subgraph\n * @param description - The description from the subgraph's initial message\n * @returns The matched tool call ID, or undefined if no match\n */\n matchSubgraphToSubagent(namespaceId: string, description: string): string | undefined;\n /**\n * Check if a tool call is a subagent invocation.\n */\n isSubagentToolCall(toolName: string): boolean;\n /**\n * Check if a subagent_type value is valid.\n * Valid types are proper identifiers like \"weather-scout\", \"experience-curator\".\n */\n private isValidSubagentType;\n /**\n * Check if a subagent should be shown to the user.\n * Subagents are only shown once they've actually started running.\n *\n * This filters out:\n * - Pending subagents that haven't been matched to a namespace yet\n * - Streaming artifacts with partial/corrupted data\n *\n * The idea is: we register subagents internally when we see tool calls,\n * but we only show them to the user once LangGraph confirms they're\n * actually executing (via namespace events).\n */\n private isValidSubagent;\n /**\n * Build a complete SubagentStream from internal state.\n * Adds messages and derived properties.\n */\n private buildExecution;\n /**\n * Get all subagents as a Map.\n * Filters out incomplete/phantom subagents that lack subagent_type.\n */\n getSubagents(): Map<string, SubagentStream<Record<string, unknown>, ToolCall>>;\n /**\n * Get all currently running subagents.\n * Filters out incomplete/phantom subagents.\n */\n getActiveSubagents(): SubagentStream<Record<string, unknown>, ToolCall>[];\n /**\n * Get a specific subagent by tool call ID.\n */\n getSubagent(toolCallId: string): SubagentStream<Record<string, unknown>, ToolCall> | undefined;\n /**\n * Get all subagents of a specific type.\n */\n getSubagentsByType(type: string): SubagentStream<Record<string, unknown>, ToolCall>[];\n /**\n * Get all subagents triggered by a specific AI message.\n *\n * @param messageId - The ID of the AI message.\n * @returns Array of subagent streams triggered by that message.\n */\n getSubagentsByMessage(messageId: string): SubagentStream<Record<string, unknown>, ToolCall>[];\n /**\n * Parse tool call args, handling both object and string formats.\n * During streaming, args might come as a string that needs parsing.\n */\n private parseArgs;\n /**\n * Register new subagent(s) from AI message tool calls.\n *\n * Called when an AI message is received with tool calls.\n * Creates pending subagent entries for each subagent tool call.\n *\n * @param toolCalls - The tool calls from an AI message\n * @param aiMessageId - The ID of the AI message that triggered the tool calls\n */\n registerFromToolCalls(toolCalls: Array<{\n id?: string;\n name: string;\n args: Record<string, unknown> | string;\n }>, aiMessageId?: string | null): void;\n /**\n * Retry matching pending namespaces to newly registered tool calls.\n */\n private retryPendingMatches;\n /**\n * Mark a subagent as running and update its namespace.\n *\n * Called when update events are received with a namespace indicating\n * which subagent is streaming.\n *\n * @param toolCallId - The tool call ID of the subagent\n * @param options - Additional update options\n */\n markRunning(toolCallId: string, options?: {\n namespace?: string[];\n }): void;\n /**\n * Mark a subagent as running using a namespace ID.\n * Resolves the namespace ID to the actual tool call ID via the mapping.\n *\n * @param namespaceId - The namespace ID (pregel task ID) from the subgraph\n * @param namespace - The full namespace array\n */\n markRunningFromNamespace(namespaceId: string, namespace?: string[]): void;\n /**\n * Add a serialized message to a subagent from stream events.\n *\n * This method handles the raw serialized message data from SSE events.\n * Uses MessageTupleManager for proper chunk concatenation, matching\n * how the main stream handles messages.\n *\n * @param namespaceId - The namespace ID (pregel task ID) from the stream\n * @param serialized - The serialized message from the stream\n * @param metadata - Optional metadata from the stream event\n */\n addMessageToSubagent(namespaceId: string, serialized: Message<DefaultToolCall>, metadata?: Record<string, unknown>): void;\n /**\n * Update subagent values from a values stream event.\n *\n * Called when a values event is received from a subagent's namespace.\n * This populates the subagent's state values, making them accessible\n * via the `values` property.\n *\n * @param namespaceId - The namespace ID (pregel task ID) from the stream\n * @param values - The state values from the stream event\n */\n updateSubagentValues(namespaceId: string, values: Record<string, unknown>): void;\n /**\n * Complete a subagent with a result.\n *\n * Called when a tool message is received for the subagent.\n *\n * @param toolCallId - The tool call ID of the subagent\n * @param result - The result content\n * @param status - The final status (complete or error)\n */\n complete(toolCallId: string, result: string, status?: \"complete\" | \"error\"): void;\n /**\n * Clear all subagent state.\n */\n clear(): void;\n /**\n * Process a tool message to complete a subagent.\n *\n * @param toolCallId - The tool call ID from the tool message\n * @param content - The result content\n * @param status - Whether the tool execution was successful\n */\n processToolMessage(toolCallId: string, content: string, status?: \"success\" | \"error\"): void;\n /**\n * Reconstruct subagent state from historical messages.\n *\n * This method parses an array of messages (typically from thread history)\n * to identify subagent executions and their results. It's used to restore\n * subagent state after:\n * - Page refresh (when stream has already completed)\n * - Loading thread history\n * - Navigating between threads\n *\n * The reconstruction process:\n * 1. Find AI messages with tool calls matching subagent tool names\n * 2. Find corresponding tool messages with results\n * 3. Create SubagentStream entries with \"complete\" status\n *\n * Note: Internal subagent messages (their streaming conversation) are not\n * reconstructed since they are not persisted in the main thread state.\n *\n * @param messages - Array of messages from thread history\n * @param options - Optional configuration\n * @param options.skipIfPopulated - If true, skip reconstruction if subagents already exist\n */\n reconstructFromMessages(messages: Message<DefaultToolCall>[], options?: {\n skipIfPopulated?: boolean;\n }): void;\n /**\n * Check if any subagents are currently tracked.\n */\n hasSubagents(): boolean;\n}\n"],"mappings":";;;;;;;AAWA;AAUA;AAQA;AAUA;AAIA;AAiBA;;AAAgDC,iBAjDxBE,mBAAAA,CAiDwBF,SAAAA,EAAAA,MAAAA,EAAAA,GAAAA,MAAAA,GAAAA,SAAAA,CAAAA,EAAAA,OAAAA;;;;;;;;;;AA+F6BS,iBAtIrDN,8BAAAA,CAsIqDM,SAAAA,EAAAA,MAAAA,EAAAA,GAAAA,SAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;;;;;;;;AA6B/DD,iBA3JUJ,2BAAAA,CA2JVI,SAAAA,EAAAA,MAAAA,EAAAA,GAAAA,SAAAA,CAAAA,EAAAA,MAAAA;;;;;;;;;;iBAjJUH,4BAAAA;;;;UAIPC,sBAAAA;;;;;;;;;;;;;;;;;cAiBIC,2BAA2BP;;;;;;;;;;;;;;;;;;;;;wBAqBtBM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiENI,YAAYT,eAAeO,yBAAyBC;;;;;wBAK9CR,eAAeO,yBAAyBC;;;;mCAI7BR,eAAeO,yBAAyBC;;;;oCAIvCR,eAAeO,yBAAyBC;;;;;;;4CAOhCR,eAAeO,yBAAyBC;;;;;;;;;;;;;;;mCAejDE;;;UAGvBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDAqC4CT,QAAQC,6BAA6BQ;;;;;;;;;;;oDAWzCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA6ChBT,QAAQC"}