Commit Graph

21 Commits

Author SHA1 Message Date
mcfn 143ba43e8b [packages/cli]fix: send mouseMoved before mousePressed in dispatch_click (#220)
SPA frameworks (React Router, Vue Router, Next.js) require a prior
mouseMoved event to establish pointer hover state before the click
event synthesizes correctly. Without it, the router's click listener
never fires and the URL remains unchanged (url_changed: false).

Add a single mouseMoved dispatch at (x, y) with button=none before
the existing mousePressed/mouseReleased loop — matches Playwright's
standard click implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 13:04:30 +08:00
mcfn.feng fc8a3300ad [packages/cli]fix: set-based inflight tracking + stale eviction for network-idle
Replace simple i64 counter with HashMap<requestId, Instant> per session
(Playwright-style set tracking). Requests whose loadingFinished fires on
a different CDP session (cross-origin iframes) are automatically evicted
after 3 seconds, preventing permanent counter inflation.

Key changes:
- TabNetPending: HashMap<String, i64> → HashMap<String, HashMap<String, Instant>>
- network_pending() evicts entries older than 3s before counting
- Exclude WebSocket, EventSource, favicon, data: from tracking
- Redirect requests don't double-count (requestId reuse)
- Comprehensive unit test for skip/undercount scenarios

Results:
- flightaware.com: 30s timeout → 4s (was stuck on WebSocket)
- costcotravel.com: 30s timeout → 2.6s
- healthline.com: still times out (needs per-frame tracking — follow-up)

TODO: Implement Playwright-style per-frame idle tracking to handle
sites with heavy cross-origin iframe tracking (Facebook pixel, etc.)
2026-04-02 12:52:47 +08:00
mcfn.feng df258b8194 [packages/cli]fix: track skipped requestIds to prevent undercount + handle redirects
Address Codex bot P1 review finding: skipping favicon/data: URLs on
requestWillBeSent without also skipping their loadingFinished would
undercount active requests, causing premature network-idle.

Changes:
- Maintain `skipped_request_ids` HashSet to track suppressed requests
- loadingFinished/loadingFailed checks the set and suppresses delta
- Add EventSource exclusion (persistent like WebSocket)
- Handle redirect double-counting (redirectResponse → don't re-increment)
- Add comprehensive unit test covering all skip/undercount scenarios
2026-04-02 12:21:32 +08:00
mcfn.feng a7a61d7e4d [packages/cli]fix: exclude WebSocket/favicon/data: from network-idle pending count
WebSocket upgrade requests fire `Network.requestWillBeSent` but never
`Network.loadingFinished`, leaving the pending counter stuck at ≥1
and causing `wait network-idle` to always time out on sites with
persistent WebSocket connections (analytics, real-time features).

Align with Playwright's behaviour by excluding:
- WebSocket upgrades (type == "WebSocket")
- Favicon requests (url ends with /favicon.ico)
- data: URLs (not intercepted by Network Service)

Before: healthline.com 30s timeout, flightaware.com ~25s
After:  healthline.com 523ms, flightaware.com 514ms
2026-04-02 11:58:46 +08:00
mcfn.feng 7a6a240715 [packages/cli]chore: relocate api and commands modules from cli-v2 to cli
Move new files added in upstream release/1.0.0 from the old
packages/cli-v2/ path to packages/cli/ after merge.
2026-04-02 02:21:04 +08:00
mcfn.feng 4d4a437a40 Merge remote-tracking branch 'origin/release/1.0.0' into feat/update-repo 2026-04-02 02:20:01 +08:00
mcfn.feng 58545129de [root]refactor: remove actionbook-rs, promote cli-v2 to packages/cli
- Delete packages/actionbook-rs/ (legacy 0.x CLI)
- Delete old packages/cli/ (JS npm wrapper for 0.x)
- Rename packages/cli-v2/ → packages/cli/ (git mv)
- Merge npm wrapper files (bin/actionbook.js, scripts/postinstall.js) into new cli/
- Update package.json: name → @actionbookdev/cli, private → false, add npm distribution fields
- Update sync-versions.js: point Cargo.toml/Cargo.lock sync at packages/cli/
- Update release.yml: build from packages/cli/ instead of packages/actionbook-rs/
- Update test.yml: paths and working-directory from cli-v2 → cli
- Update CLAUDE.md, CONTRIBUTING.md, docs, issue templates
- Delete stale changeset (fix-screenshot-timeout.md)
- Keep 6 platform binary packages unchanged
2026-04-02 00:46:12 +08:00
4bmis 4715896e2e [packages/cli]refactor: replace TypeScript CLI with Rust binary wrapper
Replace the TypeScript CLI implementation with a thin JS wrapper that
executes the native Rust binary. The npm package now ships all platform
binaries directly, with a postinstall fallback to download from GitHub
Releases if needed.

- Add bin/actionbook.js: platform detection + binary execution
- Add scripts/postinstall.js: fallback download from GitHub Releases
- Remove all TypeScript source, build config, and dependencies
- Update CI workflow to build, package, and publish with binaries
- Update README with full Rust CLI command documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 12:44:19 +08:00
4bmis bb4ae30281 [packages/*]feat: migrate to new text-based API
- Replace old JSON API with new text-based API using area_id format
- Add get_action_by_area_id tool to MCP server
- Update search_actions with new parameters (domain, url, page, page_size)
- Remove --json option from CLI commands (output is now plain text)
- Disable sources command temporarily in CLI
- Update README documentation for CLI and MCP

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:29:38 +08:00
junliang.feng 18e9e6732d [packages/cli]refactor: use direct playwright-core CLI instead of npx for browser installation
Replace npx playwright@{version} with direct node execution of playwright-core CLI.
Find CLI path by checking multiple node_modules structures (pnpm .pnpm/*, npm flat, npm nested).
Search both package dir and workspace root to support pnpm workspaces.

Benefits:
- Eliminates npx overhead and potential version mismatches
- Works reliably with both npm and pnpm package managers
- No need to parse agent-browser's
2026-01-28 16:40:50 +08:00
junliang.feng 5befdfbe01 [packages/cli]feat: forward help to agent-browser for complete documentation
Remove custom help text and disable Commander.js help option.
Now 'actionbook browser -h' displays full agent-browser help with all
commands, options, and examples instead of minimal Commander help.

Benefits:
- Users see complete command reference without extra steps
- Automatically stays up-to-date with agent-browser changes
- Consistent help across -h, --help, and no-args invocations
2026-01-28 16:01:06 +08:00
junliang.feng ffd4405e81 [packages/cli]fix: dynamically match playwright version with agent-browser
Read playwright-core version from agent-browser's package.json to ensure
binary compatibility when installing Chromium. This prevents 'executable
doesn't exist' errors that occur when npx downloads a mismatched Playwright
version.

- Add getAgentBrowserPlaywrightVersion() to read version dynamically
- Use playwright@{version} instead of hardcoded version
- Fallback to 'latest' if version detection fails
2026-01-27 23:18:12 +08:00
junliang.feng 3b3b8cd95e [packages/cli]docs: update browser command description and help text
- Change command description from "agent-browser" to "actionbook browser"
- Simplify help text from "detailed agent-browser commands" to "detailed commands"
2026-01-27 23:09:42 +08:00
junliang.feng ae48421298 [packages/cli]feat: replace agent-browser text with actionbook browser in output
Transform stdout/stderr from agent-browser command to replace all
occurrences of 'agent-browser' with 'actionbook browser' for
consistent branding in user-facing output.
2026-01-27 22:34:22 +08:00
junliang.feng 26d16452bd [packages/cli]feat: use agent-browser as dependency with npx execution
- Add agent-browser ^0.8.3 as dependency in package.json
- Implement spawnAgentBrowser() using npx with cwd to CLI package root
- Update installAgentBrowser() to use 'npx playwright install chromium'
- Replace all agent-browser calls with spawnAgentBrowser()
- Update README with automatic dependency installation info
- Remove manual npm install logic (handled by package manager)

Benefits:
- agent-browser automatically installed with CLI
- No global install required for agent-browser
- Version managed by package.json
- Works seamlessly with npm/pnpm package managers
2026-01-27 22:28:38 +08:00
junliang.feng 201f0461aa [packages/cli]refactor: bundle agent-browser as dependency instead of global install
- Add agent-browser as direct dependency in package.json
- Remove automatic npm global installation logic
- Simplify installAgentBrowser() to only download Chromium binaries
- Update documentation to reflect simpler setup process
- Remove checkAgentBrowserInstalled() and showAgentBrowserSetupInstructions()
- Update help text to clarify browser install only downloads Chromium
- Keep --with-deps flag support for Linux
2026-01-27 21:36:51 +08:00
junliang.feng 2e00a8420d [packages/cli]feat: implement automatic installation for browser command
- Add installAgentBrowser() function to auto-install agent-browser
- Execute 'npm install -g agent-browser' if not already installed
- Automatically run 'agent-browser install' to download Chromium
- Support --with-deps flag for Linux system dependencies
- Show step-by-step progress during installation
- Update README with automatic installation instructions
2026-01-27 20:44:09 +08:00
junliang.feng 60edc48473 [packages/cli]feat: add setup instructions for browser install command
- Add special handling for 'actionbook browser install' command
- Show detailed setup instructions when agent-browser is not installed
- Guide users through npm installation and Chromium download
- Include Linux-specific instructions for system dependencies
- Update README with improved setup documentation
2026-01-27 20:12:50 +08:00
junliang.feng dff879d4a3 [packages/cli]feat: add browser command for agent-browser integration
- Add browser command to CLI for browser automation
- Create process utility for spawning commands with stdio inheritance
- Show installation instructions when agent-browser is not found
- Pass through all arguments to agent-browser CLI
- Add help text with examples and reference link
2026-01-27 11:44:53 +08:00
Adcent e4b2e26449 [packages/cli]refactor: read version from package.json dynamically
- Replace hardcoded version string with dynamic package.json reading
- Ensures CLI version stays in sync with package.json

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 21:14:43 +08:00
Adcent 036a64aa2e [packages/cli]feat: add CLI package (@actionbookdev/cli)
- Add actionbook CLI with search, get, and sources commands
- Support formatted output with colors and JSON output mode
- Publish as @actionbookdev/cli to npm

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:01:23 +08:00