@riddledc/riddle-proof 0.7.196 → 0.7.198

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/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  profileStatusExitCode,
14
14
  resolveRiddleProofProfileTargetUrl,
15
15
  resolveRiddleProofProfileTimeoutSec
16
- } from "./chunk-WUOU5RB4.js";
16
+ } from "./chunk-DL6UB4N6.js";
17
17
  import {
18
18
  createRiddleApiClient,
19
19
  isTerminalRiddleJobStatus,
@@ -834,10 +834,25 @@ function profilePackReceiptStatus(result, metadata, receipt) {
834
834
  ...setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "window_call"))
835
835
  ].filter((item) => item.ok !== false);
836
836
  const clickCount = setupViewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0) + profileSetupReceiptTotal(setupViewports, "click") + profileSetupReceiptTotal(setupViewports, "click_count");
837
- const visibleUiActionCount = clickCount + profileSetupReceiptTotal(setupViewports, "tap");
837
+ const clickFallbackTapKeys = /* @__PURE__ */ new Set();
838
+ [
839
+ ...setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "clicked")),
840
+ ...evidenceViewports.flatMap((viewport) => setupReceiptArray(cliRecord(viewport) || {}, "setup_action_results"))
841
+ ].forEach((receipt2, index) => {
842
+ if (receipt2.ok === false || receipt2.fallback_to_tap !== true) return;
843
+ const action = cliString(receipt2.action);
844
+ if (action && action !== "click") return;
845
+ const ordinal = cliFiniteNumber(receipt2.ordinal);
846
+ const selector = cliString(receipt2.selector) || "";
847
+ const frameSelector = cliString(receipt2.frame_selector) || "";
848
+ clickFallbackTapKeys.add(`${ordinal === void 0 ? `idx:${index}` : `ord:${ordinal}`}:${frameSelector}:${selector}`);
849
+ });
850
+ const clickFallbackTapCount = clickFallbackTapKeys.size;
851
+ const tapUntilCount = profileSetupReceiptTotal(setupViewports, "tap_until");
852
+ const visibleUiActionCount = clickCount + profileSetupReceiptTotal(setupViewports, "tap") + tapUntilCount;
838
853
  const setupFailureCount = profileSetupFailureCount(setupViewports);
839
854
  const setupObstructionCount = profileSetupObstructionCount(setupViewports);
840
- const inputDispatchCount = profileSetupReceiptTotal(setupViewports, "drag") + profileSetupReceiptTotal(setupViewports, "tap") + profileSetupReceiptTotal(setupViewports, "press") + profileSetupReceiptTotal(setupViewports, "keyboard_sequence");
855
+ const inputDispatchCount = profileSetupReceiptTotal(setupViewports, "drag") + profileSetupReceiptTotal(setupViewports, "tap") + tapUntilCount + profileSetupReceiptTotal(setupViewports, "press") + profileSetupReceiptTotal(setupViewports, "keyboard_sequence");
841
856
  const canvasReceipts = setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "canvas_signature"));
842
857
  const hasCanvasChange = canvasReceipts.some((item) => item.ok !== false && item.changed === true);
843
858
  const canvasSignatureHashes = canvasReceipts.filter((item) => item.ok !== false).map((item) => cliString(item.hash)).filter(Boolean);
