@mastra/client-js 1.31.0-alpha.4 → 1.31.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 +63 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-long-running-agents-schedules.md +13 -39
- package/dist/docs/references/reference-client-js-agents.md +88 -0
- package/dist/docs/references/reference-client-js-workflows.md +45 -6
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **Added unified schedule methods and deprecated heartbeat methods.** The client now manages agent schedules (previously heartbeats) and workflow schedules through one set of methods backed by `/api/schedules`. ([#18874](https://github.com/mastra-ai/mastra/pull/18874))
|
|
8
|
+
|
|
9
|
+
Added `createSchedule()`, `updateSchedule()`, `deleteSchedule()`, and `runSchedule()`, alongside the existing `listSchedules()`, `getSchedule()`, `pauseSchedule()`, `resumeSchedule()`, and `listScheduleTriggers()`. `ScheduleResponse.target` is now a discriminated union of agent and workflow targets.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// Schedule an agent (was createHeartbeat)
|
|
13
|
+
const schedule = await client.createSchedule({
|
|
14
|
+
agentId: 'chef',
|
|
15
|
+
cron: '0 9 * * *',
|
|
16
|
+
prompt: 'Suggest a dish of the day',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Schedule a workflow with the same method
|
|
20
|
+
await client.createSchedule({
|
|
21
|
+
workflowId: 'daily-report',
|
|
22
|
+
cron: '0 6 * * *',
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Deprecated `listHeartbeats()`, `getHeartbeat()`, `createHeartbeat()`, `updateHeartbeat()`, `deleteHeartbeat()`, `pauseHeartbeat()`, `resumeHeartbeat()`, and `runHeartbeat()`. They now delegate to the schedule methods and will be removed in a future release.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Added workspace-level provider registry to MastraEditor. You can now register WorkspaceProvider factories that build complete Workspace instances as a single unit, instead of composing from separate filesystem and sandbox providers. Stored agents can reference a workspace provider via `{ type: 'provider', provider: 'my-cloud', config: { ... } }` and the editor will call the registered factory during agent hydration. ([#18781](https://github.com/mastra-ai/mastra/pull/18781))
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { MastraEditor } from '@mastra/editor';
|
|
34
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
35
|
+
|
|
36
|
+
const editor = new MastraEditor({
|
|
37
|
+
workspaces: {
|
|
38
|
+
'my-cloud': {
|
|
39
|
+
id: 'my-cloud',
|
|
40
|
+
name: 'My Cloud Workspace',
|
|
41
|
+
createWorkspace: config =>
|
|
42
|
+
new Workspace({
|
|
43
|
+
id: 'cloud-ws',
|
|
44
|
+
name: 'Cloud WS',
|
|
45
|
+
filesystem: new MyCloudFilesystem(config),
|
|
46
|
+
sandbox: new MyCloudSandbox(config),
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Stored agent workspace reference using the provider:
|
|
53
|
+
// { type: 'provider', provider: 'my-cloud', config: { region: 'us-east-1' } }
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [[`b291760`](https://github.com/mastra-ai/mastra/commit/b291760df9d6c7e4fc72606c8f0a4af2cf6e946c), [`3ffb8b7`](https://github.com/mastra-ai/mastra/commit/3ffb8b720e90f5e6977129ec1f6707d43c2bebe0), [`6ef59fe`](https://github.com/mastra-ai/mastra/commit/6ef59fef1da52ed8da5fbb2a892c71cf4fb6c739), [`4039488`](https://github.com/mastra-ai/mastra/commit/403948898af7293198d9e8b3e7fb47f623c78b94), [`29b7ea6`](https://github.com/mastra-ai/mastra/commit/29b7ea64e72b5523d5bdcbd34ee03d2b854d54e1), [`b2c9d70`](https://github.com/mastra-ai/mastra/commit/b2c9d70757207fb01a9069549e69b6f0d73a6636), [`a51c63d`](https://github.com/mastra-ai/mastra/commit/a51c63d8ee639e4daeba2a0be093efa6a1b5e52f), [`252f63d`](https://github.com/mastra-ai/mastra/commit/252f63d8fec723955adb2202be2f01a75ad0e69c), [`5ea76a7`](https://github.com/mastra-ai/mastra/commit/5ea76a723d966c72da9aa3ab30ae20276e049765), [`6445560`](https://github.com/mastra-ai/mastra/commit/6445560327045d20b239585fc63fed72e9ce36ec), [`e2b9f33`](https://github.com/mastra-ai/mastra/commit/e2b9f33456fd638eca555f9466c6519d8d049666), [`10959d5`](https://github.com/mastra-ai/mastra/commit/10959d509d824f682d40ff96e05ee044aec3b0e5), [`c547a77`](https://github.com/mastra-ai/mastra/commit/c547a7729bdf64dfc2df29c965046c0712a18f10), [`a0085fa`](https://github.com/mastra-ai/mastra/commit/a0085fa0934e52c37c8c8b3d75a6bb5cd199af36), [`a2ba369`](https://github.com/mastra-ai/mastra/commit/a2ba369e796dfab610f41c6875965b488272fa55), [`ffc3c17`](https://github.com/mastra-ai/mastra/commit/ffc3c17274ea17c11aa6f73d3140649cd7fc8abc), [`81542c1`](https://github.com/mastra-ai/mastra/commit/81542c1835c35bc32f2ce4fa9136ee11993cd299), [`3908e53`](https://github.com/mastra-ai/mastra/commit/3908e53ce04bbea04f5e0c097d7aa298c35fabee), [`cb24ce7`](https://github.com/mastra-ai/mastra/commit/cb24ce76bd16ca88eb6a963f6277f8780e703029), [`02705fd`](https://github.com/mastra-ai/mastra/commit/02705fd2f5a9062210d64ea061adeeb10dc9452e), [`ae51e81`](https://github.com/mastra-ai/mastra/commit/ae51e818825582d42500338dfc1929a082eff0ba), [`6f304ef`](https://github.com/mastra-ai/mastra/commit/6f304ef319e99725e884bdb8d3193c001b6e5964), [`5f9858f`](https://github.com/mastra-ai/mastra/commit/5f9858f791f1137ca7d52d23559fb4568f7a9026)]:
|
|
57
|
+
- @mastra/core@1.50.0
|
|
58
|
+
|
|
59
|
+
## 1.31.0-alpha.5
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`a0085fa`](https://github.com/mastra-ai/mastra/commit/a0085fa0934e52c37c8c8b3d75a6bb5cd199af36)]:
|
|
64
|
+
- @mastra/core@1.50.0-alpha.5
|
|
65
|
+
|
|
3
66
|
## 1.31.0-alpha.4
|
|
4
67
|
|
|
5
68
|
### 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.31.0
|
|
6
|
+
version: "1.31.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -6,13 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
> **Beta:** This feature is in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
8
8
|
|
|
9
|
-
A schedule runs an agent on a cron cadence. On each fire, Mastra sends a prompt to the agent, either as a [signal](https://mastra.ai/docs/long-running-agents/signals) into a thread or as a threadless `agent.generate()` run. Use schedules for recurring agent work such as daily summaries, periodic checks, or scheduled nudges into a conversation.
|
|
9
|
+
A schedule runs an agent on a cron cadence. On each fire, Mastra sends a prompt to the agent, either as a [signal](https://mastra.ai/docs/long-running-agents/signals) into a thread or as a threadless [`agent.generate()`](https://mastra.ai/reference/agents/generate) run. Use schedules for recurring agent work such as daily summaries, periodic checks, or scheduled nudges into a conversation.
|
|
10
10
|
|
|
11
|
-
Schedules are persisted, so they survive restarts and redeploys. Manage them at runtime through `mastra.schedules
|
|
11
|
+
Schedules are persisted, so they survive restarts and redeploys. Manage them at runtime through [`mastra.schedules`](https://mastra.ai/reference/schedules/overview), the canonical create, read, update, and delete (CRUD) surface. The same surface also manages [workflow schedules](https://mastra.ai/docs/workflows/scheduled-workflows) (pass `workflowId` instead of `agentId` to schedule a workflow).
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Schedules require a [storage](https://mastra.ai/docs/memory/storage) adapter that implements the schedules domain, for example `@mastra/libsql`. Without one, `mastra.schedules.create()` throws.
|
|
13
|
+
> **Note:** Schedules require a [storage](https://mastra.ai/docs/memory/storage) adapter that implements the schedules domain. See the [`mastra.schedules` reference](https://mastra.ai/reference/schedules/overview) for supported adapters and API behavior.
|
|
16
14
|
|
|
17
15
|
## Quickstart
|
|
18
16
|
|
|
@@ -48,7 +46,7 @@ Mastra starts the scheduler the first time a schedule is created, then fires the
|
|
|
48
46
|
|
|
49
47
|
Schedules fire on a cron expression. The `cron` field accepts a standard 5-, 6-, or 7-part cron expression, and it's validated when you create or update the schedule.
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
`croner` nicknames also work, for example `@hourly`, `@daily`, `@weekly`, `@monthly`, and `@midnight`. For day-and-time combinations, write the cron field directly:
|
|
52
50
|
|
|
53
51
|
```typescript
|
|
54
52
|
// Every weekday at 9am
|
|
@@ -85,15 +83,9 @@ await mastra.schedules.create({
|
|
|
85
83
|
})
|
|
86
84
|
```
|
|
87
85
|
|
|
88
|
-
Threaded schedules accept extra fields that control how the signal behaves. They mirror the options [`agent.sendSignal`](https://mastra.ai/docs/long-running-agents/signals) accepts and stay JSON-serializable so they persist with the schedule.
|
|
89
|
-
|
|
90
|
-
- `signalType`: the [signal type](https://mastra.ai/docs/long-running-agents/signals) to send, for example `notification` or `system-reminder`. Defaults to `notification`.
|
|
91
|
-
- `tagName`: the XML tag the signal renders as. Defaults to `schedule`, so a fire surfaces to the agent as `<schedule>…</schedule>`.
|
|
92
|
-
- `attributes`: values rendered onto the signal's XML tag.
|
|
93
|
-
- `ifActive`: behavior when the thread is already streaming, as `{ behavior, attributes }`. `behavior` is one of `deliver`, `persist`, or `discard`.
|
|
94
|
-
- `ifIdle`: behavior when the thread is idle, as `{ behavior, attributes, streamOptions }`. `behavior` is one of `wake`, `persist`, or `discard`. `streamOptions.requestContext` is applied to the woken run.
|
|
86
|
+
Threaded schedules accept extra fields that control how the signal behaves, including the signal type, XML tag, tag attributes, and active-or-idle delivery behavior. They mirror the options [`agent.sendSignal()`](https://mastra.ai/docs/long-running-agents/signals) accepts and stay JSON-serializable so they persist with the schedule.
|
|
95
87
|
|
|
96
|
-
These fields require a `threadId`.
|
|
88
|
+
These fields require a `threadId`. For the full threaded input shape, see the [agent schedule input reference](https://mastra.ai/reference/schedules/overview).
|
|
97
89
|
|
|
98
90
|
```typescript
|
|
99
91
|
await mastra.schedules.create({
|
|
@@ -116,39 +108,21 @@ await mastra.schedules.create({
|
|
|
116
108
|
|
|
117
109
|
## Managing schedules
|
|
118
110
|
|
|
119
|
-
Use `mastra.schedules` for all schedule operations.
|
|
111
|
+
Use `mastra.schedules` for all schedule operations. The service can create, read, update, pause, resume, manually run, and delete schedules.
|
|
120
112
|
|
|
121
113
|
```typescript
|
|
122
|
-
// Create
|
|
123
114
|
const schedule = await mastra.schedules.create({
|
|
124
115
|
agentId: 'pinger',
|
|
125
116
|
cron: '0 * * * *',
|
|
126
117
|
prompt: 'Status check.',
|
|
127
118
|
})
|
|
128
119
|
|
|
129
|
-
// Read
|
|
130
|
-
await mastra.schedules.get(schedule.id)
|
|
131
|
-
await mastra.schedules.list({ agentId: 'pinger' })
|
|
132
|
-
|
|
133
|
-
// Update — changing cron or timezone recomputes the next fire time
|
|
134
|
-
await mastra.schedules.update(schedule.id, { cron: '*/30 * * * *' })
|
|
135
|
-
|
|
136
|
-
// Pause and resume
|
|
137
120
|
await mastra.schedules.pause(schedule.id)
|
|
138
121
|
await mastra.schedules.resume(schedule.id)
|
|
139
|
-
|
|
140
|
-
// Fire once now, off-schedule
|
|
141
|
-
await mastra.schedules.run(schedule.id)
|
|
142
|
-
|
|
143
|
-
// Delete
|
|
144
|
-
await mastra.schedules.delete(schedule.id)
|
|
122
|
+
await mastra.schedules.run(schedule.id) // Fire once now, off-schedule
|
|
145
123
|
```
|
|
146
124
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- `pause` and `resume` are durable and idempotent. A paused schedule survives restarts, and `resume` recomputes the next fire time from now rather than firing backlogged runs.
|
|
150
|
-
- `run` fires the schedule once immediately without affecting its cadence.
|
|
151
|
-
- `list` filters by `agentId`, `workflowId`, `threadId`, `resourceId`, `name`, and `status`. Without a filter it returns every schedule, agent and workflow alike.
|
|
125
|
+
`pause` and `resume` are durable. `run` fires the schedule once immediately without affecting its cadence. For the complete method list, filters, and patch fields, see the [`mastra.schedules` reference](https://mastra.ai/reference/schedules/overview).
|
|
152
126
|
|
|
153
127
|
### Workflow schedules
|
|
154
128
|
|
|
@@ -166,7 +140,7 @@ Workflow schedules created this way are independent of the declarative `schedule
|
|
|
166
140
|
|
|
167
141
|
### Custom IDs
|
|
168
142
|
|
|
169
|
-
|
|
143
|
+
Pass `id` when you need a predictable handle to look up, update, or delete later.
|
|
170
144
|
|
|
171
145
|
```typescript
|
|
172
146
|
await mastra.schedules.create({
|
|
@@ -175,14 +149,13 @@ await mastra.schedules.create({
|
|
|
175
149
|
cron: '0 9 * * *',
|
|
176
150
|
prompt: 'Summarize anything new since yesterday.',
|
|
177
151
|
})
|
|
178
|
-
// stored as `agent_nightly-summary`
|
|
179
152
|
```
|
|
180
153
|
|
|
181
|
-
|
|
154
|
+
See the [`create(input)` reference](https://mastra.ai/reference/schedules/overview) for ID normalization rules and duplicate ID behavior.
|
|
182
155
|
|
|
183
156
|
### From the client
|
|
184
157
|
|
|
185
|
-
The same operations are available from `@mastra/client-js` over the `/api/schedules` routes
|
|
158
|
+
The same operations are available from `@mastra/client-js` over the `/api/schedules` routes, so you can manage schedules from a separate process or a UI. See the [client-js agent schedules reference](https://mastra.ai/reference/client-js/agents) for the client method list.
|
|
186
159
|
|
|
187
160
|
## Lifecycle hooks
|
|
188
161
|
|
|
@@ -223,5 +196,6 @@ Hook exceptions are caught and logged. They never re-route the worker or trigger
|
|
|
223
196
|
|
|
224
197
|
## Related
|
|
225
198
|
|
|
199
|
+
- [`mastra.schedules`](https://mastra.ai/reference/schedules/overview): API reference for creating and managing schedules.
|
|
226
200
|
- [Signals](https://mastra.ai/docs/long-running-agents/signals): the delivery mechanism behind threaded schedules.
|
|
227
201
|
- [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows): declare a cron schedule on a workflow definition.
|
|
@@ -494,6 +494,94 @@ if (output.finishReason === 'suspended') {
|
|
|
494
494
|
}
|
|
495
495
|
```
|
|
496
496
|
|
|
497
|
+
## Agent schedules
|
|
498
|
+
|
|
499
|
+
Use the client SDK schedule methods to manage persisted agent schedules over the `/api/schedules` routes. For concepts and server-side examples, see [Schedules](https://mastra.ai/docs/long-running-agents/schedules) and the [`mastra.schedules` reference](https://mastra.ai/reference/schedules/overview).
|
|
500
|
+
|
|
501
|
+
### `createSchedule()`
|
|
502
|
+
|
|
503
|
+
Create an agent schedule by passing `agentId`.
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
const schedule = await mastraClient.createSchedule({
|
|
507
|
+
agentId: 'pinger',
|
|
508
|
+
cron: '0 * * * *',
|
|
509
|
+
prompt: 'Give me a status update.',
|
|
510
|
+
})
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### `listSchedules()`
|
|
514
|
+
|
|
515
|
+
List agent schedules. Filter by fields such as `agentId`, `threadId`, `resourceId`, `name`, or `status`.
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
const schedules = await mastraClient.listSchedules({
|
|
519
|
+
agentId: 'pinger',
|
|
520
|
+
status: 'active',
|
|
521
|
+
})
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### `getSchedule()`
|
|
525
|
+
|
|
526
|
+
Fetch a single agent schedule by ID.
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
const schedule = await mastraClient.getSchedule('agent_pinger')
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### `updateSchedule()`
|
|
533
|
+
|
|
534
|
+
Update an agent schedule. Agent schedules can update fields such as `cron`, `timezone`, `prompt`, `name`, signal delivery options, metadata, and `status`.
|
|
535
|
+
|
|
536
|
+
```typescript
|
|
537
|
+
const updated = await mastraClient.updateSchedule('agent_pinger', {
|
|
538
|
+
cron: '*/30 * * * *',
|
|
539
|
+
prompt: 'Give me a status update every 30 minutes.',
|
|
540
|
+
})
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### `deleteSchedule()`
|
|
544
|
+
|
|
545
|
+
Delete an agent schedule.
|
|
546
|
+
|
|
547
|
+
```typescript
|
|
548
|
+
await mastraClient.deleteSchedule('agent_pinger')
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### `runSchedule()`
|
|
552
|
+
|
|
553
|
+
Fire an agent schedule once immediately without changing its cron cadence.
|
|
554
|
+
|
|
555
|
+
```typescript
|
|
556
|
+
const run = await mastraClient.runSchedule('agent_pinger')
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### `pauseSchedule()`
|
|
560
|
+
|
|
561
|
+
Pause an agent schedule so the scheduler stops firing it. Returns the updated schedule.
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
await mastraClient.pauseSchedule('agent_pinger')
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### `resumeSchedule()`
|
|
568
|
+
|
|
569
|
+
Resume a paused agent schedule. The next fire time is recomputed from now, so a long-paused schedule doesn't fire a backlog. Returns the updated schedule.
|
|
570
|
+
|
|
571
|
+
```typescript
|
|
572
|
+
await mastraClient.resumeSchedule('agent_pinger')
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### `listScheduleTriggers()`
|
|
576
|
+
|
|
577
|
+
List the trigger history for an agent schedule, including the joined run summary for each fire.
|
|
578
|
+
|
|
579
|
+
```typescript
|
|
580
|
+
const { triggers } = await mastraClient.listScheduleTriggers('agent_pinger', {
|
|
581
|
+
limit: 50,
|
|
582
|
+
})
|
|
583
|
+
```
|
|
584
|
+
|
|
497
585
|
## Client tools
|
|
498
586
|
|
|
499
587
|
Client-side tools allow you to execute custom functions on the client side when the agent requests them.
|
|
@@ -214,11 +214,23 @@ A workflow run result yields the following:
|
|
|
214
214
|
|
|
215
215
|
## Schedules
|
|
216
216
|
|
|
217
|
-
Schedules are declared in code via the `schedule` field on `createWorkflow`. The client SDK exposes read and operational methods for managing
|
|
217
|
+
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).
|
|
218
|
+
|
|
219
|
+
### `createSchedule()`
|
|
220
|
+
|
|
221
|
+
Create a workflow schedule by passing `workflowId`.
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
const schedule = await mastraClient.createSchedule({
|
|
225
|
+
workflowId: 'daily-report',
|
|
226
|
+
cron: '0 9 * * *',
|
|
227
|
+
inputData: { reportType: 'summary' },
|
|
228
|
+
})
|
|
229
|
+
```
|
|
218
230
|
|
|
219
231
|
### `listSchedules()`
|
|
220
232
|
|
|
221
|
-
List
|
|
233
|
+
List workflow schedules, optionally filtered by workflow ID or status.
|
|
222
234
|
|
|
223
235
|
```typescript
|
|
224
236
|
const schedules = await mastraClient.listSchedules({
|
|
@@ -229,15 +241,42 @@ const schedules = await mastraClient.listSchedules({
|
|
|
229
241
|
|
|
230
242
|
### `getSchedule()`
|
|
231
243
|
|
|
232
|
-
Fetch a single schedule by
|
|
244
|
+
Fetch a single workflow schedule by ID.
|
|
233
245
|
|
|
234
246
|
```typescript
|
|
235
247
|
const schedule = await mastraClient.getSchedule('daily-report')
|
|
236
248
|
```
|
|
237
249
|
|
|
250
|
+
### `updateSchedule()`
|
|
251
|
+
|
|
252
|
+
Update a workflow schedule.
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
const updated = await mastraClient.updateSchedule('daily-report', {
|
|
256
|
+
cron: '0 10 * * *',
|
|
257
|
+
inputData: { reportType: 'summary' },
|
|
258
|
+
})
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `deleteSchedule()`
|
|
262
|
+
|
|
263
|
+
Delete a workflow schedule.
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
await mastraClient.deleteSchedule('daily-report')
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### `runSchedule()`
|
|
270
|
+
|
|
271
|
+
Fire a workflow schedule once immediately without changing its cron cadence.
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const run = await mastraClient.runSchedule('daily-report')
|
|
275
|
+
```
|
|
276
|
+
|
|
238
277
|
### `pauseSchedule()`
|
|
239
278
|
|
|
240
|
-
Pause a schedule so the scheduler stops firing it. Returns the updated schedule.
|
|
279
|
+
Pause a schedule so the scheduler stops firing it. Returns the updated schedule.
|
|
241
280
|
|
|
242
281
|
```typescript
|
|
243
282
|
await mastraClient.pauseSchedule('daily-report')
|
|
@@ -245,7 +284,7 @@ await mastraClient.pauseSchedule('daily-report')
|
|
|
245
284
|
|
|
246
285
|
### `resumeSchedule()`
|
|
247
286
|
|
|
248
|
-
Resume a paused schedule. The next fire time is recomputed from now, so a long-paused schedule doesn't fire a backlog. Returns the updated schedule.
|
|
287
|
+
Resume a paused schedule. The next fire time is recomputed from now, so a long-paused schedule doesn't fire a backlog. Returns the updated schedule.
|
|
249
288
|
|
|
250
289
|
```typescript
|
|
251
290
|
await mastraClient.resumeSchedule('daily-report')
|
|
@@ -253,7 +292,7 @@ await mastraClient.resumeSchedule('daily-report')
|
|
|
253
292
|
|
|
254
293
|
### `listScheduleTriggers()`
|
|
255
294
|
|
|
256
|
-
List the trigger history for a schedule, including the joined run summary for each fire.
|
|
295
|
+
List the trigger history for a workflow schedule, including the joined run summary for each fire.
|
|
257
296
|
|
|
258
297
|
```typescript
|
|
259
298
|
const { triggers } = await mastraClient.listScheduleTriggers('daily-report', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "1.31.0
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"canonicalize": "^1.0.8",
|
|
40
40
|
"jose": "^6.2.1",
|
|
41
41
|
"json-schema": "^0.4.0",
|
|
42
|
-
"@mastra/core": "1.50.0
|
|
42
|
+
"@mastra/core": "1.50.0",
|
|
43
43
|
"@mastra/schema-compat": "1.3.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"typescript": "^6.0.3",
|
|
57
57
|
"vitest": "4.1.8",
|
|
58
58
|
"zod": "^4.4.3",
|
|
59
|
-
"@internal/ai-sdk-
|
|
60
|
-
"@internal/
|
|
61
|
-
"@internal/
|
|
62
|
-
"@internal/types-builder": "0.0.
|
|
59
|
+
"@internal/ai-sdk-v4": "0.0.59",
|
|
60
|
+
"@internal/ai-sdk-v5": "0.0.59",
|
|
61
|
+
"@internal/lint": "0.0.112",
|
|
62
|
+
"@internal/types-builder": "0.0.87"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=22.13.0"
|