@riddledc/riddle-proof 0.8.55 → 0.8.57

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 (71) 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-W44XEGYW.js → chunk-CUBYSWZT.js} +5 -0
  18. package/dist/{chunk-QGE3KBRL.js → chunk-GHBNDHG7.js} +60 -24
  19. package/dist/{chunk-F65S5LT2.js → chunk-JLOZTVXU.js} +2 -2
  20. package/dist/{chunk-6KYXX4OE.js → chunk-JR7GFTLS.js} +89 -2
  21. package/dist/{chunk-NYRMPWJB.js → chunk-KNPCWWF3.js} +2 -2
  22. package/dist/{chunk-MYMTAVGP.js → chunk-LUFT7AGY.js} +4 -4
  23. package/dist/{chunk-QUK3SG24.js → chunk-MOTQNIZX.js} +5 -1
  24. package/dist/{chunk-SONWF3FQ.js → chunk-RS4HJLJQ.js} +1 -1
  25. package/dist/{chunk-J2ZNL3H3.js → chunk-TTB3ZAVX.js} +2 -2
  26. package/dist/{chunk-Q5GYD5RG.js → chunk-UZIX7M7D.js} +4 -2
  27. package/dist/cli/index.js +8 -8
  28. package/dist/cli.cjs +153 -22
  29. package/dist/cli.js +8 -8
  30. package/dist/codex-exec-agent.js +2 -2
  31. package/dist/engine-harness.cjs +64 -20
  32. package/dist/engine-harness.js +5 -5
  33. package/dist/index.cjs +155 -22
  34. package/dist/index.d.cts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +10 -8
  37. package/dist/local-agent.js +2 -2
  38. package/dist/openclaw.js +5 -5
  39. package/dist/pr-comment.cjs +89 -2
  40. package/dist/pr-comment.d.cts +18 -1
  41. package/dist/pr-comment.d.ts +18 -1
  42. package/dist/pr-comment.js +1 -1
  43. package/dist/{proof-run-engine-MiKZt9oY.d.ts → proof-run-engine-BqRoA3Do.d.ts} +3 -3
  44. package/dist/{proof-run-engine-Baiv6l3A.d.cts → proof-run-engine-DpChFR5H.d.cts} +3 -3
  45. package/dist/proof-run-engine.d.cts +1 -1
  46. package/dist/proof-run-engine.d.ts +1 -1
  47. package/dist/result.cjs +6 -0
  48. package/dist/result.d.cts +2 -1
  49. package/dist/result.d.ts +2 -1
  50. package/dist/result.js +3 -1
  51. package/dist/run-card.js +3 -3
  52. package/dist/runner.cjs +5 -0
  53. package/dist/runner.js +5 -5
  54. package/dist/spec/checkpoint.cjs +4 -0
  55. package/dist/spec/checkpoint.js +2 -2
  56. package/dist/spec/index.cjs +11 -0
  57. package/dist/spec/index.d.cts +1 -1
  58. package/dist/spec/index.d.ts +1 -1
  59. package/dist/spec/index.js +6 -4
  60. package/dist/spec/result.cjs +6 -0
  61. package/dist/spec/result.d.cts +1 -1
  62. package/dist/spec/result.d.ts +1 -1
  63. package/dist/spec/result.js +3 -1
  64. package/dist/spec/run-card.js +3 -3
  65. package/dist/spec/state.cjs +4 -0
  66. package/dist/spec/state.js +4 -4
  67. package/dist/state.cjs +4 -0
  68. package/dist/state.js +4 -4
  69. package/dist/types.d.cts +2 -0
  70. package/dist/types.d.ts +2 -0
  71. package/package.json +1 -1
@@ -3,8 +3,8 @@ import {
3
3
  createCodexExecAgentAdapter,
4
4
  createCodexExecJsonRunner,
5
5
  runCodexExecAgentDoctor
6
- } from "../chunk-SONWF3FQ.js";
7
- import "../chunk-W44XEGYW.js";
6
+ } from "../chunk-RS4HJLJQ.js";
7
+ import "../chunk-CUBYSWZT.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
10
10
  createCodexExecAgentAdapter,
@@ -3,8 +3,8 @@ import {
3
3
  createCodexExecAgentAdapter,
4
4
  createCodexExecJsonRunner,
5
5
  runCodexExecAgentDoctor
6
- } from "../chunk-SONWF3FQ.js";
7
- import "../chunk-W44XEGYW.js";
6
+ } from "../chunk-RS4HJLJQ.js";
7
+ import "../chunk-CUBYSWZT.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
10
10
  createCodexExecAgentAdapter,
@@ -3,8 +3,8 @@ import {
3
3
  createCodexExecAgentAdapter,
4
4
  createCodexExecJsonRunner,
5
5
  runCodexExecAgentDoctor
6
- } from "../chunk-SONWF3FQ.js";
7
- import "../chunk-W44XEGYW.js";
6
+ } from "../chunk-RS4HJLJQ.js";
7
+ import "../chunk-CUBYSWZT.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
10
10
  createCodexExecAgentAdapter as createLocalAgentAdapter,
@@ -3,11 +3,11 @@ import {
3
3
  parseOpenClawAssertions,
4
4
  parseOpenClawJsonObjectOrArray,
5
5
  toRiddleProofRunParams
6
- } from "../chunk-J2ZNL3H3.js";
7
- import "../chunk-Q5GYD5RG.js";
8
- import "../chunk-NYRMPWJB.js";
9
- import "../chunk-QUK3SG24.js";
10
- import "../chunk-W44XEGYW.js";
6
+ } from "../chunk-TTB3ZAVX.js";
7
+ import "../chunk-UZIX7M7D.js";
8
+ import "../chunk-KNPCWWF3.js";
9
+ import "../chunk-MOTQNIZX.js";
10
+ import "../chunk-CUBYSWZT.js";
11
11
  import "../chunk-MLKGABMK.js";
12
12
  export {
13
13
  openClawIntegrationContext,
@@ -3423,6 +3423,9 @@ var import_node_crypto3 = __toESM(require("crypto"), 1);
3423
3423
  function isTerminalStatus(status) {
3424
3424
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
3425
3425
  }
3426
+ function isProtectedFinalStatus(status) {
3427
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
3428
+ }
3426
3429
  function isSuccessfulStatus(status) {
3427
3430
  return status !== "blocked" && status !== "failed";
3428
3431
  }
@@ -3636,6 +3639,7 @@ function createRunResult(input) {
3636
3639
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
3637
3640
  state.status = status;
3638
3641
  state.ok = ok;
3642
+ if (isProtectedFinalStatus(status)) state.finalized = true;
3639
3643
  applyShipControlState(state, { status, raw: input.raw });
3640
3644
  return compactRecord({
3641
3645
  ok,
@@ -4293,6 +4297,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4293
4297
  const packets = history.filter((entry) => entry.packet);
4294
4298
  const responses = acceptedCheckpointResponseEntries(state);
4295
4299
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
4300
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
4301
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
4296
4302
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
4297
4303
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
4298
4304
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -4308,6 +4314,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4308
4314
  packet_count: packets.length,
4309
4315
  response_count: responses.length,
4310
4316
  duplicate_response_count: duplicateResponses.length,
4317
+ rejected_response_count: rejectedResponses.length,
4318
+ ignored_response_count: ignoredResponses.length,
4311
4319
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
4312
4320
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
4313
4321
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -4806,6 +4814,7 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
4806
4814
  function setRunStatus(state, status, at = timestamp2()) {
4807
4815
  state.status = status;
4808
4816
  state.ok = status !== "blocked" && status !== "failed";
4817
+ if (isProtectedFinalStatus(status)) state.finalized = true;
4809
4818
  state.updated_at = at;
4810
4819
  return state;
4811
4820
  }
@@ -4874,9 +4883,6 @@ function loadRunState(input) {
4874
4883
  state_path: statePath
4875
4884
  });
4876
4885
  }
4877
- function isProtectedFinalStatus(status) {
4878
- return status === "ready_to_ship" || status === "shipped" || status === "completed";
4879
- }
4880
4886
  function shouldPreserveFinalizedRunState(filePath, incoming) {
4881
4887
  const existing = readJson(filePath);
4882
4888
  if (!existing?.finalized || !isProtectedFinalStatus(existing.status)) return false;
@@ -5448,19 +5454,38 @@ function appendCheckpointResponse(state, response, input = {}) {
5448
5454
  setRunStatus(state, "running", at);
5449
5455
  persist(state);
5450
5456
  }
5457
+ function checkpointResponseRejectedBlocker(state, input) {
5458
+ const packet = input.packet || null;
5459
+ const response = input.response || null;
5460
+ appendRunEvent(state, {
5461
+ kind: "checkpoint.response.rejected",
5462
+ checkpoint: response?.checkpoint || packet?.checkpoint || input.blocker.checkpoint || null,
5463
+ stage: packet?.stage || state.current_stage || "author",
5464
+ summary: input.blocker.message,
5465
+ details: compactRecord({
5466
+ code: input.blocker.code,
5467
+ decision: response?.decision,
5468
+ resume_token: response?.resume_token,
5469
+ packet_id: response?.packet_id,
5470
+ source: response?.source
5471
+ })
5472
+ });
5473
+ return { blocker: input.blocker };
5474
+ }
5451
5475
  function checkpointResponseContinuation(state, value) {
5452
5476
  if (!value) return {};
5453
5477
  const packet = state.checkpoint_packet;
5454
5478
  const response = normalizeCheckpointResponse(value);
5455
5479
  if (!response) {
5456
- return {
5480
+ return checkpointResponseRejectedBlocker(state, {
5481
+ packet,
5457
5482
  blocker: {
5458
5483
  code: "checkpoint_response_invalid",
5459
5484
  checkpoint: packet?.checkpoint || state.last_checkpoint || null,
5460
5485
  message: "Checkpoint response was not a valid riddle-proof.checkpoint_response.v1 object.",
5461
5486
  details: { checkpoint_packet: packet || null, checkpoint_summary: checkpointSummaryFromState(state) }
5462
5487
  }
5463
- };
5488
+ });
5464
5489
  }
5465
5490
  if (isDuplicateCheckpointResponse(state, response)) {
5466
5491
  const stage = packet?.stage || state.current_stage || "author";
@@ -5491,17 +5516,20 @@ function checkpointResponseContinuation(state, value) {
5491
5516
  };
5492
5517
  }
5493
5518
  if (!packet) {
5494
- return {
5519
+ return checkpointResponseRejectedBlocker(state, {
5520
+ response,
5495
5521
  blocker: {
5496
5522
  code: "checkpoint_response_without_packet",
5497
5523
  checkpoint: response.checkpoint,
5498
5524
  message: "A checkpoint response was supplied, but the run state has no pending checkpoint packet.",
5499
5525
  details: { response, checkpoint_summary: checkpointSummaryFromState(state) }
5500
5526
  }
5501
- };
5527
+ });
5502
5528
  }
5503
5529
  if (response.run_id !== packet.run_id || response.checkpoint !== packet.checkpoint) {
5504
- return {
5530
+ return checkpointResponseRejectedBlocker(state, {
5531
+ packet,
5532
+ response,
5505
5533
  blocker: {
5506
5534
  code: "checkpoint_response_mismatch",
5507
5535
  checkpoint: packet.checkpoint,
@@ -5512,10 +5540,12 @@ function checkpointResponseContinuation(state, value) {
5512
5540
  actual: { run_id: response.run_id, checkpoint: response.checkpoint }
5513
5541
  }
5514
5542
  }
5515
- };
5543
+ });
5516
5544
  }
5517
5545
  if (packet.resume_token && response.resume_token !== packet.resume_token) {
5518
- return {
5546
+ return checkpointResponseRejectedBlocker(state, {
5547
+ packet,
5548
+ response,
5519
5549
  blocker: {
5520
5550
  code: "checkpoint_response_resume_token_mismatch",
5521
5551
  checkpoint: packet.checkpoint,
@@ -5526,10 +5556,12 @@ function checkpointResponseContinuation(state, value) {
5526
5556
  actual_resume_token: response.resume_token || null
5527
5557
  }
5528
5558
  }
5529
- };
5559
+ });
5530
5560
  }
5531
5561
  if (packet.packet_id && response.packet_id !== packet.packet_id) {
5532
- return {
5562
+ return checkpointResponseRejectedBlocker(state, {
5563
+ packet,
5564
+ response,
5533
5565
  blocker: {
5534
5566
  code: "checkpoint_response_packet_id_mismatch",
5535
5567
  checkpoint: packet.checkpoint,
@@ -5542,10 +5574,12 @@ function checkpointResponseContinuation(state, value) {
5542
5574
  actual_resume_token: response.resume_token || null
5543
5575
  }
5544
5576
  }
5545
- };
5577
+ });
5546
5578
  }
5547
5579
  if (!packet.allowed_decisions.includes(response.decision)) {
5548
- return {
5580
+ return checkpointResponseRejectedBlocker(state, {
5581
+ packet,
5582
+ response,
5549
5583
  blocker: {
5550
5584
  code: "checkpoint_response_decision_not_allowed",
5551
5585
  checkpoint: packet.checkpoint,
@@ -5557,7 +5591,7 @@ function checkpointResponseContinuation(state, value) {
5557
5591
  response
5558
5592
  }
5559
5593
  }
5560
- };
5594
+ });
5561
5595
  }
5562
5596
  const base = {
5563
5597
  action: "run",
@@ -5567,14 +5601,16 @@ function checkpointResponseContinuation(state, value) {
5567
5601
  if (response.decision === "author_packet") {
5568
5602
  const payload = authorPacketPayloadFromCheckpointResponse(response);
5569
5603
  if (!payload) {
5570
- return {
5604
+ return checkpointResponseRejectedBlocker(state, {
5605
+ packet,
5606
+ response,
5571
5607
  blocker: {
5572
5608
  code: "checkpoint_author_packet_missing",
5573
5609
  checkpoint: packet.checkpoint,
5574
5610
  message: "Checkpoint response decision=author_packet did not include a proof_plan and capture_script payload.",
5575
5611
  details: { stage: packet.stage, response }
5576
5612
  }
5577
- };
5613
+ });
5578
5614
  }
5579
5615
  state.proof_contract = proofContractFromAuthorCheckpointResponse(response, packet, payload);
5580
5616
  appendCheckpointResponse(state, response);
@@ -5603,14 +5639,16 @@ function checkpointResponseContinuation(state, value) {
5603
5639
  const workdir = nonEmptyString(packet.state_excerpt?.after_worktree) || state.worktree_path;
5604
5640
  if (workdir) state.worktree_path = workdir;
5605
5641
  if (!hasGitDiff(workdir)) {
5606
- return {
5642
+ return checkpointResponseRejectedBlocker(state, {
5643
+ packet,
5644
+ response,
5607
5645
  blocker: {
5608
5646
  code: "implementation_diff_missing",
5609
5647
  checkpoint: packet.checkpoint,
5610
5648
  message: "Checkpoint response claimed implementation_complete, but the after worktree has no detectable git diff.",
5611
5649
  details: { stage: packet.stage, worktree_path: workdir || null, response }
5612
5650
  }
5613
- };
5651
+ });
5614
5652
  }
5615
5653
  appendCheckpointResponse(state, response);
5616
5654
  return {
@@ -5659,7 +5697,13 @@ function checkpointResponseContinuation(state, value) {
5659
5697
  response,
5660
5698
  code: "checkpoint_response_source_not_trusted"
5661
5699
  });
5662
- if (sourceBlocker) return { blocker: sourceBlocker };
5700
+ if (sourceBlocker) {
5701
+ return checkpointResponseRejectedBlocker(state, {
5702
+ packet,
5703
+ response,
5704
+ blocker: sourceBlocker
5705
+ });
5706
+ }
5663
5707
  appendCheckpointResponse(state, response);
5664
5708
  if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
5665
5709
  const result = {
@@ -2,12 +2,12 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-QGE3KBRL.js";
6
- import "../chunk-Q5GYD5RG.js";
7
- import "../chunk-NYRMPWJB.js";
5
+ } from "../chunk-GHBNDHG7.js";
6
+ import "../chunk-UZIX7M7D.js";
7
+ import "../chunk-KNPCWWF3.js";
8
8
  import "../chunk-EKZXU6MU.js";
9
- import "../chunk-QUK3SG24.js";
10
- import "../chunk-W44XEGYW.js";
9
+ import "../chunk-MOTQNIZX.js";
10
+ import "../chunk-CUBYSWZT.js";
11
11
  import "../chunk-MLKGABMK.js";
12
12
  export {
13
13
  createDisabledRiddleProofAgentAdapter,
@@ -3457,6 +3457,9 @@ __export(runner_exports, {
3457
3457
  function isTerminalStatus(status) {
3458
3458
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
3459
3459
  }
3460
+ function isProtectedFinalStatus(status) {
3461
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
3462
+ }
3460
3463
  function isSuccessfulStatus(status) {
3461
3464
  return status !== "blocked" && status !== "failed";
3462
3465
  }
@@ -3670,6 +3673,7 @@ function createRunResult(input) {
3670
3673
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
3671
3674
  state.status = status;
3672
3675
  state.ok = ok;
3676
+ if (isProtectedFinalStatus(status)) state.finalized = true;
3673
3677
  applyShipControlState(state, { status, raw: input.raw });
3674
3678
  return compactRecord({
3675
3679
  ok,
@@ -4327,6 +4331,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4327
4331
  const packets = history.filter((entry) => entry.packet);
4328
4332
  const responses = acceptedCheckpointResponseEntries(state);
4329
4333
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
4334
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
4335
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
4330
4336
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
4331
4337
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
4332
4338
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -4342,6 +4348,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4342
4348
  packet_count: packets.length,
4343
4349
  response_count: responses.length,
4344
4350
  duplicate_response_count: duplicateResponses.length,
4351
+ rejected_response_count: rejectedResponses.length,
4352
+ ignored_response_count: ignoredResponses.length,
4345
4353
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
4346
4354
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
4347
4355
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -4840,6 +4848,7 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
4840
4848
  function setRunStatus(state, status, at = timestamp2()) {
4841
4849
  state.status = status;
4842
4850
  state.ok = status !== "blocked" && status !== "failed";
4851
+ if (isProtectedFinalStatus(status)) state.finalized = true;
4843
4852
  state.updated_at = at;
4844
4853
  return state;
4845
4854
  }
@@ -5413,9 +5422,6 @@ function loadRunState(input) {
5413
5422
  state_path: statePath
5414
5423
  });
5415
5424
  }
5416
- function isProtectedFinalStatus(status) {
5417
- return status === "ready_to_ship" || status === "shipped" || status === "completed";
5418
- }
5419
5425
  function shouldPreserveFinalizedRunState(filePath, incoming) {
5420
5426
  const existing = readJson(filePath);
5421
5427
  if (!existing?.finalized || !isProtectedFinalStatus(existing.status)) return false;
@@ -5987,19 +5993,38 @@ function appendCheckpointResponse(state, response, input = {}) {
5987
5993
  setRunStatus(state, "running", at);
5988
5994
  persist(state);
5989
5995
  }
5996
+ function checkpointResponseRejectedBlocker(state, input) {
5997
+ const packet = input.packet || null;
5998
+ const response = input.response || null;
5999
+ appendRunEvent(state, {
6000
+ kind: "checkpoint.response.rejected",
6001
+ checkpoint: response?.checkpoint || packet?.checkpoint || input.blocker.checkpoint || null,
6002
+ stage: packet?.stage || state.current_stage || "author",
6003
+ summary: input.blocker.message,
6004
+ details: compactRecord({
6005
+ code: input.blocker.code,
6006
+ decision: response?.decision,
6007
+ resume_token: response?.resume_token,
6008
+ packet_id: response?.packet_id,
6009
+ source: response?.source
6010
+ })
6011
+ });
6012
+ return { blocker: input.blocker };
6013
+ }
5990
6014
  function checkpointResponseContinuation(state, value) {
5991
6015
  if (!value) return {};
5992
6016
  const packet = state.checkpoint_packet;
5993
6017
  const response = normalizeCheckpointResponse(value);
5994
6018
  if (!response) {
5995
- return {
6019
+ return checkpointResponseRejectedBlocker(state, {
6020
+ packet,
5996
6021
  blocker: {
5997
6022
  code: "checkpoint_response_invalid",
5998
6023
  checkpoint: packet?.checkpoint || state.last_checkpoint || null,
5999
6024
  message: "Checkpoint response was not a valid riddle-proof.checkpoint_response.v1 object.",
6000
6025
  details: { checkpoint_packet: packet || null, checkpoint_summary: checkpointSummaryFromState(state) }
6001
6026
  }
6002
- };
6027
+ });
6003
6028
  }
6004
6029
  if (isDuplicateCheckpointResponse(state, response)) {
6005
6030
  const stage = packet?.stage || state.current_stage || "author";
@@ -6030,17 +6055,20 @@ function checkpointResponseContinuation(state, value) {
6030
6055
  };
6031
6056
  }
6032
6057
  if (!packet) {
6033
- return {
6058
+ return checkpointResponseRejectedBlocker(state, {
6059
+ response,
6034
6060
  blocker: {
6035
6061
  code: "checkpoint_response_without_packet",
6036
6062
  checkpoint: response.checkpoint,
6037
6063
  message: "A checkpoint response was supplied, but the run state has no pending checkpoint packet.",
6038
6064
  details: { response, checkpoint_summary: checkpointSummaryFromState(state) }
6039
6065
  }
6040
- };
6066
+ });
6041
6067
  }
6042
6068
  if (response.run_id !== packet.run_id || response.checkpoint !== packet.checkpoint) {
6043
- return {
6069
+ return checkpointResponseRejectedBlocker(state, {
6070
+ packet,
6071
+ response,
6044
6072
  blocker: {
6045
6073
  code: "checkpoint_response_mismatch",
6046
6074
  checkpoint: packet.checkpoint,
@@ -6051,10 +6079,12 @@ function checkpointResponseContinuation(state, value) {
6051
6079
  actual: { run_id: response.run_id, checkpoint: response.checkpoint }
6052
6080
  }
6053
6081
  }
6054
- };
6082
+ });
6055
6083
  }
6056
6084
  if (packet.resume_token && response.resume_token !== packet.resume_token) {
6057
- return {
6085
+ return checkpointResponseRejectedBlocker(state, {
6086
+ packet,
6087
+ response,
6058
6088
  blocker: {
6059
6089
  code: "checkpoint_response_resume_token_mismatch",
6060
6090
  checkpoint: packet.checkpoint,
@@ -6065,10 +6095,12 @@ function checkpointResponseContinuation(state, value) {
6065
6095
  actual_resume_token: response.resume_token || null
6066
6096
  }
6067
6097
  }
6068
- };
6098
+ });
6069
6099
  }
6070
6100
  if (packet.packet_id && response.packet_id !== packet.packet_id) {
6071
- return {
6101
+ return checkpointResponseRejectedBlocker(state, {
6102
+ packet,
6103
+ response,
6072
6104
  blocker: {
6073
6105
  code: "checkpoint_response_packet_id_mismatch",
6074
6106
  checkpoint: packet.checkpoint,
@@ -6081,10 +6113,12 @@ function checkpointResponseContinuation(state, value) {
6081
6113
  actual_resume_token: response.resume_token || null
6082
6114
  }
6083
6115
  }
6084
- };
6116
+ });
6085
6117
  }
6086
6118
  if (!packet.allowed_decisions.includes(response.decision)) {
6087
- return {
6119
+ return checkpointResponseRejectedBlocker(state, {
6120
+ packet,
6121
+ response,
6088
6122
  blocker: {
6089
6123
  code: "checkpoint_response_decision_not_allowed",
6090
6124
  checkpoint: packet.checkpoint,
@@ -6096,7 +6130,7 @@ function checkpointResponseContinuation(state, value) {
6096
6130
  response
6097
6131
  }
6098
6132
  }
6099
- };
6133
+ });
6100
6134
  }
6101
6135
  const base = {
6102
6136
  action: "run",
@@ -6106,14 +6140,16 @@ function checkpointResponseContinuation(state, value) {
6106
6140
  if (response.decision === "author_packet") {
6107
6141
  const payload = authorPacketPayloadFromCheckpointResponse(response);
6108
6142
  if (!payload) {
6109
- return {
6143
+ return checkpointResponseRejectedBlocker(state, {
6144
+ packet,
6145
+ response,
6110
6146
  blocker: {
6111
6147
  code: "checkpoint_author_packet_missing",
6112
6148
  checkpoint: packet.checkpoint,
6113
6149
  message: "Checkpoint response decision=author_packet did not include a proof_plan and capture_script payload.",
6114
6150
  details: { stage: packet.stage, response }
6115
6151
  }
6116
- };
6152
+ });
6117
6153
  }
6118
6154
  state.proof_contract = proofContractFromAuthorCheckpointResponse(response, packet, payload);
6119
6155
  appendCheckpointResponse(state, response);
@@ -6142,14 +6178,16 @@ function checkpointResponseContinuation(state, value) {
6142
6178
  const workdir = nonEmptyString(packet.state_excerpt?.after_worktree) || state.worktree_path;
6143
6179
  if (workdir) state.worktree_path = workdir;
6144
6180
  if (!hasGitDiff(workdir)) {
6145
- return {
6181
+ return checkpointResponseRejectedBlocker(state, {
6182
+ packet,
6183
+ response,
6146
6184
  blocker: {
6147
6185
  code: "implementation_diff_missing",
6148
6186
  checkpoint: packet.checkpoint,
6149
6187
  message: "Checkpoint response claimed implementation_complete, but the after worktree has no detectable git diff.",
6150
6188
  details: { stage: packet.stage, worktree_path: workdir || null, response }
6151
6189
  }
6152
- };
6190
+ });
6153
6191
  }
6154
6192
  appendCheckpointResponse(state, response);
6155
6193
  return {
@@ -6198,7 +6236,13 @@ function checkpointResponseContinuation(state, value) {
6198
6236
  response,
6199
6237
  code: "checkpoint_response_source_not_trusted"
6200
6238
  });
6201
- if (sourceBlocker) return { blocker: sourceBlocker };
6239
+ if (sourceBlocker) {
6240
+ return checkpointResponseRejectedBlocker(state, {
6241
+ packet,
6242
+ response,
6243
+ blocker: sourceBlocker
6244
+ });
6245
+ }
6202
6246
  appendCheckpointResponse(state, response);
6203
6247
  if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
6204
6248
  const result = {
@@ -1,5 +1,5 @@
1
1
  export { b as runner } from '../runner-4LJ5z0D-.cjs';
2
2
  export { l as engineHarness } from '../engine-harness-LBfqbFSe.cjs';
3
3
  export { p as proofRunCore } from '../proof-run-core-7Dqm7RKM.cjs';
4
- export { p as proofRunEngine } from '../proof-run-engine-Baiv6l3A.cjs';
4
+ export { p as proofRunEngine } from '../proof-run-engine-DpChFR5H.cjs';
5
5
  import '../types.cjs';
@@ -1,5 +1,5 @@
1
1
  export { b as runner } from '../runner-BdQpOkZD.js';
2
2
  export { l as engineHarness } from '../engine-harness-CMACHP6A.js';
3
3
  export { p as proofRunCore } from '../proof-run-core-7Dqm7RKM.js';
4
- export { p as proofRunEngine } from '../proof-run-engine-MiKZt9oY.js';
4
+ export { p as proofRunEngine } from '../proof-run-engine-BqRoA3Do.js';
5
5
  import '../types.js';
@@ -3,17 +3,17 @@ import {
3
3
  } from "../chunk-VYJD6XYF.js";
4
4
  import {
5
5
  runner_exports
6
- } from "../chunk-F65S5LT2.js";
6
+ } from "../chunk-JLOZTVXU.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-QGE3KBRL.js";
10
- import "../chunk-Q5GYD5RG.js";
11
- import "../chunk-NYRMPWJB.js";
9
+ } from "../chunk-GHBNDHG7.js";
10
+ import "../chunk-UZIX7M7D.js";
11
+ import "../chunk-KNPCWWF3.js";
12
12
  import {
13
13
  proof_run_core_exports
14
14
  } from "../chunk-EKZXU6MU.js";
15
- import "../chunk-QUK3SG24.js";
16
- import "../chunk-W44XEGYW.js";
15
+ import "../chunk-MOTQNIZX.js";
16
+ import "../chunk-CUBYSWZT.js";
17
17
  import "../chunk-MLKGABMK.js";
18
18
  export {
19
19
  engine_harness_exports as engineHarness,
@@ -1,2 +1,2 @@
1
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-Baiv6l3A.cjs';
1
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-DpChFR5H.cjs';
2
2
  import '../proof-run-core-7Dqm7RKM.cjs';
@@ -1,2 +1,2 @@
1
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-MiKZt9oY.js';
1
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-BqRoA3Do.js';
2
2
  import '../proof-run-core-7Dqm7RKM.js';
@@ -35,6 +35,9 @@ __export(runner_exports, {
35
35
  module.exports = __toCommonJS(runner_exports);
36
36
 
37
37
  // src/result.ts
38
+ function isProtectedFinalStatus(status) {
39
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
40
+ }
38
41
  function isSuccessfulStatus(status) {
39
42
  return status !== "blocked" && status !== "failed";
40
43
  }
@@ -149,6 +152,7 @@ function createRunResult(input) {
149
152
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
150
153
  state.status = status;
151
154
  state.ok = ok;
155
+ if (isProtectedFinalStatus(status)) state.finalized = true;
152
156
  applyShipControlState(state, { status, raw: input.raw });
153
157
  return compactRecord({
154
158
  ok,
@@ -348,6 +352,7 @@ function appendStageHeartbeat(state, input) {
348
352
  function setRunStatus(state, status, at = timestamp()) {
349
353
  state.status = status;
350
354
  state.ok = status !== "blocked" && status !== "failed";
355
+ if (isProtectedFinalStatus(status)) state.finalized = true;
351
356
  state.updated_at = at;
352
357
  return state;
353
358
  }
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "../chunk-F65S5LT2.js";
4
- import "../chunk-Q5GYD5RG.js";
5
- import "../chunk-NYRMPWJB.js";
3
+ } from "../chunk-JLOZTVXU.js";
4
+ import "../chunk-UZIX7M7D.js";
5
+ import "../chunk-KNPCWWF3.js";
6
6
  import "../chunk-EKZXU6MU.js";
7
- import "../chunk-QUK3SG24.js";
8
- import "../chunk-W44XEGYW.js";
7
+ import "../chunk-MOTQNIZX.js";
8
+ import "../chunk-CUBYSWZT.js";
9
9
  import "../chunk-MLKGABMK.js";
10
10
  export {
11
11
  runRiddleProof
@@ -757,6 +757,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
757
757
  const packets = history.filter((entry) => entry.packet);
758
758
  const responses = acceptedCheckpointResponseEntries(state);
759
759
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
760
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
761
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
760
762
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
761
763
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
762
764
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -772,6 +774,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
772
774
  packet_count: packets.length,
773
775
  response_count: responses.length,
774
776
  duplicate_response_count: duplicateResponses.length,
777
+ rejected_response_count: rejectedResponses.length,
778
+ ignored_response_count: ignoredResponses.length,
775
779
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
776
780
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
777
781
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -14,8 +14,8 @@ import {
14
14
  normalizeCheckpointResponse,
15
15
  proofContractFromAuthorCheckpointResponse,
16
16
  statePathsForRunState
17
- } from "./chunk-QUK3SG24.js";
18
- import "./chunk-W44XEGYW.js";
17
+ } from "./chunk-MOTQNIZX.js";
18
+ import "./chunk-CUBYSWZT.js";
19
19
  import "./chunk-MLKGABMK.js";
20
20
  export {
21
21
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
@@ -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,