@erdoai/cli 0.216.0 → 0.217.1

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 +40 -21
  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);
@@ -5552,11 +5553,14 @@ conversationParticipantsCmd.command("remove <threadId> <agent>").description("Re
5552
5553
  fail(e);
5553
5554
  }
5554
5555
  });
5555
- function contentBlockLabel(c) {
5556
+ function contentBlockLabel(c, verbose = false) {
5556
5557
  const type = c.ui_content_type || c.content_type;
5557
5558
  const payload = c.content;
5558
5559
  const toolName = payload && typeof payload === "object" && !Array.isArray(payload) && typeof payload.name === "string" ? payload.name : void 0;
5559
- return toolName ? `${type}: ${toolName}` : type;
5560
+ let label = toolName ? `${type}: ${toolName}` : type;
5561
+ const producer = [c.created_by_agent_key, verbose && c.created_by_agent_run_id ? `run ${c.created_by_agent_run_id}` : void 0].filter(Boolean).join(" ");
5562
+ if (producer) label += ` \xB7 by ${producer}`;
5563
+ return label;
5560
5564
  }
5561
5565
  agentCmd.command("messages <threadId>").description("Show a thread's messages (role + text)").option("-v, --verbose", "print full content for non-text entries (tool calls, results, etc.) instead of a placeholder").action(async (threadId, opts) => {
5562
5566
  try {
@@ -5572,7 +5576,7 @@ agentCmd.command("messages <threadId>").description("Show a thread's messages (r
5572
5576
  if (c.content_type === "text") {
5573
5577
  console.log(c.content);
5574
5578
  } else if (opts.verbose) {
5575
- console.log(`\x1B[2m[${contentBlockLabel(c)}]\x1B[0m`);
5579
+ console.log(`\x1B[2m[${contentBlockLabel(c, true)}]\x1B[0m`);
5576
5580
  console.log(typeof c.content === "string" ? c.content : JSON.stringify(c.content, null, 2));
5577
5581
  } else {
5578
5582
  console.log(`\x1B[2m[${contentBlockLabel(c)}]\x1B[0m`);
@@ -11013,7 +11017,7 @@ knowledgeAssetsCmd.command("list <objectId>").description("List files attached t
11013
11017
  fail(e);
11014
11018
  }
11015
11019
  });
11016
- var autoCmd = program.command("automations").description("Scheduled automations (heartbeats)");
11020
+ var autoCmd = program.command("automations").description("All scheduled and event-triggered automations");
11017
11021
  function heartbeatBounds(h) {
11018
11022
  const at = h.anchor_time ? ` at:${h.anchor_time}${h.timezone ? ` ${h.timezone}` : ""}` : "";
11019
11023
  const after = h.run_after_id ? ` after:${h.run_after_id}` : "";
@@ -11077,16 +11081,31 @@ autoCmd.command("create <name>").description(
11077
11081
  }
11078
11082
  }
11079
11083
  );
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}`);
11084
+ 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) => {
11085
+ try {
11086
+ const client = new ErdoClient();
11087
+ const heartbeats = [];
11088
+ const jobs = /* @__PURE__ */ new Map();
11089
+ let offset = 0;
11090
+ let refreshes;
11091
+ let jobsTruncated = false;
11092
+ for (; ; ) {
11093
+ const page = await client.listHeartbeats({ includeRefresh: opts.includeRefresh, includeRetired: opts.includeRetired, limit: 100, offset });
11094
+ heartbeats.push(...page.heartbeats);
11095
+ for (const job of page.jobs ?? []) jobs.set(job.id, job);
11096
+ refreshes ??= page.refreshes;
11097
+ jobsTruncated ||= !!page.jobs_truncated;
11098
+ if (!page.has_more) break;
11099
+ offset += page.heartbeats.length;
11100
+ }
11089
11101
  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)}`);
11102
+ for (const job of jobs.values()) {
11103
+ 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(",");
11104
+ console.log(`${job.id} ${job.state} ${job.name} job:${job.type} ${job.kind} ${triggers}`);
11105
+ }
11106
+ if (jobsTruncated) {
11107
+ console.error(`Listed the first ${jobs.size} scheduled and event automations; this organization has more than one listing reads.`);
11108
+ }
11090
11109
  if (opts.includeRefresh) {
11091
11110
  for (const r of refreshes ?? []) console.log(formatRefreshJobRow(r));
11092
11111
  }
@@ -11112,7 +11131,7 @@ autoCmd.command("run <id>").description("Trigger an automation now").option("--m
11112
11131
  fail(e);
11113
11132
  }
11114
11133
  });
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(
11134
+ 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
11135
  "--script-file <path>",
11117
11136
  "Read the replacement script body from a file (scripted automation)"
11118
11137
  ).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.1",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {