@sellable/mcp 0.1.793 → 0.1.794

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.
Files changed (54) hide show
  1. package/dist/agent-tool-names.d.ts +2 -2
  2. package/dist/agent-tool-names.js +14 -0
  3. package/dist/scheduler-envelope.d.ts +190 -0
  4. package/dist/scheduler-envelope.js +412 -0
  5. package/dist/server.js +28 -2
  6. package/dist/tools/campaign-message-preparation.d.ts +25 -0
  7. package/dist/tools/campaign-message-preparation.js +37 -0
  8. package/dist/tools/campaign-processing.d.ts +74 -1
  9. package/dist/tools/campaign-processing.js +57 -1
  10. package/dist/tools/prompts.d.ts +15 -3
  11. package/dist/tools/prompts.js +25 -0
  12. package/dist/tools/refill-executors.d.ts +43 -70
  13. package/dist/tools/refill-executors.js +201 -273
  14. package/dist/tools/refill-sends.d.ts +3 -3
  15. package/dist/tools/refill-sends.js +1 -1
  16. package/dist/tools/refill-target-plan.js +1 -1
  17. package/dist/tools/refill-v3-advance-contract.d.ts +618 -0
  18. package/dist/tools/refill-v3-advance-contract.js +920 -0
  19. package/dist/tools/refill-v3-advance.d.ts +397 -0
  20. package/dist/tools/refill-v3-advance.js +75 -0
  21. package/dist/tools/refill-v3-attention-packet-contract.d.ts +608 -0
  22. package/dist/tools/refill-v3-attention-packet-contract.js +911 -0
  23. package/dist/tools/refill-v3-campaign-work.d.ts +324 -0
  24. package/dist/tools/refill-v3-campaign-work.js +1015 -0
  25. package/dist/tools/refill-v3-continue-contract.d.ts +433 -0
  26. package/dist/tools/refill-v3-continue-contract.js +112 -0
  27. package/dist/tools/refill-v3-continue.d.ts +501 -0
  28. package/dist/tools/refill-v3-continue.js +654 -0
  29. package/dist/tools/refill-v3-edit-selected-campaign-contract.d.ts +208 -0
  30. package/dist/tools/refill-v3-edit-selected-campaign-contract.js +351 -0
  31. package/dist/tools/refill-v3-edit-selected-campaign.d.ts +232 -0
  32. package/dist/tools/refill-v3-edit-selected-campaign.js +147 -0
  33. package/dist/tools/refill-v3-fill-ready-contract.d.ts +198 -0
  34. package/dist/tools/refill-v3-fill-ready-contract.js +324 -0
  35. package/dist/tools/refill-v3-fill-ready.d.ts +199 -0
  36. package/dist/tools/refill-v3-fill-ready.js +136 -0
  37. package/dist/tools/refill-v3-source-family-dispatch.d.ts +249 -0
  38. package/dist/tools/refill-v3-source-family-dispatch.js +514 -0
  39. package/dist/tools/refill-v3-waterfall-contract.d.ts +156 -0
  40. package/dist/tools/refill-v3-waterfall-contract.js +181 -0
  41. package/dist/tools/refill-v3-waterfall.d.ts +136 -0
  42. package/dist/tools/refill-v3-waterfall.js +161 -0
  43. package/dist/tools/refill-v3-world-state-contract.d.ts +666 -0
  44. package/dist/tools/refill-v3-world-state-contract.js +790 -0
  45. package/dist/tools/refill-v3-world-state.d.ts +592 -0
  46. package/dist/tools/refill-v3-world-state.js +137 -0
  47. package/dist/tools/registry.d.ts +1710 -3
  48. package/dist/tools/registry.js +19 -0
  49. package/package.json +1 -1
  50. package/skills/refill-sends/SKILL.md +89 -4
  51. package/skills/refill-sends-waterfall-order/SKILL.md +174 -0
  52. package/skills/refill-sends-work-campaign/SKILL.md +253 -0
  53. package/skills/refill-sends-workflow/SKILL.md +112 -5
  54. package/skills/refill-sends-workflow/core/flow.v3.json +209 -0
package/dist/server.js CHANGED
@@ -53,6 +53,12 @@ import { preflightFindLeadsProvider } from "./tools/provider-preflight.js";
53
53
  import { waitForCampaignTableReady, waitForLeadListReady, } from "./tools/readiness.js";
54
54
  import { executeRefillSendsCommand } from "./tools/refill-sends.js";
55
55
  import { getRefillTargetPlan } from "./tools/refill-target-plan.js";
56
+ import { refillV3RetiredToolRefusal } from "./tools/refill-v3-advance-contract.js";
57
+ import { advanceRefillV3Tool } from "./tools/refill-v3-advance.js";
58
+ import { continueRefillV3Tool } from "./tools/refill-v3-continue.js";
59
+ import { editRefillV3SelectedCampaignTool } from "./tools/refill-v3-edit-selected-campaign.js";
60
+ import { fillRefillV3ReadyTool } from "./tools/refill-v3-fill-ready.js";
61
+ import { getRefillV3WorldStateTool } from "./tools/refill-v3-world-state.js";
56
62
  import { refreshSenderEngagementCommand } from "./tools/refresh-sender-engagement.js";
57
63
  import { allTools } from "./tools/registry.js";
58
64
  import { getRows, getTableRows, getTableRowsMinimal } from "./tools/rows.js";
@@ -392,6 +398,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
392
398
  case "run_scheduler_sweep":
393
399
  result = await runSchedulerSweep(args);
394
400
  break;
401
+ case "refill_v3_world_state":
402
+ result = await getRefillV3WorldStateTool(args);
403
+ break;
404
+ case "refill_v3_fill_ready":
405
+ result = await fillRefillV3ReadyTool(args);
406
+ break;
407
+ case "refill_v3_edit_selected_campaign":
408
+ result = await editRefillV3SelectedCampaignTool(args);
409
+ break;
410
+ case "refill_v3_advance":
411
+ result = await advanceRefillV3Tool(args);
412
+ break;
413
+ case "refill_v3_continue":
414
+ result = await continueRefillV3Tool(args);
415
+ break;
395
416
  case "refresh_sender_engagement":
396
417
  result = await refreshSenderEngagementCommand(args);
397
418
  break;
@@ -924,8 +945,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
924
945
  case "get_prospeo_credits":
925
946
  result = await getProspeoCredits();
926
947
  break;
927
- default:
928
- throw new Error(`Unknown tool: ${name}`);
948
+ default: {
949
+ // An already-installed skill or a cached flow asset can still invoke a
950
+ // RETIRED Refill V3 name. Naming the replacement turns an opaque dead end
951
+ // into an actionable refusal, with zero partial dispatch either way.
952
+ const retired = refillV3RetiredToolRefusal(name);
953
+ throw new Error(retired ?? `Unknown tool: ${name}`);
954
+ }
929
955
  }
930
956
  // A tool that DECLARES an `outputSchema` must answer with `structuredContent`,
931
957
  // or the client discards the whole response. `toMcpToolResult` owns that,
@@ -210,6 +210,14 @@ export declare const campaignMessagePreparationToolDefinitions: ({
210
210
  runCondition: {
211
211
  type: string[];
212
212
  };
213
+ intrinsicRequirements: {
214
+ type: string;
215
+ description: string;
216
+ };
217
+ approvalPolicy: {
218
+ type: string;
219
+ description: string;
220
+ };
213
221
  requestId: {
214
222
  type: string;
215
223
  };
@@ -404,6 +412,17 @@ export declare const campaignMessagePreparationToolDefinitions: ({
404
412
  jobId?: undefined;
405
413
  };
406
414
  required: string[];
415
+ oneOf: ({
416
+ not: {
417
+ anyOf: {
418
+ required: ("effectId" | "runCondition" | "requestId" | "profileSchemaVersion" | "compilerVersion" | "sequenceVersion" | "campaignDigest" | "actionColumnId" | "pathDigest" | "targetNodeId" | "entryNodeId" | "pathNodeIds" | "dependsOnColumnIds" | "intrinsicRequirements" | "approvalPolicy" | "targetColumnType" | "targetAction")[];
419
+ }[];
420
+ };
421
+ required?: undefined;
422
+ } | {
423
+ required: ("effectId" | "runCondition" | "requestId" | "profileSchemaVersion" | "compilerVersion" | "sequenceVersion" | "campaignDigest" | "actionColumnId" | "pathDigest" | "targetNodeId" | "entryNodeId" | "pathNodeIds" | "dependsOnColumnIds" | "intrinsicRequirements" | "approvalPolicy" | "targetColumnType" | "targetAction")[];
424
+ not?: undefined;
425
+ })[];
407
426
  additionalProperties: boolean;
408
427
  };
409
428
  } | {
@@ -626,12 +645,15 @@ export declare const campaignMessagePreparationToolDefinitions: ({
626
645
  pathNodeIds?: undefined;
627
646
  dependsOnColumnIds?: undefined;
628
647
  runCondition?: undefined;
648
+ intrinsicRequirements?: undefined;
649
+ approvalPolicy?: undefined;
629
650
  requestId?: undefined;
630
651
  effectId?: undefined;
631
652
  disableLowPassRateStop?: undefined;
632
653
  };
633
654
  additionalProperties: boolean;
634
655
  required?: undefined;
656
+ oneOf?: undefined;
635
657
  };
636
658
  } | {
637
659
  name: string;
@@ -676,6 +698,8 @@ export declare const campaignMessagePreparationToolDefinitions: ({
676
698
  pathNodeIds?: undefined;
677
699
  dependsOnColumnIds?: undefined;
678
700
  runCondition?: undefined;
701
+ intrinsicRequirements?: undefined;
702
+ approvalPolicy?: undefined;
679
703
  requestId?: undefined;
680
704
  effectId?: undefined;
681
705
  disableLowPassRateStop?: undefined;
@@ -684,6 +708,7 @@ export declare const campaignMessagePreparationToolDefinitions: ({
684
708
  };
685
709
  additionalProperties: boolean;
686
710
  required?: undefined;
711
+ oneOf?: undefined;
687
712
  };
688
713
  })[];
689
714
  export declare function startPrepareCampaignMessages(input: StartPrepareMessagesInput): Promise<unknown>;
@@ -2,6 +2,25 @@ import { getApi } from "../api.js";
2
2
  import { REFILL_REPORTING_CONTEXT_INPUT_SCHEMA, } from "./campaign-processing.js";
3
3
  import { sanitizeRefillReportingContextProjection, sanitizeRefillReportingProjection, } from "./refill-target-plan.js";
4
4
  import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
5
+ const READINESS_EXPECTATION_KEYS = [
6
+ "profileSchemaVersion",
7
+ "compilerVersion",
8
+ "sequenceVersion",
9
+ "campaignDigest",
10
+ "actionColumnId",
11
+ "targetColumnType",
12
+ "pathDigest",
13
+ "targetAction",
14
+ "targetNodeId",
15
+ "entryNodeId",
16
+ "pathNodeIds",
17
+ "dependsOnColumnIds",
18
+ "runCondition",
19
+ "intrinsicRequirements",
20
+ "approvalPolicy",
21
+ "requestId",
22
+ "effectId",
23
+ ];
5
24
  async function postPrepareMessages(body, workspaceId) {
6
25
  const api = getApi();
7
26
  const requestOptions = workspaceRequestOptions(workspaceId);
@@ -133,6 +152,14 @@ export const campaignMessagePreparationToolDefinitions = [
133
152
  pathNodeIds: { type: "array", items: { type: "string" } },
134
153
  dependsOnColumnIds: { type: "array", items: { type: "string" } },
135
154
  runCondition: { type: ["string", "null"] },
155
+ intrinsicRequirements: {
156
+ type: "object",
157
+ description: "Backend-issued sequence intrinsic requirements. Supply only as part of the complete readiness envelope.",
158
+ },
159
+ approvalPolicy: {
160
+ type: "object",
161
+ description: "Backend-issued approval policy. Supply only as part of the complete readiness envelope.",
162
+ },
136
163
  requestId: { type: "string" },
137
164
  effectId: { type: "string" },
138
165
  disableLowPassRateStop: {
@@ -154,6 +181,16 @@ export const campaignMessagePreparationToolDefinitions = [
154
181
  },
155
182
  },
156
183
  required: ["campaignId"],
184
+ oneOf: [
185
+ {
186
+ not: {
187
+ anyOf: READINESS_EXPECTATION_KEYS.map((key) => ({
188
+ required: [key],
189
+ })),
190
+ },
191
+ },
192
+ { required: [...READINESS_EXPECTATION_KEYS] },
193
+ ],
157
194
  additionalProperties: false,
158
195
  },
159
196
  },
@@ -29,13 +29,54 @@ type SchemaInput = {
29
29
  tableId?: string;
30
30
  workspaceId?: string;
31
31
  };
32
+ /**
33
+ * Bounded diagnostic read mode for `select_campaign_cells`. The ONLY new input
34
+ * is `{ limit }`, an integer in [1,10]. It never widens the compact default
35
+ * response and never reaches `queue_campaign_cells`.
36
+ */
37
+ export type CampaignDiagnosticInput = {
38
+ limit: number;
39
+ };
40
+ export type CampaignRepairSelection = {
41
+ success: true;
42
+ campaignId: string | null;
43
+ tableId: string;
44
+ rows: Array<{
45
+ rowId: string;
46
+ cells: Array<{
47
+ columnRole: "enrich" | "icpScore" | "generateMessage";
48
+ status: string;
49
+ error: string;
50
+ }>;
51
+ }>;
52
+ termination: {
53
+ reason: "frontier_exhausted" | "limit_reached";
54
+ rowsChecked: number;
55
+ rowsRemaining: number;
56
+ hasMore: boolean;
57
+ };
58
+ };
59
+ export declare const CAMPAIGN_DIAGNOSTIC_LIMIT_MAX = 10;
60
+ export declare const CAMPAIGN_DIAGNOSTIC_INPUT_SCHEMA: {
61
+ readonly type: "object";
62
+ readonly properties: {
63
+ readonly limit: {
64
+ readonly type: "integer";
65
+ readonly minimum: 1;
66
+ readonly maximum: 10;
67
+ };
68
+ };
69
+ readonly required: readonly ["limit"];
70
+ readonly additionalProperties: false;
71
+ };
32
72
  type SelectInput = SchemaInput & {
33
73
  columnRole: ColumnRole;
34
74
  rowSelector: RowSelector;
35
75
  limit?: number;
36
76
  includeGeneratedMessageReview?: boolean;
77
+ diagnostic?: CampaignDiagnosticInput;
37
78
  };
38
- type QueueInput = SelectInput & {
79
+ type QueueInput = Omit<SelectInput, "diagnostic"> & {
39
80
  forceRerun?: boolean;
40
81
  reason?: string;
41
82
  };
@@ -503,6 +544,14 @@ type WorkflowTableStats = {
503
544
  export declare function normalizeRefillRunHandle(value: unknown): RefillRunHandleV1;
504
545
  export declare function normalizeRefillTargetConfig(value: unknown): RefillTargetConfigV1;
505
546
  export declare function normalizeMessageTemplateRevision(value: unknown): MessageTemplateRevisionV1 | undefined;
547
+ /**
548
+ * Internal Refill V3 owner for the exact transient pre-approval repair
549
+ * frontier. It is intentionally not a public MCP tool: the model chooses the
550
+ * action, while the server owns the bounded current rows and semantic roles.
551
+ */
552
+ export declare function selectRepairableCampaignCells(input: SchemaInput & {
553
+ limit: number;
554
+ }): Promise<CampaignRepairSelection>;
506
555
  export declare const campaignProcessingToolDefinitions: ({
507
556
  name: string;
508
557
  description: string;
@@ -522,6 +571,7 @@ export declare const campaignProcessingToolDefinitions: ({
522
571
  rowSelector?: undefined;
523
572
  limit?: undefined;
524
573
  includeGeneratedMessageReview?: undefined;
574
+ diagnostic?: undefined;
525
575
  forceRerun?: undefined;
526
576
  reason?: undefined;
527
577
  minPassedCount?: undefined;
@@ -587,6 +637,18 @@ export declare const campaignProcessingToolDefinitions: ({
587
637
  type: string;
588
638
  description: string;
589
639
  };
640
+ diagnostic: {
641
+ readonly type: "object";
642
+ readonly properties: {
643
+ readonly limit: {
644
+ readonly type: "integer";
645
+ readonly minimum: 1;
646
+ readonly maximum: 10;
647
+ };
648
+ };
649
+ readonly required: readonly ["limit"];
650
+ readonly additionalProperties: false;
651
+ };
590
652
  forceRerun?: undefined;
591
653
  reason?: undefined;
592
654
  minPassedCount?: undefined;
@@ -655,6 +717,7 @@ export declare const campaignProcessingToolDefinitions: ({
655
717
  type: string;
656
718
  };
657
719
  includeGeneratedMessageReview?: undefined;
720
+ diagnostic?: undefined;
658
721
  minPassedCount?: undefined;
659
722
  minGeneratedMessages?: undefined;
660
723
  templateRevision?: undefined;
@@ -704,6 +767,7 @@ export declare const campaignProcessingToolDefinitions: ({
704
767
  rowSelector?: undefined;
705
768
  limit?: undefined;
706
769
  includeGeneratedMessageReview?: undefined;
770
+ diagnostic?: undefined;
707
771
  forceRerun?: undefined;
708
772
  reason?: undefined;
709
773
  rowIds?: undefined;
@@ -744,6 +808,7 @@ export declare const campaignProcessingToolDefinitions: ({
744
808
  rowSelector?: undefined;
745
809
  limit?: undefined;
746
810
  includeGeneratedMessageReview?: undefined;
811
+ diagnostic?: undefined;
747
812
  forceRerun?: undefined;
748
813
  reason?: undefined;
749
814
  minPassedCount?: undefined;
@@ -964,6 +1029,7 @@ export declare const campaignProcessingToolDefinitions: ({
964
1029
  rowSelector?: undefined;
965
1030
  limit?: undefined;
966
1031
  includeGeneratedMessageReview?: undefined;
1032
+ diagnostic?: undefined;
967
1033
  forceRerun?: undefined;
968
1034
  reason?: undefined;
969
1035
  minPassedCount?: undefined;
@@ -979,6 +1045,13 @@ export declare const campaignProcessingToolDefinitions: ({
979
1045
  };
980
1046
  })[];
981
1047
  export declare function getCampaignTableSchema(input: SchemaInput): Promise<CampaignProcessingSchemaResponse>;
1048
+ /**
1049
+ * Validate the bounded diagnostic packet locally, BEFORE the outbound POST. The
1050
+ * host's JSON-schema validation is not a substitute: a permissive packet that
1051
+ * reached the product would authorize an unbounded or foreign diagnostic read.
1052
+ * An absent `diagnostic` returns null and leaves the compact default untouched.
1053
+ */
1054
+ export declare function normalizeCampaignDiagnosticInput(input: SelectInput): CampaignDiagnosticInput | null;
982
1055
  export declare function selectCampaignCells(input: SelectInput): Promise<unknown>;
983
1056
  export declare function queueCampaignCells(input: QueueInput): Promise<unknown>;
984
1057
  export declare function recordCampaignReviewBatch(input: RecordReviewBatchInput): Promise<unknown>;
@@ -1,6 +1,15 @@
1
1
  import { getApi } from "../api.js";
2
2
  import { resolveWaitTimeout } from "./readiness.js";
3
3
  import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
4
+ export const CAMPAIGN_DIAGNOSTIC_LIMIT_MAX = 10;
5
+ export const CAMPAIGN_DIAGNOSTIC_INPUT_SCHEMA = {
6
+ type: "object",
7
+ properties: {
8
+ limit: { type: "integer", minimum: 1, maximum: 10 },
9
+ },
10
+ required: ["limit"],
11
+ additionalProperties: false,
12
+ };
4
13
  export const REFILL_RUN_HANDLE_INPUT_SCHEMA = {
5
14
  type: "object",
6
15
  properties: {
@@ -297,6 +306,21 @@ async function resolveSchema(input) {
297
306
  ...(workspaceId ? { workspaceId } : {}),
298
307
  }, workspaceId ?? undefined);
299
308
  }
309
+ /**
310
+ * Internal Refill V3 owner for the exact transient pre-approval repair
311
+ * frontier. It is intentionally not a public MCP tool: the model chooses the
312
+ * action, while the server owns the bounded current rows and semantic roles.
313
+ */
314
+ export async function selectRepairableCampaignCells(input) {
315
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
316
+ return postCampaignProcessing({
317
+ action: "selectRepairable",
318
+ campaignId: input.campaignId,
319
+ tableId: input.tableId,
320
+ limit: input.limit,
321
+ ...(workspaceId ? { workspaceId } : {}),
322
+ }, workspaceId ?? undefined);
323
+ }
300
324
  export const campaignProcessingToolDefinitions = [
301
325
  {
302
326
  name: "get_campaign_table_schema",
@@ -313,7 +337,7 @@ export const campaignProcessingToolDefinitions = [
313
337
  },
314
338
  {
315
339
  name: "select_campaign_cells",
316
- description: 'Dry-run semantic campaign-cell selection. Returns compact counts and a tiny sample, never bulky row data. For a bounded exact copy audit before approval, call columnRole:"generateMessage", rowSelector:{type:"rowIds",rowIds:[...]}, includeGeneratedMessageReview:true with 1-20 exact rows. authoritativeGeneratedMessageReview is the WorkflowTableCell.result source of truth for subject, body, and template authority; never substitute formula Message/Subject columns, campaign previews, or CSV exports. 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.',
340
+ description: 'Dry-run semantic campaign-cell selection. Returns compact counts and a tiny sample, never bulky row data. For a bounded exact copy audit before approval, call columnRole:"generateMessage", rowSelector:{type:"rowIds",rowIds:[...]}, includeGeneratedMessageReview:true with 1-20 exact rows. authoritativeGeneratedMessageReview is the WorkflowTableCell.result source of truth for subject, body, and template authority; never substitute formula Message/Subject columns, campaign previews, or CSV exports. 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. Pass diagnostic:{limit:N} with 1<=N<=10 and exact workspaceId, campaignId, and tableId to additionally load decision-relevant workflow evidence for that bounded sample in one set query; inert display/formula cells are omitted. Omit diagnostic for the compact default response.',
317
341
  inputSchema: {
318
342
  type: "object",
319
343
  properties: {
@@ -358,6 +382,7 @@ export const campaignProcessingToolDefinitions = [
358
382
  type: "boolean",
359
383
  description: "Return the authoritative generated subject/body and template-authority projection. Allowed only for columnRole generateMessage with 1-20 exact rowIds.",
360
384
  },
385
+ diagnostic: CAMPAIGN_DIAGNOSTIC_INPUT_SCHEMA,
361
386
  },
362
387
  required: ["columnRole", "rowSelector"],
363
388
  additionalProperties: false,
@@ -470,11 +495,42 @@ export const campaignProcessingToolDefinitions = [
470
495
  export async function getCampaignTableSchema(input) {
471
496
  return resolveSchema(input);
472
497
  }
498
+ /**
499
+ * Validate the bounded diagnostic packet locally, BEFORE the outbound POST. The
500
+ * host's JSON-schema validation is not a substitute: a permissive packet that
501
+ * reached the product would authorize an unbounded or foreign diagnostic read.
502
+ * An absent `diagnostic` returns null and leaves the compact default untouched.
503
+ */
504
+ export function normalizeCampaignDiagnosticInput(input) {
505
+ const raw = input.diagnostic;
506
+ if (raw === undefined)
507
+ return null;
508
+ if (!isRecord(raw)) {
509
+ throw new Error("diagnostic must be an object with exactly one integer limit between 1 and 10.");
510
+ }
511
+ const keys = Object.keys(raw);
512
+ if (keys.length !== 1 || keys[0] !== "limit") {
513
+ throw new Error("diagnostic accepts only the limit property.");
514
+ }
515
+ const limit = raw.limit;
516
+ if (typeof limit !== "number" ||
517
+ !Number.isInteger(limit) ||
518
+ limit < 1 ||
519
+ limit > CAMPAIGN_DIAGNOSTIC_LIMIT_MAX) {
520
+ throw new Error(`diagnostic.limit must be an integer between 1 and ${CAMPAIGN_DIAGNOSTIC_LIMIT_MAX}.`);
521
+ }
522
+ requiredString(input.workspaceId, "workspaceId for diagnostic mode");
523
+ requiredString(input.campaignId, "campaignId for diagnostic mode");
524
+ requiredString(input.tableId, "tableId for diagnostic mode");
525
+ return { limit };
526
+ }
473
527
  export async function selectCampaignCells(input) {
474
528
  const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
529
+ const diagnostic = normalizeCampaignDiagnosticInput(input);
475
530
  return postCampaignProcessing({
476
531
  action: "select",
477
532
  ...input,
533
+ ...(diagnostic ? { diagnostic } : {}),
478
534
  ...(workspaceId ? { workspaceId } : {}),
479
535
  }, workspaceId ?? undefined);
480
536
  }
@@ -146,7 +146,7 @@ export interface PostFindLeadsScoutRegistryResponse {
146
146
  export declare const DEFAULT_SUBSKILL_PROMPT_CHUNK_CHARS = 48000;
147
147
  export declare const MAX_SUBSKILL_PROMPT_CHUNK_CHARS = 48000;
148
148
  export declare const DEPRECATED_SUBSKILL_PROMPT_REPLACEMENTS: Record<string, string>;
149
- export declare const ALLOWED_SUBSKILL_PROMPT_NAMES: readonly ["avoid-ai-writing", "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", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
149
+ export declare const ALLOWED_SUBSKILL_PROMPT_NAMES: readonly ["avoid-ai-writing", "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", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-waterfall-order", "refill-sends-work-campaign", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
150
150
  export declare const REFILL_PROJECTION_PROMPT_INVENTORY: readonly [{
151
151
  readonly name: "refill-sends";
152
152
  readonly assetPath: "SKILL.md";
@@ -155,6 +155,18 @@ export declare const REFILL_PROJECTION_PROMPT_INVENTORY: readonly [{
155
155
  readonly name: "refill-sends-workflow";
156
156
  readonly assetPath: "core/flow.v1.json";
157
157
  readonly visibility: "internal";
158
+ }, {
159
+ readonly name: "refill-sends-workflow";
160
+ readonly assetPath: "core/flow.v3.json";
161
+ readonly visibility: "internal";
162
+ }, {
163
+ readonly name: "refill-sends-work-campaign";
164
+ readonly assetPath: "SKILL.md";
165
+ readonly visibility: "internal";
166
+ }, {
167
+ readonly name: "refill-sends-waterfall-order";
168
+ readonly assetPath: "SKILL.md";
169
+ readonly visibility: "internal";
158
170
  }];
159
171
  export declare const promptToolDefinitions: ({
160
172
  name: string;
@@ -199,7 +211,7 @@ export declare const promptToolDefinitions: ({
199
211
  properties: {
200
212
  subskillName: {
201
213
  type: string;
202
- enum: readonly ["avoid-ai-writing", "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", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
214
+ enum: readonly ["avoid-ai-writing", "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", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-waterfall-order", "refill-sends-work-campaign", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
203
215
  description: string;
204
216
  };
205
217
  offset: {
@@ -234,7 +246,7 @@ export declare const promptToolDefinitions: ({
234
246
  properties: {
235
247
  subskillName: {
236
248
  type: string;
237
- enum: readonly ["avoid-ai-writing", "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", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
249
+ enum: readonly ["avoid-ai-writing", "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", "find-leads-v2", "foundation", "generate-messages", "interview", "load-voice", "refresh-sender-engagement", "refill-sends", "refill-sends-waterfall-order", "refill-sends-work-campaign", "refill-sends-workflow", "research", "research-prospect", "research-sender", "weekly-campaign-summary", "workflow-sequences"];
238
250
  description: string;
239
251
  };
240
252
  assetPath: {
@@ -40,6 +40,12 @@ export const ALLOWED_SUBSKILL_PROMPT_NAMES = [
40
40
  "load-voice",
41
41
  "refresh-sender-engagement",
42
42
  "refill-sends",
43
+ // Phase 146.5 Plan 09: the two INTERNAL wave-7 AI seams. Both are lazily
44
+ // loaded through `get_subskill_prompt`; neither gets a slash command, a command
45
+ // directory, a menu entry, or any installer edit, matching the
46
+ // `refill-sends-workflow` internal-subskill precedent.
47
+ "refill-sends-waterfall-order",
48
+ "refill-sends-work-campaign",
43
49
  "refill-sends-workflow",
44
50
  "research",
45
51
  "research-prospect",
@@ -54,6 +60,25 @@ export const REFILL_PROJECTION_PROMPT_INVENTORY = [
54
60
  assetPath: "core/flow.v1.json",
55
61
  visibility: "internal",
56
62
  },
63
+ // Phase 146.5 Plan 12 (Plan 10 deferred item 6): the V3 flow asset is a
64
+ // FIRST-CLASS member of the refill projection surface, not an undeclared
65
+ // sibling of the V1 asset. `refill-sends-workflow` therefore appears twice —
66
+ // once per route asset — which is exactly what a two-route workflow projects.
67
+ {
68
+ name: "refill-sends-workflow",
69
+ assetPath: "core/flow.v3.json",
70
+ visibility: "internal",
71
+ },
72
+ {
73
+ name: "refill-sends-work-campaign",
74
+ assetPath: "SKILL.md",
75
+ visibility: "internal",
76
+ },
77
+ {
78
+ name: "refill-sends-waterfall-order",
79
+ assetPath: "SKILL.md",
80
+ visibility: "internal",
81
+ },
57
82
  ];
58
83
  export const promptToolDefinitions = [
59
84
  {
@@ -1,5 +1,6 @@
1
+ import { hasTerminalSchedulerReceipt, normalizeSchedulerChangedCounts, normalizeSchedulerPrimitiveResult, numberValue, recordValue, schedulerEnvelopeIsTerminal, stringArray, stringValue, type SchedulerChangedCount, type SchedulerChangedCounts } from "../scheduler-envelope.js";
1
2
  import { searchSignals } from "./leads.js";
2
- import { type SchedulerExpectedTargetInput } from "./scheduler-run.js";
3
+ import type { RefillV3SourceFamilyOwners, RefillV3SourceOwnerKey, RefillV3SourceOwnerOutcome } from "./refill-v3-source-family-dispatch.js";
3
4
  export type RefillSendsApprovalMode = "approve" | "mark_ready";
4
5
  export type PaidInmailRefreshAction = {
5
6
  senderId: string;
@@ -44,6 +45,30 @@ export type YoloPrimitiveAttempt = {
44
45
  refusalReason?: string;
45
46
  providerOutcome?: ProviderSavedSearchOutcome;
46
47
  };
48
+ /**
49
+ * Normalize ONE existing family owner's `YoloPrimitiveAttempt` into the closed
50
+ * dispatch outcome. Missing or uncertain effect evidence is NEVER success:
51
+ * `no_action` is a bounded zero-yield success only when its receipt carries
52
+ * before/after evidence, and a refusal or an absent receipt is a typed failure.
53
+ */
54
+ /**
55
+ * The V3 source path is SINGLE-PASS by construction.
56
+ *
57
+ * V1 keeps its two-attempt signal helper and its depth-scaled provider target;
58
+ * V3 removes both. `searchSignalsWithProviderRetry` hides TWO transport attempts
59
+ * inside one "bounded" owner call, and `priorSearchDepth` is retry/expansion
60
+ * MEMORY that multiplies the target the AI never asked for. Under V3 a provider
61
+ * outcome is a typed no-effect receipt followed by a reread, and only a later
62
+ * fresh attention iteration may choose another action.
63
+ */
64
+ export declare const REFILL_V3_SIGNAL_SEARCH_ATTEMPTS = 1;
65
+ export declare function isRefillV3SinglePassAction(action: Record<string, unknown>): boolean;
66
+ export declare function normalizeRefillV3SourceOwnerReceipt(params: {
67
+ ownerKey: RefillV3SourceOwnerKey;
68
+ attempt: YoloPrimitiveAttempt;
69
+ requestFingerprint: string;
70
+ idempotencyKey: string;
71
+ }): RefillV3SourceOwnerOutcome;
47
72
  export type RefillTemplateRevisionPrimitiveResult = {
48
73
  executed: true;
49
74
  type: "revise_message_template_and_rerun";
@@ -177,7 +202,7 @@ export type StartCampaignPrimitiveResult = {
177
202
  result: unknown;
178
203
  };
179
204
  type RerunErroredCellsOperation = {
180
- columnRole: "icpScore" | "generateMessage";
205
+ columnRole: "enrich" | "icpScore" | "generateMessage";
181
206
  rowSelector: {
182
207
  type: "rowIds";
183
208
  rowIds: string[];
@@ -197,75 +222,10 @@ export type RerunErroredCellsPrimitiveResult = {
197
222
  };
198
223
  export declare function normalizeStrings(values: unknown): string[];
199
224
  export declare function sleep(ms: number): Promise<unknown>;
200
- export declare function recordValue(value: unknown): Record<string, unknown> | null;
201
- export declare function stringValue(value: unknown): string | null;
202
- export declare function numberValue(value: unknown): number | null;
203
- export type SchedulerChangedCount = {
204
- campaignId: string;
205
- tableId: string;
206
- actionType: string;
207
- count: number;
208
- };
209
- export type SchedulerChangedCounts = {
210
- complete: true;
211
- truncated: false;
212
- total: number;
213
- byCampaignTableActionType: SchedulerChangedCount[];
214
- byCampaignTableActionTypeSender: Array<SchedulerChangedCount & {
215
- senderId: string;
216
- }>;
217
- };
218
- export declare function normalizeSchedulerChangedCounts(value: unknown): SchedulerChangedCounts | null;
219
225
  export declare function setSweepSettlePollDelayMsForTests(ms: number): void;
220
226
  export declare function resetSweepSettlePollDelayMsForTests(): void;
221
- export declare function schedulerEnvelopeIsTerminal(schedulerStatus: string, receipt?: Record<string, unknown> | null): boolean;
222
- export declare function normalizeSchedulerPrimitiveResult(value: unknown, expected?: {
223
- expectedTargets: SchedulerExpectedTargetInput[];
224
- expectedTargetsHash: string;
225
- maxPlacements: number;
226
- }): {
227
- retryAfterMs: number;
228
- changedCounts: null;
229
- auditComplete: false;
230
- unsettledReceipt?: Record<string, unknown> | undefined;
231
- status: "matching_scheduler_active";
232
- schedulerStatus: string;
233
- terminal: false;
234
- disposition: "bounded_reread_wait";
235
- receipt: null;
236
- blocker?: undefined;
237
- } | {
238
- status: string;
239
- schedulerStatus: string;
240
- disposition: "bounded_backoff_wait" | "diagnostic_stop";
241
- receipt: {} | null;
242
- retryAfterMs: number | null;
243
- changedCounts: null;
244
- auditComplete: false;
245
- blocker: string;
246
- terminal?: undefined;
247
- } | {
248
- status: "scheduler_receipt_incomplete";
249
- schedulerStatus: string;
250
- receipt: {} | null;
251
- retryAfterMs: number | null;
252
- changedCounts: null;
253
- auditComplete: false;
254
- blocker: "scheduler_receipt_incomplete";
255
- disposition?: undefined;
256
- terminal?: undefined;
257
- } | {
258
- status: string;
259
- terminal: boolean;
260
- receipt: {} | null;
261
- retryAfterMs: number | null;
262
- changedCounts: SchedulerChangedCounts;
263
- auditComplete: true;
264
- schedulerStatus?: undefined;
265
- disposition?: undefined;
266
- blocker?: undefined;
267
- };
268
- export declare function stringArray(value: unknown): string[];
227
+ export { hasTerminalSchedulerReceipt, normalizeSchedulerChangedCounts, normalizeSchedulerPrimitiveResult, numberValue, recordValue, schedulerEnvelopeIsTerminal, stringArray, stringValue, };
228
+ export type { SchedulerChangedCount, SchedulerChangedCounts };
269
229
  export declare function prepareRowSelectorValue(value: unknown): PrepareRowSelector | undefined;
270
230
  export declare function uniqueStrings(values: Array<string | null | undefined>): string[];
271
231
  export declare function userAddedRowsLimitPayloadFromError(error: unknown): UserAddedRowsLimitPayload | null;
@@ -389,6 +349,20 @@ export declare function buildBoundedProviderSearchClone(provider: "sales-nav" |
389
349
  export declare function executeProviderSavedSearch(action: Record<string, unknown>, workspaceId: string | undefined, mode: ProviderSavedSearchMode): Promise<YoloPrimitiveAttempt>;
390
350
  export declare function continueProviderSource(action: Record<string, unknown>, workspaceId?: string): Promise<YoloPrimitiveAttempt>;
391
351
  export declare function broadenProviderSearch(action: Record<string, unknown>, workspaceId?: string): Promise<YoloPrimitiveAttempt>;
352
+ /**
353
+ * The V3 owner binding (Phase 146.5 Plan 09 T4/T5).
354
+ *
355
+ * It maps the dispatcher's five closed owner keys onto the EXISTING family
356
+ * owners and marks every action single-pass, so the V3 path can never take a
357
+ * hidden second transport attempt or scale its target by prior search depth.
358
+ * Every receipt crosses the ONE normalization path.
359
+ *
360
+ * It never chooses a family, a provider, a query, a filter, a keyword, or a
361
+ * post: those arrive already bounded on the AI command.
362
+ */
363
+ export type RefillV3SourceOwnerRequest = Parameters<RefillV3SourceFamilyOwners[RefillV3SourceOwnerKey]>[0];
364
+ export declare function buildRefillV3SourceOwnerAction(request: RefillV3SourceOwnerRequest): Record<string, unknown>;
365
+ export declare function refillV3SourceFamilyOwners(workspaceId: string): RefillV3SourceFamilyOwners;
392
366
  export declare function refreshSenderPostEngagers(action: Record<string, unknown>, workspaceId?: string): Promise<YoloPrimitiveAttempt>;
393
367
  /**
394
368
  * Rung 4 is a product-owned rubric quality trial, not a blind toggle. The backend
@@ -422,4 +396,3 @@ export declare function executeRefillTemplateRevisionPrimitive(params: {
422
396
  workspaceId?: string | null;
423
397
  }): Promise<RefillTemplateRevisionPrimitiveResult>;
424
398
  export declare function executeOneYoloPrimitive(action: Record<string, unknown> | null, workspaceId?: string): Promise<YoloPrimitiveAttempt>;
425
- export {};