@erdoai/cli 0.122.0 → 0.125.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.
- package/dist/index.js +19 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1660,6 +1660,12 @@ var ErdoClient = class {
|
|
|
1660
1660
|
runHeartbeat(id) {
|
|
1661
1661
|
return this.request("POST", `/v1/heartbeats/${encodeURIComponent(id)}/run`, {});
|
|
1662
1662
|
}
|
|
1663
|
+
listHeartbeatExecutions(id, limit = 10) {
|
|
1664
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
1665
|
+
throw new Error("limit must be an integer between 1 and 100");
|
|
1666
|
+
}
|
|
1667
|
+
return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}/executions?limit=${limit}`);
|
|
1668
|
+
}
|
|
1663
1669
|
updateHeartbeat(id, body) {
|
|
1664
1670
|
return this.request(
|
|
1665
1671
|
"PATCH",
|
|
@@ -1720,6 +1726,7 @@ var ErdoClient = class {
|
|
|
1720
1726
|
// --- agent runs ---
|
|
1721
1727
|
listAgentRuns(opts) {
|
|
1722
1728
|
const params = new URLSearchParams();
|
|
1729
|
+
if (opts.invocation) params.set("invocation_id", opts.invocation);
|
|
1723
1730
|
if (opts.agent) params.set("agent_key", opts.agent);
|
|
1724
1731
|
if (opts.thread) params.set("thread_id", opts.thread);
|
|
1725
1732
|
if (opts.status) params.set("status", opts.status);
|
|
@@ -4190,7 +4197,7 @@ agentCmd.command("messages <threadId>").description("Show a thread's messages (r
|
|
|
4190
4197
|
}
|
|
4191
4198
|
});
|
|
4192
4199
|
var runsCmd = program.command("runs").description("Inspect agent runs");
|
|
4193
|
-
runsCmd.command("list").description("List agent runs
|
|
4200
|
+
runsCmd.command("list").description("List agent runs; select an exact invocation, optionally constrained by agent OR thread").option("--invocation <id>", "select the exact root run for an invocation").option("-a, --agent <key>", "filter by agent key").option("-t, --thread <id>", "filter to a thread").option("-s, --status <status>", "filter by status (running, completed, failed, cancelled, pending)").option("-l, --limit <n>", "max runs", (v) => parseInt(v, 10)).action(async (opts) => {
|
|
4194
4201
|
try {
|
|
4195
4202
|
const { runs } = await new ErdoClient().listAgentRuns(opts);
|
|
4196
4203
|
for (const r of runs) console.log(`${r.id} ${r.status} ${r.agent_key}`);
|
|
@@ -8450,6 +8457,17 @@ autoCmd.command("list").description("List automations").action(async () => {
|
|
|
8450
8457
|
fail(e);
|
|
8451
8458
|
}
|
|
8452
8459
|
});
|
|
8460
|
+
autoCmd.command("executions <id>").description("Read recent execution history for one automation or refresh job").option("--limit <n>", "Number of executions (integer 1\u2013100)", "10").action(async (id, opts) => {
|
|
8461
|
+
try {
|
|
8462
|
+
const limit = Number(opts.limit);
|
|
8463
|
+
if (!/^\d+$/.test(opts.limit) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
8464
|
+
throw new Error("limit must be an integer between 1 and 100");
|
|
8465
|
+
}
|
|
8466
|
+
print(await new ErdoClient().listHeartbeatExecutions(id, limit));
|
|
8467
|
+
} catch (e) {
|
|
8468
|
+
fail(e);
|
|
8469
|
+
}
|
|
8470
|
+
});
|
|
8453
8471
|
autoCmd.command("run <id>").description("Trigger an automation now").action(async (id) => {
|
|
8454
8472
|
try {
|
|
8455
8473
|
print(await new ErdoClient().runHeartbeat(id));
|