@sellable/mcp 0.1.641 → 0.1.643

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.
@@ -745,9 +745,127 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
745
745
  status: string;
746
746
  workspaceTargetPlan: unknown;
747
747
  selectedTarget?: undefined;
748
+ exactTargetPlan?: undefined;
749
+ note?: undefined;
750
+ completedTarget?: undefined;
751
+ exactRunResult?: undefined;
752
+ };
753
+ continuation: {
754
+ required: boolean;
755
+ userActionRequired: boolean;
756
+ kind?: undefined;
757
+ owner?: undefined;
758
+ tool?: undefined;
759
+ arguments?: undefined;
760
+ stopCondition?: undefined;
761
+ };
762
+ targetDate: string | null;
763
+ untilDate: string | null;
764
+ horizonSendDays: number | null;
765
+ fillWindow: {
766
+ mode: string;
767
+ targetDate: string;
768
+ description: string;
769
+ untilDate?: undefined;
770
+ horizonSendDays?: undefined;
771
+ horizonHours?: undefined;
772
+ } | {
773
+ mode: string;
774
+ untilDate: string;
775
+ description: string;
776
+ targetDate?: undefined;
777
+ horizonSendDays?: undefined;
778
+ horizonHours?: undefined;
779
+ } | {
780
+ mode: string;
781
+ horizonSendDays: number | null;
782
+ horizonHours: number | null;
783
+ description: string;
784
+ targetDate?: undefined;
785
+ untilDate?: undefined;
786
+ };
787
+ approvalMode: RefillSendsApprovalMode;
788
+ campaignId: string | null;
789
+ tableId: string | null;
790
+ targetConfig: RefillTargetConfigV1 | null;
791
+ runHandle: RefillRunHandleV1 | null;
792
+ reportingContext: RefillReportingContextV2 | null;
793
+ messageTemplateRevision: MessageTemplateRevisionV1 | null;
794
+ senderScope: string;
795
+ senderSelectors: {
796
+ senders: string[];
797
+ senderIds: string[];
798
+ senderNames: string[];
799
+ };
800
+ firstOperationalSteps: string[];
801
+ approvalContract: string;
802
+ forbiddenActions: string[];
803
+ hostExamples: {
804
+ claude: string[];
805
+ codex: string[];
806
+ mcpTool: {
807
+ name: string;
808
+ arguments: {
809
+ workspaceCoordinator?: boolean | undefined;
810
+ messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
811
+ reportingContext?: RefillReportingContextV2 | undefined;
812
+ targetConfig?: RefillTargetConfigV1 | undefined;
813
+ runHandle?: RefillRunHandleV1 | undefined;
814
+ fence?: number | undefined;
815
+ runId?: string | undefined;
816
+ expectedActionKey?: string | undefined;
817
+ expectedTargetShapeRevision?: string | undefined;
818
+ targetDate: string | null;
819
+ untilDate: string | null;
820
+ horizonSendDays: number | null;
821
+ campaignId: string | undefined;
822
+ tableId: string | undefined;
823
+ intent: RefillSendsIntent;
824
+ approvalMode: RefillSendsApprovalMode;
825
+ workspaceId: string | null;
826
+ actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
827
+ yolo: boolean;
828
+ senders: string[];
829
+ senderIds: string[];
830
+ senderNames: string[];
831
+ };
832
+ };
833
+ };
834
+ actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
835
+ command: string;
836
+ tool: string;
837
+ promptName: string;
838
+ workflowPromptName: string;
839
+ workflowAsset: {
840
+ subskillName: string;
841
+ assetPath: string;
842
+ };
843
+ yolo: boolean;
844
+ executionMode: RefillSendsExecutionMode;
845
+ workspaceId: string | null;
846
+ workspaceResolution: string;
847
+ intent: RefillSendsIntent;
848
+ } | {
849
+ status: "terminal";
850
+ doneReason: "loaded_awaiting_scheduler";
851
+ note: string;
852
+ targetPlan: unknown;
853
+ exactTargetPlan: unknown;
854
+ orchestration: {
855
+ mode: string;
856
+ scope: string;
857
+ checkpointedFields: string[];
858
+ transportBudgetMs: number;
859
+ };
860
+ coordinator: {
861
+ scope: string;
862
+ status: string;
863
+ selectedTarget: WorkspaceExactTarget;
864
+ workspaceTargetPlan: unknown;
865
+ exactTargetPlan: unknown;
866
+ note: string;
748
867
  completedTarget?: undefined;
749
868
  exactRunResult?: undefined;
750
- note?: undefined;
751
869
  };
752
870
  continuation: {
753
871
  required: boolean;
@@ -847,8 +965,8 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
847
965
  } | {
848
966
  ok: boolean;
849
967
  status: "blocked";
850
- code: "workspace_exact_target_unavailable" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
851
- blocker: "workspace_exact_target_unavailable" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
968
+ code: "workspace_exact_target_unavailable" | "workspace_exact_target_ambiguous" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
969
+ blocker: "workspace_exact_target_unavailable" | "workspace_exact_target_ambiguous" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
852
970
  note: string;
853
971
  targetPlan: unknown;
854
972
  exactTargetPlan: {} | null;
@@ -857,9 +975,10 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
857
975
  status: string;
858
976
  selectedTarget: WorkspaceExactTarget | null;
859
977
  workspaceTargetPlan?: undefined;
978
+ exactTargetPlan?: undefined;
979
+ note?: undefined;
860
980
  completedTarget?: undefined;
861
981
  exactRunResult?: undefined;
862
- note?: undefined;
863
982
  };
864
983
  continuation: {
865
984
  required: boolean;
@@ -1079,6 +1198,7 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1079
1198
  conflicts?: undefined;
1080
1199
  };
1081
1200
  selectedTarget?: undefined;
1201
+ exactTargetPlan?: undefined;
1082
1202
  note?: undefined;
1083
1203
  };
1084
1204
  continuation: {
@@ -1188,11 +1308,154 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1188
1308
  workspaceId: string | null;
1189
1309
  workspaceResolution: string;
1190
1310
  intent: RefillSendsIntent;
1311
+ } | {
1312
+ status: "terminal";
1313
+ doneReason: "loaded_awaiting_scheduler";
1314
+ note: string;
1315
+ targetPlan: unknown;
1316
+ exactTargetPlan: unknown;
1317
+ orchestration: {
1318
+ mode: string;
1319
+ scope: string;
1320
+ checkpointedFields: string[];
1321
+ transportBudgetMs: number;
1322
+ };
1323
+ coordinator: {
1324
+ scope: string;
1325
+ status: string;
1326
+ completedTarget: WorkspaceExactTarget | null;
1327
+ selectedTarget: WorkspaceExactTarget;
1328
+ workspaceTargetPlan: unknown;
1329
+ exactTargetPlan: unknown;
1330
+ exactRunResult: {
1331
+ runSnapshot: unknown;
1332
+ readOnly: boolean;
1333
+ forbiddenActions: string[];
1334
+ boundedAuthority: string;
1335
+ status: "terminal";
1336
+ doneReason: string;
1337
+ report: Record<string, unknown>;
1338
+ runId: string;
1339
+ guidance?: string;
1340
+ journalPath?: string | null;
1341
+ targetConfig?: RefillTargetConfigV1;
1342
+ runHandle?: RefillRunHandleV1;
1343
+ refillReporting?: Record<string, unknown>;
1344
+ blocker?: undefined;
1345
+ conflicts?: undefined;
1346
+ };
1347
+ note: string;
1348
+ };
1349
+ continuation: {
1350
+ required: boolean;
1351
+ userActionRequired: boolean;
1352
+ kind?: undefined;
1353
+ owner?: undefined;
1354
+ tool?: undefined;
1355
+ arguments?: undefined;
1356
+ stopCondition?: undefined;
1357
+ };
1358
+ runSnapshot: unknown;
1359
+ readOnly: boolean;
1360
+ forbiddenActions: string[];
1361
+ boundedAuthority: string;
1362
+ report: Record<string, unknown>;
1363
+ runId: string;
1364
+ guidance?: string;
1365
+ journalPath?: string | null;
1366
+ targetConfig: RefillTargetConfigV1 | null;
1367
+ runHandle: RefillRunHandleV1 | null;
1368
+ refillReporting?: Record<string, unknown>;
1369
+ blocker?: undefined;
1370
+ conflicts?: undefined;
1371
+ targetDate: string | null;
1372
+ untilDate: string | null;
1373
+ horizonSendDays: number | null;
1374
+ fillWindow: {
1375
+ mode: string;
1376
+ targetDate: string;
1377
+ description: string;
1378
+ untilDate?: undefined;
1379
+ horizonSendDays?: undefined;
1380
+ horizonHours?: undefined;
1381
+ } | {
1382
+ mode: string;
1383
+ untilDate: string;
1384
+ description: string;
1385
+ targetDate?: undefined;
1386
+ horizonSendDays?: undefined;
1387
+ horizonHours?: undefined;
1388
+ } | {
1389
+ mode: string;
1390
+ horizonSendDays: number | null;
1391
+ horizonHours: number | null;
1392
+ description: string;
1393
+ targetDate?: undefined;
1394
+ untilDate?: undefined;
1395
+ };
1396
+ approvalMode: RefillSendsApprovalMode;
1397
+ campaignId: string | null;
1398
+ tableId: string | null;
1399
+ reportingContext: RefillReportingContextV2 | null;
1400
+ messageTemplateRevision: MessageTemplateRevisionV1 | null;
1401
+ senderScope: string;
1402
+ senderSelectors: {
1403
+ senders: string[];
1404
+ senderIds: string[];
1405
+ senderNames: string[];
1406
+ };
1407
+ firstOperationalSteps: string[];
1408
+ approvalContract: string;
1409
+ hostExamples: {
1410
+ claude: string[];
1411
+ codex: string[];
1412
+ mcpTool: {
1413
+ name: string;
1414
+ arguments: {
1415
+ workspaceCoordinator?: boolean | undefined;
1416
+ messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
1417
+ reportingContext?: RefillReportingContextV2 | undefined;
1418
+ targetConfig?: RefillTargetConfigV1 | undefined;
1419
+ runHandle?: RefillRunHandleV1 | undefined;
1420
+ fence?: number | undefined;
1421
+ runId?: string | undefined;
1422
+ expectedActionKey?: string | undefined;
1423
+ expectedTargetShapeRevision?: string | undefined;
1424
+ targetDate: string | null;
1425
+ untilDate: string | null;
1426
+ horizonSendDays: number | null;
1427
+ campaignId: string | undefined;
1428
+ tableId: string | undefined;
1429
+ intent: RefillSendsIntent;
1430
+ approvalMode: RefillSendsApprovalMode;
1431
+ workspaceId: string | null;
1432
+ actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
1433
+ yolo: boolean;
1434
+ senders: string[];
1435
+ senderIds: string[];
1436
+ senderNames: string[];
1437
+ };
1438
+ };
1439
+ };
1440
+ actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
1441
+ command: string;
1442
+ tool: string;
1443
+ promptName: string;
1444
+ workflowPromptName: string;
1445
+ workflowAsset: {
1446
+ subskillName: string;
1447
+ assetPath: string;
1448
+ };
1449
+ yolo: boolean;
1450
+ executionMode: RefillSendsExecutionMode;
1451
+ workspaceId: string | null;
1452
+ workspaceResolution: string;
1453
+ intent: RefillSendsIntent;
1191
1454
  } | {
1192
1455
  ok: boolean;
1193
1456
  status: "blocked";
1194
- code: "workspace_exact_target_unavailable" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
1195
- blocker: "workspace_exact_target_unavailable" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
1457
+ code: "workspace_exact_target_unavailable" | "workspace_exact_target_ambiguous" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
1458
+ blocker: "workspace_exact_target_unavailable" | "workspace_exact_target_ambiguous" | "exact_target_config_unavailable" | "exact_target_config_mismatch" | "exact_target_projection_mismatch";
1196
1459
  note: string;
1197
1460
  targetPlan: unknown;
1198
1461
  exactTargetPlan: {} | null;
@@ -1219,6 +1482,7 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1219
1482
  conflicts?: undefined;
1220
1483
  };
