@sellable/mcp 0.1.502 → 0.1.503

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 (34) hide show
  1. package/dist/api.d.ts +5 -5
  2. package/dist/api.js +10 -10
  3. package/dist/index-dev.js +0 -0
  4. package/dist/index.js +0 -0
  5. package/dist/server.js +2 -2
  6. package/dist/tools/campaign-fill-routing.d.ts +5 -0
  7. package/dist/tools/campaign-fill-routing.js +13 -3
  8. package/dist/tools/campaign-message-preparation.d.ts +7 -48
  9. package/dist/tools/campaign-message-preparation.js +21 -44
  10. package/dist/tools/campaign-processing.d.ts +19 -0
  11. package/dist/tools/campaign-processing.js +31 -8
  12. package/dist/tools/campaign-refill-state.d.ts +5 -0
  13. package/dist/tools/campaign-refill-state.js +13 -3
  14. package/dist/tools/leads.d.ts +6 -47
  15. package/dist/tools/leads.js +26 -30
  16. package/dist/tools/prompts.js +1 -1
  17. package/dist/tools/readiness.d.ts +6 -0
  18. package/dist/tools/readiness.js +12 -5
  19. package/dist/tools/refill-sends.d.ts +34 -32
  20. package/dist/tools/refill-sends.js +67 -608
  21. package/dist/tools/refill-target-plan.d.ts +5 -0
  22. package/dist/tools/refill-target-plan.js +24 -50
  23. package/dist/tools/registry.d.ts +205 -48
  24. package/dist/tools/scheduler-fill-capacity.d.ts +5 -0
  25. package/dist/tools/scheduler-fill-capacity.js +13 -3
  26. package/dist/tools/sender-routing.d.ts +8 -1
  27. package/dist/tools/sender-routing.js +12 -3
  28. package/dist/tools/senders.d.ts +14 -1
  29. package/dist/tools/senders.js +31 -5
  30. package/dist/tools/workspace-context.d.ts +36 -0
  31. package/dist/tools/workspace-context.js +39 -0
  32. package/package.json +1 -1
  33. package/skills/refill-sends/SKILL.md +49 -28
  34. package/skills/refill-sends-workflow/SKILL.md +15 -10
@@ -1,7 +1,11 @@
1
1
  import { getApi } from "../api.js";
2
- async function postSchedulerFillCapacity(body) {
2
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
3
+ async function postSchedulerFillCapacity(body, workspaceId) {
3
4
  const api = getApi();
4
- return api.post("/api/v3/mcp/scheduler-fill-capacity", body);
5
+ const requestOptions = workspaceRequestOptions(workspaceId);
6
+ return requestOptions
7
+ ? api.post("/api/v3/mcp/scheduler-fill-capacity", body, requestOptions)
8
+ : api.post("/api/v3/mcp/scheduler-fill-capacity", body);
5
9
  }
6
10
  export const schedulerFillCapacityToolDefinitions = [
7
11
  {
@@ -55,6 +59,10 @@ export const schedulerFillCapacityToolDefinitions = [
55
59
  enum: ["default_horizon", "target_date"],
56
60
  description: "Optional mode hint. Omit for default_horizon; target_date requires targetDate.",
57
61
  },
62
+ workspaceId: {
63
+ type: "string",
64
+ description: "Explicit request-scoped workspace id for scheduled/yolo refill automation. Pass this instead of switching the shared active workspace.",
65
+ },
58
66
  },
59
67
  required: ["capacityRequests"],
60
68
  additionalProperties: false,
@@ -62,9 +70,11 @@ export const schedulerFillCapacityToolDefinitions = [
62
70
  },
63
71
  ];
64
72
  export function getSchedulerFillCapacity(input) {
73
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
65
74
  return postSchedulerFillCapacity({
66
75
  capacityRequests: input.capacityRequests,
67
76
  targetDate: input.targetDate,
68
77
  mode: input.mode,
69
- });
78
+ ...(workspaceId ? { workspaceId } : {}),
79
+ }, workspaceId ?? undefined);
70
80
  }
@@ -14,6 +14,10 @@ export declare const senderRoutingToolDefinitions: ({
14
14
  inputSchema: {
15
15
  type: string;
16
16
  properties: {
17
+ workspaceId: {
18
+ type: string;
19
+ description: string;
20
+ };
17
21
  rulesMarkdown?: undefined;
18
22
  };
19
23
  required: never[];
@@ -29,12 +33,15 @@ export declare const senderRoutingToolDefinitions: ({
29
33
  type: string;
30
34
  description: string;
31
35
  };
36
+ workspaceId?: undefined;
32
37
  };
33
38
  required: never[];
34
39
  additionalProperties: boolean;
35
40
  };
36
41
  })[];
37
- export declare function getSenderRoutingTool(): Promise<SenderRoutingResponse>;
42
+ export declare function getSenderRoutingTool(input?: {
43
+ workspaceId?: string;
44
+ }): Promise<SenderRoutingResponse>;
38
45
  export declare function setSenderRoutingTool(input?: {
39
46
  rulesMarkdown?: string;
40
47
  }): Promise<{
@@ -1,4 +1,5 @@
1
1
  import { getApi } from "../api.js";
2
+ import { workspaceRequestOptions } from "./workspace-context.js";
2
3
  const MAX_RULES_MARKDOWN_LENGTH = 65536;
3
4
  export const senderRoutingToolDefinitions = [
4
5
  {
@@ -6,7 +7,12 @@ export const senderRoutingToolDefinitions = [
6
7
  description: "Return the workspace's territory routing rules markdown plus the connected sender roster. If configured is false, routing is inactive and all campaign senders are eligible everywhere.",
7
8
  inputSchema: {
8
9
  type: "object",
9
- properties: {},
10
+ properties: {
11
+ workspaceId: {
12
+ type: "string",
13
+ description: "Explicit request-scoped workspace id for scheduled/yolo refill automation. Pass this instead of switching the shared active workspace.",
14
+ },
15
+ },
10
16
  required: [],
11
17
  additionalProperties: false,
12
18
  },
@@ -27,9 +33,12 @@ export const senderRoutingToolDefinitions = [
27
33
  },
28
34
  },
29
35
  ];
30
- export async function getSenderRoutingTool() {
36
+ export async function getSenderRoutingTool(input = {}) {
31
37
  const api = getApi();
32
- return api.get("/api/v3/sender-routing");
38
+ const requestOptions = workspaceRequestOptions(input.workspaceId);
39
+ return requestOptions
40
+ ? api.get("/api/v3/sender-routing", requestOptions)
41
+ : api.get("/api/v3/sender-routing");
33
42
  }
34
43
  export async function setSenderRoutingTool(input = {}) {
35
44
  if (input.rulesMarkdown &&
@@ -22,14 +22,19 @@ export type SenderListItem = {
22
22
  export type ListSendersResponse = {
23
23
  senders: SenderListItem[];
24
24
  };
25
+ export type ListSendersInput = {
26
+ workspaceId?: string;
27
+ };
25
28
  export type GetSenderInput = {
26
29
  senderId: string;
30
+ workspaceId?: string;
27
31
  };
28
32
  export type SenderDetailResponse = {
29
33
  sender: any;
30
34
  };
31
35
  export type RefreshPaidInmailCreditsInput = {
32
36
  senderId: string;
37
+ workspaceId?: string;
33
38
  };
34
39
  export type PaidInmailCreditStatus = {
35
40
  available: number;
@@ -57,6 +62,10 @@ export declare const senderToolDefinitions: ({
57
62
  inputSchema: {
58
63
  type: string;
59
64
  properties: {
65
+ workspaceId: {
66
+ type: string;
67
+ description: string;
68
+ };
60
69
  senderId?: undefined;
61
70
  };
62
71
  required: never[];
@@ -72,12 +81,16 @@ export declare const senderToolDefinitions: ({
72
81
  type: string;
73
82
  description: string;
74
83
  };
84
+ workspaceId: {
85
+ type: string;
86
+ description: string;
87
+ };
75
88
  };
76
89
  required: string[];
77
90
  additionalProperties: boolean;
78
91
  };
79
92
  })[];
80
- export declare function listSenders(): Promise<ListSendersResponse>;
93
+ export declare function listSenders(input?: ListSendersInput): Promise<ListSendersResponse>;
81
94
  export declare function getSender(input: GetSenderInput): Promise<SenderDetailResponse>;
82
95
  export declare function refreshPaidInmailCredits(input: RefreshPaidInmailCreditsInput): Promise<RefreshPaidInmailCreditsResponse>;
83
96
  export {};
@@ -1,5 +1,6 @@
1
1
  import { getApi } from "../api.js";
2
2
  import { isLinkedInProfileInput, normalizeLinkedInProfileInput, } from "./linkedin-url.js";
3
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
3
4
  function pickString(...values) {
4
5
  for (const value of values) {
5
6
  if (typeof value !== "string")
@@ -107,7 +108,12 @@ export const senderToolDefinitions = [
107
108
  description: "List outbound sender identities available in the active workspace, including LinkedIn profile URL and verified identity proof when available. In create-campaign flows, use this at Settings/final launch handoff to verify available connected senders; auto-select only when a sender has an exact identity match to the researched campaign identity. If identity proof is missing, ask the user to confirm the sender.",
108
109
  inputSchema: {
109
110
  type: "object",
110
- properties: {},
111
+ properties: {
112
+ workspaceId: {
113
+ type: "string",
114
+ description: "Explicit request-scoped workspace id for scheduled/yolo refill automation. Pass this instead of switching the shared active workspace.",
115
+ },
116
+ },
111
117
  required: [],
112
118
  additionalProperties: false,
113
119
  },
@@ -119,6 +125,10 @@ export const senderToolDefinitions = [
119
125
  type: "object",
120
126
  properties: {
121
127
  senderId: { type: "string", description: "Outbound sender ID" },
128
+ workspaceId: {
129
+ type: "string",
130
+ description: "Explicit request-scoped workspace id for scheduled/yolo refill automation.",
131
+ },
122
132
  },
123
133
  required: ["senderId"],
124
134
  additionalProperties: false,
@@ -134,15 +144,22 @@ export const senderToolDefinitions = [
134
144
  type: "string",
135
145
  description: "Exact Sender.id to refresh. The API verifies the sender belongs to the active workspace.",
136
146
  },
147
+ workspaceId: {
148
+ type: "string",
149
+ description: "Explicit request-scoped workspace id for scheduled/yolo refill automation. Pass this instead of switching the shared active workspace.",
150
+ },
137
151
  },
138
152
  required: ["senderId"],
139
153
  additionalProperties: false,
140
154
  },
141
155
  },
142
156
  ];
143
- export async function listSenders() {
157
+ export async function listSenders(input = {}) {
144
158
  const api = getApi();
145
- const senders = await api.get("/api/v1/outbound-sender-identities");
159
+ const requestOptions = workspaceRequestOptions(input.workspaceId);
160
+ const senders = requestOptions
161
+ ? await api.get("/api/v1/outbound-sender-identities", requestOptions)
162
+ : await api.get("/api/v1/outbound-sender-identities");
146
163
  return {
147
164
  senders: (senders || []).map((s) => {
148
165
  const linkedinProfileUrl = computeLinkedinProfileUrl(s);
@@ -163,7 +180,11 @@ export async function listSenders() {
163
180
  }
164
181
  export async function getSender(input) {
165
182
  const api = getApi();
166
- const sender = await api.get(`/api/v1/outbound-sender-identities/${encodeURIComponent(input.senderId)}`);
183
+ const requestOptions = workspaceRequestOptions(input.workspaceId);
184
+ const path = `/api/v1/outbound-sender-identities/${encodeURIComponent(input.senderId)}`;
185
+ const sender = requestOptions
186
+ ? await api.get(path, requestOptions)
187
+ : await api.get(path);
167
188
  return { sender };
168
189
  }
169
190
  function normalizeCreditStatus(raw) {
@@ -187,7 +208,12 @@ export async function refreshPaidInmailCredits(input) {
187
208
  throw new Error("senderId is required.");
188
209
  }
189
210
  const api = getApi();
190
- const result = await api.post(`/api/v3/senders/${encodeURIComponent(senderId)}/refresh-inmail-credits`, {});
211
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
212
+ const requestOptions = workspaceRequestOptions(workspaceId);
213
+ const body = workspaceId ? { workspaceId } : {};
214
+ const result = requestOptions
215
+ ? await api.post(`/api/v3/senders/${encodeURIComponent(senderId)}/refresh-inmail-credits`, body, requestOptions)
216
+ : await api.post(`/api/v3/senders/${encodeURIComponent(senderId)}/refresh-inmail-credits`, body);
191
217
  return {
192
218
  senderId,
193
219
  refreshed: true,
@@ -0,0 +1,36 @@
1
+ import type { ApiRequestOptions } from "../api.js";
2
+ export type WorkspaceExecutionMode = "manual" | "scheduled" | "yolo";
3
+ export interface CreateWorkspaceContextInput {
4
+ workspaceId?: string | null;
5
+ executionMode: WorkspaceExecutionMode;
6
+ toolName?: string;
7
+ runId?: string;
8
+ }
9
+ export interface WorkspaceContext {
10
+ workspaceId: string;
11
+ requestOptions: Readonly<ApiRequestOptions>;
12
+ executionMode: WorkspaceExecutionMode;
13
+ toolName?: string;
14
+ runId: string;
15
+ workspaceResolution: "explicit";
16
+ }
17
+ export interface WorkspaceRequiredResult {
18
+ ok: false;
19
+ code: "WORKSPACE_REQUIRED";
20
+ message: string;
21
+ executionMode: WorkspaceExecutionMode;
22
+ toolName?: string;
23
+ workspaceResolution: "missing";
24
+ }
25
+ export interface WorkspaceContextResult {
26
+ ok: true;
27
+ context: Readonly<WorkspaceContext>;
28
+ }
29
+ export type CreateWorkspaceContextResult = WorkspaceContextResult | WorkspaceRequiredResult;
30
+ export declare function workspaceRequired(params: {
31
+ executionMode: WorkspaceExecutionMode;
32
+ toolName?: string;
33
+ }): WorkspaceRequiredResult;
34
+ export declare function normalizeExplicitWorkspaceId(value: unknown): string | null;
35
+ export declare function workspaceRequestOptions(workspaceId: unknown): Readonly<ApiRequestOptions> | undefined;
36
+ export declare function createWorkspaceContext(input: CreateWorkspaceContextInput): CreateWorkspaceContextResult;
@@ -0,0 +1,39 @@
1
+ import { randomUUID } from "node:crypto";
2
+ export function workspaceRequired(params) {
3
+ const toolLabel = params.toolName ? ` for ${params.toolName}` : "";
4
+ return {
5
+ ok: false,
6
+ code: "WORKSPACE_REQUIRED",
7
+ message: `Explicit workspaceId is required${toolLabel} in ${params.executionMode} mode. ` +
8
+ "Pass workspaceId on the tool call instead of switching the shared active workspace.",
9
+ executionMode: params.executionMode,
10
+ toolName: params.toolName,
11
+ workspaceResolution: "missing",
12
+ };
13
+ }
14
+ export function normalizeExplicitWorkspaceId(value) {
15
+ return typeof value === "string" && value.trim() ? value.trim() : null;
16
+ }
17
+ export function workspaceRequestOptions(workspaceId) {
18
+ const normalized = normalizeExplicitWorkspaceId(workspaceId);
19
+ return normalized ? Object.freeze({ workspaceId: normalized }) : undefined;
20
+ }
21
+ export function createWorkspaceContext(input) {
22
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
23
+ if (!workspaceId) {
24
+ return workspaceRequired({
25
+ executionMode: input.executionMode,
26
+ toolName: input.toolName,
27
+ });
28
+ }
29
+ const requestOptions = Object.freeze({ workspaceId });
30
+ const context = Object.freeze({
31
+ workspaceId,
32
+ requestOptions,
33
+ executionMode: input.executionMode,
34
+ toolName: input.toolName,
35
+ runId: input.runId?.trim() || randomUUID(),
36
+ workspaceResolution: "explicit",
37
+ });
38
+ return { ok: true, context };
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.502",
3
+ "version": "0.1.503",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code and Codex campaign workflows",
6
6
  "main": "dist/index.js",
@@ -68,6 +68,9 @@ Accepted invocation flags in the same user request:
68
68
 
69
69
  - `--yolo`: auto-accept the rendered bounded refill packet after the required
70
70
  fresh state reread.
71
+ - `workspaceId: <id>`: required for scheduled automation and `--yolo`; pass it
72
+ through on every refill MCP tool call instead of relying on shared config
73
+ state.
71
74
  - `--sender <name-or-id>`: scope to a specific sender; repeat for multiple
72
75
  senders.
73
76
  - `--until <YYYY-MM-DD>`: fill through that sender-local date, inclusive,
@@ -86,23 +89,48 @@ Accepted invocation flags in the same user request:
86
89
  When the host can call typed MCP tools, start with:
87
90
 
88
91
  ```text
89
- refill_sends({ yolo?: boolean, senders?: string[], senderIds?: string[], senderNames?: string[], horizonSendDays?: number, untilDate?: "YYYY-MM-DD", targetDate?: "YYYY-MM-DD" })
92
+ refill_sends({ yolo?: boolean, executionMode?: "manual" | "scheduled" | "yolo", requireWorkspace?: boolean, workspaceId?: string, senders?: string[], senderIds?: string[], senderNames?: string[], horizonSendDays?: number, untilDate?: "YYYY-MM-DD", targetDate?: "YYYY-MM-DD" })
90
93
  ```
91
94
 
92
- That command helper normalizes arguments and returns the execution contract. In
93
- non-yolo mode it does not mutate. In `--yolo`, it may execute exactly one safe
94
- bounded primitive from the fresh `target.globalActionQueue[0]`, then reread and
95
- return the new target plan; currently safe primitives are paid-credit refresh,
96
- existing-row message preparation, same-source row copy, and read-only wait
97
- rereads. It does not run unbounded approval, lower
98
- paid-InMail thresholds, switch source families, create campaigns, launch, send,
99
- or write scheduler rows. Continue with the workflow below for route selection,
100
- state rereads, approval gating, source import, preparation, and bounded
101
- approval.
102
-
103
- First call `get_auth_status({})`. If auth or active workspace is not OK, follow
104
- the returned login/workspace guidance before route resolution. Do not run refill
105
- research against an implicit or guessed workspace.
95
+ That command helper only normalizes arguments and returns the execution
96
+ contract. It does not mutate. Continue with the workflow below for route
97
+ selection, state rereads, approval gating, source import, preparation, and
98
+ bounded approval.
99
+
100
+ ## Workspace Contract
101
+
102
+ First resolve the target workspace id from the user's request, automation config,
103
+ or install-time workspace mapping. Pass `workspaceId` on every scheduled or
104
+ `--yolo` refill tool call, including setup/read calls such as
105
+ `refill_sends`, `get_refill_target_plan`, `list_senders`,
106
+ `get_sender_routing`, `resolve_campaign_fill_route`,
107
+ `get_campaign_refill_state`, `get_scheduler_fill_capacity`, and any later
108
+ refill mutation covered by the packet. Missing `workspaceId` in scheduled or
109
+ `--yolo` mode is a blocker; stop with `WORKSPACE_REQUIRED` instead of running
110
+ against an implicit or guessed workspace.
111
+
112
+ Do not solve scheduled or `--yolo` workspace uncertainty by changing the shared
113
+ active workspace. Manual interactive workspace switching remains a separate
114
+ diagnostic/setup flow, outside automation.
115
+
116
+ Examples:
117
+
118
+ ```text
119
+ refill_sends({ yolo:true, executionMode:"yolo", requireWorkspace:true, workspaceId:"cmlq1v8ms0000jx04ang4hi7e" })
120
+ get_refill_target_plan({ intent:"plain", approvalMode:"approve", workspaceId:"cmlq1v8ms0000jx04ang4hi7e" })
121
+ list_senders({ workspaceId:"cmlq1v8ms0000jx04ang4hi7e" })
122
+ ```
123
+
124
+ Clover scheduled automation must name the Clover workspace explicitly:
125
+
126
+ ```text
127
+ refill_sends({ yolo:false, executionMode:"scheduled", requireWorkspace:true, workspaceId:"cmlq1v8ms0000jx04ang4hi7e" })
128
+ get_refill_target_plan({ intent:"plain", approvalMode:"mark_ready", workspaceId:"cmlq1v8ms0000jx04ang4hi7e" })
129
+ ```
130
+
131
+ First call `get_auth_status({})`. If auth is not OK, follow the returned login
132
+ guidance before route resolution. Do not run refill research against an implicit
133
+ or guessed workspace.
106
134
 
107
135
  Treat "refill senders", "fill senders", "load everyone up", and "max out
108
136
  senders" as sender-scoped requests. The target set is senders enrolled in active
@@ -165,25 +193,18 @@ Structured planner packet:
165
193
  `Still need`.
166
194
  - `target.globalActionQueue` is the only cross-sender yolo execution queue.
167
195
  Execute exactly one globally ranked primitive from
168
- `target.globalActionQueue[0]`, then rerun `get_refill_target_plan` before
196
+ `target.globalActionQueue[0]`, then rerun `get_refill_target_plan` with the
197
+ same `workspaceId` before
169
198
  choosing another action.
170
199
  - `manualAlternates` are not yolo actions. Threshold lowering and campaign
171
200
  creation are manual continuations only.
172
201
 
173
- Refill action ladder: approve generated rows only when an explicit bounded
174
- approval gate exists, process all existing same-campaign unenriched/unprepared
175
- rows in bounded batches before any source work, then copy bounded net-new rows
176
- from the selected source (`selectedLeadListId`, provider, and source
177
- fingerprint preserved), then use provider-aligned source-more. A new source or
178
- provider switch changes the reply-rate baseline and is a manual alternate, not a
179
- `--yolo` side effect.
180
-
181
202
  Run-local paid-credit guard: in `--yolo`, the `refill_sends` MCP command
182
203
  automatically maintains a `refreshedPaidInmailSenderIds` set for the current
183
204
  command call. If its first target plan has stale/missing paid-InMail credit
184
205
  facts, it refreshes each selected sender at most once, reruns
185
206
  `get_refill_target_plan`, and returns the post-refresh `targetPlan` before
186
- choosing the next prep/source-copy/bounded-approval/read-only wait action. If fresh facts are still below
207
+ choosing the next prep/approval/start action. If fresh facts are still below
187
208
  threshold, below-threshold paid-InMail facts fall back to an existing connection
188
209
  lane, the same Sales Nav cascade campaign's connection branch, or a manual
189
210
  continuation.
@@ -250,7 +271,7 @@ If Christian includes `--yolo` in the same refill request, treat that flag as
250
271
  auto-accept for the rendered bounded refill packet after the required fresh state
251
272
  reread. For sender-scoped language with no named senders, `--yolo` means all
252
273
  eligible healthy senders enrolled in active campaign-backed sequence campaigns in
253
- the active workspace. Without `--yolo`, if Christian did not name senders, ask
274
+ the requested `workspaceId`. Without `--yolo`, if Christian did not name senders, ask
254
275
  which eligible enrolled senders to refill before choosing campaigns or mutating.
255
276
 
256
277
  `--yolo` only covers the exact sender set, per-sender target campaigns, caps,
@@ -272,7 +293,7 @@ they change `stateRevision`, not `targetShapeRevision`, and do not require a
272
293
  second approval.
273
294
 
274
295
  In `--yolo`, continue as far as the rendered packet safely allows. After each
275
- apply/prep/source-copy/bounded-approval/read-only wait result, reread state, settle processing when needed, and move to
296
+ apply/prep/start result, reread state, settle processing when needed, and move to
276
297
  the next selected sender or start-eligible same-packet campaign instead of
277
298
  stopping after the first partial result. If no in-packet safe action remains,
278
299
  return concrete continuation options with campaign names, exact ids, which option
@@ -286,7 +307,7 @@ selected sender: selected send days, gross capacity, actual sent cells, future
286
307
  scheduler-owned scheduled cells with non-null `scheduledFor`, projected count,
287
308
  ready-to-schedule buffer, remaining projected gap, paid-InMail feasibility,
288
309
  `targetShapeRevision`, `stateRevision`, and the next MCP primitive that can
289
- reduce the gap. After every apply/prep/source-copy/bounded-approval/read-only wait result, wait for processing, reread
310
+ reduce the gap. After every apply/prep/start result, wait for processing, reread
290
311
  the target plan/refill state, recompute the ledger, then keep applying safe
291
312
  bounded actions until projected coverage fills the target window or a concrete
292
313
  non-scheduler blocker is proven.
@@ -61,6 +61,17 @@ senders", and "load everyone up". A sender-scoped request targets senders
61
61
  enrolled in active campaign-backed sequence campaigns, not one arbitrary active
62
62
  campaign.
63
63
 
64
+ Workspace contract: scheduled automation and `--yolo` must carry an explicit
65
+ request-scoped `workspaceId`. Pass that same `workspaceId` on every refill tool
66
+ call in this workflow: `get_refill_target_plan`, `list_senders`,
67
+ `get_sender_routing`, `resolve_campaign_fill_route`,
68
+ `get_campaign_refill_state`, `get_scheduler_fill_capacity`,
69
+ `refresh_paid_inmail_credits`, source import/readiness calls, preparation calls,
70
+ approval calls, and campaign start calls. Missing `workspaceId` in scheduled or
71
+ `--yolo` mode is a blocker; return or report `WORKSPACE_REQUIRED` instead of
72
+ falling back to shared config state. Manual interactive workspace switching is
73
+ diagnostic setup only and is not an automation control path.
74
+
64
75
  Goal-mode continuation: a skill cannot create or invoke `/goal` by itself. When
65
76
  this workflow is already running inside an active Codex goal, keep that goal
66
77
  open until every selected sender lane is horizon-filled by projected coverage
@@ -103,24 +114,18 @@ in-progress wait state, not a reason to mark the goal complete or blocked.
103
114
  `Still need`.
104
115
  - `target.globalActionQueue` is the only cross-sender yolo execution queue.
105
116
  execute exactly one globally ranked primitive from
106
- `target.globalActionQueue[0]`, then rerun `get_refill_target_plan` before
117
+ `target.globalActionQueue[0]`, then rerun `get_refill_target_plan` with
118
+ the same `workspaceId` before
107
119
  choosing another action.
108
120
  - `nextActions[0]` is the current sender's smallest safe primitive.
109
121
  - `manualAlternates` are not yolo actions. Threshold lowering and campaign
110
122
  creation are manual continuations only.
111
- Refill action ladder: approve generated rows only when an explicit bounded
112
- approval gate exists, process all existing same-campaign
113
- unenriched/unprepared rows in bounded batches before any source work, then
114
- copy bounded net-new rows from the selected source (`selectedLeadListId`,
115
- provider, and source fingerprint preserved), then use provider-aligned
116
- source-more. A new source or provider switch changes the reply-rate baseline
117
- and is a manual alternate, not a `--yolo` side effect.
118
123
  Run-local paid-credit guard: in `--yolo`, the `refill_sends` MCP command
119
124
  automatically maintains a `refreshedPaidInmailSenderIds` set for the current
120
125
  command call. If its first target plan has stale/missing paid-InMail credit
121
126
  facts, it refreshes each selected sender at most once, reruns
122
127
  `get_refill_target_plan`, and returns the post-refresh `targetPlan` before
123
- choosing the next prep/source-copy/bounded-approval/read-only wait action. If fresh facts are still below
128
+ choosing the next prep/approval/start action. If fresh facts are still below
124
129
  threshold, below-threshold paid-InMail facts fall back to an existing
125
130
  connection lane, the same Sales Nav cascade campaign's connection branch, or
126
131
  a manual continuation.
@@ -559,7 +564,7 @@ same refill request, do not ask the `Accept` / `Decline` question. Instead:
559
564
  caps/dates, approval mode, blockers, and side-effect class still match the
560
565
  packet;
561
566
  4. execute only the exact packet;
562
- 5. after each terminal credit-refresh/apply/prep/source-copy/bounded-approval/read-only wait result, rerun
567
+ 5. after each terminal credit-refresh/apply/prep/start result, rerun
563
568
  `get_refill_target_plan`, reread state, settle processing when needed,
564
569
  recompute the target-window saturation ledger, and continue with the next smallest
565
570
  safe action inside the same bounded packet until every selected sender is