@sellable/mcp 0.1.499 → 0.1.500
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/tools/refill-sends.js +24 -7
- package/package.json +1 -1
|
@@ -494,7 +494,13 @@ function keywordsFromSignalTabs(tabs) {
|
|
|
494
494
|
}
|
|
495
495
|
return uniqueStrings([...selectedKeywords, ...fallbackKeywords]).slice(0, 5);
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function selectedPostIdsFromSignalTabs(tabs) {
|
|
498
|
+
return uniqueStrings(tabs.flatMap((tab) => (tab.posts ?? [])
|
|
499
|
+
.filter((post) => post.isSelected === true)
|
|
500
|
+
.map((post) => post.id)));
|
|
501
|
+
}
|
|
502
|
+
function postIdsFromSignalSearch(summary, maxPosts, options = {}) {
|
|
503
|
+
const excludedPostIds = new Set((options.excludePostIds ?? []).map((postId) => postId.toLowerCase()));
|
|
498
504
|
const recommendedPostIds = stringArray(summary?.recommendedPostIds);
|
|
499
505
|
const topPostIds = Array.isArray(summary?.topPosts)
|
|
500
506
|
? summary.topPosts
|
|
@@ -503,7 +509,9 @@ function postIdsFromSignalSearch(summary, maxPosts) {
|
|
|
503
509
|
: null)
|
|
504
510
|
.filter((id) => Boolean(id))
|
|
505
511
|
: [];
|
|
506
|
-
return uniqueStrings([...recommendedPostIds, ...topPostIds])
|
|
512
|
+
return uniqueStrings([...recommendedPostIds, ...topPostIds])
|
|
513
|
+
.filter((postId) => !excludedPostIds.has(postId.toLowerCase()))
|
|
514
|
+
.slice(0, Math.max(1, maxPosts));
|
|
507
515
|
}
|
|
508
516
|
function maxSignalDiscoveryPostsForSourceLimit(sourceRowLimit) {
|
|
509
517
|
return Math.min(SIGNAL_DISCOVERY_MAX_REFILL_POSTS, Math.max(SIGNAL_DISCOVERY_MIN_REFILL_POSTS, Math.ceil(sourceRowLimit / SIGNAL_DISCOVERY_TARGET_ROWS_PER_POST)));
|
|
@@ -597,7 +605,9 @@ async function continueSignalDiscoverySource(action) {
|
|
|
597
605
|
? stringArray(sourceConfig?.headlineICPCriteria)
|
|
598
606
|
: stringArray(sourceConfig?.rubricGuidelines);
|
|
599
607
|
const tabsResponse = await api.get(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
600
|
-
const
|
|
608
|
+
const signalTabs = tabsResponse.tabs ?? [];
|
|
609
|
+
const keywords = keywordsFromSignalTabs(signalTabs);
|
|
610
|
+
const excludedPostIds = selectedPostIdsFromSignalTabs(signalTabs);
|
|
601
611
|
if (keywords.length === 0) {
|
|
602
612
|
return {
|
|
603
613
|
status: "refused",
|
|
@@ -621,12 +631,12 @@ async function continueSignalDiscoverySource(action) {
|
|
|
621
631
|
confirmed: true,
|
|
622
632
|
limit: 50,
|
|
623
633
|
});
|
|
624
|
-
const selectedPostIds = postIdsFromSignalSearch(searchSummary, maxPostsToScrape);
|
|
634
|
+
const selectedPostIds = postIdsFromSignalSearch(searchSummary, maxPostsToScrape, { excludePostIds: excludedPostIds });
|
|
625
635
|
if (selectedPostIds.length === 0) {
|
|
626
636
|
return {
|
|
627
637
|
status: "refused",
|
|
628
|
-
refusalReason: "Signal Discovery search returned no recommended posts to continue the source",
|
|
629
|
-
result: { keywords, searchSummary },
|
|
638
|
+
refusalReason: "Signal Discovery search returned no new recommended posts to continue the source",
|
|
639
|
+
result: { keywords, excludedPostIds, searchSummary },
|
|
630
640
|
};
|
|
631
641
|
}
|
|
632
642
|
const selectionResult = await selectPromisingPosts({
|
|
@@ -665,7 +675,13 @@ async function continueSignalDiscoverySource(action) {
|
|
|
665
675
|
status: "refused",
|
|
666
676
|
refusalReason: stringValue(importRecord.message) ??
|
|
667
677
|
`Signal Discovery import returned ${String(importRecord.error)}`,
|
|
668
|
-
result: {
|
|
678
|
+
result: {
|
|
679
|
+
keywords,
|
|
680
|
+
excludedPostIds,
|
|
681
|
+
selectedPostIds,
|
|
682
|
+
selectionResult,
|
|
683
|
+
importResult,
|
|
684
|
+
},
|
|
669
685
|
};
|
|
670
686
|
}
|
|
671
687
|
return {
|
|
@@ -676,6 +692,7 @@ async function continueSignalDiscoverySource(action) {
|
|
|
676
692
|
previousSourceLeadListId: sourceLeadListId,
|
|
677
693
|
sourceFingerprint,
|
|
678
694
|
keywords,
|
|
695
|
+
excludedPostIds,
|
|
679
696
|
selectedPostIds,
|
|
680
697
|
sourceRowLimit,
|
|
681
698
|
maxPostsToScrape: selectedPostIds.length,
|