@riddledc/riddle-proof 0.7.183 → 0.7.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/{chunk-X24EJSIU.js → chunk-Z42O55GB.js} +16 -4
- package/dist/cli.cjs +503 -7
- package/dist/cli.js +488 -4
- package/dist/index.cjs +16 -4
- package/dist/index.js +1 -1
- package/dist/profile.cjs +16 -4
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/profile.js +1 -1
- package/dist/proof-run-core.d.cts +1 -1
- package/dist/proof-run-core.d.ts +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/examples/profiles/spa-route-exit-state-hygiene.json +76 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
profileStatusExitCode,
|
|
14
14
|
resolveRiddleProofProfileTargetUrl,
|
|
15
15
|
resolveRiddleProofProfileTimeoutSec
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-Z42O55GB.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
isTerminalRiddleJobStatus,
|
|
@@ -396,6 +396,10 @@ function profileResultMarkdown(result) {
|
|
|
396
396
|
if (result.warnings.length > 12) lines.push(`- ${result.warnings.length - 12} additional warning(s) omitted.`);
|
|
397
397
|
lines.push("");
|
|
398
398
|
}
|
|
399
|
+
const packMetadataLines = profilePackMetadataMarkdown(result);
|
|
400
|
+
if (packMetadataLines.length) {
|
|
401
|
+
lines.push("## Proof Pack", "", ...packMetadataLines, "");
|
|
402
|
+
}
|
|
399
403
|
lines.push("## Checks", "");
|
|
400
404
|
for (const check of result.checks) {
|
|
401
405
|
lines.push(`- ${check.status}: ${profileCheckMarkdownLabel(check)}`);
|
|
@@ -405,6 +409,18 @@ function profileResultMarkdown(result) {
|
|
|
405
409
|
if (setupSummaryLines.length) {
|
|
406
410
|
lines.push("", "## Setup Summary", "", ...setupSummaryLines);
|
|
407
411
|
}
|
|
412
|
+
const reachabilitySummaryLines = profileReachabilitySummaryMarkdown(result);
|
|
413
|
+
if (reachabilitySummaryLines.length) {
|
|
414
|
+
lines.push("", "## Reachability", "", ...reachabilitySummaryLines);
|
|
415
|
+
}
|
|
416
|
+
const stateContractSummaryLines = profileStateContractSummaryMarkdown(result);
|
|
417
|
+
if (stateContractSummaryLines.length) {
|
|
418
|
+
lines.push("", "## State Contract", "", ...stateContractSummaryLines);
|
|
419
|
+
}
|
|
420
|
+
const sideCaveatSummaryLines = profileSideCaveatSummaryMarkdown(result);
|
|
421
|
+
if (sideCaveatSummaryLines.length) {
|
|
422
|
+
lines.push("", "## Side Caveats", "", ...sideCaveatSummaryLines);
|
|
423
|
+
}
|
|
408
424
|
const networkMockSummaryLines = profileNetworkMockSummaryMarkdown(result);
|
|
409
425
|
if (networkMockSummaryLines.length) {
|
|
410
426
|
lines.push("", "## Network Mocks", "", ...networkMockSummaryLines);
|
|
@@ -503,6 +519,249 @@ function profileRiddleJobMarkdown(result) {
|
|
|
503
519
|
if (splitJobs.length > 12) lines.push(`- ${splitJobs.length - 12} additional split job(s) omitted.`);
|
|
504
520
|
return lines;
|
|
505
521
|
}
|
|
522
|
+
function profileMetadataStringArray(value) {
|
|
523
|
+
return Array.isArray(value) ? value.map((item) => typeof item === "string" ? item.trim() : "").filter((item) => Boolean(item)) : [];
|
|
524
|
+
}
|
|
525
|
+
function profileSetupSummaryRecord(result) {
|
|
526
|
+
const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
|
|
527
|
+
return cliRecord(setupCheck?.evidence?.setup_summary);
|
|
528
|
+
}
|
|
529
|
+
function profileSetupSummaryViewports(result) {
|
|
530
|
+
const setupSummary = profileSetupSummaryRecord(result);
|
|
531
|
+
return Array.isArray(setupSummary?.viewports) ? setupSummary.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
|
|
532
|
+
}
|
|
533
|
+
function profileHasPassedCheck(result, types) {
|
|
534
|
+
return result.checks.some((check) => types.includes(check.type) && check.status === "passed");
|
|
535
|
+
}
|
|
536
|
+
function profileHasCheck(result, types) {
|
|
537
|
+
return result.checks.some((check) => types.includes(check.type));
|
|
538
|
+
}
|
|
539
|
+
function profileSetupScreenshotCount(viewports) {
|
|
540
|
+
return viewports.reduce((sum, viewport) => {
|
|
541
|
+
const setupScreenshots = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
|
|
542
|
+
const finalScreenshot = cliString(viewport.final_screenshot) || cliString(viewport.screenshot_label) ? 1 : 0;
|
|
543
|
+
return sum + setupScreenshots + finalScreenshot;
|
|
544
|
+
}, 0);
|
|
545
|
+
}
|
|
546
|
+
function profileSetupReceiptTotal(viewports, key) {
|
|
547
|
+
return viewports.reduce((sum, viewport) => sum + setupReceiptArray(viewport, key).filter((receipt) => receipt.ok !== false).length, 0);
|
|
548
|
+
}
|
|
549
|
+
function profileSetupFailureCount(viewports) {
|
|
550
|
+
return viewports.reduce((sum, viewport) => {
|
|
551
|
+
const failed = Array.isArray(viewport.failed) ? viewport.failed : [];
|
|
552
|
+
return sum + failed.filter((failure) => Boolean(cliRecord(failure))).length;
|
|
553
|
+
}, 0);
|
|
554
|
+
}
|
|
555
|
+
function profileSetupObstructionCount(viewports) {
|
|
556
|
+
return viewports.reduce((sum, viewport) => {
|
|
557
|
+
const failed = Array.isArray(viewport.failed) ? viewport.failed.map(cliRecord).filter((failure) => Boolean(failure)) : [];
|
|
558
|
+
return sum + failed.filter((failure) => Boolean(setupFailureObstructionSnippet(cliString(failure.reason)))).length;
|
|
559
|
+
}, 0);
|
|
560
|
+
}
|
|
561
|
+
function profileResultHasArtifact(result) {
|
|
562
|
+
return Boolean(
|
|
563
|
+
result.artifacts.proof_json || result.artifacts.console || result.artifacts.dom_summary || result.artifacts.screenshots?.length || result.artifacts.riddle_artifacts?.some((artifact) => artifact.url || artifact.path || artifact.name)
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
function profileReceiptSignalStatus(hasSignal, presentReason, missingReason) {
|
|
567
|
+
return hasSignal ? { status: "present", reason: presentReason } : { status: "missing", reason: missingReason };
|
|
568
|
+
}
|
|
569
|
+
function compactProfileReceiptReason(value, limit = 180) {
|
|
570
|
+
const text = cliString(value)?.replace(/\s+/g, " ").trim();
|
|
571
|
+
if (!text) return void 0;
|
|
572
|
+
return text.length <= limit ? text : `${text.slice(0, Math.max(0, limit - 3)).trimEnd()}...`;
|
|
573
|
+
}
|
|
574
|
+
function profileFailedCleanupInventoryReason(setupViewports) {
|
|
575
|
+
const receipts = setupViewports.flatMap((viewport) => [
|
|
576
|
+
...setupReceiptArray(viewport, "window_eval"),
|
|
577
|
+
...setupReceiptArray(viewport, "window_call")
|
|
578
|
+
]);
|
|
579
|
+
for (const receipt of receipts) {
|
|
580
|
+
if (receipt.ok !== false) continue;
|
|
581
|
+
const returnStoredTo = cliString(receipt.return_stored_to) || "";
|
|
582
|
+
const reason = cliString(receipt.reason) || "";
|
|
583
|
+
const error = cliString(receipt.error) || "";
|
|
584
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
585
|
+
const haystack = `${returnStoredTo} ${reason} ${error} ${summary}`.toLowerCase();
|
|
586
|
+
const isCleanupReceipt = haystack.includes("cleanup") || haystack.includes("post-cleanup") || haystack.includes("stale") || haystack.includes("statehygiene") || haystack.includes("state hygiene") || haystack.includes("remained after") || haystack.includes("still present");
|
|
587
|
+
if (!isCleanupReceipt) continue;
|
|
588
|
+
return compactProfileReceiptReason(error) || compactProfileReceiptReason(reason) || "cleanup inventory failed";
|
|
589
|
+
}
|
|
590
|
+
return void 0;
|
|
591
|
+
}
|
|
592
|
+
function profilePackReceiptStatus(result, metadata, receipt) {
|
|
593
|
+
const text = receipt.toLowerCase();
|
|
594
|
+
const setupSummary = profileSetupSummaryRecord(result);
|
|
595
|
+
const setupViewports = profileSetupSummaryViewports(result);
|
|
596
|
+
const evidenceViewports = Array.isArray(result.evidence?.viewports) ? result.evidence.viewports : [];
|
|
597
|
+
const setupResultCount = setupViewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.result_count) || 0), 0);
|
|
598
|
+
const setupScreenshotCount = profileSetupScreenshotCount(setupViewports);
|
|
599
|
+
const screenshotCount = (result.artifacts.screenshots?.length || 0) + evidenceViewports.filter((viewport) => cliString(viewport.screenshot_label)).length + setupScreenshotCount;
|
|
600
|
+
const windowEvalCount = profileSetupReceiptTotal(setupViewports, "window_eval");
|
|
601
|
+
const valueReceipts = [
|
|
602
|
+
...setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "window_eval")),
|
|
603
|
+
...setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "window_call"))
|
|
604
|
+
].filter((item) => item.ok !== false);
|
|
605
|
+
const clickCount = setupViewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0) + profileSetupReceiptTotal(setupViewports, "click") + profileSetupReceiptTotal(setupViewports, "click_count");
|
|
606
|
+
const setupFailureCount = profileSetupFailureCount(setupViewports);
|
|
607
|
+
const setupObstructionCount = profileSetupObstructionCount(setupViewports);
|
|
608
|
+
const inputDispatchCount = profileSetupReceiptTotal(setupViewports, "drag") + profileSetupReceiptTotal(setupViewports, "tap") + profileSetupReceiptTotal(setupViewports, "press") + profileSetupReceiptTotal(setupViewports, "keyboard_sequence");
|
|
609
|
+
const canvasReceipts = setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "canvas_signature"));
|
|
610
|
+
const hasCanvasChange = canvasReceipts.some((item) => item.ok !== false && item.changed === true);
|
|
611
|
+
const canvasSignatureHashes = canvasReceipts.filter((item) => item.ok !== false).map((item) => cliString(item.hash)).filter(Boolean);
|
|
612
|
+
const hasCanvasSignatureChange = hasCanvasChange || new Set(canvasSignatureHashes).size >= 2;
|
|
613
|
+
const hasNaturalInput = setupNaturalInputSummaryMarkdown(setupViewports).length > 0;
|
|
614
|
+
const hasStateContract = profileStateContractSummaryMarkdown(result).length > 0 || Boolean(cliRecord(metadata.declared_state_contract));
|
|
615
|
+
const hasInvalidStateReceipt = valueReceipts.some((item) => {
|
|
616
|
+
const state = setupReturnSummaryValue(item, ["state", "nextState"]);
|
|
617
|
+
return typeof state === "string" && state.toLowerCase().includes("invalid");
|
|
618
|
+
});
|
|
619
|
+
const hasErrorDetailReceipt = valueReceipts.some((item) => setupReturnSummaryValue(item, ["hasErrorDetail", "errorDetail", "error_detail"]) === true);
|
|
620
|
+
const hasGridEvidence = valueReceipts.some((item) => setupReturnSummaryValue(item, ["itemCount", "grid.width", "gridWidth", "visibleGridCount"]) !== void 0);
|
|
621
|
+
const hasVisibleControlReceipt = valueReceipts.some((item) => setupReturnSummaryValue(item, ["visibleButtonCount", "visibleControlCount"]) !== void 0 || setupReturnSummaryValue(item, ["buttonStillVisible", "controlStillVisible"]) === true);
|
|
622
|
+
const hasToolSelectionReceipt = valueReceipts.some((item) => setupReturnSummaryValue(item, ["rectangleChecked", "toolSelected", "toolChecked", "selected"]) === true);
|
|
623
|
+
const hasStateGrowthReceipt = valueReceipts.some((item) => {
|
|
624
|
+
const delta = cliFiniteNumber(setupReturnSummaryValue(item, ["delta", "countDelta", "itemDelta", "stateDelta"]));
|
|
625
|
+
if (delta !== void 0 && delta > 0) return true;
|
|
626
|
+
const before = cliFiniteNumber(setupReturnSummaryValue(item, ["before", "beforeCount", "previousCount"]));
|
|
627
|
+
const after = cliFiniteNumber(setupReturnSummaryValue(item, ["after", "afterCount", "itemCount", "count"]));
|
|
628
|
+
return before !== void 0 && after !== void 0 && after > before;
|
|
629
|
+
});
|
|
630
|
+
const hasReachability = profileReachabilitySummaryMarkdown(result).length > 0 || result.checks.some((check) => check.type === "selector_visible" && Boolean(cliRecord(check.evidence)?.selector));
|
|
631
|
+
const hasOverflowEvidence = result.checks.some((check) => check.type === "no_horizontal_overflow" || check.type === "no_mobile_horizontal_overflow" || check.type === "frame_no_horizontal_overflow") || evidenceViewports.some((viewport) => (cliFiniteNumber(viewport.overflow_px) || 0) > 0 || (cliFiniteNumber(viewport.bounds_overflow_px) || 0) > 0 || Boolean(viewport.overflow_offenders?.length));
|
|
632
|
+
const hasConsoleAccounting = profileHasCheck(result, ["no_console_warnings", "no_fatal_console_errors"]) || Boolean(result.evidence?.console || result.evidence?.page_errors);
|
|
633
|
+
const hasDomSummary = Boolean(result.artifacts.dom_summary || result.evidence?.dom_summary);
|
|
634
|
+
const hasProofJson = Boolean(result.artifacts.proof_json || result.version === "riddle-proof.profile-result.v1");
|
|
635
|
+
const hasRouteViewport = Boolean(result.route?.requested || result.route?.observed) && Boolean(evidenceViewports.length || result.route?.matched !== void 0);
|
|
636
|
+
const hasSetupReceipts = setupResultCount > 0 || Boolean(setupSummary);
|
|
637
|
+
const hasTextVisibility = profileHasPassedCheck(result, ["text_visible", "selector_text_visible", "selector_visible"]);
|
|
638
|
+
const hasTextAbsence = profileHasPassedCheck(result, ["text_absent", "selector_text_absent"]);
|
|
639
|
+
const hasMeasuredStateChange = hasNaturalInput || hasCanvasChange || valueReceipts.some((item) => setupReturnSummaryValue(item, ["changed"]) === true || setupReturnSummaryValue(item, ["nonWhiteDelta", "darkDelta", "pixelDelta", "movementDelta"]) !== void 0);
|
|
640
|
+
const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
|
|
641
|
+
if (text.includes("artifact link") || text.includes("artifact path")) {
|
|
642
|
+
return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
|
|
643
|
+
}
|
|
644
|
+
if (text.includes("proof json")) return profileReceiptSignalStatus(hasProofJson, "proof JSON artifact named", "proof JSON artifact missing");
|
|
645
|
+
if (text.includes("dom summary")) return profileReceiptSignalStatus(hasDomSummary, "DOM summary evidence present", "DOM summary evidence missing");
|
|
646
|
+
if (text.includes("console") || text.includes("warning") || text.includes("fatal") || text.includes("browser warning") || text.includes("graphics")) {
|
|
647
|
+
return profileReceiptSignalStatus(hasConsoleAccounting, "console checks or evidence present", "console accounting evidence missing");
|
|
648
|
+
}
|
|
649
|
+
if (text.includes("route") && text.includes("viewport")) {
|
|
650
|
+
return profileReceiptSignalStatus(hasRouteViewport, "route and viewport evidence present", "route or viewport evidence missing");
|
|
651
|
+
}
|
|
652
|
+
if (text.includes("setup action")) {
|
|
653
|
+
return profileReceiptSignalStatus(hasSetupReceipts, "setup receipts present", "setup receipts missing");
|
|
654
|
+
}
|
|
655
|
+
if (text.includes("declared state contract")) {
|
|
656
|
+
return profileReceiptSignalStatus(hasStateContract, "state contract metadata or receipts present", "state contract evidence missing");
|
|
657
|
+
}
|
|
658
|
+
if (text.includes("stale") || text.includes("absence")) {
|
|
659
|
+
if (failedCleanupInventoryReason && (text.includes("cleanup") || text.includes("post-cleanup") || text.includes("stale-state") || text.includes("stale state"))) {
|
|
660
|
+
return { status: "failed", reason: `cleanup inventory failed: ${failedCleanupInventoryReason}` };
|
|
661
|
+
}
|
|
662
|
+
return profileReceiptSignalStatus(hasTextAbsence, "absence check passed", "absence check missing");
|
|
663
|
+
}
|
|
664
|
+
if (text.includes("recovered") || text.includes("final state")) {
|
|
665
|
+
return profileReceiptSignalStatus(hasStateContract || hasTextVisibility, "final state receipt present", "final state receipt missing");
|
|
666
|
+
}
|
|
667
|
+
if (text.includes("error detail")) {
|
|
668
|
+
const hasRequiredState = !text.includes("invalid") || hasInvalidStateReceipt;
|
|
669
|
+
return profileReceiptSignalStatus(
|
|
670
|
+
hasRequiredState && hasErrorDetailReceipt,
|
|
671
|
+
"error-detail state receipt present",
|
|
672
|
+
"error-detail state receipt missing"
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
if (text.includes("invalid state")) {
|
|
676
|
+
return profileReceiptSignalStatus(hasStateContract || hasInvalidStateReceipt, "invalid-state receipt present", "invalid-state receipt missing");
|
|
677
|
+
}
|
|
678
|
+
if (text.includes("retry") || text.includes("repair") || text.includes("reset") || text.includes("affordance")) {
|
|
679
|
+
return profileReceiptSignalStatus(hasStateContract || clickCount > 0, "affordance or transition receipt present", "affordance receipt missing");
|
|
680
|
+
}
|
|
681
|
+
if (text.includes("failure") || text.includes("mutation")) {
|
|
682
|
+
return profileReceiptSignalStatus(hasStateContract || windowEvalCount > 0 || clickCount > 0, "failure or mutation receipt present", "failure or mutation receipt missing");
|
|
683
|
+
}
|
|
684
|
+
if (text.includes("initial") && (text.includes("visible") || text.includes("state"))) {
|
|
685
|
+
return profileReceiptSignalStatus(hasTextVisibility || screenshotCount > 0, "initial visible-state evidence present", "initial state evidence missing");
|
|
686
|
+
}
|
|
687
|
+
if (text.includes("state-growth") || text.includes("state growth") || text.includes("growth receipt") || text.includes("grid grows") || text.includes("state") && text.includes("after the click")) {
|
|
688
|
+
return profileReceiptSignalStatus(hasStateGrowthReceipt, "state-growth receipt present", "state-growth receipt missing");
|
|
689
|
+
}
|
|
690
|
+
if (text.includes("visible grid") || text.includes("control evidence") || text.includes("grid") && text.includes("control")) {
|
|
691
|
+
return profileReceiptSignalStatus(
|
|
692
|
+
hasGridEvidence && (hasVisibleControlReceipt || hasReachability),
|
|
693
|
+
"visible grid/control evidence present",
|
|
694
|
+
"visible grid/control evidence missing"
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
if (text.includes("tool") && text.includes("selected") || text.includes("rectangle tool")) {
|
|
698
|
+
return profileReceiptSignalStatus(hasToolSelectionReceipt, "tool-selection receipt present", "tool-selection receipt missing");
|
|
699
|
+
}
|
|
700
|
+
if (text.includes("canvas signature")) {
|
|
701
|
+
return profileReceiptSignalStatus(hasCanvasSignatureChange, "canvas signature change evidence present", "canvas signature evidence missing");
|
|
702
|
+
}
|
|
703
|
+
if (text.includes("selector count") || text.includes("visible count") || text.includes("control visibility") || text.includes("reachability gate") || text.includes("visible control")) {
|
|
704
|
+
return profileReceiptSignalStatus(hasReachability, "selector visibility or reachability evidence present", "reachability evidence missing");
|
|
705
|
+
}
|
|
706
|
+
if (text.includes("overflow") || text.includes("clipped") || text.includes("fit")) {
|
|
707
|
+
return profileReceiptSignalStatus(hasOverflowEvidence, "overflow evidence present", "overflow evidence missing");
|
|
708
|
+
}
|
|
709
|
+
if (text.includes("click receipt") || text.includes("obstruction receipt") || text.includes("state mutation")) {
|
|
710
|
+
return profileReceiptSignalStatus(clickCount > 0 || setupObstructionCount > 0, "click or obstruction receipt present", "click or obstruction receipt missing");
|
|
711
|
+
}
|
|
712
|
+
if (text.includes("target selector") || text.includes("target selector/text")) {
|
|
713
|
+
return profileReceiptSignalStatus(hasReachability || hasTextVisibility, "selector or text check evidence present", "selector/text evidence missing");
|
|
714
|
+
}
|
|
715
|
+
if (text.includes("intercepting element")) {
|
|
716
|
+
if (setupObstructionCount > 0) return { status: "present", reason: "obstruction receipt present" };
|
|
717
|
+
return setupFailureCount > 0 ? { status: "missing", reason: "setup failed without intercepting element evidence" } : { status: "manual", reason: "only applies when blocked" };
|
|
718
|
+
}
|
|
719
|
+
if (text.includes("before and after state")) {
|
|
720
|
+
return profileReceiptSignalStatus(
|
|
721
|
+
hasStateContract || valueReceipts.length >= 2 || screenshotCount >= 2,
|
|
722
|
+
"before/after state evidence present",
|
|
723
|
+
"before/after state evidence missing"
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
if (text.includes("screenshot")) {
|
|
727
|
+
const needsBoundaryScreenshots = text.includes("each") || text.includes("before and after") || text.includes("state boundary");
|
|
728
|
+
return profileReceiptSignalStatus(
|
|
729
|
+
needsBoundaryScreenshots ? screenshotCount >= 2 : screenshotCount > 0,
|
|
730
|
+
needsBoundaryScreenshots ? "multiple screenshots present" : "screenshot evidence present",
|
|
731
|
+
needsBoundaryScreenshots ? "multiple screenshots missing" : "screenshot evidence missing"
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
if (text.includes("input dispatch") || text.includes("pointer") || text.includes("touch") || text.includes("key event") || text.includes("trusted-event")) {
|
|
735
|
+
return profileReceiptSignalStatus(inputDispatchCount > 0 || hasNaturalInput, "input dispatch evidence present", "input dispatch evidence missing");
|
|
736
|
+
}
|
|
737
|
+
if (text.includes("measured") || text.includes("state-change") || text.includes("pixel delta") || text.includes("movement receipt") || text.includes("canvas hash")) {
|
|
738
|
+
return profileReceiptSignalStatus(hasMeasuredStateChange, "measured-change evidence present", "measured-change evidence missing");
|
|
739
|
+
}
|
|
740
|
+
return { status: "manual", reason: "semantic receipt requires audit review" };
|
|
741
|
+
}
|
|
742
|
+
function profilePackMetadataMarkdown(result) {
|
|
743
|
+
const metadata = cliRecord(result.metadata);
|
|
744
|
+
if (!metadata) return [];
|
|
745
|
+
const packId = cliString(metadata.pack_id);
|
|
746
|
+
const packPublicName = cliString(metadata.pack_public_name);
|
|
747
|
+
const requiredReceipts = profileMetadataStringArray(metadata.required_receipts);
|
|
748
|
+
if (!packId && !packPublicName && !requiredReceipts.length) return [];
|
|
749
|
+
const lines = [];
|
|
750
|
+
const packParts = [
|
|
751
|
+
packId ? markdownInlineCode(packId) : "",
|
|
752
|
+
packPublicName ? packPublicName : ""
|
|
753
|
+
].filter(Boolean);
|
|
754
|
+
if (packParts.length) lines.push(`- pack: ${packParts.join(" - ")}`);
|
|
755
|
+
if (requiredReceipts.length) {
|
|
756
|
+
lines.push(`- required receipts: ${requiredReceipts.length}`);
|
|
757
|
+
for (const receipt of requiredReceipts.slice(0, 20)) {
|
|
758
|
+
const item = profilePackReceiptStatus(result, metadata, receipt);
|
|
759
|
+
lines.push(` - ${item.status}: ${receipt} (${item.reason})`);
|
|
760
|
+
}
|
|
761
|
+
if (requiredReceipts.length > 20) lines.push(` - ${requiredReceipts.length - 20} additional required receipt(s) omitted.`);
|
|
762
|
+
}
|
|
763
|
+
return lines;
|
|
764
|
+
}
|
|
506
765
|
function markdownInlineCode(value, maxLength = 80) {
|
|
507
766
|
const normalized = value.replace(/\s+/g, " ").trim();
|
|
508
767
|
const clipped = normalized.length > maxLength ? `${normalized.slice(0, Math.max(0, maxLength - 3))}...` : normalized;
|
|
@@ -764,6 +1023,221 @@ function setupNaturalInputSummaryMarkdown(viewports) {
|
|
|
764
1023
|
}
|
|
765
1024
|
return lines;
|
|
766
1025
|
}
|
|
1026
|
+
function reachabilityFailureReason(reason) {
|
|
1027
|
+
if (!reason) return void 0;
|
|
1028
|
+
const noVisibleMatch = /No visible match for selector [\s\S]*?:\s*([^\n]+)/.exec(reason);
|
|
1029
|
+
if (noVisibleMatch?.[1]) return noVisibleMatch[1].trim().slice(0, 120);
|
|
1030
|
+
if (/no_visible_match/.test(reason)) return "no_visible_match";
|
|
1031
|
+
if (/not visible/i.test(reason)) return "not_visible";
|
|
1032
|
+
return void 0;
|
|
1033
|
+
}
|
|
1034
|
+
function viewportTopBoundsOverflowPx(viewport) {
|
|
1035
|
+
const direct = cliFiniteNumber(viewport.bounds_overflow_px);
|
|
1036
|
+
if (direct !== void 0 && direct > 0) return direct;
|
|
1037
|
+
const offenders = Array.isArray(viewport.overflow_offenders) ? viewport.overflow_offenders.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
1038
|
+
for (const offender of offenders) {
|
|
1039
|
+
const overflow = cliFiniteNumber(offender.bounds_overflow_px) ?? cliFiniteNumber(offender.overflow_px) ?? cliFiniteNumber(offender.overflow);
|
|
1040
|
+
if (overflow !== void 0 && overflow > 0) return overflow;
|
|
1041
|
+
}
|
|
1042
|
+
const scrollOverflow = cliFiniteNumber(viewport.overflow_px);
|
|
1043
|
+
return scrollOverflow !== void 0 && scrollOverflow > 0 ? scrollOverflow : void 0;
|
|
1044
|
+
}
|
|
1045
|
+
function profileReachabilitySummaryMarkdown(result) {
|
|
1046
|
+
const evidenceViewports = Array.isArray(result.evidence?.viewports) ? result.evidence.viewports.map((viewport) => cliRecord(viewport)).filter((viewport) => Boolean(viewport)) : [];
|
|
1047
|
+
if (!evidenceViewports.length) return [];
|
|
1048
|
+
const evidenceByName = /* @__PURE__ */ new Map();
|
|
1049
|
+
for (const viewport of evidenceViewports) {
|
|
1050
|
+
const name = cliString(viewport.name);
|
|
1051
|
+
if (name) evidenceByName.set(name, viewport);
|
|
1052
|
+
}
|
|
1053
|
+
const receipts = [];
|
|
1054
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1055
|
+
const addReceipt = (viewportName, selector, reason) => {
|
|
1056
|
+
const viewport = evidenceByName.get(viewportName);
|
|
1057
|
+
if (!viewport) return;
|
|
1058
|
+
const selectors = cliRecord(viewport.selectors);
|
|
1059
|
+
const selectorEvidence = cliRecord(selectors?.[selector]);
|
|
1060
|
+
const count = cliFiniteNumber(selectorEvidence?.count);
|
|
1061
|
+
const visibleCount = cliFiniteNumber(selectorEvidence?.visible_count);
|
|
1062
|
+
if (count === void 0 || count <= 0 || visibleCount === void 0 || visibleCount > 0) return;
|
|
1063
|
+
const key = `${viewportName}\0${selector}`;
|
|
1064
|
+
if (seen.has(key)) return;
|
|
1065
|
+
seen.add(key);
|
|
1066
|
+
const reasonText = reason || "no_visible_match";
|
|
1067
|
+
const boundsOverflow = viewportTopBoundsOverflowPx(viewport);
|
|
1068
|
+
receipts.push(`- reachability ${viewportName}: ${markdownInlineCode(selector, 120)} exists ${count}, visible ${visibleCount}, reason ${markdownInlineCode(reasonText, 80)}${boundsOverflow === void 0 ? "" : `, top bounds overflow ${boundsOverflow}px`}`);
|
|
1069
|
+
};
|
|
1070
|
+
const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
|
|
1071
|
+
const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
|
|
1072
|
+
const setupViewports = Array.isArray(setupSummary?.viewports) ? setupSummary.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
|
|
1073
|
+
for (const viewport of setupViewports) {
|
|
1074
|
+
const viewportName = cliString(viewport.name) || "viewport";
|
|
1075
|
+
const failed = [
|
|
1076
|
+
...Array.isArray(viewport.failed) ? viewport.failed : [],
|
|
1077
|
+
...Array.isArray(viewport.optional_failed) ? viewport.optional_failed : []
|
|
1078
|
+
].map(cliRecord).filter((failure) => Boolean(failure));
|
|
1079
|
+
for (const failure of failed) {
|
|
1080
|
+
const selector = cliString(failure.selector);
|
|
1081
|
+
const reason = reachabilityFailureReason(cliString(failure.reason));
|
|
1082
|
+
if (selector && reason) addReceipt(viewportName, selector, reason);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
for (const check of result.checks) {
|
|
1086
|
+
if (check.type !== "selector_visible" || check.status !== "failed") continue;
|
|
1087
|
+
const evidence = cliRecord(check.evidence);
|
|
1088
|
+
const selector = cliString(evidence?.selector);
|
|
1089
|
+
if (!selector) continue;
|
|
1090
|
+
for (const viewport of evidenceViewports) {
|
|
1091
|
+
const viewportName = cliString(viewport.name) || "viewport";
|
|
1092
|
+
addReceipt(viewportName, selector, "no_visible_match");
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
if (receipts.length > 8) {
|
|
1096
|
+
return [...receipts.slice(0, 8), `- ${receipts.length - 8} additional reachability receipt(s) omitted.`];
|
|
1097
|
+
}
|
|
1098
|
+
return receipts;
|
|
1099
|
+
}
|
|
1100
|
+
function stateContractReceiptName(receipt, fallbackIndex) {
|
|
1101
|
+
const storedTo = cliString(receipt.return_stored_to);
|
|
1102
|
+
if (!storedTo) return `receipt-${fallbackIndex + 1}`;
|
|
1103
|
+
const parts = storedTo.split(".").map((part) => part.trim()).filter(Boolean);
|
|
1104
|
+
return parts[parts.length - 1] || storedTo;
|
|
1105
|
+
}
|
|
1106
|
+
function stateContractReceiptValue(receipt) {
|
|
1107
|
+
const value = setupReturnSummaryValue(receipt, [
|
|
1108
|
+
"state",
|
|
1109
|
+
"nextState",
|
|
1110
|
+
"terminalState",
|
|
1111
|
+
"finalState",
|
|
1112
|
+
"status",
|
|
1113
|
+
"phase"
|
|
1114
|
+
]);
|
|
1115
|
+
return cliValueLabel(value);
|
|
1116
|
+
}
|
|
1117
|
+
function stateContractSignalParts(receipts) {
|
|
1118
|
+
const names = [
|
|
1119
|
+
"hasValidate",
|
|
1120
|
+
"hasTryFix",
|
|
1121
|
+
"hasErrorDetail",
|
|
1122
|
+
"hasValid",
|
|
1123
|
+
"hasInvalid",
|
|
1124
|
+
"invalidGone",
|
|
1125
|
+
"staleGone",
|
|
1126
|
+
"staleCopyGone",
|
|
1127
|
+
"repairedTrailingCommaGone",
|
|
1128
|
+
"hasSuccess",
|
|
1129
|
+
"hasFailure",
|
|
1130
|
+
"hasRetry",
|
|
1131
|
+
"hasError",
|
|
1132
|
+
"success",
|
|
1133
|
+
"recovered"
|
|
1134
|
+
];
|
|
1135
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1136
|
+
const parts = [];
|
|
1137
|
+
for (const receipt of receipts) {
|
|
1138
|
+
for (const name of names) {
|
|
1139
|
+
const value = setupReturnSummaryValue(receipt, [name]);
|
|
1140
|
+
if (value === void 0) continue;
|
|
1141
|
+
const label = cliValueLabel(value);
|
|
1142
|
+
if (label === void 0) continue;
|
|
1143
|
+
const part = `${name}=${label}`;
|
|
1144
|
+
if (seen.has(part)) continue;
|
|
1145
|
+
seen.add(part);
|
|
1146
|
+
parts.push(part);
|
|
1147
|
+
if (parts.length >= 8) return parts;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
return parts;
|
|
1151
|
+
}
|
|
1152
|
+
function profileStateContractSummaryMarkdown(result) {
|
|
1153
|
+
const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
|
|
1154
|
+
const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
|
|
1155
|
+
const viewports = Array.isArray(setupSummary?.viewports) ? setupSummary.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
|
|
1156
|
+
const lines = [];
|
|
1157
|
+
for (const viewport of viewports.slice(0, 8)) {
|
|
1158
|
+
const name = cliString(viewport.name) || "viewport";
|
|
1159
|
+
const receipts = [
|
|
1160
|
+
...setupReceiptArray(viewport, "window_eval"),
|
|
1161
|
+
...setupReceiptArray(viewport, "window_call"),
|
|
1162
|
+
...setupReceiptArray(viewport, "window_call_until")
|
|
1163
|
+
].filter((receipt) => receipt.ok !== false);
|
|
1164
|
+
const states = receipts.map((receipt, index) => ({
|
|
1165
|
+
name: stateContractReceiptName(receipt, index),
|
|
1166
|
+
state: stateContractReceiptValue(receipt)
|
|
1167
|
+
})).filter((receipt) => Boolean(receipt.state));
|
|
1168
|
+
if (states.length < 2) continue;
|
|
1169
|
+
const stateChain = states.slice(0, 6).map((receipt) => `${markdownInlineCode(receipt.name, 60)}=${markdownInlineCode(receipt.state, 80)}`).join(" -> ");
|
|
1170
|
+
const omitted = states.length > 6 ? ` (+${states.length - 6} more)` : "";
|
|
1171
|
+
const signals = stateContractSignalParts(receipts);
|
|
1172
|
+
lines.push(`- state contract ${name}: ${stateChain}${omitted}${signals.length ? `; signals ${signals.map((part) => markdownInlineCode(part, 80)).join(", ")}` : ""}`);
|
|
1173
|
+
}
|
|
1174
|
+
return lines;
|
|
1175
|
+
}
|
|
1176
|
+
function sideCaveatAllowlistPart(evidence, totalKey, allowedKey) {
|
|
1177
|
+
const total = cliFiniteNumber(evidence[totalKey]);
|
|
1178
|
+
const allowed = cliFiniteNumber(evidence[allowedKey]);
|
|
1179
|
+
if (total === void 0 || allowed === void 0 || allowed <= 0) return void 0;
|
|
1180
|
+
return `${allowed}/${total} allowed`;
|
|
1181
|
+
}
|
|
1182
|
+
function sideCaveatAllowlistCounts(evidence) {
|
|
1183
|
+
const textCount = Array.isArray(evidence.allowed_console_texts) ? evidence.allowed_console_texts.filter((value) => typeof value === "string" && value.trim()).length : 0;
|
|
1184
|
+
const patternCount = Array.isArray(evidence.allowed_console_patterns) ? evidence.allowed_console_patterns.filter((value) => typeof value === "string" && value.trim()).length : 0;
|
|
1185
|
+
return textCount || patternCount ? `allowlist ${textCount} text${textCount === 1 ? "" : "s"}, ${patternCount} pattern${patternCount === 1 ? "" : "s"}` : void 0;
|
|
1186
|
+
}
|
|
1187
|
+
function overflowCheckFailed(result) {
|
|
1188
|
+
return result.checks.some((check) => check.status === "failed" && (check.type === "no_horizontal_overflow" || check.type === "no_mobile_horizontal_overflow" || check.type === "frame_no_horizontal_overflow"));
|
|
1189
|
+
}
|
|
1190
|
+
function sideCaveatOverflowLine(viewport) {
|
|
1191
|
+
const name = cliString(viewport.name) || "viewport";
|
|
1192
|
+
const scrollOverflow = cliFiniteNumber(viewport.overflow_px);
|
|
1193
|
+
const boundsOverflow = cliFiniteNumber(viewport.bounds_overflow_px);
|
|
1194
|
+
if ((scrollOverflow === void 0 || scrollOverflow <= 0) && (boundsOverflow === void 0 || boundsOverflow <= 0)) return void 0;
|
|
1195
|
+
const parts = [
|
|
1196
|
+
scrollOverflow !== void 0 && scrollOverflow > 0 ? `scroll overflow ${scrollOverflow}px` : "",
|
|
1197
|
+
boundsOverflow !== void 0 && boundsOverflow > 0 ? `bounds overflow ${boundsOverflow}px` : ""
|
|
1198
|
+
].filter(Boolean);
|
|
1199
|
+
const offenders = Array.isArray(viewport.overflow_offenders) ? viewport.overflow_offenders.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
1200
|
+
const offender = offenders.find((item) => {
|
|
1201
|
+
const overflow = cliFiniteNumber(item.bounds_overflow_px) ?? cliFiniteNumber(item.overflow_px) ?? cliFiniteNumber(item.overflow);
|
|
1202
|
+
return overflow !== void 0 && overflow > 0;
|
|
1203
|
+
});
|
|
1204
|
+
const offenderSelector = cliString(offender?.selector);
|
|
1205
|
+
const offenderOverflow = offender ? cliFiniteNumber(offender.bounds_overflow_px) ?? cliFiniteNumber(offender.overflow_px) ?? cliFiniteNumber(offender.overflow) : void 0;
|
|
1206
|
+
return `- side caveat layout ${name}: ${parts.join(", ")}${offenderSelector && offenderOverflow !== void 0 ? `; top offender ${markdownInlineCode(offenderSelector, 100)} ${offenderOverflow}px` : ""}`;
|
|
1207
|
+
}
|
|
1208
|
+
function profileSideCaveatSummaryMarkdown(result) {
|
|
1209
|
+
const lines = [];
|
|
1210
|
+
for (const check of result.checks) {
|
|
1211
|
+
if (check.status !== "passed") continue;
|
|
1212
|
+
const evidence = cliRecord(check.evidence);
|
|
1213
|
+
if (!evidence) continue;
|
|
1214
|
+
if (check.type === "no_console_warnings") {
|
|
1215
|
+
const allowed = sideCaveatAllowlistPart(evidence, "total_console_warning_count", "allowed_console_warning_count");
|
|
1216
|
+
if (allowed) {
|
|
1217
|
+
const allowlist = sideCaveatAllowlistCounts(evidence);
|
|
1218
|
+
lines.push(`- side caveat console warnings: ${allowed}${allowlist ? `; ${allowlist}` : ""}`);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
if (check.type === "no_fatal_console_errors") {
|
|
1222
|
+
const consoleAllowed = sideCaveatAllowlistPart(evidence, "total_console_fatal_count", "allowed_console_fatal_count");
|
|
1223
|
+
const pageAllowed = sideCaveatAllowlistPart(evidence, "total_page_error_count", "allowed_page_error_count");
|
|
1224
|
+
const parts = [
|
|
1225
|
+
consoleAllowed ? `console fatal ${consoleAllowed}` : "",
|
|
1226
|
+
pageAllowed ? `page errors ${pageAllowed}` : "",
|
|
1227
|
+
sideCaveatAllowlistCounts(evidence)
|
|
1228
|
+
].filter(Boolean);
|
|
1229
|
+
if (parts.length) lines.push(`- side caveat fatal errors: ${parts.join("; ")}`);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
if (!overflowCheckFailed(result) && Array.isArray(result.evidence?.viewports)) {
|
|
1233
|
+
for (const viewport of result.evidence.viewports.slice(0, 8)) {
|
|
1234
|
+
const line = sideCaveatOverflowLine(cliRecord(viewport) || {});
|
|
1235
|
+
if (line) lines.push(line);
|
|
1236
|
+
}
|
|
1237
|
+
if (result.evidence.viewports.length > 8) lines.push(`- ${result.evidence.viewports.length - 8} additional viewport side caveat(s) omitted.`);
|
|
1238
|
+
}
|
|
1239
|
+
return lines.slice(0, 12);
|
|
1240
|
+
}
|
|
767
1241
|
function balancedSetupReceiptDetails(groups, limit) {
|
|
768
1242
|
if (limit <= 0) return [];
|
|
769
1243
|
const total = groups.reduce((sum, group) => sum + group.length, 0);
|
|
@@ -1481,7 +1955,7 @@ async function readArtifactJson(artifact) {
|
|
|
1481
1955
|
async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInputs) {
|
|
1482
1956
|
for (const input of fallbackInputs) {
|
|
1483
1957
|
const result = extractRiddleProofProfileResult(input);
|
|
1484
|
-
if (result) return result;
|
|
1958
|
+
if (result) return withProfileMetadata(profile, result);
|
|
1485
1959
|
}
|
|
1486
1960
|
const proofArtifacts = artifacts.filter((artifact) => /(^|\/)proof\.json(?:\.json)?$/i.test(artifact.name || artifact.url || artifact.path || "")).sort((left, right) => {
|
|
1487
1961
|
const leftName = left.name || left.url || left.path || "";
|
|
@@ -1491,7 +1965,7 @@ async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInpu
|
|
|
1491
1965
|
for (const artifact of proofArtifacts) {
|
|
1492
1966
|
const parsed = await readArtifactJson(artifact);
|
|
1493
1967
|
const result = extractRiddleProofProfileResult(parsed);
|
|
1494
|
-
if (result) return result;
|
|
1968
|
+
if (result) return withProfileMetadata(profile, result);
|
|
1495
1969
|
}
|
|
1496
1970
|
const evidenceArtifacts = artifacts.filter((artifact) => /profile-evidence|evidence\.json/i.test(artifact.name || artifact.url || artifact.path || ""));
|
|
1497
1971
|
for (const artifact of evidenceArtifacts) {
|
|
@@ -1502,6 +1976,16 @@ async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInpu
|
|
|
1502
1976
|
}
|
|
1503
1977
|
return void 0;
|
|
1504
1978
|
}
|
|
1979
|
+
function withProfileMetadata(profile, result) {
|
|
1980
|
+
if (!profile.metadata || !Object.keys(profile.metadata).length) return result;
|
|
1981
|
+
return {
|
|
1982
|
+
...result,
|
|
1983
|
+
metadata: {
|
|
1984
|
+
...profile.metadata,
|
|
1985
|
+
...result.metadata || {}
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1505
1989
|
function withRiddleMetadata(result, input) {
|
|
1506
1990
|
const poll = input.poll;
|
|
1507
1991
|
const staleJobIds = input.staleJobIds?.filter(Boolean);
|
|
@@ -1845,7 +2329,7 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
|
1845
2329
|
jobId = typeof created.job_id === "string" ? created.job_id : typeof created.id === "string" ? created.id : "";
|
|
1846
2330
|
if (!jobId) {
|
|
1847
2331
|
const directResult = extractRiddleProofProfileResult(created);
|
|
1848
|
-
return directResult ? withRiddleMetadata(directResult, { artifacts: collectRiddleProfileArtifactRefs(created) }) : createRiddleProofProfileInsufficientResult({ profile, runner, error: "Riddle run response was missing job_id.", artifacts: collectRiddleProfileArtifactRefs(created) });
|
|
2332
|
+
return directResult ? withRiddleMetadata(withProfileMetadata(profile, directResult), { artifacts: collectRiddleProfileArtifactRefs(created) }) : createRiddleProofProfileInsufficientResult({ profile, runner, error: "Riddle run response was missing job_id.", artifacts: collectRiddleProfileArtifactRefs(created) });
|
|
1849
2333
|
}
|
|
1850
2334
|
poll = await client.pollJob(jobId, pollOptions);
|
|
1851
2335
|
if (attempt < retryLimit && shouldRetryUnsubmittedRiddleJob(poll)) {
|
package/dist/index.cjs
CHANGED
|
@@ -9222,8 +9222,9 @@ function profileSetupWindowCallReceipts(results) {
|
|
|
9222
9222
|
path: result.path ?? null,
|
|
9223
9223
|
return_captured: result.return_captured ?? null,
|
|
9224
9224
|
return_stored_to: result.return_stored_to ?? null,
|
|
9225
|
-
reason: result.reason ?? result.
|
|
9225
|
+
reason: result.reason ?? result.store_reason ?? null
|
|
9226
9226
|
};
|
|
9227
|
+
if (result.error !== void 0) receipt.error = result.error;
|
|
9227
9228
|
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
9228
9229
|
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
9229
9230
|
const returnSummary = profileSetupReturnSummary(result);
|
|
@@ -9239,8 +9240,9 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
9239
9240
|
script_length: result.script_length ?? null,
|
|
9240
9241
|
return_captured: result.return_captured ?? null,
|
|
9241
9242
|
return_stored_to: result.return_stored_to ?? null,
|
|
9242
|
-
reason: result.reason ?? result.
|
|
9243
|
+
reason: result.reason ?? result.store_reason ?? null
|
|
9243
9244
|
};
|
|
9245
|
+
if (result.error !== void 0) receipt.error = result.error;
|
|
9244
9246
|
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
9245
9247
|
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
9246
9248
|
const returnSummary = profileSetupReturnSummary(result);
|
|
@@ -9605,6 +9607,7 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9605
9607
|
selector: result.selector ?? null,
|
|
9606
9608
|
frame_selector: result.frame_selector ?? null,
|
|
9607
9609
|
reason: result.reason ?? result.error ?? null,
|
|
9610
|
+
error: result.error ?? null,
|
|
9608
9611
|
case_insensitive_text: compactProfileSetupSummaryText(result.case_insensitive_text)
|
|
9609
9612
|
})),
|
|
9610
9613
|
optional_failed: optionalFailed.map((result) => ({
|
|
@@ -9613,6 +9616,7 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9613
9616
|
selector: result.selector ?? null,
|
|
9614
9617
|
frame_selector: result.frame_selector ?? null,
|
|
9615
9618
|
reason: result.reason ?? result.error ?? null,
|
|
9619
|
+
error: result.error ?? null,
|
|
9616
9620
|
case_insensitive_text: compactProfileSetupSummaryText(result.case_insensitive_text)
|
|
9617
9621
|
}))
|
|
9618
9622
|
};
|
|
@@ -12193,6 +12197,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
|
|
|
12193
12197
|
checks,
|
|
12194
12198
|
summary: summarizeRiddleProofProfileResult({ profile_name: profile.name, status, checks, viewports: evidence?.viewports || [] }),
|
|
12195
12199
|
captured_at: capturedAt,
|
|
12200
|
+
metadata: profile.metadata,
|
|
12196
12201
|
warnings: warnings.length ? warnings : void 0,
|
|
12197
12202
|
evidence,
|
|
12198
12203
|
riddle: options.riddle
|
|
@@ -12254,6 +12259,7 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
|
12254
12259
|
checks: [],
|
|
12255
12260
|
summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
|
|
12256
12261
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12262
|
+
metadata: input.profile.metadata,
|
|
12257
12263
|
warnings: warnings.length ? warnings : void 0,
|
|
12258
12264
|
riddle: input.riddle,
|
|
12259
12265
|
environment_blocker: environmentBlocker,
|
|
@@ -12330,6 +12336,7 @@ function createRiddleProofProfileInsufficientResult(input) {
|
|
|
12330
12336
|
checks: [],
|
|
12331
12337
|
summary: `${input.profile.name} did not produce enough evidence for a profile judgment.`,
|
|
12332
12338
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12339
|
+
metadata: input.profile.metadata,
|
|
12333
12340
|
warnings: warnings.length ? warnings : void 0,
|
|
12334
12341
|
riddle: input.riddle,
|
|
12335
12342
|
error: message
|
|
@@ -13096,8 +13103,9 @@ function profileSetupWindowCallReceipts(results) {
|
|
|
13096
13103
|
path: result.path ?? null,
|
|
13097
13104
|
return_captured: result.return_captured ?? null,
|
|
13098
13105
|
return_stored_to: result.return_stored_to ?? null,
|
|
13099
|
-
reason: result.reason || result.
|
|
13106
|
+
reason: result.reason || result.store_reason || null,
|
|
13100
13107
|
};
|
|
13108
|
+
if (result.error !== undefined) receipt.error = result.error;
|
|
13101
13109
|
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
13102
13110
|
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
13103
13111
|
const returnSummary = profileSetupReturnSummary(result);
|
|
@@ -13115,8 +13123,9 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
13115
13123
|
script_length: result.script_length ?? null,
|
|
13116
13124
|
return_captured: result.return_captured ?? null,
|
|
13117
13125
|
return_stored_to: result.return_stored_to ?? null,
|
|
13118
|
-
reason: result.reason || result.
|
|
13126
|
+
reason: result.reason || result.store_reason || null,
|
|
13119
13127
|
};
|
|
13128
|
+
if (result.error !== undefined) receipt.error = result.error;
|
|
13120
13129
|
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
13121
13130
|
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
13122
13131
|
const returnSummary = profileSetupReturnSummary(result);
|
|
@@ -13526,6 +13535,7 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
13526
13535
|
selector: result.selector ?? null,
|
|
13527
13536
|
frame_selector: result.frame_selector ?? null,
|
|
13528
13537
|
reason: result.reason || result.error || null,
|
|
13538
|
+
error: result.error || null,
|
|
13529
13539
|
case_insensitive_text: compactProfileSetupSummaryText(result.case_insensitive_text),
|
|
13530
13540
|
})),
|
|
13531
13541
|
optional_failed: optionalFailed.map((result) => ({
|
|
@@ -13534,6 +13544,7 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
13534
13544
|
selector: result.selector ?? null,
|
|
13535
13545
|
frame_selector: result.frame_selector ?? null,
|
|
13536
13546
|
reason: result.reason || result.error || null,
|
|
13547
|
+
error: result.error || null,
|
|
13537
13548
|
case_insensitive_text: compactProfileSetupSummaryText(result.case_insensitive_text),
|
|
13538
13549
|
})),
|
|
13539
13550
|
};
|
|
@@ -14256,6 +14267,7 @@ function assessProfile(profile, evidence) {
|
|
|
14256
14267
|
checks,
|
|
14257
14268
|
summary,
|
|
14258
14269
|
captured_at: evidence.captured_at,
|
|
14270
|
+
metadata: profile.metadata,
|
|
14259
14271
|
warnings: profileWarnings.length ? profileWarnings : undefined,
|
|
14260
14272
|
evidence,
|
|
14261
14273
|
};
|