@sellable/mcp 0.1.635 → 0.1.637
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/refill-run-loop.js
CHANGED
|
@@ -412,6 +412,38 @@ function isLeaseLost(value) {
|
|
|
412
412
|
function isActiveRun(value) {
|
|
413
413
|
return hasBlocker(value, "active_run_in_progress");
|
|
414
414
|
}
|
|
415
|
+
function isTargetConfigDrift(value) {
|
|
416
|
+
return hasBlocker(value, "refill_target_config_drift");
|
|
417
|
+
}
|
|
418
|
+
function reconciledNarrowerUntilDateConfig(startResult, requested) {
|
|
419
|
+
const reconciliation = recordValue(startResult.reconciliation);
|
|
420
|
+
if (reconciliation?.version !== 1 ||
|
|
421
|
+
reconciliation.type !== "expired_narrower_until_date_run") {
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
let prior;
|
|
425
|
+
try {
|
|
426
|
+
prior = normalizeRefillTargetConfig(startResult.targetConfig);
|
|
427
|
+
}
|
|
428
|
+
catch {
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
const priorUntilDate = prior.targetWindow.untilDate;
|
|
432
|
+
const requestedUntilDate = requested.targetWindow.untilDate;
|
|
433
|
+
if (!priorUntilDate ||
|
|
434
|
+
!requestedUntilDate ||
|
|
435
|
+
priorUntilDate >= requestedUntilDate) {
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
const expandedPrior = {
|
|
439
|
+
...prior,
|
|
440
|
+
targetWindow: {
|
|
441
|
+
...prior.targetWindow,
|
|
442
|
+
untilDate: requestedUntilDate,
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
return safeJson(expandedPrior) === safeJson(requested) ? prior : null;
|
|
446
|
+
}
|
|
415
447
|
function actionToolInput(action) {
|
|
416
448
|
return recordValue(action.toolInput) ?? {};
|
|
417
449
|
}
|
|
@@ -1718,7 +1750,38 @@ async function startOrResume(input, deps) {
|
|
|
1718
1750
|
guidance: "A refill run is already active for this workspace. Use the original handle or wait for the lease TTL window before retrying takeover.",
|
|
1719
1751
|
};
|
|
1720
1752
|
}
|
|
1753
|
+
if (isTargetConfigDrift(started)) {
|
|
1754
|
+
return {
|
|
1755
|
+
status: "blocked",
|
|
1756
|
+
blocker: "refill_target_config_drift",
|
|
1757
|
+
guidance: "An existing refill run has a different immutable target. Wait for that run to terminalize or retry after its lease expires; unrelated target drift remains fail-closed.",
|
|
1758
|
+
report: {
|
|
1759
|
+
differingFields: Array.isArray(started.differingFields)
|
|
1760
|
+
? started.differingFields
|
|
1761
|
+
: [],
|
|
1762
|
+
},
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1721
1765
|
const result = started;
|
|
1766
|
+
let runTargetConfig = targetConfig;
|
|
1767
|
+
if (recordValue(result.reconciliation)) {
|
|
1768
|
+
if (!targetConfig) {
|
|
1769
|
+
return {
|
|
1770
|
+
status: "blocked",
|
|
1771
|
+
blocker: "stale_run_reconciliation_invalid",
|
|
1772
|
+
guidance: "The refill run route attempted stale-run reconciliation without an exact requested targetConfig.",
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1775
|
+
const reconciled = reconciledNarrowerUntilDateConfig(result, targetConfig);
|
|
1776
|
+
if (!reconciled) {
|
|
1777
|
+
return {
|
|
1778
|
+
status: "blocked",
|
|
1779
|
+
blocker: "stale_run_reconciliation_invalid",
|
|
1780
|
+
guidance: "The refill run route returned a stale target that is not an exact narrower untilDate subset of the requested target. Refusing to weaken target authority.",
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
runTargetConfig = reconciled;
|
|
1784
|
+
}
|
|
1722
1785
|
const runId = stringValue(result.runId);
|
|
1723
1786
|
const fence = numberValue(result.fence);
|
|
1724
1787
|
let runHandle = null;
|
|
@@ -1738,8 +1801,8 @@ async function startOrResume(input, deps) {
|
|
|
1738
1801
|
};
|
|
1739
1802
|
}
|
|
1740
1803
|
input.runHandle = runHandle;
|
|
1741
|
-
if (
|
|
1742
|
-
input.targetConfig =
|
|
1804
|
+
if (runTargetConfig)
|
|
1805
|
+
input.targetConfig = runTargetConfig;
|
|
1743
1806
|
const gate = (stringValue(result.gate) ?? "g0_bootstrap");
|
|
1744
1807
|
const gateSeq = numberValue(result.gateSeq) ?? 0;
|
|
1745
1808
|
const runState = recordValue(result.runState) ??
|
|
@@ -1756,7 +1819,7 @@ async function startOrResume(input, deps) {
|
|
|
1756
1819
|
runId,
|
|
1757
1820
|
fence,
|
|
1758
1821
|
runHandle,
|
|
1759
|
-
targetConfig,
|
|
1822
|
+
targetConfig: runTargetConfig,
|
|
1760
1823
|
gate,
|
|
1761
1824
|
gateSeq,
|
|
1762
1825
|
runState,
|
package/package.json
CHANGED