@sellable/mcp 0.1.503 → 0.1.504
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/api.d.ts +5 -5
- package/dist/api.js +10 -10
- package/dist/index-dev.js +0 -0
- package/dist/index.js +0 -0
- package/dist/server.js +2 -2
- package/dist/tools/campaign-fill-routing.d.ts +0 -5
- package/dist/tools/campaign-fill-routing.js +3 -13
- package/dist/tools/campaign-message-preparation.d.ts +48 -7
- package/dist/tools/campaign-message-preparation.js +44 -21
- package/dist/tools/campaign-processing.d.ts +0 -19
- package/dist/tools/campaign-processing.js +8 -31
- package/dist/tools/campaign-refill-state.d.ts +0 -5
- package/dist/tools/campaign-refill-state.js +3 -13
- package/dist/tools/leads.d.ts +47 -6
- package/dist/tools/leads.js +30 -26
- package/dist/tools/prompts.js +1 -1
- package/dist/tools/readiness.d.ts +0 -6
- package/dist/tools/readiness.js +5 -12
- package/dist/tools/refill-sends.d.ts +32 -34
- package/dist/tools/refill-sends.js +608 -67
- package/dist/tools/refill-target-plan.d.ts +0 -5
- package/dist/tools/refill-target-plan.js +65 -32
- package/dist/tools/registry.d.ts +48 -205
- package/dist/tools/scheduler-fill-capacity.d.ts +0 -5
- package/dist/tools/scheduler-fill-capacity.js +3 -13
- package/dist/tools/sender-routing.d.ts +1 -8
- package/dist/tools/sender-routing.js +3 -12
- package/dist/tools/senders.d.ts +1 -14
- package/dist/tools/senders.js +5 -31
- package/package.json +1 -1
- package/skills/refill-sends/SKILL.md +28 -49
- package/skills/refill-sends-workflow/SKILL.md +10 -15
- package/dist/tools/workspace-context.d.ts +0 -36
- package/dist/tools/workspace-context.js +0 -39
package/dist/tools/leads.d.ts
CHANGED
|
@@ -148,7 +148,6 @@ export type SignalSearchInput = {
|
|
|
148
148
|
};
|
|
149
149
|
export type ImportLeadsInput = {
|
|
150
150
|
campaignOfferId: string;
|
|
151
|
-
workspaceId?: string;
|
|
152
151
|
currentStep?: string | null;
|
|
153
152
|
confirmed?: boolean;
|
|
154
153
|
provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
|
|
@@ -171,7 +170,6 @@ export type CancelLeadImportInput = {
|
|
|
171
170
|
};
|
|
172
171
|
export type ConfirmLeadListInput = {
|
|
173
172
|
campaignOfferId: string;
|
|
174
|
-
workspaceId?: string;
|
|
175
173
|
currentStep?: string | null;
|
|
176
174
|
confirmed?: boolean;
|
|
177
175
|
sourceLeadListId?: string;
|
|
@@ -181,6 +179,8 @@ export type ConfirmLeadListInput = {
|
|
|
181
179
|
reviewBatchLimit?: number;
|
|
182
180
|
includeRawImportResult?: boolean;
|
|
183
181
|
allowPartialSourceList?: boolean;
|
|
182
|
+
sourceRowIds?: string[];
|
|
183
|
+
sourceRowLimit?: number;
|
|
184
184
|
/**
|
|
185
185
|
* Deprecated alias for reviewBatchLimit. Confirming a lead list now copies the
|
|
186
186
|
* confirmed source into the campaign table; this value no longer caps clone
|
|
@@ -295,6 +295,8 @@ export declare const leadToolDefinitions: ({
|
|
|
295
295
|
keepInSync?: undefined;
|
|
296
296
|
jobId?: undefined;
|
|
297
297
|
reviewBatchLimit?: undefined;
|
|
298
|
+
sourceRowIds?: undefined;
|
|
299
|
+
sourceRowLimit?: undefined;
|
|
298
300
|
allowPartialSourceList?: undefined;
|
|
299
301
|
includeRawImportResult?: undefined;
|
|
300
302
|
selections?: undefined;
|
|
@@ -489,6 +491,8 @@ export declare const leadToolDefinitions: ({
|
|
|
489
491
|
keepInSync?: undefined;
|
|
490
492
|
jobId?: undefined;
|
|
491
493
|
reviewBatchLimit?: undefined;
|
|
494
|
+
sourceRowIds?: undefined;
|
|
495
|
+
sourceRowLimit?: undefined;
|
|
492
496
|
allowPartialSourceList?: undefined;
|
|
493
497
|
includeRawImportResult?: undefined;
|
|
494
498
|
selections?: undefined;
|
|
@@ -582,6 +586,8 @@ export declare const leadToolDefinitions: ({
|
|
|
582
586
|
keepInSync?: undefined;
|
|
583
587
|
jobId?: undefined;
|
|
584
588
|
reviewBatchLimit?: undefined;
|
|
589
|
+
sourceRowIds?: undefined;
|
|
590
|
+
sourceRowLimit?: undefined;
|
|
585
591
|
allowPartialSourceList?: undefined;
|
|
586
592
|
includeRawImportResult?: undefined;
|
|
587
593
|
selections?: undefined;
|
|
@@ -747,6 +753,8 @@ export declare const leadToolDefinitions: ({
|
|
|
747
753
|
keepInSync?: undefined;
|
|
748
754
|
jobId?: undefined;
|
|
749
755
|
reviewBatchLimit?: undefined;
|
|
756
|
+
sourceRowIds?: undefined;
|
|
757
|
+
sourceRowLimit?: undefined;
|
|
750
758
|
allowPartialSourceList?: undefined;
|
|
751
759
|
includeRawImportResult?: undefined;
|
|
752
760
|
selections?: undefined;
|
|
@@ -854,6 +862,8 @@ export declare const leadToolDefinitions: ({
|
|
|
854
862
|
keepInSync?: undefined;
|
|
855
863
|
jobId?: undefined;
|
|
856
864
|
reviewBatchLimit?: undefined;
|
|
865
|
+
sourceRowIds?: undefined;
|
|
866
|
+
sourceRowLimit?: undefined;
|
|
857
867
|
allowPartialSourceList?: undefined;
|
|
858
868
|
includeRawImportResult?: undefined;
|
|
859
869
|
selections?: undefined;
|
|
@@ -970,6 +980,8 @@ export declare const leadToolDefinitions: ({
|
|
|
970
980
|
keepInSync?: undefined;
|
|
971
981
|
jobId?: undefined;
|
|
972
982
|
reviewBatchLimit?: undefined;
|
|
983
|
+
sourceRowIds?: undefined;
|
|
984
|
+
sourceRowLimit?: undefined;
|
|
973
985
|
allowPartialSourceList?: undefined;
|
|
974
986
|
includeRawImportResult?: undefined;
|
|
975
987
|
selections?: undefined;
|
|
@@ -1075,6 +1087,8 @@ export declare const leadToolDefinitions: ({
|
|
|
1075
1087
|
keepInSync?: undefined;
|
|
1076
1088
|
jobId?: undefined;
|
|
1077
1089
|
reviewBatchLimit?: undefined;
|
|
1090
|
+
sourceRowIds?: undefined;
|
|
1091
|
+
sourceRowLimit?: undefined;
|
|
1078
1092
|
allowPartialSourceList?: undefined;
|
|
1079
1093
|
includeRawImportResult?: undefined;
|
|
1080
1094
|
selections?: undefined;
|
|
@@ -1185,6 +1199,8 @@ export declare const leadToolDefinitions: ({
|
|
|
1185
1199
|
keepInSync?: undefined;
|
|
1186
1200
|
jobId?: undefined;
|
|
1187
1201
|
reviewBatchLimit?: undefined;
|
|
1202
|
+
sourceRowIds?: undefined;
|
|
1203
|
+
sourceRowLimit?: undefined;
|
|
1188
1204
|
allowPartialSourceList?: undefined;
|
|
1189
1205
|
includeRawImportResult?: undefined;
|
|
1190
1206
|
selections?: undefined;
|
|
@@ -1283,6 +1299,8 @@ export declare const leadToolDefinitions: ({
|
|
|
1283
1299
|
keepInSync?: undefined;
|
|
1284
1300
|
jobId?: undefined;
|
|
1285
1301
|
reviewBatchLimit?: undefined;
|
|
1302
|
+
sourceRowIds?: undefined;
|
|
1303
|
+
sourceRowLimit?: undefined;
|
|
1286
1304
|
allowPartialSourceList?: undefined;
|
|
1287
1305
|
includeRawImportResult?: undefined;
|
|
1288
1306
|
selections?: undefined;
|
|
@@ -2173,6 +2191,8 @@ export declare const leadToolDefinitions: ({
|
|
|
2173
2191
|
keepInSync?: undefined;
|
|
2174
2192
|
jobId?: undefined;
|
|
2175
2193
|
reviewBatchLimit?: undefined;
|
|
2194
|
+
sourceRowIds?: undefined;
|
|
2195
|
+
sourceRowLimit?: undefined;
|
|
2176
2196
|
allowPartialSourceList?: undefined;
|
|
2177
2197
|
includeRawImportResult?: undefined;
|
|
2178
2198
|
selections?: undefined;
|
|
@@ -2280,6 +2300,8 @@ export declare const leadToolDefinitions: ({
|
|
|
2280
2300
|
keepInSync?: undefined;
|
|
2281
2301
|
jobId?: undefined;
|
|
2282
2302
|
reviewBatchLimit?: undefined;
|
|
2303
|
+
sourceRowIds?: undefined;
|
|
2304
|
+
sourceRowLimit?: undefined;
|
|
2283
2305
|
allowPartialSourceList?: undefined;
|
|
2284
2306
|
includeRawImportResult?: undefined;
|
|
2285
2307
|
selections?: undefined;
|
|
@@ -3325,6 +3347,8 @@ export declare const leadToolDefinitions: ({
|
|
|
3325
3347
|
keepInSync?: undefined;
|
|
3326
3348
|
jobId?: undefined;
|
|
3327
3349
|
reviewBatchLimit?: undefined;
|
|
3350
|
+
sourceRowIds?: undefined;
|
|
3351
|
+
sourceRowLimit?: undefined;
|
|
3328
3352
|
allowPartialSourceList?: undefined;
|
|
3329
3353
|
includeRawImportResult?: undefined;
|
|
3330
3354
|
selections?: undefined;
|
|
@@ -3479,6 +3503,8 @@ export declare const leadToolDefinitions: ({
|
|
|
3479
3503
|
keepInSync?: undefined;
|
|
3480
3504
|
jobId?: undefined;
|
|
3481
3505
|
reviewBatchLimit?: undefined;
|
|
3506
|
+
sourceRowIds?: undefined;
|
|
3507
|
+
sourceRowLimit?: undefined;
|
|
3482
3508
|
allowPartialSourceList?: undefined;
|
|
3483
3509
|
includeRawImportResult?: undefined;
|
|
3484
3510
|
selections?: undefined;
|
|
@@ -3620,6 +3646,8 @@ export declare const leadToolDefinitions: ({
|
|
|
3620
3646
|
keepInSync?: undefined;
|
|
3621
3647
|
jobId?: undefined;
|
|
3622
3648
|
reviewBatchLimit?: undefined;
|
|
3649
|
+
sourceRowIds?: undefined;
|
|
3650
|
+
sourceRowLimit?: undefined;
|
|
3623
3651
|
allowPartialSourceList?: undefined;
|
|
3624
3652
|
includeRawImportResult?: undefined;
|
|
3625
3653
|
selections?: undefined;
|
|
@@ -3716,6 +3744,8 @@ export declare const leadToolDefinitions: ({
|
|
|
3716
3744
|
keepInSync?: undefined;
|
|
3717
3745
|
jobId?: undefined;
|
|
3718
3746
|
reviewBatchLimit?: undefined;
|
|
3747
|
+
sourceRowIds?: undefined;
|
|
3748
|
+
sourceRowLimit?: undefined;
|
|
3719
3749
|
allowPartialSourceList?: undefined;
|
|
3720
3750
|
includeRawImportResult?: undefined;
|
|
3721
3751
|
selections?: undefined;
|
|
@@ -3762,6 +3792,17 @@ export declare const leadToolDefinitions: ({
|
|
|
3762
3792
|
type: string;
|
|
3763
3793
|
description: string;
|
|
3764
3794
|
};
|
|
3795
|
+
sourceRowIds: {
|
|
3796
|
+
type: string;
|
|
3797
|
+
items: {
|
|
3798
|
+
type: string;
|
|
3799
|
+
};
|
|
3800
|
+
description: string;
|
|
3801
|
+
};
|
|
3802
|
+
sourceRowLimit: {
|
|
3803
|
+
type: string;
|
|
3804
|
+
description: string;
|
|
3805
|
+
};
|
|
3765
3806
|
allowPartialSourceList: {
|
|
3766
3807
|
type: string;
|
|
3767
3808
|
description: string;
|
|
@@ -3971,6 +4012,8 @@ export declare const leadToolDefinitions: ({
|
|
|
3971
4012
|
keepInSync?: undefined;
|
|
3972
4013
|
jobId?: undefined;
|
|
3973
4014
|
reviewBatchLimit?: undefined;
|
|
4015
|
+
sourceRowIds?: undefined;
|
|
4016
|
+
sourceRowLimit?: undefined;
|
|
3974
4017
|
allowPartialSourceList?: undefined;
|
|
3975
4018
|
includeRawImportResult?: undefined;
|
|
3976
4019
|
};
|
|
@@ -4068,6 +4111,8 @@ export declare const leadToolDefinitions: ({
|
|
|
4068
4111
|
keepInSync?: undefined;
|
|
4069
4112
|
jobId?: undefined;
|
|
4070
4113
|
reviewBatchLimit?: undefined;
|
|
4114
|
+
sourceRowIds?: undefined;
|
|
4115
|
+
sourceRowLimit?: undefined;
|
|
4071
4116
|
allowPartialSourceList?: undefined;
|
|
4072
4117
|
includeRawImportResult?: undefined;
|
|
4073
4118
|
selections?: undefined;
|
|
@@ -4517,7 +4562,6 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
|
|
|
4517
4562
|
args: {
|
|
4518
4563
|
sourceLeadListId: string;
|
|
4519
4564
|
campaignOfferId: string;
|
|
4520
|
-
workspaceId?: string;
|
|
4521
4565
|
currentStep?: string | null;
|
|
4522
4566
|
confirmed?: boolean;
|
|
4523
4567
|
provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
|
|
@@ -4570,7 +4614,6 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
|
|
|
4570
4614
|
sourceLeadListId: string;
|
|
4571
4615
|
mode: string;
|
|
4572
4616
|
campaignOfferId: string;
|
|
4573
|
-
workspaceId?: string;
|
|
4574
4617
|
currentStep?: string | null;
|
|
4575
4618
|
confirmed?: boolean;
|
|
4576
4619
|
provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
|
|
@@ -4664,7 +4707,6 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
|
|
|
4664
4707
|
provider: string;
|
|
4665
4708
|
confirmed: boolean;
|
|
4666
4709
|
allowInvalidSignalPosts: boolean;
|
|
4667
|
-
workspaceId?: string;
|
|
4668
4710
|
currentStep?: string | null;
|
|
4669
4711
|
sourceLeadListId?: string;
|
|
4670
4712
|
searchId?: string;
|
|
@@ -4739,7 +4781,6 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
|
|
|
4739
4781
|
sourceLeadListId: string;
|
|
4740
4782
|
mode: string;
|
|
4741
4783
|
campaignOfferId: string;
|
|
4742
|
-
workspaceId?: string;
|
|
4743
4784
|
currentStep?: string | null;
|
|
4744
4785
|
confirmed?: boolean;
|
|
4745
4786
|
provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
|
package/dist/tools/leads.js
CHANGED
|
@@ -10,7 +10,6 @@ import { assertInteractionApproval } from "./interaction-mode.js";
|
|
|
10
10
|
import { assertProviderPromptLoaded, markProviderPromptLoaded, } from "./provider-preflight.js";
|
|
11
11
|
import { waitForLeadListReady } from "./readiness.js";
|
|
12
12
|
import { getTableRowsMinimal } from "./rows.js";
|
|
13
|
-
import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
|
|
14
13
|
const entryPath = process.argv[1] ? resolve(process.argv[1]) : process.cwd();
|
|
15
14
|
const entryDir = dirname(entryPath);
|
|
16
15
|
const workspaceRoot = resolveWorkspaceRoot(entryDir);
|
|
@@ -2202,6 +2201,15 @@ export const leadToolDefinitions = [
|
|
|
2202
2201
|
type: "number",
|
|
2203
2202
|
description: "Number of campaign rows to use as the initial review/process sample. Defaults to 15.",
|
|
2204
2203
|
},
|
|
2204
|
+
sourceRowIds: {
|
|
2205
|
+
type: "array",
|
|
2206
|
+
items: { type: "string" },
|
|
2207
|
+
description: "Optional exact source WorkflowTableRow ids to copy from the selected source lead list. Use only for bounded refill same-source copy packets.",
|
|
2208
|
+
},
|
|
2209
|
+
sourceRowLimit: {
|
|
2210
|
+
type: "number",
|
|
2211
|
+
description: "Optional cap for copying the first N source rows. Prefer sourceRowIds when a refill packet provides exact ids.",
|
|
2212
|
+
},
|
|
2205
2213
|
allowPartialSourceList: {
|
|
2206
2214
|
type: "boolean",
|
|
2207
2215
|
description: "Explicit override for user-approved early continuation. Default false. When true, confirm_lead_list may copy the currently materialized rows from a still-running source import; use only after the user explicitly asks to keep going with the partial list.",
|
|
@@ -3633,11 +3641,11 @@ export async function searchSignals(input) {
|
|
|
3633
3641
|
const effectiveHeadlineICPCriteria = headlineICPCriteria && headlineICPCriteria.length > 0
|
|
3634
3642
|
? headlineICPCriteria
|
|
3635
3643
|
: rubricGuidelines;
|
|
3636
|
-
if (campaignOfferId) {
|
|
3644
|
+
if (campaignOfferId && searchCurrentStep) {
|
|
3637
3645
|
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3638
3646
|
leadSourceType: "new",
|
|
3639
3647
|
leadSourceProvider: "signal-discovery",
|
|
3640
|
-
|
|
3648
|
+
currentStep: searchCurrentStep,
|
|
3641
3649
|
...(currentStepTransition ? { currentStepTransition } : {}),
|
|
3642
3650
|
watchNarration: buildSignalDiscoverySearchWatchNarration(),
|
|
3643
3651
|
});
|
|
@@ -3653,9 +3661,9 @@ export async function searchSignals(input) {
|
|
|
3653
3661
|
}
|
|
3654
3662
|
const response = await api.post(`/api/v1/signal-discovery/search-signals`, searchRequest);
|
|
3655
3663
|
const summary = summarizeSignalSearchResponse(response);
|
|
3656
|
-
if (campaignOfferId) {
|
|
3664
|
+
if (campaignOfferId && searchCurrentStep) {
|
|
3657
3665
|
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3658
|
-
|
|
3666
|
+
currentStep: searchCurrentStep,
|
|
3659
3667
|
...(currentStepTransition ? { currentStepTransition } : {}),
|
|
3660
3668
|
watchNarration: buildSignalDiscoveryResultsWatchNarration(summary.postsReturned),
|
|
3661
3669
|
});
|
|
@@ -4128,9 +4136,7 @@ export async function cancelLeadImport(input) {
|
|
|
4128
4136
|
}
|
|
4129
4137
|
export async function confirmLeadList(input) {
|
|
4130
4138
|
const api = getApi();
|
|
4131
|
-
const
|
|
4132
|
-
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
4133
|
-
const { campaignOfferId, currentStep, confirmed, sourceLeadListId, campaignName, keepInSync, jobId, reviewBatchLimit, includeRawImportResult, allowPartialSourceList, targetLeadCount, } = input;
|
|
4139
|
+
const { campaignOfferId, currentStep, confirmed, sourceLeadListId, campaignName, keepInSync, jobId, reviewBatchLimit, includeRawImportResult, allowPartialSourceList, targetLeadCount, sourceRowIds, sourceRowLimit, } = input;
|
|
4134
4140
|
assertInteractionApproval({
|
|
4135
4141
|
campaignId: campaignOfferId,
|
|
4136
4142
|
action: "confirm-lead-list",
|
|
@@ -4139,9 +4145,7 @@ export async function confirmLeadList(input) {
|
|
|
4139
4145
|
let resolvedLeadListId = sourceLeadListId;
|
|
4140
4146
|
let resolvedProvider;
|
|
4141
4147
|
if (!resolvedLeadListId || currentStep === undefined || !resolvedProvider) {
|
|
4142
|
-
const campaign =
|
|
4143
|
-
? await api.get(`/api/v2/campaign-offers/${campaignOfferId}`, requestOptions)
|
|
4144
|
-
: await api.get(`/api/v2/campaign-offers/${campaignOfferId}`);
|
|
4148
|
+
const campaign = await api.get(`/api/v2/campaign-offers/${campaignOfferId}`);
|
|
4145
4149
|
if (!resolvedLeadListId) {
|
|
4146
4150
|
resolvedLeadListId = campaign.selectedLeadListId ?? undefined;
|
|
4147
4151
|
}
|
|
@@ -4189,9 +4193,7 @@ export async function confirmLeadList(input) {
|
|
|
4189
4193
|
: "filter-choice";
|
|
4190
4194
|
const shouldSetCurrentStep = typeof effectiveCurrentStep === "string" && effectiveCurrentStep.length > 0;
|
|
4191
4195
|
let readiness;
|
|
4192
|
-
const leadListMeta =
|
|
4193
|
-
? await api.get(`/api/v3/workflow-tables/${resolvedLeadListId}?mode=meta`, requestOptions)
|
|
4194
|
-
: await api.get(`/api/v3/workflow-tables/${resolvedLeadListId}?mode=meta`);
|
|
4196
|
+
const leadListMeta = await api.get(`/api/v3/workflow-tables/${resolvedLeadListId}?mode=meta`);
|
|
4195
4197
|
const leadListConfig = leadListMeta.table?.config ?? null;
|
|
4196
4198
|
const leadListRowCount = leadListMeta.rowCount ?? 0;
|
|
4197
4199
|
const importProgress = leadListConfig?.importProgress ?? null;
|
|
@@ -4254,7 +4256,6 @@ export async function confirmLeadList(input) {
|
|
|
4254
4256
|
readiness = await waitForLeadListReady({
|
|
4255
4257
|
leadListId: resolvedLeadListId,
|
|
4256
4258
|
campaignOfferId,
|
|
4257
|
-
workspaceId: workspaceId ?? undefined,
|
|
4258
4259
|
provider: resolvedProvider,
|
|
4259
4260
|
jobId,
|
|
4260
4261
|
targetLeadCount: readinessTargetLeadCount,
|
|
@@ -4330,17 +4331,17 @@ export async function confirmLeadList(input) {
|
|
|
4330
4331
|
}
|
|
4331
4332
|
return "Campaign or source lead list could not be found. Re-open the correct campaign or reselect the source list before retrying confirm_lead_list.";
|
|
4332
4333
|
};
|
|
4333
|
-
const
|
|
4334
|
+
const importResult = await api
|
|
4335
|
+
.post(`/api/v3/campaign-builder/import-leads`, {
|
|
4334
4336
|
sourceLeadListId: resolvedLeadListId,
|
|
4335
4337
|
campaignOfferId,
|
|
4336
4338
|
campaignName,
|
|
4337
4339
|
keepInSync,
|
|
4338
4340
|
currentStep: null,
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
: api.post(`/api/v3/campaign-builder/import-leads`, importBody)).catch((error) => {
|
|
4341
|
+
sourceRowIds,
|
|
4342
|
+
sourceRowLimit,
|
|
4343
|
+
})
|
|
4344
|
+
.catch((error) => {
|
|
4344
4345
|
if (isTerminalAccessError(error)) {
|
|
4345
4346
|
throw new Error(formatTerminalAccessError(error));
|
|
4346
4347
|
}
|
|
@@ -4571,7 +4572,7 @@ export function getProviderPrompt(input) {
|
|
|
4571
4572
|
}
|
|
4572
4573
|
export async function selectPromisingPosts(input) {
|
|
4573
4574
|
const api = getApi();
|
|
4574
|
-
const { campaignOfferId, selections, headlineICPCriteria, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
|
|
4575
|
+
const { campaignOfferId, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
|
|
4575
4576
|
const effectiveMode = selectionMode ?? mode ?? "replace";
|
|
4576
4577
|
const effectiveScrapePlanMode = scrapePlanMode ??
|
|
4577
4578
|
(targetEngagerCount || maxPostsToScrape
|
|
@@ -4671,10 +4672,13 @@ Approval card should say:
|
|
|
4671
4672
|
|
|
4672
4673
|
**Approve scraping ${selectionResult.selectedCount} recommended LinkedIn post${selectionResult.selectedCount === 1 ? "" : "s"}?**`;
|
|
4673
4674
|
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4675
|
+
const selectionCurrentStep = currentStep === null ? undefined : (currentStep ?? "signal-discovery");
|
|
4676
|
+
if (selectionCurrentStep) {
|
|
4677
|
+
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
4678
|
+
currentStep: selectionCurrentStep,
|
|
4679
|
+
watchNarration: buildSelectedPostApprovalWatchNarration(selectionResult.selectedCount, recommendedPostCount, recommendationTargetEngagerCount),
|
|
4680
|
+
});
|
|
4681
|
+
}
|
|
4678
4682
|
return {
|
|
4679
4683
|
success: true,
|
|
4680
4684
|
selectedCount: selectionResult.selectedCount,
|
package/dist/tools/prompts.js
CHANGED
|
@@ -373,7 +373,7 @@ export function getPostFindLeadsScoutRegistry() {
|
|
|
373
373
|
codex: 'After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not spawn anything before that question. After the answer, launch only Message Drafting. The filter-choice answer is the post-import user gate for this single worker; do not ask another question about starting it in step-wise or YOLO mode. The registry lookup is not a launch: after get_post_find_leads_scout_registry, immediately invoke Task/spawn_agent or the host background-agent mechanism before loading filter-leads.md, before saving rubrics, and before treating skip-filters as ready for message review. Both choices route through this kickoff; do not let filters_skipped jump straight from filter-choice to message-generation. If filters are chosen, the parent stays on Filter Rules and drafts/saves rubrics with MCP tools while Message Drafting runs in the background. If filters are skipped, move to Messages/message review only after Message Drafting has started or is ready; update_campaign(currentStep=messages) is not proof of launch. If the named Message Drafting custom agent is unavailable, spawn a generic gpt-5.5 xhigh Message Drafting background agent with the same lean campaign/table basis. When the background worker starts, persist workerDetails.messageDraftBuilder with statusSource "branch", status "branch-running", runId, startedAt, updatedAt, basisToken when known, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds; workerStatuses.messageDraftBuilder may be "running" as a simple badge only. Never put rich proof under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start the same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource "parent-thread-fallback" and status "fallback-active", and require the same live context, prompt, assets, and validation gate before message review; do not wait until filters are saved and then call the registry.',
|
|
374
374
|
claude: "After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not invoke any Task/Agent before that question. After the answer, invoke only Message Drafting. If filters are chosen, parent drafts/saves rubrics with MCP tools while Message Drafting runs, asks filter approval, then joins Message Drafting. If filters are skipped, invoke only Message Drafting and move to Messages/message review.",
|
|
375
375
|
parentThreadRule: 'Named agents are optional acceleration, but message drafting is not optional. The only normal background worker is Message Drafting. The filter-choice answer is the campaign-scoped go-ahead for this single post-import worker; do not ask another question to start it in step-wise or YOLO mode. If a named agent is unavailable, use a generic gpt-5.5 xhigh Message Drafting background agent. source work and filter work stay in the parent thread with MCP tools. If post-find-leads-message-scout is available, run it as the background Message Draft Builder after the filter-choice answer. The registry lookup is not a launch: get_post_find_leads_scout_registry only identifies the worker, and Message Drafting counts as started only after Task/spawn_agent or the host background-agent tool is invoked, or after the parent begins the same full message branch inline because no background-agent tool is callable. This launch must happen before loading filter-leads.md, save_rubrics, filter approval, or skip-filter message review; currentStep=messages is not proof of launch. If post-find-leads-message-scout is absent, do not customer-surface install status. Do not silently treat message drafting as started; the main thread must either launch the background worker or execute the same message branch from CampaignOffer state, selected source state, workflowTableId, and initial campaign-table execution slice rows. For a spawned worker, record workerDetails.messageDraftBuilder with statusSource branch / status branch-running, runId, startedAt, updatedAt, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds. workerStatuses.messageDraftBuilder is optional simple badge text only ("running", "ready", "blocked", "idle"); never put runId/statusSource/basis under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start that same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource parent-thread-fallback / status fallback-active then ready, and require the same live context, prompt, assets, and validation gate before message review; do not report that as a background worker failure. If neither branch nor inline fallback can run, return blocked/retry-needed; do not wait until filters are saved and then call the registry. The Message Drafting handoff must be lean. Do not paste copied row counts, brief hashes, review-batch hashes, full reviewBatchRowIds, broad row data, or local debug artifacts into the spawn prompt. Local markdown/json files are not normal-path inputs. The filter-choice question is the first post-import user gate; do not load post-lead registries or filter references before it. Message drafting starts after the filter-choice answer, must load get_subskill_prompt({ subskillName: "generate-messages" }), and must load every required message asset named by generate-messages Mode 0 through get_subskill_asset before drafting. Reference Asset Loading means loading the required pre-draft reference pack before drafting; return blocked/retry-needed if required assets cannot be loaded; load ai-tells.md because it is never optional. The branch or parent-thread fallback loads the full generate-messages prompt and every referenced asset through get_subskill_asset. After generating/revising the candidate and before returning ready, must load get_subskill_prompt({ subskillName: "create-campaign-v2-validation" }) as the final internal validation gate, must read live campaign table state through scoped MCP/product tools, and must reject mismatched selectedLeadListId/workflowTableId/campaign/workspace input. Do not block when filters were chosen but leadScoringRubrics are not yet visible in the branch read; the parent owns save_rubrics and filter approval in parallel, so Message Drafting should return status ready with basisStatus usable_initial when campaign/list/table identity and the non-empty execution slice match. Do not use any alternate, local-artifact, or examples-only message prompt. User copy feedback, message QA, or rewrite requests before approve-message must be routed back to Message Drafting with the current recommendation, lean campaign/table basis, and latest user text; the parent must not rewrite or QA the template from memory and must not call update_campaign_brief before approve-message. The worker validates internally and returns only templateRecommendation, tokenFillRules, renderedGoodSample, status, approveOrReviseRecommendation, validationStatus, outputAt, outputHash, and blocked/retry detail. Do not render renderedFallbackSample, risk notes, or a qaReceipt on the normal happy path. On the filter path, save_rubrics keeps the browser on Filter Rules after save_rubrics so the user can approve the saved criteria; after saved-filter approval, move to Filter Leads with currentStep=apply-icp-rubric whether Message Drafting is ready or still running. Wait there for message approval. Enrichment, filtering, Generate Message cells, sender setup, sequence attach, and launch wait for template approval on the Use Template path. On the skip path, move to Messages/message review after Message Drafting has started or is ready and wait for message approval before enrichment or Settings. Do not render message review from checklist or shortcut instructions; message review requires a messageDraftRecommendation whose basis proves the generate-messages prompt, required message assets, and validation gate ran for the current campaign/table execution slice. Do not automatically rerun Message Drafting after filters/enrichment finish; show the initial draft by default and offer an enriched rewrite only with explicit user opt-in. Handoff and recommendation output are Markdown with labeled fields, not raw JSON.',
|
|
376
|
-
prepareMessagesRule: `Default create-campaign stays on the existing reviewBatchLimit:15 first campaign-table execution slice. For plain post-mint fill/load/refill requests, load get_subskill_prompt({ subskillName: "refill-sends-workflow" }), then call resolve_campaign_fill_route({ intent:"plain" }), list_senders, and get_campaign_refill_state for enough candidate campaigns to identify the campaign that most recently had scheduler-owned sends for the relevant sender set before any mutation. Route outcomes are route:"evergreen_horizon", route:"active_campaigns", and route:"ask_create"; if a plain managed-waterfall route has archived/completed skipped slots or does not cover the named sender set, immediately refetch with resolve_campaign_fill_route({ intent:"active" }) and inspect current dashboard-active ACTIVE/PAUSED campaign-backed sequence campaigns before declaring a sender blocked; stay in the same campaignOfferId/campaignId context after minting. Plain fill is not an alias for fill_campaign_horizon or campaign creation. fill_campaign_horizon is evergreen-only and is not the generic regular-campaign fill path. Campaign creation is allowed only after route:"ask_create" and explicit user selection; it is never the default response to plain fill. Treat "fill up/load sends" as capacity-fill preparation, and treat "refill senders", "fill senders", "max out senders", and "load everyone up" as sender-scoped capacity-fill preparation. For sender-scoped requests with no named senders, --yolo means all eligible healthy senders enrolled in active campaign-backed sequence campaigns in the active workspace; without --yolo, ask which eligible enrolled senders to refill before choosing campaigns or mutating. In non-yolo interactive Codex or Claude Code sessions, post the full sender/campaign/action approval packet in normal chat as Markdown first, then ask request_user_input/AskUserQuestion with exactly Accept and Decline and a compact body that refers back to the posted packet; do not duplicate the campaign table or full operator packet inside the structured question. The chat packet must show workspace, sender scope, a campaign-by-campaign table, exact ids/caps/dates, side effects, forbidden actions, and stop condition before mutation. Default --yolo target is the scheduler-forward 48-hour target window: sender-local send days whose configured sending windows overlap the rolling target window, skipping no-send-hour days. For campaign-scoped fill/refill, select the best recent-send campaign and calculate the bounded gap from healthy sender daily capacity minus projected coverage (actual sent plus future scheduler-owned scheduled sends) and ready-to-schedule rows, then prepare only that gap. For sender-scoped fill/refill, calculate the bounded gap per eligible sender across active enrolled campaigns, counting actual sent coverage, future scheduled rows, and ready-to-schedule rows across those campaigns, then choose the best same-sender campaign to fill each sender gap: prefer recent/future scheduler-owned sends for that sender, then strongest recent result evidence, then source health. Maintain a target-window saturation ledger per selected sender with selected send days, gross capacity, actual sent counts, future scheduler-owned scheduled counts, projected coverage, ready-to-schedule buffer, remaining projected gap, paid-InMail threshold feasibility, and the next MCP primitive. The structured packet lives in target.senderRefillPlans[] with target.eligibleSenderLedger, campaignRanking.options, sourcePlan, nextActions, manualAlternates, and target.globalActionQueue; preserve Need to prepare, Goal, Already sent, Scheduled, Ready and waiting to be scheduled, and Still need labels. In --yolo, execute exactly one globally ranked primitive from the post-refresh target.globalActionQueue[0], then rerun get_refill_target_plan before choosing another action. The refill_sends MCP command maintains a run-local refreshedPaidInmailSenderIds set: if the first target plan contains refresh_paid_inmail_credits for stale/missing paid-InMail facts, refill_sends refreshes each selected paid-InMail sender at most once, reruns get_refill_target_plan, and returns autoPaidInmailRefresh plus the post-refresh targetPlan before the operator chooses prep, approval, start, or fallback. Do not present paid-credit refresh as the next operator action after refill_sends has returned a post-refresh targetPlan. Do not stop after filling only one sender when the request was sender-scoped. In --yolo, continue through every safe selected sender/campaign action covered by the rendered packet, reread after each terminal apply/prep/start result, recompute the target-window saturation ledger, and keep going until projected coverage (sent + scheduled) fills the scheduler-forward target window or a concrete non-scheduler blocker is proven. Ready-to-schedule rows are buffer, not completion; if ready covers the projected gap but scheduled cells do not, report loaded, awaiting scheduler and run a persistent read-only scheduler wait/reread loop and keep the run open while awaiting_scheduler_after_ready_buffer is the only remaining state. Paid-InMail threshold changes and connection-campaign creation are explicit continuation options, never --yolo side effects. When no safe in-packet action remains return concrete continuation options with campaign names, exact ids, and which options require a new approval packet; do not return final completion for scheduler wait unless Christian explicitly asks for status or stops the run. Use the refill workflow to decide whether to enrich/prep more rows in that same recent-send/best-result campaign, add/import more rows to that same campaign/source path, use a different existing campaign only when the selected same-sender lane is blocked/exhausted/already loaded while the sender still has a gap, or ask what to create. Do not create warm-post-engager side campaigns. Surface sender-health blockers and paid-InMail threshold blockers separately from prepared/approved/scheduled counts. User-facing refill decisions must be campaign-name-first and sender-name-first, with ids as proof/execution targets only. Trust schedulerGate.sendable and scheduler blockers over raw unipileAccountStatus labels alone. For long-running prep use compact prep status checks, reread target plans after prep or cancel, avoid huge parallel target-plan reads when output is large, and if prepared/ready rows grow but sender-level projected coverage does not move after one bounded settle loop, pivot to compact prep status or a scheduler-proven lane instead of waiting on campaign-level ready counts. For already-running regular campaigns that need Signal Discovery source replenishment, use the guarded currentStep clear with clearCurrentStepIfMatches:"running", campaign-scoped provider prompt/search/select, and import_leads with the existing sourceLeadListId when a newly approved selected-post scrape would otherwise return reusedExistingSourceList. Before prep, inspect get_campaign_refill_state.preparationFrontier. If hasLaterPreparedIsland:true or earliestUnpreparedRow exists before later successful enrichment, use rowSelector:{type:"needsEnrichment"} with columnRole:"enrich" in table-position order or start_campaign_message_preparation adaptive defaults; do not use the UI Jump anchor or needsGeneratedMessage as the refill cursor. After confirm_lead_list copies rows into an existing table, avoid fixed maxRowsToCheck:100; if confirm_lead_list returns USER_ADDED_ROWS_LIMIT_EXCEEDED, create a bounded same-source split from selectedLeadListId with get_rows_minimal/load_csv_linkedin_leads, confirm that smaller source list into the same campaign, and inspect reviewBatch only as diagnostics unless the approved packet explicitly prioritizes the just-copied split and earlier needsEnrichment rows are exhausted, dependency-blocked, or excluded. For approval diagnostics use rowSelector:{type:"needsApproval"} after current generated messages exist; mutating Approved cells still requires approvalMode:approve and exact bounded approval. Do not interpret checkedRows as enriched rows; it is only the table cursor. Prepared, approved, and ready_to_schedule rows are intermediate states; never call them scheduled unless a re-read proves scheduler-owned scheduled cells with non-null scheduledFor contribute to projected coverage, and never call them complete unless a final re-read proves projected coverage fills the scheduler-forward target window. Before source import, prep, approval, or selected paused campaign start, require exact visible approval or --yolo packet auto-accept and a fresh get_campaign_refill_state reread; stop if freshness.stateHash or exact ids changed. For "approve X messages", use approvalMode:approve only when explicitly requested. For "schedule X sends" or "fill sender sends", approve only when explicitly requested, then re-read campaign/table scheduled counts; if projected coverage does not fill the horizon, keep polling when ready buffer covers the gap and report only interim prepared/approved/ready - awaiting scheduler status if Christian asks. Do not call start_campaign as part of fill/schedule horizon. start_campaign is allowed in refill only for exact selected PAUSED, dashboard-active, campaign-backed sequence targets named in the bounded packet, and the packet must state that starting can let the product scheduler schedule/send approved eligible sequence actions. Never start unrelated, archived, completed, draft, direct, or non-selected campaigns, never broad approve-all, and never use direct scheduler writes. campaignId is CampaignOffer.id. If the user asks to stop preparation, the target is wrong, or status shows the wrong campaign/table, use cancel_campaign_message_preparation only for the exact active job. Low-level selectors are diagnostics and recovery only for this lane.`,
|
|
376
|
+
prepareMessagesRule: `Default create-campaign stays on the existing reviewBatchLimit:15 first campaign-table execution slice. For plain post-mint fill/load/refill requests, load get_subskill_prompt({ subskillName: "refill-sends-workflow" }), then call resolve_campaign_fill_route({ intent:"plain" }), list_senders, and get_campaign_refill_state for enough candidate campaigns to identify the campaign that most recently had scheduler-owned sends for the relevant sender set before any mutation. Route outcomes are route:"evergreen_horizon", route:"active_campaigns", and route:"ask_create"; if a plain managed-waterfall route has archived/completed skipped slots or does not cover the named sender set, immediately refetch with resolve_campaign_fill_route({ intent:"active" }) and inspect current dashboard-active ACTIVE/PAUSED campaign-backed sequence campaigns before declaring a sender blocked; stay in the same campaignOfferId/campaignId context after minting. Plain fill is not an alias for fill_campaign_horizon or campaign creation. fill_campaign_horizon is evergreen-only and is not the generic regular-campaign fill path. Campaign creation is allowed only after route:"ask_create" and explicit user selection; it is never the default response to plain fill. Treat "fill up/load sends" as capacity-fill preparation, and treat "refill senders", "fill senders", "max out senders", and "load everyone up" as sender-scoped capacity-fill preparation. For sender-scoped requests with no named senders, --yolo means all eligible healthy senders enrolled in active campaign-backed sequence campaigns in the active workspace; without --yolo, ask which eligible enrolled senders to refill before choosing campaigns or mutating. In non-yolo interactive Codex or Claude Code sessions, post the full sender/campaign/action approval packet in normal chat as Markdown first, then ask request_user_input/AskUserQuestion with exactly Accept and Decline and a compact body that refers back to the posted packet; do not duplicate the campaign table or full operator packet inside the structured question. The chat packet must show workspace, sender scope, a campaign-by-campaign table, exact ids/caps/dates, side effects, forbidden actions, and stop condition before mutation. Default --yolo target is the scheduler-forward 48-hour target window: sender-local send days whose configured sending windows overlap the rolling target window, skipping no-send-hour days. For campaign-scoped fill/refill, select the best recent-send campaign and calculate the bounded gap from healthy sender daily capacity minus projected coverage (actual sent plus future scheduler-owned scheduled sends) and ready-to-schedule rows, then prepare only that gap. For sender-scoped fill/refill, calculate the bounded gap per eligible sender across active enrolled campaigns, counting actual sent coverage, future scheduled rows, and ready-to-schedule rows across those campaigns, then choose the best same-sender campaign to fill each sender gap: prefer recent/future scheduler-owned sends for that sender, then strongest recent result evidence, then source health. Maintain a target-window saturation ledger per selected sender with selected send days, gross capacity, actual sent counts, future scheduler-owned scheduled counts, projected coverage, ready-to-schedule buffer, remaining projected gap, paid-InMail threshold feasibility, and the next MCP primitive. The structured packet lives in target.senderRefillPlans[] with target.eligibleSenderLedger, campaignRanking.options, sourcePlan, nextActions, manualAlternates, and target.globalActionQueue; preserve Need to prepare, Goal, Already sent, Scheduled, Ready and waiting to be scheduled, and Still need labels. In --yolo, execute exactly one globally ranked primitive from the post-refresh target.globalActionQueue[0], then rerun get_refill_target_plan before choosing another action. Refill action ladder: approve generated rows only when an explicit bounded approval gate exists, process all existing same-campaign unenriched/unprepared rows in bounded batches before any source work, then copy bounded net-new rows from the selected source (selectedLeadListId, provider, and source fingerprint preserved), then use provider-aligned source-more. A new source or provider switch changes the reply-rate baseline and is a manual alternate, not a --yolo side effect. The refill_sends MCP command maintains a run-local refreshedPaidInmailSenderIds set: if the first target plan contains refresh_paid_inmail_credits for stale/missing paid-InMail facts, refill_sends refreshes each selected paid-InMail sender at most once, reruns get_refill_target_plan, and returns autoPaidInmailRefresh plus the post-refresh targetPlan before the operator chooses prep/source-copy/bounded-approval/read-only wait. Do not present paid-credit refresh as the next operator action after refill_sends has returned a post-refresh targetPlan. Do not stop after filling only one sender when the request was sender-scoped. In --yolo, continue through every safe selected sender/campaign action covered by the rendered packet, reread after each terminal apply/prep/source-copy/bounded-approval/read-only wait result, recompute the target-window saturation ledger, and keep going until projected coverage (sent + scheduled) fills the scheduler-forward target window or a concrete non-scheduler blocker is proven. Ready-to-schedule rows are buffer, not completion; if ready covers the projected gap but scheduled cells do not, report loaded, awaiting scheduler and run a persistent read-only scheduler wait/reread loop and keep the run open while awaiting_scheduler_after_ready_buffer is the only remaining state. Paid-InMail threshold changes and connection-campaign creation are explicit continuation options, never --yolo side effects. When no safe in-packet action remains return concrete continuation options with campaign names, exact ids, and which options require a new approval packet; do not return final completion for scheduler wait unless Christian explicitly asks for status or stops the run. Use the refill workflow to decide whether to enrich/prep more rows in that same recent-send/best-result campaign, add/import more rows to that same campaign/source path, use a different existing campaign only when the selected same-sender lane is blocked/exhausted/already loaded while the sender still has a gap, or ask what to create. Do not create warm-post-engager side campaigns. Surface sender-health blockers and paid-InMail threshold blockers separately from prepared/approved/scheduled counts. User-facing refill decisions must be campaign-name-first and sender-name-first, with ids as proof/execution targets only. Trust schedulerGate.sendable and scheduler blockers over raw unipileAccountStatus labels alone. For long-running prep use compact prep status checks, reread target plans after prep or cancel, avoid huge parallel target-plan reads when output is large, and if prepared/ready rows grow but sender-level projected coverage does not move after one bounded settle loop, pivot to compact prep status or a scheduler-proven lane instead of waiting on campaign-level ready counts. For already-running regular campaigns that need Signal Discovery source replenishment, use the guarded currentStep clear with clearCurrentStepIfMatches:"running", campaign-scoped provider prompt/search/select, and import_leads with the existing sourceLeadListId when a newly approved selected-post scrape would otherwise return reusedExistingSourceList. Before prep, inspect get_campaign_refill_state.preparationFrontier. If hasLaterPreparedIsland:true or earliestUnpreparedRow exists before later successful enrichment, use rowSelector:{type:"needsEnrichment"} with columnRole:"enrich" in table-position order or start_campaign_message_preparation adaptive defaults; do not use the UI Jump anchor or needsGeneratedMessage as the refill cursor. After confirm_lead_list copies rows into an existing table, avoid fixed maxRowsToCheck:100; if confirm_lead_list returns USER_ADDED_ROWS_LIMIT_EXCEEDED, create a bounded same-source split from selectedLeadListId with get_rows_minimal/load_csv_linkedin_leads, confirm that smaller source list into the same campaign, and inspect reviewBatch only as diagnostics unless the approved packet explicitly prioritizes the just-copied split and earlier needsEnrichment rows are exhausted, dependency-blocked, or excluded. For approval diagnostics use rowSelector:{type:"needsApproval"} after current generated messages exist; mutating Approved cells still requires approvalMode:approve and exact bounded approval. Do not interpret checkedRows as enriched rows; it is only the table cursor. Prepared, approved, and ready_to_schedule rows are intermediate states; never call them scheduled unless a re-read proves scheduler-owned scheduled cells with non-null scheduledFor contribute to projected coverage, and never call them complete unless a final re-read proves projected coverage fills the scheduler-forward target window. Before source import, prep, approval, or selected paused campaign start, require exact visible approval or --yolo packet auto-accept and a fresh get_campaign_refill_state reread; stop if freshness.stateHash or exact ids changed. For "approve X messages", use approvalMode:approve only when explicitly requested. For "schedule X sends" or "fill sender sends", approve only when explicitly requested, then re-read campaign/table scheduled counts; if projected coverage does not fill the horizon, keep polling when ready buffer covers the gap and report only interim prepared/approved/ready - awaiting scheduler status if Christian asks. Do not call start_campaign as part of fill/schedule horizon. start_campaign is allowed in refill only for exact selected PAUSED, dashboard-active, campaign-backed sequence targets named in the bounded packet, and the packet must state that starting can let the product scheduler schedule/send approved eligible sequence actions. Never start unrelated, archived, completed, draft, direct, or non-selected campaigns, never broad approve-all, and never use direct scheduler writes. campaignId is CampaignOffer.id. If the user asks to stop preparation, the target is wrong, or status shows the wrong campaign/table, use cancel_campaign_message_preparation only for the exact active job. Low-level selectors are diagnostics and recovery only for this lane.`,
|
|
377
377
|
},
|
|
378
378
|
};
|
|
379
379
|
}
|
|
@@ -8,7 +8,6 @@ type WaitForCampaignTableReadyInput = {
|
|
|
8
8
|
type WaitForLeadListReadyInput = {
|
|
9
9
|
leadListId?: string;
|
|
10
10
|
campaignOfferId?: string;
|
|
11
|
-
workspaceId?: string;
|
|
12
11
|
provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery" | "csv-linkedin";
|
|
13
12
|
jobId?: string;
|
|
14
13
|
targetLeadCount?: number;
|
|
@@ -52,7 +51,6 @@ export declare const readinessToolDefinitions: ({
|
|
|
52
51
|
};
|
|
53
52
|
leadListId?: undefined;
|
|
54
53
|
campaignOfferId?: undefined;
|
|
55
|
-
workspaceId?: undefined;
|
|
56
54
|
provider?: undefined;
|
|
57
55
|
jobId?: undefined;
|
|
58
56
|
targetLeadCount?: undefined;
|
|
@@ -75,10 +73,6 @@ export declare const readinessToolDefinitions: ({
|
|
|
75
73
|
type: string;
|
|
76
74
|
description: string;
|
|
77
75
|
};
|
|
78
|
-
workspaceId: {
|
|
79
|
-
type: string;
|
|
80
|
-
description: string;
|
|
81
|
-
};
|
|
82
76
|
provider: {
|
|
83
77
|
type: string;
|
|
84
78
|
description: string;
|
package/dist/tools/readiness.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getApi } from "../api.js";
|
|
2
2
|
import { hydrateCampaignContextFromNavigation } from "./context.js";
|
|
3
3
|
import { getCampaignNavigationState } from "./navigation.js";
|
|
4
|
-
import { workspaceRequestOptions } from "./workspace-context.js";
|
|
5
4
|
const DEFAULT_TIMEOUT_MS = 90000;
|
|
6
5
|
const DEFAULT_INTERVAL_MS = 2000;
|
|
7
6
|
const TOOL_CALL_TIMEOUT_GUARD_MS = 55000;
|
|
@@ -109,10 +108,6 @@ export const readinessToolDefinitions = [
|
|
|
109
108
|
type: "string",
|
|
110
109
|
description: "Campaign offer ID (used to resolve selectedLeadListId if leadListId is missing).",
|
|
111
110
|
},
|
|
112
|
-
workspaceId: {
|
|
113
|
-
type: "string",
|
|
114
|
-
description: "Explicit request-scoped workspace id for scheduled/yolo refill automation.",
|
|
115
|
-
},
|
|
116
111
|
provider: {
|
|
117
112
|
type: "string",
|
|
118
113
|
description: "Lead provider (apollo, sales-nav, prospeo, signal-discovery). If omitted, derived from campaignOfferId when possible.",
|
|
@@ -198,8 +193,6 @@ export async function waitForCampaignTableReady(input) {
|
|
|
198
193
|
}
|
|
199
194
|
export async function waitForLeadListReady(input) {
|
|
200
195
|
const api = getApi();
|
|
201
|
-
const requestOptions = workspaceRequestOptions(input.workspaceId);
|
|
202
|
-
const apiGet = (path) => requestOptions ? api.get(path, requestOptions) : api.get(path);
|
|
203
196
|
const { effectiveTimeoutMs, guardApplied, requestedTimeoutMs } = resolveWaitTimeout(input.timeoutMs);
|
|
204
197
|
const intervalMs = Math.max(500, input.intervalMs ?? DEFAULT_INTERVAL_MS);
|
|
205
198
|
const requireRows = input.requireRows !== false;
|
|
@@ -208,7 +201,7 @@ export async function waitForLeadListReady(input) {
|
|
|
208
201
|
let provider = input.provider;
|
|
209
202
|
let targetLeadCount = input.targetLeadCount;
|
|
210
203
|
if (input.campaignOfferId && (!leadListId || !provider)) {
|
|
211
|
-
const campaign = await
|
|
204
|
+
const campaign = await api.get(`/api/v2/campaign-offers/${input.campaignOfferId}`);
|
|
212
205
|
if (!leadListId) {
|
|
213
206
|
leadListId = campaign?.selectedLeadListId ?? undefined;
|
|
214
207
|
}
|
|
@@ -238,7 +231,7 @@ export async function waitForLeadListReady(input) {
|
|
|
238
231
|
while (Date.now() - start <= effectiveTimeoutMs) {
|
|
239
232
|
attempts += 1;
|
|
240
233
|
try {
|
|
241
|
-
const meta = await
|
|
234
|
+
const meta = await api.get(`/api/v3/workflow-tables/${leadListId}?mode=meta`);
|
|
242
235
|
const rowCount = meta?.rowCount ?? 0;
|
|
243
236
|
lastRowCount = rowCount;
|
|
244
237
|
const config = meta?.table?.config ?? null;
|
|
@@ -328,7 +321,7 @@ export async function waitForLeadListReady(input) {
|
|
|
328
321
|
// If config didn't provide a status, fall back to provider-specific checks.
|
|
329
322
|
if (!configStatus) {
|
|
330
323
|
if (provider === "apollo") {
|
|
331
|
-
const statusResponse = await
|
|
324
|
+
const statusResponse = await api.get(`/api/v3/lead-lists/${leadListId}/apollo-import/status`);
|
|
332
325
|
const status = statusResponse?.status ?? null;
|
|
333
326
|
lastStatus = status;
|
|
334
327
|
statusTarget = statusResponse?.progress?.targetLeadCount ?? null;
|
|
@@ -371,7 +364,7 @@ export async function waitForLeadListReady(input) {
|
|
|
371
364
|
}
|
|
372
365
|
else if (provider === "sales-nav") {
|
|
373
366
|
if (jobId) {
|
|
374
|
-
const statusResponse = await
|
|
367
|
+
const statusResponse = await api.get(`/api/v3/sales-nav/export?jobId=${jobId}`);
|
|
375
368
|
const status = statusResponse?.job?.status ?? null;
|
|
376
369
|
lastStatus = status;
|
|
377
370
|
statusTarget = statusResponse?.job?.targetLeadCount ?? null;
|
|
@@ -417,7 +410,7 @@ export async function waitForLeadListReady(input) {
|
|
|
417
410
|
}
|
|
418
411
|
else if (provider === "prospeo") {
|
|
419
412
|
if (jobId) {
|
|
420
|
-
const statusResponse = await
|
|
413
|
+
const statusResponse = await api.get(`/api/v3/lead-lists/${leadListId}/prospeo-import/status?jobId=${jobId}`);
|
|
421
414
|
const status = statusResponse?.job?.status ?? null;
|
|
422
415
|
lastStatus = status;
|
|
423
416
|
statusTarget = statusResponse?.job?.targetLeadCount ?? null;
|