ai 6.0.295 → 6.0.297

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 (42) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/index.d.mts +42 -11
  3. package/dist/index.d.ts +42 -11
  4. package/dist/index.js +210 -43
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +210 -43
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/internal/index.js +1 -1
  9. package/dist/internal/index.mjs +1 -1
  10. package/docs/04-ai-sdk-ui/02-chatbot.mdx +10 -1
  11. package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +8 -0
  12. package/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +10 -3
  13. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +10 -1
  14. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +1 -1
  15. package/docs/07-reference/01-ai-sdk-core/17-create-agent-ui-stream.mdx +3 -3
  16. package/docs/07-reference/01-ai-sdk-core/18-create-agent-ui-stream-response.mdx +2 -2
  17. package/docs/07-reference/01-ai-sdk-core/18-pipe-agent-ui-stream-to-response.mdx +3 -3
  18. package/docs/07-reference/02-ai-sdk-ui/41-create-ui-message-stream-response.mdx +7 -0
  19. package/docs/07-reference/02-ai-sdk-ui/42-pipe-ui-message-stream-to-response.mdx +7 -0
  20. package/package.json +2 -2
  21. package/src/agent/create-agent-ui-stream-response.ts +5 -2
  22. package/src/agent/create-agent-ui-stream.ts +5 -3
  23. package/src/agent/pipe-agent-ui-stream-to-response.ts +5 -2
  24. package/src/embed/embed-many.ts +5 -3
  25. package/src/generate-image/generate-image.ts +7 -2
  26. package/src/generate-text/smooth-stream.ts +24 -9
  27. package/src/generate-text/stream-text-result.ts +5 -0
  28. package/src/generate-text/stream-text.ts +4 -1
  29. package/src/generate-video/generate-video.ts +6 -4
  30. package/src/registry/provider-registry.ts +1 -1
  31. package/src/ui/chat.ts +13 -4
  32. package/src/ui/http-chat-transport.ts +27 -1
  33. package/src/ui/last-assistant-message-is-complete-with-tool-calls.ts +15 -3
  34. package/src/ui/process-ui-message-stream.ts +59 -18
  35. package/src/ui/ui-messages.ts +14 -0
  36. package/src/ui/validate-ui-messages.ts +2 -0
  37. package/src/ui-message-stream/create-sse-stream-with-keep-alive.ts +89 -0
  38. package/src/ui-message-stream/create-ui-message-stream-response.ts +7 -1
  39. package/src/ui-message-stream/pipe-ui-message-stream-to-response.ts +7 -1
  40. package/src/ui-message-stream/ui-message-stream-response-init.ts +7 -0
  41. package/src/util/get-own.ts +18 -0
  42. package/src/util/set-own.ts +16 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.297
4
+
5
+ ### Patch Changes
6
+
7
+ - 8349396: fix(ai): preserve hydrated partial static tool input across stream resumptions
8
+ - ab0b94b: fix(ai): keep idle UI message streams open with optional SSE heartbeats
9
+ - ce660b0: Clarify that provider-executed tool execution errors bypass the UI stream's `onError` callback to preserve provider error data. Stream errors and invalid tool calls still use the callback. Runtime behavior is unchanged.
10
+ - 850d4d5: Encode chat IDs in default stream reconnection URLs so slashes, query delimiters, and fragments stay within the ID. Reject standalone `.` and `..` IDs before fetching. Custom URLs returned by `prepareReconnectToStreamRequest` remain unchanged.
11
+ - cdc5b56: Preserve prototype-named tools, providers, and provider metadata as own properties without changing lookup object prototypes. Prevent inherited names from resolving as registered providers or causing image metadata aggregation to fail.
12
+ - d4203d2: Prevent automatic chat resumption when completed tool output is followed by terminal text without a completed stream state, while preserving resumption after completed model text.
13
+ - Updated dependencies [4972874]
14
+ - Updated dependencies [03e5a25]
15
+ - @ai-sdk/gateway@3.0.206
16
+
17
+ ## 6.0.296
18
+
19
+ ### Patch Changes
20
+
21
+ - 0741da8: fix(ai): allow agent UI streams to use original messages as input
22
+ - a63fa9b: fix(ai): preserve tool metadata from tool output chunks
23
+ - a61bea9: Preserve provider metadata on corresponding `smoothStream` chunks without carrying it into subsequent metadata-free deltas.
24
+
3
25
  ## 6.0.295
