@sellable/mcp 0.1.555 → 0.1.557

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 (63) hide show
  1. package/README.md +13 -2
  2. package/agents/registry.json +2 -2
  3. package/dist/api.js +3 -6
  4. package/dist/auth.d.ts +0 -6
  5. package/dist/auth.js +2 -44
  6. package/dist/refill-run-client.d.ts +0 -5
  7. package/dist/refill-run-client.js +0 -15
  8. package/dist/refill-run-loop.d.ts +1 -12
  9. package/dist/refill-run-loop.js +13 -158
  10. package/dist/server.js +23 -0
  11. package/dist/tools/auth.d.ts +0 -5
  12. package/dist/tools/auth.js +12 -49
  13. package/dist/tools/campaign-message-preparation.d.ts +0 -62
  14. package/dist/tools/campaign-message-preparation.js +0 -41
  15. package/dist/tools/campaigns.js +2 -2
  16. package/dist/tools/csv-dnc.js +2 -2
  17. package/dist/tools/evergreen-refill-plan.d.ts +0 -3
  18. package/dist/tools/evergreen-refill-plan.js +7 -29
  19. package/dist/tools/find-leads-runs.d.ts +151 -0
  20. package/dist/tools/find-leads-runs.js +98 -0
  21. package/dist/tools/leads.d.ts +317 -32
  22. package/dist/tools/leads.js +171 -10
  23. package/dist/tools/model-quality.js +4 -6
  24. package/dist/tools/prompts.d.ts +3 -3
  25. package/dist/tools/prompts.js +7 -15
  26. package/dist/tools/provider-preflight.d.ts +65 -2
  27. package/dist/tools/provider-preflight.js +97 -10
  28. package/dist/tools/readiness.d.ts +89 -5
  29. package/dist/tools/readiness.js +66 -0
  30. package/dist/tools/refill-executors.d.ts +0 -38
  31. package/dist/tools/refill-executors.js +3 -222
  32. package/dist/tools/refill-sends-v2.d.ts +1 -112
  33. package/dist/tools/refill-sends-v2.js +2 -302
  34. package/dist/tools/refill-sends.d.ts +32 -678
  35. package/dist/tools/refill-sends.js +13 -274
  36. package/dist/tools/refill-target-plan.js +14 -486
  37. package/dist/tools/registry.d.ts +330 -115
  38. package/dist/tools/registry.js +7 -1
  39. package/dist/tools/scheduler-fill-capacity.js +1 -1
  40. package/dist/tools/scheduler-run.d.ts +0 -71
  41. package/dist/tools/scheduler-run.js +1 -203
  42. package/dist/tools/setup-evergreen-campaigns.js +1 -1
  43. package/dist/tools/workspace-context.d.ts +1 -1
  44. package/dist/tools/workspace-context.js +3 -8
  45. package/dist/tools/workspace-export.js +2 -2
  46. package/dist/tools/workspaces.d.ts +2 -48
  47. package/dist/tools/workspaces.js +5 -48
  48. package/package.json +1 -1
  49. package/skills/create-campaign/SKILL.md +3 -3
  50. package/skills/create-campaign-v2/SKILL.md +1 -1
  51. package/skills/create-evergreen-campaigns/SKILL.md +16 -16
  52. package/skills/find-leads/SKILL.md +48 -630
  53. package/skills/find-leads-v2/SKILL.md +70 -0
  54. package/skills/find-leads-v2/core/flow.v1.json +31 -0
  55. package/skills/refill-sends/SKILL.md +353 -91
  56. package/skills/refill-sends-v2/SKILL.md +6 -6
  57. package/skills/refill-sends-v2-workflow/SKILL.md +5 -5
  58. package/skills/refill-sends-v2-workflow/core/flow.v1.json +8 -8
  59. package/skills/refill-sends-workflow/SKILL.md +743 -100
  60. package/skills/refill-sends-workflow/core/flow.v1.json +1 -185
  61. package/dist/refill-contract.d.ts +0 -157
  62. package/dist/refill-contract.js +0 -487
  63. package/skills/refill-sends-workflow/core/contract.v2.json +0 -543
@@ -1348,6 +1348,10 @@ export const leadToolDefinitions = [
1348
1348
  type: "string",
1349
1349
  description: "Optional campaign offer ID for campaign-scoped preflight tracking.",
1350
1350
  },
