@mastra/client-js 1.51.0-alpha.9 → 1.51.1-alpha.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.1-alpha.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.1-alpha.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.
@@ -45,7 +45,7 @@ const completeTrace = await mastraClient.getTrace(traces.spans[0].traceId)
45
45
 
46
46
  ## Listing traces for a list view
47
47
 
48
- `listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries a short `inputPreview` string instead, so a list can render a preview column without transferring the whole prompt.
48
+ `listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries a short `inputPreview` string instead, so a list can render a preview column without transferring the whole prompt, plus `threadId` and `resourceId` for the memory context columns.
49
49
 
50
50
  Prefer it whenever you are rendering many traces at once, and fetch the full record only when a row is opened:
51
51
 
@@ -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';
@@ -2501,6 +2501,8 @@ type Shared_Type_60 = {
2501
2501
  entityType?: (Shared_Type_58 | null) | undefined;
2502
2502
  entityId?: (string | null) | undefined;
2503
2503
  entityName?: (string | null) | undefined;
2504
+ threadId?: ((string | null) | undefined) | null;
2505
+ resourceId?: ((string | null) | undefined) | null;
2504
2506
  metadata?: ({
2505
2507
  [key: string]: unknown;
2506
2508
  } | null) | undefined;
@@ -3075,7 +3077,7 @@ type Shared_Type_81 = {
3075
3077
  /** List of asset file paths */
3076
3078
  assets?: string[] | undefined;
3077
3079
  /** Full file tree structure for the skill */
3078
- files?: Shared_Auxiliary_750[] | undefined;
3080
+ files?: Shared_Auxiliary_752[] | undefined;
3079
3081
  /** Additional metadata for the skill */
3080
3082
  metadata?: {
3081
3083
  [key: string]: unknown;
@@ -5933,7 +5935,7 @@ export type GetProcessors_Response = {
5933
5935
  id: string;
5934
5936
  name?: string | undefined;
5935
5937
  description?: string | undefined;
5936
- phases: ('input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult')[];
5938
+ phases: ('input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult' | 'llmRequest')[];
5937
5939
  agentIds: string[];
5938
5940
  configurations: {
5939
5941
  agentId: string;
@@ -5969,7 +5971,7 @@ export type GetProcessorsProcessorId_Response = {
5969
5971
  id: string;
5970
5972
  name?: string | undefined;
5971
5973
  description?: string | undefined;
5972
- phases: ('input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult')[];
5974
+ phases: ('input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult' | 'llmRequest')[];
5973
5975
  configurations: {
5974
5976
  agentId: string;
5975
5977
  agentName: string;
@@ -5998,7 +6000,7 @@ export interface GetProcessorsProcessorId_RouteContract {
5998
6000
  }
5999
6001
  export type PostProcessorsProcessorIdExecute_PathParams = GetProcessorsProcessorId_PathParams;
6000
6002
  export type PostProcessorsProcessorIdExecute_Body = {
6001
- phase: 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult';
6003
+ phase: 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult' | 'llmRequest';
6002
6004
  messages: {
6003
6005
  id: string;
6004
6006
  role: 'user' | 'assistant' | 'system' | 'tool' | 'signal';
@@ -7852,6 +7854,53 @@ export interface PostObservabilityTracesQuery_RouteContract {
7852
7854
  response: PostObservabilityTracesQuery_Response;
7853
7855
  responseType: 'json';
7854
7856
  }
7857
+ export type PostObservabilityTracesAggregate_Body = {
7858
+ timeRange: {
7859
+ from: string;
7860
+ to: string;
7861
+ };
7862
+ where?: InputShared_Auxiliary_204 | undefined;
7863
+ groupBy?: string[];
7864
+ interval?: ('1m' | '5m' | '15m' | '1h' | '1d') | undefined;
7865
+ measures: (('count' | 'duration.avg' | 'duration.min' | 'duration.max' | 'duration.p50' | 'duration.p90' | 'duration.p95' | 'duration.p99' | 'errorCount' | 'errorRate') | `countDistinct.${string}`)[];
7866
+ having?: InputShared_Auxiliary_223 | undefined;
7867
+ orderBy?: {
7868
+ field: string;
7869
+ direction: 'asc' | 'desc';
7870
+ };
7871
+ limit?: number;
7872
+ };
7873
+ export type PostObservabilityTracesAggregate_Response = {
7874
+ rows: {
7875
+ dimensions?: {
7876
+ [key: string]: string | null;
7877
+ } | undefined;
7878
+ bucket?: string | undefined;
7879
+ measures: {
7880
+ [K in ('count' | 'duration.avg' | 'duration.min' | 'duration.max' | 'duration.p50' | 'duration.p90' | 'duration.p95' | 'duration.p99' | 'errorCount' | 'errorRate') | `countDistinct.${string}`]?: number;
7881
+ };
7882
+ }[];
7883
+ truncated: boolean;
7884
+ };
7885
+ export type PostObservabilityTracesAggregate_Request = Simplify<(never extends never ? {} : {
7886
+ params: never;
7887
+ }) & (never extends never ? {} : {} extends never ? {
7888
+ query?: never;
7889
+ } : {
7890
+ query: never;
7891
+ }) & (PostObservabilityTracesAggregate_Body extends never ? {} : {} extends PostObservabilityTracesAggregate_Body ? {
7892
+ body?: PostObservabilityTracesAggregate_Body;
7893
+ } : {
7894
+ body: PostObservabilityTracesAggregate_Body;
7895
+ })>;
7896
+ export interface PostObservabilityTracesAggregate_RouteContract {
7897
+ pathParams: never;
7898
+ queryParams: never;
7899
+ body: PostObservabilityTracesAggregate_Body;
7900
+ request: PostObservabilityTracesAggregate_Request;
7901
+ response: PostObservabilityTracesAggregate_Response;
7902
+ responseType: 'json';
7903
+ }
7855
7904
  export type PostObservabilityThreadsQuery_Body = {
7856
7905
  traces: {
7857
7906
  timeRange: {
@@ -7860,7 +7909,7 @@ export type PostObservabilityThreadsQuery_Body = {
7860
7909
  };
7861
7910
  where?: InputShared_Auxiliary_204 | undefined;
7862
7911
  };
7863
- where?: InputShared_Auxiliary_251 | undefined;
7912
+ where?: InputShared_Auxiliary_254 | undefined;
7864
7913
  page?: {
7865
7914
  limit?: number;
7866
7915
  after?: (string | null) | undefined;
@@ -14152,7 +14201,7 @@ export type PostStoredSkills_Body = {
14152
14201
  /** List of asset file paths */
14153
14202
  assets?: string[] | undefined;
14154
14203
  /** Full file tree structure for the skill */
14155
- files?: InputShared_Auxiliary_741[] | undefined;
14204
+ files?: InputShared_Auxiliary_744[] | undefined;
14156
14205
  /** Additional metadata for the skill */
14157
14206
  metadata?: {
14158
14207
  [key: string]: unknown;
@@ -14202,7 +14251,7 @@ export type PatchStoredSkillsStoredSkillId_Body = {
14202
14251
  /** List of asset file paths */
14203
14252
  assets?: (string[] | undefined) | undefined;
14204
14253
  /** Full file tree structure for the skill */
14205
- files?: (InputShared_Auxiliary_741[] | undefined) | undefined;
14254
+ files?: (InputShared_Auxiliary_744[] | undefined) | undefined;
14206
14255
  /** Additional metadata for the skill */
14207
14256
  metadata?: ({
14208
14257
  [key: string]: unknown;
@@ -18552,6 +18601,7 @@ export interface RouteTypes {
18552
18601
  'POST /observability/traces/score': PostObservabilityTracesScore_RouteContract;
18553
18602
  'GET /observability/traces/:traceId/:spanId/scores': GetObservabilityTracesTraceIdSpanIdScores_RouteContract;
18554
18603
  'POST /observability/traces/query': PostObservabilityTracesQuery_RouteContract;
18604
+ 'POST /observability/traces/aggregate': PostObservabilityTracesAggregate_RouteContract;
18555
18605
  'POST /observability/threads/query': PostObservabilityThreadsQuery_RouteContract;
18556
18606
  'POST /observability/traces/query/fields': PostObservabilityTracesQueryFields_RouteContract;
18557
18607
  'POST /observability/traces/query/values': PostObservabilityTracesQueryValues_RouteContract;
@@ -19509,6 +19559,9 @@ export interface Client {
19509
19559
  '/observability/traces/:traceId/trajectory': {
19510
19560
  GET: GetObservabilityTracesTraceIdTrajectory_RouteContract;
19511
19561
  };
19562
+ '/observability/traces/aggregate': {
19563
+ POST: PostObservabilityTracesAggregate_RouteContract;
19564
+ };
19512
19565
  '/observability/traces/delete': {
19513
19566
  POST: PostObservabilityTracesDelete_RouteContract;
19514
19567
  };