@riddledc/riddle-proof 0.7.138 → 0.7.139

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 CHANGED
@@ -482,6 +482,12 @@ and `click_count_value_total`.
482
482
  profile carries its own hosted Riddle worker budget; an explicit CLI `--timeout`
483
483
  still overrides the profile value for one-off runs.
484
484
 
485
+ Profile final viewport screenshots are full-page by default. Set
486
+ `target.screenshot_full_page: false`, `target.screenshotFullPage: false`, or
487
+ `target.screenshot_mode: "viewport"` when the automatic final screenshots
488
+ should capture only the current viewport, for example when fixed or sticky
489
+ headers make full-page captures misleading.
490
+
485
491
  Use `allowed_console_patterns` / `allowed_console_texts` on
486
492
  `no_fatal_console_errors` when a negative-path profile intentionally triggers a
487
493
  known browser console error, such as a mocked `503` that the app recovers from:
@@ -875,6 +875,42 @@ function normalizeSetupActions(value) {
875
875
  if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
876
876
  return value.map(normalizeSetupAction);
877
877
  }
878
+ function normalizeTargetScreenshotFullPage(input) {
879
+ const directFullPage = booleanValue(valueFromOwn(
880
+ input,
881
+ "screenshot_full_page",
882
+ "screenshotFullPage",
883
+ "final_screenshot_full_page",
884
+ "finalScreenshotFullPage",
885
+ "full_page_screenshots",
886
+ "fullPageScreenshots"
887
+ ));
888
+ const viewportOnly = booleanValue(valueFromOwn(
889
+ input,
890
+ "viewport_screenshots",
891
+ "viewportScreenshots",
892
+ "viewport_only_screenshots",
893
+ "viewportOnlyScreenshots"
894
+ ));
895
+ const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
896
+ let modeFullPage;
897
+ if (modeInput) {
898
+ const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
899
+ if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
900
+ modeFullPage = true;
901
+ } else if (mode === "viewport" || mode === "view") {
902
+ modeFullPage = false;
903
+ } else {
904
+ throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
905
+ }
906
+ }
907
+ const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
908
+ if (!values.length) return void 0;
909
+ if (values.some((value) => value !== values[0])) {
910
+ throw new Error("target has conflicting screenshot full_page / viewport mode options.");
911
+ }
912
+ return values[0];
913
+ }
878
914
  function normalizeNetworkMock(input, index) {
879
915
  if (!isRecord(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
880
916
  const url = stringValue(input.url) || stringValue(input.glob) || stringValue(input.pattern);
@@ -1443,6 +1479,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
1443
1479
  timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
1444
1480
  wait_for_selector: stringValue(targetInput.wait_for_selector) || stringValue(targetInput.waitForSelector),
1445
1481
  wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
1482
+ screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
1446
1483
  setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
1447
1484
  network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
1448
1485
  },
@@ -6890,7 +6927,9 @@ async function captureViewport(viewport) {
6890
6927
  }
6891
6928
  const screenshotLabel = profileSlug + "-" + viewport.name;
6892
6929
  try {
6893
- if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel);
6930
+ const screenshotOptions = {};
6931
+ if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
6932
+ if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
6894
6933
  } catch (error) {
6895
6934
  pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
6896
6935
  }
package/dist/cli.cjs CHANGED
@@ -7812,6 +7812,42 @@ function normalizeSetupActions(value) {
7812
7812
  if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
7813
7813
  return value.map(normalizeSetupAction);
7814
7814
  }
7815
+ function normalizeTargetScreenshotFullPage(input) {
7816
+ const directFullPage = booleanValue(valueFromOwn(
7817
+ input,
7818
+ "screenshot_full_page",
7819
+ "screenshotFullPage",
7820
+ "final_screenshot_full_page",
7821
+ "finalScreenshotFullPage",
7822
+ "full_page_screenshots",
7823
+ "fullPageScreenshots"
7824
+ ));
7825
+ const viewportOnly = booleanValue(valueFromOwn(
7826
+ input,
7827
+ "viewport_screenshots",
7828
+ "viewportScreenshots",
7829
+ "viewport_only_screenshots",
7830
+ "viewportOnlyScreenshots"
7831
+ ));
7832
+ const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
7833
+ let modeFullPage;
7834
+ if (modeInput) {
7835
+ const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
7836
+ if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
7837
+ modeFullPage = true;
7838
+ } else if (mode === "viewport" || mode === "view") {
7839
+ modeFullPage = false;
7840
+ } else {
7841
+ throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
7842
+ }
7843
+ }
7844
+ const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
7845
+ if (!values.length) return void 0;
7846
+ if (values.some((value) => value !== values[0])) {
7847
+ throw new Error("target has conflicting screenshot full_page / viewport mode options.");
7848
+ }
7849
+ return values[0];
7850
+ }
7815
7851
  function normalizeNetworkMock(input, index) {
7816
7852
  if (!isRecord(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
7817
7853
  const url = stringValue2(input.url) || stringValue2(input.glob) || stringValue2(input.pattern);
@@ -8380,6 +8416,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
8380
8416
  timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
8381
8417
  wait_for_selector: stringValue2(targetInput.wait_for_selector) || stringValue2(targetInput.waitForSelector),
8382
8418
  wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
8419
+ screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
8383
8420
  setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
8384
8421
  network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
8385
8422
  },
@@ -13811,7 +13848,9 @@ async function captureViewport(viewport) {
13811
13848
  }
13812
13849
  const screenshotLabel = profileSlug + "-" + viewport.name;
13813
13850
  try {
13814
- if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel);
13851
+ const screenshotOptions = {};
13852
+ if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
13853
+ if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
13815
13854
  } catch (error) {
13816
13855
  pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
13817
13856
  }
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  profileStatusExitCode,
13
13
  resolveRiddleProofProfileTargetUrl,
14
14
  resolveRiddleProofProfileTimeoutSec
15
- } from "./chunk-N75EAJNG.js";
15
+ } from "./chunk-DB6J53V5.js";
16
16
  import {
17
17
  createRiddleApiClient,
18
18
  parseRiddleViewport
package/dist/index.cjs CHANGED
@@ -9608,6 +9608,42 @@ function normalizeSetupActions(value) {
9608
9608
  if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
9609
9609
  return value.map(normalizeSetupAction);
9610
9610
  }
9611
+ function normalizeTargetScreenshotFullPage(input) {
9612
+ const directFullPage = booleanValue(valueFromOwn(
9613
+ input,
9614
+ "screenshot_full_page",
9615
+ "screenshotFullPage",
9616
+ "final_screenshot_full_page",
9617
+ "finalScreenshotFullPage",
9618
+ "full_page_screenshots",
9619
+ "fullPageScreenshots"
9620
+ ));
9621
+ const viewportOnly = booleanValue(valueFromOwn(
9622
+ input,
9623
+ "viewport_screenshots",
9624
+ "viewportScreenshots",
9625
+ "viewport_only_screenshots",
9626
+ "viewportOnlyScreenshots"
9627
+ ));
9628
+ const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
9629
+ let modeFullPage;
9630
+ if (modeInput) {
9631
+ const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
9632
+ if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
9633
+ modeFullPage = true;
9634
+ } else if (mode === "viewport" || mode === "view") {
9635
+ modeFullPage = false;
9636
+ } else {
9637
+ throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
9638
+ }
9639
+ }
9640
+ const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
9641
+ if (!values.length) return void 0;
9642
+ if (values.some((value) => value !== values[0])) {
9643
+ throw new Error("target has conflicting screenshot full_page / viewport mode options.");
9644
+ }
9645
+ return values[0];
9646
+ }
9611
9647
  function normalizeNetworkMock(input, index) {
9612
9648
  if (!isRecord2(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
9613
9649
  const url = stringValue5(input.url) || stringValue5(input.glob) || stringValue5(input.pattern);
@@ -10176,6 +10212,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
10176
10212
  timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
10177
10213
  wait_for_selector: stringValue5(targetInput.wait_for_selector) || stringValue5(targetInput.waitForSelector),
10178
10214
  wait_ms: numberValue3(targetInput.wait_ms) ?? numberValue3(targetInput.waitMs),
10215
+ screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
10179
10216
  setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
10180
10217
  network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
10181
10218
  },
@@ -15623,7 +15660,9 @@ async function captureViewport(viewport) {
15623
15660
  }
15624
15661
  const screenshotLabel = profileSlug + "-" + viewport.name;
15625
15662
  try {
15626
- if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel);
15663
+ const screenshotOptions = {};
15664
+ if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
15665
+ if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
15627
15666
  } catch (error) {
15628
15667
  pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
15629
15668
  }
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  resolveRiddleProofProfileTimeoutSec,
63
63
  slugifyRiddleProofProfileName,
64
64
  summarizeRiddleProofProfileResult
65
- } from "./chunk-N75EAJNG.js";
65
+ } from "./chunk-DB6J53V5.js";
66
66
  import {
67
67
  DEFAULT_RIDDLE_API_BASE_URL,
68
68
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -922,6 +922,42 @@ function normalizeSetupActions(value) {
922
922
  if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
923
923
  return value.map(normalizeSetupAction);
924
924
  }
925
+ function normalizeTargetScreenshotFullPage(input) {
926
+ const directFullPage = booleanValue(valueFromOwn(
927
+ input,
928
+ "screenshot_full_page",
929
+ "screenshotFullPage",
930
+ "final_screenshot_full_page",
931
+ "finalScreenshotFullPage",
932
+ "full_page_screenshots",
933
+ "fullPageScreenshots"
934
+ ));
935
+ const viewportOnly = booleanValue(valueFromOwn(
936
+ input,
937
+ "viewport_screenshots",
938
+ "viewportScreenshots",
939
+ "viewport_only_screenshots",
940
+ "viewportOnlyScreenshots"
941
+ ));
942
+ const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
943
+ let modeFullPage;
944
+ if (modeInput) {
945
+ const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
946
+ if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
947
+ modeFullPage = true;
948
+ } else if (mode === "viewport" || mode === "view") {
949
+ modeFullPage = false;
950
+ } else {
951
+ throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
952
+ }
953
+ }
954
+ const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
955
+ if (!values.length) return void 0;
956
+ if (values.some((value) => value !== values[0])) {
957
+ throw new Error("target has conflicting screenshot full_page / viewport mode options.");
958
+ }
959
+ return values[0];
960
+ }
925
961
  function normalizeNetworkMock(input, index) {
926
962
  if (!isRecord(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
927
963
  const url = stringValue(input.url) || stringValue(input.glob) || stringValue(input.pattern);
@@ -1490,6 +1526,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
1490
1526
  timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
1491
1527
  wait_for_selector: stringValue(targetInput.wait_for_selector) || stringValue(targetInput.waitForSelector),
1492
1528
  wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
1529
+ screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
1493
1530
  setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
1494
1531
  network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
1495
1532
  },
@@ -6937,7 +6974,9 @@ async function captureViewport(viewport) {
6937
6974
  }
6938
6975
  const screenshotLabel = profileSlug + "-" + viewport.name;
6939
6976
  try {
6940
- if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel);
6977
+ const screenshotOptions = {};
6978
+ if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
6979
+ if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
6941
6980
  } catch (error) {
6942
6981
  pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
6943
6982
  }
@@ -203,6 +203,7 @@ interface RiddleProofProfileTarget {
203
203
  timeout_sec?: number;
204
204
  wait_for_selector?: string;
205
205
  wait_ms?: number;
206
+ screenshot_full_page?: boolean;
206
207
  setup_actions?: RiddleProofProfileSetupAction[];
207
208
  network_mocks?: RiddleProofProfileNetworkMock[];
208
209
  }
package/dist/profile.d.ts CHANGED
@@ -203,6 +203,7 @@ interface RiddleProofProfileTarget {
203
203
  timeout_sec?: number;
204
204
  wait_for_selector?: string;
205
205
  wait_ms?: number;
206
+ screenshot_full_page?: boolean;
206
207
  setup_actions?: RiddleProofProfileSetupAction[];
207
208
  network_mocks?: RiddleProofProfileNetworkMock[];
208
209
  }
package/dist/profile.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  resolveRiddleProofProfileTimeoutSec,
24
24
  slugifyRiddleProofProfileName,
25
25
  summarizeRiddleProofProfileResult
26
- } from "./chunk-N75EAJNG.js";
26
+ } from "./chunk-DB6J53V5.js";
27
27
  export {
28
28
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
29
29
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.138",
3
+ "version": "0.7.139",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",