@sellable/mcp 0.1.725 → 0.1.727

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.
@@ -682,6 +682,22 @@ export declare function approvedPacketComparison(input: RefillSendsCommandInput,
682
682
  shapeChanged: boolean;
683
683
  actionChanged: boolean;
684
684
  };
685
+ type ApproveDriftSettleResult = {
686
+ resolved: "proceed";
687
+ plan: unknown;
688
+ actionKey: string | null;
689
+ } | {
690
+ resolved: "terminal";
691
+ plan: unknown;
692
+ comparison: ReturnType<typeof approvedPacketComparison>;
693
+ };
694
+ export declare function settleApprovedApproveDrift(params: {
695
+ input: RefillSendsCommandInput;
696
+ plan: unknown;
697
+ comparison: ReturnType<typeof approvedPacketComparison>;
698
+ delayMs?: number;
699
+ maxReads?: number;
700
+ }): Promise<ApproveDriftSettleResult>;
685
701
  type RefillSenderSelectorMatch = {
686
702
  selector: string;
687
703
  senderId: string;
@@ -3127,117 +3143,6 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
3127
3143
  workspaceResolution: string;
3128
3144
  intent: RefillSendsIntent;
3129
3145
  } | {
3130
- status: "blocked";
3131
- blocker: string;
3132
- guidance: string;
3133
- conflicts: string[];
3134
- runId: string | undefined;
3135
- readOnly: boolean;
3136
- forbiddenActions: string[];
3137
- boundedAuthority: string;
3138
- ok: boolean;
3139
- targetDate: string | null;
3140
- untilDate: string | null;
3141
- horizonSendDays: number | null;
3142
- fillWindow: {
3143
- mode: string;
3144
- targetDate: string;
3145
- description: string;
3146
- untilDate?: undefined;
3147
- horizonSendDays?: undefined;
3148
- horizonHours?: undefined;
3149
- } | {
3150
- mode: string;
3151
- untilDate: string;
3152
- description: string;
3153
- targetDate?: undefined;
3154
- horizonSendDays?: undefined;
3155
- horizonHours?: undefined;
3156
- } | {
3157
- mode: string;
3158
- horizonSendDays: number | null;
3159
- horizonHours: number | null;
3160
- description: string;
3161
- targetDate?: undefined;
3162
- untilDate?: undefined;
3163
- };
3164
- approvalMode: RefillSendsApprovalMode;
3165
- campaignId: string | null;
3166
- tableId: string | null;
3167
- targetConfig: RefillTargetConfigV1 | null;
3168
- runHandle: RefillRunHandleV1 | null;
3169
- reportingContext: RefillReportingContextV2 | null;
3170
- messageTemplateRevision: MessageTemplateRevisionV1 | null;
3171
- senderScope: string;
3172
- senderSelectors: {
3173
- senders: string[];
3174
- senderIds: string[];
3175
- senderNames: string[];
3176
- };
3177
- firstOperationalSteps: string[];
3178
- approvalContract: string;
3179
- hostExamples: {
3180
- claude: string[];
3181
- codex: string[];
3182
- mcpTool: {
3183
- name: string;
3184
- arguments: {
3185
- workspaceRunState?: Record<string, unknown> | undefined;
3186
- workspaceCoordinator?: boolean | undefined;
3187
- messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
3188
- reportingContext?: RefillReportingContextV2 | undefined;
3189
- targetConfig?: RefillTargetConfigV1 | undefined;
3190
- runHandle?: RefillRunHandleV1 | undefined;
3191
- fence?: number | undefined;
3192
- runId?: string | undefined;
3193
- expectedActionKey?: string | undefined;
3194
- expectedTargetShapeRevision?: string | undefined;
3195
- targetDate: string | null;
3196
- untilDate: string | null;
3197
- horizonSendDays: number | null;
3198
- campaignId: string | undefined;
3199
- tableId: string | undefined;
3200
- intent: RefillSendsIntent;
3201
- approvalMode: RefillSendsApprovalMode;
3202
- workspaceId: string | null;
3203
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3204
- yolo: boolean;
3205
- senders: string[];
3206
- senderIds: string[];
3207
- senderNames: string[];
3208
- };
3209
- };
3210
- };
3211
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3212
- command: string;
3213
- tool: string;
3214
- promptName: string;
3215
- workflowPromptName: string;
3216
- workflowAsset: {
3217
- subskillName: string;
3218
- assetPath: string;
3219
- expectedVersion: string;
3220
- };
3221
- yolo: boolean;
3222
- executionMode: RefillSendsExecutionMode;
3223
- workspaceId: string | null;
3224
- workspaceResolution: string;
3225
- intent: RefillSendsIntent;
3226
- } | {
3227
- readOnly: boolean;
3228
- mode: string;
3229
- forbiddenActions: string[];
3230
- boundedAuthority: string;
3231
- blocker: string;
3232
- workspaceId: string;
3233
- guidance: string;
3234
- warnings: string[];
3235
- journalPath: string | null;
3236
- text: string;
3237
- workspaceResolution: string;
3238
- status?: undefined;
3239
- conflicts?: undefined;
3240
- runId?: undefined;
3241
3146
  ok: boolean;
3242
3147
  targetDate: string | null;
3243
3148
  untilDate: string | null;
@@ -3279,513 +3184,7 @@ export declare function executeRefillSendsCommand(input?: RefillSendsCommandInpu
3279
3184
  };
3280
3185
  firstOperationalSteps: string[];
3281
3186
  approvalContract: string;
3282
- hostExamples: {
3283
- claude: string[];
3284
- codex: string[];
3285
- mcpTool: {
3286
- name: string;
3287
- arguments: {
3288
- workspaceRunState?: Record<string, unknown> | undefined;
3289
- workspaceCoordinator?: boolean | undefined;
3290
- messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
3291
- reportingContext?: RefillReportingContextV2 | undefined;
3292
- targetConfig?: RefillTargetConfigV1 | undefined;
3293
- runHandle?: RefillRunHandleV1 | undefined;
3294
- fence?: number | undefined;
3295
- runId?: string | undefined;
3296
- expectedActionKey?: string | undefined;
3297
- expectedTargetShapeRevision?: string | undefined;
3298
- targetDate: string | null;
3299
- untilDate: string | null;
3300
- horizonSendDays: number | null;
3301
- campaignId: string | undefined;
3302
- tableId: string | undefined;
3303
- intent: RefillSendsIntent;
3304
- approvalMode: RefillSendsApprovalMode;
3305
- workspaceId: string | null;
3306
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3307
- yolo: boolean;
3308
- senders: string[];
3309
- senderIds: string[];
3310
- senderNames: string[];
3311
- };
3312
- };
3313
- };
3314
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3315
- command: string;
3316
- tool: string;
3317
- promptName: string;
3318
- workflowPromptName: string;
3319
- workflowAsset: {
3320
- subskillName: string;
3321
- assetPath: string;
3322
- expectedVersion: string;
3323
- };
3324
- yolo: boolean;
3325
- executionMode: RefillSendsExecutionMode;
3326
- intent: RefillSendsIntent;
3327
- } | {
3328
- readOnly: boolean;
3329
- mode: string;
3330
3187
  forbiddenActions: string[];
3331
- boundedAuthority: string;
3332
- warnings: any[];
3333
- journalPath: string | null;
3334
- text: string;
3335
- workspaceId: string;
3336
- workspaceResolution: string;
3337
- blocker?: undefined;
3338
- guidance?: undefined;
3339
- status?: undefined;
3340
- conflicts?: undefined;
3341
- runId?: undefined;
3342
- ok: boolean;
3343
- targetDate: string | null;
3344
- untilDate: string | null;
3345
- horizonSendDays: number | null;
3346
- fillWindow: {
3347
- mode: string;
3348
- targetDate: string;
3349
- description: string;
3350
- untilDate?: undefined;
3351
- horizonSendDays?: undefined;
3352
- horizonHours?: undefined;
3353
- } | {
3354
- mode: string;
3355
- untilDate: string;
3356
- description: string;
3357
- targetDate?: undefined;
3358
- horizonSendDays?: undefined;
3359
- horizonHours?: undefined;
3360
- } | {
3361
- mode: string;
3362
- horizonSendDays: number | null;
3363
- horizonHours: number | null;
3364
- description: string;
3365
- targetDate?: undefined;
3366
- untilDate?: undefined;
3367
- };
3368
- approvalMode: RefillSendsApprovalMode;
3369
- campaignId: string | null;
3370
- tableId: string | null;
3371
- targetConfig: RefillTargetConfigV1 | null;
3372
- runHandle: RefillRunHandleV1 | null;
3373
- reportingContext: RefillReportingContextV2 | null;
3374
- messageTemplateRevision: MessageTemplateRevisionV1 | null;
3375
- senderScope: string;
3376
- senderSelectors: {
3377
- senders: string[];
3378
- senderIds: string[];
3379
- senderNames: string[];
3380
- };
3381
- firstOperationalSteps: string[];
3382
- approvalContract: string;
3383
- hostExamples: {
3384
- claude: string[];
3385
- codex: string[];
3386
- mcpTool: {
3387
- name: string;
3388
- arguments: {
3389
- workspaceRunState?: Record<string, unknown> | undefined;
3390
- workspaceCoordinator?: boolean | undefined;
3391
- messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
3392
- reportingContext?: RefillReportingContextV2 | undefined;
3393
- targetConfig?: RefillTargetConfigV1 | undefined;
3394
- runHandle?: RefillRunHandleV1 | undefined;
3395
- fence?: number | undefined;
3396
- runId?: string | undefined;
3397
- expectedActionKey?: string | undefined;
3398
- expectedTargetShapeRevision?: string | undefined;
3399
- targetDate: string | null;
3400
- untilDate: string | null;
3401
- horizonSendDays: number | null;
3402
- campaignId: string | undefined;
3403
- tableId: string | undefined;
3404
- intent: RefillSendsIntent;
3405
- approvalMode: RefillSendsApprovalMode;
3406
- workspaceId: string | null;
3407
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3408
- yolo: boolean;
3409
- senders: string[];
3410
- senderIds: string[];
3411
- senderNames: string[];
3412
- };
3413
- };
3414
- };
3415
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3416
- command: string;
3417
- tool: string;
3418
- promptName: string;
3419
- workflowPromptName: string;
3420
- workflowAsset: {
3421
- subskillName: string;
3422
- assetPath: string;
3423
- expectedVersion: string;
3424
- };
3425
- yolo: boolean;
3426
- executionMode: RefillSendsExecutionMode;
3427
- intent: RefillSendsIntent;
3428
- } | {
3429
- runSnapshot: unknown;
3430
- readOnly: boolean;
3431
- forbiddenActions: string[];
3432
- boundedAuthority: string;
3433
- status: "dry_run";
3434
- plan: Record<string, unknown>;
3435
- blocker?: undefined;
3436
- guidance?: undefined;
3437
- conflicts?: undefined;
3438
- runId?: undefined;
3439
- ok: boolean;
3440
- targetDate: string | null;
3441
- untilDate: string | null;
3442
- horizonSendDays: number | null;
3443
- fillWindow: {
3444
- mode: string;
3445
- targetDate: string;
3446
- description: string;
3447
- untilDate?: undefined;
3448
- horizonSendDays?: undefined;
3449
- horizonHours?: undefined;
3450
- } | {
3451
- mode: string;
3452
- untilDate: string;
3453
- description: string;
3454
- targetDate?: undefined;
3455
- horizonSendDays?: undefined;
3456
- horizonHours?: undefined;
3457
- } | {
3458
- mode: string;
3459
- horizonSendDays: number | null;
3460
- horizonHours: number | null;
3461
- description: string;
3462
- targetDate?: undefined;
3463
- untilDate?: undefined;
3464
- };
3465
- approvalMode: RefillSendsApprovalMode;
3466
- campaignId: string | null;
3467
- tableId: string | null;
3468
- targetConfig: RefillTargetConfigV1 | null;
3469
- runHandle: RefillRunHandleV1 | null;
3470
- reportingContext: RefillReportingContextV2 | null;
3471
- messageTemplateRevision: MessageTemplateRevisionV1 | null;
3472
- senderScope: string;
3473
- senderSelectors: {
3474
- senders: string[];
3475
- senderIds: string[];
3476
- senderNames: string[];
3477
- };
3478
- firstOperationalSteps: string[];
3479
- approvalContract: string;
3480
- hostExamples: {
3481
- claude: string[];
3482
- codex: string[];
3483
- mcpTool: {
3484
- name: string;
3485
- arguments: {
3486
- workspaceRunState?: Record<string, unknown> | undefined;
3487
- workspaceCoordinator?: boolean | undefined;
3488
- messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
3489
- reportingContext?: RefillReportingContextV2 | undefined;
3490
- targetConfig?: RefillTargetConfigV1 | undefined;
3491
- runHandle?: RefillRunHandleV1 | undefined;
3492
- fence?: number | undefined;
3493
- runId?: string | undefined;
3494
- expectedActionKey?: string | undefined;
3495
- expectedTargetShapeRevision?: string | undefined;
3496
- targetDate: string | null;
3497
- untilDate: string | null;
3498
- horizonSendDays: number | null;
3499
- campaignId: string | undefined;
3500
- tableId: string | undefined;
3501
- intent: RefillSendsIntent;
3502
- approvalMode: RefillSendsApprovalMode;
3503
- workspaceId: string | null;
3504
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3505
- yolo: boolean;
3506
- senders: string[];
3507
- senderIds: string[];
3508
- senderNames: string[];
3509
- };
3510
- };
3511
- };
3512
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3513
- command: string;
3514
- tool: string;
3515
- promptName: string;
3516
- workflowPromptName: string;
3517
- workflowAsset: {
3518
- subskillName: string;
3519
- assetPath: string;
3520
- expectedVersion: string;
3521
- };
3522
- yolo: boolean;
3523
- executionMode: RefillSendsExecutionMode;
3524
- workspaceId: string | null;
3525
- workspaceResolution: string;
3526
- intent: RefillSendsIntent;
3527
- } | {
3528
- runSnapshot: unknown;
3529
- readOnly: boolean;
3530
- forbiddenActions: string[];
3531
- boundedAuthority: string;
3532
- status: "in_progress";
3533
- runId: string;
3534
- fence: number;
3535
- gate: import("../refill-run-loop.js").RefillLoopGate;
3536
- guidance: string;
3537
- journalPath?: string | null;
3538
- targetConfig: RefillTargetConfigV1 | null;
3539
- runHandle: RefillRunHandleV1 | null;
3540
- refillReporting?: Record<string, unknown>;
3541
- blocker?: undefined;
3542
- conflicts?: undefined;
3543
- ok: boolean;
3544
- targetDate: string | null;
3545
- untilDate: string | null;
3546
- horizonSendDays: number | null;
3547
- fillWindow: {
3548
- mode: string;
3549
- targetDate: string;
3550
- description: string;
3551
- untilDate?: undefined;
3552
- horizonSendDays?: undefined;
3553
- horizonHours?: undefined;
3554
- } | {
3555
- mode: string;
3556
- untilDate: string;
3557
- description: string;
3558
- targetDate?: undefined;
3559
- horizonSendDays?: undefined;
3560
- horizonHours?: undefined;
3561
- } | {
3562
- mode: string;
3563
- horizonSendDays: number | null;
3564
- horizonHours: number | null;
3565
- description: string;
3566
- targetDate?: undefined;
3567
- untilDate?: undefined;
3568
- };
3569
- approvalMode: RefillSendsApprovalMode;
3570
- campaignId: string | null;
3571
- tableId: string | null;
3572
- reportingContext: RefillReportingContextV2 | null;
3573
- messageTemplateRevision: MessageTemplateRevisionV1 | null;
3574
- senderScope: string;
3575
- senderSelectors: {
3576
- senders: string[];
3577
- senderIds: string[];
3578
- senderNames: string[];
3579
- };
3580
- firstOperationalSteps: string[];
3581
- approvalContract: string;
3582
- hostExamples: {
3583
- claude: string[];
3584
- codex: string[];
3585
- mcpTool: {
3586
- name: string;
3587
- arguments: {
3588
- workspaceRunState?: Record<string, unknown> | undefined;
3589
- workspaceCoordinator?: boolean | undefined;
3590
- messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
3591
- reportingContext?: RefillReportingContextV2 | undefined;
3592
- targetConfig?: RefillTargetConfigV1 | undefined;
3593
- runHandle?: RefillRunHandleV1 | undefined;
3594
- fence?: number | undefined;
3595
- runId?: string | undefined;
3596
- expectedActionKey?: string | undefined;
3597
- expectedTargetShapeRevision?: string | undefined;
3598
- targetDate: string | null;
3599
- untilDate: string | null;
3600
- horizonSendDays: number | null;
3601
- campaignId: string | undefined;
3602
- tableId: string | undefined;
3603
- intent: RefillSendsIntent;
3604
- approvalMode: RefillSendsApprovalMode;
3605
- workspaceId: string | null;
3606
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3607
- yolo: boolean;
3608
- senders: string[];
3609
- senderIds: string[];
3610
- senderNames: string[];
3611
- };
3612
- };
3613
- };
3614
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3615
- command: string;
3616
- tool: string;
3617
- promptName: string;
3618
- workflowPromptName: string;
3619
- workflowAsset: {
3620
- subskillName: string;
3621
- assetPath: string;
3622
- expectedVersion: string;
3623
- };
3624
- yolo: boolean;
3625
- executionMode: RefillSendsExecutionMode;
3626
- workspaceId: string | null;
3627
- workspaceResolution: string;
3628
- intent: RefillSendsIntent;
3629
- } | {
3630
- runSnapshot: unknown;
3631
- readOnly: boolean;
3632
- forbiddenActions: string[];
3633
- boundedAuthority: string;
3634
- status: "blocked";
3635
- blocker: string;
3636
- runId?: string;
3637
- fence?: number;
3638
- gate?: import("../refill-run-loop.js").RefillLoopGate;
3639
- guidance: string;
3640
- holderRunId?: string;
3641
- report?: Record<string, unknown>;
3642
- journalPath?: string | null;
3643
- targetConfig: RefillTargetConfigV1 | null;
3644
- runHandle: RefillRunHandleV1 | null;
3645
- refillReporting?: Record<string, unknown>;
3646
- conflicts?: undefined;
3647
- ok: boolean;
3648
- targetDate: string | null;
3649
- untilDate: string | null;
3650
- horizonSendDays: number | null;
3651
- fillWindow: {
3652
- mode: string;
3653
- targetDate: string;
3654
- description: string;
3655
- untilDate?: undefined;
3656
- horizonSendDays?: undefined;
3657
- horizonHours?: undefined;
3658
- } | {
3659
- mode: string;
3660
- untilDate: string;
3661
- description: string;
3662
- targetDate?: undefined;
3663
- horizonSendDays?: undefined;
3664
- horizonHours?: undefined;
3665
- } | {
3666
- mode: string;
3667
- horizonSendDays: number | null;
3668
- horizonHours: number | null;
3669
- description: string;
3670
- targetDate?: undefined;
3671
- untilDate?: undefined;
3672
- };
3673
- approvalMode: RefillSendsApprovalMode;
3674
- campaignId: string | null;
3675
- tableId: string | null;
3676
- reportingContext: RefillReportingContextV2 | null;
3677
- messageTemplateRevision: MessageTemplateRevisionV1 | null;
3678
- senderScope: string;
3679
- senderSelectors: {
3680
- senders: string[];
3681
- senderIds: string[];
3682
- senderNames: string[];
3683
- };
3684
- firstOperationalSteps: string[];
3685
- approvalContract: string;
3686
- hostExamples: {
3687
- claude: string[];
3688
- codex: string[];
3689
- mcpTool: {
3690
- name: string;
3691
- arguments: {
3692
- workspaceRunState?: Record<string, unknown> | undefined;
3693
- workspaceCoordinator?: boolean | undefined;
3694
- messageTemplateRevision?: MessageTemplateRevisionV1 | undefined;
3695
- reportingContext?: RefillReportingContextV2 | undefined;
3696
- targetConfig?: RefillTargetConfigV1 | undefined;
3697
- runHandle?: RefillRunHandleV1 | undefined;
3698
- fence?: number | undefined;
3699
- runId?: string | undefined;
3700
- expectedActionKey?: string | undefined;
3701
- expectedTargetShapeRevision?: string | undefined;
3702
- targetDate: string | null;
3703
- untilDate: string | null;
3704
- horizonSendDays: number | null;
3705
- campaignId: string | undefined;
3706
- tableId: string | undefined;
3707
- intent: RefillSendsIntent;
3708
- approvalMode: RefillSendsApprovalMode;
3709
- workspaceId: string | null;
3710
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3711
- yolo: boolean;
3712
- senders: string[];
3713
- senderIds: string[];
3714
- senderNames: string[];
3715
- };
3716
- };
3717
- };
3718
- actionTypes?: ("send_invite" | "send_inmail_closed")[] | undefined;
3719
- command: string;
3720
- tool: string;
3721
- promptName: string;
3722
- workflowPromptName: string;
3723
- workflowAsset: {
3724
- subskillName: string;
3725
- assetPath: string;
3726
- expectedVersion: string;
3727
- };
3728
- yolo: boolean;
3729
- executionMode: RefillSendsExecutionMode;
3730
- workspaceId: string | null;
3731
- workspaceResolution: string;
3732
- intent: RefillSendsIntent;
3733
- } | {
3734
- runSnapshot: unknown;
3735
- readOnly: boolean;
3736
- forbiddenActions: string[];
3737
- boundedAuthority: string;
3738
- status: "terminal";
3739
- doneReason: string;
3740
- report: Record<string, unknown>;
3741
- runId: string;
3742
- guidance?: string;
3743
- journalPath?: string | null;
3744
- targetConfig: RefillTargetConfigV1 | null;
3745
- runHandle: RefillRunHandleV1 | null;
3746
- refillReporting?: Record<string, unknown>;
3747
- runState?: Record<string, unknown>;
3748
- blocker?: undefined;
3749
- conflicts?: undefined;
3750
- ok: boolean;
3751
- targetDate: string | null;
3752
- untilDate: string | null;
3753
- horizonSendDays: number | null;
3754
- fillWindow: {
3755
- mode: string;
3756
- targetDate: string;
3757
- description: string;
3758
- untilDate?: undefined;
3759
- horizonSendDays?: undefined;
3760
- horizonHours?: undefined;
3761
- } | {
3762
- mode: string;
3763
- untilDate: string;
3764
- description: string;
3765
- targetDate?: undefined;
3766
- horizonSendDays?: undefined;
3767
- horizonHours?: undefined;
3768
- } | {
3769
- mode: string;
3770
- horizonSendDays: number | null;
3771
- horizonHours: number | null;
3772
- description: string;
3773
- targetDate?: undefined;
3774
- untilDate?: undefined;
3775
- };
3776
- approvalMode: RefillSendsApprovalMode;
3777
- campaignId: string | null;
3778
- tableId: string | null;
3779
- reportingContext: RefillReportingContextV2 | null;
3780
- messageTemplateRevision: MessageTemplateRevisionV1 | null;
3781
- senderScope: string;
3782
- senderSelectors: {
3783
- senders: string[];
3784
- senderIds: string[];
3785
- senderNames: string[];
3786
- };
3787
- firstOperationalSteps: string[];
3788
- approvalContract: string;
3789
3188
  hostExamples: {
3790
3189
  claude: string[];
3791
3190
  codex: string[];
@@ -736,6 +736,60 @@ function workspaceCoordinatorInput(input) {
736
736
  delete coordinatorInput.backgroundWait;
737
737
  return coordinatorInput;
738
738
  }
739
+ // fix(112ad): the agent-keywords broaden handoff template must carry the COMPLETE
740
+ // original invocation surface, not just the fence handle + campaign/table that
741
+ // 0b680f407 added. The run loop renders a minimal argumentsTemplate (workspaceId,
742
+ // runId, fence, campaignId, tableId, agentKeywords); without the window
743
+ // (targetDate/untilDate/horizonSendDays), the lane (actionTypes/approvalMode/
744
+ // intent), and the coordinator envelope (executionMode/workspaceCoordinator/
745
+ // workspaceRunState), the agent's filled re-invocation defaults targetDate=null ->
746
+ // fillWindow scheduler_forward_48h -> the re-rendered authority mismatches the
747
+ // fenced targetConfig -> approval_scope_changed with no safe continuation (Clover
748
+ // 7-29, calls 10-11). Merge the coordinator envelope UNDER the base template so the
749
+ // fence handle + exact target win and the missing scope fields are filled — the
750
+ // identical continuation contract every other coordinator handoff carries.
751
+ function withKeywordsHandoffScope(result, scopedInput) {
752
+ const report = recordValue(result.report);
753
+ const continuation = report ? recordValue(report.continuation) : null;
754
+ const template = continuation
755
+ ? recordValue(continuation.argumentsTemplate)
756
+ : null;
757
+ if (!report || !continuation || !template)
758
+ return result;
759
+ const scopeAdditions = {
760
+ ...(scopedInput.targetDate ? { targetDate: scopedInput.targetDate } : {}),
761
+ ...(scopedInput.untilDate ? { untilDate: scopedInput.untilDate } : {}),
762
+ ...(typeof scopedInput.horizonSendDays === "number"
763
+ ? { horizonSendDays: scopedInput.horizonSendDays }
764
+ : {}),
765
+ ...(scopedInput.actionTypes
766
+ ? { actionTypes: scopedInput.actionTypes }
767
+ : {}),
768
+ ...(scopedInput.approvalMode
769
+ ? { approvalMode: scopedInput.approvalMode }
770
+ : {}),
771
+ ...(scopedInput.intent ? { intent: scopedInput.intent } : {}),
772
+ ...(scopedInput.executionMode
773
+ ? { executionMode: scopedInput.executionMode }
774
+ : {}),
775
+ ...(scopedInput.workspaceCoordinator === true
776
+ ? { workspaceCoordinator: true }
777
+ : {}),
778
+ ...(scopedInput.workspaceRunState
779
+ ? { workspaceRunState: scopedInput.workspaceRunState }
780
+ : {}),
781
+ };
782
+ return {
783
+ ...result,
784
+ report: {
785
+ ...report,
786
+ continuation: {
787
+ ...continuation,
788
+ argumentsTemplate: { ...scopeAdditions, ...template },
789
+ },
790
+ },
791
+ };
792
+ }
739
793
  const BACKGROUND_WAIT_FAST_PATH_TTL_MS = 10 * 60 * 1000;
740
794
  const BACKGROUND_WAIT_MIN_RETRY_MS = 5_000;
741
795
  // Action families whose successful exact terminal means NEW ROWS landed on
@@ -2217,6 +2271,67 @@ export function approvedPacketComparison(input, targetPlan) {
2217
2271
  actionChanged,
2218
2272
  };
2219
2273
  }
2274
+ const APPROVE_DRIFT_SETTLE_MAX_READS = 3;
2275
+ const APPROVE_DRIFT_SETTLE_DELAY_MS = 4_000;
2276
+ // fix(112y): approve_messages is a MUTATION whose actionKey content-hashes the
2277
+ // bounded needsApproval cohort. While background prep workers land generated /
2278
+ // approved rows the cohort recomputes and the key drifts on every fresh read even
2279
+ // though the semantic scope (targetShapeRevision) is unchanged — Dotwork td7-27:
2280
+ // five consecutive reads drifted 0688fe33 -> 53269881 -> 9313b4b9 -> b75167a7 ->
2281
+ // e032b1e8 -> eb45f373 while targetShapeRevision stayed d5f6cb46 and prep job
2282
+ // cmrymi5on ran (activeCellCount 1). The approval fence three-struck a full host
2283
+ // rerun each time. Unlike the scheduler sweep (112q) we must NOT blanket re-pin a
2284
+ // drifting mutation key. Instead, when ONLY the approve key drifts (shape stable)
2285
+ // and prep workers are still active on the lane, settle-wait and re-read until two
2286
+ // consecutive reads agree or the workers drain, then re-pin the fresh stable key
2287
+ // and execute. A genuinely thrashing cohort still terminals honestly after the
2288
+ // bounded number of reads.
2289
+ export async function settleApprovedApproveDrift(params) {
2290
+ const { comparison } = params;
2291
+ const settleable = comparison.changed &&
2292
+ comparison.actionChanged &&
2293
+ !comparison.shapeChanged &&
2294
+ stringValue(firstGlobalAction(params.plan)?.type) === "approve_messages" &&
2295
+ activePrepJobWaitFallback(params.plan) !== null;
2296
+ if (!settleable) {
2297
+ return { resolved: "terminal", plan: params.plan, comparison };
2298
+ }
2299
+ const delayMs = params.delayMs ?? APPROVE_DRIFT_SETTLE_DELAY_MS;
2300
+ const maxReads = params.maxReads ?? APPROVE_DRIFT_SETTLE_MAX_READS;
2301
+ let lastKey = stringValue(firstGlobalAction(params.plan)?.actionKey) ?? null;
2302
+ let latestPlan = params.plan;
2303
+ for (let read = 0; read < maxReads; read += 1) {
2304
+ await waitForYoloReread(delayMs);
2305
+ const fresh = await getRefillTargetPlan(targetPlanInputFor(params.input));
2306
+ latestPlan = fresh;
2307
+ const freshHead = firstGlobalAction(fresh);
2308
+ const freshKey = stringValue(freshHead?.actionKey) ?? null;
2309
+ const freshShape = stringValue(recordValue(fresh)?.targetShapeRevision) ?? null;
2310
+ // A genuine scope change — the shape moved, or the head is no longer an
2311
+ // approve mutation — is a real terminal, not a settle case.
2312
+ if (stringValue(freshHead?.type) !== "approve_messages" ||
2313
+ freshShape !== comparison.actualTargetShapeRevision) {
2314
+ return {
2315
+ resolved: "terminal",
2316
+ plan: fresh,
2317
+ comparison: approvedPacketComparison(params.input, fresh),
2318
+ };
2319
+ }
2320
+ // Two consecutive reads agree, or the prep workers drained: the cohort is
2321
+ // stable, so re-pin the fresh key and let the approve mutation execute.
2322
+ if (freshKey === lastKey || activePrepJobWaitFallback(fresh) === null) {
2323
+ return { resolved: "proceed", plan: fresh, actionKey: freshKey };
2324
+ }
2325
+ lastKey = freshKey;
2326
+ }
2327
+ // Drift-strike bound reached while the cohort still thrashes under active prep
2328
+ // work: return the honest approval_scope_changed terminal on the latest read.
2329
+ return {
2330
+ resolved: "terminal",
2331
+ plan: latestPlan,
2332
+ comparison: approvedPacketComparison(params.input, latestPlan),
2333
+ };
2334
+ }
2220
2335
  function paidRefreshApprovalPacket(params) {
2221
2336
  const action = params.action.action ?? {};
2222
2337
  const ids = actionIds(action);
@@ -2735,32 +2850,46 @@ export async function executeRefillSendsCommand(input = {}) {
2735
2850
  coordinatorWorkspacePlanBeforeDispatch = await getRefillTargetPlan(targetPlanInputFor(workspaceCoordinatorInput(scopedInput)));
2736
2851
  const approvedPacket = approvedPacketComparison(scopedInput, coordinatorWorkspacePlanBeforeDispatch);
2737
2852
  if (approvedPacket.changed) {
2738
- return {
2739
- ...command,
2740
- ok: false,
2741
- code: "approval_scope_changed",
2742
- targetPlan: coordinatorWorkspacePlanBeforeDispatch,
2743
- targetPlanBeforePaidRefresh: null,
2744
- targetPlanBeforeYoloPrimitive: null,
2745
- ...approvedPacket,
2746
- autoPaidInmailRefresh: {
2747
- enabled: false,
2748
- status: "skipped_approval_scope_changed",
2749
- refreshedPaidInmailSenderIds: [],
2750
- failedPaidInmailRefreshes: [],
2751
- attemptedSenderIds: [],
2752
- targetPlanReread: false,
2753
- workspaceId,
2754
- workspaceResolution: "explicit",
2755
- note: "Approved refill scope changed before paid-credit refresh or primitive execution.",
2756
- },
2757
- yoloExecution: {
2758
- enabled: yolo,
2759
- status: "approval_scope_changed",
2760
- selectedAction: firstGlobalAction(coordinatorWorkspacePlanBeforeDispatch),
2761
- targetPlanReread: false,
2762
- },
2763
- };
2853
+ // fix(112y): a drifting approve mutation key on a stable shape with active
2854
+ // prep work is settle-waited and re-pinned instead of terminaling the
2855
+ // coordinator fence. This is the CR-Dotwork td7-27 path (workspace
2856
+ // coordinator, approve head, prep job cmrymi5on active).
2857
+ const settled = await settleApprovedApproveDrift({
2858
+ input: workspaceCoordinatorInput(scopedInput),
2859
+ plan: coordinatorWorkspacePlanBeforeDispatch,
2860
+ comparison: approvedPacket,
2861
+ });
2862
+ if (settled.resolved === "terminal") {
2863
+ return {
2864
+ ...command,
2865
+ ok: false,
2866
+ code: "approval_scope_changed",
2867
+ targetPlan: settled.plan,
2868
+ targetPlanBeforePaidRefresh: null,
2869
+ targetPlanBeforeYoloPrimitive: null,
2870
+ ...settled.comparison,
2871
+ autoPaidInmailRefresh: {
2872
+ enabled: false,
2873
+ status: "skipped_approval_scope_changed",
2874
+ refreshedPaidInmailSenderIds: [],
2875
+ failedPaidInmailRefreshes: [],
2876
+ attemptedSenderIds: [],
2877
+ targetPlanReread: false,
2878
+ workspaceId,
2879
+ workspaceResolution: "explicit",
2880
+ note: "Approved refill scope changed before paid-credit refresh or primitive execution.",
2881
+ },
2882
+ yoloExecution: {
2883
+ enabled: yolo,
2884
+ status: "approval_scope_changed",
2885
+ selectedAction: firstGlobalAction(settled.plan),
2886
+ targetPlanReread: false,
2887
+ },
2888
+ };
2889
+ }
2890
+ // Settled: the approve cohort stabilized (or prep workers drained), so
2891
+ // dispatch off the fresh re-pinned workspace plan.
2892
+ coordinatorWorkspacePlanBeforeDispatch = settled.plan;
2764
2893
  }
2765
2894
  }
2766
2895
  if (isWorkspaceCoordinator && !exactTargetConfig && !scopedInput.runId) {
@@ -3123,7 +3252,11 @@ export async function executeRefillSendsCommand(input = {}) {
3123
3252
  if ("blocker" in result &&
3124
3253
  stringValue(result.blocker) ===
3125
3254
  "agent_supplied_signal_keywords_required") {
3126
- return { ...command, ok: false, ...result };
3255
+ // fix(112ad): complete the handoff template with the original window + lane
3256
+ // + coordinator envelope so the agent's filled re-invocation re-renders the
3257
+ // SAME fenced target instead of defaulting to the scheduler-forward window.
3258
+ const scopedResult = withKeywordsHandoffScope(result, scopedInput);
3259
+ return { ...command, ok: false, ...scopedResult };
3127
3260
  }
3128
3261
  const continuationHandle = "status" in result &&
3129
3262
  result.status === "in_progress" &&
@@ -3722,35 +3855,47 @@ export async function executeRefillSendsCommand(input = {}) {
3722
3855
  };
3723
3856
  }
3724
3857
  const targetPlanInput = targetPlanInputFor(scopedInput);
3725
- const targetPlanBeforePaidRefresh = await getRefillTargetPlan(targetPlanInput);
3858
+ let targetPlanBeforePaidRefresh = await getRefillTargetPlan(targetPlanInput);
3726
3859
  const approvedPacket = approvedPacketComparison(scopedInput, targetPlanBeforePaidRefresh);
3727
3860
  if (approvedPacket.changed) {
3728
- return {
3729
- ...command,
3730
- ok: false,
3731
- code: "approval_scope_changed",
3732
- targetPlan: targetPlanBeforePaidRefresh,
3733
- targetPlanBeforePaidRefresh: null,
3734
- targetPlanBeforeYoloPrimitive: null,
3735
- ...approvedPacket,
3736
- autoPaidInmailRefresh: {
3737
- enabled: false,
3738
- status: "skipped_approval_scope_changed",
3739
- refreshedPaidInmailSenderIds: [],
3740
- failedPaidInmailRefreshes: [],
3741
- attemptedSenderIds: [],
3742
- targetPlanReread: false,
3743
- workspaceId,
3744
- workspaceResolution: workspaceId ? "explicit" : "active_config",
3745
- note: "Approved refill scope changed before paid-credit refresh or primitive execution.",
3746
- },
3747
- yoloExecution: {
3748
- enabled: yolo,
3749
- status: "approval_scope_changed",
3750
- selectedAction: firstGlobalAction(targetPlanBeforePaidRefresh),
3751
- targetPlanReread: false,
3752
- },
3753
- };
3861
+ // fix(112y): a drifting approve mutation key on a stable shape with active
3862
+ // prep work is settle-waited and re-pinned instead of terminaling the fence.
3863
+ const settled = await settleApprovedApproveDrift({
3864
+ input: scopedInput,
3865
+ plan: targetPlanBeforePaidRefresh,
3866
+ comparison: approvedPacket,
3867
+ });
3868
+ if (settled.resolved === "terminal") {
3869
+ return {
3870
+ ...command,
3871
+ ok: false,
3872
+ code: "approval_scope_changed",
3873
+ targetPlan: settled.plan,
3874
+ targetPlanBeforePaidRefresh: null,
3875
+ targetPlanBeforeYoloPrimitive: null,
3876
+ ...settled.comparison,
3877
+ autoPaidInmailRefresh: {
3878
+ enabled: false,
3879
+ status: "skipped_approval_scope_changed",
3880
+ refreshedPaidInmailSenderIds: [],
3881
+ failedPaidInmailRefreshes: [],
3882
+ attemptedSenderIds: [],
3883
+ targetPlanReread: false,
3884
+ workspaceId,
3885
+ workspaceResolution: workspaceId ? "explicit" : "active_config",
3886
+ note: "Approved refill scope changed before paid-credit refresh or primitive execution.",
3887
+ },
3888
+ yoloExecution: {
3889
+ enabled: yolo,
3890
+ status: "approval_scope_changed",
3891
+ selectedAction: firstGlobalAction(settled.plan),
3892
+ targetPlanReread: false,
3893
+ },
3894
+ };
3895
+ }
3896
+ // Settled: the approve cohort stabilized (or the prep workers drained), so
3897
+ // proceed on the fresh re-pinned plan.
3898
+ targetPlanBeforePaidRefresh = settled.plan;
3754
3899
  }
3755
3900
  const refreshActions = collectPaidInmailRefreshActions(targetPlanBeforePaidRefresh);
3756
3901
  const refreshedPaidInmailSenderIds = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.725",
3
+ "version": "0.1.727",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code, Codex, and Hermes campaign workflows",
6
6
  "main": "dist/index.js",