@sellable/mcp 0.1.619 → 0.1.620-phase111.20260720075026
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +0 -1
- package/dist/api.js +0 -3
- package/dist/auth.d.ts +0 -4
- package/dist/auth.js +3 -121
- package/dist/refill-contract.d.ts +157 -0
- package/dist/refill-contract.js +487 -0
- package/dist/refill-run-client.d.ts +9 -4
- package/dist/refill-run-client.js +12 -0
- package/dist/refill-run-loop.d.ts +31 -0
- package/dist/refill-run-loop.js +234 -356
- package/dist/server.js +9 -96
- package/dist/tools/campaign-message-preparation.d.ts +409 -0
- package/dist/tools/campaign-message-preparation.js +46 -4
- package/dist/tools/campaign-processing.d.ts +614 -40
- package/dist/tools/campaign-processing.js +306 -35
- package/dist/tools/campaign-refill-state.d.ts +174 -3
- package/dist/tools/campaign-refill-state.js +27 -3
- package/dist/tools/company-info.d.ts +1 -7
- package/dist/tools/company-info.js +2 -8
- package/dist/tools/evergreen-refill-plan.d.ts +5 -0
- package/dist/tools/evergreen-refill-plan.js +127 -14
- package/dist/tools/prompts.d.ts +25 -0
- package/dist/tools/prompts.js +24 -0
- package/dist/tools/refill-executors.d.ts +37 -45
- package/dist/tools/refill-executors.js +261 -458
- package/dist/tools/refill-sends-v2.d.ts +370 -0
- package/dist/tools/refill-sends-v2.js +78 -18
- package/dist/tools/refill-sends.d.ts +600 -0
- package/dist/tools/refill-sends.js +112 -0
- package/dist/tools/refill-target-plan.d.ts +368 -0
- package/dist/tools/refill-target-plan.js +234 -80
- package/dist/tools/registry.d.ts +1445 -326
- package/dist/tools/registry.js +11 -0
- package/package.json +1 -1
- package/skills/refill-sends/SKILL.md +23 -1
- package/skills/refill-sends-evergreen/SKILL.md +5 -0
- package/skills/refill-sends-evergreen-workflow/SKILL.md +5 -0
- package/skills/refill-sends-evergreen-workflow/core/flow.v1.json +12 -0
- package/skills/refill-sends-v2/SKILL.md +23 -1
- package/skills/refill-sends-v2-workflow/SKILL.md +16 -1
- package/skills/refill-sends-v2-workflow/core/flow.v1.json +20 -0
- package/skills/refill-sends-workflow/SKILL.md +18 -1
- package/skills/refill-sends-workflow/core/flow.v1.json +26 -1
- package/skills/research/config.json +9 -0
- package/dist/agent-approval-effect-port.d.ts +0 -5
- package/dist/agent-approval-effect-port.js +0 -30
- package/dist/agent-service-auth.d.ts +0 -94
- package/dist/agent-service-auth.js +0 -177
- package/dist/agent-tool-policy.d.ts +0 -156
- package/dist/agent-tool-policy.js +0 -358
package/dist/api.d.ts
CHANGED
package/dist/api.js
CHANGED
|
@@ -54,9 +54,6 @@ export class SellableApi {
|
|
|
54
54
|
"Content-Type": "application/json",
|
|
55
55
|
Authorization: `Bearer ${config.token}`,
|
|
56
56
|
...(workspaceId ? { "x-workspaceid": workspaceId } : {}),
|
|
57
|
-
...(options?.agentEffectId
|
|
58
|
-
? { "x-sellable-agent-effect-id": options.agentEffectId }
|
|
59
|
-
: {}),
|
|
60
57
|
},
|
|
61
58
|
...(body && { body: JSON.stringify(body) }),
|
|
62
59
|
});
|
package/dist/auth.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export interface SellableMultiEnvConfig {
|
|
|
14
14
|
export type SellableConfig = SellableEnvConfig & {
|
|
15
15
|
/** Name of the active environment (e.g. "local", "prod"). */
|
|
16
16
|
activeEnvName?: string;
|
|
17
|
-
/** Credential class controls MCP discovery/invocation and API semantics. */
|
|
18
|
-
credentialKind?: "human" | "agent_service";
|
|
19
17
|
};
|
|
20
18
|
export type EngageWorkspaceState = {
|
|
21
19
|
lastSenderId?: string;
|
|
@@ -49,8 +47,6 @@ export declare function assertWorkspaceLockSatisfied(action?: string): void;
|
|
|
49
47
|
export declare function getEffectiveConfiguredWorkspaceId(config: Pick<SellableConfig, "activeWorkspaceId" | "workspaceId">): string | null;
|
|
50
48
|
export declare function resolveWorkspaceIdForRequest(requestedWorkspaceId: string | null | undefined, action?: string): string | null;
|
|
51
49
|
export declare function getConfig(): SellableConfig;
|
|
52
|
-
/** Reads only the credential class; never returns or validates credential bytes. */
|
|
53
|
-
export declare function getConfiguredCredentialIntent(): "unconfigured" | "human" | "agent_service" | "invalid";
|
|
54
50
|
export declare function updateActiveWorkspace(params: {
|
|
55
51
|
workspaceId: string;
|
|
56
52
|
workspaceName?: string | null;
|
package/dist/auth.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as os from "os";
|
|
3
3
|
import * as path from "path";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import { readMcpAgentServiceContext } from "./agent-service-auth.js";
|
|
6
4
|
const DEFAULT_API_URL = "https://app.sellable.dev";
|
|
7
5
|
const WORKSPACE_LOCK_ENV = "SELLABLE_LOCK_WORKSPACE_ID";
|
|
8
6
|
const REQUIRE_WORKSPACE_LOCK_ENV = "SELLABLE_REQUIRE_WORKSPACE_LOCK";
|
|
9
|
-
const AGENT_SERVICE_CREDENTIAL_FILE_ENV = "SELLABLE_AGENT_SERVICE_CREDENTIAL_FILE";
|
|
10
|
-
const AGENT_RUNTIME_SECRET_ROOT_ENV = "SELLABLE_AGENT_RUNTIME_SECRET_ROOT";
|
|
11
|
-
const AGENT_PROFILE_ID_ENV = "SELLABLE_AGENT_PROFILE_ID";
|
|
12
7
|
// No caching — re-read config on every call so token/workspace changes
|
|
13
8
|
// made by the LLM (editing sellable.json) take effect immediately
|
|
14
9
|
// without requiring an MCP server restart.
|
|
@@ -92,64 +87,6 @@ function normalizeConfig(raw) {
|
|
|
92
87
|
apiUrl: raw.apiUrl || DEFAULT_API_URL,
|
|
93
88
|
};
|
|
94
89
|
}
|
|
95
|
-
function readConfinedAgentServiceCredential(raw, env = process.env) {
|
|
96
|
-
const credentialPathValue = env[AGENT_SERVICE_CREDENTIAL_FILE_ENV]?.trim();
|
|
97
|
-
if (!credentialPathValue)
|
|
98
|
-
return null;
|
|
99
|
-
const runtimeRootValue = env[AGENT_RUNTIME_SECRET_ROOT_ENV]?.trim();
|
|
100
|
-
const profileId = env[AGENT_PROFILE_ID_ENV]?.trim();
|
|
101
|
-
if (!runtimeRootValue ||
|
|
102
|
-
!path.isAbsolute(runtimeRootValue) ||
|
|
103
|
-
!path.isAbsolute(credentialPathValue) ||
|
|
104
|
-
!profileId ||
|
|
105
|
-
!/^[A-Za-z0-9_-]{1,128}$/.test(profileId)) {
|
|
106
|
-
throw new Error("Invalid Agent service credential file binding");
|
|
107
|
-
}
|
|
108
|
-
const rootLink = fs.lstatSync(runtimeRootValue);
|
|
109
|
-
if (rootLink.isSymbolicLink() ||
|
|
110
|
-
!rootLink.isDirectory() ||
|
|
111
|
-
(rootLink.mode & 0o077) !== 0) {
|
|
112
|
-
throw new Error("Invalid Agent runtime secret root");
|
|
113
|
-
}
|
|
114
|
-
const lexicalExpectedPath = path.join(path.resolve(runtimeRootValue), profileId, "service-credential");
|
|
115
|
-
if (path.resolve(credentialPathValue) !== lexicalExpectedPath) {
|
|
116
|
-
throw new Error("Invalid Agent service credential file binding");
|
|
117
|
-
}
|
|
118
|
-
const runtimeRoot = fs.realpathSync(runtimeRootValue);
|
|
119
|
-
const expectedPath = path.join(runtimeRoot, profileId, "service-credential");
|
|
120
|
-
const parent = path.dirname(expectedPath);
|
|
121
|
-
const parentLink = fs.lstatSync(parent);
|
|
122
|
-
const credentialLink = fs.lstatSync(expectedPath);
|
|
123
|
-
const currentUid = process.getuid?.();
|
|
124
|
-
if (parentLink.isSymbolicLink() ||
|
|
125
|
-
!parentLink.isDirectory() ||
|
|
126
|
-
(parentLink.mode & 0o077) !== 0 ||
|
|
127
|
-
credentialLink.isSymbolicLink() ||
|
|
128
|
-
!credentialLink.isFile() ||
|
|
129
|
-
(credentialLink.mode & 0o777) !== 0o600 ||
|
|
130
|
-
credentialLink.size < 8 ||
|
|
131
|
-
credentialLink.size > 4096 ||
|
|
132
|
-
(currentUid !== undefined && credentialLink.uid !== currentUid)) {
|
|
133
|
-
throw new Error("Invalid Agent service credential file");
|
|
134
|
-
}
|
|
135
|
-
if (fs.realpathSync(parent) !== parent || fs.realpathSync(expectedPath) !== expectedPath) {
|
|
136
|
-
throw new Error("Invalid Agent service credential file confinement");
|
|
137
|
-
}
|
|
138
|
-
const token = fs.readFileSync(expectedPath, "utf8").trim();
|
|
139
|
-
const descriptor = raw.serviceCredential;
|
|
140
|
-
const generation = Number(env.SELLABLE_AGENT_CREDENTIAL_GENERATION ?? "");
|
|
141
|
-
const fingerprint = createHash("sha256").update(token).digest("hex").slice(0, 16);
|
|
142
|
-
if (!/^sat_[^_\s]+_\S+$/.test(token) ||
|
|
143
|
-
typeof raw.token === "string" ||
|
|
144
|
-
!descriptor ||
|
|
145
|
-
descriptor.fingerprint !== fingerprint ||
|
|
146
|
-
descriptor.generation !== generation ||
|
|
147
|
-
typeof descriptor.reference !== "string" ||
|
|
148
|
-
!/^secret:\/\/agent\/service\/g[1-9][0-9]*$/.test(descriptor.reference)) {
|
|
149
|
-
throw new Error("Invalid Agent service credential descriptor");
|
|
150
|
-
}
|
|
151
|
-
return token;
|
|
152
|
-
}
|
|
153
90
|
export function getLockedWorkspaceId() {
|
|
154
91
|
const value = process.env[WORKSPACE_LOCK_ENV]?.trim();
|
|
155
92
|
return value || null;
|
|
@@ -210,7 +147,6 @@ export function getConfig() {
|
|
|
210
147
|
const raw = JSON.parse(content);
|
|
211
148
|
// Resolve config: support multi-env format or legacy flat format
|
|
212
149
|
let config;
|
|
213
|
-
let selectedRaw;
|
|
214
150
|
if (raw.activeEnv && raw.environments) {
|
|
215
151
|
const envName = raw.activeEnv;
|
|
216
152
|
const envConfig = raw.environments[envName];
|
|
@@ -218,7 +154,6 @@ export function getConfig() {
|
|
|
218
154
|
const available = Object.keys(raw.environments).join(", ");
|
|
219
155
|
throw new Error(`Unknown environment '${envName}' in ${configFileName}. Available: ${available}`);
|
|
220
156
|
}
|
|
221
|
-
selectedRaw = envConfig;
|
|
222
157
|
config = {
|
|
223
158
|
...normalizeConfig(envConfig),
|
|
224
159
|
activeEnvName: envName,
|
|
@@ -226,35 +161,13 @@ export function getConfig() {
|
|
|
226
161
|
}
|
|
227
162
|
else {
|
|
228
163
|
// Legacy flat format: { token, workspaceId?, apiUrl? }
|
|
229
|
-
selectedRaw = raw;
|
|
230
164
|
config = normalizeConfig(raw);
|
|
231
165
|
}
|
|
232
|
-
|
|
233
|
-
if (confinedAgentCredential) {
|
|
234
|
-
config.token = confinedAgentCredential;
|
|
235
|
-
config.credentialKind = "agent_service";
|
|
236
|
-
}
|
|
237
|
-
else if (!config.token) {
|
|
166
|
+
if (!config.token) {
|
|
238
167
|
throw new Error(`Missing 'token' in ${configFileName}`);
|
|
239
168
|
}
|
|
240
|
-
if (config.token.startsWith("skt_")) {
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
else if (config.token.startsWith("sat_")) {
|
|
244
|
-
const agent = readMcpAgentServiceContext(process.env, config.token);
|
|
245
|
-
if (!agent)
|
|
246
|
-
throw new Error("Invalid Agent service context");
|
|
247
|
-
const configuredWorkspace = normalizeWorkspaceId(config.activeWorkspaceId) ||
|
|
248
|
-
normalizeWorkspaceId(config.workspaceId);
|
|
249
|
-
if (configuredWorkspace && configuredWorkspace !== agent.workspaceId) {
|
|
250
|
-
throw new Error("Agent service credential workspace binding mismatch");
|
|
251
|
-
}
|
|
252
|
-
config.activeWorkspaceId = agent.workspaceId;
|
|
253
|
-
config.workspaceId = agent.workspaceId;
|
|
254
|
-
config.credentialKind = "agent_service";
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
throw new Error("Invalid token format - expected a Sellable credential");
|
|
169
|
+
if (!config.token.startsWith("skt_")) {
|
|
170
|
+
throw new Error("Invalid token format - must start with 'skt_'");
|
|
258
171
|
}
|
|
259
172
|
return config;
|
|
260
173
|
}
|
|
@@ -265,38 +178,7 @@ export function getConfig() {
|
|
|
265
178
|
throw error;
|
|
266
179
|
}
|
|
267
180
|
}
|
|
268
|
-
/** Reads only the credential class; never returns or validates credential bytes. */
|
|
269
|
-
export function getConfiguredCredentialIntent() {
|
|
270
|
-
const configPath = getConfigPath();
|
|
271
|
-
if (!fs.existsSync(configPath))
|
|
272
|
-
return "unconfigured";
|
|
273
|
-
try {
|
|
274
|
-
const raw = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
275
|
-
const selected = raw?.activeEnv && raw?.environments
|
|
276
|
-
? raw.environments[raw.activeEnv]
|
|
277
|
-
: raw;
|
|
278
|
-
const token = selected?.token;
|
|
279
|
-
if (process.env[AGENT_SERVICE_CREDENTIAL_FILE_ENV]?.trim()) {
|
|
280
|
-
return token == null && selected?.serviceCredential
|
|
281
|
-
? "agent_service"
|
|
282
|
-
: "invalid";
|
|
283
|
-
}
|
|
284
|
-
if (typeof token !== "string")
|
|
285
|
-
return "invalid";
|
|
286
|
-
if (token.startsWith("sat_"))
|
|
287
|
-
return "agent_service";
|
|
288
|
-
if (token.startsWith("skt_"))
|
|
289
|
-
return "human";
|
|
290
|
-
return "invalid";
|
|
291
|
-
}
|
|
292
|
-
catch {
|
|
293
|
-
return "invalid";
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
181
|
export function updateActiveWorkspace(params) {
|
|
297
|
-
if (getConfig().credentialKind === "agent_service") {
|
|
298
|
-
throw new Error("Agent service profiles cannot switch workspaces");
|
|
299
|
-
}
|
|
300
182
|
resolveWorkspaceIdForRequest(params.workspaceId, "set_active_workspace");
|
|
301
183
|
const configPath = getConfigPath();
|
|
302
184
|
const configDir = path.dirname(configPath);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export declare const REFILL_CONTRACT_VERSION: "2.0.0";
|
|
2
|
+
export declare const REFILL_CONTRACT_CACHE_VERSION: "refill-contract-v1";
|
|
3
|
+
export declare const REFILL_CONTRACT_SUPPORTED_MAJOR: 2;
|
|
4
|
+
export declare const REFILL_CONTRACT_ERROR_CODES: readonly ["refill_contract_not_implemented", "unsupported_refill_contract_major", "refill_contract_hash_mismatch", "refill_contract_semantic_mismatch"];
|
|
5
|
+
export type RefillContractErrorCode = (typeof REFILL_CONTRACT_ERROR_CODES)[number];
|
|
6
|
+
export declare class RefillContractError extends Error {
|
|
7
|
+
readonly code: RefillContractErrorCode;
|
|
8
|
+
constructor(code: RefillContractErrorCode, message: string);
|
|
9
|
+
}
|
|
10
|
+
export declare const REFILL_SCOPE_IDS: readonly ["workspace_id", "target_date", "sender_selectors", "campaign_selectors", "approval_mode", "contract_identity", "installed_identity"];
|
|
11
|
+
export declare const REFILL_GATE_IDS: readonly ["workspace_access", "approval_packet", "source_family", "threshold", "scheduler", "campaign_lifecycle", "send_time", "no_direct_send", "one_primitive", "fresh_reread", "normalized_accounting", "prep_circuit", "terminal_truth"];
|
|
12
|
+
export declare const REFILL_STATE_IDS: readonly ["planning", "awaiting_approval", "executing", "settling", "replanning", "terminal"];
|
|
13
|
+
export declare const REFILL_ACTION_IDS: readonly ["prepare_messages", "approve_messages", "rerun_errored_cells", "start_paused_campaign", "run_scheduler_sweep", "scheduler_first_settle", "wait_for_scheduler", "wait_for_active_work", "wait_for_source_import", "copy_selected_source_rows", "continue_signal_discovery_source", "continue_sales_nav_source", "continue_prospeo_source", "manual_source_replenishment", "refresh_paid_inmail_credits", "lower_paid_inmail_threshold", "switch_to_connection_lane", "create_connection_campaign", "next_campaign", "done"];
|
|
14
|
+
export declare const REFILL_RECEIPT_IDS: readonly ["target_plan_receipt", "preparation_receipt", "scheduler_receipt", "run_receipt"];
|
|
15
|
+
export declare const REFILL_SIDE_EFFECT_CLASS_IDS: readonly ["read_only", "message_preparation", "message_approval", "source_replenishment", "credit_refresh", "campaign_start", "scheduler_placement"];
|
|
16
|
+
export declare const REFILL_FORBIDDEN_ACTION_IDS: readonly ["direct_send", "raw_scheduler_write", "campaign_create", "campaign_archive_delete", "threshold_lowering", "unselected_source_mutation", "unapproved_campaign_start", "sender_config_write"];
|
|
17
|
+
export declare const REFILL_TERMINAL_REASON_IDS: readonly ["projected_full", "concrete_blocker", "deadline_reached", "iteration_limit", "operator_stopped", "capped_by_scheduler", "loaded_awaiting_scheduler", "lanes_exhausted", "not_an_evergreen_workspace", "no_refillable_campaigns"];
|
|
18
|
+
export type RefillScopeId = (typeof REFILL_SCOPE_IDS)[number];
|
|
19
|
+
export type RefillGateId = (typeof REFILL_GATE_IDS)[number];
|
|
20
|
+
export type RefillStateId = (typeof REFILL_STATE_IDS)[number];
|
|
21
|
+
export type RefillActionId = (typeof REFILL_ACTION_IDS)[number];
|
|
22
|
+
export type RefillReceiptId = (typeof REFILL_RECEIPT_IDS)[number];
|
|
23
|
+
export type RefillSideEffectClassId = (typeof REFILL_SIDE_EFFECT_CLASS_IDS)[number];
|
|
24
|
+
export type RefillForbiddenActionId = (typeof REFILL_FORBIDDEN_ACTION_IDS)[number];
|
|
25
|
+
export type RefillTerminalReasonId = (typeof REFILL_TERMINAL_REASON_IDS)[number];
|
|
26
|
+
export type RefillAction = {
|
|
27
|
+
[Kind in RefillActionId]: {
|
|
28
|
+
kind: Kind;
|
|
29
|
+
actionKey: string;
|
|
30
|
+
sideEffectClass: RefillSideEffectClassId;
|
|
31
|
+
};
|
|
32
|
+
}[RefillActionId];
|
|
33
|
+
export type RefillReceipt = {
|
|
34
|
+
[Kind in RefillReceiptId]: {
|
|
35
|
+
kind: Kind;
|
|
36
|
+
actionKey: string;
|
|
37
|
+
recordedAt: string;
|
|
38
|
+
};
|
|
39
|
+
}[RefillReceiptId];
|
|
40
|
+
export type RefillTerminal = {
|
|
41
|
+
[Reason in RefillTerminalReasonId]: {
|
|
42
|
+
kind: "terminal";
|
|
43
|
+
reason: Reason;
|
|
44
|
+
evidence: Record<string, unknown>;
|
|
45
|
+
};
|
|
46
|
+
}[RefillTerminalReasonId];
|
|
47
|
+
export declare function canonicalizeRefillContract(value: unknown): string;
|
|
48
|
+
export declare function computeRefillContractHash(value: unknown): string;
|
|
49
|
+
export declare const REFILL_CONTRACT_HASH: string;
|
|
50
|
+
export declare const refillContract: {
|
|
51
|
+
readonly contractHash: string;
|
|
52
|
+
readonly contractVersion: "2.0.0";
|
|
53
|
+
readonly cacheVersion: "refill-contract-v1";
|
|
54
|
+
readonly supportedMajor: 2;
|
|
55
|
+
readonly semantics: {
|
|
56
|
+
readonly scope: {
|
|
57
|
+
id: "workspace_id" | "target_date" | "sender_selectors" | "campaign_selectors" | "approval_mode" | "contract_identity" | "installed_identity";
|
|
58
|
+
}[];
|
|
59
|
+
readonly gates: {
|
|
60
|
+
id: "workspace_access" | "approval_packet" | "source_family" | "threshold" | "scheduler" | "campaign_lifecycle" | "send_time" | "no_direct_send" | "one_primitive" | "fresh_reread" | "normalized_accounting" | "prep_circuit" | "terminal_truth";
|
|
61
|
+
}[];
|
|
62
|
+
readonly states: {
|
|
63
|
+
id: "planning" | "awaiting_approval" | "executing" | "settling" | "replanning" | "terminal";
|
|
64
|
+
}[];
|
|
65
|
+
readonly actions: {
|
|
66
|
+
id: "prepare_messages" | "approve_messages" | "rerun_errored_cells" | "start_paused_campaign" | "run_scheduler_sweep" | "scheduler_first_settle" | "wait_for_scheduler" | "wait_for_active_work" | "wait_for_source_import" | "copy_selected_source_rows" | "continue_signal_discovery_source" | "continue_sales_nav_source" | "continue_prospeo_source" | "manual_source_replenishment" | "refresh_paid_inmail_credits" | "lower_paid_inmail_threshold" | "switch_to_connection_lane" | "create_connection_campaign" | "next_campaign" | "done";
|
|
67
|
+
sideEffectClass: "read_only" | "message_preparation" | "message_approval" | "source_replenishment" | "credit_refresh" | "campaign_start" | "scheduler_placement";
|
|
68
|
+
}[];
|
|
69
|
+
readonly receipts: readonly [{
|
|
70
|
+
readonly id: "target_plan_receipt";
|
|
71
|
+
readonly requiredFields: readonly ["refillLaneKey", "branchMetrics", "ledger", "targetDate", "actionKey", "targetShapeRevision", "stateRevision"];
|
|
72
|
+
}, {
|
|
73
|
+
readonly id: "preparation_receipt";
|
|
74
|
+
readonly requiredFields: readonly ["dependency", "circuit", "batchCalibration", "cooperativeStop"];
|
|
75
|
+
}, {
|
|
76
|
+
readonly id: "scheduler_receipt";
|
|
77
|
+
readonly requiredFields: readonly ["receiptVersion", "diagnosticsVersion", "status", "trigger", "workspaceId", "runId", "leaseFence", "expectedTargetsHash", "maxPlacements", "readyCellsFound", "cellsConsidered", "cellsScheduled", "cellsSkipped", "cellsDeferred", "campaignScopeSummary", "expectedTargetSummary", "changedCounts", "summary", "nextAction", "errorCount", "error"];
|
|
78
|
+
}, {
|
|
79
|
+
readonly id: "run_receipt";
|
|
80
|
+
readonly requiredFields: readonly ["runId", "fence", "gate", "gateSeq", "events", "doneReason"];
|
|
81
|
+
}];
|
|
82
|
+
readonly sideEffectClasses: {
|
|
83
|
+
id: "read_only" | "message_preparation" | "message_approval" | "source_replenishment" | "credit_refresh" | "campaign_start" | "scheduler_placement";
|
|
84
|
+
}[];
|
|
85
|
+
readonly forbiddenActions: {
|
|
86
|
+
id: "direct_send" | "raw_scheduler_write" | "campaign_create" | "campaign_archive_delete" | "threshold_lowering" | "unselected_source_mutation" | "unapproved_campaign_start" | "sender_config_write";
|
|
87
|
+
}[];
|
|
88
|
+
readonly terminalReasons: {
|
|
89
|
+
id: "projected_full" | "concrete_blocker" | "deadline_reached" | "iteration_limit" | "operator_stopped" | "capped_by_scheduler" | "loaded_awaiting_scheduler" | "lanes_exhausted" | "not_an_evergreen_workspace" | "no_refillable_campaigns";
|
|
90
|
+
terminalKind: string;
|
|
91
|
+
}[];
|
|
92
|
+
readonly transitions: readonly [{
|
|
93
|
+
readonly from: "planning";
|
|
94
|
+
readonly to: "awaiting_approval";
|
|
95
|
+
}, {
|
|
96
|
+
readonly from: "awaiting_approval";
|
|
97
|
+
readonly to: "executing";
|
|
98
|
+
}, {
|
|
99
|
+
readonly from: "executing";
|
|
100
|
+
readonly to: "settling";
|
|
101
|
+
}, {
|
|
102
|
+
readonly from: "settling";
|
|
103
|
+
readonly to: "replanning";
|
|
104
|
+
}, {
|
|
105
|
+
readonly from: "replanning";
|
|
106
|
+
readonly to: "executing";
|
|
107
|
+
}, {
|
|
108
|
+
readonly from: "replanning";
|
|
109
|
+
readonly to: "terminal";
|
|
110
|
+
}];
|
|
111
|
+
};
|
|
112
|
+
readonly backendBindings: {
|
|
113
|
+
readonly planner: {
|
|
114
|
+
readonly actions: ("prepare_messages" | "approve_messages" | "rerun_errored_cells" | "start_paused_campaign" | "run_scheduler_sweep" | "scheduler_first_settle" | "wait_for_scheduler" | "wait_for_active_work" | "wait_for_source_import" | "copy_selected_source_rows" | "continue_signal_discovery_source" | "continue_sales_nav_source" | "continue_prospeo_source" | "manual_source_replenishment" | "refresh_paid_inmail_credits" | "lower_paid_inmail_threshold" | "switch_to_connection_lane" | "create_connection_campaign" | "next_campaign" | "done")[];
|
|
115
|
+
readonly receiptFields: readonly ["refillLaneKey", "branchMetrics", "ledger", "targetDate", "actionKey", "targetShapeRevision", "stateRevision"];
|
|
116
|
+
};
|
|
117
|
+
readonly preparation: {
|
|
118
|
+
readonly dependencyClasses: readonly ["active", "transient", "permanent", "changed", "exhausted"];
|
|
119
|
+
readonly dependencyReasons: readonly ["active_cells", "dependency_timeout", "rate_limited", "provider_unavailable", "authentication_failed", "validation_failed", "schema_invalid", "config_epoch_changed", "source_epoch_changed", "frontier_exhausted", "unknown_dependency"];
|
|
120
|
+
readonly circuitStates: readonly ["closed", "open", "half_open", "reset"];
|
|
121
|
+
readonly cooperativeStopReasons: readonly ["target_satisfied_during_prep"];
|
|
122
|
+
readonly receiptFields: readonly ["dependency", "circuit", "batchCalibration", "cooperativeStop"];
|
|
123
|
+
};
|
|
124
|
+
readonly scheduler: {
|
|
125
|
+
readonly targetOutcomes: readonly ["included", "omitted"];
|
|
126
|
+
readonly omissionReasons: readonly ["no_ready_cells", "not_scheduler_eligible", "sender_mismatch", "capacity_prefiltered", "outside_target_date", "receipt_error"];
|
|
127
|
+
readonly runStatuses: readonly ["ran", "window_closed_noop", "failed"];
|
|
128
|
+
readonly nextActions: readonly ["refresh_paid_inmail_credits_then_rerun", "wait_for_capacity_or_window", "inspect_sender_mismatch", "no_ready_cells_continue_refill_prep", "scheduled_cells", "investigate_deferred_reasons", "investigate_scheduler_failure"];
|
|
129
|
+
readonly receiptFields: readonly ["receiptVersion", "diagnosticsVersion", "status", "trigger", "workspaceId", "runId", "leaseFence", "expectedTargetsHash", "maxPlacements", "readyCellsFound", "cellsConsidered", "cellsScheduled", "cellsSkipped", "cellsDeferred", "campaignScopeSummary", "expectedTargetSummary", "changedCounts", "summary", "nextAction", "errorCount", "error"];
|
|
130
|
+
};
|
|
131
|
+
readonly run: {
|
|
132
|
+
readonly gates: readonly ["g0_bootstrap", "g1_plan", "g2_execute", "g3_verify", "g4_terminal"];
|
|
133
|
+
readonly states: readonly ["planning", "awaiting_approval", "executing", "settling", "replanning", "terminal"];
|
|
134
|
+
readonly resultKinds: readonly ["started", "awaiting_approval", "active_run_in_progress", "resumed", "lease_lost", "scope_drift", "approval_expired", "approval_fingerprint_mismatch"];
|
|
135
|
+
readonly terminalReasons: readonly ["complete", "capped_by_scheduler", "loaded_awaiting_scheduler", "lanes_exhausted", "blocked", "not_an_evergreen_workspace", "no_refillable_campaigns"];
|
|
136
|
+
readonly refusals: readonly ["scope_drift", "approval_expired", "approval_fingerprint_mismatch", "legacy_read_only", "expected_target_overflow", "scheduler_receipt_incomplete"];
|
|
137
|
+
readonly scopeFields: readonly ["workspaceId", "intent", "senderIds", "campaignIds", "tableIds", "actionIds", "approvalMode", "dateSelector", "senderTimezones", "expectedTargetsHash", "maxPlacements", "contract", "installed"];
|
|
138
|
+
readonly approvalFields: readonly ["scopeHash", "targetShapeRevision", "actionFingerprint", "expectedTargetsHash", "sideEffectEnvelope", "maxPlacements", "approvalExpiresAt", "approvalFingerprint"];
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export type RefillContract = typeof refillContract;
|
|
143
|
+
export declare function assertSupportedRefillContractMajor(version: string): void;
|
|
144
|
+
export declare function validateRefillContractAsset(value: unknown): RefillContract;
|
|
145
|
+
export declare function refillContractSemanticProjection(): {
|
|
146
|
+
contractVersion: "2.0.0";
|
|
147
|
+
cacheVersion: "refill-contract-v1";
|
|
148
|
+
contractHash: string;
|
|
149
|
+
semanticIds: {
|
|
150
|
+
[k: string]: string[];
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export declare function validateRefillFlowProjection(value: unknown): void;
|
|
154
|
+
export declare function renderRefillBootstrapGuidance(): string;
|
|
155
|
+
export declare function renderRefillSafetyGuidance(): string;
|
|
156
|
+
export declare function renderRefillTerminalGuidance(): string;
|
|
157
|
+
export declare function assertNeverRefillVariant(value: never): never;
|