@mastra/client-js 0.10.7-alpha.1 → 0.10.8-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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.10.7-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.10.8-alpha.0 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
- CJS dist/index.cjs 67.49 KB
13
- CJS ⚡️ Build success in 1909ms
14
- ESM dist/index.js 67.20 KB
15
- ESM ⚡️ Build success in 1910ms
12
+ ESM dist/index.js 67.94 KB
13
+ ESM ⚡️ Build success in 2540ms
14
+ CJS dist/index.cjs 68.23 KB
15
+ CJS ⚡️ Build success in 2546ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 15457ms
18
- DTS dist/index.d.ts 39.62 KB
19
- DTS dist/index.d.cts 39.62 KB
17
+ DTS ⚡️ Build success in 19041ms
18
+ DTS dist/index.d.ts 40.25 KB
19
+ DTS dist/index.d.cts 40.25 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.8-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 9047bda: clientTools - stream tool-result part
8
+ - a606c75: show right suspend schema for nested workflow on playground
9
+ - 1760a1c: Use workflow stream in playground instead of watch
10
+ - 038e5ae: Add cancel workflow run
11
+ - 7e801dd: Add tools to network api response
12
+ - Updated dependencies [9dda1ac]
13
+ - Updated dependencies [c984582]
14
+ - Updated dependencies [7e801dd]
15
+ - Updated dependencies [a606c75]
16
+ - Updated dependencies [7aa70a4]
17
+ - Updated dependencies [764f86a]
18
+ - Updated dependencies [1760a1c]
19
+ - Updated dependencies [038e5ae]
20
+ - Updated dependencies [7dda16a]
21
+ - Updated dependencies [5ebfcdd]
22
+ - Updated dependencies [b2d0c91]
23
+ - Updated dependencies [4e809ad]
24
+ - Updated dependencies [57929df]
25
+ - Updated dependencies [b7852ed]
26
+ - Updated dependencies [6320a61]
27
+ - @mastra/core@0.10.9-alpha.0
28
+
29
+ ## 0.10.7
30
+
31
+ ### Patch Changes
32
+
33
+ - a344ac7: Fix tool streaming in agent network
34
+ - Updated dependencies [b8f16b2]
35
+ - Updated dependencies [3e04487]
36
+ - Updated dependencies [a344ac7]
37
+ - Updated dependencies [dc4ca0a]
38
+ - @mastra/core@0.10.8
39
+
3
40
  ## 0.10.7-alpha.1
4
41
 
5
42
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -774,6 +774,19 @@ var Agent = class extends BaseResource {
774
774
  toolInvocation.state = "result";
775
775
  toolInvocation.result = result;
776
776
  }
777
+ const writer = writable.getWriter();
778
+ try {
779
+ await writer.write(
780
+ new TextEncoder().encode(
781
+ "a:" + JSON.stringify({
782
+ toolCallId: toolCall2.toolCallId,
783
+ result
784
+ }) + "\n"
785
+ )
786
+ );
787
+ } finally {
788
+ writer.releaseLock();
789
+ }
777
790
  const originalMessages = processedParams.messages;
778
791
  const messageArray = Array.isArray(originalMessages) ? originalMessages : [originalMessages];
