@sellable/mcp 0.1.793 → 0.1.794
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/agent-tool-names.d.ts +2 -2
- package/dist/agent-tool-names.js +14 -0
- package/dist/scheduler-envelope.d.ts +190 -0
- package/dist/scheduler-envelope.js +412 -0
- package/dist/server.js +28 -2
- package/dist/tools/campaign-message-preparation.d.ts +25 -0
- package/dist/tools/campaign-message-preparation.js +37 -0
- package/dist/tools/campaign-processing.d.ts +74 -1
- package/dist/tools/campaign-processing.js +57 -1
- package/dist/tools/prompts.d.ts +15 -3
- package/dist/tools/prompts.js +25 -0
- package/dist/tools/refill-executors.d.ts +43 -70
- package/dist/tools/refill-executors.js +201 -273
- package/dist/tools/refill-sends.d.ts +3 -3
- package/dist/tools/refill-sends.js +1 -1
- package/dist/tools/refill-target-plan.js +1 -1
- package/dist/tools/refill-v3-advance-contract.d.ts +618 -0
- package/dist/tools/refill-v3-advance-contract.js +920 -0
- package/dist/tools/refill-v3-advance.d.ts +397 -0
- package/dist/tools/refill-v3-advance.js +75 -0
- package/dist/tools/refill-v3-attention-packet-contract.d.ts +608 -0
- package/dist/tools/refill-v3-attention-packet-contract.js +911 -0
- package/dist/tools/refill-v3-campaign-work.d.ts +324 -0
- package/dist/tools/refill-v3-campaign-work.js +1015 -0
- package/dist/tools/refill-v3-continue-contract.d.ts +433 -0
- package/dist/tools/refill-v3-continue-contract.js +112 -0
- package/dist/tools/refill-v3-continue.d.ts +501 -0
- package/dist/tools/refill-v3-continue.js +654 -0
- package/dist/tools/refill-v3-edit-selected-campaign-contract.d.ts +208 -0
- package/dist/tools/refill-v3-edit-selected-campaign-contract.js +351 -0
- package/dist/tools/refill-v3-edit-selected-campaign.d.ts +232 -0
- package/dist/tools/refill-v3-edit-selected-campaign.js +147 -0
- package/dist/tools/refill-v3-fill-ready-contract.d.ts +198 -0
- package/dist/tools/refill-v3-fill-ready-contract.js +324 -0
- package/dist/tools/refill-v3-fill-ready.d.ts +199 -0
- package/dist/tools/refill-v3-fill-ready.js +136 -0
- package/dist/tools/refill-v3-source-family-dispatch.d.ts +249 -0
- package/dist/tools/refill-v3-source-family-dispatch.js +514 -0
- package/dist/tools/refill-v3-waterfall-contract.d.ts +156 -0
- package/dist/tools/refill-v3-waterfall-contract.js +181 -0
- package/dist/tools/refill-v3-waterfall.d.ts +136 -0
- package/dist/tools/refill-v3-waterfall.js +161 -0
- package/dist/tools/refill-v3-world-state-contract.d.ts +666 -0
- package/dist/tools/refill-v3-world-state-contract.js +790 -0
- package/dist/tools/refill-v3-world-state.d.ts +592 -0
- package/dist/tools/refill-v3-world-state.js +137 -0
- package/dist/tools/registry.d.ts +1710 -3
- package/dist/tools/registry.js +19 -0
- package/package.json +1 -1
- package/skills/refill-sends/SKILL.md +89 -4
- package/skills/refill-sends-waterfall-order/SKILL.md +174 -0
- package/skills/refill-sends-work-campaign/SKILL.md +253 -0
- package/skills/refill-sends-workflow/SKILL.md +112 -5
- package/skills/refill-sends-workflow/core/flow.v3.json +209 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refill V3 table-driven SOURCE-FAMILY DISPATCHER (Phase 146.5 Plan 09 T3/T4/T5,
|
|
3
|
+
* RV3PRM-002/003/004).
|
|
4
|
+
*
|
|
5
|
+
* EXECUTION PLUMBING ONLY. The AI seam decides WHY to broaden, which family,
|
|
6
|
+
* which contextual query, and which minimal filter/keyword/post delta. This
|
|
7
|
+
* module validates that already-bounded command and maps it, through a CONSTANT
|
|
8
|
+
* table, to exactly one existing owner. It contains no family inference, no
|
|
9
|
+
* query invention, no ranking, no yield projection, no provider retry, no import
|
|
10
|
+
* policy, and no fallback between families.
|
|
11
|
+
*
|
|
12
|
+
* It lives INSIDE the package beside its owners (`A09-DISPATCHER-IN-PACKAGE`):
|
|
13
|
+
* every named family owner is declared in `refill-executors.ts`, which reaches
|
|
14
|
+
* the backend over HTTP, so an app-side dispatcher would create an
|
|
15
|
+
* app -> MCP-api-client -> app-route loop and needs a route that was never
|
|
16
|
+
* defined.
|
|
17
|
+
*
|
|
18
|
+
* The searched-negative set is DERIVED from existing source-run/import lineage
|
|
19
|
+
* plus effect fingerprints (`A09-NEGATIVE-SET-OWNER`). There is no new database
|
|
20
|
+
* model, no attempt counter, and no durable ledger. Every entry is append-only,
|
|
21
|
+
* fingerprint-identified, and carries an explicit typed RELEASE CONDITION, so a
|
|
22
|
+
* bounded attempt can never harden into a standing claim.
|
|
23
|
+
*/
|
|
24
|
+
import { type RefillV3ActiveJob, type RefillV3ExhaustionInput, type RefillV3ExhaustionVerdict, type RefillV3LeadSourceFamily, type RefillV3ProviderSearchReference, type RefillV3SourceYieldEvidence, type RefillV3SourceYieldVerdict } from "./refill-v3-attention-packet-contract.js";
|
|
25
|
+
import { type RefillV3CandidateVerdict, type RefillV3SourceCommand } from "./refill-v3-campaign-work.js";
|
|
26
|
+
export declare const REFILL_V3_SOURCE_OWNER_KEYS: readonly ["refreshSenderPostEngagers", "continueSignalDiscoverySource", "broadenSignalSearch", "continueProviderSource", "broadenProviderSearch"];
|
|
27
|
+
export type RefillV3SourceOwnerKey = (typeof REFILL_V3_SOURCE_OWNER_KEYS)[number];
|
|
28
|
+
/**
|
|
29
|
+
* The CONSTANT family table. The public token `cold` maps INTERNALLY to the
|
|
30
|
+
* provider owners; no boundary rewrites it to another public token.
|
|
31
|
+
*/
|
|
32
|
+
export declare const REFILL_V3_SOURCE_FAMILY_TABLE: Readonly<Record<RefillV3LeadSourceFamily, {
|
|
33
|
+
continuation: RefillV3SourceOwnerKey;
|
|
34
|
+
broadening: RefillV3SourceOwnerKey;
|
|
35
|
+
}>>;
|
|
36
|
+
export declare const REFILL_V3_SOURCE_DISPATCH_REFUSALS: readonly ["missing_scope", "foreign_scope", "unsupported_family", "unsupported_action", "malformed_command", "stale_prior_fingerprint", "missing_count", "health_evidence_not_source_work", "live_source_job", "negative_set_replay", "incidental_change_only", "negative_set_provenance_unavailable", "family_switch_prompt_missing", "family_switch_negative_set", "post_engager_refresh_required", "exhaustion_falsified", "keyword_batch_size", "post_cap_exceeded", "post_rationale_missing", "posts_round_budget_spent", "receipt_incomplete"];
|
|
37
|
+
export type RefillV3SourceDispatchRefusal = (typeof REFILL_V3_SOURCE_DISPATCH_REFUSALS)[number];
|
|
38
|
+
/**
|
|
39
|
+
* Provider INFRASTRUCTURE failure is never exhaustion. Each class is RETRYABLE,
|
|
40
|
+
* leaves the campaign NON-exhausted, and — critically — never enters the
|
|
41
|
+
* searched-negative set, because nothing was actually searched (repairs C18).
|
|
42
|
+
*/
|
|
43
|
+
export declare const REFILL_V3_SOURCE_FAILURE_CLASSES: readonly ["owner_threw", "timeout", "provider_5xx", "rate_limit"];
|
|
44
|
+
export type RefillV3SourceFailureClass = (typeof REFILL_V3_SOURCE_FAILURE_CLASSES)[number];
|
|
45
|
+
/**
|
|
46
|
+
* The ONE enumerated release-condition vocabulary shared by the negative-set
|
|
47
|
+
* WRITER and READER. Every entry must name a condition that is actually checked
|
|
48
|
+
* on every evidence change, or the set grows monotonically until every plausible
|
|
49
|
+
* query is refused and the campaign becomes permanently un-broadenable while
|
|
50
|
+
* exhaustion may still be falsified (`A09-NEGATIVE-SET-LIFECYCLE`).
|
|
51
|
+
*/
|
|
52
|
+
export declare const REFILL_V3_NEGATIVE_SET_RELEASE_CONDITIONS: readonly ["campaign_icp_changed", "provider_inventory_refreshed", "evidence_window_rolled", "posts_refreshed_in_window"];
|
|
53
|
+
export type RefillV3NegativeSetReleaseCondition = (typeof REFILL_V3_NEGATIVE_SET_RELEASE_CONDITIONS)[number];
|
|
54
|
+
export declare const REFILL_V3_NEGATIVE_SET_PROVENANCE_UNAVAILABLE: "negative_set_provenance_unavailable";
|
|
55
|
+
/**
|
|
56
|
+
* One canonical source-run / import lineage record. Every field already exists on
|
|
57
|
+
* the source-run and import lineage plus `actionSourceFingerprint` and
|
|
58
|
+
* `actionLeadSourceProvider`; nothing new is persisted.
|
|
59
|
+
*/
|
|
60
|
+
export type RefillV3SourceLineageRecord = {
|
|
61
|
+
campaignId: string;
|
|
62
|
+
family: RefillV3LeadSourceFamily;
|
|
63
|
+
provider: string | null;
|
|
64
|
+
sourceFingerprint: string;
|
|
65
|
+
/** Canonicalized semantic identity: incidental fields are already stripped. */
|
|
66
|
+
semanticFingerprint: string;
|
|
67
|
+
keywordBatch: readonly string[] | null;
|
|
68
|
+
postIds: readonly string[] | null;
|
|
69
|
+
importedCount: number;
|
|
70
|
+
yieldEvidence: RefillV3SourceYieldEvidence | null;
|
|
71
|
+
observedAt: string;
|
|
72
|
+
/** Only a COMPLETED search registers. An unexecuted attempt never does. */
|
|
73
|
+
searchCompleted: boolean;
|
|
74
|
+
};
|
|
75
|
+
export type RefillV3NegativeSetEntry = {
|
|
76
|
+
campaignId: string;
|
|
77
|
+
family: RefillV3LeadSourceFamily;
|
|
78
|
+
sourceFingerprint: string;
|
|
79
|
+
semanticFingerprint: string;
|
|
80
|
+
keywordBatch: readonly string[] | null;
|
|
81
|
+
postIds: readonly string[] | null;
|
|
82
|
+
releaseCondition: RefillV3NegativeSetReleaseCondition;
|
|
83
|
+
observedAt: string;
|
|
84
|
+
};
|
|
85
|
+
export type RefillV3NegativeSet = {
|
|
86
|
+
provenance: "derived";
|
|
87
|
+
entries: readonly RefillV3NegativeSetEntry[];
|
|
88
|
+
/** Rounds already spent on the posts-search avenue in this window. */
|
|
89
|
+
postsRoundsByCampaign: Readonly<Record<string, number>>;
|
|
90
|
+
/** Dry claims are keyed per `(family, campaignId)`, never globally. */
|
|
91
|
+
dryFamilies: readonly string[];
|
|
92
|
+
} | {
|
|
93
|
+
provenance: typeof REFILL_V3_NEGATIVE_SET_PROVENANCE_UNAVAILABLE;
|
|
94
|
+
entries: readonly [];
|
|
95
|
+
postsRoundsByCampaign: Readonly<Record<string, number>>;
|
|
96
|
+
dryFamilies: readonly [];
|
|
97
|
+
};
|
|
98
|
+
export declare const REFILL_V3_SOURCE_DISPATCH_ACTIONS: readonly ["continue", "broaden", "record_exhaustion"];
|
|
99
|
+
export type RefillV3SourceDispatchAction = (typeof REFILL_V3_SOURCE_DISPATCH_ACTIONS)[number];
|
|
100
|
+
export type RefillV3SourceDispatchScope = {
|
|
101
|
+
workspaceId: string;
|
|
102
|
+
campaignId: string;
|
|
103
|
+
tableId: string;
|
|
104
|
+
sourceLeadListId?: string | null;
|
|
105
|
+
senderId: string;
|
|
106
|
+
date: string;
|
|
107
|
+
count: number;
|
|
108
|
+
campaignVersion: number;
|
|
109
|
+
evidenceFingerprint: string;
|
|
110
|
+
priorSourceFingerprint: string;
|
|
111
|
+
idempotencyKey: string;
|
|
112
|
+
providerSearchReference?: RefillV3ProviderSearchReference | null;
|
|
113
|
+
};
|
|
114
|
+
export type RefillV3SourceOwnerReceipt = {
|
|
115
|
+
ownerKey: RefillV3SourceOwnerKey;
|
|
116
|
+
requestFingerprint: string;
|
|
117
|
+
idempotencyKey: string;
|
|
118
|
+
sourceBeforeFingerprint: string;
|
|
119
|
+
sourceAfterFingerprint: string;
|
|
120
|
+
sourceBeforeCount: number;
|
|
121
|
+
sourceAfterCount: number;
|
|
122
|
+
importedCount: number;
|
|
123
|
+
effects: readonly string[];
|
|
124
|
+
replayState: "first" | "exact_replay" | "not_applicable";
|
|
125
|
+
rollback: {
|
|
126
|
+
available: true;
|
|
127
|
+
input: Record<string, unknown>;
|
|
128
|
+
result: string | null;
|
|
129
|
+
} | {
|
|
130
|
+
available: false;
|
|
131
|
+
reason: "not_applicable";
|
|
132
|
+
};
|
|
133
|
+
/** Per-post selection rationale, so a bad pick stays auditable. */
|
|
134
|
+
postRationales: readonly {
|
|
135
|
+
postId: string;
|
|
136
|
+
expectedYieldBasis: string;
|
|
137
|
+
}[] | null;
|
|
138
|
+
yieldEvidence: RefillV3SourceYieldEvidence | null;
|
|
139
|
+
};
|
|
140
|
+
export type RefillV3SourceOwnerOutcome = {
|
|
141
|
+
kind: "receipt";
|
|
142
|
+
receipt: RefillV3SourceOwnerReceipt;
|
|
143
|
+
} | {
|
|
144
|
+
kind: "no_effect";
|
|
145
|
+
receipt: RefillV3SourceOwnerReceipt;
|
|
146
|
+
} | {
|
|
147
|
+
kind: "failure";
|
|
148
|
+
failureClass: RefillV3SourceFailureClass;
|
|
149
|
+
detail: string;
|
|
150
|
+
} | {
|
|
151
|
+
kind: "timeout";
|
|
152
|
+
effectIdentity: string | null;
|
|
153
|
+
};
|
|
154
|
+
export type RefillV3SourceFamilyOwners = Readonly<Record<RefillV3SourceOwnerKey, (request: {
|
|
155
|
+
scope: RefillV3SourceDispatchScope;
|
|
156
|
+
command: RefillV3SourceCommand;
|
|
157
|
+
providerPromptPackage: string | null;
|
|
158
|
+
}) => Promise<RefillV3SourceOwnerOutcome>>>;
|
|
159
|
+
export type RefillV3SourceDispatchInput = {
|
|
160
|
+
scope: RefillV3SourceDispatchScope;
|
|
161
|
+
action: RefillV3SourceDispatchAction;
|
|
162
|
+
/** The AI's already-bounded command. Never re-derived here. */
|
|
163
|
+
command: RefillV3SourceCommand;
|
|
164
|
+
owners: RefillV3SourceFamilyOwners;
|
|
165
|
+
lineage: readonly RefillV3SourceLineageRecord[] | null;
|
|
166
|
+
observedFamily: RefillV3LeadSourceFamily;
|
|
167
|
+
activeJob: RefillV3ActiveJob | null;
|
|
168
|
+
healthEvidence?: readonly string[];
|
|
169
|
+
/** Loaded provider guidance identity, when a new provider search needs it. */
|
|
170
|
+
providerPromptPackage?: string | null;
|
|
171
|
+
/** In-window authored-posts refresh receipt for `post_engager`. */
|
|
172
|
+
postsRefreshedInWindow?: boolean;
|
|
173
|
+
candidateVerdicts?: readonly RefillV3CandidateVerdict[] | null;
|
|
174
|
+
exhaustionEvidence?: RefillV3ExhaustionInput | null;
|
|
175
|
+
};
|
|
176
|
+
export type RefillV3SourceDispatchResult = {
|
|
177
|
+
kind: "dispatched";
|
|
178
|
+
ownerKey: RefillV3SourceOwnerKey;
|
|
179
|
+
family: RefillV3LeadSourceFamily;
|
|
180
|
+
receipt: RefillV3SourceOwnerReceipt;
|
|
181
|
+
yieldVerdict: RefillV3SourceYieldVerdict | null;
|
|
182
|
+
negativeSetAdditions: readonly RefillV3NegativeSetEntry[];
|
|
183
|
+
exhausted: false;
|
|
184
|
+
reobserveRequired: true;
|
|
185
|
+
} | {
|
|
186
|
+
kind: "recorded_exhaustion";
|
|
187
|
+
family: RefillV3LeadSourceFamily;
|
|
188
|
+
receipt: RefillV3SourceOwnerReceipt;
|
|
189
|
+
exhausted: true;
|
|
190
|
+
reobserveRequired: true;
|
|
191
|
+
} | {
|
|
192
|
+
kind: "refused";
|
|
193
|
+
refusal: RefillV3SourceDispatchRefusal;
|
|
194
|
+
detail: string;
|
|
195
|
+
matchingFingerprint: string | null;
|
|
196
|
+
releaseCondition: RefillV3NegativeSetReleaseCondition | null;
|
|
197
|
+
exhausted: false;
|
|
198
|
+
reobserveRequired: boolean;
|
|
199
|
+
} | {
|
|
200
|
+
kind: "scoped_failure";
|
|
201
|
+
family: RefillV3LeadSourceFamily;
|
|
202
|
+
failureClass: RefillV3SourceFailureClass | "uncertain";
|
|
203
|
+
retryable: true;
|
|
204
|
+
effectIdentity: string | null;
|
|
205
|
+
detail: string;
|
|
206
|
+
exhausted: false;
|
|
207
|
+
reobserveRequired: true;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* The SEMANTIC identity of a source command.
|
|
211
|
+
*
|
|
212
|
+
* A timestamp, a counter, a reordered-but-equivalent filter list, and a
|
|
213
|
+
* whitespace edit are INCIDENTAL: they must not buy a second identical search.
|
|
214
|
+
* The caller's `requestFingerprint` is deliberately excluded — it is a transport
|
|
215
|
+
* identity, and including it would let a cosmetic edit re-run the same query.
|
|
216
|
+
*/
|
|
217
|
+
export declare function canonicalRefillV3SourceFingerprint(command: RefillV3SourceCommand): string;
|
|
218
|
+
/**
|
|
219
|
+
* Derive the searched-negative set from durable lineage ALONE.
|
|
220
|
+
*
|
|
221
|
+
* Because it is a pure function of canonical lineage, a cold restart and a new
|
|
222
|
+
* day reconstruct identical verdicts and process memory is never load-bearing.
|
|
223
|
+
* `null` lineage is NOT an empty set: silent shrinkage re-admits previously
|
|
224
|
+
* refused searches, so it yields the typed provenance marker instead.
|
|
225
|
+
*/
|
|
226
|
+
export declare function deriveRefillV3SearchedNegativeSet(lineage: readonly RefillV3SourceLineageRecord[] | null, options?: {
|
|
227
|
+
campaignId?: string;
|
|
228
|
+
}): RefillV3NegativeSet;
|
|
229
|
+
/**
|
|
230
|
+
* Validate ONE already-bounded AI command and map it through the constant table
|
|
231
|
+
* to exactly one existing owner.
|
|
232
|
+
*
|
|
233
|
+
* Every refusal happens BEFORE the single owner call, so a refused command costs
|
|
234
|
+
* zero external work. Nothing here chooses a family, a query, a filter, a post,
|
|
235
|
+
* a provider, or a retry.
|
|
236
|
+
*/
|
|
237
|
+
export declare function dispatchRefillV3SourceFamily(input: RefillV3SourceDispatchInput): Promise<RefillV3SourceDispatchResult>;
|
|
238
|
+
/** Re-exported bounds so no consumer restates them. */
|
|
239
|
+
export declare const REFILL_V3_SOURCE_DISPATCH_BOUNDS: Readonly<{
|
|
240
|
+
keywordBatchSize: 5;
|
|
241
|
+
maxSelectedPosts: 5;
|
|
242
|
+
postsRoundBudget: 3;
|
|
243
|
+
minSourceYield: 0.08;
|
|
244
|
+
yieldSample: 20;
|
|
245
|
+
}>;
|
|
246
|
+
/** The AI claim is ROUTED through the shared predicate, never re-tabled here. */
|
|
247
|
+
export declare function falsifyRefillV3SourceExhaustion(evidence: RefillV3ExhaustionInput): RefillV3ExhaustionVerdict;
|
|
248
|
+
export declare function evaluateRefillV3DispatchYield(evidence: RefillV3SourceYieldEvidence): RefillV3SourceYieldVerdict;
|
|
249
|
+
export declare function isRefillV3LeadSourceFamily(value: unknown): value is RefillV3LeadSourceFamily;
|