@riddledc/riddle-proof 0.5.44 → 0.5.45

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.
@@ -34,6 +34,8 @@ __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,
37
39
  checkpointResponseIdentity: () => checkpointResponseIdentity,
38
40
  checkpointSummaryFromState: () => checkpointSummaryFromState,
39
41
  isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
@@ -131,6 +133,47 @@ function responseSchemaForAuthorPacket() {
131
133
  }
132
134
  };
133
135
  }
136
+ function responseSchemaForProofAssessmentPacket() {
137
+ return {
138
+ type: "object",
139
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
140
+ additionalProperties: false,
141
+ properties: {
142
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
143
+ run_id: { type: "string" },
144
+ checkpoint: { type: "string" },
145
+ resume_token: { type: "string" },
146
+ decision: {
147
+ type: "string",
148
+ enum: [
149
+ "ready_to_ship",
150
+ "needs_richer_proof",
151
+ "revise_capture",
152
+ "needs_recon",
153
+ "needs_implementation",
154
+ "blocked",
155
+ "human_review"
156
+ ]
157
+ },
158
+ summary: { type: "string" },
159
+ payload: {
160
+ type: "object",
161
+ description: "Optional structured assessment details, including recommended_stage, continue_with_stage, visual_delta notes, or blocker diagnostics."
162
+ },
163
+ reasons: { type: "array", items: { type: "string" } },
164
+ continue_with_stage: { type: "string", enum: ["ship", "author", "implement", "recon", "verify"] },
165
+ source: {
166
+ type: "object",
167
+ properties: {
168
+ kind: { type: "string" },
169
+ session_id: { type: "string" },
170
+ user_id: { type: "string" }
171
+ }
172
+ },
173
+ created_at: { type: "string" }
174
+ }
175
+ };
176
+ }
134
177
  function resumeTokenFor(input) {
135
178
  const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
136
179
  return `rpchk_${hash}`;
@@ -214,6 +257,124 @@ function buildAuthorCheckpointPacket(input) {
214
257
  created_at: input.created_at || timestamp()
215
258
  };
216
259
  }
260
+ function visualDeltaFromState(fullState) {
261
+ const bundle = recordValue(fullState.evidence_bundle);
262
+ const after = recordValue(bundle?.after);
263
+ const afterDelta = recordValue(after?.visual_delta);
264
+ if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
265
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request);
266
+ return recordValue(proofAssessmentRequest?.visual_delta) || null;
267
+ }
268
+ function verificationModeRequiresVisualDelta(value) {
269
+ const mode = String(value || "proof").trim().toLowerCase();
270
+ return [
271
+ "visual",
272
+ "render",
273
+ "interaction",
274
+ "ui",
275
+ "layout",
276
+ "screenshot",
277
+ "canvas",
278
+ "animation"
279
+ ].includes(mode);
280
+ }
281
+ function visualDeltaIssueCode(visualDelta, required) {
282
+ const status = String(visualDelta?.status || "").trim();
283
+ const reason = String(visualDelta?.reason || "").toLowerCase();
284
+ if (status === "unmeasured") {
285
+ if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
286
+ return "comparator_fetch_blocked";
287
+ }
288
+ return "visual_delta_unmeasured";
289
+ }
290
+ if (status === "measured" && visualDelta?.passed === false) return "semantic_proof_failed";
291
+ if (required && status !== "measured") return "visual_delta_unmeasured";
292
+ return null;
293
+ }
294
+ function buildProofAssessmentCheckpointPacket(input) {
295
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "verify_supervisor_judgment";
296
+ const stage = "verify";
297
+ const runId = input.runState.run_id || "unknown";
298
+ const fullState = input.fullRiddleState || {};
299
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request) || recordValue(recordValue(fullState.verify_decision_request)?.assessment_request) || recordValue(input.engineResult.decisionRequest?.details) || {};
300
+ const bundle = recordValue(fullState.evidence_bundle);
301
+ const artifactContract = recordValue(proofAssessmentRequest.artifact_contract) || recordValue(bundle?.artifact_contract);
302
+ const requiredSignals = recordValue(recordValue(artifactContract)?.required);
303
+ const visualDelta = visualDeltaFromState(fullState);
304
+ const verificationMode = nonEmptyString(input.request.verification_mode) || nonEmptyString(fullState.verification_mode) || nonEmptyString(bundle?.verification_mode) || "proof";
305
+ const visualDeltaRequired = requiredSignals?.visual_delta === true || verificationModeRequiresVisualDelta(verificationMode);
306
+ const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
307
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
308
+ 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.";
309
+ return {
310
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
311
+ run_id: runId,
312
+ state_path: input.runState.state_path,
313
+ stage,
314
+ checkpoint,
315
+ kind: evidenceIssueCode ? "recover_evidence" : "assess_proof",
316
+ summary,
317
+ question: `Assess the current Riddle Proof evidence. ${recoveryHint} Return a CheckpointResponse using one allowed decision.`,
318
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
319
+ context: input.request.context,
320
+ artifacts: artifactsFromState(fullState),
321
+ state_excerpt: compactRecord({
322
+ repo: input.request.repo || fullState.repo,
323
+ branch: input.request.branch || fullState.branch,
324
+ verification_mode: verificationMode,
325
+ reference: input.request.reference || fullState.reference,
326
+ server_path: fullState.server_path,
327
+ wait_for_selector: fullState.wait_for_selector,
328
+ implementation_status: fullState.implementation_status,
329
+ implementation_summary: fullState.implementation_summary,
330
+ changed_files: jsonCloneValue(fullState.changed_files),
331
+ proof_plan: compactText(fullState.proof_plan, 1200)
332
+ }),
333
+ evidence_excerpt: compactRecord({
334
+ before_cdn: fullState.before_cdn || null,
335
+ prod_cdn: fullState.prod_cdn || null,
336
+ after_cdn: fullState.after_cdn || null,
337
+ visual_delta_required: visualDeltaRequired,
338
+ visual_delta_ready: visualDelta?.status === "measured" && visualDelta?.passed === true,
339
+ visual_delta: jsonCloneRecord(visualDelta),
340
+ evidence_issue_code: evidenceIssueCode,
341
+ proof_assessment_request: jsonCloneRecord(proofAssessmentRequest),
342
+ verify_decision_request: jsonCloneRecord(fullState.verify_decision_request),
343
+ checkpoint_contract: jsonCloneRecord(input.engineResult.checkpointContract)
344
+ }),
345
+ artifact_contract: jsonCloneRecord(artifactContract),
346
+ allowed_decisions: [
347
+ "ready_to_ship",
348
+ "needs_richer_proof",
349
+ "revise_capture",
350
+ "needs_recon",
351
+ "needs_implementation",
352
+ "blocked",
353
+ "human_review"
354
+ ],
355
+ response_schema: responseSchemaForProofAssessmentPacket(),
356
+ routing_hint: {
357
+ suggested_role: evidenceIssueCode ? "proof_judge" : "proof_judge",
358
+ visibility: input.visibility || "quiet",
359
+ urgency: evidenceIssueCode ? "high" : "normal",
360
+ can_auto_answer: input.visibility !== "manual"
361
+ },
362
+ resume_token: resumeTokenFor({
363
+ runId,
364
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
365
+ checkpoint,
366
+ stage
367
+ }),
368
+ created_at: input.created_at || timestamp()
369
+ };
370
+ }
371
+ function buildCheckpointPacketForEngineResult(input) {
372
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
373
+ if (checkpoint === "verify_supervisor_judgment" || checkpoint === "verify_supervisor_judgment_required" || checkpoint === "verify_human_escalation") {
374
+ return buildProofAssessmentCheckpointPacket(input);
375
+ }
376
+ return buildAuthorCheckpointPacket(input);
377
+ }
217
378
  function normalizeCheckpointResponse(value) {
218
379
  const record = recordValue(value);
219
380
  if (!record) return null;
@@ -334,6 +495,8 @@ function proofContractFromAuthorCheckpointResponse(response, packet, payload) {
334
495
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
335
496
  authorPacketPayloadFromCheckpointResponse,
336
497
  buildAuthorCheckpointPacket,
498
+ buildCheckpointPacketForEngineResult,
499
+ buildProofAssessmentCheckpointPacket,
337
500
  checkpointResponseIdentity,
338
501
  checkpointSummaryFromState,
339
502
  isDuplicateCheckpointResponse,
@@ -17,6 +17,34 @@ declare function buildAuthorCheckpointPacket(input: {
17
17
  visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
18
18
  created_at?: string;
19
19
  }): RiddleProofCheckpointPacket;
20
+ declare function buildProofAssessmentCheckpointPacket(input: {
21
+ request: RiddleProofRunParams;
22
+ runState: RiddleProofRunState;
23
+ engineResult: {
24
+ state_path?: string | null;
25
+ checkpoint?: string | null;
26
+ checkpointContract?: Record<string, unknown> | null;
27
+ decisionRequest?: Record<string, unknown> | null;
28
+ summary?: string;
29
+ };
30
+ fullRiddleState?: Record<string, unknown> | null;
31
+ visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
32
+ created_at?: string;
33
+ }): RiddleProofCheckpointPacket;
34
+ declare function buildCheckpointPacketForEngineResult(input: {
35
+ request: RiddleProofRunParams;
36
+ runState: RiddleProofRunState;
37
+ engineResult: {
38
+ state_path?: string | null;
39
+ checkpoint?: string | null;
40
+ checkpointContract?: Record<string, unknown> | null;
41
+ decisionRequest?: Record<string, unknown> | null;
42
+ summary?: string;
43
+ };
44
+ fullRiddleState?: Record<string, unknown> | null;
45
+ visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
46
+ created_at?: string;
47
+ }): RiddleProofCheckpointPacket;
20
48
  declare function normalizeCheckpointResponse(value: unknown): RiddleProofCheckpointResponse | null;
21
49
  declare function checkpointSummaryFromState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofCheckpointSummary;
22
50
  declare function isDuplicateCheckpointResponse(state: RiddleProofRunState, response: RiddleProofCheckpointResponse): boolean;
@@ -24,4 +52,4 @@ declare function checkpointResponseIdentity(response: RiddleProofCheckpointRespo
24
52
  declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
25
53
  declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
26
54
 
27
- export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
55
+ export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
@@ -17,6 +17,34 @@ declare function buildAuthorCheckpointPacket(input: {
17
17
  visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
18
18
  created_at?: string;
19
19
  }): RiddleProofCheckpointPacket;
20
+ declare function buildProofAssessmentCheckpointPacket(input: {
21
+ request: RiddleProofRunParams;
22
+ runState: RiddleProofRunState;
23
+ engineResult: {
24
+ state_path?: string | null;
25
+ checkpoint?: string | null;
26
+ checkpointContract?: Record<string, unknown> | null;
27
+ decisionRequest?: Record<string, unknown> | null;
28
+ summary?: string;
29
+ };
30
+ fullRiddleState?: Record<string, unknown> | null;
31
+ visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
32
+ created_at?: string;
33
+ }): RiddleProofCheckpointPacket;
34
+ declare function buildCheckpointPacketForEngineResult(input: {
35
+ request: RiddleProofRunParams;
36
+ runState: RiddleProofRunState;
37
+ engineResult: {
38
+ state_path?: string | null;
39
+ checkpoint?: string | null;
40
+ checkpointContract?: Record<string, unknown> | null;
41
+ decisionRequest?: Record<string, unknown> | null;
42
+ summary?: string;
43
+ };
44
+ fullRiddleState?: Record<string, unknown> | null;
45
+ visibility?: "liveblog" | "quiet" | "terminal_only" | "manual" | string;
46
+ created_at?: string;
47
+ }): RiddleProofCheckpointPacket;
20
48
  declare function normalizeCheckpointResponse(value: unknown): RiddleProofCheckpointResponse | null;
21
49
  declare function checkpointSummaryFromState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofCheckpointSummary;
22
50
  declare function isDuplicateCheckpointResponse(state: RiddleProofRunState, response: RiddleProofCheckpointResponse): boolean;
@@ -24,4 +52,4 @@ declare function checkpointResponseIdentity(response: RiddleProofCheckpointRespo
24
52
  declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
25
53
  declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
26
54
 
27
- export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
55
+ export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
@@ -3,19 +3,23 @@ import {
3
3
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
4
4
  authorPacketPayloadFromCheckpointResponse,
5
5
  buildAuthorCheckpointPacket,
6
+ buildCheckpointPacketForEngineResult,
7
+ buildProofAssessmentCheckpointPacket,
6
8
  checkpointResponseIdentity,
7
9
  checkpointSummaryFromState,
8
10
  isDuplicateCheckpointResponse,
9
11
  normalizeCheckpointResponse,
10
12
  proofContractFromAuthorCheckpointResponse,
11
13
  statePathsForRunState
12
- } from "./chunk-RI25RGQP.js";
14
+ } from "./chunk-LXE5YUYY.js";
13
15
  import "./chunk-W7VTDN4T.js";
14
16
  export {
15
17
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
16
18
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
17
19
  authorPacketPayloadFromCheckpointResponse,
18
20
  buildAuthorCheckpointPacket,
21
+ buildCheckpointPacketForEngineResult,
22
+ buildProofAssessmentCheckpointPacket,
19
23
  checkpointResponseIdentity,
20
24
  checkpointSummaryFromState,
21
25
  isDuplicateCheckpointResponse,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  authorPacketPayloadFromCheckpointResponse,
3
- buildAuthorCheckpointPacket,
3
+ buildCheckpointPacketForEngineResult,
4
4
  checkpointResponseIdentity,
5
5
  checkpointSummaryFromState,
6
6
  isDuplicateCheckpointResponse,
7
7
  normalizeCheckpointResponse,
8
8
  proofContractFromAuthorCheckpointResponse,
9
9
  statePathsForRunState
10
- } from "./chunk-RI25RGQP.js";
10
+ } from "./chunk-LXE5YUYY.js";
11
11
  import {
12
12
  appendRunEvent,
13
13
  appendStageHeartbeat,
@@ -308,6 +308,39 @@ function proofAssessmentContinuation(result, payload) {
308
308
  const proof_assessment_json = jsonParam(payload);
309
309
  return { ...baseContinuation(result), proof_assessment_json };
310
310
  }
311
+ function defaultStageForProofCheckpointDecision(decision) {
312
+ if (decision === "ready_to_ship") return "ship";
313
+ if (decision === "needs_implementation") return "implement";
314
+ if (decision === "needs_recon") return "recon";
315
+ if (decision === "revise_capture") return "verify";
316
+ if (decision === "needs_richer_proof") return "author";
317
+ return null;
318
+ }
319
+ function proofAssessmentPayloadFromCheckpointResponse(response) {
320
+ if (![
321
+ "ready_to_ship",
322
+ "needs_richer_proof",
323
+ "revise_capture",
324
+ "needs_recon",
325
+ "needs_implementation"
326
+ ].includes(response.decision)) {
327
+ return null;
328
+ }
329
+ const payload = recordValue(response.payload) || {};
330
+ const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
331
+ return compactRecord({
332
+ ...payload,
333
+ decision: response.decision,
334
+ summary: response.summary,
335
+ recommended_stage: nonEmptyString(payload.recommended_stage) || stage || void 0,
336
+ continue_with_stage: stage || void 0,
337
+ escalation_target: nonEmptyString(payload.escalation_target) || "agent",
338
+ reasons: Array.isArray(response.reasons) ? response.reasons : Array.isArray(payload.reasons) ? payload.reasons : [],
339
+ source: "supervising_agent",
340
+ checkpoint_response_source: response.source || null,
341
+ checkpoint_response_created_at: response.created_at
342
+ });
343
+ }
311
344
  function proofAssessmentVisualBlocker(state, payload) {
312
345
  if (!proofAssessmentRequestsShip(payload)) return null;
313
346
  const source = nonEmptyString(payload.source) || "supervising_agent";
@@ -446,7 +479,7 @@ function blockerResult(state, result, blocker) {
446
479
  });
447
480
  }
448
481
  function checkpointAwaitingResult(state, result, visibility) {
449
- const packet = buildAuthorCheckpointPacket({
482
+ const packet = buildCheckpointPacketForEngineResult({
450
483
  request: state.request,
451
484
  runState: state,
452
485
  engineResult: result,
@@ -611,8 +644,30 @@ function checkpointResponseContinuation(state, value) {
611
644
  }
612
645
  if (response.decision === "needs_recon") {
613
646
  appendCheckpointResponse(state, response);
647
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
648
+ const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
649
+ if (assessment) return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
650
+ }
614
651
  return { next: { ...base, advance_stage: "recon" } };
615
652
  }
653
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
654
+ const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
655
+ if (assessment) {
656
+ appendCheckpointResponse(state, response);
657
+ return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
658
+ }
659
+ if (response.decision === "blocked" || response.decision === "human_review") {
660
+ appendCheckpointResponse(state, response, { clear_packet: false });
661
+ return {
662
+ blocker: {
663
+ code: `checkpoint_response_${response.decision}`,
664
+ checkpoint: packet.checkpoint,
665
+ message: response.summary || `Checkpoint response stopped the run with decision=${response.decision}.`,
666
+ details: { stage: packet.stage, response }
667
+ }
668
+ };
669
+ }
670
+ }
616
671
  appendCheckpointResponse(state, response, { clear_packet: false });
617
672
  return {
618
673
  blocker: {
@@ -895,9 +950,24 @@ async function routeCheckpoint(request, state, result, agent, input) {
895
950
  return { next: { action: "run", state_path: String(result.state_path || ""), advance_stage: "verify" } };
896
951
  }
897
952
  if (checkpoint === "verify_supervisor_judgment") {
953
+ if (input.checkpoint_mode === "yield") {
954
+ return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
955
+ }
898
956
  const assessment = await agent.assessProof(context);
899
957
  const blocker = requirePayload("proof_assessment", assessment, state, result);
900
- if (blocker) return { blocker };
958
+ if (blocker) {
959
+ if (blocker.code === "main_agent_proof_review_required") {
960
+ recordEvent(state, {
961
+ kind: "checkpoint.packet.requested",
962
+ checkpoint,
963
+ stage: "verify",
964
+ summary: "Main-agent proof review is being converted to a portable checkpoint packet.",
965
+ details: { blocker }
966
+ });
967
+ return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
968
+ }
969
+ return { blocker };
970
+ }
901
971
  const payload = assessment.payload;
902
972
  recordEvent(state, {
903
973
  kind: "agent.proof_assessment.completed",
@@ -81,6 +81,47 @@ function responseSchemaForAuthorPacket() {
81
81
  }
82
82
  };
83
83
  }
84
+ function responseSchemaForProofAssessmentPacket() {
85
+ return {
86
+ type: "object",
87
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
88
+ additionalProperties: false,
89
+ properties: {
90
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
91
+ run_id: { type: "string" },
92
+ checkpoint: { type: "string" },
93
+ resume_token: { type: "string" },
94
+ decision: {
95
+ type: "string",
96
+ enum: [
97
+ "ready_to_ship",
98
+ "needs_richer_proof",
99
+ "revise_capture",
100
+ "needs_recon",
101
+ "needs_implementation",
102
+ "blocked",
103
+ "human_review"
104
+ ]
105
+ },
106
+ summary: { type: "string" },
107
+ payload: {
108
+ type: "object",
109
+ description: "Optional structured assessment details, including recommended_stage, continue_with_stage, visual_delta notes, or blocker diagnostics."
110
+ },
111
+ reasons: { type: "array", items: { type: "string" } },
112
+ continue_with_stage: { type: "string", enum: ["ship", "author", "implement", "recon", "verify"] },
113
+ source: {
114
+ type: "object",
115
+ properties: {
116
+ kind: { type: "string" },
117
+ session_id: { type: "string" },
118
+ user_id: { type: "string" }
119
+ }
120
+ },
121
+ created_at: { type: "string" }
122
+ }
123
+ };
124
+ }
84
125
  function resumeTokenFor(input) {
85
126
  const hash = crypto.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
86
127
  return `rpchk_${hash}`;
@@ -164,6 +205,124 @@ function buildAuthorCheckpointPacket(input) {
164
205
  created_at: input.created_at || timestamp()
165
206
  };
166
207
  }
208
+ function visualDeltaFromState(fullState) {
209
+ const bundle = recordValue(fullState.evidence_bundle);
210
+ const after = recordValue(bundle?.after);
211
+ const afterDelta = recordValue(after?.visual_delta);
212
+ if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
213
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request);
214
+ return recordValue(proofAssessmentRequest?.visual_delta) || null;
215
+ }
216
+ function verificationModeRequiresVisualDelta(value) {
217
+ const mode = String(value || "proof").trim().toLowerCase();
218
+ return [
219
+ "visual",
220
+ "render",
221
+ "interaction",
222
+ "ui",
223
+ "layout",
224
+ "screenshot",
225
+ "canvas",
226
+ "animation"
227
+ ].includes(mode);
228
+ }
229
+ function visualDeltaIssueCode(visualDelta, required) {
230
+ const status = String(visualDelta?.status || "").trim();
231
+ const reason = String(visualDelta?.reason || "").toLowerCase();
232
+ if (status === "unmeasured") {
233
+ if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
234
+ return "comparator_fetch_blocked";
235
+ }
236
+ return "visual_delta_unmeasured";
237
+ }
238
+ if (status === "measured" && visualDelta?.passed === false) return "semantic_proof_failed";
239
+ if (required && status !== "measured") return "visual_delta_unmeasured";
240
+ return null;
241
+ }
242
+ function buildProofAssessmentCheckpointPacket(input) {
243
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "verify_supervisor_judgment";
244
+ const stage = "verify";
245
+ const runId = input.runState.run_id || "unknown";
246
+ const fullState = input.fullRiddleState || {};
247
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request) || recordValue(recordValue(fullState.verify_decision_request)?.assessment_request) || recordValue(input.engineResult.decisionRequest?.details) || {};
248
+ const bundle = recordValue(fullState.evidence_bundle);
249
+ const artifactContract = recordValue(proofAssessmentRequest.artifact_contract) || recordValue(bundle?.artifact_contract);
250
+ const requiredSignals = recordValue(recordValue(artifactContract)?.required);
251
+ const visualDelta = visualDeltaFromState(fullState);
252
+ const verificationMode = nonEmptyString(input.request.verification_mode) || nonEmptyString(fullState.verification_mode) || nonEmptyString(bundle?.verification_mode) || "proof";
253
+ const visualDeltaRequired = requiredSignals?.visual_delta === true || verificationModeRequiresVisualDelta(verificationMode);
254
+ const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
255
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
256
+ 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.";
257
+ return {
258
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
259
+ run_id: runId,
260
+ state_path: input.runState.state_path,
261
+ stage,
262
+ checkpoint,
263
+ kind: evidenceIssueCode ? "recover_evidence" : "assess_proof",
264
+ summary,
265
+ question: `Assess the current Riddle Proof evidence. ${recoveryHint} Return a CheckpointResponse using one allowed decision.`,
266
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
267
+ context: input.request.context,
268
+ artifacts: artifactsFromState(fullState),
269
+ state_excerpt: compactRecord({
270
+ repo: input.request.repo || fullState.repo,
271
+ branch: input.request.branch || fullState.branch,
272
+ verification_mode: verificationMode,
273
+ reference: input.request.reference || fullState.reference,
274
+ server_path: fullState.server_path,
275
+ wait_for_selector: fullState.wait_for_selector,
276
+ implementation_status: fullState.implementation_status,
277
+ implementation_summary: fullState.implementation_summary,
278
+ changed_files: jsonCloneValue(fullState.changed_files),
279
+ proof_plan: compactText(fullState.proof_plan, 1200)
280
+ }),
281
+ evidence_excerpt: compactRecord({
282
+ before_cdn: fullState.before_cdn || null,
283
+ prod_cdn: fullState.prod_cdn || null,
284
+ after_cdn: fullState.after_cdn || null,
285
+ visual_delta_required: visualDeltaRequired,
286
+ visual_delta_ready: visualDelta?.status === "measured" && visualDelta?.passed === true,
287
+ visual_delta: jsonCloneRecord(visualDelta),
288
+ evidence_issue_code: evidenceIssueCode,
289
+ proof_assessment_request: jsonCloneRecord(proofAssessmentRequest),
290
+ verify_decision_request: jsonCloneRecord(fullState.verify_decision_request),
291
+ checkpoint_contract: jsonCloneRecord(input.engineResult.checkpointContract)
292
+ }),
293
+ artifact_contract: jsonCloneRecord(artifactContract),
294
+ allowed_decisions: [
295
+ "ready_to_ship",
296
+ "needs_richer_proof",
297
+ "revise_capture",
298
+ "needs_recon",
299
+ "needs_implementation",
300
+ "blocked",
301
+ "human_review"
302
+ ],
303
+ response_schema: responseSchemaForProofAssessmentPacket(),
304
+ routing_hint: {
305
+ suggested_role: evidenceIssueCode ? "proof_judge" : "proof_judge",
306
+ visibility: input.visibility || "quiet",
307
+ urgency: evidenceIssueCode ? "high" : "normal",
308
+ can_auto_answer: input.visibility !== "manual"
309
+ },
310
+ resume_token: resumeTokenFor({
311
+ runId,
312
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
313
+ checkpoint,
314
+ stage
315
+ }),
316
+ created_at: input.created_at || timestamp()
317
+ };
318
+ }
319
+ function buildCheckpointPacketForEngineResult(input) {
320
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
321
+ if (checkpoint === "verify_supervisor_judgment" || checkpoint === "verify_supervisor_judgment_required" || checkpoint === "verify_human_escalation") {
322
+ return buildProofAssessmentCheckpointPacket(input);
323
+ }
324
+ return buildAuthorCheckpointPacket(input);
325
+ }
167
326
  function normalizeCheckpointResponse(value) {
168
327
  const record = recordValue(value);
169
328
  if (!record) return null;
@@ -284,6 +443,8 @@ export {
284
443
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
285
444
  statePathsForRunState,
286
445
  buildAuthorCheckpointPacket,
446
+ buildProofAssessmentCheckpointPacket,
447
+ buildCheckpointPacketForEngineResult,
287
448
  normalizeCheckpointResponse,
288
449
  checkpointSummaryFromState,
289
450
  isDuplicateCheckpointResponse,
@@ -3238,6 +3238,47 @@ function responseSchemaForAuthorPacket() {
3238
3238
  }
3239
3239
  };
3240
3240
  }
3241
+ function responseSchemaForProofAssessmentPacket() {
3242
+ return {
3243
+ type: "object",
3244
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
3245
+ additionalProperties: false,
3246
+ properties: {
3247
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
3248
+ run_id: { type: "string" },
3249
+ checkpoint: { type: "string" },
3250
+ resume_token: { type: "string" },
3251
+ decision: {
3252
+ type: "string",
3253
+ enum: [
3254
+ "ready_to_ship",
3255
+ "needs_richer_proof",
3256
+ "revise_capture",
3257
+ "needs_recon",
3258
+ "needs_implementation",
3259
+ "blocked",
3260
+ "human_review"
3261
+ ]
3262
+ },
3263
+ summary: { type: "string" },
3264
+ payload: {
3265
+ type: "object",
3266
+ description: "Optional structured assessment details, including recommended_stage, continue_with_stage, visual_delta notes, or blocker diagnostics."
3267
+ },
3268
+ reasons: { type: "array", items: { type: "string" } },
3269
+ continue_with_stage: { type: "string", enum: ["ship", "author", "implement", "recon", "verify"] },
3270
+ source: {
3271
+ type: "object",
3272
+ properties: {
3273
+ kind: { type: "string" },
3274
+ session_id: { type: "string" },
3275
+ user_id: { type: "string" }
3276
+ }
3277
+ },
3278
+ created_at: { type: "string" }
3279
+ }
3280
+ };
3281
+ }
3241
3282
  function resumeTokenFor(input) {
3242
3283
  const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
3243
3284
  return `rpchk_${hash}`;
@@ -3321,6 +3362,124 @@ function buildAuthorCheckpointPacket(input) {
3321
3362
  created_at: input.created_at || timestamp2()
3322
3363
  };
3323
3364
  }
3365
+ function visualDeltaFromState(fullState) {
3366
+ const bundle = recordValue(fullState.evidence_bundle);
3367
+ const after = recordValue(bundle?.after);
3368
+ const afterDelta = recordValue(after?.visual_delta);
3369
+ if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
3370
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request);
3371
+ return recordValue(proofAssessmentRequest?.visual_delta) || null;
3372
+ }
3373
+ function verificationModeRequiresVisualDelta(value) {
3374
+ const mode = String(value || "proof").trim().toLowerCase();
3375
+ return [
3376
+ "visual",
3377
+ "render",
3378
+ "interaction",
3379
+ "ui",
3380
+ "layout",
3381
+ "screenshot",
3382
+ "canvas",
3383
+ "animation"
3384
+ ].includes(mode);
3385
+ }
3386
+ function visualDeltaIssueCode(visualDelta, required) {
3387
+ const status = String(visualDelta?.status || "").trim();
3388
+ const reason = String(visualDelta?.reason || "").toLowerCase();
3389
+ if (status === "unmeasured") {
3390
+ if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
3391
+ return "comparator_fetch_blocked";
3392
+ }
3393
+ return "visual_delta_unmeasured";
3394
+ }
3395
+ if (status === "measured" && visualDelta?.passed === false) return "semantic_proof_failed";
3396
+ if (required && status !== "measured") return "visual_delta_unmeasured";
3397
+ return null;
3398
+ }
3399
+ function buildProofAssessmentCheckpointPacket(input) {
3400
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "verify_supervisor_judgment";
3401
+ const stage = "verify";
3402
+ const runId = input.runState.run_id || "unknown";
3403
+ const fullState = input.fullRiddleState || {};
3404
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request) || recordValue(recordValue(fullState.verify_decision_request)?.assessment_request) || recordValue(input.engineResult.decisionRequest?.details) || {};
3405
+ const bundle = recordValue(fullState.evidence_bundle);
3406
+ const artifactContract = recordValue(proofAssessmentRequest.artifact_contract) || recordValue(bundle?.artifact_contract);
3407
+ const requiredSignals = recordValue(recordValue(artifactContract)?.required);
3408
+ const visualDelta = visualDeltaFromState(fullState);
3409
+ const verificationMode = nonEmptyString(input.request.verification_mode) || nonEmptyString(fullState.verification_mode) || nonEmptyString(bundle?.verification_mode) || "proof";
3410
+ const visualDeltaRequired = requiredSignals?.visual_delta === true || verificationModeRequiresVisualDelta(verificationMode);
3411
+ const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
3412
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
3413
+ 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.";
3414
+ return {
3415
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
3416
+ run_id: runId,
3417
+ state_path: input.runState.state_path,
3418
+ stage,
3419
+ checkpoint,
3420
+ kind: evidenceIssueCode ? "recover_evidence" : "assess_proof",
3421
+ summary,
3422
+ question: `Assess the current Riddle Proof evidence. ${recoveryHint} Return a CheckpointResponse using one allowed decision.`,
3423
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
3424
+ context: input.request.context,
3425
+ artifacts: artifactsFromState(fullState),
3426
+ state_excerpt: compactRecord({
3427
+ repo: input.request.repo || fullState.repo,
3428
+ branch: input.request.branch || fullState.branch,
3429
+ verification_mode: verificationMode,
3430
+ reference: input.request.reference || fullState.reference,
3431
+ server_path: fullState.server_path,
3432
+ wait_for_selector: fullState.wait_for_selector,
3433
+ implementation_status: fullState.implementation_status,
3434
+ implementation_summary: fullState.implementation_summary,
3435
+ changed_files: jsonCloneValue(fullState.changed_files),
3436
+ proof_plan: compactText(fullState.proof_plan, 1200)
3437
+ }),
3438
+ evidence_excerpt: compactRecord({
3439
+ before_cdn: fullState.before_cdn || null,
3440
+ prod_cdn: fullState.prod_cdn || null,
3441
+ after_cdn: fullState.after_cdn || null,
3442
+ visual_delta_required: visualDeltaRequired,
3443
+ visual_delta_ready: visualDelta?.status === "measured" && visualDelta?.passed === true,
3444
+ visual_delta: jsonCloneRecord(visualDelta),
3445
+ evidence_issue_code: evidenceIssueCode,
3446
+ proof_assessment_request: jsonCloneRecord(proofAssessmentRequest),
3447
+ verify_decision_request: jsonCloneRecord(fullState.verify_decision_request),
3448
+ checkpoint_contract: jsonCloneRecord(input.engineResult.checkpointContract)
3449
+ }),
3450
+ artifact_contract: jsonCloneRecord(artifactContract),
3451
+ allowed_decisions: [
3452
+ "ready_to_ship",
3453
+ "needs_richer_proof",
3454
+ "revise_capture",
3455
+ "needs_recon",
3456
+ "needs_implementation",
3457
+ "blocked",
3458
+ "human_review"
3459
+ ],
3460
+ response_schema: responseSchemaForProofAssessmentPacket(),
3461
+ routing_hint: {
3462
+ suggested_role: evidenceIssueCode ? "proof_judge" : "proof_judge",
3463
+ visibility: input.visibility || "quiet",
3464
+ urgency: evidenceIssueCode ? "high" : "normal",
3465
+ can_auto_answer: input.visibility !== "manual"
3466
+ },
3467
+ resume_token: resumeTokenFor({
3468
+ runId,
3469
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
3470
+ checkpoint,
3471
+ stage
3472
+ }),
3473
+ created_at: input.created_at || timestamp2()
3474
+ };
3475
+ }
3476
+ function buildCheckpointPacketForEngineResult(input) {
3477
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
3478
+ if (checkpoint === "verify_supervisor_judgment" || checkpoint === "verify_supervisor_judgment_required" || checkpoint === "verify_human_escalation") {
3479
+ return buildProofAssessmentCheckpointPacket(input);
3480
+ }
3481
+ return buildAuthorCheckpointPacket(input);
3482
+ }
3324
3483
  function normalizeCheckpointResponse(value) {
3325
3484
  const record = recordValue(value);
3326
3485
  if (!record) return null;
@@ -3704,6 +3863,39 @@ function proofAssessmentContinuation(result, payload) {
3704
3863
  const proof_assessment_json = jsonParam(payload);
3705
3864
  return { ...baseContinuation(result), proof_assessment_json };
3706
3865
  }
3866
+ function defaultStageForProofCheckpointDecision(decision) {
3867
+ if (decision === "ready_to_ship") return "ship";
3868
+ if (decision === "needs_implementation") return "implement";
3869
+ if (decision === "needs_recon") return "recon";
3870
+ if (decision === "revise_capture") return "verify";
3871
+ if (decision === "needs_richer_proof") return "author";
3872
+ return null;
3873
+ }
3874
+ function proofAssessmentPayloadFromCheckpointResponse(response) {
3875
+ if (![
3876
+ "ready_to_ship",
3877
+ "needs_richer_proof",
3878
+ "revise_capture",
3879
+ "needs_recon",
3880
+ "needs_implementation"
3881
+ ].includes(response.decision)) {
3882
+ return null;
3883
+ }
3884
+ const payload = recordValue(response.payload) || {};
3885
+ const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
3886
+ return compactRecord({
3887
+ ...payload,
3888
+ decision: response.decision,
3889
+ summary: response.summary,
3890
+ recommended_stage: nonEmptyString(payload.recommended_stage) || stage || void 0,
3891
+ continue_with_stage: stage || void 0,
3892
+ escalation_target: nonEmptyString(payload.escalation_target) || "agent",
3893
+ reasons: Array.isArray(response.reasons) ? response.reasons : Array.isArray(payload.reasons) ? payload.reasons : [],
3894
+ source: "supervising_agent",
3895
+ checkpoint_response_source: response.source || null,
3896
+ checkpoint_response_created_at: response.created_at
3897
+ });
3898
+ }
3707
3899
  function proofAssessmentVisualBlocker(state, payload) {
3708
3900
  if (!proofAssessmentRequestsShip(payload)) return null;
3709
3901
  const source = nonEmptyString(payload.source) || "supervising_agent";
@@ -3842,7 +4034,7 @@ function blockerResult(state, result, blocker) {
3842
4034
  });
3843
4035
  }
3844
4036
  function checkpointAwaitingResult(state, result, visibility) {
3845
- const packet = buildAuthorCheckpointPacket({
4037
+ const packet = buildCheckpointPacketForEngineResult({
3846
4038
  request: state.request,
3847
4039
  runState: state,
3848
4040
  engineResult: result,
@@ -4007,8 +4199,30 @@ function checkpointResponseContinuation(state, value) {
4007
4199
  }
4008
4200
  if (response.decision === "needs_recon") {
4009
4201
  appendCheckpointResponse(state, response);
4202
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
4203
+ const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
4204
+ if (assessment) return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
4205
+ }
4010
4206
  return { next: { ...base, advance_stage: "recon" } };
4011
4207
  }
4208
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
4209
+ const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
4210
+ if (assessment) {
4211
+ appendCheckpointResponse(state, response);
4212
+ return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
4213
+ }
4214
+ if (response.decision === "blocked" || response.decision === "human_review") {
4215
+ appendCheckpointResponse(state, response, { clear_packet: false });
4216
+ return {
4217
+ blocker: {
4218
+ code: `checkpoint_response_${response.decision}`,
4219
+ checkpoint: packet.checkpoint,
4220
+ message: response.summary || `Checkpoint response stopped the run with decision=${response.decision}.`,
4221
+ details: { stage: packet.stage, response }
4222
+ }
4223
+ };
4224
+ }
4225
+ }
4012
4226
  appendCheckpointResponse(state, response, { clear_packet: false });
4013
4227
  return {
4014
4228
  blocker: {
@@ -4291,9 +4505,24 @@ async function routeCheckpoint(request, state, result, agent, input) {
4291
4505
  return { next: { action: "run", state_path: String(result.state_path || ""), advance_stage: "verify" } };
4292
4506
  }
4293
4507
  if (checkpoint === "verify_supervisor_judgment") {
4508
+ if (input.checkpoint_mode === "yield") {
4509
+ return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
4510
+ }
4294
4511
  const assessment = await agent.assessProof(context);
4295
4512
  const blocker = requirePayload("proof_assessment", assessment, state, result);
4296
- if (blocker) return { blocker };
4513
+ if (blocker) {
4514
+ if (blocker.code === "main_agent_proof_review_required") {
4515
+ recordEvent(state, {
4516
+ kind: "checkpoint.packet.requested",
4517
+ checkpoint,
4518
+ stage: "verify",
4519
+ summary: "Main-agent proof review is being converted to a portable checkpoint packet.",
4520
+ details: { blocker }
4521
+ });
4522
+ return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
4523
+ }
4524
+ return { blocker };
4525
+ }
4297
4526
  const payload = assessment.payload;
4298
4527
  recordEvent(state, {
4299
4528
  kind: "agent.proof_assessment.completed",
@@ -2,8 +2,8 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-MJD37CLH.js";
6
- import "./chunk-RI25RGQP.js";
5
+ } from "./chunk-CHRYLX6N.js";
6
+ import "./chunk-LXE5YUYY.js";
7
7
  import "./chunk-7S7O3NKF.js";
8
8
  import "./chunk-W7VTDN4T.js";
9
9
  import "./chunk-4ASMX4R6.js";
package/dist/index.cjs CHANGED
@@ -2772,6 +2772,8 @@ __export(index_exports, {
2772
2772
  assessPlayabilityEvidence: () => assessPlayabilityEvidence,
2773
2773
  authorPacketPayloadFromCheckpointResponse: () => authorPacketPayloadFromCheckpointResponse,
2774
2774
  buildAuthorCheckpointPacket: () => buildAuthorCheckpointPacket,
2775
+ buildCheckpointPacketForEngineResult: () => buildCheckpointPacketForEngineResult,
2776
+ buildProofAssessmentCheckpointPacket: () => buildProofAssessmentCheckpointPacket,
2775
2777
  buildVisualProofSession: () => buildVisualProofSession,
2776
2778
  checkpointResponseIdentity: () => checkpointResponseIdentity,
2777
2779
  checkpointSummaryFromState: () => checkpointSummaryFromState,
@@ -3330,6 +3332,47 @@ function responseSchemaForAuthorPacket() {
3330
3332
  }
3331
3333
  };
3332
3334
  }
3335
+ function responseSchemaForProofAssessmentPacket() {
3336
+ return {
3337
+ type: "object",
3338
+ required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
3339
+ additionalProperties: false,
3340
+ properties: {
3341
+ version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
3342
+ run_id: { type: "string" },
3343
+ checkpoint: { type: "string" },
3344
+ resume_token: { type: "string" },
3345
+ decision: {
3346
+ type: "string",
3347
+ enum: [
3348
+ "ready_to_ship",
3349
+ "needs_richer_proof",
3350
+ "revise_capture",
3351
+ "needs_recon",
3352
+ "needs_implementation",
3353
+ "blocked",
3354
+ "human_review"
3355
+ ]
3356
+ },
3357
+ summary: { type: "string" },
3358
+ payload: {
3359
+ type: "object",
3360
+ description: "Optional structured assessment details, including recommended_stage, continue_with_stage, visual_delta notes, or blocker diagnostics."
3361
+ },
3362
+ reasons: { type: "array", items: { type: "string" } },
3363
+ continue_with_stage: { type: "string", enum: ["ship", "author", "implement", "recon", "verify"] },
3364
+ source: {
3365
+ type: "object",
3366
+ properties: {
3367
+ kind: { type: "string" },
3368
+ session_id: { type: "string" },
3369
+ user_id: { type: "string" }
3370
+ }
3371
+ },
3372
+ created_at: { type: "string" }
3373
+ }
3374
+ };
3375
+ }
3333
3376
  function resumeTokenFor(input) {
3334
3377
  const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
3335
3378
  return `rpchk_${hash}`;
@@ -3413,6 +3456,124 @@ function buildAuthorCheckpointPacket(input) {
3413
3456
  created_at: input.created_at || timestamp2()
3414
3457
  };
3415
3458
  }
3459
+ function visualDeltaFromState(fullState) {
3460
+ const bundle = recordValue(fullState.evidence_bundle);
3461
+ const after = recordValue(bundle?.after);
3462
+ const afterDelta = recordValue(after?.visual_delta);
3463
+ if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
3464
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request);
3465
+ return recordValue(proofAssessmentRequest?.visual_delta) || null;
3466
+ }
3467
+ function verificationModeRequiresVisualDelta(value) {
3468
+ const mode = String(value || "proof").trim().toLowerCase();
3469
+ return [
3470
+ "visual",
3471
+ "render",
3472
+ "interaction",
3473
+ "ui",
3474
+ "layout",
3475
+ "screenshot",
3476
+ "canvas",
3477
+ "animation"
3478
+ ].includes(mode);
3479
+ }
3480
+ function visualDeltaIssueCode(visualDelta, required) {
3481
+ const status = String(visualDelta?.status || "").trim();
3482
+ const reason = String(visualDelta?.reason || "").toLowerCase();
3483
+ if (status === "unmeasured") {
3484
+ if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
3485
+ return "comparator_fetch_blocked";
3486
+ }
3487
+ return "visual_delta_unmeasured";
3488
+ }
3489
+ if (status === "measured" && visualDelta?.passed === false) return "semantic_proof_failed";
3490
+ if (required && status !== "measured") return "visual_delta_unmeasured";
3491
+ return null;
3492
+ }
3493
+ function buildProofAssessmentCheckpointPacket(input) {
3494
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "verify_supervisor_judgment";
3495
+ const stage = "verify";
3496
+ const runId = input.runState.run_id || "unknown";
3497
+ const fullState = input.fullRiddleState || {};
3498
+ const proofAssessmentRequest = recordValue(fullState.proof_assessment_request) || recordValue(recordValue(fullState.verify_decision_request)?.assessment_request) || recordValue(input.engineResult.decisionRequest?.details) || {};
3499
+ const bundle = recordValue(fullState.evidence_bundle);
3500
+ const artifactContract = recordValue(proofAssessmentRequest.artifact_contract) || recordValue(bundle?.artifact_contract);
3501
+ const requiredSignals = recordValue(recordValue(artifactContract)?.required);
3502
+ const visualDelta = visualDeltaFromState(fullState);
3503
+ const verificationMode = nonEmptyString(input.request.verification_mode) || nonEmptyString(fullState.verification_mode) || nonEmptyString(bundle?.verification_mode) || "proof";
3504
+ const visualDeltaRequired = requiredSignals?.visual_delta === true || verificationModeRequiresVisualDelta(verificationMode);
3505
+ const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
3506
+ const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
3507
+ 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.";
3508
+ return {
3509
+ version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
3510
+ run_id: runId,
3511
+ state_path: input.runState.state_path,
3512
+ stage,
3513
+ checkpoint,
3514
+ kind: evidenceIssueCode ? "recover_evidence" : "assess_proof",
3515
+ summary,
3516
+ question: `Assess the current Riddle Proof evidence. ${recoveryHint} Return a CheckpointResponse using one allowed decision.`,
3517
+ change_request: input.request.change_request || nonEmptyString(fullState.change_request) || "",
3518
+ context: input.request.context,
3519
+ artifacts: artifactsFromState(fullState),
3520
+ state_excerpt: compactRecord({
3521
+ repo: input.request.repo || fullState.repo,
3522
+ branch: input.request.branch || fullState.branch,
3523
+ verification_mode: verificationMode,
3524
+ reference: input.request.reference || fullState.reference,
3525
+ server_path: fullState.server_path,
3526
+ wait_for_selector: fullState.wait_for_selector,
3527
+ implementation_status: fullState.implementation_status,
3528
+ implementation_summary: fullState.implementation_summary,
3529
+ changed_files: jsonCloneValue(fullState.changed_files),
3530
+ proof_plan: compactText(fullState.proof_plan, 1200)
3531
+ }),
3532
+ evidence_excerpt: compactRecord({
3533
+ before_cdn: fullState.before_cdn || null,
3534
+ prod_cdn: fullState.prod_cdn || null,
3535
+ after_cdn: fullState.after_cdn || null,
3536
+ visual_delta_required: visualDeltaRequired,
3537
+ visual_delta_ready: visualDelta?.status === "measured" && visualDelta?.passed === true,
3538
+ visual_delta: jsonCloneRecord(visualDelta),
3539
+ evidence_issue_code: evidenceIssueCode,
3540
+ proof_assessment_request: jsonCloneRecord(proofAssessmentRequest),
3541
+ verify_decision_request: jsonCloneRecord(fullState.verify_decision_request),
3542
+ checkpoint_contract: jsonCloneRecord(input.engineResult.checkpointContract)
3543
+ }),
3544
+ artifact_contract: jsonCloneRecord(artifactContract),
3545
+ allowed_decisions: [
3546
+ "ready_to_ship",
3547
+ "needs_richer_proof",
3548
+ "revise_capture",
3549
+ "needs_recon",
3550
+ "needs_implementation",
3551
+ "blocked",
3552
+ "human_review"
3553
+ ],
3554
+ response_schema: responseSchemaForProofAssessmentPacket(),
3555
+ routing_hint: {
3556
+ suggested_role: evidenceIssueCode ? "proof_judge" : "proof_judge",
3557
+ visibility: input.visibility || "quiet",
3558
+ urgency: evidenceIssueCode ? "high" : "normal",
3559
+ can_auto_answer: input.visibility !== "manual"
3560
+ },
3561
+ resume_token: resumeTokenFor({
3562
+ runId,
3563
+ statePath: input.engineResult.state_path || input.request.engine_state_path || null,
3564
+ checkpoint,
3565
+ stage
3566
+ }),
3567
+ created_at: input.created_at || timestamp2()
3568
+ };
3569
+ }
3570
+ function buildCheckpointPacketForEngineResult(input) {
3571
+ const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
3572
+ if (checkpoint === "verify_supervisor_judgment" || checkpoint === "verify_supervisor_judgment_required" || checkpoint === "verify_human_escalation") {
3573
+ return buildProofAssessmentCheckpointPacket(input);
3574
+ }
3575
+ return buildAuthorCheckpointPacket(input);
3576
+ }
3416
3577
  function normalizeCheckpointResponse(value) {
3417
3578
  const record = recordValue(value);
3418
3579
  if (!record) return null;
@@ -4282,6 +4443,39 @@ function proofAssessmentContinuation(result, payload) {
4282
4443
  const proof_assessment_json = jsonParam(payload);
4283
4444
  return { ...baseContinuation(result), proof_assessment_json };
4284
4445
  }
4446
+ function defaultStageForProofCheckpointDecision(decision) {
4447
+ if (decision === "ready_to_ship") return "ship";
4448
+ if (decision === "needs_implementation") return "implement";
4449
+ if (decision === "needs_recon") return "recon";
4450
+ if (decision === "revise_capture") return "verify";
4451
+ if (decision === "needs_richer_proof") return "author";
4452
+ return null;
4453
+ }
4454
+ function proofAssessmentPayloadFromCheckpointResponse(response) {
4455
+ if (![
4456
+ "ready_to_ship",
4457
+ "needs_richer_proof",
4458
+ "revise_capture",
4459
+ "needs_recon",
4460
+ "needs_implementation"
4461
+ ].includes(response.decision)) {
4462
+ return null;
4463
+ }
4464
+ const payload = recordValue(response.payload) || {};
4465
+ const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
4466
+ return compactRecord({
4467
+ ...payload,
4468
+ decision: response.decision,
4469
+ summary: response.summary,
4470
+ recommended_stage: nonEmptyString(payload.recommended_stage) || stage || void 0,
4471
+ continue_with_stage: stage || void 0,
4472
+ escalation_target: nonEmptyString(payload.escalation_target) || "agent",
4473
+ reasons: Array.isArray(response.reasons) ? response.reasons : Array.isArray(payload.reasons) ? payload.reasons : [],
4474
+ source: "supervising_agent",
4475
+ checkpoint_response_source: response.source || null,
4476
+ checkpoint_response_created_at: response.created_at
4477
+ });
4478
+ }
4285
4479
  function proofAssessmentVisualBlocker(state, payload) {
4286
4480
  if (!proofAssessmentRequestsShip(payload)) return null;
4287
4481
  const source = nonEmptyString(payload.source) || "supervising_agent";
@@ -4420,7 +4614,7 @@ function blockerResult(state, result, blocker) {
4420
4614
  });
4421
4615
  }
4422
4616
  function checkpointAwaitingResult(state, result, visibility) {
4423
- const packet = buildAuthorCheckpointPacket({
4617
+ const packet = buildCheckpointPacketForEngineResult({
4424
4618
  request: state.request,
4425
4619
  runState: state,
4426
4620
  engineResult: result,
@@ -4585,8 +4779,30 @@ function checkpointResponseContinuation(state, value) {
4585
4779
  }
4586
4780
  if (response.decision === "needs_recon") {
4587
4781
  appendCheckpointResponse(state, response);
4782
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
4783
+ const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
4784
+ if (assessment) return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
4785
+ }
4588
4786
  return { next: { ...base, advance_stage: "recon" } };
4589
4787
  }
4788
+ if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
4789
+ const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
4790
+ if (assessment) {
4791
+ appendCheckpointResponse(state, response);
4792
+ return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
4793
+ }
4794
+ if (response.decision === "blocked" || response.decision === "human_review") {
4795
+ appendCheckpointResponse(state, response, { clear_packet: false });
4796
+ return {
4797
+ blocker: {
4798
+ code: `checkpoint_response_${response.decision}`,
4799
+ checkpoint: packet.checkpoint,
4800
+ message: response.summary || `Checkpoint response stopped the run with decision=${response.decision}.`,
4801
+ details: { stage: packet.stage, response }
4802
+ }
4803
+ };
4804
+ }
4805
+ }
4590
4806
  appendCheckpointResponse(state, response, { clear_packet: false });
4591
4807
  return {
4592
4808
  blocker: {
@@ -4869,9 +5085,24 @@ async function routeCheckpoint(request, state, result, agent, input) {
4869
5085
  return { next: { action: "run", state_path: String(result.state_path || ""), advance_stage: "verify" } };
4870
5086
  }
4871
5087
  if (checkpoint === "verify_supervisor_judgment") {
5088
+ if (input.checkpoint_mode === "yield") {
5089
+ return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
5090
+ }
4872
5091
  const assessment = await agent.assessProof(context);
4873
5092
  const blocker = requirePayload("proof_assessment", assessment, state, result);
4874
- if (blocker) return { blocker };
5093
+ if (blocker) {
5094
+ if (blocker.code === "main_agent_proof_review_required") {
5095
+ recordEvent(state, {
5096
+ kind: "checkpoint.packet.requested",
5097
+ checkpoint,
5098
+ stage: "verify",
5099
+ summary: "Main-agent proof review is being converted to a portable checkpoint packet.",
5100
+ details: { blocker }
5101
+ });
5102
+ return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
5103
+ }
5104
+ return { blocker };
5105
+ }
4875
5106
  const payload = assessment.payload;
4876
5107
  recordEvent(state, {
4877
5108
  kind: "agent.proof_assessment.completed",
@@ -5755,6 +5986,8 @@ function parseJson(value) {
5755
5986
  assessPlayabilityEvidence,
5756
5987
  authorPacketPayloadFromCheckpointResponse,
5757
5988
  buildAuthorCheckpointPacket,
5989
+ buildCheckpointPacketForEngineResult,
5990
+ buildProofAssessmentCheckpointPacket,
5758
5991
  buildVisualProofSession,
5759
5992
  checkpointResponseIdentity,
5760
5993
  checkpointSummaryFromState,
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from './types.cjs';
2
2
  export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from './result.cjs';
3
3
  export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from './state.cjs';
4
- export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.cjs';
4
+ export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.cjs';
5
5
  export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.cjs';
6
6
  export { RiddleProofAgentAdapter, RiddleProofAgentPayload, RiddleProofCheckpointMode, RiddleProofEngine, RiddleProofEngineHarnessConfig, RiddleProofEngineHarnessContext, RiddleProofEngineResult, RiddleProofShipMode, RiddleProofWorkflowParams, RunRiddleProofEngineHarnessInput, createDisabledRiddleProofAgentAdapter, readRiddleProofRunStatus, runRiddleProofEngineHarness } from './engine-harness.cjs';
7
7
  export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_DIAGNOSTIC_HISTORY_LIMIT, DEFAULT_DIAGNOSTIC_STRING_LIMIT, RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION, RiddleProofArtifactSummary, RiddleProofCaptureArtifactSummary, RiddleProofCaptureDiagnostic, RiddleProofDiagnosticRedactionOptions, appendCaptureDiagnostic, createCaptureDiagnostic, redactForProofDiagnostics, summarizeCaptureArtifacts } from './diagnostics.cjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from './types.js';
2
2
  export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from './result.js';
3
3
  export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from './state.js';
4
- export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.js';
4
+ export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.js';
5
5
  export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.js';
6
6
  export { RiddleProofAgentAdapter, RiddleProofAgentPayload, RiddleProofCheckpointMode, RiddleProofEngine, RiddleProofEngineHarnessConfig, RiddleProofEngineHarnessContext, RiddleProofEngineResult, RiddleProofShipMode, RiddleProofWorkflowParams, RunRiddleProofEngineHarnessInput, createDisabledRiddleProofAgentAdapter, readRiddleProofRunStatus, runRiddleProofEngineHarness } from './engine-harness.js';
7
7
  export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_DIAGNOSTIC_HISTORY_LIMIT, DEFAULT_DIAGNOSTIC_STRING_LIMIT, RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION, RiddleProofArtifactSummary, RiddleProofCaptureArtifactSummary, RiddleProofCaptureDiagnostic, RiddleProofDiagnosticRedactionOptions, appendCaptureDiagnostic, createCaptureDiagnostic, redactForProofDiagnostics, summarizeCaptureArtifacts } from './diagnostics.js';
package/dist/index.js CHANGED
@@ -25,19 +25,21 @@ import {
25
25
  createDisabledRiddleProofAgentAdapter,
26
26
  readRiddleProofRunStatus,
27
27
  runRiddleProofEngineHarness
28
- } from "./chunk-MJD37CLH.js";
28
+ } from "./chunk-CHRYLX6N.js";
29
29
  import {
30
30
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
31
31
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
32
32
  authorPacketPayloadFromCheckpointResponse,
33
33
  buildAuthorCheckpointPacket,
34
+ buildCheckpointPacketForEngineResult,
35
+ buildProofAssessmentCheckpointPacket,
34
36
  checkpointResponseIdentity,
35
37
  checkpointSummaryFromState,
36
38
  isDuplicateCheckpointResponse,
37
39
  normalizeCheckpointResponse,
38
40
  proofContractFromAuthorCheckpointResponse,
39
41
  statePathsForRunState
40
- } from "./chunk-RI25RGQP.js";
42
+ } from "./chunk-LXE5YUYY.js";
41
43
  import {
42
44
  RIDDLE_PROOF_RUN_STATE_VERSION,
43
45
  appendRunEvent,
@@ -88,6 +90,8 @@ export {
88
90
  assessPlayabilityEvidence,
89
91
  authorPacketPayloadFromCheckpointResponse,
90
92
  buildAuthorCheckpointPacket,
93
+ buildCheckpointPacketForEngineResult,
94
+ buildProofAssessmentCheckpointPacket,
91
95
  buildVisualProofSession,
92
96
  checkpointResponseIdentity,
93
97
  checkpointSummaryFromState,
package/dist/types.d.cts CHANGED
@@ -82,6 +82,7 @@ interface RiddleProofCheckpointPacket {
82
82
  artifacts?: RiddleProofCheckpointArtifact[];
83
83
  state_excerpt?: Record<string, unknown>;
84
84
  evidence_excerpt?: Record<string, unknown>;
85
+ artifact_contract?: Record<string, unknown>;
85
86
  allowed_decisions: string[];
86
87
  response_schema: Record<string, unknown>;
87
88
  routing_hint?: RiddleProofCheckpointRoutingHint;
package/dist/types.d.ts CHANGED
@@ -82,6 +82,7 @@ interface RiddleProofCheckpointPacket {
82
82
  artifacts?: RiddleProofCheckpointArtifact[];
83
83
  state_excerpt?: Record<string, unknown>;
84
84
  evidence_excerpt?: Record<string, unknown>;
85
+ artifact_contract?: Record<string, unknown>;
85
86
  allowed_decisions: string[];
86
87
  response_schema: Record<string, unknown>;
87
88
  routing_hint?: RiddleProofCheckpointRoutingHint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.5.44",
3
+ "version": "0.5.45",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",