@riddledc/riddle-proof 0.8.50 → 0.8.52

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 (57) hide show
  1. package/dist/adapters/openclaw.js +4 -4
  2. package/dist/advanced/engine-harness.cjs +41 -23
  3. package/dist/advanced/engine-harness.js +5 -5
  4. package/dist/advanced/index.cjs +43 -23
  5. package/dist/advanced/index.d.cts +2 -2
  6. package/dist/advanced/index.d.ts +2 -2
  7. package/dist/advanced/index.js +7 -7
  8. package/dist/advanced/proof-run-core.cjs +24 -2
  9. package/dist/advanced/proof-run-core.d.cts +1 -1
  10. package/dist/advanced/proof-run-core.d.ts +1 -1
  11. package/dist/advanced/proof-run-core.js +5 -1
  12. package/dist/advanced/proof-run-engine.cjs +20 -2
  13. package/dist/advanced/proof-run-engine.d.cts +2 -2
  14. package/dist/advanced/proof-run-engine.d.ts +2 -2
  15. package/dist/advanced/proof-run-engine.js +2 -2
  16. package/dist/advanced/runner.js +5 -5
  17. package/dist/checkpoint.cjs +16 -4
  18. package/dist/checkpoint.js +1 -1
  19. package/dist/{chunk-UKGDVNGI.js → chunk-2CZORYB7.js} +2 -2
  20. package/dist/{chunk-U46KE6JZ.js → chunk-AXWJJ2LC.js} +16 -4
  21. package/dist/{chunk-X7SQTCIQ.js → chunk-EKZXU6MU.js} +24 -2
  22. package/dist/{chunk-TO3VKAG2.js → chunk-FWHJN3QG.js} +2 -2
  23. package/dist/{chunk-EMWF2575.js → chunk-M3IE3VNC.js} +1 -1
  24. package/dist/{chunk-2PHYFVTY.js → chunk-OYWZGDTS.js} +1 -1
  25. package/dist/{chunk-L7U7QZYH.js → chunk-RBAU2M4S.js} +1 -1
  26. package/dist/{chunk-IOI6QR3B.js → chunk-VYJD6XYF.js} +1 -1
  27. package/dist/{chunk-2KEYWZY5.js → chunk-WURLFN72.js} +11 -21
  28. package/dist/cli/index.js +6 -6
  29. package/dist/cli.cjs +41 -23
  30. package/dist/cli.js +6 -6
  31. package/dist/engine-harness.cjs +41 -23
  32. package/dist/engine-harness.js +5 -5
  33. package/dist/index.cjs +41 -23
  34. package/dist/index.js +6 -6
  35. package/dist/openclaw.js +4 -4
  36. package/dist/{proof-run-core-B1GeqkR8.d.ts → proof-run-core-7Dqm7RKM.d.cts} +6 -2
  37. package/dist/{proof-run-core-B1GeqkR8.d.cts → proof-run-core-7Dqm7RKM.d.ts} +6 -2
  38. package/dist/proof-run-core.cjs +24 -2
  39. package/dist/proof-run-core.d.cts +1 -1
  40. package/dist/proof-run-core.d.ts +1 -1
  41. package/dist/proof-run-core.js +5 -1
  42. package/dist/{proof-run-engine-BqaeqAze.d.ts → proof-run-engine-BqRoA3Do.d.ts} +1 -1
  43. package/dist/{proof-run-engine-4dM37pEx.d.cts → proof-run-engine-DpChFR5H.d.cts} +1 -1
  44. package/dist/proof-run-engine.cjs +20 -2
  45. package/dist/proof-run-engine.d.cts +2 -2
  46. package/dist/proof-run-engine.d.ts +2 -2
  47. package/dist/proof-run-engine.js +2 -2
  48. package/dist/run-card.js +2 -2
  49. package/dist/runner.js +5 -5
  50. package/dist/spec/checkpoint.cjs +16 -4
  51. package/dist/spec/checkpoint.js +1 -1
  52. package/dist/spec/index.cjs +16 -4
  53. package/dist/spec/index.js +3 -3
  54. package/dist/spec/run-card.js +2 -2
  55. package/dist/spec/state.js +3 -3
  56. package/dist/state.js +3 -3
  57. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -31,6 +31,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
33
  // src/proof-run-core.ts
34
+ function canonicalProofAssessmentStageForDecision(decision) {
35
+ const normalized = typeof decision === "string" ? decision.trim() : "";
36
+ if (normalized === "ready_to_ship") return "ship";
37
+ if (normalized === "needs_richer_proof") return "author";
38
+ if (normalized === "revise_capture") return "verify";
39
+ if (normalized === "needs_recon") return "recon";
40
+ if (normalized === "needs_implementation") return "implement";
41
+ return null;
42
+ }
43
+ function normalizeProofAssessmentStageFields(assessment) {
44
+ const canonicalStage = canonicalProofAssessmentStageForDecision(assessment.decision);
45
+ if (!canonicalStage) return assessment;
46
+ return {
47
+ ...assessment,
48
+ recommended_stage: canonicalStage,
49
+ continue_with_stage: canonicalStage
50
+ };
51
+ }
34
52
  function normalizedMode(value) {
35
53
  return typeof value === "string" ? value.trim().toLowerCase() : "";
36
54
  }
@@ -866,10 +884,10 @@ function mergeStateFromParams(statePath, params) {
866
884
  state.proof_assessment_source = null;
867
885
  } else {
868
886
  const parsed = JSON.parse(raw);
869
- const assessment = {
887
+ const assessment = normalizeProofAssessmentStageFields({
870
888
  ...parsed,
871
889
  source: (parsed?.source || "supervising_agent").toString()
872
- };
890
+ });
873
891
  const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
874
892
  if (readyBlocker) {
875
893
  assessment.blocked_decision = assessment.decision;
@@ -4394,13 +4412,25 @@ function createCheckpointResponseTemplate(packet, input = {}) {
4394
4412
  created_at: input.created_at || timestamp()
4395
4413
  });
4396
4414
  }
