@erdoai/cli 0.89.0 → 0.90.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 +40 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -489,10 +489,13 @@ var ErdoClient = class {
489
489
  // Phone conversation records: inbound calls to a voice agent's own number and
490
490
  // the outbound calls Erdo placed. Website chat widget conversations are a
491
491
  // different resource — they live under /v1/voice/widget-conversations.
492
+ // canonical_lead_id narrows to one lead's calls, by its UUID or its lead
493
+ // reference — the same filter every conversation list takes.
492
494
  listVoiceCalls(params) {
493
495
  const q = new URLSearchParams();
494
496
  if (params?.agent) q.set("agent", params.agent);
495
497
  if (params?.direction) q.set("direction", params.direction);
498
+ if (params?.canonical_lead_id) q.set("canonical_lead_id", params.canonical_lead_id);
496
499
  if (params?.limit !== void 0) q.set("limit", String(params.limit));
497
500
  if (params?.offset !== void 0) q.set("offset", String(params.offset));
498
501
  if (params?.cursor) q.set("cursor", params.cursor);
@@ -510,6 +513,7 @@ var ErdoClient = class {
510
513
  if (params?.widget) q.set("widget", params.widget);
511
514
  if (params?.since) q.set("since", params.since);
512
515
  if (params?.until) q.set("until", params.until);
516
+ if (params?.canonical_lead_id) q.set("canonical_lead_id", params.canonical_lead_id);
513
517
  if (params?.limit !== void 0) q.set("limit", String(params.limit));
514
518
  if (params?.offset !== void 0) q.set("offset", String(params.offset));
515
519
  if (params?.cursor) q.set("cursor", params.cursor);
@@ -536,6 +540,7 @@ var ErdoClient = class {
536
540
  const q = new URLSearchParams();
537
541
  if (params?.phone_number) q.set("phone_number", params.phone_number);
538
542
  if (params?.address) q.set("address", params.address);
543
+ if (params?.canonical_lead_id) q.set("canonical_lead_id", params.canonical_lead_id);
539
544
  if (params?.limit !== void 0) q.set("limit", String(params.limit));
540
545
  if (params?.cursor) q.set("cursor", params.cursor);
541
546
  const qs = q.toString();
@@ -5215,13 +5220,18 @@ function contactLabel(contact) {
5215
5220
  function leadStatusLabel(outcome) {
5216
5221
  return outcome ? outcome : "pending";
5217
5222
  }
5223
+ function leadReferenceLabel(reference) {
5224
+ return reference ? reference : "-";
5225
+ }
5226
+ var LEAD_FILTER_HELP = "only this lead's conversations \u2014 its canonical lead id (UUID) or its 22-character lead reference";
5218
5227
  var voiceCallsCmd = voiceCmd.command("calls").description("Inbound and outbound phone call records");
5219
- voiceCallsCmd.command("list").description("List the organization's phone calls, newest first").option("--agent <slug>", "only calls held by this voice agent, by slug").option("--direction <direction>", "only 'inbound' (calls to the agent's number) or 'outbound'").option("--limit <n>", "page size (default 25, max 100)").option("--offset <n>", "rows to skip").option("--cursor <cursor>", "next_cursor from the preceding page (stable paging)").option("--json", "print the raw JSON result instead of a table").action(
5228
+ voiceCallsCmd.command("list").description("List the organization's phone calls, newest first").option("--agent <slug>", "only calls held by this voice agent, by slug").option("--direction <direction>", "only 'inbound' (calls to the agent's number) or 'outbound'").option("--lead <lead>", LEAD_FILTER_HELP).option("--limit <n>", "page size (default 25, max 100)").option("--offset <n>", "rows to skip").option("--cursor <cursor>", "next_cursor from the preceding page (stable paging)").option("--json", "print the raw JSON result instead of a table").action(
5220
5229
  async (opts) => {
5221
5230
  try {
5222
5231
  const res = await new ErdoClient().listVoiceCalls({
5223
5232
  agent: opts.agent,
5224
5233
  direction: opts.direction,
5234
+ canonical_lead_id: opts.lead,
5225
5235
  limit: opts.limit ? Number(opts.limit) : void 0,
5226
5236
  offset: opts.offset ? Number(opts.offset) : void 0,
5227
5237
  cursor: opts.cursor
@@ -5246,6 +5256,7 @@ voiceCallsCmd.command("list").description("List the organization's phone calls,
5246
5256
  "transcript",
5247
5257
  "contact",
5248
5258
  "lead",
5259
+ "lead ref",
5249
5260
  "started",
5250
5261
  "summary"
5251
5262
  ],
@@ -5259,6 +5270,7 @@ voiceCallsCmd.command("list").description("List the organization's phone calls,
5259
5270
  call.has_transcript ? "yes" : "no",
5260
5271
  contactLabel(call.contact),
5261
5272
  leadStatusLabel(call.lead_status),
5273
+ leadReferenceLabel(call.lead_reference),
5262
5274
  call.created_at,
5263
5275
  call.transcript_summary
5264
5276
  ])
@@ -5275,7 +5287,7 @@ voiceCallsCmd.command("list").description("List the organization's phone calls,
5275
5287
  }
5276
5288
  );
5277
5289
  voiceCallsCmd.command("get <callID>").description(
5278
- "Read one phone call in full: transcript, summary, per-turn LLM metrics, and the lead it produced (contact, lead_status, lead_saved_at)"
5290
+ "Read one phone call in full: transcript, summary, per-turn LLM metrics, and the lead it produced (contact, lead_status, lead_saved_at, canonical_lead_id, lead_reference)"
5279
5291
  ).action(async (callID) => {
5280
5292
  try {
5281
5293
  print(await new ErdoClient().getVoiceCall(callID));
@@ -5284,13 +5296,14 @@ voiceCallsCmd.command("get <callID>").description(
5284
5296
  }
5285
5297
  });
5286
5298
  var widgetConversationsCmd = voiceCmd.command("widget-conversations").description("Website concierge widget conversations (text, voice and video sessions)");
5287
- widgetConversationsCmd.command("list").description("List the organization's widget conversations, newest first").option("--widget <handle>", "only this widget's conversations \u2014 its name or public key (vw_...)").option("--since <rfc3339>", "only conversations that started at or after this time (inclusive)").option("--until <rfc3339>", "only conversations that started before this time (exclusive)").option("--limit <n>", "page size (default 25, max 100)").option("--offset <n>", "rows to skip").option("--cursor <cursor>", "next_cursor from the preceding page (stable paging)").option("--json", "print the raw JSON result instead of a table").action(
5299
+ widgetConversationsCmd.command("list").description("List the organization's widget conversations, newest first").option("--widget <handle>", "only this widget's conversations \u2014 its name or public key (vw_...)").option("--since <rfc3339>", "only conversations that started at or after this time (inclusive)").option("--until <rfc3339>", "only conversations that started before this time (exclusive)").option("--lead <lead>", LEAD_FILTER_HELP).option("--limit <n>", "page size (default 25, max 100)").option("--offset <n>", "rows to skip").option("--cursor <cursor>", "next_cursor from the preceding page (stable paging)").option("--json", "print the raw JSON result instead of a table").action(
5288
5300
  async (opts) => {
5289
5301
  try {
5290
5302
  const res = await new ErdoClient().listWidgetConversations({
5291
5303
  widget: opts.widget,
5292
5304
  since: opts.since,
5293
5305
  until: opts.until,
5306
+ canonical_lead_id: opts.lead,
5294
5307
  limit: opts.limit ? Number(opts.limit) : void 0,
5295
5308
  offset: opts.offset ? Number(opts.offset) : void 0,
5296
5309
  cursor: opts.cursor
@@ -5313,6 +5326,7 @@ widgetConversationsCmd.command("list").description("List the organization's widg
5313
5326
  "transcript",
5314
5327
  "contact",
5315
5328
  "lead",
5329
+ "lead ref",
5316
5330
  "started",
5317
5331
  "summary"
5318
5332
  ],
@@ -5324,6 +5338,7 @@ widgetConversationsCmd.command("list").description("List the organization's widg
5324
5338
  c.has_transcript ? "yes" : "no",
5325
5339
  contactLabel(c.contact),
5326
5340
  leadStatusLabel(c.lead_status),
5341
+ leadReferenceLabel(c.lead_reference),
5327
5342
  c.created_at,
5328
5343
  c.transcript_summary
5329
5344
  ])
@@ -5342,7 +5357,7 @@ widgetConversationsCmd.command("list").description("List the organization's widg
5342
5357
  }
5343
5358
  );
5344
5359
  widgetConversationsCmd.command("get <sessionID>").description(
5345
- "Read one widget conversation in full: transcript, summary, topics, per-turn LLM metrics, and the lead it produced (contact, lead_status, lead_saved_at)"
5360
+ "Read one widget conversation in full: transcript, summary, topics, per-turn LLM metrics, and the lead it produced (contact, lead_status, lead_saved_at, canonical_lead_id, lead_reference)"
5346
5361
  ).option("--widget <handle>", "the widget it belongs to \u2014 optional, the session id identifies it").action(async (sessionID, opts) => {
5347
5362
  try {
5348
5363
  print(await new ErdoClient().getWidgetConversation(sessionID, opts.widget));
@@ -5351,12 +5366,13 @@ widgetConversationsCmd.command("get <sessionID>").description(
5351
5366
  }
5352
5367
  });
5353
5368
  var voiceSMSCmd = voiceCmd.command("sms").description("Text conversations on a voice agent's own number");
5354
- voiceSMSCmd.command("list").description("List the organization's SMS conversations, most recently active first").option("--phone-number <number>", "only conversations on this Erdo number (any format)").option("--address <number>", "only the conversation with this person (any format)").option("--limit <n>", "page size (default 25, max 100)").option("--cursor <cursor>", "next_cursor from the preceding page (stable paging)").option("--json", "print the raw JSON result instead of a table").action(
5369
+ voiceSMSCmd.command("list").description("List the organization's SMS conversations, most recently active first").option("--phone-number <number>", "only conversations on this Erdo number (any format)").option("--address <number>", "only the conversation with this person (any format)").option("--lead <lead>", LEAD_FILTER_HELP).option("--limit <n>", "page size (default 25, max 100)").option("--cursor <cursor>", "next_cursor from the preceding page (stable paging)").option("--json", "print the raw JSON result instead of a table").action(
5355
5370
  async (opts) => {
5356
5371
  try {
5357
5372
  const res = await new ErdoClient().listSMSConversations({
5358
5373
  phone_number: opts.phoneNumber,
5359
5374
  address: opts.address,
5375
+ canonical_lead_id: opts.lead,
5360
5376
  limit: opts.limit ? Number(opts.limit) : void 0,
5361
5377
  cursor: opts.cursor
5362
5378
  });
@@ -5370,7 +5386,7 @@ voiceSMSCmd.command("list").description("List the organization's SMS conversatio
5370
5386
  return;
5371
5387
  }
5372
5388
  printAlignedTable(
5373
- ["session id", "phone", "address", "msgs", "last inbound", "last outbound", "summary"],
5389
+ ["session id", "phone", "address", "msgs", "last inbound", "last outbound", "lead ref", "summary"],
5374
5390
  conversations.map((c) => [
5375
5391
  c.session_id,
5376
5392
  c.phone_number,
@@ -5380,6 +5396,7 @@ voiceSMSCmd.command("list").description("List the organization's SMS conversatio
5380
5396
  c.message_count,
5381
5397
  c.last_inbound_at ?? "",
5382
5398
  c.last_outbound_at ?? "",
5399
+ leadReferenceLabel(c.lead_reference),
5383
5400
  c.summary
5384
5401
  ])
5385
5402
  );
@@ -5426,6 +5443,9 @@ voiceSMSCmd.command("get <sessionID>").description("Read one SMS conversation: i
5426
5443
  console.log(`
5427
5444
  contact: ${parts.join(" \xB7 ")}`);
5428
5445
  }
5446
+ if (c.lead_reference) {
5447
+ console.log(`lead: ${c.lead_reference} (${c.canonical_lead_id})`);
5448
+ }
5429
5449
  const messages = res.messages ?? [];
5430
5450
  if (messages.length === 0) {
5431
5451
  console.log("\nNo texts have been recorded in this conversation yet.");
@@ -6290,8 +6310,20 @@ function printLead(lead) {
6290
6310
  if (lead.captures?.length) {
6291
6311
  console.log("\ncaptures");
6292
6312
  printAlignedTable(
6293
- ["when", "producer", "resolution", "conversion"],
6294
- lead.captures.map((c) => [c.created_at, c.producer, c.resolution, c.conversion_status])
6313
+ ["when", "producer", "pipeline", "resolution", "conversion"],
6314
+ lead.captures.map((c) => [c.created_at, c.producer, c.pipeline_id ?? "", c.resolution, c.conversion_status])
6315
+ );
6316
+ }
6317
+ if (lead.refused_captures?.length) {
6318
+ console.log("\nrefused captures (this lead was one of the candidates)");
6319
+ printAlignedTable(
6320
+ ["when", "pipeline", "resolution", "candidates"],
6321
+ lead.refused_captures.map((c) => [
6322
+ c.created_at,
6323
+ c.pipeline_id ?? "",
6324
+ c.resolution,
6325
+ (c.candidate_lead_ids ?? []).join(", ")
6326
+ ])
6295
6327
  );
6296
6328
  }
6297
6329
  if (lead.row) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.89.0",
3
+ "version": "0.90.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {