@sellable/mcp 0.1.553 → 0.1.554

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.
@@ -1,8 +1,6 @@
1
1
  type RefillSendsIntent = "plain" | "active" | "evergreen";
2
2
  type RefillSendsApprovalMode = "approve" | "mark_ready";
3
3
  type RefillSendsExecutionMode = "manual" | "scheduled" | "yolo";
4
- declare const REFILL_SEND_ACTION_TYPES: readonly ["send_invite", "send_inmail_closed"];
5
- type RefillSendsActionType = (typeof REFILL_SEND_ACTION_TYPES)[number];
6
4
  type RefillSendsCommandInput = {
7
5
  yolo?: boolean;
8
6
  executionMode?: RefillSendsExecutionMode;
@@ -18,9 +16,6 @@ type RefillSendsCommandInput = {
18
16
  tableId?: string;
19
17
  intent?: RefillSendsIntent;
20
18
  approvalMode?: RefillSendsApprovalMode;
21
- actionTypes?: RefillSendsActionType[];
22
- expectedTargetShapeRevision?: string;
23
- expectedActionKey?: string;
24
19
  };
25
20
  type PaidInmailRefreshApprovalPacket = {
26
21
  approvalSource: "explicit_yolo_flag";
@@ -79,14 +74,6 @@ export declare const refillSendsToolDefinitions: {
79
74
  };
80
75
  description: string;
81
76
  };
82
- actionTypes: {
83
- type: string;
84
- items: {
85
- type: string;
86
- enum: string[];
87
- };
88
- description: string;
89
- };
90
77
  horizonSendDays: {
91
78
  type: string;
92
79
  minimum: number;
@@ -121,20 +108,25 @@ export declare const refillSendsToolDefinitions: {
121
108
  enum: string[];
122
109
  description: string;
123
110
  };
124
- expectedTargetShapeRevision: {
125
- type: string;
126
- description: string;
127
- };
128
- expectedActionKey: {
129
- type: string;
130
- description: string;
131
- };
132
111
  };
133
112
  required: never[];
134
113
  additionalProperties: boolean;
135
114
  };
136
115
  }[];
137
116
  export declare function refillSendsCommand(input?: RefillSendsCommandInput): {
117
+ command: string;
118
+ tool: string;
119
+ promptName: string;
120
+ workflowPromptName: string;
121
+ workflowAsset: {
122
+ subskillName: string;
123
+ assetPath: string;
124
+ };
125
+ yolo: boolean;
126
+ executionMode: RefillSendsExecutionMode;
127
+ workspaceId: string | null;
128
+ workspaceResolution: string;
129
+ intent: RefillSendsIntent;
138
130
  targetDate: string | null;
139
131
  untilDate: string | null;
140
132
  horizonSendDays: number | null;
@@ -178,8 +170,10 @@ export declare function refillSendsCommand(input?: RefillSendsCommandInput): {
178
170
  mcpTool: {
179
171
  name: string;
180
172
  arguments: {
181
- expectedActionKey?: string | undefined;
182
- expectedTargetShapeRevision?: string | undefined;
173
+ yolo: boolean;
174
+ senders: string[];
175
+ senderIds: string[];
176
+ senderNames: string[];
183
177
  targetDate: string | null;
184
178
  untilDate: string | null;
185
179
  horizonSendDays: number | null;
@@ -188,28 +182,9 @@ export declare function refillSendsCommand(input?: RefillSendsCommandInput): {
188
182
  intent: RefillSendsIntent;
189
183
  approvalMode: RefillSendsApprovalMode;
190
184
  workspaceId: string | null;
191
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
192
- yolo: boolean;
193
- senders: string[];
194
- senderIds: string[];
195
- senderNames: string[];
196
185
  };
197
186
  };
198
187
  };
199
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
200
- command: string;
201
- tool: string;
202
- promptName: string;
203
- workflowPromptName: string;
204
- workflowAsset: {
205
- subskillName: string;
206
- assetPath: string;
207
- };
208
- yolo: boolean;
209
- executionMode: RefillSendsExecutionMode;
210
- workspaceId: string | null;
211
- workspaceResolution: string;
212
- intent: RefillSendsIntent;
213
188
  };
214
189
  export declare function executeRefillSendsCommand(input?: RefillSendsCommandInput): Promise<import("./workspace-context.js").WorkspaceRequiredResult | {
215
190
  autoPaidInmailRefresh: {
@@ -218,11 +193,11 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
218
193
  refreshedPaidInmailSenderIds: never[];
219
194
  failedPaidInmailRefreshes: never[];
220
195
  note: string;
196
+ refreshReceipts?: undefined;
221
197
  attemptedSenderIds?: undefined;
222
198
  targetPlanReread?: undefined;
223
199
  workspaceId?: undefined;
224
200
  workspaceResolution?: undefined;
225
- refreshReceipts?: undefined;
226
201
  };
227
202
  yoloExecution: {
228
203
  enabled: false;
@@ -233,68 +208,6 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
233
208
  refusalReason?: undefined;
234
209
  postActionFirstAction?: undefined;
235
210
  };
236
- targetDate: string | null;
237
- untilDate: string | null;
238
- horizonSendDays: number | null;
239
- fillWindow: {
240
- mode: string;
241
- targetDate: string;
242
- description: string;
243
- untilDate?: undefined;
244
- horizonSendDays?: undefined;
245
- horizonHours?: undefined;
246
- } | {
247
- mode: string;
248
- untilDate: string;
249
- description: string;
250
- targetDate?: undefined;
251
- horizonSendDays?: undefined;
252
- horizonHours?: undefined;
253
- } | {
254
- mode: string;
255
- horizonSendDays: number | null;
256
- horizonHours: number | null;
257
- description: string;
258
- targetDate?: undefined;
259
- untilDate?: undefined;
260
- };
261
- approvalMode: RefillSendsApprovalMode;
262
- campaignId: string | null;
263
- tableId: string | null;
264
- senderScope: string;
265
- senderSelectors: {
266
- senders: string[];
267
- senderIds: string[];
268
- senderNames: string[];
269
- };
270
- firstOperationalSteps: string[];
271
- approvalContract: string;
272
- forbiddenActions: string[];
273
- hostExamples: {
274
- claude: string[];
275
- codex: string[];
276
- mcpTool: {
277
- name: string;
278
- arguments: {
279
- expectedActionKey?: string | undefined;
280
- expectedTargetShapeRevision?: string | undefined;
281
- targetDate: string | null;
282
- untilDate: string | null;
283
- horizonSendDays: number | null;
284
- campaignId: string | undefined;
285
- tableId: string | undefined;
286
- intent: RefillSendsIntent;
287
- approvalMode: RefillSendsApprovalMode;
288
- workspaceId: string | null;
289
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
290
- yolo: boolean;
291
- senders: string[];
292
- senderIds: string[];
293
- senderNames: string[];
294
- };
295
- };
296
- };
297
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
298
211
  command: string;
299
212
  tool: string;
300
213
  promptName: string;
@@ -308,40 +221,6 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
308
221
  workspaceId: string | null;
309
222
  workspaceResolution: string;
310
223
  intent: RefillSendsIntent;
311
- } | {
312
- autoPaidInmailRefresh: {
313
- enabled: boolean;
314
- status: string;
315
- refreshedPaidInmailSenderIds: never[];
316
- failedPaidInmailRefreshes: never[];
317
- attemptedSenderIds: never[];
318
- targetPlanReread: boolean;
319
- workspaceId: string | null;
320
- workspaceResolution: string;
321
- note: string;
322
- refreshReceipts?: undefined;
323
- };
324
- yoloExecution: {
325
- enabled: boolean;
326
- status: string;
327
- selectedAction: Record<string, unknown> | null;
328
- targetPlanReread: boolean;
329
- result?: undefined;
330
- refusalReason?: undefined;
331
- postActionFirstAction?: undefined;
332
- };
333
- changed: boolean;
334
- expectedTargetShapeRevision: string | null;
335
- actualTargetShapeRevision: string | null;
336
- expectedActionKey: string | null;
337
- actualActionKey: string | null;
338
- shapeChanged: boolean;
339
- actionChanged: boolean;
340
- ok: boolean;
341
- code: string;
342
- targetPlan: unknown;
343
- targetPlanBeforePaidRefresh: null;
344
- targetPlanBeforeYoloPrimitive: null;
345
224
  targetDate: string | null;
346
225
  untilDate: string | null;
347
226
  horizonSendDays: number | null;
@@ -385,8 +264,10 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
385
264
  mcpTool: {
386
265
  name: string;
387
266
  arguments: {
388
- expectedActionKey?: string | undefined;
389
- expectedTargetShapeRevision?: string | undefined;
267
+ yolo: boolean;
268
+ senders: string[];
269
+ senderIds: string[];
270
+ senderNames: string[];
390
271
  targetDate: string | null;
391
272
  untilDate: string | null;
392
273
  horizonSendDays: number | null;
@@ -395,28 +276,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
395
276
  intent: RefillSendsIntent;
396
277
  approvalMode: RefillSendsApprovalMode;
397
278
  workspaceId: string | null;
398
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
399
- yolo: boolean;
400
- senders: string[];
401
- senderIds: string[];
402
- senderNames: string[];
403
279
  };
404
280
  };
405
281
  };
406
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
407
- command: string;
408
- tool: string;
409
- promptName: string;
410
- workflowPromptName: string;
411
- workflowAsset: {
412
- subskillName: string;
413
- assetPath: string;
414
- };
415
- yolo: boolean;
416
- executionMode: RefillSendsExecutionMode;
417
- workspaceId: string | null;
418
- workspaceResolution: string;
419
- intent: RefillSendsIntent;
420
282
  } | {
421
283
  targetPlan: unknown;
422
284
  targetPlanBeforePaidRefresh: unknown;
@@ -475,6 +337,19 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
475
337
  refusalReason: string | undefined;
476
338
  postActionFirstAction: Record<string, unknown> | null;
477
339
  };
340
+ command: string;
341
+ tool: string;
342
+ promptName: string;
343
+ workflowPromptName: string;
344
+ workflowAsset: {
345
+ subskillName: string;
346
+ assetPath: string;
347
+ };
348
+ yolo: boolean;
349
+ executionMode: RefillSendsExecutionMode;
350
+ workspaceId: string | null;
351
+ workspaceResolution: string;
352
+ intent: RefillSendsIntent;
478
353
  targetDate: string | null;
479
354
  untilDate: string | null;
480
355
  horizonSendDays: number | null;
@@ -518,8 +393,10 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
518
393
  mcpTool: {
519
394
  name: string;
520
395
  arguments: {
521
- expectedActionKey?: string | undefined;
522
- expectedTargetShapeRevision?: string | undefined;
396
+ yolo: boolean;
397
+ senders: string[];
398
+ senderIds: string[];
399
+ senderNames: string[];
523
400
  targetDate: string | null;
524
401
  untilDate: string | null;
525
402
  horizonSendDays: number | null;
@@ -528,27 +405,8 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
528
405
  intent: RefillSendsIntent;
529
406
  approvalMode: RefillSendsApprovalMode;
530
407
  workspaceId: string | null;
531
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
532
- yolo: boolean;
533
- senders: string[];
534
- senderIds: string[];
535
- senderNames: string[];
536
408
  };
537
409
  };
538
410
  };
539
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
540
- command: string;
541
- tool: string;
542
- promptName: string;
543
- workflowPromptName: string;
544
- workflowAsset: {
545
- subskillName: string;
546
- assetPath: string;
547
- };
548
- yolo: boolean;
549
- executionMode: RefillSendsExecutionMode;
550
- workspaceId: string | null;
551
- workspaceResolution: string;
552
- intent: RefillSendsIntent;
553
411
  }>;
554
412
  export {};
@@ -1,8 +1,6 @@
1
1
  import { actionIds, classifyPaidInmailRefreshReceipt, collectPaidInmailRefreshActions, executeOneYoloPrimitive, firstGlobalAction, normalizeStrings, numberValue, recordValue, refreshPaidInmailCreditsWithRetry, stringValue, } from "./refill-executors.js";
2
2
  import { getRefillTargetPlan } from "./refill-target-plan.js";
3
3
  import { createWorkspaceContext, normalizeExplicitWorkspaceId, } from "./workspace-context.js";
4
- const REFILL_SEND_ACTION_TYPES = ["send_invite", "send_inmail_closed"];
5
- const REFILL_SEND_ACTION_TYPE_SET = new Set(REFILL_SEND_ACTION_TYPES);
6
4
  const DEFAULT_SCHEDULER_FORWARD_HOURS = 48;
7
5
  const MCP_PAID_INMAIL_CREDITS_MAX_STALENESS_SECONDS = 4 * 60 * 60;
8
6
  function normalizeHorizonSendDays(value) {
@@ -50,51 +48,10 @@ function normalizeTargetDate(value) {
50
48
  }
51
49
  return trimmed;
52
50
  }
