@mastra/client-js 0.16.16-alpha.0 → 0.17.0-alpha.1

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,83 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.17.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 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))
8
+
9
+ You can now pass a custom fetch function when creating a MastraClient:
10
+
11
+ ```typescript
12
+ import { MastraClient } from '@mastra/client-js';
13
+
14
+ // Before: Only global fetch was available
15
+ const client = new MastraClient({
16
+ baseUrl: 'http://your-api-url',
17
+ });
18
+
19
+ // After: Custom fetch can be passed
20
+ const client = new MastraClient({
21
+ baseUrl: 'http://your-api-url',
22
+ fetch: customFetch, // Your custom fetch implementation
23
+ });
24
+ ```
25
+
26
+ If no custom fetch is provided, it falls back to the global fetch function, maintaining backward compatibility.
27
+
28
+ Fixes #10673
29
+
30
+ ### Patch Changes
31
+
32
+ - Add timeTravel APIs and add timeTravel feature to studio ([#10757](https://github.com/mastra-ai/mastra/pull/10757))
33
+
34
+ - feat: Add partial response support for agent and workflow list endpoints ([#10906](https://github.com/mastra-ai/mastra/pull/10906))
35
+
36
+ Add optional `partial` query parameter to `/api/agents` and `/api/workflows` endpoints to return minimal data without schemas, reducing payload size for list views:
37
+ - When `partial=true`: tool schemas (inputSchema, outputSchema) are omitted
38
+ - When `partial=true`: workflow steps are replaced with stepCount integer
39
+ - When `partial=true`: workflow root schemas (inputSchema, outputSchema) are omitted
40
+ - Maintains backward compatibility when partial parameter is not provided
41
+
42
+ ## Server Endpoint Usage
43
+
44
+ ```http
45
+ # Get partial agent data (no tool schemas)
46
+ GET /api/agents?partial=true
47
+
48
+ # Get full agent data (default behavior)
49
+ GET /api/agents
50
+
51
+ # Get partial workflow data (stepCount instead of steps, no schemas)
52
+ GET /api/workflows?partial=true
53
+
54
+ # Get full workflow data (default behavior)
55
+ GET /api/workflows
56
+ ```
57
+
58
+ ## Client SDK Usage
59
+
60
+ ```typescript
61
+ import { MastraClient } from '@mastra/client-js';
62
+
63
+ const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
64
+
65
+ // Get partial agent list (smaller payload)
66
+ const partialAgents = await client.listAgents({ partial: true });
67
+
68
+ // Get full agent list with tool schemas
69
+ const fullAgents = await client.listAgents();
70
+
71
+ // Get partial workflow list (smaller payload)
72
+ const partialWorkflows = await client.listWorkflows({ partial: true });
73
+
74
+ // Get full workflow list with steps and schemas
75
+ const fullWorkflows = await client.listWorkflows();
76
+ ```
77
+
78
+ - 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)]:
79
+ - @mastra/core@0.24.7-alpha.1
80
+
3
81
  ## 0.16.16-alpha.0
4
82
 
5
83
  ### 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,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gB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAenF;;;;OAIG;IACI,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAiBzF;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOrE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAInD,WAAW,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIvE,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI1E,KAAK,CAAC,MAAM,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACtD,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAGjD"}
package/dist/index.cjs CHANGED
@@ -150,11 +150,20 @@ var BaseResource = class {
150
150
  */
151
151
  async request(path, options = {}) {
152
152
  let lastError = null;
153
- const { baseUrl, retries = 3, backoffMs = 100, maxBackoffMs = 1e3, headers = {}, credentials } = this.options;
153
+ const {
154
+ baseUrl,
155
+ retries = 3,
156
+ backoffMs = 100,
157
+ maxBackoffMs = 1e3,
158
+ headers = {},
159
+ credentials,
160
+ fetch: customFetch
161
+ } = this.options;
162
+ const fetchFn = customFetch || fetch;
154
163
  let delay = backoffMs;
155
164
  for (let attempt = 0; attempt <= retries; attempt++) {
156
165
  try {
157
- const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
166
+ const response = await fetchFn(`${baseUrl.replace(/\/$/, "")}${path}`, {
158
167
  ...options,
159
168
  headers: {
160
169
  ...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
@@ -2217,6 +2226,142 @@ var Workflow = class extends BaseResource {
2217
2226
  }
2218
2227
  });
2219
2228
  }
2229
+ /**
2230
+ * Restarts an active workflow run synchronously without waiting for the workflow to complete
2231
+ * @param params - Object containing the runId and runtimeContext
2232
+ * @returns Promise containing success message
2233
+ */
2234
+ restart(params) {
2235
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
2236
+ return this.request(`/api/workflows/${this.workflowId}/restart?runId=${params.runId}`, {
2237
+ method: "POST",
2238
+ body: {
2239
+ runtimeContext,
2240
+ tracingOptions: params.tracingOptions
2241
+ }
2242
+ });
2243
+ }
2244
+ /**
2245
+ * Restarts an active workflow run asynchronously
2246
+ * @param params - Object containing the runId and runtimeContext
2247
+ * @returns Promise containing the workflow restart results
2248
+ */
2249
+ restartAsync(params) {
2250
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
2251
+ return this.request(`/api/workflows/${this.workflowId}/restart-async?runId=${params.runId}`, {
2252
+ method: "POST",
2253
+ body: {
2254
+ runtimeContext,
2255
+ tracingOptions: params.tracingOptions
2256
+ }
2257
+ });
2258
+ }
2259
+ /**
2260
+ * Restart all active workflow runs synchronously without waiting for the workflow to complete
2261
+ * @returns Promise containing success message
2262
+ */
2263
+ restartAllActiveWorkflowRuns() {
2264
+ return this.request(`/api/workflows/${this.workflowId}/restart-all-active-workflow-runs`, {
2265
+ method: "POST"
2266
+ });
2267
+ }
2268
+ /**
2269
+ * Restart all active workflow runs asynchronously
2270
+ * @returns Promise containing success message
2271
+ */
2272
+ restartAllActiveWorkflowRunsAsync() {
2273
+ return this.request(`/api/workflows/${this.workflowId}/restart-all-active-workflow-runs-async`, {
2274
+ method: "POST"
2275
+ });
2276
+ }
2277
+ /**
2278
+ * Time travels a workflow run synchronously without waiting for the workflow to complete
2279
+ * @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, runtimeContext and tracingOptions
2280
+ * @returns Promise containing success message
2281
+ */
2282
+ timeTravel({
2283
+ runId,
2284
+ runtimeContext: paramsRuntimeContext,
2285
+ ...params
2286
+ }) {
2287
+ const runtimeContext = parseClientRuntimeContext(paramsRuntimeContext);
2288
+ return this.request(`/api/workflows/${this.workflowId}/time-travel?runId=${runId}`, {
2289
+ method: "POST",
2290
+ body: {
2291
+ ...params,
2292
+ runtimeContext
2293
+ }
2294
+ });
2295
+ }
2296
+ /**
2297
+ * Time travels a workflow run asynchronously
2298
+ * @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, runtimeContext and tracingOptions
2299
+ * @returns Promise containing the workflow time travel results
2300
+ */
2301
+ timeTravelAsync({
2302
+ runId,
2303
+ runtimeContext: paramsRuntimeContext,
2304
+ ...params
2305
+ }) {
2306
+ const runtimeContext = parseClientRuntimeContext(paramsRuntimeContext);
2307
+ return this.request(`/api/workflows/${this.workflowId}/time-travel-async?runId=${runId}`, {
2308
+ method: "POST",
2309
+ body: {
2310
+ ...params,
2311
+ runtimeContext
2312
+ }
2313
+ });
2314
+ }
2315
+ /**
2316
+ * Time travels a workflow run and returns a stream
2317
+ * @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, runtimeContext and tracingOptions
2318
+ * @returns Promise containing the workflow execution results
2319
+ */
2320
+ async timeTravelStream({ runId, runtimeContext: paramsRuntimeContext, ...params }) {
2321
+ const runtimeContext = parseClientRuntimeContext(paramsRuntimeContext);
2322
+ const response = await this.request(
2323
+ `/api/workflows/${this.workflowId}/time-travel-stream?runId=${runId}`,
2324
+ {
2325
+ method: "POST",
2326
+ body: {
2327
+ ...params,
2328
+ runtimeContext
2329
+ },
2330
+ stream: true
2331
+ }
2332
+ );
2333
+ if (!response.ok) {
2334
+ throw new Error(`Failed to time travel workflow: ${response.statusText}`);
2335
+ }
2336
+ if (!response.body) {
2337
+ throw new Error("Response body is null");
2338
+ }
2339
+ let failedChunk = void 0;
2340
+ const transformStream = new TransformStream({
2341
+ start() {
2342
+ },
2343
+ async transform(chunk, controller) {
2344
+ try {
2345
+ const decoded = new TextDecoder().decode(chunk);
2346
+ const chunks = decoded.split(RECORD_SEPARATOR);
2347
+ for (const chunk2 of chunks) {
2348
+ if (chunk2) {
2349
+ const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
2350
+ try {
2351
+ const parsedChunk = JSON.parse(newChunk);
2352
+ controller.enqueue(parsedChunk);
2353
+ failedChunk = void 0;
2354
+ } catch {
2355
+ failedChunk = newChunk;
2356
+ }
2357
+ }
2358
+ }
2359
+ } catch {
2360
+ }
2361
+ }
2362
+ });
2363
+ return response.body.pipeThrough(transformStream);
2364
+ }
2220
2365
  };
2221
2366
 
2222
2367
  // src/resources/a2a.ts
@@ -2847,14 +2992,18 @@ var MastraClient = class extends BaseResource {
2847
2992
  /**
2848
2993
  * Retrieves all available agents
2849
2994
  * @param runtimeContext - Optional runtime context to pass as query parameter
2995
+ * @param partial - Optional flag to return minimal data without schemas
2850
2996
  * @returns Promise containing map of agent IDs to agent details
2851
2997
  */
2852
- getAgents(runtimeContext) {
2998
+ getAgents(runtimeContext, partial) {
2853
2999
  const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
2854
3000
  const searchParams = new URLSearchParams();
2855
3001
  if (runtimeContextParam) {
2856
3002
  searchParams.set("runtimeContext", runtimeContextParam);
2857
3003
  }
3004
+ if (partial) {
3005
+ searchParams.set("partial", "true");
3006
+ }
2858
3007
  const queryString = searchParams.toString();
2859
3008
  return this.request(`/api/agents${queryString ? `?${queryString}` : ""}`);
2860
3009
  }
@@ -3013,14 +3162,18 @@ var MastraClient = class extends BaseResource {
3013
3162
  /**
3014
3163
  * Retrieves all available workflows
3015
3164
  * @param runtimeContext - Optional runtime context to pass as query parameter
3165
+ * @param partial - Optional flag to return minimal data without schemas
3016
3166
  * @returns Promise containing map of workflow IDs to workflow details
3017
3167
  */
3018
- getWorkflows(runtimeContext) {
3168
+ getWorkflows(runtimeContext, partial) {
3019
3169
  const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
3020
3170
  const searchParams = new URLSearchParams();
3021
3171
  if (runtimeContextParam) {
3022
3172
  searchParams.set("runtimeContext", runtimeContextParam);
3023
3173
  }
3174
+ if (partial) {
3175
+ searchParams.set("partial", "true");
3176
+ }
3024
3177
  const queryString = searchParams.toString();
3025
3178
  return this.request(`/api/workflows${queryString ? `?${queryString}` : ""}`);
3026
3179
  }