@mastra/client-js 1.51.0-alpha.9 → 1.51.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.
@@ -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.51.0-alpha.9"
6
+ version: "1.51.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.51.0-alpha.9",
2
+ "version": "1.51.0",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -196,6 +196,33 @@ Every hook context includes `agentId` (the agent the schedule fired for) alongsi
196
196
 
197
197
  Hook exceptions are caught and logged. They never re-route the worker or trigger another hook.
198
198
 
199
+ ## Recurring prompts in Mastra Code
200
+
201
+ Mastra Code offers the `/schedules` command, which attaches a recurring prompt to the current conversation thread. Unlike `mastra.schedules`, these schedules live only in the Mastra Code process that created them: nothing is written to storage, and each fire is sent to the thread with `agent.sendSignal()` directly.
202
+
203
+ Run `/schedules` to open a menu with **Create schedule** and one row per schedule on the current thread. Creating a schedule walks through these steps:
204
+
205
+ 1. Choose what each fire sends: a **Prompt**, a **Prompt file** that's re-read on every fire, or a **Script** that runs on every fire.
206
+ 2. Enter the prompt text or the file path. Paths resolve from the project root. For a script, you can add a prompt that's sent after the script output.
207
+ 3. Pick a cadence from `1m` to `1d`, or type one such as `20m` or `3h`. Minute steps must divide an hour and hour steps must divide a day.
208
+ 4. Confirm.
209
+
210
+ Scripts run from the project root with a 60-second timeout, and their stdout, stderr, and exit code become the prompt. The extra prompt is never passed to the script.
211
+
212
+ Selecting an existing schedule offers **Run now**, **Pause** or **Resume**, and **Delete**. **Run now** fires the schedule once without changing its cadence, works on paused schedules, and is skipped while a fire of the same schedule is still running.
213
+
214
+ Each fire arrives on the thread as a `user`-type signal and shows in the transcript as a `schedule` entry with the schedule's id, cadence, source, and script exit status. If the thread is busy, the running agent receives the prompt as its next input, the same way a message you type mid-run does. If the thread is idle, it wakes and runs. Schedules fire on any thread in the process, not only the one focused in the terminal. After `/new`, a new schedule binds to the new thread.
215
+
216
+ Things to know:
217
+
218
+ - **Session scoped.** Schedules exist only in the Mastra Code process that created them and stop when it exits. Other Mastra Code processes sharing the same database never see or fire them.
219
+ - **Clock boundaries.** `5m` fires at :00, :05, :10 and so on, not five minutes after creation, and `1d` fires at local midnight. Hour and day cadences follow wall-clock time across daylight saving changes, like cron. A fire missed while the machine slept, or one whose timer runs more than a minute late, is skipped, and the schedule resumes at the next boundary.
220
+ - **Overlapping fires are skipped.** If a script is still running when the next boundary arrives, that fire doesn't run.
221
+
222
+ ### Agent schedule tools
223
+
224
+ Turning on **Experimental schedule tools** in `/settings` (restart required) gives the agent tools that manage the same schedules: `schedule_create`, `schedule_list`, `schedule_update` (pause or delete), `schedule_resume`, and `schedule_run`. The tools only see and change schedules on the thread of the run that calls them. Because a schedule can run a script on every fire, `schedule_create`, `schedule_resume`, and `schedule_run` need the same approval as running a shell command unless YOLO mode is on. Schedules the agent creates are marked `created by agent` in the transcript.
225
+
199
226
  ## Related
200
227
 
