@mastra/client-js 1.8.4-alpha.0 → 1.8.5-alpha.0
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 +22 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +33 -46
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +28 -1089
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -1087
- package/dist/index.js.map +1 -1
- package/dist/utils/process-client-tools.d.ts.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.8.5-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`51970b3`](https://github.com/mastra-ai/mastra/commit/51970b3828494d59a8dd4df143b194d37d31e3f5), [`4a7ce05`](https://github.com/mastra-ai/mastra/commit/4a7ce05125b8d3d260f68f1fc4a6c6866d22ba24), [`085e371`](https://github.com/mastra-ai/mastra/commit/085e3718a7d0fe9a210fe7dd1c867b9bdfe8d16b), [`ce26fe2`](https://github.com/mastra-ai/mastra/commit/ce26fe2166dd90254f8bee5776e55977143e97de), [`b26307f`](https://github.com/mastra-ai/mastra/commit/b26307f050df39629511b0e831b8fc26973ce8b1)]:
|
|
8
|
+
- @mastra/core@1.13.3-alpha.0
|
|
9
|
+
- @mastra/schema-compat@1.2.5-alpha.0
|
|
10
|
+
|
|
11
|
+
## 1.8.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Fixed `@mastra/client-js` so client-side tools with Zod `inputSchema`, `parameters`, or `outputSchema` are serialized to JSON Schema before requests are sent. ([#13673](https://github.com/mastra-ai/mastra/pull/13673))
|
|
16
|
+
|
|
17
|
+
Client tools with `execute` functions no longer trigger OpenAI `"Invalid schema for function"` errors when they include Zod schemas.
|
|
18
|
+
|
|
19
|
+
Fixes #11668. Alternative to #11787.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`0ce6035`](https://github.com/mastra-ai/mastra/commit/0ce603591189f547397704e53f23c77bc5630071), [`1978bc4`](https://github.com/mastra-ai/mastra/commit/1978bc424dbb04f5f7c5d8522f07f1166006fa3f)]:
|
|
22
|
+
- @mastra/core@1.13.2
|
|
23
|
+
- @mastra/schema-compat@1.2.4
|
|
24
|
+
|
|
3
25
|
## 1.8.4-alpha.0
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -754,7 +754,7 @@ declare type ConsumeStreamOptions = {
|
|
|
754
754
|
onError?: ErrorHandler;
|
|
755
755
|
};
|
|
756
756
|
|
|
757
|
-
declare type ContentPart<TOOLS extends ToolSet> = {
|
|
757
|
+
export declare type ContentPart<TOOLS extends ToolSet> = {
|
|
758
758
|
type: 'text';
|
|
759
759
|
text: string;
|
|
760
760
|
providerMetadata?: ProviderMetadata;
|
|
@@ -907,6 +907,23 @@ export declare function cosineSimilarity(vector1: number[], vector2: number[]):
|
|
|
907
907
|
|
|
908
908
|
declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
|
|
909
909
|
|
|
910
|
+
/**
|
|
911
|
+
* Creates a download function with configurable options.
|
|
912
|
+
*
|
|
913
|
+
* @param options - Configuration options for the download function.
|
|
914
|
+
* @param options.maxBytes - Maximum allowed download size in bytes. Default: 2 GiB.
|
|
915
|
+
* @returns A download function that can be passed to `transcribe()` or `experimental_generateVideo()`.
|
|
916
|
+
*/
|
|
917
|
+
export declare function createDownload(options?: {
|
|
918
|
+
maxBytes?: number;
|
|
919
|
+
}): ({ url, abortSignal }: {
|
|
920
|
+
url: URL;
|
|
921
|
+
abortSignal?: AbortSignal;
|
|
922
|
+
}) => Promise<{
|
|
923
|
+
data: Uint8Array<ArrayBufferLike>;
|
|
924
|
+
mediaType: string | undefined;
|
|
925
|
+
}>;
|
|
926
|
+
|
|
910
927
|
declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleValidator<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
|
|
911
928
|
|
|
912
929
|
/**
|
|
@@ -2082,20 +2099,7 @@ export declare interface Experimental_SpeechResult {
|
|
|
2082
2099
|
readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
|
|
2083
2100
|
}
|
|
2084
2101
|
|
|
2085
|
-
|
|
2086
|
-
Generates transcripts using a transcription model.
|
|
2087
|
-
|
|
2088
|
-
@param model - The transcription model to use.
|
|
2089
|
-
@param audio - The audio data to transcribe as DataContent (string | Uint8Array | ArrayBuffer | Buffer) or a URL.
|
|
2090
|
-
@param providerOptions - Additional provider-specific options that are passed through to the provider
|
|
2091
|
-
as body parameters.
|
|
2092
|
-
@param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
|
2093
|
-
@param abortSignal - An optional abort signal that can be used to cancel the call.
|
|
2094
|
-
@param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
|
2095
|
-
|
|
2096
|
-
@returns A result object that contains the generated transcript.
|
|
2097
|
-
*/
|
|
2098
|
-
export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
|
2102
|
+
export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
|
|
2099
2103
|
/**
|
|
2100
2104
|
The transcription model to use.
|
|
2101
2105
|
*/
|
|
@@ -2134,6 +2138,19 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
|
|
|
2134
2138
|
Only applicable for HTTP-based providers.
|
|
2135
2139
|
*/
|
|
2136
2140
|
headers?: Record<string, string>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Custom download function for fetching audio from URLs.
|
|
2143
|
+
* Use `createDownload()` from `ai` to create a download function with custom size limits.
|
|
2144
|
+
*
|
|
2145
|
+
* @default createDownload() (2 GiB limit)
|
|
2146
|
+
*/
|
|
2147
|
+
download?: (options: {
|
|
2148
|
+
url: URL;
|
|
2149
|
+
abortSignal?: AbortSignal;
|
|
2150
|
+
}) => Promise<{
|
|
2151
|
+
data: Uint8Array;
|
|
2152
|
+
mediaType: string | undefined;
|
|
2153
|
+
}>;
|
|
2137
2154
|
}): Promise<Experimental_TranscriptionResult>;
|
|
2138
2155
|
|
|
2139
2156
|
/**
|
|
@@ -2545,7 +2562,6 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
2545
2562
|
The enum values that the model should use.
|
|
2546
2563
|
*/
|
|
2547
2564
|
enum: Array<RESULT>;
|
|
2548
|
-
mode?: 'json';
|
|
2549
2565
|
output: 'enum';
|
|
2550
2566
|
} : OUTPUT extends 'no-schema' ? {} : {
|
|
2551
2567
|
/**
|
|
@@ -2564,20 +2580,6 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
2564
2580
|
via tool or schema description.
|
|
2565
2581
|
*/
|
|
2566
2582
|
schemaDescription?: string;
|
|
2567
|
-
/**
|
|
2568
|
-
The mode to use for object generation.
|
|
2569
|
-
|
|
2570
|
-
The schema is converted into a JSON schema and used in one of the following ways
|
|
2571
|
-
|
|
2572
|
-
- 'auto': The provider will choose the best mode for the model.
|
|
2573
|
-
- 'tool': A tool with the JSON schema as parameters is provided and the provider is instructed to use it.
|
|
2574
|
-
- 'json': The JSON schema and an instruction are injected into the prompt. If the provider supports JSON mode, it is enabled. If the provider supports JSON grammars, the grammar is used.
|
|
2575
|
-
|
|
2576
|
-
Please note that most providers do not support all modes.
|
|
2577
|
-
|
|
2578
|
-
Default and recommended: 'auto' (best mode for the model).
|
|
2579
|
-
*/
|
|
2580
|
-
mode?: 'auto' | 'json' | 'tool';
|
|
2581
2583
|
}) & {
|
|
2582
2584
|
output?: OUTPUT;
|
|
2583
2585
|
/**
|
|
@@ -7905,7 +7907,6 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
7905
7907
|
The enum values that the model should use.
|
|
7906
7908
|
*/
|
|
7907
7909
|
enum: Array<RESULT>;
|
|
7908
|
-
mode?: 'json';
|
|
7909
7910
|
output: 'enum';
|
|
7910
7911
|
} : OUTPUT extends 'no-schema' ? {} : {
|
|
7911
7912
|
/**
|
|
@@ -7924,20 +7925,6 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
7924
7925
|
via tool or schema description.
|
|
7925
7926
|
*/
|
|
7926
7927
|
schemaDescription?: string;
|
|
7927
|
-
/**
|
|
7928
|
-
The mode to use for object generation.
|
|
7929
|
-
|
|
7930
|
-
The schema is converted into a JSON schema and used in one of the following ways
|
|
7931
|
-
|
|
7932
|
-
- 'auto': The provider will choose the best mode for the model.
|
|
7933
|
-
- 'tool': A tool with the JSON schema as parameters is provided and the provider is instructed to use it.
|
|
7934
|
-
- 'json': The JSON schema and an instruction are injected into the prompt. If the provider supports JSON mode, it is enabled. If the provider supports JSON grammars, the grammar is used.
|
|
7935
|
-
|
|
7936
|
-
Please note that most providers do not support all modes.
|
|
7937
|
-
|
|
7938
|
-
Default and recommended: 'auto' (best mode for the model).
|
|
7939
|
-
*/
|
|
7940
|
-
mode?: 'auto' | 'json' | 'tool';
|
|
7941
7928
|
}) & {
|
|
7942
7929
|
output?: OUTPUT;
|
|
7943
7930
|
/**
|
|
@@ -10341,5 +10328,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
10341
10328
|
}): Schema<OBJECT>;
|
|
10342
10329
|
|
|
10343
10330
|
export { }
|
|
10344
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_2 as JSONValue_2, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding_2 as EmbeddingModelV2Embedding_2, ImageModelV2ProviderMetadata_2 as ImageModelV2ProviderMetadata_2, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason_2 as LanguageModelV2FinishReason_2, LanguageModelV2CallWarning_2 as LanguageModelV2CallWarning_2, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata_2 as SharedV2ProviderMetadata_2, LanguageModelV2Usage_2 as LanguageModelV2Usage_2,
|
|
10331
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_2 as JSONValue_2, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding_2 as EmbeddingModelV2Embedding_2, ImageModelV2ProviderMetadata_2 as ImageModelV2ProviderMetadata_2, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason_2 as LanguageModelV2FinishReason_2, LanguageModelV2CallWarning_2 as LanguageModelV2CallWarning_2, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata_2 as SharedV2ProviderMetadata_2, LanguageModelV2Usage_2 as LanguageModelV2Usage_2, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall_2 as LanguageModelV2ToolCall_2, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_3 as JSONValue_3, ImageModelV2CallWarning_2 as ImageModelV2CallWarning_2, SpeechModelV2CallWarning_2 as SpeechModelV2CallWarning_2, TranscriptionModelV2CallWarning_2 as TranscriptionModelV2CallWarning_2, LanguageModelV2CallOptions_2 as LanguageModelV2CallOptions_2, LanguageModelV2_2 as LanguageModelV2_2, EmbeddingModelV2_2 as EmbeddingModelV2_2, ImageModelV2_2 as ImageModelV2_2, TranscriptionModelV2_2 as TranscriptionModelV2_2, SpeechModelV2_2 as SpeechModelV2_2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2_2 as ProviderV2_2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
|
|
10345
10332
|
export { schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$7_3, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$c_3, symbol$d, symbol$d_2, symbol$d_3, symbol$e, symbol, symbol_2, validatorSymbol };
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-client-js
|
|
|
3
3
|
description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/client-js"
|
|
6
|
-
version: "1.8.
|
|
6
|
+
version: "1.8.5-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|