@sellable/mcp 0.1.512 → 0.1.514

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/server.js CHANGED
@@ -9,12 +9,8 @@ import { prepareCampaignAbTest } from "./tools/campaign-ab-test.js";
9
9
  import { resolveCampaignFillRoute } from "./tools/campaign-fill-routing.js";
10
10
  import { fillCampaignHorizon } from "./tools/campaign-horizon-fill.js";
11
11
  import { cancelPrepareCampaignMessages, getPrepareCampaignMessagesStatus, startPrepareCampaignMessages, } from "./tools/campaign-message-preparation.js";
12
- import { getCampaignRefillState } from "./tools/campaign-refill-state.js";
13
- import { getEvergreenRefillPlan } from "./tools/evergreen-refill-plan.js";
14
- import { getRefillTargetPlan } from "./tools/refill-target-plan.js";
15
- import { refillSendsEvergreenCommand } from "./tools/refill-sends-evergreen.js";
16
- import { getSchedulerFillCapacity } from "./tools/scheduler-fill-capacity.js";
17
12
  import { getCampaignTableSchema, queueCampaignCells, recordCampaignReviewBatch, reviseMessageTemplateAndRerun, selectCampaignCells, waitForCampaignProcessing, } from "./tools/campaign-processing.js";
13
+ import { getCampaignRefillState } from "./tools/campaign-refill-state.js";
18
14
  import { archiveCampaign, createCampaign, duplicateCampaign, getCampaign, getCampaignMessagesPreview, getCampaigns, pauseCampaign, startCampaign, updateCampaign, updateCampaignBrief, } from "./tools/campaigns.js";
19
15
  import { queueCells, updateCell } from "./tools/cells.js";
20
16
  import { handleStartCliLogin, handleWaitForCliLogin, } from "./tools/cli-login.js";
@@ -31,6 +27,7 @@ import { searchEngagementPosts } from "./tools/engage-discovery.js";
31
27
  import { copySenderConfigTool, getEngageMemoryTool, migrateFlatConfigsTool, recordEngageProvenSearchTool, setEngageStyleGuideTool, upsertEngageTrackedPersonTool, } from "./tools/engage-memory.js";
32
28
  import { getEngageStateTool, setEngageStateTool, } from "./tools/engage-state.js";
33
29
  import { bulkEnrichWithProspeo, enrichWithProspeo, getProspeoCredits, } from "./tools/enrichment.js";
30
+ import { getRefillPlanV2 } from "./tools/evergreen-refill-plan.js";
34
31
  import { getCampaignFramework } from "./tools/framework.js";
35
32
  import { confirmHarvestJobCompanies, searchHarvestJobs, } from "./tools/harvest-jobs.js";
36
33
  import { checkInboxReplyEligibility, getInboxThread, searchInboxThreads, sendInboxDraft, sendInboxManualReply, updateInboxDraft, } from "./tools/inbox.js";
@@ -41,10 +38,13 @@ import { addOnDemandLeads, createOnDemandCampaign, createOnDemandTable, initOnDe
41
38
  import { upsertRubric } from "./tools/processing.js";
42
39
  import { completeSenderResearch, getPostFindLeadsScoutRegistry, getSourceScoutRegistry, getSubskillAsset, getSubskillPrompt, listSubskillPrompts, searchSubskillPrompts, } from "./tools/prompts.js";
43
40
  import { waitForCampaignTableReady, waitForLeadListReady, } from "./tools/readiness.js";
41
+ import { refillSendsV2Command } from "./tools/refill-sends-v2.js";
44
42
  import { executeRefillSendsCommand } from "./tools/refill-sends.js";
43
+ import { getRefillTargetPlan } from "./tools/refill-target-plan.js";
45
44
  import { allTools } from "./tools/registry.js";
46
45
  import { getRows, getTableRows, getTableRowsMinimal } from "./tools/rows.js";
47
46
  import { addRubricItem, checkRubric, deleteRubricItem, draftRubrics, saveRubrics, selectNecessaryRubrics, updateRubricItem, waitForRubricResults, } from "./tools/rubrics.js";
47
+ import { getSchedulerFillCapacity } from "./tools/scheduler-fill-capacity.js";
48
48
  import { getSenderRoutingTool, setSenderRoutingTool, } from "./tools/sender-routing.js";
49
49
  import { getSender, listSenders, refreshPaidInmailCredits, } from "./tools/senders.js";
50
50
  import { attachRecommendedSequence, attachSequence, createWorkflowTable, } from "./tools/sequencer.js";
@@ -225,8 +225,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
225
225
  case "get_campaign_refill_state":
226
226
  result = await getCampaignRefillState(args);
227
227
  break;
228
+ case "get_refill_plan_v2":
228
229
  case "get_evergreen_refill_plan":
229
- result = await getEvergreenRefillPlan(args);
230
+ result = await getRefillPlanV2(args);
230
231
  break;
231
232
  case "get_refill_target_plan":
232
233
  result = await getRefillTargetPlan(args);
@@ -237,8 +238,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
237
238
  case "refill_sends":
238
239
  result = await executeRefillSendsCommand(args);
239
240
  break;
241
+ case "refill_sends_v2":
240
242
  case "refill_sends_evergreen":
241
- result = refillSendsEvergreenCommand(args);
243
+ result = await refillSendsV2Command(args);
242
244
  break;
243
245
  case "setup_evergreen_campaigns":
244
246
  result = await setupEvergreenCampaigns(args);
@@ -47,7 +47,7 @@ export const campaignProcessingToolDefinitions = [
47
47
  },
48
48
  {
49
49
  name: "select_campaign_cells",
50
- description: "Dry-run semantic campaign-cell selection. Returns compact counts and a tiny sample, never bulky row data. For regular refill diagnostics, use rowSelector:{type:\"needsEnrichment\"} to find the earliest unenriched rows by table position, then rowSelector:{type:\"needsApproval\"} to inspect current generated messages that are not approved. needsGeneratedMessage only sees rows that already passed rubric and can skip earlier unenriched rows; use it for generated-message repair, not top-down refill.",
50
+ description: 'Dry-run semantic campaign-cell selection. Returns compact counts and a tiny sample, never bulky row data. For regular refill diagnostics, use rowSelector:{type:"needsEnrichment"} to find the earliest unenriched rows by table position, then rowSelector:{type:"needsApproval"} to inspect current generated messages that are not approved. needsGeneratedMessage only sees rows that already passed rubric and can skip earlier unenriched rows; use it for generated-message repair, not top-down refill.',
51
51
  inputSchema: {
52
52
  type: "object",
53
53
  properties: {
@@ -94,7 +94,7 @@ export const campaignProcessingToolDefinitions = [
94
94
  },
95
95
  {
96
96
  name: "queue_campaign_cells",
97
- description: "Resolve and queue campaign cells by semantic role and row selector. Normal create-campaign tail should use this instead of fetching rows only to discover cell IDs. For regular refill enrichment, queue columnRole:\"enrich\" with rowSelector:{type:\"needsEnrichment\"} or use start_campaign_message_preparation for the full top-down prep loop. For approval, rowSelector:{type:\"needsApproval\"} selects current generated rows missing Approved=true, but mutating Approved cells still requires explicit bounded approval. Do not use needsGeneratedMessage as a refill cursor because it only selects already-passed rows. Use forceRerun:true for message-template revisions.",
97
+ description: 'Resolve and queue campaign cells by semantic role and row selector. Normal create-campaign tail should use this instead of fetching rows only to discover cell IDs. For regular refill enrichment, queue columnRole:"enrich" with rowSelector:{type:"needsEnrichment"} or use start_campaign_message_preparation for the full top-down prep loop. For approval, rowSelector:{type:"needsApproval"} selects current generated rows missing Approved=true, but mutating Approved cells still requires explicit bounded approval. Do not use needsGeneratedMessage as a refill cursor because it only selects already-passed rows. Use forceRerun:true for message-template revisions.',
98
98
  inputSchema: {
99
99
  type: "object",
100
100
  properties: {
@@ -103,7 +103,7 @@ export const campaignProcessingToolDefinitions = [
103
103
  workspaceId: { type: "string" },
104
104
  columnRole: {
105
105
  type: "string",
106
- enum: ["enrich", "generateMessage", "approved"],
106
+ enum: ["enrich", "icpScore", "generateMessage", "approved"],
107
107
  },
108
108
  rowSelector: {
109
109
  type: "object",
@@ -1,12 +1,19 @@
1
- type GetEvergreenRefillPlanInput = {
1
+ type GetRefillPlanV2Input = {
2
2
  workspaceId?: string;
3
+ intent?: "auto" | "evergreen" | "plain" | "active";
3
4
  senderIds?: string[];
4
5
  runState?: Record<string, unknown>;
5
6
  journal?: boolean;
6
7
  journalNote?: string;
7
8
  };
8
9
  export declare function sanitizeEvergreenRefillPlanResult(value: unknown): Record<string, unknown>;
9
- export declare const evergreenRefillPlanToolDefinitions: {
10
+ export declare function buildRunStateFromLocalHints(workspaceId: string): {
11
+ version: number;
12
+ senderCursors: never[];
13
+ laneCooldowns: import("../refill-local-state.js").RefillLaneMemoryEntry[];
14
+ passRates: import("../refill-local-state.js").RefillPassRateObservation[];
15
+ };
16
+ export declare const refillPlanV2ToolDefinitions: {
10
17
  name: string;
11
18
  description: string;
12
19
  inputSchema: {
@@ -26,6 +33,11 @@ export declare const evergreenRefillPlanToolDefinitions: {
26
33
  type: string;
27
34
  description: string;
28
35
  };
36
+ intent: {
37
+ type: string;
38
+ enum: string[];
39
+ description: string;
40
+ };
29
41
  journal: {
30
42
  type: string;
31
43
  description: string;
@@ -39,11 +51,25 @@ export declare const evergreenRefillPlanToolDefinitions: {
39
51
  additionalProperties: boolean;
40
52
  };
41
53
  }[];
42
- export declare function getEvergreenRefillPlan(input: GetEvergreenRefillPlanInput): Promise<{
54
+ export declare function getRefillPlanV2(input: GetRefillPlanV2Input): Promise<{
55
+ readOnly: boolean;
56
+ blocker: string;
57
+ workspaceId: string;
58
+ guidance: string;
59
+ warnings: string[];
60
+ journalPath: string | null;
61
+ text: string;
62
+ workspaceResolution: string;
63
+ } | {
43
64
  warnings: any[];
44
65
  journalPath: string | null;
45
66
  text: string;
46
67
  workspaceId: string;
47
68
  workspaceResolution: string;
69
+ readOnly?: undefined;
70
+ blocker?: undefined;
71
+ guidance?: undefined;
48
72
  }>;
73
+ /** @deprecated Use getRefillPlanV2. */
74
+ export declare const getEvergreenRefillPlan: typeof getRefillPlanV2;
49
75
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as path from "node:path";
2
- import { getApi } from "../api.js";
2
+ import { getApi, SellableApiError } from "../api.js";
3
3
  import { appendIndexLine, appendJournalEvent, createRunJournal, renderBootstrapSection, renderPlanSection, renderTerminalSection, } from "../refill-journal.js";
4
4
  import { readRefillWorkspaceState } from "../refill-local-state.js";
5
5
  import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
@@ -36,7 +36,7 @@ export function sanitizeEvergreenRefillPlanResult(value) {
36
36
  }
37
37
  return sanitized;
38
38
  }
39
- function buildRunStateFromLocalHints(workspaceId) {
39
+ export function buildRunStateFromLocalHints(workspaceId) {
40
40
  const state = readRefillWorkspaceState(workspaceId);
41
41
  return {
42
42
  version: 1,
@@ -45,7 +45,7 @@ function buildRunStateFromLocalHints(workspaceId) {
45
45
  passRates: state?.passRates ?? [],
46
46
  };
47
47
  }
48
- async function postEvergreenRefillPlan(body, workspaceId) {
48
+ async function postRefillPlanV2(body, workspaceId) {
49
49
  const api = getApi();
50
50
  const requestOptions = workspaceRequestOptions(workspaceId);
51
51
  return requestOptions
@@ -75,7 +75,7 @@ function writeDryRunJournal(params) {
75
75
  ? params.result.bootstrap
76
76
  : {};
77
77
  appendJournalEvent(created.filePath, renderBootstrapSection({
78
- summary: "Evergreen refill dry-run bootstrap",
78
+ summary: "Refill v2 dry-run bootstrap across managed waterfall, dashboard evergreen, and active campaign lanes",
79
79
  senderSummary: JSON.stringify(bootstrap.senders ?? []),
80
80
  laneSummary: JSON.stringify(bootstrap.laneOrder ?? []),
81
81
  targetSummary: JSON.stringify(bootstrap.target ?? []),
@@ -113,14 +113,48 @@ function writeDryRunJournal(params) {
113
113
  fileName: path.basename(created.filePath),
114
114
  workspaceId: params.workspaceId,
115
115
  dryRun: true,
116
- summary: "evergreen refill dry-run",
116
+ summary: "refill v2 dry-run",
117
117
  });
118
118
  return created.filePath;
119
119
  }
120
- export const evergreenRefillPlanToolDefinitions = [
120
+ function writeWorkspaceAccessJournal(params) {
121
+ const created = createRunJournal({
122
+ workspaceId: params.workspaceId,
123
+ dryRun: true,
124
+ });
125
+ appendJournalEvent(created.filePath, renderBootstrapSection({
126
+ summary: "Refill v2 dry-run bootstrap stopped at workspace access",
127
+ senderSummary: "[]",
128
+ laneSummary: "[]",
129
+ targetSummary: `workspaceId=${params.workspaceId}`,
130
+ creditSummary: "[]",
131
+ }));
132
+ appendJournalEvent(created.filePath, renderPlanSection({
133
+ chosenSummary: "workspace_access blocker",
134
+ itinerarySummaries: ["No workspace campaign state read"],
135
+ fallbackSummary: "terminal:workspace_access",
136
+ }));
137
+ appendJournalEvent(created.filePath, renderTerminalSection({
138
+ summary: `blocker=workspace_access workspaceId=${params.workspaceId} ${params.guidance}`,
139
+ }));
140
+ appendIndexLine({
141
+ runId: created.runId,
142
+ fileName: path.basename(created.filePath),
143
+ workspaceId: params.workspaceId,
144
+ dryRun: true,
145
+ summary: "refill v2 dry-run workspace_access blocker",
146
+ });
147
+ return created.filePath;
148
+ }
149
+ function isWorkspaceAccessError(error) {
150
+ return (error instanceof SellableApiError &&
151
+ error.status === 403 &&
152
+ error.body.includes("No access to workspace"));
153
+ }
154
+ export const refillPlanV2ToolDefinitions = [
121
155
  {
122
- name: "get_evergreen_refill_plan",
123
- description: "Read-only evergreen refill dry-run planner. It performs no mutations, does not schedule, send, approve, prepare, or refresh credits, and writes a local dry-run journal file unless journal:false is passed.",
156
+ name: "get_refill_plan_v2",
157
+ description: "Read-only refill sends v2 dry-run planner across managed waterfall, dashboard evergreen, and active campaign lanes. It performs no mutations, does not schedule, send, approve, prepare, or refresh credits, and writes a local dry-run journal file unless journal:false is passed.",
124
158
  inputSchema: {
125
159
  type: "object",
126
160
  properties: {
@@ -136,6 +170,11 @@ export const evergreenRefillPlanToolDefinitions = [
136
170
  type: "object",
137
171
  description: "Optional synthetic v1 run state. When provided, replaces local lane-memory hints.",
138
172
  },
173
+ intent: {
174
+ type: "string",
175
+ enum: ["auto", "evergreen", "plain", "active"],
176
+ description: 'Planner intent. Defaults to "auto" for refill-sends-v2.',
177
+ },
139
178
  journal: {
140
179
  type: "boolean",
141
180
  description: "Set false to skip the local dry-run journal write.",
@@ -150,19 +189,55 @@ export const evergreenRefillPlanToolDefinitions = [
150
189
  },
151
190
  },
152
191
  ];
153
- export async function getEvergreenRefillPlan(input) {
192
+ export async function getRefillPlanV2(input) {
154
193
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
155
194
  if (!workspaceId) {
156
- throw new Error("workspaceId is required for get_evergreen_refill_plan.");
195
+ throw new Error("workspaceId is required for get_refill_plan_v2.");
157
196
  }
158
197
  const runState = input.runState !== undefined
159
198
  ? input.runState
160
199
  : buildRunStateFromLocalHints(workspaceId);
161
- const raw = await postEvergreenRefillPlan({
162
- workspaceId,
163
- senderIds: input.senderIds,
164
- runState,
165
- }, workspaceId);
200
+ let raw;
201
+ try {
202
+ raw = await postRefillPlanV2({
203
+ workspaceId,
204
+ intent: input.intent ?? "auto",
205
+ senderIds: input.senderIds,
206
+ runState,
207
+ }, workspaceId);
208
+ }
209
+ catch (error) {
210
+ if (!isWorkspaceAccessError(error))
211
+ throw error;
212
+ const guidance = error instanceof SellableApiError && error.guidance
213
+ ? error.guidance
214
+ : "The authenticated user is not a member of this workspace. Confirm the workspaceId or ask a workspace admin to add the user; re-login will not help.";
215
+ const warnings = [];
216
+ let journalPath = null;
217
+ if (input.journal !== false) {
218
+ try {
219
+ journalPath = writeWorkspaceAccessJournal({ workspaceId, guidance });
220
+ }
221
+ catch {
222
+ warnings.push("journalWriteFailed");
223
+ }
224
+ }
225
+ return {
226
+ readOnly: true,
227
+ blocker: "workspace_access",
228
+ workspaceId,
229
+ guidance,
230
+ warnings,
231
+ journalPath,
232
+ text: [
233
+ "Refill sends v2 dry-run blocked: workspace_access",
234
+ `Workspace: ${workspaceId}`,
235
+ guidance,
236
+ journalPath ? `Journal: ${journalPath}` : "Journal: not written",
237
+ ].join("\n"),
238
+ workspaceResolution: "explicit",
239
+ };
240
+ }
166
241
  const sanitized = sanitizeEvergreenRefillPlanResult(raw);
167
242
  const warnings = Array.isArray(sanitized.warnings)
168
243
  ? [...sanitized.warnings]
@@ -181,7 +256,7 @@ export async function getEvergreenRefillPlan(input) {
181
256
  }
182
257
  }
183
258
  const summary = [
184
- "Evergreen refill dry-run plan:",
259
+ "Refill sends v2 dry-run plan:",
185
260
  ...planSummaryLines(sanitized),
186
261
  journalPath ? `Journal: ${journalPath}` : "Journal: not written",
187
262
  ].join("\n");
@@ -194,3 +269,5 @@ export async function getEvergreenRefillPlan(input) {
194
269
  workspaceResolution: "explicit",
195
270
  };
196
271
  }
272
+ /** @deprecated Use getRefillPlanV2. */
273
+ export const getEvergreenRefillPlan = getRefillPlanV2;
@@ -137,7 +137,8 @@ export interface PostFindLeadsScoutRegistryResponse {
137
137
  }
138
138
  export declare const DEFAULT_SUBSKILL_PROMPT_CHUNK_CHARS = 48000;
139
139
  export declare const MAX_SUBSKILL_PROMPT_CHUNK_CHARS = 48000;
140
- export declare const ALLOWED_SUBSKILL_PROMPT_NAMES: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
140
+ export declare const DEPRECATED_SUBSKILL_PROMPT_REPLACEMENTS: Record<string, string>;
141
+ export declare const ALLOWED_SUBSKILL_PROMPT_NAMES: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
141
142
  export declare const promptToolDefinitions: ({
142
143
  name: string;
143
144
  description: string;
@@ -181,7 +182,7 @@ export declare const promptToolDefinitions: ({
181
182
  properties: {
182
183
  subskillName: {
183
184
  type: string;
184
- enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
185
+ enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
185
186
  description: string;
186
187
  };
187
188
  offset: {
@@ -216,7 +217,7 @@ export declare const promptToolDefinitions: ({
216
217
  properties: {
217
218
  subskillName: {
218
219
  type: string;
219
- enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
220
+ enum: readonly ["building-gtm-tables", "content", "create-ab-test", "create-campaign", "create-campaign-brief", "create-campaign-v2", "create-campaign-v2-tail", "create-campaign-v2-validation", "create-evergreen-campaigns", "create-post", "create-rubric", "engage", "enrich-prospects", "fill-send-horizon", "find-leads", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-evergreen", "refill-sends-evergreen-workflow", "refill-sends-v2", "refill-sends-v2-workflow", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
220
221
  description: string;
221
222
  };
222
223
  assetPath: {
@@ -13,8 +13,10 @@ import { markCreateCampaignPromptLoaded, markResearchPromptLoaded, markSenderRes
13
13
  // ~3s.
14
14
  export const DEFAULT_SUBSKILL_PROMPT_CHUNK_CHARS = 48_000;
15
15
  export const MAX_SUBSKILL_PROMPT_CHUNK_CHARS = 48_000;
16
- const DEPRECATED_SUBSKILL_PROMPT_REPLACEMENTS = {
16
+ export const DEPRECATED_SUBSKILL_PROMPT_REPLACEMENTS = {
17
17
  "generate-messages-compact": "generate-messages",
18
+ "refill-sends-evergreen": "refill-sends-v2",
19
+ "refill-sends-evergreen-workflow": "refill-sends-v2-workflow",
18
20
  };
19
21
  export const ALLOWED_SUBSKILL_PROMPT_NAMES = [
20
22
  "building-gtm-tables",
@@ -40,6 +42,8 @@ export const ALLOWED_SUBSKILL_PROMPT_NAMES = [
40
42
  "refill-sends",
41
43
  "refill-sends-evergreen",
42
44
  "refill-sends-evergreen-workflow",
45
+ "refill-sends-v2",
46
+ "refill-sends-v2-workflow",
43
47
  "refill-sends-workflow",
44
48
  "research",
45
49
  "research-prospect",
@@ -0,0 +1,178 @@
1
+ import { searchSignals } from "./leads.js";
2
+ export type RefillSendsApprovalMode = "approve" | "mark_ready";
3
+ export type PaidInmailRefreshAction = {
4
+ senderId: string;
5
+ actionKey?: string | null;
6
+ action?: Record<string, unknown>;
7
+ };
8
+ export type YoloPrimitiveExecution = {
9
+ enabled: true;
10
+ status: "no_action" | "read_only_reread" | "executed_and_reread" | "refused" | "skipped_after_paid_refresh";
11
+ selectedAction: Record<string, unknown> | null;
12
+ result?: unknown;
13
+ targetPlanReread: boolean;
14
+ refusalReason?: string;
15
+ postActionFirstAction?: unknown;
16
+ } | {
17
+ enabled: false;
18
+ status: "not_run_without_yolo";
19
+ selectedAction: null;
20
+ targetPlanReread: false;
21
+ };
22
+ export type YoloPrimitiveAttempt = {
23
+ status: "no_action" | "read_only_reread" | "executed_and_reread" | "refused";
24
+ result?: unknown;
25
+ refusalReason?: string;
26
+ };
27
+ export type UserAddedRowsLimitPayload = {
28
+ error?: string;
29
+ code: "USER_ADDED_ROWS_LIMIT_EXCEEDED";
30
+ maxRows?: number;
31
+ currentRows?: number;
32
+ requestedRows?: number;
33
+ attemptedRows?: number;
34
+ remainingRows?: number;
35
+ };
36
+ export type PrepareRowSelector = {
37
+ type: "needsEnrichment";
38
+ limit?: number;
39
+ } | {
40
+ type: "needsApproval";
41
+ limit?: number;
42
+ } | {
43
+ type: "needsGeneratedMessage";
44
+ limit?: number;
45
+ } | {
46
+ type: "reviewBatch";
47
+ limit?: number;
48
+ } | {
49
+ type: "staleGeneratedMessages";
50
+ limit?: number;
51
+ };
52
+ type SignalDiscoveryTab = {
53
+ keyword?: string | null;
54
+ posts?: Array<{
55
+ id?: string | null;
56
+ isSelected?: boolean | null;
57
+ }>;
58
+ };
59
+ export type ApproveBatchResult = {
60
+ approved: number;
61
+ failed: number;
62
+ partial?: boolean;
63
+ scope?: string;
64
+ message?: string;
65
+ };
66
+ export type StartCampaignAuthority = {
67
+ laneChainCampaignIds: string[];
68
+ pinnedCampaignId: string | null;
69
+ planRevision: string | null;
70
+ };
71
+ export type StartCampaignPrimitiveResult = {
72
+ executed: false;
73
+ refused: true;
74
+ reason: "action_type_not_start_paused_campaign" | "campaign_not_in_pinned_lane_chain";
75
+ campaignId: string | null;
76
+ laneChainCampaignIds: string[];
77
+ } | {
78
+ executed: false;
79
+ blocked: true;
80
+ reason: "start_route_rejected";
81
+ status: number;
82
+ body: string;
83
+ campaignId: string;
84
+ } | {
85
+ executed: true;
86
+ type: "start_paused_campaign";
87
+ campaignId: string;
88
+ authorizedBy: {
89
+ planRevision: string | null;
90
+ action: Record<string, unknown>;
91
+ };
92
+ result: unknown;
93
+ };
94
+ type RerunErroredCellsOperation = {
95
+ columnRole: "icpScore" | "generateMessage";
96
+ rowSelector: {
97
+ type: "rowIds";
98
+ rowIds: string[];
99
+ };
100
+ cellIds: string[];
101
+ };
102
+ export type RerunErroredCellsPrimitiveResult = {
103
+ executed: false;
104
+ refused: true;
105
+ reason: "action_type_not_rerun_errored_cells" | "missing_bounded_operations";
106
+ } | {
107
+ executed: true;
108
+ type: "rerun_errored_cells";
109
+ operations: Array<RerunErroredCellsOperation & {
110
+ result: unknown;
111
+ }>;
112
+ };
113
+ export declare function normalizeStrings(values: unknown): string[];
114
+ export declare function sleep(ms: number): Promise<unknown>;
115
+ export declare function recordValue(value: unknown): Record<string, unknown> | null;
116
+ export declare function stringValue(value: unknown): string | null;
117
+ export declare function numberValue(value: unknown): number | null;
118
+ export declare function stringArray(value: unknown): string[];
119
+ export declare function prepareRowSelectorValue(value: unknown): PrepareRowSelector | undefined;
120
+ export declare function uniqueStrings(values: Array<string | null | undefined>): string[];
121
+ export declare function userAddedRowsLimitPayloadFromError(error: unknown): UserAddedRowsLimitPayload | null;
122
+ export declare function paidRefreshActionFrom(value: unknown): PaidInmailRefreshAction | null;
123
+ export declare function collectPaidInmailRefreshActions(plan: unknown): PaidInmailRefreshAction[];
124
+ export declare function firstGlobalAction(plan: unknown): Record<string, unknown> | null;
125
+ export declare function actionIds(action: Record<string, unknown>): Record<string, unknown>;
126
+ export declare function actionToolInput(action: Record<string, unknown>): Record<string, unknown>;
127
+ export declare function actionCampaignId(action: Record<string, unknown>): string | null;
128
+ export declare function actionTableId(action: Record<string, unknown>): string | null;
129
+ export declare function actionSourceLeadListId(action: Record<string, unknown>): string | null;
130
+ export declare function actionSenderId(action: Record<string, unknown>): string | null;
131
+ export declare function actionActionType(action: Record<string, unknown>): string | null;
132
+ export declare function actionSourceFingerprint(action: Record<string, unknown>): string | null;
133
+ export declare function actionLeadSourceProvider(action: Record<string, unknown>): string | null;
134
+ export declare function normalizedSignalKeyword(value: unknown): string | null;
135
+ export declare function keywordsFromSignalTabs(tabs: SignalDiscoveryTab[]): string[];
136
+ export declare function selectedPostIdsFromSignalTabs(tabs: SignalDiscoveryTab[]): string[];
137
+ export declare function postIdsFromSignalSearch(summary: Awaited<ReturnType<typeof searchSignals>>, maxPosts: number, options?: {
138
+ excludePostIds?: string[];
139
+ }): string[];
140
+ export declare function maxSignalDiscoveryPostsForSourceLimit(sourceRowLimit: number): number;
141
+ export declare function refillPrepareRequestHash(params: {
142
+ action: Record<string, unknown>;
143
+ campaignId: string;
144
+ tableId?: string;
145
+ approvalMode: RefillSendsApprovalMode;
146
+ rowSelector?: PrepareRowSelector;
147
+ }): string;
148
+ export declare function boundedApprovalLimit(action: Record<string, unknown>): number | null;
149
+ export declare function approveGeneratedMessagesBatch(action: Record<string, unknown>, workspaceId?: string): Promise<{
150
+ status: "refused";
151
+ refusalReason: string;
152
+ result?: undefined;
153
+ } | {
154
+ status: "executed_and_reread";
155
+ result: ApproveBatchResult;
156
+ refusalReason?: undefined;
157
+ }>;
158
+ export declare function continueSignalDiscoverySource(action: Record<string, unknown>, workspaceId?: string): Promise<YoloPrimitiveAttempt>;
159
+ export declare function refreshPaidInmailCreditsWithRetry(senderId: string, workspaceId: string): Promise<{
160
+ receipt: import("./senders.js").RefreshPaidInmailCreditsResponse;
161
+ attempts: number;
162
+ errors: string[];
163
+ } | {
164
+ receipt: null;
165
+ attempts: number;
166
+ errors: string[];
167
+ }>;
168
+ export declare function executeStartCampaignPrimitive(params: {
169
+ action: Record<string, unknown>;
170
+ authority: StartCampaignAuthority;
171
+ workspaceId?: string | null;
172
+ }): Promise<StartCampaignPrimitiveResult>;
173
+ export declare function executeRerunErroredCellsPrimitive(params: {
174
+ action: Record<string, unknown>;
175
+ workspaceId?: string | null;
176
+ }): Promise<RerunErroredCellsPrimitiveResult>;
177
+ export declare function executeOneYoloPrimitive(action: Record<string, unknown> | null, workspaceId?: string): Promise<YoloPrimitiveAttempt>;
178
+ export {};