aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2026-05-05fix: prevent TUI crash when screenshot path overflows terminal width (#2)Aman Kumar
The Image text-fallback render does not respect the rendered width, so a long file path can blow past the terminal width and crash the host TUI. Wrap the component to truncate each rendered line with truncateToWidth so it fits the available width. Co-authored-by: amankumarsingh77 <amankumarsingh7702@gmal.com>
2026-05-04feat: parallel tool execution with automatic mutation serializationamankumarsingh77
- Add lightweight async mutex (src/util/mutex.ts) for FIFO serialization - Add serialized?: boolean to BrowserToolDefinition - Wire mutex acquisition into registerBrowserTool execute wrapper - Expose mutationMutex() on BrowserClient - Mark all mutation tools (click, type, scroll, navigate, switch_tab, etc.) as serialized - Leave observation tools (screenshot, page_info, execute_js, http_get, etc.) unguarded - Update prompt and skill docs to reflect parallel-safe behavior - Fix scroll tool: add Page.bringToFront, explicit button:none/buttons:0/pointerType:mouse - Update .gitignore to ignore scripts/ and data/ folders
2026-05-04docs: add speed-optimizations research; chore: improve browser detection in ↵amankumarsingh77
setup
2026-05-03feat: render screenshots inline in TUI via Image component; add ↵amankumarsingh77
parallelization guidance to SKILL.md - browser_screenshot now has renderResult that creates an Image component for inline display in Kitty/iTerm2/Ghostty/WezTerm terminals - Falls back to dim text placeholder on terminals without image support - Updated system prompt table description to mention TUI inline rendering - Added Parallelization section to SKILL.md teaching the agent to batch independent operations (browser_open_urls, browser_http_get, etc.)
2026-05-02fix: replace @ts-expect-error with @ts-ignore for dynamic sharp importamankumarsingh77
2026-05-02release: v0.3.1 — audit fixes for list_tabs IDs, switch_tab prefix ↵amankumarsingh77
matching, download auto-mkdir, session recovery, docs updates Bug fixes: - list_tabs: show full 32-char targetIds (was truncated to 8 chars) - switch_tab: prefix matching fallback for hex prefixes >= 8 chars - download: auto-create directory with mkdir -p - ensureAlive: Runtime.evaluate probe to recover from crashed page targets Docs: - dispatch_key: clarify DOM-only event behavior - navigate: warn about Google anti-bot limitation - network_log: update deprecated promptSnippet - SKILL.md: document actual daemon API (evaluateJs, pageInfo, session.call) - SKILL.md: add troubleshooting for sharp/maxDim and Google navigation - sharp: add to optionalDependencies for screenshot maxDim auto-resize
2026-05-02chore: address final-review minors — surface event-consumer crashes, ↵amankumarsingh77
document IIFE-wrap heuristic, log shutdown failures, fix CHANGELOG file-size claim Five tweaks from the whole-implementation review: - session.ts: log unexpected event-consumer rejections instead of silent swallow - client.ts: comment the return-substring IIFE-wrap false-positive case - transport.ts: comment that ws.onclose post-open settle is no-op-by-design - index.ts: log client.stop() failures during shutdown - CHANGELOG.md: correct largest-file claim (transport.ts and client.ts are ~220 each, not "client.ts at ~180") Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02chore: final cleanup — drop unused keyCode exportamankumarsingh77
2026-05-02refactor: delete legacy daemon, tools, protocol, renderers; collapse to ↵amankumarsingh77
single tsconfig
2026-05-02refactor: drop legacy daemon usage from index/setup; trim state; move 4 ↵amankumarsingh77
files to strict tsconfig Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02feat(domains): migrate execute_js and run_script with path allowlist + ↵amankumarsingh77
timeout + return validation
2026-05-02feat(domains): migrate http_get (timeout covers body) and get_network_log ↵amankumarsingh77
(deprecation note)
2026-05-02feat(domains): migrate drag_and_dropamankumarsingh77
2026-05-02feat(domains): migrate viewport_resizeamankumarsingh77
2026-05-02feat(domains): migrate upload_file (safeJs), download (validated dir), ↵amankumarsingh77
print_to_pdf
2026-05-02feat(domains): migrate tab tools (list, current, switch, new)amankumarsingh77
2026-05-02feat(domains): migrate go_back, go_forward, reloadamankumarsingh77
2026-05-02feat(domains): migrate navigate (NavOutcome) and open_urlsamankumarsingh77
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02feat(domains): migrate screenshot, add typed sharp shim, restore click ↵amankumarsingh77
crosshair overlay
2026-05-02feat(domains): migrate handle_dialogamankumarsingh77
2026-05-02feat(domains): migrate page_info, wait, wait_for_load with typed timeoutamankumarsingh77
2026-05-02feat(domains): migrate scroll with W3C deltaY semantics and dialog guardamankumarsingh77
2026-05-02feat(domains): migrate type, press_key, dispatch_key with safeJs and ↵amankumarsingh77
matched-count validation
2026-05-02feat(domains): migrate browser_click to defineBrowserTool — vertical sliceamankumarsingh77
Implements Task 9: adds src/domains/click.ts with the new architecture, updates registry.ts to register clickTool, removes the legacy browser_click block from tools.ts, and wires BrowserClient alongside BrowserDaemon in index.ts so both systems coexist during migration. Also fixes AnyBrowserToolDefinition variance: uses never-arg renderCall in the erased type and a boundary cast in registerBrowserTool so concrete tool definitions (with specific Static<S> args) are assignable to the registry array without widening.
2026-05-02feat: add defineBrowserTool helper, truncation, schemas/common, empty registryamankumarsingh77
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02fix(cdp): serialize event consumer; persist dialog until taken; validate ↵amankumarsingh77
page info shape
2026-05-02feat: add CDP session and BrowserClient factoryamankumarsingh77
2026-05-02fix(cdp): validate inbound CDP messages with a runtime type guardamankumarsingh77
2026-05-02feat(cdp): add factory-based transport with Result and event AsyncIterableamankumarsingh77
2026-05-02fix(cdp): clear socket timer on probe success; surface non-ENOENT readFile ↵amankumarsingh77
errors
2026-05-02feat(cdp): port DevToolsActivePort discovery to Resultamankumarsingh77
2026-05-02feat(cdp): add types and error model for new transport layeramankumarsingh77
2026-05-02docs(util): clarify safeJs trust boundary and unsupported value typesamankumarsingh77
2026-05-02feat(util): add pure keycodes and safeJs template helperamankumarsingh77
2026-05-02fix(util): preserve AbortSignal.reason; validate namespace in temp pathsamankumarsingh77
2026-05-02feat(util): add result, time, and paths primitives for v0.3 rewriteamankumarsingh77
2026-05-02feat: v0.2.1 — feature parity with browser-use/browser-harnessamankumarsingh77
Adds the missing tools called out in docs/browser-harness-comparison.md: upload_file, dispatch_key, download (configure dir), viewport_resize, drag_and_drop, print_to_pdf, get_network_log, plus the iframe-target helper. Updates promptGuidelines and the system prompt's tools table. Tracked in todo.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02perf: v0.2.0 — event-based waitForLoad, fast ensureAlive, JPEG ↵amankumarsingh77
screenshots, page info caching 5 performance optimizations (14-36% faster end-to-end, output quality unchanged): - fast ensureAlive(): WS state check instead of CDP roundtrip (96% faster per-call) - event-based waitForLoad(): CDP load events instead of 300ms polling (99.5% faster for loaded tabs) - JPEG screenshot support: 29-49% smaller files, faster CDP transfer - page info caching: 1s TTL eliminates redundant evaluateJS calls - parallel domain enables: Promise.all instead of sequential await in switchTab() Benchmark: 3622ms vs 4243ms baseline on 3-tab navigation + screenshot task.
2026-04-30Replace dynamic tool registration with browser_run_scriptamankumarsingh77
Remove register_tool/remove_tool/list_dynamic_tools and the entire dynamic-tools.ts module. Replace with a single browser_run_script tool that executes temporary scripts from disk with daemon access. Scripts are now written to disk before execution, making them auditable and re-runnable. Same bindings (daemon, require, params, etc.) as before via the same AsyncFunction mechanism.
2026-04-30fix: stop Chrome remote-debugging consent popup stormamankumarsingh77
Previously a single consent-pending socket could spawn up to 5 stacked 'Allow remote debugging?' dialogs. Three causes: - onopen reset _reconnectAttempts, but Chrome accepts the WS upgrade before the user clicks Allow, so a held socket looked healthy. - ensureAlive's health probe used the full 15s CDP timeout; while the user was reading the dialog the probe would time out, trigger a stop()+start(), and a fresh popup would stack on top. - onclose auto-reconnected unconditionally even when consent had never been granted on that connection. Now a connection is only considered healthy once the first CDP roundtrip completes (attachFirstPage). ensureAlive does a 2s short probe before tearing down the socket. onclose bails out of auto- reconnect when consent was never observed, so a denied dialog surfaces a clean error instead of looping.
2026-04-29Replace socket daemon with direct CDP WebSocket connectionamankumarsingh77
Drops the Unix socket subprocess in favor of talking CDP directly over WebSocket from the extension. Removes the protocol's send/health helpers, simplifies setup to just verifying Chrome's remote debugging port, and tightens types in dynamic-tools. Bumps Node engine to >=22 and adds the ws dependency.
2026-04-29Initial release: pi-browser-harnessamankumarsingh77
Browser control extension for pi — 20 browser_* tools for navigating, clicking, typing, screenshotting, and extracting data from real Chrome via CDP. Includes self-extending harness (register_tool/remove_tool), guided /browser-setup, session persistence, and custom TUI renderers.