@sellable/mcp 0.1.475 → 0.1.477

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.
@@ -179,6 +179,8 @@ export type ConfirmLeadListInput = {
179
179
  reviewBatchLimit?: number;
180
180
  includeRawImportResult?: boolean;
181
181
  allowPartialSourceList?: boolean;
182
+ sourceRowIds?: string[];
183
+ sourceRowLimit?: number;
182
184
  /**
183
185
  * Deprecated alias for reviewBatchLimit. Confirming a lead list now copies the
184
186
  * confirmed source into the campaign table; this value no longer caps clone
@@ -293,6 +295,8 @@ export declare const leadToolDefinitions: ({
293
295
  keepInSync?: undefined;
294
296
  jobId?: undefined;
295
297
  reviewBatchLimit?: undefined;
298
+ sourceRowIds?: undefined;
299
+ sourceRowLimit?: undefined;
296
300
  allowPartialSourceList?: undefined;
297
301
  includeRawImportResult?: undefined;
298
302
  selections?: undefined;
@@ -487,6 +491,8 @@ export declare const leadToolDefinitions: ({
487
491
  keepInSync?: undefined;
488
492
  jobId?: undefined;
489
493
  reviewBatchLimit?: undefined;
494
+ sourceRowIds?: undefined;
495
+ sourceRowLimit?: undefined;
490
496
  allowPartialSourceList?: undefined;
491
497
  includeRawImportResult?: undefined;
492
498
  selections?: undefined;
@@ -580,6 +586,8 @@ export declare const leadToolDefinitions: ({
580
586
  keepInSync?: undefined;
581
587
  jobId?: undefined;
582
588
  reviewBatchLimit?: undefined;
589
+ sourceRowIds?: undefined;
590
+ sourceRowLimit?: undefined;
583
591
  allowPartialSourceList?: undefined;
584
592
  includeRawImportResult?: undefined;
585
593
  selections?: undefined;
@@ -745,6 +753,8 @@ export declare const leadToolDefinitions: ({
745
753
  keepInSync?: undefined;
746
754
  jobId?: undefined;
747
755
  reviewBatchLimit?: undefined;
756
+ sourceRowIds?: undefined;
757
+ sourceRowLimit?: undefined;
748
758
  allowPartialSourceList?: undefined;
749
759
  includeRawImportResult?: undefined;
750
760
  selections?: undefined;
@@ -852,6 +862,8 @@ export declare const leadToolDefinitions: ({
852
862
  keepInSync?: undefined;
853
863
  jobId?: undefined;
854
864
  reviewBatchLimit?: undefined;
865
+ sourceRowIds?: undefined;
866
+ sourceRowLimit?: undefined;
855
867
  allowPartialSourceList?: undefined;
856
868
  includeRawImportResult?: undefined;
857
869
  selections?: undefined;
@@ -968,6 +980,8 @@ export declare const leadToolDefinitions: ({
968
980
  keepInSync?: undefined;
969
981
  jobId?: undefined;
970
982
  reviewBatchLimit?: undefined;
983
+ sourceRowIds?: undefined;
984
+ sourceRowLimit?: undefined;
971
985
  allowPartialSourceList?: undefined;
972
986
  includeRawImportResult?: undefined;
973
987
  selections?: undefined;
@@ -1073,6 +1087,8 @@ export declare const leadToolDefinitions: ({
1073
1087
  keepInSync?: undefined;
1074
1088
  jobId?: undefined;
1075
1089
  reviewBatchLimit?: undefined;
1090
+ sourceRowIds?: undefined;
1091
+ sourceRowLimit?: undefined;
1076
1092
  allowPartialSourceList?: undefined;
1077
1093
  includeRawImportResult?: undefined;
1078
1094
  selections?: undefined;
@@ -1183,6 +1199,8 @@ export declare const leadToolDefinitions: ({
1183
1199
  keepInSync?: undefined;
1184
1200
  jobId?: undefined;
1185
1201
  reviewBatchLimit?: undefined;
1202
+ sourceRowIds?: undefined;
1203
+ sourceRowLimit?: undefined;
1186
1204
  allowPartialSourceList?: undefined;
1187
1205
  includeRawImportResult?: undefined;
1188
1206
  selections?: undefined;
@@ -1281,6 +1299,8 @@ export declare const leadToolDefinitions: ({
1281
1299
  keepInSync?: undefined;
1282
1300
  jobId?: undefined;
1283
1301
  reviewBatchLimit?: undefined;
1302
+ sourceRowIds?: undefined;
1303
+ sourceRowLimit?: undefined;
1284
1304
  allowPartialSourceList?: undefined;
1285
1305
  includeRawImportResult?: undefined;
1286
1306
  selections?: undefined;
@@ -2171,6 +2191,8 @@ export declare const leadToolDefinitions: ({
2171
2191
  keepInSync?: undefined;
2172
2192
  jobId?: undefined;
2173
2193
  reviewBatchLimit?: undefined;
2194
+ sourceRowIds?: undefined;
2195
+ sourceRowLimit?: undefined;
2174
2196
  allowPartialSourceList?: undefined;
2175
2197
  includeRawImportResult?: undefined;
2176
2198
  selections?: undefined;
@@ -2278,6 +2300,8 @@ export declare const leadToolDefinitions: ({
2278
2300
  keepInSync?: undefined;
2279
2301
  jobId?: undefined;
2280
2302
  reviewBatchLimit?: undefined;
2303
+ sourceRowIds?: undefined;
2304
+ sourceRowLimit?: undefined;
2281
2305
  allowPartialSourceList?: undefined;
2282
2306
  includeRawImportResult?: undefined;
2283
2307
  selections?: undefined;
@@ -3323,6 +3347,8 @@ export declare const leadToolDefinitions: ({
3323
3347
  keepInSync?: undefined;
3324
3348
  jobId?: undefined;
3325
3349
  reviewBatchLimit?: undefined;
3350
+ sourceRowIds?: undefined;
3351
+ sourceRowLimit?: undefined;
3326
3352
  allowPartialSourceList?: undefined;
3327
3353
  includeRawImportResult?: undefined;
3328
3354
  selections?: undefined;
@@ -3477,6 +3503,8 @@ export declare const leadToolDefinitions: ({
3477
3503
  keepInSync?: undefined;
3478
3504
  jobId?: undefined;
3479
3505
  reviewBatchLimit?: undefined;
3506
+ sourceRowIds?: undefined;
3507
+ sourceRowLimit?: undefined;
3480
3508
  allowPartialSourceList?: undefined;
3481
3509
  includeRawImportResult?: undefined;
3482
3510
  selections?: undefined;
@@ -3618,6 +3646,8 @@ export declare const leadToolDefinitions: ({
3618
3646
  keepInSync?: undefined;
3619
3647
  jobId?: undefined;
3620
3648
  reviewBatchLimit?: undefined;
3649
+ sourceRowIds?: undefined;
3650
+ sourceRowLimit?: undefined;
3621
3651
  allowPartialSourceList?: undefined;
3622
3652
  includeRawImportResult?: undefined;
3623
3653
  selections?: undefined;
@@ -3714,6 +3744,8 @@ export declare const leadToolDefinitions: ({
3714
3744
  keepInSync?: undefined;
3715
3745
  jobId?: undefined;
3716
3746
  reviewBatchLimit?: undefined;
3747
+ sourceRowIds?: undefined;
3748
+ sourceRowLimit?: undefined;
3717
3749
  allowPartialSourceList?: undefined;
3718
3750
  includeRawImportResult?: undefined;
3719
3751
  selections?: undefined;
@@ -3760,6 +3792,17 @@ export declare const leadToolDefinitions: ({
3760
3792
  type: string;
3761
3793
  description: string;
3762
3794
  };
3795
+ sourceRowIds: {
3796
+ type: string;
3797
+ items: {
3798
+ type: string;
3799
+ };
3800
+ description: string;
3801
+ };
3802
+ sourceRowLimit: {
3803
+ type: string;
3804
+ description: string;
3805
+ };
3763
3806
  allowPartialSourceList: {
3764
3807
  type: string;
3765
3808
  description: string;
@@ -3969,6 +4012,8 @@ export declare const leadToolDefinitions: ({
3969
4012
  keepInSync?: undefined;
3970
4013
  jobId?: undefined;
3971
4014
  reviewBatchLimit?: undefined;
4015
+ sourceRowIds?: undefined;
4016
+ sourceRowLimit?: undefined;
3972
4017
  allowPartialSourceList?: undefined;
3973
4018
  includeRawImportResult?: undefined;
3974
4019
  };
@@ -4066,6 +4111,8 @@ export declare const leadToolDefinitions: ({
4066
4111
  keepInSync?: undefined;
4067
4112
  jobId?: undefined;
4068
4113
  reviewBatchLimit?: undefined;
4114
+ sourceRowIds?: undefined;
4115
+ sourceRowLimit?: undefined;
4069
4116
  allowPartialSourceList?: undefined;
4070
4117
  includeRawImportResult?: undefined;
4071
4118
  selections?: undefined;
@@ -4617,7 +4664,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4617
4664
  validSelectedPostCount: number;
4618
4665
  recommendedValidPostCount: number;
4619
4666
  estimatedValidEngagers: number;
4620
- targetEngagerCount: number;
4667
+ targetEngagerCount: number | null;
4621
4668
  suggestedToolCalls: never[];
4622
4669
  leadListId?: undefined;
4623
4670
  existingLeadListId?: undefined;
@@ -4651,7 +4698,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4651
4698
  validSelectedPostCount: number;
4652
4699
  recommendedValidPostCount: number;
4653
4700
  estimatedValidEngagers: number;
4654
- targetEngagerCount: number;
4701
+ targetEngagerCount: number | null;
4655
4702
  message: string;
4656
4703
  suggestedToolCalls: {
4657
4704
  tool: string;
@@ -4698,7 +4745,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4698
4745
  estimatedEngagers: number;
4699
4746
  selectedPostCount: number;
4700
4747
  availableSelectedPostCount: number;
4701
- targetEngagerCount: number;
4748
+ targetEngagerCount: number | null;
4702
4749
  maxPostsToScrape: number | null;
4703
4750
  limitedSelectedPosts: boolean;
4704
4751
  invalidSelectedPostCount: number;
@@ -1127,15 +1127,15 @@ function normalizeEngagementCount(value) {
1127
1127
  : 0;
1128
1128
  }
1129
1129
  function buildSignalDiscoverySourceRecommendation({ selectedPosts, targetEngagerCount, maxPostsToScrape, }) {
1130
- const { targetGoodFitLeads, defaultFitRate, minPlanningFitRate, sourceCandidateTarget, reviewBatchSize, } = getSignalDiscoverySourcePlanDefaults();
1131
- const effectiveTargetEngagerCount = normalizePositiveInteger(targetEngagerCount) ?? sourceCandidateTarget;
1130
+ const { targetGoodFitLeads, defaultFitRate, minPlanningFitRate, reviewBatchSize, } = getSignalDiscoverySourcePlanDefaults();
1131
+ const explicitTargetEngagerCount = normalizePositiveInteger(targetEngagerCount);
1132
1132
  const normalizedSelectedPosts = selectedPosts.map((post) => ({
1133
1133
  ...post,
1134
1134
  likes: normalizeEngagementCount(post.likes),
1135
1135
  comments: normalizeEngagementCount(post.comments),
1136
1136
  }));
1137
1137
  const scrapePlan = selectSignalPostsForImport(normalizedSelectedPosts, {
1138
- targetEngagerCount: effectiveTargetEngagerCount,
1138
+ targetEngagerCount: explicitTargetEngagerCount,
1139
1139
  maxPostsToScrape: maxPostsToScrape ?? undefined,
1140
1140
  });
1141
1141
  const recommendedPosts = scrapePlan.posts;
@@ -1143,8 +1143,8 @@ function buildSignalDiscoverySourceRecommendation({ selectedPosts, targetEngager
1143
1143
  const recommendedCount = recommendedPosts.length;
1144
1144
  const totalVisibleEngagement = normalizedSelectedPosts.reduce((sum, post) => sum + post.likes + post.comments, 0);
1145
1145
  const recommendedVisibleEngagement = recommendedPosts.reduce((sum, post) => sum + post.likes + post.comments, 0);
1146
- const fitRateForEstimate = targetEngagerCount && effectiveTargetEngagerCount > 0
1147
- ? Math.min(1, targetGoodFitLeads / effectiveTargetEngagerCount)
1146
+ const fitRateForEstimate = explicitTargetEngagerCount && explicitTargetEngagerCount > 0
1147
+ ? Math.min(1, targetGoodFitLeads / explicitTargetEngagerCount)
1148
1148
  : defaultFitRate;
1149
1149
  const estimatedGoodFit = scrapePlan.estimatedEngagers * fitRateForEstimate;
1150
1150
  const tableRows = recommendedPosts
@@ -1154,9 +1154,12 @@ function buildSignalDiscoverySourceRecommendation({ selectedPosts, targetEngager
1154
1154
  return `| ${escapeMarkdownTableCell(post.authorName)} | ${escapeMarkdownTableCell(post.reason)} | ${formatApproxInteger(engagement)} | ${formatApproxInteger(estimatedPostGoodFit)} |`;
1155
1155
  })
1156
1156
  .join("\n");
1157
- const fitRateLabel = targetEngagerCount && effectiveTargetEngagerCount > 0
1157
+ const fitRateLabel = explicitTargetEngagerCount && explicitTargetEngagerCount > 0
1158
1158
  ? "the approved buyer-search target"
1159
1159
  : `the ${Math.round(defaultFitRate * 100)}% starting estimate`;
1160
+ const peopleToCheckCopy = explicitTargetEngagerCount && explicitTargetEngagerCount > 0
1161
+ ? `about ${explicitTargetEngagerCount.toLocaleString("en-US")} people who reacted or commented`
1162
+ : `up to ${formatApproxInteger(scrapePlan.estimatedEngagers)} people from the selected posts`;
1160
1163
  const selectedPoolCopy = recommendedCount < selectedCount
1161
1164
  ? `**Posts considered:** ${selectedCount.toLocaleString("en-US")} selected posts with ${formatApproxInteger(totalVisibleEngagement)} public reactions/comments<br>\n**Recommended first set:** ${recommendedCount.toLocaleString("en-US")} post${recommendedCount === 1 ? "" : "s"} with ${formatApproxInteger(recommendedVisibleEngagement)} public reactions/comments and up to ${formatApproxInteger(scrapePlan.estimatedEngagers)} people to check<br>`
1162
1165
  : `**Public activity in the selected posts:** ${formatApproxInteger(totalVisibleEngagement)} reactions/comments<br>\n**People we can check from this set:** up to ${formatApproxInteger(scrapePlan.estimatedEngagers)}<br>`;
@@ -1167,7 +1170,7 @@ Start with LinkedIn posts.
1167
1170
  I found ${recommendedCount.toLocaleString("en-US")} recommended LinkedIn post${recommendedCount === 1 ? "" : "s"} to check first. People there are already reacting or commenting around this problem.
1168
1171
 
1169
1172
  **Goal:** find about ${targetGoodFitLeads.toLocaleString("en-US")} likely prospects<br>
1170
- **People to check:** about ${effectiveTargetEngagerCount.toLocaleString("en-US")} people who reacted or commented<br>
1173
+ **People to check:** ${peopleToCheckCopy}<br>
1171
1174
  **Good sign:** at least ${Math.round(minPlanningFitRate * 100)}% of the first sample should look like real prospects; below that, switch to active LinkedIn profiles with the right titles<br>
1172
1175
  **First review:** after the list is built, review the first ${reviewBatchSize.toLocaleString("en-US")} leads before we scale
1173
1176
 
@@ -1195,7 +1198,7 @@ Approval card should say:
1195
1198
  message,
1196
1199
  recommendedPostCount: recommendedCount,
1197
1200
  estimatedEngagers: scrapePlan.estimatedEngagers,
1198
- targetEngagerCount: effectiveTargetEngagerCount,
1201
+ targetEngagerCount: explicitTargetEngagerCount ?? null,
1199
1202
  };
1200
1203
  }
1201
1204
  function hasUsableSignalValidationPost(post) {
@@ -2114,7 +2117,7 @@ export const leadToolDefinitions = [
2114
2117
  },
2115
2118
  targetEngagerCount: {
2116
2119
  type: "number",
2117
- description: "Signal Discovery: target number of people from selected posts to check. Default planning target is about 300 likely prospects at a 20% starting pass assumption, or about 1500 people to check. Use real sample math when available: target likely prospects divided by sampled pass rate. If the sampled/projected fit rate is below the 10% planning floor, switch to the next provider instead of scaling noisy post reactions. Limits selected posts before starting scrape, with a backend hard cap of 10 posts.",
2120
+ description: "Signal Discovery: optional explicit target number of people from selected posts to check. If omitted, import all selected posts up to backend Signal Discovery caps. Use only when the approved source plan has real sample math: target likely prospects divided by sampled pass rate. If the sampled/projected fit rate is below the 10% planning floor, switch to the next provider instead of scaling noisy post reactions. When provided, this can limit selected posts before starting scrape, with a backend hard cap of 10 posts.",
2118
2121
  },
2119
2122
  maxPostsToScrape: {
2120
2123
  type: "number",
@@ -2198,6 +2201,15 @@ export const leadToolDefinitions = [
2198
2201
  type: "number",
2199
2202
  description: "Number of campaign rows to use as the initial review/process sample. Defaults to 15.",
2200
2203
  },
2204
+ sourceRowIds: {
2205
+ type: "array",
2206
+ items: { type: "string" },
2207
+ description: "Optional exact source WorkflowTableRow ids to copy from the selected source lead list. Use only for bounded refill same-source copy packets.",
2208
+ },
2209
+ sourceRowLimit: {
2210
+ type: "number",
2211
+ description: "Optional cap for copying the first N source rows. Prefer sourceRowIds when a refill packet provides exact ids.",
2212
+ },
2201
2213
  allowPartialSourceList: {
2202
2214
  type: "boolean",
2203
2215
  description: "Explicit override for user-approved early continuation. Default false. When true, confirm_lead_list may copy the currently materialized rows from a still-running source import; use only after the user explicitly asks to keep going with the partial list.",
@@ -2263,7 +2275,7 @@ export const leadToolDefinitions = [
2263
2275
  },
2264
2276
  targetEngagerCount: {
2265
2277
  type: "number",
2266
- description: "Optional source-candidate target from sample math. When provided, the recommendation ranks selected posts by scrapable engagement and asks approval for only enough posts to cover this target. If omitted, uses the default Signal Discovery source target.",
2278
+ description: "Optional source-candidate target from sample math. When provided, the recommendation ranks selected posts by scrapable engagement and asks approval for only enough posts to cover this target. If omitted, all selected posts are recommended up to backend Signal Discovery caps.",
2267
2279
  },
2268
2280
  maxPostsToScrape: {
2269
2281
  type: "number",
@@ -3793,9 +3805,7 @@ export async function importLeads(input) {
3793
3805
  : undefined;
3794
3806
  // === SIGNAL DISCOVERY FLOW ===
3795
3807
  if (provider === "signal-discovery") {
3796
- const defaultSignalTargetEngagers = getSignalDiscoverySourcePlanDefaults().sourceCandidateTarget;
3797
- const effectiveTargetEngagerCount = normalizePositiveInteger(targetEngagerCount) ??
3798
- defaultSignalTargetEngagers;
3808
+ const effectiveTargetEngagerCount = normalizePositiveInteger(targetEngagerCount) ?? null;
3799
3809
  // Get selected posts from the campaign's signal search tabs
3800
3810
  // Note: API returns flat fields (postUrl, postContent, authorName, etc.)
3801
3811
  const tabsResponse = await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
@@ -3843,7 +3853,7 @@ export async function importLeads(input) {
3843
3853
  throw new Error(`Maximum ${MAX_SIGNAL_DISCOVERY_POSTS} Signal Discovery posts can be imported for scraping. ${uniqueSelectedPosts.length} unique posts are currently selected; reduce the selected posts to the strongest ${MAX_SIGNAL_DISCOVERY_POSTS} before calling import_leads.`);
3844
3854
  }
3845
3855
  let importSelection = selectSignalPostsForImport(uniqueSelectedPosts, {
3846
- targetEngagerCount: effectiveTargetEngagerCount,
3856
+ targetEngagerCount: effectiveTargetEngagerCount ?? undefined,
3847
3857
  maxPostsToScrape,
3848
3858
  });
3849
3859
  let postsToScrape = importSelection.posts;
@@ -3876,7 +3886,7 @@ export async function importLeads(input) {
3876
3886
  }
3877
3887
  if (invalidPlannedPosts.length > 0 && !allowInvalidSignalPosts) {
3878
3888
  const validImportSelection = selectSignalPostsForImport(postValidation.validPosts, {
3879
- targetEngagerCount: effectiveTargetEngagerCount,
3889
+ targetEngagerCount: effectiveTargetEngagerCount ?? undefined,
3880
3890
  maxPostsToScrape,
3881
3891
  });
3882
3892
  const validRecommendedCount = validImportSelection.posts.length;
@@ -3915,7 +3925,7 @@ export async function importLeads(input) {
3915
3925
  }
3916
3926
  if (allowInvalidSignalPosts && postValidation.invalidPosts.length > 0) {
3917
3927
  importSelection = selectSignalPostsForImport(postValidation.validPosts, {
3918
- targetEngagerCount: effectiveTargetEngagerCount,
3928
+ targetEngagerCount: effectiveTargetEngagerCount ?? undefined,
3919
3929
  maxPostsToScrape,
3920
3930
  });
3921
3931
  postsToScrape = importSelection.posts;
@@ -4126,7 +4136,7 @@ export async function cancelLeadImport(input) {
4126
4136
  }
4127
4137
  export async function confirmLeadList(input) {
4128
4138
  const api = getApi();
4129
- const { campaignOfferId, currentStep, confirmed, sourceLeadListId, campaignName, keepInSync, jobId, reviewBatchLimit, includeRawImportResult, allowPartialSourceList, targetLeadCount, } = input;
4139
+ const { campaignOfferId, currentStep, confirmed, sourceLeadListId, campaignName, keepInSync, jobId, reviewBatchLimit, includeRawImportResult, allowPartialSourceList, targetLeadCount, sourceRowIds, sourceRowLimit, } = input;
4130
4140
  assertInteractionApproval({
4131
4141
  campaignId: campaignOfferId,
4132
4142
  action: "confirm-lead-list",
@@ -4328,6 +4338,8 @@ export async function confirmLeadList(input) {
4328
4338
  campaignName,
4329
4339
  keepInSync,
4330
4340
  currentStep: null,
4341
+ sourceRowIds,
4342
+ sourceRowLimit,
4331
4343
  })
4332
4344
  .catch((error) => {
4333
4345
  if (isTerminalAccessError(error)) {
@@ -373,7 +373,7 @@ export function getPostFindLeadsScoutRegistry() {
373
373
  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.',
374
374
  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.",
375
375
  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.',
376
- 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" }), 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. 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, approval, start, or fallback. 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/start 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.`,
376
+ 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" }), 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/read-only wait. 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/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.`,
377
377
  },
378
378
  };
379
379
  }
@@ -159,6 +159,15 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
159
159
  attemptedSenderIds?: undefined;
160
160
  targetPlanReread?: undefined;
161
161
  };
162
+ yoloExecution: {
163
+ enabled: false;
164
+ status: "not_run_without_yolo";
165
+ selectedAction: null;
166
+ targetPlanReread: false;
167
+ result?: undefined;
168
+ refusalReason?: undefined;
169
+ postActionFirstAction?: undefined;
170
+ };
162
171
  command: string;
163
172
  tool: string;
164
173
  promptName: string;
@@ -225,6 +234,7 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
225
234
  } | {
226
235
  targetPlan: unknown;
227
236
  targetPlanBeforePaidRefresh: unknown;
237
+ targetPlanBeforeYoloPrimitive: unknown;
228
238
  autoPaidInmailRefresh: {
229
239
  enabled: boolean;
230
240
  status: string;
@@ -242,6 +252,23 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
242
252
  targetPlanReread: boolean;
243
253
  note: string;
244
254
  };
255
+ yoloExecution: {
256
+ enabled: true;
257
+ status: "skipped_after_paid_refresh";
258
+ selectedAction: null;
259
+ targetPlanReread: true;
260
+ result?: undefined;
261
+ refusalReason?: undefined;
262
+ postActionFirstAction?: undefined;
263
+ } | {
264
+ enabled: true;
265
+ status: "no_action" | "read_only_reread" | "executed_and_reread" | "refused";
266
+ selectedAction: Record<string, unknown> | null;
267
+ result: unknown;
268
+ targetPlanReread: boolean;
269
+ refusalReason: string | undefined;
270
+ postActionFirstAction: Record<string, unknown> | null;
271
+ };
245
272
  command: string;
246
273
  tool: string;
247
274
  promptName: string;