@erdoai/cli 0.232.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 +39 -48
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1324,13 +1324,6 @@ var ErdoClient = class {
1324
1324
  `/v1/workstreams/${encodeURIComponent(slug)}/events${qs}`
1325
1325
  );
1326
1326
  }
1327
- addWorkstreamPhase(slug, input) {
1328
- return this.request(
1329
- "POST",
1330
- `/v1/workstreams/${encodeURIComponent(slug)}/phases`,
1331
- input
1332
- );
1333
- }
1334
1327
  armWorkstreamLoop(slug, input) {
1335
1328
  return this.request("POST", `/v1/workstreams/${encodeURIComponent(slug)}/arm`, input ?? {});
1336
1329
  }
@@ -1440,7 +1433,6 @@ var ErdoClient = class {
1440
1433
  if (params?.limit) q.set("limit", String(params.limit));
1441
1434
  if (params?.offset) q.set("offset", String(params.offset));
1442
1435
  if (params?.categories) q.set("categories", params.categories);
1443
- if (params?.scope) q.set("scope", params.scope);
1444
1436
  if (params?.workstream_slug) q.set("workstream_slug", params.workstream_slug);
1445
1437
  const qs = q.toString();
1446
1438
  return this.request(
@@ -2391,6 +2383,9 @@ var ErdoClient = class {
2391
2383
  const query = params.toString();
2392
2384
  return this.request("GET", `/v1/heartbeats${query ? `?${query}` : ""}`);
2393
2385
  }
2386
+ getHeartbeat(id) {
2387
+ return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}`);
2388
+ }
2394
2389
  createHeartbeat(body) {
2395
2390
  return this.request("POST", "/v1/heartbeats", body);
2396
2391
  }
@@ -4389,7 +4384,7 @@ wsCmd.command("list").description("List workstreams in the active org").option("
4389
4384
  fail(e);
4390
4385
  }
4391
4386
  });
4392
- wsCmd.command("get <slug>").description("Show a workstream \u2014 status, phases, resources, recent log").action(async (slug) => {
4387
+ wsCmd.command("get <slug>").description("Show a workstream \u2014 status, resources, recent log").action(async (slug) => {
4393
4388
  try {
4394
4389
  print(await new ErdoClient().getWorkstream(slug));
4395
4390
  } catch (e) {
@@ -4431,50 +4426,20 @@ wsCmd.command("events <slug>").description("Show a workstream's full event log (
4431
4426
  fail(e);
4432
4427
  }
4433
4428
  });
4434
- wsCmd.command("phase-add <slug>").description("Append a new phase to a workstream").requiredOption("--phase-slug <phaseSlug>", "URL-safe phase id, unique within the workstream").requiredOption("--title <title>", "human-readable phase title").option("--skill <skillSlug>", "optional skill that runs this phase").action(
4435
- async (slug, opts) => {
4436
- try {
4437
- print(
4438
- await new ErdoClient().addWorkstreamPhase(slug, {
4439
- slug: opts.phaseSlug,
4440
- title: opts.title,
4441
- skill_slug: opts.skill
4442
- })
4443
- );
4444
- } catch (e) {
4445
- fail(e);
4446
- }
4447
- }
4448
- );
4449
- wsCmd.command("set-state <slug>").description("Update a workstream's status / title / description / phase statuses").option("--status <status>", "active, awaiting_user, blocked, completed").option("--title <title>", "retitle").option("--description <text>", "describe current state / surface a blocker").option(
4429
+ wsCmd.command("set-state <slug>").description("Update a workstream's status / title / description").option("--status <status>", "active, awaiting_user, blocked, completed").option("--title <title>", "retitle").option("--description <text>", "describe current state / surface a blocker").option(
4450
4430
  "--token-budget <millicents>",
4451
4431
  "spend ceiling in millicents \u2014 100,000 per dollar, so 25000000 = $250; this is how you raise a ceiling a loop has spent through",
4452
4432
  (v) => parseInt(v, 10)
4453
- ).option("--escalation-budget <n>", "max urgent attention items per rolling 24h", (v) => parseInt(v, 10)).option(
4454
- "--phase <slug=status>",
4455
- "set one phase's status (repeatable), e.g. --phase brand-brief=completed --phase landing-pages=running; statuses: pending, running, awaiting_user, blocked, completed, skipped, failed",
4456
- collect,
4457
- []
4458
- ).action(
4433
+ ).option("--escalation-budget <n>", "max urgent attention items per rolling 24h", (v) => parseInt(v, 10)).action(
4459
4434
  async (slug, opts) => {
4460
4435
  try {
4461
- const phaseUpdates = opts.phase.map((raw) => {
4462
- const eq = raw.indexOf("=");
4463
- const phaseSlug = eq < 0 ? raw : raw.slice(0, eq);
4464
- const status = eq < 0 ? "" : raw.slice(eq + 1);
4465
- if (!phaseSlug || !status) {
4466
- throw new Error(`--phase expects <slug>=<status>, got "${raw}"`);
4467
- }
4468
- return { slug: phaseSlug, status };
4469
- });
4470
4436
  print(
4471
4437
  await new ErdoClient().updateWorkState(slug, {
4472
4438
  status: opts.status,
4473
4439
  title: opts.title,
4474
4440
  description: opts.description,
4475
4441
  token_budget_millicents: opts.tokenBudget,
4476
- escalation_budget_per_day: opts.escalationBudget,
4477
- phase_updates: phaseUpdates.length > 0 ? phaseUpdates : void 0
4442
+ escalation_budget_per_day: opts.escalationBudget
4478
4443
  })
4479
4444
  );
4480
4445
  } catch (e) {
@@ -4537,7 +4502,7 @@ wsCmd.command("recommendations <slug>").description("Read resolved recommendatio
4537
4502
  fail(e);
4538
4503
  }
4539
4504
  });
4540
- wsCmd.command("attach <slug>").description("Link a resource (page, dataset, heartbeat, experiment_run, \u2026) to a workstream").requiredOption("--type <resourceType>", "resource type (page, dataset, heartbeat, experiment_run, \u2026)").requiredOption("--id <resourceId>", "the resource's UUID").requiredOption("--rel <relationshipType>", "output | input | evidence | monitoring | subject | parent | child | running").option("--title <title>", "optional label for the link").option("--phase <phaseId>", "optional phase to attach under").action(
4505
+ wsCmd.command("attach <slug>").description("Link a resource (page, dataset, heartbeat, experiment_run, \u2026) to a workstream").requiredOption("--type <resourceType>", "resource type (page, dataset, heartbeat, experiment_run, \u2026)").requiredOption("--id <resourceId>", "the resource's UUID").requiredOption("--rel <relationshipType>", "output | input | evidence | monitoring | subject | parent | child | running").option("--title <title>", "optional label for the link").action(
4541
4506
  async (slug, opts) => {
4542
4507
  try {
4543
4508
  print(
@@ -4545,8 +4510,7 @@ wsCmd.command("attach <slug>").description("Link a resource (page, dataset, hear
4545
4510
  resource_type: opts.type,
4546
4511
  resource_id: opts.id,
4547
4512
  relationship_type: opts.rel,
4548
- title: opts.title,
4549
- phase_id: opts.phase
4513
+ title: opts.title
4550
4514
  })
4551
4515
  );
4552
4516
  } catch (e) {
@@ -5180,6 +5144,9 @@ var agentCmd = program.command("agent").description("Run agents");
5180
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(
5181
5145
  "--sync",
5182
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"
5183
5150
  ).action(async (question, opts) => {
5184
5151
  try {
5185
5152
  const client = new ErdoClient();
@@ -5187,6 +5154,7 @@ agentCmd.command("ask <question>").description("Ask the data-question agent (one
5187
5154
  question: readMaybeFile(question) ?? "",
5188
5155
  dataset_slugs: opts.datasets ? opts.datasets.split(",").map((s) => s.trim()) : void 0,
5189
5156
  allow_writes: opts.allowWrites ? true : void 0,
5157
+ timezone: opts.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
5190
5158
  async: !opts.sync
5191
5159
  });
5192
5160
  if (opts.sync) {
@@ -5217,7 +5185,10 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
5217
5185
  ).option(
5218
5186
  "--sync",
5219
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"
5220
- ).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) => {
5221
5192
  try {
5222
5193
  const client = new ErdoClient();
5223
5194
  const baselineRunID = opts.sync ? void 0 : await client.latestRunID(threadId);
@@ -5226,6 +5197,7 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
5226
5197
  context: readMaybeFile(opts.context),
5227
5198
  agent_key: opts.agent,
5228
5199
  model: opts.model,
5200
+ timezone: opts.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
5229
5201
  async: !opts.sync,
5230
5202
  read_only: opts.readOnly
5231
5203
  });
@@ -6478,14 +6450,13 @@ program.command("activity").alias("feed").description(
6478
6450
  ).option("-n, --limit <n>", "max items (default 20, max 100)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).option(
6479
6451
  "--categories <list>",
6480
6452
  "comma-separated: attention,approval,workstream,catalog,job,heartbeat (default: attention,approval,workstream)"
6481
- ).option("--scope <scope>", "following | all (default all)").option("--workstream <slug>", "only this workstream").option("--json", "raw JSON response").action(
6453
+ ).option("--workstream <slug>", "only this workstream").option("--json", "raw JSON response").action(
6482
6454
  async (opts) => {
6483
6455
  try {
6484
6456
  const feed = await new ErdoClient().listActivityFeed({
6485
6457
  limit: opts.limit,
6486
6458
  offset: opts.offset,
6487
6459
  categories: opts.categories,
6488
- scope: opts.scope,
6489
6460
  workstream_slug: opts.workstream
6490
6461
  });
6491
6462
  if (opts.json) {
@@ -11381,6 +11352,26 @@ autoCmd.command("list").description("List automations").option("--include-refres
11381
11352
  fail(e);
11382
11353
  }
11383
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
+ });
11384
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) => {
11385
11376
  try {
11386
11377
  const limit = Number(opts.limit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.232.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": {