@@ -897,6 +912,20 @@ function profilePackReceiptStatus(result, metadata, receipt) {
897
912
  if (text.includes("setup action")) {
898
913
  return profileReceiptSignalStatus(hasSetupReceipts, "setup receipts present", "setup receipts missing");
899
914
  }
915
+ if (text.includes("click") && text.includes("fallback") && text.includes("tap")) {
916
+ return profileReceiptSignalStatus(
917
+ clickFallbackTapCount > 0,
918
+ `click fallback tap evidence present (${clickFallbackTapCount})`,
919
+ "click fallback tap evidence missing"
920
+ );
921
+ }
922
+ if (text.includes("tap_until") || text.includes("tap until") || text.includes("tap-until")) {
923
+ return profileReceiptSignalStatus(
924
+ tapUntilCount > 0,
925
+ `tap_until receipt present (${tapUntilCount})`,
926
+ "tap_until receipt missing"
927
+ );
928
+ }
900
929
  if (text.includes("active") && (text.includes("route-local") || text.includes("route local")) && (text.includes("proof helper") || text.includes("proof api") || text.includes("proof state"))) {
901
930
  return profileReceiptSignalStatus(
902
931
  hasActiveRouteLocalProofReceipt,
@@ -1332,6 +1361,7 @@ function setupNaturalInputSummaryMarkdown(viewports) {
1332
1361
  const inputReceipts = [
1333
1362
  ...setupReceiptArray(viewport, "drag").map((receipt) => ({ kind: "drag", receipt })),
1334
1363
  ...setupReceiptArray(viewport, "tap").map((receipt) => ({ kind: "tap", receipt })),
1364
+ ...setupReceiptArray(viewport, "tap_until").map((receipt) => ({ kind: "tap_until", receipt })),
1335
1365
  ...setupReceiptArray(viewport, "press").map((receipt) => ({ kind: "press", receipt }))
1336
1366
  ].filter(({ receipt }) => receipt.ok !== false);
1337
1367
  if (!inputReceipts.length) continue;
@@ -1726,6 +1756,8 @@ function profileSetupSummaryMarkdown(result) {
1726
1756
  const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
1727
1757
  const dragTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.drag_total) || 0), 0);
1728
1758
  const tapTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.tap_total) || 0), 0);
1759
+ const tapUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.tap_until_total) || 0), 0);
1760
+ const tapUntilTapTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.tap_until_tap_total) || 0), 0);
1729
1761
  const keyboardTotal = viewports.reduce((sum, viewport) => {
1730
1762
  const total = cliFiniteNumber(viewport.keyboard_total);
1731
1763
  return sum + (total === void 0 ? cliFiniteNumber(viewport.press_total) || 0 : total);
@@ -1765,6 +1797,9 @@ function profileSetupSummaryMarkdown(result) {
1765
1797
  if (tapTotal) {
1766
1798
  lines.push(`- tap: ${tapTotal} action(s)`);
1767
1799
  }
1800
+ if (tapUntilTotal) {
1801
+ lines.push(`- tap_until: ${tapUntilTotal} action(s), tap_count total ${tapUntilTapTotal}`);
1802
+ }
1768
1803
  if (keyboardTotal) {
1769
1804
  lines.push(`- keyboard: ${keyboardTotal} action(s)`);
1770
1805
  }
@@ -1792,10 +1827,12 @@ function profileSetupSummaryMarkdown(result) {
1792
1827
  const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
1793
1828
  const dragActions = cliFiniteNumber(viewport.drag_total) || 0;
1794
1829
  const tapActions = cliFiniteNumber(viewport.tap_total) || 0;
1830
+ const tapUntilActions = cliFiniteNumber(viewport.tap_until_total) || 0;
1831
+ const tapUntilTaps = cliFiniteNumber(viewport.tap_until_tap_total) || 0;
1795
1832
  const keyboardActions = cliFiniteNumber(viewport.keyboard_total) ?? cliFiniteNumber(viewport.press_total) ?? 0;
1796
1833
  const canvasSignatureActions = cliFiniteNumber(viewport.canvas_signature_total) || 0;
1797
1834
  const observedPath = cliString(viewport.observed_path);
1798
- lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickSequenceCount ? `, ${clickSequenceCount} click sequence(s)` : ""}${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${tapActions ? `, ${tapActions} tap action(s)` : ""}${keyboardActions ? `, ${keyboardActions} keyboard action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${deterministicRuntimeActions ? `, ${deterministicRuntimeActions} deterministic_runtime action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
1835
+ lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickSequenceCount ? `, ${clickSequenceCount} click sequence(s)` : ""}${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${tapActions ? `, ${tapActions} tap action(s)` : ""}${tapUntilActions ? `, ${tapUntilActions} tap_until action(s), ${tapUntilTaps} tap(s)` : ""}${keyboardActions ? `, ${keyboardActions} keyboard action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${deterministicRuntimeActions ? `, ${deterministicRuntimeActions} deterministic_runtime action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
1799
1836
  }
1800
1837
  const clickSequenceGroups = viewports.map((viewport) => {
1801
1838
  const name = cliString(viewport.name) || "viewport";
@@ -1862,6 +1899,33 @@ function profileSetupSummaryMarkdown(result) {
1862
1899
  lines.push(`- ${name} tap: ${ok}, ${markdownInlineCode(selector)}${pointerType ? ` ${markdownInlineCode(pointerType)}` : ""}${inputDispatch ? ` via ${markdownInlineCode(inputDispatch)}` : ""}${coordinateText}${durationMs === void 0 ? "" : `, duration ${durationMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
1863
1900
  }
1864
1901
  if (tapDetails.length > sampledTapDetails.length) lines.push(`- ${tapDetails.length - sampledTapDetails.length} additional tap receipt(s) omitted.`);
1902
+ const tapUntilGroups = viewports.map((viewport) => {
1903
+ const name = cliString(viewport.name) || "viewport";
1904
+ const receipts = Array.isArray(viewport.tap_until) ? viewport.tap_until.map(cliRecord).filter((item) => Boolean(item)) : [];
1905
+ return receipts.map((receipt) => ({ name, receipt }));
1906
+ });
1907
+ const tapUntilDetails = tapUntilGroups.flat();
1908
+ const sampledTapUntilDetails = balancedSetupReceiptDetails(tapUntilGroups, 12);
1909
+ for (const { name, receipt } of sampledTapUntilDetails) {
1910
+ const selector = cliString(receipt.selector) || "target";
1911
+ const pointerType = cliString(receipt.pointer_type);
1912
+ const inputDispatch = cliString(receipt.input_dispatch);
1913
+ const coordinateMode = cliString(receipt.coordinate_mode);
1914
+ const x = cliValueLabel(receipt.x);
1915
+ const y = cliValueLabel(receipt.y);
1916
+ const durationMs = cliFiniteNumber(receipt.duration_ms);
1917
+ const untilPath = cliString(receipt.until_path) || "until_path";
1918
+ const expected = cliValueLabel(receipt.until_expected_value);
1919
+ const actual = cliValueLabel(receipt.until_value);
1920
+ const tapCount = cliFiniteNumber(receipt.tap_count);
1921
+ const maxTaps = cliFiniteNumber(receipt.max_taps) ?? cliFiniteNumber(receipt.max_calls);
1922
+ const ok = receipt.ok === false ? "failed" : "ok";
1923
+ const reason = cliString(receipt.reason);
1924
+ const coordinateText = x && y ? `, ${coordinateMode ? `${coordinateMode} ` : ""}${markdownInlineCode(`${x},${y}`)}` : "";
1925
+ const tapText = tapCount === void 0 ? "" : ` in ${tapCount}${maxTaps === void 0 ? "" : `/${maxTaps}`} tap(s)`;
1926
+ lines.push(`- ${name} tap_until: ${ok}, ${markdownInlineCode(selector)}${pointerType ? ` ${markdownInlineCode(pointerType)}` : ""}${inputDispatch ? ` via ${markdownInlineCode(inputDispatch)}` : ""}${coordinateText}${durationMs === void 0 ? "" : `, duration ${durationMs}ms`} until ${markdownInlineCode(untilPath)}${expected === void 0 ? "" : ` == ${markdownInlineCode(expected, 80)}`}${tapText}${actual === void 0 ? "" : `, observed ${markdownInlineCode(actual, 80)}`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
1927
+ }
1928
+ if (tapUntilDetails.length > sampledTapUntilDetails.length) lines.push(`- ${tapUntilDetails.length - sampledTapUntilDetails.length} additional tap_until receipt(s) omitted.`);
1865
1929
  const keyboardGroups = viewports.map((viewport) => {
1866
1930
  const name = cliString(viewport.name) || "viewport";
1867
1931
  const rawReceipts = Array.isArray(viewport.keyboard) ? viewport.keyboard : viewport.press;