Commit Graph

167 Commits

Author SHA1 Message Date
Simon
c04c02723d chore(version): bump version to 1.10.0 2026-06-15 17:31:54 +08:00
Simon
77468e4ab4 chore(version): bump version to 1.9.1 2026-06-15 17:22:10 +08:00
Simon
7dffaa4718 Merge pull request #512 from linked-danis/fix/scroll-predicate-types
Fix scroll predicate types (boolean | null -> boolean)
2026-06-11 21:22:31 +08:00
Simon
56c09a9ae9 test(page-controller): add happy-dom env and basic tests 2026-06-11 21:10:05 +08:00
Simon
9ed0a09194 feat(core): make execute_javascript honor AbortSignal
Expose the task AbortSignal as `signal` in the script scope so cooperative
code can cancel promptly, and re-check signal.throwIfAborted() after the
script settles to discard stale results.

Closes #537.
2026-06-09 21:30:27 +08:00
Simon
01c9cc9ea7 feat(page-controller): refine dark mode detection heuristics 2026-06-09 20:33:14 +08:00
Simon
b3ff0a1a25 Merge pull request #373 from tageniu/feat/dark-mode-detect
Implement TODO: enhance dark mode detection
2026-06-09 20:18:33 +08:00
Simon
797c238862 Merge pull request #534 from 64johnlee/chore/remove-debug-console-logs
chore(page-controller): remove accidental debug console.log calls
2026-06-09 15:07:19 +08:00
Simon
3a2f0a41ec chore(version): bump version to 1.9.0 2026-06-08 22:42:46 +08:00
64JohnLee
7b623c5b22 chore(page-controller): remove accidental debug console.log calls
Two debug log statements were left in production code:

- `isScrollableElement()` logged `scrollData!!!` for every scrollable
  element found during DOM tree construction. Because the DOM is rebuilt
  on every agent action, this fired repeatedly and also triggered
  unnecessary JSON serialisation of scroll metrics on the hot path.

- `SimulatorMask.dispose()` logged 'dispose SimulatorMask' every time
  the highlight overlay was torn down.

Neither had a structured prefix or was gated behind a debug flag.
Removing both silences console noise for end users and removes the
serialisation overhead in the scroll-detection hot path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 16:47:04 +08:00
Simon
90ff96ca15 fix: dts global declarations should not be bundled 2026-06-04 17:44:59 +08:00
linked-danis
903c2a736c fix: return booleans from scroll predicates 2026-05-18 15:00:52 +02:00
Simon
ebc785d1fe chore(version): bump version to 1.8.2 2026-05-11 19:40:30 +08:00
Simon
f5591dd3ea chore(version): bump version to 1.8.1 2026-04-27 23:32:01 +08:00
Simon
c6f09375f8 fix(controller): isMainContentDark too aggressive 2026-04-20 20:31:50 -04:00
tageniu
cc33297cc4 fix(controller): check html and body data attrs independently
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-20 20:31:45 -04:00
Shijie Sun
8556745645 feat(page-controller): enhance dark mode detection
Resolve the @TODO in checkDarkMode.ts by adding 3 new detection
strategies and expanding data-attribute coverage:

- Check data-color-mode, data-bs-theme, data-color-scheme attributes
- Read CSS color-scheme property and <meta name="color-scheme"> tag
- Inspect background of SPA containers (#app, #root, #__next, etc.)
- Detect light text color as a dark-theme signal
2026-04-20 20:14:07 -04:00
Simon
2ad2d06d01 chore(version): bump version to 1.8.0 2026-04-15 03:11:14 +08:00
Simon
78c829d955 fix: global helper functions redeclaration 2026-04-14 02:57:13 +08:00
Simon
a1b7684bf2 Merge pull request #418 from lgy2020/fix/simulator-mask-raf-leak
fix(mask): dispose 后 requestAnimationFrame 循环未停止导致内存泄漏
2026-04-13 20:14:32 +08:00
Simon
da67f3b07e chore(controller): .disposed guard 2026-04-13 20:13:41 +08:00
Simon
ca197d14e9 fix: dom typing 2026-04-12 03:16:39 +08:00
Simon
acfb336a9a fix: pre-publish and post-publish hooks 2026-04-12 03:16:13 +08:00
Simon
4d27d49752 refactor(setup): upgrade to TypeScript 6 with source-first monorepo resolution 2026-04-12 02:04:21 +08:00
liuguiyuan
9104064e8c fix(mask): stop requestAnimationFrame loop on dispose to prevent memory leak
The #moveCursorToTarget() method recursively schedules itself via
requestAnimationFrame, creating a continuous animation loop for the
AI cursor. However, dispose() only removes the DOM wrapper element
without stopping this loop, causing:

- CPU waste: rAF callback continues executing every frame (~60fps)
  after the mask is disposed, performing unnecessary calculations
  on a detached cursor element.
- Resource leak: Each SimulatorMask instance creates an unrecoverable
  animation loop that persists for the lifetime of the page.
- Console noise: style assignments to removed DOM nodes may produce
  browser warnings.

Fix: Add a #disposed boolean flag, checked at the top of
#moveCursorToTarget() to short-circuit the recursion. Set the flag
to true in dispose() before removing DOM elements.

Changes:
- Add #disposed field (default false)
- Guard #moveCursorToTarget() with early return when #disposed
- Set #disposed = true in dispose() before cleanup
2026-04-08 18:53:42 +08:00
Simon
cb55daf47d chore(version): bump version to 1.7.1 2026-04-04 01:37:49 +08:00
Simon
4272939217 fix(controller): treat interactive with aria as distinct 2026-04-03 20:21:11 +08:00
Lubrsy
148bdb6839 fix: recognize role="listitem" as interactive element (#203)
* fix: recognize role="listitem" as interactive element
* fix: DISTINCT_INTERACTIVE_ROLES

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Simon <10131203+gaomeng1900@users.noreply.github.com>
2026-04-03 20:09:48 +08:00
Simon
7e9027167d feat(controller): add keepSemanticTags config to keep the semantic structure of the page 2026-04-03 19:01:54 +08:00
Simon
0ca1c8de0b feat(controller): consider hasScrollbarSignal when detecting scrollable 2026-04-03 16:09:35 +08:00
Simon
85a33ac1a4 feat(controller): improve scroll action 2026-04-02 22:05:47 +08:00
Simon
8159aa58a6 Merge branch 'main' into fix/scroll-direction-pixels 2026-04-02 18:31:56 +08:00
Simon
2bdb3be81c Merge pull request #356 from lgy2020/fix/aria-attribute-detection
fix(isInteractiveCandidate): use hasAttribute with known aria list to detect aria- attributes
2026-04-02 17:41:36 +08:00
Simon
bde630f55d chore(controller): add @edit mark 2026-04-02 17:38:02 +08:00
Simon
3efef0ec42 fix(controller): clean up INTERACTIVE_ARIA_ATTRS 2026-04-02 17:33:27 +08:00
Simon
6823e04ca9 chore(version): bump version to 1.7.0 2026-03-31 20:45:12 +08:00
Simon
2b20b48dff chore(controller): reuse pointer xy 2026-03-31 20:27:04 +08:00
Simon
296459924a feat(controller): enhance click action with elementFromPoint 2026-03-31 20:02:39 +08:00
Simon
8eee3b27e2 feat(controller): fix SimulatorMast mem leak; add passthrough events 2026-03-31 19:59:57 +08:00
Simon
32d6f0c74b fix(controller): click action robust 2026-03-31 17:41:49 +08:00
liuguiyuan
f2b6c9dfd2 fix: use hasAttribute with known aria list for interactive candidate detection
Replace broken el.hasAttribute("aria-") with a curated list of 27
aria attributes checked via hasAttribute. Each check is O(1).

WAI-ARIA 1.2 defines ~50 aria attributes total per MDN.
Of these ~27 appear on interactive elements such as buttons,
inputs, sliders, and dialogs. The remaining ~20 are structural
container attributes like aria-live, aria-colcount, and
aria-rowspan that only appear on non-interactive containers.
Checking them would not change results.
2026-03-31 00:57:44 +08:00
Simon
c465fd8aa4 chore(version): bump version to 1.6.3 2026-03-30 22:29:03 +08:00
Simon
75bc69c0c0 chore(version): bump version to 1.6.2 2026-03-25 01:05:20 +08:00
Simon
eede819ea8 chore(version): bump version to 1.6.1 2026-03-22 03:27:51 +08:00
Matt Van Horn
005bc8ab44 fix(page-controller): apply scroll direction to pixels parameter
Two bugs in the scroll direction logic:

1. Vertical scroll with `pixels` ignores the `down` boolean because the
   `??` operator bypasses the direction multiplier when pixels is provided.
   Fix: move the direction multiplier outside the `??` so it applies to
   both the pixels and numPages paths.

2. Horizontal scroll with `pixels` applies direction twice - once in
   PageController.ts and again in actions.ts - causing a double negation
   that reverses the intended direction. Fix: remove the redundant
   direction logic from actions.ts since PageController already signs
   the scroll amount.

Also removes the now-unused `down` and `right` parameters from the
scrollVertically() and scrollHorizontally() action functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:38:32 -07:00
zfangqijun
cd2d33a9f6 chore(page-controller): export actions as internal methods 2026-03-21 20:17:01 +08:00
Simon
b6691b4732 chore(version): bump version to 1.6.0 2026-03-21 02:24:42 +08:00
Simon
eeb5b6a5af fix(clickElement): reorder iframe scroll and click actions 2026-03-21 02:18:42 +08:00
Simon
ad31e2b750 chore: clarify current type handling in isHTMLElement 2026-03-21 02:16:51 +08:00
Simon
e98d80b6a0 fix(PageController): same-origin iframe actions 2026-03-21 01:46:09 +08:00