@sellable/mcp 0.1.557 → 0.1.559

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 +2 -13
  2. package/agents/registry.json +2 -2
  3. package/dist/api.js +6 -3
  4. package/dist/auth.d.ts +6 -0
  5. package/dist/auth.js +44 -2
  6. package/dist/refill-contract.d.ts +157 -0
  7. package/dist/refill-contract.js +487 -0
  8. package/dist/refill-run-client.d.ts +10 -0
  9. package/dist/refill-run-client.js +22 -0
  10. package/dist/refill-run-loop.d.ts +14 -2
  11. package/dist/refill-run-loop.js +169 -18
  12. package/dist/server.js +0 -23
  13. package/dist/tools/auth.d.ts +5 -0
  14. package/dist/tools/auth.js +49 -12
  15. package/dist/tools/campaign-message-preparation.d.ts +62 -0
  16. package/dist/tools/campaign-message-preparation.js +41 -0
  17. package/dist/tools/campaigns.js +2 -2
  18. package/dist/tools/csv-dnc.js +2 -2
  19. package/dist/tools/evergreen-refill-plan.d.ts +3 -0
  20. package/dist/tools/evergreen-refill-plan.js +29 -7
  21. package/dist/tools/leads.d.ts +32 -317
  22. package/dist/tools/leads.js +10 -171
  23. package/dist/tools/model-quality.js +6 -4
  24. package/dist/tools/prompts.d.ts +3 -3
  25. package/dist/tools/prompts.js +15 -7
  26. package/dist/tools/provider-preflight.d.ts +2 -65
  27. package/dist/tools/provider-preflight.js +10 -97
  28. package/dist/tools/readiness.d.ts +5 -89
  29. package/dist/tools/readiness.js +0 -66
  30. package/dist/tools/refill-executors.d.ts +38 -0
  31. package/dist/tools/refill-executors.js +222 -3
  32. package/dist/tools/refill-sends-v2.d.ts +118 -1
  33. package/dist/tools/refill-sends-v2.js +312 -3
  34. package/dist/tools/refill-sends.d.ts +678 -32
  35. package/dist/tools/refill-sends.js +274 -13
  36. package/dist/tools/refill-target-plan.js +486 -14
  37. package/dist/tools/registry.d.ts +115 -330
  38. package/dist/tools/registry.js +1 -7
  39. package/dist/tools/scheduler-fill-capacity.js +1 -1
  40. package/dist/tools/scheduler-run.d.ts +71 -0
  41. package/dist/tools/scheduler-run.js +203 -1
  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 +8 -3
  45. package/dist/tools/workspace-export.js +2 -2
  46. package/dist/tools/workspaces.d.ts +48 -2
  47. package/dist/tools/workspaces.js +48 -5
  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 +630 -48
  53. package/skills/refill-sends/SKILL.md +94 -353
  54. package/skills/refill-sends-v2/SKILL.md +6 -6
  55. package/skills/refill-sends-v2-workflow/SKILL.md +5 -5
  56. package/skills/refill-sends-v2-workflow/core/flow.v1.json +8 -8
  57. package/skills/refill-sends-workflow/SKILL.md +100 -743
  58. package/skills/refill-sends-workflow/core/contract.v2.json +543 -0
  59. package/skills/refill-sends-workflow/core/flow.v1.json +185 -1
  60. package/dist/tools/find-leads-runs.d.ts +0 -151
  61. package/dist/tools/find-leads-runs.js +0 -98
  62. package/skills/find-leads-v2/SKILL.md +0 -70
  63. package/skills/find-leads-v2/core/flow.v1.json +0 -31
