@mastra/client-js 0.0.0-tool-call-parts-20250630193309 → 0.0.0-tsconfig-compile-20250703214351

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 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.10.9 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 67.20 KB
13
- ESM ⚡️ Build success in 2103ms
14
- CJS dist/index.cjs 67.49 KB
15
- CJS ⚡️ Build success in 2120ms
12
+ ESM dist/index.js 68.47 KB
13
+ ESM ⚡️ Build success in 2727ms
14
+ CJS dist/index.cjs 68.75 KB
15
+ CJS ⚡️ Build success in 2732ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 15225ms
18
- DTS dist/index.d.ts 39.72 KB
19
- DTS dist/index.d.cts 39.72 KB
17
+ DTS ⚡️ Build success in 18202ms
18
+ DTS dist/index.d.ts 40.58 KB
19
+ DTS dist/index.d.cts 40.58 KB
package/CHANGELOG.md CHANGED
@@ -1,21 +1,88 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-tool-call-parts-20250630193309
3
+ ## 0.0.0-tsconfig-compile-20250703214351
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Updated dependencies [b790fd1]
8
+ - Updated dependencies [f36e4f1]
9
+ - @mastra/core@0.0.0-tsconfig-compile-20250703214351
10
+
11
+ ## 0.10.9
12
+
13
+ ### Patch Changes
14
+
15
+ - b60f510: Fix getWorkflowRuns by limit and offset
16
+ - 6997af1: add send event to server, deployer, client-js and playground-ui
17
+ - Updated dependencies [4d3fbdf]
18
+ - @mastra/core@0.10.10
19
+
20
+ ## 0.10.9-alpha.1
21
+
22
+ ### Patch Changes
23
+
24
+ - b60f510: Fix getWorkflowRuns by limit and offset
25
+ - 6997af1: add send event to server, deployer, client-js and playground-ui
26
+ - @mastra/core@0.10.10-alpha.1
27
+
28
+ ## 0.10.9-alpha.0
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [4d3fbdf]
33
+ - @mastra/core@0.10.10-alpha.0
34
+
35
+ ## 0.10.8
36
+
37
+ ### Patch Changes
38
+
39
+ - 9047bda: clientTools - stream tool-result part
40
+ - a606c75: show right suspend schema for nested workflow on playground
41
+ - 1760a1c: Use workflow stream in playground instead of watch
42
+ - 038e5ae: Add cancel workflow run
43
+ - 7e801dd: Add tools to network api response
44
+ - Updated dependencies [9dda1ac]
45
+ - Updated dependencies [c984582]
46
+ - Updated dependencies [7e801dd]
47
+ - Updated dependencies [a606c75]
48
+ - Updated dependencies [7aa70a4]
49
+ - Updated dependencies [764f86a]
50
+ - Updated dependencies [1760a1c]
51
+ - Updated dependencies [038e5ae]
52
+ - Updated dependencies [7dda16a]
53
+ - Updated dependencies [5ebfcdd]
54
+ - Updated dependencies [b2d0c91]
55
+ - Updated dependencies [4e809ad]
56
+ - Updated dependencies [57929df]
57
+ - Updated dependencies [b7852ed]
58
+ - Updated dependencies [6320a61]
59
+ - @mastra/core@0.10.9
60
+
61
+ ## 0.10.8-alpha.0
62
+
63
+ ### Patch Changes
64
+
65
+ - 9047bda: clientTools - stream tool-result part
66
+ - a606c75: show right suspend schema for nested workflow on playground
7
67
  - 1760a1c: Use workflow stream in playground instead of watch
68
+ - 038e5ae: Add cancel workflow run
8
69
  - 7e801dd: Add tools to network api response
9
70
  - Updated dependencies [9dda1ac]
71
+ - Updated dependencies [c984582]
10
72
  - Updated dependencies [7e801dd]
73
+ - Updated dependencies [a606c75]
11
74
  - Updated dependencies [7aa70a4]
12
75
  - Updated dependencies [764f86a]
13
76
  - Updated dependencies [1760a1c]
77
+ - Updated dependencies [038e5ae]
14
78
  - Updated dependencies [7dda16a]
15
- - Updated dependencies [d80069a]
79
+ - Updated dependencies [5ebfcdd]
80
+ - Updated dependencies [b2d0c91]
81
+ - Updated dependencies [4e809ad]
16
82
  - Updated dependencies [57929df]
83
+ - Updated dependencies [b7852ed]
17
84
  - Updated dependencies [6320a61]
18
- - @mastra/core@0.0.0-tool-call-parts-20250630193309
85
+ - @mastra/core@0.10.9-alpha.0
19
86
 
20
87
  ## 0.10.7
