@riddledc/riddle-proof 0.8.52 → 0.8.54
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/dist/adapters/openclaw.js +4 -4
- package/dist/advanced/engine-harness.cjs +117 -12
- package/dist/advanced/engine-harness.js +4 -4
- package/dist/advanced/index.cjs +117 -12
- package/dist/advanced/index.d.cts +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/index.js +5 -5
- package/dist/advanced/proof-run-engine.d.cts +1 -1
- package/dist/advanced/proof-run-engine.d.ts +1 -1
- package/dist/advanced/runner.js +4 -4
- package/dist/checkpoint.cjs +41 -11
- package/dist/checkpoint.d.cts +2 -1
- package/dist/checkpoint.d.ts +2 -1
- package/dist/checkpoint.js +3 -1
- package/dist/{chunk-AXWJJ2LC.js → chunk-BLM5EIBA.js} +40 -11
- package/dist/{chunk-FWHJN3QG.js → chunk-ECLGGGAI.js} +3 -2
- package/dist/{chunk-WURLFN72.js → chunk-IV4DVWPR.js} +82 -4
- package/dist/{chunk-RBAU2M4S.js → chunk-JJ4IWRMJ.js} +1 -1
- package/dist/{chunk-OYWZGDTS.js → chunk-LNWJAHAQ.js} +1 -1
- package/dist/{chunk-2CZORYB7.js → chunk-S5DX7Z6X.js} +1 -1
- package/dist/{chunk-M3IE3VNC.js → chunk-WDIKPIMB.js} +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/cli.cjs +119 -12
- package/dist/cli.js +5 -5
- package/dist/engine-harness.cjs +117 -12
- package/dist/engine-harness.js +4 -4
- package/dist/index.cjs +120 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -5
- package/dist/openclaw.js +4 -4
- package/dist/{proof-run-engine-DpChFR5H.d.cts → proof-run-engine-Baiv6l3A.d.cts} +3 -3
- package/dist/{proof-run-engine-BqRoA3Do.d.ts → proof-run-engine-MiKZt9oY.d.ts} +3 -3
- package/dist/proof-run-engine.d.cts +1 -1
- package/dist/proof-run-engine.d.ts +1 -1
- package/dist/run-card.js +2 -2
- package/dist/runner.js +4 -4
- package/dist/spec/checkpoint.cjs +41 -11
- package/dist/spec/checkpoint.d.cts +1 -1
- package/dist/spec/checkpoint.d.ts +1 -1
- package/dist/spec/checkpoint.js +3 -1
- package/dist/spec/index.cjs +41 -11
- package/dist/spec/index.d.cts +1 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/index.js +5 -3
- package/dist/spec/run-card.js +2 -2
- package/dist/spec/state.js +3 -3
- package/dist/state.js +3 -3
- package/dist/types.d.cts +5 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-
|
|
1
|
+
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-Baiv6l3A.cjs';
|
|
2
2
|
import '../proof-run-core-7Dqm7RKM.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-
|
|
1
|
+
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-MiKZt9oY.js';
|
|
2
2
|
import '../proof-run-core-7Dqm7RKM.js';
|
package/dist/advanced/runner.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-S5DX7Z6X.js";
|
|
4
|
+
import "../chunk-WDIKPIMB.js";
|
|
5
|
+
import "../chunk-JJ4IWRMJ.js";
|
|
6
6
|
import "../chunk-EKZXU6MU.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-BLM5EIBA.js";
|
|
8
8
|
import "../chunk-VY4Y5U57.js";
|
|
9
9
|
import "../chunk-MLKGABMK.js";
|
|
10
10
|
export {
|
package/dist/checkpoint.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(checkpoint_exports, {
|
|
|
37
37
|
buildCheckpointPacketForEngineResult: () => buildCheckpointPacketForEngineResult,
|
|
38
38
|
buildProofAssessmentCheckpointPacket: () => buildProofAssessmentCheckpointPacket,
|
|
39
39
|
buildStageCheckpointPacket: () => buildStageCheckpointPacket,
|
|
40
|
+
checkpointPacketIdentity: () => checkpointPacketIdentity,
|
|
40
41
|
checkpointResponseIdentity: () => checkpointResponseIdentity,
|
|
41
42
|
checkpointSummaryFromState: () => checkpointSummaryFromState,
|
|
42
43
|
createCheckpointResponseTemplate: () => createCheckpointResponseTemplate,
|
|
@@ -105,12 +106,13 @@ function statePathsForRunState(state, engineStatePath) {
|
|
|
105
106
|
function responseSchemaForAuthorPacket() {
|
|
106
107
|
return {
|
|
107
108
|
type: "object",
|
|
108
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "payload", "created_at"],
|
|
109
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "payload", "created_at"],
|
|
109
110
|
additionalProperties: false,
|
|
110
111
|
properties: {
|
|
111
112
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
112
113
|
run_id: { type: "string" },
|
|
113
114
|
checkpoint: { type: "string" },
|
|
115
|
+
packet_id: { type: "string" },
|
|
114
116
|
resume_token: { type: "string" },
|
|
115
117
|
decision: {
|
|
116
118
|
type: "string",
|
|
@@ -138,12 +140,13 @@ function responseSchemaForAuthorPacket() {
|
|
|
138
140
|
function responseSchemaForProofAssessmentPacket() {
|
|
139
141
|
return {
|
|
140
142
|
type: "object",
|
|
141
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
143
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
142
144
|
additionalProperties: false,
|
|
143
145
|
properties: {
|
|
144
146
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
145
147
|
run_id: { type: "string" },
|
|
146
148
|
checkpoint: { type: "string" },
|
|
149
|
+
packet_id: { type: "string" },
|
|
147
150
|
resume_token: { type: "string" },
|
|
148
151
|
decision: {
|
|
149
152
|
type: "string",
|
|
@@ -179,12 +182,13 @@ function responseSchemaForProofAssessmentPacket() {
|
|
|
179
182
|
function responseSchemaForReconPacket() {
|
|
180
183
|
return {
|
|
181
184
|
type: "object",
|
|
182
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
185
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
183
186
|
additionalProperties: false,
|
|
184
187
|
properties: {
|
|
185
188
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
186
189
|
run_id: { type: "string" },
|
|
187
190
|
checkpoint: { type: "string" },
|
|
191
|
+
packet_id: { type: "string" },
|
|
188
192
|
resume_token: { type: "string" },
|
|
189
193
|
decision: {
|
|
190
194
|
type: "string",
|
|
@@ -212,12 +216,13 @@ function responseSchemaForReconPacket() {
|
|
|
212
216
|
function responseSchemaForImplementationPacket() {
|
|
213
217
|
return {
|
|
214
218
|
type: "object",
|
|
215
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
219
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
216
220
|
additionalProperties: false,
|
|
217
221
|
properties: {
|
|
218
222
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
219
223
|
run_id: { type: "string" },
|
|
220
224
|
checkpoint: { type: "string" },
|
|
225
|
+
packet_id: { type: "string" },
|
|
221
226
|
resume_token: { type: "string" },
|
|
222
227
|
decision: {
|
|
223
228
|
type: "string",
|
|
@@ -245,12 +250,13 @@ function responseSchemaForImplementationPacket() {
|
|
|
245
250
|
function responseSchemaForAdvancePacket(stage) {
|
|
246
251
|
return {
|
|
247
252
|
type: "object",
|
|
248
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
253
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
249
254
|
additionalProperties: false,
|
|
250
255
|
properties: {
|
|
251
256
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
252
257
|
run_id: { type: "string" },
|
|
253
258
|
checkpoint: { type: "string" },
|
|
259
|
+
packet_id: { type: "string" },
|
|
254
260
|
resume_token: { type: "string" },
|
|
255
261
|
decision: {
|
|
256
262
|
type: "string",
|
|
@@ -276,6 +282,20 @@ function resumeTokenFor(input) {
|
|
|
276
282
|
const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
277
283
|
return `rpchk_${hash}`;
|
|
278
284
|
}
|
|
285
|
+
function packetIdentityPayload(packet) {
|
|
286
|
+
const { packet_id: _packetId, ...identityPayload } = packet;
|
|
287
|
+
return identityPayload;
|
|
288
|
+
}
|
|
289
|
+
function checkpointPacketIdentity(packet) {
|
|
290
|
+
const hash = import_node_crypto.default.createHash("sha256").update(stableJson(packetIdentityPayload(packet))).digest("hex").slice(0, 24);
|
|
291
|
+
return `rppkt_${hash}`;
|
|
292
|
+
}
|
|
293
|
+
function withPacketIdentity(packet) {
|
|
294
|
+
return {
|
|
295
|
+
...packet,
|
|
296
|
+
packet_id: checkpointPacketIdentity(packet)
|
|
297
|
+
};
|
|
298
|
+
}
|
|
279
299
|
function artifactsFromState(state) {
|
|
280
300
|
const artifacts = [];
|
|
281
301
|
for (const role of ["before", "prod", "after"]) {
|
|
@@ -348,7 +368,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
348
368
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
349
369
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
|
|
350
370
|
const kind = packetKindForStage(stage, checkpoint);
|
|
351
|
-
return {
|
|
371
|
+
return withPacketIdentity({
|
|
352
372
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
353
373
|
run_id: runId,
|
|
354
374
|
state_path: input.runState.state_path,
|
|
@@ -397,7 +417,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
397
417
|
stage
|
|
398
418
|
}),
|
|
399
419
|
created_at: input.created_at || timestamp()
|
|
400
|
-
};
|
|
420
|
+
});
|
|
401
421
|
}
|
|
402
422
|
function buildAuthorCheckpointPacket(input) {
|
|
403
423
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
|
|
@@ -410,7 +430,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
410
430
|
const reconResults = recordValue(fullState.recon_results);
|
|
411
431
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
412
432
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.author_summary) || "Author checkpoint needs a supervising proof packet.";
|
|
413
|
-
return {
|
|
433
|
+
return withPacketIdentity({
|
|
414
434
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
415
435
|
run_id: runId,
|
|
416
436
|
state_path: input.runState.state_path,
|
|
@@ -459,7 +479,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
459
479
|
stage
|
|
460
480
|
}),
|
|
461
481
|
created_at: input.created_at || timestamp()
|
|
462
|
-
};
|
|
482
|
+
});
|
|
463
483
|
}
|
|
464
484
|
function visualDeltaFromState(fullState) {
|
|
465
485
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -530,7 +550,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
530
550
|
const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
|
|
531
551
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
|
|
532
552
|
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.";
|
|
533
|
-
return {
|
|
553
|
+
return withPacketIdentity({
|
|
534
554
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
535
555
|
run_id: runId,
|
|
536
556
|
state_path: input.runState.state_path,
|
|
@@ -590,7 +610,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
590
610
|
stage
|
|
591
611
|
}),
|
|
592
612
|
created_at: input.created_at || timestamp()
|
|
593
|
-
};
|
|
613
|
+
});
|
|
594
614
|
}
|
|
595
615
|
function buildCheckpointPacketForEngineResult(input) {
|
|
596
616
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
|
|
@@ -619,6 +639,7 @@ function normalizeCheckpointResponse(value) {
|
|
|
619
639
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
620
640
|
run_id: runId,
|
|
621
641
|
checkpoint,
|
|
642
|
+
packet_id: nonEmptyString(record.packet_id),
|
|
622
643
|
resume_token: nonEmptyString(record.resume_token),
|
|
623
644
|
decision,
|
|
624
645
|
summary,
|
|
@@ -706,6 +727,7 @@ function createCheckpointResponseTemplate(packet, input = {}) {
|
|
|
706
727
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
707
728
|
run_id: packet.run_id,
|
|
708
729
|
checkpoint: packet.checkpoint,
|
|
730
|
+
packet_id: packet.packet_id,
|
|
709
731
|
resume_token: packet.resume_token,
|
|
710
732
|
decision,
|
|
711
733
|
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
@@ -739,6 +761,9 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
739
761
|
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
740
762
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
741
763
|
const latestResponse = latestResponseEntry?.response;
|
|
764
|
+
const latestPacketId = latestPacket?.packet_id || null;
|
|
765
|
+
const latestResponsePacketId = latestResponse?.packet_id || null;
|
|
766
|
+
const packetIdMatches = !latestResponse ? null : latestPacketId && latestResponsePacketId ? latestPacketId === latestResponsePacketId : latestPacketId || latestResponsePacketId ? false : null;
|
|
742
767
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
743
768
|
const latestResponseToken = latestResponse?.resume_token || null;
|
|
744
769
|
const tokenMatches = !latestResponse ? null : latestResumeToken && latestResponseToken ? latestResumeToken === latestResponseToken : latestResumeToken || latestResponseToken ? false : null;
|
|
@@ -753,6 +778,9 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
753
778
|
latest_decision: latestResponse?.decision || null,
|
|
754
779
|
latest_packet_summary: latestPacket?.summary || null,
|
|
755
780
|
latest_response_summary: latestResponse?.summary || null,
|
|
781
|
+
latest_packet_id: latestPacketId,
|
|
782
|
+
latest_response_packet_id: latestResponsePacketId,
|
|
783
|
+
packet_id_matches: packetIdMatches,
|
|
756
784
|
latest_resume_token: latestResumeToken,
|
|
757
785
|
latest_response_token: latestResponseToken,
|
|
758
786
|
token_matches: tokenMatches,
|
|
@@ -769,6 +797,7 @@ function checkpointResponseIdentity(response) {
|
|
|
769
797
|
const logicalResponse = compactRecord({
|
|
770
798
|
run_id: response.run_id,
|
|
771
799
|
checkpoint: response.checkpoint,
|
|
800
|
+
packet_id: response.packet_id,
|
|
772
801
|
resume_token: response.resume_token,
|
|
773
802
|
decision: response.decision,
|
|
774
803
|
summary: response.summary,
|
|
@@ -830,6 +859,7 @@ function proofContractFromAuthorCheckpointResponse(response, packet, payload) {
|
|
|
830
859
|
buildCheckpointPacketForEngineResult,
|
|
831
860
|
buildProofAssessmentCheckpointPacket,
|
|
832
861
|
buildStageCheckpointPacket,
|
|
862
|
+
checkpointPacketIdentity,
|
|
833
863
|
checkpointResponseIdentity,
|
|
834
864
|
checkpointSummaryFromState,
|
|
835
865
|
createCheckpointResponseTemplate,
|
package/dist/checkpoint.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ 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 checkpointPacketIdentity(packet: RiddleProofCheckpointPacket): string;
|
|
6
7
|
declare function buildStageCheckpointPacket(input: {
|
|
7
8
|
request: RiddleProofRunParams;
|
|
8
9
|
runState: RiddleProofRunState;
|
|
@@ -76,4 +77,4 @@ declare function checkpointResponseIdentity(response: RiddleProofCheckpointRespo
|
|
|
76
77
|
declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
|
|
77
78
|
declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
|
|
78
79
|
|
|
79
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
|
80
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
package/dist/checkpoint.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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 checkpointPacketIdentity(packet: RiddleProofCheckpointPacket): string;
|
|
6
7
|
declare function buildStageCheckpointPacket(input: {
|
|
7
8
|
request: RiddleProofRunParams;
|
|
8
9
|
runState: RiddleProofRunState;
|
|
@@ -76,4 +77,4 @@ declare function checkpointResponseIdentity(response: RiddleProofCheckpointRespo
|
|
|
76
77
|
declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
|
|
77
78
|
declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
|
|
78
79
|
|
|
79
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
|
80
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
package/dist/checkpoint.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
buildCheckpointPacketForEngineResult,
|
|
7
7
|
buildProofAssessmentCheckpointPacket,
|
|
8
8
|
buildStageCheckpointPacket,
|
|
9
|
+
checkpointPacketIdentity,
|
|
9
10
|
checkpointResponseIdentity,
|
|
10
11
|
checkpointSummaryFromState,
|
|
11
12
|
createCheckpointResponseTemplate,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
normalizeCheckpointResponse,
|
|
14
15
|
proofContractFromAuthorCheckpointResponse,
|
|
15
16
|
statePathsForRunState
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BLM5EIBA.js";
|
|
17
18
|
import "./chunk-VY4Y5U57.js";
|
|
18
19
|
import "./chunk-MLKGABMK.js";
|
|
19
20
|
export {
|
|
@@ -24,6 +25,7 @@ export {
|
|
|
24
25
|
buildCheckpointPacketForEngineResult,
|
|
25
26
|
buildProofAssessmentCheckpointPacket,
|
|
26
27
|
buildStageCheckpointPacket,
|
|
28
|
+
checkpointPacketIdentity,
|
|
27
29
|
checkpointResponseIdentity,
|
|
28
30
|
checkpointSummaryFromState,
|
|
29
31
|
createCheckpointResponseTemplate,
|
|
@@ -51,12 +51,13 @@ function statePathsForRunState(state, engineStatePath) {
|
|
|
51
51
|
function responseSchemaForAuthorPacket() {
|
|
52
52
|
return {
|
|
53
53
|
type: "object",
|
|
54
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "payload", "created_at"],
|
|
54
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "payload", "created_at"],
|
|
55
55
|
additionalProperties: false,
|
|
56
56
|
properties: {
|
|
57
57
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
58
58
|
run_id: { type: "string" },
|
|
59
59
|
checkpoint: { type: "string" },
|
|
60
|
+
packet_id: { type: "string" },
|
|
60
61
|
resume_token: { type: "string" },
|
|
61
62
|
decision: {
|
|
62
63
|
type: "string",
|
|
@@ -84,12 +85,13 @@ function responseSchemaForAuthorPacket() {
|
|
|
84
85
|
function responseSchemaForProofAssessmentPacket() {
|
|
85
86
|
return {
|
|
86
87
|
type: "object",
|
|
87
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
88
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
88
89
|
additionalProperties: false,
|
|
89
90
|
properties: {
|
|
90
91
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
91
92
|
run_id: { type: "string" },
|
|
92
93
|
checkpoint: { type: "string" },
|
|
94
|
+
packet_id: { type: "string" },
|
|
93
95
|
resume_token: { type: "string" },
|
|
94
96
|
decision: {
|
|
95
97
|
type: "string",
|
|
@@ -125,12 +127,13 @@ function responseSchemaForProofAssessmentPacket() {
|
|
|
125
127
|
function responseSchemaForReconPacket() {
|
|
126
128
|
return {
|
|
127
129
|
type: "object",
|
|
128
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
130
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
129
131
|
additionalProperties: false,
|
|
130
132
|
properties: {
|
|
131
133
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
132
134
|
run_id: { type: "string" },
|
|
133
135
|
checkpoint: { type: "string" },
|
|
136
|
+
packet_id: { type: "string" },
|
|
134
137
|
resume_token: { type: "string" },
|
|
135
138
|
decision: {
|
|
136
139
|
type: "string",
|
|
@@ -158,12 +161,13 @@ function responseSchemaForReconPacket() {
|
|
|
158
161
|
function responseSchemaForImplementationPacket() {
|
|
159
162
|
return {
|
|
160
163
|
type: "object",
|
|
161
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
164
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
162
165
|
additionalProperties: false,
|
|
163
166
|
properties: {
|
|
164
167
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
165
168
|
run_id: { type: "string" },
|
|
166
169
|
checkpoint: { type: "string" },
|
|
170
|
+
packet_id: { type: "string" },
|
|
167
171
|
resume_token: { type: "string" },
|
|
168
172
|
decision: {
|
|
169
173
|
type: "string",
|
|
@@ -191,12 +195,13 @@ function responseSchemaForImplementationPacket() {
|
|
|
191
195
|
function responseSchemaForAdvancePacket(stage) {
|
|
192
196
|
return {
|
|
193
197
|
type: "object",
|
|
194
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
198
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
195
199
|
additionalProperties: false,
|
|
196
200
|
properties: {
|
|
197
201
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
198
202
|
run_id: { type: "string" },
|
|
199
203
|
checkpoint: { type: "string" },
|
|
204
|
+
packet_id: { type: "string" },
|
|
200
205
|
resume_token: { type: "string" },
|
|
201
206
|
decision: {
|
|
202
207
|
type: "string",
|
|
@@ -222,6 +227,20 @@ function resumeTokenFor(input) {
|
|
|
222
227
|
const hash = crypto.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
223
228
|
return `rpchk_${hash}`;
|
|
224
229
|
}
|
|
230
|
+
function packetIdentityPayload(packet) {
|
|
231
|
+
const { packet_id: _packetId, ...identityPayload } = packet;
|
|
232
|
+
return identityPayload;
|
|
233
|
+
}
|
|
234
|
+
function checkpointPacketIdentity(packet) {
|
|
235
|
+
const hash = crypto.createHash("sha256").update(stableJson(packetIdentityPayload(packet))).digest("hex").slice(0, 24);
|
|
236
|
+
return `rppkt_${hash}`;
|
|
237
|
+
}
|
|
238
|
+
function withPacketIdentity(packet) {
|
|
239
|
+
return {
|
|
240
|
+
...packet,
|
|
241
|
+
packet_id: checkpointPacketIdentity(packet)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
225
244
|
function artifactsFromState(state) {
|
|
226
245
|
const artifacts = [];
|
|
227
246
|
for (const role of ["before", "prod", "after"]) {
|
|
@@ -294,7 +313,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
294
313
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
295
314
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
|
|
296
315
|
const kind = packetKindForStage(stage, checkpoint);
|
|
297
|
-
return {
|
|
316
|
+
return withPacketIdentity({
|
|
298
317
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
299
318
|
run_id: runId,
|
|
300
319
|
state_path: input.runState.state_path,
|
|
@@ -343,7 +362,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
343
362
|
stage
|
|
344
363
|
}),
|
|
345
364
|
created_at: input.created_at || timestamp()
|
|
346
|
-
};
|
|
365
|
+
});
|
|
347
366
|
}
|
|
348
367
|
function buildAuthorCheckpointPacket(input) {
|
|
349
368
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
|
|
@@ -356,7 +375,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
356
375
|
const reconResults = recordValue(fullState.recon_results);
|
|
357
376
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
358
377
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.author_summary) || "Author checkpoint needs a supervising proof packet.";
|
|
359
|
-
return {
|
|
378
|
+
return withPacketIdentity({
|
|
360
379
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
361
380
|
run_id: runId,
|
|
362
381
|
state_path: input.runState.state_path,
|
|
@@ -405,7 +424,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
405
424
|
stage
|
|
406
425
|
}),
|
|
407
426
|
created_at: input.created_at || timestamp()
|
|
408
|
-
};
|
|
427
|
+
});
|
|
409
428
|
}
|
|
410
429
|
function visualDeltaFromState(fullState) {
|
|
411
430
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -476,7 +495,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
476
495
|
const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
|
|
477
496
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
|
|
478
497
|
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.";
|
|
479
|
-
return {
|
|
498
|
+
return withPacketIdentity({
|
|
480
499
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
481
500
|
run_id: runId,
|
|
482
501
|
state_path: input.runState.state_path,
|
|
@@ -536,7 +555,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
536
555
|
stage
|
|
537
556
|
}),
|
|
538
557
|
created_at: input.created_at || timestamp()
|
|
539
|
-
};
|
|
558
|
+
});
|
|
540
559
|
}
|
|
541
560
|
function buildCheckpointPacketForEngineResult(input) {
|
|
542
561
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
|
|
@@ -565,6 +584,7 @@ function normalizeCheckpointResponse(value) {
|
|
|
565
584
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
566
585
|
run_id: runId,
|
|
567
586
|
checkpoint,
|
|
587
|
+
packet_id: nonEmptyString(record.packet_id),
|
|
568
588
|
resume_token: nonEmptyString(record.resume_token),
|
|
569
589
|
decision,
|
|
570
590
|
summary,
|
|
@@ -652,6 +672,7 @@ function createCheckpointResponseTemplate(packet, input = {}) {
|
|
|
652
672
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
653
673
|
run_id: packet.run_id,
|
|
654
674
|
checkpoint: packet.checkpoint,
|
|
675
|
+
packet_id: packet.packet_id,
|
|
655
676
|
resume_token: packet.resume_token,
|
|
656
677
|
decision,
|
|
657
678
|
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
@@ -685,6 +706,9 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
685
706
|
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
686
707
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
687
708
|
const latestResponse = latestResponseEntry?.response;
|
|
709
|
+
const latestPacketId = latestPacket?.packet_id || null;
|
|
710
|
+
const latestResponsePacketId = latestResponse?.packet_id || null;
|
|
711
|
+
const packetIdMatches = !latestResponse ? null : latestPacketId && latestResponsePacketId ? latestPacketId === latestResponsePacketId : latestPacketId || latestResponsePacketId ? false : null;
|
|
688
712
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
689
713
|
const latestResponseToken = latestResponse?.resume_token || null;
|
|
690
714
|
const tokenMatches = !latestResponse ? null : latestResumeToken && latestResponseToken ? latestResumeToken === latestResponseToken : latestResumeToken || latestResponseToken ? false : null;
|
|
@@ -699,6 +723,9 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
699
723
|
latest_decision: latestResponse?.decision || null,
|
|
700
724
|
latest_packet_summary: latestPacket?.summary || null,
|
|
701
725
|
latest_response_summary: latestResponse?.summary || null,
|
|
726
|
+
latest_packet_id: latestPacketId,
|
|
727
|
+
latest_response_packet_id: latestResponsePacketId,
|
|
728
|
+
packet_id_matches: packetIdMatches,
|
|
702
729
|
latest_resume_token: latestResumeToken,
|
|
703
730
|
latest_response_token: latestResponseToken,
|
|
704
731
|
token_matches: tokenMatches,
|
|
@@ -715,6 +742,7 @@ function checkpointResponseIdentity(response) {
|
|
|
715
742
|
const logicalResponse = compactRecord({
|
|
716
743
|
run_id: response.run_id,
|
|
717
744
|
checkpoint: response.checkpoint,
|
|
745
|
+
packet_id: response.packet_id,
|
|
718
746
|
resume_token: response.resume_token,
|
|
719
747
|
decision: response.decision,
|
|
720
748
|
summary: response.summary,
|
|
@@ -772,6 +800,7 @@ export {
|
|
|
772
800
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
773
801
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
774
802
|
statePathsForRunState,
|
|
803
|
+
checkpointPacketIdentity,
|
|
775
804
|
buildStageCheckpointPacket,
|
|
776
805
|
buildAuthorCheckpointPacket,
|
|
777
806
|
buildProofAssessmentCheckpointPacket,
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
createDisabledRiddleProofAgentAdapter,
|
|
29
29
|
readRiddleProofRunStatus,
|
|
30
30
|
runRiddleProofEngineHarness
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-IV4DVWPR.js";
|
|
32
32
|
import {
|
|
33
33
|
createCheckpointResponseTemplate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-BLM5EIBA.js";
|
|
35
35
|
import {
|
|
36
36
|
createCodexExecAgentAdapter,
|
|
37
37
|
runCodexExecAgentDoctor
|
|
@@ -1088,6 +1088,7 @@ function formatCheckpointMarkdown(input) {
|
|
|
1088
1088
|
`Status: ${input.status || "awaiting_checkpoint"}`,
|
|
1089
1089
|
`Stage: ${packet.stage}`,
|
|
1090
1090
|
`Checkpoint: ${packet.checkpoint}`,
|
|
1091
|
+
`Packet ID: ${packet.packet_id || "legacy"}`,
|
|
1091
1092
|
`Kind: ${packet.kind}`,
|
|
1092
1093
|
"",
|
|
1093
1094
|
"## Goal",
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
createRunStatusSnapshot,
|
|
6
6
|
normalizeRunParams,
|
|
7
7
|
setRunStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WDIKPIMB.js";
|
|
9
9
|
import {
|
|
10
10
|
createRiddleProofRunCard
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JJ4IWRMJ.js";
|
|
12
12
|
import {
|
|
13
13
|
canonicalProofAssessmentStageForDecision,
|
|
14
14
|
noImplementationModeFor,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
normalizeCheckpointResponse,
|
|
28
28
|
proofContractFromAuthorCheckpointResponse,
|
|
29
29
|
statePathsForRunState
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BLM5EIBA.js";
|
|
31
31
|
import {
|
|
32
32
|
applyTerminalMetadata,
|
|
33
33
|
compactRecord,
|
|
@@ -361,6 +361,32 @@ function isReadyShipGate(result) {
|
|
|
361
361
|
function proofAssessmentRequestsShip(payload) {
|
|
362
362
|
return String(payload.decision || "").trim() === "ready_to_ship";
|
|
363
363
|
}
|
|
364
|
+
var TRUSTED_PROOF_ASSESSMENT_READY_SOURCES = /* @__PURE__ */ new Set([
|
|
365
|
+
"supervising_agent",
|
|
366
|
+
"supervisor",
|
|
367
|
+
"openclaw_auto_ship_mode_none"
|
|
368
|
+
]);
|
|
369
|
+
function proofAssessmentSourceTrustedForShip(payload) {
|
|
370
|
+
const source = nonEmptyString(payload.source)?.toLowerCase();
|
|
371
|
+
if (!source) return true;
|
|
372
|
+
return TRUSTED_PROOF_ASSESSMENT_READY_SOURCES.has(source);
|
|
373
|
+
}
|
|
374
|
+
function proofAssessmentSourceBlocker(input) {
|
|
375
|
+
if (!proofAssessmentRequestsShip(input.payload)) return null;
|
|
376
|
+
if (proofAssessmentSourceTrustedForShip(input.payload)) return null;
|
|
377
|
+
const source = nonEmptyString(input.payload.source) || "unknown";
|
|
378
|
+
return {
|
|
379
|
+
code: input.code || "proof_assessment_source_not_trusted",
|
|
380
|
+
checkpoint: input.checkpoint || null,
|
|
381
|
+
message: `Riddle Proof cannot mark ready_to_ship from untrusted proof assessment source: ${source}.`,
|
|
382
|
+
details: compactRecord({
|
|
383
|
+
stage: input.stage || null,
|
|
384
|
+
proofAssessment: input.payload,
|
|
385
|
+
checkpoint_response_source: input.response?.source || null,
|
|
386
|
+
response: input.response || null
|
|
387
|
+
})
|
|
388
|
+
};
|
|
389
|
+
}
|
|
364
390
|
function proofAssessmentHardBlockers(state, payload) {
|
|
365
391
|
const blockers = proofAssessmentHardBlockersForState(state || {});
|
|
366
392
|
if (Array.isArray(payload.hard_blockers)) {
|
|
@@ -391,6 +417,15 @@ function stageFromCheckpointResponse(response, packet) {
|
|
|
391
417
|
const stage = response.continue_with_stage || nonEmptyString(payload.continue_with_stage) || nonEmptyString(payload.recommended_stage) || nonEmptyString(resume?.continue_with_stage) || (response.decision === "retry_stage" ? packet.stage : "");
|
|
392
418
|
return stage ? stage : null;
|
|
393
419
|
}
|
|
420
|
+
function proofAssessmentSourceFromCheckpointResponse(response) {
|
|
421
|
+
const kind = nonEmptyString(response.source?.kind)?.toLowerCase();
|
|
422
|
+
if (!kind) return "supervising_agent";
|
|
423
|
+
if (kind === "human") return "supervisor";
|
|
424
|
+
if (kind === "codex" || kind === "openclaw-main" || kind === "claude-code") {
|
|
425
|
+
return "supervising_agent";
|
|
426
|
+
}
|
|
427
|
+
return `checkpoint_response:${kind}`;
|
|
428
|
+
}
|
|
394
429
|
function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
395
430
|
if (![
|
|
396
431
|
"ready_to_ship",
|
|
@@ -411,7 +446,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
411
446
|
continue_with_stage: stage || void 0,
|
|
412
447
|
escalation_target: nonEmptyString(payload.escalation_target) || "agent",
|
|
413
448
|
reasons: Array.isArray(response.reasons) ? response.reasons : Array.isArray(payload.reasons) ? payload.reasons : [],
|
|
414
|
-
source:
|
|
449
|
+
source: proofAssessmentSourceFromCheckpointResponse(response),
|
|
415
450
|
checkpoint_response_source: response.source || null,
|
|
416
451
|
checkpoint_response_created_at: response.created_at
|
|
417
452
|
}));
|
|
@@ -738,6 +773,22 @@ function checkpointResponseContinuation(state, value) {
|
|
|
738
773
|
}
|
|
739
774
|
};
|
|
740
775
|
}
|
|
776
|
+
if (packet.packet_id && response.packet_id !== packet.packet_id) {
|
|
777
|
+
return {
|
|
778
|
+
blocker: {
|
|
779
|
+
code: "checkpoint_response_packet_id_mismatch",
|
|
780
|
+
checkpoint: packet.checkpoint,
|
|
781
|
+
message: "Checkpoint response packet_id does not match the pending checkpoint packet.",
|
|
782
|
+
details: {
|
|
783
|
+
stage: packet.stage,
|
|
784
|
+
expected_packet_id: packet.packet_id,
|
|
785
|
+
actual_packet_id: response.packet_id || null,
|
|
786
|
+
expected_resume_token: packet.resume_token || null,
|
|
787
|
+
actual_resume_token: response.resume_token || null
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
741
792
|
if (!packet.allowed_decisions.includes(response.decision)) {
|
|
742
793
|
return {
|
|
743
794
|
blocker: {
|
|
@@ -846,6 +897,14 @@ function checkpointResponseContinuation(state, value) {
|
|
|
846
897
|
if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
|
|
847
898
|
const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
|
|
848
899
|
if (assessment) {
|
|
900
|
+
const sourceBlocker = proofAssessmentSourceBlocker({
|
|
901
|
+
checkpoint: packet.checkpoint,
|
|
902
|
+
stage: packet.stage,
|
|
903
|
+
payload: assessment,
|
|
904
|
+
response,
|
|
905
|
+
code: "checkpoint_response_source_not_trusted"
|
|
906
|
+
});
|
|
907
|
+
if (sourceBlocker) return { blocker: sourceBlocker };
|
|
849
908
|
appendCheckpointResponse(state, response);
|
|
850
909
|
if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
|
|
851
910
|
const result = {
|
|
@@ -1404,6 +1463,25 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
1404
1463
|
}
|
|
1405
1464
|
};
|
|
1406
1465
|
}
|
|
1466
|
+
const sourceBlocker = proofAssessmentSourceBlocker({
|
|
1467
|
+
checkpoint,
|
|
1468
|
+
stage: "verify",
|
|
1469
|
+
payload,
|
|
1470
|
+
code: "proof_assessment_source_not_trusted"
|
|
1471
|
+
});
|
|
1472
|
+
if (sourceBlocker) {
|
|
1473
|
+
recordEvent(state, {
|
|
1474
|
+
kind: "agent.proof_assessment.source_blocked",
|
|
1475
|
+
checkpoint,
|
|
1476
|
+
stage: "verify",
|
|
1477
|
+
summary: sourceBlocker.message,
|
|
1478
|
+
details: compactRecord({
|
|
1479
|
+
proof_assessment: payload,
|
|
1480
|
+
agent_duration_ms: durationMs
|
|
1481
|
+
})
|
|
1482
|
+
});
|
|
1483
|
+
return { blocker: sourceBlocker };
|
|
1484
|
+
}
|
|
1407
1485
|
const visualBlocker = proofAssessmentVisualBlocker({
|
|
1408
1486
|
...context.fullRiddleState || {},
|
|
1409
1487
|
verification_mode: context.fullRiddleState?.verification_mode || request.verification_mode
|