@riddledc/riddle-proof 0.7.213 → 0.7.214

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.
@@ -5797,6 +5797,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
5797
5797
  if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
5798
5798
  return compactSetupResultText(normalizedSample);
5799
5799
  }
5800
+ async function selectorVisibilityDiagnostic(context, selector) {
5801
+ return await context.locator(selector).evaluateAll((elements) => {
5802
+ const isVisible = (element) => {
5803
+ const style = window.getComputedStyle(element);
5804
+ const rect = element.getBoundingClientRect();
5805
+ return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
5806
+ };
5807
+ const describeElement = (element) => {
5808
+ const tag = String(element.tagName || "element").toLowerCase();
5809
+ const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
5810
+ const classes = String(element.getAttribute("class") || "")
5811
+ .split(/\s+/)
5812
+ .filter(Boolean)
5813
+ .slice(0, 3)
5814
+ .map((name) => "." + name.slice(0, 32))
5815
+ .join("");
5816
+ return (tag + id + classes).slice(0, 120);
5817
+ };
5818
+ const describeBox = (element) => {
5819
+ const rect = element.getBoundingClientRect();
5820
+ const style = window.getComputedStyle(element);
5821
+ const width = Math.round(rect.width * 10) / 10;
5822
+ const height = Math.round(rect.height * 10) / 10;
5823
+ return describeElement(element)
5824
+ + " " + width + "x" + height
5825
+ + " display=" + (style ? style.display : "unknown")
5826
+ + " visibility=" + (style ? style.visibility : "unknown");
5827
+ };
5828
+ if (!elements.length) return "selector_not_found";
5829
+ const visibleCount = elements.filter(isVisible).length;
5830
+ let visibleDescendant = null;
5831
+ for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
5832
+ const descendants = Array.from(elements[index].querySelectorAll("*"));
5833
+ const match = descendants.find(isVisible);
5834
+ if (match) {
5835
+ visibleDescendant = {
5836
+ parent_index: index,
5837
+ label: describeElement(match),
5838
+ box: describeBox(match),
5839
+ text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
5840
+ };
5841
+ }
5842
+ }
5843
+ const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
5844
+ if (visibleDescendant) {
5845
+ parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
5846
+ parts.push("visible_descendant_box " + visibleDescendant.box);
5847
+ if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
5848
+ }
5849
+ parts.push("first " + describeBox(elements[0]));
5850
+ return parts.join("; ").slice(0, 500);
5851
+ }).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
5852
+ }
5800
5853
  async function waitForAnyVisibleSelector(context, selector, timeout) {
5801
5854
  const deadline = Date.now() + setupNumber(timeout, 15000);
5802
5855
  let lastReason = "selector_not_found";
@@ -5807,7 +5860,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
5807
5860
  if (!count) {
5808
5861
  lastReason = "selector_not_found";
5809
5862
  } else {
5810
- lastReason = "no_visible_match";
5863
+ lastReason = await selectorVisibilityDiagnostic(context, selector);
5811
5864
  for (let index = 0; index < count; index += 1) {
5812
5865
  if (await locator.nth(index).isVisible().catch(() => false)) {
5813
5866
  return { ok: true, count, index };
package/dist/cli.cjs CHANGED
@@ -12750,6 +12750,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
12750
12750
  if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
12751
12751
  return compactSetupResultText(normalizedSample);
12752
12752
  }
12753
+ async function selectorVisibilityDiagnostic(context, selector) {
12754
+ return await context.locator(selector).evaluateAll((elements) => {
12755
+ const isVisible = (element) => {
12756
+ const style = window.getComputedStyle(element);
12757
+ const rect = element.getBoundingClientRect();
12758
+ return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
12759
+ };
12760
+ const describeElement = (element) => {
12761
+ const tag = String(element.tagName || "element").toLowerCase();
12762
+ const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
12763
+ const classes = String(element.getAttribute("class") || "")
12764
+ .split(/\s+/)
12765
+ .filter(Boolean)
12766
+ .slice(0, 3)
12767
+ .map((name) => "." + name.slice(0, 32))
12768
+ .join("");
12769
+ return (tag + id + classes).slice(0, 120);
12770
+ };
12771
+ const describeBox = (element) => {
12772
+ const rect = element.getBoundingClientRect();
12773
+ const style = window.getComputedStyle(element);
12774
+ const width = Math.round(rect.width * 10) / 10;
12775
+ const height = Math.round(rect.height * 10) / 10;
12776
+ return describeElement(element)
12777
+ + " " + width + "x" + height
12778
+ + " display=" + (style ? style.display : "unknown")
12779
+ + " visibility=" + (style ? style.visibility : "unknown");
12780
+ };
12781
+ if (!elements.length) return "selector_not_found";
12782
+ const visibleCount = elements.filter(isVisible).length;
12783
+ let visibleDescendant = null;
12784
+ for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
12785
+ const descendants = Array.from(elements[index].querySelectorAll("*"));
12786
+ const match = descendants.find(isVisible);
12787
+ if (match) {
12788
+ visibleDescendant = {
12789
+ parent_index: index,
12790
+ label: describeElement(match),
12791
+ box: describeBox(match),
12792
+ text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
12793
+ };
12794
+ }
12795
+ }
12796
+ const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
12797
+ if (visibleDescendant) {
12798
+ parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
12799
+ parts.push("visible_descendant_box " + visibleDescendant.box);
12800
+ if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
12801
+ }
12802
+ parts.push("first " + describeBox(elements[0]));
12803
+ return parts.join("; ").slice(0, 500);
12804
+ }).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
12805
+ }
12753
12806
  async function waitForAnyVisibleSelector(context, selector, timeout) {
12754
12807
  const deadline = Date.now() + setupNumber(timeout, 15000);
12755
12808
  let lastReason = "selector_not_found";
@@ -12760,7 +12813,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
12760
12813
  if (!count) {
12761
12814
  lastReason = "selector_not_found";
12762
12815
  } else {
12763
- lastReason = "no_visible_match";
12816
+ lastReason = await selectorVisibilityDiagnostic(context, selector);
12764
12817
  for (let index = 0; index < count; index += 1) {
12765
12818
  if (await locator.nth(index).isVisible().catch(() => false)) {
12766
12819
  return { ok: true, count, index };
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  profileStatusExitCode,
14
14
  resolveRiddleProofProfileTargetUrl,
15
15
  resolveRiddleProofProfileTimeoutSec
16
- } from "./chunk-3RTVXIFZ.js";
16
+ } from "./chunk-PEWAIEER.js";
17
17
  import {
18
18
  createRiddleApiClient,
19
19
  isTerminalRiddleJobStatus,
package/dist/index.cjs CHANGED
@@ -14532,6 +14532,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
14532
14532
  if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
14533
14533
  return compactSetupResultText(normalizedSample);
14534
14534
  }
14535
+ async function selectorVisibilityDiagnostic(context, selector) {
14536
+ return await context.locator(selector).evaluateAll((elements) => {
14537
+ const isVisible = (element) => {
14538
+ const style = window.getComputedStyle(element);
14539
+ const rect = element.getBoundingClientRect();
14540
+ return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
14541
+ };
14542
+ const describeElement = (element) => {
14543
+ const tag = String(element.tagName || "element").toLowerCase();
14544
+ const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
14545
+ const classes = String(element.getAttribute("class") || "")
14546
+ .split(/\s+/)
14547
+ .filter(Boolean)
14548
+ .slice(0, 3)
14549
+ .map((name) => "." + name.slice(0, 32))
14550
+ .join("");
14551
+ return (tag + id + classes).slice(0, 120);
14552
+ };
14553
+ const describeBox = (element) => {
14554
+ const rect = element.getBoundingClientRect();
14555
+ const style = window.getComputedStyle(element);
14556
+ const width = Math.round(rect.width * 10) / 10;
14557
+ const height = Math.round(rect.height * 10) / 10;
14558
+ return describeElement(element)
14559
+ + " " + width + "x" + height
14560
+ + " display=" + (style ? style.display : "unknown")
14561
+ + " visibility=" + (style ? style.visibility : "unknown");
14562
+ };
14563
+ if (!elements.length) return "selector_not_found";
14564
+ const visibleCount = elements.filter(isVisible).length;
14565
+ let visibleDescendant = null;
14566
+ for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
14567
+ const descendants = Array.from(elements[index].querySelectorAll("*"));
14568
+ const match = descendants.find(isVisible);
14569
+ if (match) {
14570
+ visibleDescendant = {
14571
+ parent_index: index,
14572
+ label: describeElement(match),
14573
+ box: describeBox(match),
14574
+ text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
14575
+ };
14576
+ }
14577
+ }
14578
+ const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
14579
+ if (visibleDescendant) {
14580
+ parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
14581
+ parts.push("visible_descendant_box " + visibleDescendant.box);
14582
+ if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
14583
+ }
14584
+ parts.push("first " + describeBox(elements[0]));
14585
+ return parts.join("; ").slice(0, 500);
14586
+ }).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
14587
+ }
14535
14588
  async function waitForAnyVisibleSelector(context, selector, timeout) {
14536
14589
  const deadline = Date.now() + setupNumber(timeout, 15000);
14537
14590
  let lastReason = "selector_not_found";
@@ -14542,7 +14595,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
14542
14595
  if (!count) {
14543
14596
  lastReason = "selector_not_found";
14544
14597
  } else {
14545
- lastReason = "no_visible_match";
14598
+ lastReason = await selectorVisibilityDiagnostic(context, selector);
14546
14599
  for (let index = 0; index < count; index += 1) {
14547
14600
  if (await locator.nth(index).isVisible().catch(() => false)) {
14548
14601
  return { ok: true, count, index };
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  resolveRiddleProofProfileTimeoutSec,
63
63
  slugifyRiddleProofProfileName,
64
64
  summarizeRiddleProofProfileResult
65
- } from "./chunk-3RTVXIFZ.js";
65
+ } from "./chunk-PEWAIEER.js";
66
66
  import {
67
67
  DEFAULT_RIDDLE_API_BASE_URL,
68
68
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -5844,6 +5844,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
5844
5844
  if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
5845
5845
  return compactSetupResultText(normalizedSample);
5846
5846
  }
5847
+ async function selectorVisibilityDiagnostic(context, selector) {
5848
+ return await context.locator(selector).evaluateAll((elements) => {
5849
+ const isVisible = (element) => {
5850
+ const style = window.getComputedStyle(element);
5851
+ const rect = element.getBoundingClientRect();
5852
+ return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
5853
+ };
5854
+ const describeElement = (element) => {
5855
+ const tag = String(element.tagName || "element").toLowerCase();
5856
+ const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
5857
+ const classes = String(element.getAttribute("class") || "")
5858
+ .split(/\s+/)
5859
+ .filter(Boolean)
5860
+ .slice(0, 3)
5861
+ .map((name) => "." + name.slice(0, 32))
5862
+ .join("");
5863
+ return (tag + id + classes).slice(0, 120);
5864
+ };
5865
+ const describeBox = (element) => {
5866
+ const rect = element.getBoundingClientRect();
5867
+ const style = window.getComputedStyle(element);
5868
+ const width = Math.round(rect.width * 10) / 10;
5869
+ const height = Math.round(rect.height * 10) / 10;
5870
+ return describeElement(element)
5871
+ + " " + width + "x" + height
5872
+ + " display=" + (style ? style.display : "unknown")
5873
+ + " visibility=" + (style ? style.visibility : "unknown");
5874
+ };
5875
+ if (!elements.length) return "selector_not_found";
5876
+ const visibleCount = elements.filter(isVisible).length;
5877
+ let visibleDescendant = null;
5878
+ for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
5879
+ const descendants = Array.from(elements[index].querySelectorAll("*"));
5880
+ const match = descendants.find(isVisible);
5881
+ if (match) {
5882
+ visibleDescendant = {
5883
+ parent_index: index,
5884
+ label: describeElement(match),
5885
+ box: describeBox(match),
5886
+ text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
5887
+ };
5888
+ }
5889
+ }
5890
+ const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
5891
+ if (visibleDescendant) {
5892
+ parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
5893
+ parts.push("visible_descendant_box " + visibleDescendant.box);
5894
+ if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
5895
+ }
5896
+ parts.push("first " + describeBox(elements[0]));
5897
+ return parts.join("; ").slice(0, 500);
5898
+ }).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
5899
+ }
5847
5900
  async function waitForAnyVisibleSelector(context, selector, timeout) {
5848
5901
  const deadline = Date.now() + setupNumber(timeout, 15000);
5849
5902
  let lastReason = "selector_not_found";
@@ -5854,7 +5907,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
5854
5907
  if (!count) {
5855
5908
  lastReason = "selector_not_found";
5856
5909
  } else {
5857
- lastReason = "no_visible_match";
5910
+ lastReason = await selectorVisibilityDiagnostic(context, selector);
5858
5911
  for (let index = 0; index < count; index += 1) {
5859
5912
  if (await locator.nth(index).isVisible().catch(() => false)) {
5860
5913
  return { ok: true, count, index };
package/dist/profile.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  resolveRiddleProofProfileTimeoutSec,
24
24
  slugifyRiddleProofProfileName,
25
25
  summarizeRiddleProofProfileResult
26
- } from "./chunk-3RTVXIFZ.js";
26
+ } from "./chunk-PEWAIEER.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.213",
3
+ "version": "0.7.214",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",