201
228
  - [`mastra.schedules`](https://mastra.ai/reference/schedules/overview): API reference for creating and managing schedules.
@@ -96,12 +96,12 @@ type InputShared_Auxiliary_223 = {
96
96
  op: 'not';
97
97
  arg: InputShared_Auxiliary_223;
98
98
  };
99
- type InputShared_Auxiliary_251 = {
99
+ type InputShared_Auxiliary_254 = {
100
100
  op: 'and' | 'or';
101
- args: InputShared_Auxiliary_251[];
101
+ args: InputShared_Auxiliary_254[];
102
102
  } | {
103
103
  op: 'not';
104
- arg: InputShared_Auxiliary_251;
104
+ arg: InputShared_Auxiliary_254;
105
105
  } | {
106
106
  traces: {
107
107
  some: InputShared_Auxiliary_204;
@@ -109,7 +109,7 @@ type InputShared_Auxiliary_251 = {
109
109
  none: InputShared_Auxiliary_204;
110
110
  };
111
111
  };
112
- type InputShared_Auxiliary_667 = {
112
+ type InputShared_Auxiliary_670 = {
113
113
  op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte';
114
114
  left: {
115
115
  path: string;
@@ -141,24 +141,24 @@ type InputShared_Auxiliary_667 = {
141
141
  };
142
142
  } | {
143
143
  op: 'and' | 'or';
144
- args: InputShared_Auxiliary_667[];
144
+ args: InputShared_Auxiliary_670[];
145
145
  } | {
146
146
  op: 'not';
147
- arg: InputShared_Auxiliary_667;
147
+ arg: InputShared_Auxiliary_670;
148
148
  };
149
- type InputShared_Auxiliary_741 = {
149
+ type InputShared_Auxiliary_744 = {
150
150
  id?: string | undefined;
151
151
  name: string;
152
152
  type: 'file' | 'folder';
153
153
  content?: string | undefined;
154
- children?: InputShared_Auxiliary_741[] | undefined;
154
+ children?: InputShared_Auxiliary_744[] | undefined;
155
155
  };
156
- type Shared_Auxiliary_750 = {
156
+ type Shared_Auxiliary_752 = {
157
157
  id?: string | undefined;
158
158
  name: string;
159
159
  type: 'file' | 'folder';
160
160
  content?: string | undefined;
161
- children?: Shared_Auxiliary_750[] | undefined;
161
+ children?: Shared_Auxiliary_752[] | undefined;
162
162
  };
163
163
  type InputShared_Type_0 = {
164
164
  thread: string | {
@@ -1280,7 +1280,7 @@ type InputShared_Type_86 = {
1280
1280
  [key: string]: unknown;
1281
1281
  } | undefined;
1282
1282
  steps: InputShared_Type_81[];
1283
- predicates: InputShared_Auxiliary_667[];
1283
+ predicates: InputShared_Auxiliary_670[];
1284
1284
  };
1285
1285
  type InputShared_Type_87 = {
1286
1286
  type: 'loop';
@@ -1291,7 +1291,7 @@ type InputShared_Type_87 = {
1291
1291
  } | undefined;
1292
1292
  step: InputShared_Type_81;
1293
1293
  loopType: 'dowhile' | 'dountil';
1294
- predicate: InputShared_Auxiliary_667;
1294
+ predicate: InputShared_Auxiliary_670;
1295
1295
  };
1296
1296
  type InputShared_Type_88 = InputShared_Type_78 | InputShared_Type_79 | InputShared_Type_80 | {
1297
1297
  type: 'workflow';
@@ -3075,7 +3075,7 @@ type Shared_Type_81 = {
3075
3075
  /** List of asset file paths */
3076
3076
  assets?: string[] | undefined;
3077
3077
  /** Full file tree structure for the skill */
3078
- files?: Shared_Auxiliary_750[] | undefined;
3078
+ files?: Shared_Auxiliary_752[] | undefined;
3079
3079
  /** Additional metadata for the skill */
3080
3080
  metadata?: {
3081
3081
  [key: string]: unknown;
@@ -7852,6 +7852,53 @@ export interface PostObservabilityTracesQuery_RouteContract {
7852
7852
  response: PostObservabilityTracesQuery_Response;
7853
7853
  responseType: 'json';
7854
7854
  }
7855
+ export type PostObservabilityTracesAggregate_Body = {
7856
+ timeRange: {
7857
+ from: string;
7858
+ to: string;
7859
+ };
7860
+ where?: InputShared_Auxiliary_204 | undefined;
7861
+ groupBy?: string[];
7862
+ interval?: ('1m' | '5m' | '15m' | '1h' | '1d') | undefined;
7863
+ measures: (('count' | 'duration.avg' | 'duration.min' | 'duration.max' | 'duration.p50' | 'duration.p90' | 'duration.p95' | 'duration.p99' | 'errorCount' | 'errorRate') | `countDistinct.${string}`)[];
7864
+ having?: InputShared_Auxiliary_223 | undefined;
7865
+ orderBy?: {
7866
+ field: string;
7867
+ direction: 'asc' | 'desc';
7868
+ };
7869
+ limit?: number;
7870
+ };
7871
+ export type PostObservabilityTracesAggregate_Response = {
7872
+ rows: {
7873
+ dimensions?: {
7874
+ [key: string]: string | null;
7875
+ } | undefined;
7876
+ bucket?: string | undefined;
7877
+ measures: {
7878
+ [K in ('count' | 'duration.avg' | 'duration.min' | 'duration.max' | 'duration.p50' | 'duration.p90' | 'duration.p95' | 'duration.p99' | 'errorCount' | 'errorRate') | `countDistinct.${string}`]?: number;
7879
+ };
7880
+ }[];
7881
+ truncated: boolean;
7882
+ };
7883
+ export type PostObservabilityTracesAggregate_Request = Simplify<(never extends never ? {} : {
7884
+ params: never;
7885
+ }) & (never extends never ? {} : {} extends never ? {
7886
+ query?: never;
7887
+ } : {
7888
+ query: never;
7889
+ }) & (PostObservabilityTracesAggregate_Body extends never ? {} : {} extends PostObservabilityTracesAggregate_Body ? {
7890
+ body?: PostObservabilityTracesAggregate_Body;
7891
+ } : {
7892
+ body: PostObservabilityTracesAggregate_Body;
7893
+ })>;
7894
+ export interface PostObservabilityTracesAggregate_RouteContract {
7895
+ pathParams: never;
7896
+ queryParams: never;
7897
+ body: PostObservabilityTracesAggregate_Body;
7898
+ request: PostObservabilityTracesAggregate_Request;
7899
+ response: PostObservabilityTracesAggregate_Response;
7900
+ responseType: 'json';
7901
+ }
7855
7902
  export type PostObservabilityThreadsQuery_Body = {
7856
7903
  traces: {
7857
7904
  timeRange: {
@@ -7860,7 +7907,7 @@ export type PostObservabilityThreadsQuery_Body = {
7860
7907
  };
7861
7908
  where?: InputShared_Auxiliary_204 | undefined;
7862
7909
  };
7863
- where?: InputShared_Auxiliary_251 | undefined;
7910
+ where?: InputShared_Auxiliary_254 | undefined;
7864
7911
  page?: {
7865
7912
  limit?: number;
7866
7913
  after?: (string | null) | undefined;
@@ -14152,7 +14199,7 @@ export type PostStoredSkills_Body = {
14152
14199
  /** List of asset file paths */
14153
14200
  assets?: string[] | undefined;
14154
14201
  /** Full file tree structure for the skill */
14155
- files?: InputShared_Auxiliary_741[] | undefined;
14202
+ files?: InputShared_Auxiliary_744[] | undefined;
14156
14203
  /** Additional metadata for the skill */
14157
14204
  metadata?: {
14158
14205
  [key: string]: unknown;
@@ -14202,7 +14249,7 @@ export type PatchStoredSkillsStoredSkillId_Body = {
14202
14249
  /** List of asset file paths */
14203
14250
  assets?: (string[] | undefined) | undefined;
14204
14251
  /** Full file tree structure for the skill */
14205
- files?: (InputShared_Auxiliary_741[] | undefined) | undefined;
14252
+ files?: (InputShared_Auxiliary_744[] | undefined) | undefined;
14206
14253
  /** Additional metadata for the skill */
14207
14254
  metadata?: ({
14208
14255
  [key: string]: unknown;
@@ -18552,6 +18599,7 @@ export interface RouteTypes {
18552
18599
  'POST /observability/traces/score': PostObservabilityTracesScore_RouteContract;
18553
18600
  'GET /observability/traces/:traceId/:spanId/scores': GetObservabilityTracesTraceIdSpanIdScores_RouteContract;
18554
18601
  'POST /observability/traces/query': PostObservabilityTracesQuery_RouteContract;
18602
+ 'POST /observability/traces/aggregate': PostObservabilityTracesAggregate_RouteContract;
18555
18603
  'POST /observability/threads/query': PostObservabilityThreadsQuery_RouteContract;
18556
18604
  'POST /observability/traces/query/fields': PostObservabilityTracesQueryFields_RouteContract;
18557
18605
  'POST /observability/traces/query/values': PostObservabilityTracesQueryValues_RouteContract;
@@ -19509,6 +19557,9 @@ export interface Client {
19509
19557
  '/observability/traces/:traceId/trajectory': {
19510
19558
  GET: GetObservabilityTracesTraceIdTrajectory_RouteContract;
19511
19559
  };
19560
+ '/observability/traces/aggregate': {
19561
+ POST: PostObservabilityTracesAggregate_RouteContract;
19562
+ };
19512
19563
  '/observability/traces/delete': {
19513
19564
  POST: PostObservabilityTracesDelete_RouteContract;
19514
19565
  };