@riddledc/riddle-proof 0.7.225 → 0.7.227

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 (139) hide show
  1. package/dist/adapters/codex-exec-agent.cjs +893 -0
  2. package/dist/adapters/codex-exec-agent.d.cts +3 -0
  3. package/dist/adapters/codex-exec-agent.d.ts +3 -0
  4. package/dist/adapters/codex-exec-agent.js +13 -0
  5. package/dist/adapters/codex.cjs +893 -0
  6. package/dist/adapters/codex.d.cts +3 -0
  7. package/dist/adapters/codex.d.ts +3 -0
  8. package/dist/adapters/codex.js +13 -0
  9. package/dist/adapters/local-agent.cjs +893 -0
  10. package/dist/adapters/local-agent.d.cts +3 -0
  11. package/dist/adapters/local-agent.d.ts +3 -0
  12. package/dist/adapters/local-agent.js +13 -0
  13. package/dist/adapters/openclaw.cjs +213 -0
  14. package/dist/adapters/openclaw.d.cts +2 -0
  15. package/dist/adapters/openclaw.d.ts +2 -0
  16. package/dist/adapters/openclaw.js +17 -0
  17. package/dist/advanced/engine-harness.cjs +5701 -0
  18. package/dist/advanced/engine-harness.d.cts +2 -0
  19. package/dist/advanced/engine-harness.d.ts +2 -0
  20. package/dist/advanced/engine-harness.js +16 -0
  21. package/dist/advanced/index.cjs +6242 -0
  22. package/dist/advanced/index.d.cts +5 -0
  23. package/dist/advanced/index.d.ts +5 -0
  24. package/dist/advanced/index.js +23 -0
  25. package/dist/advanced/proof-run-core.cjs +1085 -0
  26. package/dist/advanced/proof-run-core.d.cts +1 -0
  27. package/dist/advanced/proof-run-core.d.ts +1 -0
  28. package/dist/advanced/proof-run-core.js +59 -0
  29. package/dist/advanced/proof-run-engine.cjs +2905 -0
  30. package/dist/advanced/proof-run-engine.d.cts +2 -0
  31. package/dist/advanced/proof-run-engine.d.ts +2 -0
  32. package/dist/advanced/proof-run-engine.js +10 -0
  33. package/dist/advanced/runner.cjs +833 -0
  34. package/dist/advanced/runner.d.cts +2 -0
  35. package/dist/advanced/runner.d.ts +2 -0
  36. package/dist/advanced/runner.js +12 -0
  37. package/dist/app-contract/index.cjs +24 -0
  38. package/dist/app-contract/index.d.cts +1 -0
  39. package/dist/app-contract/index.d.ts +1 -0
  40. package/dist/app-contract/index.js +2 -0
  41. package/dist/basic-gameplay.js +1 -0
  42. package/dist/checkpoint.js +1 -0
  43. package/dist/chunk-BHL4JSGM.js +1900 -0
  44. package/dist/chunk-BTN76IGW.js +115 -0
  45. package/dist/{chunk-TGHTM66Z.js → chunk-COERZX63.js} +10 -2
  46. package/dist/{chunk-4DRRIJDX.js → chunk-IWLQQ5S5.js} +27 -4
  47. package/dist/chunk-MLKGABMK.js +9 -0
  48. package/dist/chunk-OFSECTSC.js +0 -0
  49. package/dist/{chunk-GBVEQQIM.js → chunk-TJ63IE65.js} +36 -1
  50. package/dist/chunk-VZD5LH7U.js +4138 -0
  51. package/dist/cli/index.cjs +18 -0
  52. package/dist/cli/index.d.cts +2 -0
  53. package/dist/cli/index.d.ts +2 -0
  54. package/dist/cli/index.js +12 -0
  55. package/dist/cli.cjs +19 -2
  56. package/dist/cli.d.cts +1 -0
  57. package/dist/cli.d.ts +1 -0
  58. package/dist/cli.js +8 -4139
  59. package/dist/codex-exec-agent.d.cts +1 -1
  60. package/dist/codex-exec-agent.d.ts +1 -1
  61. package/dist/codex-exec-agent.js +1 -0
  62. package/dist/diagnostics.js +1 -0
  63. package/dist/engine-harness-CMACHP6A.d.ts +96 -0
  64. package/dist/engine-harness-LBfqbFSe.d.cts +96 -0
  65. package/dist/engine-harness.cjs +19 -2
  66. package/dist/engine-harness.d.cts +2 -79
  67. package/dist/engine-harness.d.ts +2 -79
  68. package/dist/engine-harness.js +3 -2
  69. package/dist/index.cjs +19 -2
  70. package/dist/index.d.cts +2 -2
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.js +4 -3
  73. package/dist/local-agent.d.cts +1 -1
  74. package/dist/local-agent.d.ts +1 -1
  75. package/dist/local-agent.js +1 -0
  76. package/dist/openclaw.js +8 -107
  77. package/dist/playability.js +1 -0
  78. package/dist/profile/index.cjs +9403 -0
  79. package/dist/profile/index.d.cts +2 -0
  80. package/dist/profile/index.d.ts +2 -0
  81. package/dist/profile/index.js +53 -0
  82. package/dist/profile.js +1 -0
  83. package/dist/proof-run-core-CE0jx7wL.d.cts +359 -0
  84. package/dist/proof-run-core-CE0jx7wL.d.ts +359 -0
  85. package/dist/proof-run-core.d.cts +1 -322
  86. package/dist/proof-run-core.d.ts +1 -322
  87. package/dist/proof-run-core.js +2 -1
  88. package/dist/proof-run-engine-CSSc0mNn.d.ts +764 -0
  89. package/dist/proof-run-engine-HSRpUeBi.d.cts +764 -0
  90. package/dist/proof-run-engine.cjs +4 -0
  91. package/dist/proof-run-engine.d.cts +2 -757
  92. package/dist/proof-run-engine.d.ts +2 -757
  93. package/dist/proof-run-engine.js +5 -1881
  94. package/dist/proof-session.js +1 -0
  95. package/dist/result.js +1 -0
  96. package/dist/riddle-client.js +1 -0
  97. package/dist/run-card.js +1 -0
  98. package/dist/runner-4LJ5z0D-.d.cts +29 -0
  99. package/dist/runner-BdQpOkZD.d.ts +29 -0
  100. package/dist/runner.d.cts +2 -22
  101. package/dist/runner.d.ts +2 -22
  102. package/dist/runner.js +3 -2
  103. package/dist/runtime/index.cjs +528 -0
  104. package/dist/runtime/index.d.cts +1 -0
  105. package/dist/runtime/index.d.ts +1 -0
  106. package/dist/runtime/index.js +37 -0
  107. package/dist/runtime/riddle-client.cjs +528 -0
  108. package/dist/runtime/riddle-client.d.cts +1 -0
  109. package/dist/runtime/riddle-client.d.ts +1 -0
  110. package/dist/runtime/riddle-client.js +37 -0
  111. package/dist/spec/checkpoint.cjs +807 -0
  112. package/dist/spec/checkpoint.d.cts +2 -0
  113. package/dist/spec/checkpoint.d.ts +2 -0
  114. package/dist/spec/checkpoint.js +34 -0
  115. package/dist/spec/index.cjs +1510 -0
  116. package/dist/spec/index.d.cts +5 -0
  117. package/dist/spec/index.d.ts +5 -0
  118. package/dist/spec/index.js +80 -0
  119. package/dist/spec/result.cjs +259 -0
  120. package/dist/spec/result.d.cts +2 -0
  121. package/dist/spec/result.d.ts +2 -0
  122. package/dist/spec/result.js +21 -0
  123. package/dist/spec/run-card.cjs +287 -0
  124. package/dist/spec/run-card.d.cts +2 -0
  125. package/dist/spec/run-card.d.ts +2 -0
  126. package/dist/spec/run-card.js +11 -0
  127. package/dist/spec/state.cjs +541 -0
  128. package/dist/spec/state.d.cts +2 -0
  129. package/dist/spec/state.d.ts +2 -0
  130. package/dist/spec/state.js +28 -0
  131. package/dist/spec/types.cjs +18 -0
  132. package/dist/spec/types.d.cts +1 -0
  133. package/dist/spec/types.d.ts +1 -0
  134. package/dist/spec/types.js +1 -0
  135. package/dist/state.js +1 -0
  136. package/package.json +95 -2
  137. package/runtime/lib/verify.py +53 -3
  138. package/runtime/pipelines/riddle-proof-setup.lobster +45 -41
  139. package/runtime/tests/recon_verify_smoke.py +41 -0
@@ -0,0 +1,807 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/spec/checkpoint.ts
31
+ var checkpoint_exports = {};
32
+ __export(checkpoint_exports, {
33
+ RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: () => RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
34
+ RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: () => RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
35
+ authorPacketPayloadFromCheckpointResponse: () => authorPacketPayloadFromCheckpointResponse,
36
+ buildAuthorCheckpointPacket: () => buildAuthorCheckpointPacket,
37
+ buildCheckpointPacketForEngineResult: () => buildCheckpointPacketForEngineResult,
38
+ buildProofAssessmentCheckpointPacket: () => buildProofAssessmentCheckpointPacket,
39
+ buildStageCheckpointPacket: () => buildStageCheckpointPacket,
40
+ checkpointResponseIdentity: () => checkpointResponseIdentity,
41
+ checkpointSummaryFromState: () => checkpointSummaryFromState,
42
+ createCheckpointResponseTemplate: () => createCheckpointResponseTemplate,
43
+ isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
44
+ normalizeCheckpointResponse: () => normalizeCheckpointResponse,
45
+ proofContractFromAuthorCheckpointResponse: () => proofContractFromAuthorCheckpointResponse,
46
+ statePathsForRunState: () => statePathsForRunState
47
+ });
48
+ module.exports = __toCommonJS(checkpoint_exports);
49
+
50
+ // src/checkpoint.ts
51
+ var import_node_crypto = __toESM(require("crypto"), 1);
52
+
53
+ // src/result.ts
54
+ function compactRecord(input) {
55
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
56
+ }
57
+ function nonEmptyString(value) {
58
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
59
+ }
60
+ function recordValue(value) {
61
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
62
+ }
63
+
64
+ // src/checkpoint.ts
65
+ var RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION = "riddle-proof.checkpoint.v1";
66
+ var RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION = "riddle-proof.checkpoint_response.v1";
67
+ function timestamp() {
68
+ return (/* @__PURE__ */ new Date()).toISOString();
69
+ }
70
+ function jsonCloneRecord(value) {
71
+ const record = recordValue(value);
72
+ if (!record) return void 0;
73
+ try {
74
+ return JSON.parse(JSON.stringify(record));
75
+ } catch {
76
+ return { ...record };
77
+ }
78
+ }
79
+ function jsonCloneValue(value) {
80
+ if (value === void 0 || value === null) return void 0;
81
+ try {
82
+ return JSON.parse(JSON.stringify(value));
83
+ } catch {
84
+ return value;
85
+ }
86
+ }
87
+ function stableJson(value) {
88
+ if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
89
+ const record = recordValue(value);
90
+ if (record) {
91
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`).join(",")}}`;
92
+ }
93
+ return JSON.stringify(value);
94
+ }
95
+ function compactText(value, limit = 1600) {
96
+ const text = nonEmptyString(value);
97
+ if (!text) return void 0;
98
+ return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
99
+ }
100
+ function statePathsForRunState(state, engineStatePath) {
101
+ return compactRecord({
102
+ wrapper_state_path: state.state_path || state.request.harness_state_path || null,
103
+ engine_state_path: engineStatePath || state.request.engine_state_path || null,
104
+ resume_state_path: engineStatePath || state.request.engine_state_path || null
105
+ });
106
+ }
107
+ function responseSchemaForAuthorPacket() {
108
+ return {
109
+ type: "object",
110
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "payload", "created_at"],
111
+ additionalProperties: false,
112
+ properties: {
113
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
114
+ run_id: { type: "string" },
115
+ checkpoint: { type: "string" },
116
+ resume_token: { type: "string" },
117
+ decision: {
118
+ type: "string",
119
+ enum: ["author_packet", "needs_recon", "blocked", "human_review"]
120
+ },
121
+ summary: { type: "string" },
122
+ payload: {
123
+ type: "object",
124
+ description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan and capture_script."
125
+ },
126
+ reasons: { type: "array", items: { type: "string" } },
127
+ continue_with_stage: { type: "string", enum: ["author", "recon"] },
128
+ source: {
129
+ type: "object",
130
+ properties: {
131
+ kind: { type: "string" },
132
+ session_id: { type: "string" },
133
+ user_id: { type: "string" }
134
+ }
135
+ },
136
+ created_at: { type: "string" }
137
+ }
138
+ };
139
+ }
140
+ function responseSchemaForProofAssessmentPacket() {
141
+ return {
142
+ type: "object",
143
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
144
+ additionalProperties: false,
145
+ properties: {
146
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
147
+ run_id: { type: "string" },
148
+ checkpoint: { type: "string" },
149
+ resume_token: { type: "string" },
150
+ decision: {
151
+ type: "string",
152
+ enum: [
153
+ "ready_to_ship",
154
+ "needs_richer_proof",
155
+ "revise_capture",
156
+ "needs_recon",
157
+ "needs_implementation",
158
+ "blocked",
159
+ "human_review"
160
+ ]
161
+ },
162
+ summary: { type: "string" },
163
+ payload: {
164
+ type: "object",
165
+ description: "Optional structured assessment details, including recommended_stage, continue_with_stage, visual_delta notes, or blocker diagnostics."
166
+ },
167
+ reasons: { type: "array", items: { type: "string" } },
168
+ continue_with_stage: { type: "string", enum: ["ship", "author", "implement", "recon", "verify"] },
169
+ source: {
170
+ type: "object",
171
+ properties: {
172
+ kind: { type: "string" },
173
+ session_id: { type: "string" },
174
+ user_id: { type: "string" }
175
+ }
176
+ },
177
+ created_at: { type: "string" }
178
+ }
179
+ };
180
+ }
181
+ function responseSchemaForReconPacket() {
182
+ return {
183
+ type: "object",
184
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
185
+ additionalProperties: false,
186
+ properties: {
187
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
188
+ run_id: { type: "string" },
189
+ checkpoint: { type: "string" },
190
+ resume_token: { type: "string" },
191
+ decision: {
192
+ type: "string",
193
+ enum: ["ready_for_author", "retry_recon", "recon_stuck", "needs_recon", "blocked", "human_review"]
194
+ },
195
+ summary: { type: "string" },
196
+ payload: {
197
+ type: "object",
198
+ description: "Optional recon assessment details such as baseline_understanding, refined_inputs, reasons, or diagnostic blocker context."
199
+ },
200
+ reasons: { type: "array", items: { type: "string" } },
201
+ continue_with_stage: { type: "string", enum: ["recon", "author"] },
202
+ source: {
203
+ type: "object",
204
+ properties: {
205
+ kind: { type: "string" },
206
+ session_id: { type: "string" },
207
+ user_id: { type: "string" }
208
+ }
209
+ },
210
+ created_at: { type: "string" }
211
+ }
212
+ };
213
+ }
214
+ function responseSchemaForImplementationPacket() {
215
+ return {
216
+ type: "object",
217
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
218
+ additionalProperties: false,
219
+ properties: {
220
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
221
+ run_id: { type: "string" },
222
+ checkpoint: { type: "string" },
223
+ resume_token: { type: "string" },
224
+ decision: {
225
+ type: "string",
226
+ enum: ["implementation_complete", "needs_author", "needs_recon", "blocked", "human_review"]
227
+ },
228
+ summary: { type: "string" },
229
+ payload: {
230
+ type: "object",
231
+ description: "Implementation details such as changed_files, tests_run, and implementation_notes. The changed worktree must contain a real git diff before verify can advance."
232
+ },
233
+ reasons: { type: "array", items: { type: "string" } },
234
+ continue_with_stage: { type: "string", enum: ["implement", "verify", "author", "recon"] },
235
+ source: {
236
+ type: "object",
237
+ properties: {
238
+ kind: { type: "string" },
239
+ session_id: { type: "string" },
240
+ user_id: { type: "string" }
241
+ }
242
+ },
243
+ created_at: { type: "string" }
244
+ }
245
+ };
246
+ }
247
+ function responseSchemaForAdvancePacket(stage) {
248
+ return {
249
+ type: "object",
250
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
251
+ additionalProperties: false,
252
+ properties: {
253
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
254
+ run_id: { type: "string" },
255
+ checkpoint: { type: "string" },
256
+ resume_token: { type: "string" },
257
+ decision: {
258
+ type: "string",
259
+ enum: ["continue_stage", "retry_stage", "needs_recon", "needs_implementation", "blocked", "human_review"]
260
+ },
261
+ summary: { type: "string" },
262
+ payload: { type: "object" },
263
+ reasons: { type: "array", items: { type: "string" } },
264
+ continue_with_stage: { type: "string", enum: ["recon", "author", "implement", "verify", "ship", stage] },
265
+ source: {
266
+ type: "object",
267
+ properties: {
268
+ kind: { type: "string" },
269
+ session_id: { type: "string" },
270
+ user_id: { type: "string" }
271
+ }
272
+ },
273
+ created_at: { type: "string" }
274
+ }
275
+ };
276
+ }
277
+ function resumeTokenFor(input) {
278
+ const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
279
+ return `rpchk_${hash}`;
280
+ }
281
+ function artifactsFromState(state) {
282
+ const artifacts = [];
283
+ for (const role of ["before", "prod", "after"]) {
284
+ const url = nonEmptyString(state?.[`${role}_cdn`]);
285
+ if (url) artifacts.push({ role, url, name: `${role}.png`, mime_type: "image/png" });
286
+ }
287
+ const authorRequest = recordValue(state?.author_request);
288
+ const latestAttempt = recordValue(authorRequest?.latest_attempt);
289
+ const observations = recordValue(latestAttempt?.observations);
290
+ for (const [label, observation] of Object.entries(observations || {})) {
291
+ const record = recordValue(observation);
292
+ const url = nonEmptyString(record?.url);
293
+ if (url && !artifacts.some((artifact) => artifact.url === url)) {
294
+ artifacts.push({
295
+ role: label === "before" || label === "prod" ? label : "json",
296
+ url,
297
+ name: `${label}-observation`,
298
+ summary: compactText(record?.reason, 240)
299
+ });
300
+ }
301
+ }
302
+ return artifacts.slice(0, 16);
303
+ }
304
+ function stageFromCheckpoint(checkpoint) {
305
+ if (checkpoint.startsWith("recon_")) return "recon";
306
+ if (checkpoint.startsWith("author_")) return "author";
307
+ if (checkpoint.startsWith("implement_")) return "implement";
308
+ if (checkpoint.startsWith("verify_")) return "verify";
309
+ if (checkpoint.startsWith("ship_")) return "ship";
310
+ if (checkpoint.startsWith("pr_sync_")) return "notify";
311
+ if (checkpoint.includes("capture")) return "prove";
312
+ return "setup";
313
+ }
314
+ function allowedDecisionsForStage(stage, checkpoint) {
315
+ if (stage === "recon") return ["ready_for_author", "retry_recon", "recon_stuck", "blocked", "human_review"];
316
+ if (stage === "implement") return ["implementation_complete", "needs_author", "needs_recon", "blocked", "human_review"];
317
+ if (stage === "ship") return ["continue_stage", "needs_implementation", "needs_recon", "blocked", "human_review"];
318
+ if (checkpoint === "awaiting_stage_advance") return ["continue_stage", "retry_stage", "blocked", "human_review"];
319
+ return ["continue_stage", "needs_recon", "needs_implementation", "blocked", "human_review"];
320
+ }
321
+ function packetKindForStage(stage, checkpoint) {
322
+ if (stage === "recon") return "assess_recon";
323
+ if (stage === "implement") return "implement_change";
324
+ if (checkpoint.includes("human")) return "human_review";
325
+ return "advance_decision";
326
+ }
327
+ function responseSchemaForStage(stage, checkpoint) {
328
+ if (stage === "recon") return responseSchemaForReconPacket();
329
+ if (stage === "implement") return responseSchemaForImplementationPacket();
330
+ return responseSchemaForAdvancePacket(stage);
331
+ }
332
+ function questionForStage(stage, checkpoint) {
333
+ if (stage === "recon") {
334
+ return "Assess the baseline/recon evidence. Return ready_for_author only when the baseline is trustworthy; otherwise choose retry_recon, recon_stuck, blocked, or human_review.";
335
+ }
336
+ if (stage === "implement") {
337
+ return "Implement the requested change in the after worktree, leave a real git diff, then return implementation_complete with changed_files/tests_run/implementation_notes. Choose blocked or human_review if implementation cannot honestly advance.";
338
+ }
339
+ if (stage === "ship") {
340
+ return "Assess whether the ship gate can continue. Return continue_stage only if proof, PR, and policy gates are satisfied; otherwise route to the appropriate earlier stage or block with a concrete reason.";
341
+ }
342
+ return "Choose the next Riddle Proof stage for this durable run, or block with a concrete reason if the run cannot honestly advance.";
343
+ }
344
+ function buildStageCheckpointPacket(input) {
345
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "stage_checkpoint";
346
+ const stage = nonEmptyString(input.engineResult.stage) || stageFromCheckpoint(checkpoint);
347
+ const runId = input.runState.run_id || "unknown";
348
+ const fullState = input.fullRiddleState || {};
349
+ const decisionDetails = recordValue(input.engineResult.decisionRequest?.details);
350
+ const checkpointContract = recordValue(input.engineResult.checkpointContract);
351
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
352
+ const kind = packetKindForStage(stage, checkpoint);
353
+ return {
354
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
355
+ run_id: runId,
356
+ state_path: input.runState.state_path,
357
+ stage,
358
+ checkpoint,
359
+ kind,
360
+ summary,
361
+ question: questionForStage(stage, checkpoint),
362
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
363
+ context: input.request.context,
364
+ artifacts: artifactsFromState(fullState),
365
+ state_excerpt: compactRecord({
366
+ repo: input.request.repo || fullState.repo,
367
+ branch: input.request.branch || fullState.branch,
368
+ after_worktree: fullState.after_worktree || input.runState.worktree_path,
369
+ verification_mode: input.request.verification_mode || fullState.verification_mode,
370
+ reference: input.request.reference || fullState.reference,
371
+ server_path: fullState.server_path,
372
+ wait_for_selector: fullState.wait_for_selector,
373
+ recon_status: fullState.recon_status,
374
+ author_status: fullState.author_status,
375
+ implementation_status: fullState.implementation_status,
376
+ verify_status: fullState.verify_status,
377
+ stage_decision_request: jsonCloneRecord(fullState.stage_decision_request)
378
+ }),
379
+ evidence_excerpt: compactRecord({
380
+ before_cdn: fullState.before_cdn || null,
381
+ prod_cdn: fullState.prod_cdn || null,
382
+ after_cdn: fullState.after_cdn || null,
383
+ recon_results: jsonCloneRecord(fullState.recon_results),
384
+ checkpoint_contract: jsonCloneRecord(checkpointContract),
385
+ decision_details: jsonCloneRecord(decisionDetails)
386
+ }),
387
+ allowed_decisions: allowedDecisionsForStage(stage, checkpoint),
388
+ response_schema: responseSchemaForStage(stage, checkpoint),
389
+ routing_hint: {
390
+ suggested_role: stage === "implement" ? "builder_agent" : checkpoint.includes("human") ? "human" : "main_agent",
391
+ visibility: input.visibility || "quiet",
392
+ urgency: stage === "ship" ? "high" : "normal",
393
+ can_auto_answer: input.visibility !== "manual"
394
+ },
395
+ resume_token: resumeTokenFor({
396
+ runId,
397
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
398
+ checkpoint,
399
+ stage
400
+ }),
401
+ created_at: input.created_at || timestamp()
402
+ };
403
+ }
404
+ function buildAuthorCheckpointPacket(input) {
405
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
406
+ const stage = "author";
407
+ const runId = input.runState.run_id || "unknown";
408
+ const fullState = input.fullRiddleState || {};
409
+ const decisionDetails = recordValue(input.engineResult.decisionRequest?.details);
410
+ const authorRequest = recordValue(fullState.author_request) || recordValue(fullState.proof_plan_request) || recordValue(decisionDetails?.authorRequest) || {};
411
+ const fallbackDefaults = recordValue(authorRequest.fallback_defaults) || {};
412
+ const reconResults = recordValue(fullState.recon_results);
413
+ const checkpointContract = recordValue(input.engineResult.checkpointContract);
414
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.author_summary) || "Author checkpoint needs a supervising proof packet.";
415
+ return {
416
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
417
+ run_id: runId,
418
+ state_path: input.runState.state_path,
419
+ stage,
420
+ checkpoint,
421
+ kind: "author_proof",
422
+ summary,
423
+ question: "Author the proof packet for this Riddle Proof run. Return a CheckpointResponse with decision=author_packet and payload containing proof_plan and capture_script.",
424
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
425
+ context: input.request.context,
426
+ artifacts: artifactsFromState(fullState),
427
+ state_excerpt: compactRecord({
428
+ repo: input.request.repo || fullState.repo,
429
+ branch: input.request.branch || fullState.branch,
430
+ verification_mode: input.request.verification_mode || fullState.verification_mode,
431
+ reference: input.request.reference || fullState.reference,
432
+ server_path: fullState.server_path,
433
+ wait_for_selector: fullState.wait_for_selector,
434
+ author_summary: fullState.author_summary,
435
+ author_request: jsonCloneRecord(authorRequest),
436
+ recon_baseline_understanding: jsonCloneRecord(fullState.recon_baseline_understanding),
437
+ fallback_defaults: jsonCloneRecord(fallbackDefaults)
438
+ }),
439
+ evidence_excerpt: compactRecord({
440
+ recon_results: jsonCloneRecord(reconResults),
441
+ checkpoint_contract: jsonCloneRecord(checkpointContract)
442
+ }),
443
+ allowed_decisions: ["author_packet", "needs_recon", "blocked", "human_review"],
444
+ response_schema: responseSchemaForAuthorPacket(),
445
+ routing_hint: {
446
+ suggested_role: "proof_author",
447
+ visibility: input.visibility || "quiet",
448
+ urgency: "normal",
449
+ can_auto_answer: input.visibility !== "manual"
450
+ },
451
+ resume_token: resumeTokenFor({
452
+ runId,
453
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
454
+ checkpoint,
455
+ stage
456
+ }),
457
+ created_at: input.created_at || timestamp()
458
+ };
459
+ }
460
+ function visualDeltaFromState(fullState) {
461
+ const bundle = recordValue(fullState.evidence_bundle);
462
+ const after = recordValue(bundle?.after);
463
+ const afterDelta = recordValue(after?.visual_delta);
464
+ if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
465
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request);
466
+ return recordValue(proofAssessmentRequest?.visual_delta) || null;
467
+ }
468
+ function normalizedText(value) {
469
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
470
+ }
471
+ function noImplementationModeForCheckpoint(request, fullState) {
472
+ const requestRecord = recordValue(request) || {};
473
+ const mode = normalizedText(
474
+ requestRecord.mode || requestRecord.workflow_mode || fullState.mode || fullState.workflow_mode
475
+ );
476
+ const implementationMode = normalizedText(requestRecord.implementation_mode || fullState.implementation_mode);
477
+ const requireDiff = requestRecord.require_diff ?? fullState.require_diff;
478
+ const allowCodeChanges = requestRecord.allow_code_changes ?? fullState.allow_code_changes;
479
+ return mode === "audit" || mode === "profile" || implementationMode === "none" || requireDiff === false || allowCodeChanges === false;
480
+ }
481
+ function visualDeltaNotApplicableForNoImplementation(visualDelta) {
482
+ if (String(visualDelta?.status || "").trim() !== "not_applicable") return false;
483
+ const reason = String(visualDelta?.reason || "").toLowerCase();
484
+ return reason.includes("audit/no-diff") || reason.includes("does not require a before/after implementation delta");
485
+ }
486
+ function verificationModeRequiresVisualDelta(value) {
487
+ const mode = String(value || "proof").trim().toLowerCase();
488
+ return [
489
+ "visual",
490
+ "render",
491
+ "interaction",
492
+ "ui",
493
+ "layout",
494
+ "screenshot",
495
+ "canvas",
496
+ "animation"
497
+ ].includes(mode);
498
+ }
499
+ function visualDeltaIssueCode(visualDelta, required) {
500
+ const status = String(visualDelta?.status || "").trim();
501
+ const reason = String(visualDelta?.reason || "").toLowerCase();
502
+ if (status === "unmeasured") {
503
+ if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
504
+ return "comparator_fetch_blocked";
505
+ }
506
+ return "visual_delta_unmeasured";
507
+ }
508
+ if (status === "measured" && visualDelta?.passed === false) return "semantic_proof_failed";
509
+ if (required && status !== "measured") return "visual_delta_unmeasured";
510
+ return null;
511
+ }
512
+ function buildProofAssessmentCheckpointPacket(input) {
513
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "verify_supervisor_judgment";
514
+ const stage = "verify";
515
+ const runId = input.runState.run_id || "unknown";
516
+ const fullState = input.fullRiddleState || {};
517
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request) || recordValue(recordValue(fullState.verify_decision_request)?.assessment_request) || recordValue(input.engineResult.decisionRequest?.details) || {};
518
+ const bundle = recordValue(fullState.evidence_bundle);
519
+ const artifactContract = recordValue(proofAssessmentRequest.artifact_contract) || recordValue(bundle?.artifact_contract);
520
+ const requiredSignals = recordValue(recordValue(artifactContract)?.required);
521
+ const visualDelta = visualDeltaFromState(fullState);
522
+ const verificationMode = nonEmptyString(bundle?.verification_mode) || nonEmptyString(fullState.verification_mode) || nonEmptyString(input.request.verification_mode) || "proof";
523
+ const noImplementationMode = noImplementationModeForCheckpoint(input.request, fullState);
524
+ const noImplementationVisualDelta = visualDeltaNotApplicableForNoImplementation(visualDelta);
525
+ const visualDeltaRequired = !noImplementationMode && !noImplementationVisualDelta && requiredSignals?.visual_delta !== false && (requiredSignals?.visual_delta === true || verificationModeRequiresVisualDelta(verificationMode));
526
+ const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
527
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
528
+ const recoveryHint = evidenceIssueCode ? "Required visual_delta evidence is incomplete. Keep this same run in verify/evidence recovery with decision=revise_capture and continue_with_stage=verify unless the evidence proves an implementation or recon problem." : "Assess whether the current artifacts prove the requested change, then choose the next stage.";
529
+ return {
530
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
531
+ run_id: runId,
532
+ state_path: input.runState.state_path,
533
+ stage,
534
+ checkpoint,
535
+ kind: evidenceIssueCode ? "recover_evidence" : "assess_proof",
536
+ summary,
537
+ question: `Assess the current Riddle Proof evidence. ${recoveryHint} Return a CheckpointResponse using one allowed decision.`,
538
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
539
+ context: input.request.context,
540
+ artifacts: artifactsFromState(fullState),
541
+ state_excerpt: compactRecord({
542
+ repo: input.request.repo || fullState.repo,
543
+ branch: input.request.branch || fullState.branch,
544
+ verification_mode: verificationMode,
545
+ reference: input.request.reference || fullState.reference,
546
+ server_path: fullState.server_path,
547
+ wait_for_selector: fullState.wait_for_selector,
548
+ implementation_status: fullState.implementation_status,
549
+ implementation_summary: fullState.implementation_summary,
550
+ changed_files: jsonCloneValue(fullState.changed_files),
551
+ proof_plan: compactText(fullState.proof_plan, 1200)
552
+ }),
553
+ evidence_excerpt: compactRecord({
554
+ before_cdn: fullState.before_cdn || null,
555
+ prod_cdn: fullState.prod_cdn || null,
556
+ after_cdn: fullState.after_cdn || null,
557
+ visual_delta_required: visualDeltaRequired,
558
+ visual_delta_ready: !visualDeltaRequired || visualDelta?.status === "measured" && visualDelta?.passed === true,
559
+ visual_delta: jsonCloneRecord(visualDelta),
560
+ evidence_issue_code: evidenceIssueCode,
561
+ proof_assessment_request: jsonCloneRecord(proofAssessmentRequest),
562
+ verify_decision_request: jsonCloneRecord(fullState.verify_decision_request),
563
+ checkpoint_contract: jsonCloneRecord(input.engineResult.checkpointContract)
564
+ }),
565
+ artifact_contract: jsonCloneRecord(artifactContract),
566
+ allowed_decisions: [
567
+ "ready_to_ship",
568
+ "needs_richer_proof",
569
+ "revise_capture",
570
+ "needs_recon",
571
+ "needs_implementation",
572
+ "blocked",
573
+ "human_review"
574
+ ],
575
+ response_schema: responseSchemaForProofAssessmentPacket(),
576
+ routing_hint: {
577
+ suggested_role: evidenceIssueCode ? "proof_judge" : "proof_judge",
578
+ visibility: input.visibility || "quiet",
579
+ urgency: evidenceIssueCode ? "high" : "normal",
580
+ can_auto_answer: input.visibility !== "manual"
581
+ },
582
+ resume_token: resumeTokenFor({
583
+ runId,
584
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
585
+ checkpoint,
586
+ stage
587
+ }),
588
+ created_at: input.created_at || timestamp()
589
+ };
590
+ }
591
+ function buildCheckpointPacketForEngineResult(input) {
592
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
593
+ if (checkpoint === "verify_supervisor_judgment" || checkpoint === "verify_supervisor_judgment_required" || checkpoint === "verify_human_escalation") {
594
+ return buildProofAssessmentCheckpointPacket(input);
595
+ }
596
+ const resume = recordValue(input.engineResult.checkpointContract?.resume);
597
+ const continueStage = nonEmptyString(resume?.continue_with_stage);
598
+ if (checkpoint === "author_supervisor_judgment" || checkpoint === "verify_capture_retry" || checkpoint === "verify_agent_retry" && continueStage === "author") {
599
+ return buildAuthorCheckpointPacket(input);
600
+ }
601
+ return buildStageCheckpointPacket(input);
602
+ }
603
+ function normalizeCheckpointResponse(value) {
604
+ const record = recordValue(value);
605
+ if (!record) return null;
606
+ const version = nonEmptyString(record.version);
607
+ const runId = nonEmptyString(record.run_id);
608
+ const checkpoint = nonEmptyString(record.checkpoint);
609
+ const decision = nonEmptyString(record.decision);
610
+ const summary = nonEmptyString(record.summary);
611
+ if (version !== RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION || !runId || !checkpoint || !decision || !summary) {
612
+ return null;
613
+ }
614
+ return compactRecord({
615
+ version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
616
+ run_id: runId,
617
+ checkpoint,
618
+ resume_token: nonEmptyString(record.resume_token),
619
+ decision,
620
+ summary,
621
+ payload: jsonCloneRecord(record.payload),
622
+ reasons: Array.isArray(record.reasons) ? record.reasons.filter((item) => typeof item === "string") : void 0,
623
+ continue_with_stage: nonEmptyString(record.continue_with_stage),
624
+ source: jsonCloneRecord(record.source),
625
+ created_at: nonEmptyString(record.created_at) || timestamp()
626
+ });
627
+ }
628
+ function defaultContinueStage(packet, decision) {
629
+ if (decision === "ready_for_author" || decision === "author_packet" || decision === "needs_author") return "author";
630
+ if (decision === "implementation_complete") return "verify";
631
+ if (decision === "ready_to_ship") return "ship";
632
+ if (decision === "revise_capture") return "verify";
633
+ if (decision === "retry_recon" || decision === "recon_stuck" || decision === "needs_recon") return "recon";
634
+ if (decision === "needs_implementation") return "implement";
635
+ if (decision === "continue_stage" || decision === "retry_stage") return packet.stage;
636
+ return void 0;
637
+ }
638
+ function templatePayloadFor(packet, decision) {
639
+ if (decision === "author_packet") {
640
+ return {
641
+ proof_plan: "TODO: describe the exact proof plan and stop condition.",
642
+ capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
643
+ summary: "TODO: summarize why this proof packet targets the requested change."
644
+ };
645
+ }
646
+ if (decision === "implementation_complete") {
647
+ return {
648
+ changed_files: [],
649
+ tests_run: [],
650
+ implementation_notes: "TODO: summarize the direct edits made in the after worktree."
651
+ };
652
+ }
653
+ if (decision === "ready_for_author") {
654
+ return {
655
+ baseline_understanding: {
656
+ reference: "TODO",
657
+ target_route: "TODO",
658
+ before_evidence_url: "TODO",
659
+ visible_before_state: "TODO",
660
+ relevant_elements: [],
661
+ requested_change: packet.change_request,
662
+ proof_focus: "TODO",
663
+ stop_condition: "TODO",
664
+ quality_risks: []
665
+ },
666
+ refined_inputs: {
667
+ server_path: null,
668
+ wait_for_selector: null,
669
+ reference: null
670
+ }
671
+ };
672
+ }
673
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
674
+ return {
675
+ recommended_stage: defaultContinueStage(packet, decision) || packet.stage,
676
+ evidence_issue_code: packet.evidence_excerpt?.evidence_issue_code || null,
677
+ visual_delta: packet.evidence_excerpt?.visual_delta || null
678
+ };
679
+ }
680
+ return void 0;
681
+ }
682
+ function createCheckpointResponseTemplate(packet, input = {}) {
683
+ const allowed = Array.isArray(packet.allowed_decisions) ? packet.allowed_decisions : [];
684
+ const decision = input.decision && allowed.includes(input.decision) ? input.decision : allowed[0] || "blocked";
685
+ const continueStage = input.continue_with_stage || defaultContinueStage(packet, decision);
686
+ return compactRecord({
687
+ version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
688
+ run_id: packet.run_id,
689
+ checkpoint: packet.checkpoint,
690
+ resume_token: packet.resume_token,
691
+ decision,
692
+ summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
693
+ payload: input.payload || templatePayloadFor(packet, decision),
694
+ reasons: input.reasons || ["TODO: replace with concrete reason(s)."],
695
+ continue_with_stage: continueStage,
696
+ source: {
697
+ kind: input.source_kind || "codex"
698
+ },
699
+ created_at: input.created_at || timestamp()
700
+ });
701
+ }
702
+ function checkpointSummaryFromState(state, engineStatePath) {
703
+ const history = state.checkpoint_history || [];
704
+ const packets = history.filter((entry) => entry.packet);
705
+ const responses = history.filter((entry) => entry.response);
706
+ const duplicateResponses = (state.events || []).filter((event) => event.kind === "checkpoint.response.duplicate");
707
+ const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
708
+ const latestResponseEntry = [...history].reverse().find((entry) => entry.response);
709
+ const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
710
+ const latestResponse = latestResponseEntry?.response;
711
+ const latestResumeToken = latestPacket?.resume_token || null;
712
+ const latestResponseToken = latestResponse?.resume_token || null;
713
+ const tokenMatches = latestResumeToken && latestResponseToken ? latestResumeToken === latestResponseToken : latestResumeToken || latestResponseToken ? false : null;
714
+ return compactRecord({
715
+ pending: Boolean(state.checkpoint_packet),
716
+ packet_count: packets.length,
717
+ response_count: responses.length,
718
+ duplicate_response_count: duplicateResponses.length,
719
+ latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
720
+ latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
721
+ latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
722
+ latest_decision: latestResponse?.decision || null,
723
+ latest_packet_summary: latestPacket?.summary || null,
724
+ latest_response_summary: latestResponse?.summary || null,
725
+ latest_resume_token: latestResumeToken,
726
+ latest_response_token: latestResponseToken,
727
+ token_matches: tokenMatches,
728
+ last_packet_at: latestPacketEntry?.ts || null,
729
+ last_response_at: latestResponseEntry?.ts || null,
730
+ state_paths: statePathsForRunState(state, engineStatePath)
731
+ });
732
+ }
733
+ function isDuplicateCheckpointResponse(state, response) {
734
+ const identity = checkpointResponseIdentity(response);
735
+ return (state.checkpoint_history || []).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
736
+ }
737
+ function checkpointResponseIdentity(response) {
738
+ const logicalResponse = compactRecord({
739
+ run_id: response.run_id,
740
+ checkpoint: response.checkpoint,
741
+ resume_token: response.resume_token,
742
+ decision: response.decision,
743
+ summary: response.summary,
744
+ payload: response.payload,
745
+ reasons: response.reasons,
746
+ continue_with_stage: response.continue_with_stage,
747
+ source: response.source
748
+ });
749
+ return import_node_crypto.default.createHash("sha256").update(stableJson(logicalResponse)).digest("hex").slice(0, 24);
750
+ }
751
+ function authorPacketPayloadFromCheckpointResponse(response) {
752
+ if (response.decision !== "author_packet") return null;
753
+ const payload = recordValue(response.payload);
754
+ if (!payload) return null;
755
+ const nested = recordValue(payload.author_packet);
756
+ const candidate = nested || payload;
757
+ if (!nonEmptyString(candidate.proof_plan) || !nonEmptyString(candidate.capture_script)) return null;
758
+ return candidate;
759
+ }
760
+ function proofContractFromAuthorCheckpointResponse(response, packet, payload) {
761
+ const refinedInputs = recordValue(payload.refined_inputs) || {};
762
+ return compactRecord({
763
+ version: "riddle-proof.proof-contract.v1",
764
+ checkpoint: packet.checkpoint,
765
+ source_response: compactRecord({
766
+ run_id: response.run_id,
767
+ checkpoint: response.checkpoint,
768
+ resume_token: response.resume_token,
769
+ decision: response.decision,
770
+ summary: response.summary,
771
+ created_at: response.created_at
772
+ }),
773
+ proof_plan: nonEmptyString(payload.proof_plan),
774
+ capture_script: nonEmptyString(payload.capture_script),
775
+ artifact_contract: jsonCloneRecord(payload.artifact_contract),
776
+ assertions: jsonCloneValue(payload.assertions),
777
+ baseline_understanding: jsonCloneRecord(payload.baseline_understanding) || jsonCloneRecord(payload.recon_baseline_understanding) || jsonCloneRecord(packet.state_excerpt?.recon_baseline_understanding),
778
+ route_assumptions: compactRecord({
779
+ server_path: nonEmptyString(refinedInputs.server_path) || nonEmptyString(payload.server_path) || nonEmptyString(packet.state_excerpt?.server_path),
780
+ wait_for_selector: nonEmptyString(refinedInputs.wait_for_selector) || nonEmptyString(payload.wait_for_selector) || nonEmptyString(packet.state_excerpt?.wait_for_selector),
781
+ reference: nonEmptyString(refinedInputs.reference) || nonEmptyString(payload.reference),
782
+ expected_path: nonEmptyString(payload.expected_path) || nonEmptyString(refinedInputs.expected_path)
783
+ }),
784
+ stop_condition: nonEmptyString(payload.stop_condition),
785
+ rationale: jsonCloneValue(payload.rationale),
786
+ verdict_dimensions: jsonCloneRecord(payload.verdict_dimensions),
787
+ payload: jsonCloneRecord(payload),
788
+ created_at: timestamp()
789
+ });
790
+ }
791
+ // Annotate the CommonJS export names for ESM import in node:
792
+ 0 && (module.exports = {
793
+ RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
794
+ RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
795
+ authorPacketPayloadFromCheckpointResponse,
796
+ buildAuthorCheckpointPacket,
797
+ buildCheckpointPacketForEngineResult,
798
+ buildProofAssessmentCheckpointPacket,
799
+ buildStageCheckpointPacket,
800
+ checkpointResponseIdentity,
801
+ checkpointSummaryFromState,
802
+ createCheckpointResponseTemplate,
803
+ isDuplicateCheckpointResponse,
804
+ normalizeCheckpointResponse,
805
+ proofContractFromAuthorCheckpointResponse,
806
+ statePathsForRunState
807
+ });