@mastra/client-js 1.37.1-alpha.1 → 1.38.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.
- package/CHANGELOG.md +54 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-client-js-workflows.md +92 -0
- package/dist/route-types.generated.d.ts +399 -379
- package/dist/route-types.generated.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.38.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added typed client support for transient agent signals. Use `transient: true` with `sendSignal()` to deliver non-state context for the current model call without retaining it. ([#18909](https://github.com/mastra-ai/mastra/pull/18909))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
await client.getAgent('myAgent').sendSignal({
|
|
11
|
+
resourceId: 'user-1',
|
|
12
|
+
threadId: 'thread-1',
|
|
13
|
+
signal: {
|
|
14
|
+
type: 'reactive',
|
|
15
|
+
contents: 'Stay on the current task.',
|
|
16
|
+
transient: true,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- Added `toolResult` as a recognized processor phase across the processor server API and the generated client types. Processors that implement `processToolResult` are now detected and surfaced when listing processors, the phase can be targeted when executing a processor, and it is accepted by the processor provider and stored agent schemas. The `@mastra/client-js` route types now include the new phase. ([#16012](https://github.com/mastra-ai/mastra/pull/16012))
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Fixed streamed UTF-8 characters being corrupted when their bytes span network chunks. ([#20224](https://github.com/mastra-ai/mastra/pull/20224))
|
|
26
|
+
|
|
27
|
+
- Added landmark types for trace signal theme snapshots. Querying the theme-snapshots endpoint with `presentation=landmarks` returns a bounded, time-balanced selection of snapshots instead of every snapshot in range. The response types now cover that mode. ([#20710](https://github.com/mastra-ai/mastra/pull/20710))
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import type { ThemeSnapshotsResponse } from '@mastra/client-js';
|
|
31
|
+
|
|
32
|
+
const response: ThemeSnapshotsResponse = await fetch(
|
|
33
|
+
'/api/learning/entities/my-agent/theme-snapshots?' +
|
|
34
|
+
'entityType=agent&signalNames=goal,outcome&presentation=landmarks&limit=24',
|
|
35
|
+
).then(res => res.json());
|
|
36
|
+
|
|
37
|
+
response.totalSnapshots; // full in-range count, larger than the landmark list
|
|
38
|
+
for (const snapshot of response.snapshots) {
|
|
39
|
+
snapshot.cutoffAt; // position ticks proportionally on a time axis
|
|
40
|
+
snapshot.reason; // 'range_start' | 'range_end' | 'time_sample'
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [[`8d2399b`](https://github.com/mastra-ai/mastra/commit/8d2399b638f8e0945cf2cda0187dbea8dcf0b784), [`c8002da`](https://github.com/mastra-ai/mastra/commit/c8002da7775c468e2965b6ff5f82045450fa8cb9), [`92be47f`](https://github.com/mastra-ai/mastra/commit/92be47fbd26ffccec0e2131ef7c1d9e70dd5ef4a), [`89200ba`](https://github.com/mastra-ai/mastra/commit/89200bafa05444bb7949b363ce7b743e29867561), [`c950138`](https://github.com/mastra-ai/mastra/commit/c950138e72e4f317a40187e3800588731ab790ce), [`810c7e7`](https://github.com/mastra-ai/mastra/commit/810c7e74929989d8b8b5db52cd3af22cd0998af4), [`063c8b2`](https://github.com/mastra-ai/mastra/commit/063c8b2eb14e4e5ca021779bc33e8c3c031c8604), [`f9f9884`](https://github.com/mastra-ai/mastra/commit/f9f98848ee194dc71a787a709ec430b065cdc41b), [`e0904dc`](https://github.com/mastra-ai/mastra/commit/e0904dc538792e54e1806b70172e5900ac49bff4), [`9672fab`](https://github.com/mastra-ai/mastra/commit/9672fabfbcadb961a35c22a2d6722e077f7b24b9), [`f4e964c`](https://github.com/mastra-ai/mastra/commit/f4e964cad57057301d6bed5c55bcdd730175b941), [`1f7bbd7`](https://github.com/mastra-ai/mastra/commit/1f7bbd7785a8d230aad02454ecabeb4a0b2cc96f), [`e47ff36`](https://github.com/mastra-ai/mastra/commit/e47ff36945720f4ee4caa09f6e83514d7d188608), [`64d6781`](https://github.com/mastra-ai/mastra/commit/64d67814bccddd314f7e09643243821e57cb87b6), [`14562d6`](https://github.com/mastra-ai/mastra/commit/14562d6ea724ed4ccb9fb079d016ec7ab1bd92a4), [`fb9a6ac`](https://github.com/mastra-ai/mastra/commit/fb9a6ac11c9560518742ece60b49d6b062845fd3), [`aa2cec8`](https://github.com/mastra-ai/mastra/commit/aa2cec8501f634d51c2f3ebfb3dd3aa7af8d2ca2), [`c848e65`](https://github.com/mastra-ai/mastra/commit/c848e655a64ff10331a8ceafafe7f18e70a0f092), [`2adf8eb`](https://github.com/mastra-ai/mastra/commit/2adf8eb4a70ed2b6cff2dd39281496ea0e025fac), [`0494489`](https://github.com/mastra-ai/mastra/commit/049448906e4c3d2d615bbe865b073a0d890ddb7c), [`8d1aeb8`](https://github.com/mastra-ai/mastra/commit/8d1aeb8acf7c20c4bb8e4d8e4bdc6569c83ac561), [`8264611`](https://github.com/mastra-ai/mastra/commit/8264611510e421b818bc7395dc2ae4d9c2d518b2), [`d8fa243`](https://github.com/mastra-ai/mastra/commit/d8fa2430d21113e330c4e676ac65e1235cf44f81), [`44fc98b`](https://github.com/mastra-ai/mastra/commit/44fc98b9d1242aa87a3ab44bdce9e9f12c44d8c9), [`f933ba3`](https://github.com/mastra-ai/mastra/commit/f933ba32700e1d0bf143311c1a08f88300b840b6), [`83065bf`](https://github.com/mastra-ai/mastra/commit/83065bfee9e47c3c6f09132a9034501f6cfb69cf), [`0f2ef41`](https://github.com/mastra-ai/mastra/commit/0f2ef4118da022e4f30dac4e9856cc3a8c97671c), [`01b162f`](https://github.com/mastra-ai/mastra/commit/01b162fe435295881aa7ea55f1759407ad5175ad)]:
|
|
45
|
+
- @mastra/core@1.57.0
|
|
46
|
+
- @mastra/schema-compat@1.3.5
|
|
47
|
+
|
|
48
|
+
## 1.37.1-alpha.2
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Fixed streamed UTF-8 characters being corrupted when their bytes span network chunks. ([#20224](https://github.com/mastra-ai/mastra/pull/20224))
|
|
53
|
+
|
|
54
|
+
- Updated dependencies [[`810c7e7`](https://github.com/mastra-ai/mastra/commit/810c7e74929989d8b8b5db52cd3af22cd0998af4), [`f9f9884`](https://github.com/mastra-ai/mastra/commit/f9f98848ee194dc71a787a709ec430b065cdc41b), [`e0904dc`](https://github.com/mastra-ai/mastra/commit/e0904dc538792e54e1806b70172e5900ac49bff4), [`64d6781`](https://github.com/mastra-ai/mastra/commit/64d67814bccddd314f7e09643243821e57cb87b6), [`c848e65`](https://github.com/mastra-ai/mastra/commit/c848e655a64ff10331a8ceafafe7f18e70a0f092), [`0494489`](https://github.com/mastra-ai/mastra/commit/049448906e4c3d2d615bbe865b073a0d890ddb7c), [`8d1aeb8`](https://github.com/mastra-ai/mastra/commit/8d1aeb8acf7c20c4bb8e4d8e4bdc6569c83ac561), [`83065bf`](https://github.com/mastra-ai/mastra/commit/83065bfee9e47c3c6f09132a9034501f6cfb69cf), [`01b162f`](https://github.com/mastra-ai/mastra/commit/01b162fe435295881aa7ea55f1759407ad5175ad)]:
|
|
55
|
+
- @mastra/core@1.57.0-alpha.2
|
|
56
|
+
|
|
3
57
|
## 1.37.1-alpha.1
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-client-js
|
|
|
3
3
|
description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/client-js"
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.38.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -212,6 +212,98 @@ A workflow run result yields the following:
|
|
|
212
212
|
|
|
213
213
|
**payload** (`object`): Contains currentStep (id, status, output, payload) and workflowState (status, steps record)
|
|
214
214
|
|
|
215
|
+
## Stored workflows
|
|
216
|
+
|
|
217
|
+
> **Beta:** Stored workflows are in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
218
|
+
|
|
219
|
+
Stored workflows are workflow definitions expressed as JSON. The server persists each definition and registers it as a runnable workflow. See [Stored workflows](https://mastra.ai/docs/workflows/stored-workflows) for the definition format.
|
|
220
|
+
|
|
221
|
+
### `listStoredWorkflows()`
|
|
222
|
+
|
|
223
|
+
List stored workflow definitions, optionally filtered by `status` (`'active' | 'archived'`) and `authorId`:
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
const { definitions, total } = await mastraClient.listStoredWorkflows({
|
|
227
|
+
status: 'active',
|
|
228
|
+
})
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### `upsertStoredWorkflow()`
|
|
232
|
+
|
|
233
|
+
Create or replace a stored workflow definition. The server validates the definition, persists it, and live-registers it for execution:
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const stored = await mastraClient.upsertStoredWorkflow({
|
|
237
|
+
id: 'greeting-workflow',
|
|
238
|
+
description: 'Returns a greeting for the supplied name',
|
|
239
|
+
inputSchema: {
|
|
240
|
+
type: 'object',
|
|
241
|
+
properties: { name: { type: 'string' } },
|
|
242
|
+
required: ['name'],
|
|
243
|
+
},
|
|
244
|
+
outputSchema: {
|
|
245
|
+
type: 'object',
|
|
246
|
+
properties: { message: { type: 'string' } },
|
|
247
|
+
required: ['message'],
|
|
248
|
+
},
|
|
249
|
+
graph: [
|
|
250
|
+
{
|
|
251
|
+
type: 'mapping',
|
|
252
|
+
id: 'create-greeting',
|
|
253
|
+
mapConfig: JSON.stringify({
|
|
254
|
+
message: { template: 'Hello, ${initData.name}!' },
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
})
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
When the root definition nests helper workflows that don't exist yet, pass them in the same request through `dependencies`. The server validates and registers the bundle as a unit and echoes the helper ids back as `dependencyIds`:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
const stored = await mastraClient.upsertStoredWorkflow({
|
|
265
|
+
id: 'root-workflow',
|
|
266
|
+
// ...schemas and graph referencing 'helper-workflow'...
|
|
267
|
+
dependencies: [helperDefinition],
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
console.log(stored.dependencyIds) // ['helper-workflow']
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### `getStoredWorkflow()`
|
|
274
|
+
|
|
275
|
+
Get a stored workflow instance for definition management. To execute a stored workflow, use `getWorkflow(id).createRun()` like any other workflow:
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
const storedWorkflow = mastraClient.getStoredWorkflow('greeting-workflow')
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### `storedWorkflow.details()`
|
|
282
|
+
|
|
283
|
+
Retrieve the persisted definition, including schemas, graph, status, and timestamps:
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
const definition = await storedWorkflow.details()
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### `storedWorkflow.delete()`
|
|
290
|
+
|
|
291
|
+
Delete the stored definition and unregister the live workflow:
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
await storedWorkflow.delete()
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Executing a stored workflow
|
|
298
|
+
|
|
299
|
+
Once registered, a stored workflow runs through the ordinary workflow API:
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const workflow = mastraClient.getWorkflow('greeting-workflow')
|
|
303
|
+
const run = await workflow.createRun()
|
|
304
|
+
const result = await run.startAsync({ inputData: { name: 'Ada' } })
|
|
305
|
+
```
|
|
306
|
+
|
|
215
307
|
## Schedules
|
|
216
308
|
|
|
217
309
|
Schedules are declared in code via the `schedule` field on `createWorkflow`. The client SDK exposes read and operational methods for managing workflow schedules at runtime. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows).
|