@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.
Files changed (54) hide show
  1. package/dist/agent-tool-names.d.ts +2 -2
  2. package/dist/agent-tool-names.js +14 -0
  3. package/dist/scheduler-envelope.d.ts +190 -0
  4. package/dist/scheduler-envelope.js +412 -0
  5. package/dist/server.js +28 -2
  6. package/dist/tools/campaign-message-preparation.d.ts +25 -0
  7. package/dist/tools/campaign-message-preparation.js +37 -0
  8. package/dist/tools/campaign-processing.d.ts +74 -1
  9. package/dist/tools/campaign-processing.js +57 -1
  10. package/dist/tools/prompts.d.ts +15 -3
  11. package/dist/tools/prompts.js +25 -0
  12. package/dist/tools/refill-executors.d.ts +43 -70
  13. package/dist/tools/refill-executors.js +201 -273
  14. package/dist/tools/refill-sends.d.ts +3 -3
  15. package/dist/tools/refill-sends.js +1 -1
  16. package/dist/tools/refill-target-plan.js +1 -1
  17. package/dist/tools/refill-v3-advance-contract.d.ts +618 -0
  18. package/dist/tools/refill-v3-advance-contract.js +920 -0
  19. package/dist/tools/refill-v3-advance.d.ts +397 -0
  20. package/dist/tools/refill-v3-advance.js +75 -0
  21. package/dist/tools/refill-v3-attention-packet-contract.d.ts +608 -0
  22. package/dist/tools/refill-v3-attention-packet-contract.js +911 -0
  23. package/dist/tools/refill-v3-campaign-work.d.ts +324 -0
  24. package/dist/tools/refill-v3-campaign-work.js +1015 -0
  25. package/dist/tools/refill-v3-continue-contract.d.ts +433 -0
  26. package/dist/tools/refill-v3-continue-contract.js +112 -0
  27. package/dist/tools/refill-v3-continue.d.ts +501 -0
  28. package/dist/tools/refill-v3-continue.js +654 -0
  29. package/dist/tools/refill-v3-edit-selected-campaign-contract.d.ts +208 -0
  30. package/dist/tools/refill-v3-edit-selected-campaign-contract.js +351 -0
  31. package/dist/tools/refill-v3-edit-selected-campaign.d.ts +232 -0
  32. package/dist/tools/refill-v3-edit-selected-campaign.js +147 -0
  33. package/dist/tools/refill-v3-fill-ready-contract.d.ts +198 -0
  34. package/dist/tools/refill-v3-fill-ready-contract.js +324 -0
  35. package/dist/tools/refill-v3-fill-ready.d.ts +199 -0
  36. package/dist/tools/refill-v3-fill-ready.js +136 -0
  37. package/dist/tools/refill-v3-source-family-dispatch.d.ts +249 -0
  38. package/dist/tools/refill-v3-source-family-dispatch.js +514 -0
  39. package/dist/tools/refill-v3-waterfall-contract.d.ts +156 -0
  40. package/dist/tools/refill-v3-waterfall-contract.js +181 -0
  41. package/dist/tools/refill-v3-waterfall.d.ts +136 -0
  42. package/dist/tools/refill-v3-waterfall.js +161 -0
  43. package/dist/tools/refill-v3-world-state-contract.d.ts +666 -0
  44. package/dist/tools/refill-v3-world-state-contract.js +790 -0
  45. package/dist/tools/refill-v3-world-state.d.ts +592 -0
  46. package/dist/tools/refill-v3-world-state.js +137 -0
  47. package/dist/tools/registry.d.ts +1710 -3
  48. package/dist/tools/registry.js +19 -0
  49. package/package.json +1 -1
  50. package/skills/refill-sends/SKILL.md +89 -4
  51. package/skills/refill-sends-waterfall-order/SKILL.md +174 -0
  52. package/skills/refill-sends-work-campaign/SKILL.md +253 -0
  53. package/skills/refill-sends-workflow/SKILL.md +112 -5
  54. package/skills/refill-sends-workflow/core/flow.v3.json +209 -0
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Refill V3 selected-campaign EDIT public MCP projection (Phase 146.5 Plan 09
3
+ * T2, RV3EDIT-001).
4
+ *
5
+ * A THIN projection over the package contract and nothing else:
6
+ *
7
+ * 1. it mirrors the closed eleven-key request vocabulary so a protocol-level
8
+ * validator refuses drift before the handler runs;
9
+ * 2. it applies the shared explicit-workspace guard, because a bounded mutation
10
+ * must NAME its target workspace instead of switching the shared active one;
11
+ * 3. it posts the caller's exact values once to the authenticated route, whose
12
+ * parser is the SOLE runtime authority; and
13
+ * 4. it returns only what the sole closed decoder produced.
14
+ *
15
+ * A typed business refusal — including `blocked` — is a successful response
16
+ * VALUE and passes through verbatim. Transport failure is the ONLY source of an
17
+ * error result (error law 6), so nothing here reads a decoded business field to
18
+ * decide failure.
19
+ *
20
+ * The request mirror is not trusted: `tests/mcp/refill-v3/edit-selected-campaign-tool.test.ts`
21
+ * asserts its key set equals `REFILL_V3_EDIT_INPUT_KEYS`, so drift is a failing
22
+ * pin rather than a silent 400.
23
+ */
24
+ import { type RefillV3CampaignEditResult } from "./refill-v3-edit-selected-campaign-contract.js";
25
+ export declare const REFILL_V3_EDIT_SELECTED_CAMPAIGN_ROUTE = "/api/v3/mcp/refill-v3/edit-selected-campaign";
26
+ export declare const REFILL_V3_EDIT_SELECTED_CAMPAIGN_TOOL_NAME: "refill_v3_edit_selected_campaign";
27
+ export declare const refillV3EditSelectedCampaignToolDefinitions: {
28
+ name: "refill_v3_edit_selected_campaign";
29
+ description: string;
30
+ inputSchema: {
31
+ readonly type: "object";
32
+ readonly additionalProperties: false;
33
+ readonly required: readonly ["workspaceId", "campaignId", "tableId", "campaignVersion", "evidenceFingerprint", "priorActionFingerprint", "action", "field", "value", "reobservationScope", "idempotencyKey"];
34
+ readonly properties: {
35
+ readonly workspaceId: {
36
+ readonly type: "string";
37
+ readonly minLength: 1;
38
+ readonly description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.";
39
+ };
40
+ readonly campaignId: {
41
+ readonly type: "string";
42
+ readonly minLength: 1;
43
+ readonly description: "Exact id of the ONE selected campaign this request may touch.";
44
+ };
45
+ readonly tableId: {
46
+ readonly type: "string";
47
+ readonly minLength: 1;
48
+ readonly description: "Exact workflow table id owned by that campaign.";
49
+ };
50
+ readonly campaignVersion: {
51
+ readonly type: "integer";
52
+ readonly minimum: 0;
53
+ readonly description: "Optimistic concurrency token from the selected packet. A stale value refuses before any delegated call.";
54
+ };
55
+ readonly evidenceFingerprint: {
56
+ readonly type: "string";
57
+ readonly minLength: 1;
58
+ readonly description: "Fingerprint of the bounded evidence the edit was chosen from. Stale evidence cannot authorize a mutation.";
59
+ };
60
+ readonly priorActionFingerprint: {
61
+ readonly type: "string";
62
+ readonly minLength: 1;
63
+ readonly description: "Action-specific prior fingerprint proving the delta was derived from the current field value.";
64
+ };
65
+ readonly action: {
66
+ readonly type: "string";
67
+ readonly enum: readonly import("./refill-v3-edit-selected-campaign-contract.js").RefillV3CampaignEditAction[];
68
+ readonly description: "The one closed edit action. Rerun, same-meaning regeneration, and the guarded rubric trial are NOT edit variants and are refused here.";
69
+ };
70
+ readonly field: {
71
+ readonly type: "string";
72
+ readonly minLength: 1;
73
+ readonly description: "The single allowlisted field for that action. A protected field or an action/field mismatch refuses before any delegated call.";
74
+ };
75
+ readonly value: {
76
+ readonly type: readonly ["string", "boolean"];
77
+ readonly description: "The one normalized field-level value. Objects, arrays, and whole-object replacement are refused.";
78
+ };
79
+ readonly reobservationScope: {
80
+ readonly type: "object";
81
+ readonly additionalProperties: false;
82
+ readonly required: readonly ["senderId", "date"];
83
+ readonly properties: {
84
+ readonly senderId: {
85
+ readonly type: "string";
86
+ readonly minLength: 1;
87
+ };
88
+ readonly date: {
89
+ readonly type: "string";
90
+ readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
91
+ };
92
+ };
93
+ readonly description: "The exact sender and sender-local date whose two lanes must be re-observed immediately after the edit.";
94
+ };
95
+ readonly idempotencyKey: {
96
+ readonly type: "string";
97
+ readonly minLength: 1;
98
+ readonly description: "Caller replay identity. Reuse the SAME key to retry one request; the same key with changed input is refused, never converged.";
99
+ };
100
+ };
101
+ };
102
+ outputSchema: Readonly<{
103
+ readonly type: "object";
104
+ readonly additionalProperties: false;
105
+ readonly required: readonly ["schemaVersion", "outcome", "action", "reason", "receipt", "reobservation", "detail"];
106
+ readonly properties: {
107
+ readonly schemaVersion: {
108
+ readonly type: "string";
109
+ readonly const: "refill_v3_campaign_edit.v1.0";
110
+ };
111
+ readonly outcome: {
112
+ readonly type: "string";
113
+ readonly enum: readonly ["applied", "replayed", "rolled_back", "blocked"];
114
+ };
115
+ readonly action: {
116
+ readonly type: "string";
117
+ readonly enum: readonly import("./refill-v3-edit-selected-campaign-contract.js").RefillV3CampaignEditAction[];
118
+ };
119
+ readonly reason: {
120
+ readonly type: readonly ["string", "null"];
121
+ readonly enum: readonly ["cross_workspace_scope", "foreign_campaign_scope", "foreign_table_scope", "stale_campaign_version", "stale_evidence_fingerprint", "stale_prior_fingerprint", "disallowed_action", "protected_field", "value_shape_mismatch", "protected_invariant_weakened", "health_evidence_not_editable", "reobservation_scope_missing", "idempotency_input_changed", "no_edit_available", "uncertain_delegated_effect", null];
122
+ };
123
+ readonly receipt: {
124
+ readonly type: readonly ["object", "null"];
125
+ readonly additionalProperties: false;
126
+ readonly required: readonly ["scopeEcho", "idempotencyKey", "effectKey", "beforeFingerprint", "afterFingerprint", "changedFields", "replayState", "rollback"];
127
+ readonly properties: {
128
+ readonly scopeEcho: {
129
+ readonly type: "string";
130
+ readonly minLength: 1;
131
+ };
132
+ readonly idempotencyKey: {
133
+ readonly type: "string";
134
+ readonly minLength: 1;
135
+ };
136
+ readonly effectKey: {
137
+ readonly type: "string";
138
+ readonly minLength: 1;
139
+ };
140
+ readonly beforeFingerprint: {
141
+ readonly type: "string";
142
+ readonly minLength: 1;
143
+ };
144
+ readonly afterFingerprint: {
145
+ readonly type: "string";
146
+ readonly minLength: 1;
147
+ };
148
+ readonly changedFields: {
149
+ readonly type: "array";
150
+ readonly items: {
151
+ readonly type: "string";
152
+ readonly minLength: 1;
153
+ };
154
+ };
155
+ readonly replayState: {
156
+ readonly type: "string";
157
+ readonly enum: readonly ["first", "exact_replay", "not_applicable"];
158
+ };
159
+ readonly rollback: {
160
+ readonly type: "object";
161
+ readonly additionalProperties: false;
162
+ readonly required: readonly ["available", "input", "result"];
163
+ readonly properties: {
164
+ readonly available: {
165
+ readonly type: "boolean";
166
+ };
167
+ readonly input: {
168
+ readonly type: readonly ["object", "null"];
169
+ };
170
+ readonly result: {
171
+ readonly type: readonly ["string", "null"];
172
+ };
173
+ };
174
+ };
175
+ };
176
+ };
177
+ readonly reobservation: {
178
+ readonly type: readonly ["object", "null"];
179
+ readonly additionalProperties: false;
180
+ readonly required: readonly ["senderId", "date", "required", "lanes"];
181
+ readonly properties: {
182
+ readonly senderId: {
183
+ readonly type: "string";
184
+ readonly minLength: 1;
185
+ };
186
+ readonly date: {
187
+ readonly type: "string";
188
+ readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
189
+ };
190
+ readonly required: {
191
+ readonly type: "boolean";
192
+ readonly const: true;
193
+ };
194
+ readonly lanes: {
195
+ readonly type: "array";
196
+ readonly items: {
197
+ readonly type: "string";
198
+ readonly minLength: 1;
199
+ };
200
+ };
201
+ };
202
+ };
203
+ readonly detail: {
204
+ readonly type: "string";
205
+ };
206
+ };
207
+ }>;
208
+ annotations: {
209
+ title: string;
210
+ readOnlyHint: boolean;
211
+ destructiveHint: boolean;
212
+ idempotentHint: boolean;
213
+ openWorldHint: boolean;
214
+ };
215
+ }[];
216
+ export type RefillV3EditSelectedCampaignToolInput = {
217
+ workspaceId?: string;
218
+ campaignId?: string;
219
+ tableId?: string;
220
+ campaignVersion?: number;
221
+ evidenceFingerprint?: string;
222
+ priorActionFingerprint?: string;
223
+ action?: string;
224
+ field?: string;
225
+ value?: string | boolean;
226
+ reobservationScope?: {
227
+ senderId?: string;
228
+ date?: string;
229
+ };
230
+ idempotencyKey?: string;
231
+ };
232
+ export declare function editRefillV3SelectedCampaignTool(input: RefillV3EditSelectedCampaignToolInput): Promise<RefillV3CampaignEditResult>;
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Refill V3 selected-campaign EDIT public MCP projection (Phase 146.5 Plan 09
3
+ * T2, RV3EDIT-001).
4
+ *
5
+ * A THIN projection over the package contract and nothing else:
6
+ *
7
+ * 1. it mirrors the closed eleven-key request vocabulary so a protocol-level
8
+ * validator refuses drift before the handler runs;
9
+ * 2. it applies the shared explicit-workspace guard, because a bounded mutation
10
+ * must NAME its target workspace instead of switching the shared active one;
11
+ * 3. it posts the caller's exact values once to the authenticated route, whose
12
+ * parser is the SOLE runtime authority; and
13
+ * 4. it returns only what the sole closed decoder produced.
14
+ *
15
+ * A typed business refusal — including `blocked` — is a successful response
16
+ * VALUE and passes through verbatim. Transport failure is the ONLY source of an
17
+ * error result (error law 6), so nothing here reads a decoded business field to
18
+ * decide failure.
19
+ *
20
+ * The request mirror is not trusted: `tests/mcp/refill-v3/edit-selected-campaign-tool.test.ts`
21
+ * asserts its key set equals `REFILL_V3_EDIT_INPUT_KEYS`, so drift is a failing
22
+ * pin rather than a silent 400.
23
+ */
24
+ import { getApi } from "../api.js";
25
+ import { decodeRefillV3CampaignEditResult, REFILL_V3_CAMPAIGN_EDIT_OUTPUT_SCHEMA, REFILL_V3_EDIT_ACTIONS, } from "./refill-v3-edit-selected-campaign-contract.js";
26
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
27
+ export const REFILL_V3_EDIT_SELECTED_CAMPAIGN_ROUTE = "/api/v3/mcp/refill-v3/edit-selected-campaign";
28
+ export const REFILL_V3_EDIT_SELECTED_CAMPAIGN_TOOL_NAME = "refill_v3_edit_selected_campaign";
29
+ const REFILL_V3_EDIT_TOOL_INPUT_SCHEMA = {
30
+ type: "object",
31
+ additionalProperties: false,
32
+ required: [
33
+ "workspaceId",
34
+ "campaignId",
35
+ "tableId",
36
+ "campaignVersion",
37
+ "evidenceFingerprint",
38
+ "priorActionFingerprint",
39
+ "action",
40
+ "field",
41
+ "value",
42
+ "reobservationScope",
43
+ "idempotencyKey",
44
+ ],
45
+ properties: {
46
+ workspaceId: {
47
+ type: "string",
48
+ minLength: 1,
49
+ description: "Explicit request-scoped workspace id. Pass this instead of switching the shared active workspace.",
50
+ },
51
+ campaignId: {
52
+ type: "string",
53
+ minLength: 1,
54
+ description: "Exact id of the ONE selected campaign this request may touch.",
55
+ },
56
+ tableId: {
57
+ type: "string",
58
+ minLength: 1,
59
+ description: "Exact workflow table id owned by that campaign.",
60
+ },
61
+ campaignVersion: {
62
+ type: "integer",
63
+ minimum: 0,
64
+ description: "Optimistic concurrency token from the selected packet. A stale value refuses before any delegated call.",
65
+ },
66
+ evidenceFingerprint: {
67
+ type: "string",
68
+ minLength: 1,
69
+ description: "Fingerprint of the bounded evidence the edit was chosen from. Stale evidence cannot authorize a mutation.",
70
+ },
71
+ priorActionFingerprint: {
72
+ type: "string",
73
+ minLength: 1,
74
+ description: "Action-specific prior fingerprint proving the delta was derived from the current field value.",
75
+ },
76
+ action: {
77
+ type: "string",
78
+ enum: [...REFILL_V3_EDIT_ACTIONS],
79
+ description: "The one closed edit action. Rerun, same-meaning regeneration, and the guarded rubric trial are NOT edit variants and are refused here.",
80
+ },
81
+ field: {
82
+ type: "string",
83
+ minLength: 1,
84
+ description: "The single allowlisted field for that action. A protected field or an action/field mismatch refuses before any delegated call.",
85
+ },
86
+ value: {
87
+ type: ["string", "boolean"],
88
+ description: "The one normalized field-level value. Objects, arrays, and whole-object replacement are refused.",
89
+ },
90
+ reobservationScope: {
91
+ type: "object",
92
+ additionalProperties: false,
93
+ required: ["senderId", "date"],
94
+ properties: {
95
+ senderId: { type: "string", minLength: 1 },
96
+ date: { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}$" },
97
+ },
98
+ description: "The exact sender and sender-local date whose two lanes must be re-observed immediately after the edit.",
99
+ },
100
+ idempotencyKey: {
101
+ type: "string",
102
+ minLength: 1,
103
+ description: "Caller replay identity. Reuse the SAME key to retry one request; the same key with changed input is refused, never converged.",
104
+ },
105
+ },
106
+ };
107
+ export const refillV3EditSelectedCampaignToolDefinitions = [
108
+ {
109
+ name: REFILL_V3_EDIT_SELECTED_CAMPAIGN_TOOL_NAME,
110
+ description: "Apply exactly ONE allowlisted configuration, filter, or source field patch to exactly one already-selected campaign, proven by the exact bounded evidence that chose it. It MUTATES campaign configuration and is deliberately narrow: it wraps and restricts update_campaign and refuses the campaign name, brief, positioning, senders, current step, interaction mode, provider or list replacement, rubric, template or sequence meaning, and any launch or start. It never reruns cells, regenerates messages, relaxes a rubric, writes raw rows, schedules, or sends; those keep their existing owners. A filter or source value that weakens the approved objective or any employment, DNC, legal, or explicit-exclusion invariant is invalid at the schema and makes zero delegated calls. Connection-health facts are categorically not edit actions. Every success returns immutable before/after fingerprints, the exact changed fields, a deterministic effect key, replay state, rollback data, and a required exact sender/date two-lane re-observation; reuse the same idempotencyKey to retry one request.",
111
+ inputSchema: REFILL_V3_EDIT_TOOL_INPUT_SCHEMA,
112
+ outputSchema: REFILL_V3_CAMPAIGN_EDIT_OUTPUT_SCHEMA,
113
+ annotations: {
114
+ title: "Refill V3 Edit Selected Campaign",
115
+ readOnlyHint: false,
116
+ destructiveHint: true,
117
+ idempotentHint: true,
118
+ openWorldHint: false,
119
+ },
120
+ },
121
+ ];
122
+ export async function editRefillV3SelectedCampaignTool(input) {
123
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
124
+ if (!workspaceId) {
125
+ throw new Error("Explicit workspaceId is required for refill_v3_edit_selected_campaign. Name the target workspace instead of switching the shared active workspace.");
126
+ }
127
+ const raw = await getApi().post(REFILL_V3_EDIT_SELECTED_CAMPAIGN_ROUTE, {
128
+ workspaceId,
129
+ campaignId: input.campaignId,
130
+ tableId: input.tableId,
131
+ campaignVersion: input.campaignVersion,
132
+ evidenceFingerprint: input.evidenceFingerprint,
133
+ priorActionFingerprint: input.priorActionFingerprint,
134
+ action: input.action,
135
+ field: input.field,
136
+ value: input.value,
137
+ reobservationScope: input.reobservationScope,
138
+ // Forwarded byte-for-byte: rewriting the caller's replay identity would
139
+ // turn a retry into a second mutation scope.
140
+ idempotencyKey: input.idempotencyKey,
141
+ }, workspaceRequestOptions(workspaceId));
142
+ const decoded = decodeRefillV3CampaignEditResult(raw);
143
+ if (decoded === null) {
144
+ throw new Error("The Refill V3 campaign-edit response failed the published result contract.");
145
+ }
146
+ return decoded;
147
+ }
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Refill V3 fill-ready PACKAGE seam.
3
+ *
4
+ * This module is the SOLE owner of the fill-ready public result contract:
5
+ * - `REFILL_V3_FILL_READY_OUTCOMES` and the closed reason/receipt/result types;
6
+ * - `REFILL_V3_FILL_READY_REASON_CODES`, which EXTENDS the world-state code
7
+ * vocabulary rather than forking it;
8
+ * - `decodeRefillV3FillReadyResult`, the ONE unknown-value decoder; and
9
+ * - `REFILL_V3_FILL_READY_OUTPUT_SCHEMA`, derived from the same closed
10
+ * vocabulary so the central MCP envelope can always emit matching
11
+ * `structuredContent`.
12
+ *
13
+ * It lives inside `@sellable/mcp` and compiles to
14
+ * `dist/tools/refill-v3-fill-ready-contract.js` plus `.d.ts`, so both the app
15
+ * service and the Plan 08 tool wrapper IMPORT these exact exports. Nothing here
16
+ * imports app `src/**`, and no consumer may copy the types, outcomes, decoder,
17
+ * or schema.
18
+ *
19
+ * Decoding rules: hand-rolled type guards plus as-const JSON-Schema literals,
20
+ * strict inbound, and fail-closed. Unlike the world-state observation, a
21
+ * fill-ready result describes a MUTATION, so an unrecognized member is rejected
22
+ * outright instead of being narrowed to a tolerant projection: a malformed
23
+ * mutation receipt must never be read as a partial success.
24
+ */
25
+ export declare const REFILL_V3_FILL_READY_SCHEMA_NAMESPACE: "refill_v3_fill_ready";
26
+ export declare const REFILL_V3_FILL_READY_SCHEMA_MAJOR = 1;
27
+ export declare const REFILL_V3_FILL_READY_SCHEMA_VERSION: "refill_v3_fill_ready.v1.0";
28
+ /** The five terminal outcomes. There is deliberately no sixth member. */
29
+ export declare const REFILL_V3_FILL_READY_OUTCOMES: readonly ["scheduled", "partially_scheduled", "awaiting_scheduler", "campaign_exhausted", "blocked"];
30
+ export type RefillV3FillReadyOutcome = (typeof REFILL_V3_FILL_READY_OUTCOMES)[number];
31
+ /**
32
+ * Codes emitted ONLY by the fill-ready service. They EXTEND the world-state
33
+ * vocabulary; every one gets a row in the single exported code -> classification
34
+ * map, so retryability stays a property of the CODE rather than of a call site.
35
+ */
36
+ export declare const REFILL_V3_FILL_READY_ONLY_REASON_CODES: readonly ["zero_requested_count", "idempotency_scope_mismatch", "uncertain_outcome", "placed_under_other_sender", "placed_off_target_date", "paid_inmail_credit_receipt_invalid", "awaiting_external_change", "approval_authority_invalid", "approval_authority_in_flight", "approval_dispatch_incomplete", "ready_cells_unavailable", "sender_affinity_conflict", "scheduler_target_omitted", "scheduler_failed", "receipt_readback_mismatch"];
37
+ export type RefillV3FillReadyOnlyReasonCode = (typeof REFILL_V3_FILL_READY_ONLY_REASON_CODES)[number];
38
+ /** The complete closed fill-ready code vocabulary. */
39
+ export declare const REFILL_V3_FILL_READY_REASON_CODES: readonly ["global_cooldown", "connection_cooldown", "paid_inmail_cooldown", "endpoint_temporarily_unavailable", "date_in_past", "no_sending_hours", "sender_disconnected", "sender_limit_reached", "daily_target_met", "no_eligible_campaign", "no_ready_supply", "sales_nav_disconnected", "insufficient_paid_credits", "paid_inmail_connection_health_recheck_required", "paid_inmail_credit_refresh_failed", "invalid_paid_configuration", "campaign_table_missing", "campaign_sequence_invalid", "source_family_unresolved", "campaign_work_in_flight", "zero_requested_count", "idempotency_scope_mismatch", "uncertain_outcome", "placed_under_other_sender", "placed_off_target_date", "paid_inmail_credit_receipt_invalid", "awaiting_external_change", "approval_authority_invalid", "approval_authority_in_flight", "approval_dispatch_incomplete", "ready_cells_unavailable", "sender_affinity_conflict", "scheduler_target_omitted", "scheduler_failed", "receipt_readback_mismatch"];
40
+ export type RefillV3FillReadyReasonCode = (typeof REFILL_V3_FILL_READY_REASON_CODES)[number];
41
+ /**
42
+ * Why a request was reduced. A clamp is NEVER silent: whenever
43
+ * `requestedCount !== appliedCount` the result carries this basis, except for
44
+ * the two concurrent-consumption codes where the shortfall is not a clamp at
45
+ * all and labelling it one would be a false statement.
46
+ */
47
+ export declare const REFILL_V3_FILL_READY_CLAMP_BASES: readonly ["capacity", "supply", "candidates"];
48
+ export type RefillV3FillReadyClampBasis = (typeof REFILL_V3_FILL_READY_CLAMP_BASES)[number];
49
+ /** Codes for which a shortfall is concurrent consumption, never a clamp. */
50
+ export declare const REFILL_V3_FILL_READY_CLAMP_EXEMPT_CODES: readonly ["placed_under_other_sender", "placed_off_target_date"];
51
+ /** Reused verbatim: a mutation result must not leak identity or internals. */
52
+ export declare const REFILL_V3_FILL_READY_FORBIDDEN_LEAK_KEYS: readonly ["campaignActionFacts", "leaves", "possibleActions", "boundedRowIds", "rowIds", "rowId", "cellId", "cellIds", "tableId", "actionId", "actionIds", "actionColumnId", "graph", "rank", "ranking", "selectedCampaign", "waterfall", "queryDebug"];
53
+ export type RefillV3FillReadyReason = {
54
+ code: RefillV3FillReadyReasonCode;
55
+ message: string;
56
+ /** Derived from the shared code map, never from the emitting call site. */
57
+ retryable: boolean;
58
+ /** Present only for a time-bound code; a bare cooldown is unusable guidance. */
59
+ resumeAt?: string;
60
+ };
61
+ export type RefillV3FillReadyClamp = {
62
+ basis: RefillV3FillReadyClampBasis;
63
+ requested: number;
64
+ limit: number;
65
+ };
66
+ export type RefillV3FillReadyReceipt = {
67
+ idempotencyKey: string;
68
+ campaignId: string;
69
+ senderId: string;
70
+ targetDate: string;
71
+ };
72
+ export type RefillV3FillReadyResult = {
73
+ outcome: RefillV3FillReadyOutcome;
74
+ requestedCount: number;
75
+ appliedCount: number;
76
+ approvedCount: number;
77
+ scheduledCount: number;
78
+ reason: RefillV3FillReadyReason | null;
79
+ clamp: RefillV3FillReadyClamp | null;
80
+ receipt: RefillV3FillReadyReceipt;
81
+ /**
82
+ * The STABLE poll identity of an `awaiting_scheduler` result. The documented
83
+ * follow-up is a status lookup by this key; a second dispatch under it is
84
+ * forbidden.
85
+ */
86
+ pollKey: string | null;
87
+ };
88
+ export declare const REFILL_V3_FILL_READY_RESULT_KEYS: readonly ["outcome", "requestedCount", "appliedCount", "approvedCount", "scheduledCount", "reason", "clamp", "receipt", "pollKey"];
89
+ /**
90
+ * A TOP-LEVEL OBJECT, never an array: an MCP client validates
91
+ * `structuredContent` against this declaration, and a tool that declares an
92
+ * output schema and answers with a shape the client rejects has its ENTIRE
93
+ * response discarded. Every boundary the decoder closes is closed here too.
94
+ */
95
+ export declare const REFILL_V3_FILL_READY_OUTPUT_SCHEMA: Readonly<{
96
+ readonly type: "object";
97
+ readonly additionalProperties: false;
98
+ readonly required: readonly ["outcome", "requestedCount", "appliedCount", "approvedCount", "scheduledCount", "reason", "clamp", "receipt", "pollKey"];
99
+ readonly properties: {
100
+ readonly outcome: {
101
+ readonly type: "string";
102
+ readonly enum: readonly ["scheduled", "partially_scheduled", "awaiting_scheduler", "campaign_exhausted", "blocked"];
103
+ };
104
+ readonly requestedCount: {
105
+ readonly type: "integer";
106
+ readonly minimum: 0;
107
+ };
108
+ readonly appliedCount: {
109
+ readonly type: "integer";
110
+ readonly minimum: 0;
111
+ };
112
+ readonly approvedCount: {
113
+ readonly type: "integer";
114
+ readonly minimum: 0;
115
+ };
116
+ readonly scheduledCount: {
117
+ readonly type: "integer";
118
+ readonly minimum: 0;
119
+ };
120
+ readonly reason: {
121
+ readonly type: readonly ["object", "null"];
122
+ readonly additionalProperties: false;
123
+ readonly required: readonly ["code", "message", "retryable"];
124
+ readonly properties: {
125
+ readonly code: {
126
+ readonly type: "string";
127
+ readonly enum: readonly ["global_cooldown", "connection_cooldown", "paid_inmail_cooldown", "endpoint_temporarily_unavailable", "date_in_past", "no_sending_hours", "sender_disconnected", "sender_limit_reached", "daily_target_met", "no_eligible_campaign", "no_ready_supply", "sales_nav_disconnected", "insufficient_paid_credits", "paid_inmail_connection_health_recheck_required", "paid_inmail_credit_refresh_failed", "invalid_paid_configuration", "campaign_table_missing", "campaign_sequence_invalid", "source_family_unresolved", "campaign_work_in_flight", "zero_requested_count", "idempotency_scope_mismatch", "uncertain_outcome", "placed_under_other_sender", "placed_off_target_date", "paid_inmail_credit_receipt_invalid", "awaiting_external_change", "approval_authority_invalid", "approval_authority_in_flight", "approval_dispatch_incomplete", "ready_cells_unavailable", "sender_affinity_conflict", "scheduler_target_omitted", "scheduler_failed", "receipt_readback_mismatch"];
128
+ };
129
+ readonly message: {
130
+ readonly type: "string";
131
+ };
132
+ readonly retryable: {
133
+ readonly type: "boolean";
134
+ };
135
+ readonly resumeAt: {
136
+ readonly type: "string";
137
+ };
138
+ };
139
+ };
140
+ readonly clamp: {
141
+ readonly type: readonly ["object", "null"];
142
+ readonly additionalProperties: false;
143
+ readonly required: readonly ["basis", "requested", "limit"];
144
+ readonly properties: {
145
+ readonly basis: {
146
+ readonly type: "string";
147
+ readonly enum: readonly ["capacity", "supply", "candidates"];
148
+ };
149
+ readonly requested: {
150
+ readonly type: "integer";
151
+ readonly minimum: 0;
152
+ };
153
+ readonly limit: {
154
+ readonly type: "integer";
155
+ readonly minimum: 0;
156
+ };
157
+ };
158
+ };
159
+ readonly receipt: {
160
+ readonly type: "object";
161
+ readonly additionalProperties: false;
162
+ readonly required: readonly ["idempotencyKey", "campaignId", "senderId", "targetDate"];
163
+ readonly properties: {
164
+ readonly idempotencyKey: {
165
+ readonly type: "string";
166
+ readonly minLength: 1;
167
+ };
168
+ readonly campaignId: {
169
+ readonly type: "string";
170
+ readonly minLength: 1;
171
+ };
172
+ readonly senderId: {
173
+ readonly type: "string";
174
+ readonly minLength: 1;
175
+ };
176
+ readonly targetDate: {
177
+ readonly type: "string";
178
+ readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
179
+ };
180
+ };
181
+ };
182
+ readonly pollKey: {
183
+ readonly type: readonly ["string", "null"];
184
+ };
185
+ };
186
+ }>;
187
+ export declare function isOneOfFillReady<T extends readonly string[]>(value: unknown, allowed: T): value is T[number];
188
+ /**
189
+ * Sole unknown-value decoder for the public result. STRICT and FAIL-CLOSED: a
190
+ * fill-ready result describes a MUTATION, so an unknown key, a malformed count,
191
+ * a broken count invariant, or a leaked identity rejects the whole value rather
192
+ * than being narrowed into a confident partial success.
193
+ */
194
+ export declare function decodeRefillV3FillReadyResult(value: unknown): RefillV3FillReadyResult | null;
195
+ /** Wire form of a decoded result. `schemaVersion` is TRANSPORT, not business. */
196
+ export declare function encodeRefillV3FillReadyResult(result: RefillV3FillReadyResult): Record<string, unknown>;
197
+ /** The two lanes, re-exported so a consumer needs exactly one import. */
198
+ export declare const REFILL_V3_FILL_READY_LANES: readonly ["connection_invite", "paid_inmail"];