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