779
792
  this.processStreamResponse(
@@ -1326,6 +1339,16 @@ var Workflow = class extends BaseResource {
1326
1339
  runExecutionResult(runId) {
1327
1340
  return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/execution-result`);
1328
1341
  }
1342
+ /**
1343
+ * Cancels a specific workflow run by its ID
1344
+ * @param runId - The ID of the workflow run to cancel
1345
+ * @returns Promise containing a success message
1346
+ */
1347
+ cancelRun(runId) {
1348
+ return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/cancel`, {
1349
+ method: "POST"
1350
+ });
1351
+ }
1329
1352
  /**
1330
1353
  * Creates a new workflow run
1331
1354
  * @param params - Optional object containing the optional runId
package/dist/index.d.cts CHANGED
@@ -114,6 +114,17 @@ interface GetWorkflowResponse {
114
114
  suspendSchema: string;
115
115
  };
116
116
  };
117
+ allSteps: {
118
+ [key: string]: {
119
+ id: string;
120
+ description: string;
121
+ inputSchema: string;
122
+ outputSchema: string;
123
+ resumeSchema: string;
124
+ suspendSchema: string;
125
+ isWorkflow: boolean;
126
+ };
127
+ };
117
128
  stepGraph: Workflow$1['serializedStepGraph'];
118
129
  inputSchema: string;
119
130
  outputSchema: string;
@@ -306,6 +317,10 @@ interface GetVNextNetworkResponse {
306
317
  inputSchema: string | undefined;
307
318
  outputSchema: string | undefined;
308
319
  }>;
320
+ tools: Array<{
321
+ id: string;
322
+ description: string;
323
+ }>;
309
324
  }
310
325
  interface GenerateVNextNetworkResponse {
311
326
  task: string;
@@ -703,6 +718,14 @@ declare class Workflow extends BaseResource {
703
718
  * @returns Promise containing the workflow run execution result
704
719
  */
705
720
  runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
721
+ /**
722
+ * Cancels a specific workflow run by its ID
723
+ * @param runId - The ID of the workflow run to cancel
724
+ * @returns Promise containing a success message
725
+ */
726
+ cancelRun(runId: string): Promise<{
727
+ message: string;
728
+ }>;
706
729
  /**
707
730
  * Creates a new workflow run
708
731
  * @param params - Optional object containing the optional runId
@@ -757,7 +780,10 @@ declare class Workflow extends BaseResource {
757
780
  runId?: string;
758
781
  inputData: Record<string, any>;
759
782
  runtimeContext?: RuntimeContext;
760
- }): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
783
+ }): Promise<stream_web.ReadableStream<{
784
+ type: string;
785
+ payload: any;
786
+ }>>;
761
787
  /**
762
788
  * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
763
789
  * @param params - Object containing the runId, step, resumeData and runtimeContext
package/dist/index.d.ts CHANGED
@@ -114,6 +114,17 @@ interface GetWorkflowResponse {
114
114
  suspendSchema: string;
115
115
  };
116
116
  };
117
+ allSteps: {
118
+ [key: string]: {
119
+ id: string;
120
+ description: string;
121
+ inputSchema: string;
122
+ outputSchema: string;
123
+ resumeSchema: string;
124
+ suspendSchema: string;
125
+ isWorkflow: boolean;
126
+ };
127
+ };
117
128
  stepGraph: Workflow$1['serializedStepGraph'];
118
129
  inputSchema: string;
119
130
  outputSchema: string;
@@ -306,6 +317,10 @@ interface GetVNextNetworkResponse {
306
317
  inputSchema: string | undefined;
307
318
  outputSchema: string | undefined;
308
319
  }>;
320
+ tools: Array<{
321
+ id: string;
322
+ description: string;
323
+ }>;
309
324
  }
310
325
  interface GenerateVNextNetworkResponse {
311
326
  task: string;
@@ -703,6 +718,14 @@ declare class Workflow extends BaseResource {
703
718
  * @returns Promise containing the workflow run execution result
704
719
  */
705
720
  runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
721
+ /**
722
+ * Cancels a specific workflow run by its ID
723
+ * @param runId - The ID of the workflow run to cancel
724
+ * @returns Promise containing a success message
725
+ */
726
+ cancelRun(runId: string): Promise<{
727
+ message: string;
728
+ }>;
706
729
  /**
707
730
  * Creates a new workflow run
708
731
  * @param params - Optional object containing the optional runId
@@ -757,7 +780,10 @@ declare class Workflow extends BaseResource {
757
780
  runId?: string;
758
781
  inputData: Record<string, any>;
759
782
  runtimeContext?: RuntimeContext;
760
- }): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
783
+ }): Promise<stream_web.ReadableStream<{
784
+ type: string;
785
+ payload: any;
786
+ }>>;
761
787
  /**
762
788
  * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
763
789
  * @param params - Object containing the runId, step, resumeData and runtimeContext
package/dist/index.js CHANGED
@@ -768,6 +768,19 @@ var Agent = class extends BaseResource {
768
768
  toolInvocation.state = "result";
769
769
  toolInvocation.result = result;
770
770
  }
771
+ const writer = writable.getWriter();
772
+ try {
773
+ await writer.write(
774
+ new TextEncoder().encode(
775
+ "a:" + JSON.stringify({
776
+ toolCallId: toolCall2.toolCallId,
777
+ result
778
+ }) + "\n"
779
+ )
780
+ );
781
+ } finally {
782
+ writer.releaseLock();
783
+ }
771
784
  const originalMessages = processedParams.messages;
772
785
  const messageArray = Array.isArray(originalMessages) ? originalMessages : [originalMessages];
773
786
  this.processStreamResponse(
@@ -1320,6 +1333,16 @@ var Workflow = class extends BaseResource {
1320
1333
  runExecutionResult(runId) {
1321
1334
  return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/execution-result`);
1322
1335
  }
1336
+ /**
1337
+ * Cancels a specific workflow run by its ID
1338
+ * @param runId - The ID of the workflow run to cancel
1339
+ * @returns Promise containing a success message
1340
+ */
1341
+ cancelRun(runId) {
1342
+ return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/cancel`, {
1343
+ method: "POST"
1344
+ });
1345
+ }
1323
1346
  /**
1324
1347
  * Creates a new workflow run
1325
1348
  * @param params - Optional object containing the optional runId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.10.7-alpha.1",
3
+ "version": "0.10.8-alpha.0",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "rxjs": "7.8.1",
34
34
  "zod": "^3.25.67",
35
35
  "zod-to-json-schema": "^3.24.5",
36
- "@mastra/core": "0.10.8-alpha.1"
36
+ "@mastra/core": "0.10.9-alpha.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "zod": "^3.0.0"
@@ -46,8 +46,8 @@
46
46
  "@types/node": "^20.19.0",
47
47
  "tsup": "^8.5.0",
48
48
  "typescript": "^5.8.3",
49
- "vitest": "^3.2.3",
50
- "@internal/lint": "0.0.14"
49
+ "vitest": "^3.2.4",
50
+ "@internal/lint": "0.0.15"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting",
@@ -673,6 +673,24 @@ export class Agent extends BaseResource {
673
673
  toolInvocation.result = result;
674
674
  }
675
675
 
676
+ // write the tool result part to the stream
677
+ const writer = writable.getWriter();
678
+
679
+ try {
680
+ await writer.write(
681
+ new TextEncoder().encode(
682
+ 'a:' +
683
+ JSON.stringify({
684
+ toolCallId: toolCall.toolCallId,
685
+ result,
686
+ }) +
687
+ '\n',
688
+ ),
689
+ );
690
+ } finally {
691
+ writer.releaseLock();
692
+ }
693
+
676
694
  // Convert messages to the correct format for the recursive call
677
695
  const originalMessages = processedParams.messages;
678
696
  const messageArray = Array.isArray(originalMessages) ? originalMessages : [originalMessages];
@@ -150,6 +150,17 @@ export class Workflow extends BaseResource {
150
150
  return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/execution-result`);
151
151
  }
152
152
 
153
+ /**
154
+ * Cancels a specific workflow run by its ID
155
+ * @param runId - The ID of the workflow run to cancel
156
+ * @returns Promise containing a success message
157
+ */
158
+ cancelRun(runId: string): Promise<{ message: string }> {
159
+ return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/cancel`, {
160
+ method: 'POST',
161
+ });
162
+ }
163
+
153
164
  /**
154
165
  * Creates a new workflow run
155
166
  * @param params - Optional object containing the optional runId
@@ -267,7 +278,7 @@ export class Workflow extends BaseResource {
267
278
  }
268
279
 
269
280
  // Create a transform stream that processes the response body
270
- const transformStream = new TransformStream<ArrayBuffer, WorkflowWatchResult>({
281
+ const transformStream = new TransformStream<ArrayBuffer, { type: string; payload: any }>({
271
282
  start() {},
272
283
  async transform(chunk, controller) {
273
284
  try {
package/src/types.ts CHANGED
@@ -140,6 +140,17 @@ export interface GetWorkflowResponse {
140
140
  suspendSchema: string;
141
141
  };
142
142
  };
143
+ allSteps: {
144
+ [key: string]: {
145
+ id: string;
146
+ description: string;
147
+ inputSchema: string;
148
+ outputSchema: string;
149
+ resumeSchema: string;
150
+ suspendSchema: string;
151
+ isWorkflow: boolean;
152
+ };
153
+ };
143
154
  stepGraph: Workflow['serializedStepGraph'];
144
155
  inputSchema: string;
145
156
  outputSchema: string;
@@ -358,6 +369,10 @@ export interface GetVNextNetworkResponse {
358
369
  inputSchema: string | undefined;
359
370
  outputSchema: string | undefined;
360
371
  }>;
372
+ tools: Array<{
373
+ id: string;
374
+ description: string;
375
+ }>;
361
376
  }
362
377
 
363
378
  export interface GenerateVNextNetworkResponse {