@sellable/mcp 0.1.749 → 0.1.751

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.
@@ -689,6 +689,13 @@ type WorkspaceCoordinatorWaitAction = {
689
689
  reason: string | null;
690
690
  };
691
691
  declare function clearCompleteDefersForCampaign(runState: Record<string, unknown> | undefined, campaignId: string | null, preserveActionKey?: string | null): Record<string, unknown> | undefined;
692
+ declare function deferWorkspaceExactTarget(params: {
693
+ runState: unknown;
694
+ target: WorkspaceExactTarget;
695
+ blocker: string;
696
+ }): {
697
+ coordinatorBlockedExactTargets: (Record<string, unknown> | null)[];
698
+ };
692
699
  export declare function approvedPacketComparison(input: RefillSendsCommandInput, targetPlan: unknown): {
693
700
  changed: boolean;
694
701
  expectedTargetShapeRevision: string | null;
@@ -732,6 +739,9 @@ type RefillSenderSelectorMiss = {
732
739
  export declare const refillSendsDeferInternals: {
733
740
  clearCompleteDefersForCampaign: typeof clearCompleteDefersForCampaign;
734
741
  SUPPLY_INVALIDATED_DEFER_BLOCKERS: Set<string>;
742
+ deferWorkspaceExactTarget: typeof deferWorkspaceExactTarget;
743
+ EXACT_ACTION_COMPLETE_BLOCKER: string;
744
+ EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER: string;
735
745
  };
736
746
  export declare function executeRefillSendsCommand(input?: RefillSendsCommandInput): Promise<import("./workspace-context.js").WorkspaceRequiredResult | {
737
747
  ok: boolean;
@@ -933,10 +933,17 @@ const WORKSPACE_SUPPLY_ACTION_FAMILIES = new Set([
933
933
  // stale proof, not by absent supply.
934
934
  //
935
935
  // Same shape as 112c: a bounded ATTEMPT must not harden into a standing claim.
936
+ const EXACT_ACTION_COMPLETE_BLOCKER = "exact_action_complete";
937
+ // fix(112as-b): a completeness claim RE-CONFIRMED by a second identical receipt.
938
+ // The 112as release deliberately never waives this, which is what stops the
939
+ // release from looping forever across continuations.
940
+ const EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER = "exact_action_complete_confirmed";
936
941
  const SUPPLY_INVALIDATED_DEFER_BLOCKERS = new Set([
937
942
  "complete",
938
943
  "capped_by_scheduler",
939
944
  "exact_action_complete",
945
+ // new supply genuinely invalidates even a re-confirmed claim
946
+ "exact_action_complete_confirmed",
940
947
  ]);
941
948
  function clearCompleteDefersForCampaign(runState, campaignId,
942
949
  // fix(112ar): the action that JUST landed keeps its own defer. Clearing it
@@ -1204,20 +1211,42 @@ function deferWorkspaceExactTarget(params) {
1204
1211
  const existing = Array.isArray(current.coordinatorBlockedExactTargets)
1205
1212
  ? current.coordinatorBlockedExactTargets.map(recordValue).filter(Boolean)
1206
1213
  : [];
1214
+ const matchesTarget = (entry) => {
1215
+ const candidate = coordinatorBlockedExactTargets({
1216
+ version: 1,
1217
+ coordinatorBlockedExactTargets: [entry],
1218
+ })[0];
1219
+ return Boolean(candidate &&
1220
+ coordinatorBlockedExactTargetMatches(candidate, params.target));
1221
+ };
1222
+ // fix(112as-b): 112as bounds its release with `waiveCompleteClaims`, which is
1223
+ // per SELECTION CALL. Every next_exact_target continuation starts a fresh
1224
+ // selection, so the same completed edge was released over and over and the
1225
+ // coordinator ping-ponged between two already-complete edges without
1226
+ // executing either (Dotwork: alternating prepare_messages:e5fc49c5 and
1227
+ // approve_messages:4bf8c1e1). That traded the invariant breach for a
1228
+ // livelock.
1229
+ //
1230
+ // Bound the release PER EDGE instead: the first exact_action_complete is a
1231
+ // bounded attempt and stays releasable, but if the SAME edge comes back
1232
+ // complete a second time, the claim is CONFIRMED by its own re-receipt and is
1233
+ // never waived again. Self-limiting, and it needs no new ledger — the entry
1234
+ // already survives continuations inside workspaceRunState.
1235
+ const alreadyCompleteClaim = params.blocker === EXACT_ACTION_COMPLETE_BLOCKER &&
1236
+ existing.some((entry) => matchesTarget(entry) &&
1237
+ (stringValue(recordValue(entry)?.blocker) ===
1238
+ EXACT_ACTION_COMPLETE_BLOCKER ||
1239
+ stringValue(recordValue(entry)?.blocker) ===
1240
+ EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER));
1207
1241
  return {
1208
1242
  ...current,
1209
1243
  coordinatorBlockedExactTargets: [
1210
- ...existing.filter((entry) => {
1211
- const candidate = coordinatorBlockedExactTargets({
1212
- version: 1,
1213
- coordinatorBlockedExactTargets: [entry],
1214
- })[0];
1215
- return (!candidate ||
1216
- !coordinatorBlockedExactTargetMatches(candidate, params.target));
1217
- }),
1244
+ ...existing.filter((entry) => !matchesTarget(entry)),
1218
1245
  {
1219
1246
  ...params.target,
1220
- blocker: params.blocker,
1247
+ blocker: alreadyCompleteClaim
1248
+ ? EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER
1249
+ : params.blocker,
1221
1250
  decidedAt: new Date().toISOString(),
1222
1251
  },
1223
1252
  ],
@@ -1996,6 +2025,35 @@ function laneFrontierIsRubricTerminal(frontier) {
1996
2025
  const status = stringValue(diagnosis.status);
1997
2026
  return status === "zero_yield" || status === "low_yield";
1998
2027
  }
2028
+ // fix(112au): a lane can be receipt-proven spent WITHOUT the classifier having
2029
+ // labelled its stage `icp_or_rubric_rejection`. Dotwork's receipts carry
2030
+ // `retryable: false`, `status: "zero_yield"`, `activeCellCount: 0` and
2031
+ // `stage: "mixed_or_unknown"` (dominantReason legacy_progress_zero_yield), so
2032
+ // the lane stayed "convertible", kept its rows in the actionable census, and
2033
+ // the run terminaled `actionable_supply_not_queued` against supply it could
2034
+ // never convert — an owner-invariant breach caused by a MISSING stage label,
2035
+ // not by real actionable work.
2036
+ //
2037
+ // The substantive proof of exhaustion is: the preparation receipt is
2038
+ // NON-RETRYABLE, it yielded nothing, and there is no work still in flight.
2039
+ // The stage label is a classifier detail on top of that.
2040
+ //
2041
+ // activeCellCount === 0 is load-bearing: a lane with cells still processing is
2042
+ // mid-flight, not spent, and must keep its rows in the census so the
2043
+ // active-prep-job wait path wins instead of a false exhaustion terminal.
2044
+ function laneFrontierIsReceiptProvenSpent(frontier) {
2045
+ const frontierRecord = recordValue(frontier);
2046
+ const diagnosis = recordValue(frontierRecord?.failureDiagnosis);
2047
+ if (!diagnosis)
2048
+ return false;
2049
+ if (diagnosis.retryable !== false)
2050
+ return false;
2051
+ const status = stringValue(diagnosis.status);
2052
+ if (status !== "zero_yield" && status !== "low_yield")
2053
+ return false;
2054
+ const activeCells = numberValue(frontierRecord?.activeCellCount);
2055
+ return activeCells === 0;
2056
+ }
1999
2057
  // One frontier receipt describes one campaign table's lane, however many senders
2000
2058
  // share it. Fall back to sender identity only when the receipt did not name the
2001
2059
  // table it measured, so independent lanes still sum.
@@ -2070,7 +2128,8 @@ function workspaceActionableSupplyCensus(plan) {
2070
2128
  const stageCounts = recordValue(frontier?.stageCounts);
2071
2129
  const lane = workspaceLaneFrontier(planRecord, receipt, frontier, stageCounts);
2072
2130
  const laneKey = workspaceLaneFrontierKey(lane);
2073
- if (laneFrontierIsRubricTerminal(frontier)) {
2131
+ if (laneFrontierIsRubricTerminal(frontier) ||
2132
+ laneFrontierIsReceiptProvenSpent(frontier)) {
2074
2133
  mergeNonConvertibleLane(nonConvertibleByLane, laneKey, lane);
2075
2134
  continue;
2076
2135
  }
@@ -2156,7 +2215,11 @@ function workspaceGapBearingActionableSupply(plan) {
2156
2215
  const frontier = recordValue(receipt?.existingRowFrontier);
2157
2216
  const stageCounts = recordValue(frontier?.stageCounts);
2158
2217
  const lane = workspaceLaneFrontier(rec, receipt, frontier, stageCounts);
2159
- const rubricTerminal = laneFrontierIsRubricTerminal(frontier);
2218
+ // fix(112au): both convertibility splits must agree. This one feeds the
2219
+ // TERMINAL classifier, so a lane spent-by-receipt but unlabelled here would
2220
+ // still drive actionable_supply_not_queued.
2221
+ const rubricTerminal = laneFrontierIsRubricTerminal(frontier) ||
2222
+ laneFrontierIsReceiptProvenSpent(frontier);
2160
2223
  const laneActionable = rubricTerminal
2161
2224
  ? 0
2162
2225
  : lane.approval + lane.generate + lane.enrich + lane.rubric;
@@ -3115,6 +3178,9 @@ async function resolveRefillSenderSelectors(params) {
3115
3178
  export const refillSendsDeferInternals = {
3116
3179
  clearCompleteDefersForCampaign,
3117
3180
  SUPPLY_INVALIDATED_DEFER_BLOCKERS,
3181
+ deferWorkspaceExactTarget,
3182
+ EXACT_ACTION_COMPLETE_BLOCKER,
3183
+ EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER,
3118
3184
  };
3119
3185
  export async function executeRefillSendsCommand(input = {}) {
3120
3186
  const normalizedInput = normalizeRefillSendsInput(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.749",
3
+ "version": "0.1.751",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code, Codex, and Hermes campaign workflows",
6
6
  "main": "dist/index.js",