1221
1484
  workspaceTargetPlan?: undefined;
1485
+ exactTargetPlan?: undefined;
1222
1486
  note?: undefined;
1223
1487
  };
1224
1488
  continuation: {
@@ -1349,6 +1613,7 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1349
1613
  conflicts?: undefined;
1350
1614
  };
1351
1615
  note: string;
1616
+ exactTargetPlan?: undefined;
1352
1617
  };
1353
1618
  continuation: {
1354
1619
  required: boolean;
@@ -1490,6 +1755,7 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1490
1755
  conflicts?: undefined;
1491
1756
  };
1492
1757
  workspaceTargetPlan?: undefined;
1758
+ exactTargetPlan?: undefined;
1493
1759
  note?: undefined;
1494
1760
  };
1495
1761
  continuation: {
@@ -1647,9 +1913,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1647
1913
  scope: string;
1648
1914
  status: string | undefined;
1649
1915
  selectedTarget: WorkspaceExactTarget | null;
1916
+ note?: undefined;
1650
1917
  completedTarget?: undefined;
1651
1918
  exactRunResult?: undefined;
1652
- note?: undefined;
1653
1919
  } | undefined;
1654
1920
  orchestration: {
1655
1921
  checkpointedFields: string[];
@@ -1796,9 +2062,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1796
2062
  scope: string;
1797
2063
  status: string | undefined;
1798
2064
  selectedTarget: WorkspaceExactTarget | null;
2065
+ note?: undefined;
1799
2066
  completedTarget?: undefined;
1800
2067
  exactRunResult?: undefined;
1801
- note?: undefined;
1802
2068
  } | undefined;
