@ai-sdk/provider-utils 4.0.24 → 4.0.25

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 (63) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +4 -2
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +2 -2
  7. package/src/add-additional-properties-to-json-schema.ts +1 -1
  8. package/src/convert-image-model-file-to-data-uri.ts +1 -1
  9. package/src/create-tool-name-mapping.ts +1 -1
  10. package/src/get-from-api.ts +2 -2
  11. package/src/inject-json-instruction.ts +1 -1
  12. package/src/parse-json-event-stream.ts +3 -3
  13. package/src/parse-json.ts +2 -2
  14. package/src/parse-provider-options.ts +1 -1
  15. package/src/post-to-api.ts +2 -2
  16. package/src/provider-tool-factory.ts +2 -2
  17. package/src/resolve.ts +1 -1
  18. package/src/response-handler.ts +2 -2
  19. package/src/schema.ts +6 -3
  20. package/src/to-json-schema/zod3-to-json-schema/options.ts +3 -3
  21. package/src/to-json-schema/zod3-to-json-schema/parse-def.ts +3 -3
  22. package/src/to-json-schema/zod3-to-json-schema/parse-types.ts +22 -22
  23. package/src/to-json-schema/zod3-to-json-schema/parsers/array.ts +3 -3
  24. package/src/to-json-schema/zod3-to-json-schema/parsers/bigint.ts +1 -1
  25. package/src/to-json-schema/zod3-to-json-schema/parsers/branded.ts +2 -2
  26. package/src/to-json-schema/zod3-to-json-schema/parsers/catch.ts +2 -2
  27. package/src/to-json-schema/zod3-to-json-schema/parsers/date.ts +3 -3
  28. package/src/to-json-schema/zod3-to-json-schema/parsers/default.ts +3 -3
  29. package/src/to-json-schema/zod3-to-json-schema/parsers/effects.ts +3 -3
  30. package/src/to-json-schema/zod3-to-json-schema/parsers/enum.ts +1 -1
  31. package/src/to-json-schema/zod3-to-json-schema/parsers/intersection.ts +4 -4
  32. package/src/to-json-schema/zod3-to-json-schema/parsers/literal.ts +1 -1
  33. package/src/to-json-schema/zod3-to-json-schema/parsers/map.ts +4 -4
  34. package/src/to-json-schema/zod3-to-json-schema/parsers/native-enum.ts +1 -1
  35. package/src/to-json-schema/zod3-to-json-schema/parsers/never.ts +1 -1
  36. package/src/to-json-schema/zod3-to-json-schema/parsers/nullable.ts +4 -4
  37. package/src/to-json-schema/zod3-to-json-schema/parsers/number.ts +1 -1
  38. package/src/to-json-schema/zod3-to-json-schema/parsers/object.ts +3 -3
  39. package/src/to-json-schema/zod3-to-json-schema/parsers/optional.ts +3 -3
  40. package/src/to-json-schema/zod3-to-json-schema/parsers/pipeline.ts +4 -4
  41. package/src/to-json-schema/zod3-to-json-schema/parsers/promise.ts +3 -3
  42. package/src/to-json-schema/zod3-to-json-schema/parsers/readonly.ts +2 -2
  43. package/src/to-json-schema/zod3-to-json-schema/parsers/record.ts +7 -7
  44. package/src/to-json-schema/zod3-to-json-schema/parsers/set.ts +3 -3
  45. package/src/to-json-schema/zod3-to-json-schema/parsers/string.ts +2 -2
  46. package/src/to-json-schema/zod3-to-json-schema/parsers/tuple.ts +3 -3
  47. package/src/to-json-schema/zod3-to-json-schema/parsers/undefined.ts +1 -1
  48. package/src/to-json-schema/zod3-to-json-schema/parsers/union.ts +3 -3
  49. package/src/to-json-schema/zod3-to-json-schema/parsers/unknown.ts +1 -1
  50. package/src/to-json-schema/zod3-to-json-schema/refs.ts +3 -3
  51. package/src/to-json-schema/zod3-to-json-schema/select-parser.ts +2 -2
  52. package/src/to-json-schema/zod3-to-json-schema/zod3-to-json-schema.ts +3 -3
  53. package/src/types/assistant-model-message.ts +3 -3
  54. package/src/types/content-part.ts +3 -3
  55. package/src/types/execute-tool.ts +1 -1
  56. package/src/types/index.ts +2 -1
  57. package/src/types/model-message.ts +4 -4
  58. package/src/types/provider-options.ts +1 -1
  59. package/src/types/system-model-message.ts +1 -1
  60. package/src/types/tool-model-message.ts +3 -3
  61. package/src/types/tool.ts +5 -5
  62. package/src/types/user-model-message.ts +2 -2
  63. package/src/validate-types.ts +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "4.0.24",
3
+ "version": "4.0.25",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@standard-schema/spec": "^1.1.0",
37
37
  "eventsource-parser": "^3.0.8",
38
- "@ai-sdk/provider": "3.0.9"
38
+ "@ai-sdk/provider": "3.0.10"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "20.17.24",
@@ -1,4 +1,4 @@
1
- import { JSONSchema7, JSONSchema7Definition } from '@ai-sdk/provider';
1
+ import type { JSONSchema7, JSONSchema7Definition } from '@ai-sdk/provider';
2
2
 
3
3
  /**
4
4
  * Recursively adds additionalProperties: false to the JSON schema. This is necessary because some providers (e.g. OpenAI) do not support additionalProperties: true.
@@ -1,4 +1,4 @@
1
- import { ImageModelV3File } from '@ai-sdk/provider';
1
+ import type { ImageModelV3File } from '@ai-sdk/provider';
2
2
  import { convertUint8ArrayToBase64 } from './uint8-utils';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  LanguageModelV3FunctionTool,
3
3
  LanguageModelV3ProviderTool,
4
4
  } from '@ai-sdk/provider';
@@ -1,9 +1,9 @@
1
1
  import { APICallError } from '@ai-sdk/provider';
2
2
  import { extractResponseHeaders } from './extract-response-headers';
3
- import { FetchFunction } from './fetch-function';
3
+ import type { FetchFunction } from './fetch-function';
4
4
  import { handleFetchError } from './handle-fetch-error';
5
5
  import { isAbortError } from './is-abort-error';
6
- import { ResponseHandler } from './response-handler';
6
+ import type { ResponseHandler } from './response-handler';
7
7
  import { getRuntimeEnvironmentUserAgent } from './get-runtime-environment-user-agent';
8
8
  import { withUserAgentSuffix } from './with-user-agent-suffix';
9
9
  import { VERSION } from './version';
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  JSONSchema7,
3
3
  LanguageModelV3Message,
4
4
  LanguageModelV3Prompt,
@@ -1,9 +1,9 @@
1
1
  import {
2
- EventSourceMessage,
3
2
  EventSourceParserStream,
3
+ type EventSourceMessage,
4
4
  } from 'eventsource-parser/stream';
5
- import { ParseResult, safeParseJSON } from './parse-json';
6
- import { FlexibleSchema } from './schema';
5
+ import { safeParseJSON, type ParseResult } from './parse-json';
6
+ import type { FlexibleSchema } from './schema';
7
7
 
8
8
  /**
9
9
  * Parses a JSON event stream into a stream of parsed JSON objects.
package/src/parse-json.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  JSONParseError,
3
- JSONValue,
4
3
  TypeValidationError,
4
+ type JSONValue,
5
5
  } from '@ai-sdk/provider';
6
6
  import { secureJsonParse } from './secure-json-parse';
7
7
  import { safeValidateTypes, validateTypes } from './validate-types';
8
- import { FlexibleSchema } from './schema';
8
+ import type { FlexibleSchema } from './schema';
9
9
 
10
10
  /**
11
11
  * Parses a JSON string into an unknown object.
@@ -1,6 +1,6 @@
1
1
  import { InvalidArgumentError } from '@ai-sdk/provider';
2
2
  import { safeValidateTypes } from './validate-types';
3
- import { FlexibleSchema } from './schema';
3
+ import type { FlexibleSchema } from './schema';
4
4
 
5
5
  export async function parseProviderOptions<OPTIONS>({
6
6
  provider,
@@ -1,9 +1,9 @@
1
1
  import { APICallError } from '@ai-sdk/provider';
2
2
  import { extractResponseHeaders } from './extract-response-headers';
3
- import { FetchFunction } from './fetch-function';
3
+ import type { FetchFunction } from './fetch-function';
4
4
  import { handleFetchError } from './handle-fetch-error';
5
5
  import { isAbortError } from './is-abort-error';
6
- import { ResponseHandler } from './response-handler';
6
+ import type { ResponseHandler } from './response-handler';
7
7
  import { getRuntimeEnvironmentUserAgent } from './get-runtime-environment-user-agent';
8
8
  import { withUserAgentSuffix } from './with-user-agent-suffix';
9
9
  import { VERSION } from './version';
@@ -1,5 +1,5 @@
1
- import { tool, Tool, ToolExecuteFunction } from './types/tool';
2
- import { FlexibleSchema } from './schema';
1
+ import { tool, type Tool, type ToolExecuteFunction } from './types/tool';
2
+ import type { FlexibleSchema } from './schema';
3
3
 
4
4
  export type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(
5
5
  options: ARGS & {
package/src/resolve.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MaybePromiseLike } from './maybe-promise-like';
1
+ import type { MaybePromiseLike } from './maybe-promise-like';
2
2
 
3
3
  export type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
4
4
 
@@ -1,8 +1,8 @@
1
1
  import { APICallError, EmptyResponseBodyError } from '@ai-sdk/provider';
2
2
  import { extractResponseHeaders } from './extract-response-headers';
3
- import { parseJSON, ParseResult, safeParseJSON } from './parse-json';
3
+ import { parseJSON, safeParseJSON, type ParseResult } from './parse-json';
4
4
  import { parseJsonEventStream } from './parse-json-event-stream';
5
- import { FlexibleSchema } from './schema';
5
+ import type { FlexibleSchema } from './schema';
6
6
 
7
7
  export type ResponseHandler<RETURN_TYPE> = (options: {
8
8
  url: string;
package/src/schema.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { JSONSchema7, TypeValidationError } from '@ai-sdk/provider';
2
- import { StandardSchemaV1, StandardJSONSchemaV1 } from '@standard-schema/spec';
3
- import * as z3 from 'zod/v3';
1
+ import { TypeValidationError, type JSONSchema7 } from '@ai-sdk/provider';
2
+ import type {
3
+ StandardSchemaV1,
4
+ StandardJSONSchemaV1,
5
+ } from '@standard-schema/spec';
6
+ import type * as z3 from 'zod/v3';
4
7
  import * as z4 from 'zod/v4';
5
8
  import { addAdditionalPropertiesToJsonSchema } from './add-additional-properties-to-json-schema';
6
9
  import { zod3ToJsonSchema } from './to-json-schema/zod3-to-json-schema';
@@ -1,6 +1,6 @@
1
- import { ZodSchema, ZodTypeDef } from 'zod/v3';
2
- import { Refs, Seen } from './refs';
3
- import { JsonSchema7Type } from './parse-types';
1
+ import type { ZodSchema, ZodTypeDef } from 'zod/v3';
2
+ import type { Refs, Seen } from './refs';
3
+ import type { JsonSchema7Type } from './parse-types';
4
4
 
5
5
  export type DateStrategy =
6
6
  | 'format:date-time'
@@ -1,7 +1,7 @@
1
- import { ZodTypeDef } from 'zod/v3';
2
- import { Refs, Seen } from './refs';
1
+ import type { ZodTypeDef } from 'zod/v3';
2
+ import type { Refs, Seen } from './refs';
3
3
  import { ignoreOverride } from './options';
4
- import { JsonSchema7Type } from './parse-types';
4
+ import type { JsonSchema7Type } from './parse-types';
5
5
  import { selectParser } from './select-parser';
6
6
  import { getRelativePath } from './get-relative-path';
7
7
  import { parseAnyDef } from './parsers/any';
@@ -1,25 +1,25 @@
1
- import { JsonSchema7AnyType } from './parsers/any';
2
- import { JsonSchema7ArrayType } from './parsers/array';
3
- import { JsonSchema7BigintType } from './parsers/bigint';
4
- import { JsonSchema7BooleanType } from './parsers/boolean';
5
- import { JsonSchema7DateType } from './parsers/date';
6
- import { JsonSchema7EnumType } from './parsers/enum';
7
- import { JsonSchema7AllOfType } from './parsers/intersection';
8
- import { JsonSchema7LiteralType } from './parsers/literal';
9
- import { JsonSchema7MapType } from './parsers/map';
10
- import { JsonSchema7NativeEnumType } from './parsers/native-enum';
11
- import { JsonSchema7NeverType } from './parsers/never';
12
- import { JsonSchema7NullType } from './parsers/null';
13
- import { JsonSchema7NullableType } from './parsers/nullable';
14
- import { JsonSchema7NumberType } from './parsers/number';
15
- import { JsonSchema7ObjectType } from './parsers/object';
16
- import { JsonSchema7RecordType } from './parsers/record';
17
- import { JsonSchema7SetType } from './parsers/set';
18
- import { JsonSchema7StringType } from './parsers/string';
19
- import { JsonSchema7TupleType } from './parsers/tuple';
20
- import { JsonSchema7UndefinedType } from './parsers/undefined';
21
- import { JsonSchema7UnionType } from './parsers/union';
22
- import { JsonSchema7UnknownType } from './parsers/unknown';
1
+ import type { JsonSchema7AnyType } from './parsers/any';
2
+ import type { JsonSchema7ArrayType } from './parsers/array';
3
+ import type { JsonSchema7BigintType } from './parsers/bigint';
4
+ import type { JsonSchema7BooleanType } from './parsers/boolean';
5
+ import type { JsonSchema7DateType } from './parsers/date';
6
+ import type { JsonSchema7EnumType } from './parsers/enum';
7
+ import type { JsonSchema7AllOfType } from './parsers/intersection';
8
+ import type { JsonSchema7LiteralType } from './parsers/literal';
9
+ import type { JsonSchema7MapType } from './parsers/map';
10
+ import type { JsonSchema7NativeEnumType } from './parsers/native-enum';
11
+ import type { JsonSchema7NeverType } from './parsers/never';
12
+ import type { JsonSchema7NullType } from './parsers/null';
13
+ import type { JsonSchema7NullableType } from './parsers/nullable';
14
+ import type { JsonSchema7NumberType } from './parsers/number';
15
+ import type { JsonSchema7ObjectType } from './parsers/object';
16
+ import type { JsonSchema7RecordType } from './parsers/record';
17
+ import type { JsonSchema7SetType } from './parsers/set';
18
+ import type { JsonSchema7StringType } from './parsers/string';
19
+ import type { JsonSchema7TupleType } from './parsers/tuple';
20
+ import type { JsonSchema7UndefinedType } from './parsers/undefined';
21
+ import type { JsonSchema7UnionType } from './parsers/union';
22
+ import type { JsonSchema7UnknownType } from './parsers/unknown';
23
23
 
24
24
  type JsonSchema7RefType = { $ref: string };
25
25
  type JsonSchema7Meta = {
@@ -1,7 +1,7 @@
1
- import { ZodArrayDef, ZodFirstPartyTypeKind } from 'zod/v3';
1
+ import { ZodFirstPartyTypeKind, type ZodArrayDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
 
6
6
  export type JsonSchema7ArrayType = {
7
7
  type: 'array';
@@ -1,4 +1,4 @@
1
- import { ZodBigIntDef } from 'zod/v3';
1
+ import type { ZodBigIntDef } from 'zod/v3';
2
2
 
3
3
  export type JsonSchema7BigintType = {
4
4
  type: 'integer';
@@ -1,6 +1,6 @@
1
- import { ZodBrandedDef } from 'zod/v3';
1
+ import type { ZodBrandedDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { Refs } from '../refs';
3
+ import type { Refs } from '../refs';
4
4
 
5
5
  export function parseBrandedDef(_def: ZodBrandedDef<any>, refs: Refs) {
6
6
  return parseDef(_def.type._def, refs);
@@ -1,6 +1,6 @@
1
- import { ZodCatchDef } from 'zod/v3';
1
+ import type { ZodCatchDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { Refs } from '../refs';
3
+ import type { Refs } from '../refs';
4
4
 
5
5
  export const parseCatchDef = (def: ZodCatchDef<any>, refs: Refs) => {
6
6
  return parseDef(def.innerType._def, refs);
@@ -1,6 +1,6 @@
1
- import { ZodDateDef } from 'zod/v3';
2
- import { Refs } from '../refs';
3
- import { DateStrategy } from '../options';
1
+ import type { ZodDateDef } from 'zod/v3';
2
+ import type { Refs } from '../refs';
3
+ import type { DateStrategy } from '../options';
4
4
 
5
5
  export type JsonSchema7DateType =
6
6
  | {
@@ -1,7 +1,7 @@
1
- import { ZodDefaultDef } from 'zod/v3';
1
+ import type { ZodDefaultDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
 
6
6
  export function parseDefaultDef(
7
7
  _def: ZodDefaultDef,
@@ -1,7 +1,7 @@
1
- import { ZodEffectsDef } from 'zod/v3';
1
+ import type { ZodEffectsDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
  import { parseAnyDef } from './any';
6
6
 
7
7
  export function parseEffectsDef(
@@ -1,4 +1,4 @@
1
- import { ZodEnumDef } from 'zod/v3';
1
+ import type { ZodEnumDef } from 'zod/v3';
2
2
 
3
3
  export type JsonSchema7EnumType = {
4
4
  type: 'string';
@@ -1,8 +1,8 @@
1
- import { ZodIntersectionDef } from 'zod/v3';
1
+ import type { ZodIntersectionDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
5
- import { JsonSchema7StringType } from './string';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
+ import type { JsonSchema7StringType } from './string';
6
6
 
7
7
  export type JsonSchema7AllOfType = {
8
8
  allOf: JsonSchema7Type[];
@@ -1,4 +1,4 @@
1
- import { ZodLiteralDef } from 'zod/v3';
1
+ import type { ZodLiteralDef } from 'zod/v3';
2
2
 
3
3
  export type JsonSchema7LiteralType =
4
4
  | {
@@ -1,9 +1,9 @@
1
- import { ZodMapDef } from 'zod/v3';
1
+ import type { ZodMapDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
  import { parseAnyDef } from './any';
6
- import { JsonSchema7RecordType, parseRecordDef } from './record';
6
+ import { parseRecordDef, type JsonSchema7RecordType } from './record';
7
7
 
8
8
  export type JsonSchema7MapType = {
9
9
  type: 'array';
@@ -1,4 +1,4 @@
1
- import { ZodNativeEnumDef } from 'zod/v3';
1
+ import type { ZodNativeEnumDef } from 'zod/v3';
2
2
 
3
3
  export type JsonSchema7NativeEnumType = {
4
4
  type: 'string' | 'number' | ['string', 'number'];
@@ -1,4 +1,4 @@
1
- import { JsonSchema7AnyType, parseAnyDef } from './any';
1
+ import { parseAnyDef, type JsonSchema7AnyType } from './any';
2
2
 
3
3
  export type JsonSchema7NeverType = {
4
4
  not: JsonSchema7AnyType;
@@ -1,8 +1,8 @@
1
- import { ZodNullableDef } from 'zod/v3';
1
+ import type { ZodNullableDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
5
- import { JsonSchema7NullType } from './null';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
+ import type { JsonSchema7NullType } from './null';
6
6
  import { primitiveMappings } from './union';
7
7
 
8
8
  export type JsonSchema7NullableType =
@@ -1,4 +1,4 @@
1
- import { ZodNumberDef } from 'zod/v3';
1
+ import type { ZodNumberDef } from 'zod/v3';
2
2
 
3
3
  export type JsonSchema7NumberType = {
4
4
  type: 'number' | 'integer';
@@ -1,7 +1,7 @@
1
- import { ZodObjectDef, ZodTypeAny } from 'zod/v3';
1
+ import type { ZodObjectDef, ZodTypeAny } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
 
6
6
  export type JsonSchema7ObjectType = {
7
7
  type: 'object';
@@ -1,7 +1,7 @@
1
- import { ZodOptionalDef } from 'zod/v3';
1
+ import type { ZodOptionalDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
  import { parseAnyDef } from './any';
6
6
 
7
7
  export const parseOptionalDef = (
@@ -1,8 +1,8 @@
1
- import { ZodPipelineDef } from 'zod/v3';
1
+ import type { ZodPipelineDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
5
- import { JsonSchema7AllOfType } from './intersection';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
+ import type { JsonSchema7AllOfType } from './intersection';
6
6
 
7
7
  export const parsePipelineDef = (
8
8
  def: ZodPipelineDef<any, any>,
@@ -1,7 +1,7 @@
1
- import { ZodPromiseDef } from 'zod/v3';
1
+ import type { ZodPromiseDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
 
6
6
  export function parsePromiseDef(
7
7
  def: ZodPromiseDef,
@@ -1,6 +1,6 @@
1
- import { ZodReadonlyDef } from 'zod/v3';
1
+ import type { ZodReadonlyDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { Refs } from '../refs';
3
+ import type { Refs } from '../refs';
4
4
 
5
5
  export const parseReadonlyDef = (def: ZodReadonlyDef<any>, refs: Refs) => {
6
6
  return parseDef(def.innerType._def, refs);
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ZodFirstPartyTypeKind,
3
- ZodMapDef,
4
- ZodRecordDef,
5
- ZodTypeAny,
3
+ type ZodMapDef,
4
+ type ZodRecordDef,
5
+ type ZodTypeAny,
6
6
  } from 'zod/v3';
7
7
  import { parseDef } from '../parse-def';
8
- import { JsonSchema7Type } from '../parse-types';
9
- import { Refs } from '../refs';
8
+ import type { JsonSchema7Type } from '../parse-types';
9
+ import type { Refs } from '../refs';
10
10
  import { parseBrandedDef } from './branded';
11
- import { JsonSchema7EnumType } from './enum';
12
- import { JsonSchema7StringType, parseStringDef } from './string';
11
+ import type { JsonSchema7EnumType } from './enum';
12
+ import { parseStringDef, type JsonSchema7StringType } from './string';
13
13
 
14
14
  type JsonSchema7RecordPropertyNamesType =
15
15
  | Omit<JsonSchema7StringType, 'type'>
@@ -1,7 +1,7 @@
1
- import { ZodSetDef } from 'zod/v3';
1
+ import type { ZodSetDef } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
 
6
6
  export type JsonSchema7SetType = {
7
7
  type: 'array';
@@ -1,5 +1,5 @@
1
- import { ZodStringDef } from 'zod/v3';
2
- import { Refs } from '../refs';
1
+ import type { ZodStringDef } from 'zod/v3';
2
+ import type { Refs } from '../refs';
3
3
 
4
4
  let emojiRegex: RegExp | undefined = undefined;
5
5
 
@@ -1,7 +1,7 @@
1
- import { ZodTupleDef, ZodTupleItems, ZodTypeAny } from 'zod/v3';
1
+ import type { ZodTupleDef, ZodTupleItems, ZodTypeAny } from 'zod/v3';
2
2
  import { parseDef } from '../parse-def';
3
- import { JsonSchema7Type } from '../parse-types';
4
- import { Refs } from '../refs';
3
+ import type { JsonSchema7Type } from '../parse-types';
4
+ import type { Refs } from '../refs';
5
5
 
6
6
  export type JsonSchema7TupleType = {
7
7
  type: 'array';
@@ -1,4 +1,4 @@
1
- import { JsonSchema7AnyType, parseAnyDef } from './any';
1
+ import { parseAnyDef, type JsonSchema7AnyType } from './any';
2
2
 
3
3
  export type JsonSchema7UndefinedType = {
4
4
  not: JsonSchema7AnyType;
@@ -1,12 +1,12 @@
1
- import {
1
+ import type {
2
2
  ZodDiscriminatedUnionDef,
3
3
  ZodLiteralDef,
4
4
  ZodTypeAny,
5
5
  ZodUnionDef,
6
6
  } from 'zod/v3';
7
7
  import { parseDef } from '../parse-def';
8
- import { JsonSchema7Type } from '../parse-types';
9
- import { Refs } from '../refs';
8
+ import type { JsonSchema7Type } from '../parse-types';
9
+ import type { Refs } from '../refs';
10
10
 
11
11
  export const primitiveMappings = {
12
12
  ZodString: 'string',
@@ -1,4 +1,4 @@
1
- import { JsonSchema7AnyType, parseAnyDef } from './any';
1
+ import { parseAnyDef, type JsonSchema7AnyType } from './any';
2
2
 
3
3
  export type JsonSchema7UnknownType = JsonSchema7AnyType;
4
4
 
@@ -1,6 +1,6 @@
1
- import { ZodTypeDef } from 'zod/v3';
2
- import { getDefaultOptions, Options } from './options';
3
- import { JsonSchema7Type } from './parse-types';
1
+ import type { ZodTypeDef } from 'zod/v3';
2
+ import { getDefaultOptions, type Options } from './options';
3
+ import type { JsonSchema7Type } from './parse-types';
4
4
 
5
5
  export type Refs = {
6
6
  seen: Map<ZodTypeDef, Seen>;
@@ -28,9 +28,9 @@ import { parseTupleDef } from './parsers/tuple';
28
28
  import { parseUndefinedDef } from './parsers/undefined';
29
29
  import { parseUnionDef } from './parsers/union';
30
30
  import { parseUnknownDef } from './parsers/unknown';
31
- import { Refs } from './refs';
31
+ import type { Refs } from './refs';
32
32
  import { parseReadonlyDef } from './parsers/readonly';
33
- import { JsonSchema7Type } from './parse-types';
33
+ import type { JsonSchema7Type } from './parse-types';
34
34
 
35
35
  export type InnerDefGetter = () => any;
36
36
 
@@ -1,7 +1,7 @@
1
- import { ZodSchema } from 'zod/v3';
2
- import { Options } from './options';
1
+ import type { ZodSchema } from 'zod/v3';
2
+ import type { Options } from './options';
3
3
  import { parseDef } from './parse-def';
4
- import { JsonSchema7Type } from './parse-types';
4
+ import type { JsonSchema7Type } from './parse-types';
5
5
  import { getRefs } from './refs';
6
6
  import { parseAnyDef } from './parsers/any';
7
7
 
@@ -1,12 +1,12 @@
1
- import {
1
+ import type {
2
2
  FilePart,
3
3
  ReasoningPart,
4
4
  TextPart,
5
5
  ToolCallPart,
6
6
  ToolResultPart,
7
7
  } from './content-part';
8
- import { ProviderOptions } from './provider-options';
9
- import { ToolApprovalRequest } from './tool-approval-request';
8
+ import type { ProviderOptions } from './provider-options';
9
+ import type { ToolApprovalRequest } from './tool-approval-request';
10
10
 
11
11
  /**
12
12
  * An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
@@ -1,6 +1,6 @@
1
- import { JSONValue } from '@ai-sdk/provider';
2
- import { DataContent } from './data-content';
3
- import { ProviderOptions } from './provider-options';
1
+ import type { JSONValue } from '@ai-sdk/provider';
2
+ import type { DataContent } from './data-content';
3
+ import type { ProviderOptions } from './provider-options';
4
4
 
5
5
  /**
6
6
  * Text content part of a prompt. It contains a string of text.
@@ -1,5 +1,5 @@
1
1
  import { isAsyncIterable } from '../is-async-iterable';
2
- import { ToolExecutionOptions, ToolExecuteFunction } from './tool';
2
+ import type { ToolExecutionOptions, ToolExecuteFunction } from './tool';
3
3
 
4
4
  export async function* executeTool<INPUT, OUTPUT>({
5
5
  execute,
@@ -1,3 +1,5 @@
1
+ import type { ToolExecutionOptions } from './tool';
2
+
1
3
  export type {
2
4
  AssistantContent,
3
5
  AssistantModelMessage,
@@ -32,7 +34,6 @@ export type { ToolCall } from './tool-call';
32
34
  export type { ToolContent, ToolModelMessage } from './tool-model-message';
33
35
  export type { ToolResult } from './tool-result';
34
36
  export type { UserContent, UserModelMessage } from './user-model-message';
35
- import type { ToolExecutionOptions } from './tool';
36
37
 
37
38
  /**
38
39
  * @deprecated Use ToolExecutionOptions instead.