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