Commit Graph

142 Commits

Author SHA1 Message Date
mcfn ff9b82c23a [packages/cli]feat: finalize browser send command with spec-compliant interface
Update Cmd struct field names (header instead of headers), change
parse_header to return HashMap<String, String> for JSON multi-key
support, use serde_json::to_string for safe JS string embedding in
fetch expression, update IIFE to match spec pattern, add all required
tests (parse_header, method inference, build_fetch_js, CLI parser),
and add search/manual to top-level help text.
2026-04-11 02:49:02 +08:00
mcfn 9f317cd038 feat: implement browser send command
Adds `actionbook browser send <URL>` which executes HTTP requests from
the browser's fetch API via CDP Runtime.evaluate. Supports curl-like
flags (-X, -H, -d) and token substitution via $ACTIONBOOK.<SITE>.API_KEY
patterns resolved from env vars or ~/.actionbook/tokens/<site> files.
2026-04-11 02:45:32 +08:00
Junliang Feng 3fa0d11453 [packages/cli]feat: add manual command data structures, format functions and tests (#495)
* [packages/cli]feat: add manual command with format functions and tests (Phase 1)

Port manual command from reference implementation with async run() function,
data structures, format functions (site overview, group overview, action detail),
and 12 unit tests. All brand references use actionbook/$ACTIONBOOK.
CLI parser tests added for manual/man alias parsing.

* [packages/cli]fix: remove extra group line from format_action_detail for postagent parity

* [packages/cli]fix: allow dead_code on ActionDetail.group field after parity fix
2026-04-11 02:37:02 +08:00
Junliang Feng e3648846a5 feat: implement search command (#494)
feat(cli): implement search command with HTTP-based lookup

Replace the old API-client-based search with a direct HTTP call to
the actionbook search endpoint. Simplify the Search CLI command to
accept only a keyword; add config::api_base() for endpoint resolution
via ACTIONBOOK_API_URL; introduce api_response and formatter modules;
update main.rs dispatch accordingly.
2026-04-11 02:13:31 +08:00
Junliang Feng 4ad9c3530e fix(browser): include request ID in text output and deduplicate redirect chains (ACT-882)
Address Codex review findings on PR #492:
- P1: Text-mode network request listing now includes request_id so
  users can drill into browser network request <id> without --json
- P2: record_request_will_be_sent updates in-place when the same
  requestId appears again (redirect chains), preventing duplicate
  entries and ensuring detail lookup returns the correct final hop
2026-04-11 01:21:05 +08:00
Junliang Feng f119e54565 feat(browser): add network requests commands (ACT-882)
Add `browser network requests` and `browser network request <id>` commands.

- Per-tab ring buffer (500 cap) stores TrackedRequest with URL, method,
  resource type, status, headers (normalized HashMap), post data, timestamps
- CDP event handlers for Network.requestWillBeSent / Network.responseReceived
- Filters: --filter (URL substring), --type, --method, --status (exact/class/range)
- Response body fetched on-demand via Network.getResponseBody
- Chrome internal URLs filtered from tracking
- 9 unit tests + 5 e2e tests

Closes ACT-882
2026-04-11 01:09:53 +08:00
Junliang Feng 479828d1ea fix(browser): await Promise in eval command via awaitPromise CDP flag
## Summary
- Add `awaitPromise: true` to the `Runtime.evaluate` CDP call in the `eval` command
- Without this flag, evaluating a Promise expression returns the Promise object itself, which serializes to `{}` (no enumerable properties)
- With `awaitPromise: true`, CDP waits for the Promise to resolve and returns the actual value — matching Playwright's behavior
- Add e2e regression test covering `Promise.resolve(42)` and delayed Promise resolution

Cherry-picked from #490 (closed — had stale click.rs/output.rs conflicts with main).

## Test plan
- [x] `eval_json_promise` e2e: `Promise.resolve(42)` returns 42
- [x] `eval_json_promise` e2e: delayed Promise via setTimeout resolves correctly
- [x] `eval_json_number` e2e: sync expressions still work
- [x] CI lint + unit tests green
2026-04-10 17:40:34 +08:00
Junliang Feng 673d21dc81 fix(browser): fix wait-navigation timeout for fast/delayed redirects (ACT-873)
## Summary
- Fix `browser wait navigation` timing out when navigation completes before
  the wait command starts (fast-redirect scenario, ACT-873).
- Add CDP `Page.frameNavigated` event subscription alongside polling for
  reliable in-watch navigation detection.
- Use registry `prev_url` as baseline to detect navigation that occurred
  between commands.
- Add time-based URL stability (300ms) to distinguish final destinations
  from intermediate redirect pages.
- Add 5 unit tests for NavigationDetector and 3 e2e tests covering
  fast-redirect, delayed-redirect, and no-navigation timeout scenarios.

Closes ACT-873
2026-04-10 17:15:22 +08:00
Junliang Feng 4deeda4a7b perf: reduce click latency from ~2s to ~75ms for DOM-only interactions (#475)
* [packages/cli]feat: add batch click support and optimize wait_for_navigation

- Support multiple selectors in click command: click @e1 @e2 @e3
- Execute clicks sequentially with fail-fast on first error
- Batch response includes all results with url_changed/focus_changed per click
- Optimize wait_for_navigation: return immediately on URL change detection, avoid polling for DOM-only interactions
- Format text output for batch clicks (clicks count + target list)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]perf: reduce Runtime.evaluate calls per click from 5 to 2

Merged pre-click (url+focus) and post-click (url+title+focus) state reads
each into a single JS evaluate, eliminating 3 serial main-thread round-trips
per click. Also removed wait_for_navigation's fixed 2s wait — now exits
immediately when URL hasn't changed (DOM-only interactions like card expand).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]perf: return immediately on DOM-only clicks (no navigation)

After first evaluate, if URL is unchanged the click was a DOM-only
interaction — return immediately instead of polling for 2s. Only
continue polling when URL actually changed (real navigation).

Result: DOM-only clicks drop from ~2050ms to ~75ms.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [root]docs: update target branch to main in cli-devflow

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [root]docs: untrack .docs/cli-devflow.md

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]feat: support single-package local distribution via bundled binary

Add fallback in bin/actionbook.js to check for co-located actionbook-native
binary before looking up the platform-specific optional dependency package.
Enables local npm install -g from a single .tgz without separate platform packages.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]chore: bump version to 1.0.2-alpha.1

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]feat: add batch-click command for bulk DOM interactions

Adds `browser batch-click` as an agent-friendly command for clicking
multiple elements sequentially. Simplified interface (no --new-tab,
--button, --count) that delegates to click::execute internally.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]perf: batch-click bypasses JS main thread entirely

batch-click now uses resolve_center_no_scroll (DOM.getBoxModel only)
and skips pre/post state detection. All CDP calls stay on the DOM engine
thread, avoiding the JS main thread bottleneck.

Result: 5 clicks 413ms, 10 clicks 756ms (~75ms/click vs ~5000ms before).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]fix: restore scrollIntoView in batch-click fast path

Keep scrollIntoView so off-screen elements are scrolled into view
before clicking. The perf gain comes from skipping pre/post state
detection (Runtime.evaluate), not from skipping scroll.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* [packages/cli]feat: add batch-new-tab command for opening multiple tabs at once

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [packages/cli]chore: bump version to 1.0.3-alpha.1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(browser): add batch-snapshot command (#479)

Implements browser batch-snapshot (tasks #14, #15):
- Cmd struct with --session, --tabs (1+), and all shared snapshot flags
- execute() loops over tabs, reuses snapshot logic per tab, collects
  results with partial success (SESSION_NOT_FOUND bubbles as Fatal,
  all other per-tab errors become inline error entries)
- Registers in mod.rs, action.rs, cli.rs (BrowserCommands), router.rs

Co-authored-by: cli-roger-test <cli-roger-test@local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(browser): add batch snapshot e2e coverage

* feat(browser): add batch-snapshot command

Implements browser batch-snapshot (tasks #14, #15):
- Cmd struct with --session, --tabs (1+), and all shared snapshot flags
- execute() loops over tabs, reuses snapshot logic per tab, collects
  results with partial success (SESSION_NOT_FOUND bubbles as Fatal,
  all other per-tab errors become inline error entries)
- Registers in mod.rs, action.rs, cli.rs (BrowserCommands), router.rs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(browser): add batch snapshot e2e coverage

---------

Co-authored-by: cli-roger-test <cli-roger-test@local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(browser): add batch-new-tab to text output action list

batch-new-tab was missing from the is_action match in format_text,
so "ok browser batch-new-tab" was never emitted. Also add its
format_data_fields arm and partial failure handling.

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: cli-roger-test <cli-roger-test@local>
2026-04-10 15:35:53 +08:00
github-actions[bot] 805bb8f171 chore: version packages (#487)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-09 20:43:41 +08:00
sen 86905ebe11 feat(cli): restore extension browser mode with bridge relay (#486)
* [packages/cli]feat: restore extension browser mode with bridge relay

Add a WebSocket bridge server inside the daemon that transparently
relays CDP messages between the Chrome extension and CdpSession.
Extension mode was removed in v1.0.0; this restores it with minimal
changes by reusing the existing cloud-mode CDP connection flow.

- daemon/bridge.rs: WS bridge on port 19222, hello handshake with
  extension origin validation, bidirectional CDP message relay
- daemon/server.rs: spawn bridge as tokio task (non-fatal on bind fail)
- daemon/registry.rs: store SharedBridgeState for session start access
- browser/session/start.rs: execute_extension() reusing cloud CDP flow
- setup: unblock extension mode in wizard and --browser flag
- CdpSession: zero changes
- Extension side: zero changes

* [packages/cli]fix: use Extension API for tab discovery in extension mode

Extension bridge requires Extension.attachTab before any CDP command
can be relayed. Replaced Target.getTargets + Target.attachToTarget
with Extension.createTab / Extension.attachActiveTab flow. Added
CdpSession.register_extension_tab() to register tabs without CDP
flat-session handshake. Local and cloud modes are unaffected.

* [packages/cli]fix: close tabs and detach debugger in extension mode

Session close and close-tab now use Extension.closeTab / Extension.detachTab
in extension mode instead of Target.closeTarget which the bridge doesn't
support. Added Extension.closeTab to the extension that detaches the
debugger and removes the tab via chrome.tabs.remove. Local and cloud
modes are unaffected.

* [packages/cli]fix: revert extension JS change, use detachTab for close

Extension is loaded from CWS — local JS changes don't take effect.
Reverted Extension.closeTab addition to background.js. Session close
and close-tab now use Extension.detachTab to release the debugger in
extension mode. Tabs are left open since CLI doesn't own the browser.

* [packages/cli]fix: read default browser mode from config instead of hardcoding Local

When --mode is not specified, browser start now reads browser.mode from
config.toml (e.g. mode = "extension") instead of always falling back to
Local mode. This allows users with extension mode configured to connect
to their existing browser without explicitly passing --mode extension.

* [packages/cli]fix: build.rs track branch ref for accurate BUILD_VERSION in worktrees

build.rs only watched .git/HEAD which doesn't change on new commits in a
worktree (it stays as ref: refs/heads/branch-name). This caused stale
BUILD_VERSION, preventing daemon version-mismatch detection when the
npm-installed binary shared the same cached hash.

Now also watches the actual ref file and packed-refs via --git-common-dir
so BUILD_VERSION updates on every new commit.

Also adds a guard in start.rs Local mode section to reject non-Local
modes explicitly instead of silently launching a local Chrome.

* [packages/cli]fix: clippy/fmt fixes and reject concurrent CDP clients in bridge

- Fix rustfmt formatting (collapsed if chains, import order, line width)
- Fix clippy collapsible-if warnings
- Reject concurrent CDP clients in bridge relay to prevent response
  channel hijacking between sessions

* [packages/cli]fix: suppress result_large_err for accept_hdr_async callback

The closure signature is dictated by tokio-tungstenite's API and cannot
use Box<Err>. Allow the lint on this specific closure.

* [root]chore: add changeset for CLI v1.2.0 (extension mode restore)
2026-04-09 20:01:37 +08:00
mcfn 9a0cd4058e fix(browser): add batch-new-tab to text output action list
batch-new-tab was missing from the is_action match in format_text,
so "ok browser batch-new-tab" was never emitted. Also add its
format_data_fields arm and partial failure handling.
2026-04-09 14:59:33 +08:00
mcfn 6da55f0d94 Merge branch 'main' into feat/multi-click
Resolve version conflicts (take main's 1.1.0), apply cargo fmt.
2026-04-09 13:38:32 +08:00
github-actions[bot] c59638d50a chore: version packages (#484)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-07 23:20:31 +08:00
s1mba 2e9ee9c245 [packages/cli]fix: batch new-tab session-loss failures (#482)
Fix skipped batch new-tab failures
2026-04-07 21:21:07 +08:00
4bmis f8c3be406b Fix e2e test helper import 2026-04-07 17:10:49 +08:00
4bmis b3498b9625 Support multi-URL browser new-tab 2026-04-07 17:03:12 +08:00
Junliang Feng 90accb0213 test(browser): add batch snapshot e2e coverage
* feat(browser): add batch-snapshot command

Implements browser batch-snapshot (tasks #14, #15):
- Cmd struct with --session, --tabs (1+), and all shared snapshot flags
- execute() loops over tabs, reuses snapshot logic per tab, collects
  results with partial success (SESSION_NOT_FOUND bubbles as Fatal,
  all other per-tab errors become inline error entries)
- Registers in mod.rs, action.rs, cli.rs (BrowserCommands), router.rs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(browser): add batch snapshot e2e coverage

---------

Co-authored-by: cli-roger-test <cli-roger-test@local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:12:04 +08:00
Junliang Feng ff494fc2dc feat(browser): add batch-snapshot command (#479)
Implements browser batch-snapshot (tasks #14, #15):
- Cmd struct with --session, --tabs (1+), and all shared snapshot flags
- execute() loops over tabs, reuses snapshot logic per tab, collects
  results with partial success (SESSION_NOT_FOUND bubbles as Fatal,
  all other per-tab errors become inline error entries)
- Registers in mod.rs, action.rs, cli.rs (BrowserCommands), router.rs

Co-authored-by: cli-roger-test <cli-roger-test@local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:31:51 +08:00
mcfn cff4ea5268 [packages/cli]chore: bump version to 1.0.3-alpha.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:28:16 +08:00
mcfn 0352417e90 Merge branch 'main' of github.com:actionbook/actionbook into feat/multi-click
# Conflicts:
#	packages/cli-darwin-arm64/package.json
#	packages/cli/Cargo.lock
#	packages/cli/Cargo.toml
#	packages/cli/package.json
2026-04-03 15:18:15 +08:00
mcfn 7bc8644ce7 [packages/cli]feat: add batch-new-tab command for opening multiple tabs at once
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:14:09 +08:00
Junliang Feng 0711c870e7 feat(browser): save snapshot as Playwright-style YAML (#477)
* test(browser): add render_yaml unit tests

* test(browser): extend render_yaml edge coverage

* feat(browser): save snapshot as Playwright-style YAML

Add render_yaml() to snapshot_transform.rs that converts a flat AXNode
list into a nested Playwright-style YAML DSL string. Format rules:
- Container nodes (children or URL): `- role "name" [ref=eN]:`
- Leaf with ref: `- role "name" [ref=eN]`
- Leaf with value (no ref): `- role "name": value`
- Leaf with name only (no ref): `- role: name`
- URL rendered as child: `- /url: <url>`
- [cursor=pointer] added when cursor_info has cursor:pointer hint

Switch build_output() to call render_yaml() instead of render_content(),
and change snapshot file extension from .txt to .yaml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(browser): escape name and value in render_yaml leaf nodes

- Use escaped_name (not node.name) in the inline leaf branch
- Escape node.value with the same rules to prevent injection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(browser): render value inline even when ref is present in render_yaml

Textbox/combobox nodes are interactive and typically have both a ref and
a value. Previously, the ref branch dropped the value entirely. Now the
value is appended inline: `- textbox "Label" [ref=eN]: value`.

Also moves escaped_value computation to the top of the loop so it can be
shared across both the ref and no-ref branches.

Adds unit test for the ref+value path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(browser): update snapshot e2e for yaml artifacts

- assert data.path ends with .yaml
- snapshot_content() validates .yaml extension before reading
- rename assert_content_has_refs to assert_content_is_yaml_snapshot
- add assertions: no legacy `url=` format, at least one YAML container line

Co-Authored-By: cli-roger-test <cli-roger-test@local>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* style: fix rustfmt formatting in render_yaml tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: rustfmt formatting and update link URL test for YAML format

Apply rustfmt-required formatting:
- Expand format!() call with 3+ args to multi-line
- Expand assert!(cond, msg) to multi-line
- Expand assert_eq! with long string to multi-line

Update test_build_output_renders_link_urls_from_ax_properties:
- Old format: `url=https://...` inline
- New YAML format: `- link "Docs" [ref=e1]:` + child `- /url: https://...`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* style: fix final rustfmt issue in link URL test assertion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace map_or(false) with is_some_and per clippy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: cli-roger-test <cli-roger-test@local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:10:56 +08:00
Junliang Feng 7336c1e11f fix(cli): native-ish stealth + OOPIF iframe click offset (#465) 2026-04-03 14:51:37 +08:00
mcfn 42090975fb [packages/cli]fix: restore scrollIntoView in batch-click fast path
Keep scrollIntoView so off-screen elements are scrolled into view
before clicking. The perf gain comes from skipping pre/post state
detection (Runtime.evaluate), not from skipping scroll.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 14:44:17 +08:00
Asen's Agent 350f4fa8db chore: version packages (cli v1.0.2)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 14:32:01 +08:00
asensagent 4ee5e44703 docs: remove search and get from help and skills (#476)
docs: remove search and get commands from help and skills

Search and get commands are being removed from the CLI. This removes
all references from help output, SKILL.md, and command-reference.md.
The workflow now starts directly with browser automation via snapshot.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 14:29:42 +08:00
mcfn 026cc36614 [packages/cli]perf: batch-click bypasses JS main thread entirely
batch-click now uses resolve_center_no_scroll (DOM.getBoxModel only)
and skips pre/post state detection. All CDP calls stay on the DOM engine
thread, avoiding the JS main thread bottleneck.

Result: 5 clicks 413ms, 10 clicks 756ms (~75ms/click vs ~5000ms before).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 14:28:49 +08:00
mcfn 40b4bf7962 [packages/cli]feat: add batch-click command for bulk DOM interactions
Adds `browser batch-click` as an agent-friendly command for clicking
multiple elements sequentially. Simplified interface (no --new-tab,
--button, --count) that delegates to click::execute internally.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 14:21:38 +08:00
mcfn 78da0963b9 [packages/cli]chore: bump version to 1.0.2-alpha.1
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 12:43:58 +08:00
mcfn 7e1acd795f [packages/cli]feat: support single-package local distribution via bundled binary
Add fallback in bin/actionbook.js to check for co-located actionbook-native
binary before looking up the platform-specific optional dependency package.
Enables local npm install -g from a single .tgz without separate platform packages.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 12:43:53 +08:00
mcfn a6c2110a0c [packages/cli]perf: return immediately on DOM-only clicks (no navigation)
After first evaluate, if URL is unchanged the click was a DOM-only
interaction — return immediately instead of polling for 2s. Only
continue polling when URL actually changed (real navigation).

Result: DOM-only clicks drop from ~2050ms to ~75ms.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 10:43:38 +08:00
mcfn 0a25f2cace [packages/cli]perf: reduce Runtime.evaluate calls per click from 5 to 2
Merged pre-click (url+focus) and post-click (url+title+focus) state reads
each into a single JS evaluate, eliminating 3 serial main-thread round-trips
per click. Also removed wait_for_navigation's fixed 2s wait — now exits
immediately when URL hasn't changed (DOM-only interactions like card expand).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 10:35:42 +08:00
mcfn a3b3385f3f [packages/cli]feat: add batch click support and optimize wait_for_navigation
- Support multiple selectors in click command: click @e1 @e2 @e3
- Execute clicks sequentially with fail-fast on first error
- Batch response includes all results with url_changed/focus_changed per click
- Optimize wait_for_navigation: return immediately on URL change detection, avoid polling for DOM-only interactions
- Format text output for batch clicks (clicks count + target list)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 09:57:50 +08:00
mcfn.feng ee83689aa2 [packages/cli]docs: add 1.0.1 entry to CHANGELOG 2026-04-02 23:35:48 +08:00
mcfn.feng 8aa6116cbd [packages/cli]chore: bump version to 1.0.1 (npm rejected 1.0.0 re-publish) 2026-04-02 23:34:40 +08:00
Junliang Feng fcf79b96f1 fix: Windows build, E2E stability, README in npm, workflow_dispatch (#471) 2026-04-02 23:27:23 +08:00
mcfn.feng a171ea2192 [root]fix: copy root README.md to CLI package before npm publish 2026-04-02 23:23:56 +08:00
Junliang Feng b706b2b291 fix: gate Unix-specific APIs for Windows build (#470) 2026-04-02 23:09:54 +08:00
mcfn.feng 6a2b6010fd [packages/cli]fix: increase Chrome startup timeout to 30s and relax snapshot assertion
- Increase DevTools URL discovery timeout from 15s to 30s for CI environments
- Relax snap_selector_flag_limits_subtree assertion to allow ±2 node tolerance
- Increase E2E test workflow timeout to 20 minutes
2026-04-02 23:01:55 +08:00
mcfn.feng fd0dfe3f63 [packages/cli]fix: gate Unix-specific APIs behind #[cfg(unix)] for Windows build
- server.rs: gate flock, kill FFI, UnixListener, SIGHUP behind #[cfg(unix)]
- chrome_reaper.rs: gate SIGTERM FFI, fall back to child.kill() on Windows
- client.rs: gate UnixStream usage, return error on non-Unix platforms
2026-04-02 22:49:36 +08:00
github-actions[bot] 8b55277dad chore: version packages 2026-04-02 14:27:45 +00:00
AlexZ 022ab6ea1d [packages/cli]chore: fix clippy collapsible-if warnings
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 22:04:13 +08:00
AlexZ 1c7c02eb63 [packages/cli]fix: address Codex review — OOPIF expansion + ref stability
- P1: expand_undiscovered_oopifs now uses frame_ids expanded in the
  current pass (returned by expand_iframes) instead of persisted cache.
  Prevents stale cache entries from causing OOPIF frames to be skipped.
- P1: remap_frame_id_for_backend_nodes skips if the new (frame_id, bid)
  key already exists, preserving stable ref_ids across snapshots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 21:56:51 +08:00
AlexZ 850e4430a3 [packages/cli]chore: fix formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 21:50:14 +08:00
AlexZ 8b2b64d56b merge: resolve conflicts with main (browser.rs, cdp_session.rs)
- browser.rs: keep native-ish stealth flags, drop duplicate WebRTC line
- cdp_session.rs: keep apply_stealth() refactor over inline version

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 21:48:34 +08:00
AlexZ d31d70ead1 [packages/cli]fix: native-ish stealth + OOPIF iframe click offset
Stealth rewrite ("native-ish" strategy):
- Only remove automation traces (webdriver, cdc_*, Playwright markers)
- Preserve real system fingerprints (plugins, screen, language, WebGL)
- Minimal chrome.runtime stub for Cloudflare Turnstile compatibility
- Canvas noise for fingerprint tracking prevention
- Remove heavy spoofing that triggered Akamai/DataDome detection

OOPIF iframe click offset:
- Add get_iframe_offset() via DOM.getFrameOwner + DOM.getBoxModel
- Remap RefCache frame_id for nodes inlined by Chrome AX tree
- Expand undiscovered OOPIF frames in snapshot
- RefCache.remap_frame_id_for_backend_nodes() for closed shadow root iframes

Stealth apply refactor:
- Extract apply_stealth() method on CdpSession
- Apply stealth to already-attached tabs (Target.setAutoAttach race)
- Remove DeviceMetricsOverride (fixed 1920x1080 is a bot signal)

Tested: Reddit, BBB Scam Tracker (Cloudflare Turnstile), Etsy (DataDome)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 21:44:22 +08:00
mcfn.feng 00a9b8ef14 [feat] update version 2026-04-02 20:02:06 +08:00
mcfn.feng c2a2a43de5 [packages/cli]fix: select fixture uses DOM APIs to avoid TrustedHTML error
Chrome 146+ may enforce Trusted Types on certain pages, causing
innerHTML assignments to fail. Replace innerHTML with createElement
+ appendChild in install_select_fixture.
2026-04-02 18:13:32 +08:00
mcfn.feng 5cee89cde8 [packages/cli]fix: type/press key events not reaching correct tab + contenteditable fix
Three issues fixed:

1. Input.dispatchKeyEvent routes to Chrome's active tab, ignoring sessionId.
   - type: add Target.activateTarget before key dispatch loop
   - press: add Target.activateTarget before key dispatch

2. type command used minimal key definitions (just key+text) which didn't
   trigger native text insertion on contenteditable elements.
   - Reuse key_definition() from press module for full CDP key definitions
     (code, windowsVirtualKeyCode, nativeVirtualKeyCode, unmodifiedText)

3. Contenteditable e2e test fixture had element at top:500px, whose center
   (y=531) exceeded headless viewport height (513), causing click to miss.
   - Changed to top:200px

Closes ACT-822
2026-04-02 18:02:23 +08:00