21
88
 
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(
@@ -1295,10 +1308,10 @@ var Workflow = class extends BaseResource {
1295
1308
  if (params?.toDate) {
1296
1309
  searchParams.set("toDate", params.toDate.toISOString());
1297
1310
  }
1298
- if (params?.limit) {
1311
+ if (params?.limit !== null && params?.limit !== void 0 && !isNaN(Number(params?.limit))) {
1299
1312
  searchParams.set("limit", String(params.limit));
1300
1313
  }
1301
- if (params?.offset) {
1314
+ if (params?.offset !== null && params?.offset !== void 0 && !isNaN(Number(params?.offset))) {
1302
1315
  searchParams.set("offset", String(params.offset));
1303
1316
  }
1304
1317
  if (params?.resourceId) {
@@ -1326,6 +1339,27 @@ 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
+ }
1352
+ /**
1353
+ * Sends an event to a specific workflow run by its ID
1354
+ * @param params - Object containing the runId, event and data
1355
+ * @returns Promise containing a success message
1356
+ */
1357
+ sendRunEvent(params) {
1358
+ return this.request(`/api/workflows/${this.workflowId}/runs/${params.runId}/send-event`, {
1359
+ method: "POST",
1360
+ body: { event: params.event, data: params.data }
1361
+ });
1362
+ }
1329
1363
  /**
1330
1364
  * Creates a new workflow run
1331
1365
  * @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;
@@ -707,6 +718,26 @@ declare class Workflow extends BaseResource {
707
718
  * @returns Promise containing the workflow run execution result
708
719
  */
709
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
+ }>;
729
+ /**
730
+ * Sends an event to a specific workflow run by its ID
731
+ * @param params - Object containing the runId, event and data
732
+ * @returns Promise containing a success message
733
+ */
734
+ sendRunEvent(params: {
735
+ runId: string;
736
+ event: string;
737
+ data: unknown;
738
+ }): Promise<{
739
+ message: string;
740
+ }>;
710
741
  /**
711
742
  * Creates a new workflow run
712
743
  * @param params - Optional object containing the optional runId
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;
@@ -707,6 +718,26 @@ declare class Workflow extends BaseResource {
707
718
  * @returns Promise containing the workflow run execution result
708
719
  */
709
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
+ }>;
729
+ /**
730
+ * Sends an event to a specific workflow run by its ID
731
+ * @param params - Object containing the runId, event and data
732
+ * @returns Promise containing a success message
733
+ */
734
+ sendRunEvent(params: {
735
+ runId: string;
736
+ event: string;
737
+ data: unknown;
738
+ }): Promise<{
739
+ message: string;
740
+ }>;
710
741
  /**
711
742
  * Creates a new workflow run
712
743
  * @param params - Optional object containing the optional runId
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(
@@ -1289,10 +1302,10 @@ var Workflow = class extends BaseResource {
1289
1302
  if (params?.toDate) {
1290
1303
  searchParams.set("toDate", params.toDate.toISOString());
1291
1304
  }
1292
- if (params?.limit) {
1305
+ if (params?.limit !== null && params?.limit !== void 0 && !isNaN(Number(params?.limit))) {
1293
1306
  searchParams.set("limit", String(params.limit));
1294
1307
  }
1295
- if (params?.offset) {
1308
+ if (params?.offset !== null && params?.offset !== void 0 && !isNaN(Number(params?.offset))) {
1296
1309
  searchParams.set("offset", String(params.offset));
1297
1310
  }
1298
1311
  if (params?.resourceId) {
@@ -1320,6 +1333,27 @@ 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
+ }
1346
+ /**
1347
+ * Sends an event to a specific workflow run by its ID
1348
+ * @param params - Object containing the runId, event and data
1349
+ * @returns Promise containing a success message
1350
+ */
1351
+ sendRunEvent(params) {
1352
+ return this.request(`/api/workflows/${this.workflowId}/runs/${params.runId}/send-event`, {
1353
+ method: "POST",
1354
+ body: { event: params.event, data: params.data }
1355
+ });
1356
+ }
1323
1357
  /**
1324
1358
  * Creates a new workflow run
1325
1359
  * @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.0.0-tool-call-parts-20250630193309",
3
+ "version": "0.0.0-tsconfig-compile-20250703214351",
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.0.0-tool-call-parts-20250630193309"
36
+ "@mastra/core": "0.0.0-tsconfig-compile-20250703214351"
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.0-tool-call-parts-20250630193309"
49
+ "vitest": "^3.2.4",
50
+ "@internal/lint": "0.0.0-tsconfig-compile-20250703214351"
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];
@@ -115,10 +115,10 @@ export class Workflow extends BaseResource {
115
115
  if (params?.toDate) {
116
116
  searchParams.set('toDate', params.toDate.toISOString());
117
117
  }
118
- if (params?.limit) {
118
+ if (params?.limit !== null && params?.limit !== undefined && !isNaN(Number(params?.limit))) {
119
119
  searchParams.set('limit', String(params.limit));
120
120
  }
121
- if (params?.offset) {
121
+ if (params?.offset !== null && params?.offset !== undefined && !isNaN(Number(params?.offset))) {
122
122
  searchParams.set('offset', String(params.offset));
123
123
  }
124
124
  if (params?.resourceId) {
@@ -150,6 +150,29 @@ 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
+
164
+ /**
165
+ * Sends an event to a specific workflow run by its ID
166
+ * @param params - Object containing the runId, event and data
167
+ * @returns Promise containing a success message
168
+ */
169
+ sendRunEvent(params: { runId: string; event: string; data: unknown }): Promise<{ message: string }> {
170
+ return this.request(`/api/workflows/${this.workflowId}/runs/${params.runId}/send-event`, {
171
+ method: 'POST',
172
+ body: { event: params.event, data: params.data },
173
+ });
174
+ }
175
+
153
176
  /**
154
177
  * Creates a new workflow run
155
178
  * @param params - Optional object containing the optional runId
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;