@eko-ai/eko 3.1.1 → 3.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"build_dom_tree.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/build_dom_tree.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,SAkwBjC"}
1
+ {"version":3,"file":"build_dom_tree.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/build_dom_tree.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,SAywBjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,cAAc,SAAM,EACpB,kBAAkB,SAAQ,UAoH3B;AAED,wBAAgB,kCAAkC,CAChD,UAAU,EAAE;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC;CACvC,EACD,QAAQ,EAAE,MAAM,CACd,MAAM,EACN;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CACxD,EACD,WAAW,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,MAAM,CAAC,CAmGjB;AAED,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,YAAY,GAAG,WAAW,EACrC,QAAQ,EACJ;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IACE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,EACL,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC;CACvC,CAAC,CA0CD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,cAAc,SAAM,EACpB,kBAAkB,SAAQ,UAoH3B;AAED,wBAAgB,kCAAkC,CAChD,UAAU,EAAE;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC;CACvC,EACD,QAAQ,EAAE,MAAM,CACd,MAAM,EACN;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CACxD,EACD,WAAW,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,MAAM,CAAC,CAyGjB;AAED,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,YAAY,GAAG,WAAW,EACrC,QAAQ,EACJ;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IACE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,EACL,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC;CACvC,CAAC,CA0CD"}
package/dist/index.cjs.js CHANGED
@@ -35183,7 +35183,12 @@ function mark_screenshot_highlight_elements(screenshot, area_map, client_rect) {
35183
35183
  const labelHeight = fontSize + padding * 2;
35184
35184
  // The tag position is in the upper right corner.
35185
35185
  const labelX = area.x + area.width - labelWidth;
35186
- const labelY = area.y;
35186
+ let labelY = area.y;
35187
+ // Adjust if box is too small
35188
+ if (area.width < labelWidth + 4 || area.height < labelHeight + 4) {
35189
+ // Position outside the box if it's too small
35190
+ labelY = area.y - labelHeight;
35191
+ }
35187
35192
  // Draw label background
35188
35193
  ctx.fillStyle = color;
35189
35194
  ctx.fillRect(labelX, labelY, labelWidth, labelHeight);
@@ -35840,13 +35845,10 @@ function run_build_dom_tree() {
35840
35845
  interactiveRoles.has(ariaRole) ||
35841
35846
  (tabIndex !== null && tabIndex !== '-1') ||
35842
35847
  element.getAttribute('data-action') === 'a-dropdown-select' ||
35843
- element.getAttribute('data-action') === 'a-dropdown-button';
35848
+ element.getAttribute('data-action') === 'a-dropdown-button' ||
35849
+ element.getAttribute('contenteditable') === 'true';
35844
35850
  if (hasInteractiveRole)
35845
35851
  return true;
35846
- // Get computed style
35847
- const style = getCachedComputedStyle(element);
35848
- // Check if element has click-like styling
35849
- const hasClickStyling = style.cursor === 'pointer' || element.style.cursor === 'pointer';
35850
35852
  // Check for event listeners
35851
35853
  const hasClickHandler = element.onclick !== null ||
35852
35854
  element.getAttribute('onclick') !== null ||
@@ -35854,10 +35856,13 @@ function run_build_dom_tree() {
35854
35856
  element.hasAttribute('@click') ||
35855
35857
  element.hasAttribute('v-on:click');
35856
35858
  // Helper function to safely get event listeners
35857
- function getEventListeners(el) {
35858
- // if (window.getEventListeners) {
35859
- // return window.getEventListeners?.(el) || {};
35860
- // }
35859
+ function getElementEventListeners(el) {
35860
+ if (window.getEventListeners) {
35861
+ const listeners = window.getEventListeners?.(el);
35862
+ if (listeners) {
35863
+ return listeners;
35864
+ }
35865
+ }
35861
35866
  // List of common event types to check
35862
35867
  const listeners = {};
35863
35868
  const eventTypes = [
@@ -35885,7 +35890,7 @@ function run_build_dom_tree() {
35885
35890
  return listeners;
35886
35891
  }
35887
35892
  // Check for click-related events on the element itself
35888
- const listeners = getEventListeners(element);
35893
+ const listeners = getElementEventListeners(element);
35889
35894
  const hasClickListeners = listeners &&
35890
35895
  (listeners.click?.length > 0 ||
35891
35896
  listeners.mousedown?.length > 0 ||
@@ -35897,18 +35902,27 @@ function run_build_dom_tree() {
35897
35902
  element.hasAttribute('aria-pressed') ||
35898
35903
  element.hasAttribute('aria-selected') ||
35899
35904
  element.hasAttribute('aria-checked');
35900
- // Check for form-related functionality
35901
- element.form !== undefined ||
35902
- element.hasAttribute('contenteditable') ||
35903
- (style && style.userSelect !== 'none');
35904
35905
  // Check if element is draggable
35905
35906
  const isDraggable = element.draggable || element.getAttribute('draggable') === 'true';
35906
- return (hasAriaProps ||
35907
- hasClickStyling ||
35908
- hasClickHandler ||
35909
- hasClickListeners ||
35910
- // isFormRelated ||
35911
- isDraggable);
35907
+ if (hasAriaProps || hasClickHandler || hasClickListeners || isDraggable) {
35908
+ return true;
35909
+ }
35910
+ // Check if element has click-like styling
35911
+ let hasClickStyling = element.style.cursor === 'pointer' || getCachedComputedStyle(element).cursor === 'pointer';
35912
+ if (hasClickStyling) {
35913
+ let count = 0;
35914
+ let current = element.parentElement;
35915
+ while (current && current !== document.documentElement) {
35916
+ hasClickStyling = current.style.cursor === 'pointer' || getCachedComputedStyle(current).cursor === 'pointer';
35917
+ if (hasClickStyling)
35918
+ return false;
35919
+ current = current.parentElement;
35920
+ if (++count > 10)
35921
+ break;
35922
+ }
35923
+ return true;
35924
+ }
35925
+ return false;
35912
35926
  }
35913
35927
  // Helper function to check if element is visible
35914
35928
  function isElementVisible(element) {
@@ -35938,11 +35952,14 @@ function run_build_dom_tree() {
35938
35952
  if (!topEl)
35939
35953
  return false;
35940
35954
  // Check if the element or any of its parents match our target element
35955
+ let count = 0;
35941
35956
  let current = topEl;
35942
35957
  while (current && current !== shadowRoot) {
35943
35958
  if (current === element)
35944
35959
  return true;
35945
35960
  current = current.parentElement;
35961
+ if (++count > 15)
35962
+ break;
35946
35963
  }
35947
35964
  return false;
35948
35965
  }
@@ -35957,11 +35974,14 @@ function run_build_dom_tree() {
35957
35974
  const topEl = document.elementFromPoint(point.x, point.y);
35958
35975
  if (!topEl)
35959
35976
  return false;
35977
+ let count = 0;
35960
35978
  let current = topEl;
35961
35979
  while (current && current !== document.documentElement) {
35962
35980
  if (current === element)
35963
35981
  return true;
35964
35982
  current = current.parentElement;
35983
+ if (++count > 15)
35984
+ break;
35965
35985
  }
35966
35986
  return false;
35967
35987
  }