Skip to content

feat: a bare patchright-cli shows the open sessions and what to run next - #22

Merged
b1zya merged 1 commit into
mainfrom
feat-home-view
Nov 8, 2026
Merged

b1zya merged 1 commit into
mainfrom
feat-home-view

Conversation

@b1zya

@b1zya b1zya commented Nov 8, 2026

Copy link
Copy Markdown
Owner

A bare patchright-cli printed the whole manual. It now prints the home view: what is already open in this workspace and what to run next, so an agent arriving in a workspace continues a session instead of opening a second one. The idea comes from the home view in AhaiMk01/patchright-cli; the implementation is ours, client-side only.

patchright-cli 0.2.0 (patchright-core 1.64.3) - anti-detection browser automation for AI agents

Browsers open in this workspace (2):
- default: headless chrome, 2 tabs, current about:blank
  closes after 30m without a command, closes when process 145380 exits
- work: headless chrome, profile work, 1 tab, current "Example Domain" https://example.com/
  closes after 30m without a command, closes when process 145380 exits

Next:
  patchright-cli snapshot             element refs of the current page
  patchright-cli -s=<name> <command>  act in another session
  patchright-cli list --all           sessions in every workspace
  patchright-cli --help               all commands; <command> --help for one

With nothing open it says so and points at open <url> and env.

How it works

  • src/commands/home.ts: reads this workspace's session files, connects to each daemon in parallel and asks tab-list (raw) with a 1.5 s budget. A daemon that refuses the connection is skipped (stale file, left in place: the view is read-only); one that does not answer in time shows as busy; one started by a newer client shows as incompatible with an open hint, since this client refuses to drive it.
  • It starts nothing and does not touch the activity file, so looking does not keep an idle session alive.
  • --json returns the same as data (sessions[] with status, headed, profile, tabs, current, lifetime, plus next[]). --help is unchanged and still the manual.
  • src/program.ts (forked): the bare-run branch calls the home view; the --help branch is as before. The Agent skill: line moved into a shared variable and shows in both.

Docs and tests

  • SKILL.md: run bare patchright-cli after env, and continue an open session instead of opening another; README and CHANGELOG mirror it.
  • tests/unit/home.spec.ts: tab-list parsing, workspace filtering, stale/busy/incompatible sessions, hints. tests/integration/isolation.spec.ts: empty view, a named session with its current page, --json, --help.
  • npm run check, npm run test:unit (133), npm run test:integration (23) pass locally on Windows. Measured 0.14 s with two live sessions.

🤖 Generated with Claude Code

The no-argument run printed the whole manual. It now prints the home
view: the live sessions of this workspace with their mode, profile, tab
count, current page and lifetime, then the next commands (or how to open
a browser when none is). --json gives the same as data; --help is still
the manual. It starts nothing, asks each daemon for tab-list with a
1.5 s budget, deletes no stale session file and does not touch the idle
timer. Idea from AhaiMk01/patchright-cli's home view.
@b1zya
b1zya merged commit de1c508 into main Nov 8, 2026
5 checks passed
@b1zya
b1zya deleted the feat-home-view branch November 8, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant