@erdoai/cli 0.107.0 → 0.108.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 +30 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7059,7 +7059,7 @@ var leadsCmd = program.command("leads").description(
7059
7059
  "Read leads in a lead dataset, merge two that are the same person, and run the lead playbook that suggests each lead's next action"
7060
7060
  );
7061
7061
  leadsCmd.command("get <dataset> <lead>").description(
7062
- "Read one lead: its permanent canonical_lead_id, the email and phone evidence bound to it, its dataset row, the leads merged into it, and its capture history. <lead> is either the canonical_lead_id UUID or the 22-character lead reference, and an id that has since been merged away resolves to the lead it became \u2014 so an id read off an old capture response still works."
7062
+ "Read one lead: its permanent canonical_lead_id, what it told us (on the form and in every call, chat, text and email reply since), the email and phone evidence bound to it, its dataset row, the leads merged into it, and its capture history. <lead> is either the canonical_lead_id UUID or the 22-character lead reference, and an id that has since been merged away resolves to the lead it became \u2014 so an id read off an old capture response still works."
7063
7063
  ).option("--json", "print the raw JSON result instead of a summary").action(async (dataset, lead, opts) => {
7064
7064
  try {
7065
7065
  const res = await new ErdoClient().getLead(dataset, lead);
@@ -7145,7 +7145,7 @@ leadsCmd.command("merge <dataset> <survivor>").description(
7145
7145
  console.log(`Already one lead: ${res.absorbed_lead_id} resolves to ${res.lead.canonical_lead_id}.`);
7146
7146
  } else {
7147
7147
  console.log(
7148
- `Merged ${res.absorbed_lead_id} into ${res.lead.canonical_lead_id} \u2014 ${res.aliases_moved} contact ${res.aliases_moved === 1 ? "alias" : "aliases"} moved, ${res.rows_combined} ${res.rows_combined === 1 ? "row" : "rows"} combined.`
7148
+ `Merged ${res.absorbed_lead_id} into ${res.lead.canonical_lead_id} \u2014 ${res.aliases_moved} contact ${res.aliases_moved === 1 ? "alias" : "aliases"} and ${res.details_moved ?? 0} ${res.details_moved === 1 ? "detail" : "details"} moved, ${res.rows_combined} ${res.rows_combined === 1 ? "row" : "rows"} combined.`
7149
7149
  );
7150
7150
  }
7151
7151
  printLead(res.lead);
@@ -7552,6 +7552,24 @@ function printRecordedLeadDecision(a) {
7552
7552
  console.log(`Recorded ${a.action_kind} on lead ${a.lead_reference}${a.action_kind === "hold" ? until : ""}.`);
7553
7553
  if (a.rationale) console.log(a.rationale);
7554
7554
  }
7555
+ function leadDetailSource(kind) {
7556
+ switch (kind) {
7557
+ case "form":
7558
+ return "form";
7559
+ case "phone_call":
7560
+ return "call";
7561
+ case "widget_conversation":
7562
+ return "website chat";
7563
+ case "sms":
7564
+ return "text";
7565
+ case "whatsapp":
7566
+ return "WhatsApp";
7567
+ case "email_reply":
7568
+ return "email reply";
7569
+ default:
7570
+ return kind;
7571
+ }
7572
+ }
7555
7573
  function printLead(lead) {
7556
7574
  console.log(`lead ${lead.canonical_lead_id}`);
7557
7575
  console.log(`reference ${lead.reference}`);
@@ -7565,6 +7583,16 @@ function printLead(lead) {
7565
7583
  if (lead.absorbed_lead_ids?.length) {
7566
7584
  console.log(`absorbed ${lead.absorbed_lead_ids.join(", ")}`);
7567
7585
  }
7586
+ if (lead.details?.length) {
7587
+ console.log("\nwhat they told us");
7588
+ printAlignedTable(
7589
+ ["question", "answer", "from", "when"],
7590
+ lead.details.flatMap((d) => [
7591
+ [d.label, d.value, leadDetailSource(d.source_kind), d.observed_at],
7592
+ ...(d.earlier ?? []).map((e) => ["", ` earlier: ${e.value}`, leadDetailSource(e.source_kind), e.observed_at])
7593
+ ])
7594
+ );
7595
+ }
7568
7596
  if (lead.aliases?.length) {
7569
7597
  console.log("\ncontact evidence");
7570
7598
  printAlignedTable(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.107.0",
3
+ "version": "0.108.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {