@sellable/mcp 0.1.335 → 0.1.337
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/index-dev.js +0 -0
- package/dist/index.js +0 -0
- package/dist/server.js +17 -1
- package/dist/tools/campaign-fill-routing.d.ts +39 -0
- package/dist/tools/campaign-fill-routing.js +45 -0
- package/dist/tools/campaign-horizon-fill.js +1 -1
- package/dist/tools/campaign-message-preparation.js +1 -1
- package/dist/tools/campaign-processing.d.ts +54 -0
- package/dist/tools/campaign-processing.js +39 -11
- package/dist/tools/prompts.js +1 -1
- package/dist/tools/refill-campaign-sends.d.ts +92 -0
- package/dist/tools/refill-campaign-sends.js +91 -0
- package/dist/tools/registry.d.ts +153 -0
- package/dist/tools/registry.js +4 -0
- package/package.json +1 -1
- package/skills/create-campaign/SKILL.md +47 -23
- package/skills/create-campaign-v2/core/flow.v2.json +1 -1
- package/skills/create-campaign-v2/references/filter-leads.md +24 -0
- package/skills/create-campaign-v2/references/sample-validation-loop.md +145 -9
- package/skills/create-campaign-v2-tail/SKILL.md +16 -10
- package/skills/fill-send-horizon/SKILL.md +36 -21
- package/skills/refill-sends/SKILL.md +57 -0
package/dist/index-dev.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/server.js
CHANGED
|
@@ -6,9 +6,11 @@ import { getAuthStatus } from "./tools/auth.js";
|
|
|
6
6
|
import { handleAddColumn, handleCommitBlueprint, } from "./tools/blueprint-commit.js";
|
|
7
7
|
import { bootstrapCreateCampaign } from "./tools/bootstrap.js";
|
|
8
8
|
import { prepareCampaignAbTest } from "./tools/campaign-ab-test.js";
|
|
9
|
+
import { resolveCampaignFillRoute } from "./tools/campaign-fill-routing.js";
|
|
9
10
|
import { fillCampaignHorizon } from "./tools/campaign-horizon-fill.js";
|
|
10
11
|
import { cancelPrepareCampaignMessages, getPrepareCampaignMessagesStatus, startPrepareCampaignMessages, } from "./tools/campaign-message-preparation.js";
|
|
11
|
-
import {
|
|
12
|
+
import { refillCampaignSends } from "./tools/refill-campaign-sends.js";
|
|
13
|
+
import { getCampaignTableSchema, queueCampaignCells, recordCampaignReviewBatch, reviseMessageTemplateAndRerun, selectCampaignCells, waitForCampaignProcessing, } from "./tools/campaign-processing.js";
|
|
12
14
|
import { createCampaign, duplicateCampaign, getCampaign, getCampaignMessagesPreview, getCampaigns, pauseCampaign, startCampaign, updateCampaign, updateCampaignBrief, } from "./tools/campaigns.js";
|
|
13
15
|
import { queueCells, updateCell } from "./tools/cells.js";
|
|
14
16
|
import { handleStartCliLogin, handleWaitForCliLogin, } from "./tools/cli-login.js";
|
|
@@ -179,6 +181,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
179
181
|
case "get_campaign_messages_preview":
|
|
180
182
|
result = await getCampaignMessagesPreview(args);
|
|
181
183
|
break;
|
|
184
|
+
case "resolve_campaign_fill_route":
|
|
185
|
+
result = await resolveCampaignFillRoute(args);
|
|
186
|
+
break;
|
|
187
|
+
case "refill_campaign_sends":
|
|
188
|
+
result = await refillCampaignSends(args);
|
|
189
|
+
if (args?.mode === "apply" && Array.isArray(result?.appliedCampaignIds)) {
|
|
190
|
+
for (const campaignId of result.appliedCampaignIds) {
|
|
191
|
+
markCampaignContextDirty(campaignId, "refill_campaign_sends");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
182
195
|
case "fill_campaign_horizon":
|
|
183
196
|
result = await fillCampaignHorizon(args);
|
|
184
197
|
if (args?.campaignId) {
|
|
@@ -219,6 +232,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
219
232
|
markCampaignContextDirty(args.campaignId, "queue_campaign_cells");
|
|
220
233
|
}
|
|
221
234
|
break;
|
|
235
|
+
case "record_campaign_review_batch":
|
|
236
|
+
result = await recordCampaignReviewBatch(args);
|
|
237
|
+
break;
|
|
222
238
|
case "wait_for_campaign_processing":
|
|
223
239
|
result = await waitForCampaignProcessing(args);
|
|
224
240
|
break;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type CampaignFillIntent = "plain" | "evergreen" | "active";
|
|
2
|
+
type ResolveCampaignFillRouteInput = {
|
|
3
|
+
intent: CampaignFillIntent;
|
|
4
|
+
campaignId?: string;
|
|
5
|
+
tableId?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const campaignFillRoutingToolDefinitions: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
intent: {
|
|
15
|
+
type: string;
|
|
16
|
+
enum: string[];
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
campaignId: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
tableId: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
limit: {
|
|
28
|
+
type: string;
|
|
29
|
+
minimum: number;
|
|
30
|
+
maximum: number;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
required: string[];
|
|
35
|
+
additionalProperties: boolean;
|
|
36
|
+
};
|
|
37
|
+
}[];
|
|
38
|
+
export declare function resolveCampaignFillRoute(input: ResolveCampaignFillRouteInput): Promise<unknown>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getApi } from "../api.js";
|
|
2
|
+
async function postCampaignFillRoute(body) {
|
|
3
|
+
const api = getApi();
|
|
4
|
+
return api.post("/api/v3/mcp/campaign-fill-routing", body);
|
|
5
|
+
}
|
|
6
|
+
export const campaignFillRoutingToolDefinitions = [
|
|
7
|
+
{
|
|
8
|
+
name: "resolve_campaign_fill_route",
|
|
9
|
+
description: 'Audit-only resolver to call before interpreting plain "fill campaigns", "load everyone up", or similar fill requests. It decides whether the workspace has evergreen/horizon targets, currently active campaign-backed sequence targets, or no targets so the agent must ask what to create. It does not create, append, prepare, approve, schedule, launch, archive, delete, send, or call lower-level fill tools. Only call fill_campaign_horizon when this resolver returns route "evergreen_horizon" or the user explicitly requested evergreen/horizon and the returned target is eligible. Exact target narrowing uses campaignId or tableId only; never fuzzy campaign names.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
intent: {
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: ["plain", "evergreen", "active"],
|
|
16
|
+
description: 'Use "plain" for generic fill/load requests, "evergreen" for explicit evergreen/horizon fill, and "active" for explicit active campaign fill.',
|
|
17
|
+
},
|
|
18
|
+
campaignId: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Optional exact CampaignOffer.id to narrow routing. Do not pass campaign names.",
|
|
21
|
+
},
|
|
22
|
+
tableId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Optional exact WorkflowTable.id to narrow routing. Do not pass table names.",
|
|
25
|
+
},
|
|
26
|
+
limit: {
|
|
27
|
+
type: "number",
|
|
28
|
+
minimum: 1,
|
|
29
|
+
maximum: 100,
|
|
30
|
+
description: "Maximum returned targets/skippedTargets.",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["intent"],
|
|
34
|
+
additionalProperties: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
export function resolveCampaignFillRoute(input) {
|
|
39
|
+
return postCampaignFillRoute({
|
|
40
|
+
intent: input.intent,
|
|
41
|
+
campaignId: input.campaignId,
|
|
42
|
+
tableId: input.tableId,
|
|
43
|
+
limit: input.limit,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -6,7 +6,7 @@ async function postHorizonFill(body) {
|
|
|
6
6
|
export const campaignHorizonFillToolDefinitions = [
|
|
7
7
|
{
|
|
8
8
|
name: "fill_campaign_horizon",
|
|
9
|
-
description: "
|
|
9
|
+
description: "Evergreen/horizon-only tool: audit or apply a bounded CampaignOffer horizon fill from Signal Discovery/source lead-list rows only when resolve_campaign_fill_route returns route evergreen_horizon or the user explicitly requested evergreen/horizon and the target is managed-waterfall eligible. Use audit first to get stateRevision, then apply with that stateRevision. Apply imports at most 300 eligible non-excluded source rows, starts bounded message preparation in approval mode, skips rows from excluded posts/authors, and does not start or launch the campaign, send messages, or directly assign scheduler-owned send timestamps. Prepared/approved rows are intermediate only; report scheduled completion only after re-reading scheduler-owned scheduled cells with non-null scheduler timestamps.",
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: "object",
|
|
12
12
|
properties: {
|
|
@@ -6,7 +6,7 @@ async function postPrepareMessages(body) {
|
|
|
6
6
|
export const campaignMessagePreparationToolDefinitions = [
|
|
7
7
|
{
|
|
8
8
|
name: "start_campaign_message_preparation",
|
|
9
|
-
description: 'Start a bounded
|
|
9
|
+
description: 'Start a bounded message-preparation job for a specific existing CampaignOffer campaignId/tableId. This is the active_campaigns existing-row path after resolve_campaign_fill_route, exact target re-read, and active prep-job check; it is not campaign creation and not evergreen horizon fill. It never launches the campaign, sends messages, or directly writes scheduledFor. The job queues pending Enrich Prospect cells first, lets ICP/rubric and Generate Message cascade, then marks ready or approves only the bounded cohort. Prepared/approved/ready rows are intermediate only; scheduled completion requires a later re-read proving scheduler-owned scheduled cells with non-null scheduledFor. Surface active preparation jobs, exhausted source rows, disconnected Sales Nav/deleted sender accounts, missing sequence state, and other sender-health blockers separately from prepared/approved/scheduled counts. Omit maxRowsToCheck and batchSize for the adaptive default: calibrate on at least 100 actually-enriched rows, estimate the row budget from observed rubric/pass yield, cap rows at 300, and process at most 100 newly checked rows at a time. The worker will not pull another row batch while the current checked batch still has queueable or active cells. Do not interpret checkedRows as enriched rows; use progress.enrichedRows, needsEnrichRows, activeCellCount, preparedMessages, approvedMessages, and stopReason.',
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: "object",
|
|
12
12
|
properties: {
|
|
@@ -42,6 +42,11 @@ type ReviseTemplateInput = SchemaInput & {
|
|
|
42
42
|
rowSelector?: RowSelector;
|
|
43
43
|
limit?: number;
|
|
44
44
|
};
|
|
45
|
+
type RecordReviewBatchInput = SchemaInput & {
|
|
46
|
+
tableId: string;
|
|
47
|
+
rowIds: string[];
|
|
48
|
+
enrichCellIds?: string[];
|
|
49
|
+
};
|
|
45
50
|
type ReviseTemplateResponse = Record<string, unknown> & {
|
|
46
51
|
approvalsReset?: number;
|
|
47
52
|
};
|
|
@@ -99,6 +104,8 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
99
104
|
templateRevision?: undefined;
|
|
100
105
|
timeoutMs?: undefined;
|
|
101
106
|
intervalMs?: undefined;
|
|
107
|
+
rowIds?: undefined;
|
|
108
|
+
enrichCellIds?: undefined;
|
|
102
109
|
templateMarkdown?: undefined;
|
|
103
110
|
approvedMessageTemplate?: undefined;
|
|
104
111
|
};
|
|
@@ -154,6 +161,8 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
154
161
|
templateRevision?: undefined;
|
|
155
162
|
timeoutMs?: undefined;
|
|
156
163
|
intervalMs?: undefined;
|
|
164
|
+
rowIds?: undefined;
|
|
165
|
+
enrichCellIds?: undefined;
|
|
157
166
|
templateMarkdown?: undefined;
|
|
158
167
|
approvedMessageTemplate?: undefined;
|
|
159
168
|
};
|
|
@@ -213,6 +222,8 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
213
222
|
templateRevision?: undefined;
|
|
214
223
|
timeoutMs?: undefined;
|
|
215
224
|
intervalMs?: undefined;
|
|
225
|
+
rowIds?: undefined;
|
|
226
|
+
enrichCellIds?: undefined;
|
|
216
227
|
templateMarkdown?: undefined;
|
|
217
228
|
approvedMessageTemplate?: undefined;
|
|
218
229
|
};
|
|
@@ -252,12 +263,52 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
252
263
|
limit?: undefined;
|
|
253
264
|
forceRerun?: undefined;
|
|
254
265
|
reason?: undefined;
|
|
266
|
+
rowIds?: undefined;
|
|
267
|
+
enrichCellIds?: undefined;
|
|
255
268
|
templateMarkdown?: undefined;
|
|
256
269
|
approvedMessageTemplate?: undefined;
|
|
257
270
|
};
|
|
258
271
|
additionalProperties: boolean;
|
|
259
272
|
required?: undefined;
|
|
260
273
|
};
|
|
274
|
+
} | {
|
|
275
|
+
name: string;
|
|
276
|
+
description: string;
|
|
277
|
+
inputSchema: {
|
|
278
|
+
type: string;
|
|
279
|
+
properties: {
|
|
280
|
+
tableId: {
|
|
281
|
+
type: string;
|
|
282
|
+
};
|
|
283
|
+
rowIds: {
|
|
284
|
+
type: string;
|
|
285
|
+
items: {
|
|
286
|
+
type: string;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
enrichCellIds: {
|
|
290
|
+
type: string;
|
|
291
|
+
items: {
|
|
292
|
+
type: string;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
campaignId?: undefined;
|
|
296
|
+
columnRole?: undefined;
|
|
297
|
+
rowSelector?: undefined;
|
|
298
|
+
limit?: undefined;
|
|
299
|
+
forceRerun?: undefined;
|
|
300
|
+
reason?: undefined;
|
|
301
|
+
minPassedCount?: undefined;
|
|
302
|
+
minGeneratedMessages?: undefined;
|
|
303
|
+
templateRevision?: undefined;
|
|
304
|
+
timeoutMs?: undefined;
|
|
305
|
+
intervalMs?: undefined;
|
|
306
|
+
templateMarkdown?: undefined;
|
|
307
|
+
approvedMessageTemplate?: undefined;
|
|
308
|
+
};
|
|
309
|
+
required: string[];
|
|
310
|
+
additionalProperties: boolean;
|
|
311
|
+
};
|
|
261
312
|
} | {
|
|
262
313
|
name: string;
|
|
263
314
|
description: string;
|
|
@@ -308,6 +359,8 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
308
359
|
templateRevision?: undefined;
|
|
309
360
|
timeoutMs?: undefined;
|
|
310
361
|
intervalMs?: undefined;
|
|
362
|
+
rowIds?: undefined;
|
|
363
|
+
enrichCellIds?: undefined;
|
|
311
364
|
};
|
|
312
365
|
required: string[];
|
|
313
366
|
additionalProperties: boolean;
|
|
@@ -316,6 +369,7 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
316
369
|
export declare function getCampaignTableSchema(input: SchemaInput): Promise<CampaignProcessingSchemaResponse>;
|
|
317
370
|
export declare function selectCampaignCells(input: SelectInput): Promise<unknown>;
|
|
318
371
|
export declare function queueCampaignCells(input: QueueInput): Promise<unknown>;
|
|
372
|
+
export declare function recordCampaignReviewBatch(input: RecordReviewBatchInput): Promise<unknown>;
|
|
319
373
|
export declare function reviseMessageTemplateAndRerun(input: ReviseTemplateInput): Promise<ReviseTemplateResponse>;
|
|
320
374
|
export declare function waitForCampaignProcessing(input: WaitInput): Promise<{
|
|
321
375
|
ready: boolean;
|
|
@@ -142,6 +142,20 @@ export const campaignProcessingToolDefinitions = [
|
|
|
142
142
|
additionalProperties: false,
|
|
143
143
|
},
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
name: "record_campaign_review_batch",
|
|
147
|
+
description: "Record a fresh campaign-table review batch from explicit row IDs. Use for same-source new-sample recovery after a zero-pass bounded filter run; do not use for new lead sourcing.",
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: "object",
|
|
150
|
+
properties: {
|
|
151
|
+
tableId: { type: "string" },
|
|
152
|
+
rowIds: { type: "array", items: { type: "string" } },
|
|
153
|
+
enrichCellIds: { type: "array", items: { type: "string" } },
|
|
154
|
+
},
|
|
155
|
+
required: ["tableId", "rowIds"],
|
|
156
|
+
additionalProperties: false,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
145
159
|
{
|
|
146
160
|
name: "revise_message_template_and_rerun",
|
|
147
161
|
description: "Update the approved message template in the campaign brief, mark prior generated messages stale, reset unsent approvals, and force-rerun Generate Message cells. Does not directly overwrite row message cells.",
|
|
@@ -192,6 +206,12 @@ export async function queueCampaignCells(input) {
|
|
|
192
206
|
...input,
|
|
193
207
|
});
|
|
194
208
|
}
|
|
209
|
+
export async function recordCampaignReviewBatch(input) {
|
|
210
|
+
return postCampaignProcessing({
|
|
211
|
+
action: "recordReviewBatch",
|
|
212
|
+
...input,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
195
215
|
export async function reviseMessageTemplateAndRerun(input) {
|
|
196
216
|
const result = await postCampaignProcessing({
|
|
197
217
|
action: "reviseTemplateAndRerun",
|
|
@@ -245,28 +265,36 @@ function buildProcessingTimeoutRecovery({ input, schema, stats, minPassedCount,
|
|
|
245
265
|
},
|
|
246
266
|
});
|
|
247
267
|
}
|
|
248
|
-
if (!passFloorMet && pendingWorkCount === 0
|
|
268
|
+
if (!passFloorMet && pendingWorkCount === 0) {
|
|
249
269
|
suggestedToolCalls.push({
|
|
250
|
-
tool: "
|
|
251
|
-
reason: "The checked sample missed the validation floor;
|
|
270
|
+
tool: "get_rows_minimal",
|
|
271
|
+
reason: "The checked sample missed the validation floor; inspect compact row miss patterns before choosing rubric revision, same-source new sample, or source revision.",
|
|
252
272
|
args: {
|
|
253
|
-
|
|
254
|
-
currentStep: "signal-discovery",
|
|
255
|
-
currentStepTransition: "revise-source-after-validation",
|
|
273
|
+
...(campaignId ? { campaignId } : { tableId: schema.tableId }),
|
|
256
274
|
},
|
|
257
275
|
});
|
|
276
|
+
suggestedToolCalls.push({
|
|
277
|
+
tool: "record_campaign_review_batch",
|
|
278
|
+
reason: "If the source is still viable but this slice was unrepresentative, record explicit same-source rowIds as a fresh review batch, then queue enrich on rowSelector reviewBatch.",
|
|
279
|
+
args: {
|
|
280
|
+
tableId: schema.tableId,
|
|
281
|
+
rowIds: ["<choose unprocessed same-source row ids>"],
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (!passFloorMet && pendingWorkCount === 0 && campaignId) {
|
|
258
286
|
suggestedToolCalls.push({
|
|
259
287
|
tool: "update_campaign",
|
|
260
|
-
reason: "
|
|
288
|
+
reason: "Persist the chosen recovery step explicitly; do not jump straight to source revision unless rubric relaxation and same-source sampling are not viable.",
|
|
261
289
|
args: {
|
|
262
290
|
campaignId,
|
|
263
|
-
currentStep: "
|
|
264
|
-
currentStepTransition: "
|
|
291
|
+
currentStep: "apply-icp-rubric",
|
|
292
|
+
currentStepTransition: "sample-needs-revision",
|
|
265
293
|
},
|
|
266
294
|
});
|
|
267
295
|
}
|
|
268
296
|
const nextAction = !passFloorMet && pendingWorkCount === 0
|
|
269
|
-
? "revise-
|
|
297
|
+
? "revise-rubric-new-sample-or-source"
|
|
270
298
|
: !generatedFloorMet
|
|
271
299
|
? "queue-or-retry-message-generation"
|
|
272
300
|
: pendingWorkCount > 0
|
|
@@ -404,7 +432,7 @@ export async function waitForCampaignProcessing(input) {
|
|
|
404
432
|
minGeneratedMessages,
|
|
405
433
|
},
|
|
406
434
|
recovery,
|
|
407
|
-
guidance: "Surface this partial validation checkpoint before taking another action. Use recovery.suggestedToolCalls to retry processing, queue missing work, or revise
|
|
435
|
+
guidance: "Surface this partial validation checkpoint before taking another action. Use recovery.suggestedToolCalls to retry processing, queue missing work, revise rubrics, record a fresh same-source sample, revise source, or revise message quality instead of moving to Settings on a weak sample.",
|
|
408
436
|
stats: lastStats,
|
|
409
437
|
};
|
|
410
438
|
}
|
package/dist/tools/prompts.js
CHANGED
|
@@ -371,7 +371,7 @@ export function getPostFindLeadsScoutRegistry() {
|
|
|
371
371
|
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.',
|
|
372
372
|
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.",
|
|
373
373
|
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.',
|
|
374
|
-
prepareMessagesRule:
|
|
374
|
+
prepareMessagesRule: `Default create-campaign stays on the existing reviewBatchLimit:15 first campaign-table execution slice. For plain post-mint fill/load/refill requests, first call refill_campaign_sends({ mode:"plan", intent:"plain" }). Plain fill is not an alias for fill_campaign_horizon or campaign creation. If no --yolo is present, report the plan and stop. If --yolo is present, call plan first, inspect blockers, then call refill_campaign_sends({ mode:"apply", yolo:true, planRevision, actionIds }) using only selected immutable actionIds from the fresh plan. Use resolve_campaign_fill_route, fill_campaign_horizon, and start_campaign_message_preparation only as fallback/lower-level diagnostics when refill_campaign_sends is unavailable or when the refill command returns an evergreen subplan. fill_campaign_horizon is evergreen-only and is not the generic regular-campaign fill path. Treat "fill up/load sends" as capacity-fill preparation: calculate the bounded target from sender capacity when needed, then let the command plan source, enrichment, ICP/rubric, Generate Message propagation, approval/ready state, scheduler reread, and blockers. 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. For "approve X messages", use approvalMode:approve only when explicitly requested, but still do not launch. For "schedule X sends" or "fill sender sends", approve only when explicitly requested, then re-read campaign/table scheduled counts; if scheduler-owned scheduledFor cells are not present, report prepared/approved/ready - awaiting scheduler instead of success. Do not call start_campaign as part of refill sends. Launch/start is a separate explicit human action after the operator intentionally wants sends to go out, and it must still verify that the bounded cohort is the only approved cohort and must not broad approve-all. 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. start_campaign remains forbidden until explicit launch/start approval outside refill sends.`,
|
|
375
375
|
},
|
|
376
376
|
};
|
|
377
377
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
type RefillCampaignSendsInput = {
|
|
2
|
+
mode?: "plan" | "apply";
|
|
3
|
+
intent?: "plain" | "evergreen" | "active";
|
|
4
|
+
campaignIds?: string[];
|
|
5
|
+
tableIds?: string[];
|
|
6
|
+
sendWindowDays?: number;
|
|
7
|
+
targetDates?: string[];
|
|
8
|
+
targetScheduledSends?: number;
|
|
9
|
+
approvalMode?: "mark_ready" | "approve";
|
|
10
|
+
yolo?: boolean;
|
|
11
|
+
planRevision?: string;
|
|
12
|
+
actionIds?: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare const refillCampaignSendsToolDefinitions: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: string;
|
|
19
|
+
properties: {
|
|
20
|
+
mode: {
|
|
21
|
+
type: string;
|
|
22
|
+
enum: string[];
|
|
23
|
+
default: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
intent: {
|
|
27
|
+
type: string;
|
|
28
|
+
enum: string[];
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
campaignIds: {
|
|
32
|
+
type: string;
|
|
33
|
+
items: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
maxItems: number;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
tableIds: {
|
|
40
|
+
type: string;
|
|
41
|
+
items: {
|
|
42
|
+
type: string;
|
|
43
|
+
};
|
|
44
|
+
maxItems: number;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
sendWindowDays: {
|
|
48
|
+
type: string;
|
|
49
|
+
minimum: number;
|
|
50
|
+
maximum: number;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
targetDates: {
|
|
54
|
+
type: string;
|
|
55
|
+
items: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
maxItems: number;
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
targetScheduledSends: {
|
|
62
|
+
type: string;
|
|
63
|
+
minimum: number;
|
|
64
|
+
maximum: number;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
approvalMode: {
|
|
68
|
+
type: string;
|
|
69
|
+
enum: string[];
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
yolo: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
planRevision: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
actionIds: {
|
|
81
|
+
type: string;
|
|
82
|
+
items: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
additionalProperties: boolean;
|
|
89
|
+
};
|
|
90
|
+
}[];
|
|
91
|
+
export declare function refillCampaignSends(input: RefillCampaignSendsInput): Promise<unknown>;
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { getApi } from "../api.js";
|
|
2
|
+
async function postRefillCampaignSends(body) {
|
|
3
|
+
const api = getApi();
|
|
4
|
+
return api.post("/api/v3/mcp/refill-campaign-sends", body);
|
|
5
|
+
}
|
|
6
|
+
export const refillCampaignSendsToolDefinitions = [
|
|
7
|
+
{
|
|
8
|
+
name: "refill_campaign_sends",
|
|
9
|
+
description: "Default mode is plan and read-only. Use this as the canonical tool for plain fill, refill sends, max out sends, load everyone up, and fill send window requests. It returns a campaign send refill plan for regular campaigns and evergreen campaigns, including campaign/table ids, senders, source state, current evergreen source audit evidence, funnel counts, blockers, stable planRevision, and immutable actionIds. It does not create campaigns, create side campaigns, use unsupported_campaign_type internal targets, does not launch or start campaigns, spend paid InMail opt-in, and does not raw-write scheduler fields. mode apply requires yolo: true, the fresh planRevision from the immediately preceding plan, and selected actionIds only; apply rejects changed caps, source ids, target dates, approval mode, or selectors. Evergreen source fallback is evidence-gated: audit the current evergreen source first and recommend the next source-ladder option only after current-source exhaustion or insufficient good-prospect yield is proven. Scheduled completion is not claimed until scheduler-owned cells are reread with non-null scheduledFor.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
mode: {
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: ["plan", "apply"],
|
|
16
|
+
default: "plan",
|
|
17
|
+
description: 'Defaults to "plan"; plan mode is read-only and returns the plan of attack.',
|
|
18
|
+
},
|
|
19
|
+
intent: {
|
|
20
|
+
type: "string",
|
|
21
|
+
enum: ["plain", "evergreen", "active"],
|
|
22
|
+
description: 'Use "plain" for generic fill/refill sends, "evergreen" for explicit evergreen, and "active" for exact active campaign refill.',
|
|
23
|
+
},
|
|
24
|
+
campaignIds: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: { type: "string" },
|
|
27
|
+
maxItems: 25,
|
|
28
|
+
description: "Optional exact CampaignOffer ids. Do not pass names.",
|
|
29
|
+
},
|
|
30
|
+
tableIds: {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: { type: "string" },
|
|
33
|
+
maxItems: 25,
|
|
34
|
+
description: "Optional exact WorkflowTable ids. Do not pass names.",
|
|
35
|
+
},
|
|
36
|
+
sendWindowDays: {
|
|
37
|
+
type: "number",
|
|
38
|
+
minimum: 1,
|
|
39
|
+
maximum: 30,
|
|
40
|
+
description: "Optional send window size in days.",
|
|
41
|
+
},
|
|
42
|
+
targetDates: {
|
|
43
|
+
type: "array",
|
|
44
|
+
items: { type: "string" },
|
|
45
|
+
maxItems: 30,
|
|
46
|
+
description: "Optional ISO date keys for the send window.",
|
|
47
|
+
},
|
|
48
|
+
targetScheduledSends: {
|
|
49
|
+
type: "number",
|
|
50
|
+
minimum: 1,
|
|
51
|
+
maximum: 500,
|
|
52
|
+
description: "Optional bounded send target. This is not a launch request.",
|
|
53
|
+
},
|
|
54
|
+
approvalMode: {
|
|
55
|
+
type: "string",
|
|
56
|
+
enum: ["mark_ready", "approve"],
|
|
57
|
+
description: "Planning preference. Use approve only when the user explicitly asked for approval; launch remains separate.",
|
|
58
|
+
},
|
|
59
|
+
yolo: {
|
|
60
|
+
type: "boolean",
|
|
61
|
+
description: "Required true for apply. Never use in production without explicit operator approval of exact workspace, campaign/table ids, action ids, caps/dates, and expected side effects.",
|
|
62
|
+
},
|
|
63
|
+
planRevision: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Required for apply. Copy from the fresh read-only plan response.",
|
|
66
|
+
},
|
|
67
|
+
actionIds: {
|
|
68
|
+
type: "array",
|
|
69
|
+
items: { type: "string" },
|
|
70
|
+
description: "Required for apply. Select immutable actionIds from the fresh plan only.",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
additionalProperties: false,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
export function refillCampaignSends(input) {
|
|
78
|
+
return postRefillCampaignSends({
|
|
79
|
+
mode: input.mode ?? "plan",
|
|
80
|
+
intent: input.intent,
|
|
81
|
+
campaignIds: input.campaignIds,
|
|
82
|
+
tableIds: input.tableIds,
|
|
83
|
+
sendWindowDays: input.sendWindowDays,
|
|
84
|
+
targetScheduledSends: input.targetScheduledSends,
|
|
85
|
+
targetDates: input.targetDates,
|
|
86
|
+
approvalMode: input.approvalMode,
|
|
87
|
+
yolo: input.yolo,
|
|
88
|
+
planRevision: input.planRevision,
|
|
89
|
+
actionIds: input.actionIds,
|
|
90
|
+
});
|
|
91
|
+
}
|