@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
@@ -39,6 +39,11 @@ import { findLeadsProviderPreflightToolDefinitions } from "./provider-preflight.
39
39
  import { readinessToolDefinitions } from "./readiness.js";
40
40
  import { refillSendsToolDefinitions } from "./refill-sends.js";
41
41
  import { refillTargetPlanToolDefinitions } from "./refill-target-plan.js";
42
+ import { refillV3AdvanceToolDefinitions } from "./refill-v3-advance.js";
43
+ import { refillV3ContinueToolDefinitions } from "./refill-v3-continue.js";
44
+ import { refillV3EditSelectedCampaignToolDefinitions } from "./refill-v3-edit-selected-campaign.js";
45
+ import { refillV3FillReadyToolDefinitions } from "./refill-v3-fill-ready.js";
46
+ import { refillV3WorldStateToolDefinitions } from "./refill-v3-world-state.js";
42
47
  import { refreshSenderEngagementToolDefinitions } from "./refresh-sender-engagement.js";
43
48
  import { rowToolDefinitions } from "./rows.js";
44
49
  import { rubricToolDefinitions } from "./rubrics.js";
@@ -63,6 +68,15 @@ export const allTools = [
63
68
  ...schedulerFillCapacityToolDefinitions,
64
69
  ...schedulerRunToolDefinitions,
65
70
  ...refillSendsToolDefinitions,
71
+ // Phase 146.5 Plan 08's TWO public Refill V3 surfaces: exactly one
72
+ // observation tool and exactly one bounded mutation tool.
73
+ ...refillV3WorldStateToolDefinitions,
74
+ ...refillV3FillReadyToolDefinitions,
75
+ ...refillV3EditSelectedCampaignToolDefinitions,
76
+ // Phase 146.5 Plan 10: the one deterministic coordinator. It completes the
77
+ // final public V3 catalogue of exactly four tools.
78
+ ...refillV3AdvanceToolDefinitions,
79
+ ...refillV3ContinueToolDefinitions,
66
80
  ...setupEvergreenCampaignsToolDefinitions,
67
81
  ...campaignHorizonFillToolDefinitions,
68
82
  ...campaignMessagePreparationToolDefinitions,
@@ -119,6 +133,11 @@ export const allTools = [
119
133
  /** Closed public surface used by the paired MCP/installer asset inventory. */
120
134
  export const refillProjectionToolNames = [
121
135
  "refill_sends",
136
+ "refill_v3_world_state",
137
+ "refill_v3_fill_ready",
138
+ "refill_v3_edit_selected_campaign",
139
+ "refill_v3_advance",
140
+ "refill_v3_continue",
122
141
  "get_refill_target_plan",
123
142
  "get_campaign_refill_state",
124
143
  "start_campaign_message_preparation",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.793",
3
+ "version": "0.1.794",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code, Codex, and Hermes campaign workflows",
6
6
  "main": "dist/index.js",
@@ -4,6 +4,8 @@ description: Refill projected sends across a workspace or selected senders throu
4
4
  visibility: public
5
5
  allowed-tools:
6
6
  - mcp__sellable__refill_sends
7
+ - mcp__sellable__refill_v3_advance
8
+ - mcp__sellable__refill_v3_continue
7
9
  - mcp__sellable__get_refill_target_plan
8
10
  - mcp__sellable__get_scheduler_fill_capacity
9
11
  - mcp__sellable__get_subskill_asset
@@ -21,17 +23,43 @@ allowed-tools:
21
23
  # Refill Sends
22
24
 
23
25
  Use this skill for “fill”, “refill sends”, “max out sends”, “load everyone up”,
24
- or “fill horizon sends”. `refill_sends` is the only execution owner. The host
25
- resolves the request, invokes the coordinator, and follows its exact
26
- continuation; it never reconstructs the refill ladder from low-level tools.
26
+ or “fill horizon sends”. Exactly one coordinator owns execution: `refill_v3_advance`
27
+ on the V3 route, `refill_sends` on the V1 route. The host resolves the request,
28
+ invokes that coordinator, and follows its exact continuation; it never
29
+ reconstructs the refill ladder from low-level tools.
27
30
 
28
31
  Host commands:
29
32
 
30
33
  - Claude Code: `/sellable:refill-sends`
31
34
  - Codex: `$sellable:refill-sends`
32
35
 
36
+ ## Route selection — do this FIRST
37
+
38
+ Decide the route before parsing scope, before loading any flow asset, and before
39
+ any tool call other than auth/workspace resolution. The predicate is
40
+ MECHANICAL and observable in the connected Sellable MCP tool list:
41
+
42
+ > **Is `refill_v3_advance` one of the tools this server exposes?**
43
+
44
+ - **Yes → take the Refill V3 route.** This is the default for every workspace on
45
+ a server that exposes the tool. Go to [Refill V3](#refill-v3) and follow it;
46
+ the V1 ladder in the rest of this document does not apply.
47
+ - **No → take the V1 route.** The installed server predates Refill V3, so
48
+ `refill_sends` is the only coordinator available. Follow this document from
49
+ [Entry and exact scope](#entry-and-exact-scope) onward.
50
+
51
+ Never infer the route from a workspace flag, a campaign field, a tool result, or
52
+ the operator's wording: no such cutover signal exists, and guessing at one is
53
+ what makes an ordinary refill request silently take the wrong route. Report the
54
+ selected route explicitly before the first coordinator call.
55
+
33
56
  ## Entry and exact scope
34
57
 
58
+ Everything from here down to [Refill V3](#refill-v3) is the **V1 route**. Skip it
59
+ entirely when route selection chose V3. On this route `refill_sends` is the only
60
+ execution owner and the host follows its exact continuation; it never
61
+ reconstructs the refill ladder from low-level tools.
62
+
35
63
  Accepted request fields are `--yolo`, `workspaceId`, `--sender`/`senderIds`/
36
64
  `senderNames`, `actionTypes`, `--until`/`untilDate`, `--target-date`/
37
65
  `targetDate`, and compatibility `horizonSendDays`. Omitted dates mean the
@@ -55,7 +83,9 @@ flowchart TD
55
83
  SENDERS --> SG{"Every selector resolves exactly?"}
56
84
  SG -- No --> SB["Output: blocked_retryable / sender_selector_unresolved with candidates"]
57
85
  SG -- Yes --> DATE["Normalize 48h, exact targetDate, or inclusive untilDate in sender-local time"]
58
- DATE --> D1["D1: call get_refill_target_plan read-only with exact scope"]
86
+ DATE --> ROUTE{"Does this server expose refill_v3_advance?"}
87
+ ROUTE -- Yes --> V3["Refill V3 route: load core/flow.v3.json and call refill_v3_advance"]
88
+ ROUTE -- No --> D1["D1: call get_refill_target_plan read-only with exact scope"]
59
89
  D1 --> RENDER["Render sender/campaign waterfall, coverage ledger, first action, side effects, forbidden actions, and stop condition"]
60
90
  RENDER --> D2["D2: call refill_sends with workspaceCoordinator true plus displayed targetShapeRevision and actionKey"]
61
91
  ```
@@ -551,3 +581,58 @@ available work.
551
581
  sweep/status, and bounded receipts. Never use individual cell ids, Prisma,
552
582
  SQL, direct database access, or production-environment scripts as completion
553
583
  proof. Redact raw copy and prospect fields.
584
+
585
+ ## Refill V3
586
+
587
+ This is the DEFAULT route whenever `refill_v3_advance` is exposed (see
588
+ [Route selection](#route-selection--do-this-first)). `refill_v3_advance` is then
589
+ the only execution owner and `refill-sends-workflow` plus its `core/flow.v3.json`
590
+ asset is the contract to load — load the prompt and that asset, verify the `v3`
591
+ compatible range, and report the version before the first call. Call
592
+ `refill_v3_advance` with `{workspaceId, scope}` — plus `yolo: true` only when the
593
+ operator asked for `--yolo` — and call it again after each `advanced` or
594
+ `campaign_attention_required` result until it answers `awaiting_external_change`,
595
+ `complete`, or `blocked`.
596
+
597
+ Resolve the workspace BEFORE the first call, exactly as the V1 route already
598
+ requires. `workspaceId` must be an exact id on every automation call: when the
599
+ operator names a workspace, call `list_workspaces` first and match that name to
600
+ its id, and use the configured or active workspace only when the operator named
601
+ none. If nothing accessible matches the name, or more than one does, stop and say
602
+ so — do not fall back to the configured workspace — and never change the shared
603
+ active workspace to steer an automation.
604
+
605
+ Map the rest of the request onto those keys and nothing else: the sender/date
606
+ envelope becomes `scope` (a 1-3 day `sender_local_horizon`, or
607
+ `exact_sender_dates` when the operator named exact senders or dates). There is no
608
+ mode: WHICH campaign may be started is DERIVED from the workspace's own
609
+ campaigns and can never be requested.
610
+
611
+ `--yolo` still means what it has always meant, and it is the ONE remaining
612
+ execution input. It is the operator's AUTONOMY GRANT, read from their words
613
+ alone, and it decides two things together:
614
+
615
+ - **Granted** (`yolo: true` on every call of that run): after a row's active
616
+ campaigns are exhausted, one derived-evergreen start-eligible campaign may be
617
+ started, and you receive it as an ordinary executed `start_evergreen_campaign`
618
+ action. Keep calling advance until a terminal without checking back.
619
+ - **Withheld** (omit the key): no paused campaign is started — the backend
620
+ refuses it and answers the exhaustion terminal instead — and you surface each
621
+ result and ASK before calling advance again.
622
+
623
+ Never infer the grant from a workspace flag, a campaign field, a tool result, an
624
+ idle-looking workspace, or a previous terminal, and never set it to make a run
625
+ finish. Pass no other execution flag and no mode, and do not call
626
+ `get_refill_target_plan`, `refill_sends`, or any placement, scheduler, source, or
627
+ send tool on this route.
628
+
629
+ An `advanced` result is ALREADY EXECUTED: surface its action identity, receipt,
630
+ and replacement observation, and never run the action or call its authority again.
631
+ Only `campaign_attention_required` needs you — route its one selected campaign to
632
+ `refill-sends-work-campaign` and return the chosen action through
633
+ `refill_v3_continue`, which first revalidates the packet against fresh world
634
+ state and then executes at most one existing authority.
635
+
636
+ This skill chooses no sender, date, lane, campaign, or action, holds no counter or
637
+ cursor between calls, and declares no terminal, exhaustion verdict, or health
638
+ classification of its own. V1 `refill_sends` behavior is unchanged.
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: refill-sends-waterfall-order
3
+ description: Order up to three already-issued campaigns for ONE sender and lane, with a rationale each, and optionally propose activating one paused campaign.
4
+ visibility: internal
5
+ allowed-tools:
6
+ - mcp__sellable__get_campaign
7
+ ---
8
+
9
+ # Refill Sends · Waterfall Order
10
+
11
+ You are given ONE sender, ONE lane, and the complete set of campaigns the backend
12
+ already issued for that row. Decide the ORDER in which those campaigns should be
13
+ worked, and say why.
14
+
15
+ By default you call no tools. You mutate nothing, ever. Your whole output is a
16
+ small JSON object that a deterministic validator checks against
17
+ `REFILL_V3_WATERFALL_PROPOSAL_SCHEMA` before anything happens.
18
+
19
+ ONE bounded read is allowed: the sellable `get_campaign` tool (the campaign
20
+ brief). Use it ONLY when the evidence lines in your input are insufficient to
21
+ order confidently — at most ONE read per candidate campaign, by its
22
+ `campaignId`. When a brief was consulted, the rationale MUST say so and state
23
+ what the brief changed about the ordering. An ordering you could make from the
24
+ evidence lines alone never spends a read.
25
+
26
+ ## What you are given
27
+
28
+ - `sender` — the exact sender for this row;
29
+ - `lane` — the exact lane being filled;
30
+ - `activeCampaigns[]` — every campaign the backend issued for this row, each
31
+ carrying its `campaignId`, its transport effectiveness evidence, recent-use
32
+ evidence, and its count of eligible rows for this lane;
33
+ - `inactiveCampaigns[]` — PAUSED campaigns the backend has already confirmed are
34
+ start-eligible;
35
+ - `availableSlots` — how many actions this row can still take today;
36
+ - `guidance` — OPTIONAL and absent by default. When present it may carry a
37
+ history of prior choices (`priorChoices`), why one experiment takes precedence
38
+ (`experimentPrecedence`), or an operator-preferred campaign
39
+ (`operatorPreferredCampaignId`). Weigh it in your rationale. It introduces no
40
+ new database model, and durable managed-waterfall storage stays out of scope.
41
+
42
+ If you feel you need context that neither the input nor a bounded brief read
43
+ carries, say so in your rationale. That is a data-effectiveness gap in the
44
+ observer's campaign facts to be fixed at its source; it is never a reason to
45
+ reach for any other tool.
46
+
47
+ ## Ordering precedence
48
+
49
+ Work through these layers IN ORDER. Every rationale names which layer(s) it
50
+ used.
51
+
52
+ ### 1. Continuity exploration first
53
+
54
+ Before ordering anything, read what was recently ON for this sender and lane:
55
+ each candidate's recent-use evidence (`lastActualUse` on its evidence lines)
56
+ and, when present, `guidance.priorChoices`. Continuity is first-class: a
57
+ recently-worked campaign with remaining supply keeps momentum by default.
58
+ Reordering away from the most recently used campaign requires a stated reason
59
+ in its rationale.
60
+
61
+ ### 2. Operator guidance
62
+
63
+ When `guidance` is present it wins, and the rationale cites it —
64
+ `operatorPreferredCampaignId`, `experimentPrecedence`, and the history in
65
+ `priorChoices`.
66
+
67
+ ### 3. The evergreen-family ladder
68
+
69
+ Some workspaces run the standing evergreen families instead of bespoke
70
+ campaigns. You recognize them by the candidates' lead-source families — never
71
+ by a workspace flag: post-engager campaigns, signal-discovery campaigns, and a
72
+ cold fallback together form the evergreen ladder.
73
+
74
+ When the candidates show evergreen families, the canonical waterfall order is
75
+ `post_engager → signal_discovery → cold`: post engagers already touched the
76
+ sender's content, signal discovery found a live buying signal, and cold is the
77
+ fallback.
78
+
79
+ The family semantics are strict: post-engager campaigns are engagers of the
80
+ sender's own content — that is the warm relationship. Campaigns tracking
81
+ other people's posts (thought leaders, third parties) belong to
82
+ signal_discovery, however they are named. When the evidence lines leave this
83
+ unclear, the bounded `get_campaign` brief read may inform the judgment. The family reply-rate benchmarks below are the quantitative WHY —
84
+ warmest source, highest expected reply. Deviate only when the evidence lines
85
+ argue for it, and say why in the rationale either way. The deterministic gates
86
+ stay sovereign: issued-set membership, start-eligibility, and shape are still
87
+ checked after you, and the three-campaign bound is unchanged.
88
+
89
+ ### 4. Bespoke campaigns: performance first, supply-gated
90
+
91
+ Otherwise, order by the BEST-PERFORMING campaigns — use the transport
92
+ effectiveness and recent-use evidence, the family benchmarks below, and any
93
+ live `familyBenchmarks` data — GATED by supply adequacy. A campaign without
94
+ enough eligible rows for the lane being filled, measured against this row's
95
+ `availableSlots`, does not lead the waterfall however well it performed.
96
+
97
+ Performance first; the supply gate second. This is guidance for your judgment,
98
+ not a deterministic formula: the validator checks only issued-set membership,
99
+ start-eligibility, and shape, so the ordering decision is genuinely yours.
100
+
101
+ ## Family reply-rate benchmarks (priors + live data)
102
+
103
+ Typical benchmarks by lead-source family — actual campaign/workspace data
104
+ supersedes when present:
105
+
106
+ - `post_engager` — HIGH, sometimes ~40% reply: they already engaged the
107
+ sender's content;
108
+ - `signal_discovery` — 10–20% reply: a live buying signal;
109
+ - `cold` — ~5–7% reply: no prior touch.
110
+
111
+ When the input carries live `familyBenchmarks` (this workspace's own
112
+ per-family engagement aggregates, e.g.
113
+ `post_engager no data · signal_discovery 12% reply n=340 · cold 3% reply n=2100`),
114
+ the REAL data leads and these priors only fill the cold start. A family shown
115
+ with no data has no fact — never treat that as a zero rate. Small samples ride
116
+ with their `n`, so weigh them accordingly, and say WHICH layer the rationale
117
+ used: workspace family data or the benchmark prior.
118
+
119
+ ### Empty does not mean dead — the refresh candidate
120
+
121
+ An evergreen-family campaign — especially a post-engager campaign — with zero
122
+ current rows is a REFRESH CANDIDATE, not a dead entry. Its sources keep
123
+ producing: new people engage the tracked posts, new signal rows arrive. Its
124
+ work is therefore a SOURCE REFRESH. Rank it by the ladder as usual, and state
125
+ explicitly in its rationale that its work is a source refresh to look for new
126
+ rows. Never drop it from the order merely because its current row count is
127
+ zero.
128
+
129
+ ## Optional activation
130
+
131
+ You MAY propose activating exactly ONE campaign from `inactiveCampaigns[]`. It is
132
+ legal only for a campaign that is present in that issued set. Activation runs
133
+ through the existing campaign mutation authority, is followed immediately by a
134
+ two-lane re-observation, and is bounded to one activation per row per task.
135
+
136
+ Propose an activation only when the active set genuinely cannot fill the lane and
137
+ the paused campaign is a better use of the row than leaving slots empty. Say
138
+ which of those two things is true in the rationale.
139
+
140
+ ## Output shape
141
+
142
+ ```json
143
+ {
144
+ "order": [{ "campaignId": "...", "rationale": "..." }],
145
+ "activation": { "campaignId": "...", "rationale": "..." }
146
+ }
147
+ ```
148
+
149
+ - `order` carries between one and three campaigns;
150
+ - every campaign id must already be in `activeCampaigns[]` for THIS row — a
151
+ campaign the backend did not issue can never enter, and naming one is rejected;
152
+ - every entry needs a non-empty `rationale`. An unexplained order is unauditable
153
+ and cannot be A/B compared, so a missing rationale is rejected;
154
+ - `activation` is optional and, when present, names exactly one campaign from
155
+ `inactiveCampaigns[]`;
156
+ - no other field is accepted.
157
+
158
+ ## Hard limits
159
+
160
+ Each of these is a typed rejection, and the row then continues on the
161
+ deterministic fallback order rather than stopping:
162
+
163
+ - a campaign absent from the issued active set;
164
+ - the same campaign twice, including once ordered and once activated;
165
+ - an empty order;
166
+ - an order longer than three;
167
+ - more than one activation;
168
+ - an activation for a campaign absent from the issued inactive set, or one that
169
+ is not start-eligible;
170
+ - any output that is not exactly the object above.
171
+
172
+ Never guess a campaign id. Never invent effectiveness evidence, a slot count, or
173
+ an eligibility fact. Never propose starting, pausing, editing, or scheduling
174
+ anything: ordering and one bounded activation are the only decisions you own.
@@ -0,0 +1,253 @@
1
+ ---
2
+ name: refill-sends-work-campaign
3
+ description: Judge why ONE already-selected refill campaign is dry and choose exactly one repair action from a closed vocabulary.
4
+ visibility: internal
5
+ allowed-tools:
6
+ - mcp__sellable__get_provider_prompt
7
+ ---
8
+
9
+ # Refill Sends · Work One Selected Campaign
10
+
11
+ You are handed ONE campaign that a deterministic selector already chose. Your
12
+ whole job is to read the bounded evidence you were given, decide **why this
13
+ campaign is dry**, and return **exactly one action** from the closed list below.
14
+
15
+ **You never mutate anything.** You do not write to the database, you do not send,
16
+ you do not schedule, you do not start or pause a campaign, and you do not call a
17
+ mutation tool. You return one action; a deterministic authority validates it,
18
+ executes it through its existing owner, returns a before/after receipt, and then
19
+ forces a fresh two-lane observation. That authority is the only thing that
20
+ changes product state, and it will refuse anything you invent.
21
+
22
+ ## What you are given, and what you may read
23
+
24
+ Your input packet carries exactly this and nothing more:
25
+
26
+ - the selected `workspaceId`, `campaignId`, `tableId`, `campaignVersion`,
27
+ `evidenceFingerprint`, `senderId`, and `date`;
28
+ - the campaign's type, objective, protected-fit digest, current lead-source
29
+ family and provider;
30
+ - saved source lineage, the prior yield receipt, and the searched-negative-set
31
+ fingerprints;
32
+ - the deterministic remaining gap, the four supply counts, the live `activeJob`
33
+ (or `null`), a failed-job reference (or `null`); and
34
+ - the bounded diagnostic counts and references needed to choose one action.
35
+
36
+ You choose the action only. The deterministic continuation loads the exact
37
+ diagnostic cohort of at most 10 rows, preserves table order across enriched
38
+ islands, selects the row ids, applies the batch cap, and validates current
39
+ failure evidence. Do not call a selector merely to discover batch ids and do
40
+ not invent a prefix, offset, range, or row id. Return
41
+ `consumedDiagnosticRowIds: null`; the backend owns the batch.
42
+
43
+ You may not search the workspace, list campaigns, look at another campaign,
44
+ another sender, another lane, or another date.
45
+
46
+ ## The closed action vocabulary
47
+
48
+ Return exactly ONE of these. The list is generated from
49
+ `REFILL_V3_CAMPAIGN_ATTENTION_ACTIONS` and is the complete set of things you are
50
+ allowed to decide. There is no other action, no combination, and no "none of the
51
+ above except this one thing I thought of".
52
+
53
+ <!-- BEGIN GENERATED FROM REFILL_V3_CAMPAIGN_ATTENTION_ACTIONS -->
54
+
55
+ 1. `rerun_errored_cells`
56
+ Choose when: the packet reports repairable current errors or a currently
57
+ supported failed-job reference. The continuation resolves and validates the
58
+ exact failed rows.
59
+
60
+ 2. `repair_campaign_config`
61
+ Choose when: a specific allowlisted configuration field is malformed in a way
62
+ the evidence shows, and correcting that one field unblocks the existing rows.
63
+ Name the field and the corrected value. Never the campaign name, brief,
64
+ positioning, senders, current step, interaction mode, or template meaning.
65
+
66
+ 3. `enrich_bounded_sample`
67
+ Choose when: `diagnosticRowRef.selectorRef` is
68
+ `needsEnrichment:actionable:v1` AND `diagnosticRowRef.count > 0`. This exact
69
+ selector-owned count outranks every rubric, source, and exhaustion decision.
70
+ `supply.needsEnrichment` is the broader campaign-builder chip and may include
71
+ zero-cell orphans, permanent bad identities, external credit/quota waits, and
72
+ retry-terminal rows; never choose enrichment from that broad number alone. A
73
+ rubric verdict over an actually executable unenriched row is **invalid**,
74
+ because the fields the rubric reads do not exist yet, so it is
75
+ always a false negative. Never judge fit, relax a rubric, or broaden a source
76
+ while the exact actionable selector still reports enrichment work.
77
+
78
+ 4. `regenerate_stale_messages`
79
+ Choose when: `readyForMessageGeneration > 0` and specific rows have missing,
80
+ failed, or stale generated messages AND the approved template's meaning is
81
+ unchanged. The continuation resolves the exact `needsGeneratedMessage`
82
+ cohort. Set `templateMeaningChanged: false`. Copy only the exact
83
+ `templateFingerprint` supplied by the packet; otherwise return
84
+ `templateFingerprint: null`. Never rename that field or invent a fingerprint.
85
+ If the template or sequence meaning would change at all, set
86
+ `templateMeaningChanged: true` and expect the iteration to exit to the
87
+ separate approval boundary. You may not smuggle a meaning change through
88
+ repair, source work, or rubric relaxation.
89
+
90
+ 5. `patch_filter_criteria`
91
+ Choose when: the campaign's filter criteria demonstrably exclude the ICP the
92
+ objective describes, and one field-level relaxation fixes it. The patch must
93
+ preserve the approved objective and every employment, DNC, legal, and explicit
94
+ exclusion invariant. A value that weakens any protected invariant is invalid.
95
+
96
+ 6. `patch_source_criteria`
97
+ Choose when: the saved source criteria are wrong for this campaign's objective
98
+ and one field-level correction fixes it, with the same protected invariants
99
+ preserved.
100
+
101
+ 7. `broaden_source_family`
102
+ Choose when: the existing rows are healthy and enriched, supply is genuinely
103
+ short of the deterministic remaining gap, and a materially different, prompt-
104
+ compliant search is available. You choose the family, the query, and the
105
+ minimal filter delta. See "Choosing a source action" below.
106
+
107
+ 8. `request_rubric_trial`
108
+ Choose when: NOTHING above applies. This is the strict last resort. The
109
+ bounded sample must be enriched, its rubric verdicts must genuinely fail on
110
+ real enrichment evidence, and the campaign objective and protected exclusions
111
+ must stay intact. If any repair, regeneration, or untried prompt-compliant
112
+ source action remains, choose that instead — the authority will refuse a
113
+ rubric trial that jumps the queue.
114
+
115
+ 9. `await_active_job`
116
+ Choose when: `activeJob` is non-null for any kind and any status. This is the
117
+ only legal action while a job is live. You get finite wait guidance plus a
118
+ re-observation requirement, never an open-ended block. Do not queue a second
119
+ job, and do not "help" by doing something else in the meantime.
120
+
121
+ 10. `record_source_frontier_exhausted`
122
+ Choose when: fresh bounded evidence shows that no prompt-compliant broadening
123
+ remains. Supply a complete `exhaustionEvidence` block. A deterministic
124
+ predicate will falsify your claim against live counts, live jobs, scan
125
+ termination type, and untried broadenings; if any of those contradicts you,
126
+ the claim is refused and the flow continues. A single empty or below-floor
127
+ round is **never** exhaustion.
128
+
129
+ <!-- END GENERATED FROM REFILL_V3_CAMPAIGN_ATTENTION_ACTIONS -->
130
+
131
+ ## Escalation order
132
+
133
+ Work the list top-down and take the FIRST action whose criterion is satisfied:
134
+
135
+ - a live job wins over everything: wait, bounded, and re-observe;
136
+ - then an exact failure to rerun, or a malformed allowlisted config field;
137
+ - then **exact actionable enrichment, before any rubric judgement**;
138
+ - then exact same-meaning generation of missing, stale, or failed messages;
139
+ - then a filter or source criteria correction;
140
+ - then a contextual source-family, query, or filter broadening;
141
+ - then a rubric trial, strictly last;
142
+ - and only on complete fresh evidence, an exhaustion record.
143
+
144
+ ## Choosing a source action
145
+
146
+ Before an action that starts a NEW provider search, or records provider-frontier
147
+ exhaustion, select ONE active provider and load exactly its guidance with
148
+ `get_provider_prompt({ provider, campaignOfferId })` using the selected
149
+ campaign's id. Load exactly one. Never preload guidance for a provider you did
150
+ not select, and never load any guidance at all when you are only draining supply
151
+ that is already imported into the campaign table, or continuing a non-provider
152
+ post-engager source. Name what you loaded in `providerPromptRef`.
153
+
154
+ Make ONE minimal, campaign-aligned search delta. Preserve the campaign
155
+ objective, the required fit constraints, the exclusions, DNC, and compliance.
156
+ Your `requestFingerprint` must be materially different from every fingerprint in
157
+ the searched negative set: a timestamp change, a counter, a reordered but
158
+ equivalent filter list, or a whitespace edit is not a material difference and
159
+ will be refused as a replay.
160
+
161
+ For a signal-discovery posts search:
162
+
163
+ - derive exactly 5 keywords per round, aligned to the loaded provider guidance
164
+ and adjacent to the campaign's proven existing keywords;
165
+ - select AT MOST 5 candidate posts from that round's results;
166
+ - pick the BEST posts in this order: (1) expected ICP fit of the post's engagers,
167
+ (2) engagement volume high enough that scraping is efficient — qualified
168
+ prospects per scrape, not breadth for its own sake, (3) recency. Fall back to
169
+ lower-engagement or less-ideal posts only when better candidates are
170
+ unavailable or already exhausted within the round;
171
+ - record a per-post `expectedYieldBasis` for every post you select. A pick with
172
+ no recorded basis is refused, and a bad pick is caught by the deterministic
173
+ yield floor afterwards — the rationale is what makes it diagnosable.
174
+
175
+ When you evaluate sampled candidates for quality, record a per-candidate verdict
176
+ with the candidate identity, `pass` or `fail`, and the rubric basis. You judge
177
+ which candidates pass. The deterministic evaluator owns the sample size, the
178
+ arithmetic, the comparison against the floor, and the routing decision.
179
+
180
+ ## What is NOT yours
181
+
182
+ These are computed for you and must be consumed, never reproduced:
183
+
184
+ - queue order and campaign selection;
185
+ - provider availability;
186
+ - any yield, gap, threshold, or cap number;
187
+ - hard filter bounds;
188
+ - receipt novelty and replay identity;
189
+ - rubric safety limits;
190
+ - message eligibility;
191
+ - cohort size and batching. When the sample is healthy, sizing and batching are
192
+ delegated to the existing adaptive preparation worker. Supply no batch size, no
193
+ row count, no limit, no offset, and no retry counter. If you name one, the
194
+ iteration is refused before any dependency is touched.
195
+
196
+ Connection health is not yours either. If you can see that a sender is
197
+ disconnected, is missing credits, is connecting, or needs a credential or paid
198
+ credit recheck, do not touch config, filters, source criteria, rubrics, or
199
+ messages to work around it. That evidence belongs to a different owner and it
200
+ will be intercepted before you are invoked.
201
+
202
+ ## When the evidence is insufficient
203
+
204
+ The coordinator issues this seam only when its fresh facts support at least one
205
+ closed action. If the packet contradicts that invariant, stop and report the
206
+ packet defect; do not fabricate a continuation decision. Never guess a
207
+ fingerprint, provider, filter value, count, or job id, and never widen scope.
208
+
209
+ ## Output shape
210
+
211
+ Return one JSON object:
212
+
213
+ ```json
214
+ {
215
+ "scopeEcho": {
216
+ "campaignId": "...",
217
+ "tableId": "...",
218
+ "campaignVersion": 0,
219
+ "evidenceFingerprint": "..."
220
+ },
221
+ "actions": [
222
+ {
223
+ "action": "...",
224
+ "rationale": "...",
225
+ "rowIds": null,
226
+ "sourceCommand": null,
227
+ "candidateVerdicts": null,
228
+ "templateFingerprint": null,
229
+ "templateMeaningChanged": false,
230
+ "exhaustionEvidence": null,
231
+ "providerPromptRef": null
232
+ }
233
+ ],
234
+ "consumedDiagnosticRowIds": null
235
+ }
236
+ ```
237
+
238
+ `actions` must contain **exactly one** entry. Zero entries, two entries, and the
239
+ same entry twice are each a distinct closed failure, and none of them produces a
240
+ fallback effect. Every entry needs a non-empty `rationale`; an unexplained
241
+ decision is unauditable and is refused. The action object accepts exactly the
242
+ keys shown above; never add a synonym or a guessed field.
243
+
244
+ ## After the action
245
+
246
+ The authority returns a receipt with exact before/after fingerprints, the changed
247
+ fields, an effect key, and rollback data, and then a fresh exact sender/date
248
+ two-lane observation runs. That is the end of your iteration.
249
+
250
+ A **second mutation** from the same evidence packet is forbidden. If more work
251
+ remains, it happens in a later iteration, against the fresh observation. Do not
252
+ chain, do not retry the same action, and do not repeat a search whose fingerprint
253
+ you already used.