@mastra/client-js 1.30.1-alpha.2 → 1.31.0-alpha.3

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/dist/index.cjs CHANGED
@@ -8036,14 +8036,18 @@ var MastraClient = class extends BaseResource {
8036
8036
  );
8037
8037
  }
8038
8038
  /**
8039
- * Lists schedules with optional filtering by workflowId, status, ownerType, or ownerId.
8039
+ * Lists schedules agent schedules and workflow schedules with optional
8040
+ * filtering by agentId, workflowId, or status. Agent schedules can
8041
+ * additionally be filtered by threadId, resourceId, or name.
8040
8042
  */
8041
8043
  listSchedules(params = {}) {
8042
8044
  const searchParams = new URLSearchParams();
8045
+ if (params.agentId) searchParams.set("agentId", params.agentId);
8043
8046
  if (params.workflowId) searchParams.set("workflowId", params.workflowId);
8044
8047
  if (params.status) searchParams.set("status", params.status);
8045
- if (params.ownerType) searchParams.set("ownerType", params.ownerType);
8046
- if (params.ownerId) searchParams.set("ownerId", params.ownerId);
8048
+ if (params.threadId) searchParams.set("threadId", params.threadId);
8049
+ if (params.resourceId) searchParams.set("resourceId", params.resourceId);
8050
+ if (params.name) searchParams.set("name", params.name);
8047
8051
  const qs = searchParams.toString();
8048
8052
  return this.request(`/schedules${qs ? `?${qs}` : ""}`);
8049
8053
  }
@@ -8054,115 +8058,77 @@ var MastraClient = class extends BaseResource {
8054
8058
  return this.request(`/schedules/${encodeURIComponent(scheduleId)}`);
8055
8059
  }
8056
8060
  /**
8057
- * Lists trigger history for a schedule, ordered by actualFireAt descending.
8058
- */
8059
- listScheduleTriggers(scheduleId, params = {}) {
8060
- const searchParams = new URLSearchParams();
8061
- if (params.limit !== void 0) searchParams.set("limit", String(params.limit));
8062
- if (params.fromActualFireAt !== void 0) searchParams.set("fromActualFireAt", String(params.fromActualFireAt));
8063
- if (params.toActualFireAt !== void 0) searchParams.set("toActualFireAt", String(params.toActualFireAt));
8064
- const qs = searchParams.toString();
8065
- return this.request(`/schedules/${encodeURIComponent(scheduleId)}/triggers${qs ? `?${qs}` : ""}`);
8066
- }
8067
- /**
8068
- * Pauses a schedule. The scheduler tick loop will skip paused schedules.
8069
- * Idempotent — pausing an already-paused schedule returns the current state unchanged.
8070
- * Pause status survives redeploys.
8071
- */
8072
- pauseSchedule(scheduleId) {
8073
- return this.request(`/schedules/${encodeURIComponent(scheduleId)}/pause`, { method: "POST" });
8074
- }
8075
- /**
8076
- * Resumes a paused schedule. Recomputes nextFireAt from "now" so a long-paused schedule
8077
- * does not fire a backlog. Idempotent — resuming an already-active schedule returns
8078
- * the current state unchanged.
8079
- */
8080
- resumeSchedule(scheduleId) {
8081
- return this.request(`/schedules/${encodeURIComponent(scheduleId)}/resume`, { method: "POST" });
8082
- }
8083
- /**
8084
- * Lists heartbeats across all agents. Pass `agentId` to scope the list to
8085
- * a single agent. Filter further by `threadId`, `resourceId`, or `name`.
8086
- */
8087
- listHeartbeats(params = {}) {
8088
- const searchParams = new URLSearchParams();
8089
- if (params.agentId) searchParams.set("agentId", params.agentId);
8090
- if (params.threadId) searchParams.set("threadId", params.threadId);
8091
- if (params.resourceId) searchParams.set("resourceId", params.resourceId);
8092
- if (params.name) searchParams.set("name", params.name);
8093
- const qs = searchParams.toString();
8094
- return this.request(`/heartbeats${qs ? `?${qs}` : ""}`).then(
8095
- (response) => response.heartbeats
8096
- );
8097
- }
8098
- /**
8099
- * Gets a single heartbeat by id.
8100
- */
8101
- getHeartbeat(heartbeatId) {
8102
- return this.request(`/heartbeats/${encodeURIComponent(heartbeatId)}`);
8103
- }
8104
- /**
8105
- * Creates a heartbeat for the agent named by `agentId`. By default each call
8106
- * creates a new heartbeat with a random `hb_<uuid>` id — multiple heartbeats
8107
- * per agent/thread are supported. Use `name` to label distinct heartbeats.
8108
- * Pass `id` to choose a stable id (normalized to `hb_<slug>`); creating one
8109
- * with an id that already exists throws.
8061
+ * Creates a schedule. Pass `agentId` (plus `prompt`) to schedule an agent,
8062
+ * or `workflowId` (plus optional `inputData`) to schedule a workflow.
8063
+ * By default each call creates a new schedule with a random id
8064
+ * (`agent_<uuid>` for agents, `schedule_<uuid>` for workflows) — pass `id`
8065
+ * to choose a stable id instead; creating one with an id that already
8066
+ * exists throws.
8110
8067
  *
8111
- * Trigger (fire) history is read through the generic schedules surface:
8112
- * `listScheduleTriggers(heartbeat.id)`.
8068
+ * Trigger (fire) history is read through `listScheduleTriggers(schedule.id)`.
8113
8069
  */
