@trigger.dev/sdk 4.4.5 → 4.5.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/commonjs/v3/agentSkillsRuntime.d.ts +28 -0
  2. package/dist/commonjs/v3/agentSkillsRuntime.js +163 -0
  3. package/dist/commonjs/v3/agentSkillsRuntime.js.map +1 -0
  4. package/dist/commonjs/v3/ai-shared.d.ts +173 -0
  5. package/dist/commonjs/v3/ai-shared.js +25 -0
  6. package/dist/commonjs/v3/ai-shared.js.map +1 -0
  7. package/dist/commonjs/v3/ai.d.ts +2823 -5
  8. package/dist/commonjs/v3/ai.js +6197 -13
  9. package/dist/commonjs/v3/ai.js.map +1 -1
  10. package/dist/commonjs/v3/auth.d.ts +9 -0
  11. package/dist/commonjs/v3/auth.js.map +1 -1
  12. package/dist/commonjs/v3/chat-client.d.ts +301 -0
  13. package/dist/commonjs/v3/chat-client.js +624 -0
  14. package/dist/commonjs/v3/chat-client.js.map +1 -0
  15. package/dist/commonjs/v3/chat-react.d.ts +155 -0
  16. package/dist/commonjs/v3/chat-react.js +330 -0
  17. package/dist/commonjs/v3/chat-react.js.map +1 -0
  18. package/dist/commonjs/v3/chat-server.d.ts +206 -0
  19. package/dist/commonjs/v3/chat-server.js +737 -0
  20. package/dist/commonjs/v3/chat-server.js.map +1 -0
  21. package/dist/commonjs/v3/chat-server.test.d.ts +1 -0
  22. package/dist/commonjs/v3/chat-server.test.js +518 -0
  23. package/dist/commonjs/v3/chat-server.test.js.map +1 -0
  24. package/dist/commonjs/v3/chat-tab-coordinator.d.ts +65 -0
  25. package/dist/commonjs/v3/chat-tab-coordinator.js +235 -0
  26. package/dist/commonjs/v3/chat-tab-coordinator.js.map +1 -0
  27. package/dist/commonjs/v3/chat-tab-coordinator.test.d.ts +1 -0
  28. package/dist/commonjs/v3/chat-tab-coordinator.test.js +140 -0
  29. package/dist/commonjs/v3/chat-tab-coordinator.test.js.map +1 -0
  30. package/dist/commonjs/v3/chat.d.ts +437 -0
  31. package/dist/commonjs/v3/chat.js +968 -0
  32. package/dist/commonjs/v3/chat.js.map +1 -0
  33. package/dist/commonjs/v3/chat.test.d.ts +1 -0
  34. package/dist/commonjs/v3/chat.test.js +1180 -0
  35. package/dist/commonjs/v3/chat.test.js.map +1 -0
  36. package/dist/commonjs/v3/createStartSessionAction.test.d.ts +1 -0
  37. package/dist/commonjs/v3/createStartSessionAction.test.js +113 -0
  38. package/dist/commonjs/v3/createStartSessionAction.test.js.map +1 -0
  39. package/dist/commonjs/v3/deployments.d.ts +26 -0
  40. package/dist/commonjs/v3/deployments.js +37 -0
  41. package/dist/commonjs/v3/deployments.js.map +1 -0
  42. package/dist/commonjs/v3/index.d.ts +6 -3
  43. package/dist/commonjs/v3/index.js +7 -1
  44. package/dist/commonjs/v3/index.js.map +1 -1
  45. package/dist/commonjs/v3/runs.d.ts +22 -7
  46. package/dist/commonjs/v3/runs.js +1 -0
  47. package/dist/commonjs/v3/runs.js.map +1 -1
  48. package/dist/commonjs/v3/sessions.d.ts +228 -0
  49. package/dist/commonjs/v3/sessions.js +664 -0
  50. package/dist/commonjs/v3/sessions.js.map +1 -0
  51. package/dist/commonjs/v3/sessions.test.d.ts +1 -0
  52. package/dist/commonjs/v3/sessions.test.js +154 -0
  53. package/dist/commonjs/v3/sessions.test.js.map +1 -0
  54. package/dist/commonjs/v3/shared.d.ts +24 -2
  55. package/dist/commonjs/v3/shared.js +189 -1
  56. package/dist/commonjs/v3/shared.js.map +1 -1
  57. package/dist/commonjs/v3/skill.d.ts +99 -0
  58. package/dist/commonjs/v3/skill.js +155 -0
  59. package/dist/commonjs/v3/skill.js.map +1 -0
  60. package/dist/commonjs/v3/skills.d.ts +2 -0
  61. package/dist/commonjs/v3/skills.js +6 -0
  62. package/dist/commonjs/v3/skills.js.map +1 -0
  63. package/dist/commonjs/v3/streams.js +127 -19
  64. package/dist/commonjs/v3/streams.js.map +1 -1
  65. package/dist/commonjs/v3/tasks.d.ts +2 -1
  66. package/dist/commonjs/v3/tasks.js +1 -0
  67. package/dist/commonjs/v3/tasks.js.map +1 -1
  68. package/dist/commonjs/v3/test/index.d.ts +3 -0
  69. package/dist/commonjs/v3/test/index.js +18 -0
  70. package/dist/commonjs/v3/test/index.js.map +1 -0
  71. package/dist/commonjs/v3/test/mock-chat-agent.d.ts +259 -0
  72. package/dist/commonjs/v3/test/mock-chat-agent.js +468 -0
  73. package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -0
  74. package/dist/commonjs/v3/test/setup-catalog.d.ts +1 -0
  75. package/dist/commonjs/v3/test/setup-catalog.js +18 -0
  76. package/dist/commonjs/v3/test/setup-catalog.js.map +1 -0
  77. package/dist/commonjs/v3/test/test-session-handle.d.ts +53 -0
  78. package/dist/commonjs/v3/test/test-session-handle.js +256 -0
  79. package/dist/commonjs/v3/test/test-session-handle.js.map +1 -0
  80. package/dist/commonjs/version.js +1 -1
  81. package/dist/esm/v3/agentSkillsRuntime.d.ts +28 -0
  82. package/dist/esm/v3/agentSkillsRuntime.js +136 -0
  83. package/dist/esm/v3/agentSkillsRuntime.js.map +1 -0
  84. package/dist/esm/v3/ai-shared.d.ts +173 -0
  85. package/dist/esm/v3/ai-shared.js +22 -0
  86. package/dist/esm/v3/ai-shared.js.map +1 -0
  87. package/dist/esm/v3/ai.d.ts +2823 -5
  88. package/dist/esm/v3/ai.js +6187 -14
  89. package/dist/esm/v3/ai.js.map +1 -1
  90. package/dist/esm/v3/auth.d.ts +9 -0
  91. package/dist/esm/v3/auth.js.map +1 -1
  92. package/dist/esm/v3/chat-client.d.ts +301 -0
  93. package/dist/esm/v3/chat-client.js +619 -0
  94. package/dist/esm/v3/chat-client.js.map +1 -0
  95. package/dist/esm/v3/chat-react.d.ts +155 -0
  96. package/dist/esm/v3/chat-react.js +325 -0
  97. package/dist/esm/v3/chat-react.js.map +1 -0
  98. package/dist/esm/v3/chat-server.d.ts +206 -0
  99. package/dist/esm/v3/chat-server.js +734 -0
  100. package/dist/esm/v3/chat-server.js.map +1 -0
  101. package/dist/esm/v3/chat-server.test.d.ts +1 -0
  102. package/dist/esm/v3/chat-server.test.js +516 -0
  103. package/dist/esm/v3/chat-server.test.js.map +1 -0
  104. package/dist/esm/v3/chat-tab-coordinator.d.ts +65 -0
  105. package/dist/esm/v3/chat-tab-coordinator.js +231 -0
  106. package/dist/esm/v3/chat-tab-coordinator.js.map +1 -0
  107. package/dist/esm/v3/chat-tab-coordinator.test.d.ts +1 -0
  108. package/dist/esm/v3/chat-tab-coordinator.test.js +138 -0
  109. package/dist/esm/v3/chat-tab-coordinator.test.js.map +1 -0
  110. package/dist/esm/v3/chat.d.ts +437 -0
  111. package/dist/esm/v3/chat.js +961 -0
  112. package/dist/esm/v3/chat.js.map +1 -0
  113. package/dist/esm/v3/chat.test.d.ts +1 -0
  114. package/dist/esm/v3/chat.test.js +1178 -0
  115. package/dist/esm/v3/chat.test.js.map +1 -0
  116. package/dist/esm/v3/createStartSessionAction.test.d.ts +1 -0
  117. package/dist/esm/v3/createStartSessionAction.test.js +111 -0
  118. package/dist/esm/v3/createStartSessionAction.test.js.map +1 -0
  119. package/dist/esm/v3/deployments.d.ts +26 -0
  120. package/dist/esm/v3/deployments.js +34 -0
  121. package/dist/esm/v3/deployments.js.map +1 -0
  122. package/dist/esm/v3/index.d.ts +6 -3
  123. package/dist/esm/v3/index.js +4 -1
  124. package/dist/esm/v3/index.js.map +1 -1
  125. package/dist/esm/v3/runs.d.ts +15 -0
  126. package/dist/esm/v3/runs.js +1 -0
  127. package/dist/esm/v3/runs.js.map +1 -1
  128. package/dist/esm/v3/sessions.d.ts +228 -0
  129. package/dist/esm/v3/sessions.js +656 -0
  130. package/dist/esm/v3/sessions.js.map +1 -0
  131. package/dist/esm/v3/sessions.test.d.ts +1 -0
  132. package/dist/esm/v3/sessions.test.js +152 -0
  133. package/dist/esm/v3/sessions.test.js.map +1 -0
  134. package/dist/esm/v3/shared.d.ts +24 -2
  135. package/dist/esm/v3/shared.js +188 -1
  136. package/dist/esm/v3/shared.js.map +1 -1
  137. package/dist/esm/v3/skill.d.ts +99 -0
  138. package/dist/esm/v3/skill.js +128 -0
  139. package/dist/esm/v3/skill.js.map +1 -0
  140. package/dist/esm/v3/skills.d.ts +2 -0
  141. package/dist/esm/v3/skills.js +2 -0
  142. package/dist/esm/v3/skills.js.map +1 -0
  143. package/dist/esm/v3/streams.js +127 -20
  144. package/dist/esm/v3/streams.js.map +1 -1
  145. package/dist/esm/v3/tasks.d.ts +2 -1
  146. package/dist/esm/v3/tasks.js +2 -1
  147. package/dist/esm/v3/tasks.js.map +1 -1
  148. package/dist/esm/v3/test/index.d.ts +3 -0
  149. package/dist/esm/v3/test/index.js +13 -0
  150. package/dist/esm/v3/test/index.js.map +1 -0
  151. package/dist/esm/v3/test/mock-chat-agent.d.ts +259 -0
  152. package/dist/esm/v3/test/mock-chat-agent.js +465 -0
  153. package/dist/esm/v3/test/mock-chat-agent.js.map +1 -0
  154. package/dist/esm/v3/test/setup-catalog.d.ts +1 -0
  155. package/dist/esm/v3/test/setup-catalog.js +16 -0
  156. package/dist/esm/v3/test/setup-catalog.js.map +1 -0
  157. package/dist/esm/v3/test/test-session-handle.d.ts +53 -0
  158. package/dist/esm/v3/test/test-session-handle.js +251 -0
  159. package/dist/esm/v3/test/test-session-handle.js.map +1 -0
  160. package/dist/esm/version.js +1 -1
  161. package/package.json +87 -6
