@trigger.dev/sdk 0.0.0-prerelease-20260325143642 → 0.0.0-prerelease-20260327224514
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/dist/commonjs/v3/ai.d.ts +224 -54
- package/dist/commonjs/v3/ai.js +430 -151
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/chat-react.d.ts +7 -6
- package/dist/commonjs/v3/chat-react.js +19 -6
- package/dist/commonjs/v3/chat-react.js.map +1 -1
- package/dist/commonjs/v3/chat.d.ts +46 -5
- package/dist/commonjs/v3/chat.js +202 -51
- package/dist/commonjs/v3/chat.js.map +1 -1
- package/dist/commonjs/v3/chat.test.js +315 -18
- package/dist/commonjs/v3/chat.test.js.map +1 -1
- package/dist/commonjs/v3/index.d.ts +2 -2
- package/dist/commonjs/v3/runs.d.ts +7 -0
- package/dist/commonjs/v3/runs.js +1 -0
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/v3/shared.d.ts +24 -2
- package/dist/commonjs/v3/shared.js +160 -1
- package/dist/commonjs/v3/shared.js.map +1 -1
- package/dist/commonjs/v3/tasks.d.ts +2 -1
- package/dist/commonjs/v3/tasks.js +1 -0
- package/dist/commonjs/v3/tasks.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +224 -54
- package/dist/esm/v3/ai.js +432 -153
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/chat-react.d.ts +7 -6
- package/dist/esm/v3/chat-react.js +21 -8
- package/dist/esm/v3/chat-react.js.map +1 -1
- package/dist/esm/v3/chat.d.ts +46 -5
- package/dist/esm/v3/chat.js +202 -51
- package/dist/esm/v3/chat.js.map +1 -1
- package/dist/esm/v3/chat.test.js +315 -18
- package/dist/esm/v3/chat.test.js.map +1 -1
- package/dist/esm/v3/index.d.ts +2 -2
- package/dist/esm/v3/runs.d.ts +7 -0
- package/dist/esm/v3/runs.js +1 -0
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/v3/shared.d.ts +24 -2
- package/dist/esm/v3/shared.js +159 -1
- package/dist/esm/v3/shared.js.map +1 -1
- package/dist/esm/v3/tasks.d.ts +2 -1
- package/dist/esm/v3/tasks.js +2 -1
- package/dist/esm/v3/tasks.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
package/dist/commonjs/v3/ai.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { AnyTask, Task, type inferSchemaIn, type inferSchemaOut, type TaskIdentifier, type TaskOptions, type TaskSchema, type TaskWithSchema } from "@trigger.dev/core/v3";
|
|
2
|
-
import type { ModelMessage, UIMessage, UIMessageChunk, UIMessageStreamOptions, LanguageModelUsage } from "ai";
|
|
3
|
-
import { Tool } from "ai";
|
|
1
|
+
import { AnyTask, Task, type inferSchemaIn, type inferSchemaOut, type TaskIdentifier, type TaskOptions, type TaskSchema, type TaskRunContext, type TaskWithSchema } from "@trigger.dev/core/v3";
|
|
2
|
+
import type { ModelMessage, ToolSet, UIMessage, UIMessageChunk, UIMessageStreamOptions, LanguageModelUsage } from "ai";
|
|
3
|
+
import { Tool, ToolCallOptions } from "ai";
|
|
4
4
|
import { locals } from "./locals.js";
|
|
5
5
|
import type { ResolvedPrompt } from "./prompt.js";
|
|
6
|
+
/** Re-export for typing `ctx` in `chat.task` hooks without importing `@trigger.dev/core`. */
|
|
7
|
+
export type { TaskRunContext } from "@trigger.dev/core/v3";
|
|
6
8
|
import { CHAT_MESSAGES_STREAM_ID, CHAT_STOP_STREAM_ID } from "./chat-constants.js";
|
|
7
9
|
export type ToolCallExecutionOptions = {
|
|
8
10
|
toolCallId: string;
|
|
@@ -31,16 +33,46 @@ type ToolResultContent = Array<{
|
|
|
31
33
|
export type ToolOptions<TResult> = {
|
|
32
34
|
experimental_toToolResultContent?: (result: TResult) => ToolResultContent;
|
|
33
35
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
/** Satisfies AI SDK `ToolSet` index signature alongside concrete `Tool` input/output types. */
|
|
37
|
+
type ToolSetCompatible<T extends Tool<any, any>> = T & NonNullable<ToolSet[string]>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns an `execute` function for the AI SDK `tool()` helper (or any compatible tool definition).
|
|
40
|
+
* Preferred API for task-backed tools: the same Trigger wiring as the deprecated `ai.tool()`
|
|
41
|
+
* (`triggerAndSubscribe`, tool-call metadata, chat context, `chat.local` serialization) without
|
|
42
|
+
* building the tool object. You supply `description`, `inputSchema`, and any AI-SDK-only options
|
|
43
|
+
* (e.g. `experimental_toToolResultContent`) on `tool()` yourself.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { tool } from "ai";
|
|
48
|
+
* import { z } from "zod";
|
|
49
|
+
* import { ai } from "@trigger.dev/sdk/ai";
|
|
50
|
+
* import { myTask } from "./trigger/myTask";
|
|
51
|
+
*
|
|
52
|
+
* export const myTool = tool({
|
|
53
|
+
* description: myTask.description ?? "",
|
|
54
|
+
* inputSchema: z.object({ id: z.string() }),
|
|
55
|
+
* execute: ai.toolExecute(myTask),
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function toolExecute<TIdentifier extends string, TInput = void, TOutput = unknown>(task: Task<TIdentifier, TInput, TOutput>): (input: TInput, toolOpts: ToolCallOptions) => Promise<TOutput>;
|
|
60
|
+
declare function toolExecute<TIdentifier extends string, TTaskSchema extends TaskSchema | undefined = undefined, TOutput = unknown>(task: TaskWithSchema<TIdentifier, TTaskSchema, TOutput>): (input: inferSchemaIn<TTaskSchema>, toolOpts: ToolCallOptions) => Promise<TOutput>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use `tool()` from the `ai` package with `execute: ai.toolExecute(task)` instead.
|
|
63
|
+
* This helper may be removed in a future major release.
|
|
64
|
+
*/
|
|
65
|
+
declare function toolFromTask<TIdentifier extends string, TInput = void, TOutput = unknown>(task: Task<TIdentifier, TInput, TOutput>, options?: ToolOptions<TOutput>): ToolSetCompatible<Tool<TInput, TOutput>>;
|
|
66
|
+
/** @deprecated Use `tool()` from `ai` with `execute: ai.toolExecute(task)`. */
|
|
67
|
+
declare function toolFromTask<TIdentifier extends string, TTaskSchema extends TaskSchema | undefined = undefined, TOutput = unknown>(task: TaskWithSchema<TIdentifier, TTaskSchema, TOutput>, options?: ToolOptions<TOutput>): ToolSetCompatible<Tool<inferSchemaIn<TTaskSchema>, TOutput>>;
|
|
36
68
|
declare function getToolOptionsFromMetadata(): ToolCallExecutionOptions | undefined;
|
|
37
69
|
/**
|
|
38
|
-
* Get the current tool call ID from inside a subtask invoked via `ai.tool()
|
|
70
|
+
* Get the current tool call ID from inside a subtask invoked via `ai.toolExecute()` (or legacy `ai.tool()`).
|
|
39
71
|
* Returns `undefined` if not running as a tool subtask.
|
|
40
72
|
*/
|
|
41
73
|
declare function getToolCallId(): string | undefined;
|
|
42
74
|
/**
|
|
43
|
-
* Get the chat context from inside a subtask invoked via `ai.tool()` within a `chat.task`.
|
|
75
|
+
* Get the chat context from inside a subtask invoked via `ai.toolExecute()` (or legacy `ai.tool()`) within a `chat.task`.
|
|
44
76
|
* Pass `typeof yourChatTask` as the type parameter to get typed `clientData`.
|
|
45
77
|
* Returns `undefined` if the parent is not a chat task.
|
|
46
78
|
*
|
|
@@ -63,9 +95,17 @@ declare function getToolChatContext<TChatTask extends AnyTask = AnyTask>(): Chat
|
|
|
63
95
|
*/
|
|
64
96
|
declare function getToolChatContextOrThrow<TChatTask extends AnyTask = AnyTask>(): ChatTurnContext<InferChatClientData<TChatTask>>;
|
|
65
97
|
export declare const ai: {
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Use `tool()` from the `ai` package with `execute: ai.toolExecute(task)` instead.
|
|
100
|
+
*/
|
|
66
101
|
tool: typeof toolFromTask;
|
|
102
|
+
/**
|
|
103
|
+
* Preferred: return value for the `execute` field of AI SDK `tool()`. Keeps Trigger subtask and
|
|
104
|
+
* metadata behavior without coupling to a specific `ai` version’s `Tool` / `ToolSet` types.
|
|
105
|
+
*/
|
|
106
|
+
toolExecute: typeof toolExecute;
|
|
67
107
|
currentToolOptions: typeof getToolOptionsFromMetadata;
|
|
68
|
-
/** Get the tool call ID from inside a subtask invoked via `ai.tool()
|
|
108
|
+
/** Get the tool call ID from inside a subtask invoked via `ai.toolExecute()` (or legacy `ai.tool()`). */
|
|
69
109
|
toolCallId: typeof getToolCallId;
|
|
70
110
|
/** Get chat context (chatId, turn, clientData, etc.) from inside a subtask of a `chat.task`. Returns undefined if not in a chat context. */
|
|
71
111
|
chatContext: typeof getToolChatContext;
|
|
@@ -97,6 +137,31 @@ declare function createChatAccessToken<TTask extends AnyTask>(taskId: TaskIdenti
|
|
|
97
137
|
*/
|
|
98
138
|
export declare const CHAT_STREAM_KEY = "chat";
|
|
99
139
|
export { CHAT_MESSAGES_STREAM_ID, CHAT_STOP_STREAM_ID };
|
|
140
|
+
/**
|
|
141
|
+
* A stream writer passed to chat lifecycle callbacks (`onPreload`, `onChatStart`,
|
|
142
|
+
* `onTurnStart`, `onTurnComplete`, `onCompacted`).
|
|
143
|
+
*
|
|
144
|
+
* Write custom `UIMessageChunk` parts (e.g. `data-*` parts) directly to the chat
|
|
145
|
+
* stream without the ceremony of `chat.stream.writer({ execute })`.
|
|
146
|
+
*
|
|
147
|
+
* The writer is lazy — no stream overhead if you don't call `write()` or `merge()`.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* onTurnStart: async ({ writer }) => {
|
|
152
|
+
* writer.write({ type: "data-status", data: { loading: true } });
|
|
153
|
+
* },
|
|
154
|
+
* onTurnComplete: async ({ writer, uiMessages }) => {
|
|
155
|
+
* writer.write({ type: "data-analytics", data: { messageCount: uiMessages.length } });
|
|
156
|
+
* },
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export type ChatWriter = {
|
|
160
|
+
/** Write a single UIMessageChunk to the chat stream. */
|
|
161
|
+
write(part: UIMessageChunk): void;
|
|
162
|
+
/** Merge another stream's chunks into the chat stream. */
|
|
163
|
+
merge(stream: ReadableStream<UIMessageChunk>): void;
|
|
164
|
+
};
|
|
100
165
|
/**
|
|
101
166
|
* The wire payload shape sent by `TriggerChatTransport`.
|
|
102
167
|
* Uses `metadata` to match the AI SDK's `ChatRequestOptions` field name.
|
|
@@ -163,6 +228,11 @@ export type ChatTaskSignals = {
|
|
|
163
228
|
* Extends `ChatTaskPayload` (the wire payload) with abort signals.
|
|
164
229
|
*/
|
|
165
230
|
export type ChatTaskRunPayload<TClientData = unknown> = ChatTaskPayload<TClientData> & ChatTaskSignals & {
|
|
231
|
+
/**
|
|
232
|
+
* Task run context — same object as the `ctx` passed to a standard `task({ run })` handler’s second argument.
|
|
233
|
+
* Use for tags, metadata, parent run links, or any API that needs the full run record.
|
|
234
|
+
*/
|
|
235
|
+
ctx: TaskRunContext;
|
|
166
236
|
/** Token usage from the previous turn. Undefined on turn 0. */
|
|
167
237
|
previousTurnUsage?: LanguageModelUsage;
|
|
168
238
|
/** Cumulative token usage across all completed turns so far. */
|
|
@@ -177,7 +247,7 @@ export type ChatTurnUsage = LanguageModelUsage;
|
|
|
177
247
|
* `onTurnComplete` to compact before the next turn. Takes `UIMessage[]`
|
|
178
248
|
* and converts to `ModelMessage[]` internally.
|
|
179
249
|
*/
|
|
180
|
-
declare function setChatMessages(uiMessages:
|
|
250
|
+
declare function setChatMessages<TUIM extends UIMessage = UIMessage>(uiMessages: TUIM[]): void;
|
|
181
251
|
/** State stored in locals during prepareStep compaction. */
|
|
182
252
|
interface CompactionState {
|
|
183
253
|
summary: string;
|
|
@@ -211,11 +281,11 @@ export type SummarizeEvent = {
|
|
|
211
281
|
/**
|
|
212
282
|
* Event passed to `compactUIMessages` and `compactModelMessages` callbacks.
|
|
213
283
|
*/
|
|
214
|
-
export type CompactMessagesEvent = {
|
|
284
|
+
export type CompactMessagesEvent<TUIM extends UIMessage = UIMessage> = {
|
|
215
285
|
/** The generated summary text. */
|
|
216
286
|
summary: string;
|
|
217
287
|
/** The current UI messages (full conversation). */
|
|
218
|
-
uiMessages:
|
|
288
|
+
uiMessages: TUIM[];
|
|
219
289
|
/** The current model messages (full conversation). */
|
|
220
290
|
modelMessages: ModelMessage[];
|
|
221
291
|
/** The chat session ID. */
|
|
@@ -238,7 +308,7 @@ export type CompactMessagesEvent = {
|
|
|
238
308
|
* tool-call steps) and the outer loop (between turns, for single-step responses
|
|
239
309
|
* where prepareStep never fires).
|
|
240
310
|
*/
|
|
241
|
-
export type ChatTaskCompactionOptions = {
|
|
311
|
+
export type ChatTaskCompactionOptions<TUIM extends UIMessage = UIMessage> = {
|
|
242
312
|
/** Decide whether to compact. Return true to trigger compaction. */
|
|
243
313
|
shouldCompact: (event: ShouldCompactEvent) => boolean | Promise<boolean>;
|
|
244
314
|
/** Generate a summary from the current messages. Return the summary text. */
|
|
@@ -263,7 +333,7 @@ export type ChatTaskCompactionOptions = {
|
|
|
263
333
|
* ],
|
|
264
334
|
* ```
|
|
265
335
|
*/
|
|
266
|
-
compactUIMessages?: (event: CompactMessagesEvent) =>
|
|
336
|
+
compactUIMessages?: (event: CompactMessagesEvent<TUIM>) => TUIM[] | Promise<TUIM[]>;
|
|
267
337
|
/**
|
|
268
338
|
* Transform model messages after compaction (what gets sent to the LLM).
|
|
269
339
|
* Default: replace all with a single summary message.
|
|
@@ -277,14 +347,14 @@ export type ChatTaskCompactionOptions = {
|
|
|
277
347
|
* ],
|
|
278
348
|
* ```
|
|
279
349
|
*/
|
|
280
|
-
compactModelMessages?: (event: CompactMessagesEvent) => ModelMessage[] | Promise<ModelMessage[]>;
|
|
350
|
+
compactModelMessages?: (event: CompactMessagesEvent<TUIM>) => ModelMessage[] | Promise<ModelMessage[]>;
|
|
281
351
|
};
|
|
282
352
|
/**
|
|
283
353
|
* Event passed to `shouldInject` and `prepareMessages` callbacks.
|
|
284
354
|
*/
|
|
285
|
-
export type PendingMessagesBatchEvent = {
|
|
355
|
+
export type PendingMessagesBatchEvent<TUIM extends UIMessage = UIMessage> = {
|
|
286
356
|
/** All pending UI messages that arrived during streaming (batch). */
|
|
287
|
-
messages:
|
|
357
|
+
messages: TUIM[];
|
|
288
358
|
/** Current model messages in the conversation. */
|
|
289
359
|
modelMessages: ModelMessage[];
|
|
290
360
|
/** Completed steps so far. */
|
|
@@ -301,9 +371,9 @@ export type PendingMessagesBatchEvent = {
|
|
|
301
371
|
/**
|
|
302
372
|
* Event passed to `onReceived` callback (per-message, as they arrive).
|
|
303
373
|
*/
|
|
304
|
-
export type PendingMessageReceivedEvent = {
|
|
374
|
+
export type PendingMessageReceivedEvent<TUIM extends UIMessage = UIMessage> = {
|
|
305
375
|
/** The UI message that arrived during streaming. */
|
|
306
|
-
message:
|
|
376
|
+
message: TUIM;
|
|
307
377
|
/** Chat session ID. */
|
|
308
378
|
chatId: string;
|
|
309
379
|
/** Current turn number (0-indexed). */
|
|
@@ -312,9 +382,9 @@ export type PendingMessageReceivedEvent = {
|
|
|
312
382
|
/**
|
|
313
383
|
* Event passed to `onInjected` callback (batch, after injection).
|
|
314
384
|
*/
|
|
315
|
-
export type PendingMessagesInjectedEvent = {
|
|
385
|
+
export type PendingMessagesInjectedEvent<TUIM extends UIMessage = UIMessage> = {
|
|
316
386
|
/** All UI messages that were injected. */
|
|
317
|
-
messages:
|
|
387
|
+
messages: TUIM[];
|
|
318
388
|
/** The model messages that were injected. */
|
|
319
389
|
injectedModelMessages: ModelMessage[];
|
|
320
390
|
/** Chat session ID. */
|
|
@@ -333,23 +403,23 @@ export type PendingMessagesInjectedEvent = {
|
|
|
333
403
|
* messages is injected between tool-call steps via `prepareStep`.
|
|
334
404
|
* Otherwise, messages queue for the next turn.
|
|
335
405
|
*/
|
|
336
|
-
export type PendingMessagesOptions = {
|
|
406
|
+
export type PendingMessagesOptions<TUIM extends UIMessage = UIMessage> = {
|
|
337
407
|
/**
|
|
338
408
|
* Decide whether to inject pending messages between tool-call steps.
|
|
339
409
|
* Called once per step boundary with the full batch of pending messages.
|
|
340
410
|
* If absent, no injection happens — messages only queue for the next turn.
|
|
341
411
|
*/
|
|
342
|
-
shouldInject?: (event: PendingMessagesBatchEvent) => boolean | Promise<boolean>;
|
|
412
|
+
shouldInject?: (event: PendingMessagesBatchEvent<TUIM>) => boolean | Promise<boolean>;
|
|
343
413
|
/**
|
|
344
414
|
* Transform the batch of pending messages before injection.
|
|
345
415
|
* Return the model messages to inject.
|
|
346
416
|
* Default: convert each UI message via `convertToModelMessages`.
|
|
347
417
|
*/
|
|
348
|
-
prepare?: (event: PendingMessagesBatchEvent) => ModelMessage[] | Promise<ModelMessage[]>;
|
|
418
|
+
prepare?: (event: PendingMessagesBatchEvent<TUIM>) => ModelMessage[] | Promise<ModelMessage[]>;
|
|
349
419
|
/** Called when a message arrives during streaming (per-message). */
|
|
350
|
-
onReceived?: (event: PendingMessageReceivedEvent) => void | Promise<void>;
|
|
420
|
+
onReceived?: (event: PendingMessageReceivedEvent<TUIM>) => void | Promise<void>;
|
|
351
421
|
/** Called after a batch of messages is injected via `prepareStep`. */
|
|
352
|
-
onInjected?: (event: PendingMessagesInjectedEvent) => void | Promise<void>;
|
|
422
|
+
onInjected?: (event: PendingMessagesInjectedEvent<TUIM>) => void | Promise<void>;
|
|
353
423
|
};
|
|
354
424
|
/**
|
|
355
425
|
* The data part type used to signal that pending messages were injected
|
|
@@ -384,6 +454,8 @@ export type CompactionChunkData = {
|
|
|
384
454
|
* Event passed to the `onCompacted` callback.
|
|
385
455
|
*/
|
|
386
456
|
export type CompactedEvent = {
|
|
457
|
+
/** Task run context — same as `task` lifecycle hooks and `chat.task` `run({ ctx })`. */
|
|
458
|
+
ctx: TaskRunContext;
|
|
387
459
|
/** The generated summary text. */
|
|
388
460
|
summary: string;
|
|
389
461
|
/** The messages that were compacted (pre-compaction). */
|
|
@@ -404,6 +476,8 @@ export type CompactedEvent = {
|
|
|
404
476
|
chatId?: string;
|
|
405
477
|
/** The current turn number (if running inside a chat.task). */
|
|
406
478
|
turn?: number;
|
|
479
|
+
/** Stream writer — write custom `UIMessageChunk` parts to the chat stream. Lazy: no overhead if unused. */
|
|
480
|
+
writer: ChatWriter;
|
|
407
481
|
};
|
|
408
482
|
/**
|
|
409
483
|
* Event passed to `shouldCompact` callbacks.
|
|
@@ -654,7 +728,7 @@ export type PipeChatOptions = {
|
|
|
654
728
|
* Use `streamText`'s `onFinish` for custom finish handling, or drop down to
|
|
655
729
|
* raw task mode with `chat.pipe()` for full control.
|
|
656
730
|
*/
|
|
657
|
-
export type ChatUIMessageStreamOptions = Omit<UIMessageStreamOptions<
|
|
731
|
+
export type ChatUIMessageStreamOptions<TUIM extends UIMessage = UIMessage> = Omit<UIMessageStreamOptions<TUIM>, "onFinish" | "originalMessages" | "generateMessageId">;
|
|
658
732
|
/**
|
|
659
733
|
* An object with a `toUIMessageStream()` method (e.g. `StreamTextResult` from `streamText()`).
|
|
660
734
|
*/
|
|
@@ -719,6 +793,8 @@ declare function pipeChat(source: UIMessageStreamable | AsyncIterable<unknown> |
|
|
|
719
793
|
* Event passed to the `onPreload` callback.
|
|
720
794
|
*/
|
|
721
795
|
export type PreloadEvent<TClientData = unknown> = {
|
|
796
|
+
/** Task run context — same as `task({ run })` second-argument `ctx`. */
|
|
797
|
+
ctx: TaskRunContext;
|
|
722
798
|
/** The unique identifier for the chat session. */
|
|
723
799
|
chatId: string;
|
|
724
800
|
/** The Trigger.dev run ID for this conversation. */
|
|
@@ -727,11 +803,15 @@ export type PreloadEvent<TClientData = unknown> = {
|
|
|
727
803
|
chatAccessToken: string;
|
|
728
804
|
/** Custom data from the frontend. */
|
|
729
805
|
clientData?: TClientData;
|
|
806
|
+
/** Stream writer — write custom `UIMessageChunk` parts to the chat stream. Lazy: no overhead if unused. */
|
|
807
|
+
writer: ChatWriter;
|
|
730
808
|
};
|
|
731
809
|
/**
|
|
732
810
|
* Event passed to the `onChatStart` callback.
|
|
733
811
|
*/
|
|
734
812
|
export type ChatStartEvent<TClientData = unknown> = {
|
|
813
|
+
/** Task run context — same as `task({ run })` second-argument `ctx`. */
|
|
814
|
+
ctx: TaskRunContext;
|
|
735
815
|
/** The unique identifier for the chat session. */
|
|
736
816
|
chatId: string;
|
|
737
817
|
/** The initial model-ready messages for this conversation. */
|
|
@@ -748,17 +828,21 @@ export type ChatStartEvent<TClientData = unknown> = {
|
|
|
748
828
|
previousRunId?: string;
|
|
749
829
|
/** Whether this run was preloaded before the first message. */
|
|
750
830
|
preloaded: boolean;
|
|
831
|
+
/** Stream writer — write custom `UIMessageChunk` parts to the chat stream. Lazy: no overhead if unused. */
|
|
832
|
+
writer: ChatWriter;
|
|
751
833
|
};
|
|
752
834
|
/**
|
|
753
835
|
* Event passed to the `onTurnStart` callback.
|
|
754
836
|
*/
|
|
755
|
-
export type TurnStartEvent<TClientData = unknown> = {
|
|
837
|
+
export type TurnStartEvent<TClientData = unknown, TUIM extends UIMessage = UIMessage> = {
|
|
838
|
+
/** Task run context — same as `task({ run })` second-argument `ctx`. */
|
|
839
|
+
ctx: TaskRunContext;
|
|
756
840
|
/** The unique identifier for the chat session. */
|
|
757
841
|
chatId: string;
|
|
758
842
|
/** The accumulated model-ready messages (all turns so far, including new user message). */
|
|
759
843
|
messages: ModelMessage[];
|
|
760
844
|
/** The accumulated UI messages (all turns so far, including new user message). */
|
|
761
|
-
uiMessages:
|
|
845
|
+
uiMessages: TUIM[];
|
|
762
846
|
/** The turn number (0-indexed). */
|
|
763
847
|
turn: number;
|
|
764
848
|
/** The Trigger.dev run ID for this conversation. */
|
|
@@ -777,11 +861,15 @@ export type TurnStartEvent<TClientData = unknown> = {
|
|
|
777
861
|
previousTurnUsage?: LanguageModelUsage;
|
|
778
862
|
/** Cumulative token usage across all completed turns so far. */
|
|
779
863
|
totalUsage: LanguageModelUsage;
|
|
864
|
+
/** Stream writer — write custom `UIMessageChunk` parts to the chat stream. Lazy: no overhead if unused. */
|
|
865
|
+
writer: ChatWriter;
|
|
780
866
|
};
|
|
781
867
|
/**
|
|
782
868
|
* Event passed to the `onTurnComplete` callback.
|
|
783
869
|
*/
|
|
784
|
-
export type TurnCompleteEvent<TClientData = unknown> = {
|
|
870
|
+
export type TurnCompleteEvent<TClientData = unknown, TUIM extends UIMessage = UIMessage> = {
|
|
871
|
+
/** Task run context — same as `task({ run })` second-argument `ctx`. */
|
|
872
|
+
ctx: TaskRunContext;
|
|
785
873
|
/** The unique identifier for the chat session. */
|
|
786
874
|
chatId: string;
|
|
787
875
|
/** The full accumulated conversation in model format (all turns so far). */
|
|
@@ -790,7 +878,7 @@ export type TurnCompleteEvent<TClientData = unknown> = {
|
|
|
790
878
|
* The full accumulated conversation in UI format (all turns so far).
|
|
791
879
|
* This is the format expected by `useChat` — store this for persistence.
|
|
792
880
|
*/
|
|
793
|
-
uiMessages:
|
|
881
|
+
uiMessages: TUIM[];
|
|
794
882
|
/**
|
|
795
883
|
* Only the new model messages from this turn (user message(s) + assistant response).
|
|
796
884
|
* Useful for appending to an existing conversation record.
|
|
@@ -800,15 +888,15 @@ export type TurnCompleteEvent<TClientData = unknown> = {
|
|
|
800
888
|
* Only the new UI messages from this turn (user message(s) + assistant response).
|
|
801
889
|
* Useful for inserting individual message records instead of overwriting the full history.
|
|
802
890
|
*/
|
|
803
|
-
newUIMessages:
|
|
891
|
+
newUIMessages: TUIM[];
|
|
804
892
|
/** The assistant's response for this turn, with aborted parts cleaned up when `stopped` is true. Undefined if `pipeChat` was used manually. */
|
|
805
|
-
responseMessage:
|
|
893
|
+
responseMessage: TUIM | undefined;
|
|
806
894
|
/**
|
|
807
895
|
* The raw assistant response before abort cleanup. Includes incomplete tool parts
|
|
808
896
|
* (`input-available`, `partial-call`) and streaming reasoning/text parts.
|
|
809
897
|
* Use this if you need custom cleanup logic. Same as `responseMessage` when not stopped.
|
|
810
898
|
*/
|
|
811
|
-
rawResponseMessage:
|
|
899
|
+
rawResponseMessage: TUIM | undefined;
|
|
812
900
|
/** The turn number (0-indexed). */
|
|
813
901
|
turn: number;
|
|
814
902
|
/** The Trigger.dev run ID for this conversation. */
|
|
@@ -832,7 +920,15 @@ export type TurnCompleteEvent<TClientData = unknown> = {
|
|
|
832
920
|
/** Cumulative token usage across all turns in this run (including this turn). */
|
|
833
921
|
totalUsage: LanguageModelUsage;
|
|
834
922
|
};
|
|
835
|
-
|
|
923
|
+
/**
|
|
924
|
+
* Event passed to the `onBeforeTurnComplete` callback.
|
|
925
|
+
* Same as `TurnCompleteEvent` but includes a `writer` since the stream is still open.
|
|
926
|
+
*/
|
|
927
|
+
export type BeforeTurnCompleteEvent<TClientData = unknown, TUIM extends UIMessage = UIMessage> = TurnCompleteEvent<TClientData, TUIM> & {
|
|
928
|
+
/** Stream writer — write custom `UIMessageChunk` parts to the chat stream. Lazy: no overhead if unused. */
|
|
929
|
+
writer: ChatWriter;
|
|
930
|
+
};
|
|
931
|
+
export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extends TaskSchema | undefined = undefined, TUIMessage extends UIMessage = UIMessage> = Omit<TaskOptions<TIdentifier, ChatTaskWirePayload<TUIMessage, inferSchemaIn<TClientDataSchema>>, unknown>, "run"> & {
|
|
836
932
|
/**
|
|
837
933
|
* Schema for validating `clientData` from the frontend.
|
|
838
934
|
* Accepts Zod, ArkType, Valibot, or any supported schema library.
|
|
@@ -845,8 +941,9 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
845
941
|
* chat.task({
|
|
846
942
|
* id: "my-chat",
|
|
847
943
|
* clientDataSchema: z.object({ model: z.string().optional(), userId: z.string() }),
|
|
848
|
-
* run: async ({ messages, clientData, signal }) => {
|
|
944
|
+
* run: async ({ messages, clientData, ctx, signal }) => {
|
|
849
945
|
* // clientData is typed as { model?: string; userId: string }
|
|
946
|
+
* // ctx is the same TaskRunContext as in task({ run: (payload, { ctx }) => ... })
|
|
850
947
|
* },
|
|
851
948
|
* });
|
|
852
949
|
* ```
|
|
@@ -856,7 +953,8 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
856
953
|
* The run function for the chat task.
|
|
857
954
|
*
|
|
858
955
|
* Receives a `ChatTaskRunPayload` with the conversation messages, chat session ID,
|
|
859
|
-
* trigger type,
|
|
956
|
+
* trigger type, task `ctx` (same as `task({ run })`’s second argument), and abort signals
|
|
957
|
+
* (`signal`, `cancelSignal`, `stopSignal`).
|
|
860
958
|
*
|
|
861
959
|
* **Auto-piping:** If this function returns a value with `.toUIMessageStream()`,
|
|
862
960
|
* the stream is automatically piped to the frontend.
|
|
@@ -870,7 +968,7 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
870
968
|
*
|
|
871
969
|
* @example
|
|
872
970
|
* ```ts
|
|
873
|
-
* onPreload: async ({ chatId, clientData }) => {
|
|
971
|
+
* onPreload: async ({ ctx, chatId, clientData }) => {
|
|
874
972
|
* await db.chat.create({ data: { id: chatId } });
|
|
875
973
|
* userContext.init(await loadUser(clientData.userId));
|
|
876
974
|
* }
|
|
@@ -884,7 +982,7 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
884
982
|
*
|
|
885
983
|
* @example
|
|
886
984
|
* ```ts
|
|
887
|
-
* onChatStart: async ({ chatId, messages, clientData }) => {
|
|
985
|
+
* onChatStart: async ({ ctx, chatId, messages, clientData }) => {
|
|
888
986
|
* await db.chat.create({ data: { id: chatId, userId: clientData.userId } });
|
|
889
987
|
* }
|
|
890
988
|
* ```
|
|
@@ -899,12 +997,12 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
899
997
|
*
|
|
900
998
|
* @example
|
|
901
999
|
* ```ts
|
|
902
|
-
* onTurnStart: async ({ chatId, uiMessages }) => {
|
|
1000
|
+
* onTurnStart: async ({ ctx, chatId, uiMessages }) => {
|
|
903
1001
|
* await db.chat.update({ where: { id: chatId }, data: { messages: uiMessages } });
|
|
904
1002
|
* }
|
|
905
1003
|
* ```
|
|
906
1004
|
*/
|
|
907
|
-
onTurnStart?: (event: TurnStartEvent<inferSchemaOut<TClientDataSchema
|
|
1005
|
+
onTurnStart?: (event: TurnStartEvent<inferSchemaOut<TClientDataSchema>, TUIMessage>) => Promise<void> | void;
|
|
908
1006
|
/**
|
|
909
1007
|
* Called after the response is captured but before the stream closes.
|
|
910
1008
|
* The stream is still open, so you can write custom chunks to the frontend
|
|
@@ -913,24 +1011,24 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
913
1011
|
*
|
|
914
1012
|
* @example
|
|
915
1013
|
* ```ts
|
|
916
|
-
* onBeforeTurnComplete: async ({
|
|
1014
|
+
* onBeforeTurnComplete: async ({ ctx, writer, usage }) => {
|
|
917
1015
|
* if (usage?.inputTokens && usage.inputTokens > 5000) {
|
|
918
|
-
*
|
|
1016
|
+
* writer.write({ type: "data-compaction", id: generateId(), data: { status: "compacting" } });
|
|
919
1017
|
* // ... compact messages ...
|
|
920
1018
|
* chat.setMessages(compactedMessages);
|
|
921
|
-
*
|
|
1019
|
+
* writer.write({ type: "data-compaction", id: generateId(), data: { status: "complete" } });
|
|
922
1020
|
* }
|
|
923
1021
|
* }
|
|
924
1022
|
* ```
|
|
925
1023
|
*/
|
|
926
|
-
onBeforeTurnComplete?: (event:
|
|
1024
|
+
onBeforeTurnComplete?: (event: BeforeTurnCompleteEvent<inferSchemaOut<TClientDataSchema>, TUIMessage>) => Promise<void> | void;
|
|
927
1025
|
/**
|
|
928
1026
|
* Called when conversation compaction occurs (via `chat.compact()` or
|
|
929
1027
|
* `chat.compactionStep()`). Use for logging, billing, or persisting the summary.
|
|
930
1028
|
*
|
|
931
1029
|
* @example
|
|
932
1030
|
* ```ts
|
|
933
|
-
* onCompacted: async ({ summary, totalTokens, chatId }) => {
|
|
1031
|
+
* onCompacted: async ({ ctx, summary, totalTokens, chatId }) => {
|
|
934
1032
|
* logger.info("Compacted", { totalTokens, chatId });
|
|
935
1033
|
* await db.compactionLog.create({ data: { chatId, summary } });
|
|
936
1034
|
* }
|
|
@@ -964,7 +1062,7 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
964
1062
|
* });
|
|
965
1063
|
* ```
|
|
966
1064
|
*/
|
|
967
|
-
compaction?: ChatTaskCompactionOptions
|
|
1065
|
+
compaction?: ChatTaskCompactionOptions<TUIMessage>;
|
|
968
1066
|
/**
|
|
969
1067
|
* Configure how messages that arrive during streaming are handled.
|
|
970
1068
|
*
|
|
@@ -980,18 +1078,19 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
980
1078
|
* },
|
|
981
1079
|
* ```
|
|
982
1080
|
*/
|
|
983
|
-
pendingMessages?: PendingMessagesOptions
|
|
1081
|
+
pendingMessages?: PendingMessagesOptions<TUIMessage>;
|
|
984
1082
|
/**
|
|
1083
|
+
* Called after each assistant response completes. Use to persist the
|
|
985
1084
|
* conversation to your database after each assistant response.
|
|
986
1085
|
*
|
|
987
1086
|
* @example
|
|
988
1087
|
* ```ts
|
|
989
|
-
* onTurnComplete: async ({ chatId, messages }) => {
|
|
1088
|
+
* onTurnComplete: async ({ ctx, chatId, messages }) => {
|
|
990
1089
|
* await db.chat.update({ where: { id: chatId }, data: { messages } });
|
|
991
1090
|
* }
|
|
992
1091
|
* ```
|
|
993
1092
|
*/
|
|
994
|
-
onTurnComplete?: (event: TurnCompleteEvent<inferSchemaOut<TClientDataSchema
|
|
1093
|
+
onTurnComplete?: (event: TurnCompleteEvent<inferSchemaOut<TClientDataSchema>, TUIMessage>) => Promise<void> | void;
|
|
995
1094
|
/**
|
|
996
1095
|
* Maximum number of conversational turns (message round-trips) a single run
|
|
997
1096
|
* will handle before ending. After this many turns the run completes
|
|
@@ -1094,7 +1193,7 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
1094
1193
|
* });
|
|
1095
1194
|
* ```
|
|
1096
1195
|
*/
|
|
1097
|
-
uiMessageStreamOptions?: ChatUIMessageStreamOptions
|
|
1196
|
+
uiMessageStreamOptions?: ChatUIMessageStreamOptions<TUIMessage>;
|
|
1098
1197
|
};
|
|
1099
1198
|
/**
|
|
1100
1199
|
* Creates a Trigger.dev task pre-configured for AI SDK chat.
|
|
@@ -1123,7 +1222,34 @@ export type ChatTaskOptions<TIdentifier extends string, TClientDataSchema extend
|
|
|
1123
1222
|
* });
|
|
1124
1223
|
* ```
|
|
1125
1224
|
*/
|
|
1126
|
-
declare function chatTask<TIdentifier extends string, TClientDataSchema extends TaskSchema | undefined = undefined>(options: ChatTaskOptions<TIdentifier, TClientDataSchema>): Task<TIdentifier, ChatTaskWirePayload<
|
|
1225
|
+
declare function chatTask<TIdentifier extends string, TClientDataSchema extends TaskSchema | undefined = undefined, TUIMessage extends UIMessage = UIMessage>(options: ChatTaskOptions<TIdentifier, TClientDataSchema, TUIMessage>): Task<TIdentifier, ChatTaskWirePayload<TUIMessage, inferSchemaIn<TClientDataSchema>>, unknown>;
|
|
1226
|
+
/**
|
|
1227
|
+
* Optional config for {@link chat.withUIMessage}. `streamOptions` become default
|
|
1228
|
+
* static `toUIMessageStream()` settings; inner `chat.task({ uiMessageStreamOptions })`
|
|
1229
|
+
* shallow-merges on top (task wins on conflicts).
|
|
1230
|
+
*/
|
|
1231
|
+
export type ChatWithUIMessageConfig<TUIM extends UIMessage = UIMessage> = {
|
|
1232
|
+
streamOptions?: ChatUIMessageStreamOptions<TUIM>;
|
|
1233
|
+
};
|
|
1234
|
+
/**
|
|
1235
|
+
* Fix the UI message type for a chat task (AI SDK `UIMessage` generics) while
|
|
1236
|
+
* keeping `id` and `clientDataSchema` inference on the inner {@link chat.task} call.
|
|
1237
|
+
*
|
|
1238
|
+
* @example
|
|
1239
|
+
* ```ts
|
|
1240
|
+
* type AgentUiMessage = UIMessage<unknown, UIDataTypes, UITools>;
|
|
1241
|
+
*
|
|
1242
|
+
* export const myChat = chat.withUIMessage<AgentUiMessage>({
|
|
1243
|
+
* streamOptions: { sendReasoning: true },
|
|
1244
|
+
* }).task({
|
|
1245
|
+
* id: "my-chat",
|
|
1246
|
+
* run: async ({ messages, signal }) => { ... },
|
|
1247
|
+
* });
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
declare function withUIMessage<TUIM extends UIMessage = UIMessage>(config?: ChatWithUIMessageConfig<TUIM>): {
|
|
1251
|
+
task: <TIdentifier extends string, TClientDataSchema extends TaskSchema | undefined = undefined>(options: ChatTaskOptions<TIdentifier, TClientDataSchema, TUIM>) => Task<TIdentifier, ChatTaskWirePayload<TUIM, inferSchemaIn<TClientDataSchema>>, unknown>;
|
|
1252
|
+
};
|
|
1127
1253
|
/**
|
|
1128
1254
|
* Override the turn timeout for subsequent turns in the current run.
|
|
1129
1255
|
*
|
|
@@ -1197,7 +1323,7 @@ declare function setIdleTimeoutInSeconds(seconds: number): void;
|
|
|
1197
1323
|
* }
|
|
1198
1324
|
* ```
|
|
1199
1325
|
*/
|
|
1200
|
-
declare function setUIMessageStreamOptions(options: ChatUIMessageStreamOptions): void;
|
|
1326
|
+
declare function setUIMessageStreamOptions(options: ChatUIMessageStreamOptions<UIMessage>): void;
|
|
1201
1327
|
/**
|
|
1202
1328
|
* Check whether the user stopped generation during the current turn.
|
|
1203
1329
|
*
|
|
@@ -1235,6 +1361,34 @@ declare function isStopped(): boolean;
|
|
|
1235
1361
|
* ```
|
|
1236
1362
|
*/
|
|
1237
1363
|
declare function chatDefer(promise: Promise<unknown>): void;
|
|
1364
|
+
/**
|
|
1365
|
+
* Queue model messages for injection at the next `prepareStep` boundary.
|
|
1366
|
+
*
|
|
1367
|
+
* Use this to inject context from background work into the agent's conversation.
|
|
1368
|
+
* Messages are appended to the model messages before the next LLM inference call.
|
|
1369
|
+
*
|
|
1370
|
+
* Combine with `chat.defer()` to run background analysis and inject results:
|
|
1371
|
+
*
|
|
1372
|
+
* @example
|
|
1373
|
+
* ```ts
|
|
1374
|
+
* onTurnComplete: async ({ messages }) => {
|
|
1375
|
+
* chat.defer((async () => {
|
|
1376
|
+
* const review = await generateObject({
|
|
1377
|
+
* model: openai("gpt-4o-mini"),
|
|
1378
|
+
* messages: [...messages, { role: "user", content: "Review the last response." }],
|
|
1379
|
+
* schema: z.object({ suggestions: z.array(z.string()) }),
|
|
1380
|
+
* });
|
|
1381
|
+
* if (review.object.suggestions.length > 0) {
|
|
1382
|
+
* chat.inject([{
|
|
1383
|
+
* role: "system",
|
|
1384
|
+
* content: `Improvements for next response:\n${review.object.suggestions.join("\n")}`,
|
|
1385
|
+
* }]);
|
|
1386
|
+
* }
|
|
1387
|
+
* })());
|
|
1388
|
+
* },
|
|
1389
|
+
* ```
|
|
1390
|
+
*/
|
|
1391
|
+
declare function injectBackgroundContext(messages: ModelMessage[]): void;
|
|
1238
1392
|
/**
|
|
1239
1393
|
* Clean up a UIMessage that was captured during an aborted/stopped turn.
|
|
1240
1394
|
*
|
|
@@ -1262,7 +1416,7 @@ declare function chatDefer(promise: Promise<unknown>): void;
|
|
|
1262
1416
|
* }
|
|
1263
1417
|
* ```
|
|
1264
1418
|
*/
|
|
1265
|
-
declare function cleanupAbortedParts(message:
|
|
1419
|
+
declare function cleanupAbortedParts<TUIM extends UIMessage>(message: TUIM): TUIM;
|
|
1266
1420
|
/**
|
|
1267
1421
|
* Create a managed stop signal wired to the chat stop input stream.
|
|
1268
1422
|
*
|
|
@@ -1528,7 +1682,7 @@ export type ChatLocal<T extends Record<string, unknown>> = T & {
|
|
|
1528
1682
|
*
|
|
1529
1683
|
* The `id` is required and must be unique across all `chat.local()` calls in
|
|
1530
1684
|
* your project. It's used to serialize values into subtask metadata so that
|
|
1531
|
-
* `ai.tool()` subtasks can auto-hydrate parent locals (read-only).
|
|
1685
|
+
* `ai.toolExecute()` (or legacy `ai.tool()`) subtasks can auto-hydrate parent locals (read-only).
|
|
1532
1686
|
*
|
|
1533
1687
|
* @example
|
|
1534
1688
|
* ```ts
|
|
@@ -1576,9 +1730,23 @@ declare function chatLocal<T extends Record<string, unknown>>(options: {
|
|
|
1576
1730
|
* ```
|
|
1577
1731
|
*/
|
|
1578
1732
|
export type InferChatClientData<TTask extends AnyTask> = TTask extends Task<string, ChatTaskWirePayload<any, infer TMetadata>, any> ? TMetadata : unknown;
|
|
1733
|
+
/**
|
|
1734
|
+
* Extracts the UI message type from a chat task (wire payload `messages` items).
|
|
1735
|
+
*
|
|
1736
|
+
* @example
|
|
1737
|
+
* ```ts
|
|
1738
|
+
* import type { InferChatUIMessage } from "@trigger.dev/sdk/ai";
|
|
1739
|
+
* import type { myChat } from "@/trigger/chat";
|
|
1740
|
+
*
|
|
1741
|
+
* type Msg = InferChatUIMessage<typeof myChat>;
|
|
1742
|
+
* ```
|
|
1743
|
+
*/
|
|
1744
|
+
export type InferChatUIMessage<TTask extends AnyTask> = TTask extends Task<string, ChatTaskWirePayload<infer TUIM extends UIMessage, any>, any> ? TUIM : UIMessage;
|
|
1579
1745
|
export declare const chat: {
|
|
1580
1746
|
/** Create a chat task. See {@link chatTask}. */
|
|
1581
1747
|
task: typeof chatTask;
|
|
1748
|
+
/** Create a chat task with a fixed {@link UIMessage} subtype and optional default stream options. See {@link withUIMessage}. */
|
|
1749
|
+
withUIMessage: typeof withUIMessage;
|
|
1582
1750
|
/** Pipe a stream to the chat transport. See {@link pipeChat}. */
|
|
1583
1751
|
pipe: typeof pipeChat;
|
|
1584
1752
|
/** Create a per-run typed local. See {@link chatLocal}. */
|
|
@@ -1599,6 +1767,8 @@ export declare const chat: {
|
|
|
1599
1767
|
cleanupAbortedParts: typeof cleanupAbortedParts;
|
|
1600
1768
|
/** Register background work that runs in parallel with streaming. See {@link chatDefer}. */
|
|
1601
1769
|
defer: typeof chatDefer;
|
|
1770
|
+
/** Queue model messages for injection at the next `prepareStep` boundary. See {@link injectBackgroundContext}. */
|
|
1771
|
+
inject: typeof injectBackgroundContext;
|
|
1602
1772
|
/** Typed chat output stream for writing custom chunks or piping from subtasks. */
|
|
1603
1773
|
stream: import("@trigger.dev/core/v3").RealtimeDefinedStream<UIMessageChunk>;
|
|
1604
1774
|
/** Pre-built input stream for receiving messages from the transport. */
|