1351
+ findLeadsRunId: {
1352
+ type: "string",
1353
+ description: "Optional durable Find Leads run ID for exact run-scoped prompt tracking.",
1354
+ },
1351
1355
  confirmed: {
1352
1356
  type: "boolean",
1353
1357
  description: "Set true after user approval when interaction mode requires confirmation for this action.",
@@ -1462,6 +1466,18 @@ export const leadToolDefinitions = [
1462
1466
  type: "string",
1463
1467
  description: "Campaign offer ID to associate search",
1464
1468
  },
1469
+ findLeadsRunId: {
1470
+ type: "string",
1471
+ description: "Campaignless run/list ID. Cannot be combined with campaignOfferId.",
1472
+ },
1473
+ runVersion: {
1474
+ type: "number",
1475
+ description: "Current durable run version for a campaignless search.",
1476
+ },
1477
+ targetLeadCount: {
1478
+ type: "number",
1479
+ description: "Approved bounded source cap for a campaignless search.",
1480
+ },
1465
1481
  searchName: {
1466
1482
  type: "string",
1467
1483
  description: "REQUIRED: Descriptive name for this search. Include key filters. Examples: 'SaaS + Series A-B + 11-200 employees', 'Healthcare VPs + 51-500 employees'",
@@ -1518,7 +1534,7 @@ export const leadToolDefinitions = [
1518
1534
  },
1519
1535
  {
1520
1536
  name: "search_sales_nav",
1521
- description: 'Search LinkedIn Sales Navigator. Requires get_provider_prompt({ provider: "sales-nav" }) first. Returns normalized results with pagination. `campaignOfferId` is optional for directional preview runs; include it only when the search should be associated with a campaign. Post-mint create-campaign-v2 watch runs MUST pass campaignOfferId and currentStep: "sales-nav" so the search appears in the watched campaign UI. Omitting campaignOfferId post-mint orphans the search from the UI.',
1537
+ description: 'Search LinkedIn Sales Navigator. Requires exact provider prompt preflight. Pass exactly one owner: campaignOfferId for campaign work or findLeadsRunId plus runVersion for a campaignless run.',
1522
1538
  inputSchema: {
1523
1539
  type: "object",
1524
1540
  properties: {
@@ -1543,6 +1559,9 @@ export const leadToolDefinitions = [
1543
1559
  type: "string",
1544
1560
  description: "Campaign offer ID to associate search",
1545
1561
  },
1562
+ findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
1563
+ runVersion: { type: "number", description: "Current durable run version" },
1564
+ targetLeadCount: { type: "number", description: "Approved bounded source cap" },
1546
1565
  searchName: {
1547
1566
  type: "string",
1548
1567
  description: "Optional name for the search",
@@ -1978,6 +1997,9 @@ export const leadToolDefinitions = [
1978
1997
  type: "string",
1979
1998
  description: "Campaign offer ID to associate search",
1980
1999
  },
2000
+ findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
2001
+ runVersion: { type: "number", description: "Current durable run version" },
2002
+ targetLeadCount: { type: "number", description: "Approved bounded source cap" },
1981
2003
  workspaceId: {
1982
2004
  type: "string",
1983
2005
  description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
@@ -2044,6 +2066,8 @@ export const leadToolDefinitions = [
2044
2066
  type: "string",
2045
2067
  description: "Campaign offer ID to associate search. Optional for directional preview runs.",
2046
2068
  },
2069
+ findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
2070
+ runVersion: { type: "number", description: "Current durable run version" },
2047
2071
  currentStep: {
2048
2072
  type: ["string", "null"],
2049
2073
  description: "Headless workflow step ID",
@@ -2081,7 +2105,7 @@ export const leadToolDefinitions = [
2081
2105
  },
2082
2106
  {
2083
2107
  name: "import_leads",
2084
- description: "Create/select a source lead list and start the provider import/export job. Requires provider prompt preflight via get_provider_prompt for the active provider. For Sales Nav/Prospeo, targetLeadCount is the approved source-list export count computed from projected good-fit math, not the later internal campaign-table execution-slice size. On success, this tool owns moving the watched campaign to confirm-lead-list with import/progress narration after a leadListId/jobId exists; do not call update_campaign to fix that step. After the user confirms the source list, call confirm_lead_list to copy the confirmed source rows into the campaign table and use the initial campaign-table execution slice for setup.",
2108
+ description: "Start an approval-gated provider import into exactly one target: campaignOfferId or findLeadsRunId. Campaignless imports materialize directly into the reserved run/list and never read campaign state.",
2085
2109
  inputSchema: {
2086
2110
  type: "object",
2087
2111
  properties: {
@@ -2089,6 +2113,8 @@ export const leadToolDefinitions = [
2089
2113
  type: "string",
2090
2114
  description: "Campaign offer ID",
2091
2115
  },
2116
+ findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
2117
+ runVersion: { type: "number", description: "Current durable run version" },
2092
2118
  workspaceId: {
2093
2119
  type: "string",
2094
2120
  description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
@@ -2110,6 +2136,10 @@ export const leadToolDefinitions = [
2110
2136
  type: "string",
2111
2137
  description: "Search ID for apollo or sales-nav import",
2112
2138
  },
2139
+ signalTabId: {
2140
+ type: "string",
2141
+ description: "Signal Discovery run tab whose selected posts should be materialized",
2142
+ },
2113
2143
  targetLeadCount: {
2114
2144
  type: "number",
2115
2145
  description: "Provider source-list target count (max per provider from config). For Sales Nav/Prospeo this should be the export/materialization count needed to hit projected good-fit goals, not the internal campaign-table execution-slice size.",
@@ -2154,7 +2184,11 @@ export const leadToolDefinitions = [
2154
2184
  description: "Set true after user approval when interaction mode requires confirmation for import.",
2155
2185
  },
2156
2186
  },
2157
- required: ["campaignOfferId"],
2187
+ oneOf: [
2188
+ { required: ["campaignOfferId"], not: { required: ["findLeadsRunId"] } },
2189
+ { required: ["findLeadsRunId", "runVersion", "provider"], not: { required: ["campaignOfferId"] } }
2190
+ ],
2191
+ additionalProperties: false,
2158
2192
  },
2159
2193
  },
2160
2194
  {
@@ -2194,6 +2228,9 @@ export const leadToolDefinitions = [
2194
2228
  type: "string",
2195
2229
  description: "Campaign offer ID",
2196
2230
  },
2231
+ findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
2232
+ signalTabId: { type: "string", description: "Signal Discovery tab ID" },
2233
+ runVersion: { type: "number", description: "Current durable run version" },
2197
2234
  workspaceId: {
2198
2235
  type: "string",
2199
2236
  description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
@@ -2590,6 +2627,9 @@ export async function searchApollo(input) {
2590
2627
  });
2591
2628
  }
2592
2629
  export async function searchSalesNav(input) {
2630
+ if (input.campaignOfferId && input.findLeadsRunId) {
2631
+ throw new Error("search_sales_nav requires exactly one owner target");
2632
+ }
2593
2633
  if (input?.campaignOfferId) {
2594
2634
  assertInteractionApproval({
2595
2635
  campaignId: input.campaignOfferId,
@@ -2600,6 +2640,7 @@ export async function searchSalesNav(input) {
2600
2640
  assertProviderPromptLoaded({
2601
2641
  provider: "sales-nav",
2602
2642
  campaignOfferId: input?.campaignOfferId,
2643
+ findLeadsRunId: input?.findLeadsRunId,
2603
2644
  });
2604
2645
  const api = getApi();
2605
2646
  return api.post(`/api/v3/sales-nav/search`, normalizeSalesNavSearchInput(input));
@@ -3134,6 +3175,9 @@ function compactProspeoCompanyAccountConfirmationResponse(response) {
3134
3175
  };
3135
3176
  }
3136
3177
  export async function searchProspeo(input) {
3178
+ if (input.campaignOfferId && input.findLeadsRunId) {
3179
+ throw new Error("search_prospeo requires exactly one owner target");
3180
+ }
3137
3181
  if (input?.campaignOfferId) {
3138
3182
  assertInteractionApproval({
3139
3183
  campaignId: input.campaignOfferId,
@@ -3144,6 +3188,7 @@ export async function searchProspeo(input) {
3144
3188
  assertProviderPromptLoaded({
3145
3189
  provider: "prospeo",
3146
3190
  campaignOfferId: input?.campaignOfferId,
3191
+ findLeadsRunId: input?.findLeadsRunId,
3147
3192
  });
3148
3193
  const api = getApi();
3149
3194
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
@@ -3655,6 +3700,9 @@ export async function lookupSalesNavFilter(input) {
3655
3700
  };
3656
3701
  }
3657
3702
  export async function searchSignals(input) {
3703
+ if (input.campaignOfferId && input.findLeadsRunId) {
3704
+ throw new Error("search_signals requires exactly one owner target");
3705
+ }
3658
3706
  if (input?.campaignOfferId) {
3659
3707
  assertInteractionApproval({
3660
3708
  campaignId: input.campaignOfferId,
@@ -3665,6 +3713,7 @@ export async function searchSignals(input) {
3665
3713
  assertProviderPromptLoaded({
3666
3714
  provider: "signal-discovery",
3667
3715
  campaignOfferId: input?.campaignOfferId,
3716
+ findLeadsRunId: input?.findLeadsRunId,
3668
3717
  });
3669
3718
  const api = getApi();
3670
3719
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
@@ -3727,7 +3776,82 @@ export async function importLeads(input) {
3727
3776
  const apiPut = (path, body) => requestOptions
3728
3777
  ? api.put(path, body, requestOptions)
3729
3778
  : api.put(path, body);
3730
- const { campaignOfferId, currentStep, sourceLeadListId: inputSourceLeadListId, searchId, targetLeadCount, mode, searchName, leadListName, headlineICPCriteria, targetEngagerCount, maxPostsToScrape, allowInvalidSignalPosts, rubricGuidelines, confirmed, } = input;
3779
+ const hasCampaignTarget = Boolean(input.campaignOfferId);
3780
+ const hasRunTarget = Boolean(input.findLeadsRunId);
3781
+ if (hasCampaignTarget === hasRunTarget) {
3782
+ throw new Error("import_leads requires exactly one target: campaignOfferId or findLeadsRunId");
3783
+ }
3784
+ if (input.findLeadsRunId) {
3785
+ const runId = input.findLeadsRunId;
3786
+ const provider = input.provider;
3787
+ if (provider !== "sales-nav" &&
3788
+ provider !== "prospeo" &&
3789
+ provider !== "signal-discovery") {
3790
+ throw new Error("Campaignless import_leads requires provider sales-nav, prospeo, or signal-discovery");
3791
+ }
3792
+ if (!Number.isInteger(input.runVersion) || (input.runVersion ?? -1) < 0) {
3793
+ throw new Error("Campaignless import_leads requires the current non-negative runVersion from get_find_leads_run");
3794
+ }
3795
+ if (input.sourceLeadListId && input.sourceLeadListId !== runId) {
3796
+ throw new Error("Campaignless sourceLeadListId must equal findLeadsRunId");
3797
+ }
3798
+ assertProviderPromptLoaded({ provider, findLeadsRunId: runId });
3799
+ const targetLeadCount = Math.min(normalizeTargetLeadCount(input.targetLeadCount, getMaxImportCount(provider)) ??
3800
+ defaultProviderSourceListTarget, getMaxImportCount(provider));
3801
+ let response;
3802
+ if (provider === "sales-nav") {
3803
+ if (!input.searchId) {
3804
+ throw new Error("Campaignless Sales Nav import requires searchId");
3805
+ }
3806
+ response = await apiPost("/api/v3/sales-nav/export", {
3807
+ searchId: input.searchId,
3808
+ workflowTableId: runId,
3809
+ targetLeadCount,
3810
+ findLeadsRunId: runId,
3811
+ runVersion: input.runVersion,
3812
+ });
3813
+ }
3814
+ else if (provider === "prospeo") {
3815
+ if (!input.searchId) {
3816
+ throw new Error("Campaignless Prospeo import requires searchId");
3817
+ }
3818
+ response = await apiPost(`/api/v3/lead-lists/${encodeURIComponent(runId)}/prospeo-import/start`, {
3819
+ searchId: input.searchId,
3820
+ targetLeadCount,
3821
+ mode: input.mode ?? "add",
3822
+ findLeadsRunId: runId,
3823
+ runVersion: input.runVersion,
3824
+ });
3825
+ }
3826
+ else {
3827
+ const tabId = input.signalTabId ?? input.searchId;
3828
+ if (!tabId) {
3829
+ throw new Error("Campaignless Signal Discovery import requires signalTabId");
3830
+ }
3831
+ response = await apiPost(`/api/v3/find-leads/runs/${encodeURIComponent(runId)}/signal-leads/create`, {
3832
+ tabId,
3833
+ runVersion: input.runVersion,
3834
+ targetEngagerCount: input.targetEngagerCount,
3835
+ headlineICPCriteria: input.headlineICPCriteria ?? input.rubricGuidelines ?? [],
3836
+ });
3837
+ }
3838
+ return {
3839
+ runId,
3840
+ leadListId: runId,
3841
+ provider,
3842
+ searchId: input.searchId ?? input.signalTabId ?? null,
3843
+ jobId: response.jobId ?? response.id ?? null,
3844
+ status: response.status ?? (response.success === false ? "failed" : "queued"),
3845
+ counts: {
3846
+ requested: targetLeadCount,
3847
+ rows: response.rowCount ?? response.leadsImported ?? response.importedCount ?? 0,
3848
+ },
3849
+ retryable: response.retryable ?? response.success !== false,
3850
+ replay: response.replay === true,
3851
+ };
3852
+ }
3853
+ const { campaignOfferId: campaignTarget, currentStep, sourceLeadListId: inputSourceLeadListId, searchId, targetLeadCount, mode, searchName, leadListName, headlineICPCriteria, targetEngagerCount, maxPostsToScrape, allowInvalidSignalPosts, rubricGuidelines, confirmed, } = input;
3854
+ const campaignOfferId = campaignTarget;
3731
3855
  assertInteractionApproval({
3732
3856
  campaignId: campaignOfferId,
3733
3857
  action: "import-leads",
@@ -4629,7 +4753,10 @@ export async function confirmLeadList(input) {
4629
4753
  };
4630
4754
  }
4631
4755
  export function getProviderPrompt(input) {
4632
- const { provider, campaignOfferId, confirmed } = input;
4756
+ const { provider, campaignOfferId, findLeadsRunId, confirmed } = input;
4757
+ if (campaignOfferId && findLeadsRunId) {
4758
+ throw new Error("get_provider_prompt requires exactly one owner target");
4759
+ }
4633
4760
  if (campaignOfferId) {
4634
4761
  assertInteractionApproval({
4635
4762
  campaignId: campaignOfferId,
@@ -4653,6 +4780,7 @@ export function getProviderPrompt(input) {
4653
4780
  markProviderPromptLoaded({
4654
4781
  provider,
4655
4782
  campaignOfferId,
4783
+ findLeadsRunId,
4656
4784
  });
4657
4785
  return prompt;
4658
4786
  }
@@ -4671,7 +4799,10 @@ export async function selectPromisingPosts(input) {
4671
4799
  const apiPut = (path, body) => requestOptions
4672
4800
  ? api.put(path, body, requestOptions)
4673
4801
  : api.put(path, body);
4674
- const { campaignOfferId, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
4802
+ const { campaignOfferId, findLeadsRunId, signalTabId, runVersion, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
4803
+ if (Boolean(campaignOfferId) === Boolean(findLeadsRunId)) {
4804
+ throw new Error("select_promising_posts requires exactly one target: campaignOfferId or findLeadsRunId");
4805
+ }
4675
4806
  const effectiveMode = selectionMode ?? mode ?? "replace";
4676
4807
  const effectiveScrapePlanMode = scrapePlanMode ??
4677
4808
  (targetEngagerCount || maxPostsToScrape
@@ -4686,18 +4817,48 @@ export async function selectPromisingPosts(input) {
4686
4817
  message: `Maximum ${MAX_SIGNAL_DISCOVERY_POSTS} Signal Discovery posts can be selected for scraping. Narrow the post set to the strongest ${MAX_SIGNAL_DISCOVERY_POSTS} before calling select_promising_posts again.`,
4687
4818
  };
4688
4819
  }
4820
+ if (findLeadsRunId) {
4821
+ if (!signalTabId || !Number.isInteger(runVersion)) {
4822
+ throw new Error("Campaignless select_promising_posts requires signalTabId and current runVersion");
4823
+ }
4824
+ const existing = await apiGet(`/api/v3/find-leads/runs/${encodeURIComponent(findLeadsRunId)}/signal-discovery/tabs/${encodeURIComponent(signalTabId)}`);
4825
+ const postIds = selections.map((selection) => selection.postId);
4826
+ const selectedSet = new Set(postIds);
4827
+ const unselectedIds = effectiveMode === "replace"
4828
+ ? (existing.tab?.posts ?? [])
4829
+ .filter((post) => post.isSelected && post.id && !selectedSet.has(post.id))
4830
+ .map((post) => post.id)
4831
+ : [];
4832
+ const result = await apiPatch(`/api/v3/find-leads/runs/${encodeURIComponent(findLeadsRunId)}/signal-discovery/tabs/${encodeURIComponent(signalTabId)}`, {
4833
+ version: runVersion,
4834
+ selectedIds: postIds,
4835
+ unselectedIds,
4836
+ });
4837
+ return {
4838
+ success: result.success,
4839
+ runId: findLeadsRunId,
4840
+ leadListId: findLeadsRunId,
4841
+ signalTabId,
4842
+ selectedCount: result.selectedCount,
4843
+ unselectedCount: unselectedIds.length,
4844
+ criteriaCount: headlineICPCriteria.length,
4845
+ selectionMode: effectiveMode,
4846
+ nextStep: "Present the distinct import plan, persist approve_import, refresh the run version, then call import_leads with this signalTabId.",
4847
+ };
4848
+ }
4849
+ const campaignId = campaignOfferId;
4689
4850
  // Update post selections via API
4690
4851
  const postIds = selections.map((s) => s.postId);
4691
4852
  let unselectedIds = [];
4692
4853
  if (effectiveMode === "replace") {
4693
- const existing = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`);
4854
+ const existing = await apiGet(`/api/v3/campaigns/${campaignId}/signal-discovery/posts?selected=true`);
4694
4855
  const existingIds = existing?.posts
4695
4856
  ?.map((post) => post.id)
4696
4857
  .filter((id) => Boolean(id)) ?? [];
4697
4858
  const selectedSet = new Set(postIds);
4698
4859
  unselectedIds = existingIds.filter((id) => !selectedSet.has(id));
4699
4860
  }
4700
- const selectionResult = await apiPatch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
4861
+ const selectionResult = await apiPatch(`/api/v3/campaigns/${campaignId}/signal-discovery/posts`, {
4701
4862
  selectedIds: postIds,
4702
4863
  unselectedIds,
4703
4864
  headlineICPCriteria,
@@ -4716,7 +4877,7 @@ export async function selectPromisingPosts(input) {
4716
4877
  let recommendedPostCount = selectionResult.selectedCount;
4717
4878
  let recommendationTargetEngagerCount = null;
4718
4879
  try {
4719
- const tabsResponse = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
4880
+ const tabsResponse = await apiGet(`/api/v3/campaigns/${campaignId}/signal-discovery/tabs`);
4720
4881
  const reasonsByPostId = new Map(selections.map((selection) => [selection.postId, selection.reason]));
4721
4882
  const selectedByUrl = new Map();
4722
4883
  for (const tab of tabsResponse.tabs ?? []) {
@@ -4773,7 +4934,7 @@ Approval card should say:
4773
4934
  }
4774
4935
  const selectionCurrentStep = currentStep === null ? undefined : (currentStep ?? "signal-discovery");
4775
4936
  if (selectionCurrentStep) {
4776
- await apiPut(`/api/v2/campaign-offers/${campaignOfferId}`, {
4937
+ await apiPut(`/api/v2/campaign-offers/${campaignId}`, {
4777
4938
  currentStep: selectionCurrentStep,
4778
4939
  watchNarration: buildSelectedPostApprovalWatchNarration(selectionResult.selectedCount, recommendedPostCount, recommendationTargetEngagerCount),
4779
4940
  });
@@ -21,30 +21,28 @@ const DEFAULT_MODEL_QUALITY_CONFIG = {
21
21
  minimumModel: "GPT 5.5",
22
22
  familyKeywords: ["gpt"],
23
23
  minimumVersion: "5.5",
24
- minimumReasoningEffort: "high",
24
+ minimumReasoningEffort: "xhigh",
25
25
  acceptedReasoningEfforts: [
26
- "high",
27
26
  "extra high",
28
27
  "extra-high",
29
28
  "xhigh",
30
29
  "extra_high",
31
30
  ],
32
- recommendedReasoningEffort: "high or better",
31
+ recommendedReasoningEffort: "xhigh",
33
32
  },
34
33
  hermes: {
35
34
  label: "Hermes",
36
35
  minimumModel: "GPT 5.5",
37
36
  familyKeywords: ["gpt"],
38
37
  minimumVersion: "5.5",
39
- minimumReasoningEffort: "high",
38
+ minimumReasoningEffort: "xhigh",
40
39
  acceptedReasoningEfforts: [
41
- "high",
42
40
  "extra high",
43
41
  "extra-high",
44
42
  "xhigh",
45
43
  "extra_high",
46
44
  ],
47
- recommendedReasoningEffort: "high or better",
45
+ recommendedReasoningEffort: "xhigh",
48
46
  },
49
47
  },
50
48
  warningCopy: {
@@ -140,7 +140,7 @@ export interface PostFindLeadsScoutRegistryResponse {
140
140
  export declare const DEFAULT_SUBSKILL_PROMPT_CHUNK_CHARS = 48000;
141
141
  export declare const MAX_SUBSKILL_PROMPT_CHUNK_CHARS = 48000;
142
142
  export declare const DEPRECATED_SUBSKILL_PROMPT_REPLACEMENTS: Record<string, string>;
143
- export declare const ALLOWED_SUBSKILL_PROMPT_NAMES: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
143
+ export declare const ALLOWED_SUBSKILL_PROMPT_NAMES: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
144
144
  export declare const promptToolDefinitions: ({
145
145
  name: string;
146
146
  description: string;
@@ -184,7 +184,7 @@ export declare const promptToolDefinitions: ({
184
184
  properties: {
185
185
  subskillName: {
186
186
  type: string;
187
- enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
187
+ enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
188
188
  description: string;
189
189
  };
190
190
  offset: {
@@ -219,7 +219,7 @@ export declare const promptToolDefinitions: ({
219
219
  properties: {
220
220
  subskillName: {
221
221
  type: string;
222
- enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
222
+ enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
223
223
  description: string;
224
224
  };
225
225
  assetPath: {
@@ -2,7 +2,6 @@ import * as fs from "fs";
2
2
  import * as path from "path";
3
3
  import { getSkillByName, listSkills, resolveSkillsDir, stripFrontmatter, } from "../skills.js";
4
4
  import { markCreateCampaignPromptLoaded, markResearchPromptLoaded, markSenderResearchCompleted, } from "./flow-preflight.js";
5
- import { validateRefillContractAsset, validateRefillFlowProjection, } from "../refill-contract.js";
6
5
  // Chunk size sits below Claude Code's max-token cap on tool results
7
6
  // (empirically around ~50k chars — fetch_linkedin_profile breached at
8
7
  // 53,295 chars, which forced a python3 chunked-read fallback). 48k gives
@@ -35,6 +34,7 @@ export const ALLOWED_SUBSKILL_PROMPT_NAMES = [
35
34
  "enrich-prospects",
36
35
  "fill-send-horizon",
37
36
  "find-leads",
37
+ "find-leads-v2",
38
38
  "foundation",
39
39
  "generate-messages",
40
40
  "interview",
@@ -262,8 +262,8 @@ export function getSourceScoutRegistry() {
262
262
  codex: {
263
263
  filename: String(agent.codex?.filename || `${agent.name}.toml`),
264
264
  description: String(agent.codex?.description || ""),
265
- model: String(agent.codex?.model || "gpt-5.6-sol"),
266
- modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "high"),
265
+ model: String(agent.codex?.model || "gpt-5.5"),
266
+ modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "xhigh"),
267
267
  },
268
268
  claude: {
269
269
  filename: String(agent.claude?.filename || `${agent.name}.md`),
@@ -309,8 +309,8 @@ export function getPostFindLeadsScoutRegistry() {
309
309
  codex: {
310
310
  filename: String(agent.codex?.filename || `${agent.name}.toml`),
311
311
  description: String(agent.codex?.description || ""),
312
- model: String(agent.codex?.model || "gpt-5.6-sol"),
313
- modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "high"),
312
+ model: String(agent.codex?.model || "gpt-5.5"),
313
+ modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "xhigh"),
314
314
  },
315
315
  claude: {
316
316
  filename: String(agent.claude?.filename || `${agent.name}.md`),
@@ -377,9 +377,9 @@ export function getPostFindLeadsScoutRegistry() {
377
377
  reusePolicy: "The first completed Message Drafting recommendation remains the default review candidate. Later Lead Fit Builder, Filter Leads, enrichment, or rubric completion may make an enriched rewrite available, but does not automatically retry or replace the initial draft unless campaign/brief/source/list/table/execution-slice identity mismatches or the initial output failed. If filters were chosen but leadScoringRubrics are not yet visible when the branch reads campaign state, Message Drafting must not wait, retry, or return blocked; missing saved rubrics are parent-owned filter setup, and the branch should return status ready with basisStatus usable_initial when campaign/list/table identity and the non-empty execution slice match. User copy feedback before approve-message is an explicit Message Drafting revision and must be routed back through the message branch with the current recommendation and basis.",
378
378
  },
379
379
  usage: {
380
- codex: 'After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not spawn anything before that question. After the answer, launch only Message Drafting. The filter-choice answer is the post-import user gate for this single worker; do not ask another question about starting it in step-wise or YOLO mode. The registry lookup is not a launch: after get_post_find_leads_scout_registry, immediately invoke Task/spawn_agent or the host background-agent mechanism before loading filter-leads.md, before saving rubrics, and before treating skip-filters as ready for message review. Both choices route through this kickoff; do not let filters_skipped jump straight from filter-choice to message-generation. If filters are chosen, the parent stays on Filter Rules and drafts/saves rubrics with MCP tools while Message Drafting runs in the background. If filters are skipped, move to Messages/message review only after Message Drafting has started or is ready; update_campaign(currentStep=messages) is not proof of launch. If the named Message Drafting custom agent is unavailable, spawn a generic gpt-5.6-sol high Message Drafting background agent with the same lean campaign/table basis. When the background worker starts, persist workerDetails.messageDraftBuilder with statusSource "branch", status "branch-running", runId, startedAt, updatedAt, basisToken when known, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds; workerStatuses.messageDraftBuilder may be "running" as a simple badge only. Never put rich proof under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start the same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource "parent-thread-fallback" and status "fallback-active", and require the same live context, prompt, assets, and validation gate before message review; do not wait until filters are saved and then call the registry.',
380
+ codex: 'After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not spawn anything before that question. After the answer, launch only Message Drafting. The filter-choice answer is the post-import user gate for this single worker; do not ask another question about starting it in step-wise or YOLO mode. The registry lookup is not a launch: after get_post_find_leads_scout_registry, immediately invoke Task/spawn_agent or the host background-agent mechanism before loading filter-leads.md, before saving rubrics, and before treating skip-filters as ready for message review. Both choices route through this kickoff; do not let filters_skipped jump straight from filter-choice to message-generation. If filters are chosen, the parent stays on Filter Rules and drafts/saves rubrics with MCP tools while Message Drafting runs in the background. If filters are skipped, move to Messages/message review only after Message Drafting has started or is ready; update_campaign(currentStep=messages) is not proof of launch. If the named Message Drafting custom agent is unavailable, spawn a generic gpt-5.5 xhigh Message Drafting background agent with the same lean campaign/table basis. When the background worker starts, persist workerDetails.messageDraftBuilder with statusSource "branch", status "branch-running", runId, startedAt, updatedAt, basisToken when known, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds; workerStatuses.messageDraftBuilder may be "running" as a simple badge only. Never put rich proof under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start the same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource "parent-thread-fallback" and status "fallback-active", and require the same live context, prompt, assets, and validation gate before message review; do not wait until filters are saved and then call the registry.',
381
381
  claude: "After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not invoke any Task/Agent before that question. After the answer, invoke only Message Drafting. If filters are chosen, parent drafts/saves rubrics with MCP tools while Message Drafting runs, asks filter approval, then joins Message Drafting. If filters are skipped, invoke only Message Drafting and move to Messages/message review.",
382
- parentThreadRule: 'Named agents are optional acceleration, but message drafting is not optional. The only normal background worker is Message Drafting. The filter-choice answer is the campaign-scoped go-ahead for this single post-import worker; do not ask another question to start it in step-wise or YOLO mode. If a named agent is unavailable, use a generic gpt-5.6-sol high Message Drafting background agent. source work and filter work stay in the parent thread with MCP tools. If post-find-leads-message-scout is available, run it as the background Message Draft Builder after the filter-choice answer. The registry lookup is not a launch: get_post_find_leads_scout_registry only identifies the worker, and Message Drafting counts as started only after Task/spawn_agent or the host background-agent tool is invoked, or after the parent begins the same full message branch inline because no background-agent tool is callable. This launch must happen before loading filter-leads.md, save_rubrics, filter approval, or skip-filter message review; currentStep=messages is not proof of launch. If post-find-leads-message-scout is absent, do not customer-surface install status. Do not silently treat message drafting as started; the main thread must either launch the background worker or execute the same message branch from CampaignOffer state, selected source state, workflowTableId, and initial campaign-table execution slice rows. For a spawned worker, record workerDetails.messageDraftBuilder with statusSource branch / status branch-running, runId, startedAt, updatedAt, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds. workerStatuses.messageDraftBuilder is optional simple badge text only ("running", "ready", "blocked", "idle"); never put runId/statusSource/basis under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start that same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource parent-thread-fallback / status fallback-active then ready, and require the same live context, prompt, assets, and validation gate before message review; do not report that as a background worker failure. If neither branch nor inline fallback can run, return blocked/retry-needed; do not wait until filters are saved and then call the registry. The Message Drafting handoff must be lean. Do not paste copied row counts, brief hashes, review-batch hashes, full reviewBatchRowIds, broad row data, or local debug artifacts into the spawn prompt. Local markdown/json files are not normal-path inputs. The filter-choice question is the first post-import user gate; do not load post-lead registries or filter references before it. Message drafting starts after the filter-choice answer, must load get_subskill_prompt({ subskillName: "generate-messages" }), and must load every required message asset named by generate-messages Mode 0 through get_subskill_asset before drafting. Reference Asset Loading means loading the required pre-draft reference pack before drafting; return blocked/retry-needed if required assets cannot be loaded; load ai-tells.md because it is never optional. The branch or parent-thread fallback loads the full generate-messages prompt and every referenced asset through get_subskill_asset. After generating/revising the candidate and before returning ready, must load get_subskill_prompt({ subskillName: "create-campaign-v2-validation" }) as the final internal validation gate, must read live campaign table state through scoped MCP/product tools, and must reject mismatched selectedLeadListId/workflowTableId/campaign/workspace input. Do not block when filters were chosen but leadScoringRubrics are not yet visible in the branch read; the parent owns save_rubrics and filter approval in parallel, so Message Drafting should return status ready with basisStatus usable_initial when campaign/list/table identity and the non-empty execution slice match. Do not use any alternate, local-artifact, or examples-only message prompt. User copy feedback, message QA, or rewrite requests before approve-message must be routed back to Message Drafting with the current recommendation, lean campaign/table basis, and latest user text; the parent must not rewrite or QA the template from memory and must not call update_campaign_brief before approve-message. The worker validates internally and returns only templateRecommendation, tokenFillRules, renderedGoodSample, status, approveOrReviseRecommendation, validationStatus, outputAt, outputHash, and blocked/retry detail. Do not render renderedFallbackSample, risk notes, or a qaReceipt on the normal happy path. On the filter path, save_rubrics keeps the browser on Filter Rules after save_rubrics so the user can approve the saved criteria; after saved-filter approval, move to Filter Leads with currentStep=apply-icp-rubric whether Message Drafting is ready or still running. Wait there for message approval. Enrichment, filtering, Generate Message cells, sender setup, sequence attach, and launch wait for template approval on the Use Template path. On the skip path, move to Messages/message review after Message Drafting has started or is ready and wait for message approval before enrichment or Settings. Do not render message review from checklist or shortcut instructions; message review requires a messageDraftRecommendation whose basis proves the generate-messages prompt, required message assets, and validation gate ran for the current campaign/table execution slice. Do not automatically rerun Message Drafting after filters/enrichment finish; show the initial draft by default and offer an enriched rewrite only with explicit user opt-in. Handoff and recommendation output are Markdown with labeled fields, not raw JSON.',
382
+ parentThreadRule: 'Named agents are optional acceleration, but message drafting is not optional. The only normal background worker is Message Drafting. The filter-choice answer is the campaign-scoped go-ahead for this single post-import worker; do not ask another question to start it in step-wise or YOLO mode. If a named agent is unavailable, use a generic gpt-5.5 xhigh Message Drafting background agent. source work and filter work stay in the parent thread with MCP tools. If post-find-leads-message-scout is available, run it as the background Message Draft Builder after the filter-choice answer. The registry lookup is not a launch: get_post_find_leads_scout_registry only identifies the worker, and Message Drafting counts as started only after Task/spawn_agent or the host background-agent tool is invoked, or after the parent begins the same full message branch inline because no background-agent tool is callable. This launch must happen before loading filter-leads.md, save_rubrics, filter approval, or skip-filter message review; currentStep=messages is not proof of launch. If post-find-leads-message-scout is absent, do not customer-surface install status. Do not silently treat message drafting as started; the main thread must either launch the background worker or execute the same message branch from CampaignOffer state, selected source state, workflowTableId, and initial campaign-table execution slice rows. For a spawned worker, record workerDetails.messageDraftBuilder with statusSource branch / status branch-running, runId, startedAt, updatedAt, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds. workerStatuses.messageDraftBuilder is optional simple badge text only ("running", "ready", "blocked", "idle"); never put runId/statusSource/basis under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start that same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource parent-thread-fallback / status fallback-active then ready, and require the same live context, prompt, assets, and validation gate before message review; do not report that as a background worker failure. If neither branch nor inline fallback can run, return blocked/retry-needed; do not wait until filters are saved and then call the registry. The Message Drafting handoff must be lean. Do not paste copied row counts, brief hashes, review-batch hashes, full reviewBatchRowIds, broad row data, or local debug artifacts into the spawn prompt. Local markdown/json files are not normal-path inputs. The filter-choice question is the first post-import user gate; do not load post-lead registries or filter references before it. Message drafting starts after the filter-choice answer, must load get_subskill_prompt({ subskillName: "generate-messages" }), and must load every required message asset named by generate-messages Mode 0 through get_subskill_asset before drafting. Reference Asset Loading means loading the required pre-draft reference pack before drafting; return blocked/retry-needed if required assets cannot be loaded; load ai-tells.md because it is never optional. The branch or parent-thread fallback loads the full generate-messages prompt and every referenced asset through get_subskill_asset. After generating/revising the candidate and before returning ready, must load get_subskill_prompt({ subskillName: "create-campaign-v2-validation" }) as the final internal validation gate, must read live campaign table state through scoped MCP/product tools, and must reject mismatched selectedLeadListId/workflowTableId/campaign/workspace input. Do not block when filters were chosen but leadScoringRubrics are not yet visible in the branch read; the parent owns save_rubrics and filter approval in parallel, so Message Drafting should return status ready with basisStatus usable_initial when campaign/list/table identity and the non-empty execution slice match. Do not use any alternate, local-artifact, or examples-only message prompt. User copy feedback, message QA, or rewrite requests before approve-message must be routed back to Message Drafting with the current recommendation, lean campaign/table basis, and latest user text; the parent must not rewrite or QA the template from memory and must not call update_campaign_brief before approve-message. The worker validates internally and returns only templateRecommendation, tokenFillRules, renderedGoodSample, status, approveOrReviseRecommendation, validationStatus, outputAt, outputHash, and blocked/retry detail. Do not render renderedFallbackSample, risk notes, or a qaReceipt on the normal happy path. On the filter path, save_rubrics keeps the browser on Filter Rules after save_rubrics so the user can approve the saved criteria; after saved-filter approval, move to Filter Leads with currentStep=apply-icp-rubric whether Message Drafting is ready or still running. Wait there for message approval. Enrichment, filtering, Generate Message cells, sender setup, sequence attach, and launch wait for template approval on the Use Template path. On the skip path, move to Messages/message review after Message Drafting has started or is ready and wait for message approval before enrichment or Settings. Do not render message review from checklist or shortcut instructions; message review requires a messageDraftRecommendation whose basis proves the generate-messages prompt, required message assets, and validation gate ran for the current campaign/table execution slice. Do not automatically rerun Message Drafting after filters/enrichment finish; show the initial draft by default and offer an enriched rewrite only with explicit user opt-in. Handoff and recommendation output are Markdown with labeled fields, not raw JSON.',
383
383
  schedulerRunReceiptRule: "For refill prompt handoffs, scheduler-run receipt interpretation is mandatory: cellsConsidered is allocation-attempt count, not total ready supply, while readyCellsFound is ready inventory found before prefilters. Inspect campaignScopeSummary before assuming the selected refill campaign/table was included. Interpret prefiltered, skipped, and deferred separately. For ready closed-InMail cells with stale paid-credit prefilter/defer reasons, route to refresh_paid_inmail_credits_then_rerun once, then rerun/status. wait_for_capacity_or_window means report loaded/capped/waiting and do not source or prep more rows. no_ready_cells_continue_refill_prep means return to the refill/prep ladder. Do not treat cellsScheduled:0 alone as failure.",
384
384
  prepareMessagesRule: `Default create-campaign stays on the existing reviewBatchLimit:15 first campaign-table execution slice. For plain post-mint fill/load/refill requests, load get_subskill_prompt({ subskillName: "refill-sends-workflow" }) and get_subskill_asset({ subskillName: "refill-sends-workflow", assetPath: "core/flow.v1.json" }) to hasMore:false before operational steps, then call resolve_campaign_fill_route({ intent:"plain" }), list_senders, and get_campaign_refill_state for enough candidate campaigns to identify the campaign that most recently had scheduler-owned sends for the relevant sender set before any mutation. Route outcomes are route:"evergreen_horizon", route:"active_campaigns", and route:"ask_create"; if a plain managed-waterfall route has archived/completed skipped slots or does not cover the named sender set, immediately refetch with resolve_campaign_fill_route({ intent:"active" }) and inspect current dashboard-active ACTIVE/PAUSED campaign-backed sequence campaigns before declaring a sender blocked; stay in the same campaignOfferId/campaignId context after minting. Plain fill is not an alias for fill_campaign_horizon or campaign creation. fill_campaign_horizon is evergreen-only and is not the generic regular-campaign fill path. Campaign creation is allowed only after route:"ask_create" and explicit user selection; it is never the default response to plain fill. Treat "fill up/load sends" as capacity-fill preparation, and treat "refill senders", "fill senders", "max out senders", and "load everyone up" as sender-scoped capacity-fill preparation. For sender-scoped requests with no named senders, --yolo means all eligible healthy senders enrolled in active campaign-backed sequence campaigns in the active workspace; without --yolo, ask which eligible enrolled senders to refill before choosing campaigns or mutating. In non-yolo interactive Codex or Claude Code sessions, post the full sender/campaign/action approval packet in normal chat as Markdown first, then ask request_user_input/AskUserQuestion with exactly Accept and Decline and a compact body that refers back to the posted packet; do not duplicate the campaign table or full operator packet inside the structured question. The chat packet must show workspace, sender scope, a campaign-by-campaign table, exact ids/caps/dates, side effects, forbidden actions, and stop condition before mutation. Default --yolo target is the scheduler-forward 48-hour target window: sender-local send days whose configured sending windows overlap the rolling target window, skipping no-send-hour days. For campaign-scoped fill/refill, select the best recent-send campaign and calculate the bounded gap from healthy sender daily capacity minus projected coverage (actual sent plus future scheduler-owned scheduled sends) and ready-to-schedule rows, then prepare only that gap. For sender-scoped fill/refill, calculate the bounded gap per eligible sender across active enrolled campaigns, counting actual sent coverage, future scheduled rows, and ready-to-schedule rows across those campaigns, then choose the best same-sender campaign to fill each sender gap: prefer recent/future scheduler-owned sends for that sender, then strongest recent result evidence, then source health. Maintain a target-window saturation ledger per selected sender with selected send days, gross capacity, actual sent counts, future scheduler-owned scheduled counts, projected coverage, ready-to-schedule buffer, remaining projected gap, paid-InMail threshold feasibility, and the next MCP primitive. The structured packet lives in target.senderRefillPlans[] with target.eligibleSenderLedger, campaignRanking.options, sourcePlan, nextActions, manualAlternates, and target.globalActionQueue; preserve Need to prepare, Goal, Already sent, Scheduled, Ready and waiting to be scheduled, and Still need labels. In --yolo, execute exactly one globally ranked primitive from the post-refresh target.globalActionQueue[0], then rerun get_refill_target_plan before choosing another action. Refill action ladder: approve generated rows only when an explicit bounded approval gate exists, process all existing same-campaign unenriched/unprepared rows in bounded batches before any source work, then copy bounded net-new rows from the selected source (selectedLeadListId, provider, and source fingerprint preserved), then use provider-aligned source-more. A new source or provider switch changes the reply-rate baseline and is a manual alternate, not a --yolo side effect. The refill_sends MCP command maintains a run-local refreshedPaidInmailSenderIds set: if the first target plan contains refresh_paid_inmail_credits for stale/missing paid-InMail facts, refill_sends refreshes each selected paid-InMail sender at most once, reruns get_refill_target_plan, and returns autoPaidInmailRefresh plus the post-refresh targetPlan before the operator chooses prep/source-copy/bounded-approval/read-only wait. Freshness gate precedes scheduler wait: if any selected target.senderRefillPlans[].paidInmail.status is missing_credit_facts or stale_credit_facts, or the target plan contains refresh_paid_inmail_credits, do not enter wait_for_scheduler even when remainingReadyOrProjectedGap is 0; refresh exact sender credit facts once, reread get_refill_target_plan, then choose scheduler wait only if freshness is clean. Do not present paid-credit refresh as the next operator action after refill_sends has returned a post-refresh targetPlan. Do not stop after filling only one sender when the request was sender-scoped. In --yolo, continue through every safe selected sender/campaign action covered by the rendered packet, reread after each terminal apply/prep/source-copy/bounded-approval/read-only wait result, recompute the target-window saturation ledger, and keep going until projected coverage (sent + scheduled) fills the scheduler-forward target window or a concrete non-scheduler blocker is proven. Ready-to-schedule rows are buffer, not completion; if ready covers the projected gap but scheduled cells do not, report loaded, awaiting scheduler and run a persistent read-only scheduler wait/reread loop and keep the run open while awaiting_scheduler_after_ready_buffer is the only remaining state. Paid-InMail threshold changes and connection-campaign creation are explicit continuation options, never --yolo side effects. When no safe in-packet action remains return concrete continuation options with campaign names, exact ids, and which options require a new approval packet; do not return final completion for scheduler wait unless Christian explicitly asks for status or stops the run. Use the refill workflow to decide whether to enrich/prep more rows in that same recent-send/best-result campaign, add/import more rows to that same campaign/source path, use a different existing campaign only when the selected same-sender lane is blocked/exhausted/already loaded while the sender still has a gap, or ask what to create. Do not create warm-post-engager side campaigns. Surface sender-health blockers and paid-InMail threshold blockers separately from prepared/approved/scheduled counts. User-facing refill decisions must be campaign-name-first and sender-name-first, with ids as proof/execution targets only. Trust schedulerGate.sendable and scheduler blockers over raw unipileAccountStatus labels alone. For long-running prep use compact prep status checks, reread target plans after prep or cancel, avoid huge parallel target-plan reads when output is large, and if prepared/ready rows grow but sender-level projected coverage does not move after one bounded settle loop, pivot to compact prep status or a scheduler-proven lane instead of waiting on campaign-level ready counts. For already-running regular campaigns that need Signal Discovery source replenishment, use the guarded currentStep clear with clearCurrentStepIfMatches:"running", campaign-scoped provider prompt/search/select, and import_leads with the existing sourceLeadListId when a newly approved selected-post scrape would otherwise return reusedExistingSourceList. Before prep, inspect get_campaign_refill_state.preparationFrontier. If hasLaterPreparedIsland:true or earliestUnpreparedRow exists before later successful enrichment, use rowSelector:{type:"needsEnrichment"} with columnRole:"enrich" in table-position order or start_campaign_message_preparation adaptive defaults; do not use the UI Jump anchor or needsGeneratedMessage as the refill cursor. After confirm_lead_list copies rows into an existing table, avoid fixed maxRowsToCheck:100; if confirm_lead_list returns USER_ADDED_ROWS_LIMIT_EXCEEDED, create a bounded same-source split from selectedLeadListId with get_rows_minimal/load_csv_linkedin_leads, confirm that smaller source list into the same campaign, and inspect reviewBatch only as diagnostics unless the approved packet explicitly prioritizes the just-copied split and earlier needsEnrichment rows are exhausted, dependency-blocked, or excluded. For approval diagnostics use rowSelector:{type:"needsApproval"} after current generated messages exist; mutating Approved cells still requires approvalMode:approve and exact bounded approval. Do not interpret checkedRows as enriched rows; it is only the table cursor. Prepared, approved, and ready_to_schedule rows are intermediate states; never call them scheduled unless a re-read proves scheduler-owned scheduled cells with non-null scheduledFor contribute to projected coverage, and never call them complete unless a final re-read proves projected coverage fills the scheduler-forward target window. Before source import, prep, approval, or selected paused campaign start, require exact visible approval or --yolo packet auto-accept and a fresh get_campaign_refill_state reread; stop if freshness.stateHash or exact ids changed. For "approve X messages", use approvalMode:approve only when explicitly requested. For "schedule X sends" or "fill sender sends", approve only when explicitly requested, then re-read campaign/table scheduled counts; if projected coverage does not fill the horizon, keep polling when ready buffer covers the gap and report only interim prepared/approved/ready - awaiting scheduler status if Christian asks. Do not call start_campaign as part of fill/schedule horizon. start_campaign is allowed in refill only for exact selected PAUSED, dashboard-active, campaign-backed sequence targets named in the bounded packet, and the packet must state that starting can let the product scheduler schedule/send approved eligible sequence actions. Never start unrelated, archived, completed, draft, direct, or non-selected campaigns, never broad approve-all, and never use direct scheduler writes. campaignId is CampaignOffer.id. If the user asks to stop preparation, the target is wrong, or status shows the wrong campaign/table, use cancel_campaign_message_preparation only for the exact active job. Low-level selectors are diagnostics and recovery only for this lane.`,
385
385
  },
@@ -512,14 +512,6 @@ export function getSubskillAsset(subskillName, assetPath, offset, limit) {
512
512
  throw new Error(`Unknown subskill asset: ${subskillName}/${cleanAssetPath}`);
513
513
  }
514
514
  const content = fs.readFileSync(resolved, "utf8");
515
- if (subskillName === "refill-sends-workflow" &&
516
- cleanAssetPath === "core/contract.v2.json") {
517
- validateRefillContractAsset(JSON.parse(content));
518
- }
519
- if (subskillName === "refill-sends-workflow" &&
520
- cleanAssetPath === "core/flow.v1.json") {
521
- validateRefillFlowProjection(JSON.parse(content));
522
- }
523
515
  const chunked = readChunkedContent(content, offset, limit, (nextOffset, safeLimit) => `Continue this same asset load with get_subskill_asset({ subskillName: "${subskillName}", assetPath: "${cleanAssetPath}", offset: ${nextOffset}, limit: ${safeLimit} }) until hasMore is false. Treat all chunks as one asset load; do not use saved local tool-output files or machine-specific paths.`);
524
516
  return {
525
517
  subskillName,
@@ -1,21 +1,84 @@
1
1
  export type ProviderId = "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
2
+ export declare const FIND_LEADS_WORKFLOW_VERSION = "find-leads-v1";
3
+ export type FindLeadsProviderId = "sales-nav" | "prospeo" | "signal-discovery";
4
+ type ProviderFacts = {
5
+ configured: boolean;
6
+ reason?: string;
7
+ credits?: number;
8
+ };
9
+ export declare function preflightFindLeadsProvider(input: {
10
+ runId: string;
11
+ provider: FindLeadsProviderId;
12
+ workflowVersion: string;
13
+ runVersion?: number;
14
+ promptHash?: string;
15
+ providerFacts?: ProviderFacts;
16
+ }): Promise<{
17
+ ok: false;
18
+ code: string;
19
+ message: string;
20
+ nextAction: string;
21
+ resumable: boolean;
22
+ } | {
23
+ ok: true;
24
+ provider: FindLeadsProviderId;
25
+ receipt: {
26
+ workflowVersion: string;
27
+ promptHash: string;
28
+ provider: FindLeadsProviderId;
29
+ checkedAt: string;
30
+ };
31
+ run: Record<string, unknown>;
32
+ }>;
33
+ export declare const findLeadsProviderPreflightToolDefinitions: readonly [{
34
+ readonly name: "preflight_find_leads_provider";
35
+ readonly description: "Persist the selected provider prompt/version receipt and return actionable setup diagnostics before any provider call.";
36
+ readonly inputSchema: {
37
+ readonly type: "object";
38
+ readonly properties: {
39
+ readonly runId: {
40
+ readonly type: "string";
41
+ };
42
+ readonly runVersion: {
43
+ readonly type: "number";
44
+ };
45
+ readonly provider: {
46
+ readonly type: "string";
47
+ readonly enum: readonly ["sales-nav", "prospeo", "signal-discovery"];
48
+ };
49
+ readonly workflowVersion: {
50
+ readonly type: "string";
51
+ };
52
+ readonly promptHash: {
53
+ readonly type: "string";
54
+ };
55
+ };
56
+ readonly required: readonly ["runId", "runVersion", "provider", "workflowVersion"];
57
+ readonly additionalProperties: false;
58
+ };
59
+ }];
2
60
  export declare function markProviderPromptLoaded(params: {
3
61
  provider: ProviderId;
4
62
  campaignOfferId?: string | null;
63
+ findLeadsRunId?: string | null;
5
64
  }): {
6
- readonly scope: "campaign" | "provider";
65
+ readonly scope: "campaign" | "provider" | "find-leads-run";
7
66
  readonly provider: ProviderId;
8
67
  readonly campaignOfferId: string | null;
68
+ readonly findLeadsRunId: string | null;
9
69
  readonly loadedAt: string;
10
70
  };
11
71
  export declare function assertProviderPromptLoaded(params: {
12
72
  provider: ProviderId;
13
73
  campaignOfferId?: string | null;
74
+ findLeadsRunId?: string | null;
14
75
  }): {
15
76
  readonly ok: true;
16
77
  readonly provider: ProviderId;
17
78
  readonly campaignOfferId: string | null;
79
+ readonly findLeadsRunId: string | null;
18
80
  readonly loadedAt: string;
19
- readonly scope: "campaign" | "provider";
81
+ readonly scope: "campaign" | "provider" | "find-leads-run";
20
82
  };
21
83
  export declare function resetProviderPromptPreflightState(): void;
84
+ export {};