@erdoai/cli 0.237.0 → 0.239.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 +37 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1642,6 +1642,8 @@ var ErdoClient = class {
1642
1642
  if (params?.orderBy) q.set("order_by", params.orderBy);
1643
1643
  if (params?.includeAutomation) q.set("include_automation", "true");
1644
1644
  if (params?.origin) q.set("origin", params.origin);
1645
+ if (params?.createdAfter) q.set("created_after", params.createdAfter);
1646
+ if (params?.createdBefore) q.set("created_before", params.createdBefore);
1645
1647
  if (params?.limit !== void 0) q.set("limit", String(params.limit));
1646
1648
  if (params?.offset !== void 0) q.set("offset", String(params.offset));
1647
1649
  const qs = q.toString();
@@ -1847,6 +1849,13 @@ var ErdoClient = class {
1847
1849
  `/v1/datasets/${encodeURIComponent(datasetSlug)}/leads/${encodeURIComponent(lead)}`
1848
1850
  );
1849
1851
  }
1852
+ resolveLeadReferences(datasetSlug, leadRefs) {
1853
+ return this.request(
1854
+ "POST",
1855
+ `/v1/datasets/${encodeURIComponent(datasetSlug)}/lead-reference-resolutions`,
1856
+ { lead_refs: leadRefs }
1857
+ );
1858
+ }
1850
1859
  // The captures the platform refused to resolve: two leads sharing a contact
1851
1860
  // detail, or a submission whose email and phone point at different leads.
1852
1861
  listLeadMergeCandidates(datasetSlug, limit, traffic) {
@@ -5347,9 +5356,13 @@ async function resolveConversationPersona(client, selector) {
5347
5356
  throw new Error(`No enabled agent matches "${selector}"`);
5348
5357
  }
5349
5358
  var conversationsCmd = program.command("threads").description("List and open conversations with people and named agents");
5350
- 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("-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) => {
5359
+ 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) => {
5351
5360
  try {
5352
- const { threads, total } = await new ErdoClient().listThreads(opts);
5361
+ const { threads, total } = await new ErdoClient().listThreads({
5362
+ ...opts,
5363
+ createdAfter: opts.since,
5364
+ createdBefore: opts.until
5365
+ });
5353
5366
  for (const thread of threads) {
5354
5367
  const preview = (thread.last_message_preview || "").replace(/[\t\r\n]+/g, " ").slice(0, 120);
5355
5368
  const speaker = thread.last_message_author_display_name || thread.last_message_author_entity_type || "";
@@ -10049,6 +10062,26 @@ leadsCmd.command("get <dataset> <lead>").description(
10049
10062
  fail(e);
10050
10063
  }
10051
10064
  });
10065
+ leadsCmd.command("resolve <dataset> <refs...>").description("Resolve many stored lead references to their surviving leads after merges").option("--json", "print the raw JSON result instead of a table").action(async (dataset, refs, opts) => {
10066
+ try {
10067
+ const res = await new ErdoClient().resolveLeadReferences(dataset, refs);
10068
+ if (opts.json) {
10069
+ print(res);
10070
+ return;
10071
+ }
10072
+ const rows = res.resolved.map((item) => [
10073
+ item.lead_ref,
10074
+ item.survivor_lead_ref,
10075
+ item.survivor_canonical_lead_id,
10076
+ item.merged ? "yes" : "no"
10077
+ ]);
10078
+ if (rows.length) printAlignedTable(["input", "survivor", "survivor canonical id", "merged"], rows);
10079
+ if (res.not_found.length) console.log(`Not found: ${res.not_found.join(", ")}`);
10080
+ if (res.invalid.length) console.log(`Invalid: ${res.invalid.join(", ")}`);
10081
+ } catch (e) {
10082
+ fail(e);
10083
+ }
10084
+ });
10052
10085
  leadsCmd.command("candidates <dataset>").description(
10053
10086
  "List unresolved refused submissions and their candidate leads. Inspect the saved evidence before previewing an apply-to-lead or dismissal decision with leads resolve-capture."
10054
10087
  ).option("-l, --limit <n>", "maximum captures to return (default 50, maximum 200)", (v) => parseInt(v, 10)).addOption(new Option2("--traffic <kind>", "include real submissions, independently trusted tests, or both").choices(["real", "test", "all"])).option("--json", "print the raw JSON result instead of a table").action(async (dataset, opts) => {
@@ -11438,7 +11471,8 @@ autoCmd.command("show <id>").description("Show one automation's state, schedule,
11438
11471
  console.log(`schedule: ${schedule}`);
11439
11472
  console.log(`next run: ${h.next_run_at ?? cron?.next_run_at ?? "none"}`);
11440
11473
  const latest = h.latest_execution;
11441
- console.log(`latest run: ${latest ? `${latest.status} at ${latest.started_at}${latest.error_message ? `; error: ${latest.error_message}` : ""}` : "none"}`);
11474
+ const latestDetail = latest?.error_message ? latest.failure_class === "reported_could_not" ? `; couldn't: ${latest.error_message}` : `; error: ${latest.error_message}` : "";
11475
+ console.log(`latest run: ${latest ? `${latest.status} at ${latest.started_at}${latestDetail}` : "none"}`);
11442
11476
  } catch (e) {
11443
11477
  fail(e);
11444
11478
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.237.0",
3
+ "version": "0.239.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {