@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/CHANGELOG.md +30 -0
- package/dist/client.d.ts +34 -50
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +3 -3
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-long-running-agents-schedules.md +227 -0
- package/dist/docs/references/reference-client-js-observability.md +88 -1
- package/dist/index.cjs +51 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -85
- package/dist/index.js.map +1 -1
- package/dist/route-types.generated.d.ts +331 -551
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +123 -91
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/docs/references/docs-long-running-agents-heartbeats.md +0 -213
package/dist/index.cjs
CHANGED
|
@@ -8036,14 +8036,18 @@ var MastraClient = class extends BaseResource {
|
|
|
8036
8036
|
);
|
|
8037
8037
|
}
|
|
8038
8038
|
/**
|
|
8039
|
-
* Lists schedules
|
|
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.
|
|
8046
|
-
if (params.
|
|
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
|
-
*
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
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
|
|
8112
|
-
* `listScheduleTriggers(heartbeat.id)`.
|
|
8068
|
+
* Trigger (fire) history is read through `listScheduleTriggers(schedule.id)`.
|
|
8113
8069
|
*/
|
|
8114
|
-
|
|
8115
|
-
return this.request(`/
|
|
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
|
|
8122
|
-
*
|
|
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
|
-
|
|
8125
|
-
return this.request(`/
|
|
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
|
|
8088
|
+
* Deletes a schedule.
|
|
8132
8089
|
*/
|
|
8133
|
-
|
|
8134
|
-
return this.request(`/
|
|
8090
|
+
deleteSchedule(scheduleId) {
|
|
8091
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
|
|
8135
8092
|
method: "DELETE"
|
|
8136
8093
|
});
|
|
8137
8094
|
}
|
|
8138
8095
|
/**
|
|
8139
|
-
*
|
|
8140
|
-
*
|
|
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
|
-
|
|
8143
|
-
return this.request(`/
|
|
8101
|
+
runSchedule(scheduleId) {
|
|
8102
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}/run`, {
|
|
8144
8103
|
method: "POST"
|
|
8145
8104
|
});
|
|
8146
8105
|
}
|
|
8147
8106
|
/**
|
|
8148
|
-
*
|
|
8149
|
-
* long-paused heartbeat does not fire a backlog. Idempotent.
|
|
8107
|
+
* Lists trigger history for a schedule, ordered by actualFireAt descending.
|
|
8150
8108
|
*/
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
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
|
-
*
|
|
8158
|
-
*
|
|
8159
|
-
*
|
|
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
|
-
|
|
8163
|
-
return this.request(`/
|
|
8164
|
-
|
|
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
|
|