@riddledc/riddle-proof 0.8.55 → 0.8.56

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 (66) hide show
  1. package/dist/adapters/codex-exec-agent.js +2 -2
  2. package/dist/adapters/codex.js +2 -2
  3. package/dist/adapters/local-agent.js +2 -2
  4. package/dist/adapters/openclaw.js +5 -5
  5. package/dist/advanced/engine-harness.cjs +64 -20
  6. package/dist/advanced/engine-harness.js +5 -5
  7. package/dist/advanced/index.cjs +64 -20
  8. package/dist/advanced/index.d.cts +1 -1
  9. package/dist/advanced/index.d.ts +1 -1
  10. package/dist/advanced/index.js +6 -6
  11. package/dist/advanced/proof-run-engine.d.cts +1 -1
  12. package/dist/advanced/proof-run-engine.d.ts +1 -1
  13. package/dist/advanced/runner.cjs +5 -0
  14. package/dist/advanced/runner.js +5 -5
  15. package/dist/checkpoint.cjs +4 -0
  16. package/dist/checkpoint.js +2 -2
  17. package/dist/{chunk-MYMTAVGP.js → chunk-54DIEDR3.js} +3 -3
  18. package/dist/{chunk-W44XEGYW.js → chunk-CUBYSWZT.js} +5 -0
  19. package/dist/{chunk-QGE3KBRL.js → chunk-GHBNDHG7.js} +60 -24
  20. package/dist/{chunk-F65S5LT2.js → chunk-JLOZTVXU.js} +2 -2
  21. package/dist/{chunk-NYRMPWJB.js → chunk-KNPCWWF3.js} +2 -2
  22. package/dist/{chunk-QUK3SG24.js → chunk-MOTQNIZX.js} +5 -1
  23. package/dist/{chunk-SONWF3FQ.js → chunk-RS4HJLJQ.js} +1 -1
  24. package/dist/{chunk-J2ZNL3H3.js → chunk-TTB3ZAVX.js} +2 -2
  25. package/dist/{chunk-Q5GYD5RG.js → chunk-UZIX7M7D.js} +4 -2
  26. package/dist/cli/index.js +7 -7
  27. package/dist/cli.cjs +64 -20
  28. package/dist/cli.js +7 -7
  29. package/dist/codex-exec-agent.js +2 -2
  30. package/dist/engine-harness.cjs +64 -20
  31. package/dist/engine-harness.js +5 -5
  32. package/dist/index.cjs +66 -20
  33. package/dist/index.d.cts +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +9 -7
  36. package/dist/local-agent.js +2 -2
  37. package/dist/openclaw.js +5 -5
  38. package/dist/{proof-run-engine-MiKZt9oY.d.ts → proof-run-engine-BqRoA3Do.d.ts} +3 -3
  39. package/dist/{proof-run-engine-Baiv6l3A.d.cts → proof-run-engine-DpChFR5H.d.cts} +3 -3
  40. package/dist/proof-run-engine.d.cts +1 -1
  41. package/dist/proof-run-engine.d.ts +1 -1
  42. package/dist/result.cjs +6 -0
  43. package/dist/result.d.cts +2 -1
  44. package/dist/result.d.ts +2 -1
  45. package/dist/result.js +3 -1
  46. package/dist/run-card.js +3 -3
  47. package/dist/runner.cjs +5 -0
  48. package/dist/runner.js +5 -5
  49. package/dist/spec/checkpoint.cjs +4 -0
  50. package/dist/spec/checkpoint.js +2 -2
  51. package/dist/spec/index.cjs +11 -0
  52. package/dist/spec/index.d.cts +1 -1
  53. package/dist/spec/index.d.ts +1 -1
  54. package/dist/spec/index.js +6 -4
  55. package/dist/spec/result.cjs +6 -0
  56. package/dist/spec/result.d.cts +1 -1
  57. package/dist/spec/result.d.ts +1 -1
  58. package/dist/spec/result.js +3 -1
  59. package/dist/spec/run-card.js +3 -3
  60. package/dist/spec/state.cjs +4 -0
  61. package/dist/spec/state.js +4 -4
  62. package/dist/state.cjs +4 -0
  63. package/dist/state.js +4 -4
  64. package/dist/types.d.cts +2 -0
  65. package/dist/types.d.ts +2 -0
  66. package/package.json +1 -1
@@ -2,6 +2,9 @@
2
2
  function isTerminalStatus(status) {
3
3
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
4
4
  }
5
+ function isProtectedFinalStatus(status) {
6
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
7
+ }
5
8
  function isSuccessfulStatus(status) {
6
9
  return status !== "blocked" && status !== "failed";
7
10
  }
@@ -215,6 +218,7 @@ function createRunResult(input) {
215
218
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
216
219
  state.status = status;
217
220
  state.ok = ok;
221
+ if (isProtectedFinalStatus(status)) state.finalized = true;
218
222
  applyShipControlState(state, { status, raw: input.raw });
219
223
  return compactRecord({
220
224
  ok,
@@ -266,6 +270,7 @@ function createRunResult(input) {
266
270
 
267
271
  export {
268
272
  isTerminalStatus,
273
+ isProtectedFinalStatus,
269
274
  isSuccessfulStatus,
270
275
  compactRecord,
271
276
  nonEmptyString,
@@ -5,10 +5,10 @@ import {
5
5
  createRunStatusSnapshot,
6
6
  normalizeRunParams,
7
7
  setRunStatus
8
- } from "./chunk-Q5GYD5RG.js";
8
+ } from "./chunk-UZIX7M7D.js";
9
9
  import {
10
10
  createRiddleProofRunCard
11
- } from "./chunk-NYRMPWJB.js";
11
+ } from "./chunk-KNPCWWF3.js";
12
12
  import {
13
13
  canonicalProofAssessmentStageForDecision,
14
14
  noImplementationModeFor,
@@ -27,16 +27,17 @@ import {
27
27
  normalizeCheckpointResponse,
28
28
  proofContractFromAuthorCheckpointResponse,
29
29
  statePathsForRunState
30
- } from "./chunk-QUK3SG24.js";
30
+ } from "./chunk-MOTQNIZX.js";
31
31
  import {
32
32
  applyShipControlState,
33
33
  applyTerminalMetadata,
34
34
  compactRecord,
35
35
  createRunResult,
36
+ isProtectedFinalStatus,
36
37
  nonEmptyString,
37
38
  normalizeTerminalMetadata,
38
39
  recordValue
39
- } from "./chunk-W44XEGYW.js";
40
+ } from "./chunk-CUBYSWZT.js";
40
41
  import {
41
42
  __export
42
43
  } from "./chunk-MLKGABMK.js";
@@ -121,9 +122,6 @@ function loadRunState(input) {
121
122
  state_path: statePath
122
123
  });
123
124
  }
124
- function isProtectedFinalStatus(status) {
125
- return status === "ready_to_ship" || status === "shipped" || status === "completed";
126
- }
127
125
  function shouldPreserveFinalizedRunState(filePath, incoming) {
128
126
  const existing = readJson(filePath);
129
127
  if (!existing?.finalized || !isProtectedFinalStatus(existing.status)) return false;
@@ -695,19 +693,38 @@ function appendCheckpointResponse(state, response, input = {}) {
695
693
  setRunStatus(state, "running", at);
696
694
  persist(state);
697
695
  }
696
+ function checkpointResponseRejectedBlocker(state, input) {
697
+ const packet = input.packet || null;
698
+ const response = input.response || null;
699
+ appendRunEvent(state, {
700
+ kind: "checkpoint.response.rejected",
701
+ checkpoint: response?.checkpoint || packet?.checkpoint || input.blocker.checkpoint || null,
702
+ stage: packet?.stage || state.current_stage || "author",
703
+ summary: input.blocker.message,
704
+ details: compactRecord({
705
+ code: input.blocker.code,
706
+ decision: response?.decision,
707
+ resume_token: response?.resume_token,
708
+ packet_id: response?.packet_id,
709
+ source: response?.source
710
+ })
711
+ });
712
+ return { blocker: input.blocker };
713
+ }
698
714
  function checkpointResponseContinuation(state, value) {
699
715
  if (!value) return {};
700
716
  const packet = state.checkpoint_packet;
701
717
  const response = normalizeCheckpointResponse(value);
702
718
  if (!response) {
703
- return {
719
+ return checkpointResponseRejectedBlocker(state, {
720
+ packet,
704
721
  blocker: {
705
722
  code: "checkpoint_response_invalid",
706
723
  checkpoint: packet?.checkpoint || state.last_checkpoint || null,
707
724
  message: "Checkpoint response was not a valid riddle-proof.checkpoint_response.v1 object.",
708
725
  details: { checkpoint_packet: packet || null, checkpoint_summary: checkpointSummaryFromState(state) }
709
726
  }
710
- };
727
+ });
711
728
  }
712
729
  if (isDuplicateCheckpointResponse(state, response)) {
713
730
  const stage = packet?.stage || state.current_stage || "author";
@@ -738,17 +755,20 @@ function checkpointResponseContinuation(state, value) {
738
755
  };
739
756
  }
740
757
  if (!packet) {
741
- return {
758
+ return checkpointResponseRejectedBlocker(state, {
759
+ response,
742
760
  blocker: {
743
761
  code: "checkpoint_response_without_packet",
744
762
  checkpoint: response.checkpoint,
745
763
  message: "A checkpoint response was supplied, but the run state has no pending checkpoint packet.",
746
764
  details: { response, checkpoint_summary: checkpointSummaryFromState(state) }
747
765
  }
748
- };
766
+ });
749
767
  }
750
768
  if (response.run_id !== packet.run_id || response.checkpoint !== packet.checkpoint) {
751
- return {
769
+ return checkpointResponseRejectedBlocker(state, {
770
+ packet,
771
+ response,
752
772
  blocker: {
753
773
  code: "checkpoint_response_mismatch",
754
774
  checkpoint: packet.checkpoint,
@@ -759,10 +779,12 @@ function checkpointResponseContinuation(state, value) {
759
779
  actual: { run_id: response.run_id, checkpoint: response.checkpoint }
760
780
  }
761
781
  }
762
- };
782
+ });
763
783
  }
764
784
  if (packet.resume_token && response.resume_token !== packet.resume_token) {
765
- return {
785
+ return checkpointResponseRejectedBlocker(state, {
786
+ packet,
787
+ response,
766
788
  blocker: {
767
789
  code: "checkpoint_response_resume_token_mismatch",
768
790
  checkpoint: packet.checkpoint,
@@ -773,10 +795,12 @@ function checkpointResponseContinuation(state, value) {
773
795
  actual_resume_token: response.resume_token || null
774
796
  }
775
797
  }
776
- };
798
+ });
777
799
  }
778
800
  if (packet.packet_id && response.packet_id !== packet.packet_id) {
779
- return {
801
+ return checkpointResponseRejectedBlocker(state, {
802
+ packet,
803
+ response,
780
804
  blocker: {
781
805
  code: "checkpoint_response_packet_id_mismatch",
782
806
  checkpoint: packet.checkpoint,
@@ -789,10 +813,12 @@ function checkpointResponseContinuation(state, value) {
789
813
  actual_resume_token: response.resume_token || null
790
814
  }
791
815
  }
792
- };
816
+ });
793
817
  }
794
818
  if (!packet.allowed_decisions.includes(response.decision)) {
795
- return {
819
+ return checkpointResponseRejectedBlocker(state, {
820
+ packet,
821
+ response,
796
822
  blocker: {
797
823
  code: "checkpoint_response_decision_not_allowed",
798
824
  checkpoint: packet.checkpoint,
@@ -804,7 +830,7 @@ function checkpointResponseContinuation(state, value) {
804
830
  response
805
831
  }
806
832
  }
807
- };
833
+ });
808
834
  }
809
835
  const base = {
810
836
  action: "run",
@@ -814,14 +840,16 @@ function checkpointResponseContinuation(state, value) {
814
840
  if (response.decision === "author_packet") {
815
841
  const payload = authorPacketPayloadFromCheckpointResponse(response);
816
842
  if (!payload) {
817
- return {
843
+ return checkpointResponseRejectedBlocker(state, {
844
+ packet,
845
+ response,
818
846
  blocker: {
819
847
  code: "checkpoint_author_packet_missing",
820
848
  checkpoint: packet.checkpoint,
821
849
  message: "Checkpoint response decision=author_packet did not include a proof_plan and capture_script payload.",
822
850
  details: { stage: packet.stage, response }
823
851
  }
824
- };
852
+ });
825
853
  }
826
854
  state.proof_contract = proofContractFromAuthorCheckpointResponse(response, packet, payload);
827
855
  appendCheckpointResponse(state, response);
@@ -850,14 +878,16 @@ function checkpointResponseContinuation(state, value) {
850
878
  const workdir = nonEmptyString(packet.state_excerpt?.after_worktree) || state.worktree_path;
851
879
  if (workdir) state.worktree_path = workdir;
852
880
  if (!hasGitDiff(workdir)) {
853
- return {
881
+ return checkpointResponseRejectedBlocker(state, {
882
+ packet,
883
+ response,
854
884
  blocker: {
855
885
  code: "implementation_diff_missing",
856
886
  checkpoint: packet.checkpoint,
857
887
  message: "Checkpoint response claimed implementation_complete, but the after worktree has no detectable git diff.",
858
888
  details: { stage: packet.stage, worktree_path: workdir || null, response }
859
889
  }
860
- };
890
+ });
861
891
  }
862
892
  appendCheckpointResponse(state, response);
863
893
  return {
@@ -906,7 +936,13 @@ function checkpointResponseContinuation(state, value) {
906
936
  response,
907
937
  code: "checkpoint_response_source_not_trusted"
908
938
  });
909
- if (sourceBlocker) return { blocker: sourceBlocker };
939
+ if (sourceBlocker) {
940
+ return checkpointResponseRejectedBlocker(state, {
941
+ packet,
942
+ response,
943
+ blocker: sourceBlocker
944
+ });
945
+ }
910
946
  appendCheckpointResponse(state, response);
911
947
  if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
912
948
  const result = {
@@ -3,13 +3,13 @@ import {
3
3
  appendStageHeartbeat,
4
4
  createRunState,
5
5
  setRunStatus
6
- } from "./chunk-Q5GYD5RG.js";
6
+ } from "./chunk-UZIX7M7D.js";
7
7
  import {
8
8
  noImplementationModeFor
9
9
  } from "./chunk-EKZXU6MU.js";
10
10
  import {
11
11
  createRunResult
12
- } from "./chunk-W44XEGYW.js";
12
+ } from "./chunk-CUBYSWZT.js";
13
13
  import {
14
14
  __export
15
15
  } from "./chunk-MLKGABMK.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  statePathsForRunState
3
- } from "./chunk-QUK3SG24.js";
3
+ } from "./chunk-MOTQNIZX.js";
4
4
  import {
5
5
  compactRecord,
6
6
  isTerminalStatus,
7
7
  nonEmptyString,
8
8
  recordValue,
9
9
  shipControlStateFor
10
- } from "./chunk-W44XEGYW.js";
10
+ } from "./chunk-CUBYSWZT.js";
11
11
 
12
12
  // src/run-card.ts
13
13
  var RIDDLE_PROOF_RUN_CARD_VERSION = "riddle-proof.run-card.v1";
@@ -2,7 +2,7 @@ import {
2
2
  compactRecord,
3
3
  nonEmptyString,
4
4
  recordValue
5
- } from "./chunk-W44XEGYW.js";
5
+ } from "./chunk-CUBYSWZT.js";
6
6
 
7
7
  // src/checkpoint.ts
8
8
  import crypto from "crypto";
@@ -702,6 +702,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
702
702
  const packets = history.filter((entry) => entry.packet);
703
703
  const responses = acceptedCheckpointResponseEntries(state);
704
704
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
705
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
706
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
705
707
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
706
708
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
707
709
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -717,6 +719,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
717
719
  packet_count: packets.length,
718
720
  response_count: responses.length,
719
721
  duplicate_response_count: duplicateResponses.length,
722
+ rejected_response_count: rejectedResponses.length,
723
+ ignored_response_count: ignoredResponses.length,
720
724
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
721
725
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
722
726
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compactRecord
3
- } from "./chunk-W44XEGYW.js";
3
+ } from "./chunk-CUBYSWZT.js";
4
4
 
5
5
  // src/codex-exec-agent.ts
6
6
  import { execFileSync, spawnSync } from "child_process";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  normalizeIntegrationContext,
3
3
  normalizeRunParams
4
- } from "./chunk-Q5GYD5RG.js";
4
+ } from "./chunk-UZIX7M7D.js";
5
5
  import {
6
6
  compactRecord
7
- } from "./chunk-W44XEGYW.js";
7
+ } from "./chunk-CUBYSWZT.js";
8
8
 
9
9
  // src/openclaw.ts
10
10
  function parseOpenClawAssertions(value) {
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  createRiddleProofRunCard
3
- } from "./chunk-NYRMPWJB.js";
3
+ } from "./chunk-KNPCWWF3.js";
4
4
  import {
5
5
  compactRecord,
6
+ isProtectedFinalStatus,
6
7
  isTerminalStatus,
7
8
  nonEmptyString,
8
9
  recordValue,
9
10
  shipControlStateFor
10
- } from "./chunk-W44XEGYW.js";
11
+ } from "./chunk-CUBYSWZT.js";
11
12
 
12
13
  // src/state.ts
13
14
  var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
@@ -232,6 +233,7 @@ function createRunStatusSnapshot(state, at = timestamp()) {
232
233
  function setRunStatus(state, status, at = timestamp()) {
233
234
  state.status = status;
234
235
  state.ok = status !== "blocked" && status !== "failed";
236
+ if (isProtectedFinalStatus(status)) state.finalized = true;
235
237
  state.updated_at = at;
236
238
  return state;
237
239
  }
package/dist/cli/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import "../chunk-MYMTAVGP.js";
1
+ import "../chunk-54DIEDR3.js";
2
2
  import "../chunk-DI2XNGEZ.js";
3
3
  import "../chunk-6KYXX4OE.js";
4
4
  import "../chunk-EX7TO4I5.js";
5
- import "../chunk-QGE3KBRL.js";
6
- import "../chunk-Q5GYD5RG.js";
7
- import "../chunk-NYRMPWJB.js";
5
+ import "../chunk-GHBNDHG7.js";
6
+ import "../chunk-UZIX7M7D.js";
7
+ import "../chunk-KNPCWWF3.js";
8
8
  import "../chunk-EKZXU6MU.js";
9
- import "../chunk-QUK3SG24.js";
9
+ import "../chunk-MOTQNIZX.js";
10
10
  import "../chunk-JFQXAJH2.js";
11
- import "../chunk-SONWF3FQ.js";
12
- import "../chunk-W44XEGYW.js";
11
+ import "../chunk-RS4HJLJQ.js";
12
+ import "../chunk-CUBYSWZT.js";
13
13
  import "../chunk-MLKGABMK.js";
package/dist/cli.cjs CHANGED
@@ -3419,6 +3419,9 @@ var import_node_crypto3 = __toESM(require("crypto"), 1);
3419
3419
  function isTerminalStatus(status) {
3420
3420
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
3421
3421
  }
3422
+ function isProtectedFinalStatus(status) {
3423
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
3424
+ }
3422
3425
  function isSuccessfulStatus(status) {
3423
3426
  return status !== "blocked" && status !== "failed";
3424
3427
  }
@@ -3632,6 +3635,7 @@ function createRunResult(input) {
3632
3635
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
3633
3636
  state.status = status;
3634
3637
  state.ok = ok;
3638
+ if (isProtectedFinalStatus(status)) state.finalized = true;
3635
3639
  applyShipControlState(state, { status, raw: input.raw });
3636
3640
  return compactRecord({
3637
3641
  ok,
@@ -4379,6 +4383,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4379
4383
  const packets = history.filter((entry) => entry.packet);
4380
4384
  const responses = acceptedCheckpointResponseEntries(state);
4381
4385
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
4386
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
4387
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
4382
4388
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
4383
4389
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
4384
4390
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -4394,6 +4400,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4394
4400
  packet_count: packets.length,
4395
4401
  response_count: responses.length,
4396
4402
  duplicate_response_count: duplicateResponses.length,
4403
+ rejected_response_count: rejectedResponses.length,
4404
+ ignored_response_count: ignoredResponses.length,
4397
4405
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
4398
4406
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
4399
4407
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -4892,6 +4900,7 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
4892
4900
  function setRunStatus(state, status, at = timestamp2()) {
4893
4901
  state.status = status;
4894
4902
  state.ok = status !== "blocked" && status !== "failed";
4903
+ if (isProtectedFinalStatus(status)) state.finalized = true;
4895
4904
  state.updated_at = at;
4896
4905
  return state;
4897
4906
  }
@@ -4960,9 +4969,6 @@ function loadRunState(input) {
4960
4969
  state_path: statePath
4961
4970
  });
4962
4971
  }
4963
- function isProtectedFinalStatus(status) {
4964
- return status === "ready_to_ship" || status === "shipped" || status === "completed";
4965
- }
4966
4972
  function shouldPreserveFinalizedRunState(filePath, incoming) {
4967
4973
  const existing = readJson(filePath);
4968
4974
  if (!existing?.finalized || !isProtectedFinalStatus(existing.status)) return false;
@@ -5534,19 +5540,38 @@ function appendCheckpointResponse(state, response, input = {}) {
5534
5540
  setRunStatus(state, "running", at);
5535
5541
  persist(state);
5536
5542
  }
5543
+ function checkpointResponseRejectedBlocker(state, input) {
5544
+ const packet = input.packet || null;
5545
+ const response = input.response || null;
5546
+ appendRunEvent(state, {
5547
+ kind: "checkpoint.response.rejected",
5548
+ checkpoint: response?.checkpoint || packet?.checkpoint || input.blocker.checkpoint || null,
5549
+ stage: packet?.stage || state.current_stage || "author",
5550
+ summary: input.blocker.message,
5551
+ details: compactRecord({
5552
+ code: input.blocker.code,
5553
+ decision: response?.decision,
5554
+ resume_token: response?.resume_token,
5555
+ packet_id: response?.packet_id,
5556
+ source: response?.source
5557
+ })
5558
+ });
5559
+ return { blocker: input.blocker };
5560
+ }
5537
5561
  function checkpointResponseContinuation(state, value) {
5538
5562
  if (!value) return {};
5539
5563
  const packet = state.checkpoint_packet;
5540
5564
  const response = normalizeCheckpointResponse(value);
5541
5565
  if (!response) {
5542
- return {
5566
+ return checkpointResponseRejectedBlocker(state, {
5567
+ packet,
5543
5568
  blocker: {
5544
5569
  code: "checkpoint_response_invalid",
5545
5570
  checkpoint: packet?.checkpoint || state.last_checkpoint || null,
5546
5571
  message: "Checkpoint response was not a valid riddle-proof.checkpoint_response.v1 object.",
5547
5572
  details: { checkpoint_packet: packet || null, checkpoint_summary: checkpointSummaryFromState(state) }
5548
5573
  }
5549
- };
5574
+ });
5550
5575
  }
5551
5576
  if (isDuplicateCheckpointResponse(state, response)) {
5552
5577
  const stage = packet?.stage || state.current_stage || "author";
@@ -5577,17 +5602,20 @@ function checkpointResponseContinuation(state, value) {
5577
5602
  };
5578
5603
  }
5579
5604
  if (!packet) {
5580
- return {
5605
+ return checkpointResponseRejectedBlocker(state, {
5606
+ response,
5581
5607
  blocker: {
5582
5608
  code: "checkpoint_response_without_packet",
5583
5609
  checkpoint: response.checkpoint,
5584
5610
  message: "A checkpoint response was supplied, but the run state has no pending checkpoint packet.",
5585
5611
  details: { response, checkpoint_summary: checkpointSummaryFromState(state) }
5586
5612
  }
5587
- };
5613
+ });
5588
5614
  }
5589
5615
  if (response.run_id !== packet.run_id || response.checkpoint !== packet.checkpoint) {
5590
- return {
5616
+ return checkpointResponseRejectedBlocker(state, {
5617
+ packet,
5618
+ response,
5591
5619
  blocker: {
5592
5620
  code: "checkpoint_response_mismatch",
5593
5621
  checkpoint: packet.checkpoint,
@@ -5598,10 +5626,12 @@ function checkpointResponseContinuation(state, value) {
5598
5626
  actual: { run_id: response.run_id, checkpoint: response.checkpoint }
5599
5627
  }
5600
5628
  }
5601
- };
5629
+ });
5602
5630
  }
5603
5631
  if (packet.resume_token && response.resume_token !== packet.resume_token) {
5604
- return {
5632
+ return checkpointResponseRejectedBlocker(state, {
5633
+ packet,
5634
+ response,
5605
5635
  blocker: {
5606
5636
  code: "checkpoint_response_resume_token_mismatch",
5607
5637
  checkpoint: packet.checkpoint,
@@ -5612,10 +5642,12 @@ function checkpointResponseContinuation(state, value) {
5612
5642
  actual_resume_token: response.resume_token || null
5613
5643
  }
5614
5644
  }
5615
- };
5645
+ });
5616
5646
  }
5617
5647
  if (packet.packet_id && response.packet_id !== packet.packet_id) {
5618
- return {
5648
+ return checkpointResponseRejectedBlocker(state, {
5649
+ packet,
5650
+ response,
5619
5651
  blocker: {
5620
5652
  code: "checkpoint_response_packet_id_mismatch",
5621
5653
  checkpoint: packet.checkpoint,
@@ -5628,10 +5660,12 @@ function checkpointResponseContinuation(state, value) {
5628
5660
  actual_resume_token: response.resume_token || null
5629
5661
  }
5630
5662
  }
5631
- };
5663
+ });
5632
5664
  }
5633
5665
  if (!packet.allowed_decisions.includes(response.decision)) {
5634
- return {
5666
+ return checkpointResponseRejectedBlocker(state, {
5667
+ packet,
5668
+ response,
5635
5669
  blocker: {
5636
5670
  code: "checkpoint_response_decision_not_allowed",
5637
5671
  checkpoint: packet.checkpoint,
@@ -5643,7 +5677,7 @@ function checkpointResponseContinuation(state, value) {
5643
5677
  response
5644
5678
  }
5645
5679
  }
5646
- };
5680
+ });
5647
5681
  }
5648
5682
  const base = {
5649
5683
  action: "run",
@@ -5653,14 +5687,16 @@ function checkpointResponseContinuation(state, value) {
5653
5687
  if (response.decision === "author_packet") {
5654
5688
  const payload = authorPacketPayloadFromCheckpointResponse(response);
5655
5689
  if (!payload) {
5656
- return {
5690
+ return checkpointResponseRejectedBlocker(state, {
5691
+ packet,
5692
+ response,
5657
5693
  blocker: {
5658
5694
  code: "checkpoint_author_packet_missing",
5659
5695
  checkpoint: packet.checkpoint,
5660
5696
  message: "Checkpoint response decision=author_packet did not include a proof_plan and capture_script payload.",
5661
5697
  details: { stage: packet.stage, response }
5662
5698
  }
5663
- };
5699
+ });
5664
5700
  }
5665
5701
  state.proof_contract = proofContractFromAuthorCheckpointResponse(response, packet, payload);
5666
5702
  appendCheckpointResponse(state, response);
@@ -5689,14 +5725,16 @@ function checkpointResponseContinuation(state, value) {
5689
5725
  const workdir = nonEmptyString(packet.state_excerpt?.after_worktree) || state.worktree_path;
5690
5726
  if (workdir) state.worktree_path = workdir;
5691
5727
  if (!hasGitDiff(workdir)) {
5692
- return {
5728
+ return checkpointResponseRejectedBlocker(state, {
5729
+ packet,
5730
+ response,
5693
5731
  blocker: {
5694
5732
  code: "implementation_diff_missing",
5695
5733
  checkpoint: packet.checkpoint,
5696
5734
  message: "Checkpoint response claimed implementation_complete, but the after worktree has no detectable git diff.",
5697
5735
  details: { stage: packet.stage, worktree_path: workdir || null, response }
5698
5736
  }
5699
- };
5737
+ });
5700
5738
  }
5701
5739
  appendCheckpointResponse(state, response);
5702
5740
  return {
@@ -5745,7 +5783,13 @@ function checkpointResponseContinuation(state, value) {
5745
5783
  response,
5746
5784
  code: "checkpoint_response_source_not_trusted"
5747
5785
  });
5748
- if (sourceBlocker) return { blocker: sourceBlocker };
5786
+ if (sourceBlocker) {
5787
+ return checkpointResponseRejectedBlocker(state, {
5788
+ packet,
5789
+ response,
5790
+ blocker: sourceBlocker
5791
+ });
5792
+ }
5749
5793
  appendCheckpointResponse(state, response);
5750
5794
  if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
5751
5795
  const result = {
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-MYMTAVGP.js";
2
+ import "./chunk-54DIEDR3.js";
3
3
  import "./chunk-DI2XNGEZ.js";
4
4
  import "./chunk-6KYXX4OE.js";
5
5
  import "./chunk-EX7TO4I5.js";
6
- import "./chunk-QGE3KBRL.js";
7
- import "./chunk-Q5GYD5RG.js";
8
- import "./chunk-NYRMPWJB.js";
6
+ import "./chunk-GHBNDHG7.js";
7
+ import "./chunk-UZIX7M7D.js";
8
+ import "./chunk-KNPCWWF3.js";
9
9
  import "./chunk-EKZXU6MU.js";
10
- import "./chunk-QUK3SG24.js";
10
+ import "./chunk-MOTQNIZX.js";
11
11
  import "./chunk-JFQXAJH2.js";
12
- import "./chunk-SONWF3FQ.js";
13
- import "./chunk-W44XEGYW.js";
12
+ import "./chunk-RS4HJLJQ.js";
13
+ import "./chunk-CUBYSWZT.js";
14
14
  import "./chunk-MLKGABMK.js";
@@ -2,8 +2,8 @@ import {
2
2
  createCodexExecAgentAdapter,
3
3
  createCodexExecJsonRunner,
4
4
  runCodexExecAgentDoctor
5
- } from "./chunk-SONWF3FQ.js";
6
- import "./chunk-W44XEGYW.js";
5
+ } from "./chunk-RS4HJLJQ.js";
6
+ import "./chunk-CUBYSWZT.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
  export {
9
9
  createCodexExecAgentAdapter,