@mastra/client-js 0.16.16-alpha.0 → 0.17.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,96 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.17.0-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - The client-js package had its own simpler zodToJsonSchema implementation that was missing critical features from schema-compat. This could cause issues when users pass Zod schemas with `z.record()` or `z.date()` through the MastraClient. ([#10925](https://github.com/mastra-ai/mastra/pull/10925))
8
+
9
+ Now the client uses the same implementation as the rest of the codebase, which includes the Zod v4 `z.record()` bug fix, date-time format conversion for `z.date()`, and proper handling of unrepresentable types.
10
+
11
+ Also removes the now-unused `zod-to-json-schema` dependency from client-js.
12
+
13
+ - Updated dependencies [[`b685c9c`](https://github.com/mastra-ai/mastra/commit/b685c9c0b89f49e0d4542c4ac72569682db69794)]:
14
+ - @mastra/core@0.24.7-alpha.2
15
+
16
+ ## 0.17.0-alpha.1
17
+
18
+ ### Minor Changes
19
+
20
+ - Add support for custom fetch function in MastraClient to enable environments like Tauri that require custom fetch implementations to avoid timeout errors. ([#10679](https://github.com/mastra-ai/mastra/pull/10679))
21
+
22
+ You can now pass a custom fetch function when creating a MastraClient:
23
+
24
+ ```typescript
25
+ import { MastraClient } from '@mastra/client-js';
26
+
27
+ // Before: Only global fetch was available
28
+ const client = new MastraClient({
29
+ baseUrl: 'http://your-api-url',
30
+ });
31
+
32
+ // After: Custom fetch can be passed
33
+ const client = new MastraClient({
34
+ baseUrl: 'http://your-api-url',
35
+ fetch: customFetch, // Your custom fetch implementation
36
+ });
37
+ ```
38
+
39
+ If no custom fetch is provided, it falls back to the global fetch function, maintaining backward compatibility.
40
+
41
+ Fixes #10673
42
+
43
+ ### Patch Changes
44
+
45
+ - Add timeTravel APIs and add timeTravel feature to studio ([#10757](https://github.com/mastra-ai/mastra/pull/10757))
46
+
47
+ - feat: Add partial response support for agent and workflow list endpoints ([#10906](https://github.com/mastra-ai/mastra/pull/10906))
48
+
49
+ Add optional `partial` query parameter to `/api/agents` and `/api/workflows` endpoints to return minimal data without schemas, reducing payload size for list views:
50
+ - When `partial=true`: tool schemas (inputSchema, outputSchema) are omitted
51
+ - When `partial=true`: workflow steps are replaced with stepCount integer
52
+ - When `partial=true`: workflow root schemas (inputSchema, outputSchema) are omitted
53
+ - Maintains backward compatibility when partial parameter is not provided
54
+
55
+ ## Server Endpoint Usage
56
+
57
+ ```http
58
+ # Get partial agent data (no tool schemas)
59
+ GET /api/agents?partial=true
60
+
61
+ # Get full agent data (default behavior)
62
+ GET /api/agents
63
+
64
+ # Get partial workflow data (stepCount instead of steps, no schemas)
65
+ GET /api/workflows?partial=true
66
+
67
+ # Get full workflow data (default behavior)
68
+ GET /api/workflows
69
+ ```
70
+
71
+ ## Client SDK Usage
72
+
73
+ ```typescript
74
+ import { MastraClient } from '@mastra/client-js';
75
+
76
+ const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
77
+
78
+ // Get partial agent list (smaller payload)
79
+ const partialAgents = await client.listAgents({ partial: true });
80
+
81
+ // Get full agent list with tool schemas
82
+ const fullAgents = await client.listAgents();
83
+
84
+ // Get partial workflow list (smaller payload)
85
+ const partialWorkflows = await client.listWorkflows({ partial: true });
86
+
87
+ // Get full workflow list with steps and schemas
88
+ const fullWorkflows = await client.listWorkflows();
89
+ ```
90
+
91
+ - Updated dependencies [[`5cc85aa`](https://github.com/mastra-ai/mastra/commit/5cc85aa4329773cac8314f3aa0146227b6b158e4), [`c53f8e6`](https://github.com/mastra-ai/mastra/commit/c53f8e68df42464935f9a63eb0fc765a65aacb83), [`386ab43`](https://github.com/mastra-ai/mastra/commit/386ab4350cf2a814fb4ac0a5fc6983ca93158ffe), [`2b62302`](https://github.com/mastra-ai/mastra/commit/2b623027a9d65c1dbc963bf651e9e6a9d09da1fa), [`7d85da4`](https://github.com/mastra-ai/mastra/commit/7d85da42a5fab56009a959a9c20328558d14f4b5), [`3d7c5bd`](https://github.com/mastra-ai/mastra/commit/3d7c5bdbee1b2693cd45bf207b960dd9b7277680), [`31b381e`](https://github.com/mastra-ai/mastra/commit/31b381efb48e031c0ecc46bc6e410ae6e67b88e5), [`e77a5f9`](https://github.com/mastra-ai/mastra/commit/e77a5f9718dc418e29e3c8a389299ed6dc0a6401), [`b069af5`](https://github.com/mastra-ai/mastra/commit/b069af514c4dcfc4fdcb164303569bfff1c26e3d), [`7dc8304`](https://github.com/mastra-ai/mastra/commit/7dc830420296db516b86dcec663e54d0309b8fb8), [`6942109`](https://github.com/mastra-ai/mastra/commit/694210903c70e3c26b5ce8ca4f4637ca2d9eb369), [`62d13f4`](https://github.com/mastra-ai/mastra/commit/62d13f4d1db1c16742831f210fe4c2caf8a26d57), [`358ab98`](https://github.com/mastra-ai/mastra/commit/358ab98024c388e383aca15616e8988bf4a5b66e)]:
92
+ - @mastra/core@0.24.7-alpha.1
93
+
3
94
  ## 0.16.16-alpha.0
4
95
 
5
96
  ### Patch Changes
package/dist/client.d.ts CHANGED
@@ -10,9 +10,10 @@ export declare class MastraClient extends BaseResource {
10
10
  /**
11
11
  * Retrieves all available agents
12
12
  * @param runtimeContext - Optional runtime context to pass as query parameter
13
+ * @param partial - Optional flag to return minimal data without schemas
13
14
  * @returns Promise containing map of agent IDs to agent details
14
15
  */
15
- getAgents(runtimeContext?: RuntimeContext | Record<string, any>): Promise<Record<string, GetAgentResponse>>;
16
+ getAgents(runtimeContext?: RuntimeContext | Record<string, any>, partial?: boolean): Promise<Record<string, GetAgentResponse>>;
16
17
  /**
17
18
  * Gets an agent instance by ID
18
19
  * @param agentId - ID of the agent to retrieve
@@ -117,9 +118,10 @@ export declare class MastraClient extends BaseResource {
117
118
  /**
118
119
  * Retrieves all available workflows
119
120
  * @param runtimeContext - Optional runtime context to pass as query parameter
121
+ * @param partial - Optional flag to return minimal data without schemas
120
122
  * @returns Promise containing map of workflow IDs to workflow details
121
123
  */
122
- getWorkflows(runtimeContext?: RuntimeContext | Record<string, any>): Promise<Record<string, GetWorkflowResponse>>;
124
+ getWorkflows(runtimeContext?: RuntimeContext | Record<string, any>, partial?: boolean): Promise<Record<string, GetWorkflowResponse>>;
123
125
  /**
124
126
  * Gets a workflow instance by ID
125
127
  * @param workflowId - ID of the workflow to retrieve
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,GAAG,EACH,OAAO,EACP,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,+BAA+B,EAC/B,gCAAgC,EAChC,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,CAAC,aAAa,CAAgB;gBAC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
5
5
  var error = require('@mastra/core/error');
6
6
  var runtimeContext = require('@mastra/core/runtime-context');
7
7
  var isVercelTool = require('@mastra/core/tools/is-vercel-tool');
8
- var zod = require('zod');
9
- var originalZodToJsonSchema = require('zod-to-json-schema');
10
-
11
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
-
13
- var originalZodToJsonSchema__default = /*#__PURE__*/_interopDefault(originalZodToJsonSchema);
8
+ var zodToJson = require('@mastra/schema-compat/zod-to-json');
14
9
 
15
10
  // src/resources/agent.ts
16
11
  function parseClientRuntimeContext(runtimeContext$1) {
@@ -43,11 +38,7 @@ function zodToJsonSchema(zodSchema) {
43
38
  if (!isZodType(zodSchema)) {
44
39
  return zodSchema;
45
40
  }
46
- if ("toJSONSchema" in zod.z) {
47
- const fn = "toJSONSchema";
48
- return zod.z[fn].call(zod.z, zodSchema);
49
- }
50
- return originalZodToJsonSchema__default.default(zodSchema, { $refStrategy: "relative" });
41
+ return zodToJson.zodToJsonSchema(zodSchema);
51
42
  }
52
43
 
53
44
  // src/utils/process-client-tools.ts
@@ -150,11 +141,20 @@ var BaseResource = class {
150
141
  */
151
142
  async request(path, options = {}) {
152
143
  let lastError = null;
153
- const { baseUrl, retries = 3, backoffMs = 100, maxBackoffMs = 1e3, headers = {}, credentials } = this.options;
144
+ const {
145
+ baseUrl,
146
+ retries = 3,
147
+ backoffMs = 100,
148
+ maxBackoffMs = 1e3,
149
+ headers = {},
150
+ credentials,
151
+ fetch: customFetch
152
+ } = this.options;
153
+ const fetchFn = customFetch || fetch;
154
154
  let delay = backoffMs;
155
155
  for (let attempt = 0; attempt <= retries; attempt++) {
156
156
  try {
157
- const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
157
+ const response = await fetchFn(`${baseUrl.replace(/\/$/, "")}${path}`, {
158
158
  ...options,
159
159
  headers: {
160
160
  ...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
@@ -2217,6 +2217,142 @@ var Workflow = class extends BaseResource {
2217
2217
  }
2218
2218
  });
2219
2219
  }
2220
+ /**
2221
+ * Restarts an active workflow run synchronously without waiting for the workflow to complete
2222
+ * @param params - Object containing the runId and runtimeContext
2223
+ * @returns Promise containing success message
2224
+ */
2225
+ restart(params) {
2226
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
2227
+ return this.request(`/api/workflows/${this.workflowId}/restart?runId=${params.runId}`, {
2228
+ method: "POST",
2229
+ body: {
2230
+ runtimeContext,
2231
+ tracingOptions: params.tracingOptions
2232
+ }
2233
+ });
2234
+ }
2235
+ /**
2236
+ * Restarts an active workflow run asynchronously
2237
+ * @param params - Object containing the runId and runtimeContext
2238
+ * @returns Promise containing the workflow restart results
2239
+ */
2240
+ restartAsync(params) {
2241
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
2242
+ return this.request(`/api/workflows/${this.workflowId}/restart-async?runId=${params.runId}`, {
2243
+ method: "POST",
2244
+ body: {
2245
+ runtimeContext,
2246
+ tracingOptions: params.tracingOptions
2247
+ }
2248
+ });
2249
+ }
2250
+ /**
2251
+ * Restart all active workflow runs synchronously without waiting for the workflow to complete
2252
+ * @returns Promise containing success message
2253
+ */
2254
+ restartAllActiveWorkflowRuns() {
2255
+ return this.request(`/api/workflows/${this.workflowId}/restart-all-active-workflow-runs`, {
2256
+ method: "POST"
2257
+ });
2258
+ }
2259
+ /**
2260
+ * Restart all active workflow runs asynchronously
2261
+ * @returns Promise containing success message
2262
+ */
2263
+ restartAllActiveWorkflowRunsAsync() {
2264
+ return this.request(`/api/workflows/${this.workflowId}/restart-all-active-workflow-runs-async`, {
2265
+ method: "POST"
2266
+ });
2267
+ }
2268
+ /**
2269
+ * Time travels a workflow run synchronously without waiting for the workflow to complete
2270
+ * @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, runtimeContext and tracingOptions
2271
+ * @returns Promise containing success message
2272
+ */
2273
+ timeTravel({
2274
+ runId,
2275
+ runtimeContext: paramsRuntimeContext,
2276
+ ...params
2277
+ }) {
2278
+ const runtimeContext = parseClientRuntimeContext(paramsRuntimeContext);
2279
+ return this.request(`/api/workflows/${this.workflowId}/time-travel?runId=${runId}`, {
2280
+ method: "POST",
2281
+ body: {
2282
+ ...params,
2283
+ runtimeContext
2284
+ }
2285
+ });
2286
+ }
2287
+ /**
2288
+ * Time travels a workflow run asynchronously
2289
+ * @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, runtimeContext and tracingOptions
2290
+ * @returns Promise containing the workflow time travel results
2291
+ */
2292
+ timeTravelAsync({
2293
+ runId,
2294
+ runtimeContext: paramsRuntimeContext,
2295
+ ...params
2296
+ }) {
2297
+ const runtimeContext = parseClientRuntimeContext(paramsRuntimeContext);
2298
+ return this.request(`/api/workflows/${this.workflowId}/time-travel-async?runId=${runId}`, {
2299
+ method: "POST",
2300
+ body: {
2301
+ ...params,
2302
+ runtimeContext
2303
+ }
2304
+ });
2305
+ }
2306
+ /**
2307
+ * Time travels a workflow run and returns a stream
2308
+ * @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, runtimeContext and tracingOptions
2309
+ * @returns Promise containing the workflow execution results
2310
+ */
2311
+ async timeTravelStream({ runId, runtimeContext: paramsRuntimeContext, ...params }) {
2312
+ const runtimeContext = parseClientRuntimeContext(paramsRuntimeContext);
2313
+ const response = await this.request(
2314
+ `/api/workflows/${this.workflowId}/time-travel-stream?runId=${runId}`,
2315
+ {
2316
+ method: "POST",
2317
+ body: {
2318
+ ...params,
2319
+ runtimeContext
2320
+ },
2321
+ stream: true
2322
+ }
2323
+ );
2324
+ if (!response.ok) {
2325
+ throw new Error(`Failed to time travel workflow: ${response.statusText}`);
2326
+ }
2327
+ if (!response.body) {
2328
+ throw new Error("Response body is null");
2329
+ }
2330
+ let failedChunk = void 0;
2331
+ const transformStream = new TransformStream({
2332
+ start() {
2333
+ },
2334
+ async transform(chunk, controller) {
2335
+ try {
2336
+ const decoded = new TextDecoder().decode(chunk);
2337
+ const chunks = decoded.split(RECORD_SEPARATOR);
2338
+ for (const chunk2 of chunks) {
2339
+ if (chunk2) {
2340
+ const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
2341
+ try {
2342
+ const parsedChunk = JSON.parse(newChunk);
2343
+ controller.enqueue(parsedChunk);
2344
+ failedChunk = void 0;
2345
+ } catch {
2346
+ failedChunk = newChunk;
2347
+ }
2348
+ }
2349
+ }
2350
+ } catch {
2351
+ }
2352
+ }
2353
+ });
2354
+ return response.body.pipeThrough(transformStream);
2355
+ }
2220
2356
  };
2221
2357
 
2222
2358
  // src/resources/a2a.ts
@@ -2847,14 +2983,18 @@ var MastraClient = class extends BaseResource {
2847
2983
  /**
2848
2984
  * Retrieves all available agents
2849
2985
  * @param runtimeContext - Optional runtime context to pass as query parameter
2986
+ * @param partial - Optional flag to return minimal data without schemas
2850
2987
  * @returns Promise containing map of agent IDs to agent details
2851
2988
  */
2852
- getAgents(runtimeContext) {
2989
+ getAgents(runtimeContext, partial) {
2853
2990
  const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
2854
2991
  const searchParams = new URLSearchParams();
2855
2992
  if (runtimeContextParam) {
2856
2993
  searchParams.set("runtimeContext", runtimeContextParam);
2857
2994
  }
2995
+ if (partial) {
2996
+ searchParams.set("partial", "true");
2997
+ }
2858
2998
  const queryString = searchParams.toString();
2859
2999
  return this.request(`/api/agents${queryString ? `?${queryString}` : ""}`);
2860
3000
  }
@@ -3013,14 +3153,18 @@ var MastraClient = class extends BaseResource {
3013
3153
  /**
3014
3154
  * Retrieves all available workflows
3015
3155
  * @param runtimeContext - Optional runtime context to pass as query parameter
3156
+ * @param partial - Optional flag to return minimal data without schemas
3016
3157
  * @returns Promise containing map of workflow IDs to workflow details
3017
3158
  */
3018
- getWorkflows(runtimeContext) {
3159
+ getWorkflows(runtimeContext, partial) {
3019
3160
  const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
3020
3161
  const searchParams = new URLSearchParams();
3021
3162
  if (runtimeContextParam) {
3022
3163
  searchParams.set("runtimeContext", runtimeContextParam);
3023
3164
  }
3165
+ if (partial) {
3166
+ searchParams.set("partial", "true");
3167
+ }
3024
3168
  const queryString = searchParams.toString();
3025
3169
  return this.request(`/api/workflows${queryString ? `?${queryString}` : ""}`);
3026
3170
  }