@sellable/mcp 0.1.513 → 0.1.514
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/refill-journal.d.ts +26 -0
- package/dist/refill-journal.js +69 -1
- package/dist/refill-local-state.d.ts +21 -0
- package/dist/refill-local-state.js +177 -1
- package/dist/refill-run-client.d.ts +62 -0
- package/dist/refill-run-client.js +101 -0
- package/dist/refill-run-loop.d.ts +100 -0
- package/dist/refill-run-loop.js +1238 -0
- package/dist/server.js +1 -1
- package/dist/tools/campaign-processing.js +3 -3
- package/dist/tools/evergreen-refill-plan.d.ts +6 -0
- package/dist/tools/evergreen-refill-plan.js +1 -1
- package/dist/tools/refill-executors.d.ts +178 -0
- package/dist/tools/refill-executors.js +788 -0
- package/dist/tools/refill-sends-v2.d.ts +94 -7
- package/dist/tools/refill-sends-v2.js +143 -30
- package/dist/tools/refill-sends.js +2 -657
- package/dist/tools/registry.d.ts +168 -0
- package/package.json +1 -1
- package/skills/refill-sends-v2/SKILL.md +113 -53
- package/skills/refill-sends-v2-workflow/SKILL.md +112 -101
- package/skills/refill-sends-v2-workflow/core/flow.v1.json +137 -31
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
type RefillSendsV2Input = {
|
|
2
2
|
workspaceId?: string;
|
|
3
|
+
runId?: string;
|
|
4
|
+
fence?: number;
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
approvalMode?: "approve" | "mark_ready";
|
|
7
|
+
senderIds?: string[];
|
|
8
|
+
intent?: "auto" | "evergreen" | "plain" | "active";
|
|
3
9
|
};
|
|
4
10
|
export declare const refillSendsV2ToolDefinitions: {
|
|
5
11
|
name: string;
|
|
@@ -11,18 +17,99 @@ export declare const refillSendsV2ToolDefinitions: {
|
|
|
11
17
|
type: string;
|
|
12
18
|
description: string;
|
|
13
19
|
};
|
|
20
|
+
runId: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
fence: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
dryRun: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
approvalMode: {
|
|
33
|
+
type: string;
|
|
34
|
+
enum: string[];
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
senderIds: {
|
|
38
|
+
type: string;
|
|
39
|
+
items: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
intent: {
|
|
44
|
+
type: string;
|
|
45
|
+
enum: string[];
|
|
46
|
+
};
|
|
14
47
|
};
|
|
15
48
|
required: string[];
|
|
16
49
|
additionalProperties: boolean;
|
|
17
50
|
};
|
|
18
51
|
}[];
|
|
19
|
-
export declare function refillSendsV2Command(input: RefillSendsV2Input): {
|
|
52
|
+
export declare function refillSendsV2Command(input: RefillSendsV2Input): Promise<{
|
|
20
53
|
readOnly: boolean;
|
|
21
|
-
|
|
22
|
-
firstOperationalSteps: string[];
|
|
23
|
-
approvalContract: string;
|
|
54
|
+
mode: string;
|
|
24
55
|
forbiddenActions: string[];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
56
|
+
boundedAuthority: string;
|
|
57
|
+
blocker: string;
|
|
58
|
+
workspaceId: string;
|
|
59
|
+
guidance: string;
|
|
60
|
+
warnings: string[];
|
|
61
|
+
journalPath: string | null;
|
|
62
|
+
text: string;
|
|
63
|
+
workspaceResolution: string;
|
|
64
|
+
} | {
|
|
65
|
+
readOnly: boolean;
|
|
66
|
+
mode: string;
|
|
67
|
+
forbiddenActions: string[];
|
|
68
|
+
boundedAuthority: string;
|
|
69
|
+
warnings: any[];
|
|
70
|
+
journalPath: string | null;
|
|
71
|
+
text: string;
|
|
72
|
+
workspaceId: string;
|
|
73
|
+
workspaceResolution: string;
|
|
74
|
+
blocker?: undefined;
|
|
75
|
+
guidance?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
readOnly: boolean;
|
|
78
|
+
forbiddenActions: string[];
|
|
79
|
+
boundedAuthority: string;
|
|
80
|
+
status: "dry_run";
|
|
81
|
+
plan: Record<string, unknown>;
|
|
82
|
+
} | {
|
|
83
|
+
readOnly: boolean;
|
|
84
|
+
forbiddenActions: string[];
|
|
85
|
+
boundedAuthority: string;
|
|
86
|
+
status: "in_progress";
|
|
87
|
+
runId: string;
|
|
88
|
+
fence: number;
|
|
89
|
+
gate: import("../refill-run-loop.js").RefillLoopGate;
|
|
90
|
+
guidance: string;
|
|
91
|
+
journalPath?: string | null;
|
|
92
|
+
} | {
|
|
93
|
+
readOnly: boolean;
|
|
94
|
+
forbiddenActions: string[];
|
|
95
|
+
boundedAuthority: string;
|
|
96
|
+
status: "blocked";
|
|
97
|
+
blocker: string;
|
|
98
|
+
runId?: string;
|
|
99
|
+
fence?: number;
|
|
100
|
+
gate?: import("../refill-run-loop.js").RefillLoopGate;
|
|
101
|
+
guidance: string;
|
|
102
|
+
holderRunId?: string;
|
|
103
|
+
report?: Record<string, unknown>;
|
|
104
|
+
journalPath?: string | null;
|
|
105
|
+
} | {
|
|
106
|
+
readOnly: boolean;
|
|
107
|
+
forbiddenActions: string[];
|
|
108
|
+
boundedAuthority: string;
|
|
109
|
+
status: "terminal";
|
|
110
|
+
doneReason: string;
|
|
111
|
+
report: Record<string, unknown>;
|
|
112
|
+
runId: string;
|
|
113
|
+
journalPath?: string | null;
|
|
114
|
+
}>;
|
|
28
115
|
export {};
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import { appendIndexLine, appendJournalEvent, createRunJournal, renderBootstrapSection, renderCrashedAbandonedSection, renderExecutionEventSection, renderPlanSection, renderTerminalSection, } from "../refill-journal.js";
|
|
2
|
+
import { writeRefillWorkspaceState } from "../refill-local-state.js";
|
|
3
|
+
import { advanceRefillRunGateRemote, completeRefillRun, heartbeatRefillRun, recordRunOutcome, recordRunPlanned, refillRunStatus, startRefillRunRemote, } from "../refill-run-client.js";
|
|
4
|
+
import { runRefillV2Loop } from "../refill-run-loop.js";
|
|
5
|
+
import { getPrepareCampaignMessagesStatus } from "./campaign-message-preparation.js";
|
|
6
|
+
import { getRefillPlanV2 } from "./evergreen-refill-plan.js";
|
|
7
|
+
import { executeOneYoloPrimitive, executeStartCampaignPrimitive, prepareRowSelectorValue, refillPrepareRequestHash, refreshPaidInmailCreditsWithRetry, } from "./refill-executors.js";
|
|
8
|
+
const FORBIDDEN_ACTIONS = [
|
|
9
|
+
"Do not schedule sends.",
|
|
10
|
+
"Do not send messages.",
|
|
11
|
+
"Do not create campaigns.",
|
|
12
|
+
"Do not switch providers or source families.",
|
|
13
|
+
"Do not lower paid InMail thresholds.",
|
|
14
|
+
"Do not write scheduler fields.",
|
|
15
|
+
];
|
|
16
|
+
const BOUNDED_AUTHORITY = "Within the refill run, bounded approvals, preparation jobs, source copies, saved signal continuations, pinned-lane campaign starts, and paid-credit refreshes may execute only when named by the current packet and logged planned -> did -> outcome.";
|
|
1
17
|
export const refillSendsV2ToolDefinitions = [
|
|
2
18
|
{
|
|
3
19
|
name: "refill_sends_v2",
|
|
4
|
-
description: "
|
|
20
|
+
description: "Execute the refill sends v2 loop with run-record fencing, packet re-planning, shared refill executors, and resumable dry-run/real-run modes.",
|
|
5
21
|
inputSchema: {
|
|
6
22
|
type: "object",
|
|
7
23
|
properties: {
|
|
@@ -9,41 +25,138 @@ export const refillSendsV2ToolDefinitions = [
|
|
|
9
25
|
type: "string",
|
|
10
26
|
description: "Explicit request-scoped workspace id.",
|
|
11
27
|
},
|
|
28
|
+
runId: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Optional refill run id to resume.",
|
|
31
|
+
},
|
|
32
|
+
fence: {
|
|
33
|
+
type: "number",
|
|
34
|
+
description: "Optional refill run fence to resume.",
|
|
35
|
+
},
|
|
36
|
+
dryRun: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
description: "When true, read the v2 packet and write only a dry-run journal.",
|
|
39
|
+
},
|
|
40
|
+
approvalMode: {
|
|
41
|
+
type: "string",
|
|
42
|
+
enum: ["approve", "mark_ready"],
|
|
43
|
+
description: 'Message approval behavior for packet-named prep/approval actions. Defaults to "approve".',
|
|
44
|
+
},
|
|
45
|
+
senderIds: {
|
|
46
|
+
type: "array",
|
|
47
|
+
items: { type: "string" },
|
|
48
|
+
},
|
|
49
|
+
intent: {
|
|
50
|
+
type: "string",
|
|
51
|
+
enum: ["auto", "evergreen", "plain", "active"],
|
|
52
|
+
},
|
|
12
53
|
},
|
|
13
54
|
required: ["workspaceId"],
|
|
14
55
|
additionalProperties: false,
|
|
15
56
|
},
|
|
16
57
|
},
|
|
17
58
|
];
|
|
18
|
-
|
|
59
|
+
function normalizeWorkspaceId(workspaceId) {
|
|
60
|
+
if (!workspaceId?.trim()) {
|
|
61
|
+
throw new Error("workspaceId is required for refill_sends_v2.");
|
|
62
|
+
}
|
|
63
|
+
return workspaceId.trim();
|
|
64
|
+
}
|
|
65
|
+
function resumeHandle(input) {
|
|
66
|
+
return input.runId && typeof input.fence === "number"
|
|
67
|
+
? { runId: input.runId, fence: input.fence }
|
|
68
|
+
: undefined;
|
|
69
|
+
}
|
|
70
|
+
async function maybeAddLostFenceGuidance(result, input) {
|
|
71
|
+
if (result.status !== "blocked" ||
|
|
72
|
+
result.blocker !== "lease_lost" ||
|
|
73
|
+
!input.runId) {
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const status = await refillRunStatus({
|
|
78
|
+
workspaceId: input.workspaceId,
|
|
79
|
+
runId: input.runId,
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
...result,
|
|
83
|
+
guidance: [
|
|
84
|
+
result.guidance,
|
|
85
|
+
"Lease lockout window is approximately 10 minutes.",
|
|
86
|
+
`Holder status: ${JSON.stringify(status)}`,
|
|
87
|
+
].join(" "),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export async function refillSendsV2Command(input) {
|
|
95
|
+
const workspaceId = normalizeWorkspaceId(input.workspaceId);
|
|
96
|
+
if (input.dryRun) {
|
|
97
|
+
const plan = await getRefillPlanV2({
|
|
98
|
+
workspaceId,
|
|
99
|
+
intent: input.intent,
|
|
100
|
+
senderIds: input.senderIds,
|
|
101
|
+
journal: true,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
...plan,
|
|
105
|
+
readOnly: true,
|
|
106
|
+
mode: "dry_run",
|
|
107
|
+
forbiddenActions: FORBIDDEN_ACTIONS,
|
|
108
|
+
boundedAuthority: BOUNDED_AUTHORITY,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const result = await runRefillV2Loop({
|
|
112
|
+
workspaceId,
|
|
113
|
+
intent: input.intent,
|
|
114
|
+
senderIds: input.senderIds,
|
|
115
|
+
approvalMode: input.approvalMode ?? "approve",
|
|
116
|
+
resume: resumeHandle(input),
|
|
117
|
+
}, {
|
|
118
|
+
runClient: {
|
|
119
|
+
startRefillRunRemote,
|
|
120
|
+
refillRunStatus,
|
|
121
|
+
heartbeatRefillRun,
|
|
122
|
+
advanceRefillRunGateRemote,
|
|
123
|
+
recordRunPlanned,
|
|
124
|
+
recordRunOutcome,
|
|
125
|
+
completeRefillRun,
|
|
126
|
+
},
|
|
127
|
+
readPlan: async (planInput) => getRefillPlanV2({
|
|
128
|
+
workspaceId: planInput.workspaceId,
|
|
129
|
+
intent: planInput.intent,
|
|
130
|
+
senderIds: planInput.senderIds,
|
|
131
|
+
runState: planInput.runState,
|
|
132
|
+
journal: planInput.journal,
|
|
133
|
+
}),
|
|
134
|
+
executors: {
|
|
135
|
+
executeOneYoloPrimitive,
|
|
136
|
+
executeStartCampaignPrimitive,
|
|
137
|
+
refreshPaidInmailCreditsWithRetry,
|
|
138
|
+
getPrepareCampaignMessagesStatus,
|
|
139
|
+
refillPrepareRequestHash,
|
|
140
|
+
prepareRowSelectorValue,
|
|
141
|
+
},
|
|
142
|
+
journal: {
|
|
143
|
+
createRunJournal,
|
|
144
|
+
appendJournalEvent,
|
|
145
|
+
renderBootstrapSection,
|
|
146
|
+
renderPlanSection,
|
|
147
|
+
renderExecutionEventSection,
|
|
148
|
+
renderCrashedAbandonedSection,
|
|
149
|
+
renderTerminalSection,
|
|
150
|
+
appendIndexLine,
|
|
151
|
+
},
|
|
152
|
+
localState: {
|
|
153
|
+
writeRefillWorkspaceState,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
19
156
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"Read the returned packet, globalActionQueue, per-sender plans, laneOrder source labels, laneChain values, and itinerary before taking any action.",
|
|
25
|
-
"Confirm which lane source was selected for each sender: managed_waterfall, dashboard_evergreen, or active_campaign.",
|
|
26
|
-
"Review the refill v2 dry-run journal file path returned by get_refill_plan_v2.",
|
|
27
|
-
"If the packet reports no_refillable_campaigns or workspace_access, stop and report that blocker instead of mutating.",
|
|
28
|
-
"This command is PLAN-ONLY; execution arrives in Phase 86.",
|
|
29
|
-
],
|
|
30
|
-
approvalContract: "Nothing is approved or executable in Phase 87. The refill_sends_v2 command is read-only; Phase 86 introduces execution approval.",
|
|
31
|
-
forbiddenActions: [
|
|
32
|
-
"Do not schedule sends.",
|
|
33
|
-
"Do not send messages.",
|
|
34
|
-
"Do not approve messages.",
|
|
35
|
-
"Do not prepare messages.",
|
|
36
|
-
"Do not start or launch campaigns.",
|
|
37
|
-
"Do not create campaigns.",
|
|
38
|
-
"Do not switch providers or source families.",
|
|
39
|
-
"Do not lower paid InMail thresholds.",
|
|
40
|
-
"Do not refresh paid InMail credits.",
|
|
41
|
-
"Do not write scheduler fields.",
|
|
42
|
-
],
|
|
43
|
-
fillWindow: "Use only the target window and caps returned by get_refill_plan_v2.",
|
|
44
|
-
hostExamples: [
|
|
45
|
-
"refill_sends_v2({ workspaceId })",
|
|
46
|
-
"get_refill_plan_v2({ workspaceId })",
|
|
47
|
-
],
|
|
157
|
+
...(await maybeAddLostFenceGuidance(result, { ...input, workspaceId })),
|
|
158
|
+
readOnly: false,
|
|
159
|
+
forbiddenActions: FORBIDDEN_ACTIONS,
|
|
160
|
+
boundedAuthority: BOUNDED_AUTHORITY,
|
|
48
161
|
};
|
|
49
162
|
}
|