@sellable/mcp 0.1.504 → 0.1.505

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 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/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
- async function postCampaignFillRoute(body) {
2
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
3
+ async function postCampaignFillRoute(body, workspaceId) {
3
4
  const api = getApi();
4
- return api.post("/api/v3/mcp/campaign-fill-routing", body);
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
  }
@@ -19,6 +19,7 @@ type PrepareMessagesBaseInput = {
19
19
  campaignId?: string;
20
20
  tableId?: string;
21
21
  jobId?: string;
22
+ workspaceId?: string;
22
23
  };
23
24
  type StartPrepareMessagesInput = PrepareMessagesBaseInput & {
24
25
  campaignId: string;
@@ -111,6 +112,10 @@ export declare const campaignMessagePreparationToolDefinitions: ({
111
112
  type: string;
112
113
  description: string;
113
114
  };
115
+ workspaceId: {
116
+ type: string;
117
+ description: string;
118
+ };
114
119
  jobId?: undefined;
115
120
  };
116
121
  required: string[];
@@ -132,6 +137,10 @@ export declare const campaignMessagePreparationToolDefinitions: ({
132
137
  tableId: {
133
138
  type: string;
134
139
  };
140
+ workspaceId: {
141
+ type: string;
142
+ description?: undefined;
143
+ };
135
144
  targetPreparedMessages?: undefined;
136
145
  maxRowsToCheck?: undefined;
137
146
  batchSize?: undefined;
@@ -1,7 +1,11 @@
1
1
  import { getApi } from "../api.js";
2
- async function postPrepareMessages(body) {
2
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
3
+ async function postPrepareMessages(body, workspaceId) {
3
4
  const api = getApi();
4
- return api.post("/api/v3/mcp/campaign-message-preparation", body);
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
  {
@@ -78,6 +82,10 @@ export const campaignMessagePreparationToolDefinitions = [
78
82
  type: "boolean",
79
83
  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.",
80
84
  },
85
+ workspaceId: {
86
+ type: "string",
87
+ description: "Explicit request-scoped workspace id for scheduled/yolo refill automation.",
88
+ },
81
89
  },
82
90
  required: ["campaignId"],
83
91
  additionalProperties: false,
@@ -92,6 +100,7 @@ export const campaignMessagePreparationToolDefinitions = [
92
100
  jobId: { type: "string" },
93
101
  campaignId: { type: "string" },
94
102
  tableId: { type: "string" },
103
+ workspaceId: { type: "string" },
95
104
  },
96
105
  additionalProperties: false,
97
106
  },
@@ -105,12 +114,14 @@ export const campaignMessagePreparationToolDefinitions = [
105
114
  jobId: { type: "string" },
106
115
  campaignId: { type: "string" },
107
116
  tableId: { type: "string" },
117
+ workspaceId: { type: "string" },
108
118
  },
109
119
  additionalProperties: false,
110
120
  },
111
121
  },
112
122
  ];
113
123
  export function startPrepareCampaignMessages(input) {
124
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
114
125
  return postPrepareMessages({
115
126
  action: "start",
116
127
  campaignId: input.campaignId,
@@ -127,21 +138,26 @@ export function startPrepareCampaignMessages(input) {
127
138
  requestSource: input.requestSource,
128
139
  senderId: input.senderId,
129
140
  actionType: input.actionType,
130
- });
141
+ ...(workspaceId ? { workspaceId } : {}),
142
+ }, workspaceId ?? undefined);
131
143
  }
132
144
  export function getPrepareCampaignMessagesStatus(input) {
145
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
133
146
  return postPrepareMessages({
134
147
  action: "status",
135
148
  jobId: input.jobId,
136
149
  campaignId: input.campaignId,
137
150
  tableId: input.tableId,
138
- });
151
+ ...(workspaceId ? { workspaceId } : {}),
152
+ }, workspaceId ?? undefined);
139
153
  }
140
154
  export function cancelPrepareCampaignMessages(input) {
155
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
141
156
  return postPrepareMessages({
142
157
  action: "cancel",
143
158
  jobId: input.jobId,
144
159
  campaignId: input.campaignId,
145
160
  tableId: input.tableId,
146
- });
161
+ ...(workspaceId ? { workspaceId } : {}),
162
+ }, workspaceId ?? undefined);
147
163
  }
@@ -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
- return api.post("/api/v3/mcp/campaign-processing", body);
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 = await api.get(`/api/v3/workflow-tables/${schema.tableId}/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
- async function postCampaignRefillState(body) {
2
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
3
+ async function postCampaignRefillState(body, workspaceId) {
3
4
  const api = getApi();
4
- return api.post("/api/v3/mcp/campaign-refill-state", body);
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
  }
@@ -148,6 +148,7 @@ export type SignalSearchInput = {
148
148
  };
149
149
  export type ImportLeadsInput = {
150
150
  campaignOfferId: string;
151
+ workspaceId?: string;
151
152
  currentStep?: string | null;
152
153
  confirmed?: boolean;
153
154
  provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
@@ -170,6 +171,7 @@ export type CancelLeadImportInput = {
170
171
  };
171
172
  export type ConfirmLeadListInput = {
172
173
  campaignOfferId: string;
174
+ workspaceId?: string;
173
175
  currentStep?: string | null;
174
176
  confirmed?: boolean;
175
177
  sourceLeadListId?: string;
@@ -4562,6 +4564,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4562
4564
  args: {
4563
4565
  sourceLeadListId: string;
4564
4566
  campaignOfferId: string;
4567
+ workspaceId?: string;
4565
4568
  currentStep?: string | null;
4566
4569
  confirmed?: boolean;
4567
4570
  provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
@@ -4614,6 +4617,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4614
4617
  sourceLeadListId: string;
4615
4618
  mode: string;
4616
4619
  campaignOfferId: string;
4620
+ workspaceId?: string;
4617
4621
  currentStep?: string | null;
4618
4622
  confirmed?: boolean;
4619
4623
  provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
@@ -4707,6 +4711,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4707
4711
  provider: string;
4708
4712
  confirmed: boolean;
4709
4713
  allowInvalidSignalPosts: boolean;
4714
+ workspaceId?: string;
4710
4715
  currentStep?: string | null;
4711
4716
  sourceLeadListId?: string;
4712
4717
  searchId?: string;
@@ -4781,6 +4786,7 @@ export declare function importLeads(input: ImportLeadsInput): Promise<{
4781
4786
  sourceLeadListId: string;
4782
4787
  mode: string;
4783
4788
  campaignOfferId: string;
4789
+ workspaceId?: string;
4784
4790
  currentStep?: string | null;
4785
4791
  confirmed?: boolean;
4786
4792
  provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery";
@@ -10,6 +10,7 @@ import { assertInteractionApproval } from "./interaction-mode.js";
10
10
  import { assertProviderPromptLoaded, markProviderPromptLoaded, } from "./provider-preflight.js";
11
11
  import { waitForLeadListReady } from "./readiness.js";
12
12
  import { getTableRowsMinimal } from "./rows.js";
13
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
13
14
  const entryPath = process.argv[1] ? resolve(process.argv[1]) : process.cwd();
14
15
  const entryDir = dirname(entryPath);
15
16
  const workspaceRoot = resolveWorkspaceRoot(entryDir);
@@ -4136,6 +4137,8 @@ export async function cancelLeadImport(input) {
4136
4137
  }
4137
4138
  export async function confirmLeadList(input) {
4138
4139
  const api = getApi();
4140
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
4141
+ const requestOptions = workspaceRequestOptions(workspaceId);
4139
4142
  const { campaignOfferId, currentStep, confirmed, sourceLeadListId, campaignName, keepInSync, jobId, reviewBatchLimit, includeRawImportResult, allowPartialSourceList, targetLeadCount, sourceRowIds, sourceRowLimit, } = input;
4140
4143
  assertInteractionApproval({
4141
4144
  campaignId: campaignOfferId,
@@ -4145,7 +4148,9 @@ export async function confirmLeadList(input) {
4145
4148
  let resolvedLeadListId = sourceLeadListId;
4146
4149
  let resolvedProvider;
4147
4150
  if (!resolvedLeadListId || currentStep === undefined || !resolvedProvider) {
4148
- const campaign = await api.get(`/api/v2/campaign-offers/${campaignOfferId}`);
4151
+ const campaign = requestOptions
4152
+ ? await api.get(`/api/v2/campaign-offers/${campaignOfferId}`, requestOptions)
4153
+ : await api.get(`/api/v2/campaign-offers/${campaignOfferId}`);
4149
4154
  if (!resolvedLeadListId) {
4150
4155
  resolvedLeadListId = campaign.selectedLeadListId ?? undefined;
4151
4156
  }
@@ -4193,7 +4198,9 @@ export async function confirmLeadList(input) {
4193
4198
  : "filter-choice";
4194
4199
  const shouldSetCurrentStep = typeof effectiveCurrentStep === "string" && effectiveCurrentStep.length > 0;
4195
4200
  let readiness;
4196
- const leadListMeta = await api.get(`/api/v3/workflow-tables/${resolvedLeadListId}?mode=meta`);
4201
+ const leadListMeta = requestOptions
4202
+ ? await api.get(`/api/v3/workflow-tables/${resolvedLeadListId}?mode=meta`, requestOptions)
4203
+ : await api.get(`/api/v3/workflow-tables/${resolvedLeadListId}?mode=meta`);
4197
4204
  const leadListConfig = leadListMeta.table?.config ?? null;
4198
4205
  const leadListRowCount = leadListMeta.rowCount ?? 0;
4199
4206
  const importProgress = leadListConfig?.importProgress ?? null;
@@ -4256,6 +4263,7 @@ export async function confirmLeadList(input) {
4256
4263
  readiness = await waitForLeadListReady({
4257
4264
  leadListId: resolvedLeadListId,
4258
4265
  campaignOfferId,
4266
+ workspaceId: workspaceId ?? undefined,
4259
4267
  provider: resolvedProvider,
4260
4268
  jobId,
4261
4269
  targetLeadCount: readinessTargetLeadCount,
@@ -4331,8 +4339,7 @@ export async function confirmLeadList(input) {
4331
4339
  }
4332
4340
  return "Campaign or source lead list could not be found. Re-open the correct campaign or reselect the source list before retrying confirm_lead_list.";
4333
4341
  };
4334
- const importResult = await api
4335
- .post(`/api/v3/campaign-builder/import-leads`, {
4342
+ const importBody = {
4336
4343
  sourceLeadListId: resolvedLeadListId,
4337
4344
  campaignOfferId,
4338
4345
  campaignName,
@@ -4340,8 +4347,11 @@ export async function confirmLeadList(input) {
4340
4347
  currentStep: null,
4341
4348
  sourceRowIds,
4342
4349
  sourceRowLimit,
4343
- })
4344
- .catch((error) => {
4350
+ ...(workspaceId ? { workspaceId } : {}),
4351
+ };
4352
+ const importResult = await (requestOptions
4353
+ ? api.post(`/api/v3/campaign-builder/import-leads`, importBody, requestOptions)
4354
+ : api.post(`/api/v3/campaign-builder/import-leads`, importBody)).catch((error) => {
4345
4355
  if (isTerminalAccessError(error)) {
4346
4356
  throw new Error(formatTerminalAccessError(error));
4347
4357
  }
@@ -8,6 +8,7 @@ type WaitForCampaignTableReadyInput = {
8
8
  type WaitForLeadListReadyInput = {
9
9
  leadListId?: string;
10
10
  campaignOfferId?: string;
11
+ workspaceId?: string;
11
12
  provider?: "apollo" | "sales-nav" | "prospeo" | "signal-discovery" | "csv-linkedin";
12
13
  jobId?: string;
13
14
  targetLeadCount?: number;
@@ -51,6 +52,7 @@ export declare const readinessToolDefinitions: ({
51
52
  };
52
53
  leadListId?: undefined;
53
54
  campaignOfferId?: undefined;
55
+ workspaceId?: undefined;
54
56
  provider?: undefined;
55
57
  jobId?: undefined;
56
58
  targetLeadCount?: undefined;
@@ -73,6 +75,10 @@ export declare const readinessToolDefinitions: ({
73
75
  type: string;
74
76
  description: string;
75
77
  };
78
+ workspaceId: {
79
+ type: string;
80
+ description: string;
81
+ };
76
82
  provider: {
77
83
  type: string;
78
84
  description: string;