1803
2069
  orchestration: {
1804
2070
  checkpointedFields: string[];
@@ -1949,9 +2215,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
1949
2215
  scope: string;
1950
2216
  status: string | undefined;
1951
2217
  selectedTarget: WorkspaceExactTarget | null;
2218
+ note?: undefined;
1952
2219
  completedTarget?: undefined;
1953
2220
  exactRunResult?: undefined;
1954
- note?: undefined;
1955
2221
  } | undefined;
1956
2222
  orchestration: {
1957
2223
  checkpointedFields: string[];
@@ -2102,9 +2368,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
2102
2368
  scope: string;
2103
2369
  status: string | undefined;
2104
2370
  selectedTarget: WorkspaceExactTarget | null;
2371
+ note?: undefined;
2105
2372
  completedTarget?: undefined;
2106
2373
  exactRunResult?: undefined;
2107
- note?: undefined;
2108
2374
  } | undefined;
2109
2375
  orchestration: {
2110
2376
  checkpointedFields: string[];
@@ -2253,9 +2519,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
2253
2519
  scope: string;
2254
2520
  status: string | undefined;
2255
2521
  selectedTarget: WorkspaceExactTarget | null;
2522
+ note?: undefined;
2256
2523
  completedTarget?: undefined;
2257
2524
  exactRunResult?: undefined;
2258
- note?: undefined;
2259
2525
  } | undefined;
2260
2526
  orchestration: {
2261
2527
  checkpointedFields: string[];
@@ -2407,9 +2673,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
2407
2673
  scope: string;
2408
2674
  status: string | undefined;
2409
2675
  selectedTarget: WorkspaceExactTarget | null;
2676
+ note?: undefined;
2410
2677
  completedTarget?: undefined;
2411
2678
  exactRunResult?: undefined;
2412
- note?: undefined;
2413
2679
  } | undefined;
2414
2680
  orchestration: {
2415
2681
  checkpointedFields: string[];
@@ -2563,9 +2829,9 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
2563
2829
  scope: string;
2564
2830
  status: string | undefined;
2565
2831
  selectedTarget: WorkspaceExactTarget | null;
2832
+ note?: undefined;
2566
2833
  completedTarget?: undefined;
2567
2834
  exactRunResult?: undefined;
2568
- note?: undefined;
2569
2835
  } | undefined;
2570
2836
  orchestration: {
2571
2837
  checkpointedFields: string[];
@@ -529,15 +529,60 @@ function recordsWithExactTarget(value) {
529
529
  stringValue(candidate.tableId)))
530
530
  : [];
531
531
  }
532
- function workspaceExactTargetsFromAction(action) {
532
+ function workspaceExactActionSignature(action) {
533
+ const campaignId = actionCampaignId(action);
534
+ const tableId = actionTableId(action);
535
+ const actionKey = stringValue(action.actionKey);
536
+ const actionType = stringValue(action.actionType);
537
+ if (!campaignId || !tableId || !actionKey || !actionType)
538
+ return null;
539
+ return JSON.stringify([campaignId, tableId, actionKey, actionType]);
540
+ }
541
+ function workspaceAggregateActionSenderIds(workspacePlan) {
542
+ const target = yoloTarget(workspacePlan);
543
+ const senderPlans = Array.isArray(target?.senderRefillPlans)
544
+ ? target.senderRefillPlans
545
+ .map(recordValue)
546
+ .filter((plan) => Boolean(plan))
547
+ : [];
548
+ const senderIdsByAction = new Map();
549
+ for (const senderPlan of senderPlans) {
550
+ const senderId = stringValue(senderPlan.senderId);
551
+ const nextActions = Array.isArray(senderPlan.nextActions)
552
+ ? senderPlan.nextActions
553
+ .map(recordValue)
554
+ .filter((action) => Boolean(action))
555
+ : [];
556
+ if (!senderId)
557
+ continue;
558
+ for (const action of nextActions) {
559
+ const signature = workspaceExactActionSignature(action);
560
+ if (!signature)
561
+ continue;
562
+ const senderIds = senderIdsByAction.get(signature) ?? new Set();
563
+ senderIds.add(senderId);
564
+ senderIdsByAction.set(signature, senderIds);
565
+ }
566
+ }
567
+ return new Map([...senderIdsByAction.entries()]
568
+ .filter(([, senderIds]) => senderIds.size > 1)
569
+ .map(([signature, senderIds]) => [
570
+ signature,
571
+ [...senderIds],
572
+ ]));
573
+ }
574
+ function workspaceExactTargetsFromAction(action, aggregateSenderIdsByAction = new Map()) {
533
575
  const toolInput = recordValue(action.toolInput) ?? {};
576
+ const exactTargets = recordsWithExactTarget(toolInput.exactTargets);
534
577
  const expectedTargets = recordsWithExactTarget(toolInput.expectedTargets);
535
578
  const sourceScopes = recordsWithExactTarget(toolInput.sourceScopes);
536
- const exactEdges = expectedTargets.length > 0
537
- ? expectedTargets
538
- : sourceScopes.length > 0
539
- ? sourceScopes
540
- : [null];
579
+ const exactEdges = exactTargets.length > 0
580
+ ? exactTargets
581
+ : expectedTargets.length > 0
582
+ ? expectedTargets
583
+ : sourceScopes.length > 0
584
+ ? sourceScopes
585
+ : [null];
541
586
  const campaignIds = normalizeStrings(toolInput.campaignIds);
542
587
  const tableIds = normalizeStrings(toolInput.tableIds);
543
588
  return exactEdges.flatMap((exactEdge) => {
@@ -548,12 +593,26 @@ function workspaceExactTargetsFromAction(action) {
548
593
  if (!campaignId || !tableId)
549
594
  return [];
550
595
  const exactEdgeSenderIds = normalizeStrings(exactEdge?.senderIds);
551
- const senderId = stringValue(exactEdge?.senderId) ?? actionSenderId(action) ?? null;
552
- const senderIds = senderId
553
- ? [senderId]
554
- : exactEdgeSenderIds.length > 0
555
- ? exactEdgeSenderIds
556
- : normalizeStrings(toolInput.senderIds);
596
+ const exactEdgeSenderId = stringValue(exactEdge?.senderId);
597
+ const toolInputSenderIds = normalizeStrings(toolInput.senderIds);
598
+ const aggregateSenderIds = aggregateSenderIdsByAction.get(workspaceExactActionSignature(action) ?? "") ?? [];
599
+ const actionSenderIdValue = actionSenderId(action);
600
+ // Explicit edge/list scope is authoritative. Legacy shared campaign
601
+ // actions predate expectedTargets and can repeat the same representative
602
+ // sender action across several senderRefillPlans. Preserve that recovered
603
+ // member set instead of narrowing the exact coordinator to the complete
604
+ // representative sender and hiding another member's actionable gap.
605
+ const senderIds = exactEdgeSenderIds.length > 0
606
+ ? exactEdgeSenderIds
607
+ : exactEdgeSenderId
608
+ ? [exactEdgeSenderId]
609
+ : toolInputSenderIds.length > 0
610
+ ? toolInputSenderIds
611
+ : aggregateSenderIds.length > 0
612
+ ? aggregateSenderIds
613
+ : actionSenderIdValue
614
+ ? [actionSenderIdValue]
615
+ : [];
557
616
  const directActionType = stringValue(exactEdge?.actionType) ??
558
617
  stringValue(exactEdge?.refillLaneKey) ??
559
618
  stringValue(action.actionType);
@@ -665,7 +724,34 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
665
724
  .filter((action) => Boolean(action))
666
725
  : [];
667
726
  const workspaceActions = [...globalActions, ...rankedCandidates];
668
- const actionTargets = workspaceActions.flatMap(workspaceExactTargetsFromAction);
727
+ const aggregateSenderIdsByAction = workspaceAggregateActionSenderIds(workspacePlan);
728
+ const legacyGlobalActionCounts = new Map();
729
+ for (const action of globalActions) {
730
+ const signature = workspaceExactActionSignature(action);
731
+ if (!signature)
732
+ continue;
733
+ legacyGlobalActionCounts.set(signature, (legacyGlobalActionCounts.get(signature) ?? 0) + 1);
734
+ }
735
+ const ambiguousLegacyAction = globalActions.find((action) => {
736
+ const signature = workspaceExactActionSignature(action);
737
+ if (!signature || (legacyGlobalActionCounts.get(signature) ?? 0) < 2) {
738
+ return false;
739
+ }
740
+ const toolInput = recordValue(action.toolInput) ?? {};
741
+ const hasExplicitTargets = recordsWithExactTarget(toolInput.exactTargets).length > 0 ||
742
+ recordsWithExactTarget(toolInput.expectedTargets).length > 0 ||
743
+ recordsWithExactTarget(toolInput.sourceScopes).length > 0;
744
+ return !hasExplicitTargets && !aggregateSenderIdsByAction.has(signature);
745
+ });
746
+ if (ambiguousLegacyAction) {
747
+ return {
748
+ status: "blocked",
749
+ code: "workspace_exact_target_ambiguous",
750
+ note: "The workspace planner repeated one legacy aggregate action without explicit exact targets or recoverable sender membership. No refill run or mutation was started.",
751
+ workspacePlan,
752
+ };
753
+ }
754
+ const actionTargets = workspaceActions.flatMap((action) => workspaceExactTargetsFromAction(action, aggregateSenderIdsByAction));
669
755
  const evergreenTargets = evergreenExactTargetCandidates(workspacePlan, {
670
756
  preferredSenderId: options.preferredSenderId,
671
757
  actionTypes: input.actionTypes,
@@ -691,6 +777,9 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
691
777
  };
692
778
  }
693
779
  let completedExactTargetCount = 0;
780
+ let schedulerLoadedExactTargetCount = 0;
781
+ let lastSchedulerLoadedTarget = null;
782
+ let lastSchedulerLoadedPlan = null;
694
783
  for (const selectedTarget of targetCandidates) {
695
784
  const exactInput = {
696
785
  ...workspaceInput,
@@ -708,6 +797,12 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
708
797
  completedExactTargetCount += 1;
709
798
  continue;
710
799
  }
800
+ if (yoloPlanIsSchedulerLoaded(exactTargetPlan)) {
801
+ schedulerLoadedExactTargetCount += 1;
802
+ lastSchedulerLoadedTarget = selectedTarget;
803
+ lastSchedulerLoadedPlan = exactTargetPlan;
804
+ continue;
805
+ }
711
806
  let targetConfig;
712
807
  try {
713
808
  targetConfig = normalizeRefillTargetConfig(recordValue(exactTargetPlan)?.targetConfig);
@@ -753,6 +848,15 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
753
848
  targetConfig,
754
849
  };
755
850
  }
851
+ if (lastSchedulerLoadedTarget && lastSchedulerLoadedPlan) {
852
+ return {
853
+ status: "awaiting_scheduler",
854
+ note: `All exposed exact targets were already complete or scheduler-loaded; ${schedulerLoadedExactTargetCount} exact targets have enough ready inventory to cover their projected gaps. No identical refill fence was reopened.`,
855
+ workspacePlan,
856
+ exactTargetPlan: lastSchedulerLoadedPlan,
857
+ selectedTarget: lastSchedulerLoadedTarget,
858
+ };
859
+ }
756
860
  return {
757
861
  status: "blocked",
758
862
  code: "workspace_exact_target_unavailable",
@@ -781,6 +885,16 @@ function yoloPlanIsComplete(plan) {
781
885
  coverage.grossTarget > 0 &&
782
886
  coverage.remainingProjectedGap === 0));
783
887
  }
888
+ function yoloPlanIsSchedulerLoaded(plan) {
889
+ const coverage = yoloCoverage(plan);
890
+ return (coverage.status === "awaiting_scheduler_after_ready_buffer" ||
891
+ (coverage.status !== "blocked" &&
892
+ typeof coverage.grossTarget === "number" &&
893
+ coverage.grossTarget > 0 &&
894
+ typeof coverage.remainingProjectedGap === "number" &&
895
+ coverage.remainingProjectedGap > 0 &&
896
+ coverage.remainingReadyOrProjectedGap === 0));
897
+ }
784
898
  function workspaceConnectivityEmptyState(plan) {
785
899
  const target = yoloTarget(plan);
786
900
  const emptyState = recordValue(target?.emptyState);
@@ -1550,6 +1664,41 @@ export async function executeRefillSendsCommand(input = {}) {
1550
1664
  },
1551
1665
  };
1552
1666
  }
1667
+ if (coordinatorSelection.status === "awaiting_scheduler") {
1668
+ return {
1669
+ ...command,
1670
+ status: "terminal",
1671
+ doneReason: "loaded_awaiting_scheduler",
1672
+ note: coordinatorSelection.note,
1673
+ targetPlan: coordinatorSelection.workspacePlan,
1674
+ exactTargetPlan: coordinatorSelection.exactTargetPlan,
1675
+ orchestration: {
1676
+ mode: "fenced_bounded_yolo",
1677
+ scope: "workspace_exact_target_coordinator",
1678
+ checkpointedFields: [
1679
+ "runId",
1680
+ "fence",
1681
+ "runState",
1682
+ "actionKey",
1683
+ "requestId",
1684
+ "effectId",
1685
+ ],
1686
+ transportBudgetMs: 40_000,
1687
+ },
1688
+ coordinator: {
1689
+ scope: "workspace",
1690
+ status: "loaded_awaiting_scheduler",
1691
+ selectedTarget: coordinatorSelection.selectedTarget,
1692
+ workspaceTargetPlan: coordinatorSelection.workspacePlan,
1693
+ exactTargetPlan: coordinatorSelection.exactTargetPlan,
1694
+ note: coordinatorSelection.note,
1695
+ },
1696
+ continuation: {
1697
+ required: false,
1698
+ userActionRequired: false,
1699
+ },
1700
+ };
1701
+ }
1553
1702
  if (coordinatorSelection.status === "blocked") {
1554
1703
  return {
1555
1704
  ...command,
@@ -1774,6 +1923,44 @@ export async function executeRefillSendsCommand(input = {}) {
1774
1923
  },
1775
1924
  };
1776
1925
  }
1926
+ if (nextSelection.status === "awaiting_scheduler") {
1927
+ return {
1928
+ ...command,
1929
+ ...result,
1930
+ status: "terminal",
1931
+ doneReason: "loaded_awaiting_scheduler",
1932
+ note: nextSelection.note,
1933
+ targetPlan: nextSelection.workspacePlan,
1934
+ exactTargetPlan: nextSelection.exactTargetPlan,
1935
+ orchestration: {
1936
+ mode: "fenced_bounded_yolo",
1937
+ scope: "workspace_exact_target_coordinator",
1938
+ checkpointedFields: [
1939
+ "runId",
1940
+ "fence",
1941
+ "runState",
1942
+ "actionKey",
1943
+ "requestId",
1944
+ "effectId",
1945
+ ],
1946
+ transportBudgetMs: 40_000,
1947
+ },
1948
+ coordinator: {
1949
+ scope: "workspace",
1950
+ status: "loaded_awaiting_scheduler",
1951
+ completedTarget: selectedCoordinatorTarget,
1952
+ selectedTarget: nextSelection.selectedTarget,
1953
+ workspaceTargetPlan: nextSelection.workspacePlan,
1954
+ exactTargetPlan: nextSelection.exactTargetPlan,
1955
+ exactRunResult: result,
1956
+ note: nextSelection.note,
1957
+ },
1958
+ continuation: {
1959
+ required: false,
1960
+ userActionRequired: false,
1961
+ },
1962
+ };
1963
+ }
1777
1964
  if (nextSelection.status === "blocked") {
1778
1965
  return {
1779
1966
  ...command,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.641",
3
+ "version": "0.1.643",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code, Codex, and Hermes campaign workflows",
6
6
  "main": "dist/index.js",