@sellable/mcp 0.1.336 → 0.1.338
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/README.md +34 -19
- package/dist/api.js +5 -3
- package/dist/auth.js +44 -13
- package/dist/server.js +15 -0
- package/dist/tools/campaign-fill-routing.d.ts +39 -0
- package/dist/tools/campaign-fill-routing.js +45 -0
- package/dist/tools/campaign-horizon-fill.d.ts +93 -0
- package/dist/tools/campaign-horizon-fill.js +92 -0
- package/dist/tools/campaign-message-preparation.d.ts +8 -0
- package/dist/tools/campaign-message-preparation.js +13 -6
- package/dist/tools/campaign-refill-state.d.ts +25 -0
- package/dist/tools/campaign-refill-state.js +32 -0
- package/dist/tools/campaigns.js +1 -1
- package/dist/tools/prompts.d.ts +3 -3
- package/dist/tools/prompts.js +2 -1
- package/dist/tools/refill-campaign-sends.d.ts +92 -0
- package/dist/tools/refill-campaign-sends.js +91 -0
- package/dist/tools/registry.d.ts +115 -2
- package/dist/tools/registry.js +6 -0
- package/dist/tools/tables.d.ts +4 -0
- package/dist/tools/tables.js +1 -1
- package/package.json +1 -1
- package/skills/create-campaign/SKILL.md +39 -22
- package/skills/create-campaign-v2/core/flow.v2.json +1 -1
- package/skills/create-campaign-v2/references/sample-validation-loop.md +16 -0
- package/skills/create-evergreen-campaigns/SKILL.md +94 -14
- package/skills/fill-send-horizon/SKILL.md +21 -60
- package/skills/refill-sends/SKILL.md +54 -0
- package/skills/refill-sends-workflow/SKILL.md +172 -0
- package/skills/research/config.json +9 -0
package/README.md
CHANGED
|
@@ -96,8 +96,17 @@ startup/auth update check and tells the agent to run
|
|
|
96
96
|
`curl -fsSL "https://app.sellable.dev/api/v2/cli/install" | sh` when the
|
|
97
97
|
installed runtime is behind npm.
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
First-run login is the normal auth path. Install Sellable, launch a workflow in
|
|
100
|
+
Claude Code or Codex, and let the agent complete the browser magic-link login.
|
|
101
|
+
If the browser login page shows a manual fallback, paste:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
sellable auth set <token> --workspace-id <workspace_id>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For CI/env-only scripted installs, operators can set `SELLABLE_TOKEN` and
|
|
108
|
+
`SELLABLE_WORKSPACE_ID` before running the curl installer. The public path
|
|
109
|
+
remains:
|
|
101
110
|
|
|
102
111
|
```bash
|
|
103
112
|
curl -fsSL "https://app.sellable.dev/api/v2/cli/install" | sh
|
|
@@ -117,11 +126,17 @@ and publishes with a temporary npm config file. Prefer `NPM_TOKEN=<npm token>` i
|
|
|
117
126
|
`prod.env`; `NODE_AUTH_TOKEN`, `SELLABLE_NPM_TOKEN`, and `NPM_PUBLISH_TOKEN` are
|
|
118
127
|
also supported.
|
|
119
128
|
|
|
120
|
-
### 2.
|
|
129
|
+
### 2. First-Run Login
|
|
121
130
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
Launch a Sellable workflow after install. The agent will start first-run login,
|
|
132
|
+
send the magic link, wait for browser confirmation, and write canonical auth to
|
|
133
|
+
`~/.sellable/config.json`.
|
|
134
|
+
|
|
135
|
+
If the browser confirmation page shows a scripted fallback, paste:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
sellable auth set <token> --workspace-id <workspace_id>
|
|
139
|
+
```
|
|
125
140
|
|
|
126
141
|
### 3. Claude Setup Fallback
|
|
127
142
|
|
|
@@ -135,17 +150,9 @@ Install MCP server manually:
|
|
|
135
150
|
claude mcp add --transport stdio sellable -- npm exec --yes --package @sellable/mcp@latest -- sellable-mcp
|
|
136
151
|
```
|
|
137
152
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
{
|
|
142
|
-
"token": "skt_live_your_token_here",
|
|
143
|
-
"activeWorkspaceId": "your_workspace_id"
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The token is provided when you generate it. Use `list_workspaces` +
|
|
148
|
-
`set_active_workspace` to choose a workspace if you don't know the ID yet.
|
|
153
|
+
Do not hand-edit auth JSON for normal setup. Use first-run login or the
|
|
154
|
+
`sellable auth set <token> --workspace-id <workspace_id>` fallback so the
|
|
155
|
+
canonical config shape stays consistent.
|
|
149
156
|
|
|
150
157
|
### 4. Codex Setup
|
|
151
158
|
|
|
@@ -524,13 +531,21 @@ generation is not part of these inbox tools.
|
|
|
524
531
|
|
|
525
532
|
### "Sellable not configured" Error
|
|
526
533
|
|
|
527
|
-
|
|
534
|
+
Run a Sellable workflow to start first-run login. If the browser login page
|
|
535
|
+
shows a manual fallback, paste:
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
sellable auth set <token> --workspace-id <workspace_id>
|
|
539
|
+
```
|
|
528
540
|
|
|
529
541
|
### Token Not Working
|
|
530
542
|
|
|
531
543
|
1. Make sure token starts with `skt_`
|
|
532
544
|
2. Check token is not revoked
|
|
533
|
-
3.
|
|
545
|
+
3. If the token came from an older Settings flow and returns 403 on campaign or
|
|
546
|
+
enrichment writes, regenerate through first-run login or the scripted
|
|
547
|
+
fallback command above
|
|
548
|
+
4. Verify activeWorkspaceId matches your workspace (or run list_workspaces + set_active_workspace)
|
|
534
549
|
|
|
535
550
|
## Support
|
|
536
551
|
|
package/dist/api.js
CHANGED
|
@@ -19,9 +19,11 @@ export class SellableApi {
|
|
|
19
19
|
const missingWorkspace = status === 400 && errorText.includes("Workspace");
|
|
20
20
|
const guidance = isAuthError
|
|
21
21
|
? "Sellable authentication failed.\n\n" +
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
22
|
+
"Run the first-run Sellable login flow from a Sellable workflow, then retry.\n\n" +
|
|
23
|
+
"If the browser login page shows a manual fallback command, use:\n" +
|
|
24
|
+
"sellable auth set <token> --workspace-id <workspace_id>\n\n" +
|
|
25
|
+
`Current config path: ${getConfigPath()}\n\n` +
|
|
26
|
+
"Older copied Settings tokens can be stale, restricted, or missing write/credit permissions. Sign in again so Sellable mints the current agent token."
|
|
25
27
|
: missingWorkspace
|
|
26
28
|
? "No active workspace selected.\n\n" +
|
|
27
29
|
"Run list_workspaces then set_active_workspace to choose a workspace."
|
package/dist/auth.js
CHANGED
|
@@ -48,6 +48,16 @@ export function getConfigPath() {
|
|
|
48
48
|
}
|
|
49
49
|
return candidates[0];
|
|
50
50
|
}
|
|
51
|
+
function getConfigWritePath() {
|
|
52
|
+
const explicitConfigPath = process.env.SELLABLE_CONFIG_PATH?.trim();
|
|
53
|
+
if (explicitConfigPath) {
|
|
54
|
+
return path.resolve(explicitConfigPath);
|
|
55
|
+
}
|
|
56
|
+
if (configFileName === "sellable.json") {
|
|
57
|
+
return path.join(os.homedir(), ".sellable", "config.json");
|
|
58
|
+
}
|
|
59
|
+
return getConfigPath();
|
|
60
|
+
}
|
|
51
61
|
function normalizeConfig(raw) {
|
|
52
62
|
return {
|
|
53
63
|
...raw,
|
|
@@ -66,14 +76,12 @@ export function getConfig() {
|
|
|
66
76
|
const configPath = getConfigPath();
|
|
67
77
|
if (!fs.existsSync(configPath)) {
|
|
68
78
|
throw new Error("Sellable not configured.\n\n" +
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
"Run a Sellable workflow to start first-run login, for example /sellable:create-campaign in Claude Code or $sellable:create-campaign in Codex.\n\n" +
|
|
80
|
+
"If the browser login page shows a manual fallback command, paste it in your terminal:\n" +
|
|
81
|
+
"sellable auth set <token> --workspace-id <workspace_id>\n\n" +
|
|
82
|
+
`Preferred config path: ${getConfigWritePath()}\n\n` +
|
|
73
83
|
"Config path resolution order:\n" +
|
|
74
|
-
`${renderConfigPathOrder(configPathCandidates)}
|
|
75
|
-
"Get your token at: https://app.sellable.dev/settings?tab=integrations\n" +
|
|
76
|
-
"Then run list_workspaces + set_active_workspace to select a workspace.");
|
|
84
|
+
`${renderConfigPathOrder(configPathCandidates)}`);
|
|
77
85
|
}
|
|
78
86
|
try {
|
|
79
87
|
const content = fs.readFileSync(configPath, "utf-8");
|
|
@@ -118,7 +126,8 @@ export function updateActiveWorkspace(params) {
|
|
|
118
126
|
fs.mkdirSync(configDir, { recursive: true });
|
|
119
127
|
}
|
|
120
128
|
if (!fs.existsSync(configPath)) {
|
|
121
|
-
throw new Error(
|
|
129
|
+
throw new Error("Sellable not configured. Run a Sellable workflow to start first-run login, " +
|
|
130
|
+
"or paste the browser fallback command: sellable auth set <token> --workspace-id <workspace_id>.");
|
|
122
131
|
}
|
|
123
132
|
const content = fs.readFileSync(configPath, "utf-8");
|
|
124
133
|
let raw;
|
|
@@ -158,7 +167,8 @@ export function updateActiveWorkspace(params) {
|
|
|
158
167
|
function readRawConfigFile() {
|
|
159
168
|
const configPath = getConfigPath();
|
|
160
169
|
if (!fs.existsSync(configPath)) {
|
|
161
|
-
throw new Error(
|
|
170
|
+
throw new Error("Sellable not configured. Run a Sellable workflow to start first-run login, " +
|
|
171
|
+
"or paste the browser fallback command: sellable auth set <token> --workspace-id <workspace_id>.");
|
|
162
172
|
}
|
|
163
173
|
const content = fs.readFileSync(configPath, "utf-8");
|
|
164
174
|
try {
|
|
@@ -197,15 +207,36 @@ function writeRawConfigFile(configPath, raw) {
|
|
|
197
207
|
* new config without an MCP server restart.
|
|
198
208
|
*/
|
|
199
209
|
export function writeNewConfig(opts) {
|
|
200
|
-
const configPath =
|
|
201
|
-
|
|
210
|
+
const configPath = getConfigWritePath();
|
|
211
|
+
let raw = {};
|
|
212
|
+
if (fs.existsSync(configPath)) {
|
|
213
|
+
const content = fs.readFileSync(configPath, "utf-8");
|
|
214
|
+
try {
|
|
215
|
+
raw = JSON.parse(content);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
if (error instanceof SyntaxError) {
|
|
219
|
+
throw new Error(`Invalid JSON in ${configPath}: ${error.message}`);
|
|
220
|
+
}
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const authFields = {
|
|
202
225
|
token: opts.token,
|
|
203
226
|
activeWorkspaceId: opts.activeWorkspaceId,
|
|
204
227
|
apiUrl: opts.apiUrl,
|
|
205
228
|
};
|
|
206
|
-
if (opts.activeWorkspaceName)
|
|
207
|
-
|
|
229
|
+
if (opts.activeWorkspaceName)
|
|
230
|
+
authFields.activeWorkspaceName = opts.activeWorkspaceName;
|
|
231
|
+
const { envConfig, set } = getActiveEnvConfigRef(raw);
|
|
232
|
+
const nextEnvConfig = {
|
|
233
|
+
...envConfig,
|
|
234
|
+
...authFields,
|
|
235
|
+
};
|
|
236
|
+
if (!opts.activeWorkspaceName) {
|
|
237
|
+
delete nextEnvConfig.activeWorkspaceName;
|
|
208
238
|
}
|
|
239
|
+
set(nextEnvConfig);
|
|
209
240
|
writeRawConfigFile(configPath, raw);
|
|
210
241
|
return { configPath };
|
|
211
242
|
}
|
package/dist/server.js
CHANGED
|
@@ -6,7 +6,10 @@ import { getAuthStatus } from "./tools/auth.js";
|
|
|
6
6
|
import { handleAddColumn, handleCommitBlueprint, } from "./tools/blueprint-commit.js";
|
|
7
7
|
import { bootstrapCreateCampaign } from "./tools/bootstrap.js";
|
|
8
8
|
import { prepareCampaignAbTest } from "./tools/campaign-ab-test.js";
|
|
9
|
+
import { resolveCampaignFillRoute } from "./tools/campaign-fill-routing.js";
|
|
10
|
+
import { fillCampaignHorizon } from "./tools/campaign-horizon-fill.js";
|
|
9
11
|
import { cancelPrepareCampaignMessages, getPrepareCampaignMessagesStatus, startPrepareCampaignMessages, } from "./tools/campaign-message-preparation.js";
|
|
12
|
+
import { getCampaignRefillState } from "./tools/campaign-refill-state.js";
|
|
10
13
|
import { getCampaignTableSchema, queueCampaignCells, recordCampaignReviewBatch, reviseMessageTemplateAndRerun, selectCampaignCells, waitForCampaignProcessing, } from "./tools/campaign-processing.js";
|
|
11
14
|
import { createCampaign, duplicateCampaign, getCampaign, getCampaignMessagesPreview, getCampaigns, pauseCampaign, startCampaign, updateCampaign, updateCampaignBrief, } from "./tools/campaigns.js";
|
|
12
15
|
import { queueCells, updateCell } from "./tools/cells.js";
|
|
@@ -178,6 +181,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
178
181
|
case "get_campaign_messages_preview":
|
|
179
182
|
result = await getCampaignMessagesPreview(args);
|
|
180
183
|
break;
|
|
184
|
+
case "resolve_campaign_fill_route":
|
|
185
|
+
result = await resolveCampaignFillRoute(args);
|
|
186
|
+
break;
|
|
187
|
+
case "get_campaign_refill_state":
|
|
188
|
+
result = await getCampaignRefillState(args);
|
|
189
|
+
break;
|
|
190
|
+
case "fill_campaign_horizon":
|
|
191
|
+
result = await fillCampaignHorizon(args);
|
|
192
|
+
if (args?.campaignId) {
|
|
193
|
+
markCampaignContextDirty(args.campaignId, "fill_campaign_horizon");
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
181
196
|
case "start_campaign_message_preparation":
|
|
182
197
|
case "start_prepare_campaign_messages":
|
|
183
198
|
result = await startPrepareCampaignMessages(args);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type CampaignFillIntent = "plain" | "evergreen" | "active";
|
|
2
|
+
type ResolveCampaignFillRouteInput = {
|
|
3
|
+
intent: CampaignFillIntent;
|
|
4
|
+
campaignId?: string;
|
|
5
|
+
tableId?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const campaignFillRoutingToolDefinitions: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
intent: {
|
|
15
|
+
type: string;
|
|
16
|
+
enum: string[];
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
campaignId: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
tableId: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
limit: {
|
|
28
|
+
type: string;
|
|
29
|
+
minimum: number;
|
|
30
|
+
maximum: number;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
required: string[];
|
|
35
|
+
additionalProperties: boolean;
|
|
36
|
+
};
|
|
37
|
+
}[];
|
|
38
|
+
export declare function resolveCampaignFillRoute(input: ResolveCampaignFillRouteInput): Promise<unknown>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getApi } from "../api.js";
|
|
2
|
+
async function postCampaignFillRoute(body) {
|
|
3
|
+
const api = getApi();
|
|
4
|
+
return api.post("/api/v3/mcp/campaign-fill-routing", body);
|
|
5
|
+
}
|
|
6
|
+
export const campaignFillRoutingToolDefinitions = [
|
|
7
|
+
{
|
|
8
|
+
name: "resolve_campaign_fill_route",
|
|
9
|
+
description: 'Audit-only resolver to call before interpreting plain "fill campaigns", "load everyone up", or similar fill requests. It decides whether the workspace has evergreen/horizon targets, currently active campaign-backed sequence targets, or no targets so the agent must ask what to create. It does not create, append, prepare, approve, schedule, launch, archive, delete, send, or call lower-level fill tools. Only call fill_campaign_horizon when this resolver returns route "evergreen_horizon" or the user explicitly requested evergreen/horizon and the returned target is eligible. Exact target narrowing uses campaignId or tableId only; never fuzzy campaign names.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
intent: {
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: ["plain", "evergreen", "active"],
|
|
16
|
+
description: 'Use "plain" for generic fill/load requests, "evergreen" for explicit evergreen/horizon fill, and "active" for explicit active campaign fill.',
|
|
17
|
+
},
|
|
18
|
+
campaignId: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Optional exact CampaignOffer.id to narrow routing. Do not pass campaign names.",
|
|
21
|
+
},
|
|
22
|
+
tableId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Optional exact WorkflowTable.id to narrow routing. Do not pass table names.",
|
|
25
|
+
},
|
|
26
|
+
limit: {
|
|
27
|
+
type: "number",
|
|
28
|
+
minimum: 1,
|
|
29
|
+
maximum: 100,
|
|
30
|
+
description: "Maximum returned targets/skippedTargets.",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["intent"],
|
|
34
|
+
additionalProperties: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
export function resolveCampaignFillRoute(input) {
|
|
39
|
+
return postCampaignFillRoute({
|
|
40
|
+
intent: input.intent,
|
|
41
|
+
campaignId: input.campaignId,
|
|
42
|
+
tableId: input.tableId,
|
|
43
|
+
limit: input.limit,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
type FillCampaignHorizonInput = {
|
|
2
|
+
action: "audit" | "apply";
|
|
3
|
+
campaignId: string;
|
|
4
|
+
tableId?: string;
|
|
5
|
+
stateRevision?: string;
|
|
6
|
+
excludedPostIds?: string[];
|
|
7
|
+
excludedPostUrls?: string[];
|
|
8
|
+
excludedAuthorProfileUrls?: string[];
|
|
9
|
+
excludedAuthorNames?: string[];
|
|
10
|
+
targetPreparedMessages?: number;
|
|
11
|
+
maxRowsToCheck?: number;
|
|
12
|
+
batchSize?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const campaignHorizonFillToolDefinitions: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: string;
|
|
19
|
+
properties: {
|
|
20
|
+
action: {
|
|
21
|
+
type: string;
|
|
22
|
+
enum: string[];
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
campaignId: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
tableId: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
stateRevision: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
excludedPostIds: {
|
|
38
|
+
type: string;
|
|
39
|
+
items: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
maxItems: number;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
excludedPostUrls: {
|
|
46
|
+
type: string;
|
|
47
|
+
items: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
maxItems: number;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
excludedAuthorProfileUrls: {
|
|
54
|
+
type: string;
|
|
55
|
+
items: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
maxItems: number;
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
excludedAuthorNames: {
|
|
62
|
+
type: string;
|
|
63
|
+
items: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
maxItems: number;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
targetPreparedMessages: {
|
|
70
|
+
type: string;
|
|
71
|
+
minimum: number;
|
|
72
|
+
maximum: number;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
maxRowsToCheck: {
|
|
76
|
+
type: string;
|
|
77
|
+
minimum: number;
|
|
78
|
+
maximum: number;
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
batchSize: {
|
|
82
|
+
type: string;
|
|
83
|
+
minimum: number;
|
|
84
|
+
maximum: number;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
required: string[];
|
|
89
|
+
additionalProperties: boolean;
|
|
90
|
+
};
|
|
91
|
+
}[];
|
|
92
|
+
export declare function fillCampaignHorizon(input: FillCampaignHorizonInput): Promise<unknown>;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getApi } from "../api.js";
|
|
2
|
+
async function postHorizonFill(body) {
|
|
3
|
+
const api = getApi();
|
|
4
|
+
return api.post("/api/v3/mcp/campaign-horizon-fill", body);
|
|
5
|
+
}
|
|
6
|
+
export const campaignHorizonFillToolDefinitions = [
|
|
7
|
+
{
|
|
8
|
+
name: "fill_campaign_horizon",
|
|
9
|
+
description: "Evergreen/horizon-only tool: audit or apply a bounded CampaignOffer horizon fill from Signal Discovery/source lead-list rows only when resolve_campaign_fill_route returns route evergreen_horizon or the user explicitly requested evergreen/horizon and the target is managed-waterfall eligible. Use audit first to get stateRevision, then apply with that stateRevision. Apply imports at most 300 eligible non-excluded source rows, starts bounded message preparation in approval mode, skips rows from excluded posts/authors, and does not start or launch the campaign, send messages, or directly assign scheduler-owned send timestamps. Prepared/approved rows are intermediate only; report scheduled completion only after re-reading scheduler-owned scheduled cells with non-null scheduler timestamps.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
action: {
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: ["audit", "apply"],
|
|
16
|
+
description: 'Use "audit" to inspect counts/receipt without writes. Use "apply" with the audit stateRevision to import/prep.',
|
|
17
|
+
},
|
|
18
|
+
campaignId: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "CampaignOffer.id for the campaign to fill.",
|
|
21
|
+
},
|
|
22
|
+
tableId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Optional workflow table id. Must match the campaign workflowTableId when provided.",
|
|
25
|
+
},
|
|
26
|
+
stateRevision: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Required for apply. Copy from the immediately preceding audit receipt.",
|
|
29
|
+
},
|
|
30
|
+
excludedPostIds: {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: { type: "string" },
|
|
33
|
+
maxItems: 100,
|
|
34
|
+
description: "Exact SignalSearchPost ids to exclude from import/preparation.",
|
|
35
|
+
},
|
|
36
|
+
excludedPostUrls: {
|
|
37
|
+
type: "array",
|
|
38
|
+
items: { type: "string" },
|
|
39
|
+
maxItems: 100,
|
|
40
|
+
description: "Exact LinkedIn post URLs to exclude from import/preparation.",
|
|
41
|
+
},
|
|
42
|
+
excludedAuthorProfileUrls: {
|
|
43
|
+
type: "array",
|
|
44
|
+
items: { type: "string" },
|
|
45
|
+
maxItems: 100,
|
|
46
|
+
description: "Exact LinkedIn author profile URLs whose source rows should be excluded.",
|
|
47
|
+
},
|
|
48
|
+
excludedAuthorNames: {
|
|
49
|
+
type: "array",
|
|
50
|
+
items: { type: "string" },
|
|
51
|
+
maxItems: 25,
|
|
52
|
+
description: "Exact author names to exclude only when they resolve unambiguously inside campaign Signal Discovery posts.",
|
|
53
|
+
},
|
|
54
|
+
targetPreparedMessages: {
|
|
55
|
+
type: "number",
|
|
56
|
+
minimum: 1,
|
|
57
|
+
maximum: 300,
|
|
58
|
+
description: "Prepared/approved message target for the first pass. Backend caps this at 300.",
|
|
59
|
+
},
|
|
60
|
+
maxRowsToCheck: {
|
|
61
|
+
type: "number",
|
|
62
|
+
minimum: 1,
|
|
63
|
+
maximum: 300,
|
|
64
|
+
description: "Hard first-pass row cap. Backend caps import and prep at 300 rows.",
|
|
65
|
+
},
|
|
66
|
+
batchSize: {
|
|
67
|
+
type: "number",
|
|
68
|
+
minimum: 1,
|
|
69
|
+
maximum: 100,
|
|
70
|
+
description: "Preparation batch size. Backend caps newly checked rows at 100 per batch.",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
required: ["action", "campaignId"],
|
|
74
|
+
additionalProperties: false,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
export function fillCampaignHorizon(input) {
|
|
79
|
+
return postHorizonFill({
|
|
80
|
+
action: input.action,
|
|
81
|
+
campaignId: input.campaignId,
|
|
82
|
+
tableId: input.tableId,
|
|
83
|
+
stateRevision: input.stateRevision,
|
|
84
|
+
excludedPostIds: input.excludedPostIds,
|
|
85
|
+
excludedPostUrls: input.excludedPostUrls,
|
|
86
|
+
excludedAuthorProfileUrls: input.excludedAuthorProfileUrls,
|
|
87
|
+
excludedAuthorNames: input.excludedAuthorNames,
|
|
88
|
+
targetPreparedMessages: input.targetPreparedMessages,
|
|
89
|
+
maxRowsToCheck: input.maxRowsToCheck,
|
|
90
|
+
batchSize: input.batchSize,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
@@ -9,6 +9,7 @@ type StartPrepareMessagesInput = PrepareMessagesBaseInput & {
|
|
|
9
9
|
targetPreparedMessages?: number;
|
|
10
10
|
maxRowsToCheck?: number;
|
|
11
11
|
batchSize?: number;
|
|
12
|
+
maxBatchRows?: number;
|
|
12
13
|
approvalMode?: ApprovalMode;
|
|
13
14
|
autoContinue?: boolean;
|
|
14
15
|
disableLowPassRateStop?: boolean;
|
|
@@ -45,6 +46,12 @@ export declare const campaignMessagePreparationToolDefinitions: ({
|
|
|
45
46
|
maximum: number;
|
|
46
47
|
description: string;
|
|
47
48
|
};
|
|
49
|
+
maxBatchRows: {
|
|
50
|
+
type: string;
|
|
51
|
+
minimum: number;
|
|
52
|
+
maximum: number;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
48
55
|
approvalMode: {
|
|
49
56
|
type: string;
|
|
50
57
|
enum: string[];
|
|
@@ -81,6 +88,7 @@ export declare const campaignMessagePreparationToolDefinitions: ({
|
|
|
81
88
|
targetPreparedMessages?: undefined;
|
|
82
89
|
maxRowsToCheck?: undefined;
|
|
83
90
|
batchSize?: undefined;
|
|
91
|
+
maxBatchRows?: undefined;
|
|
84
92
|
approvalMode?: undefined;
|
|
85
93
|
autoContinue?: undefined;
|
|
86
94
|
disableLowPassRateStop?: undefined;
|
|
@@ -6,7 +6,7 @@ async function postPrepareMessages(body) {
|
|
|
6
6
|
export const campaignMessagePreparationToolDefinitions = [
|
|
7
7
|
{
|
|
8
8
|
name: "start_campaign_message_preparation",
|
|
9
|
-
description: 'Start a bounded
|
|
9
|
+
description: 'Start a bounded message-preparation job for a specific existing CampaignOffer campaignId/tableId. This is the active_campaigns existing-row path after resolve_campaign_fill_route, exact target re-read, and active prep-job check; it is not campaign creation and not evergreen horizon fill. It never launches the campaign, sends messages, or directly writes scheduledFor. The job queues pending Enrich Prospect cells first, lets ICP/rubric and Generate Message cascade, then marks ready or approves only the bounded cohort. Prepared/approved/ready rows are intermediate only; scheduled completion requires a later re-read proving scheduler-owned scheduled cells with non-null scheduledFor. Surface active preparation jobs, exhausted source rows, disconnected Sales Nav/deleted sender accounts, missing sequence state, and other sender-health blockers separately from prepared/approved/scheduled counts. Omit maxRowsToCheck and batchSize for the adaptive default: calibrate on at least 100 actually-enriched rows, estimate the row budget from observed rubric/pass yield, cap rows at 300, and process at most 100 newly checked rows at a time. The worker will not pull another row batch while the current checked batch still has queueable or active cells. Do not interpret checkedRows as enriched rows; use progress.enrichedRows, needsEnrichRows, activeCellCount, preparedMessages, approvedMessages, and stopReason.',
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: "object",
|
|
12
12
|
properties: {
|
|
@@ -19,19 +19,25 @@ export const campaignMessagePreparationToolDefinitions = [
|
|
|
19
19
|
maxRowsToCheck: {
|
|
20
20
|
type: "number",
|
|
21
21
|
minimum: 1,
|
|
22
|
-
maximum:
|
|
23
|
-
description: "Optional override capped by the backend at
|
|
22
|
+
maximum: 300,
|
|
23
|
+
description: "Optional override capped by the backend at 300. Omit this for adaptive sample-based row budgeting.",
|
|
24
24
|
},
|
|
25
25
|
batchSize: {
|
|
26
26
|
type: "number",
|
|
27
27
|
minimum: 1,
|
|
28
|
-
maximum:
|
|
29
|
-
description: "Optional first-batch override capped by the backend at
|
|
28
|
+
maximum: 100,
|
|
29
|
+
description: "Optional first-batch override capped by the backend at 100. Omit this to sample 100 rows.",
|
|
30
|
+
},
|
|
31
|
+
maxBatchRows: {
|
|
32
|
+
type: "number",
|
|
33
|
+
minimum: 1,
|
|
34
|
+
maximum: 100,
|
|
35
|
+
description: "Optional max rows to add in any single preparation batch. Capped by the backend at 100.",
|
|
30
36
|
},
|
|
31
37
|
approvalMode: {
|
|
32
38
|
type: "string",
|
|
33
39
|
enum: ["mark_ready", "approve"],
|
|
34
|
-
description: "Defaults to mark_ready. Use approve only when the user explicitly asks to flip Approved cells.",
|
|
40
|
+
description: "Defaults to mark_ready. Use approve only when the user explicitly asks to flip Approved cells. Approval is not scheduling; it only makes the bounded cohort eligible for downstream scheduler ownership.",
|
|
35
41
|
},
|
|
36
42
|
autoContinue: { type: "boolean" },
|
|
37
43
|
disableLowPassRateStop: {
|
|
@@ -78,6 +84,7 @@ export function startPrepareCampaignMessages(input) {
|
|
|
78
84
|
targetPreparedMessages: input.targetPreparedMessages,
|
|
79
85
|
maxRowsToCheck: input.maxRowsToCheck,
|
|
80
86
|
batchSize: input.batchSize,
|
|
87
|
+
maxBatchRows: input.maxBatchRows,
|
|
81
88
|
approvalMode: input.approvalMode,
|
|
82
89
|
autoContinue: input.autoContinue,
|
|
83
90
|
disableLowPassRateStop: input.disableLowPassRateStop,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type GetCampaignRefillStateInput = {
|
|
2
|
+
campaignId?: string;
|
|
3
|
+
tableId?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const campaignRefillStateToolDefinitions: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: string;
|
|
10
|
+
properties: {
|
|
11
|
+
campaignId: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
tableId: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
required: never[];
|
|
21
|
+
additionalProperties: boolean;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
export declare function getCampaignRefillState(input: GetCampaignRefillStateInput): Promise<unknown>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getApi } from "../api.js";
|
|
2
|
+
async function postCampaignRefillState(body) {
|
|
3
|
+
const api = getApi();
|
|
4
|
+
return api.post("/api/v3/mcp/campaign-refill-state", body);
|
|
5
|
+
}
|
|
6
|
+
export const campaignRefillStateToolDefinitions = [
|
|
7
|
+
{
|
|
8
|
+
name: "get_campaign_refill_state",
|
|
9
|
+
description: "read-only refill research primitive to call after resolve_campaign_fill_route and before any source import, message preparation, approval, scheduling, or horizon fill decision. It returns current campaign/table/source/sender/funnel/scheduler diagnostics plus freshness state for one exact campaignId or tableId only. This tool does not create rows, does not import leads, does not prepare messages, does not approve messages, does not schedule sends, does not launch campaigns, and does not expose direct campaign types as refillable targets. Exact targeting uses campaignId or tableId only; never pass campaign names or table names.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
campaignId: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Optional exact CampaignOffer.id from resolve_campaign_fill_route. Do not pass campaign names.",
|
|
16
|
+
},
|
|
17
|
+
tableId: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Optional exact WorkflowTable.id from resolve_campaign_fill_route. Do not pass table names.",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
required: [],
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
export function getCampaignRefillState(input) {
|
|
28
|
+
return postCampaignRefillState({
|
|
29
|
+
campaignId: input.campaignId,
|
|
30
|
+
tableId: input.tableId,
|
|
31
|
+
});
|
|
32
|
+
}
|
package/dist/tools/campaigns.js
CHANGED
|
@@ -441,7 +441,7 @@ export const campaignToolDefinitions = [
|
|
|
441
441
|
},
|
|
442
442
|
{
|
|
443
443
|
name: "start_campaign",
|
|
444
|
-
description: "Start a paused campaign, enabling the sweeper to send messages.",
|
|
444
|
+
description: "Start a paused campaign, enabling the sweeper to send messages. This is an explicit human launch/start action and must not be used as part of fill-send-horizon, message preparation, or scheduling-proof flows.",
|
|
445
445
|
inputSchema: {
|
|
446
446
|
type: "object",
|
|
447
447
|
properties: {
|