salesprompter-cli 0.1.45 → 0.1.47

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 (3) hide show
  1. package/README.md +3 -1
  2. package/dist/cli.js +31 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -88,6 +88,8 @@ salesprompter affiliate:run \
88
88
  salesprompter affiliate:status "$AFFILIATE_RUN_ID"
89
89
  salesprompter affiliate:regenerate-sequence "$AFFILIATE_RUN_ID"
90
90
  salesprompter affiliate:enrich "$AFFILIATE_RUN_ID"
91
+ salesprompter affiliate:enrich "$AFFILIATE_RUN_ID" \
92
+ --source-audience-run-id "$NEW_AUDIENCE_RUN_ID"
91
93
  salesprompter affiliate:activate "$AFFILIATE_RUN_ID"
92
94
 
93
95
  # See included capability packs
@@ -108,7 +110,7 @@ salesprompter --help
108
110
  - Respect provider terms and customer data boundaries.
109
111
  - `affiliate:run` uses direct email enrichment first, then Phantombuster Email Finder for unresolved people before creating a draft Instantly campaign.
110
112
  - Affiliate preparation automatically creates three variants per step with spintax; `affiliate:regenerate-sequence` rebuilds and syncs them through the Salesprompter app.
111
- - `affiliate:enrich` reruns email recovery and adds only newly found addresses to an existing campaign.
113
+ - `affiliate:enrich` starts durable email recovery and adds only newly found addresses to an existing campaign. It returns a background-processing status for large audiences instead of blocking the terminal. Pass `--source-audience-run-id` to merge a newer compatible audience into that campaign without creating a duplicate campaign.
112
114
  - A draft campaign does not send until `affiliate:activate` is run.
113
115
  - The CLI is designed for interactive users and agent-assisted workflows.
114
116
  - A repo-local Chrome extension compatibility copy is available in `chrome-extension/` for local LinkedIn session sync and popup copy/debug flows.
package/dist/cli.js CHANGED
@@ -6586,20 +6586,24 @@ async function regenerateAffiliateOutreachSequenceViaApp(session, audienceRunId)
6586
6586
  }), AffiliateOutreachResponseSchema);
6587
6587
  return value.outreach;
6588
6588
  }
6589
- async function enrichAffiliateOutreachViaApp(session, audienceRunId) {
6589
+ async function enrichAffiliateOutreachViaApp(session, audienceRunId, sourceAudienceRunId) {
6590
6590
  const before = await getAffiliateOutreachViaApp(session, audienceRunId);
6591
6591
  const previousAttemptedAt = typeof before.stats.latestTopUp === "object" && before.stats.latestTopUp !== null
6592
6592
  ? String(before.stats.latestTopUp.attemptedAt ?? "")
6593
6593
  : "";
6594
- await fetchCliJson(session, (currentSession) => fetch(`${currentSession.apiBaseUrl}/api/cli/affiliate-outreach/${encodeURIComponent(audienceRunId)}/enrich`, {
6594
+ const { value: started } = await fetchCliJson(session, (currentSession) => fetch(`${currentSession.apiBaseUrl}/api/cli/affiliate-outreach/${encodeURIComponent(audienceRunId)}/enrich`, {
6595
6595
  method: "POST",
6596
6596
  headers: {
6597
6597
  "Content-Type": "application/json",
6598
6598
  Authorization: `Bearer ${currentSession.accessToken}`
6599
6599
  },
6600
- body: JSON.stringify({})
6600
+ body: JSON.stringify({ sourceAudienceRunId })
6601
6601
  }), AffiliateOutreachEnrichStartResponseSchema);
6602
- const deadline = Date.now() + 10 * 60 * 1000;
6602
+ const configuredWaitMs = Number(process.env.SALESPROMPTER_AFFILIATE_ENRICH_WAIT_MS);
6603
+ const waitMs = Number.isFinite(configuredWaitMs) && configuredWaitMs >= 0
6604
+ ? Math.min(10 * 60 * 1000, Math.trunc(configuredWaitMs))
6605
+ : 15_000;
6606
+ const deadline = Date.now() + waitMs;
6603
6607
  const configuredPollMs = Number(process.env.SALESPROMPTER_AFFILIATE_ENRICH_POLL_MS);
6604
6608
  const pollMs = Number.isFinite(configuredPollMs) && configuredPollMs > 0
6605
6609
  ? Math.max(10, Math.trunc(configuredPollMs))
@@ -6612,11 +6616,20 @@ async function enrichAffiliateOutreachViaApp(session, audienceRunId) {
6612
6616
  ? current.stats.latestTopUp
6613
6617
  : null;
6614
6618
  const attemptedAt = String(latestTopUp?.attemptedAt ?? "");
6615
- if (attemptedAt && attemptedAt !== previousAttemptedAt) {
6616
- return current;
6619
+ const complete = latestTopUp?.complete !== false;
6620
+ if (attemptedAt && attemptedAt !== previousAttemptedAt && complete) {
6621
+ return {
6622
+ outreach: current,
6623
+ processing: false,
6624
+ workflowRunId: started.workflowRunId
6625
+ };
6617
6626
  }
6618
6627
  }
6619
- throw new Error("Email recovery is still running after 10 minutes. Check affiliate:status and retry later.");
6628
+ return {
6629
+ outreach: before,
6630
+ processing: true,
6631
+ workflowRunId: started.workflowRunId
6632
+ };
6620
6633
  }
6621
6634
  async function uploadLinkedInProductsCatalog(session, payload, batchSize = 100, traceId) {
6622
6635
  let imported = 0;
@@ -13357,13 +13370,20 @@ program
13357
13370
  program
13358
13371
  .command("affiliate:enrich <run-id>")
13359
13372
  .description("Find additional verified emails and add only new leads to the campaign.")
13360
- .action(async (runId) => {
13373
+ .option("--source-audience-run-id <run-id>", "Use a newer compatible audience to top up this campaign")
13374
+ .action(async (runId, options) => {
13361
13375
  const session = await requireAuthSession();
13362
- const outreach = await enrichAffiliateOutreachViaApp(session, z.string().uuid().parse(runId));
13376
+ const result = await enrichAffiliateOutreachViaApp(session, z.string().uuid().parse(runId), options.sourceAudienceRunId
13377
+ ? z.string().uuid().parse(options.sourceAudienceRunId)
13378
+ : undefined);
13363
13379
  printOutput({
13364
13380
  status: "ok",
13365
- outreach,
13366
- message: "Email recovery finished and new verified leads were added."
13381
+ processing: result.processing,
13382
+ workflowRunId: result.workflowRunId,
13383
+ outreach: result.outreach,
13384
+ message: result.processing
13385
+ ? `Email recovery is running in the background. Check: salesprompter affiliate:status ${runId}`
13386
+ : "Email recovery finished and new verified leads were added."
13367
13387
  });
13368
13388
  });
13369
13389
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "salesprompter-cli",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "description": "Sales workflow CLI for guided lead generation, enrichment, scoring, and sync.",
5
5
  "author": "Daniel Sinewe <hello@danielsinewe.com>",
6
6
  "type": "module",