@erdoai/cli 0.216.0 → 0.217.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.
Files changed (2) hide show
  1. package/dist/index.js +34 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2309,14 +2309,15 @@ var ErdoClient = class {
2309
2309
  listKnowledgeAssets(objectID) {
2310
2310
  return this.request("GET", `/v1/knowledge/${encodeURIComponent(objectID)}/attachments`);
2311
2311
  }
2312
- // --- automations (heartbeats) ---
2312
+ // --- automations ---
2313
2313
  listHeartbeats(opts = {}) {
2314
- const query = new URLSearchParams();
2315
- if (opts.includeRefresh) query.set("include_refresh", "true");
2316
- if (opts.limit !== void 0) query.set("limit", String(opts.limit));
2317
- if (opts.offset !== void 0) query.set("offset", String(opts.offset));
2318
- const suffix = query.toString() ? `?${query.toString()}` : "";
2319
- return this.request("GET", `/v1/heartbeats${suffix}`);
2314
+ const params = new URLSearchParams();
2315
+ if (opts.includeRefresh) params.set("include_refresh", "true");
2316
+ if (opts.includeRetired) params.set("include_retired", "true");
2317
+ if (opts.limit !== void 0) params.set("limit", String(opts.limit));
2318
+ if (opts.offset !== void 0) params.set("offset", String(opts.offset));
2319
+ const query = params.toString();
2320
+ return this.request("GET", `/v1/heartbeats${query ? `?${query}` : ""}`);
2320
2321
  }
2321
2322
  createHeartbeat(body) {
2322
2323
  return this.request("POST", "/v1/heartbeats", body);
@@ -11013,7 +11014,7 @@ knowledgeAssetsCmd.command("list <objectId>").description("List files attached t
11013
11014
  fail(e);
11014
11015
  }
11015
11016
  });
11016
- var autoCmd = program.command("automations").description("Scheduled automations (heartbeats)");
11017
+ var autoCmd = program.command("automations").description("All scheduled and event-triggered automations");
11017
11018
  function heartbeatBounds(h) {
11018
11019
  const at = h.anchor_time ? ` at:${h.anchor_time}${h.timezone ? ` ${h.timezone}` : ""}` : "";
11019
11020
  const after = h.run_after_id ? ` after:${h.run_after_id}` : "";
@@ -11077,16 +11078,31 @@ autoCmd.command("create <name>").description(
11077
11078
  }
11078
11079
  }
11079
11080
  );
11080
- autoCmd.command("list").description("List automations").option("--include-refresh", "Also list dataset refresh jobs with their state, including auto-paused ones and any that will pause soon").option("--limit <n>", "Number of automations to return").option("--offset <n>", "Number of automations to skip", "0").action(async (opts) => {
11081
- try {
11082
- const rawLimit = opts.limit;
11083
- const limit = rawLimit === void 0 ? void 0 : Number(rawLimit);
11084
- const offset = Number(opts.offset);
11085
- if (rawLimit !== void 0 && (!/^\d+$/.test(rawLimit) || limit === void 0 || limit < 1 || limit > 50)) throw new Error("limit must be an integer between 1 and 50");
11086
- if (!/^\d+$/.test(opts.offset) || !Number.isInteger(offset) || offset < 0) throw new Error("offset must be a non-negative integer");
11087
- const { heartbeats, refreshes, has_more } = await new ErdoClient().listHeartbeats({ includeRefresh: opts.includeRefresh, limit, offset: offset || void 0 });
11088
- if (has_more) console.error(`more automations exist: rerun with --offset ${offset + heartbeats.length}`);
11081
+ autoCmd.command("list").description("List automations").option("--include-refresh", "Also list dataset refresh jobs with their state, including auto-paused ones and any that will pause soon").option("--include-retired", "Also list retired automations").action(async (opts) => {
11082
+ try {
11083
+ const client = new ErdoClient();
11084
+ const heartbeats = [];
11085
+ const jobs = /* @__PURE__ */ new Map();
11086
+ let offset = 0;
11087
+ let refreshes;
11088
+ let jobsTruncated = false;
11089
+ for (; ; ) {
11090
+ const page = await client.listHeartbeats({ includeRefresh: opts.includeRefresh, includeRetired: opts.includeRetired, limit: 100, offset });
11091
+ heartbeats.push(...page.heartbeats);
11092
+ for (const job of page.jobs ?? []) jobs.set(job.id, job);
11093
+ refreshes ??= page.refreshes;
11094
+ jobsTruncated ||= !!page.jobs_truncated;
11095
+ if (!page.has_more) break;
11096
+ offset += page.heartbeats.length;
11097
+ }
11089
11098
  for (const h of heartbeats) console.log(`${h.id} ${h.state} ${h.name} ${h.kind === "script" ? "script" : h.thread_id ? `thread:${h.thread_id}` : h.conversation ?? "new"}${h.persona_id ? ` persona:${h.persona_id}` : ""}${h.model ? ` model:${h.model}` : ""}${heartbeatBounds(h)}`);
11099
+ for (const job of jobs.values()) {
11100
+ const triggers = job.trigger_summary.map((trigger) => trigger.type === "cron" ? `cron:${trigger.cron_expression}${trigger.timezone ? ` ${trigger.timezone}` : ""}` : trigger.type === "heartbeat" ? `every:${trigger.interval_minutes}m${trigger.timezone ? ` ${trigger.timezone}` : ""}` : trigger.type).join(",");
11101
+ console.log(`${job.id} ${job.state} ${job.name} job:${job.type} ${job.kind} ${triggers}`);
11102
+ }
11103
+ if (jobsTruncated) {
11104
+ console.error(`Listed the first ${jobs.size} scheduled and event automations; this organization has more than one listing reads.`);
11105
+ }
11090
11106
  if (opts.includeRefresh) {
11091
11107
  for (const r of refreshes ?? []) console.log(formatRefreshJobRow(r));
11092
11108
  }
@@ -11112,7 +11128,7 @@ autoCmd.command("run <id>").description("Trigger an automation now").option("--m
11112
11128
  fail(e);
11113
11129
  }
11114
11130
  });
11115
- autoCmd.command("update <id>").description("Edit an automation \u2014 rename, reschedule, or replace its script/instructions").option("--name <name>", "New name").option("--description <text>", "New description").option("--instructions <text>", "Replacement instructions (agent automation)").addOption(new Option2("--agent-key <key>", "Executor for an agent automation; omit to keep current").choices(["erdo.heartbeat-executor", "erdo.workflow-executor"])).option("--model <id>", "Pin the LLM for later runs. Omit to keep the current pin").option("--clear-model", "Remove the model pin so later runs use the skill model, then the executor default").option("--script-js <js>", "Replacement script body (scripted automation)").option(
11131
+ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, reschedule (--cron for a scheduled job, --interval/--at for a heartbeat), or replace its script/instructions").option("--name <name>", "New name").option("--description <text>", "New description").option("--instructions <text>", "Replacement instructions (agent automation)").addOption(new Option2("--agent-key <key>", "Executor for an agent automation; omit to keep current").choices(["erdo.heartbeat-executor", "erdo.workflow-executor"])).option("--model <id>", "Pin the LLM for later runs. Omit to keep the current pin").option("--clear-model", "Remove the model pin so later runs use the skill model, then the executor default").option("--script-js <js>", "Replacement script body (scripted automation)").option(
11116
11132
  "--script-file <path>",
11117
11133
  "Read the replacement script body from a file (scripted automation)"
11118
11134
  ).addOption(new Option2("--conversation <target>", "Target 'new' (fresh thread) or 'direct' conversation").choices(["new", "direct"])).option("--thread-id <id>", "Post each run into an existing conversation UUID").option("--persona-id <id>", "Org-enabled persona UUID to speak as").addOption(new Option2("--clear-persona", "Remove the explicit persona binding; template attribution may still apply").conflicts("personaId")).option("--interval <minutes>", "New interval in minutes (minimum 5)", (v) => parseInt(v, 10)).option("--timezone <tz>", "New scheduling timezone, e.g. America/New_York").option("--at <HH:MM>", "Clock time of each run in the automation timezone, e.g. 21:02").option("--clear-at", "Clear the clock time so the next run is one interval after this save").option("--run-after <id>", "Start when this automation finishes").option("--clear-run-after", "Stop following another automation").option("--after-when <when>", "success or finished").option("--after-delay <minutes>", "Wait this many minutes after the predecessor finishes", (v) => parseInt(v, 10)).option("--instead-of-schedule", "Run only from the chain, with no clock").option("--keep-schedule", "Keep the clock as well as the chain").option("--run-at <rfc3339>", "New one-off fire time: runs once at or after it, then stops permanently (omit to keep)").option("--ends-at <rfc3339>", "New end time after which it never runs (omit to keep)").option("--cron <expr>", 'New schedule for a cron-scheduled automation, read in --timezone (or its saved one), e.g. "0 17 * * 5" for Fridays at 17:00. Edits the same automation in place').option("--cron-trigger <id>", "Which cron trigger to change, when the automation has more than one (see list)").action(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.216.0",
3
+ "version": "0.217.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {