@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
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 = {
@@ -17694,6 +17738,20 @@ function numberValue2(value) {
17694
17738
  function booleanValue2(value) {
17695
17739
  return typeof value === "boolean" ? value : void 0;
17696
17740
  }
17741
+ function firstStringValue(...values) {
17742
+ for (const value of values) {
17743
+ const text = stringValue3(value);
17744
+ if (text) return text;
17745
+ }
17746
+ return void 0;
17747
+ }
17748
+ function firstBooleanValue(...values) {
17749
+ for (const value of values) {
17750
+ const bool = booleanValue2(value);
17751
+ if (typeof bool === "boolean") return bool;
17752
+ }
17753
+ return void 0;
17754
+ }
17697
17755
  function artifactKind(name, url) {
17698
17756
  const target = `${name} ${url}`.toLowerCase();
17699
17757
  if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
@@ -17770,20 +17828,55 @@ function selectPrimaryImage(artifacts) {
17770
17828
  const images = artifacts.filter((artifact) => artifact.kind === "image");
17771
17829
  return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
17772
17830
  }
17831
+ function firstRecordValue(...values) {
17832
+ for (const value of values) {
17833
+ const record = asRecord(value);
17834
+ if (Object.keys(record).length) return record;
17835
+ }
17836
+ return void 0;
17837
+ }
17838
+ function checkpointSummaryFrom(...values) {
17839
+ const record = firstRecordValue(...values);
17840
+ if (!record) return void 0;
17841
+ const summary = {
17842
+ pending: booleanValue2(record.pending),
17843
+ response_count: numberValue2(record.response_count),
17844
+ rejected_response_count: numberValue2(record.rejected_response_count),
17845
+ ignored_response_count: numberValue2(record.ignored_response_count),
17846
+ duplicate_response_count: numberValue2(record.duplicate_response_count),
17847
+ latest_decision: stringValue3(record.latest_decision),
17848
+ latest_packet_id: stringValue3(record.latest_packet_id),
17849
+ latest_resume_token: stringValue3(record.latest_resume_token)
17850
+ };
17851
+ return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
17852
+ }
17773
17853
  function summarizeRiddleProofPrComment(input) {
17774
17854
  const runResponse = asRecord(input.runResponse);
17775
17855
  const result = asRecord(input.result);
17776
17856
  const proofResult = asRecord(runResponse.proofResult);
17777
17857
  const preview = asRecord(runResponse.preview);
17858
+ const resultRunCard = asRecord(result.run_card);
17859
+ const stopCondition = asRecord(resultRunCard.stop_condition);
17860
+ const resultDetails = asRecord(result.details);
17861
+ const resultRaw = asRecord(result.raw);
17862
+ const rawDetails = asRecord(resultRaw.details);
17778
17863
  const artifacts = collectArtifacts(runResponse);
17779
17864
  const pages = pageSummaries(result);
17780
17865
  const checkSource = { ...result };
17781
17866
  delete checkSource.ok;
17782
17867
  const nestedChecks = summarizeExplicitChecks(checkSource);
17783
17868
  const ok = booleanValue2(result.ok) ?? booleanValue2(runResponse.ok) ?? null;
17869
+ const checkpointSummary = checkpointSummaryFrom(
17870
+ result.checkpoint_summary,
17871
+ stopCondition.checkpoint_summary,
17872
+ resultDetails.checkpoint_summary,
17873
+ rawDetails.checkpoint_summary,
17874
+ proofResult.checkpoint_summary
17875
+ );
17784
17876
  return {
17785
17877
  ok,
17786
17878
  status: stringValue3(proofResult.status),
17879
+ result_status: firstStringValue(result.status, stopCondition.status),
17787
17880
  job_id: stringValue3(proofResult.job_id),
17788
17881
  duration_ms: numberValue2(proofResult.duration_ms),
17789
17882
  proof_url: stringValue3(runResponse.proofUrl),
@@ -17791,6 +17884,12 @@ function summarizeRiddleProofPrComment(input) {
17791
17884
  preview_url: stringValue3(preview.preview_url) || stringValue3(preview.url),
17792
17885
  preview_publish_recovered: booleanValue2(preview.publish_recovered),
17793
17886
  preview_publish_error: stringValue3(preview.publish_error),
17887
+ ship_held: firstBooleanValue(result.ship_held, stopCondition.ship_held, resultRaw.ship_held),
17888
+ shipping_disabled: firstBooleanValue(result.shipping_disabled, stopCondition.shipping_disabled, resultRaw.shipping_disabled),
17889
+ ship_authorized: firstBooleanValue(result.ship_authorized, stopCondition.ship_authorized, resultRaw.ship_authorized),
17890
+ proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
17891
+ merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
17892
+ checkpoint_summary: checkpointSummary,
17794
17893
  passed_checks: nestedChecks.passed,
17795
17894
  failed_checks: nestedChecks.failed,
17796
17895
  pages,
@@ -17809,9 +17908,15 @@ function markdownLink(label, url) {
17809
17908
  return `[${label.replace(/\]/g, "\\]")}](${url})`;
17810
17909
  }
17811
17910
  function resultLabel(summary) {
17812
- if (summary.ok === true) return "passed";
17911
+ if (summary.ok === true) {
17912
+ if (summary.result_status === "shipped") return "shipped";
17913
+ if (summary.result_status === "completed") return "completed";
17914
+ if (summary.ship_held === true) return "proof passed; ship held";
17915
+ if (summary.ship_authorized === true) return "passed; ship authorized";
17916
+ return "passed";
17917
+ }
17813
17918
  if (summary.ok === false) return "failed";
17814
- return summary.status || "recorded";
17919
+ return summary.result_status || summary.status || "recorded";
17815
17920
  }
17816
17921
  function artifactRank(artifact) {
17817
17922
  const name = artifact.name.toLowerCase();
@@ -17823,6 +17928,25 @@ function artifactRank(artifact) {
17823
17928
  if (artifact.kind === "image") return 20;
17824
17929
  return 30;
17825
17930
  }
17931
+ function formatBool(value) {
17932
+ return typeof value === "boolean" ? String(value) : "unknown";
17933
+ }
17934
+ function hasShipControl(summary) {
17935
+ return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
17936
+ }
17937
+ function checkpointSummaryLine(summary) {
17938
+ const accepted = summary.response_count ?? 0;
17939
+ const rejected = summary.rejected_response_count ?? 0;
17940
+ const ignored = summary.ignored_response_count ?? 0;
17941
+ const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
17942
+ if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
17943
+ const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
17944
+ return [
17945
+ parts.join(" / "),
17946
+ state,
17947
+ summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
17948
+ ].filter(Boolean).join("; ");
17949
+ }
17826
17950
  function buildRiddleProofPrCommentMarkdown(input) {
17827
17951
  const summary = summarizeRiddleProofPrComment(input);
17828
17952
  const title = input.title?.trim() || "Riddle Proof Evidence";
@@ -17834,9 +17958,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
17834
17958
  ];
17835
17959
  if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
17836
17960
  if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
17961
+ if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
17837
17962
  if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
17838
17963
  if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
17839
17964
  if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
17965
+ if (hasShipControl(summary)) {
17966
+ lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
17967
+ }
17968
+ if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
17969
+ if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
17970
+ if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
17840
17971
  if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
17841
17972
  if (summary.preview_id || summary.preview_url) {
17842
17973
  const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-MYMTAVGP.js";
2
+ import "./chunk-LUFT7AGY.js";
3
3
  import "./chunk-DI2XNGEZ.js";
4
- import "./chunk-6KYXX4OE.js";
4
+ import "./chunk-JR7GFTLS.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,
@@ -3421,6 +3421,9 @@ var import_node_crypto3 = __toESM(require("crypto"), 1);
3421
3421
  function isTerminalStatus(status) {
3422
3422
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
3423
3423
  }
3424
+ function isProtectedFinalStatus(status) {
3425
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
3426
+ }
3424
3427
  function isSuccessfulStatus(status) {
3425
3428
  return status !== "blocked" && status !== "failed";
3426
3429
  }
@@ -3634,6 +3637,7 @@ function createRunResult(input) {
3634
3637
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
3635
3638
  state.status = status;
3636
3639
  state.ok = ok;
3640
+ if (isProtectedFinalStatus(status)) state.finalized = true;
3637
3641
  applyShipControlState(state, { status, raw: input.raw });
3638
3642
  return compactRecord({
3639
3643
  ok,
@@ -4291,6 +4295,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4291
4295
  const packets = history.filter((entry) => entry.packet);
4292
4296
  const responses = acceptedCheckpointResponseEntries(state);
4293
4297
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
4298
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
4299
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
4294
4300
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
4295
4301
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
4296
4302
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -4306,6 +4312,8 @@ function checkpointSummaryFromState(state, engineStatePath2) {
4306
4312
  packet_count: packets.length,
4307
4313
  response_count: responses.length,
4308
4314
  duplicate_response_count: duplicateResponses.length,
4315
+ rejected_response_count: rejectedResponses.length,
4316
+ ignored_response_count: ignoredResponses.length,
4309
4317
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
4310
4318
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
4311
4319
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -4804,6 +4812,7 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
4804
4812
  function setRunStatus(state, status, at = timestamp2()) {
4805
4813
  state.status = status;
4806
4814
  state.ok = status !== "blocked" && status !== "failed";
4815
+ if (isProtectedFinalStatus(status)) state.finalized = true;
4807
4816
  state.updated_at = at;
4808
4817
  return state;
4809
4818
  }
@@ -4872,9 +4881,6 @@ function loadRunState(input) {
4872
4881
  state_path: statePath
4873
4882
  });
4874
4883
  }
4875
- function isProtectedFinalStatus(status) {
4876
- return status === "ready_to_ship" || status === "shipped" || status === "completed";
4877
- }
4878
4884
  function shouldPreserveFinalizedRunState(filePath, incoming) {
4879
4885
  const existing = readJson(filePath);
4880
4886
  if (!existing?.finalized || !isProtectedFinalStatus(existing.status)) return false;
@@ -5446,19 +5452,38 @@ function appendCheckpointResponse(state, response, input = {}) {
5446
5452
  setRunStatus(state, "running", at);
5447
5453
  persist(state);
5448
5454
  }
5455
+ function checkpointResponseRejectedBlocker(state, input) {
5456
+ const packet = input.packet || null;
5457
+ const response = input.response || null;
5458
+ appendRunEvent(state, {
5459
+ kind: "checkpoint.response.rejected",
5460
+ checkpoint: response?.checkpoint || packet?.checkpoint || input.blocker.checkpoint || null,
5461
+ stage: packet?.stage || state.current_stage || "author",
5462
+ summary: input.blocker.message,
5463
+ details: compactRecord({
5464
+ code: input.blocker.code,
5465
+ decision: response?.decision,
5466
+ resume_token: response?.resume_token,
5467
+ packet_id: response?.packet_id,
5468
+ source: response?.source
5469
+ })
5470
+ });
5471
+ return { blocker: input.blocker };
5472
+ }
5449
5473
  function checkpointResponseContinuation(state, value) {
5450
5474
  if (!value) return {};
5451
5475
  const packet = state.checkpoint_packet;
5452
5476
  const response = normalizeCheckpointResponse(value);
5453
5477
  if (!response) {
5454
- return {
5478
+ return checkpointResponseRejectedBlocker(state, {
5479
+ packet,
5455
5480
  blocker: {
5456
5481
  code: "checkpoint_response_invalid",
5457
5482
  checkpoint: packet?.checkpoint || state.last_checkpoint || null,
5458
5483
  message: "Checkpoint response was not a valid riddle-proof.checkpoint_response.v1 object.",
5459
5484
  details: { checkpoint_packet: packet || null, checkpoint_summary: checkpointSummaryFromState(state) }
5460
5485
  }
5461
- };
5486
+ });
5462
5487
  }
5463
5488
  if (isDuplicateCheckpointResponse(state, response)) {
5464
5489
  const stage = packet?.stage || state.current_stage || "author";
@@ -5489,17 +5514,20 @@ function checkpointResponseContinuation(state, value) {
5489
5514
  };
5490
5515
  }
5491
5516
  if (!packet) {
5492
- return {
5517
+ return checkpointResponseRejectedBlocker(state, {
5518
+ response,
5493
5519
  blocker: {
5494
5520
  code: "checkpoint_response_without_packet",
5495
5521
  checkpoint: response.checkpoint,
5496
5522
  message: "A checkpoint response was supplied, but the run state has no pending checkpoint packet.",
5497
5523
  details: { response, checkpoint_summary: checkpointSummaryFromState(state) }
5498
5524
  }
5499
- };
5525
+ });
5500
5526
  }
5501
5527
  if (response.run_id !== packet.run_id || response.checkpoint !== packet.checkpoint) {
5502
- return {
5528
+ return checkpointResponseRejectedBlocker(state, {
5529
+ packet,
5530
+ response,
5503
5531
  blocker: {
5504
5532
  code: "checkpoint_response_mismatch",
5505
5533
  checkpoint: packet.checkpoint,
@@ -5510,10 +5538,12 @@ function checkpointResponseContinuation(state, value) {
5510
5538
  actual: { run_id: response.run_id, checkpoint: response.checkpoint }
5511
5539
  }
5512
5540
  }
5513
- };
5541
+ });
5514
5542
  }
5515
5543
  if (packet.resume_token && response.resume_token !== packet.resume_token) {
5516
- return {
5544
+ return checkpointResponseRejectedBlocker(state, {
5545
+ packet,
5546
+ response,
5517
5547
  blocker: {
5518
5548
  code: "checkpoint_response_resume_token_mismatch",
5519
5549
  checkpoint: packet.checkpoint,
@@ -5524,10 +5554,12 @@ function checkpointResponseContinuation(state, value) {
5524
5554
  actual_resume_token: response.resume_token || null
5525
5555
  }
5526
5556
  }
5527
- };
5557
+ });
5528
5558
  }
5529
5559
  if (packet.packet_id && response.packet_id !== packet.packet_id) {
5530
- return {
5560
+ return checkpointResponseRejectedBlocker(state, {
5561
+ packet,
5562
+ response,
5531
5563
  blocker: {
5532
5564
  code: "checkpoint_response_packet_id_mismatch",
5533
5565
  checkpoint: packet.checkpoint,
@@ -5540,10 +5572,12 @@ function checkpointResponseContinuation(state, value) {
5540
5572
  actual_resume_token: response.resume_token || null
5541
5573
  }
5542
5574
  }
5543
- };
5575
+ });
5544
5576
  }
5545
5577
  if (!packet.allowed_decisions.includes(response.decision)) {
5546
- return {
5578
+ return checkpointResponseRejectedBlocker(state, {
5579
+ packet,
5580
+ response,
5547
5581
  blocker: {
5548
5582
  code: "checkpoint_response_decision_not_allowed",
5549
5583
  checkpoint: packet.checkpoint,
@@ -5555,7 +5589,7 @@ function checkpointResponseContinuation(state, value) {
5555
5589
  response
5556
5590
  }
5557
5591
  }
5558
- };
5592
+ });
5559
5593
  }
5560
5594
  const base = {
5561
5595
  action: "run",
@@ -5565,14 +5599,16 @@ function checkpointResponseContinuation(state, value) {
5565
5599
  if (response.decision === "author_packet") {
5566
5600
  const payload = authorPacketPayloadFromCheckpointResponse(response);
5567
5601
  if (!payload) {
5568
- return {
5602
+ return checkpointResponseRejectedBlocker(state, {
5603
+ packet,
5604
+ response,
5569
5605
  blocker: {
5570
5606
  code: "checkpoint_author_packet_missing",
5571
5607
  checkpoint: packet.checkpoint,
5572
5608
  message: "Checkpoint response decision=author_packet did not include a proof_plan and capture_script payload.",
5573
5609
  details: { stage: packet.stage, response }
5574
5610
  }
5575
- };
5611
+ });
5576
5612
  }
5577
5613
  state.proof_contract = proofContractFromAuthorCheckpointResponse(response, packet, payload);
5578
5614
  appendCheckpointResponse(state, response);
@@ -5601,14 +5637,16 @@ function checkpointResponseContinuation(state, value) {
5601
5637
  const workdir = nonEmptyString(packet.state_excerpt?.after_worktree) || state.worktree_path;
5602
5638
  if (workdir) state.worktree_path = workdir;
5603
5639
  if (!hasGitDiff(workdir)) {
5604
- return {
5640
+ return checkpointResponseRejectedBlocker(state, {
5641
+ packet,
5642
+ response,
5605
5643
  blocker: {
5606
5644
  code: "implementation_diff_missing",
5607
5645
  checkpoint: packet.checkpoint,
5608
5646
  message: "Checkpoint response claimed implementation_complete, but the after worktree has no detectable git diff.",
5609
5647
  details: { stage: packet.stage, worktree_path: workdir || null, response }
5610
5648
  }
5611
- };
5649
+ });
5612
5650
  }
5613
5651
  appendCheckpointResponse(state, response);
5614
5652
  return {
@@ -5657,7 +5695,13 @@ function checkpointResponseContinuation(state, value) {
5657
5695
  response,
5658
5696
  code: "checkpoint_response_source_not_trusted"
5659
5697
  });
5660
- if (sourceBlocker) return { blocker: sourceBlocker };
5698
+ if (sourceBlocker) {
5699
+ return checkpointResponseRejectedBlocker(state, {
5700
+ packet,
5701
+ response,
5702
+ blocker: sourceBlocker
5703
+ });
5704
+ }
5661
5705
  appendCheckpointResponse(state, response);
5662
5706
  if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
5663
5707
  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,