@mastra/client-js 0.10.2-alpha.2 → 0.10.2

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.10.2-alpha.2 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.10.2-alpha.3 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
3
  > tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,11 +9,11 @@
9
9
  CLI Cleaning output folder
10
10
  ESM Build start
11
11
  CJS Build start
12
- ESM dist/index.js 43.65 KB
13
- ESM ⚡️ Build success in 1542ms
14
- CJS dist/index.cjs 43.94 KB
15
- CJS ⚡️ Build success in 1549ms
12
+ CJS dist/index.cjs 44.77 KB
13
+ CJS ⚡️ Build success in 1691ms
14
+ ESM dist/index.js 44.48 KB
15
+ ESM ⚡️ Build success in 1693ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 14713ms
18
- DTS dist/index.d.ts 31.92 KB
19
- DTS dist/index.d.cts 31.92 KB
17
+ DTS ⚡️ Build success in 13187ms
18
+ DTS dist/index.d.ts 32.02 KB
19
+ DTS dist/index.d.cts 32.02 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 592a2db: Added different icons for agents and workflows in mcp tools list
8
+ - 37643b8: Fix tool access
9
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
10
+ - b72c768: [Bug fix] Serialize parameters in clientTools
11
+ - f0d559f: Fix peerdeps for alpha channel
12
+ - Updated dependencies [ee77e78]
13
+ - Updated dependencies [592a2db]
14
+ - Updated dependencies [e5dc18d]
15
+ - Updated dependencies [ab5adbe]
16
+ - Updated dependencies [1e8bb40]
17
+ - Updated dependencies [1b5fc55]
18
+ - Updated dependencies [195c428]
19
+ - Updated dependencies [f73e11b]
20
+ - Updated dependencies [37643b8]
21
+ - Updated dependencies [99fd6cf]
22
+ - Updated dependencies [c5bf1ce]
23
+ - Updated dependencies [add596e]
24
+ - Updated dependencies [8dc94d8]
25
+ - Updated dependencies [ecebbeb]
26
+ - Updated dependencies [79d5145]
27
+ - Updated dependencies [12b7002]
28
+ - Updated dependencies [2901125]
29
+ - @mastra/core@0.10.2
30
+
31
+ ## 0.10.2-alpha.3
32
+
33
+ ### Patch Changes
34
+
35
+ - 37643b8: Fix tool access
36
+ - b72c768: [Bug fix] Serialize parameters in clientTools
37
+ - Updated dependencies [37643b8]
38
+ - Updated dependencies [79d5145]
39
+ - @mastra/core@0.10.2-alpha.8
40
+
3
41
  ## 0.10.2-alpha.2
4
42
 
5
43
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -5,6 +5,7 @@ var rxjs = require('rxjs');
5
5
  var uiUtils = require('@ai-sdk/ui-utils');
6
6
  var zod = require('zod');
7
7
  var originalZodToJsonSchema = require('zod-to-json-schema');
8
+ var tools = require('@mastra/core/tools');
8
9
  var runtimeContext = require('@mastra/core/runtime-context');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -202,6 +203,33 @@ function zodToJsonSchema(zodSchema) {
202
203
  }
203
204
  return originalZodToJsonSchema__default.default(zodSchema, { $refStrategy: "none" });
204
205
  }
206
+ function processClientTools(clientTools) {
207
+ if (!clientTools) {
208
+ return void 0;
209
+ }
210
+ return Object.fromEntries(
211
+ Object.entries(clientTools).map(([key, value]) => {
212
+ if (tools.isVercelTool(value)) {
213
+ return [
214
+ key,
215
+ {
216
+ ...value,
217
+ parameters: value.parameters ? zodToJsonSchema(value.parameters) : void 0
218
+ }
219
+ ];
220
+ } else {
221
+ return [
222
+ key,
223
+ {
224
+ ...value,
225
+ inputSchema: value.inputSchema ? zodToJsonSchema(value.inputSchema) : void 0,
226
+ outputSchema: value.outputSchema ? zodToJsonSchema(value.outputSchema) : void 0
227
+ }
228
+ ];
229
+ }
230
+ })
231
+ );
232
+ }
205
233
 
206
234
  // src/resources/base.ts
