@erdoai/cli 0.176.0 → 0.177.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 +46 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1595,6 +1595,18 @@ var ErdoClient = class {
1595
1595
  `/v1/datasets/${encodeURIComponent(datasetSlug)}/leads/${encodeURIComponent(lead)}/timeline`
1596
1596
  );
1597
1597
  }
1598
+ // Whether each lead in a dataset has ever answered, from the follow-up
1599
+ // engine's own reading, a page of the dataset at a time.
1600
+ listLeadReachability(datasetSlug, opts = {}) {
1601
+ const params = new URLSearchParams();
1602
+ if (opts.limit) params.set("limit", String(opts.limit));
1603
+ if (opts.offset) params.set("offset", String(opts.offset));
1604
+ const qs = params.toString();
1605
+ return this.request(
1606
+ "GET",
1607
+ `/v1/datasets/${encodeURIComponent(datasetSlug)}/lead-reachability${qs ? `?${qs}` : ""}`
1608
+ );
1609
+ }
1598
1610
  // A dry run: nothing is stored and nothing is sent. body tries a draft
1599
1611
  // playbook instead of the saved one.
1600
1612
  // agent_id tries the draft as a different concierge; it is read only
@@ -8981,6 +8993,40 @@ unavailable: ${source} \u2014 ${reason}`);
8981
8993
  fail(e);
8982
8994
  }
8983
8995
  });
8996
+ leadsCmd.command("reachability <dataset>").description(
8997
+ "List whether each lead in a dataset has ever answered us, from the follow-up engine's own reading: confirmed once the lead replied, called in, picked up a call and talked, texted, wrote on WhatsApp, chatted on the website or booked, and unconfirmed until then. An out-of-office reply and a STOP do not count. The same reading `leads timeline` shows for one lead under timing."
8998
+ ).option("--limit <n>", "leads per page, in canonical_lead_id order (default 500, max 5000)").option("--offset <n>", "leads to skip").option("--json", "print the raw JSON result instead of a table").action(async (dataset, opts) => {
8999
+ try {
9000
+ const limit = opts.limit === void 0 ? void 0 : parseInt(opts.limit, 10);
9001
+ const offset = opts.offset === void 0 ? void 0 : parseInt(opts.offset, 10);
9002
+ if (limit !== void 0 && (!Number.isFinite(limit) || limit <= 0) || offset !== void 0 && (!Number.isFinite(offset) || offset < 0)) {
9003
+ fail(new Error("--limit must be a positive number and --offset zero or more"));
9004
+ return;
9005
+ }
9006
+ const res = await new ErdoClient().listLeadReachability(dataset, { limit, offset });
9007
+ if (opts.json) {
9008
+ print(res);
9009
+ return;
9010
+ }
9011
+ if (res.leads.length === 0) {
9012
+ console.log(`No leads at offset ${res.offset} of ${res.total}.`);
9013
+ } else {
9014
+ printAlignedTable(
9015
+ ["lead", "reference", "reachability", "via", "reached at"],
9016
+ res.leads.map((l) => [l.canonical_lead_id, l.lead_reference, l.reachability, l.reached_via ?? "", l.reached_at ?? ""])
9017
+ );
9018
+ const confirmed = res.leads.filter((l) => l.reachability === "confirmed").length;
9019
+ console.log(`
9020
+ ${confirmed} of ${res.leads.length} confirmed; leads ${res.offset + 1}\u2013${res.offset + res.leads.length} of ${res.total}.`);
9021
+ }
9022
+ for (const [source, reason] of Object.entries(res.unavailable ?? {})) {
9023
+ console.log(`
9024
+ unavailable: ${source} \u2014 ${reason}`);
9025
+ }
9026
+ } catch (e) {
9027
+ fail(e);
9028
+ }
9029
+ });
8984
9030
  var leadNextActionsCmd = leadsCmd.command("next-actions").description("Read the suggested next action for each lead, hold, close or start a lead, and dry-run the playbook on one lead");
8985
9031
  leadNextActionsCmd.command("list").description(
8986
9032
  "List each lead's current suggestion, highest priority first. --status pending_approval lists the cards waiting for a person."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.176.0",
3
+ "version": "0.177.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {