@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
@@ -4,6 +4,10 @@ description: Closed execution contract for the canonical fenced refill-sends coo
4
4
  visibility: internal
5
5
  allowed-tools:
6
6
  - mcp__sellable__refill_sends
7
+ - mcp__sellable__refill_v3_advance
8
+ - mcp__sellable__refill_v3_continue
9
+ - mcp__sellable__list_workspaces
10
+ - mcp__sellable__get_active_workspace
7
11
  - mcp__sellable__get_subskill_asset
8
12
  - mcp__sellable__get_refill_target_plan
9
13
  - mcp__sellable__get_scheduler_fill_capacity
@@ -12,11 +16,51 @@ allowed-tools:
12
16
 
13
17
  # Refill Sends Workflow
14
18
 
15
- This is the closed executor companion to the public `refill-sends` skill.
16
- The public Mermaid diagrams define product order; `core/flow.v1.json` defines
17
- the deterministic gates. `refill_sends` is the only execution owner. Do not
18
- manually reproduce the ladder with lower-level campaign, source, preparation,
19
- approval, or scheduler tools.
19
+ This is the closed executor companion to the public `refill-sends` skill. It
20
+ carries BOTH routes, and it decides between them itself.
21
+
22
+ ## Route selection do this FIRST
23
+
24
+ Decide the route before loading any flow asset and before the next coordinator
25
+ call. Do NOT treat an earlier tool call as the decision: if a refill was already
26
+ opened on the wrong route, this section overrides it. The predicate is the same
27
+ MECHANICAL one the public skill uses, observable in the connected Sellable MCP
28
+ tool list:
29
+
30
+ > **Is `refill_v3_advance` one of the tools this server exposes?**
31
+
32
+ - **Yes → take the Refill V3 route.** This is the DEFAULT for every workspace on
33
+ a server that exposes the tool. Load `core/flow.v3.json` and follow
34
+ [Refill V3](#refill-v3-one-deterministic-step-per-call). Do not load
35
+ `core/flow.v1.json`, do not call `get_refill_target_plan`, and do not call
36
+ `refill_sends` — including when an earlier call in this session already did.
37
+ - **No → take the V1 route.** The installed server predates Refill V3, so
38
+ `refill_sends` is the only coordinator available. Load `core/flow.v1.json` and
39
+ follow the V1 sections below.
40
+
41
+ Never infer the route from a workspace flag, a campaign field, a tool result, or
42
+ the operator's wording: no such cutover signal exists. Report the selected route
43
+ explicitly before the first coordinator call.
44
+
45
+ ## Which asset to load
46
+
47
+ The asset follows the route selected above:
48
+
49
+ - **V3 → `core/flow.v3.json`.**
50
+ - **V1 → `core/flow.v1.json`.**
51
+
52
+ The public Mermaid diagrams define product order; the loaded flow asset defines
53
+ the deterministic gates. Exactly one coordinator owns execution per route:
54
+ `refill_v3_advance` on V3, `refill_sends` on V1. Do not manually reproduce
55
+ either ladder with lower-level campaign, source, preparation, approval, or
56
+ scheduler tools.
57
+
58
+ ## V1 route
59
+
60
+ Everything from here to [Refill V3](#refill-v3-one-deterministic-step-per-call)
61
+ applies only when `core/flow.v1.json` was the loaded asset. On this route
62
+ `refill_sends` is the only execution owner. Do not manually reproduce the ladder
63
+ with lower-level campaign, source, preparation, approval, or scheduler tools.
20
64
 
21
65
  Every mode renders the same read-only D1 plan before any mutation. Default
22
66
  non-yolo mode asks for explicit acceptance of that packet and later transitions.
@@ -311,3 +355,66 @@ readiness authority, reporting context, and a returned `laneScope` receipt.
311
355
  capacity, sweep/status, and bounded receipts. Never use individual cell ids,
312
356
  Prisma, SQL, direct database access, or production-environment scripts as
313
357
  completion proof. Redact raw prospect and copy data.
358
+
359
+ ## Refill V3: one deterministic step per call
360
+
361
+ This is the DEFAULT route whenever `refill_v3_advance` is exposed.
362
+ `core/flow.v3.json` is the V3 execution contract and `refill_v3_advance` is its
363
+ ONLY execution owner. Load the entire asset and verify a COMPATIBLE version
364
+ before the first call: same major (`v3`) and minor at or above the minimum
365
+ `v3.0`, so `v3.0` and `v3.7` both load while `v2.x` and `v4.x` are refused with a
366
+ typed verdict. Report that version explicitly.
367
+
368
+ Resolve the workspace BEFORE the first call. `workspaceId` must be an EXACT id on
369
+ every automation call, exactly as the V1 route already requires: when the operator
370
+ names a workspace, call `list_workspaces` first and match that name to its id, and
371
+ fall back to the configured or active workspace ONLY when the operator named none.
372
+ If nothing accessible matches the named workspace, or more than one does, stop and
373
+ say so rather than using the configured workspace, and never change the shared
374
+ active workspace to steer an automation.
375
+
376
+ Decide the AUTONOMY GRANT before the first call, from the operator's words alone,
377
+ and keep it fixed for the whole run. `--yolo` (or an explicit "just do it, don't
378
+ check back") means `yolo: true` on EVERY advance call; anything else means omit
379
+ the key. The grant is not a mode and selects no campaign — WHICH campaign may
380
+ start is derived from the workspace's own campaigns — it decides only whether
381
+ this run may start one at all, and whether you may keep going unattended:
382
+
383
+ | | `yolo: true` | key omitted |
384
+ | --- | --- | --- |
385
+ | paused derived-evergreen start | one may be started once a row's active campaigns are exhausted, arriving as an ordinary executed `start_evergreen_campaign` action | none: the backend REFUSES the start and answers the exhaustion terminal instead |
386
+ | loop | call `refill_v3_advance` again immediately, through to a terminal, without checking back | surface the result and ASK before the next call |
387
+
388
+ Never infer the grant from a workspace flag, a campaign field, a tool result, an
389
+ idle-looking workspace, or a previous terminal; never set it to make a run finish,
390
+ clear a wait, or retry a refusal; and never change it part-way through a run.
391
+
392
+ Call `refill_v3_advance` with `{workspaceId, scope}` plus `yolo` when granted.
393
+ There is no mode, continuation, task receipt, retry counter, cursor, row, action,
394
+ or receipt-fact input; the backend parser refuses any of them before it observes
395
+ anything. Losing a prior result is harmless, because every invocation reconstructs
396
+ from fresh world state plus server-loaded authority receipts.
397
+
398
+ Each call answers with exactly one of five results:
399
+
400
+ - `advanced` — the action ALREADY RAN and was already followed by its mandatory
401
+ exact-scope reread. Surface the action identity, the receipt, and the
402
+ replacement observation, then call `refill_v3_advance` again (asking first when
403
+ the grant was withheld). Never execute `action.kind` and never call its
404
+ authority again.
405
+ - `campaign_attention_required` — the ONE model judgment in this flow. The
406
+ backend already chose exactly one campaign and bounded its evidence. Load
407
+ `refill-sends-work-campaign`, pass the packet through, and let
408
+ `refill_v3_continue` revalidate the packet against a fresh advance result,
409
+ execute at most one existing authority, and re-observe the exact sender/date.
410
+ Then call `refill_v3_advance` again.
411
+ - `awaiting_external_change` — stop and report the scoped wait verbatim.
412
+ - `complete` — stop and report the terminal code verbatim.
413
+ - `blocked` — stop and report the typed business blocker verbatim.
414
+
415
+ This workflow chooses nothing. It never reads capacity, supply, family, or reason
416
+ fields to decide what to do next; never declares a terminal, an exhaustion
417
+ verdict, or a health classification; never holds a counter or a cursor between
418
+ calls; and never calls a placement, scheduler, source, enrichment, approval, or
419
+ send tool directly. `refill_sends` and `core/flow.v1.json` remain the unchanged
420
+ V1 surface.
@@ -0,0 +1,209 @@
1
+ {
2
+ "version": "v3.0",
3
+ "workflow": "refill-sends-workflow",
4
+ "asset": "core/flow.v3.json",
5
+ "principle": "refill_v3_advance is the only execution owner. It chooses ONE exact next action from one fresh observation, executes at most that one authority, and rereads the exact affected scope before answering. This asset is a THIN CALLER: it calls advance, surfaces the already-executed result, and routes exactly one result variant to the campaign subskill. It contains no row, campaign, lane, action, health, source, retry, or terminal choice of its own.",
6
+ "versionGate": {
7
+ "minimumVersion": "v3.0",
8
+ "compatibleMajor": "v3",
9
+ "versionPolicy": "compatible_range",
10
+ "note": "The authoritative consumer is the INSTALLED skill cache, so the gate is a compatible RANGE. Same major and minor at or above the minimum is accepted, so v3.0 and v3.7 both load while v2.x and v4.x are refused with a typed verdict."
11
+ },
12
+ "requiredBootstrap": [
13
+ {
14
+ "tool": "get_subskill_prompt",
15
+ "requiredValues": {
16
+ "subskillName": "refill-sends-workflow"
17
+ },
18
+ "mustReadUntil": {
19
+ "hasMore": false
20
+ }
21
+ },
22
+ {
23
+ "tool": "get_subskill_asset",
24
+ "requiredValues": {
25
+ "subskillName": "refill-sends-workflow",
26
+ "assetPath": "core/flow.v3.json"
27
+ },
28
+ "mustReadUntil": {
29
+ "hasMore": false
30
+ },
31
+ "validation": {
32
+ "workflow": "refill-sends-workflow",
33
+ "versionPolicy": "compatible_range",
34
+ "minimumVersion": "v3.0",
35
+ "compatibleMajor": "v3",
36
+ "requiredTopLevelKeys": [
37
+ "versionGate",
38
+ "loop",
39
+ "resultHandling",
40
+ "forbidden"
41
+ ]
42
+ }
43
+ }
44
+ ],
45
+ "deterministicOwner": {
46
+ "selector": "computeNextRefillV3Action",
47
+ "coordinator": "advanceRefillV3",
48
+ "note": "Both live on the backend. The caller cannot see, influence, or reproduce the selection."
49
+ },
50
+ "tools": {
51
+ "advance": "refill_v3_advance",
52
+ "campaignAttentionSubskill": "refill-sends-work-campaign",
53
+ "campaignAttentionAuthority": "refill_v3_continue"
54
+ },
55
+ "workspaceResolution": {
56
+ "appliesWhen": "always, BEFORE the first advance call",
57
+ "allowedTools": [
58
+ "list_workspaces",
59
+ "get_active_workspace"
60
+ ],
61
+ "rules": [
62
+ "An automation call requires an exact explicit workspaceId. Never pass a workspace NAME to refill_v3_advance and never let it fall back to the configured workspace when the operator named one.",
63
+ "When the operator names a workspace, call list_workspaces FIRST and match that name to an exact workspaceId; pass that id on every advance call for the rest of the run.",
64
+ "Use the configured or active workspace ONLY when the operator named no workspace at all.",
65
+ "Never change the shared active workspace to steer an automation: active-workspace mutation is not automation control."
66
+ ],
67
+ "failClosed": {
68
+ "noMatch": "If no accessible workspace matches the named one, STOP and say so with the name you were given and the accessible names. Do not fall back to the configured workspace.",
69
+ "ambiguous": "If more than one accessible workspace matches, STOP and ask which one. Do not guess and do not pick the first."
70
+ },
71
+ "note": "Ported verbatim in intent from flow.v1.json's scope_resolution state, which V3 dropped in the cutover: the V1 route already required 'an exact explicit workspaceId' and forbade active-workspace mutation as automation control."
72
+ },
73
+ "autonomy": {
74
+ "appliesWhen": "always, BEFORE the first advance call, and unchanged for the rest of the run",
75
+ "question": "Did the OPERATOR ask for --yolo (or an equivalent explicit 'just do it, don't check back')? Read it from their words only.",
76
+ "input": {
77
+ "key": "yolo",
78
+ "type": "boolean",
79
+ "pass": "yolo:true on EVERY advance call of a granted run; omit the key entirely otherwise",
80
+ "note": "yolo is the operator's AUTONOMY GRANT. It is not a mode, it selects no campaign, and it has no third value. WHICH campaign may start stays derived from the workspace's own campaigns; the grant only says whether this run may start one at all."
81
+ },
82
+ "grants": {
83
+ "execution": "One already-eligible PAUSED derived-evergreen campaign may be started once a row's active campaigns are exhausted. It arrives as an ordinary executed start_evergreen_campaign action.",
84
+ "loop": "Keep calling advance through re-observation until a terminal, without checking back with the operator between calls."
85
+ },
86
+ "withheld": {
87
+ "execution": "No paused campaign is ever started. The backend REFUSES the start and answers the exhaustion terminal instead, so this is enforced, not merely requested.",
88
+ "loop": "Report the current result and the state it implies, and ASK before calling advance again. Present what the next call would do; do not traverse to a terminal unattended."
89
+ },
90
+ "forbidden": [
91
+ "inferring the grant from a workspace flag, a campaign field, a tool result, an idle-looking workspace, or a previous call's terminal",
92
+ "setting yolo:true to make a run finish, to clear a wait, or to retry a refusal",
93
+ "changing the grant part-way through a run",
94
+ "asking the backend for a particular campaign to start: the grant authorizes a start, it never names one"
95
+ ],
96
+ "note": "Restores V1's discipline, which the V3 cutover dropped: flow.v1.json's yoloMode carries approvalSource 'explicit_yolo_flag' and lists start_paused_campaign among autoExecutableActions, and V1's refill_sends states 'In --yolo or after one Accept ... a fresh exact start_paused_campaign packet authorizes starting only that selected PAUSED fallback'. A bare non-yolo V1 run rendered the packet and asked first."
97
+ },
98
+ "loop": {
99
+ "call": {
100
+ "tool": "refill_v3_advance",
101
+ "inputKeys": [
102
+ "workspaceId",
103
+ "scope",
104
+ "yolo"
105
+ ],
106
+ "note": "Pass workspaceId and scope with the values the host resolved once, plus yolo:true only when the autonomy step granted it. workspaceId is the EXACT id workspaceResolution produced, never a name and never an implicit config default when the operator named a workspace. There is no mode, continuation, task receipt, retry counter, cursor, row, action, or receipt-fact input, and a call that supplies one is refused by the backend parser before any observation.",
107
+ "requiredInputKeys": [
108
+ "workspaceId",
109
+ "scope"
110
+ ]
111
+ },
112
+ "repeatWhile": [
113
+ "advanced",
114
+ "campaign_attention_required"
115
+ ],
116
+ "stopOn": [
117
+ "awaiting_external_change",
118
+ "complete",
119
+ "blocked"
120
+ ],
121
+ "note": "Call advance again with the SAME two keys. Losing a prior result is harmless: every invocation reconstructs from fresh world state plus server-loaded authority receipts.",
122
+ "repeatPolicy": {
123
+ "granted": "Call advance again immediately, without checking back.",
124
+ "withheld": "Surface the result, then ASK before the next call. The repeatWhile set is unchanged \u2014 only who decides to take the next step changes."
125
+ }
126
+ },
127
+ "resultHandling": {
128
+ "advanced": {
129
+ "alreadyExecuted": true,
130
+ "surface": [
131
+ "action.kind",
132
+ "action.senderId",
133
+ "action.date",
134
+ "action.lane",
135
+ "action.campaignId",
136
+ "receipt.status",
137
+ "replacementObservation"
138
+ ],
139
+ "then": "call the advance tool again",
140
+ "note": "The action ALREADY RAN and was already followed by its mandatory reread. Never execute the action and never call its authority a second time."
141
+ },
142
+ "campaign_attention_required": {
143
+ "alreadyExecuted": false,
144
+ "route": {
145
+ "subskill": "refill-sends-work-campaign",
146
+ "pass": [
147
+ "packet.scope",
148
+ "packet.evidence"
149
+ ],
150
+ "returnThrough": "refill_v3_continue",
151
+ "returnInput": [
152
+ "workspaceId",
153
+ "scope",
154
+ "packet",
155
+ "decision",
156
+ "yolo"
157
+ ]
158
+ },
159
+ "then": "call the advance tool again",
160
+ "note": "This is the ONE model judgment in the flow. The backend already selected exactly one campaign and bounded the evidence; the subskill chooses one action from its own closed vocabulary and its deterministic authority validates, executes, and re-observes it."
161
+ },
162
+ "awaiting_external_change": {
163
+ "alreadyExecuted": false,
164
+ "surface": [
165
+ "deferral.senderId",
166
+ "deferral.date",
167
+ "deferral.lane",
168
+ "deferral.code",
169
+ "deferral.resumeAt"
170
+ ],
171
+ "then": "stop and report the scoped wait verbatim"
172
+ },
173
+ "complete": {
174
+ "alreadyExecuted": false,
175
+ "surface": [
176
+ "terminal",
177
+ "observation"
178
+ ],
179
+ "then": "stop and report the terminal code verbatim"
180
+ },
181
+ "blocked": {
182
+ "alreadyExecuted": false,
183
+ "surface": [
184
+ "blocker.senderId",
185
+ "blocker.date",
186
+ "blocker.lane",
187
+ "blocker.code",
188
+ "blocker.permanent"
189
+ ],
190
+ "then": "stop and report the typed business blocker verbatim"
191
+ }
192
+ },
193
+ "forbidden": [
194
+ "choosing a sender, date, lane, campaign, or action from this JSON or from prompt prose",
195
+ "re-executing an already-executed result or calling its mutation authority a second time",
196
+ "reading capacity, supply, family, or reason fields to decide what to do next",
197
+ "holding an attempt count, a retry counter, a cursor, or any continuation between calls",
198
+ "declaring a terminal, an exhaustion verdict, or a health classification of its own",
199
+ "calling a placement, scheduler, source, enrichment, approval, or send tool directly",
200
+ "translating a typed business blocker into a transport error or a generic refusal"
201
+ ],
202
+ "verification": [
203
+ "The reported flow version satisfied the compatible RANGE and was reported explicitly.",
204
+ "Every advance call carried exactly workspaceId and scope.",
205
+ "Every already-executed result was surfaced, never re-executed.",
206
+ "Only campaign_attention_required loaded the campaign subskill.",
207
+ "The run stopped on the first awaiting_external_change, complete, or blocked result."
208
+ ]
209
+ }