8114
- createHeartbeat(options) {
8115
- return this.request(`/heartbeats`, {
8070
+ createSchedule(options) {
8071
+ return this.request(`/schedules`, {
8116
8072
  method: "POST",
8117
8073
  body: options
8118
8074
  });
8119
8075
  }
8120
8076
  /**
8121
- * Patches an existing heartbeat. `threadId` / `resourceId` are immutable
8122
- * to retarget, delete and recreate.
8077
+ * Patches an existing schedule. Fields apply to the matching target type;
8078
+ * agent-only fields on a workflow schedule are rejected. `threadId` /
8079
+ * `resourceId` are immutable — to retarget, delete and recreate.
8123
8080
  */
8124
- updateHeartbeat(heartbeatId, patch) {
8125
- return this.request(`/heartbeats/${encodeURIComponent(heartbeatId)}`, {
8081
+ updateSchedule(scheduleId, patch) {
8082
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
8126
8083
  method: "PATCH",
8127
8084
  body: patch
8128
8085
  });
8129
8086
  }
8130
8087
  /**
8131
- * Deletes a heartbeat.
8088
+ * Deletes a schedule.
8132
8089
  */
8133
- deleteHeartbeat(heartbeatId) {
8134
- return this.request(`/heartbeats/${encodeURIComponent(heartbeatId)}`, {
8090
+ deleteSchedule(scheduleId) {
8091
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
8135
8092
  method: "DELETE"
8136
8093
  });
8137
8094
  }
8138
8095
  /**
8139
- * Pauses a heartbeat. Idempotent pausing an already-paused heartbeat
8140
- * returns the current state unchanged.
8096
+ * Fires a schedule manually, out-of-band from the cron schedule. Behaves
8097
+ * like a scheduled fire but does not advance `nextFireAt`. The returned
8098
+ * `claimId` is the trigger row's runId — look it up via
8099
+ * `listScheduleTriggers(scheduleId)`.
8141
8100
  */
8142
- pauseHeartbeat(heartbeatId) {
8143
- return this.request(`/heartbeats/${encodeURIComponent(heartbeatId)}/pause`, {
8101
+ runSchedule(scheduleId) {
8102
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/run`, {
8144
8103
  method: "POST"
8145
8104
  });
8146
8105
  }
8147
8106
  /**
8148
- * Resumes a paused heartbeat. Recomputes nextFireAt from "now" so a
8149
- * long-paused heartbeat does not fire a backlog. Idempotent.
8107
+ * Lists trigger history for a schedule, ordered by actualFireAt descending.
8150
8108
  */
8151
- resumeHeartbeat(heartbeatId) {
8152
- return this.request(`/heartbeats/${encodeURIComponent(heartbeatId)}/resume`, {
8153
- method: "POST"
8154
- });
8109
+ listScheduleTriggers(scheduleId, params = {}) {
8110
+ const searchParams = new URLSearchParams();
8111
+ if (params.limit !== void 0) searchParams.set("limit", String(params.limit));
8112
+ if (params.fromActualFireAt !== void 0) searchParams.set("fromActualFireAt", String(params.fromActualFireAt));
8113
+ if (params.toActualFireAt !== void 0) searchParams.set("toActualFireAt", String(params.toActualFireAt));
8114
+ const qs = searchParams.toString();
8115
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/triggers${qs ? `?${qs}` : ""}`);
8155
8116
  }
8156
8117
  /**
8157
- * Fires a heartbeat manually, out-of-band from the cron schedule. Behaves
8158
- * like a scheduled fire (honoring `ifActive` / `ifIdle`) but
8159
- * does not advance `nextFireAt`. The returned `claimId` is the trigger row's
8160
- * runId — look it up via `listScheduleTriggers(heartbeatId)`.
8118
+ * Pauses a schedule. The scheduler tick loop will skip paused schedules.
8119
+ * Idempotent pausing an already-paused schedule returns the current state unchanged.
8120
+ * Pause status survives redeploys.
8161
8121
  */
8162
- runHeartbeat(heartbeatId) {
8163
- return this.request(`/heartbeats/${encodeURIComponent(heartbeatId)}/run`, {
8164
- method: "POST"
8165
- });
8122
+ pauseSchedule(scheduleId) {
8123
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/pause`, { method: "POST" });
8124
+ }
8125
+ /**
8126
+ * Resumes a paused schedule. Recomputes nextFireAt from "now" so a long-paused schedule
8127
+ * does not fire a backlog. Idempotent — resuming an already-active schedule returns
8128
+ * the current state unchanged.
8129
+ */
8130
+ resumeSchedule(scheduleId) {
8131
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/resume`, { method: "POST" });
8166
8132
  }
8167
8133
  };
8168
8134