4
26
 
5
27
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1736,6 +1736,13 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
1736
1736
  } & ({
1737
1737
  state: 'input-streaming';
1738
1738
  input?: DeepPartial<asUITool<TOOL>['input']> | undefined;
1739
+ /**
1740
+ * The raw tool input text received so far.
1741
+ *
1742
+ * This is used to continue input streaming when a message is persisted
1743
+ * and later resumed.
1744
+ */
1745
+ rawInput?: string;
1739
1746
  output?: never;
1740
1747
  errorText?: never;
1741
1748
  callProviderMetadata?: ProviderMetadata;
@@ -1846,6 +1853,13 @@ type DynamicToolUIPart = {
1846
1853
  } & ({
1847
1854
  state: 'input-streaming';
1848
1855
  input?: unknown;
1856
+ /**
1857
+ * The raw tool input text received so far.
1858
+ *
1859
+ * This is used to continue input streaming when a message is persisted
1860
+ * and later resumed.
1861
+ */
1862
+ rawInput?: string;
1849
1863
  output?: never;
1850
1864
  errorText?: never;
1851
1865
  callProviderMetadata?: ProviderMetadata;
@@ -2188,6 +2202,12 @@ type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage> = (event: {
2188
2202
  * Extends the standard `ResponseInit` with additional streaming options.
2189
2203
  */
2190
2204
  type UIMessageStreamResponseInit = ResponseInit & {
2205
+ /**
2206
+ * Optional interval in milliseconds for sending SSE keep-alive comments.
2207
+ * When set, an opening comment is sent immediately and additional comments
2208
+ * are sent after the stream has been idle for the configured interval.
2209
+ */
2210
+ keepAliveMs?: number;
2191
2211
  /**
2192
2212
  * Optional callback to consume a copy of the SSE stream independently.
2193
2213
  * This is useful for logging, debugging, or processing the stream in parallel.
@@ -2255,6 +2275,11 @@ type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
2255
2275
  /**
2256
2276
  * Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
2257
2277
  *
2278
+ * Tool execution errors marked `providerExecuted: true` bypass this callback.
2279
+ * Their strings pass through unchanged; other values are JSON-stringified to
2280
+ * preserve provider error data for model-message round trips. Stream errors
2281
+ * and invalid tool calls still use it.
2282
+ *
2258
2283
  * @returns error message to include in the data stream.
2259
2284
  */
2260
2285
  onError?: (error: unknown) => string;
@@ -3564,7 +3589,7 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
3564
3589
  * Runs the agent and returns a response object with a UI message stream.
3565
3590
  *
3566
3591
  * @param agent - The agent to run.
3567
- * @param uiMessages - The input UI messages.
3592
+ * @param uiMessages - The input UI messages. Defaults to originalMessages.
3568
3593
  * @param abortSignal - Abort signal. Optional.
3569
3594
  * @param timeout - Timeout in milliseconds. Optional.
3570
3595
  * @param options - The options for the agent. Optional.
@@ -3573,13 +3598,14 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
3573
3598
  * @param headers - Additional headers for the response. Optional.
3574
3599
  * @param status - The status code for the response. Optional.
3575
3600
  * @param statusText - The status text for the response. Optional.
3601
+ * @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
3576
3602
  * @param consumeSseStream - Whether to consume the SSE stream. Optional.
3577
3603
  *
3578
3604
  * @returns The response object.
3579
3605
  */
3580
- declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
3606
+ declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
3581
3607
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
3582
- uiMessages: unknown[];
3608
+ uiMessages?: unknown[];
3583
3609
  abortSignal?: AbortSignal;
3584
3610
  timeout?: TimeoutConfiguration;
3585
3611
  options?: CALL_OPTIONS;
@@ -4120,7 +4146,9 @@ declare function lastAssistantMessageIsCompleteWithApprovalResponses({ messages,
4120
4146
  /**
4121
4147
  * Check if the last message is an assistant message with completed tool calls.
4122
4148
  * The last step of the message must have at least one tool invocation and
4123
- * all tool invocations must have a result.
4149
+ * all tool invocations must have a result. Completed model text may follow
4150
+ * the tool invocation because client-side tool results update parts in place,
4151
+ * but trailing text without a completed stream state prevents resubmission.
4124
4152
  */
4125
4153
  declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
4126
4154
  messages: UIMessage[];
@@ -4303,11 +4331,12 @@ originalMessages, onStepFinish, onFinish, generateId, }: {
4303
4331
  * @param options.statusText - The HTTP status text for the response.
4304
4332
  * @param options.headers - Additional HTTP headers to include in the response.
4305
4333
  * @param options.stream - The UI message chunk stream to send.
4334
+ * @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
4306
4335
  * @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
4307
4336
  *
4308
4337
  * @returns A `Response` object with the UI message stream as the body.
4309
4338
  */
4310
- declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
4339
+ declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
4311
4340
  stream: ReadableStream<UIMessageChunk>;
4312
4341
  }): Response;
4313
4342
 
@@ -4329,10 +4358,11 @@ declare class JsonToSseTransformStream extends TransformStream<unknown, string>
4329
4358
  * @param options.statusText - The HTTP status text for the response.
4330
4359
  * @param options.headers - Additional HTTP headers to include in the response.
4331
4360
  * @param options.stream - The UI message chunk stream to send.
4361
+ * @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
4332
4362
  * @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
4333
4363
  * @returns A promise that resolves when the stream has been written.
4334
4364
  */
4335
- declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
4365
+ declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
4336
4366
  response: ServerResponse;
4337
4367
  stream: ReadableStream<UIMessageChunk>;
4338
4368
  } & UIMessageStreamResponseInit): Promise<void>;
@@ -4367,7 +4397,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
4367
4397
  * Runs the agent and stream the output as a UI message stream.
4368
4398
  *
4369
4399
  * @param agent - The agent to run.
4370
- * @param uiMessages - The input UI messages.
4400
+ * @param uiMessages - The input UI messages. Defaults to originalMessages.
4371
4401
  * @param abortSignal - The abort signal. Optional.
4372
4402
  * @param timeout - Timeout in milliseconds. Optional.
4373
4403
  * @param options - The options for the agent.
@@ -4378,7 +4408,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
4378
4408
  */
4379
4409
  declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, timeout, experimental_transform, onStepFinish, ...uiMessageStreamOptions }: {
4380
4410
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
4381
- uiMessages: unknown[];
4411
+ uiMessages?: unknown[];
4382
4412
  abortSignal?: AbortSignal;
4383
4413
  timeout?: TimeoutConfiguration;
4384
4414
  options?: CALL_OPTIONS;
@@ -4391,7 +4421,7 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
4391
4421
  *
4392
4422
  * @param response - The Node.js ServerResponse object to pipe to.
4393
4423
  * @param agent - The agent to run.
4394
- * @param uiMessages - The input UI messages.
4424
+ * @param uiMessages - The input UI messages. Defaults to originalMessages.
4395
4425
  * @param abortSignal - Abort signal. Optional.
4396
4426
  * @param timeout - Timeout in milliseconds. Optional.
4397
4427
  * @param options - The options for the agent. Optional.
@@ -4400,12 +4430,13 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
4400
4430
  * @param headers - Additional headers for the response. Optional.
4401
4431
  * @param status - The status code for the response. Optional.
4402
4432
  * @param statusText - The status text for the response. Optional.
4433
+ * @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
4403
4434
  * @param consumeSseStream - Whether to consume the SSE stream. Optional.
4404
4435
  */
4405
- declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
4436
+ declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
4406
4437
  response: ServerResponse;
4407
4438
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
4408
- uiMessages: unknown[];
4439
+ uiMessages?: unknown[];
4409
4440
  abortSignal?: AbortSignal;
4410
4441
  timeout?: TimeoutConfiguration;
4411
4442
  options?: CALL_OPTIONS;
package/dist/index.d.ts CHANGED
@@ -1736,6 +1736,13 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
1736
1736
  } & ({
1737
1737
  state: 'input-streaming';
1738
1738
  input?: DeepPartial<asUITool<TOOL>['input']> | undefined;
1739
+ /**
1740
+ * The raw tool input text received so far.
1741
+ *
1742
+ * This is used to continue input streaming when a message is persisted
1743
+ * and later resumed.
1744
+ */
1745
+ rawInput?: string;
1739
1746
  output?: never;
1740
1747
  errorText?: never;
1741
1748
  callProviderMetadata?: ProviderMetadata;
@@ -1846,6 +1853,13 @@ type DynamicToolUIPart = {
1846
1853
  } & ({
1847
1854
  state: 'input-streaming';
1848
1855
  input?: unknown;
1856
+ /**
1857
+ * The raw tool input text received so far.
1858
+ *
1859
+ * This is used to continue input streaming when a message is persisted
1860
+ * and later resumed.
1861
+ */
1862
+ rawInput?: string;
1849
1863
  output?: never;
1850
1864
  errorText?: never;
1851
1865
  callProviderMetadata?: ProviderMetadata;
@@ -2188,6 +2202,12 @@ type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage> = (event: {
2188
2202
  * Extends the standard `ResponseInit` with additional streaming options.
2189
2203
  */
2190
2204
  type UIMessageStreamResponseInit = ResponseInit & {
2205
+ /**
2206
+ * Optional interval in milliseconds for sending SSE keep-alive comments.
2207
+ * When set, an opening comment is sent immediately and additional comments
2208
+ * are sent after the stream has been idle for the configured interval.
2209
+ */
2210
+ keepAliveMs?: number;
2191
2211
  /**
2192
2212
  * Optional callback to consume a copy of the SSE stream independently.
2193
2213
  * This is useful for logging, debugging, or processing the stream in parallel.
@@ -2255,6 +2275,11 @@ type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
2255
2275
  /**
2256
2276
  * Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
2257
2277
  *
2278
+ * Tool execution errors marked `providerExecuted: true` bypass this callback.
2279
+ * Their strings pass through unchanged; other values are JSON-stringified to
2280
+ * preserve provider error data for model-message round trips. Stream errors
2281
+ * and invalid tool calls still use it.
2282
+ *
2258
2283
  * @returns error message to include in the data stream.
2259
2284
  */
2260
2285
  onError?: (error: unknown) => string;
@@ -3564,7 +3589,7 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
3564
3589
  * Runs the agent and returns a response object with a UI message stream.
3565
3590
  *
3566
3591
  * @param agent - The agent to run.
3567
- * @param uiMessages - The input UI messages.
3592
+ * @param uiMessages - The input UI messages. Defaults to originalMessages.
3568
3593
  * @param abortSignal - Abort signal. Optional.
3569
3594
  * @param timeout - Timeout in milliseconds. Optional.
3570
3595
  * @param options - The options for the agent. Optional.
@@ -3573,13 +3598,14 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
3573
3598
  * @param headers - Additional headers for the response. Optional.
3574
3599
  * @param status - The status code for the response. Optional.
3575
3600
  * @param statusText - The status text for the response. Optional.
3601
+ * @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
3576
3602
  * @param consumeSseStream - Whether to consume the SSE stream. Optional.
3577
3603
  *
3578
3604
  * @returns The response object.
3579
3605
  */
3580
- declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
3606
+ declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
3581
3607
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
3582
- uiMessages: unknown[];
3608
+ uiMessages?: unknown[];
3583
3609
  abortSignal?: AbortSignal;
3584
3610
  timeout?: TimeoutConfiguration;
3585
3611
  options?: CALL_OPTIONS;
@@ -4120,7 +4146,9 @@ declare function lastAssistantMessageIsCompleteWithApprovalResponses({ messages,
4120
4146
  /**
4121
4147
  * Check if the last message is an assistant message with completed tool calls.
4122
4148
  * The last step of the message must have at least one tool invocation and
4123
- * all tool invocations must have a result.
4149
+ * all tool invocations must have a result. Completed model text may follow
4150
+ * the tool invocation because client-side tool results update parts in place,
4151
+ * but trailing text without a completed stream state prevents resubmission.
4124
4152
  */
4125
4153
  declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
4126
4154
  messages: UIMessage[];
@@ -4303,11 +4331,12 @@ originalMessages, onStepFinish, onFinish, generateId, }: {
4303
4331
  * @param options.statusText - The HTTP status text for the response.
4304
4332
  * @param options.headers - Additional HTTP headers to include in the response.
4305
4333
  * @param options.stream - The UI message chunk stream to send.
4334
+ * @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
4306
4335
  * @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
4307
4336
  *
4308
4337
  * @returns A `Response` object with the UI message stream as the body.
4309
4338
  */
4310
- declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
4339
+ declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
4311
4340
  stream: ReadableStream<UIMessageChunk>;
4312
4341
  }): Response;
4313
4342
 
@@ -4329,10 +4358,11 @@ declare class JsonToSseTransformStream extends TransformStream<unknown, string>
4329
4358
  * @param options.statusText - The HTTP status text for the response.
4330
4359
  * @param options.headers - Additional HTTP headers to include in the response.
4331
4360
  * @param options.stream - The UI message chunk stream to send.
4361
+ * @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
4332
4362
  * @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
4333
4363
  * @returns A promise that resolves when the stream has been written.
4334
4364
  */
4335
- declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
4365
+ declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
4336
4366
  response: ServerResponse;
4337
4367
  stream: ReadableStream<UIMessageChunk>;
4338
4368
  } & UIMessageStreamResponseInit): Promise<void>;
@@ -4367,7 +4397,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
4367
4397
  * Runs the agent and stream the output as a UI message stream.
4368
4398
  *
4369
4399
  * @param agent - The agent to run.
4370
- * @param uiMessages - The input UI messages.
4400
+ * @param uiMessages - The input UI messages. Defaults to originalMessages.
4371
4401
  * @param abortSignal - The abort signal. Optional.
4372
4402
  * @param timeout - Timeout in milliseconds. Optional.
4373
4403
  * @param options - The options for the agent.
@@ -4378,7 +4408,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
4378
4408
  */
4379
4409
  declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, timeout, experimental_transform, onStepFinish, ...uiMessageStreamOptions }: {
4380
4410
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
4381
- uiMessages: unknown[];
4411
+ uiMessages?: unknown[];
4382
4412
  abortSignal?: AbortSignal;
4383
4413
  timeout?: TimeoutConfiguration;
4384
4414
  options?: CALL_OPTIONS;
@@ -4391,7 +4421,7 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
4391
4421
  *
4392
4422
  * @param response - The Node.js ServerResponse object to pipe to.
4393
4423
  * @param agent - The agent to run.
4394
- * @param uiMessages - The input UI messages.
4424
+ * @param uiMessages - The input UI messages. Defaults to originalMessages.
4395
4425
  * @param abortSignal - Abort signal. Optional.
4396
4426
  * @param timeout - Timeout in milliseconds. Optional.
4397
4427
  * @param options - The options for the agent. Optional.
@@ -4400,12 +4430,13 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
4400
4430
  * @param headers - Additional headers for the response. Optional.
4401
4431
  * @param status - The status code for the response. Optional.
4402
4432
  * @param statusText - The status text for the response. Optional.
4433
+ * @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
4403
4434
  * @param consumeSseStream - Whether to consume the SSE stream. Optional.
4404
4435
  */
4405
- declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
4436
+ declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
4406
4437
  response: ServerResponse;
4407
4438
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
4408
- uiMessages: unknown[];
4439
+ uiMessages?: unknown[];
4409
4440
  abortSignal?: AbortSignal;
4410
4441
  timeout?: TimeoutConfiguration;
4411
4442
  options?: CALL_OPTIONS;