@riddledc/riddle-proof 0.8.59 → 0.8.61

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 (116) hide show
  1. package/dist/adapters/codex-exec-agent.d.cts +1 -0
  2. package/dist/adapters/codex-exec-agent.d.ts +1 -0
  3. package/dist/adapters/codex-exec-agent.js +3 -2
  4. package/dist/adapters/codex.d.cts +1 -0
  5. package/dist/adapters/codex.d.ts +1 -0
  6. package/dist/adapters/codex.js +3 -2
  7. package/dist/adapters/local-agent.d.cts +1 -0
  8. package/dist/adapters/local-agent.d.ts +1 -0
  9. package/dist/adapters/local-agent.js +3 -2
  10. package/dist/adapters/openclaw.d.cts +1 -0
  11. package/dist/adapters/openclaw.d.ts +1 -0
  12. package/dist/adapters/openclaw.js +6 -5
  13. package/dist/advanced/engine-harness.cjs +299 -43
  14. package/dist/advanced/engine-harness.d.cts +1 -0
  15. package/dist/advanced/engine-harness.d.ts +1 -0
  16. package/dist/advanced/engine-harness.js +6 -5
  17. package/dist/advanced/index.cjs +299 -43
  18. package/dist/advanced/index.d.cts +1 -0
  19. package/dist/advanced/index.d.ts +1 -0
  20. package/dist/advanced/index.js +7 -6
  21. package/dist/advanced/runner.cjs +202 -4
  22. package/dist/advanced/runner.d.cts +1 -0
  23. package/dist/advanced/runner.d.ts +1 -0
  24. package/dist/advanced/runner.js +6 -5
  25. package/dist/checkpoint.d.cts +1 -0
  26. package/dist/checkpoint.d.ts +1 -0
  27. package/dist/checkpoint.js +3 -2
  28. package/dist/{chunk-TTB3ZAVX.js → chunk-3FK5HZHK.js} +2 -2
  29. package/dist/{chunk-MOTQNIZX.js → chunk-FX2CB4MG.js} +1 -1
  30. package/dist/{chunk-GHBNDHG7.js → chunk-HD46EEUV.js} +50 -4
  31. package/dist/{chunk-2PKBTYOA.js → chunk-K6VYKOIM.js} +9 -4
  32. package/dist/{chunk-XSNMMAPJ.js → chunk-NQ5HPAZD.js} +4 -4
  33. package/dist/{chunk-KNPCWWF3.js → chunk-NXEAFQYZ.js} +16 -10
  34. package/dist/{chunk-CUBYSWZT.js → chunk-QGMSN34W.js} +51 -4
  35. package/dist/{chunk-RS4HJLJQ.js → chunk-QPKY767W.js} +1 -1
  36. package/dist/{chunk-UZIX7M7D.js → chunk-UEY5SJG5.js} +13 -9
  37. package/dist/{chunk-KG64Y5MC.js → chunk-WKIIJX3O.js} +12 -0
  38. package/dist/{chunk-JLOZTVXU.js → chunk-XKNJ5OE4.js} +2 -2
  39. package/dist/cli/index.js +9 -9
  40. package/dist/cli.cjs +512 -405
  41. package/dist/cli.js +9 -9
  42. package/dist/codex-exec-agent.d.cts +1 -0
  43. package/dist/codex-exec-agent.d.ts +1 -0
  44. package/dist/codex-exec-agent.js +3 -2
  45. package/dist/diagnostics.d.cts +1 -0
  46. package/dist/diagnostics.d.ts +1 -0
  47. package/dist/engine-harness.cjs +299 -43
  48. package/dist/engine-harness.d.cts +1 -0
  49. package/dist/engine-harness.d.ts +1 -0
  50. package/dist/engine-harness.js +6 -5
  51. package/dist/index.cjs +287 -170
  52. package/dist/index.d.cts +2 -2
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.js +21 -11
  55. package/dist/local-agent.d.cts +1 -0
  56. package/dist/local-agent.d.ts +1 -0
  57. package/dist/local-agent.js +3 -2
  58. package/dist/openclaw.d.cts +1 -0
  59. package/dist/openclaw.d.ts +1 -0
  60. package/dist/openclaw.js +6 -5
  61. package/dist/pr-comment.cjs +15 -3
  62. package/dist/pr-comment.js +2 -2
  63. package/dist/profile/index.d.cts +1 -0
  64. package/dist/profile/index.d.ts +1 -0
  65. package/dist/profile.d.cts +1 -0
  66. package/dist/profile.d.ts +1 -0
  67. package/dist/proof-session.d.cts +1 -0
  68. package/dist/proof-session.d.ts +1 -0
  69. package/dist/public-state.cjs +15 -0
  70. package/dist/public-state.d.cts +4 -1
  71. package/dist/public-state.d.ts +4 -1
  72. package/dist/public-state.js +7 -1
  73. package/dist/result.cjs +211 -4
  74. package/dist/result.d.cts +12 -1
  75. package/dist/result.d.ts +12 -1
  76. package/dist/result.js +6 -1
  77. package/dist/run-card.cjs +198 -40
  78. package/dist/run-card.d.cts +1 -0
  79. package/dist/run-card.d.ts +1 -0
  80. package/dist/run-card.js +4 -3
  81. package/dist/runner.cjs +202 -4
  82. package/dist/runner.d.cts +1 -0
  83. package/dist/runner.d.ts +1 -0
  84. package/dist/runner.js +6 -5
  85. package/dist/spec/checkpoint.d.cts +1 -0
  86. package/dist/spec/checkpoint.d.ts +1 -0
  87. package/dist/spec/checkpoint.js +3 -2
  88. package/dist/spec/index.cjs +235 -167
  89. package/dist/spec/index.d.cts +2 -2
  90. package/dist/spec/index.d.ts +2 -2
  91. package/dist/spec/index.js +17 -7
  92. package/dist/spec/public-state.cjs +15 -0
  93. package/dist/spec/public-state.d.cts +1 -1
  94. package/dist/spec/public-state.d.ts +1 -1
  95. package/dist/spec/public-state.js +7 -1
  96. package/dist/spec/result.cjs +209 -4
  97. package/dist/spec/result.d.cts +2 -1
  98. package/dist/spec/result.d.ts +2 -1
  99. package/dist/spec/result.js +6 -1
  100. package/dist/spec/run-card.cjs +198 -40
  101. package/dist/spec/run-card.d.cts +1 -0
  102. package/dist/spec/run-card.d.ts +1 -0
  103. package/dist/spec/run-card.js +4 -3
  104. package/dist/spec/state.cjs +207 -45
  105. package/dist/spec/state.d.cts +1 -0
  106. package/dist/spec/state.d.ts +1 -0
  107. package/dist/spec/state.js +5 -4
  108. package/dist/spec/types.d.cts +1 -0
  109. package/dist/spec/types.d.ts +1 -0
  110. package/dist/state.cjs +207 -45
  111. package/dist/state.d.cts +1 -0
  112. package/dist/state.d.ts +1 -0
  113. package/dist/state.js +5 -4
  114. package/dist/types.d.cts +14 -0
  115. package/dist/types.d.ts +14 -0
  116. package/package.json +1 -1
@@ -34,7 +34,171 @@ __export(runner_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(runner_exports);
36
36
 
37
+ // src/public-state.ts
38
+ function riddleProofPublicStateAllowsClaim(summary, claim) {
39
+ return !summary?.prohibited_claims.includes(claim);
40
+ }
41
+ function riddleProofPublicStateAllowsMergeRecommendation(summary) {
42
+ return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
43
+ }
44
+ function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
45
+ return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
46
+ }
47
+ function asRecord(value) {
48
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
49
+ }
50
+ function stringValue(value) {
51
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
52
+ }
53
+ function booleanValue(value) {
54
+ return typeof value === "boolean" ? value : void 0;
55
+ }
56
+ function numberValue(value) {
57
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
58
+ }
59
+ function firstStringValue(...values) {
60
+ for (const value of values) {
61
+ const text = stringValue(value);
62
+ if (text) return text;
63
+ }
64
+ return void 0;
65
+ }
66
+ function firstBooleanValue(...values) {
67
+ for (const value of values) {
68
+ const bool = booleanValue(value);
69
+ if (typeof bool === "boolean") return bool;
70
+ }
71
+ return void 0;
72
+ }
73
+ function firstRecordValue(...values) {
74
+ for (const value of values) {
75
+ const record = asRecord(value);
76
+ if (Object.keys(record).length) return record;
77
+ }
78
+ return void 0;
79
+ }
80
+ function countValue(value) {
81
+ const number = numberValue(value);
82
+ return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
83
+ }
84
+ function checkpointSummaryFrom(...values) {
85
+ const record = firstRecordValue(...values);
86
+ if (!record) return void 0;
87
+ const accepted = countValue(record.response_count);
88
+ const rejected = countValue(record.rejected_response_count);
89
+ const ignored = countValue(record.ignored_response_count);
90
+ const duplicate = countValue(record.duplicate_response_count);
91
+ const summary = {
92
+ pending: booleanValue(record.pending),
93
+ accepted_response_count: accepted,
94
+ rejected_response_count: rejected,
95
+ ignored_response_count: ignored,
96
+ duplicate_response_count: duplicate,
97
+ latest_decision: stringValue(record.latest_decision),
98
+ audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
99
+ };
100
+ return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
101
+ }
102
+ function uniqueStrings(values) {
103
+ return [...new Set(values.filter(Boolean))];
104
+ }
105
+ function summarizeRiddleProofPublicState(input) {
106
+ const record = asRecord(input);
107
+ const runCard = asRecord(record.run_card);
108
+ const stopCondition = asRecord(runCard.stop_condition);
109
+ const raw = asRecord(record.raw);
110
+ const request = asRecord(record.request);
111
+ const requestMetadata = asRecord(record.request_metadata);
112
+ const prState = asRecord(record.pr_state);
113
+ const handoff = asRecord(record.pr_handoff_policy);
114
+ const handoffState = stringValue(handoff.state);
115
+ const status = firstStringValue(record.status, stopCondition.status);
116
+ const ok = booleanValue(record.ok) ?? null;
117
+ const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
118
+ const explicitShippingDisabled = firstBooleanValue(
119
+ record.shipping_disabled,
120
+ stopCondition.shipping_disabled,
121
+ raw.shipping_disabled,
122
+ handoff.shipping_disabled
123
+ );
124
+ const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
125
+ const explicitShipAuthorized = firstBooleanValue(
126
+ record.ship_authorized,
127
+ stopCondition.ship_authorized,
128
+ raw.ship_authorized
129
+ );
130
+ const authorizationEvidence = Boolean(
131
+ status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
132
+ );
133
+ const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
134
+ const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
135
+ const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
136
+ const shipHeld = explicitShipHeld === true || inferredHeld;
137
+ const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
138
+ const proofComplete = Boolean(
139
+ status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
140
+ );
141
+ const checkpointSummary = checkpointSummaryFrom(
142
+ record.checkpoint_summary,
143
+ stopCondition.checkpoint_summary,
144
+ asRecord(record.details).checkpoint_summary,
145
+ asRecord(raw.details).checkpoint_summary
146
+ );
147
+ const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
148
+ const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
149
+ const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
150
+ const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
151
+ const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
152
+ const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
153
+ const syncAllowed = mergeReady;
154
+ let policyState = "unknown";
155
+ if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
156
+ else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
157
+ else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
158
+ else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
159
+ else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
160
+ else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
161
+ else if (shipAuthorized) policyState = "ship_authorized";
162
+ else if (proofPassed) policyState = "proof_passed";
163
+ else if (status === "running") policyState = "proof_in_progress";
164
+ const requiredDisclosures = [];
165
+ if (shipHeld) requiredDisclosures.push("ship_held");
166
+ if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
167
+ if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
168
+ if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
169
+ const prohibitedClaims = [];
170
+ if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
171
+ if (!mergeReady) prohibitedClaims.push("merge_ready");
172
+ if (!syncAllowed) prohibitedClaims.push("sync_allowed");
173
+ if (blockedOrWaiting) {
174
+ prohibitedClaims.push("proof_passed", "ready_to_ship");
175
+ }
176
+ if (checkpointSummary?.audit_disclosure_required) {
177
+ prohibitedClaims.push("all_checkpoint_responses_accepted");
178
+ }
179
+ const resultLabel = policyState === "awaiting_checkpoint" ? "checkpoint required" : policyState === "proof_blocked" ? "blocked" : policyState === "proof_failed" ? "failed" : policyState === "proof_complete_ship_disabled" ? "proof complete; shipping disabled" : policyState === "proof_passed_ship_held" ? "proof passed; ship held" : policyState === "ship_authorized" ? status === "shipped" ? "shipped" : "ship authorized" : policyState === "proof_passed" ? "passed" : policyState === "proof_in_progress" ? "running" : status || "recorded";
180
+ return {
181
+ status,
182
+ ok,
183
+ policy_state: policyState,
184
+ result_label: resultLabel,
185
+ proof_complete: proofComplete,
186
+ proof_passed: proofPassed,
187
+ ship_held: shipHeld,
188
+ shipping_disabled: shippingDisabled,
189
+ ship_authorized: shipAuthorized,
190
+ merge_ready: mergeReady,
191
+ sync_allowed: syncAllowed,
192
+ checkpoint_summary: checkpointSummary,
193
+ required_disclosures: uniqueStrings(requiredDisclosures),
194
+ prohibited_claims: uniqueStrings(prohibitedClaims)
195
+ };
196
+ }
197
+
37
198
  // src/result.ts
199
+ function isTerminalStatus(status) {
200
+ return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
201
+ }
38
202
  function isProtectedFinalStatus(status) {
39
203
  return status === "ready_to_ship" || status === "shipped" || status === "completed";
40
204
  }
@@ -106,6 +270,31 @@ function applyTerminalMetadata(state, metadata) {
106
270
  if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
107
271
  return state;
108
272
  }
273
+ function publicStateForRunState(input) {
274
+ const state = input.state;
275
+ const status = input.status || state.status;
276
+ const raw = recordValue(input.raw) || {};
277
+ const extendedState = state;
278
+ const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
279
+ return summarizeRiddleProofPublicState(compactRecord({
280
+ status,
281
+ ok: terminalOk,
282
+ request: state.request,
283
+ pr_state: state.pr_state,
284
+ marked_ready: state.marked_ready,
285
+ ship_held: state.ship_held,
286
+ shipping_disabled: state.shipping_disabled,
287
+ ship_authorized: state.ship_authorized,
288
+ ship_mode: state.request?.ship_mode,
289
+ merge_commit: state.merge_commit,
290
+ merged_at: state.merged_at,
291
+ checkpoint_summary: state.checkpoint_summary,
292
+ pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
293
+ merge_ready: extendedState.merge_ready,
294
+ normal_pr_allowed: extendedState.normal_pr_allowed,
295
+ raw: Object.keys(raw).length ? raw : void 0
296
+ }));
297
+ }
109
298
  function shipControlStateFor(input) {
110
299
  const state = input.state;
111
300
  const status = input.status || state.status;
@@ -154,6 +343,11 @@ function createRunResult(input) {
154
343
  state.ok = ok;
155
344
  if (isProtectedFinalStatus(status)) state.finalized = true;
156
345
  applyShipControlState(state, { status, raw: input.raw });
346
+ const publicState = publicStateForRunState({ state, status, raw: input.raw });
347
+ const publicMergeRecommendation = riddleProofPublicStateMergeRecommendation(
348
+ publicState,
349
+ state.merge_recommendation
350
+ );
157
351
  return compactRecord({
158
352
  ok,
159
353
  status,
@@ -171,9 +365,12 @@ function createRunResult(input) {
171
365
  pr_state: state.pr_state,
172
366
  marked_ready: state.marked_ready,
173
367
  left_draft: state.left_draft,
174
- ship_held: state.ship_held,
175
- shipping_disabled: state.shipping_disabled,
176
- ship_authorized: state.ship_authorized,
368
+ result_label: publicState.result_label,
369
+ ship_held: publicState.ship_held,
370
+ shipping_disabled: publicState.shipping_disabled,
371
+ ship_authorized: publicState.ship_authorized,
372
+ merge_ready: publicState.merge_ready,
373
+ sync_allowed: publicState.sync_allowed,
177
374
  ci_status: state.ci_status,
178
375
  ship_commit: state.ship_commit,
179
376
  ship_remote_head: state.ship_remote_head,
@@ -187,7 +384,8 @@ function createRunResult(input) {
187
384
  cleanup_report: state.cleanup_report,
188
385
  notification: state.notification,
189
386
  proof_decision: state.proof_decision,
190
- merge_recommendation: state.merge_recommendation,
387
+ merge_recommendation: publicMergeRecommendation,
388
+ public_state: publicState,
191
389
  finalized: state.finalized,
192
390
  blocker: state.blocker,
193
391
  checkpoint_packet: state.checkpoint_packet,
@@ -1,2 +1,3 @@
1
1
  export { R as RiddleProofRunnerAdapters, a as RunRiddleProofInput, r as runRiddleProof } from '../runner-4LJ5z0D-.cjs';
2
2
  import '../types.cjs';
3
+ import '../public-state.cjs';
@@ -1,2 +1,3 @@
1
1
  export { R as RiddleProofRunnerAdapters, a as RunRiddleProofInput, r as runRiddleProof } from '../runner-BdQpOkZD.js';
2
2
  import '../types.js';
3
+ import '../public-state.js';
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "../chunk-JLOZTVXU.js";
4
- import "../chunk-UZIX7M7D.js";
5
- import "../chunk-KNPCWWF3.js";
3
+ } from "../chunk-XKNJ5OE4.js";
4
+ import "../chunk-UEY5SJG5.js";
5
+ import "../chunk-NXEAFQYZ.js";
6
6
  import "../chunk-EKZXU6MU.js";
7
- import "../chunk-MOTQNIZX.js";
8
- import "../chunk-CUBYSWZT.js";
7
+ import "../chunk-FX2CB4MG.js";
8
+ import "../chunk-QGMSN34W.js";
9
+ import "../chunk-WKIIJX3O.js";
9
10
  import "../chunk-MLKGABMK.js";
10
11
  export {
11
12
  runRiddleProof
@@ -1,4 +1,5 @@
1
1
  import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStage, RiddleProofProofContract, RiddleProofStatePaths } from './types.cjs';
2
+ import './public-state.cjs';
2
3
 
3
4
  declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
4
5
  declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
@@ -1,4 +1,5 @@
1
1
  import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStage, RiddleProofProofContract, RiddleProofStatePaths } from './types.js';
2
+ import './public-state.js';
2
3
 
3
4
  declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
4
5
  declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
@@ -14,8 +14,9 @@ import {
14
14
  normalizeCheckpointResponse,
15
15
  proofContractFromAuthorCheckpointResponse,
16
16
  statePathsForRunState
17
- } from "./chunk-MOTQNIZX.js";
18
- import "./chunk-CUBYSWZT.js";
17
+ } from "./chunk-FX2CB4MG.js";
18
+ import "./chunk-QGMSN34W.js";
19
+ import "./chunk-WKIIJX3O.js";
19
20
  import "./chunk-MLKGABMK.js";
20
21
  export {
21
22
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  normalizeIntegrationContext,
3
3
  normalizeRunParams
4
- } from "./chunk-UZIX7M7D.js";
4
+ } from "./chunk-UEY5SJG5.js";
5
5
  import {
6
6
  compactRecord
7
- } from "./chunk-CUBYSWZT.js";
7
+ } from "./chunk-QGMSN34W.js";
8
8
 
9
9
  // src/openclaw.ts
10
10
  function parseOpenClawAssertions(value) {
@@ -2,7 +2,7 @@ import {
2
2
  compactRecord,
3
3
  nonEmptyString,
4
4
  recordValue
5
- } from "./chunk-CUBYSWZT.js";
5
+ } from "./chunk-QGMSN34W.js";
6
6
 
7
7
  // src/checkpoint.ts
8
8
  import crypto from "crypto";
@@ -5,10 +5,10 @@ import {
5
5
  createRunStatusSnapshot,
6
6
  normalizeRunParams,
7
7
  setRunStatus
8
- } from "./chunk-UZIX7M7D.js";
8
+ } from "./chunk-UEY5SJG5.js";
9
9
  import {
10
10
  createRiddleProofRunCard
11
- } from "./chunk-KNPCWWF3.js";
11
+ } from "./chunk-NXEAFQYZ.js";
12
12
  import {
13
13
  canonicalProofAssessmentStageForDecision,
14
14
  noImplementationModeFor,
@@ -27,7 +27,7 @@ import {
27
27
  normalizeCheckpointResponse,
28
28
  proofContractFromAuthorCheckpointResponse,
29
29
  statePathsForRunState
30
- } from "./chunk-MOTQNIZX.js";
30
+ } from "./chunk-FX2CB4MG.js";
31
31
  import {
32
32
  applyShipControlState,
33
33
  applyTerminalMetadata,
@@ -37,7 +37,7 @@ import {
37
37
  nonEmptyString,
38
38
  normalizeTerminalMetadata,
39
39
  recordValue
40
- } from "./chunk-CUBYSWZT.js";
40
+ } from "./chunk-QGMSN34W.js";
41
41
  import {
42
42
  __export
43
43
  } from "./chunk-MLKGABMK.js";
@@ -397,6 +397,13 @@ function proofAssessmentHardBlockers(state, payload) {
397
397
  }
398
398
  return blockers;
399
399
  }
400
+ function proofGateStateForCheckpointResponse(state) {
401
+ const fullState = readJson(state.request.engine_state_path) || {};
402
+ return compactRecord({
403
+ ...fullState,
404
+ verification_mode: nonEmptyString(fullState.verification_mode) || state.request.verification_mode
405
+ });
406
+ }
400
407
  function proofAssessmentContinuation(result, payload) {
401
408
  const proof_assessment_json = jsonParam(payload);
402
409
  return { ...baseContinuation(result), proof_assessment_json };
@@ -943,6 +950,45 @@ function checkpointResponseContinuation(state, value) {
943
950
  blocker: sourceBlocker
944
951
  });
945
952
  }
953
+ const proofGateState = proofGateStateForCheckpointResponse(state);
954
+ const hardBlockers = proofAssessmentHardBlockers(proofGateState, assessment);
955
+ if (proofAssessmentRequestsShip(assessment) && hardBlockers.length) {
956
+ return checkpointResponseRejectedBlocker(state, {
957
+ packet,
958
+ response,
959
+ blocker: {
960
+ code: "checkpoint_response_proof_hard_blocker",
961
+ checkpoint: packet.checkpoint,
962
+ message: "Riddle Proof cannot mark ready_to_ship while the proof bundle contains a hard blocker: " + hardBlockers[0],
963
+ details: compactRecord({
964
+ stage: packet.stage,
965
+ hard_blockers: hardBlockers,
966
+ proofAssessment: assessment,
967
+ response
968
+ })
969
+ }
970
+ });
971
+ }
972
+ const visualBlocker = proofAssessmentVisualBlocker(proofGateState, assessment);
973
+ if (visualBlocker) {
974
+ const recoveryAssessment = visualDeltaEvidenceRecoveryAssessment(proofGateState, assessment, visualBlocker);
975
+ appendCheckpointResponse(state, response, { summary: visualBlocker });
976
+ recordEvent(state, {
977
+ kind: "checkpoint.response.evidence_recovery_required",
978
+ checkpoint: packet.checkpoint,
979
+ stage: "verify",
980
+ summary: visualBlocker,
981
+ details: compactRecord({
982
+ evidence_collection_incomplete: true,
983
+ recovery_stage: "verify",
984
+ evidence_issue_code: recoveryAssessment.evidence_issue_code || null,
985
+ visual_delta: recoveryAssessment.visual_delta || null,
986
+ proof_assessment: recoveryAssessment,
987
+ checkpoint_response_source: response.source || null
988
+ })
989
+ });
990
+ return { next: { ...base, proof_assessment_json: jsonParam(recoveryAssessment) } };
991
+ }
946
992
  appendCheckpointResponse(state, response);
947
993
  if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
948
994
  const result = {
@@ -1,6 +1,8 @@
1
1
  import {
2
+ riddleProofPublicStateAllowsMergeRecommendation,
3
+ riddleProofPublicStateMergeRecommendation,
2
4
  summarizeRiddleProofPublicState
3
- } from "./chunk-KG64Y5MC.js";
5
+ } from "./chunk-WKIIJX3O.js";
4
6
 
5
7
  // src/pr-comment.ts
6
8
  var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
@@ -152,6 +154,10 @@ function summarizeRiddleProofPrComment(input) {
152
154
  status: firstStringValue(result.status, stopCondition.status),
153
155
  checkpoint_summary: checkpointSummary || result.checkpoint_summary
154
156
  });
157
+ const mergeRecommendation = riddleProofPublicStateMergeRecommendation(
158
+ publicState,
159
+ firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation)
160
+ );
155
161
  return {
156
162
  ok,
157
163
  status: stringValue(proofResult.status),
@@ -169,7 +175,7 @@ function summarizeRiddleProofPrComment(input) {
169
175
  merge_ready: publicState.merge_ready,
170
176
  sync_allowed: publicState.sync_allowed,
171
177
  proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
172
- merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
178
+ merge_recommendation: mergeRecommendation,
173
179
  checkpoint_summary: checkpointSummary,
174
180
  public_state: publicState,
175
181
  passed_checks: nestedChecks.passed,
@@ -222,8 +228,7 @@ function hasHandoffControl(summary) {
222
228
  }
223
229
  function shouldRenderMergeRecommendation(summary) {
224
230
  if (!summary.merge_recommendation) return false;
225
- const prohibited = summary.public_state?.prohibited_claims || [];
226
- return !prohibited.includes("merge_ready") && !prohibited.includes("sync_allowed");
231
+ return riddleProofPublicStateAllowsMergeRecommendation(summary.public_state);
227
232
  }
228
233
  function checkpointSummaryLine(summary) {
229
234
  const accepted = summary.response_count ?? 0;
@@ -7,7 +7,7 @@ import {
7
7
  RIDDLE_PROOF_PR_COMMENT_MARKER,
8
8
  buildRiddleProofPrCommentMarkdown,
9
9
  summarizeRiddleProofPrComment
10
- } from "./chunk-2PKBTYOA.js";
10
+ } from "./chunk-K6VYKOIM.js";
11
11
  import {
12
12
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
13
13
  applyRiddleProofProfileArtifactCompleteness,
@@ -28,14 +28,14 @@ import {
28
28
  createDisabledRiddleProofAgentAdapter,
29
29
  readRiddleProofRunStatus,
30
30
  runRiddleProofEngineHarness
31
- } from "./chunk-GHBNDHG7.js";
31
+ } from "./chunk-HD46EEUV.js";
32
32
  import {
33
33
  createCheckpointResponseTemplate
34
- } from "./chunk-MOTQNIZX.js";
34
+ } from "./chunk-FX2CB4MG.js";
35
35
  import {
36
36
  createCodexExecAgentAdapter,
37
37
  runCodexExecAgentDoctor
38
- } from "./chunk-RS4HJLJQ.js";
38
+ } from "./chunk-QPKY767W.js";
39
39
 
40
40
  // src/cli.ts
41
41
  import { spawnSync } from "child_process";
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  statePathsForRunState
3
- } from "./chunk-MOTQNIZX.js";
3
+ } from "./chunk-FX2CB4MG.js";
4
4
  import {
5
5
  compactRecord,
6
6
  isTerminalStatus,
7
7
  nonEmptyString,
8
- recordValue,
9
- shipControlStateFor
10
- } from "./chunk-CUBYSWZT.js";
8
+ publicMergeRecommendationForRunState,
9
+ publicStateForRunState,
10
+ recordValue
11
+ } from "./chunk-QGMSN34W.js";
11
12
 
12
13
  // src/run-card.ts
13
14
  var RIDDLE_PROOF_RUN_CARD_VERSION = "riddle-proof.run-card.v1";
@@ -168,7 +169,8 @@ function createRiddleProofRunCard(state, input = {}) {
168
169
  const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
169
170
  const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
170
171
  const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
171
- const shipControl = shipControlStateFor({ state });
172
+ const publicState = publicStateForRunState({ state, status: state.status });
173
+ const publicMergeRecommendation = publicMergeRecommendationForRunState({ state, status: state.status });
172
174
  return {
173
175
  version: RIDDLE_PROOF_RUN_CARD_VERSION,
174
176
  run_id: state.run_id || "unknown",
@@ -222,14 +224,18 @@ function createRiddleProofRunCard(state, input = {}) {
222
224
  stop_condition: compactRecord({
223
225
  status: state.status,
224
226
  terminal: isTerminalStatus(state.status),
225
- ship_held: shipControl.ship_held,
226
- shipping_disabled: shipControl.shipping_disabled,
227
- ship_authorized: shipControl.ship_authorized,
227
+ result_label: publicState.result_label,
228
+ ship_held: publicState.ship_held,
229
+ shipping_disabled: publicState.shipping_disabled,
230
+ ship_authorized: publicState.ship_authorized,
231
+ merge_ready: publicState.merge_ready,
232
+ sync_allowed: publicState.sync_allowed,
228
233
  blocker_code: state.blocker?.code || null,
229
234
  blocker_message: state.blocker?.message || null,
230
235
  proof_decision: state.proof_decision,
231
- merge_recommendation: state.merge_recommendation,
232
- monitor_should_continue: !isTerminalStatus(state.status)
236
+ merge_recommendation: publicMergeRecommendation,
237
+ monitor_should_continue: !isTerminalStatus(state.status),
238
+ public_state: publicState
233
239
  }),
234
240
  updated_at: state.updated_at
235
241
  };
@@ -1,3 +1,8 @@
1
+ import {
2
+ riddleProofPublicStateMergeRecommendation,
3
+ summarizeRiddleProofPublicState
4
+ } from "./chunk-WKIIJX3O.js";
5
+
1
6
  // src/result.ts
2
7
  function isTerminalStatus(status) {
3
8
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
@@ -172,6 +177,37 @@ function applyTerminalMetadata(state, metadata) {
172
177
  if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
173
178
  return state;
174
179
  }
180
+ function publicStateForRunState(input) {
181
+ const state = input.state;
182
+ const status = input.status || state.status;
183
+ const raw = recordValue(input.raw) || {};
184
+ const extendedState = state;
185
+ const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
186
+ return summarizeRiddleProofPublicState(compactRecord({
187
+ status,
188
+ ok: terminalOk,
189
+ request: state.request,
190
+ pr_state: state.pr_state,
191
+ marked_ready: state.marked_ready,
192
+ ship_held: state.ship_held,
193
+ shipping_disabled: state.shipping_disabled,
194
+ ship_authorized: state.ship_authorized,
195
+ ship_mode: state.request?.ship_mode,
196
+ merge_commit: state.merge_commit,
197
+ merged_at: state.merged_at,
198
+ checkpoint_summary: state.checkpoint_summary,
199
+ pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
200
+ merge_ready: extendedState.merge_ready,
201
+ normal_pr_allowed: extendedState.normal_pr_allowed,
202
+ raw: Object.keys(raw).length ? raw : void 0
203
+ }));
204
+ }
205
+ function publicMergeRecommendationForRunState(input) {
206
+ return riddleProofPublicStateMergeRecommendation(
207
+ publicStateForRunState(input),
208
+ input.state.merge_recommendation
209
+ );
210
+ }
175
211
  function shipControlStateFor(input) {
176
212
  const state = input.state;
177
213
  const status = input.status || state.status;
@@ -220,6 +256,11 @@ function createRunResult(input) {
220
256
  state.ok = ok;
221
257
  if (isProtectedFinalStatus(status)) state.finalized = true;
222
258
  applyShipControlState(state, { status, raw: input.raw });
259
+ const publicState = publicStateForRunState({ state, status, raw: input.raw });
260
+ const publicMergeRecommendation = riddleProofPublicStateMergeRecommendation(
261
+ publicState,
262
+ state.merge_recommendation
263
+ );
223
264
  return compactRecord({
224
265
  ok,
225
266
  status,
@@ -237,9 +278,12 @@ function createRunResult(input) {
237
278
  pr_state: state.pr_state,
238
279
  marked_ready: state.marked_ready,
239
280
  left_draft: state.left_draft,
240
- ship_held: state.ship_held,
241
- shipping_disabled: state.shipping_disabled,
242
- ship_authorized: state.ship_authorized,
281
+ result_label: publicState.result_label,
282
+ ship_held: publicState.ship_held,
283
+ shipping_disabled: publicState.shipping_disabled,
284
+ ship_authorized: publicState.ship_authorized,
285
+ merge_ready: publicState.merge_ready,
286
+ sync_allowed: publicState.sync_allowed,
243
287
  ci_status: state.ci_status,
244
288
  ship_commit: state.ship_commit,
245
289
  ship_remote_head: state.ship_remote_head,
@@ -253,7 +297,8 @@ function createRunResult(input) {
253
297
  cleanup_report: state.cleanup_report,
254
298
  notification: state.notification,
255
299
  proof_decision: state.proof_decision,
256
- merge_recommendation: state.merge_recommendation,
300
+ merge_recommendation: publicMergeRecommendation,
301
+ public_state: publicState,
257
302
  finalized: state.finalized,
258
303
  blocker: state.blocker,
259
304
  checkpoint_packet: state.checkpoint_packet,
@@ -277,6 +322,8 @@ export {
277
322
  recordValue,
278
323
  normalizeTerminalMetadata,
279
324
  applyTerminalMetadata,
325
+ publicStateForRunState,
326
+ publicMergeRecommendationForRunState,
280
327
  shipControlStateFor,
281
328
  applyShipControlState,
282
329
  createRunResult
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compactRecord
3
- } from "./chunk-CUBYSWZT.js";
3
+ } from "./chunk-QGMSN34W.js";
4
4
 
5
5
  // src/codex-exec-agent.ts
6
6
  import { execFileSync, spawnSync } from "child_process";