@mastra/ai-sdk 1.6.2 → 1.6.3-alpha.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.
- package/CHANGELOG.md +20 -2
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2 -2
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +7 -3
- package/dist/chat-route.d.ts +8 -16
- package/dist/chat-route.d.ts.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.cjs +156 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +156 -44
- package/dist/index.js.map +1 -1
- package/dist/transformers.d.ts.map +1 -1
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/ai-sdk
|
|
2
2
|
|
|
3
|
+
## 1.6.3-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix durable agent streams that could terminate right after the initial `start` event, leaving the client with an empty response. Streams now continue through step boundaries and deliver the full reasoning, tool, and text output. ([#19671](https://github.com/mastra-ai/mastra/pull/19671))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`b7e79c3`](https://github.com/mastra-ai/mastra/commit/b7e79c3c02ac5cd415db34ba0975ceafc1464333), [`b75d749`](https://github.com/mastra-ai/mastra/commit/b75d749621ff5d17e86bcb4ee809d301fb4f7cf3), [`a8799bb`](https://github.com/mastra-ai/mastra/commit/a8799bb8e44f4a60d01e4e2acd3448ff80bf14f8)]:
|
|
10
|
+
- @mastra/core@1.52.0-alpha.7
|
|
11
|
+
|
|
12
|
+
## 1.6.3-alpha.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Fixed the AI SDK v6 native approval flow in handleChatStream so approval responses are collected across all assistant messages instead of only the final message. Approving a tool call now resumes its exact run and tool call, multiple approval responses in one request resume sequentially in a single framed response stream, and already-resolved responses from history are safely skipped instead of executing again. ([#19528](https://github.com/mastra-ai/mastra/pull/19528))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`1426af2`](https://github.com/mastra-ai/mastra/commit/1426af24975879c000d13ac75673f630fcc970c1), [`975295d`](https://github.com/mastra-ai/mastra/commit/975295d418552f0d46a59edfef4c3ee555f9930a), [`85e4fb5`](https://github.com/mastra-ai/mastra/commit/85e4fb50087a81c74df3a762f53b56373db0b912), [`ef03c0c`](https://github.com/mastra-ai/mastra/commit/ef03c0cfc62367a458e4cc56462e2148b35681c5), [`4fb4d88`](https://github.com/mastra-ai/mastra/commit/4fb4d881bc107acee13890ad4d78661016c510ed), [`4eba27a`](https://github.com/mastra-ai/mastra/commit/4eba27adcf60f991df0e62f94b3e75b4e67f3b4b), [`c701be3`](https://github.com/mastra-ai/mastra/commit/c701be32d7d9aa94a66da8c6cc38dcac6856f464)]:
|
|
19
|
+
- @mastra/core@1.52.0-alpha.3
|
|
20
|
+
|
|
3
21
|
## 1.6.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -799,7 +817,7 @@
|
|
|
799
817
|
|
|
800
818
|
Fixed TypeScript build errors when using toAISdkStream() with for await...of loops. The function now explicitly imports ReadableStream and TransformStream from 'node:stream/web', ensuring the Node.js types (which include Symbol.asyncIterator support) are used instead of global types that may not have async iterator support in all TypeScript configurations.
|
|
801
819
|
|
|
802
|
-
This resolves issue #11884 where users encountered the error: "Type 'ReadableStream<InferUIMessageChunk<UIMessage>>' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."
|
|
820
|
+
This resolves issue #11884 where users encountered the error: "Type 'ReadableStream<InferUIMessageChunk<UIMessage>>' must have a '[Symbol.asyncIterator](<>)' method that returns an async iterator."
|
|
803
821
|
|
|
804
822
|
- Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`b99ceac`](https://github.com/mastra-ai/mastra/commit/b99ceace2c830dbdef47c8692d56a91954aefea2), [`deea43e`](https://github.com/mastra-ai/mastra/commit/deea43eb1366d03a864c5e597d16a48592b9893f), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`ac9ec66`](https://github.com/mastra-ai/mastra/commit/ac9ec6672779b2e6d4344e415481d1a6a7d4911a), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
|
|
805
823
|
- @mastra/core@1.1.0
|
|
@@ -812,7 +830,7 @@
|
|
|
812
830
|
|
|
813
831
|
Fixed TypeScript build errors when using toAISdkStream() with for await...of loops. The function now explicitly imports ReadableStream and TransformStream from 'node:stream/web', ensuring the Node.js types (which include Symbol.asyncIterator support) are used instead of global types that may not have async iterator support in all TypeScript configurations.
|
|
814
832
|
|
|
815
|
-
This resolves issue #11884 where users encountered the error: "Type 'ReadableStream<InferUIMessageChunk<UIMessage>>' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."
|
|
833
|
+
This resolves issue #11884 where users encountered the error: "Type 'ReadableStream<InferUIMessageChunk<UIMessage>>' must have a '[Symbol.asyncIterator](<>)' method that returns an async iterator."
|
|
816
834
|
|
|
817
835
|
- Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
|
|
818
836
|
- @mastra/core@1.1.0-alpha.0
|
|
@@ -2323,7 +2323,7 @@ declare interface GatewayGenerationInfoParams {
|
|
|
2323
2323
|
id: string;
|
|
2324
2324
|
}
|
|
2325
2325
|
|
|
2326
|
-
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
|
|
2326
|
+
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
|
|
2327
2327
|
|
|
2328
2328
|
declare interface GatewayLanguageModelEntry {
|
|
2329
2329
|
/**
|
|
@@ -2374,7 +2374,7 @@ declare interface GatewayLanguageModelEntry {
|
|
|
2374
2374
|
|
|
2375
2375
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
2376
2376
|
|
|
2377
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
|
|
2377
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
|
|
2378
2378
|
|
|
2379
2379
|
declare interface GatewayProvider extends ProviderV2 {
|
|
2380
2380
|
(modelId: GatewayModelId): LanguageModelV2;
|
|
@@ -3084,7 +3084,7 @@ declare interface GatewayGenerationInfoParams {
|
|
|
3084
3084
|
id: string;
|
|
3085
3085
|
}
|
|
3086
3086
|
|
|
3087
|
-
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
|
|
3087
|
+
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
|
|
3088
3088
|
|
|
3089
3089
|
declare interface GatewayLanguageModelEntry {
|
|
3090
3090
|
/**
|
|
@@ -3135,7 +3135,7 @@ declare interface GatewayLanguageModelEntry {
|
|
|
3135
3135
|
|
|
3136
3136
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
3137
3137
|
|
|
3138
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-
|
|
3138
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.7-fast' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
|
|
3139
3139
|
|
|
3140
3140
|
declare interface GatewayProvider extends ProviderV3 {
|
|
3141
3141
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -10074,7 +10074,11 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
10074
10074
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
10075
10075
|
}
|
|
10076
10076
|
|
|
10077
|
-
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> &
|
|
10077
|
+
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
|
|
10078
|
+
readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
|
|
10079
|
+
readonly jsonSchema?: StandardJSONSchemaV1.Converter;
|
|
10080
|
+
};
|
|
10081
|
+
};
|
|
10078
10082
|
|
|
10079
10083
|
/** The Standard Schema interface. */
|
|
10080
10084
|
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
package/dist/chat-route.d.ts
CHANGED
|
@@ -4,25 +4,17 @@ import type { AgentExecutionOptions } from '@mastra/core/agent';
|
|
|
4
4
|
import type { Mastra } from '@mastra/core/mastra';
|
|
5
5
|
import { registerApiRoute } from '@mastra/core/server';
|
|
6
6
|
import type { SupportedUIMessage, V5UIMessage, V5UIMessageStream, V6UIMessage, V6UIMessageStream } from './public-types.js';
|
|
7
|
-
|
|
8
|
-
* Scans a v6 UIMessage array for the most recent 'approval-responded' tool
|
|
9
|
-
* part in the last trailing assistant message only. When found, splits the
|
|
10
|
-
* composite approvalId ("${runId}::${toolCallId}") to recover the runId and
|
|
11
|
-
* toolCallId needed for a targeted resumeStream.
|
|
12
|
-
*
|
|
13
|
-
* Only the last trailing assistant message is inspected so that approval
|
|
14
|
-
* responses from earlier turns are never re-processed. Within that message,
|
|
15
|
-
* parts are scanned in reverse so the decision the user just acted on wins
|
|
16
|
-
* over any earlier 'approval-responded' parts that have not yet transitioned
|
|
17
|
-
* to 'output-available'.
|
|
18
|
-
*
|
|
19
|
-
* Returns null when no approval response is present (normal chat turn).
|
|
20
|
-
*/
|
|
21
|
-
export declare function extractV6NativeApproval(messages: V6UIMessage[]): {
|
|
7
|
+
export interface V6NativeApprovalResponse {
|
|
22
8
|
resumeData: Record<string, unknown>;
|
|
23
9
|
runId: string;
|
|
24
10
|
toolCallId: string;
|
|
25
|
-
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Collects every approval response across all assistant messages in a v6
|
|
14
|
+
* request. Responses are deduplicated by their composite run/tool-call target,
|
|
15
|
+
* with the most recent part winning when history contains repeated copies.
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractV6NativeApprovals(messages: V6UIMessage[]): V6NativeApprovalResponse[];
|
|
26
18
|
export type ChatStreamHandlerParams<UI_MESSAGE extends SupportedUIMessage = SupportedUIMessage, OUTPUT = undefined> = AgentExecutionOptions<OUTPUT> & {
|
|
27
19
|
messages: UI_MESSAGE[];
|
|
28
20
|
resumeData?: Record<string, any>;
|
package/dist/chat-route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-route.d.ts","sourceRoot":"","sources":["../src/chat-route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAM9F,OAAO,KAAK,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAA6B,MAAM,oBAAoB,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB
|
|
1
|
+
{"version":3,"file":"chat-route.d.ts","sourceRoot":"","sources":["../src/chat-route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAM9F,OAAO,KAAK,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAA6B,MAAM,oBAAoB,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;I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IACzB,IAAI,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;CAC9B,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,CAkCtD;AAED,wBAAgB,uCAAuC,CAAC,UAAU,SAAS,SAAS,EAAE,EACpF,IAAI,EACJ,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,OAAO,EACP,SAAS,EACT,UAAU,EACV,iBAAiB,GAClB,EAAE;IAED,IAAI,EACA,cAAc,CAAC,OAAO,CAAC,GACvB,aAAa,GACb,mBAAmB,GACnB;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,CAAC;IAC7D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACG,mBAAmB,CAAC,UAAU,CAAC,GAC/B,qBAAqB,CAAC,WAAW,CAAC,GAClC,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,SAAS,CA6QZ"}
|
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
|
|
32
32
|
var z4__namespace = /*#__PURE__*/_interopNamespace(z4);
|
|
33
33
|
|
|
34
|
-
// ../../packages/_vendored/ai_v5/dist/chunk-
|
|
34
|
+
// ../../packages/_vendored/ai_v5/dist/chunk-NFYQIWQU.js
|
|
35
35
|
var marker = "vercel.ai.error";
|
|
36
36
|
var symbol = Symbol.for(marker);
|
|
37
37
|
var _a;
|
|
@@ -586,7 +586,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
586
586
|
);
|
|
587
587
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
588
588
|
}
|
|
589
|
-
var VERSION = "3.0.
|
|
589
|
+
var VERSION = "3.0.29";
|
|
590
590
|
var getOriginalFetch = () => globalThis.fetch;
|
|
591
591
|
var getFromApi = async ({
|
|
592
592
|
url,
|
|
@@ -735,7 +735,7 @@ function lazyValidator(createValidator) {
|
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
737
|
function asValidator(value) {
|
|
738
|
-
return isValidator(value) ? value :
|
|
738
|
+
return isValidator(value) ? value : "~standard" in value ? standardSchemaValidator(value) : value();
|
|
739
739
|
}
|
|
740
740
|
function standardSchemaValidator(standardSchema2) {
|
|
741
741
|
return validator(async (value) => {
|
|
@@ -2360,18 +2360,27 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
2360
2360
|
var name22 = "GatewayForbiddenError";
|
|
2361
2361
|
var marker32 = `vercel.ai.gateway.error.${name22}`;
|
|
2362
2362
|
var symbol32 = Symbol.for(marker32);
|
|
2363
|
+
var forbiddenParamSchema = lazyValidator(
|
|
2364
|
+
() => zodSchema(
|
|
2365
|
+
z4.z.object({
|
|
2366
|
+
ruleId: z4.z.string()
|
|
2367
|
+
})
|
|
2368
|
+
)
|
|
2369
|
+
);
|
|
2363
2370
|
var _a32;
|
|
2364
2371
|
var _b32;
|
|
2365
2372
|
var GatewayForbiddenError = class extends (_b32 = GatewayError, _a32 = symbol32, _b32) {
|
|
2366
2373
|
constructor({
|
|
2367
2374
|
message = "Forbidden",
|
|
2368
2375
|
statusCode = 403,
|
|
2369
|
-
cause
|
|
2376
|
+
cause,
|
|
2377
|
+
ruleId
|
|
2370
2378
|
} = {}) {
|
|
2371
2379
|
super({ message, statusCode, cause });
|
|
2372
2380
|
this[_a32] = true;
|
|
2373
2381
|
this.name = name22;
|
|
2374
2382
|
this.type = "forbidden";
|
|
2383
|
+
this.ruleId = ruleId;
|
|
2375
2384
|
}
|
|
2376
2385
|
static isInstance(error) {
|
|
2377
2386
|
return GatewayError.hasMarker(error) && symbol32 in error;
|
|
@@ -2539,8 +2548,18 @@ async function createGatewayErrorFromResponse({
|
|
|
2539
2548
|
}
|
|
2540
2549
|
case "internal_server_error":
|
|
2541
2550
|
return new GatewayInternalServerError({ message, statusCode, cause });
|
|
2542
|
-
case "forbidden":
|
|
2543
|
-
|
|
2551
|
+
case "forbidden": {
|
|
2552
|
+
const ruleResult = await safeValidateTypes({
|
|
2553
|
+
value: validatedResponse.error.param,
|
|
2554
|
+
schema: forbiddenParamSchema
|
|
2555
|
+
});
|
|
2556
|
+
return new GatewayForbiddenError({
|
|
2557
|
+
message,
|
|
2558
|
+
statusCode,
|
|
2559
|
+
cause,
|
|
2560
|
+
ruleId: ruleResult.success ? ruleResult.value.ruleId : void 0
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2544
2563
|
default:
|
|
2545
2564
|
return new GatewayInternalServerError({ message, statusCode, cause });
|
|
2546
2565
|
}
|
|
@@ -3442,7 +3461,7 @@ async function getVercelRequestId() {
|
|
|
3442
3461
|
var _a1032;
|
|
3443
3462
|
return (_a1032 = getContext().headers) == null ? void 0 : _a1032["x-vercel-id"];
|
|
3444
3463
|
}
|
|
3445
|
-
var VERSION2 = "2.0.
|
|
3464
|
+
var VERSION2 = "2.0.113";
|
|
3446
3465
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
3447
3466
|
function createGatewayProvider(options = {}) {
|
|
3448
3467
|
var _a1032, _b103;
|
|
@@ -7049,11 +7068,18 @@ function asSchema2(schema) {
|
|
|
7049
7068
|
}
|
|
7050
7069
|
function standardSchema(standardSchema2) {
|
|
7051
7070
|
return jsonSchema2(
|
|
7052
|
-
() =>
|
|
7053
|
-
standardSchema2
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7071
|
+
() => {
|
|
7072
|
+
if (!hasStandardJsonSchema(standardSchema2)) {
|
|
7073
|
+
throw new Error(
|
|
7074
|
+
`Standard schema vendor '${standardSchema2["~standard"].vendor}' does not support JSON Schema conversion.`
|
|
7075
|
+
);
|
|
7076
|
+
}
|
|
7077
|
+
return addAdditionalPropertiesToJsonSchema2(
|
|
7078
|
+
standardSchema2["~standard"].jsonSchema.input({
|
|
7079
|
+
target: "draft-07"
|
|
7080
|
+
})
|
|
7081
|
+
);
|
|
7082
|
+
},
|
|
7057
7083
|
{
|
|
7058
7084
|
validate: async (value) => {
|
|
7059
7085
|
const result = await standardSchema2["~standard"].validate(value);
|
|
@@ -7068,6 +7094,9 @@ function standardSchema(standardSchema2) {
|
|
|
7068
7094
|
}
|
|
7069
7095
|
);
|
|
7070
7096
|
}
|
|
7097
|
+
function hasStandardJsonSchema(schema) {
|
|
7098
|
+
return schema["~standard"].jsonSchema != null;
|
|
7099
|
+
}
|
|
7071
7100
|
function zod3Schema2(zodSchema22, options) {
|
|
7072
7101
|
var _a223;
|
|
7073
7102
|
const useReferences = (_a223 = void 0 ) != null ? _a223 : false;
|
|
@@ -9831,13 +9860,14 @@ function convertMastraChunkToAISDKBase({
|
|
|
9831
9860
|
// Preserve messageId from the payload so it can be sent to useChat
|
|
9832
9861
|
...chunk.payload?.messageId ? { messageId: chunk.payload.messageId } : {}
|
|
9833
9862
|
};
|
|
9834
|
-
case "step-start":
|
|
9835
|
-
const { messageId: _messageId, ...rest } = chunk.payload;
|
|
9863
|
+
case "step-start": {
|
|
9864
|
+
const { messageId: _messageId, ...rest } = chunk.payload ?? {};
|
|
9836
9865
|
return {
|
|
9837
9866
|
type: "start-step",
|
|
9838
9867
|
request: rest.request,
|
|
9839
9868
|
warnings: normalizeWarnings(rest.warnings)
|
|
9840
9869
|
};
|
|
9870
|
+
}
|
|
9841
9871
|
case "raw":
|
|
9842
9872
|
return {
|
|
9843
9873
|
type: "raw",
|
|
@@ -9985,14 +10015,14 @@ function convertMastraChunkToAISDKBase({
|
|
|
9985
10015
|
providerMetadata: chunk.payload.providerMetadata
|
|
9986
10016
|
};
|
|
9987
10017
|
case "step-finish": {
|
|
9988
|
-
const { request: _request, providerMetadata, ...
|
|
10018
|
+
const { request: _request, providerMetadata, ...rest } = chunk.payload.metadata;
|
|
9989
10019
|
return {
|
|
9990
10020
|
type: "finish-step",
|
|
9991
10021
|
response: {
|
|
9992
10022
|
id: chunk.payload.id || "",
|
|
9993
10023
|
timestamp: /* @__PURE__ */ new Date(),
|
|
9994
|
-
modelId:
|
|
9995
|
-
...
|
|
10024
|
+
modelId: rest.modelId || "",
|
|
10025
|
+
...rest
|
|
9996
10026
|
},
|
|
9997
10027
|
usage: normalizeUsage(chunk.payload.output.usage),
|
|
9998
10028
|
finishReason: normalizeFinishReason(chunk.payload.stepResult.reason),
|
|
@@ -11610,28 +11640,95 @@ function toAISdkStream(stream, options = {
|
|
|
11610
11640
|
}
|
|
11611
11641
|
|
|
11612
11642
|
// src/chat-route.ts
|
|
11613
|
-
function
|
|
11614
|
-
const
|
|
11615
|
-
|
|
11616
|
-
const
|
|
11617
|
-
|
|
11618
|
-
const part
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11643
|
+
function extractV6NativeApprovals(messages) {
|
|
11644
|
+
const byTarget = /* @__PURE__ */ new Map();
|
|
11645
|
+
const separator = APPROVAL_ID_SEPARATOR;
|
|
11646
|
+
for (const message of messages) {
|
|
11647
|
+
if (message.role !== "assistant") continue;
|
|
11648
|
+
for (const part of message.parts ?? []) {
|
|
11649
|
+
if (!isToolUIPart2(part) || part.state !== "approval-responded") continue;
|
|
11650
|
+
const lastSep = part.approval.id.lastIndexOf(separator);
|
|
11651
|
+
if (lastSep === -1) continue;
|
|
11652
|
+
const runId = part.approval.id.slice(0, lastSep);
|
|
11653
|
+
const toolCallId = part.approval.id.slice(lastSep + separator.length);
|
|
11654
|
+
if (!runId || !toolCallId) continue;
|
|
11655
|
+
if (toolCallId !== part.toolCallId) continue;
|
|
11656
|
+
byTarget.set(`${runId}${separator}${toolCallId}`, {
|
|
11657
|
+
resumeData: {
|
|
11658
|
+
approved: part.approval.approved,
|
|
11659
|
+
...part.approval.reason != null ? { reason: part.approval.reason } : {}
|
|
11660
|
+
},
|
|
11661
|
+
runId,
|
|
11662
|
+
toolCallId
|
|
11663
|
+
});
|
|
11664
|
+
}
|
|
11633
11665
|
}
|
|
11634
|
-
return
|
|
11666
|
+
return [...byTarget.values()];
|
|
11667
|
+
}
|
|
11668
|
+
function streamV6ApprovalResumes(args) {
|
|
11669
|
+
const { agent, approvals, baseOptions, structuredOutput, messages, lastMessageId } = args;
|
|
11670
|
+
const { sendStart, sendFinish, sendReasoning, sendSources, onError, messageMetadata } = args;
|
|
11671
|
+
return createUIMessageStream2({
|
|
11672
|
+
originalMessages: messages,
|
|
11673
|
+
onError,
|
|
11674
|
+
execute: async ({ writer }) => {
|
|
11675
|
+
let startWritten = false;
|
|
11676
|
+
let successfulLegs = 0;
|
|
11677
|
+
let firstResolvedTargetError;
|
|
11678
|
+
let finalFinish;
|
|
11679
|
+
for (const approval of approvals) {
|
|
11680
|
+
try {
|
|
11681
|
+
const result = await agent.resumeStream(approval.resumeData, {
|
|
11682
|
+
...baseOptions,
|
|
11683
|
+
runId: approval.runId,
|
|
11684
|
+
toolCallId: approval.toolCallId,
|
|
11685
|
+
...structuredOutput ? { structuredOutput } : {}
|
|
11686
|
+
});
|
|
11687
|
+
for await (const part of toAISdkStream(result, {
|
|
11688
|
+
from: "agent",
|
|
11689
|
+
version: "v6",
|
|
11690
|
+
lastMessageId,
|
|
11691
|
+
sendStart,
|
|
11692
|
+
sendFinish,
|
|
11693
|
+
sendReasoning,
|
|
11694
|
+
sendSources,
|
|
11695
|
+
onError,
|
|
11696
|
+
messageMetadata
|
|
11697
|
+
})) {
|
|
11698
|
+
if (part.type === "start") {
|
|
11699
|
+
if (startWritten) continue;
|
|
11700
|
+
startWritten = true;
|
|
11701
|
+
writer.write(part);
|
|
11702
|
+
continue;
|
|
11703
|
+
}
|
|
11704
|
+
if (!startWritten && sendStart) {
|
|
11705
|
+
writer.write({ type: "start", ...lastMessageId ? { messageId: lastMessageId } : {} });
|
|
11706
|
+
startWritten = true;
|
|
11707
|
+
}
|
|
11708
|
+
if (part.type === "finish") {
|
|
11709
|
+
finalFinish = part;
|
|
11710
|
+
continue;
|
|
11711
|
+
}
|
|
11712
|
+
writer.write(part);
|
|
11713
|
+
}
|
|
11714
|
+
successfulLegs++;
|
|
11715
|
+
} catch (error) {
|
|
11716
|
+
const id = error?.id;
|
|
11717
|
+
if (id !== "AGENT_RESUME_TOOL_CALL_NOT_SUSPENDED" && id !== "AGENT_RESUME_NO_SNAPSHOT_FOUND") {
|
|
11718
|
+
throw error;
|
|
11719
|
+
}
|
|
11720
|
+
firstResolvedTargetError ??= error;
|
|
11721
|
+
}
|
|
11722
|
+
}
|
|
11723
|
+
if (successfulLegs === 0 && firstResolvedTargetError) throw firstResolvedTargetError;
|
|
11724
|
+
if (!startWritten && sendStart) {
|
|
11725
|
+
writer.write({ type: "start", ...lastMessageId ? { messageId: lastMessageId } : {} });
|
|
11726
|
+
}
|
|
11727
|
+
if (sendFinish) {
|
|
11728
|
+
writer.write(finalFinish ?? { type: "finish" });
|
|
11729
|
+
}
|
|
11730
|
+
}
|
|
11731
|
+
});
|
|
11635
11732
|
}
|
|
11636
11733
|
async function handleChatStream({
|
|
11637
11734
|
mastra,
|
|
@@ -11669,9 +11766,6 @@ async function handleChatStream({
|
|
|
11669
11766
|
if (!Array.isArray(messages)) {
|
|
11670
11767
|
throw new Error("Messages must be an array of UIMessage objects");
|
|
11671
11768
|
}
|
|
11672
|
-
const nativeApproval = version === "v6" && !resumeData ? extractV6NativeApproval(messages) : null;
|
|
11673
|
-
const effectiveResumeData = nativeApproval?.resumeData ?? resumeData;
|
|
11674
|
-
const effectiveRunId = nativeApproval?.runId ?? runId;
|
|
11675
11769
|
let lastMessageId;
|
|
11676
11770
|
let messagesToSend = messages;
|
|
11677
11771
|
if (messages.length > 0) {
|
|
@@ -11693,12 +11787,30 @@ async function handleChatStream({
|
|
|
11693
11787
|
const baseOptions = {
|
|
11694
11788
|
...defaultOptionsRest,
|
|
11695
11789
|
...restOptions,
|
|
11696
|
-
...
|
|
11697
|
-
...nativeApproval?.toolCallId && { toolCallId: nativeApproval.toolCallId },
|
|
11790
|
+
...runId && { runId },
|
|
11698
11791
|
requestContext: requestContext || defaultOptions3?.requestContext,
|
|
11699
11792
|
...Object.keys(mergedProviderOptions).length > 0 && { providerOptions: mergedProviderOptions }
|
|
11700
11793
|
};
|
|
11701
|
-
|
|
11794
|
+
if (version === "v6" && !resumeData && trigger !== "regenerate-message" && messages.at(-1)?.role === "assistant") {
|
|
11795
|
+
const approvals = extractV6NativeApprovals(messages);
|
|
11796
|
+
if (approvals.length > 0) {
|
|
11797
|
+
return streamV6ApprovalResumes({
|
|
11798
|
+
agent: agentObj,
|
|
11799
|
+
approvals,
|
|
11800
|
+
baseOptions,
|
|
11801
|
+
structuredOutput,
|
|
11802
|
+
messages,
|
|
11803
|
+
lastMessageId,
|
|
11804
|
+
sendStart,
|
|
11805
|
+
sendFinish,
|
|
11806
|
+
sendReasoning,
|
|
11807
|
+
sendSources,
|
|
11808
|
+
onError,
|
|
11809
|
+
messageMetadata
|
|
11810
|
+
});
|
|
11811
|
+
}
|
|
11812
|
+
}
|
|
11813
|
+
const result = resumeData ? structuredOutput ? await agentObj.resumeStream(resumeData, { ...baseOptions, structuredOutput }) : await agentObj.resumeStream(resumeData, baseOptions) : structuredOutput ? await agentObj.stream(messagesToSend, { ...baseOptions, structuredOutput }) : await agentObj.stream(messagesToSend, baseOptions);
|
|
11702
11814
|
if (version === "v6") {
|
|
11703
11815
|
return createUIMessageStream2({
|
|
11704
11816
|
originalMessages: messages,
|