@sellable/mcp 0.1.501 → 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.
- package/dist/api.d.ts +5 -5
- package/dist/api.js +10 -10
- package/dist/index-dev.js +0 -0
- package/dist/index.js +0 -0
- package/dist/server.js +2 -2
- package/dist/tools/campaign-fill-routing.d.ts +5 -0
- package/dist/tools/campaign-fill-routing.js +13 -3
- package/dist/tools/campaign-message-preparation.d.ts +7 -13
- package/dist/tools/campaign-message-preparation.js +21 -24
- package/dist/tools/campaign-processing.d.ts +19 -0
- package/dist/tools/campaign-processing.js +31 -8
- package/dist/tools/campaign-refill-state.d.ts +5 -0
- package/dist/tools/campaign-refill-state.js +13 -3
- package/dist/tools/leads.d.ts +6 -47
- package/dist/tools/leads.js +26 -30
- package/dist/tools/prompts.js +1 -1
- package/dist/tools/readiness.d.ts +6 -0
- package/dist/tools/readiness.js +12 -5
- package/dist/tools/refill-sends.d.ts +34 -32
- package/dist/tools/refill-sends.js +67 -586
- package/dist/tools/refill-target-plan.d.ts +5 -0
- package/dist/tools/refill-target-plan.js +24 -50
- package/dist/tools/registry.d.ts +205 -47
- package/dist/tools/scheduler-fill-capacity.d.ts +5 -0
- package/dist/tools/scheduler-fill-capacity.js +13 -3
- package/dist/tools/sender-routing.d.ts +8 -1
- package/dist/tools/sender-routing.js +12 -3
- package/dist/tools/senders.d.ts +14 -1
- package/dist/tools/senders.js +31 -5
- package/dist/tools/workspace-context.d.ts +36 -0
- package/dist/tools/workspace-context.js +39 -0
- package/package.json +1 -1
- package/skills/refill-sends/SKILL.md +49 -28
- package/skills/refill-sends-workflow/SKILL.md +15 -10
package/dist/api.d.ts
CHANGED
|
@@ -23,12 +23,12 @@ export declare class SellableApi {
|
|
|
23
23
|
private requestResponse;
|
|
24
24
|
private request;
|
|
25
25
|
get<T>(path: string, options?: ApiRequestOptions): Promise<T>;
|
|
26
|
-
getText(path: string): Promise<string>;
|
|
27
|
-
downloadToFile(requestPath: string, destinationPath: string): Promise<DownloadToFileResult>;
|
|
26
|
+
getText(path: string, options?: ApiRequestOptions): Promise<string>;
|
|
27
|
+
downloadToFile(requestPath: string, destinationPath: string, options?: ApiRequestOptions): Promise<DownloadToFileResult>;
|
|
28
28
|
post<T>(path: string, body?: object, options?: ApiRequestOptions): Promise<T>;
|
|
29
|
-
put<T>(path: string, body?: object): Promise<T>;
|
|
30
|
-
patch<T>(path: string, body?: object): Promise<T>;
|
|
31
|
-
delete<T>(path: string): Promise<T>;
|
|
29
|
+
put<T>(path: string, body?: object, options?: ApiRequestOptions): Promise<T>;
|
|
30
|
+
patch<T>(path: string, body?: object, options?: ApiRequestOptions): Promise<T>;
|
|
31
|
+
delete<T>(path: string, options?: ApiRequestOptions): Promise<T>;
|
|
32
32
|
}
|
|
33
33
|
export declare function getApi(): SellableApi;
|
|
34
34
|
export declare function resetApi(): void;
|
package/dist/api.js
CHANGED
|
@@ -64,12 +64,12 @@ export class SellableApi {
|
|
|
64
64
|
async get(path, options) {
|
|
65
65
|
return this.request("GET", path, undefined, options);
|
|
66
66
|
}
|
|
67
|
-
async getText(path) {
|
|
68
|
-
const response = await this.requestResponse("GET", path);
|
|
67
|
+
async getText(path, options) {
|
|
68
|
+
const response = await this.requestResponse("GET", path, undefined, options);
|
|
69
69
|
return response.text();
|
|
70
70
|
}
|
|
71
|
-
async downloadToFile(requestPath, destinationPath) {
|
|
72
|
-
const response = await this.requestResponse("GET", requestPath);
|
|
71
|
+
async downloadToFile(requestPath, destinationPath, options) {
|
|
72
|
+
const response = await this.requestResponse("GET", requestPath, undefined, options);
|
|
73
73
|
if (!response.body) {
|
|
74
74
|
throw new SellableApiError(response.status, "Response body was empty for file download");
|
|
75
75
|
}
|
|
@@ -98,14 +98,14 @@ export class SellableApi {
|
|
|
98
98
|
async post(path, body, options) {
|
|
99
99
|
return this.request("POST", path, body, options);
|
|
100
100
|
}
|
|
101
|
-
async put(path, body) {
|
|
102
|
-
return this.request("PUT", path, body);
|
|
101
|
+
async put(path, body, options) {
|
|
102
|
+
return this.request("PUT", path, body, options);
|
|
103
103
|
}
|
|
104
|
-
async patch(path, body) {
|
|
105
|
-
return this.request("PATCH", path, body);
|
|
104
|
+
async patch(path, body, options) {
|
|
105
|
+
return this.request("PATCH", path, body, options);
|
|
106
106
|
}
|
|
107
|
-
async delete(path) {
|
|
108
|
-
return this.request("DELETE", path);
|
|
107
|
+
async delete(path, options) {
|
|
108
|
+
return this.request("DELETE", path, undefined, options);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
let apiInstance = null;
|
package/dist/index-dev.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/server.js
CHANGED
|
@@ -511,7 +511,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
511
511
|
result = await getEngagedPosts(args);
|
|
512
512
|
break;
|
|
513
513
|
case "get_sender_routing":
|
|
514
|
-
result = await getSenderRoutingTool();
|
|
514
|
+
result = await getSenderRoutingTool(args);
|
|
515
515
|
break;
|
|
516
516
|
case "set_sender_routing":
|
|
517
517
|
result = await setSenderRoutingTool(args);
|
|
@@ -523,7 +523,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
523
523
|
result = await setCompanyInfoTool(args);
|
|
524
524
|
break;
|
|
525
525
|
case "list_senders":
|
|
526
|
-
result = await listSenders();
|
|
526
|
+
result = await listSenders(args);
|
|
527
527
|
break;
|
|
528
528
|
case "get_sender":
|
|
529
529
|
result = await getSender(args);
|
|
@@ -4,6 +4,7 @@ type ResolveCampaignFillRouteInput = {
|
|
|
4
4
|
campaignId?: string;
|
|
5
5
|
tableId?: string;
|
|
6
6
|
limit?: number;
|
|
7
|
+
workspaceId?: string;
|
|
7
8
|
};
|
|
8
9
|
export declare const campaignFillRoutingToolDefinitions: {
|
|
9
10
|
name: string;
|
|
@@ -30,6 +31,10 @@ export declare const campaignFillRoutingToolDefinitions: {
|
|
|
30
31
|
maximum: number;
|
|
31
32
|
description: string;
|
|
32
33
|
};
|
|
34
|
+
workspaceId: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
33
38
|
};
|
|
34
39
|
required: string[];
|
|
35
40
|
additionalProperties: boolean;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { getApi } from "../api.js";
|
|
2
|
-
|
|
2
|
+
import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
|
|
3
|
+
async function postCampaignFillRoute(body, workspaceId) {
|
|
3
4
|
const api = getApi();
|
|
4
|
-
|
|
5
|
+
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
6
|
+
return requestOptions
|
|
7
|
+
? api.post("/api/v3/mcp/campaign-fill-routing", body, requestOptions)
|
|
8
|
+
: api.post("/api/v3/mcp/campaign-fill-routing", body);
|
|
5
9
|
}
|
|
6
10
|
export const campaignFillRoutingToolDefinitions = [
|
|
7
11
|
{
|
|
@@ -29,6 +33,10 @@ export const campaignFillRoutingToolDefinitions = [
|
|
|
29
33
|
maximum: 100,
|
|
30
34
|
description: "Maximum returned targets/skippedTargets.",
|
|
31
35
|
},
|
|
36
|
+
workspaceId: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Explicit request-scoped workspace id for scheduled/yolo refill automation. Pass this instead of switching the shared active workspace.",
|
|
39
|
+
},
|
|
32
40
|
},
|
|
33
41
|
required: ["intent"],
|
|
34
42
|
additionalProperties: false,
|
|
@@ -36,10 +44,12 @@ export const campaignFillRoutingToolDefinitions = [
|
|
|
36
44
|
},
|
|
37
45
|
];
|
|
38
46
|
export function resolveCampaignFillRoute(input) {
|
|
47
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
39
48
|
return postCampaignFillRoute({
|
|
40
49
|
intent: input.intent,
|
|
41
50
|
campaignId: input.campaignId,
|
|
42
51
|
tableId: input.tableId,
|
|
43
52
|
limit: input.limit,
|
|
44
|
-
|
|
53
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
54
|
+
}, workspaceId ?? undefined);
|
|
45
55
|
}
|
|
@@ -3,6 +3,7 @@ type PrepareMessagesBaseInput = {
|
|
|
3
3
|
campaignId?: string;
|
|
4
4
|
tableId?: string;
|
|
5
5
|
jobId?: string;
|
|
6
|
+
workspaceId?: string;
|
|
6
7
|
};
|
|
7
8
|
type StartPrepareMessagesInput = PrepareMessagesBaseInput & {
|
|
8
9
|
campaignId: string;
|
|
@@ -13,10 +14,6 @@ type StartPrepareMessagesInput = PrepareMessagesBaseInput & {
|
|
|
13
14
|
approvalMode?: ApprovalMode;
|
|
14
15
|
autoContinue?: boolean;
|
|
15
16
|
disableLowPassRateStop?: boolean;
|
|
16
|
-
requestHash?: string;
|
|
17
|
-
requestSource?: string;
|
|
18
|
-
senderId?: string;
|
|
19
|
-
actionType?: string;
|
|
20
17
|
};
|
|
21
18
|
type StatusPrepareMessagesInput = PrepareMessagesBaseInput;
|
|
22
19
|
type CancelPrepareMessagesInput = PrepareMessagesBaseInput;
|
|
@@ -64,16 +61,11 @@ export declare const campaignMessagePreparationToolDefinitions: ({
|
|
|
64
61
|
autoContinue: {
|
|
65
62
|
type: string;
|
|
66
63
|
};
|
|
67
|
-
|
|
64
|
+
disableLowPassRateStop: {
|
|
68
65
|
type: string;
|
|
69
66
|
description: string;
|
|
70
67
|
};
|
|
71
|
-
|
|
72
|
-
type: string;
|
|
73
|
-
enum: string[];
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
disableLowPassRateStop: {
|
|
68
|
+
workspaceId: {
|
|
77
69
|
type: string;
|
|
78
70
|
description: string;
|
|
79
71
|
};
|
|
@@ -98,14 +90,16 @@ export declare const campaignMessagePreparationToolDefinitions: ({
|
|
|
98
90
|
tableId: {
|
|
99
91
|
type: string;
|
|
100
92
|
};
|
|
93
|
+
workspaceId: {
|
|
94
|
+
type: string;
|
|
95
|
+
description?: undefined;
|
|
96
|
+
};
|
|
101
97
|
targetPreparedMessages?: undefined;
|
|
102
98
|
maxRowsToCheck?: undefined;
|
|
103
99
|
batchSize?: undefined;
|
|
104
100
|
maxBatchRows?: undefined;
|
|
105
101
|
approvalMode?: undefined;
|
|
106
102
|
autoContinue?: undefined;
|
|
107
|
-
senderId?: undefined;
|
|
108
|
-
actionType?: undefined;
|
|
109
103
|
disableLowPassRateStop?: undefined;
|
|
110
104
|
};
|
|
111
105
|
additionalProperties: boolean;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { getApi } from "../api.js";
|
|
2
|
-
|
|
2
|
+
import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
|
|
3
|
+
async function postPrepareMessages(body, workspaceId) {
|
|
3
4
|
const api = getApi();
|
|
4
|
-
|
|
5
|
+
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
6
|
+
return requestOptions
|
|
7
|
+
? api.post("/api/v3/mcp/campaign-message-preparation", body, requestOptions)
|
|
8
|
+
: api.post("/api/v3/mcp/campaign-message-preparation", body);
|
|
5
9
|
}
|
|
6
10
|
export const campaignMessagePreparationToolDefinitions = [
|
|
7
11
|
{
|
|
@@ -40,25 +44,14 @@ export const campaignMessagePreparationToolDefinitions = [
|
|
|
40
44
|
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.",
|
|
41
45
|
},
|
|
42
46
|
autoContinue: { type: "boolean" },
|
|
43
|
-
senderId: {
|
|
44
|
-
type: "string",
|
|
45
|
-
description: "Optional refill-scope sender id. Used with actionType by refill_sends so preparation skips rows already attempted by other send actions.",
|
|
46
|
-
},
|
|
47
|
-
actionType: {
|
|
48
|
-
type: "string",
|
|
49
|
-
enum: [
|
|
50
|
-
"send_invite",
|
|
51
|
-
"send_dm",
|
|
52
|
-
"send_inmail_open",
|
|
53
|
-
"send_inmail_closed",
|
|
54
|
-
"react_and_comment",
|
|
55
|
-
],
|
|
56
|
-
description: "Optional refill-scope send action. InMail scopes treat open and paid InMail as one contact-reuse family.",
|
|
57
|
-
},
|
|
58
47
|
disableLowPassRateStop: {
|
|
59
48
|
type: "boolean",
|
|
60
49
|
description: "Operator override for explicit fill/exhaust requests. When true, keep processing eligible rows even if the enriched sample pass rate is low. Still bounded by targetPreparedMessages and maxRowsToCheck.",
|
|
61
50
|
},
|
|
51
|
+
workspaceId: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Explicit request-scoped workspace id for scheduled/yolo refill automation.",
|
|
54
|
+
},
|
|
62
55
|
},
|
|
63
56
|
required: ["campaignId"],
|
|
64
57
|
additionalProperties: false,
|
|
@@ -73,6 +66,7 @@ export const campaignMessagePreparationToolDefinitions = [
|
|
|
73
66
|
jobId: { type: "string" },
|
|
74
67
|
campaignId: { type: "string" },
|
|
75
68
|
tableId: { type: "string" },
|
|
69
|
+
workspaceId: { type: "string" },
|
|
76
70
|
},
|
|
77
71
|
additionalProperties: false,
|
|
78
72
|
},
|
|
@@ -86,12 +80,14 @@ export const campaignMessagePreparationToolDefinitions = [
|
|
|
86
80
|
jobId: { type: "string" },
|
|
87
81
|
campaignId: { type: "string" },
|
|
88
82
|
tableId: { type: "string" },
|
|
83
|
+
workspaceId: { type: "string" },
|
|
89
84
|
},
|
|
90
85
|
additionalProperties: false,
|
|
91
86
|
},
|
|
92
87
|
},
|
|
93
88
|
];
|
|
94
89
|
export function startPrepareCampaignMessages(input) {
|
|
90
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
95
91
|
return postPrepareMessages({
|
|
96
92
|
action: "start",
|
|
97
93
|
campaignId: input.campaignId,
|
|
@@ -103,25 +99,26 @@ export function startPrepareCampaignMessages(input) {
|
|
|
103
99
|
approvalMode: input.approvalMode,
|
|
104
100
|
autoContinue: input.autoContinue,
|
|
105
101
|
disableLowPassRateStop: input.disableLowPassRateStop,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
senderId: input.senderId,
|
|
109
|
-
actionType: input.actionType,
|
|
110
|
-
});
|
|
102
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
103
|
+
}, workspaceId ?? undefined);
|
|
111
104
|
}
|
|
112
105
|
export function getPrepareCampaignMessagesStatus(input) {
|
|
106
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
113
107
|
return postPrepareMessages({
|
|
114
108
|
action: "status",
|
|
115
109
|
jobId: input.jobId,
|
|
116
110
|
campaignId: input.campaignId,
|
|
117
111
|
tableId: input.tableId,
|
|
118
|
-
|
|
112
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
113
|
+
}, workspaceId ?? undefined);
|
|
119
114
|
}
|
|
120
115
|
export function cancelPrepareCampaignMessages(input) {
|
|
116
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
121
117
|
return postPrepareMessages({
|
|
122
118
|
action: "cancel",
|
|
123
119
|
jobId: input.jobId,
|
|
124
120
|
campaignId: input.campaignId,
|
|
125
121
|
tableId: input.tableId,
|
|
126
|
-
|
|
122
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
123
|
+
}, workspaceId ?? undefined);
|
|
127
124
|
}
|
|
@@ -24,6 +24,7 @@ type RowSelector = {
|
|
|
24
24
|
type SchemaInput = {
|
|
25
25
|
campaignId?: string;
|
|
26
26
|
tableId?: string;
|
|
27
|
+
workspaceId?: string;
|
|
27
28
|
};
|
|
28
29
|
type SelectInput = SchemaInput & {
|
|
29
30
|
columnRole: ColumnRole;
|
|
@@ -100,6 +101,9 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
100
101
|
tableId: {
|
|
101
102
|
type: string;
|
|
102
103
|
};
|
|
104
|
+
workspaceId: {
|
|
105
|
+
type: string;
|
|
106
|
+
};
|
|
103
107
|
columnRole?: undefined;
|
|
104
108
|
rowSelector?: undefined;
|
|
105
109
|
limit?: undefined;
|
|
@@ -130,6 +134,9 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
130
134
|
tableId: {
|
|
131
135
|
type: string;
|
|
132
136
|
};
|
|
137
|
+
workspaceId: {
|
|
138
|
+
type: string;
|
|
139
|
+
};
|
|
133
140
|
columnRole: {
|
|
134
141
|
type: string;
|
|
135
142
|
enum: string[];
|
|
@@ -187,6 +194,9 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
187
194
|
tableId: {
|
|
188
195
|
type: string;
|
|
189
196
|
};
|
|
197
|
+
workspaceId: {
|
|
198
|
+
type: string;
|
|
199
|
+
};
|
|
190
200
|
columnRole: {
|
|
191
201
|
type: string;
|
|
192
202
|
enum: string[];
|
|
@@ -248,6 +258,9 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
248
258
|
tableId: {
|
|
249
259
|
type: string;
|
|
250
260
|
};
|
|
261
|
+
workspaceId: {
|
|
262
|
+
type: string;
|
|
263
|
+
};
|
|
251
264
|
minPassedCount: {
|
|
252
265
|
type: string;
|
|
253
266
|
};
|
|
@@ -286,6 +299,9 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
286
299
|
tableId: {
|
|
287
300
|
type: string;
|
|
288
301
|
};
|
|
302
|
+
workspaceId: {
|
|
303
|
+
type: string;
|
|
304
|
+
};
|
|
289
305
|
rowIds: {
|
|
290
306
|
type: string;
|
|
291
307
|
items: {
|
|
@@ -327,6 +343,9 @@ export declare const campaignProcessingToolDefinitions: ({
|
|
|
327
343
|
tableId: {
|
|
328
344
|
type: string;
|
|
329
345
|
};
|
|
346
|
+
workspaceId: {
|
|
347
|
+
type: string;
|
|
348
|
+
};
|
|
330
349
|
templateMarkdown: {
|
|
331
350
|
type: string;
|
|
332
351
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getApi } from "../api.js";
|
|
2
2
|
import { resolveWaitTimeout } from "./readiness.js";
|
|
3
|
+
import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
|
|
3
4
|
const DEFAULT_TIMEOUT_MS = 90000;
|
|
4
5
|
const DEFAULT_INTERVAL_MS = 2000;
|
|
5
6
|
function sleep(ms) {
|
|
@@ -14,16 +15,21 @@ function stableHash(value) {
|
|
|
14
15
|
}
|
|
15
16
|
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
16
17
|
}
|
|
17
|
-
async function postCampaignProcessing(body) {
|
|
18
|
+
async function postCampaignProcessing(body, workspaceId) {
|
|
18
19
|
const api = getApi();
|
|
19
|
-
|
|
20
|
+
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
21
|
+
return requestOptions
|
|
22
|
+
? api.post("/api/v3/mcp/campaign-processing", body, requestOptions)
|
|
23
|
+
: api.post("/api/v3/mcp/campaign-processing", body);
|
|
20
24
|
}
|
|
21
25
|
async function resolveSchema(input) {
|
|
26
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
22
27
|
return postCampaignProcessing({
|
|
23
28
|
action: "schema",
|
|
24
29
|
campaignId: input.campaignId,
|
|
25
30
|
tableId: input.tableId,
|
|
26
|
-
|
|
31
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
32
|
+
}, workspaceId ?? undefined);
|
|
27
33
|
}
|
|
28
34
|
export const campaignProcessingToolDefinitions = [
|
|
29
35
|
{
|
|
@@ -34,6 +40,7 @@ export const campaignProcessingToolDefinitions = [
|
|
|
34
40
|
properties: {
|
|
35
41
|
campaignId: { type: "string" },
|
|
36
42
|
tableId: { type: "string" },
|
|
43
|
+
workspaceId: { type: "string" },
|
|
37
44
|
},
|
|
38
45
|
additionalProperties: false,
|
|
39
46
|
},
|
|
@@ -46,6 +53,7 @@ export const campaignProcessingToolDefinitions = [
|
|
|
46
53
|
properties: {
|
|
47
54
|
campaignId: { type: "string" },
|
|
48
55
|
tableId: { type: "string" },
|
|
56
|
+
workspaceId: { type: "string" },
|
|
49
57
|
columnRole: {
|
|
50
58
|
type: "string",
|
|
51
59
|
enum: [
|
|
@@ -92,6 +100,7 @@ export const campaignProcessingToolDefinitions = [
|
|
|
92
100
|
properties: {
|
|
93
101
|
campaignId: { type: "string" },
|
|
94
102
|
tableId: { type: "string" },
|
|
103
|
+
workspaceId: { type: "string" },
|
|
95
104
|
columnRole: {
|
|
96
105
|
type: "string",
|
|
97
106
|
enum: ["enrich", "generateMessage", "approved"],
|
|
@@ -134,6 +143,7 @@ export const campaignProcessingToolDefinitions = [
|
|
|
134
143
|
properties: {
|
|
135
144
|
campaignId: { type: "string" },
|
|
136
145
|
tableId: { type: "string" },
|
|
146
|
+
workspaceId: { type: "string" },
|
|
137
147
|
minPassedCount: { type: "number" },
|
|
138
148
|
minGeneratedMessages: { type: "number" },
|
|
139
149
|
templateRevision: {
|
|
@@ -153,6 +163,7 @@ export const campaignProcessingToolDefinitions = [
|
|
|
153
163
|
type: "object",
|
|
154
164
|
properties: {
|
|
155
165
|
tableId: { type: "string" },
|
|
166
|
+
workspaceId: { type: "string" },
|
|
156
167
|
rowIds: { type: "array", items: { type: "string" } },
|
|
157
168
|
enrichCellIds: { type: "array", items: { type: "string" } },
|
|
158
169
|
},
|
|
@@ -168,6 +179,7 @@ export const campaignProcessingToolDefinitions = [
|
|
|
168
179
|
properties: {
|
|
169
180
|
campaignId: { type: "string" },
|
|
170
181
|
tableId: { type: "string" },
|
|
182
|
+
workspaceId: { type: "string" },
|
|
171
183
|
templateMarkdown: { type: "string" },
|
|
172
184
|
approvedMessageTemplate: { type: "string" },
|
|
173
185
|
rowSelector: {
|
|
@@ -199,28 +211,36 @@ export async function getCampaignTableSchema(input) {
|
|
|
199
211
|
return resolveSchema(input);
|
|
200
212
|
}
|
|
201
213
|
export async function selectCampaignCells(input) {
|
|
214
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
202
215
|
return postCampaignProcessing({
|
|
203
216
|
action: "select",
|
|
204
217
|
...input,
|
|
205
|
-
|
|
218
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
219
|
+
}, workspaceId ?? undefined);
|
|
206
220
|
}
|
|
207
221
|
export async function queueCampaignCells(input) {
|
|
222
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
208
223
|
return postCampaignProcessing({
|
|
209
224
|
action: "queue",
|
|
210
225
|
...input,
|
|
211
|
-
|
|
226
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
227
|
+
}, workspaceId ?? undefined);
|
|
212
228
|
}
|
|
213
229
|
export async function recordCampaignReviewBatch(input) {
|
|
230
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
214
231
|
return postCampaignProcessing({
|
|
215
232
|
action: "recordReviewBatch",
|
|
216
233
|
...input,
|
|
217
|
-
|
|
234
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
235
|
+
}, workspaceId ?? undefined);
|
|
218
236
|
}
|
|
219
237
|
export async function reviseMessageTemplateAndRerun(input) {
|
|
238
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
220
239
|
const result = await postCampaignProcessing({
|
|
221
240
|
action: "reviseTemplateAndRerun",
|
|
222
241
|
...input,
|
|
223
|
-
|
|
242
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
243
|
+
}, workspaceId ?? undefined);
|
|
224
244
|
const approvalsReset = typeof result.approvalsReset === "number" ? result.approvalsReset : 0;
|
|
225
245
|
if (approvalsReset <= 0)
|
|
226
246
|
return result;
|
|
@@ -328,6 +348,7 @@ function buildProcessingTimeoutRecovery({ input, schema, stats, minPassedCount,
|
|
|
328
348
|
}
|
|
329
349
|
export async function waitForCampaignProcessing(input) {
|
|
330
350
|
const api = getApi();
|
|
351
|
+
const requestOptions = workspaceRequestOptions(input.workspaceId);
|
|
331
352
|
const schema = await resolveSchema(input);
|
|
332
353
|
const { effectiveTimeoutMs, guardApplied, requestedTimeoutMs } = resolveWaitTimeout(input.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
333
354
|
const intervalMs = Math.max(500, input.intervalMs ?? DEFAULT_INTERVAL_MS);
|
|
@@ -352,7 +373,9 @@ export async function waitForCampaignProcessing(input) {
|
|
|
352
373
|
let lastStats = null;
|
|
353
374
|
while (Date.now() - start <= effectiveTimeoutMs) {
|
|
354
375
|
attempts += 1;
|
|
355
|
-
const stats =
|
|
376
|
+
const stats = requestOptions
|
|
377
|
+
? await api.get(`/api/v3/workflow-tables/${schema.tableId}/stats`, requestOptions)
|
|
378
|
+
: await api.get(`/api/v3/workflow-tables/${schema.tableId}/stats`);
|
|
356
379
|
lastStats = stats;
|
|
357
380
|
const currentRevisionHash = stats.currentTemplateRevisionHash ?? null;
|
|
358
381
|
if (templateRevision &&
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type GetCampaignRefillStateInput = {
|
|
2
2
|
campaignId?: string;
|
|
3
3
|
tableId?: string;
|
|
4
|
+
workspaceId?: string;
|
|
4
5
|
};
|
|
5
6
|
export declare const campaignRefillStateToolDefinitions: {
|
|
6
7
|
name: string;
|
|
@@ -16,6 +17,10 @@ export declare const campaignRefillStateToolDefinitions: {
|
|
|
16
17
|
type: string;
|
|
17
18
|
description: string;
|
|
18
19
|
};
|
|
20
|
+
workspaceId: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
19
24
|
};
|
|
20
25
|
required: never[];
|
|
21
26
|
additionalProperties: boolean;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { getApi } from "../api.js";
|
|
2
|
-
|
|
2
|
+
import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
|
|
3
|
+
async function postCampaignRefillState(body, workspaceId) {
|
|
3
4
|
const api = getApi();
|
|
4
|
-
|
|
5
|
+
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
6
|
+
return requestOptions
|
|
7
|
+
? api.post("/api/v3/mcp/campaign-refill-state", body, requestOptions)
|
|
8
|
+
: api.post("/api/v3/mcp/campaign-refill-state", body);
|
|
5
9
|
}
|
|
6
10
|
export const campaignRefillStateToolDefinitions = [
|
|
7
11
|
{
|
|
@@ -18,6 +22,10 @@ export const campaignRefillStateToolDefinitions = [
|
|
|
18
22
|
type: "string",
|
|
19
23
|
description: "Optional exact WorkflowTable.id from resolve_campaign_fill_route. Do not pass table names.",
|
|
20
24
|
},
|
|
25
|
+
workspaceId: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Explicit request-scoped workspace id for scheduled/yolo refill automation. Pass this instead of switching the shared active workspace.",
|
|
28
|
+
},
|
|
21
29
|
},
|
|
22
30
|
required: [],
|
|
23
31
|
additionalProperties: false,
|
|
@@ -25,8 +33,10 @@ export const campaignRefillStateToolDefinitions = [
|
|
|
25
33
|
},
|
|
26
34
|
];
|
|
27
35
|
export function getCampaignRefillState(input) {
|
|
36
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
28
37
|
return postCampaignRefillState({
|
|
29
38
|
campaignId: input.campaignId,
|
|
30
39
|
tableId: input.tableId,
|
|
31
|
-
|
|
40
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
41
|
+
}, workspaceId ?? undefined);
|
|
32
42
|
}
|