4415
+ function acceptedCheckpointResponseEntries(state) {
4416
+ const history = state.checkpoint_history || [];
4417
+ const events = state.events || [];
4418
+ const acceptedResponseEvents = events.filter((event) => event.kind === "checkpoint.response.accepted");
4419
+ const hasCheckpointResponseEvents = events.some((event) => nonEmptyString(event.kind)?.startsWith("checkpoint.response."));
4420
+ return history.filter((entry) => {
4421
+ if (!entry.response) return false;
4422
+ if (!hasCheckpointResponseEvents) return true;
4423
+ return acceptedResponseEvents.some((event) => event.ts === entry.ts && (!event.checkpoint || event.checkpoint === entry.response?.checkpoint));
4424
+ });
4425
+ }
4397
4426
  function checkpointSummaryFromState(state, engineStatePath2) {
4398
4427
  const history = state.checkpoint_history || [];
4428
+ const events = state.events || [];
4399
4429
  const packets = history.filter((entry) => entry.packet);
4400
- const responses = history.filter((entry) => entry.response);
4401
- const duplicateResponses = (state.events || []).filter((event) => event.kind === "checkpoint.response.duplicate");
4430
+ const responses = acceptedCheckpointResponseEntries(state);
4431
+ const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
4402
4432
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
4403
- const latestResponseEntry = [...history].reverse().find((entry) => entry.response);
4433
+ const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
4404
4434
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
4405
4435
  const latestResponse = latestResponseEntry?.response;
4406
4436
  const latestResumeToken = latestPacket?.resume_token || null;
@@ -4427,7 +4457,7 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4427
4457
  }
4428
4458
  function isDuplicateCheckpointResponse(state, response) {
4429
4459
  const identity = checkpointResponseIdentity(response);
4430
- return (state.checkpoint_history || []).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
4460
+ return acceptedCheckpointResponseEntries(state).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
4431
4461
  }
4432
4462
  function checkpointResponseIdentity(response) {
4433
4463
  const logicalResponse = compactRecord({
@@ -5750,10 +5780,7 @@ function isReadyShipGate(result) {
5750
5780
  return Boolean(gate && gate.ok === true);
5751
5781
  }
5752
5782
  function proofAssessmentRequestsShip(payload) {
5753
- const decision = String(payload.decision || "");
5754
- const recommendedStage = String(payload.recommended_stage || "");
5755
- const continueStage = String(payload.continue_with_stage || "");
5756
- return decision === "ready_to_ship" || recommendedStage === "ship" || continueStage === "ship";
5783
+ return String(payload.decision || "").trim() === "ready_to_ship";
5757
5784
  }
5758
5785
  function proofAssessmentHardBlockers(state, payload) {
5759
5786
  const blockers = proofAssessmentHardBlockersForState(state || {});
@@ -5771,12 +5798,7 @@ function proofAssessmentContinuation(result, payload) {
5771
5798
  return { ...baseContinuation(result), proof_assessment_json };
5772
5799
  }
5773
5800
  function defaultStageForProofCheckpointDecision(decision) {
5774
- if (decision === "ready_to_ship") return "ship";
5775
- if (decision === "needs_implementation") return "implement";
5776
- if (decision === "needs_recon") return "recon";
5777
- if (decision === "revise_capture") return "verify";
5778
- if (decision === "needs_richer_proof") return "author";
5779
- return null;
5801
+ return canonicalProofAssessmentStageForDecision(decision);
5780
5802
  }
5781
5803
  function checkpointContractFromPacket(packet) {
5782
5804
  return recordValue(packet.evidence_excerpt?.checkpoint_contract) || recordValue(recordValue(packet.state_excerpt?.stage_decision_request)?.checkpoint_contract) || null;
@@ -5802,7 +5824,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
5802
5824
  }
5803
5825
  const payload = recordValue(response.payload) || {};
5804
5826
  const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
5805
- return compactRecord({
5827
+ return normalizeProofAssessmentStageFields(compactRecord({
5806
5828
  ...payload,
5807
5829
  decision: response.decision,
5808
5830
  summary: response.summary,
@@ -5813,7 +5835,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
5813
5835
  source: "supervising_agent",
5814
5836
  checkpoint_response_source: response.source || null,
5815
5837
  checkpoint_response_created_at: response.created_at
5816
- });
5838
+ }));
5817
5839
  }
5818
5840
  function reconAssessmentPayloadFromCheckpointResponse(response) {
5819
5841
  if (![
@@ -6310,10 +6332,6 @@ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
6310
6332
  if (!response) return null;
6311
6333
  if (isDuplicateCheckpointResponse(state, response)) return null;
6312
6334
  const at = timestamp3();
6313
- state.checkpoint_history = [
6314
- ...state.checkpoint_history || [],
6315
- { ts: at, response }
6316
- ].slice(-25);
6317
6335
  appendRunEvent(state, {
6318
6336
  ts: at,
6319
6337
  kind: "checkpoint.response.ignored",
@@ -6767,7 +6785,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
6767
6785
  }
6768
6786
  return { blocker };
6769
6787
  }
6770
- const payload = assessment.payload;
6788
+ const payload = normalizeProofAssessmentStageFields(assessment.payload);
6771
6789
  recordEvent(state, {
6772
6790
  kind: "agent.proof_assessment.completed",
6773
6791
  checkpoint,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-UKGDVNGI.js";
3
+ } from "./chunk-2CZORYB7.js";
4
4
  import "./chunk-6F4PWJZI.js";
5
5
  import {
6
6
  RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
@@ -102,7 +102,7 @@ import {
102
102
  createDisabledRiddleProofAgentAdapter,
103
103
  readRiddleProofRunStatus,
104
104
  runRiddleProofEngineHarness
105
- } from "./chunk-2KEYWZY5.js";
105
+ } from "./chunk-WURLFN72.js";
106
106
  import {
107
107
  RIDDLE_PROOF_RUN_STATE_VERSION,
108
108
  appendRunEvent,
@@ -114,12 +114,12 @@ import {
114
114
  normalizePrLifecycleState,
115
115
  normalizeRunParams,
116
116
  setRunStatus
117
- } from "./chunk-EMWF2575.js";
117
+ } from "./chunk-M3IE3VNC.js";
118
118
  import {
119
119
  RIDDLE_PROOF_RUN_CARD_VERSION,
120
120
  createRiddleProofRunCard
121
- } from "./chunk-L7U7QZYH.js";
122
- import "./chunk-X7SQTCIQ.js";
121
+ } from "./chunk-RBAU2M4S.js";
122
+ import "./chunk-EKZXU6MU.js";
123
123
  import {
124
124
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
125
125
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -135,7 +135,7 @@ import {
135
135
  normalizeCheckpointResponse,
136
136
  proofContractFromAuthorCheckpointResponse,
137
137
  statePathsForRunState
138
- } from "./chunk-U46KE6JZ.js";
138
+ } from "./chunk-AXWJJ2LC.js";
139
139
  import "./chunk-JFQXAJH2.js";
140
140
  import {
141
141
  createCodexExecAgentAdapter,
package/dist/openclaw.js CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  parseOpenClawAssertions,
4
4
  parseOpenClawJsonObjectOrArray,
5
5
  toRiddleProofRunParams
6
- } from "./chunk-2PHYFVTY.js";
7
- import "./chunk-EMWF2575.js";
8
- import "./chunk-L7U7QZYH.js";
9
- import "./chunk-U46KE6JZ.js";
6
+ } from "./chunk-OYWZGDTS.js";
7
+ import "./chunk-M3IE3VNC.js";
8
+ import "./chunk-RBAU2M4S.js";
9
+ import "./chunk-AXWJJ2LC.js";
10
10
  import "./chunk-VY4Y5U57.js";
11
11
  import "./chunk-MLKGABMK.js";
12
12
  export {
@@ -62,6 +62,8 @@ interface WorkflowParams {
62
62
  update_base_checkout?: boolean;
63
63
  advance_stage?: WorkflowStage;
64
64
  }
65
+ declare function canonicalProofAssessmentStageForDecision(decision: unknown): WorkflowStage | null;
66
+ declare function normalizeProofAssessmentStageFields<T extends Record<string, unknown>>(assessment: T): T;
65
67
  declare function previewModeFromWorkflowMode(value: unknown): "server" | "static" | undefined;
66
68
  declare function noImplementationModeFor(params?: unknown, state?: unknown): boolean;
67
69
  interface PluginConfig {
@@ -335,6 +337,7 @@ type proofRunCore_WorkflowParams = WorkflowParams;
335
337
  type proofRunCore_WorkflowStage = WorkflowStage;
336
338
  declare const proofRunCore_buildCheckpointContract: typeof buildCheckpointContract;
337
339
  declare const proofRunCore_buildSetupArgs: typeof buildSetupArgs;
340
+ declare const proofRunCore_canonicalProofAssessmentStageForDecision: typeof canonicalProofAssessmentStageForDecision;
338
341
  declare const proofRunCore_checkpointContinueStage: typeof checkpointContinueStage;
339
342
  declare const proofRunCore_clearStageDecisionRequest: typeof clearStageDecisionRequest;
340
343
  declare const proofRunCore_ensureAction: typeof ensureAction;
@@ -342,6 +345,7 @@ declare const proofRunCore_ensureStageLoopState: typeof ensureStageLoopState;
342
345
  declare const proofRunCore_invalidateVerifyEvidence: typeof invalidateVerifyEvidence;
343
346
  declare const proofRunCore_mergeStateFromParams: typeof mergeStateFromParams;
344
347
  declare const proofRunCore_noImplementationModeFor: typeof noImplementationModeFor;
348
+ declare const proofRunCore_normalizeProofAssessmentStageFields: typeof normalizeProofAssessmentStageFields;
345
349
  declare const proofRunCore_previewModeFromWorkflowMode: typeof previewModeFromWorkflowMode;
346
350
  declare const proofRunCore_proofAssessmentHardBlockersForState: typeof proofAssessmentHardBlockersForState;
347
351
  declare const proofRunCore_readState: typeof readState;
@@ -358,7 +362,7 @@ declare const proofRunCore_visualDeltaShipGateReason: typeof visualDeltaShipGate
358
362
  declare const proofRunCore_workflowFile: typeof workflowFile;
359
363
  declare const proofRunCore_writeState: typeof writeState;
360
364
  declare namespace proofRunCore {
361
- export { proofRunCore_BUNDLED_RIDDLE_PROOF_DIR as BUNDLED_RIDDLE_PROOF_DIR, proofRunCore_CHECKPOINT_CONTRACT_VERSION as CHECKPOINT_CONTRACT_VERSION, type proofRunCore_CheckpointInputContract as CheckpointInputContract, type proofRunCore_PluginConfig as PluginConfig, proofRunCore_RIDDLE_PROOF_DIR_CANDIDATES as RIDDLE_PROOF_DIR_CANDIDATES, type proofRunCore_ShipGateValidation as ShipGateValidation, proofRunCore_WORKFLOW_STAGE_ORDER as WORKFLOW_STAGE_ORDER, type proofRunCore_WorkflowAction as WorkflowAction, type proofRunCore_WorkflowParams as WorkflowParams, type proofRunCore_WorkflowStage as WorkflowStage, proofRunCore_buildCheckpointContract as buildCheckpointContract, proofRunCore_buildSetupArgs as buildSetupArgs, proofRunCore_checkpointContinueStage as checkpointContinueStage, proofRunCore_clearStageDecisionRequest as clearStageDecisionRequest, proofRunCore_ensureAction as ensureAction, proofRunCore_ensureStageLoopState as ensureStageLoopState, proofRunCore_invalidateVerifyEvidence as invalidateVerifyEvidence, proofRunCore_mergeStateFromParams as mergeStateFromParams, proofRunCore_noImplementationModeFor as noImplementationModeFor, proofRunCore_previewModeFromWorkflowMode as previewModeFromWorkflowMode, proofRunCore_proofAssessmentHardBlockersForState as proofAssessmentHardBlockersForState, proofRunCore_readState as readState, proofRunCore_recordStageAttempt as recordStageAttempt, proofRunCore_requiredBaselineLabelsForState as requiredBaselineLabelsForState, proofRunCore_resolveConfig as resolveConfig, proofRunCore_resolveRiddleProofDir as resolveRiddleProofDir, proofRunCore_setStageDecisionRequest as setStageDecisionRequest, proofRunCore_summarizeState as summarizeState, proofRunCore_validateShipGate as validateShipGate, proofRunCore_visualDeltaForState as visualDeltaForState, proofRunCore_visualDeltaRequiredForState as visualDeltaRequiredForState, proofRunCore_visualDeltaShipGateReason as visualDeltaShipGateReason, proofRunCore_workflowFile as workflowFile, proofRunCore_writeState as writeState };
365
+ export { proofRunCore_BUNDLED_RIDDLE_PROOF_DIR as BUNDLED_RIDDLE_PROOF_DIR, proofRunCore_CHECKPOINT_CONTRACT_VERSION as CHECKPOINT_CONTRACT_VERSION, type proofRunCore_CheckpointInputContract as CheckpointInputContract, type proofRunCore_PluginConfig as PluginConfig, proofRunCore_RIDDLE_PROOF_DIR_CANDIDATES as RIDDLE_PROOF_DIR_CANDIDATES, type proofRunCore_ShipGateValidation as ShipGateValidation, proofRunCore_WORKFLOW_STAGE_ORDER as WORKFLOW_STAGE_ORDER, type proofRunCore_WorkflowAction as WorkflowAction, type proofRunCore_WorkflowParams as WorkflowParams, type proofRunCore_WorkflowStage as WorkflowStage, proofRunCore_buildCheckpointContract as buildCheckpointContract, proofRunCore_buildSetupArgs as buildSetupArgs, proofRunCore_canonicalProofAssessmentStageForDecision as canonicalProofAssessmentStageForDecision, proofRunCore_checkpointContinueStage as checkpointContinueStage, proofRunCore_clearStageDecisionRequest as clearStageDecisionRequest, proofRunCore_ensureAction as ensureAction, proofRunCore_ensureStageLoopState as ensureStageLoopState, proofRunCore_invalidateVerifyEvidence as invalidateVerifyEvidence, proofRunCore_mergeStateFromParams as mergeStateFromParams, proofRunCore_noImplementationModeFor as noImplementationModeFor, proofRunCore_normalizeProofAssessmentStageFields as normalizeProofAssessmentStageFields, proofRunCore_previewModeFromWorkflowMode as previewModeFromWorkflowMode, proofRunCore_proofAssessmentHardBlockersForState as proofAssessmentHardBlockersForState, proofRunCore_readState as readState, proofRunCore_recordStageAttempt as recordStageAttempt, proofRunCore_requiredBaselineLabelsForState as requiredBaselineLabelsForState, proofRunCore_resolveConfig as resolveConfig, proofRunCore_resolveRiddleProofDir as resolveRiddleProofDir, proofRunCore_setStageDecisionRequest as setStageDecisionRequest, proofRunCore_summarizeState as summarizeState, proofRunCore_validateShipGate as validateShipGate, proofRunCore_visualDeltaForState as visualDeltaForState, proofRunCore_visualDeltaRequiredForState as visualDeltaRequiredForState, proofRunCore_visualDeltaShipGateReason as visualDeltaShipGateReason, proofRunCore_workflowFile as workflowFile, proofRunCore_writeState as writeState };
362
366
  }
363
367
 
364
- export { visualDeltaShipGateReason as A, BUNDLED_RIDDLE_PROOF_DIR as B, CHECKPOINT_CONTRACT_VERSION as C, workflowFile as D, writeState as E, type PluginConfig as P, RIDDLE_PROOF_DIR_CANDIDATES as R, type ShipGateValidation as S, type WorkflowParams as W, type WorkflowStage as a, type CheckpointInputContract as b, WORKFLOW_STAGE_ORDER as c, type WorkflowAction as d, buildCheckpointContract as e, buildSetupArgs as f, checkpointContinueStage as g, clearStageDecisionRequest as h, ensureAction as i, ensureStageLoopState as j, invalidateVerifyEvidence as k, previewModeFromWorkflowMode as l, mergeStateFromParams as m, noImplementationModeFor as n, proofAssessmentHardBlockersForState as o, proofRunCore as p, readState as q, resolveConfig as r, recordStageAttempt as s, requiredBaselineLabelsForState as t, resolveRiddleProofDir as u, setStageDecisionRequest as v, summarizeState as w, validateShipGate as x, visualDeltaForState as y, visualDeltaRequiredForState as z };
368
+ export { visualDeltaForState as A, BUNDLED_RIDDLE_PROOF_DIR as B, CHECKPOINT_CONTRACT_VERSION as C, visualDeltaRequiredForState as D, visualDeltaShipGateReason as E, workflowFile as F, writeState as G, type PluginConfig as P, RIDDLE_PROOF_DIR_CANDIDATES as R, type ShipGateValidation as S, type WorkflowParams as W, type WorkflowStage as a, type CheckpointInputContract as b, WORKFLOW_STAGE_ORDER as c, type WorkflowAction as d, buildCheckpointContract as e, buildSetupArgs as f, canonicalProofAssessmentStageForDecision as g, checkpointContinueStage as h, clearStageDecisionRequest as i, ensureAction as j, ensureStageLoopState as k, invalidateVerifyEvidence as l, mergeStateFromParams as m, noImplementationModeFor as n, normalizeProofAssessmentStageFields as o, proofRunCore as p, previewModeFromWorkflowMode as q, resolveConfig as r, proofAssessmentHardBlockersForState as s, readState as t, recordStageAttempt as u, requiredBaselineLabelsForState as v, resolveRiddleProofDir as w, setStageDecisionRequest as x, summarizeState as y, validateShipGate as z };
@@ -62,6 +62,8 @@ interface WorkflowParams {
62
62
  update_base_checkout?: boolean;
63
63
  advance_stage?: WorkflowStage;
64
64
  }
65
+ declare function canonicalProofAssessmentStageForDecision(decision: unknown): WorkflowStage | null;
66
+ declare function normalizeProofAssessmentStageFields<T extends Record<string, unknown>>(assessment: T): T;
65
67
  declare function previewModeFromWorkflowMode(value: unknown): "server" | "static" | undefined;
66
68
  declare function noImplementationModeFor(params?: unknown, state?: unknown): boolean;
67
69
  interface PluginConfig {
@@ -335,6 +337,7 @@ type proofRunCore_WorkflowParams = WorkflowParams;
335
337
  type proofRunCore_WorkflowStage = WorkflowStage;
336
338
  declare const proofRunCore_buildCheckpointContract: typeof buildCheckpointContract;
337
339
  declare const proofRunCore_buildSetupArgs: typeof buildSetupArgs;
340
+ declare const proofRunCore_canonicalProofAssessmentStageForDecision: typeof canonicalProofAssessmentStageForDecision;
338
341
  declare const proofRunCore_checkpointContinueStage: typeof checkpointContinueStage;
339
342
  declare const proofRunCore_clearStageDecisionRequest: typeof clearStageDecisionRequest;
340
343
  declare const proofRunCore_ensureAction: typeof ensureAction;
@@ -342,6 +345,7 @@ declare const proofRunCore_ensureStageLoopState: typeof ensureStageLoopState;
342
345
  declare const proofRunCore_invalidateVerifyEvidence: typeof invalidateVerifyEvidence;
343
346
  declare const proofRunCore_mergeStateFromParams: typeof mergeStateFromParams;
344
347
  declare const proofRunCore_noImplementationModeFor: typeof noImplementationModeFor;
348
+ declare const proofRunCore_normalizeProofAssessmentStageFields: typeof normalizeProofAssessmentStageFields;
345
349
  declare const proofRunCore_previewModeFromWorkflowMode: typeof previewModeFromWorkflowMode;
346
350
  declare const proofRunCore_proofAssessmentHardBlockersForState: typeof proofAssessmentHardBlockersForState;
347
351
  declare const proofRunCore_readState: typeof readState;
@@ -358,7 +362,7 @@ declare const proofRunCore_visualDeltaShipGateReason: typeof visualDeltaShipGate
358
362
  declare const proofRunCore_workflowFile: typeof workflowFile;
359
363
  declare const proofRunCore_writeState: typeof writeState;
360
364
  declare namespace proofRunCore {
361
- export { proofRunCore_BUNDLED_RIDDLE_PROOF_DIR as BUNDLED_RIDDLE_PROOF_DIR, proofRunCore_CHECKPOINT_CONTRACT_VERSION as CHECKPOINT_CONTRACT_VERSION, type proofRunCore_CheckpointInputContract as CheckpointInputContract, type proofRunCore_PluginConfig as PluginConfig, proofRunCore_RIDDLE_PROOF_DIR_CANDIDATES as RIDDLE_PROOF_DIR_CANDIDATES, type proofRunCore_ShipGateValidation as ShipGateValidation, proofRunCore_WORKFLOW_STAGE_ORDER as WORKFLOW_STAGE_ORDER, type proofRunCore_WorkflowAction as WorkflowAction, type proofRunCore_WorkflowParams as WorkflowParams, type proofRunCore_WorkflowStage as WorkflowStage, proofRunCore_buildCheckpointContract as buildCheckpointContract, proofRunCore_buildSetupArgs as buildSetupArgs, proofRunCore_checkpointContinueStage as checkpointContinueStage, proofRunCore_clearStageDecisionRequest as clearStageDecisionRequest, proofRunCore_ensureAction as ensureAction, proofRunCore_ensureStageLoopState as ensureStageLoopState, proofRunCore_invalidateVerifyEvidence as invalidateVerifyEvidence, proofRunCore_mergeStateFromParams as mergeStateFromParams, proofRunCore_noImplementationModeFor as noImplementationModeFor, proofRunCore_previewModeFromWorkflowMode as previewModeFromWorkflowMode, proofRunCore_proofAssessmentHardBlockersForState as proofAssessmentHardBlockersForState, proofRunCore_readState as readState, proofRunCore_recordStageAttempt as recordStageAttempt, proofRunCore_requiredBaselineLabelsForState as requiredBaselineLabelsForState, proofRunCore_resolveConfig as resolveConfig, proofRunCore_resolveRiddleProofDir as resolveRiddleProofDir, proofRunCore_setStageDecisionRequest as setStageDecisionRequest, proofRunCore_summarizeState as summarizeState, proofRunCore_validateShipGate as validateShipGate, proofRunCore_visualDeltaForState as visualDeltaForState, proofRunCore_visualDeltaRequiredForState as visualDeltaRequiredForState, proofRunCore_visualDeltaShipGateReason as visualDeltaShipGateReason, proofRunCore_workflowFile as workflowFile, proofRunCore_writeState as writeState };
365
+ export { proofRunCore_BUNDLED_RIDDLE_PROOF_DIR as BUNDLED_RIDDLE_PROOF_DIR, proofRunCore_CHECKPOINT_CONTRACT_VERSION as CHECKPOINT_CONTRACT_VERSION, type proofRunCore_CheckpointInputContract as CheckpointInputContract, type proofRunCore_PluginConfig as PluginConfig, proofRunCore_RIDDLE_PROOF_DIR_CANDIDATES as RIDDLE_PROOF_DIR_CANDIDATES, type proofRunCore_ShipGateValidation as ShipGateValidation, proofRunCore_WORKFLOW_STAGE_ORDER as WORKFLOW_STAGE_ORDER, type proofRunCore_WorkflowAction as WorkflowAction, type proofRunCore_WorkflowParams as WorkflowParams, type proofRunCore_WorkflowStage as WorkflowStage, proofRunCore_buildCheckpointContract as buildCheckpointContract, proofRunCore_buildSetupArgs as buildSetupArgs, proofRunCore_canonicalProofAssessmentStageForDecision as canonicalProofAssessmentStageForDecision, proofRunCore_checkpointContinueStage as checkpointContinueStage, proofRunCore_clearStageDecisionRequest as clearStageDecisionRequest, proofRunCore_ensureAction as ensureAction, proofRunCore_ensureStageLoopState as ensureStageLoopState, proofRunCore_invalidateVerifyEvidence as invalidateVerifyEvidence, proofRunCore_mergeStateFromParams as mergeStateFromParams, proofRunCore_noImplementationModeFor as noImplementationModeFor, proofRunCore_normalizeProofAssessmentStageFields as normalizeProofAssessmentStageFields, proofRunCore_previewModeFromWorkflowMode as previewModeFromWorkflowMode, proofRunCore_proofAssessmentHardBlockersForState as proofAssessmentHardBlockersForState, proofRunCore_readState as readState, proofRunCore_recordStageAttempt as recordStageAttempt, proofRunCore_requiredBaselineLabelsForState as requiredBaselineLabelsForState, proofRunCore_resolveConfig as resolveConfig, proofRunCore_resolveRiddleProofDir as resolveRiddleProofDir, proofRunCore_setStageDecisionRequest as setStageDecisionRequest, proofRunCore_summarizeState as summarizeState, proofRunCore_validateShipGate as validateShipGate, proofRunCore_visualDeltaForState as visualDeltaForState, proofRunCore_visualDeltaRequiredForState as visualDeltaRequiredForState, proofRunCore_visualDeltaShipGateReason as visualDeltaShipGateReason, proofRunCore_workflowFile as workflowFile, proofRunCore_writeState as writeState };
362
366
  }
363
367
 
364
- export { visualDeltaShipGateReason as A, BUNDLED_RIDDLE_PROOF_DIR as B, CHECKPOINT_CONTRACT_VERSION as C, workflowFile as D, writeState as E, type PluginConfig as P, RIDDLE_PROOF_DIR_CANDIDATES as R, type ShipGateValidation as S, type WorkflowParams as W, type WorkflowStage as a, type CheckpointInputContract as b, WORKFLOW_STAGE_ORDER as c, type WorkflowAction as d, buildCheckpointContract as e, buildSetupArgs as f, checkpointContinueStage as g, clearStageDecisionRequest as h, ensureAction as i, ensureStageLoopState as j, invalidateVerifyEvidence as k, previewModeFromWorkflowMode as l, mergeStateFromParams as m, noImplementationModeFor as n, proofAssessmentHardBlockersForState as o, proofRunCore as p, readState as q, resolveConfig as r, recordStageAttempt as s, requiredBaselineLabelsForState as t, resolveRiddleProofDir as u, setStageDecisionRequest as v, summarizeState as w, validateShipGate as x, visualDeltaForState as y, visualDeltaRequiredForState as z };
368
+ export { visualDeltaForState as A, BUNDLED_RIDDLE_PROOF_DIR as B, CHECKPOINT_CONTRACT_VERSION as C, visualDeltaRequiredForState as D, visualDeltaShipGateReason as E, workflowFile as F, writeState as G, type PluginConfig as P, RIDDLE_PROOF_DIR_CANDIDATES as R, type ShipGateValidation as S, type WorkflowParams as W, type WorkflowStage as a, type CheckpointInputContract as b, WORKFLOW_STAGE_ORDER as c, type WorkflowAction as d, buildCheckpointContract as e, buildSetupArgs as f, canonicalProofAssessmentStageForDecision as g, checkpointContinueStage as h, clearStageDecisionRequest as i, ensureAction as j, ensureStageLoopState as k, invalidateVerifyEvidence as l, mergeStateFromParams as m, noImplementationModeFor as n, normalizeProofAssessmentStageFields as o, proofRunCore as p, previewModeFromWorkflowMode as q, resolveConfig as r, proofAssessmentHardBlockersForState as s, readState as t, recordStageAttempt as u, requiredBaselineLabelsForState as v, resolveRiddleProofDir as w, setStageDecisionRequest as x, summarizeState as y, validateShipGate as z };
@@ -36,6 +36,7 @@ __export(proof_run_core_exports, {
36
36
  WORKFLOW_STAGE_ORDER: () => WORKFLOW_STAGE_ORDER,
37
37
  buildCheckpointContract: () => buildCheckpointContract,
38
38
  buildSetupArgs: () => buildSetupArgs,
39
+ canonicalProofAssessmentStageForDecision: () => canonicalProofAssessmentStageForDecision,
39
40
  checkpointContinueStage: () => checkpointContinueStage,
40
41
  clearStageDecisionRequest: () => clearStageDecisionRequest,
41
42
  ensureAction: () => ensureAction,
@@ -43,6 +44,7 @@ __export(proof_run_core_exports, {
43
44
  invalidateVerifyEvidence: () => invalidateVerifyEvidence,
44
45
  mergeStateFromParams: () => mergeStateFromParams,
45
46
  noImplementationModeFor: () => noImplementationModeFor,
47
+ normalizeProofAssessmentStageFields: () => normalizeProofAssessmentStageFields,
46
48
  previewModeFromWorkflowMode: () => previewModeFromWorkflowMode,
47
49
  proofAssessmentHardBlockersForState: () => proofAssessmentHardBlockersForState,
48
50
  readState: () => readState,
@@ -66,6 +68,24 @@ var import_node_path = __toESM(require("path"), 1);
66
68
  var import_node_url = require("url");
67
69
  var import_meta = {};
68
70
  var WORKFLOW_STAGE_ORDER = ["setup", "recon", "author", "implement", "verify", "ship"];
71
+ function canonicalProofAssessmentStageForDecision(decision) {
72
+ const normalized = typeof decision === "string" ? decision.trim() : "";
73
+ if (normalized === "ready_to_ship") return "ship";
74
+ if (normalized === "needs_richer_proof") return "author";
75
+ if (normalized === "revise_capture") return "verify";
76
+ if (normalized === "needs_recon") return "recon";
77
+ if (normalized === "needs_implementation") return "implement";
78
+ return null;
79
+ }
80
+ function normalizeProofAssessmentStageFields(assessment) {
81
+ const canonicalStage = canonicalProofAssessmentStageForDecision(assessment.decision);
82
+ if (!canonicalStage) return assessment;
83
+ return {
84
+ ...assessment,
85
+ recommended_stage: canonicalStage,
86
+ continue_with_stage: canonicalStage
87
+ };
88
+ }
69
89
  function normalizedMode(value) {
70
90
  return typeof value === "string" ? value.trim().toLowerCase() : "";
71
91
  }
@@ -1092,10 +1112,10 @@ function mergeStateFromParams(statePath, params) {
1092
1112
  state.proof_assessment_source = null;
1093
1113
  } else {
1094
1114
  const parsed = JSON.parse(raw);
1095
- const assessment = {
1115
+ const assessment = normalizeProofAssessmentStageFields({
1096
1116
  ...parsed,
1097
1117
  source: (parsed?.source || "supervising_agent").toString()
1098
- };
1118
+ });
1099
1119
  const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
1100
1120
  if (readyBlocker) {
1101
1121
  assessment.blocked_decision = assessment.decision;
@@ -1265,6 +1285,7 @@ function summarizeState(state) {
1265
1285
  WORKFLOW_STAGE_ORDER,
1266
1286
  buildCheckpointContract,
1267
1287
  buildSetupArgs,
1288
+ canonicalProofAssessmentStageForDecision,
1268
1289
  checkpointContinueStage,
1269
1290
  clearStageDecisionRequest,
1270
1291
  ensureAction,
@@ -1272,6 +1293,7 @@ function summarizeState(state) {
1272
1293
  invalidateVerifyEvidence,
1273
1294
  mergeStateFromParams,
1274
1295
  noImplementationModeFor,
1296
+ normalizeProofAssessmentStageFields,
1275
1297
  previewModeFromWorkflowMode,
1276
1298
  proofAssessmentHardBlockersForState,
1277
1299
  readState,
@@ -1 +1 @@
1
- export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as checkpointContinueStage, h as clearStageDecisionRequest, i as ensureAction, j as ensureStageLoopState, k as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, l as previewModeFromWorkflowMode, o as proofAssessmentHardBlockersForState, q as readState, s as recordStageAttempt, t as requiredBaselineLabelsForState, r as resolveConfig, u as resolveRiddleProofDir, v as setStageDecisionRequest, w as summarizeState, x as validateShipGate, y as visualDeltaForState, z as visualDeltaRequiredForState, A as visualDeltaShipGateReason, D as workflowFile, E as writeState } from './proof-run-core-B1GeqkR8.cjs';
1
+ export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as canonicalProofAssessmentStageForDecision, h as checkpointContinueStage, i as clearStageDecisionRequest, j as ensureAction, k as ensureStageLoopState, l as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, o as normalizeProofAssessmentStageFields, q as previewModeFromWorkflowMode, s as proofAssessmentHardBlockersForState, t as readState, u as recordStageAttempt, v as requiredBaselineLabelsForState, r as resolveConfig, w as resolveRiddleProofDir, x as setStageDecisionRequest, y as summarizeState, z as validateShipGate, A as visualDeltaForState, D as visualDeltaRequiredForState, E as visualDeltaShipGateReason, F as workflowFile, G as writeState } from './proof-run-core-7Dqm7RKM.cjs';
@@ -1 +1 @@
1
- export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as checkpointContinueStage, h as clearStageDecisionRequest, i as ensureAction, j as ensureStageLoopState, k as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, l as previewModeFromWorkflowMode, o as proofAssessmentHardBlockersForState, q as readState, s as recordStageAttempt, t as requiredBaselineLabelsForState, r as resolveConfig, u as resolveRiddleProofDir, v as setStageDecisionRequest, w as summarizeState, x as validateShipGate, y as visualDeltaForState, z as visualDeltaRequiredForState, A as visualDeltaShipGateReason, D as workflowFile, E as writeState } from './proof-run-core-B1GeqkR8.js';
1
+ export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as canonicalProofAssessmentStageForDecision, h as checkpointContinueStage, i as clearStageDecisionRequest, j as ensureAction, k as ensureStageLoopState, l as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, o as normalizeProofAssessmentStageFields, q as previewModeFromWorkflowMode, s as proofAssessmentHardBlockersForState, t as readState, u as recordStageAttempt, v as requiredBaselineLabelsForState, r as resolveConfig, w as resolveRiddleProofDir, x as setStageDecisionRequest, y as summarizeState, z as validateShipGate, A as visualDeltaForState, D as visualDeltaRequiredForState, E as visualDeltaShipGateReason, F as workflowFile, G as writeState } from './proof-run-core-7Dqm7RKM.js';
@@ -5,6 +5,7 @@ import {
5
5
  WORKFLOW_STAGE_ORDER,
6
6
  buildCheckpointContract,
7
7
  buildSetupArgs,
8
+ canonicalProofAssessmentStageForDecision,
8
9
  checkpointContinueStage,
9
10
  clearStageDecisionRequest,
10
11
  ensureAction,
@@ -12,6 +13,7 @@ import {
12
13
  invalidateVerifyEvidence,
13
14
  mergeStateFromParams,
14
15
  noImplementationModeFor,
16
+ normalizeProofAssessmentStageFields,
15
17
  previewModeFromWorkflowMode,
16
18
  proofAssessmentHardBlockersForState,
17
19
  readState,
@@ -27,7 +29,7 @@ import {
27
29
  visualDeltaShipGateReason,
28
30
  workflowFile,
29
31
  writeState
30
- } from "./chunk-X7SQTCIQ.js";
32
+ } from "./chunk-EKZXU6MU.js";
31
33
  import "./chunk-MLKGABMK.js";
32
34
  export {
33
35
  BUNDLED_RIDDLE_PROOF_DIR,
@@ -36,6 +38,7 @@ export {
36
38
  WORKFLOW_STAGE_ORDER,
37
39
  buildCheckpointContract,
38
40
  buildSetupArgs,
41
+ canonicalProofAssessmentStageForDecision,
39
42
  checkpointContinueStage,
40
43
  clearStageDecisionRequest,
41
44
  ensureAction,
@@ -43,6 +46,7 @@ export {
43
46
  invalidateVerifyEvidence,
44
47
  mergeStateFromParams,
45
48
  noImplementationModeFor,
49
+ normalizeProofAssessmentStageFields,
46
50
  previewModeFromWorkflowMode,
47
51
  proofAssessmentHardBlockersForState,
48
52
  readState,
@@ -1,4 +1,4 @@
1
- import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-B1GeqkR8.js';
1
+ import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-7Dqm7RKM.js';
2
2
 
3
3
  declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, resolvedConfig?: ReturnType<typeof resolveConfig>): Promise<{
4
4
  ok: boolean;
@@ -1,4 +1,4 @@
1
- import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-B1GeqkR8.cjs';
1
+ import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-7Dqm7RKM.cjs';
2
2
 
3
3
  declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, resolvedConfig?: ReturnType<typeof resolveConfig>): Promise<{
4
4
  ok: boolean;
@@ -45,6 +45,24 @@ var import_node_path = __toESM(require("path"), 1);
45
45
  var import_node_url = require("url");
46
46
  var import_meta = {};
47
47
  var WORKFLOW_STAGE_ORDER = ["setup", "recon", "author", "implement", "verify", "ship"];
48
+ function canonicalProofAssessmentStageForDecision(decision) {
49
+ const normalized = typeof decision === "string" ? decision.trim() : "";
50
+ if (normalized === "ready_to_ship") return "ship";
51
+ if (normalized === "needs_richer_proof") return "author";
52
+ if (normalized === "revise_capture") return "verify";
53
+ if (normalized === "needs_recon") return "recon";
54
+ if (normalized === "needs_implementation") return "implement";
55
+ return null;
56
+ }
57
+ function normalizeProofAssessmentStageFields(assessment) {
58
+ const canonicalStage = canonicalProofAssessmentStageForDecision(assessment.decision);
59
+ if (!canonicalStage) return assessment;
60
+ return {
61
+ ...assessment,
62
+ recommended_stage: canonicalStage,
63
+ continue_with_stage: canonicalStage
64
+ };
65
+ }
48
66
  function normalizedMode(value) {
49
67
  return typeof value === "string" ? value.trim().toLowerCase() : "";
50
68
  }
@@ -1071,10 +1089,10 @@ function mergeStateFromParams(statePath, params) {
1071
1089
  state.proof_assessment_source = null;
1072
1090
  } else {
1073
1091
  const parsed = JSON.parse(raw);
1074
- const assessment = {
1092
+ const assessment = normalizeProofAssessmentStageFields({
1075
1093
  ...parsed,
1076
1094
  source: (parsed?.source || "supervising_agent").toString()
1077
- };
1095
+ });
1078
1096
  const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
1079
1097
  if (readyBlocker) {
1080
1098
  assessment.blocked_decision = assessment.decision;
@@ -1,2 +1,2 @@
1
- import './proof-run-core-B1GeqkR8.cjs';
2
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-4dM37pEx.cjs';
1
+ import './proof-run-core-7Dqm7RKM.cjs';
2
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-DpChFR5H.cjs';
@@ -1,2 +1,2 @@
1
- import './proof-run-core-B1GeqkR8.js';
2
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-BqaeqAze.js';
1
+ import './proof-run-core-7Dqm7RKM.js';
2
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-BqRoA3Do.js';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createRiddleProofEngine,
3
3
  executeWorkflow
4
- } from "./chunk-IOI6QR3B.js";
5
- import "./chunk-X7SQTCIQ.js";
4
+ } from "./chunk-VYJD6XYF.js";
5
+ import "./chunk-EKZXU6MU.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  createRiddleProofEngine,
package/dist/run-card.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RIDDLE_PROOF_RUN_CARD_VERSION,
3
3
  createRiddleProofRunCard
4
- } from "./chunk-L7U7QZYH.js";
5
- import "./chunk-U46KE6JZ.js";
4
+ } from "./chunk-RBAU2M4S.js";
5
+ import "./chunk-AXWJJ2LC.js";
6
6
  import "./chunk-VY4Y5U57.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
  export {
package/dist/runner.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-UKGDVNGI.js";
4
- import "./chunk-EMWF2575.js";
5
- import "./chunk-L7U7QZYH.js";
6
- import "./chunk-X7SQTCIQ.js";
7
- import "./chunk-U46KE6JZ.js";
3
+ } from "./chunk-2CZORYB7.js";
4
+ import "./chunk-M3IE3VNC.js";
5
+ import "./chunk-RBAU2M4S.js";
6
+ import "./chunk-EKZXU6MU.js";
7
+ import "./chunk-AXWJJ2LC.js";
8
8
  import "./chunk-VY4Y5U57.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
@@ -720,13 +720,25 @@ function createCheckpointResponseTemplate(packet, input = {}) {
720
720
  created_at: input.created_at || timestamp()
721
721
  });
722
722
  }
723
+ function acceptedCheckpointResponseEntries(state) {
724
+ const history = state.checkpoint_history || [];
725
+ const events = state.events || [];
726
+ const acceptedResponseEvents = events.filter((event) => event.kind === "checkpoint.response.accepted");
727
+ const hasCheckpointResponseEvents = events.some((event) => nonEmptyString(event.kind)?.startsWith("checkpoint.response."));
728
+ return history.filter((entry) => {
729
+ if (!entry.response) return false;
730
+ if (!hasCheckpointResponseEvents) return true;
731
+ return acceptedResponseEvents.some((event) => event.ts === entry.ts && (!event.checkpoint || event.checkpoint === entry.response?.checkpoint));
732
+ });
733
+ }
723
734
  function checkpointSummaryFromState(state, engineStatePath) {
724
735
  const history = state.checkpoint_history || [];
736
+ const events = state.events || [];
725
737
  const packets = history.filter((entry) => entry.packet);
726
- const responses = history.filter((entry) => entry.response);
727
- const duplicateResponses = (state.events || []).filter((event) => event.kind === "checkpoint.response.duplicate");
738
+ const responses = acceptedCheckpointResponseEntries(state);
739
+ const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
728
740
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
729
- const latestResponseEntry = [...history].reverse().find((entry) => entry.response);
741
+ const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
730
742
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
731
743
  const latestResponse = latestResponseEntry?.response;
732
744
  const latestResumeToken = latestPacket?.resume_token || null;
@@ -753,7 +765,7 @@ function checkpointSummaryFromState(state, engineStatePath) {
753
765
  }
754
766
  function isDuplicateCheckpointResponse(state, response) {
755
767
  const identity = checkpointResponseIdentity(response);
756
- return (state.checkpoint_history || []).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
768
+ return acceptedCheckpointResponseEntries(state).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
757
769
  }
758
770
  function checkpointResponseIdentity(response) {
759
771
  const logicalResponse = compactRecord({
@@ -13,7 +13,7 @@ import {
13
13
  normalizeCheckpointResponse,
14
14
  proofContractFromAuthorCheckpointResponse,
15
15
  statePathsForRunState
16
- } from "../chunk-U46KE6JZ.js";
16
+ } from "../chunk-AXWJJ2LC.js";
17
17
  import "../chunk-VY4Y5U57.js";
18
18
  import "../chunk-MLKGABMK.js";
19
19
  export {
@@ -943,13 +943,25 @@ function createCheckpointResponseTemplate(packet, input = {}) {
943
943
  created_at: input.created_at || timestamp()
944
944
  });
945
945
  }
946
+ function acceptedCheckpointResponseEntries(state) {
947
+ const history = state.checkpoint_history || [];
948
+ const events = state.events || [];
949
+ const acceptedResponseEvents = events.filter((event) => event.kind === "checkpoint.response.accepted");
950
+ const hasCheckpointResponseEvents = events.some((event) => nonEmptyString(event.kind)?.startsWith("checkpoint.response."));
951
+ return history.filter((entry) => {
952
+ if (!entry.response) return false;
953
+ if (!hasCheckpointResponseEvents) return true;
954
+ return acceptedResponseEvents.some((event) => event.ts === entry.ts && (!event.checkpoint || event.checkpoint === entry.response?.checkpoint));
955
+ });
956
+ }
946
957
  function checkpointSummaryFromState(state, engineStatePath) {
947
958
  const history = state.checkpoint_history || [];
959
+ const events = state.events || [];
948
960
  const packets = history.filter((entry) => entry.packet);
949
- const responses = history.filter((entry) => entry.response);
950
- const duplicateResponses = (state.events || []).filter((event) => event.kind === "checkpoint.response.duplicate");
961
+ const responses = acceptedCheckpointResponseEntries(state);
962
+ const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
951
963
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
952
- const latestResponseEntry = [...history].reverse().find((entry) => entry.response);
964
+ const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
953
965
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
954
966
  const latestResponse = latestResponseEntry?.response;
955
967
  const latestResumeToken = latestPacket?.resume_token || null;
@@ -976,7 +988,7 @@ function checkpointSummaryFromState(state, engineStatePath) {
976
988
  }
977
989
  function isDuplicateCheckpointResponse(state, response) {
978
990
  const identity = checkpointResponseIdentity(response);
979
- return (state.checkpoint_history || []).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
991
+ return acceptedCheckpointResponseEntries(state).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
980
992
  }
981
993
  function checkpointResponseIdentity(response) {
982
994
  const logicalResponse = compactRecord({
@@ -10,11 +10,11 @@ import {
10
10
  normalizePrLifecycleState,
11
11
  normalizeRunParams,
12
12
  setRunStatus
13
- } from "../chunk-EMWF2575.js";
13
+ } from "../chunk-M3IE3VNC.js";
14
14
  import {
15
15
  RIDDLE_PROOF_RUN_CARD_VERSION,
16
16
  createRiddleProofRunCard
17
- } from "../chunk-L7U7QZYH.js";
17
+ } from "../chunk-RBAU2M4S.js";
18
18
  import {
19
19
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
20
20
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -30,7 +30,7 @@ import {
30
30
  normalizeCheckpointResponse,
31
31
  proofContractFromAuthorCheckpointResponse,
32
32
  statePathsForRunState
33
- } from "../chunk-U46KE6JZ.js";
33
+ } from "../chunk-AXWJJ2LC.js";
34
34
  import {
35
35
  applyTerminalMetadata,
36
36
  compactRecord,