@riddledc/riddle-proof 0.5.43 → 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.
- package/dist/checkpoint.cjs +163 -0
- package/dist/checkpoint.d.cts +29 -1
- package/dist/checkpoint.d.ts +29 -1
- package/dist/checkpoint.js +5 -1
- package/dist/{chunk-U4VNN2CT.js → chunk-4ASMX4R6.js} +26 -5
- package/dist/{chunk-VSLU6XNI.js → chunk-CHRYLX6N.js} +116 -12
- package/dist/{chunk-RI25RGQP.js → chunk-LXE5YUYY.js} +161 -0
- package/dist/engine-harness.cjs +298 -16
- package/dist/engine-harness.js +3 -3
- package/dist/index.cjs +302 -16
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -3
- package/dist/proof-run-core.cjs +26 -5
- package/dist/proof-run-core.js +1 -1
- package/dist/proof-run-engine.cjs +28 -7
- package/dist/proof-run-engine.js +3 -3
- package/dist/types.d.cts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -389,6 +389,21 @@ function visualDeltaShipGateReason(state = {}) {
|
|
|
389
389
|
if (reason) return `visual_delta.status=${status} blocks ready_to_ship for visual/UI proof: ${reason}`;
|
|
390
390
|
return `visual_delta.status=${status} blocks ready_to_ship for visual/UI proof`;
|
|
391
391
|
}
|
|
392
|
+
function visualDeltaEvidenceIssueCode(state = {}, blocker = "") {
|
|
393
|
+
const visualDelta = visualDeltaForState(state || {});
|
|
394
|
+
const status = String(visualDelta.status || "").trim();
|
|
395
|
+
const reason = `${String(visualDelta.reason || "")}
|
|
396
|
+
${blocker}`.toLowerCase();
|
|
397
|
+
if (status === "unmeasured") {
|
|
398
|
+
if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
|
|
399
|
+
return "comparator_fetch_blocked";
|
|
400
|
+
}
|
|
401
|
+
return "visual_delta_unmeasured";
|
|
402
|
+
}
|
|
403
|
+
if (status === "measured" && visualDelta.passed === false) return "semantic_proof_failed";
|
|
404
|
+
if (visualDeltaRequiredForState(state || {})) return "visual_delta_unmeasured";
|
|
405
|
+
return "semantic_proof_failed";
|
|
406
|
+
}
|
|
392
407
|
function requiredBaselineLabelsForState(state = {}) {
|
|
393
408
|
const reference = normalizedReference(state);
|
|
394
409
|
const labels = [];
|
|
@@ -613,9 +628,15 @@ function mergeStateFromParams(statePath, params) {
|
|
|
613
628
|
const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
|
|
614
629
|
if (readyBlocker) {
|
|
615
630
|
assessment.blocked_decision = assessment.decision;
|
|
616
|
-
assessment.decision = "
|
|
617
|
-
|
|
618
|
-
|
|
631
|
+
assessment.decision = "revise_capture";
|
|
632
|
+
assessment.recommended_stage = "verify";
|
|
633
|
+
assessment.continue_with_stage = "verify";
|
|
634
|
+
assessment.evidence_collection_incomplete = true;
|
|
635
|
+
assessment.recovery_stage = "verify";
|
|
636
|
+
assessment.recovery_reason = readyBlocker;
|
|
637
|
+
assessment.evidence_issue_code = visualDeltaEvidenceIssueCode(state, readyBlocker);
|
|
638
|
+
assessment.visual_delta = visualDeltaForState(state);
|
|
639
|
+
assessment.suggested_repair = "Keep the same Riddle Proof run in evidence/comparison recovery: repair or retry the visual comparator/fetch path, wait for artifact readiness if applicable, or produce a measured visual_delta artifact before proof review can mark ready_to_ship.";
|
|
619
640
|
const blockers = Array.isArray(assessment.blockers) ? assessment.blockers : [];
|
|
620
641
|
assessment.blockers = [...blockers, readyBlocker];
|
|
621
642
|
}
|
|
@@ -634,7 +655,7 @@ function mergeStateFromParams(statePath, params) {
|
|
|
634
655
|
}
|
|
635
656
|
appendProofSummaryLine(state, `Supervising proof assessment: ${state.proof_assessment.decision || "unknown"}`);
|
|
636
657
|
if (readyBlocker) {
|
|
637
|
-
appendProofSummaryLine(state, `Ready-to-ship assessment
|
|
658
|
+
appendProofSummaryLine(state, `Ready-to-ship assessment routed to evidence recovery: ${readyBlocker}`);
|
|
638
659
|
}
|
|
639
660
|
if (state.proof_assessment_summary) {
|
|
640
661
|
appendProofSummaryLine(state, `Assessment summary: ${state.proof_assessment_summary}`);
|
|
@@ -908,7 +929,7 @@ var init_proof_run_core = __esm({
|
|
|
908
929
|
description: "JSON assessment with decision, summary, recommended_stage, continue_with_stage, escalation_target, and reasons."
|
|
909
930
|
}],
|
|
910
931
|
response_schema: {
|
|
911
|
-
decision: ["ready_to_ship", "needs_richer_proof"],
|
|
932
|
+
decision: ["ready_to_ship", "needs_richer_proof", "revise_capture"],
|
|
912
933
|
summary: "string",
|
|
913
934
|
recommended_stage: ["ship", "author", "implement", "recon", "verify"],
|
|
914
935
|
continue_with_stage: ["ship", "author", "implement", "recon", "verify"],
|
|
@@ -1713,10 +1734,10 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
1713
1734
|
const primaryShipGateNextAction = (shipGate) => {
|
|
1714
1735
|
const reasons = shipGate.reasons || [];
|
|
1715
1736
|
if (reasons.some((reason) => reason.includes("proof_assessment"))) {
|
|
1716
|
-
return "resume with riddle_proof_review using decision=ready_to_ship only after
|
|
1737
|
+
return "resume with riddle_proof_review using decision=ready_to_ship only after screenshots, semantic evidence, and required comparison metrics prove the request; otherwise choose needs_implementation, revise_capture, or needs_richer_proof for the specific missing stage";
|
|
1717
1738
|
}
|
|
1718
1739
|
if (reasons.some((reason) => reason.includes("visual_delta"))) {
|
|
1719
|
-
return "
|
|
1740
|
+
return "keep the run in verify/evidence recovery until a measured before/after visual_delta exists; choose revise_capture rather than ready_to_ship or generic needs_richer_proof for this visual proof";
|
|
1720
1741
|
}
|
|
1721
1742
|
if (reasons.some((reason) => reason.includes("after_cdn") || reason.includes("verify_status"))) {
|
|
1722
1743
|
return "rerun verify with stronger proof framing so after evidence is captured before shipping";
|
|
@@ -2751,6 +2772,8 @@ __export(index_exports, {
|
|
|
2751
2772
|
assessPlayabilityEvidence: () => assessPlayabilityEvidence,
|
|
2752
2773
|
authorPacketPayloadFromCheckpointResponse: () => authorPacketPayloadFromCheckpointResponse,
|
|
2753
2774
|
buildAuthorCheckpointPacket: () => buildAuthorCheckpointPacket,
|
|
2775
|
+
buildCheckpointPacketForEngineResult: () => buildCheckpointPacketForEngineResult,
|
|
2776
|
+
buildProofAssessmentCheckpointPacket: () => buildProofAssessmentCheckpointPacket,
|
|
2754
2777
|
buildVisualProofSession: () => buildVisualProofSession,
|
|
2755
2778
|
checkpointResponseIdentity: () => checkpointResponseIdentity,
|
|
2756
2779
|
checkpointSummaryFromState: () => checkpointSummaryFromState,
|
|
@@ -3309,6 +3332,47 @@ function responseSchemaForAuthorPacket() {
|
|
|
3309
3332
|
}
|
|
3310
3333
|
};
|
|
3311
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
|
+
}
|
|
3312
3376
|
function resumeTokenFor(input) {
|
|
3313
3377
|
const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
3314
3378
|
return `rpchk_${hash}`;
|
|
@@ -3392,6 +3456,124 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
3392
3456
|
created_at: input.created_at || timestamp2()
|
|
3393
3457
|
};
|
|
3394
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
|
+
}
|
|
3395
3577
|
function normalizeCheckpointResponse(value) {
|
|
3396
3578
|
const record = recordValue(value);
|
|
3397
3579
|
if (!record) return null;
|
|
@@ -4261,6 +4443,39 @@ function proofAssessmentContinuation(result, payload) {
|
|
|
4261
4443
|
const proof_assessment_json = jsonParam(payload);
|
|
4262
4444
|
return { ...baseContinuation(result), proof_assessment_json };
|
|
4263
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
|
+
}
|
|
4264
4479
|
function proofAssessmentVisualBlocker(state, payload) {
|
|
4265
4480
|
if (!proofAssessmentRequestsShip(payload)) return null;
|
|
4266
4481
|
const source = nonEmptyString(payload.source) || "supervising_agent";
|
|
@@ -4270,14 +4485,36 @@ function proofAssessmentVisualBlocker(state, payload) {
|
|
|
4270
4485
|
proof_assessment_source: source
|
|
4271
4486
|
});
|
|
4272
4487
|
}
|
|
4273
|
-
function
|
|
4488
|
+
function visualDeltaBlockerCode(state, blocker) {
|
|
4489
|
+
const visualDelta = visualDeltaForState(state || {});
|
|
4490
|
+
const status = nonEmptyString(visualDelta.status);
|
|
4491
|
+
const reason = `${nonEmptyString(visualDelta.reason) || ""}
|
|
4492
|
+
${blocker}`.toLowerCase();
|
|
4493
|
+
if (status === "unmeasured") {
|
|
4494
|
+
if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
|
|
4495
|
+
return "comparator_fetch_blocked";
|
|
4496
|
+
}
|
|
4497
|
+
return "visual_delta_unmeasured";
|
|
4498
|
+
}
|
|
4499
|
+
if (status === "measured" && visualDelta.passed === false) return "semantic_proof_failed";
|
|
4500
|
+
if (visualDeltaRequiredForState(state || {})) return "visual_delta_unmeasured";
|
|
4501
|
+
return "semantic_proof_failed";
|
|
4502
|
+
}
|
|
4503
|
+
function visualDeltaEvidenceRecoveryAssessment(state, payload, blocker) {
|
|
4504
|
+
const visualDelta = visualDeltaForState(state || {});
|
|
4274
4505
|
const blockers = Array.isArray(payload.blockers) ? payload.blockers.filter((item) => typeof item === "string") : [];
|
|
4275
4506
|
return {
|
|
4276
4507
|
...payload,
|
|
4277
4508
|
blocked_decision: payload.decision || "ready_to_ship",
|
|
4278
|
-
decision: "
|
|
4279
|
-
recommended_stage:
|
|
4280
|
-
continue_with_stage:
|
|
4509
|
+
decision: "revise_capture",
|
|
4510
|
+
recommended_stage: "verify",
|
|
4511
|
+
continue_with_stage: "verify",
|
|
4512
|
+
evidence_collection_incomplete: true,
|
|
4513
|
+
recovery_stage: "verify",
|
|
4514
|
+
recovery_reason: blocker,
|
|
4515
|
+
evidence_issue_code: visualDeltaBlockerCode(state, blocker),
|
|
4516
|
+
visual_delta: Object.keys(visualDelta).length ? visualDelta : null,
|
|
4517
|
+
suggested_repair: "Keep the same Riddle Proof run in evidence/comparison recovery: repair or retry the visual comparator/fetch path, wait for artifact readiness if applicable, or produce a measured visual_delta artifact before proof review can mark ready_to_ship.",
|
|
4281
4518
|
blockers: [...blockers, blocker]
|
|
4282
4519
|
};
|
|
4283
4520
|
}
|
|
@@ -4377,7 +4614,7 @@ function blockerResult(state, result, blocker) {
|
|
|
4377
4614
|
});
|
|
4378
4615
|
}
|
|
4379
4616
|
function checkpointAwaitingResult(state, result, visibility) {
|
|
4380
|
-
const packet =
|
|
4617
|
+
const packet = buildCheckpointPacketForEngineResult({
|
|
4381
4618
|
request: state.request,
|
|
4382
4619
|
runState: state,
|
|
4383
4620
|
engineResult: result,
|
|
@@ -4542,8 +4779,30 @@ function checkpointResponseContinuation(state, value) {
|
|
|
4542
4779
|
}
|
|
4543
4780
|
if (response.decision === "needs_recon") {
|
|
4544
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
|
+
}
|
|
4545
4786
|
return { next: { ...base, advance_stage: "recon" } };
|
|
4546
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
|
+
}
|
|
4547
4806
|
appendCheckpointResponse(state, response, { clear_packet: false });
|
|
4548
4807
|
return {
|
|
4549
4808
|
blocker: {
|
|
@@ -4826,9 +5085,24 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
4826
5085
|
return { next: { action: "run", state_path: String(result.state_path || ""), advance_stage: "verify" } };
|
|
4827
5086
|
}
|
|
4828
5087
|
if (checkpoint === "verify_supervisor_judgment") {
|
|
5088
|
+
if (input.checkpoint_mode === "yield") {
|
|
5089
|
+
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5090
|
+
}
|
|
4829
5091
|
const assessment = await agent.assessProof(context);
|
|
4830
5092
|
const blocker = requirePayload("proof_assessment", assessment, state, result);
|
|
4831
|
-
if (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
|
+
}
|
|
4832
5106
|
const payload = assessment.payload;
|
|
4833
5107
|
recordEvent(state, {
|
|
4834
5108
|
kind: "agent.proof_assessment.completed",
|
|
@@ -4842,14 +5116,24 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
4842
5116
|
verification_mode: context.fullRiddleState?.verification_mode || request.verification_mode
|
|
4843
5117
|
}, payload);
|
|
4844
5118
|
if (visualBlocker) {
|
|
5119
|
+
const recoveryAssessment = visualDeltaEvidenceRecoveryAssessment({
|
|
5120
|
+
...context.fullRiddleState || {},
|
|
5121
|
+
verification_mode: context.fullRiddleState?.verification_mode || request.verification_mode
|
|
5122
|
+
}, payload, visualBlocker);
|
|
4845
5123
|
recordEvent(state, {
|
|
4846
|
-
kind: "agent.proof_assessment.
|
|
5124
|
+
kind: "agent.proof_assessment.evidence_recovery_required",
|
|
4847
5125
|
checkpoint,
|
|
4848
5126
|
stage: "verify",
|
|
4849
5127
|
summary: visualBlocker,
|
|
4850
|
-
details: {
|
|
5128
|
+
details: compactRecord({
|
|
5129
|
+
evidence_collection_incomplete: true,
|
|
5130
|
+
recovery_stage: "verify",
|
|
5131
|
+
evidence_issue_code: recoveryAssessment.evidence_issue_code || null,
|
|
5132
|
+
visual_delta: recoveryAssessment.visual_delta || null,
|
|
5133
|
+
proof_assessment: recoveryAssessment
|
|
5134
|
+
})
|
|
4851
5135
|
});
|
|
4852
|
-
return { next: proofAssessmentContinuation(result,
|
|
5136
|
+
return { next: proofAssessmentContinuation(result, recoveryAssessment) };
|
|
4853
5137
|
}
|
|
4854
5138
|
if (effectiveShipMode(request, input.config) !== "ship" && proofAssessmentRequestsShip(payload)) {
|
|
4855
5139
|
return {
|
|
@@ -5702,6 +5986,8 @@ function parseJson(value) {
|
|
|
5702
5986
|
assessPlayabilityEvidence,
|
|
5703
5987
|
authorPacketPayloadFromCheckpointResponse,
|
|
5704
5988
|
buildAuthorCheckpointPacket,
|
|
5989
|
+
buildCheckpointPacketForEngineResult,
|
|
5990
|
+
buildProofAssessmentCheckpointPacket,
|
|
5705
5991
|
buildVisualProofSession,
|
|
5706
5992
|
checkpointResponseIdentity,
|
|
5707
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-
|
|
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-
|
|
42
|
+
} from "./chunk-LXE5YUYY.js";
|
|
41
43
|
import {
|
|
42
44
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
43
45
|
appendRunEvent,
|
|
@@ -67,7 +69,7 @@ import {
|
|
|
67
69
|
extractPlayabilityEvidence,
|
|
68
70
|
isRiddleProofPlayabilityMode
|
|
69
71
|
} from "./chunk-NSWT3VSV.js";
|
|
70
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-4ASMX4R6.js";
|
|
71
73
|
export {
|
|
72
74
|
DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
|
|
73
75
|
DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
|
|
@@ -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/proof-run-core.cjs
CHANGED
|
@@ -440,6 +440,21 @@ function visualDeltaShipGateReason(state = {}) {
|
|
|
440
440
|
if (reason) return `visual_delta.status=${status} blocks ready_to_ship for visual/UI proof: ${reason}`;
|
|
441
441
|
return `visual_delta.status=${status} blocks ready_to_ship for visual/UI proof`;
|
|
442
442
|
}
|
|
443
|
+
function visualDeltaEvidenceIssueCode(state = {}, blocker = "") {
|
|
444
|
+
const visualDelta = visualDeltaForState(state || {});
|
|
445
|
+
const status = String(visualDelta.status || "").trim();
|
|
446
|
+
const reason = `${String(visualDelta.reason || "")}
|
|
447
|
+
${blocker}`.toLowerCase();
|
|
448
|
+
if (status === "unmeasured") {
|
|
449
|
+
if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
|
|
450
|
+
return "comparator_fetch_blocked";
|
|
451
|
+
}
|
|
452
|
+
return "visual_delta_unmeasured";
|
|
453
|
+
}
|
|
454
|
+
if (status === "measured" && visualDelta.passed === false) return "semantic_proof_failed";
|
|
455
|
+
if (visualDeltaRequiredForState(state || {})) return "visual_delta_unmeasured";
|
|
456
|
+
return "semantic_proof_failed";
|
|
457
|
+
}
|
|
443
458
|
function requiredBaselineLabelsForState(state = {}) {
|
|
444
459
|
const reference = normalizedReference(state);
|
|
445
460
|
const labels = [];
|
|
@@ -629,7 +644,7 @@ var CHECKPOINT_CONTRACT_SPECS = {
|
|
|
629
644
|
description: "JSON assessment with decision, summary, recommended_stage, continue_with_stage, escalation_target, and reasons."
|
|
630
645
|
}],
|
|
631
646
|
response_schema: {
|
|
632
|
-
decision: ["ready_to_ship", "needs_richer_proof"],
|
|
647
|
+
decision: ["ready_to_ship", "needs_richer_proof", "revise_capture"],
|
|
633
648
|
summary: "string",
|
|
634
649
|
recommended_stage: ["ship", "author", "implement", "recon", "verify"],
|
|
635
650
|
continue_with_stage: ["ship", "author", "implement", "recon", "verify"],
|
|
@@ -832,9 +847,15 @@ function mergeStateFromParams(statePath, params) {
|
|
|
832
847
|
const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
|
|
833
848
|
if (readyBlocker) {
|
|
834
849
|
assessment.blocked_decision = assessment.decision;
|
|
835
|
-
assessment.decision = "
|
|
836
|
-
|
|
837
|
-
|
|
850
|
+
assessment.decision = "revise_capture";
|
|
851
|
+
assessment.recommended_stage = "verify";
|
|
852
|
+
assessment.continue_with_stage = "verify";
|
|
853
|
+
assessment.evidence_collection_incomplete = true;
|
|
854
|
+
assessment.recovery_stage = "verify";
|
|
855
|
+
assessment.recovery_reason = readyBlocker;
|
|
856
|
+
assessment.evidence_issue_code = visualDeltaEvidenceIssueCode(state, readyBlocker);
|
|
857
|
+
assessment.visual_delta = visualDeltaForState(state);
|
|
858
|
+
assessment.suggested_repair = "Keep the same Riddle Proof run in evidence/comparison recovery: repair or retry the visual comparator/fetch path, wait for artifact readiness if applicable, or produce a measured visual_delta artifact before proof review can mark ready_to_ship.";
|
|
838
859
|
const blockers = Array.isArray(assessment.blockers) ? assessment.blockers : [];
|
|
839
860
|
assessment.blockers = [...blockers, readyBlocker];
|
|
840
861
|
}
|
|
@@ -853,7 +874,7 @@ function mergeStateFromParams(statePath, params) {
|
|
|
853
874
|
}
|
|
854
875
|
appendProofSummaryLine(state, `Supervising proof assessment: ${state.proof_assessment.decision || "unknown"}`);
|
|
855
876
|
if (readyBlocker) {
|
|
856
|
-
appendProofSummaryLine(state, `Ready-to-ship assessment
|
|
877
|
+
appendProofSummaryLine(state, `Ready-to-ship assessment routed to evidence recovery: ${readyBlocker}`);
|
|
857
878
|
}
|
|
858
879
|
if (state.proof_assessment_summary) {
|
|
859
880
|
appendProofSummaryLine(state, `Assessment summary: ${state.proof_assessment_summary}`);
|
package/dist/proof-run-core.js
CHANGED
|
@@ -422,6 +422,21 @@ function visualDeltaShipGateReason(state = {}) {
|
|
|
422
422
|
if (reason) return `visual_delta.status=${status} blocks ready_to_ship for visual/UI proof: ${reason}`;
|
|
423
423
|
return `visual_delta.status=${status} blocks ready_to_ship for visual/UI proof`;
|
|
424
424
|
}
|
|
425
|
+
function visualDeltaEvidenceIssueCode(state = {}, blocker = "") {
|
|
426
|
+
const visualDelta = visualDeltaForState(state || {});
|
|
427
|
+
const status = String(visualDelta.status || "").trim();
|
|
428
|
+
const reason = `${String(visualDelta.reason || "")}
|
|
429
|
+
${blocker}`.toLowerCase();
|
|
430
|
+
if (status === "unmeasured") {
|
|
431
|
+
if (reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator")) {
|
|
432
|
+
return "comparator_fetch_blocked";
|
|
433
|
+
}
|
|
434
|
+
return "visual_delta_unmeasured";
|
|
435
|
+
}
|
|
436
|
+
if (status === "measured" && visualDelta.passed === false) return "semantic_proof_failed";
|
|
437
|
+
if (visualDeltaRequiredForState(state || {})) return "visual_delta_unmeasured";
|
|
438
|
+
return "semantic_proof_failed";
|
|
439
|
+
}
|
|
425
440
|
function requiredBaselineLabelsForState(state = {}) {
|
|
426
441
|
const reference = normalizedReference(state);
|
|
427
442
|
const labels = [];
|
|
@@ -611,7 +626,7 @@ var CHECKPOINT_CONTRACT_SPECS = {
|
|
|
611
626
|
description: "JSON assessment with decision, summary, recommended_stage, continue_with_stage, escalation_target, and reasons."
|
|
612
627
|
}],
|
|
613
628
|
response_schema: {
|
|
614
|
-
decision: ["ready_to_ship", "needs_richer_proof"],
|
|
629
|
+
decision: ["ready_to_ship", "needs_richer_proof", "revise_capture"],
|
|
615
630
|
summary: "string",
|
|
616
631
|
recommended_stage: ["ship", "author", "implement", "recon", "verify"],
|
|
617
632
|
continue_with_stage: ["ship", "author", "implement", "recon", "verify"],
|
|
@@ -814,9 +829,15 @@ function mergeStateFromParams(statePath, params) {
|
|
|
814
829
|
const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
|
|
815
830
|
if (readyBlocker) {
|
|
816
831
|
assessment.blocked_decision = assessment.decision;
|
|
817
|
-
assessment.decision = "
|
|
818
|
-
|
|
819
|
-
|
|
832
|
+
assessment.decision = "revise_capture";
|
|
833
|
+
assessment.recommended_stage = "verify";
|
|
834
|
+
assessment.continue_with_stage = "verify";
|
|
835
|
+
assessment.evidence_collection_incomplete = true;
|
|
836
|
+
assessment.recovery_stage = "verify";
|
|
837
|
+
assessment.recovery_reason = readyBlocker;
|
|
838
|
+
assessment.evidence_issue_code = visualDeltaEvidenceIssueCode(state, readyBlocker);
|
|
839
|
+
assessment.visual_delta = visualDeltaForState(state);
|
|
840
|
+
assessment.suggested_repair = "Keep the same Riddle Proof run in evidence/comparison recovery: repair or retry the visual comparator/fetch path, wait for artifact readiness if applicable, or produce a measured visual_delta artifact before proof review can mark ready_to_ship.";
|
|
820
841
|
const blockers = Array.isArray(assessment.blockers) ? assessment.blockers : [];
|
|
821
842
|
assessment.blockers = [...blockers, readyBlocker];
|
|
822
843
|
}
|
|
@@ -835,7 +856,7 @@ function mergeStateFromParams(statePath, params) {
|
|
|
835
856
|
}
|
|
836
857
|
appendProofSummaryLine(state, `Supervising proof assessment: ${state.proof_assessment.decision || "unknown"}`);
|
|
837
858
|
if (readyBlocker) {
|
|
838
|
-
appendProofSummaryLine(state, `Ready-to-ship assessment
|
|
859
|
+
appendProofSummaryLine(state, `Ready-to-ship assessment routed to evidence recovery: ${readyBlocker}`);
|
|
839
860
|
}
|
|
840
861
|
if (state.proof_assessment_summary) {
|
|
841
862
|
appendProofSummaryLine(state, `Assessment summary: ${state.proof_assessment_summary}`);
|
|
@@ -1711,10 +1732,10 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
1711
1732
|
const primaryShipGateNextAction = (shipGate) => {
|
|
1712
1733
|
const reasons = shipGate.reasons || [];
|
|
1713
1734
|
if (reasons.some((reason) => reason.includes("proof_assessment"))) {
|
|
1714
|
-
return "resume with riddle_proof_review using decision=ready_to_ship only after
|
|
1735
|
+
return "resume with riddle_proof_review using decision=ready_to_ship only after screenshots, semantic evidence, and required comparison metrics prove the request; otherwise choose needs_implementation, revise_capture, or needs_richer_proof for the specific missing stage";
|
|
1715
1736
|
}
|
|
1716
1737
|
if (reasons.some((reason) => reason.includes("visual_delta"))) {
|
|
1717
|
-
return "
|
|
1738
|
+
return "keep the run in verify/evidence recovery until a measured before/after visual_delta exists; choose revise_capture rather than ready_to_ship or generic needs_richer_proof for this visual proof";
|
|
1718
1739
|
}
|
|
1719
1740
|
if (reasons.some((reason) => reason.includes("after_cdn") || reason.includes("verify_status"))) {
|
|
1720
1741
|
return "rerun verify with stronger proof framing so after evidence is captured before shipping";
|