@mastra/schema-compat 1.3.4-alpha.1 → 1.3.4
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 +38 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +93 -3
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +467 -22
- package/dist/{chunk-LQOEEQF6.cjs → chunk-FJGZKUBH.cjs} +3 -2
- package/dist/chunk-FJGZKUBH.cjs.map +1 -0
- package/dist/{chunk-ECLNT3TQ.js → chunk-QEM5W7OR.js} +3 -3
- package/dist/chunk-QEM5W7OR.js.map +1 -0
- package/dist/{chunk-UZUKSPJ6.js → chunk-VNIPWNNH.js} +7 -2
- package/dist/chunk-VNIPWNNH.js.map +1 -0
- package/dist/{chunk-XVGNFEQ2.cjs → chunk-ZTO66ALH.cjs} +7 -2
- package/dist/chunk-ZTO66ALH.cjs.map +1 -0
- package/dist/index.cjs +32 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +7 -7
- package/dist/schema.js +1 -1
- package/dist/standard-schema/adapters/zod-v4.d.ts.map +1 -1
- package/dist/standard-schema/standard-schema.d.ts.map +1 -1
- package/dist/zod-to-json.cjs +8 -4
- package/dist/zod-to-json.d.ts +13 -0
- package/dist/zod-to-json.d.ts.map +1 -1
- package/dist/zod-to-json.js +1 -1
- package/package.json +15 -15
- package/dist/chunk-ECLNT3TQ.js.map +0 -1
- package/dist/chunk-LQOEEQF6.cjs.map +0 -1
- package/dist/chunk-UZUKSPJ6.js.map +0 -1
- package/dist/chunk-XVGNFEQ2.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @mastra/schema-compat
|
|
2
2
|
|
|
3
|
+
## 1.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- test(schema-compat): fix 'successful' typo in provider e2e test descriptions ([#19167](https://github.com/mastra-ai/mastra/pull/19167))
|
|
8
|
+
|
|
9
|
+
- Fixed a crash when converting Zod v4 schemas containing `z.record(...)` through `applyCompatLayer` with any provider compat layer attached (e.g. `GoogleSchemaCompatLayer`, `OpenAISchemaCompatLayer`). ([#17052](https://github.com/mastra-ai/mastra/pull/17052))
|
|
10
|
+
|
|
11
|
+
The record patch is now applied in `toStandardSchema` before the `StandardSchemaWithJSON` short-circuit, so it covers Zod >= 4.2 (which natively exposes `~standard.jsonSchema` and bypasses the Zod v4 adapter) as well as older Zod v4 versions that go through the adapter. Affects Zod 4.0.0–4.3.x; the underlying `z.record()` bug is fixed upstream in Zod 4.4.0.
|
|
12
|
+
|
|
13
|
+
Fixes [#17051](https://github.com/mastra-ai/mastra/issues/17051).
|
|
14
|
+
|
|
15
|
+
- Fixed Meta (Llama) and DeepSeek schemas leaking raw number bounds to the model. A field like `z.number().int()` was sent to the model with bogus `minimum: -9007199254740991` / `maximum: 9007199254740991` values, and `z.number().min(1).max(50)` leaked `minimum`/`maximum` keywords, even though OpenAI, Google, and Anthropic already strip these. Numeric constraints are now moved into the field description for Meta and DeepSeek too, matching the other providers. ([#19073](https://github.com/mastra-ai/mastra/pull/19073))
|
|
16
|
+
|
|
17
|
+
**Before** (Meta/DeepSeek, `z.object({ age: z.number().min(0).max(120) })`):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{ "age": { "type": "number", "minimum": 0, "maximum": 120 } }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**After**:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{ "age": { "type": "number", "description": "constraints: greater than or equal to 0, lower than or equal to 120" } }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Closes #19072.
|
|
30
|
+
|
|
31
|
+
## 1.3.4-alpha.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Fixed a crash when converting Zod v4 schemas containing `z.record(...)` through `applyCompatLayer` with any provider compat layer attached (e.g. `GoogleSchemaCompatLayer`, `OpenAISchemaCompatLayer`). ([#17052](https://github.com/mastra-ai/mastra/pull/17052))
|
|
36
|
+
|
|
37
|
+
The record patch is now applied in `toStandardSchema` before the `StandardSchemaWithJSON` short-circuit, so it covers Zod >= 4.2 (which natively exposes `~standard.jsonSchema` and bypasses the Zod v4 adapter) as well as older Zod v4 versions that go through the adapter. Affects Zod 4.0.0–4.3.x; the underlying `z.record()` bug is fixed upstream in Zod 4.4.0.
|
|
38
|
+
|
|
39
|
+
Fixes [#17051](https://github.com/mastra-ai/mastra/issues/17051).
|
|
40
|
+
|
|
3
41
|
## 1.3.4-alpha.1
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -231,6 +231,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
231
231
|
Validator,
|
|
232
232
|
asSchema,
|
|
233
233
|
asValidator,
|
|
234
|
+
cancelResponseBody,
|
|
234
235
|
combineHeaders,
|
|
235
236
|
convertAsyncIteratorToReadableStream,
|
|
236
237
|
convertBase64ToUint8Array,
|
|
@@ -249,13 +250,16 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
249
250
|
dynamicTool,
|
|
250
251
|
executeTool,
|
|
251
252
|
extractResponseHeaders,
|
|
253
|
+
fetchWithValidatedRedirects,
|
|
252
254
|
generateId,
|
|
253
255
|
getErrorMessage,
|
|
254
256
|
getFromApi,
|
|
255
257
|
getRuntimeEnvironmentUserAgent,
|
|
256
258
|
injectJsonInstructionIntoMessages,
|
|
257
259
|
isAbortError,
|
|
260
|
+
isBrowserRuntime,
|
|
258
261
|
isParsableJson,
|
|
262
|
+
isSameOrigin,
|
|
259
263
|
isUrlSupported,
|
|
260
264
|
isValidator,
|
|
261
265
|
jsonSchema,
|
|
@@ -494,6 +498,20 @@ export declare type CallSettings = {
|
|
|
494
498
|
*/
|
|
495
499
|
export declare type CallWarning = LanguageModelV2CallWarning;
|
|
496
500
|
|
|
501
|
+
/**
|
|
502
|
+
* Cancels a response body to release the underlying connection.
|
|
503
|
+
*
|
|
504
|
+
* When a fetch Response is rejected without consuming its body (e.g. a failed
|
|
505
|
+
* status code, an open-redirect rejection, or a Content-Length that exceeds the
|
|
506
|
+
* size limit), the underlying TCP socket is not returned to the connection pool
|
|
507
|
+
* and may stay open until the process runs out of file descriptors. Cancelling
|
|
508
|
+
* the body avoids this leak.
|
|
509
|
+
*
|
|
510
|
+
* Errors thrown while cancelling are ignored: the body may already be locked,
|
|
511
|
+
* disturbed, or absent, none of which should mask the original rejection.
|
|
512
|
+
*/
|
|
513
|
+
declare function cancelResponseBody(response: Response): Promise<void>;
|
|
514
|
+
|
|
497
515
|
export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
|
|
498
516
|
/**
|
|
499
517
|
* A unique identifier for the chat. If not provided, a random one will be
|
|
@@ -956,7 +974,21 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
|
|
|
956
974
|
role?: UI_MESSAGE['role'];
|
|
957
975
|
};
|
|
958
976
|
|
|
959
|
-
|
|
977
|
+
/**
|
|
978
|
+
* Creates a UI message stream that can be used to send messages to the client.
|
|
979
|
+
*
|
|
980
|
+
* @param options.execute - A function that is called with a writer to write UI message chunks to the stream.
|
|
981
|
+
* @param options.onError - A function that extracts an error message from an error. Defaults to `() => 'An error occurred.'` so server-side error details are not leaked to the client; supply your own to surface richer messages.
|
|
982
|
+
* @param options.originalMessages - The original messages. If provided, persistence mode is assumed
|
|
983
|
+
* and a message ID is provided for the response message.
|
|
984
|
+
* @param options.onStepFinish - A callback that is called when each step finishes. Useful for persisting intermediate messages.
|
|
985
|
+
* @param options.onFinish - A callback that is called when the stream finishes.
|
|
986
|
+
* @param options.generateId - A function that generates a unique ID. Defaults to the built-in ID generator.
|
|
987
|
+
*
|
|
988
|
+
* @returns A `ReadableStream` of UI message chunks.
|
|
989
|
+
*/
|
|
990
|
+
export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
|
|
991
|
+
originalMessages, onFinish, generateId, }: {
|
|
960
992
|
execute: (options: {
|
|
961
993
|
writer: UIMessageStreamWriter<UI_MESSAGE>;
|
|
962
994
|
}) => Promise<void> | void;
|
|
@@ -2129,6 +2161,36 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
2129
2161
|
*/
|
|
2130
2162
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
2131
2163
|
|
|
2164
|
+
/**
|
|
2165
|
+
* Fetches a URL while enforcing the SSRF download guard on every hop.
|
|
2166
|
+
*
|
|
2167
|
+
* Redirects are followed manually (`redirect: 'manual'`) so each hop is
|
|
2168
|
+
* validated with {@link validateDownloadUrl} *before* it is requested. Relying
|
|
2169
|
+
* on the default `redirect: 'follow'` would issue the request to a redirect
|
|
2170
|
+
* target (e.g. an internal address) before we ever see its URL, defeating the
|
|
2171
|
+
* SSRF guard.
|
|
2172
|
+
*
|
|
2173
|
+
* A `redirect: 'manual'` request yields an unreadable opaque response in the
|
|
2174
|
+
* browser (and in other spec-compliant fetch implementations), so the redirect
|
|
2175
|
+
* target cannot be validated here. In a real browser this is safe to follow
|
|
2176
|
+
* natively because SSRF is not reachable (fetch is constrained by CORS and
|
|
2177
|
+
* cannot reach a server's internal network or cloud-metadata). On any other
|
|
2178
|
+
* runtime we cannot validate the hop, so we fail closed rather than follow it
|
|
2179
|
+
* blindly and bypass the SSRF guard.
|
|
2180
|
+
*
|
|
2181
|
+
* The returned response is the final (non-redirect) response. The caller is
|
|
2182
|
+
* responsible for checking `response.ok` and reading the body.
|
|
2183
|
+
*
|
|
2184
|
+
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
2185
|
+
* a redirect cannot be validated on a non-browser runtime.
|
|
2186
|
+
*/
|
|
2187
|
+
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
|
|
2188
|
+
url: string;
|
|
2189
|
+
headers?: HeadersInit;
|
|
2190
|
+
abortSignal?: AbortSignal;
|
|
2191
|
+
maxRedirects?: number;
|
|
2192
|
+
}): Promise<Response>;
|
|
2193
|
+
|
|
2132
2194
|
/**
|
|
2133
2195
|
File content part of a prompt. It contains a file.
|
|
2134
2196
|
*/
|
|
@@ -2261,7 +2323,7 @@ declare interface GatewayGenerationInfoParams {
|
|
|
2261
2323
|
id: string;
|
|
2262
2324
|
}
|
|
2263
2325
|
|
|
2264
|
-
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' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | '
|
|
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 & {});
|
|
2265
2327
|
|
|
2266
2328
|
declare interface GatewayLanguageModelEntry {
|
|
2267
2329
|
/**
|
|
@@ -2312,7 +2374,7 @@ declare interface GatewayLanguageModelEntry {
|
|
|
2312
2374
|
|
|
2313
2375
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
2314
2376
|
|
|
2315
|
-
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' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-
|
|
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 & {});
|
|
2316
2378
|
|
|
2317
2379
|
declare interface GatewayProvider extends ProviderV2 {
|
|
2318
2380
|
(modelId: GatewayModelId): LanguageModelV2;
|
|
@@ -3424,6 +3486,16 @@ export declare class InvalidToolInputError extends AISDKError {
|
|
|
3424
3486
|
|
|
3425
3487
|
declare function isAbortError(error: unknown): error is Error;
|
|
3426
3488
|
|
|
3489
|
+
/**
|
|
3490
|
+
* Returns `true` when running in a browser.
|
|
3491
|
+
*
|
|
3492
|
+
* Detection keys on the presence of a global `window`, matching the browser
|
|
3493
|
+
* check used elsewhere in this package (see `getRuntimeEnvironmentUserAgent`)
|
|
3494
|
+
* so the SDK has a single, consistent definition of "browser". Server runtimes
|
|
3495
|
+
* (Node.js, Deno, Bun, edge/workers) do not define `window`.
|
|
3496
|
+
*/
|
|
3497
|
+
declare function isBrowserRuntime(globalThisAny?: any): boolean;
|
|
3498
|
+
|
|
3427
3499
|
/**
|
|
3428
3500
|
* Check if a message part is a data part.
|
|
3429
3501
|
*/
|
|
@@ -3456,6 +3528,20 @@ declare function isParsableJson(input: string): boolean;
|
|
|
3456
3528
|
*/
|
|
3457
3529
|
export declare function isReasoningUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is ReasoningUIPart;
|
|
3458
3530
|
|
|
3531
|
+
/**
|
|
3532
|
+
* Returns true when `url` has the same origin (scheme + host + port) as
|
|
3533
|
+
* `baseUrl`.
|
|
3534
|
+
*
|
|
3535
|
+
* Used to decide whether provider credentials may be attached to a request to a
|
|
3536
|
+
* URL taken from a provider response (e.g. a polling or media-download URL).
|
|
3537
|
+
* Credentials must only be sent to the provider's own origin; a response that
|
|
3538
|
+
* names a foreign host (a CDN, or an attacker-controlled host if the response
|
|
3539
|
+
* is tampered with) must not receive the API key.
|
|
3540
|
+
*
|
|
3541
|
+
* Returns false if either value is not a valid absolute URL (fail-closed).
|
|
3542
|
+
*/
|
|
3543
|
+
declare function isSameOrigin(url: string, baseUrl: string): boolean;
|
|
3544
|
+
|
|
3459
3545
|
/**
|
|
3460
3546
|
* Type guard to check if a message part is a text part.
|
|
3461
3547
|
*/
|
|
@@ -8714,6 +8800,10 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
8714
8800
|
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
8715
8801
|
* to prevent SSRF attacks.
|
|
8716
8802
|
*
|
|
8803
|
+
* Note: this performs string/literal-IP checks only. It does not resolve DNS, so a
|
|
8804
|
+
* hostname that resolves to a private address is not blocked here (see callers, which
|
|
8805
|
+
* should additionally constrain egress at the network layer when handling untrusted URLs).
|
|
8806
|
+
*
|
|
8717
8807
|
* @param url - The URL string to validate.
|
|
8718
8808
|
* @throws DownloadError if the URL is unsafe.
|
|
8719
8809
|
*/
|