@@ -0,0 +1,301 @@
1
+ /**
2
+ * Server-side API for chatting with Trigger.dev agents.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { AgentChat } from "@trigger.dev/sdk/chat";
7
+ *
8
+ * const chat = new AgentChat<typeof myAgent>({
9
+ * agent: "my-agent",
10
+ * clientData: { userId: "user_123" },
11
+ * });
12
+ *
13
+ * const stream = await chat.sendMessage("Review PR #1");
14
+ * const text = await stream.text();
15
+ * await chat.close();
16
+ * ```
17
+ */
18
+ import type { SessionTriggerConfig, Task } from "@trigger.dev/core/v3";
19
+ import type { ModelMessage, UIMessage, UIMessageChunk } from "ai";
20
+ import type { ChatTaskWirePayload } from "./ai-shared.js";
21
+ /** Extract the client data (metadata) type from a chat agent task. */
22
+ export type InferChatClientData<T> = T extends Task<any, ChatTaskWirePayload<any, infer TMetadata>, any> ? unknown extends TMetadata ? Record<string, unknown> : TMetadata : Record<string, unknown>;
23
+ /** Extract the UIMessage type from a chat agent task. */
24
+ export type InferChatUIMessage<T> = T extends Task<any, ChatTaskWirePayload<infer TUIMessage, any>, any> ? TUIMessage : UIMessage;
25
+ /** Persistable session state — store this to resume across requests. */
26
+ export type ChatSession = {
27
+ /** Last SSE event ID seen on `session.out` — used to resume without replay. */
28
+ lastEventId?: string;
29
+ };
30
+ /**
31
+ * Discriminator passed to per-endpoint `baseURL` and `fetch` callbacks on
32
+ * `AgentChat`. Same shape as the type on `TriggerChatTransport` — these
33
+ * mirror so customers can share a single resolver between the two clients.
34
+ */
35
+ export type AgentChatEndpoint = "in" | "out";
36
+ export type AgentChatEndpointContext = {
37
+ endpoint: AgentChatEndpoint;
38
+ chatId: string;
39
+ };
40
+ export type AgentChatBaseURLResolver = (ctx: AgentChatEndpointContext) => string;
41
+ export type AgentChatFetchOverride = (url: string, init: RequestInit, ctx: AgentChatEndpointContext) => Promise<Response>;
42
+ export type AgentChatOptions<TAgent = unknown> = {
43
+ /** The agent task ID to trigger. */
44
+ agent: string;
45
+ /**
46
+ * Conversation ID. Used for tagging runs and correlating messages.
47
+ * @default crypto.randomUUID()
48
+ */
49
+ id?: string;
50
+ /** Client data included in every request. Typed from the agent's clientDataSchema. */
51
+ clientData?: InferChatClientData<TAgent>;
52
+ /**
53
+ * Restore a previous session. Pass `lastEventId` from a previous
54
+ * request to resume the SSE stream without replaying old chunks.
55
+ */
56
+ session?: ChatSession;
57
+ /**
58
+ * Called when a new run is triggered for this session (initial start).
59
+ * Useful for telemetry / dashboard linking. The runId is the
60
+ * friendlyId.
61
+ */
62
+ onTriggered?: (event: {
63
+ runId: string;
64
+ chatId: string;
65
+ }) => void | Promise<void>;
66
+ /**
67
+ * Called when a turn completes. Persist `lastEventId` for stream
68
+ * resumption across requests.
69
+ */
70
+ onTurnComplete?: (event: {
71
+ chatId: string;
72
+ lastEventId?: string;
73
+ }) => void | Promise<void>;
74
+ /** SSE timeout in seconds. @default 120 */
75
+ streamTimeoutSeconds?: number;
76
+ /**
77
+ * Default trigger config used when starting a new session for this
78
+ * chat. Folded into `sessions.start({...triggerConfig})` body.
79
+ */
80
+ triggerConfig?: SessionTriggerConfig;
81
+ /**
82
+ * Override the Trigger.dev API base URL for the chat's `.in/append` and
83
+ * `.out` SSE endpoints. String form applies to both; pass a function to
84
+ * pick per endpoint. Defaults to `apiClientManager.baseURL` (whatever
85
+ * `@trigger.dev/sdk` was configured with — typically `TRIGGER_API_URL`
86
+ * env var).
87
+ *
88
+ * Session creation (`POST /api/v1/sessions`) and token mint
89
+ * (`POST /api/v1/auth/jwt/claims`) still flow through
90
+ * `apiClientManager` — pass equivalent options to
91
+ * `chat.createStartSessionAction` if you need those routed too.
92
+ */
93
+ baseURL?: string | AgentChatBaseURLResolver;
94
+ /**
95
+ * Optional per-request fetch override. Receives the resolved URL, the
96
+ * RequestInit, and endpoint context. Use this for header injection
97
+ * (tracing), proxy routing, or custom retries. Applies to both the
98
+ * `.in/append` POSTs and the `.out` SSE GET.
99
+ */
100
+ fetch?: AgentChatFetchOverride;
101
+ };
102
+ /** Parsed tool call from the stream. */
103
+ export type ChatToolCall = {
104
+ toolName: string;
105
+ toolCallId: string;
106
+ input: unknown;
107
+ };
108
+ /** Parsed tool result from the stream. */
109
+ export type ChatToolResult = {
110
+ toolCallId: string;
111
+ output: unknown;
112
+ };
113
+ /** Accumulated result after a stream completes. */
114
+ export type ChatStreamResult = {
115
+ text: string;
116
+ toolCalls: ChatToolCall[];
117
+ toolResults: ChatToolResult[];
118
+ };
119
+ /**
120
+ * A single turn's response stream from an agent.
121
+ *
122
+ * Pick one consumption mode:
123
+ * - `for await (const chunk of stream)` — typed UIMessageChunk iteration
124
+ * - `await stream.result()` — accumulated `{ text, toolCalls, toolResults }`
125
+ * - `await stream.text()` — just the text
126
+ * - `yield* stream.messages()` — sub-agent pattern (yields UIMessage snapshots)
127
+ */
128
+ export declare class ChatStream {
129
+ private readonly _consumerStream;
130
+ private readonly _messageCollector?;
131
+ private resultPromise;
132
+ constructor(stream: ReadableStream<UIMessageChunk>, onAssistantMessage?: (message: UIMessage) => void);
133
+ /** The raw ReadableStream for direct use with AI SDK utilities. */
134
+ get stream(): ReadableStream<UIMessageChunk>;
135
+ [Symbol.asyncIterator](): AsyncIterableIterator<UIMessageChunk>;
136
+ /**
137
+ * Yields accumulated UIMessage snapshots for the sub-agent tool pattern.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const stream = await chat.sendMessage("Research this topic");
142
+ * yield* stream.messages();
143
+ * ```
144
+ */
145
+ messages(): AsyncGenerator<UIMessage, void, unknown>;
146
+ /** Consume the stream and return the accumulated result. */
147
+ result(): Promise<ChatStreamResult>;
148
+ /** Consume the stream and return just the text. */
149
+ text(): Promise<string>;
150
+ private consumeStream;
151
+ }
152
+ /**
153
+ * A chat conversation with a Trigger.dev agent.
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * // Simple usage
158
+ * const chat = new AgentChat<typeof myAgent>({ agent: "my-agent" });
159
+ * const text = await (await chat.sendMessage("Hello")).text();
160
+ * await chat.close();
161
+ *
162
+ * // Stateless request handler — persist and restore session
163
+ * const chat = new AgentChat<typeof myAgent>({
164
+ * agent: "my-agent",
165
+ * id: chatId,
166
+ * session: { lastEventId: savedLastEventId },
167
+ * onTriggered: ({ runId }) => db.save(chatId, { runId }),
168
+ * onTurnComplete: ({ lastEventId }) => db.update(chatId, { lastEventId }),
169
+ * });
170
+ * ```
171
+ */
172
+ export declare class AgentChat<TAgent = unknown> {
173
+ private readonly taskId;
174
+ private readonly chatId;
175
+ private readonly streamTimeoutSeconds;
176
+ private readonly clientData;
177
+ private readonly triggerConfigDefault;
178
+ private readonly onTriggered;
179
+ private readonly onTurnComplete;
180
+ private readonly baseURLResolver;
181
+ private readonly fetchOverride;
182
+ private state;
183
+ constructor(options: AgentChatOptions<TAgent>);
184
+ /** The conversation ID. */
185
+ get id(): string;
186
+ /** Persistable session state — pass back via `options.session` to resume. */
187
+ get session(): ChatSession;
188
+ /**
189
+ * Eagerly start the session — creates the row and triggers the first
190
+ * run. The agent's `onPreload` hook fires immediately. Idempotent: a
191
+ * second call is a no-op.
192
+ */
193
+ preload(options?: {
194
+ idleTimeoutInSeconds?: number;
195
+ }): Promise<ChatSession>;
196
+ /**
197
+ * Send a text message and get the response stream.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const stream = await chat.sendMessage("Review PR #1");
202
+ * const text = await stream.text();
203
+ * ```
204
+ */
205
+ sendMessage(text: string, options?: {
206
+ abortSignal?: AbortSignal;
207
+ }): Promise<ChatStream>;
208
+ /** Send raw UIMessage-like objects. Use `sendMessage()` for simple text. */
209
+ sendRaw(messages: UIMessage[] | Array<{
210
+ id: string;
211
+ role: string;
212
+ parts?: unknown[];
213
+ [key: string]: unknown;
214
+ }>, options?: {
215
+ trigger?: "submit-message" | "regenerate-message";
216
+ abortSignal?: AbortSignal;
217
+ }): Promise<ReadableStream<UIMessageChunk>>;
218
+ /** Send a steering message during an active stream. */
219
+ steer(text: string): Promise<boolean>;
220
+ /** Stop the current generation (agent stays alive for next turn). */
221
+ stop(): Promise<void>;
222
+ /**
223
+ * Hand over from a `chat.handover` route handler to a parked
224
+ * `handover-prepare` agent run. Wakes the run, which seeds its
225
+ * accumulators with `partialAssistantMessage` and continues from
226
+ * tool execution onward — the model call for step 1 is skipped.
227
+ *
228
+ * Used internally by `chat.handover`; not part of the customer
229
+ * surface.
230
+ */
231
+ sendHandover(args: {
232
+ partialAssistantMessage: ModelMessage[];
233
+ /**
234
+ * UI messageId from the customer's step-1 stream — propagated to
235
+ * the agent so its post-handover chunks merge into the same
236
+ * assistant message on the browser.
237
+ */
238
+ messageId?: string;
239
+ /**
240
+ * Whether the customer's step 1 is the final response (pure-text
241
+ * finish). When true, the agent runs hooks but skips the LLM
242
+ * call. When false, the agent runs `streamText` which executes
243
+ * pending tool-calls and continues from step 2.
244
+ */
245
+ isFinal: boolean;
246
+ }): Promise<void>;
247
+ /**
248
+ * Tell a parked `handover-prepare` agent run that the customer's
249
+ * first turn finished pure-text (no tool calls) — the run exits
250
+ * cleanly without making an LLM call.
251
+ *
252
+ * Used internally by `chat.handover`; not part of the customer
253
+ * surface.
254
+ */
255
+ sendHandoverSkip(): Promise<void>;
256
+ /**
257
+ * Send a custom action to the agent.
258
+ *
259
+ * Actions are not turns. They wake the agent, fire `hydrateMessages`
260
+ * (if configured) and `onAction` only — no `onTurnStart` /
261
+ * `prepareMessages` / `onBeforeTurnComplete` / `onTurnComplete`, no
262
+ * `run()` invocation.
263
+ *
264
+ * The action payload is validated against the agent's `actionSchema`
265
+ * on the backend. Use `chat.history.*` inside `onAction` to mutate
266
+ * state. To produce a model response from the action, return a
267
+ * `StreamTextResult` (or `string` / `UIMessage`) from `onAction` —
268
+ * the returned stream is auto-piped over this stream. When `onAction`
269
+ * returns `void`, the action is side-effect-only and the returned
270
+ * stream completes immediately with `trigger:turn-complete`.
271
+ *
272
+ * @returns A `ChatStream`. For void actions the stream completes
273
+ * immediately. For actions that return a model response, the stream
274
+ * carries the assistant chunks.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * const stream = await agentChat.sendAction({ type: "undo" });
279
+ * for await (const chunk of stream) {
280
+ * if (chunk.type === "text-delta") process.stdout.write(chunk.delta);
281
+ * }
282
+ * ```
283
+ */
284
+ sendAction(action: unknown, options?: {
285
+ abortSignal?: AbortSignal;
286
+ }): Promise<ChatStream>;
287
+ /** Close the conversation — agent exits its loop gracefully. */
288
+ close(): Promise<boolean>;
289
+ /** Reconnect to the response stream (e.g. after a disconnect). */
290
+ reconnect(abortSignal?: AbortSignal): Promise<ReadableStream<UIMessageChunk> | null>;
291
+ private resolveBaseURL;
292
+ private doFetch;
293
+ private appendInputChunk;
294
+ /**
295
+ * Idempotent: `sessions.start` upserts on `(env, externalId)`. Two
296
+ * concurrent AgentChat instances on the same chatId converge to the
297
+ * same session.
298
+ */
299
+ private ensureStarted;
300
+ private subscribeToSessionStream;
301
+ }