@mastra/client-js 1.0.0-beta.10 → 1.0.0-beta.13
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 +108 -0
- package/dist/_types/@ai-sdk_ui-utils/dist/index.d.ts +820 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +8396 -0
- package/dist/index.cjs +1319 -442
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1317 -440
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts +1 -1
- package/dist/resources/run.d.ts +156 -0
- package/dist/resources/run.d.ts.map +1 -0
- package/dist/resources/workflow.d.ts +6 -219
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +4 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,113 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`919a22b`](https://github.com/mastra-ai/mastra/commit/919a22b25876f9ed5891efe5facbe682c30ff497)]:
|
|
8
|
+
- @mastra/core@1.0.0-beta.13
|
|
9
|
+
|
|
10
|
+
## 1.0.0-beta.12
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Embed AI types to fix peerdeps mismatches ([`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808))
|
|
15
|
+
|
|
16
|
+
- Add resourceId to workflow routes ([#11166](https://github.com/mastra-ai/mastra/pull/11166))
|
|
17
|
+
|
|
18
|
+
- Add `Run` instance to client-js. `workflow.createRun` returns the `Run` instance which can be used for the different run methods. ([#11207](https://github.com/mastra-ai/mastra/pull/11207))
|
|
19
|
+
With this change, run methods cannot be called directly on workflow instance anymore
|
|
20
|
+
|
|
21
|
+
```diff
|
|
22
|
+
- const result = await workflow.stream({ runId: '123', inputData: { ... } });
|
|
23
|
+
+ const run = await workflow.createRun({ runId: '123' });
|
|
24
|
+
+ const stream = await run.stream({ inputData: { ... } });
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Deserialize workflow errors on the client side ([#10992](https://github.com/mastra-ai/mastra/pull/10992))
|
|
28
|
+
|
|
29
|
+
When workflows fail, the server sends error data as JSON over HTTP. This change deserializes those errors back to proper `Error` instances on the client.
|
|
30
|
+
|
|
31
|
+
**Before:**
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
const result = await workflow.startAsync({ input });
|
|
35
|
+
if (result.status === 'failed') {
|
|
36
|
+
// result.error was a plain object, couldn't use instanceof
|
|
37
|
+
console.log(result.error.message); // TypeScript error
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**After:**
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const result = await workflow.startAsync({ input });
|
|
45
|
+
if (result.status === 'failed') {
|
|
46
|
+
// result.error is now a proper Error instance
|
|
47
|
+
if (result.error instanceof MyCustomError) {
|
|
48
|
+
console.log(result.error.statusCode); // Works!
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This enables proper error handling and type checking in client applications, allowing developers to implement error-specific recovery logic based on custom error types and properties.
|
|
54
|
+
|
|
55
|
+
Features:
|
|
56
|
+
- `instanceof Error` checks
|
|
57
|
+
- Access to `error.message`, `error.name`, `error.stack`
|
|
58
|
+
- Preservation of custom error properties (e.g., `statusCode`, `responseHeaders`)
|
|
59
|
+
- Nested error tracking via `error.cause`
|
|
60
|
+
|
|
61
|
+
Affected methods:
|
|
62
|
+
- `startAsync()`
|
|
63
|
+
- `resumeAsync()`
|
|
64
|
+
- `restartAsync()`
|
|
65
|
+
- `timeTravelAsync()`
|
|
66
|
+
|
|
67
|
+
- Add missing status parameter to workflow.runs() method ([#11095](https://github.com/mastra-ai/mastra/pull/11095))
|
|
68
|
+
|
|
69
|
+
The `status` parameter was supported by the server API but was missing from the TypeScript types in @mastra/client-js.
|
|
70
|
+
|
|
71
|
+
Now you can filter workflow runs by status:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Get only running workflows
|
|
75
|
+
const runningRuns = await workflow.runs({ status: 'running' });
|
|
76
|
+
|
|
77
|
+
// Get completed workflows
|
|
78
|
+
const completedRuns = await workflow.runs({ status: 'success' });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [[`d5ed981`](https://github.com/mastra-ai/mastra/commit/d5ed981c8701c1b8a27a5f35a9a2f7d9244e695f), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`932d63d`](https://github.com/mastra-ai/mastra/commit/932d63dd51be9c8bf1e00e3671fe65606c6fb9cd), [`b760b73`](https://github.com/mastra-ai/mastra/commit/b760b731aca7c8a3f041f61d57a7f125ae9cb215), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`2b459f4`](https://github.com/mastra-ai/mastra/commit/2b459f466fd91688eeb2a44801dc23f7f8a887ab), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`24b76d8`](https://github.com/mastra-ai/mastra/commit/24b76d8e17656269c8ed09a0c038adb9cc2ae95a), [`243a823`](https://github.com/mastra-ai/mastra/commit/243a8239c5906f5c94e4f78b54676793f7510ae3), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`c61fac3`](https://github.com/mastra-ai/mastra/commit/c61fac3add96f0dcce0208c07415279e2537eb62), [`6f14f70`](https://github.com/mastra-ai/mastra/commit/6f14f706ccaaf81b69544b6c1b75ab66a41e5317), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`4524734`](https://github.com/mastra-ai/mastra/commit/45247343e384717a7c8404296275c56201d6470f), [`2a53598`](https://github.com/mastra-ai/mastra/commit/2a53598c6d8cfeb904a7fc74e57e526d751c8fa6), [`c7cd3c7`](https://github.com/mastra-ai/mastra/commit/c7cd3c7a187d7aaf79e2ca139de328bf609a14b4), [`847c212`](https://github.com/mastra-ai/mastra/commit/847c212caba7df0d6f2fc756b494ac3c75c3720d), [`6f941c4`](https://github.com/mastra-ai/mastra/commit/6f941c438ca5f578619788acc7608fc2e23bd176)]:
|
|
82
|
+
- @mastra/core@1.0.0-beta.12
|
|
83
|
+
- @mastra/schema-compat@1.0.0-beta.3
|
|
84
|
+
|
|
85
|
+
## 1.0.0-beta.11
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
|
|
90
|
+
|
|
91
|
+
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
92
|
+
|
|
93
|
+
```typescript showLineNumbers copy
|
|
94
|
+
const run = await workflow.createRun();
|
|
95
|
+
const result = await run.start({ inputData: { message: 'Hello' } });
|
|
96
|
+
|
|
97
|
+
if (result.status === 'tripwire') {
|
|
98
|
+
console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
|
|
99
|
+
console.log('Processor ID:', result.tripwire?.processorId);
|
|
100
|
+
console.log('Retry requested:', result.tripwire?.retry);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Adds new UI state for tripwire in agent chat and workflow UI.
|
|
105
|
+
|
|
106
|
+
This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [[`38380b6`](https://github.com/mastra-ai/mastra/commit/38380b60fca905824bdf6b43df307a58efb1aa15), [`798d0c7`](https://github.com/mastra-ai/mastra/commit/798d0c740232653b1d754870e6b43a55c364ffe2), [`ffe84d5`](https://github.com/mastra-ai/mastra/commit/ffe84d54f3b0f85167fe977efd027dba027eb998), [`2c212e7`](https://github.com/mastra-ai/mastra/commit/2c212e704c90e2db83d4109e62c03f0f6ebd2667), [`4ca4306`](https://github.com/mastra-ai/mastra/commit/4ca430614daa5fa04730205a302a43bf4accfe9f), [`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
|
|
109
|
+
- @mastra/core@1.0.0-beta.11
|
|
110
|
+
|
|
3
111
|
## 1.0.0-beta.10
|
|
4
112
|
|
|
5
113
|
### Patch Changes
|