53
- function normalizeRefillActionTypes(value) {
54
- if (value === undefined || value === null)
55
- return undefined;
56
- if (!Array.isArray(value)) {
57
- throw new Error("actionTypes must be an array of supported refill lanes.");
58
- }
59
- if (value.some((actionType) => typeof actionType !== "string")) {
60
- throw new Error(`Unsupported refill actionTypes. Supported values are ${REFILL_SEND_ACTION_TYPES.join(", ")}.`);
61
- }
62
- const normalized = normalizeStrings(value);
63
- const unsupported = normalized.filter((actionType) => !REFILL_SEND_ACTION_TYPE_SET.has(actionType));
64
- if (unsupported.length > 0) {
65
- throw new Error(`Unsupported refill actionTypes: ${unsupported.join(", ")}. Supported values are ${REFILL_SEND_ACTION_TYPES.join(", ")}.`);
66
- }
67
- return normalized.length > 0
68
- ? normalized
69
- : undefined;
70
- }
71
- function normalizeExpectedPacketValue(value, field) {
72
- if (value === undefined || value === null)
73
- return undefined;
74
- if (typeof value !== "string" || value.trim().length === 0) {
75
- throw new Error(`${field} must be a non-empty string when provided.`);
76
- }
77
- return value.trim();
78
- }
79
- function normalizeRefillSendsInput(input) {
80
- const actionTypes = normalizeRefillActionTypes(input.actionTypes);
81
- const expectedTargetShapeRevision = normalizeExpectedPacketValue(input.expectedTargetShapeRevision, "expectedTargetShapeRevision");
82
- const expectedActionKey = normalizeExpectedPacketValue(input.expectedActionKey, "expectedActionKey");
83
- const normalized = { ...input };
84
- delete normalized.actionTypes;
85
- delete normalized.expectedTargetShapeRevision;
86
- delete normalized.expectedActionKey;
87
- return {
88
- ...normalized,
89
- ...(actionTypes ? { actionTypes } : {}),
90
- ...(expectedTargetShapeRevision ? { expectedTargetShapeRevision } : {}),
91
- ...(expectedActionKey ? { expectedActionKey } : {}),
92
- };
93
- }
94
51
  export const refillSendsToolDefinitions = [
95
52
  {
96
53
  name: "refill_sends",
97
- description: "Typed command entrypoint for Sellable refill sends. Accepts --yolo semantics and optional sender selectors, then returns the bounded execution contract for the skill-led refill workflow. In --yolo, it may refresh stale paid InMail credit cache facts once, or execute exactly one safe primitive from target.globalActionQueue[0] (bounded existing-row preparation, bounded generated-message approval, receipt-proven same-source copy, a request-scoped run_scheduler_sweep for an exact date, or a read-only wait) and reread. Same-source copy/source fallback is only safe after receipt-proven exhaustion: hasMoreFrontierRows:false, zero approvalCandidates, no stuckActiveCells, and no non-terminal approvedNotDispatched work. The exact-date sweep may schedule eligible workspace cells through existing product gates; it never sends directly or raw-writes scheduler fields. Wait primitives are gates, not competing goals, and carry absolute wait.deadlineAt when present. It does not run unbounded approval, lower paid InMail thresholds, switch source families, create campaigns, launch, archive, or delete.",
54
+ description: "Typed command entrypoint for Sellable refill sends. Accepts --yolo semantics and optional sender selectors, then returns the bounded execution contract for the skill-led refill workflow. In --yolo, it may refresh stale paid InMail credit cache facts once, or execute exactly one safe primitive from target.globalActionQueue[0] (bounded existing-row preparation, bounded generated-message approval, receipt-proven same-source copy, or read-only wait) and reread. Same-source copy/source fallback is only safe after receipt-proven exhaustion: hasMoreFrontierRows:false, zero approvalCandidates, no stuckActiveCells, and no non-terminal approvedNotDispatched work. Wait primitives are gates, not competing goals, and carry absolute wait.deadlineAt when present. It does not run unbounded approval, lower paid InMail thresholds, switch source families, create campaigns, schedule sends, launch, archive, delete, or write scheduler rows.",
98
55
  inputSchema: {
99
56
  type: "object",
100
57
  properties: {
@@ -130,14 +87,6 @@ export const refillSendsToolDefinitions = [
130
87
  items: { type: "string" },
131
88
  description: "Optional sender display names to resolve through list_senders before campaign selection.",
132
89
  },
133
- actionTypes: {
134
- type: "array",
135
- items: {
136
- type: "string",
137
- enum: ["send_invite", "send_inmail_closed"],
138
- },
139
- description: "Optional explicit refill lane. Omit to preserve planner inference; supported values are connection invites and paid InMail / unified Sales Nav cascades.",
140
- },
141
90
  horizonSendDays: {
142
91
  type: "number",
143
92
  minimum: 1,
@@ -172,14 +121,6 @@ export const refillSendsToolDefinitions = [
172
121
  enum: ["approve", "mark_ready"],
173
122
  description: 'Preparation mode for the final packet. Use "approve" only when the user asked to fill/schedule sender sends; otherwise default to "mark_ready".',
174
123
  },
175
- expectedTargetShapeRevision: {
176
- type: "string",
177
- description: "Optional targetShapeRevision from an already rendered and approved packet. A mismatch returns approval_scope_changed before any refresh or mutation.",
178
- },
179
- expectedActionKey: {
180
- type: "string",
181
- description: "Optional actionKey from the approved packet's first global action. A mismatch returns approval_scope_changed before any refresh or mutation.",
182
- },
183
124
  },
184
125
  required: [],
185
126
  additionalProperties: false,
@@ -187,9 +128,6 @@ export const refillSendsToolDefinitions = [
187
128
  },
188
129
  ];
189
130
  export function refillSendsCommand(input = {}) {
190
- return buildRefillSendsCommand(normalizeRefillSendsInput(input));
191
- }
192
- function buildRefillSendsCommand(input) {
193
131
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
194
132
  const senders = normalizeStrings(input.senders);
195
133
  const senderIds = normalizeStrings(input.senderIds);
@@ -204,7 +142,6 @@ function buildRefillSendsCommand(input) {
204
142
  : normalizeHorizonSendDays(input.horizonSendDays);
205
143
  const intent = input.intent ?? "plain";
206
144
  const approvalMode = input.approvalMode ?? (yolo ? "approve" : "mark_ready");
207
- const actionTypes = input.actionTypes;
208
145
  const senderScope = hasSenderSelectors
209
146
  ? "selected_senders"
210
147
  : yolo
@@ -224,7 +161,6 @@ function buildRefillSendsCommand(input) {
224
161
  workspaceId,
225
162
  workspaceResolution: workspaceId ? "explicit" : "active_config",
226
163
  intent,
227
- ...(actionTypes ? { actionTypes } : {}),
228
164
  targetDate,
229
165
  untilDate,
230
166
  horizonSendDays,
@@ -265,7 +201,7 @@ function buildRefillSendsCommand(input) {
265
201
  "A skill cannot create or invoke /goal by itself. If this refill is already running inside an active Codex goal, keep that goal open until every selected sender lane is horizon-filled by projected coverage (sent + scheduled), Christian explicitly stops/statuses the run, or a concrete non-scheduler blocker appears.",
266
202
  `Call get_refill_target_plan({ intent: "${intent}"${workspaceId ? `, workspaceId: "${workspaceId}"` : ""}${input.campaignId ? `, campaignId: "${input.campaignId}"` : ""}${input.tableId ? `, tableId: "${input.tableId}"` : ""}${senderIds.length > 0 ? `, senderIds: ${JSON.stringify(senderIds)}` : ""}${senderNames.length > 0
267
203
  ? `, senderNames: ${JSON.stringify(senderNames)}`
268
- : ""}${senders.length > 0 ? `, senders: ${JSON.stringify(senders)}` : ""}${actionTypes ? `, actionTypes: ${JSON.stringify(actionTypes)}` : ""}${targetDate
204
+ : ""}${senders.length > 0 ? `, senders: ${JSON.stringify(senders)}` : ""}${targetDate
269
205
  ? `, targetDate: "${targetDate}"`
270
206
  : untilDate
271
207
  ? `, untilDate: "${untilDate}"`
@@ -274,11 +210,10 @@ function buildRefillSendsCommand(input) {
274
210
  : `, horizonSendDays: ${horizonSendDays}`}, approvalMode: "${approvalMode}" }) before any import, prep, approval, start, or schedule-affecting action.`,
275
211
  "Render target.eligibleSenderLedger and target.senderRefillPlans before mutation. Preserve the coverage labels Need to prepare, Goal, Already sent, Scheduled, Ready and waiting to be scheduled, and Still need.",
276
212
  "Use target.globalActionQueue as the only cross-sender yolo queue: execute only target.globalActionQueue[0], one globally ranked primitive, then rerun get_refill_target_plan before choosing another action.",
277
- "When expectedTargetShapeRevision or expectedActionKey is supplied from an already rendered packet, compare both against the first fresh target plan before paid-credit refresh or any primitive. Return approval_scope_changed with the fresh packet on mismatch.",
278
213
  "Read target.senderRefillPlans[].refillReceipt as the public ladder receipt: it carries the selected campaign/sender/lane summary, skippedRungs, existingRowFrontier, and any absolute wait.deadlineAt. Do not choose source/copy/fallback work until that receipt proves the earlier ready/prep/approval rungs are exhausted.",
279
214
  "If get_refill_target_plan returns status complete, report eligible sender ledger, target.senderRefillPlans, gross target, selected days, sent count, scheduled count, projected count, campaign ids, targetShapeRevision, and no-op proof without asking for approval.",
280
215
  "Refill target lanes are connection invites (send_invite), standalone paid InMails (send_inmail_closed), or unified Sales Nav cascades represented publicly as send_inmail_closed with campaign classification sales_nav_cascade. For a Sales Nav cascade, refill the selected campaign first; its sequence can route prospects to Open InMail, paid InMail while fresh credits are >= 5, or same-campaign connection fallback without asking for separate open/paid/connection campaigns. Do not count send_dm as horizon target capacity.",
281
- "If the exact-date global action is run_scheduler_sweep, execute it once and fully reread when remainingReadyOrProjectedGap is 0 but remainingProjectedGap is positive. Otherwise, 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.",
216
+ "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.",
282
217
  `Resolve route with resolve_campaign_fill_route({ intent: "${intent}"${workspaceId ? `, workspaceId: "${workspaceId}"` : ""}${input.campaignId ? `, campaignId: "${input.campaignId}"` : ""}${input.tableId ? `, tableId: "${input.tableId}"` : ""} }).`,
283
218
  `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"${workspaceId ? `, workspaceId: "${workspaceId}"` : ""} }) and inspect current dashboard-active ACTIVE/PAUSED campaign-backed sequence campaigns before declaring a sender blocked.`,
284
219
  workspaceId
@@ -296,7 +231,7 @@ function buildRefillSendsCommand(input) {
296
231
  "Fresh reread get_campaign_refill_state immediately before any import, prep, approval, or horizon-fill mutation.",
297
232
  "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.",
298
233
  "Source/fallback primitives require receipt-proven exhaustion: existingRowFrontier.hasMoreFrontierRows:false, approvalCandidates:0, no fresh active prep, no stuckActiveCells, and no non-terminal approvedNotDispatched rows. Treat anomalies, stuckActiveCells, and non-terminal approvedNotDispatched as diagnose-and-report gates, not exhaustion. Terminal approvedNotDispatched blockers may be reported and then the ladder can proceed.",
299
- "In manual/non-yolo, scheduled, and --yolo modes, this tool may automatically refresh stale or missing paid-InMail credit facts once per selected sender when the first target plan returns refresh_paid_inmail_credits candidates. This is the only newly allowed automatic write in manual/non-yolo mode; it reruns get_refill_target_plan and returns autoPaidInmailRefresh with attemptedSenderIds, refreshedPaidInmailSenderIds, failedPaidInmailRefreshes, and the post-refresh targetPlan before any prep/source-copy/bounded-approval/exact-date-sweep/read-only-wait action is chosen.",
234
+ "In manual/non-yolo, scheduled, and --yolo modes, this tool may automatically refresh stale or missing paid-InMail credit facts once per selected sender when the first target plan returns refresh_paid_inmail_credits candidates. This is the only newly allowed automatic write in manual/non-yolo mode; it reruns get_refill_target_plan and returns autoPaidInmailRefresh with attemptedSenderIds, refreshedPaidInmailSenderIds, failedPaidInmailRefreshes, and the post-refresh targetPlan before any prep/source-copy/bounded-approval/read-only wait action is chosen.",
300
235
  "Freshness gate precedes scheduler wait: if any selected target.senderRefillPlans[].paidInmail.status is missing_credit_facts or stale_credit_facts, or the target plan contains refresh_paid_inmail_credits, do not enter wait_for_scheduler even when remainingReadyOrProjectedGap is 0; refresh exact sender credit facts once, reread get_refill_target_plan, then choose scheduler wait only if freshness is clean.",
301
236
  "Scheduler-run receipt interpretation: cellsConsidered is allocation-attempt count, readyCellsFound is ready inventory before prefilters, and campaignScopeSummary must include the selected campaign/table before inferring it was ready-but-blocked. Read prefiltered, skipped, and deferred separately. For ready closed-InMail cells with stale paid-credit facts, route to refresh_paid_inmail_credits_then_rerun once, then rerun/status. wait_for_capacity_or_window means report loaded/capped/waiting and do not source or prep more rows. no_ready_cells_continue_refill_prep means return to the refill/prep ladder.",
302
237
  "For wait_for_active_work and wait_for_scheduler, honor the receipt's absolute wait.deadlineAt when present. If the deadline is expired on this call, escalate to diagnostics with the receipt evidence instead of issuing another blind wait.",
@@ -306,9 +241,9 @@ function buildRefillSendsCommand(input) {
306
241
  "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.",
307
242
  ],
308
243
  approvalContract: yolo
309
- ? "Auto-accept only the rendered bounded refill target packet after get_refill_target_plan and fresh reread. Execute one globally ranked primitive from target.globalActionQueue at a time, then rerun get_refill_target_plan before taking another action. Continue through every safe prep/source-copy/bounded-approval/exact-date-sweep/read-only-wait action inside that packet, but source-copy/fallback requires receipt-proven exhaustion of earlier ready/prep/approval rungs. Unbounded approval, start_campaign, source-family switches, threshold changes, and campaign creation require their own explicit gates. After each safe 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 and the exact-date run_scheduler_sweep is target.globalActionQueue[0], execute it once and fully reread. Only non-exact or no-sweep scheduler waits are read-only; use a 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 workspace, sender set, campaign/table/stable source identity, configured caps, exact date/window, lane, or the approved action/side-effect envelope drifts. Treat coverage, blockers, receipts, timestamps, and current action progress as stateRevision changes inside that envelope. --yolo does not authorize lowering paid InMail thresholds or creating connection campaigns."
244
+ ? "Auto-accept only the rendered bounded refill target packet after get_refill_target_plan and fresh reread. Execute one globally ranked primitive from target.globalActionQueue at a time, then rerun get_refill_target_plan before taking another action. Continue through every safe prep/source-copy/bounded-approval/read-only wait action inside that packet, but source-copy/fallback requires receipt-proven exhaustion of earlier ready/prep/approval rungs. Unbounded approval, start_campaign, source-family switches, threshold changes, and campaign creation require their own explicit gates. After each safe 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, side-effect class, or receipt exhaustion proof drifts. --yolo does not authorize lowering paid InMail thresholds or creating connection campaigns."
310
245
  : hasSenderSelectors
311
- ? "Before mutation, post the full bounded refill packet in normal chat as Markdown, including workspace, sender scope, campaign table, exact ids, caps/dates, gross target, sent count, scheduled count, projected count, ready buffer, remaining projected gap, paid InMail threshold feasibility, targetShapeRevision/stateRevision, side effects, forbidden actions, and stop condition. Then ask the final Accept/Decline structured approval question with a compact body that refers back to the posted packet instead of duplicating it. Only ask when get_refill_target_plan reports a positive remaining projected/ready gap. If target is complete by projected coverage, no-op without approval. If ready buffer covers the projected gap and the approved exact-date run_scheduler_sweep is target.globalActionQueue[0], execute it once and fully reread. Only non-exact or no-sweep scheduler waits are read-only; keep the run open until projected coverage fills or Christian stops/statuses it. Threshold changes and campaign creation need separate explicit approval."
246
+ ? "Before mutation, post the full bounded refill packet in normal chat as Markdown, including workspace, sender scope, campaign table, exact ids, caps/dates, gross target, sent count, scheduled count, projected count, ready buffer, remaining projected gap, paid InMail threshold feasibility, targetShapeRevision/stateRevision, side effects, forbidden actions, and stop condition. Then ask the final Accept/Decline structured approval question with a compact body that refers back to the posted packet instead of duplicating it. Only ask when get_refill_target_plan reports a positive remaining projected/ready gap. If target is complete by projected coverage, no-op without approval. If ready buffer covers the projected gap, run only persistent read-only scheduler wait/reread and keep the run open until projected coverage fills or Christian stops/statuses it. Threshold changes and campaign creation need separate explicit approval."
312
247
  : "Ask which eligible enrolled senders to refill first, then, before mutation, post the full bounded refill packet in normal chat as Markdown and ask the final Accept/Decline structured approval question with a compact body that refers back to the posted packet.",
313
248
  forbiddenActions: [
314
249
  "start_campaign outside an exact selected PAUSED campaign-backed refill packet",
@@ -341,7 +276,6 @@ function buildRefillSendsCommand(input) {
341
276
  senders,
342
277
  senderIds,
343
278
  senderNames,
344
- ...(actionTypes ? { actionTypes } : {}),
345
279
  targetDate,
346
280
  untilDate,
347
281
  horizonSendDays,
@@ -350,14 +284,6 @@ function buildRefillSendsCommand(input) {
350
284
  intent,
351
285
  approvalMode,
352
286
  workspaceId,
353
- ...(input.expectedTargetShapeRevision
354
- ? {
355
- expectedTargetShapeRevision: input.expectedTargetShapeRevision,
356
- }
357
- : {}),
358
- ...(input.expectedActionKey
359
- ? { expectedActionKey: input.expectedActionKey }
360
- : {}),
361
287
  },
362
288
  },
363
289
  },
@@ -381,7 +307,6 @@ function targetPlanInputFor(input = {}) {
381
307
  ...(senderIds.length > 0 ? { senderIds } : {}),
382
308
  ...(senderNames.length > 0 ? { senderNames } : {}),
383
309
  ...(senders.length > 0 ? { senders } : {}),
384
- ...(input.actionTypes ? { actionTypes: input.actionTypes } : {}),
385
310
  ...(targetDate
386
311
  ? { targetDate }
387
312
  : untilDate
@@ -402,24 +327,6 @@ function targetPlanFingerprint(plan) {
402
327
  generatedAt: stringValue(root?.generatedAt) ?? null,
403
328
  };
404
329
  }
405
- function approvedPacketComparison(input, targetPlan) {
406
- const root = recordValue(targetPlan);
407
- const action = recordValue(firstGlobalAction(targetPlan));
408
- const actualTargetShapeRevision = stringValue(root?.targetShapeRevision) ?? null;
409
- const actualActionKey = stringValue(action?.actionKey) ?? null;
410
- const shapeChanged = Boolean(input.expectedTargetShapeRevision &&
411
- input.expectedTargetShapeRevision !== actualTargetShapeRevision);
412
- const actionChanged = Boolean(input.expectedActionKey && input.expectedActionKey !== actualActionKey);
413
- return {
414
- changed: shapeChanged || actionChanged,
415
- expectedTargetShapeRevision: input.expectedTargetShapeRevision ?? null,
416
- actualTargetShapeRevision,
417
- expectedActionKey: input.expectedActionKey ?? null,
418
- actualActionKey,
419
- shapeChanged,
420
- actionChanged,
421
- };
422
- }
423
330
  function paidRefreshApprovalPacket(params) {
424
331
  const action = params.action.action ?? {};
425
332
  const ids = actionIds(action);
@@ -451,15 +358,12 @@ function paidRefreshOptionsFromApprovalPacket(packet) {
451
358
  };
452
359
  }
453
360
  export async function executeRefillSendsCommand(input = {}) {
454
- const normalizedInput = normalizeRefillSendsInput(input);
455
- const yolo = normalizedInput.yolo === true;
456
- const executionMode = normalizedInput.executionMode ?? (yolo ? "yolo" : "manual");
457
- const mustHaveWorkspace = yolo ||
458
- normalizedInput.requireWorkspace === true ||
459
- executionMode === "scheduled";
361
+ const yolo = input.yolo === true;
362
+ const executionMode = input.executionMode ?? (yolo ? "yolo" : "manual");
363
+ const mustHaveWorkspace = yolo || input.requireWorkspace === true || executionMode === "scheduled";
460
364
  const workspaceContext = mustHaveWorkspace
461
365
  ? createWorkspaceContext({
462
- workspaceId: normalizedInput.workspaceId,
366
+ workspaceId: input.workspaceId,
463
367
  executionMode,
464
368
  toolName: "refill_sends",
465
369
  })
@@ -468,12 +372,9 @@ export async function executeRefillSendsCommand(input = {}) {
468
372
  return workspaceContext;
469
373
  }
470
374
  const scopedInput = workspaceContext && workspaceContext.ok
471
- ? {
472
- ...normalizedInput,
473
- workspaceId: workspaceContext.context.workspaceId,
474
- }
475
- : normalizedInput;
476
- const command = buildRefillSendsCommand(scopedInput);
375
+ ? { ...input, workspaceId: workspaceContext.context.workspaceId }
376
+ : input;
377
+ const command = refillSendsCommand(scopedInput);
477
378
  const workspaceId = workspaceContext && workspaceContext.ok
478
379
  ? workspaceContext.context.workspaceId
479
380
  : normalizeExplicitWorkspaceId(scopedInput.workspaceId);
@@ -498,35 +399,6 @@ export async function executeRefillSendsCommand(input = {}) {
498
399
  }
499
400
  const targetPlanInput = targetPlanInputFor(scopedInput);
500
401
  const targetPlanBeforePaidRefresh = await getRefillTargetPlan(targetPlanInput);
501
- const approvedPacket = approvedPacketComparison(scopedInput, targetPlanBeforePaidRefresh);
502
- if (approvedPacket.changed) {
503
- return {
504
- ...command,
505
- ok: false,
506
- code: "approval_scope_changed",
507
- targetPlan: targetPlanBeforePaidRefresh,
508
- targetPlanBeforePaidRefresh: null,
509
- targetPlanBeforeYoloPrimitive: null,
510
- ...approvedPacket,
511
- autoPaidInmailRefresh: {
512
- enabled: false,
513
- status: "skipped_approval_scope_changed",
514
- refreshedPaidInmailSenderIds: [],
515
- failedPaidInmailRefreshes: [],
516
- attemptedSenderIds: [],
517
- targetPlanReread: false,
518
- workspaceId,
519
- workspaceResolution: workspaceId ? "explicit" : "active_config",
520
- note: "Approved refill scope changed before paid-credit refresh or primitive execution.",
521
- },
522
- yoloExecution: {
523
- enabled: yolo,
524
- status: "approval_scope_changed",
525
- selectedAction: firstGlobalAction(targetPlanBeforePaidRefresh),
526
- targetPlanReread: false,
527
- },
528
- };
529
- }
530
402
  const refreshActions = collectPaidInmailRefreshActions(targetPlanBeforePaidRefresh);
531
403
  const refreshedPaidInmailSenderIds = [];
532
404
  const failedPaidInmailRefreshes = [];