@sellable/mcp 0.1.510 → 0.1.511
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 +1 -4
- package/dist/tools/campaigns.d.ts +1 -54
- package/dist/tools/campaigns.js +3 -18
- package/dist/tools/leads.d.ts +0 -2
- package/dist/tools/leads.js +33 -116
- package/dist/tools/prompts.js +1 -1
- package/dist/tools/refill-sends.d.ts +40 -38
- package/dist/tools/refill-sends.js +130 -261
- package/dist/tools/refill-target-plan.js +22 -3
- package/dist/tools/registry.d.ts +0 -49
- package/dist/tools/senders.d.ts +2 -1
- package/dist/tools/senders.js +9 -7
- package/package.json +1 -1
- package/skills/refill-sends/SKILL.md +30 -10
- package/skills/refill-sends-workflow/SKILL.md +27 -2
- package/skills/refill-sends-workflow/core/flow.v1.json +281 -0
package/dist/index-dev.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/server.js
CHANGED
|
@@ -305,10 +305,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
305
305
|
}
|
|
306
306
|
break;
|
|
307
307
|
case "start_campaign":
|
|
308
|
-
result = await startCampaign(
|
|
309
|
-
campaignId: args?.campaignId,
|
|
310
|
-
workspaceId: args?.workspaceId,
|
|
311
|
-
});
|
|
308
|
+
result = await startCampaign(args?.campaignId);
|
|
312
309
|
if (args?.campaignId && result?.success) {
|
|
313
310
|
markCampaignContextDirty(args.campaignId, "start_campaign");
|
|
314
311
|
}
|
|
@@ -185,7 +185,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
185
185
|
useMessagingTemplate?: undefined;
|
|
186
186
|
rubric?: undefined;
|
|
187
187
|
flowVersion?: undefined;
|
|
188
|
-
workspaceId?: undefined;
|
|
189
188
|
};
|
|
190
189
|
required: string[];
|
|
191
190
|
additionalProperties: boolean;
|
|
@@ -224,7 +223,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
224
223
|
useMessagingTemplate?: undefined;
|
|
225
224
|
rubric?: undefined;
|
|
226
225
|
flowVersion?: undefined;
|
|
227
|
-
workspaceId?: undefined;
|
|
228
226
|
};
|
|
229
227
|
required: never[];
|
|
230
228
|
additionalProperties?: undefined;
|
|
@@ -263,7 +261,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
263
261
|
useMessagingTemplate?: undefined;
|
|
264
262
|
rubric?: undefined;
|
|
265
263
|
flowVersion?: undefined;
|
|
266
|
-
workspaceId?: undefined;
|
|
267
264
|
};
|
|
268
265
|
required: string[];
|
|
269
266
|
additionalProperties?: undefined;
|
|
@@ -345,7 +342,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
345
342
|
useMessagingTemplate?: undefined;
|
|
346
343
|
rubric?: undefined;
|
|
347
344
|
flowVersion?: undefined;
|
|
348
|
-
workspaceId?: undefined;
|
|
349
345
|
};
|
|
350
346
|
required: string[];
|
|
351
347
|
additionalProperties: boolean;
|
|
@@ -540,7 +536,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
540
536
|
useMessagingTemplate?: undefined;
|
|
541
537
|
rubric?: undefined;
|
|
542
538
|
flowVersion?: undefined;
|
|
543
|
-
workspaceId?: undefined;
|
|
544
539
|
};
|
|
545
540
|
required: never[];
|
|
546
541
|
additionalProperties?: undefined;
|
|
@@ -746,49 +741,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
746
741
|
clientProspectId?: undefined;
|
|
747
742
|
senderLinkedinUrl?: undefined;
|
|
748
743
|
messageGenerationMode?: undefined;
|
|
749
|
-
workspaceId?: undefined;
|
|
750
|
-
};
|
|
751
|
-
required: string[];
|
|
752
|
-
additionalProperties?: undefined;
|
|
753
|
-
};
|
|
754
|
-
} | {
|
|
755
|
-
name: string;
|
|
756
|
-
description: string;
|
|
757
|
-
inputSchema: {
|
|
758
|
-
type: string;
|
|
759
|
-
properties: {
|
|
760
|
-
campaignId: {
|
|
761
|
-
type: string;
|
|
762
|
-
description: string;
|
|
763
|
-
};
|
|
764
|
-
workspaceId: {
|
|
765
|
-
type: string;
|
|
766
|
-
description: string;
|
|
767
|
-
};
|
|
768
|
-
limit?: undefined;
|
|
769
|
-
tableId?: undefined;
|
|
770
|
-
leadLimit?: undefined;
|
|
771
|
-
page?: undefined;
|
|
772
|
-
filters?: undefined;
|
|
773
|
-
name?: undefined;
|
|
774
|
-
clientProspectId?: undefined;
|
|
775
|
-
senderLinkedinUrl?: undefined;
|
|
776
|
-
offerPositioning?: undefined;
|
|
777
|
-
campaignBrief?: undefined;
|
|
778
|
-
messageGenerationMode?: undefined;
|
|
779
|
-
currentStep?: undefined;
|
|
780
|
-
watchNarration?: undefined;
|
|
781
|
-
leadSourceType?: undefined;
|
|
782
|
-
leadSourceProvider?: undefined;
|
|
783
|
-
selectedLeadListId?: undefined;
|
|
784
|
-
senderIds?: undefined;
|
|
785
|
-
currentStepTransition?: undefined;
|
|
786
|
-
clearCurrentStepIfMatches?: undefined;
|
|
787
|
-
interactionMode?: undefined;
|
|
788
|
-
enableICPFilters?: undefined;
|
|
789
|
-
useMessagingTemplate?: undefined;
|
|
790
|
-
rubric?: undefined;
|
|
791
|
-
flowVersion?: undefined;
|
|
792
744
|
};
|
|
793
745
|
required: string[];
|
|
794
746
|
additionalProperties?: undefined;
|
|
@@ -830,7 +782,6 @@ export declare const campaignToolDefinitions: ({
|
|
|
830
782
|
useMessagingTemplate?: undefined;
|
|
831
783
|
rubric?: undefined;
|
|
832
784
|
flowVersion?: undefined;
|
|
833
|
-
workspaceId?: undefined;
|
|
834
785
|
};
|
|
835
786
|
required: string[];
|
|
836
787
|
additionalProperties?: undefined;
|
|
@@ -870,11 +821,7 @@ export interface UpdateCampaignResult {
|
|
|
870
821
|
_campaign?: CampaignOfferNavigation;
|
|
871
822
|
}
|
|
872
823
|
export declare function updateCampaign(campaignId: string, input: UpdateCampaignInput): Promise<UpdateCampaignResult>;
|
|
873
|
-
|
|
874
|
-
campaignId?: string | null;
|
|
875
|
-
workspaceId?: string | null;
|
|
876
|
-
};
|
|
877
|
-
export declare function startCampaign(input: StartCampaignInput): Promise<{
|
|
824
|
+
export declare function startCampaign(campaignId: string): Promise<{
|
|
878
825
|
success: boolean;
|
|
879
826
|
}>;
|
|
880
827
|
export declare function pauseCampaign(campaignId: string): Promise<{
|
package/dist/tools/campaigns.js
CHANGED
|
@@ -4,7 +4,6 @@ import { assertCreateCampaignPromptLoaded, assertNetNewCreateCampaignResearchRea
|
|
|
4
4
|
import { setCampaignInteractionMode, } from "./interaction-mode.js";
|
|
5
5
|
import { isLinkedInProfileInput, normalizeLinkedInProfileInput, } from "./linkedin-url.js";
|
|
6
6
|
import { fetchCampaignRubrics } from "./processing.js";
|
|
7
|
-
import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
|
|
8
7
|
const LEAD_SOURCE_PROVIDERS = {
|
|
9
8
|
APOLLO: "apollo-ai",
|
|
10
9
|
SALES_NAV: "sales-nav",
|
|
@@ -457,7 +456,7 @@ export const campaignToolDefinitions = [
|
|
|
457
456
|
},
|
|
458
457
|
{
|
|
459
458
|
name: "start_campaign",
|
|
460
|
-
description: "Start a paused campaign, enabling the sweeper to send messages. This is an explicit human launch/start action
|
|
459
|
+
description: "Start a paused campaign, enabling the sweeper to send messages. This is an explicit human launch/start action and must not be used as part of fill-send-horizon, message preparation, or scheduling-proof flows.",
|
|
461
460
|
inputSchema: {
|
|
462
461
|
type: "object",
|
|
463
462
|
properties: {
|
|
@@ -465,10 +464,6 @@ export const campaignToolDefinitions = [
|
|
|
465
464
|
type: "string",
|
|
466
465
|
description: "Campaign ID to start",
|
|
467
466
|
},
|
|
468
|
-
workspaceId: {
|
|
469
|
-
type: "string",
|
|
470
|
-
description: "Explicit request-scoped workspace id for scheduled/yolo refill automation.",
|
|
471
|
-
},
|
|
472
467
|
},
|
|
473
468
|
required: ["campaignId"],
|
|
474
469
|
},
|
|
@@ -1019,19 +1014,9 @@ export async function updateCampaign(campaignId, input) {
|
|
|
1019
1014
|
_campaign: result,
|
|
1020
1015
|
};
|
|
1021
1016
|
}
|
|
1022
|
-
export async function startCampaign(
|
|
1023
|
-
const campaignId = typeof input === "string" ? input : input.campaignId?.trim();
|
|
1024
|
-
if (!campaignId) {
|
|
1025
|
-
throw new Error("start_campaign requires campaignId");
|
|
1026
|
-
}
|
|
1027
|
-
const workspaceId = typeof input === "string"
|
|
1028
|
-
? null
|
|
1029
|
-
: normalizeExplicitWorkspaceId(input.workspaceId);
|
|
1030
|
-
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
1017
|
+
export async function startCampaign(campaignId) {
|
|
1031
1018
|
const api = getApi();
|
|
1032
|
-
return
|
|
1033
|
-
? api.post(`/api/v3/campaigns/${campaignId}/start`, { workspaceId }, requestOptions)
|
|
1034
|
-
: api.post(`/api/v3/campaigns/${campaignId}/start`);
|
|
1019
|
+
return api.post(`/api/v3/campaigns/${campaignId}/start`);
|
|
1035
1020
|
}
|
|
1036
1021
|
export async function pauseCampaign(campaignId) {
|
|
1037
1022
|
const api = getApi();
|
package/dist/tools/leads.d.ts
CHANGED
|
@@ -127,7 +127,6 @@ export type LookupSalesNavFilterInput = {
|
|
|
127
127
|
};
|
|
128
128
|
export type SignalSearchInput = {
|
|
129
129
|
type?: "keywords" | "profile" | "post" | "company";
|
|
130
|
-
workspaceId?: string;
|
|
131
130
|
keywords?: Array<{
|
|
132
131
|
keyword: string;
|
|
133
132
|
id?: string;
|
|
@@ -193,7 +192,6 @@ export type ConfirmLeadListInput = {
|
|
|
193
192
|
};
|
|
194
193
|
export type SelectPromisingPostsInput = {
|
|
195
194
|
campaignOfferId: string;
|
|
196
|
-
workspaceId?: string;
|
|
197
195
|
selections: Array<{
|
|
198
196
|
postId: string;
|
|
199
197
|
reason: string;
|
package/dist/tools/leads.js
CHANGED
|
@@ -1259,7 +1259,7 @@ function serializeInvalidSignalPosts(posts) {
|
|
|
1259
1259
|
reason: post.reason,
|
|
1260
1260
|
}));
|
|
1261
1261
|
}
|
|
1262
|
-
async function validateSelectedSignalPostsForImport(api, posts
|
|
1262
|
+
async function validateSelectedSignalPostsForImport(api, posts) {
|
|
1263
1263
|
const results = await Promise.all(posts.map(async (post) => {
|
|
1264
1264
|
if (!post.url.trim()) {
|
|
1265
1265
|
return {
|
|
@@ -1269,15 +1269,10 @@ async function validateSelectedSignalPostsForImport(api, posts, requestOptions)
|
|
|
1269
1269
|
};
|
|
1270
1270
|
}
|
|
1271
1271
|
try {
|
|
1272
|
-
const response =
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}, requestOptions)
|
|
1277
|
-
: await api.post("/api/v1/signal-discovery/search-signals", {
|
|
1278
|
-
type: "post",
|
|
1279
|
-
postUrl: post.url,
|
|
1280
|
-
});
|
|
1272
|
+
const response = await api.post("/api/v1/signal-discovery/search-signals", {
|
|
1273
|
+
type: "post",
|
|
1274
|
+
postUrl: post.url,
|
|
1275
|
+
});
|
|
1281
1276
|
const valid = response.success !== false &&
|
|
1282
1277
|
Array.isArray(response.posts) &&
|
|
1283
1278
|
response.posts.some(hasUsableSignalValidationPost);
|
|
@@ -3638,8 +3633,6 @@ export async function searchSignals(input) {
|
|
|
3638
3633
|
campaignOfferId: input?.campaignOfferId,
|
|
3639
3634
|
});
|
|
3640
3635
|
const api = getApi();
|
|
3641
|
-
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
3642
|
-
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
3643
3636
|
const { campaignOfferId, headlineICPCriteria, rubricGuidelines, currentStepTransition, } = input;
|
|
3644
3637
|
const searchRequest = { ...input };
|
|
3645
3638
|
delete searchRequest.currentStepTransition;
|
|
@@ -3650,61 +3643,36 @@ export async function searchSignals(input) {
|
|
|
3650
3643
|
? headlineICPCriteria
|
|
3651
3644
|
: rubricGuidelines;
|
|
3652
3645
|
if (campaignOfferId && searchCurrentStep) {
|
|
3653
|
-
|
|
3646
|
+
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3654
3647
|
leadSourceType: "new",
|
|
3655
3648
|
leadSourceProvider: "signal-discovery",
|
|
3656
3649
|
currentStep: searchCurrentStep,
|
|
3657
3650
|
...(currentStepTransition ? { currentStepTransition } : {}),
|
|
3658
3651
|
watchNarration: buildSignalDiscoverySearchWatchNarration(),
|
|
3659
|
-
|
|
3660
|
-
};
|
|
3661
|
-
if (requestOptions) {
|
|
3662
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, body, requestOptions);
|
|
3663
|
-
}
|
|
3664
|
-
else {
|
|
3665
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, body);
|
|
3666
|
-
}
|
|
3652
|
+
});
|
|
3667
3653
|
}
|
|
3668
3654
|
// Persist criteria early so user take-over has filters ready.
|
|
3669
3655
|
if (campaignOfferId && effectiveHeadlineICPCriteria?.length) {
|
|
3670
|
-
|
|
3656
|
+
await api.patch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
|
|
3671
3657
|
selectedIds: [],
|
|
3672
3658
|
unselectedIds: [],
|
|
3673
3659
|
headlineICPCriteria: effectiveHeadlineICPCriteria,
|
|
3674
3660
|
rubricGuidelines: effectiveHeadlineICPCriteria,
|
|
3675
|
-
|
|
3676
|
-
};
|
|
3677
|
-
if (requestOptions) {
|
|
3678
|
-
await api.patch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, body, requestOptions);
|
|
3679
|
-
}
|
|
3680
|
-
else {
|
|
3681
|
-
await api.patch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, body);
|
|
3682
|
-
}
|
|
3661
|
+
});
|
|
3683
3662
|
}
|
|
3684
|
-
const response =
|
|
3685
|
-
? await api.post(`/api/v1/signal-discovery/search-signals`, searchRequest, requestOptions)
|
|
3686
|
-
: await api.post(`/api/v1/signal-discovery/search-signals`, searchRequest);
|
|
3663
|
+
const response = await api.post(`/api/v1/signal-discovery/search-signals`, searchRequest);
|
|
3687
3664
|
const summary = summarizeSignalSearchResponse(response);
|
|
3688
3665
|
if (campaignOfferId && searchCurrentStep) {
|
|
3689
|
-
|
|
3666
|
+
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3690
3667
|
currentStep: searchCurrentStep,
|
|
3691
3668
|
...(currentStepTransition ? { currentStepTransition } : {}),
|
|
3692
3669
|
watchNarration: buildSignalDiscoveryResultsWatchNarration(summary.postsReturned),
|
|
3693
|
-
|
|
3694
|
-
};
|
|
3695
|
-
if (requestOptions) {
|
|
3696
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, body, requestOptions);
|
|
3697
|
-
}
|
|
3698
|
-
else {
|
|
3699
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, body);
|
|
3700
|
-
}
|
|
3670
|
+
});
|
|
3701
3671
|
}
|
|
3702
3672
|
return summary;
|
|
3703
3673
|
}
|
|
3704
3674
|
export async function importLeads(input) {
|
|
3705
3675
|
const api = getApi();
|
|
3706
|
-
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
3707
|
-
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
3708
3676
|
const { campaignOfferId, currentStep, sourceLeadListId: inputSourceLeadListId, searchId, targetLeadCount, mode, searchName, leadListName, headlineICPCriteria, targetEngagerCount, maxPostsToScrape, allowInvalidSignalPosts, rubricGuidelines, confirmed, } = input;
|
|
3709
3677
|
assertInteractionApproval({
|
|
3710
3678
|
campaignId: campaignOfferId,
|
|
@@ -3719,9 +3687,7 @@ export async function importLeads(input) {
|
|
|
3719
3687
|
let campaignSelectedLeadListId;
|
|
3720
3688
|
if (!provider || currentStep === undefined || mode === undefined) {
|
|
3721
3689
|
// Pull campaign once when we need provider or to determine default step behavior.
|
|
3722
|
-
const campaign =
|
|
3723
|
-
? await api.get(`/api/v2/campaign-offers/${campaignOfferId}`, requestOptions)
|
|
3724
|
-
: await api.get(`/api/v2/campaign-offers/${campaignOfferId}`);
|
|
3690
|
+
const campaign = await api.get(`/api/v2/campaign-offers/${campaignOfferId}`);
|
|
3725
3691
|
if (!provider) {
|
|
3726
3692
|
provider = normalizeImportProvider(campaign.leadSourceProvider);
|
|
3727
3693
|
}
|
|
@@ -3843,9 +3809,7 @@ export async function importLeads(input) {
|
|
|
3843
3809
|
const effectiveTargetEngagerCount = normalizePositiveInteger(targetEngagerCount) ?? null;
|
|
3844
3810
|
// Get selected posts from the campaign's signal search tabs
|
|
3845
3811
|
// Note: API returns flat fields (postUrl, postContent, authorName, etc.)
|
|
3846
|
-
const tabsResponse =
|
|
3847
|
-
? await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`, requestOptions)
|
|
3848
|
-
: await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
3812
|
+
const tabsResponse = await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
3849
3813
|
// Collect all selected posts, mapping from API format to signal-leads/create format
|
|
3850
3814
|
const selectedPosts = [];
|
|
3851
3815
|
for (const tab of tabsResponse.tabs || []) {
|
|
@@ -3900,7 +3864,7 @@ export async function importLeads(input) {
|
|
|
3900
3864
|
: " Select/promote more right-content posts, run another narrow Signal Discovery search, or switch to Sales Nav recent activity if the lane cannot produce enough source candidates.";
|
|
3901
3865
|
throw new Error(`Signal Discovery selected posts only cover about ${importSelection.estimatedEngagers.toLocaleString("en-US")} people to check, below the approved ${importSelection.targetEngagerCount.toLocaleString("en-US")} source-candidate target. Do not scrape this under-capacity post set.${capClause}`);
|
|
3902
3866
|
}
|
|
3903
|
-
const postValidation = await validateSelectedSignalPostsForImport(api, uniqueSelectedPosts
|
|
3867
|
+
const postValidation = await validateSelectedSignalPostsForImport(api, uniqueSelectedPosts);
|
|
3904
3868
|
const plannedPostKeys = new Set(postsToScrape.map(signalImportPostKey));
|
|
3905
3869
|
const invalidPlannedPosts = postValidation.invalidPosts.filter((post) => plannedPostKeys.has(signalImportPostKey(post)));
|
|
3906
3870
|
const skippedInvalidPostWarning = postValidation.invalidPosts.length > 0
|
|
@@ -3971,7 +3935,7 @@ export async function importLeads(input) {
|
|
|
3971
3935
|
? headlineICPCriteria
|
|
3972
3936
|
: rubricGuidelines;
|
|
3973
3937
|
// Start the scrape job
|
|
3974
|
-
const
|
|
3938
|
+
const result = await api.post(`/api/v3/campaigns/${campaignOfferId}/signal-leads/create`, {
|
|
3975
3939
|
posts: postsToScrape,
|
|
3976
3940
|
targetEngagerCount: importSelection.targetEngagerCount ?? undefined,
|
|
3977
3941
|
...(effectiveHeadlineICPCriteria &&
|
|
@@ -3981,14 +3945,10 @@ export async function importLeads(input) {
|
|
|
3981
3945
|
rubricGuidelines: effectiveHeadlineICPCriteria,
|
|
3982
3946
|
}
|
|
3983
3947
|
: {}),
|
|
3984
|
-
|
|
3985
|
-
};
|
|
3986
|
-
const result = requestOptions
|
|
3987
|
-
? await api.post(`/api/v3/campaigns/${campaignOfferId}/signal-leads/create`, createBody, requestOptions)
|
|
3988
|
-
: await api.post(`/api/v3/campaigns/${campaignOfferId}/signal-leads/create`, createBody);
|
|
3948
|
+
});
|
|
3989
3949
|
// CRITICAL: Update selectedLeadListId so UI subscribes to correct table
|
|
3990
3950
|
// This enables realtime updates in LeadListCanvas
|
|
3991
|
-
|
|
3951
|
+
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3992
3952
|
selectedLeadListId: result.tableId,
|
|
3993
3953
|
...(shouldSetCurrentStep ? { currentStep: postImportCurrentStep } : {}),
|
|
3994
3954
|
...(shouldSetCurrentStep
|
|
@@ -4001,14 +3961,7 @@ export async function importLeads(input) {
|
|
|
4001
3961
|
}),
|
|
4002
3962
|
}
|
|
4003
3963
|
: {}),
|
|
4004
|
-
|
|
4005
|
-
};
|
|
4006
|
-
if (requestOptions) {
|
|
4007
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, updateBody, requestOptions);
|
|
4008
|
-
}
|
|
4009
|
-
else {
|
|
4010
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, updateBody);
|
|
4011
|
-
}
|
|
3964
|
+
});
|
|
4012
3965
|
return {
|
|
4013
3966
|
provider: "signal-discovery",
|
|
4014
3967
|
leadListId: result.tableId,
|
|
@@ -4039,14 +3992,10 @@ export async function importLeads(input) {
|
|
|
4039
3992
|
const fallbackName = leadListName ||
|
|
4040
3993
|
(searchName ? `${providerLabel} - ${searchName}` : undefined) ||
|
|
4041
3994
|
`${providerLabel} Import ${new Date().toISOString().slice(0, 10)}`;
|
|
4042
|
-
const
|
|
3995
|
+
const createResult = await api.post(`/api/v3/lead-lists`, {
|
|
4043
3996
|
name: fallbackName,
|
|
4044
3997
|
templateType: "lead_list",
|
|
4045
|
-
|
|
4046
|
-
};
|
|
4047
|
-
const createResult = requestOptions
|
|
4048
|
-
? await api.post(`/api/v3/lead-lists`, createBody, requestOptions)
|
|
4049
|
-
: await api.post(`/api/v3/lead-lists`, createBody);
|
|
3998
|
+
});
|
|
4050
3999
|
leadListId = createResult.leadList?.id;
|
|
4051
4000
|
createdLeadList = createResult.leadList;
|
|
4052
4001
|
}
|
|
@@ -4060,29 +4009,21 @@ export async function importLeads(input) {
|
|
|
4060
4009
|
const startImport = async () => {
|
|
4061
4010
|
if (provider === "sales-nav") {
|
|
4062
4011
|
// Sales Nav export flow
|
|
4063
|
-
|
|
4012
|
+
return api.post(`/api/v3/sales-nav/export`, {
|
|
4064
4013
|
searchId,
|
|
4065
4014
|
workflowTableId: leadListId,
|
|
4066
4015
|
campaignOfferId,
|
|
4067
4016
|
targetLeadCount: cappedTargetLeadCount ?? defaultProviderSourceListTarget,
|
|
4068
4017
|
...(normalizedMode ? { mode: normalizedMode } : {}),
|
|
4069
|
-
|
|
4070
|
-
};
|
|
4071
|
-
return requestOptions
|
|
4072
|
-
? api.post(`/api/v3/sales-nav/export`, body, requestOptions)
|
|
4073
|
-
: api.post(`/api/v3/sales-nav/export`, body);
|
|
4018
|
+
});
|
|
4074
4019
|
}
|
|
4075
4020
|
if (provider === "prospeo") {
|
|
4076
|
-
|
|
4021
|
+
return api.post(`/api/v3/lead-lists/${leadListId}/prospeo-import/start`, {
|
|
4077
4022
|
searchId,
|
|
4078
4023
|
campaignOfferId,
|
|
4079
4024
|
targetLeadCount: cappedTargetLeadCount ?? defaultProviderSourceListTarget,
|
|
4080
4025
|
...(normalizedMode ? { mode: normalizedMode } : {}),
|
|
4081
|
-
|
|
4082
|
-
};
|
|
4083
|
-
return requestOptions
|
|
4084
|
-
? api.post(`/api/v3/lead-lists/${leadListId}/prospeo-import/start`, body, requestOptions)
|
|
4085
|
-
: api.post(`/api/v3/lead-lists/${leadListId}/prospeo-import/start`, body);
|
|
4026
|
+
});
|
|
4086
4027
|
}
|
|
4087
4028
|
throw new Error(`Unsupported import provider ${provider}. Choose sales-nav, prospeo, or signal-discovery.`);
|
|
4088
4029
|
};
|
|
@@ -4130,7 +4071,7 @@ export async function importLeads(input) {
|
|
|
4130
4071
|
}
|
|
4131
4072
|
// Update selectedLeadListId so UI subscribes to the source lead list
|
|
4132
4073
|
// This enables realtime updates while the import job runs.
|
|
4133
|
-
|
|
4074
|
+
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
4134
4075
|
selectedLeadListId: leadListId,
|
|
4135
4076
|
...(shouldSetCurrentStep ? { currentStep: effectiveCurrentStep } : {}),
|
|
4136
4077
|
...(shouldSetCurrentStep
|
|
@@ -4141,14 +4082,7 @@ export async function importLeads(input) {
|
|
|
4141
4082
|
}),
|
|
4142
4083
|
}
|
|
4143
4084
|
: {}),
|
|
4144
|
-
|
|
4145
|
-
};
|
|
4146
|
-
if (requestOptions) {
|
|
4147
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, updateBody, requestOptions);
|
|
4148
|
-
}
|
|
4149
|
-
else {
|
|
4150
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, updateBody);
|
|
4151
|
-
}
|
|
4085
|
+
});
|
|
4152
4086
|
return {
|
|
4153
4087
|
provider,
|
|
4154
4088
|
leadListId,
|
|
@@ -4648,8 +4582,6 @@ export function getProviderPrompt(input) {
|
|
|
4648
4582
|
}
|
|
4649
4583
|
export async function selectPromisingPosts(input) {
|
|
4650
4584
|
const api = getApi();
|
|
4651
|
-
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
4652
|
-
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
4653
4585
|
const { campaignOfferId, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
|
|
4654
4586
|
const effectiveMode = selectionMode ?? mode ?? "replace";
|
|
4655
4587
|
const effectiveScrapePlanMode = scrapePlanMode ??
|
|
@@ -4669,25 +4601,19 @@ export async function selectPromisingPosts(input) {
|
|
|
4669
4601
|
const postIds = selections.map((s) => s.postId);
|
|
4670
4602
|
let unselectedIds = [];
|
|
4671
4603
|
if (effectiveMode === "replace") {
|
|
4672
|
-
const existing =
|
|
4673
|
-
? await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`, requestOptions)
|
|
4674
|
-
: await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`);
|
|
4604
|
+
const existing = await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`);
|
|
4675
4605
|
const existingIds = existing?.posts
|
|
4676
4606
|
?.map((post) => post.id)
|
|
4677
4607
|
.filter((id) => Boolean(id)) ?? [];
|
|
4678
4608
|
const selectedSet = new Set(postIds);
|
|
4679
4609
|
unselectedIds = existingIds.filter((id) => !selectedSet.has(id));
|
|
4680
4610
|
}
|
|
4681
|
-
const
|
|
4611
|
+
const selectionResult = await api.patch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
|
|
4682
4612
|
selectedIds: postIds,
|
|
4683
4613
|
unselectedIds,
|
|
4684
4614
|
headlineICPCriteria,
|
|
4685
4615
|
rubricGuidelines: headlineICPCriteria,
|
|
4686
|
-
|
|
4687
|
-
};
|
|
4688
|
-
const selectionResult = requestOptions
|
|
4689
|
-
? await api.patch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, selectionBody, requestOptions)
|
|
4690
|
-
: await api.patch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, selectionBody);
|
|
4616
|
+
});
|
|
4691
4617
|
if (selectionResult.selectedCount <= 0) {
|
|
4692
4618
|
return {
|
|
4693
4619
|
success: false,
|
|
@@ -4701,9 +4627,7 @@ export async function selectPromisingPosts(input) {
|
|
|
4701
4627
|
let recommendedPostCount = selectionResult.selectedCount;
|
|
4702
4628
|
let recommendationTargetEngagerCount = null;
|
|
4703
4629
|
try {
|
|
4704
|
-
const tabsResponse =
|
|
4705
|
-
? await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`, requestOptions)
|
|
4706
|
-
: await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
4630
|
+
const tabsResponse = await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
4707
4631
|
const reasonsByPostId = new Map(selections.map((selection) => [selection.postId, selection.reason]));
|
|
4708
4632
|
const selectedByUrl = new Map();
|
|
4709
4633
|
for (const tab of tabsResponse.tabs ?? []) {
|
|
@@ -4760,17 +4684,10 @@ Approval card should say:
|
|
|
4760
4684
|
}
|
|
4761
4685
|
const selectionCurrentStep = currentStep === null ? undefined : (currentStep ?? "signal-discovery");
|
|
4762
4686
|
if (selectionCurrentStep) {
|
|
4763
|
-
|
|
4687
|
+
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
4764
4688
|
currentStep: selectionCurrentStep,
|
|
4765
4689
|
watchNarration: buildSelectedPostApprovalWatchNarration(selectionResult.selectedCount, recommendedPostCount, recommendationTargetEngagerCount),
|
|
4766
|
-
|
|
4767
|
-
};
|
|
4768
|
-
if (requestOptions) {
|
|
4769
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, body, requestOptions);
|
|
4770
|
-
}
|
|
4771
|
-
else {
|
|
4772
|
-
await api.put(`/api/v2/campaign-offers/${campaignOfferId}`, body);
|
|
4773
|
-
}
|
|
4690
|
+
});
|
|
4774
4691
|
}
|
|
4775
4692
|
return {
|
|
4776
4693
|
success: true,
|
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. 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.`,
|
|
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" }) and get_subskill_asset({ subskillName: "refill-sends-workflow", assetPath: "core/flow.v1.json" }) to hasMore:false before operational steps, 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. Freshness gate precedes scheduler wait: if any selected target.senderRefillPlans[].paidInmail.status is missing_credit_facts or stale_credit_facts, or the target plan contains refresh_paid_inmail_credits, do not enter wait_for_scheduler even when remainingReadyOrProjectedGap is 0; refresh exact sender credit facts once, reread get_refill_target_plan, then choose scheduler wait only if freshness is clean. 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
|
}
|