@erdoai/cli 0.233.0 → 0.234.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 +32 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2383,6 +2383,9 @@ var ErdoClient = class {
2383
2383
  const query = params.toString();
2384
2384
  return this.request("GET", `/v1/heartbeats${query ? `?${query}` : ""}`);
2385
2385
  }
2386
+ getHeartbeat(id) {
2387
+ return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}`);
2388
+ }
2386
2389
  createHeartbeat(body) {
2387
2390
  return this.request("POST", "/v1/heartbeats", body);
2388
2391
  }
@@ -5141,6 +5144,9 @@ var agentCmd = program.command("agent").description("Run agents");
5141
5144
  agentCmd.command("ask <question>").description("Ask the data-question agent (one-shot); question accepts @path to a UTF-8 file").option("-d, --datasets <csv>", "dataset slugs to scope to").option("--allow-writes", "let this question create datasets, write declarations, schedule syncs, and persist other changes. A question is read-only without it").option(
5142
5145
  "--sync",
5143
5146
  "hold one long HTTP request open until the run finishes, instead of polling. Faster for quick questions; a proxy will time it out on any run over ~100s, losing the thread id while the run continues server-side"
5147
+ ).option(
5148
+ "--timezone <iana>",
5149
+ "the timezone the agent should assume for dates and schedules, e.g. Europe/London; defaults to this machine's, as the app sends the browser's"
5144
5150
  ).action(async (question, opts) => {
5145
5151
  try {
5146
5152
  const client = new ErdoClient();
@@ -5148,6 +5154,7 @@ agentCmd.command("ask <question>").description("Ask the data-question agent (one
5148
5154
  question: readMaybeFile(question) ?? "",
5149
5155
  dataset_slugs: opts.datasets ? opts.datasets.split(",").map((s) => s.trim()) : void 0,
5150
5156
  allow_writes: opts.allowWrites ? true : void 0,
5157
+ timezone: opts.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
5151
5158
  async: !opts.sync
5152
5159
  });
5153
5160
  if (opts.sync) {
@@ -5178,7 +5185,10 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
5178
5185
  ).option(
5179
5186
  "--sync",
5180
5187
  "hold one long HTTP request open until the run finishes, instead of polling. Faster for quick questions; a proxy will time it out on any run over ~100s while the run continues server-side"
5181
- ).option("--read-only", "restrict the default data-question-answerer turn to read-only tools").action(async (threadId, message, opts) => {
5188
+ ).option("--read-only", "restrict the default data-question-answerer turn to read-only tools").option(
5189
+ "--timezone <iana>",
5190
+ "the timezone the agent should assume for dates and schedules, e.g. Europe/London; defaults to this machine's, as the app sends the browser's"
5191
+ ).action(async (threadId, message, opts) => {
5182
5192
  try {
5183
5193
  const client = new ErdoClient();
5184
5194
  const baselineRunID = opts.sync ? void 0 : await client.latestRunID(threadId);
@@ -5187,6 +5197,7 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
5187
5197
  context: readMaybeFile(opts.context),
5188
5198
  agent_key: opts.agent,
5189
5199
  model: opts.model,
5200
+ timezone: opts.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
5190
5201
  async: !opts.sync,
5191
5202
  read_only: opts.readOnly
5192
5203
  });
@@ -11341,6 +11352,26 @@ autoCmd.command("list").description("List automations").option("--include-refres
11341
11352
  fail(e);
11342
11353
  }
11343
11354
  });
11355
+ autoCmd.command("show <id>").description("Show one automation's state, schedule, next run, and latest execution").option("--json", "print the raw JSON result").action(async (id, opts) => {
11356
+ try {
11357
+ const h = await new ErdoClient().getHeartbeat(id);
11358
+ if (opts.json) {
11359
+ print(h);
11360
+ return;
11361
+ }
11362
+ console.log(`id: ${h.id}`);
11363
+ console.log(`name: ${h.name}`);
11364
+ console.log(`state: ${h.state}`);
11365
+ const cron = h.schedule_triggers?.[0];
11366
+ const schedule = h.run_at ? `once at ${h.run_at}` : cron ? `cron ${cron.cron_expression} (${cron.timezone})` : h.interval_minutes ? `interval ${h.interval_minutes} minutes${h.timezone ? ` (${h.timezone})` : ""}` : "none";
11367
+ console.log(`schedule: ${schedule}`);
11368
+ console.log(`next run: ${h.next_run_at ?? cron?.next_run_at ?? "none"}`);
11369
+ const latest = h.latest_execution;
11370
+ console.log(`latest run: ${latest ? `${latest.status} at ${latest.started_at}${latest.error_message ? `; error: ${latest.error_message}` : ""}` : "none"}`);
11371
+ } catch (e) {
11372
+ fail(e);
11373
+ }
11374
+ });
11344
11375
  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) => {
11345
11376
  try {
11346
11377
  const limit = Number(opts.limit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.233.0",
3
+ "version": "0.234.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {