@riddledc/riddle-proof 0.5.44 → 0.5.46
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.
- package/README.md +17 -0
- package/dist/checkpoint.cjs +366 -0
- package/dist/checkpoint.d.cts +44 -1
- package/dist/checkpoint.d.ts +44 -1
- package/dist/checkpoint.js +8 -2
- package/dist/{chunk-W7VTDN4T.js → chunk-DUFDZJOF.js} +1 -0
- package/dist/{chunk-7S7O3NKF.js → chunk-JTNMEH57.js} +6 -1
- package/dist/{chunk-MRSYJMF4.js → chunk-L26NTZOU.js} +2 -2
- package/dist/chunk-NOBFZDZG.js +754 -0
- package/dist/chunk-PLSGW2GI.js +161 -0
- package/dist/chunk-R6SCWJCI.js +656 -0
- package/dist/{chunk-MJD37CLH.js → chunk-X3AQ2WUM.js} +201 -18
- package/dist/cli.cjs +6129 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +160 -0
- package/dist/codex-exec-agent.cjs +790 -0
- package/dist/codex-exec-agent.d.cts +91 -0
- package/dist/codex-exec-agent.d.ts +91 -0
- package/dist/codex-exec-agent.js +10 -0
- package/dist/engine-harness.cjs +1013 -323
- package/dist/engine-harness.js +5 -4
- package/dist/index.cjs +1702 -247
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +37 -17
- package/dist/openclaw.js +4 -2
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/dist/result.cjs +1 -0
- package/dist/result.js +1 -1
- package/dist/run-card.cjs +212 -0
- package/dist/run-card.d.cts +10 -0
- package/dist/run-card.d.ts +10 -0
- package/dist/run-card.js +10 -0
- package/dist/runner.cjs +2 -0
- package/dist/runner.js +5 -3
- package/dist/state.cjs +174 -5
- package/dist/state.d.cts +2 -1
- package/dist/state.d.ts +2 -1
- package/dist/state.js +4 -2
- package/dist/types.d.cts +64 -2
- package/dist/types.d.ts +64 -2
- package/package.json +15 -2
- package/dist/chunk-RI25RGQP.js +0 -293
package/README.md
CHANGED
|
@@ -56,6 +56,23 @@ adapters are exposed through subpaths such as
|
|
|
56
56
|
`@riddledc/riddle-proof/openclaw`, so wrappers can reuse the mapping logic
|
|
57
57
|
without depending on another plugin runtime.
|
|
58
58
|
|
|
59
|
+
## Durable Loop CLI
|
|
60
|
+
|
|
61
|
+
The package publishes `riddle-proof-loop` as a host-agnostic runner surface for
|
|
62
|
+
Codex/CLI-style testing:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
riddle-proof-loop run --request-json request.json --checkpoint-mode yield
|
|
66
|
+
riddle-proof-loop status --state-path /tmp/riddle-proof-run.json
|
|
67
|
+
riddle-proof-loop respond --state-path /tmp/riddle-proof-run.json --response-json response.json
|
|
68
|
+
riddle-proof-loop doctor codex_exec
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
In yield mode, the harness returns portable checkpoint packets for recon,
|
|
72
|
+
authoring, implementation, proof assessment, and evidence recovery. A host can
|
|
73
|
+
answer those packets with `riddle-proof.checkpoint_response.v1` JSON without
|
|
74
|
+
needing OpenClaw-specific proof semantics.
|
|
75
|
+
|
|
59
76
|
## Runner Harness
|
|
60
77
|
|
|
61
78
|
`runRiddleProof` is the reusable idea-to-PR workflow driver. It does not ship
|
package/dist/checkpoint.cjs
CHANGED
|
@@ -34,6 +34,9 @@ __export(checkpoint_exports, {
|
|
|
34
34
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: () => RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
35
35
|
authorPacketPayloadFromCheckpointResponse: () => authorPacketPayloadFromCheckpointResponse,
|
|
36
36
|
buildAuthorCheckpointPacket: () => buildAuthorCheckpointPacket,
|
|
37
|
+
buildCheckpointPacketForEngineResult: () => buildCheckpointPacketForEngineResult,
|
|
38
|
+
buildProofAssessmentCheckpointPacket: () => buildProofAssessmentCheckpointPacket,
|
|
39
|
+
buildStageCheckpointPacket: () => buildStageCheckpointPacket,
|
|
37
40
|
checkpointResponseIdentity: () => checkpointResponseIdentity,
|
|
38
41
|
checkpointSummaryFromState: () => checkpointSummaryFromState,
|
|
39
42
|
isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
|
|
@@ -131,6 +134,143 @@ function responseSchemaForAuthorPacket() {
|
|
|
131
134
|
}
|
|
132
135
|
};
|
|
133
136
|
}
|
|
137
|
+
function responseSchemaForProofAssessmentPacket() {
|
|
138
|
+
return {
|
|
139
|
+
type: "object",
|
|
140
|
+
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
141
|
+
additionalProperties: false,
|
|
142
|
+
properties: {
|
|
143
|
+
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
144
|
+
run_id: { type: "string" },
|
|
145
|
+
checkpoint: { type: "string" },
|
|
146
|
+
resume_token: { type: "string" },
|
|
147
|
+
decision: {
|
|
148
|
+
type: "string",
|
|
149
|
+
enum: [
|
|
150
|
+
"ready_to_ship",
|
|
151
|
+
"needs_richer_proof",
|
|
152
|
+
"revise_capture",
|
|
153
|
+
"needs_recon",
|
|
154
|
+
"needs_implementation",
|
|
155
|
+
"blocked",
|
|
156
|
+
"human_review"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
summary: { type: "string" },
|
|
160
|
+
payload: {
|
|
161
|
+
type: "object",
|
|
162
|
+
description: "Optional structured assessment details, including recommended_stage, continue_with_stage, visual_delta notes, or blocker diagnostics."
|
|
163
|
+
},
|
|
164
|
+
reasons: { type: "array", items: { type: "string" } },
|
|
165
|
+
continue_with_stage: { type: "string", enum: ["ship", "author", "implement", "recon", "verify"] },
|
|
166
|
+
source: {
|
|
167
|
+
type: "object",
|
|
168
|
+
properties: {
|
|
169
|
+
kind: { type: "string" },
|
|
170
|
+
session_id: { type: "string" },
|
|
171
|
+
user_id: { type: "string" }
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
created_at: { type: "string" }
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function responseSchemaForReconPacket() {
|
|
179
|
+
return {
|
|
180
|
+
type: "object",
|
|
181
|
+
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
182
|
+
additionalProperties: false,
|
|
183
|
+
properties: {
|
|
184
|
+
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
185
|
+
run_id: { type: "string" },
|
|
186
|
+
checkpoint: { type: "string" },
|
|
187
|
+
resume_token: { type: "string" },
|
|
188
|
+
decision: {
|
|
189
|
+
type: "string",
|
|
190
|
+
enum: ["ready_for_author", "retry_recon", "recon_stuck", "needs_recon", "blocked", "human_review"]
|
|
191
|
+
},
|
|
192
|
+
summary: { type: "string" },
|
|
193
|
+
payload: {
|
|
194
|
+
type: "object",
|
|
195
|
+
description: "Optional recon assessment details such as baseline_understanding, refined_inputs, reasons, or diagnostic blocker context."
|
|
196
|
+
},
|
|
197
|
+
reasons: { type: "array", items: { type: "string" } },
|
|
198
|
+
continue_with_stage: { type: "string", enum: ["recon", "author"] },
|
|
199
|
+
source: {
|
|
200
|
+
type: "object",
|
|
201
|
+
properties: {
|
|
202
|
+
kind: { type: "string" },
|
|
203
|
+
session_id: { type: "string" },
|
|
204
|
+
user_id: { type: "string" }
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
created_at: { type: "string" }
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function responseSchemaForImplementationPacket() {
|
|
212
|
+
return {
|
|
213
|
+
type: "object",
|
|
214
|
+
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
215
|
+
additionalProperties: false,
|
|
216
|
+
properties: {
|
|
217
|
+
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
218
|
+
run_id: { type: "string" },
|
|
219
|
+
checkpoint: { type: "string" },
|
|
220
|
+
resume_token: { type: "string" },
|
|
221
|
+
decision: {
|
|
222
|
+
type: "string",
|
|
223
|
+
enum: ["implementation_complete", "needs_author", "needs_recon", "blocked", "human_review"]
|
|
224
|
+
},
|
|
225
|
+
summary: { type: "string" },
|
|
226
|
+
payload: {
|
|
227
|
+
type: "object",
|
|
228
|
+
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."
|
|
229
|
+
},
|
|
230
|
+
reasons: { type: "array", items: { type: "string" } },
|
|
231
|
+
continue_with_stage: { type: "string", enum: ["implement", "verify", "author", "recon"] },
|
|
232
|
+
source: {
|
|
233
|
+
type: "object",
|
|
234
|
+
properties: {
|
|
235
|
+
kind: { type: "string" },
|
|
236
|
+
session_id: { type: "string" },
|
|
237
|
+
user_id: { type: "string" }
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
created_at: { type: "string" }
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function responseSchemaForAdvancePacket(stage) {
|
|
245
|
+
return {
|
|
246
|
+
type: "object",
|
|
247
|
+
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
248
|
+
additionalProperties: false,
|
|
249
|
+
properties: {
|
|
250
|
+
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
251
|
+
run_id: { type: "string" },
|
|
252
|
+
checkpoint: { type: "string" },
|
|
253
|
+
resume_token: { type: "string" },
|
|
254
|
+
decision: {
|
|
255
|
+
type: "string",
|
|
256
|
+
enum: ["continue_stage", "retry_stage", "needs_recon", "needs_implementation", "blocked", "human_review"]
|
|
257
|
+
},
|
|
258
|
+
summary: { type: "string" },
|
|
259
|
+
payload: { type: "object" },
|
|
260
|
+
reasons: { type: "array", items: { type: "string" } },
|
|
261
|
+
continue_with_stage: { type: "string", enum: ["recon", "author", "implement", "verify", "ship", stage] },
|
|
262
|
+
source: {
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
kind: { type: "string" },
|
|
266
|
+
session_id: { type: "string" },
|
|
267
|
+
user_id: { type: "string" }
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
created_at: { type: "string" }
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
134
274
|
function resumeTokenFor(input) {
|
|
135
275
|
const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
136
276
|
return `rpchk_${hash}`;
|
|
@@ -158,6 +298,106 @@ function artifactsFromState(state) {
|
|
|
158
298
|
}
|
|
159
299
|
return artifacts.slice(0, 16);
|
|
160
300
|
}
|
|
301
|
+
function stageFromCheckpoint(checkpoint) {
|
|
302
|
+
if (checkpoint.startsWith("recon_")) return "recon";
|
|
303
|
+
if (checkpoint.startsWith("author_")) return "author";
|
|
304
|
+
if (checkpoint.startsWith("implement_")) return "implement";
|
|
305
|
+
if (checkpoint.startsWith("verify_")) return "verify";
|
|
306
|
+
if (checkpoint.startsWith("ship_")) return "ship";
|
|
307
|
+
if (checkpoint.startsWith("pr_sync_")) return "notify";
|
|
308
|
+
if (checkpoint.includes("capture")) return "prove";
|
|
309
|
+
return "setup";
|
|
310
|
+
}
|
|
311
|
+
function allowedDecisionsForStage(stage, checkpoint) {
|
|
312
|
+
if (stage === "recon") return ["ready_for_author", "retry_recon", "recon_stuck", "blocked", "human_review"];
|
|
313
|
+
if (stage === "implement") return ["implementation_complete", "needs_author", "needs_recon", "blocked", "human_review"];
|
|
314
|
+
if (stage === "ship") return ["continue_stage", "needs_implementation", "needs_recon", "blocked", "human_review"];
|
|
315
|
+
if (checkpoint === "awaiting_stage_advance") return ["continue_stage", "retry_stage", "blocked", "human_review"];
|
|
316
|
+
return ["continue_stage", "needs_recon", "needs_implementation", "blocked", "human_review"];
|
|
317
|
+
}
|
|
318
|
+
function packetKindForStage(stage, checkpoint) {
|
|
319
|
+
if (stage === "recon") return "assess_recon";
|
|
320
|
+
if (stage === "implement") return "implement_change";
|
|
321
|
+
if (checkpoint.includes("human")) return "human_review";
|
|
322
|
+
return "advance_decision";
|
|
323
|
+
}
|
|
324
|
+
function responseSchemaForStage(stage, checkpoint) {
|
|
325
|
+
if (stage === "recon") return responseSchemaForReconPacket();
|
|
326
|
+
if (stage === "implement") return responseSchemaForImplementationPacket();
|
|
327
|
+
return responseSchemaForAdvancePacket(stage);
|
|
328
|
+
}
|
|
329
|
+
function questionForStage(stage, checkpoint) {
|
|
330
|
+
if (stage === "recon") {
|
|
331
|
+
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.";
|
|
332
|
+
}
|
|
333
|
+
if (stage === "implement") {
|
|
334
|
+
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.";
|
|
335
|
+
}
|
|
336
|
+
if (stage === "ship") {
|
|
337
|
+
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.";
|
|
338
|
+
}
|
|
339
|
+
return "Choose the next Riddle Proof stage for this durable run, or block with a concrete reason if the run cannot honestly advance.";
|
|
340
|
+
}
|
|
341
|
+
function buildStageCheckpointPacket(input) {
|
|
342
|
+
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "stage_checkpoint";
|
|
343
|
+
const stage = nonEmptyString(input.engineResult.stage) || stageFromCheckpoint(checkpoint);
|
|
344
|
+
const runId = input.runState.run_id || "unknown";
|
|
345
|
+
const fullState = input.fullRiddleState || {};
|
|
346
|
+
const decisionDetails = recordValue(input.engineResult.decisionRequest?.details);
|
|
347
|
+
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
348
|
+
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
|
|
349
|
+
const kind = packetKindForStage(stage, checkpoint);
|
|
350
|
+
return {
|
|
351
|
+
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
352
|
+
run_id: runId,
|
|
353
|
+
state_path: input.runState.state_path,
|
|
354
|
+
stage,
|
|
355
|
+
checkpoint,
|
|
356
|
+
kind,
|
|
357
|
+
summary,
|
|
358
|
+
question: questionForStage(stage, checkpoint),
|
|
359
|
+
change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
|
|
360
|
+
context: input.request.context,
|
|
361
|
+
artifacts: artifactsFromState(fullState),
|
|
362
|
+
state_excerpt: compactRecord({
|
|
363
|
+
repo: input.request.repo || fullState.repo,
|
|
364
|
+
branch: input.request.branch || fullState.branch,
|
|
365
|
+
after_worktree: fullState.after_worktree || input.runState.worktree_path,
|
|
366
|
+
verification_mode: input.request.verification_mode || fullState.verification_mode,
|
|
367
|
+
reference: input.request.reference || fullState.reference,
|
|
368
|
+
server_path: fullState.server_path,
|
|
369
|
+
wait_for_selector: fullState.wait_for_selector,
|
|
370
|
+
recon_status: fullState.recon_status,
|
|
371
|
+
author_status: fullState.author_status,
|
|
372
|
+
implementation_status: fullState.implementation_status,
|
|
373
|
+
verify_status: fullState.verify_status,
|
|
374
|
+
stage_decision_request: jsonCloneRecord(fullState.stage_decision_request)
|
|
375
|
+
}),
|
|
376
|
+
evidence_excerpt: compactRecord({
|
|
377
|
+
before_cdn: fullState.before_cdn || null,
|
|
378
|
+
prod_cdn: fullState.prod_cdn || null,
|
|
379
|
+
after_cdn: fullState.after_cdn || null,
|
|
380
|
+
recon_results: jsonCloneRecord(fullState.recon_results),
|
|
381
|
+
checkpoint_contract: jsonCloneRecord(checkpointContract),
|
|
382
|
+
decision_details: jsonCloneRecord(decisionDetails)
|
|
383
|
+
}),
|
|
384
|
+
allowed_decisions: allowedDecisionsForStage(stage, checkpoint),
|
|
385
|
+
response_schema: responseSchemaForStage(stage, checkpoint),
|
|
386
|
+
routing_hint: {
|
|
387
|
+
suggested_role: stage === "implement" ? "builder_agent" : checkpoint.includes("human") ? "human" : "main_agent",
|
|
388
|
+
visibility: input.visibility || "quiet",
|
|
389
|
+
urgency: stage === "ship" ? "high" : "normal",
|
|
390
|
+
can_auto_answer: input.visibility !== "manual"
|
|
391
|
+
},
|
|
392
|
+
resume_token: resumeTokenFor({
|
|
393
|
+
runId,
|
|
394
|
+
statePath: input.engineResult.state_path || input.request.engine_state_path || null,
|
|
395
|
+
checkpoint,
|
|
396
|
+
stage
|
|
397
|
+
}),
|
|
398
|
+
created_at: input.created_at || timestamp()
|
|
399
|
+
};
|
|
400
|
+
}
|
|
161
401
|
function buildAuthorCheckpointPacket(input) {
|
|
162
402
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
|
|
163
403
|
const stage = "author";
|
|
@@ -214,6 +454,129 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
214
454
|
created_at: input.created_at || timestamp()
|
|
215
455
|
};
|
|
216
456
|
}
|
|
457
|
+
function visualDeltaFromState(fullState) {
|
|
458
|
+
const bundle = recordValue(fullState.evidence_bundle);
|
|
459
|
+
const after = recordValue(bundle?.after);
|
|
460
|
+
const afterDelta = recordValue(after?.visual_delta);
|
|
461
|
+
if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
|
|
462
|
+
const proofAssessmentRequest = recordValue(fullState.proof_assessment_request);
|
|
463
|
+
return recordValue(proofAssessmentRequest?.visual_delta) || null;
|
|
464
|
+
}
|
|
465
|
+
function verificationModeRequiresVisualDelta(value) {
|
|
466
|
+
const mode = String(value || "proof").trim().toLowerCase();
|
|
467
|
+
return [
|
|
468
|
+
"visual",
|
|
469
|
+
"render",
|
|
470
|
+
"interaction",
|
|
471
|
+
"ui",
|
|
472
|
+
"layout",
|
|
473
|
+
"screenshot",
|
|
474
|
+
"canvas",
|
|
475
|
+
"animation"
|
|
476
|
+
].includes(mode);
|
|
477
|
+
}
|
|
478
|
+
function visualDeltaIssueCode(visualDelta, required) {
|
|
479
|
+
const status = String(visualDelta?.status || "").trim();
|
|
480
|
+
const reason = String(visualDelta?.reason || "").toLowerCase();
|
|
481
|
+
if (status === "unmeasured") {
|
|
482
|
+
if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
|
|
483
|
+
return "comparator_fetch_blocked";
|
|
484
|
+
}
|
|
485
|
+
return "visual_delta_unmeasured";
|
|
486
|
+
}
|
|
487
|
+
if (status === "measured" && visualDelta?.passed === false) return "semantic_proof_failed";
|
|
488
|
+
if (required && status !== "measured") return "visual_delta_unmeasured";
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
function buildProofAssessmentCheckpointPacket(input) {
|
|
492
|
+
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "verify_supervisor_judgment";
|
|
493
|
+
const stage = "verify";
|
|
494
|
+
const runId = input.runState.run_id || "unknown";
|
|
495
|
+
const fullState = input.fullRiddleState || {};
|
|
496
|
+
const proofAssessmentRequest = recordValue(fullState.proof_assessment_request) || recordValue(recordValue(fullState.verify_decision_request)?.assessment_request) || recordValue(input.engineResult.decisionRequest?.details) || {};
|
|
497
|
+
const bundle = recordValue(fullState.evidence_bundle);
|
|
498
|
+
const artifactContract = recordValue(proofAssessmentRequest.artifact_contract) || recordValue(bundle?.artifact_contract);
|
|
499
|
+
const requiredSignals = recordValue(recordValue(artifactContract)?.required);
|
|
500
|
+
const visualDelta = visualDeltaFromState(fullState);
|
|
501
|
+
const verificationMode = nonEmptyString(input.request.verification_mode) || nonEmptyString(fullState.verification_mode) || nonEmptyString(bundle?.verification_mode) || "proof";
|
|
502
|
+
const visualDeltaRequired = requiredSignals?.visual_delta === true || verificationModeRequiresVisualDelta(verificationMode);
|
|
503
|
+
const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
|
|
504
|
+
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
|
|
505
|
+
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.";
|
|
506
|
+
return {
|
|
507
|
+
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
508
|
+
run_id: runId,
|
|
509
|
+
state_path: input.runState.state_path,
|
|
510
|
+
stage,
|
|
511
|
+
checkpoint,
|
|
512
|
+
kind: evidenceIssueCode ? "recover_evidence" : "assess_proof",
|
|
513
|
+
summary,
|
|
514
|
+
question: `Assess the current Riddle Proof evidence. ${recoveryHint} Return a CheckpointResponse using one allowed decision.`,
|
|
515
|
+
change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
|
|
516
|
+
context: input.request.context,
|
|
517
|
+
artifacts: artifactsFromState(fullState),
|
|
518
|
+
state_excerpt: compactRecord({
|
|
519
|
+
repo: input.request.repo || fullState.repo,
|
|
520
|
+
branch: input.request.branch || fullState.branch,
|
|
521
|
+
verification_mode: verificationMode,
|
|
522
|
+
reference: input.request.reference || fullState.reference,
|
|
523
|
+
server_path: fullState.server_path,
|
|
524
|
+
wait_for_selector: fullState.wait_for_selector,
|
|
525
|
+
implementation_status: fullState.implementation_status,
|
|
526
|
+
implementation_summary: fullState.implementation_summary,
|
|
527
|
+
changed_files: jsonCloneValue(fullState.changed_files),
|
|
528
|
+
proof_plan: compactText(fullState.proof_plan, 1200)
|
|
529
|
+
}),
|
|
530
|
+
evidence_excerpt: compactRecord({
|
|
531
|
+
before_cdn: fullState.before_cdn || null,
|
|
532
|
+
prod_cdn: fullState.prod_cdn || null,
|
|
533
|
+
after_cdn: fullState.after_cdn || null,
|
|
534
|
+
visual_delta_required: visualDeltaRequired,
|
|
535
|
+
visual_delta_ready: visualDelta?.status === "measured" && visualDelta?.passed === true,
|
|
536
|
+
visual_delta: jsonCloneRecord(visualDelta),
|
|
537
|
+
evidence_issue_code: evidenceIssueCode,
|
|
538
|
+
proof_assessment_request: jsonCloneRecord(proofAssessmentRequest),
|
|
539
|
+
verify_decision_request: jsonCloneRecord(fullState.verify_decision_request),
|
|
540
|
+
checkpoint_contract: jsonCloneRecord(input.engineResult.checkpointContract)
|
|
541
|
+
}),
|
|
542
|
+
artifact_contract: jsonCloneRecord(artifactContract),
|
|
543
|
+
allowed_decisions: [
|
|
544
|
+
"ready_to_ship",
|
|
545
|
+
"needs_richer_proof",
|
|
546
|
+
"revise_capture",
|
|
547
|
+
"needs_recon",
|
|
548
|
+
"needs_implementation",
|
|
549
|
+
"blocked",
|
|
550
|
+
"human_review"
|
|
551
|
+
],
|
|
552
|
+
response_schema: responseSchemaForProofAssessmentPacket(),
|
|
553
|
+
routing_hint: {
|
|
554
|
+
suggested_role: evidenceIssueCode ? "proof_judge" : "proof_judge",
|
|
555
|
+
visibility: input.visibility || "quiet",
|
|
556
|
+
urgency: evidenceIssueCode ? "high" : "normal",
|
|
557
|
+
can_auto_answer: input.visibility !== "manual"
|
|
558
|
+
},
|
|
559
|
+
resume_token: resumeTokenFor({
|
|
560
|
+
runId,
|
|
561
|
+
statePath: input.engineResult.state_path || input.request.engine_state_path || null,
|
|
562
|
+
checkpoint,
|
|
563
|
+
stage
|
|
564
|
+
}),
|
|
565
|
+
created_at: input.created_at || timestamp()
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function buildCheckpointPacketForEngineResult(input) {
|
|
569
|
+
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
|
|
570
|
+
if (checkpoint === "verify_supervisor_judgment" || checkpoint === "verify_supervisor_judgment_required" || checkpoint === "verify_human_escalation") {
|
|
571
|
+
return buildProofAssessmentCheckpointPacket(input);
|
|
572
|
+
}
|
|
573
|
+
const resume = recordValue(input.engineResult.checkpointContract?.resume);
|
|
574
|
+
const continueStage = nonEmptyString(resume?.continue_with_stage);
|
|
575
|
+
if (checkpoint === "author_supervisor_judgment" || checkpoint === "verify_capture_retry" || checkpoint === "verify_agent_retry" && continueStage === "author") {
|
|
576
|
+
return buildAuthorCheckpointPacket(input);
|
|
577
|
+
}
|
|
578
|
+
return buildStageCheckpointPacket(input);
|
|
579
|
+
}
|
|
217
580
|
function normalizeCheckpointResponse(value) {
|
|
218
581
|
const record = recordValue(value);
|
|
219
582
|
if (!record) return null;
|
|
@@ -334,6 +697,9 @@ function proofContractFromAuthorCheckpointResponse(response, packet, payload) {
|
|
|
334
697
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
335
698
|
authorPacketPayloadFromCheckpointResponse,
|
|
336
699
|
buildAuthorCheckpointPacket,
|
|
700
|
+
buildCheckpointPacketForEngineResult,
|
|
701
|
+
buildProofAssessmentCheckpointPacket,
|
|
702
|
+
buildStageCheckpointPacket,
|
|
337
703
|
checkpointResponseIdentity,
|
|
338
704
|
checkpointSummaryFromState,
|
|
339
705
|
isDuplicateCheckpointResponse,
|
package/dist/checkpoint.d.cts
CHANGED
|
@@ -3,6 +3,21 @@ import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunStat
|
|
|
3
3
|
declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
|
|
4
4
|
declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
|
|
5
5
|
declare function statePathsForRunState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofStatePaths;
|
|
6
|
+
declare function buildStageCheckpointPacket(input: {
|
|
7
|
+
request: RiddleProofRunParams;
|
|
8
|
+
runState: RiddleProofRunState;
|
|
9
|
+
engineResult: {
|
|
10
|
+
state_path?: string | null;
|
|
11
|
+
checkpoint?: string | null;
|
|
12
|
+
checkpointContract?: Record<string, unknown> | null;
|
|
13
|
+
decisionRequest?: Record<string, unknown> | null;
|
|
14
|
+
summary?: string;
|
|
15
|
+
stage?: string | null;
|
|
16
|
+
};
|
|
17
|
+
fullRiddleState?: Record<string, unknown> | null;
|
|
18
|
+
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
19
|
+
created_at?: string;
|
|
20
|
+
}): RiddleProofCheckpointPacket;
|
|
6
21
|
declare function buildAuthorCheckpointPacket(input: {
|
|
7
22
|
request: RiddleProofRunParams;
|
|
8
23
|
runState: RiddleProofRunState;
|
|
@@ -17,6 +32,34 @@ declare function buildAuthorCheckpointPacket(input: {
|
|
|
17
32
|
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
18
33
|
created_at?: string;
|
|
19
34
|
}): RiddleProofCheckpointPacket;
|
|
35
|
+
declare function buildProofAssessmentCheckpointPacket(input: {
|
|
36
|
+
request: RiddleProofRunParams;
|
|
37
|
+
runState: RiddleProofRunState;
|
|
38
|
+
engineResult: {
|
|
39
|
+
state_path?: string | null;
|
|
40
|
+
checkpoint?: string | null;
|
|
41
|
+
checkpointContract?: Record<string, unknown> | null;
|
|
42
|
+
decisionRequest?: Record<string, unknown> | null;
|
|
43
|
+
summary?: string;
|
|
44
|
+
};
|
|
45
|
+
fullRiddleState?: Record<string, unknown> | null;
|
|
46
|
+
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
47
|
+
created_at?: string;
|
|
48
|
+
}): RiddleProofCheckpointPacket;
|
|
49
|
+
declare function buildCheckpointPacketForEngineResult(input: {
|
|
50
|
+
request: RiddleProofRunParams;
|
|
51
|
+
runState: RiddleProofRunState;
|
|
52
|
+
engineResult: {
|
|
53
|
+
state_path?: string | null;
|
|
54
|
+
checkpoint?: string | null;
|
|
55
|
+
checkpointContract?: Record<string, unknown> | null;
|
|
56
|
+
decisionRequest?: Record<string, unknown> | null;
|
|
57
|
+
summary?: string;
|
|
58
|
+
};
|
|
59
|
+
fullRiddleState?: Record<string, unknown> | null;
|
|
60
|
+
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
61
|
+
created_at?: string;
|
|
62
|
+
}): RiddleProofCheckpointPacket;
|
|
20
63
|
declare function normalizeCheckpointResponse(value: unknown): RiddleProofCheckpointResponse | null;
|
|
21
64
|
declare function checkpointSummaryFromState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofCheckpointSummary;
|
|
22
65
|
declare function isDuplicateCheckpointResponse(state: RiddleProofRunState, response: RiddleProofCheckpointResponse): boolean;
|
|
@@ -24,4 +67,4 @@ declare function checkpointResponseIdentity(response: RiddleProofCheckpointRespo
|
|
|
24
67
|
declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
|
|
25
68
|
declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
|
|
26
69
|
|
|
27
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
|
70
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
package/dist/checkpoint.d.ts
CHANGED
|
@@ -3,6 +3,21 @@ import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunStat
|
|
|
3
3
|
declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
|
|
4
4
|
declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
|
|
5
5
|
declare function statePathsForRunState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofStatePaths;
|
|
6
|
+
declare function buildStageCheckpointPacket(input: {
|
|
7
|
+
request: RiddleProofRunParams;
|
|
8
|
+
runState: RiddleProofRunState;
|
|
9
|
+
engineResult: {
|
|
10
|
+
state_path?: string | null;
|
|
11
|
+
checkpoint?: string | null;
|
|
12
|
+
checkpointContract?: Record<string, unknown> | null;
|
|
13
|
+
decisionRequest?: Record<string, unknown> | null;
|
|
14
|
+
summary?: string;
|
|
15
|
+
stage?: string | null;
|
|
16
|
+
};
|
|
17
|
+
fullRiddleState?: Record<string, unknown> | null;
|
|
18
|
+
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
19
|
+
created_at?: string;
|
|
20
|
+
}): RiddleProofCheckpointPacket;
|
|
6
21
|
declare function buildAuthorCheckpointPacket(input: {
|
|
7
22
|
request: RiddleProofRunParams;
|
|
8
23
|
runState: RiddleProofRunState;
|
|
@@ -17,6 +32,34 @@ declare function buildAuthorCheckpointPacket(input: {
|
|
|
17
32
|
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
18
33
|
created_at?: string;
|
|
19
34
|
}): RiddleProofCheckpointPacket;
|
|
35
|
+
declare function buildProofAssessmentCheckpointPacket(input: {
|
|
36
|
+
request: RiddleProofRunParams;
|
|
37
|
+
runState: RiddleProofRunState;
|
|
38
|
+
engineResult: {
|
|
39
|
+
state_path?: string | null;
|
|
40
|
+
checkpoint?: string | null;
|
|
41
|
+
checkpointContract?: Record<string, unknown> | null;
|
|
42
|
+
decisionRequest?: Record<string, unknown> | null;
|
|
43
|
+
summary?: string;
|
|
44
|
+
};
|
|
45
|
+
fullRiddleState?: Record<string, unknown> | null;
|
|
46
|
+
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
47
|
+
created_at?: string;
|
|
48
|
+
}): RiddleProofCheckpointPacket;
|
|
49
|
+
declare function buildCheckpointPacketForEngineResult(input: {
|
|
50
|
+
request: RiddleProofRunParams;
|
|
51
|
+
runState: RiddleProofRunState;
|
|
52
|
+
engineResult: {
|
|
53
|
+
state_path?: string | null;
|
|
54
|
+
checkpoint?: string | null;
|
|
55
|
+
checkpointContract?: Record<string, unknown> | null;
|
|
56
|
+
decisionRequest?: Record<string, unknown> | null;
|
|
57
|
+
summary?: string;
|
|
58
|
+
};
|
|
59
|
+
fullRiddleState?: Record<string, unknown> | null;
|
|
60
|
+
visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
|
|
61
|
+
created_at?: string;
|
|
62
|
+
}): RiddleProofCheckpointPacket;
|
|
20
63
|
declare function normalizeCheckpointResponse(value: unknown): RiddleProofCheckpointResponse | null;
|
|
21
64
|
declare function checkpointSummaryFromState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofCheckpointSummary;
|
|
22
65
|
declare function isDuplicateCheckpointResponse(state: RiddleProofRunState, response: RiddleProofCheckpointResponse): boolean;
|
|
@@ -24,4 +67,4 @@ declare function checkpointResponseIdentity(response: RiddleProofCheckpointRespo
|
|
|
24
67
|
declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
|
|
25
68
|
declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
|
|
26
69
|
|
|
27
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
|
70
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
package/dist/checkpoint.js
CHANGED
|
@@ -3,19 +3,25 @@ import {
|
|
|
3
3
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
4
4
|
authorPacketPayloadFromCheckpointResponse,
|
|
5
5
|
buildAuthorCheckpointPacket,
|
|
6
|
+
buildCheckpointPacketForEngineResult,
|
|
7
|
+
buildProofAssessmentCheckpointPacket,
|
|
8
|
+
buildStageCheckpointPacket,
|
|
6
9
|
checkpointResponseIdentity,
|
|
7
10
|
checkpointSummaryFromState,
|
|
8
11
|
isDuplicateCheckpointResponse,
|
|
9
12
|
normalizeCheckpointResponse,
|
|
10
13
|
proofContractFromAuthorCheckpointResponse,
|
|
11
14
|
statePathsForRunState
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-R6SCWJCI.js";
|
|
16
|
+
import "./chunk-DUFDZJOF.js";
|
|
14
17
|
export {
|
|
15
18
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
16
19
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
17
20
|
authorPacketPayloadFromCheckpointResponse,
|
|
18
21
|
buildAuthorCheckpointPacket,
|
|
22
|
+
buildCheckpointPacketForEngineResult,
|
|
23
|
+
buildProofAssessmentCheckpointPacket,
|
|
24
|
+
buildStageCheckpointPacket,
|
|
19
25
|
checkpointResponseIdentity,
|
|
20
26
|
checkpointSummaryFromState,
|
|
21
27
|
isDuplicateCheckpointResponse,
|
|
@@ -206,6 +206,7 @@ function createRunResult(input) {
|
|
|
206
206
|
checkpoint_summary: state.checkpoint_summary,
|
|
207
207
|
state_paths: state.state_paths,
|
|
208
208
|
proof_contract: state.proof_contract,
|
|
209
|
+
run_card: state.run_card,
|
|
209
210
|
proof_session: state.proof_session,
|
|
210
211
|
evidence_bundle: input.evidence_bundle,
|
|
211
212
|
raw: input.raw
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRiddleProofRunCard
|
|
3
|
+
} from "./chunk-PLSGW2GI.js";
|
|
1
4
|
import {
|
|
2
5
|
compactRecord,
|
|
3
6
|
isTerminalStatus,
|
|
4
7
|
nonEmptyString,
|
|
5
8
|
recordValue
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DUFDZJOF.js";
|
|
7
10
|
|
|
8
11
|
// src/state.ts
|
|
9
12
|
var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
|
|
@@ -131,6 +134,7 @@ function createRunState(input) {
|
|
|
131
134
|
checkpoint_summary: input.checkpoint_summary,
|
|
132
135
|
state_paths: input.state_paths,
|
|
133
136
|
proof_contract: input.proof_contract,
|
|
137
|
+
run_card: input.run_card,
|
|
134
138
|
checkpoint_history: input.checkpoint_history,
|
|
135
139
|
events: input.events ? [...input.events] : []
|
|
136
140
|
});
|
|
@@ -209,6 +213,7 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
209
213
|
checkpoint_summary: state.checkpoint_summary,
|
|
210
214
|
state_paths: state.state_paths,
|
|
211
215
|
proof_contract: state.proof_contract,
|
|
216
|
+
run_card: createRiddleProofRunCard(state, { at }),
|
|
212
217
|
latest_event: latestEvent
|
|
213
218
|
});
|
|
214
219
|
}
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
appendStageHeartbeat,
|
|
4
4
|
createRunState,
|
|
5
5
|
setRunStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JTNMEH57.js";
|
|
7
7
|
import {
|
|
8
8
|
createRunResult
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DUFDZJOF.js";
|
|
10
10
|
|
|
11
11
|
// src/runner.ts
|
|
12
12
|
function errorDetails(error) {
|