@@ -1348,10 +1348,6 @@ 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
- },
1355
1351
  confirmed: {
1356
1352
  type: "boolean",
1357
1353
  description: "Set true after user approval when interaction mode requires confirmation for this action.",
@@ -1466,18 +1462,6 @@ export const leadToolDefinitions = [
1466
1462
  type: "string",
1467
1463
  description: "Campaign offer ID to associate search",
1468
1464
  },
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
- },
1481
1465
  searchName: {
1482
1466
  type: "string",
1483
1467
  description: "REQUIRED: Descriptive name for this search. Include key filters. Examples: 'SaaS + Series A-B + 11-200 employees', 'Healthcare VPs + 51-500 employees'",
@@ -1534,7 +1518,7 @@ export const leadToolDefinitions = [
1534
1518
  },
1535
1519
  {
1536
1520
  name: "search_sales_nav",
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.',
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.',
1538
1522
  inputSchema: {
1539
1523
  type: "object",
1540
1524
  properties: {
@@ -1559,9 +1543,6 @@ export const leadToolDefinitions = [
1559
1543
  type: "string",
1560
1544
  description: "Campaign offer ID to associate search",
1561
1545
  },
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" },
1565
1546
  searchName: {
1566
1547
  type: "string",
1567
1548
  description: "Optional name for the search",
@@ -1997,9 +1978,6 @@ export const leadToolDefinitions = [
1997
1978
  type: "string",
1998
1979
  description: "Campaign offer ID to associate search",
1999
1980
  },
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" },
2003
1981
  workspaceId: {
2004
1982
  type: "string",
2005
1983
  description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
@@ -2066,8 +2044,6 @@ export const leadToolDefinitions = [
2066
2044
  type: "string",
2067
2045
  description: "Campaign offer ID to associate search. Optional for directional preview runs.",
2068
2046
  },
2069
- findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
2070
- runVersion: { type: "number", description: "Current durable run version" },
2071
2047
  currentStep: {
2072
2048
  type: ["string", "null"],
2073
2049
  description: "Headless workflow step ID",
@@ -2105,7 +2081,7 @@ export const leadToolDefinitions = [
2105
2081
  },
2106
2082
  {
2107
2083
  name: "import_leads",
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.",
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.",
2109
2085
  inputSchema: {
2110
2086
  type: "object",
2111
2087
  properties: {
@@ -2113,8 +2089,6 @@ export const leadToolDefinitions = [
2113
2089
  type: "string",
2114
2090
  description: "Campaign offer ID",
2115
2091
  },
2116
- findLeadsRunId: { type: "string", description: "Campaignless run/list ID" },
2117
- runVersion: { type: "number", description: "Current durable run version" },
2118
2092
  workspaceId: {
2119
2093
  type: "string",
2120
2094
  description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
@@ -2136,10 +2110,6 @@ export const leadToolDefinitions = [
2136
2110
  type: "string",
2137
2111
  description: "Search ID for apollo or sales-nav import",
2138
2112
  },
2139
- signalTabId: {
2140
- type: "string",
2141
- description: "Signal Discovery run tab whose selected posts should be materialized",
2142
- },
2143
2113
  targetLeadCount: {
2144
2114
  type: "number",
2145
2115
  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.",
@@ -2184,11 +2154,7 @@ export const leadToolDefinitions = [
2184
2154
  description: "Set true after user approval when interaction mode requires confirmation for import.",
2185
2155
  },
2186
2156
  },
2187
- oneOf: [
2188
- { required: ["campaignOfferId"], not: { required: ["findLeadsRunId"] } },
2189
- { required: ["findLeadsRunId", "runVersion", "provider"], not: { required: ["campaignOfferId"] } }
2190
- ],
2191
- additionalProperties: false,
2157
+ required: ["campaignOfferId"],
2192
2158
  },
2193
2159
  },
2194
2160
  {
@@ -2228,9 +2194,6 @@ export const leadToolDefinitions = [
2228
2194
  type: "string",
2229
2195
  description: "Campaign offer ID",
2230
2196
  },
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" },
2234
2197
  workspaceId: {
2235
2198
  type: "string",
2236
2199
  description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
@@ -2627,9 +2590,6 @@ export async function searchApollo(input) {
2627
2590
  });
2628
2591
  }
2629
2592
  export async function searchSalesNav(input) {
2630
- if (input.campaignOfferId && input.findLeadsRunId) {
2631
- throw new Error("search_sales_nav requires exactly one owner target");
2632
- }
2633
2593
  if (input?.campaignOfferId) {
2634
2594
  assertInteractionApproval({
2635
2595
  campaignId: input.campaignOfferId,
@@ -2640,7 +2600,6 @@ export async function searchSalesNav(input) {
2640
2600
  assertProviderPromptLoaded({
2641
2601
  provider: "sales-nav",
2642
2602
  campaignOfferId: input?.campaignOfferId,
2643
- findLeadsRunId: input?.findLeadsRunId,
2644
2603
  });
2645
2604
  const api = getApi();
2646
2605
  return api.post(`/api/v3/sales-nav/search`, normalizeSalesNavSearchInput(input));
@@ -3175,9 +3134,6 @@ function compactProspeoCompanyAccountConfirmationResponse(response) {
3175
3134
  };
3176
3135
  }
3177
3136
  export async function searchProspeo(input) {
3178
- if (input.campaignOfferId && input.findLeadsRunId) {
3179
- throw new Error("search_prospeo requires exactly one owner target");
3180
- }
3181
3137
  if (input?.campaignOfferId) {
3182
3138
  assertInteractionApproval({
3183
3139
  campaignId: input.campaignOfferId,
@@ -3188,7 +3144,6 @@ export async function searchProspeo(input) {
3188
3144
  assertProviderPromptLoaded({
3189
3145
  provider: "prospeo",
3190
3146
  campaignOfferId: input?.campaignOfferId,
3191
- findLeadsRunId: input?.findLeadsRunId,
3192
3147
  });
3193
3148
  const api = getApi();
3194
3149
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
@@ -3700,9 +3655,6 @@ export async function lookupSalesNavFilter(input) {
3700
3655
  };
3701
3656
  }
3702
3657
  export async function searchSignals(input) {
3703
- if (input.campaignOfferId && input.findLeadsRunId) {
3704
- throw new Error("search_signals requires exactly one owner target");
3705
- }
3706
3658
  if (input?.campaignOfferId) {
3707
3659
  assertInteractionApproval({
3708
3660
  campaignId: input.campaignOfferId,
@@ -3713,7 +3665,6 @@ export async function searchSignals(input) {
3713
3665
  assertProviderPromptLoaded({
3714
3666
  provider: "signal-discovery",
3715
3667
  campaignOfferId: input?.campaignOfferId,
3716
- findLeadsRunId: input?.findLeadsRunId,
3717
3668
  });
3718
3669
  const api = getApi();
3719
3670
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
@@ -3776,82 +3727,7 @@ export async function importLeads(input) {
3776
3727
  const apiPut = (path, body) => requestOptions
3777
3728
  ? api.put(path, body, requestOptions)
3778
3729
  : api.put(path, body);
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;
3730
+ const { campaignOfferId, currentStep, sourceLeadListId: inputSourceLeadListId, searchId, targetLeadCount, mode, searchName, leadListName, headlineICPCriteria, targetEngagerCount, maxPostsToScrape, allowInvalidSignalPosts, rubricGuidelines, confirmed, } = input;
3855
3731
  assertInteractionApproval({
3856
3732
  campaignId: campaignOfferId,
3857
3733
  action: "import-leads",
@@ -4753,10 +4629,7 @@ export async function confirmLeadList(input) {
4753
4629
  };
4754
4630
  }
4755
4631
  export function getProviderPrompt(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
- }
4632
+ const { provider, campaignOfferId, confirmed } = input;
4760
4633
  if (campaignOfferId) {
4761
4634
  assertInteractionApproval({
4762
4635
  campaignId: campaignOfferId,
@@ -4780,7 +4653,6 @@ export function getProviderPrompt(input) {
4780
4653
  markProviderPromptLoaded({
4781
4654
  provider,
4782
4655
  campaignOfferId,
4783
- findLeadsRunId,
4784
4656
  });
4785
4657
  return prompt;
4786
4658
  }
@@ -4799,10 +4671,7 @@ export async function selectPromisingPosts(input) {
4799
4671
  const apiPut = (path, body) => requestOptions
4800
4672
  ? api.put(path, body, requestOptions)
4801
4673
  : api.put(path, body);
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
- }
4674
+ const { campaignOfferId, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
4806
4675
  const effectiveMode = selectionMode ?? mode ?? "replace";
4807
4676
  const effectiveScrapePlanMode = scrapePlanMode ??
4808
4677
  (targetEngagerCount || maxPostsToScrape
@@ -4817,48 +4686,18 @@ export async function selectPromisingPosts(input) {
4817
4686
  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.`,
4818
4687
  };
4819
4688
  }
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;
4850
4689
  // Update post selections via API
4851
4690
  const postIds = selections.map((s) => s.postId);
4852
4691
  let unselectedIds = [];
4853
4692
  if (effectiveMode === "replace") {
4854
- const existing = await apiGet(`/api/v3/campaigns/${campaignId}/signal-discovery/posts?selected=true`);
4693
+ const existing = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`);
4855
4694
  const existingIds = existing?.posts
4856
4695
  ?.map((post) => post.id)
4857
4696
  .filter((id) => Boolean(id)) ?? [];
4858
4697
  const selectedSet = new Set(postIds);
4859
4698
  unselectedIds = existingIds.filter((id) => !selectedSet.has(id));
4860
4699
  }
4861
- const selectionResult = await apiPatch(`/api/v3/campaigns/${campaignId}/signal-discovery/posts`, {
4700
+ const selectionResult = await apiPatch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
4862
4701
  selectedIds: postIds,
4863
4702
  unselectedIds,
4864
4703
  headlineICPCriteria,
@@ -4877,7 +4716,7 @@ export async function selectPromisingPosts(input) {
4877
4716
  let recommendedPostCount = selectionResult.selectedCount;
4878
4717
  let recommendationTargetEngagerCount = null;
4879
4718
  try {
4880
- const tabsResponse = await apiGet(`/api/v3/campaigns/${campaignId}/signal-discovery/tabs`);
4719
+ const tabsResponse = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
4881
4720
  const reasonsByPostId = new Map(selections.map((selection) => [selection.postId, selection.reason]));
4882
4721
  const selectedByUrl = new Map();
4883
4722
  for (const tab of tabsResponse.tabs ?? []) {
@@ -4934,7 +4773,7 @@ Approval card should say:
4934
4773
  }
4935
4774
  const selectionCurrentStep = currentStep === null ? undefined : (currentStep ?? "signal-discovery");
4936
4775
  if (selectionCurrentStep) {
4937
- await apiPut(`/api/v2/campaign-offers/${campaignId}`, {
4776
+ await apiPut(`/api/v2/campaign-offers/${campaignOfferId}`, {
4938
4777
  currentStep: selectionCurrentStep,
4939
4778
  watchNarration: buildSelectedPostApprovalWatchNarration(selectionResult.selectedCount, recommendedPostCount, recommendationTargetEngagerCount),
4940
4779
  });
@@ -21,28 +21,30 @@ const DEFAULT_MODEL_QUALITY_CONFIG = {
21
21
  minimumModel: "GPT 5.5",
22
22
  familyKeywords: ["gpt"],
23
23
  minimumVersion: "5.5",
24
- minimumReasoningEffort: "xhigh",
24
+ minimumReasoningEffort: "high",
25
25
  acceptedReasoningEfforts: [
26
+ "high",
26
27
  "extra high",
27
28
  "extra-high",
28
29
  "xhigh",
29
30
  "extra_high",
30
31
  ],
31
- recommendedReasoningEffort: "xhigh",
32
+ recommendedReasoningEffort: "high or better",
32
33
  },
33
34
  hermes: {
34
35
  label: "Hermes",
35
36
  minimumModel: "GPT 5.5",
36
37
  familyKeywords: ["gpt"],
37
38
  minimumVersion: "5.5",
38
- minimumReasoningEffort: "xhigh",
39
+ minimumReasoningEffort: "high",
39
40
  acceptedReasoningEfforts: [
41
+ "high",
40
42
  "extra high",
41
43
  "extra-high",
42
44
  "xhigh",
43
45
  "extra_high",
44
46
  ],
45
- recommendedReasoningEffort: "xhigh",
47
+ recommendedReasoningEffort: "high or better",
46
48
  },
47
49
  },
48
50
  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", "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"];
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"];
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", "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"];
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"];
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", "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"];
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"];
223
223
  description: string;
224
224
  };
225
225
  assetPath: {
@@ -2,6 +2,7 @@ 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";
5
6
  // Chunk size sits below Claude Code's max-token cap on tool results
6
7
  // (empirically around ~50k chars — fetch_linkedin_profile breached at
7
8
  // 53,295 chars, which forced a python3 chunked-read fallback). 48k gives
@@ -34,7 +35,6 @@ export const ALLOWED_SUBSKILL_PROMPT_NAMES = [
34
35
  "enrich-prospects",
35
36
  "fill-send-horizon",
36
37
  "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.5"),
266
- modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "xhigh"),
265
+ model: String(agent.codex?.model || "gpt-5.6-sol"),
266
+ modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "high"),
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.5"),
313
- modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "xhigh"),
312
+ model: String(agent.codex?.model || "gpt-5.6-sol"),
313
+ modelReasoningEffort: String(agent.codex?.modelReasoningEffort || "high"),
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.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.',
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.',
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.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.',
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.',
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,6 +512,14 @@ 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
+ }
515
523
  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.`);
516
524
  return {
517
525
  subskillName,
@@ -1,84 +1,21 @@
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
- }];
60
2
  export declare function markProviderPromptLoaded(params: {
61
3
  provider: ProviderId;
62
4
  campaignOfferId?: string | null;
63
- findLeadsRunId?: string | null;
64
5
  }): {
65
- readonly scope: "campaign" | "provider" | "find-leads-run";
6
+ readonly scope: "campaign" | "provider";
66
7
  readonly provider: ProviderId;
67
8
  readonly campaignOfferId: string | null;
68
- readonly findLeadsRunId: string | null;
69
9
  readonly loadedAt: string;
70
10
  };
71
11
  export declare function assertProviderPromptLoaded(params: {
72
12
  provider: ProviderId;
73
13
  campaignOfferId?: string | null;
74
- findLeadsRunId?: string | null;
75
14
  }): {
76
15
  readonly ok: true;
77
16
  readonly provider: ProviderId;
78
17
  readonly campaignOfferId: string | null;
79
- readonly findLeadsRunId: string | null;
80
18
  readonly loadedAt: string;
81
- readonly scope: "campaign" | "provider" | "find-leads-run";
19
+ readonly scope: "campaign" | "provider";
82
20
  };
83
21
  export declare function resetProviderPromptPreflightState(): void;
84
- export {};