@erdoai/cli 0.280.1 → 0.282.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 +42 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -916,6 +916,7 @@ var ErdoClient = class {
916
916
  if (params?.limit) q.set("limit", String(params.limit));
917
917
  if (params?.leadRef) q.set("lead_ref", params.leadRef);
918
918
  if (params?.dataset) q.set("dataset", params.dataset);
919
+ if (params?.cursor) q.set("cursor", params.cursor);
919
920
  const qs = q.toString();
920
921
  return this.request(
921
922
  "GET",
@@ -935,6 +936,7 @@ var ErdoClient = class {
935
936
  if (params?.search) q.set("search", params.search);
936
937
  if (params?.limit) q.set("limit", String(params.limit));
937
938
  if (params?.offset) q.set("offset", String(params.offset));
939
+ if (params?.cursor) q.set("cursor", params.cursor);
938
940
  const qs = q.toString();
939
941
  return this.request("GET", `/v1/emails${qs ? `?${qs}` : ""}`);
940
942
  }
@@ -1695,6 +1697,7 @@ var ErdoClient = class {
1695
1697
  if (params?.createdBefore) q.set("created_before", params.createdBefore);
1696
1698
  if (params?.limit !== void 0) q.set("limit", String(params.limit));
1697
1699
  if (params?.offset !== void 0) q.set("offset", String(params.offset));
1700
+ if (params?.cursor) q.set("cursor", params.cursor);
1698
1701
  const qs = q.toString();
1699
1702
  return this.request("GET", `/v1/threads${qs ? `?${qs}` : ""}`);
1700
1703
  }
@@ -2433,10 +2436,11 @@ var ErdoClient = class {
2433
2436
  updateEventPipeline(slug, body) {
2434
2437
  return this.request("PUT", `/v1/event-pipelines/${encodeURIComponent(slug)}`, body);
2435
2438
  }
2436
- listEventPipelineExecutions(slug, limit, offset) {
2439
+ listEventPipelineExecutions(slug, limit, offset, cursor) {
2437
2440
  const q = new URLSearchParams();
2438
2441
  if (limit) q.set("limit", String(limit));
2439
2442
  if (offset) q.set("offset", String(offset));
2443
+ if (cursor) q.set("cursor", cursor);
2440
2444
  const qs = q.toString();
2441
2445
  return this.request(
2442
2446
  "GET",
@@ -2526,11 +2530,13 @@ var ErdoClient = class {
2526
2530
  runHeartbeat(id, body) {
2527
2531
  return this.request("POST", `/v1/heartbeats/${encodeURIComponent(id)}/run`, body ?? {});
2528
2532
  }
2529
- listHeartbeatExecutions(id, limit = 10) {
2533
+ listHeartbeatExecutions(id, limit = 10, cursor) {
2530
2534
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
2531
2535
  throw new Error("limit must be an integer between 1 and 100");
2532
2536
  }
2533
- return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}/executions?limit=${limit}`);
2537
+ const q = new URLSearchParams({ limit: String(limit) });
2538
+ if (cursor) q.set("cursor", cursor);
2539
+ return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}/executions?${q.toString()}`);
2534
2540
  }
2535
2541
  updateHeartbeat(id, body) {
2536
2542
  return this.request(
@@ -2603,6 +2609,7 @@ var ErdoClient = class {
2603
2609
  if (opts.thread) params.set("thread_id", opts.thread);
2604
2610
  if (opts.status) params.set("status", opts.status);
2605
2611
  if (opts.limit) params.set("limit", String(opts.limit));
2612
+ if (opts.cursor) params.set("cursor", opts.cursor);
2606
2613
  const qs = params.toString();
2607
2614
  return this.request("GET", `/v1/runs${qs ? `?${qs}` : ""}`);
2608
2615
  }
@@ -2758,10 +2765,11 @@ var ErdoClient = class {
2758
2765
  getArtifact(id) {
2759
2766
  return this.request("GET", `/v1/artifacts/${encodeURIComponent(id)}`);
2760
2767
  }
2761
- listEvalRuns(suiteSlug, limit) {
2768
+ listEvalRuns(suiteSlug, limit, cursor) {
2762
2769
  const params = new URLSearchParams();
2763
2770
  if (suiteSlug) params.set("suite_slug", suiteSlug);
2764
2771
  if (limit) params.set("limit", String(limit));
2772
+ if (cursor) params.set("cursor", cursor);
2765
2773
  const qs = params.toString();
2766
2774
  return this.request("GET", `/v1/evals/runs${qs ? `?${qs}` : ""}`);
2767
2775
  }
@@ -5210,14 +5218,16 @@ evalCmd.command("results <runId>").description("Show a run's results").option("-
5210
5218
  fail(e);
5211
5219
  }
5212
5220
  });
5213
- evalCmd.command("runs").description("List recent runs").option("-s, --suite <slug>", "filter to one suite").option("-l, --limit <n>", "max runs", (v) => parseInt(v, 10)).action(async (opts) => {
5221
+ evalCmd.command("runs").description("List recent runs").option("-s, --suite <slug>", "filter to one suite").option("-l, --limit <n>", "max runs", (v) => parseInt(v, 10)).option("--cursor <cursor>", "next_cursor from the preceding page").action(async (opts) => {
5214
5222
  try {
5215
- const { runs } = await new ErdoClient().listEvalRuns(opts.suite, opts.limit);
5223
+ const { runs, has_more, next_cursor } = await new ErdoClient().listEvalRuns(opts.suite, opts.limit, opts.cursor);
5216
5224
  for (const r of runs) {
5217
5225
  console.log(
5218
5226
  `${r.id} ${r.status} ${r.passed_cases}/${r.total_cases} avg ${r.avg_score.toFixed(2)} ${compactEvalRunAttribution(r)}`
5219
5227
  );
5220
5228
  }
5229
+ if (has_more && next_cursor) process.stderr.write(`more available \u2014 re-run with --cursor ${next_cursor}
5230
+ `);
5221
5231
  } catch (e) {
5222
5232
  fail(e);
5223
5233
  }
@@ -5506,9 +5516,9 @@ async function resolveConversationPersona(client, selector) {
5506
5516
  throw new Error(`No enabled agent matches "${selector}"`);
5507
5517
  }
5508
5518
  var conversationsCmd = program.command("threads").description("List and open conversations with people and named agents");
5509
- conversationsCmd.command("list").description("List conversations with the latest message, speaker, unread status and open questions").option("-s, --scope <scope>", "own (default) | org | shared | all \u2014 org/shared require org membership").option("--order-by <order>", "created_at (default) | activity (last message time) \u2014 scope=org/shared only").option("--include-automation", "include automation/heartbeat-sourced threads \u2014 scope=org/shared only").option("--origin <origin>", "person (default) | erdo (automation and Shortcut runs) | all \u2014 scope=org/shared only").option("--since <iso>", "include conversations created at or after this RFC3339 timestamp").option("--until <iso>", "include conversations created before this RFC3339 timestamp").option("-l, --limit <n>", "max conversations (default 20, max 100)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).action(async (opts) => {
5519
+ conversationsCmd.command("list").description("List conversations with the latest message, speaker, unread status and open questions").option("-s, --scope <scope>", "own (default) | org | shared | all \u2014 org/shared require org membership").option("--order-by <order>", "created_at (default) | activity (last message time) \u2014 scope=org/shared only").option("--include-automation", "include automation/heartbeat-sourced threads \u2014 scope=org/shared only").option("--origin <origin>", "person (default) | erdo (automation and Shortcut runs) | all \u2014 scope=org/shared only").option("--since <iso>", "include conversations created at or after this RFC3339 timestamp").option("--until <iso>", "include conversations created before this RFC3339 timestamp").option("-l, --limit <n>", "max conversations (default 20, max 100)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).option("--cursor <cursor>", "next_cursor from the preceding creation-ordered page").action(async (opts) => {
5510
5520
  try {
5511
- const { threads, total } = await new ErdoClient().listThreads({
5521
+ const { threads, total, has_more, next_cursor } = await new ErdoClient().listThreads({
5512
5522
  ...opts,
5513
5523
  createdAfter: opts.since,
5514
5524
  createdBefore: opts.until
@@ -5520,7 +5530,10 @@ conversationsCmd.command("list").description("List conversations with the latest
5520
5530
  console.log(`${thread.id} ${thread.name || ""} ${creator} ${thread.source || "unrecorded"} ${thread.unread ? "unread" : "read"} ${speaker} ${preview} questions=${thread.open_question_count ?? 0}`);
5521
5531
  }
5522
5532
  const shown = (opts.offset ?? 0) + threads.length;
5523
- console.error(total > shown ? `(showing ${threads.length} of ${total} \u2014 use --limit/--offset for more)` : `(${total} conversation${total === 1 ? "" : "s"})`);
5533
+ if (has_more && next_cursor) console.error(`more available \u2014 re-run with --cursor ${next_cursor}`);
5534
+ else if (opts.orderBy === "activity") {
5535
+ console.error(total > shown ? `(showing ${threads.length} of ${total} \u2014 use --limit/--offset for more; activity order has no cursor)` : `(${total} conversation${total === 1 ? "" : "s"})`);
5536
+ } else console.error(`(${total} conversation${total === 1 ? "" : "s"})`);
5524
5537
  } catch (e) {
5525
5538
  fail(e);
5526
5539
  }
@@ -5659,10 +5672,12 @@ agentCmd.command("messages <threadId>").description("Show a thread's messages (r
5659
5672
  }
5660
5673
  });
5661
5674
  var runsCmd = program.command("runs").description("Inspect agent runs");
5662
- 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) => {
5675
+ 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)).option("--cursor <cursor>", "next_cursor from the preceding page").action(async (opts) => {
5663
5676
  try {
5664
- const { runs } = await new ErdoClient().listAgentRuns(opts);
5677
+ const { runs, has_more, next_cursor } = await new ErdoClient().listAgentRuns(opts);
5665
5678
  for (const r of runs) console.log(`${r.id} ${r.status} ${r.agent_key}`);
5679
+ if (has_more && next_cursor) process.stderr.write(`more available \u2014 re-run with --cursor ${next_cursor}
5680
+ `);
5666
5681
  } catch (e) {
5667
5682
  fail(e);
5668
5683
  }
@@ -7490,19 +7505,22 @@ sendingDomainsCmd.command("remove <domain>").description(
7490
7505
  });
7491
7506
  emailCmd.command("received").description(
7492
7507
  "Read the mail that arrived at the org's sending domain, newest first \u2014 usually leads replying to outreach an agent sent. Omit --domain: an org has one sending domain and the read resolves it."
7493
- ).option("--domain <domain>", "the sending domain to read (only needed if the org has more than one)").option("--limit <n>", "maximum messages to return, newest first").option("--lead-ref <ref>", "only one lead's email conversation with the desk").option("--dataset <slug>", "with --lead-ref, only that lead dataset").option("--json", "print the raw JSON result instead of the message list").action(async (opts) => {
7508
+ ).option("--domain <domain>", "the sending domain to read (only needed if the org has more than one)").option("--limit <n>", "maximum messages to return, newest first").option("--cursor <cursor>", "next_cursor from the preceding page").option("--lead-ref <ref>", "only one lead's email conversation with the desk").option("--dataset <slug>", "with --lead-ref, only that lead dataset").option("--json", "print the raw JSON result instead of the message list").action(async (opts) => {
7494
7509
  try {
7495
7510
  const res = await new ErdoClient().listReceivedEmails({
7496
7511
  domain: opts.domain,
7497
7512
  limit: opts.limit ? Number(opts.limit) : void 0,
7498
7513
  leadRef: opts.leadRef,
7499
- dataset: opts.dataset
7514
+ dataset: opts.dataset,
7515
+ cursor: opts.cursor
7500
7516
  });
7501
7517
  if (opts.json) {
7502
7518
  print(res);
7503
7519
  return;
7504
7520
  }
7505
7521
  const emails = res.emails ?? [];
7522
+ if (res.has_more && res.next_cursor) process.stderr.write(`more available \u2014 re-run with --cursor ${res.next_cursor}
7523
+ `);
7506
7524
  if (emails.length === 0) {
7507
7525
  console.log(
7508
7526
  `No mail has arrived at ${res.domain}. Replies only come back for a domain registered with receiving on and verified active \u2014 a sending-only domain sends them straight to its nominated mailbox, which is the configuration working rather than a fault.`
@@ -7546,7 +7564,7 @@ emailCmd.command("send").description("Send one transactional email from the org'
7546
7564
  }
7547
7565
  });
7548
7566
  var sentEmailsCmd = emailCmd.command("sent").description("Read the audited outbound email log and provider delivery evidence");
7549
- sentEmailsCmd.command("list").description("List sent email, newest first, including immutable delivered_at evidence").option("--to <email>", "only mail sent to this address").option("--since <timestamp>", "only mail created at or after this RFC 3339 timestamp").option("--search <text>", "case-insensitive subject substring").option("--limit <n>", "page size (default 25, max 200)").option("--offset <n>", "rows to skip").option("--json", "print the raw JSON result instead of a table").action(
7567
+ sentEmailsCmd.command("list").description("List sent email, newest first, including immutable delivered_at evidence").option("--to <email>", "only mail sent to this address").option("--since <timestamp>", "only mail created at or after this RFC 3339 timestamp").option("--search <text>", "case-insensitive subject substring").option("--limit <n>", "page size (default 25, max 200)").option("--offset <n>", "rows to skip").option("--cursor <cursor>", "next_cursor from the preceding page").option("--json", "print the raw JSON result instead of a table").action(
7550
7568
  async (opts) => {
7551
7569
  try {
7552
7570
  const res = await new ErdoClient().listSentEmails({
@@ -7554,13 +7572,16 @@ sentEmailsCmd.command("list").description("List sent email, newest first, includ
7554
7572
  since: opts.since,
7555
7573
  search: opts.search,
7556
7574
  limit: opts.limit ? Number(opts.limit) : void 0,
7557
- offset: opts.offset ? Number(opts.offset) : void 0
7575
+ offset: opts.offset ? Number(opts.offset) : void 0,
7576
+ cursor: opts.cursor
7558
7577
  });
7559
7578
  if (opts.json) {
7560
7579
  print(res);
7561
7580
  return;
7562
7581
  }
7563
7582
  const emails = res.emails ?? [];
7583
+ if (res.has_more && res.next_cursor) process.stderr.write(`more available \u2014 re-run with --cursor ${res.next_cursor}
7584
+ `);
7564
7585
  if (emails.length === 0) {
7565
7586
  console.log("No sent email matches those filters.");
7566
7587
  return;
@@ -7577,7 +7598,7 @@ sentEmailsCmd.command("list").description("List sent email, newest first, includ
7577
7598
  email.sent_at ?? ""
7578
7599
  ])
7579
7600
  );
7580
- process.stderr.write(`showing ${emails.length} of ${res.total} matching message(s)
7601
+ if (!res.has_more) process.stderr.write(`showing ${emails.length} of ${res.total} matching message(s)
7581
7602
  `);
7582
7603
  } catch (e) {
7583
7604
  fail(e);
@@ -10325,7 +10346,7 @@ refreshCmd.command("set <slug>").description(
10325
10346
  }
10326
10347
  );
10327
10348
  refreshCmd.command("edit <slug>").description(
10328
- "Change part of a dataset's saved script or transform_js without resending it: each old_string must match the saved source exactly once. Only the source changes; the schedule and every other setting stay as saved. The edited recipe is compile-checked and test-run like `set`"
10349
+ "Change part of a dataset's saved script, transform_js, or agent prompt without resending it: each old_string must match the saved source exactly once. Only the source changes; the schedule and every other setting stay as saved. An edited script or transform_js is compile-checked and test-run like `set`; an edited agent prompt takes effect on the next run"
10329
10350
  ).requiredOption("--edits <@file>", 'JSON file: [{"old_string": "...", "new_string": "..."}, ...], applied in order').action(async (slug, opts) => {
10330
10351
  try {
10331
10352
  const path = opts.edits.startsWith("@") ? opts.edits.slice(1) : opts.edits;
@@ -11625,9 +11646,9 @@ filterCmd.command("remove <slug> <filterId>").description("Remove a filter from
11625
11646
  fail(e);
11626
11647
  }
11627
11648
  });
11628
- pipelinesCmd.command("executions <slug>").description("Show an event pipeline's recent run history (newest first)").option("-n, --limit <n>", "max executions", (v) => parseInt(v, 10)).action(async (slug, opts) => {
11649
+ pipelinesCmd.command("executions <slug>").description("Show an event pipeline's recent run history (newest first)").option("-n, --limit <n>", "max executions", (v) => parseInt(v, 10)).option("--cursor <cursor>", "next_cursor from the preceding page").action(async (slug, opts) => {
11629
11650
  try {
11630
- print(await new ErdoClient().listEventPipelineExecutions(slug, opts.limit));
11651
+ print(await new ErdoClient().listEventPipelineExecutions(slug, opts.limit, void 0, opts.cursor));
11631
11652
  } catch (e) {
11632
11653
  fail(e);
11633
11654
  }
@@ -11994,13 +12015,13 @@ autoCmd.command("show <id>").description("Show one automation's state, schedule,
11994
12015
  fail(e);
11995
12016
  }
11996
12017
  });
11997
- 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) => {
12018
+ 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").option("--cursor <cursor>", "next_cursor from the preceding page").action(async (id, opts) => {
11998
12019
  try {
11999
12020
  const limit = Number(opts.limit);
12000
12021
  if (!/^\d+$/.test(opts.limit) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
12001
12022
  throw new Error("limit must be an integer between 1 and 100");
12002
12023
  }
12003
- print(await new ErdoClient().listHeartbeatExecutions(id, limit));
12024
+ print(await new ErdoClient().listHeartbeatExecutions(id, limit, opts.cursor));
12004
12025
  } catch (e) {
12005
12026
  fail(e);
12006
12027
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.280.1",
3
+ "version": "0.282.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {