@sellable/mcp 0.1.469 → 0.1.471

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.
package/dist/server.js CHANGED
@@ -11,6 +11,7 @@ import { fillCampaignHorizon } from "./tools/campaign-horizon-fill.js";
11
11
  import { cancelPrepareCampaignMessages, getPrepareCampaignMessagesStatus, startPrepareCampaignMessages, } from "./tools/campaign-message-preparation.js";
12
12
  import { getCampaignRefillState } from "./tools/campaign-refill-state.js";
13
13
  import { getRefillTargetPlan } from "./tools/refill-target-plan.js";
14
+ import { getSchedulerFillCapacity } from "./tools/scheduler-fill-capacity.js";
14
15
  import { getCampaignTableSchema, queueCampaignCells, recordCampaignReviewBatch, reviseMessageTemplateAndRerun, selectCampaignCells, waitForCampaignProcessing, } from "./tools/campaign-processing.js";
15
16
  import { archiveCampaign, createCampaign, duplicateCampaign, getCampaign, getCampaignMessagesPreview, getCampaigns, pauseCampaign, startCampaign, updateCampaign, updateCampaignBrief, } from "./tools/campaigns.js";
16
17
  import { queueCells, updateCell } from "./tools/cells.js";
@@ -225,6 +226,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
225
226
  case "get_refill_target_plan":
226
227
  result = await getRefillTargetPlan(args);
227
228
  break;
229
+ case "get_scheduler_fill_capacity":
230
+ result = await getSchedulerFillCapacity(args);
231
+ break;
228
232
  case "refill_sends":
229
233
  result = refillSendsCommand(args);
230
234
  break;
@@ -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 horizon is a two-send-day horizon: two sender-local send days, 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 horizon 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. 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 horizon saturation ledger, and keep going until projected coverage (sent + scheduled) fills the requested horizon 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, 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. 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 requested horizon. 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. 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. 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
  }
@@ -7,6 +7,7 @@ type RefillSendsCommandInput = {
7
7
  senderNames?: string[];
8
8
  horizonSendDays?: number;
9
9
  untilDate?: string;
10
+ targetDate?: string;
10
11
  campaignId?: string;
11
12
  tableId?: string;
12
13
  intent?: RefillSendsIntent;
@@ -54,6 +55,11 @@ export declare const refillSendsToolDefinitions: {
54
55
  pattern: string;
55
56
  description: string;
56
57
  };
58
+ targetDate: {
59
+ type: string;
60
+ pattern: string;
61
+ description: string;
62
+ };
57
63
  campaignId: {
58
64
  type: string;
59
65
  description: string;
@@ -84,17 +90,29 @@ export declare function refillSendsCommand(input?: RefillSendsCommandInput): {
84
90
  workflowPromptName: string;
85
91
  yolo: boolean;
86
92
  intent: RefillSendsIntent;
93
+ targetDate: string | null;
87
94
  untilDate: string | null;
88
95
  horizonSendDays: number | null;
89
96
  fillWindow: {
97
+ mode: string;
98
+ targetDate: string;
99
+ description: string;
100
+ untilDate?: undefined;
101
+ horizonSendDays?: undefined;
102
+ horizonHours?: undefined;
103
+ } | {
90
104
  mode: string;
91
105
  untilDate: string;
92
106
  description: string;
107
+ targetDate?: undefined;
93
108
  horizonSendDays?: undefined;
109
+ horizonHours?: undefined;
94
110
  } | {
95
111
  mode: string;
96
112
  horizonSendDays: number | null;
113
+ horizonHours: number | null;
97
114
  description: string;
115
+ targetDate?: undefined;
98
116
  untilDate?: undefined;
99
117
  };
100
118
  approvalMode: RefillSendsApprovalMode;
@@ -119,6 +137,7 @@ export declare function refillSendsCommand(input?: RefillSendsCommandInput): {
119
137
  senders: string[];
120
138
  senderIds: string[];
121
139
  senderNames: string[];
140
+ targetDate: string | null;
122
141
  untilDate: string | null;
123
142
  horizonSendDays: number | null;
124
143
  campaignId: string | undefined;
@@ -1,4 +1,4 @@
1
- const DEFAULT_HORIZON_SEND_DAYS = 2;
1
+ const DEFAULT_SCHEDULER_FORWARD_HOURS = 48;
2
2
  function normalizeStrings(values) {
3
3
  if (!Array.isArray(values))
4
4
  return [];
@@ -9,9 +9,10 @@ function normalizeStrings(values) {
9
9
  ];
10
10
  }
11
11
  function normalizeHorizonSendDays(value) {
12
- if (typeof value !== "number" || !Number.isFinite(value)) {
13
- return DEFAULT_HORIZON_SEND_DAYS;
14
- }
12
+ if (value === undefined || value === null)
13
+ return null;
14
+ if (typeof value !== "number" || !Number.isFinite(value))
15
+ return null;
15
16
  return Math.max(1, Math.min(7, Math.floor(value)));
16
17
  }
17
18
  function normalizeUntilDate(value) {
@@ -33,6 +34,25 @@ function normalizeUntilDate(value) {
33
34
  }
34
35
  return trimmed;
35
36
  }
37
+ function normalizeTargetDate(value) {
38
+ if (value === undefined || value === null || value === "")
39
+ return null;
40
+ if (typeof value !== "string") {
41
+ throw new Error("targetDate must be a string in YYYY-MM-DD format.");
42
+ }
43
+ const trimmed = value.trim();
44
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
45
+ throw new Error("targetDate must use YYYY-MM-DD format.");
46
+ }
47
+ const [year, month, day] = trimmed.split("-").map((part) => Number(part));
48
+ const parsed = new Date(Date.UTC(year, month - 1, day));
49
+ if (parsed.getUTCFullYear() !== year ||
50
+ parsed.getUTCMonth() !== month - 1 ||
51
+ parsed.getUTCDate() !== day) {
52
+ throw new Error("targetDate must be a valid calendar date.");
53
+ }
54
+ return trimmed;
55
+ }
36
56
  export const refillSendsToolDefinitions = [
37
57
  {
38
58
  name: "refill_sends",
@@ -63,12 +83,17 @@ export const refillSendsToolDefinitions = [
63
83
  type: "number",
64
84
  minimum: 1,
65
85
  maximum: 7,
66
- description: "Number of sender-local send days to fill. Defaults to 2 when untilDate is not provided.",
86
+ description: "Compatibility override for an explicit sender-local send-day horizon. Omit for the default scheduler-forward 48-hour target window.",
67
87
  },
68
88
  untilDate: {
69
89
  type: "string",
70
90
  pattern: "^\\d{4}-\\d{2}-\\d{2}$",
71
- description: "Optional sender-local YYYY-MM-DD date to fill through, inclusive. Overrides the default two send-day horizon.",
91
+ description: "Optional sender-local YYYY-MM-DD date to fill through, inclusive. Overrides the default scheduler-forward 48-hour target window.",
92
+ },
93
+ targetDate: {
94
+ type: "string",
95
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
96
+ description: "Optional exact sender-local YYYY-MM-DD date to fill. This prepares rows only for scheduler-fillable slots on that date and is distinct from untilDate.",
72
97
  },
73
98
  campaignId: {
74
99
  type: "string",
@@ -100,8 +125,9 @@ export function refillSendsCommand(input = {}) {
100
125
  const senderNames = normalizeStrings(input.senderNames);
101
126
  const hasSenderSelectors = senders.length > 0 || senderIds.length > 0 || senderNames.length > 0;
102
127
  const yolo = input.yolo === true;
103
- const untilDate = normalizeUntilDate(input.untilDate);
104
- const horizonSendDays = untilDate
128
+ const targetDate = normalizeTargetDate(input.targetDate);
129
+ const untilDate = targetDate ? null : normalizeUntilDate(input.untilDate);
130
+ const horizonSendDays = targetDate || untilDate
105
131
  ? null
106
132
  : normalizeHorizonSendDays(input.horizonSendDays);
107
133
  const intent = input.intent ?? "plain";
@@ -118,19 +144,31 @@ export function refillSendsCommand(input = {}) {
118
144
  workflowPromptName: "refill-sends-workflow",
119
145
  yolo,
120
146
  intent,
147
+ targetDate,
121
148
  untilDate,
122
149
  horizonSendDays,
123
- fillWindow: untilDate
150
+ fillWindow: targetDate
124
151
  ? {
125
- mode: "until_date",
126
- untilDate,
127
- description: "Fill through this sender-local date inclusive, skipping no-send days and never extending beyond the date without a new packet.",
152
+ mode: "target_date",
153
+ targetDate,
154
+ description: "Fill only this sender-local date by preparing rows for scheduler-fillable slots on that date.",
128
155
  }
129
- : {
130
- mode: "horizon_send_days",
131
- horizonSendDays,
132
- description: "Fill the default bounded horizon by sender-local send days.",
133
- },
156
+ : untilDate
157
+ ? {
158
+ mode: "until_date",
159
+ untilDate,
160
+ description: "Fill through this sender-local date inclusive, skipping no-send days and never extending beyond the date without a new packet.",
161
+ }
162
+ : {
163
+ mode: horizonSendDays === null
164
+ ? "scheduler_forward_48h"
165
+ : "horizon_send_days",
166
+ horizonSendDays,
167
+ horizonHours: horizonSendDays === null ? DEFAULT_SCHEDULER_FORWARD_HOURS : null,
168
+ description: horizonSendDays === null
169
+ ? "Fill the default scheduler-forward 48-hour target window."
170
+ : "Fill the explicit compatibility horizon by sender-local send days.",
171
+ },
134
172
  approvalMode,
135
173
  campaignId: input.campaignId ?? null,
136
174
  tableId: input.tableId ?? null,
@@ -147,25 +185,33 @@ export function refillSendsCommand(input = {}) {
147
185
  ? `, senderIds: ${JSON.stringify(senderIds)}`
148
186
  : ""}${senderNames.length > 0
149
187
  ? `, senderNames: ${JSON.stringify(senderNames)}`
150
- : ""}${senders.length > 0 ? `, senders: ${JSON.stringify(senders)}` : ""}${untilDate
151
- ? `, untilDate: "${untilDate}"`
152
- : `, horizonSendDays: ${horizonSendDays}`}, approvalMode: "${approvalMode}" }) before any import, prep, approval, start, or schedule-affecting action.`,
188
+ : ""}${senders.length > 0 ? `, senders: ${JSON.stringify(senders)}` : ""}${targetDate
189
+ ? `, targetDate: "${targetDate}"`
190
+ : untilDate
191
+ ? `, untilDate: "${untilDate}"`
192
+ : horizonSendDays === null
193
+ ? ""
194
+ : `, horizonSendDays: ${horizonSendDays}`}, approvalMode: "${approvalMode}" }) before any import, prep, approval, start, or schedule-affecting action.`,
153
195
  "If get_refill_target_plan returns status complete, report eligible sender ledger, gross target, selected days, sent count, scheduled count, projected count, campaign ids, targetShapeRevision, and no-op proof without asking for approval.",
154
196
  "Refill target lanes are only connection invites (send_invite) or paid InMails (send_inmail_closed). Do not count send_dm or send_inmail_open as horizon target capacity; they may exist in sequences, but the planner must pick the refill lane from the most recent active campaign-backed send evidence for each sender.",
155
197
  "If remainingReadyOrProjectedGap is 0 but remainingProjectedGap is positive, run only a persistent read-only scheduler wait/reread loop; do not ask for prep/import/approval and do not close out while scheduler pickup is the only remaining state.",
156
198
  `Resolve route with resolve_campaign_fill_route({ intent: "${intent}"${input.campaignId ? `, campaignId: "${input.campaignId}"` : ""}${input.tableId ? `, tableId: "${input.tableId}"` : ""} }).`,
157
199
  'If the plain route shows stale managed waterfall evidence, archived/completed shared slots, or targets that do not cover the selected sender set, immediately call resolve_campaign_fill_route({ intent: "active" }) and inspect current dashboard-active ACTIVE/PAUSED campaign-backed sequence campaigns before declaring a sender blocked.',
158
200
  "Call list_senders and get_sender_routing, then resolve sender selectors against active enrolled campaign-backed sequence senders.",
159
- untilDate
160
- ? `Use fill window untilDate="${untilDate}" as the inclusive sender-local through date; do not extend beyond that date without a new approval packet.`
161
- : `Use the default fill window of ${horizonSendDays} sender-local send days.`,
201
+ targetDate
202
+ ? `Use fill window targetDate="${targetDate}" as one exact sender-local date; prepare rows only for scheduler-fillable slots on that date. Do not treat it as an inclusive through-date.`
203
+ : untilDate
204
+ ? `Use fill window untilDate="${untilDate}" as the inclusive sender-local through date; do not extend beyond that date without a new approval packet.`
205
+ : horizonSendDays === null
206
+ ? "Use the default scheduler-forward 48-hour target window from get_refill_target_plan; do not reinterpret it as two calendar days from today."
207
+ : `Use the explicit compatibility fill window of ${horizonSendDays} sender-local send days.`,
162
208
  "Read get_campaign_refill_state for enough exact candidate campaigns to pick the best per-sender target by recent/future scheduler-owned sends, then recent result evidence, then source health.",
163
209
  "Treat current dashboard-active PAUSED campaign-backed sequence campaigns as start-eligible candidates: read refill state before deciding whether to prep, approve, start, or skip.",
164
210
  "Fresh reread get_campaign_refill_state immediately before any import, prep, approval, or horizon-fill mutation.",
165
- "Maintain a target-led horizon saturation ledger per selected sender from get_refill_target_plan: selected days, gross capacity, actual sent counts, future scheduler-owned scheduled counts, projected counts, ready-to-schedule buffer, remaining projected gap, paid InMail threshold feasibility, targetShapeRevision, stateRevision, and next MCP primitive.",
211
+ "Maintain a target-window saturation ledger per selected sender from get_refill_target_plan: selected days, gross capacity, actual sent counts, future scheduler-owned scheduled counts, projected counts, ready-to-schedule buffer, remaining projected gap, paid InMail threshold feasibility, targetShapeRevision, stateRevision, and next MCP primitive.",
166
212
  "If paid InMail feasibility is below threshold, stale, or missing, report the exact sender/campaign/table/column threshold action or connection fallback; --yolo must not lower paid InMail thresholds or create campaigns.",
167
213
  "In --yolo or after one Accept, continue through every safe selected sender/campaign action covered by the rendered target packet; sent/scheduled-count progress changes stateRevision and should continue while targetShapeRevision is stable.",
168
- "Do not complete a fill/schedule request until a final get_refill_target_plan or refill-state reread proves projected coverage (sent + scheduled) fills the horizon. Treat awaiting_scheduler_after_ready_buffer as in-progress when ready buffer covers the gap; keep polling unless Christian stops/statuses the run or a concrete non-scheduler blocker such as paid_inmail_below_threshold appears.",
214
+ "Do not complete a fill/schedule request until a final get_refill_target_plan or refill-state reread proves projected coverage (sent + scheduled) fills the scheduler-forward target window. Treat awaiting_scheduler_after_ready_buffer as loaded, awaiting scheduler when ready buffer covers the gap; do not import/prep more rows in that state, and keep polling unless Christian stops/statuses the run or a concrete non-scheduler blocker such as paid_inmail_below_threshold appears.",
169
215
  ],
170
216
  approvalContract: yolo
171
217
  ? "Auto-accept only the rendered bounded refill target packet after get_refill_target_plan and fresh reread. Continue through every safe apply/prep/start action inside that packet, including start_campaign only for exact selected PAUSED campaign-backed sequence refill targets named in the packet. After each action, rerun get_refill_target_plan; keep going while targetShapeRevision is stable and projected coverage (sent + scheduled) progresses toward the target, even though stateRevision changes. Ready-to-schedule rows are buffer, not completion. If ready buffer covers the projected gap, use only persistent read-only scheduler wait/reread and keep the run open until projected coverage fills or Christian stops/statuses it. Stop immediately if targetShapeRevision changes because sender set, route, ids, caps, dates, blockers, action class, paid InMail threshold feasibility, or side-effect class drifts. --yolo does not authorize lowering paid InMail thresholds or creating connection campaigns."
@@ -186,11 +232,13 @@ export function refillSendsCommand(input = {}) {
186
232
  hostExamples: {
187
233
  claude: [
188
234
  "/sellable:refill-sends --yolo",
235
+ "/sellable:refill-sends --yolo --target-date 2026-07-01",
189
236
  "/sellable:refill-sends --yolo --until 2026-06-30",
190
237
  '/sellable:refill-sends --sender "Christian Reyes" --sender "Thomas Nobbs"',
191
238
  ],
192
239
  codex: [
193
240
  "$sellable:refill-sends --yolo",
241
+ "$sellable:refill-sends --yolo --target-date 2026-07-01",
194
242
  "$sellable:refill-sends --yolo --until 2026-06-30",
195
243
  '$sellable:refill-sends --sender "Christian Reyes" --sender "Thomas Nobbs"',
196
244
  ],
@@ -201,6 +249,7 @@ export function refillSendsCommand(input = {}) {
201
249
  senders,
202
250
  senderIds,
203
251
  senderNames,
252
+ targetDate,
204
253
  untilDate,
205
254
  horizonSendDays,
206
255
  campaignId: input.campaignId,
@@ -4,6 +4,7 @@ type GetRefillTargetPlanInput = {
4
4
  intent?: RefillTargetPlanIntent;
5
5
  horizonSendDays?: number;
6
6
  untilDate?: string;
7
+ targetDate?: string;
7
8
  campaignId?: string;
8
9
  tableId?: string;
9
10
  senderIds?: string[];
@@ -34,6 +35,11 @@ export declare const refillTargetPlanToolDefinitions: {
34
35
  pattern: string;
35
36
  description: string;
36
37
  };
38
+ targetDate: {
39
+ type: string;
40
+ pattern: string;
41
+ description: string;
42
+ };
37
43
  campaignId: {
38
44
  type: string;
39
45
  description: string;
@@ -89,7 +89,7 @@ function sanitizeActionCandidates(candidates, selectedKeys, status, remainingRea
89
89
  !filtered.some((item) => item.type === "wait_for_scheduler")) {
90
90
  filtered.push({
91
91
  type: "wait_for_scheduler",
92
- reason: "ready buffer covers the projected target gap but scheduledFor coverage is still short",
92
+ reason: "loaded, awaiting scheduler: ready buffer covers the projected target gap but scheduledFor coverage is still short",
93
93
  });
94
94
  }
95
95
  return filtered;
@@ -232,7 +232,7 @@ function sanitizeRefillTargetPlanResult(result) {
232
232
  export const refillTargetPlanToolDefinitions = [
233
233
  {
234
234
  name: "get_refill_target_plan",
235
- description: "read-only refill target planner to call before any refill mutation. It identifies eligible senders and infers one implicit refill lane per sender: connection invites or paid InMails, chosen from future scheduled, recent scheduled, and ready-to-schedule evidence in active campaign-backed sequence campaigns before falling back to campaign sequences. DMs and open-profile InMails are follow-up sequence actions, not refill target lanes. The planner computes selected sender-local days, gross target, actual sent coverage, scheduler-owned scheduled coverage, projected coverage (sent + scheduled), ready buffer, remaining projected gap, paid InMail credit/threshold feasibility, bounded action candidates, and targetRevision drift proof. This tool does not create rows, import leads, prepare messages, approve messages, does not schedule sends, start campaigns, lower paid InMail thresholds, create campaigns, launch, spend InMail credits, or write scheduler fields. Complete projected targets no-op without approval; incomplete targets must be followed by a bounded approval packet.",
235
+ description: "read-only refill target planner to call before any refill mutation. It identifies eligible senders and infers one implicit refill lane per sender: connection invites or paid InMails, chosen from future scheduled, recent scheduled, and ready-to-schedule evidence in active campaign-backed sequence campaigns before falling back to campaign sequences. DMs and open-profile InMails are follow-up sequence actions, not refill target lanes. By default the planner computes the scheduler-forward 48-hour target window, selected sender-local days whose sending windows overlap that window, gross target, actual sent coverage, scheduler-owned scheduled coverage, projected coverage (sent + scheduled), ready buffer, remaining projected gap, paid InMail credit/threshold feasibility, bounded action candidates, and targetRevision drift proof. This tool does not create rows, import leads, prepare messages, approve messages, does not schedule sends, start campaigns, lower paid InMail thresholds, create campaigns, launch, spend InMail credits, or write scheduler fields. Complete projected targets no-op without approval; loaded, awaiting scheduler targets use read-only wait/reread until projected coverage fills.",
236
236
  inputSchema: {
237
237
  type: "object",
238
238
  properties: {
@@ -245,12 +245,17 @@ export const refillTargetPlanToolDefinitions = [
245
245
  type: "number",
246
246
  minimum: 1,
247
247
  maximum: 7,
248
- description: "Calendar-day refill horizon to inspect from the sender-local current day. Defaults to 2 when untilDate is not provided; no-send days contribute zero target.",
248
+ description: "Compatibility override for explicit sender-local send-day horizon planning. Omit for the default scheduler-forward 48-hour target window; no-send days contribute zero target.",
249
249
  },
250
250
  untilDate: {
251
251
  type: "string",
252
252
  pattern: "^\\d{4}-\\d{2}-\\d{2}$",
253
- description: "Optional sender-local YYYY-MM-DD date to inspect through, inclusive.",
253
+ description: "Optional sender-local YYYY-MM-DD date to inspect through, inclusive. Overrides the default scheduler-forward 48-hour target window.",
254
+ },
255
+ targetDate: {
256
+ type: "string",
257
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
258
+ description: "Optional exact sender-local YYYY-MM-DD date to fill. Distinct from untilDate: targetDate asks how many scheduler-fillable slots exist on only this date.",
254
259
  },
255
260
  campaignId: {
256
261
  type: "string",
@@ -299,6 +304,7 @@ export async function getRefillTargetPlan(input = {}) {
299
304
  intent: input.intent,
300
305
  horizonSendDays: input.horizonSendDays,
301
306
  untilDate: input.untilDate,
307
+ targetDate: input.targetDate,
302
308
  campaignId: input.campaignId,
303
309
  tableId: input.tableId,
304
310
  senderIds: input.senderIds,
@@ -660,6 +660,55 @@ export declare const allTools: ({
660
660
  additionalProperties: boolean;
661
661
  required?: undefined;
662
662
  };
663
+ } | {
664
+ name: string;
665
+ description: string;
666
+ inputSchema: {
667
+ type: string;
668
+ properties: {
669
+ capacityRequests: {
670
+ type: string;
671
+ minItems: number;
672
+ items: {
673
+ type: string;
674
+ properties: {
675
+ senderId: {
676
+ type: string;
677
+ description: string;
678
+ };
679
+ actionType: {
680
+ type: string;
681
+ enum: string[];
682
+ description: string;
683
+ };
684
+ cellId: {
685
+ type: string;
686
+ description: string;
687
+ };
688
+ columnId: {
689
+ type: string;
690
+ description: string;
691
+ };
692
+ };
693
+ required: string[];
694
+ additionalProperties: boolean;
695
+ };
696
+ description: string;
697
+ };
698
+ targetDate: {
699
+ type: string;
700
+ pattern: string;
701
+ description: string;
702
+ };
703
+ mode: {
704
+ type: string;
705
+ enum: string[];
706
+ description: string;
707
+ };
708
+ };
709
+ required: string[];
710
+ additionalProperties: boolean;
711
+ };
663
712
  } | {
664
713
  name: string;
665
714
  description: string;
@@ -37,6 +37,7 @@ import { refillTargetPlanToolDefinitions } from "./refill-target-plan.js";
37
37
  import { refillSendsToolDefinitions } from "./refill-sends.js";
38
38
  import { rowToolDefinitions } from "./rows.js";
39
39
  import { rubricToolDefinitions } from "./rubrics.js";
40
+ import { schedulerFillCapacityToolDefinitions } from "./scheduler-fill-capacity.js";
40
41
  import { senderRoutingToolDefinitions } from "./sender-routing.js";
41
42
  import { senderToolDefinitions } from "./senders.js";
42
43
  import { sequencerToolDefinitions } from "./sequencer.js";
@@ -52,6 +53,7 @@ export const allTools = [
52
53
  ...campaignFillRoutingToolDefinitions,
53
54
  ...campaignRefillStateToolDefinitions,
54
55
  ...refillTargetPlanToolDefinitions,
56
+ ...schedulerFillCapacityToolDefinitions,
55
57
  ...refillSendsToolDefinitions,
56
58
  ...setupEvergreenCampaignsToolDefinitions,
57
59
  ...campaignHorizonFillToolDefinitions,
@@ -0,0 +1,65 @@
1
+ type SchedulerFillCapacityActionType = "send_invite" | "send_inmail_closed" | "send_inmail_open" | "send_dm" | "react_and_comment";
2
+ type SchedulerFillCapacityMode = "default_horizon" | "target_date";
3
+ type SchedulerFillCapacityRequest = {
4
+ senderId: string;
5
+ actionType: SchedulerFillCapacityActionType;
6
+ cellId?: string;
7
+ columnId?: string;
8
+ };
9
+ type GetSchedulerFillCapacityInput = {
10
+ capacityRequests: SchedulerFillCapacityRequest[];
11
+ targetDate?: string;
12
+ mode?: SchedulerFillCapacityMode;
13
+ };
14
+ export declare const schedulerFillCapacityToolDefinitions: {
15
+ name: string;
16
+ description: string;
17
+ inputSchema: {
18
+ type: string;
19
+ properties: {
20
+ capacityRequests: {
21
+ type: string;
22
+ minItems: number;
23
+ items: {
24
+ type: string;
25
+ properties: {
26
+ senderId: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ actionType: {
31
+ type: string;
32
+ enum: string[];
33
+ description: string;
34
+ };
35
+ cellId: {
36
+ type: string;
37
+ description: string;
38
+ };
39
+ columnId: {
40
+ type: string;
41
+ description: string;
42
+ };
43
+ };
44
+ required: string[];
45
+ additionalProperties: boolean;
46
+ };
47
+ description: string;
48
+ };
49
+ targetDate: {
50
+ type: string;
51
+ pattern: string;
52
+ description: string;
53
+ };
54
+ mode: {
55
+ type: string;
56
+ enum: string[];
57
+ description: string;
58
+ };
59
+ };
60
+ required: string[];
61
+ additionalProperties: boolean;
62
+ };
63
+ }[];
64
+ export declare function getSchedulerFillCapacity(input: GetSchedulerFillCapacityInput): Promise<unknown>;
65
+ export {};
@@ -0,0 +1,70 @@
1
+ import { getApi } from "../api.js";
2
+ async function postSchedulerFillCapacity(body) {
3
+ const api = getApi();
4
+ return api.post("/api/v3/mcp/scheduler-fill-capacity", body);
5
+ }
6
+ export const schedulerFillCapacityToolDefinitions = [
7
+ {
8
+ name: "get_scheduler_fill_capacity",
9
+ description: "read-only scheduler capacity query for refill-sends before any refill mutation. It asks the product scheduler model how many additional cells the scheduler will try to place for exact sender/action requests, using the default scheduler-forward horizon or one exact targetDate. It returns scheduler-fillable slots, occupied scheduled/processing slots, sender sendability gates, cooldowns, Sales Navigator status for paid InMail, cached paid-InMail credit feasibility, threshold source, blockers, warnings, and explicit sideEffects false. This tool does not create rows, import leads, prepare messages, approve messages, does not schedule sends, does not refresh paid InMail credits, mutate thresholds, start campaigns, launch, or send. Use exact senderId values only; never pass sender names.",
10
+ inputSchema: {
11
+ type: "object",
12
+ properties: {
13
+ capacityRequests: {
14
+ type: "array",
15
+ minItems: 1,
16
+ items: {
17
+ type: "object",
18
+ properties: {
19
+ senderId: {
20
+ type: "string",
21
+ description: "Exact Sender.id to inspect. Do not pass sender names.",
22
+ },
23
+ actionType: {
24
+ type: "string",
25
+ enum: [
26
+ "send_invite",
27
+ "send_inmail_closed",
28
+ "send_inmail_open",
29
+ "send_dm",
30
+ "react_and_comment",
31
+ ],
32
+ description: "Exact scheduler action lane to inspect for this sender.",
33
+ },
34
+ cellId: {
35
+ type: "string",
36
+ description: "Optional exact WorkflowTableCell.id for paid-InMail threshold context. Invalid scoped ids block instead of falling back to defaults.",
37
+ },
38
+ columnId: {
39
+ type: "string",
40
+ description: "Optional exact WorkflowTableColumn.id for paid-InMail threshold context. Invalid scoped ids block instead of falling back to defaults.",
41
+ },
42
+ },
43
+ required: ["senderId", "actionType"],
44
+ additionalProperties: false,
45
+ },
46
+ description: "One or more exact sender/action capacity requests. Example: [{ senderId:'snd_...', actionType:'send_invite' }].",
47
+ },
48
+ targetDate: {
49
+ type: "string",
50
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
51
+ description: "Optional sender-local YYYY-MM-DD date to inspect. When present, the query uses target_date mode.",
52
+ },
53
+ mode: {
54
+ type: "string",
55
+ enum: ["default_horizon", "target_date"],
56
+ description: "Optional mode hint. Omit for default_horizon; target_date requires targetDate.",
57
+ },
58
+ },
59
+ required: ["capacityRequests"],
60
+ additionalProperties: false,
61
+ },
62
+ },
63
+ ];
64
+ export function getSchedulerFillCapacity(input) {
65
+ return postSchedulerFillCapacity({
66
+ capacityRequests: input.capacityRequests,
67
+ targetDate: input.targetDate,
68
+ mode: input.mode,
69
+ });
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.469",
3
+ "version": "0.1.471",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code and Codex campaign workflows",
6
6
  "main": "dist/index.js",
@@ -138,10 +138,10 @@ explicit user selection; it is never the default response to plain fill. When
138
138
  choosing among active targets, use refill-state scheduled-count evidence to
139
139
  continue the campaign that most recently had scheduler-owned sends for the
140
140
  relevant sender set; do not treat every active campaign as a refill candidate.
141
- In `--yolo` fill/refill mode, default to one best recent-send campaign and a
142
- two-send-day horizon: subtract future scheduler-owned scheduled sends and
143
- ready-to-schedule rows from healthy sender daily capacity, then prepare only
144
- that bounded gap.
141
+ In `--yolo` fill/refill mode, default to one best recent-send campaign and the
142
+ scheduler-forward 48-hour target window: subtract future scheduler-owned
143
+ scheduled sends and ready-to-schedule rows from healthy sender daily capacity,
144
+ then prepare only that bounded gap.
145
145
  When more leads are needed, the refill workflow must recommend same-campaign
146
146
  source-ladder replenishment first; do not create warm-post-engager side
147
147
  campaigns, on-demand campaigns, or unrelated campaigns. If same-source copy hits
@@ -5,6 +5,7 @@ visibility: public
5
5
  allowed-tools:
6
6
  - mcp__sellable__refill_sends
7
7
  - mcp__sellable__get_refill_target_plan
8
+ - mcp__sellable__get_scheduler_fill_capacity
8
9
  - mcp__sellable__refresh_paid_inmail_credits
9
10
  - mcp__sellable__get_auth_status
10
11
  - mcp__sellable__start_cli_login
@@ -70,17 +71,22 @@ Accepted invocation flags in the same user request:
70
71
  - `--sender <name-or-id>`: scope to a specific sender; repeat for multiple
71
72
  senders.
72
73
  - `--until <YYYY-MM-DD>`: fill through that sender-local date, inclusive,
73
- instead of the default two send-day horizon.
74
+ instead of the default scheduler-forward 48-hour target window.
75
+ - `--target-date <YYYY-MM-DD>`: fill only that sender-local date. This means
76
+ prepare rows for scheduler-fillable slots on that date, not every remaining
77
+ daily-limit slot and not an inclusive through-date.
74
78
  - `senderIds: <id>, <id>` or `senderNames: <name>, <name>`: explicit selector
75
79
  alternatives when the host preserves natural-language arguments better than
76
80
  shell-style flags.
77
81
  - `untilDate: YYYY-MM-DD`: explicit date selector alternative when the host
78
82
  preserves natural-language arguments better than shell-style flags.
83
+ - `targetDate: YYYY-MM-DD`: exact-date selector alternative when the host
84
+ preserves natural-language arguments better than shell-style flags.
79
85
 
80
86
  When the host can call typed MCP tools, start with:
81
87
 
82
88
  ```text
83
- refill_sends({ yolo?: boolean, senders?: string[], senderIds?: string[], senderNames?: string[], horizonSendDays?: number, untilDate?: "YYYY-MM-DD" })
89
+ refill_sends({ yolo?: boolean, senders?: string[], senderIds?: string[], senderNames?: string[], horizonSendDays?: number, untilDate?: "YYYY-MM-DD", targetDate?: "YYYY-MM-DD" })
84
90
  ```
85
91
 
86
92
  That command helper only normalizes arguments and returns the execution
@@ -99,10 +105,11 @@ resolver.
99
105
 
100
106
  Goal-mode continuation: a skill cannot create or invoke `/goal` by itself. When
101
107
  this command is already running inside an active Codex goal, keep that goal open
102
- until every selected sender lane is horizon-filled by projected coverage
103
- (`sent + scheduled`), Christian explicitly stops/statuses the run, or a concrete
104
- non-scheduler blocker appears. Do not call the goal complete or blocked only
105
- because the current state is `awaiting_scheduler_after_ready_buffer`.
108
+ until every selected sender lane is filled by projected coverage
109
+ (`sent + scheduled`) for the scheduler-forward target window, Christian
110
+ explicitly stops/statuses the run, or a concrete non-scheduler blocker appears.
111
+ Do not call the goal complete or blocked only because the current state is
112
+ `awaiting_scheduler_after_ready_buffer`; treat it as loaded, awaiting scheduler.
106
113
 
107
114
  Load the internal workflow prompt before taking any operational step:
108
115
 
@@ -136,6 +143,11 @@ two lanes to fill. If a stale target plan selects `send_dm` or
136
143
  `send_inmail_open`, stop and re-plan with the current planner before mutation.
137
144
  Short form: trust the target plan's inferred lane only when it is a
138
145
  connection-invite or paid-InMail refill lane.
146
+ For exact-date requests, pass `targetDate` to `get_refill_target_plan`. If you
147
+ need raw proof, call the read-only `get_scheduler_fill_capacity` query for the
148
+ same sender/action/date; it tells the MCP how many cells the product scheduler
149
+ will try to place and does not import, approve, schedule, refresh credits, or
150
+ mutate.
139
151
  If the target plan is complete by projected coverage, report that the selected
140
152
  target is already filled and no-op without asking for approval. If the ready
141
153
  buffer covers the projected gap but scheduled coverage is still short, keep the
@@ -210,32 +222,35 @@ return concrete continuation options with campaign names, exact ids, which optio
210
222
  is already covered by the current packet, and which option needs a new approval
211
223
  packet.
212
224
 
213
- For `--yolo` fill/schedule requests, completion means projected horizon
214
- saturation (`sent + scheduled`), not merely prepared/approved/ready rows.
215
- Maintain a horizon saturation ledger per selected sender: selected send days,
216
- gross capacity, actual sent cells, future scheduler-owned scheduled cells with
217
- non-null `scheduledFor`, projected count, ready-to-schedule buffer, remaining
218
- projected gap, paid-InMail feasibility, `targetShapeRevision`,
219
- `stateRevision`, and the next MCP primitive that can reduce the gap. After every
220
- apply/prep/start result, wait for processing, reread the target plan/refill
221
- state, recompute the ledger, then keep applying safe bounded actions until
222
- projected coverage fills the horizon or a concrete non-scheduler blocker is
223
- proven.
225
+ For `--yolo` fill/schedule requests, completion means projected saturation
226
+ (`sent + scheduled`) for the scheduler-forward target window, not merely
227
+ prepared/approved/ready rows. Maintain a target-window saturation ledger per
228
+ selected sender: selected send days, gross capacity, actual sent cells, future
229
+ scheduler-owned scheduled cells with non-null `scheduledFor`, projected count,
230
+ ready-to-schedule buffer, remaining projected gap, paid-InMail feasibility,
231
+ `targetShapeRevision`, `stateRevision`, and the next MCP primitive that can
232
+ reduce the gap. After every apply/prep/start result, wait for processing, reread
233
+ the target plan/refill state, recompute the ledger, then keep applying safe
234
+ bounded actions until projected coverage fills the target window or a concrete
235
+ non-scheduler blocker is proven.
224
236
  If ready rows cover the projected gap but the scheduler has not picked them up
225
- yet, run the persistent read-only scheduler wait loop. Do not finish the refill
226
- goal, mark it complete, or mark it blocked only because it is still
227
- `awaiting_scheduler_after_ready_buffer`; keep waiting unless Christian stops the
228
- run or the host cannot continue.
229
-
230
- In `--yolo`, the default two-day fill horizon is two send days unless
231
- `--until`/`untilDate` is provided. If an until date is provided, compute bounded
232
- gaps through that sender-local date inclusive, skipping no-send days and never
233
- extending beyond that date without a new packet. For each target sender, compute
234
- the bounded gap from that sender's healthy daily capacity, existing future
235
- scheduler-owned scheduled sends, and rows already ready to schedule across
236
- active campaigns enrolled with that sender. Then pick the best same-sender
237
- campaign to fill the gap: prefer recent/future scheduler-owned sends for that
238
- sender, then strongest recent result evidence, then source health. Do not stop
237
+ yet, report loaded, awaiting scheduler and run the persistent read-only
238
+ scheduler wait loop. Do not finish the refill goal, mark it complete, or mark it
239
+ blocked only because it is still `awaiting_scheduler_after_ready_buffer`; keep
240
+ waiting unless Christian stops the run or the host cannot continue.
241
+
242
+ In `--yolo`, the default fill target is the scheduler-forward 48-hour window
243
+ unless `--target-date`/`targetDate`, `--until`/`untilDate`, or an explicit
244
+ compatibility `horizonSendDays` is provided. If a target date is provided,
245
+ compute bounded gaps for only that sender-local date using scheduler-fillable
246
+ slots. If an until date is provided, compute bounded gaps through that
247
+ sender-local date inclusive, skipping no-send days and never extending beyond
248
+ that date without a new packet. For each target sender, compute the bounded gap
249
+ from that sender's healthy daily capacity, existing future scheduler-owned
250
+ scheduled sends, and rows already ready to schedule across active campaigns
251
+ enrolled with that sender. Then pick the best same-sender campaign to fill the
252
+ gap: prefer recent/future scheduler-owned sends for that sender, then strongest
253
+ recent result evidence, then source health. Do not stop
239
254
  after filling only one sender when the request was sender-scoped. If a
240
255
  same-source copy hits the campaign-table row cap, split the current source into
241
256
  a bounded LinkedIn profile source list, confirm only that smaller list into the
@@ -4,6 +4,7 @@ description: Internal skill-led refill sends workflow for regular campaigns and
4
4
  visibility: internal
5
5
  allowed-tools:
6
6
  - mcp__sellable__get_refill_target_plan
7
+ - mcp__sellable__get_scheduler_fill_capacity
7
8
  - mcp__sellable__refresh_paid_inmail_credits
8
9
  - mcp__sellable__list_senders
9
10
  - mcp__sellable__get_sender_routing
@@ -88,6 +89,12 @@ in-progress wait state, not a reason to mark the goal complete or blocked.
88
89
  mutation.
89
90
  Short form: trust the target plan's inferred lane only when it is a
90
91
  connection-invite or paid-InMail refill lane.
92
+ For exact-date requests, pass `targetDate` to `get_refill_target_plan`.
93
+ When you need raw diagnostic proof, call `get_scheduler_fill_capacity` for
94
+ the same exact sender/action/date. That query is read-only and tells the MCP
95
+ how many cells the product scheduler will try to place for that sender; it
96
+ does not create rows, import, approve, schedule, refresh paid-InMail credits,
97
+ or mutate thresholds.
91
98
  If `status:"complete"`, report the target, selected dates, sent count,
92
99
  scheduled count, projected count, campaign ids, and no-op proof without
93
100
  asking for approval or mutating.
@@ -171,8 +178,8 @@ Use the refill-state response as the current facts receipt:
171
178
  cursor/inventory state, dedupe/DNC/provider exclusions, good-prospect yield,
172
179
  scan/import caps, and proof;
173
180
  - sender ids, healthy senders, disconnected senders, and daily capacity;
174
- - horizon saturation ledger per target sender: sender-local send days in scope,
175
- gross horizon capacity, actual sent coverage, future scheduler-owned
181
+ - target-window saturation ledger per target sender: sender-local send days in
182
+ scope, gross target capacity, actual sent coverage, future scheduler-owned
176
183
  scheduled counts in that window, projected coverage (`sent + scheduled`),
177
184
  ready-to-schedule buffer, remaining projected gap, paid-InMail
178
185
  credit/threshold feasibility, `targetShapeRevision`, `stateRevision`, and the
@@ -212,25 +219,27 @@ discovery. The stale waterfall slot remains diagnostic proof, not a reason to
212
219
  skip a visible paused shared campaign that can be started through a bounded
213
220
  packet.
214
221
 
215
- Default `--yolo` horizon is two send days when the user asks to fill, refill,
216
- load, or max sends without naming a different horizon. Send days are sender-local
217
- days with configured sending hours; do not treat weekends or other no-send-hour
218
- days as fillable capacity. If the user explicitly names a no-send calendar date,
219
- report that date as unschedulable and continue only for the next valid send day
220
- when the packet says "send days" or the user asked to max/refill senders broadly.
221
-
222
- For campaign-scoped requests, compute the target from the selected campaign's
223
- healthy sender daily capacity for the next two send days, minus already
224
- scheduler-owned future scheduled sends for those days and minus rows already
225
- ready to schedule. For sender-scoped requests, compute that gap per target sender
226
- across all active enrolled campaigns for that sender; count future scheduled
227
- cells and ready-to-schedule cells in any active enrolled campaign toward that
228
- sender's gap before preparing more rows. If ready/scheduled rows already cover a
229
- sender's gap, do not add rows or prep for that sender; report that the sender is
230
- loaded and awaiting the scheduler. If the gap is positive, prepare only the gap
231
- in the best same-sender campaign and keep all source-copy/prep caps tied to that
232
- two-day packet.
233
- Short form: default `--yolo refill senders` target is each eligible sender's two-send-day gap.
222
+ Default `--yolo` target is the scheduler-forward 48-hour window when the user
223
+ asks to fill, refill, load, or max sends without naming a different horizon or
224
+ exact `targetDate`.
225
+ The planner selects sender-local days whose configured sending windows overlap
226
+ that rolling target window; do not treat weekends or other no-send-hour days as
227
+ fillable capacity. If the user explicitly names a no-send calendar date, report
228
+ that date as unschedulable and continue only for the next valid send day when
229
+ the packet says "send days" or the user asked to max/refill senders broadly.
230
+
231
+ For campaign-scoped requests, compute the target from scheduler-fillable
232
+ capacity in the selected target window/date, not the full daily limit. For
233
+ sender-scoped requests, compute that scheduler-fillable gap per target sender
234
+ across all active enrolled campaigns for that sender; count ready-to-schedule
235
+ cells in any active enrolled campaign toward that sender's fillable gap before
236
+ preparing more rows. If ready rows already cover a sender's scheduler-fillable
237
+ gap, do not add rows or prep for that sender; report that the sender is loaded,
238
+ awaiting scheduler. If the gap is positive, prepare only the gap in the best
239
+ same-sender campaign and keep all source-copy/prep caps tied to that target
240
+ window/date packet.
241
+ Short form: default `--yolo refill senders` target is each eligible sender's
242
+ scheduler-forward 48-hour gap.
234
243
 
235
244
  Lane selection must choose one refill lane per sender from current
236
245
  dashboard-active campaign-backed sequence evidence:
@@ -246,23 +255,25 @@ dashboard-active campaign-backed sequence evidence:
246
255
  `send_inmail_closed` for that sender.
247
256
 
248
257
  For `--yolo` fill/schedule requests, do not treat "ready" as completion. Build
249
- and maintain a horizon saturation ledger for every selected sender from
258
+ and maintain a target-window saturation ledger for every selected sender from
250
259
  `get_refill_target_plan`. A sender is complete only when a final target-plan or
251
260
  refill-state reread proves projected coverage (`sent + scheduled`) meets or
252
- exceeds the sender's horizon capacity for the selected send days. Put another
253
- way: complete when the same daily-limit/readback model would show no remaining
261
+ exceeds the sender's capacity for the selected target window. Put another way:
262
+ complete when the same daily-limit/readback model would show no remaining
254
263
  send-day capacity for that selected lane. Ready-to-schedule rows are only buffer
255
- for the product scheduler. If ready plus projected coverage covers the horizon
256
- but scheduled cells do not yet, run a persistent read-only scheduler wait loop:
257
- wait, reread, recompute the ledger, and continue until projected coverage is
258
- proved, a concrete non-scheduler blocker appears, or Christian explicitly stops
259
- or asks for status only. `awaiting_scheduler_after_ready_buffer` is not success
260
- and is not a terminal blocker for an active refill goal; it is the poll state
261
- that keeps the thread waiting. It does not need a prep/import/approval packet.
264
+ for the product scheduler. If ready plus projected coverage covers the target
265
+ window but scheduled cells do not yet, run a persistent read-only scheduler wait
266
+ loop: wait, reread, recompute the ledger, and continue until projected coverage
267
+ is proved, a concrete non-scheduler blocker appears, or Christian explicitly
268
+ stops or asks for status only. `awaiting_scheduler_after_ready_buffer` is not
269
+ success and is not a terminal blocker for an active refill goal; it is the
270
+ loaded, awaiting scheduler poll state that keeps the thread waiting. It does not
271
+ need a prep/import/approval packet.
262
272
  Short form: ready buffer is not success.
263
273
  Short form: keep polling the scheduler instead of closing out while ready buffer
264
274
  covers the gap.
265
- Short form: `--yolo refill senders` completes only on projected horizon saturation or a concrete blocker.
275
+ Short form: `--yolo refill senders` completes only on projected target-window
276
+ saturation or a concrete blocker.
266
277
 
267
278
  Rank candidates in this order:
268
279
 
@@ -493,7 +504,7 @@ same refill request, do not ask the `Accept` / `Decline` question. Instead:
493
504
  4. execute only the exact packet;
494
505
  5. after each terminal credit-refresh/apply/prep/start result, rerun
495
506
  `get_refill_target_plan`, reread state, settle processing when needed,
496
- recompute the horizon saturation ledger, and continue with the next smallest
507
+ recompute the target-window saturation ledger, and continue with the next smallest
497
508
  safe action inside the same bounded packet until every selected sender is
498
509
  saturated by projected coverage or blocked by non-scheduler evidence. Do not
499
510
  stop at "loaded" or "awaiting scheduler"; when no in-packet MCP mutation
@@ -586,8 +597,8 @@ when generated/pass counts are still settling, then poll `get_campaign_refill_st
586
597
  remains awaiting scheduler. Do not force scheduler fields directly.
587
598
 
588
599
  For requested fill/refill completion, continue the saturation loop after each
589
- poll: recompute projected horizon coverage by sender and date, subtract it from
590
- the requested horizon capacity, and decide whether another safe prep/import/
600
+ poll: recompute projected target-window coverage by sender and date, subtract it
601
+ from the requested target capacity, and decide whether another safe prep/import/
591
602
  approval pass is required. If projected coverage is still short and ready buffer
592
603
  is also short, run the next bounded MCP primitive that can create more eligible
593
604
  rows: `fill_campaign_horizon` for the selected evergreen target, or