207
235
  var BaseResource = class {
@@ -350,7 +378,8 @@ var Agent = class extends BaseResource {
350
378
  ...params,
351
379
  output: params.output ? zodToJsonSchema(params.output) : void 0,
352
380
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
353
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
381
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
382
+ clientTools: processClientTools(params.clientTools)
354
383
  };
355
384
  return this.request(`/api/agents/${this.agentId}/generate`, {
356
385
  method: "POST",
@@ -367,7 +396,8 @@ var Agent = class extends BaseResource {
367
396
  ...params,
368
397
  output: params.output ? zodToJsonSchema(params.output) : void 0,
369
398
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
370
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
399
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
400
+ clientTools: processClientTools(params.clientTools)
371
401
  };
372
402
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
373
403
  method: "POST",
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { processDataStream } from '@ai-sdk/ui-utils';
4
4
  import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
8
  import { BaseLogMessage } from '@mastra/core/logger';
9
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
10
  import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
@@ -51,13 +51,15 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
51
51
  output?: T;
52
52
  experimental_output?: T;
53
53
  runtimeContext?: RuntimeContext | Record<string, any>;
54
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
54
+ clientTools?: ToolsInput;
55
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
55
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
56
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
57
58
  output?: T;
58
59
  experimental_output?: T;
59
60
  runtimeContext?: RuntimeContext | Record<string, any>;
60
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
61
+ clientTools?: ToolsInput;
62
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
61
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
62
64
  evals: any[];
63
65
  instructions: string;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { processDataStream } from '@ai-sdk/ui-utils';
4
4
  import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
8
  import { BaseLogMessage } from '@mastra/core/logger';
9
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
10
  import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
@@ -51,13 +51,15 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
51
51
  output?: T;
52
52
  experimental_output?: T;
53
53
  runtimeContext?: RuntimeContext | Record<string, any>;
54
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
54
+ clientTools?: ToolsInput;
55
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
55
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
56
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
57
58
  output?: T;
58
59
  experimental_output?: T;
59
60
  runtimeContext?: RuntimeContext | Record<string, any>;
60
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
61
+ clientTools?: ToolsInput;
62
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
61
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
62
64
  evals: any[];
63
65
  instructions: string;
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { Observable } from 'rxjs';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
4
  import { ZodSchema } from 'zod';
5
5
  import originalZodToJsonSchema from 'zod-to-json-schema';
6
+ import { isVercelTool } from '@mastra/core/tools';
6
7
  import { RuntimeContext } from '@mastra/core/runtime-context';
7
8
 
8
9
  // src/adapters/agui.ts
@@ -196,6 +197,33 @@ function zodToJsonSchema(zodSchema) {
196
197
  }
197
198
  return originalZodToJsonSchema(zodSchema, { $refStrategy: "none" });
198
199
  }
200
+ function processClientTools(clientTools) {
201
+ if (!clientTools) {
202
+ return void 0;
203
+ }
204
+ return Object.fromEntries(
205
+ Object.entries(clientTools).map(([key, value]) => {
206
+ if (isVercelTool(value)) {
207
+ return [
208
+ key,
209
+ {
210
+ ...value,
211
+ parameters: value.parameters ? zodToJsonSchema(value.parameters) : void 0
212
+ }
213
+ ];
214
+ } else {
215
+ return [
216
+ key,
217
+ {
218
+ ...value,
219
+ inputSchema: value.inputSchema ? zodToJsonSchema(value.inputSchema) : void 0,
220
+ outputSchema: value.outputSchema ? zodToJsonSchema(value.outputSchema) : void 0
221
+ }
222
+ ];
223
+ }
224
+ })
225
+ );
226
+ }
199
227
 
200
228
  // src/resources/base.ts
201
229
  var BaseResource = class {
@@ -344,7 +372,8 @@ var Agent = class extends BaseResource {
344
372
  ...params,
345
373
  output: params.output ? zodToJsonSchema(params.output) : void 0,
346
374
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
347
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
375
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
376
+ clientTools: processClientTools(params.clientTools)
348
377
  };
349
378
  return this.request(`/api/agents/${this.agentId}/generate`, {
350
379
  method: "POST",
@@ -361,7 +390,8 @@ var Agent = class extends BaseResource {
361
390
  ...params,
362
391
  output: params.output ? zodToJsonSchema(params.output) : void 0,
363
392
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
364
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
393
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
394
+ clientTools: processClientTools(params.clientTools)
365
395
  };
366
396
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
367
397
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.10.2-alpha.2",
3
+ "version": "0.10.2",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "zod": "^3.0.0",
34
- "@mastra/core": "^0.10.0-alpha.0"
34
+ "@mastra/core": "^0.10.2-alpha.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@babel/preset-env": "^7.26.9",
@@ -42,8 +42,8 @@
42
42
  "tsup": "^8.4.0",
43
43
  "typescript": "^5.8.2",
44
44
  "vitest": "^3.1.2",
45
- "@internal/lint": "0.0.7",
46
- "@mastra/core": "0.10.2-alpha.4"
45
+ "@internal/lint": "0.0.8",
46
+ "@mastra/core": "0.10.2"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting",
@@ -1,8 +1,9 @@
1
1
  import { processDataStream } from '@ai-sdk/ui-utils';
2
- import type { GenerateReturn } from '@mastra/core';
2
+ import { type GenerateReturn } from '@mastra/core';
3
3
  import type { JSONSchema7 } from 'json-schema';
4
4
  import { ZodSchema } from 'zod';
5
5
  import { zodToJsonSchema } from '../utils/zod-to-json-schema';
6
+ import { processClientTools } from '../utils/process-client-tools';
6
7
 
7
8
  import type {
8
9
  GenerateParams,
@@ -112,6 +113,7 @@ export class Agent extends BaseResource {
112
113
  output: params.output ? zodToJsonSchema(params.output) : undefined,
113
114
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : undefined,
114
115
  runtimeContext: parseClientRuntimeContext(params.runtimeContext),
116
+ clientTools: processClientTools(params.clientTools),
115
117
  };
116
118
 
117
119
  return this.request(`/api/agents/${this.agentId}/generate`, {
@@ -137,6 +139,7 @@ export class Agent extends BaseResource {
137
139
  output: params.output ? zodToJsonSchema(params.output) : undefined,
138
140
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : undefined,
139
141
  runtimeContext: parseClientRuntimeContext(params.runtimeContext),
142
+ clientTools: processClientTools(params.clientTools),
140
143
  };
141
144
 
142
145
  const response: Response & {
package/src/types.ts CHANGED
@@ -7,7 +7,7 @@ import type {
7
7
  WorkflowRuns,
8
8
  LegacyWorkflowRuns,
9
9
  } from '@mastra/core';
10
- import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
10
+ import type { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
11
11
  import type { BaseLogMessage } from '@mastra/core/logger';
12
12
 
13
13
  import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
@@ -69,14 +69,16 @@ export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undef
69
69
  output?: T;
70
70
  experimental_output?: T;
71
71
  runtimeContext?: RuntimeContext | Record<string, any>;
72
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
72
+ clientTools?: ToolsInput;
73
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
73
74
 
74
75
  export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
75
76
  messages: string | string[] | CoreMessage[] | AiMessageType[];
76
77
  output?: T;
77
78
  experimental_output?: T;
78
79
  runtimeContext?: RuntimeContext | Record<string, any>;
79
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
80
+ clientTools?: ToolsInput;
81
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
80
82
 
81
83
  export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
82
84
  evals: any[];
@@ -0,0 +1,31 @@
1
+ import { isVercelTool } from '@mastra/core/tools';
2
+ import { zodToJsonSchema } from './zod-to-json-schema';
3
+
4
+ export function processClientTools(clientTools: Record<string, any> | undefined): Record<string, any> | undefined {
5
+ if (!clientTools) {
6
+ return undefined;
7
+ }
8
+
9
+ return Object.fromEntries(
10
+ Object.entries(clientTools).map(([key, value]) => {
11
+ if (isVercelTool(value)) {
12
+ return [
13
+ key,
14
+ {
15
+ ...value,
16
+ parameters: value.parameters ? zodToJsonSchema(value.parameters) : undefined,
17
+ },
18
+ ];
19
+ } else {
20
+ return [
21
+ key,
22
+ {
23
+ ...value,
24
+ inputSchema: value.inputSchema ? zodToJsonSchema(value.inputSchema) : undefined,
25
+ outputSchema: value.outputSchema ? zodToJsonSchema(value.outputSchema) : undefined,
26
+ },
27
+ ];
28
+ }
29
+ }),
30
+ ) as Record<string, any>;
31
+ }