@mastra/client-js 1.51.0-alpha.1 → 1.51.0-alpha.10

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.1"
6
+ version: "1.51.0-alpha.10"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.51.0-alpha.1",
2
+ "version": "1.51.0-alpha.10",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -270,7 +270,7 @@ session.subscribe(event => {
270
270
  })
271
271
  ```
272
272
 
273
- The `always_allow_category` decision grants the tool category for the rest of the live Session. Session grants aren't durable process-level permissions.
273
+ The `always_allow_category` decision grants the tool category for the gate's thread. Grants aren't durable process-level permissions.
274
274
 
275
275
  Interactive tools such as [`ask_user`](https://mastra.ai/reference/tools/ask-user-tool) and [`submit_plan`](https://mastra.ai/reference/tools/submit-plan-tool) use resumable tool suspensions instead. Resume them with [`session.respondToToolSuspension()`](https://mastra.ai/reference/agent-controller/session):
276
276
 
@@ -401,7 +401,7 @@ Create the session under `thread.resourceId`. Because a session can bind only th
401
401
 
402
402
  Failures that aren't refusals (a storage outage, a bug in your resolver's dependencies) still post an error to the thread, so a broken bot doesn't look like a silent one. If you need to tell them apart in your own code, a refusal is a `ChannelSessionRejectedError` with the original error as its `cause`.
403
403
 
404
- `resolveSession` also runs when a user answers an approval card, with that action's request context, so a shared install revalidates the person approving rather than trusting the person who sent the original message.
404
+ `resolveSession` also runs when a user answers an approval card, with that action's request context. A shared install revalidates the person approving rather than trusting the person who sent the original message.
405
405
 
406
406
  ### Handle stale approvals
407
407
 
@@ -470,7 +470,7 @@ const subscription = await session.subscribe({
470
470
  subscription.unsubscribe()
471
471
  ```
472
472
 
473
- `subscribe()` takes an options object and is async, unlike the in-process listener. Its promise resolves once the stream is established and rejects when it can't connect, so a rejected call leaves nothing running in the background. `reconnect: true` re-establishes a stream that drops after it was established, with exponential backoff.
473
+ `subscribe()` takes an options object and is async, unlike the in-process listener. Its promise resolves once the stream is established and rejects when it can't connect. A rejected call leaves nothing running in the background. `reconnect: true` re-establishes a stream that drops after it was established, with exponential backoff.
474
474
 
475
475
  The server doesn't replay events missed while the stream was down, so read `session.state()` from `onReconnect` for the current mode, model, and thread. The client surface has no `session.displayState.get()`.
476
476
 
@@ -483,4 +483,6 @@ Send work with `session.sendMessage(content)`, or `session.sendMessage({ content
483
483
  - [Agents](https://mastra.ai/docs/agents/overview)
484
484
  - [Workspace](https://mastra.ai/docs/sandbox/overview)
485
485
  - [Observational memory](https://mastra.ai/docs/memory/observational-memory)
486
- - [Channels](https://mastra.ai/docs/channels)
486
+ - [Channels](https://mastra.ai/docs/channels)
487
+ - [Mastra Code](https://code.mastra.ai)
488
+ - [Mastra Factory](https://factory.mastra.ai)
@@ -73,7 +73,7 @@ Without a `threadId`, each fire is an isolated `agent.generate()` run. Nothing i
73
73
 
74
74
  ### Threaded
75
75
 
76
- With a `threadId`, the schedule sends a [signal](https://mastra.ai/docs/harness/signals) into that thread, so the prompt joins the agent's conversation. Threaded schedules require a `resourceId` alongside the `threadId`.
76
+ With a `threadId`, the schedule sends a [signal](https://mastra.ai/docs/harness/signals) into that thread. The prompt joins the agent's conversation. Threaded schedules require a `resourceId` alongside the `threadId`.
77
77
 
78
78
  ```typescript
79
79
  await mastra.schedules.create({
@@ -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.
@@ -218,7 +218,7 @@ export const agentsMdReminderProcessor: Processor = {
218
218
  }
219
219
  ```
220
220
 
221
- Reactive signals default to `tagName: 'system-reminder'`, so the model receives this context as
221
+ Reactive signals default to `tagName: 'system-reminder'`. The model receives this context as
222
222
 
223
223
  ```xml
224
224
  <system-reminder type="dynamic-agents-md" path="packages/ui/AGENTS.md">
@@ -411,7 +411,7 @@ export const mastra = new Mastra({
411
411
  })
412
412
  ```
413
413
 
414
- `RedisStreamsPubSub` implements both the event delivery contract and distributed leasing, so a single backend handles cross-instance signal delivery and lease ownership. Vercel's managed Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
414
+ `RedisStreamsPubSub` implements both the event delivery contract and distributed leasing. A single backend handles cross-instance signal delivery and lease ownership. Vercel's managed Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
415
415
 
416
416
  ## Compatibility and APIs
417
417
 
@@ -91,7 +91,7 @@ Returns: `Promise<CreateAgentControllerSessionResponse>`
91
91
 
92
92
  ### `subscribe(options)`
93
93
 
94
- Subscribes to the session's event stream over SSE. The promise resolves once the stream is established and rejects when it can't connect, so a rejected call leaves nothing running in the background. `reconnect` only governs re-establishing a stream that drops after it was established. To retry the initial connection, loop around `subscribe()`.
94
+ Subscribes to the session's event stream over SSE. The promise resolves once the stream is established and rejects when it can't connect. A rejected call leaves nothing running in the background. `reconnect` only governs re-establishing a stream that drops after it was established. To retry the initial connection, loop around `subscribe()`.
95
95
 
96
96
  **onEvent** (`(event: AgentControllerEvent) => void`): Called for each event received over the stream. See Events for the event types.
97
97
 
@@ -283,21 +283,21 @@ Hono and Fastify enforce the request-body limit before JSON parsing. Express and
283
283
 
284
284
  ## Fields and operators
285
285
 
286
- | Predicate context | Fields | Operators |
287
- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
288
- | Trace | `traceId`, `threadId`, `resourceId`, `entityName`, `entityType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
289
- | Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
290
- | Trace | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
291
- | Trace | `tags` | `includes`, `notIncludes`, `exists`, `notExists` |
292
- | Span | `name`, `spanType`, `model`, `provider`, `status`, `entityType`, `entityId`, `entityName`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
293
- | Span | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
294
- | Span | `error` | `exists`, `notExists` |
295
- | Score | `scorerId`, `scorerVersion`, `scoreSource`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
296
- | Score | `score`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
297
- | Score | `spanId` | `exists`, `notExists` |
298
- | Feedback | `feedbackType`, `feedbackSource`, `feedbackUserId`, `sourceId`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
299
- | Feedback | `value`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
300
- | Feedback | `comment` | `exists`, `notExists` |
286
+ | Predicate context | Fields | Operators |
287
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
288
+ | Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityName`, `entityType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
289
+ | Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
290
+ | Trace | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
291
+ | Trace | `tags` | `includes`, `notIncludes`, `exists`, `notExists` |
292
+ | Span | `name`, `spanType`, `model`, `provider`, `status`, `entityType`, `entityId`, `entityName`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId`, `runId`, `sessionId`, `userId`, `organizationId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
293
+ | Span | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
294
+ | Span | `error` | `exists`, `notExists` |
295
+ | Score | `scorerId`, `scorerVersion`, `scoreSource`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
296
+ | Score | `score`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
297
+ | Score | `spanId` | `exists`, `notExists` |
298
+ | Feedback | `feedbackType`, `feedbackSource`, `feedbackUserId`, `sourceId`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
299
+ | Feedback | `value`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
300
+ | Feedback | `comment` | `exists`, `notExists` |
301
301
 
302
302
  Compose predicates with `{ op: 'and', args: [...] }`, `{ op: 'or', args: [...] }`, and `{ op: 'not', arg: ... }`. Comparison predicates place a field reference on the left and a literal on the right. Membership predicates use a field reference in `value` and a homogeneous literal array in `set`. Tag predicates name the stored tag collection in `path`. `includes` and `notIncludes` also take one tag in `value`, while `exists` and `notExists` take only `op` and `path`. See [Filter by tags](#filter-by-tags).
303
303
 
@@ -319,6 +319,27 @@ This top-level predicate doesn't inspect child spans. In contrast, `spans.some`
319
319
 
320
320
  Trace queries exclude incomplete roots before evaluating predicates. As a result, `{ op: 'notExists', path: 'durationMs' }` doesn't find running traces or malformed roots without a usable `endedAt`.
321
321
 
322
+ ### Filter by context identifiers
323
+
324
+ `runId`, `sessionId`, `userId`, and `organizationId` are available at trace scope and inside `spans.some` / `spans.none`. Trace-scope predicates read the current root span. Span-scope predicates bind to one related current span, so a run recorded only on a child span is found through `spans.some`:
325
+
326
+ ```typescript
327
+ const sessionTracesWithRun = {
328
+ op: 'and',
329
+ args: [
330
+ { op: 'eq', left: { path: 'organizationId' }, right: { literal: 'org-123' } },
331
+ { op: 'eq', left: { path: 'sessionId' }, right: { literal: 'session-123' } },
332
+ {
333
+ spans: {
334
+ some: { op: 'eq', left: { path: 'runId' }, right: { literal: 'run-42' } },
335
+ },
336
+ },
337
+ ],
338
+ }
339
+ ```
340
+
341
+ These identifiers support `eq`, `ne`, `in`, `notIn`, `exists`, and `notExists`. Field discovery lists them, but value discovery doesn't return their recorded values. Stores advertise support through the `trace-query-context-ids` feature. A predicate on one of these fields against an older store returns `501` before storage runs, and field discovery omits them for that store.
342
+
322
343
  ### Filter by span properties
323
344
 
324
345
  Every condition inside one `spans.some` or `spans.none` clause applies to the same current span. For example, this predicate finds a failed tool span whose name is `medication_lookup`; a matching name on one span and an error on another don't satisfy it:
@@ -679,7 +700,7 @@ const plan = planTraceQuery(parseTraceQueryRequest(request), {
679
700
  })
680
701
  ```
681
702
 
682
- `resourceId` is optional and narrows within the organization. Keyset and delta cursors are bound to the scope, so a cursor minted under one scope and reused under another returns `409` before storage runs. A scoped request against an observability store or `@mastra/core` that predates tenant scope returns `501` instead of running unscoped. Stores advertise support through the `trace-query-tenant-scope` feature. Callers can't name `organizationId` or `projectId` in predicates. Without a scope the routes behave as before, so self-hosted installations keep their own tenant model.
703
+ `resourceId` is optional and narrows within the organization. Keyset and delta cursors are bound to the scope. A cursor created under one scope and reused under another returns `409` before storage runs. A scoped request against an observability store or `@mastra/core` that predates tenant scope returns `501` instead of running unscoped. Stores advertise support through the `trace-query-tenant-scope` feature. Callers can't name `projectId` in predicates. An `organizationId` predicate compares recorded data and is ANDed with the scope, so it can only narrow the tenant's own traces and never widens it. Without a scope the routes behave as before, so self-hosted installations keep their own tenant model.
683
704
 
684
705
  Cursor pagination is deterministic, but it isn't a database snapshot. Traces or replacement signals written between page requests can change later pages.
685
706
 
package/dist/index.cjs CHANGED
@@ -3249,7 +3249,7 @@ var Run = class extends BaseResource {
3249
3249
  * @deprecated Use `cancel()` instead
3250
3250
  */
3251
3251
  cancelRun() {
3252
- return this.request(`/workflows/${this.workflowId}/runs/${this.runId}/cancel`, { method: "POST" });
3252
+ return this.request(`/workflows/${this.workflowId}/runs/${encodeURIComponent(this.runId)}/cancel`, { method: "POST" });
3253
3253
  }
3254
3254
  /**
3255
3255
  * Cancels a workflow run.
@@ -3313,7 +3313,7 @@ var Run = class extends BaseResource {
3313
3313
  * ```
3314
3314
  */
3315
3315
  cancel() {
3316
- return this.request(`/workflows/${this.workflowId}/runs/${this.runId}/cancel`, { method: "POST" });
3316
+ return this.request(`/workflows/${this.workflowId}/runs/${encodeURIComponent(this.runId)}/cancel`, { method: "POST" });
3317
3317
  }
3318
3318
  /**
3319
3319
  * Starts a workflow run synchronously without waiting for the workflow to complete
@@ -3322,7 +3322,7 @@ var Run = class extends BaseResource {
3322
3322
  */
3323
3323
  start(params) {
3324
3324
  const requestContext = parseClientRequestContext(params.requestContext);
3325
- return this.request(`/workflows/${this.workflowId}/start?runId=${this.runId}`, {
3325
+ return this.request(`/workflows/${this.workflowId}/start?runId=${encodeURIComponent(this.runId)}`, {
3326
3326
  method: "POST",
3327
3327
  body: {
3328
3328
  inputData: params?.inputData,
@@ -3340,7 +3340,7 @@ var Run = class extends BaseResource {
3340
3340
  */
3341
3341
  resume({ step, resumeData, tracingOptions, perStep, forEachIndex, ...rest }) {
3342
3342
  const requestContext = parseClientRequestContext(rest.requestContext);
3343
- return this.request(`/workflows/${this.workflowId}/resume?runId=${this.runId}`, {
3343
+ return this.request(`/workflows/${this.workflowId}/resume?runId=${encodeURIComponent(this.runId)}`, {
3344
3344
  method: "POST",
3345
3345
  body: {
3346
3346
  step,
@@ -3443,7 +3443,7 @@ var Run = class extends BaseResource {
3443
3443
  */
3444
3444
  resumeAsync(params) {
3445
3445
  const requestContext = parseClientRequestContext(params.requestContext);
3446
- return this.request(`/workflows/${this.workflowId}/resume-async?runId=${this.runId}`, {
3446
+ return this.request(`/workflows/${this.workflowId}/resume-async?runId=${encodeURIComponent(this.runId)}`, {
3447
3447
  method: "POST",
3448
3448
  body: {
3449
3449
  step: params.step,
@@ -3472,7 +3472,7 @@ var Run = class extends BaseResource {
3472
3472
  */
3473
3473
  resumeNoWait(params) {
3474
3474
  const requestContext = parseClientRequestContext(params.requestContext);
3475
- return this.request(`/workflows/${this.workflowId}/resume-no-wait?runId=${this.runId}`, {
3475
+ return this.request(`/workflows/${this.workflowId}/resume-no-wait?runId=${encodeURIComponent(this.runId)}`, {
3476
3476
  method: "POST",
3477
3477
  body: {
3478
3478
  step: params.step,
@@ -3516,7 +3516,7 @@ var Run = class extends BaseResource {
3516
3516
  */
3517
3517
  restart(params) {
3518
3518
  const requestContext = parseClientRequestContext(params.requestContext);
3519
- return this.request(`/workflows/${this.workflowId}/restart?runId=${this.runId}`, {
3519
+ return this.request(`/workflows/${this.workflowId}/restart?runId=${encodeURIComponent(this.runId)}`, {
3520
3520
  method: "POST",
3521
3521
  body: {
3522
3522
  requestContext,
@@ -3531,7 +3531,7 @@ var Run = class extends BaseResource {
3531
3531
  */
3532
3532
  restartAsync(params) {
3533
3533
  const requestContext = parseClientRequestContext(params?.requestContext);
3534
- return this.request(`/workflows/${this.workflowId}/restart-async?runId=${this.runId}`, {
3534
+ return this.request(`/workflows/${this.workflowId}/restart-async?runId=${encodeURIComponent(this.runId)}`, {
3535
3535
  method: "POST",
3536
3536
  body: {
3537
3537
  requestContext,
@@ -3546,7 +3546,7 @@ var Run = class extends BaseResource {
3546
3546
  */
3547
3547
  timeTravel({ requestContext: paramsRequestContext, ...params }) {
3548
3548
  const requestContext = parseClientRequestContext(paramsRequestContext);
3549
- return this.request(`/workflows/${this.workflowId}/time-travel?runId=${this.runId}`, {
3549
+ return this.request(`/workflows/${this.workflowId}/time-travel?runId=${encodeURIComponent(this.runId)}`, {
3550
3550
  method: "POST",
3551
3551
  body: {
3552
3552
  ...params,
@@ -3561,7 +3561,7 @@ var Run = class extends BaseResource {
3561
3561
  */
3562
3562
  timeTravelAsync({ requestContext: paramsRequestContext, ...params }) {
3563
3563
  const requestContext = parseClientRequestContext(paramsRequestContext);
3564
- return this.request(`/workflows/${this.workflowId}/time-travel-async?runId=${this.runId}`, {
3564
+ return this.request(`/workflows/${this.workflowId}/time-travel-async?runId=${encodeURIComponent(this.runId)}`, {
3565
3565
  method: "POST",
3566
3566
  body: {
3567
3567
  ...params,
@@ -3576,7 +3576,7 @@ var Run = class extends BaseResource {
3576
3576
  */
3577
3577
  async timeTravelStream({ requestContext: paramsRequestContext, ...params }) {
3578
3578
  const requestContext = parseClientRequestContext(paramsRequestContext);
3579
- const response = await this.request(`/workflows/${this.workflowId}/time-travel-stream?runId=${this.runId}`, {
3579
+ const response = await this.request(`/workflows/${this.workflowId}/time-travel-stream?runId=${encodeURIComponent(this.runId)}`, {
3580
3580
  method: "POST",
3581
3581
  body: {
3582
3582
  ...params,
@@ -3626,6 +3626,7 @@ var Workflow = class extends BaseResource {
3626
3626
  if (params?.offset !== null && params?.offset !== void 0 && !isNaN(Number(params?.offset))) searchParams.set("offset", String(params.offset));
3627
3627
  if (params?.resourceId) searchParams.set("resourceId", params.resourceId);
3628
3628
  if (params?.status) searchParams.set("status", params.status);
3629
+ if (params?.summary) searchParams.set("summary", "true");
3629
3630
  if (requestContextParam) searchParams.set("requestContext", requestContextParam);
3630
3631
  if (searchParams.size) return this.request(`/workflows/${this.workflowId}/runs?${searchParams}`);
3631
3632
  else return this.request(`/workflows/${this.workflowId}/runs`);
@@ -3646,7 +3647,7 @@ var Workflow = class extends BaseResource {
3646
3647
  const requestContextParam = base64RequestContext(parseClientRequestContext(options?.requestContext));
3647
3648
  if (requestContextParam) searchParams.set("requestContext", requestContextParam);
3648
3649
  const queryString = searchParams.size > 0 ? `?${searchParams.toString()}` : "";
3649
- return this.request(`/workflows/${this.workflowId}/runs/${runId}${queryString}`);
3650
+ return this.request(`/workflows/${this.workflowId}/runs/${encodeURIComponent(runId)}${queryString}`);
3650
3651
  }
3651
3652
  /**
3652
3653
  * Deletes a specific workflow run by its ID
@@ -3654,7 +3655,7 @@ var Workflow = class extends BaseResource {
3654
3655
  * @returns Promise containing a success message
3655
3656
  */
3656
3657
  deleteRunById(runId) {
3657
- return this.request(`/workflows/${this.workflowId}/runs/${runId}`, { method: "DELETE" });
3658
+ return this.request(`/workflows/${this.workflowId}/runs/${encodeURIComponent(runId)}`, { method: "DELETE" });
3658
3659
  }
3659
3660
  /**
3660
3661
  * Retrieves the input/output schema for the workflow