Commit Graph

766 Commits

Author SHA1 Message Date
Tommy D. Rossi 44370833f7 feat: bundle playwriter version in extension, warn when CLI/MCP is outdated
The extension now reports which playwriter version it was built with via a
`?v=` query param on its WebSocket connection to the relay. The relay stores
this and exposes it in `/extension/status` and `/extensions/status` endpoints.

CLI and MCP compare the extension's bundled version against their own VERSION.
If the extension was built with a newer playwriter, a warning is shown:

  Playwriter 0.0.60 is outdated (extension requires 0.0.62).
  Run `npm install -g playwriter@latest` or update the playwriter package.

This is fully backward compatible:
- Old extensions without `?v=` get `playwriterVersion: null`, no warning
- No WS protocol changes (version is in URL query params)
- Warning fires once per executor/session lifetime

Flow:
  vite build reads playwriter/package.json → injects __PLAYWRITER_VERSION__
  → extension sends ?v=X.Y.Z on WS connect → relay stores in ExtensionInfo
  → /extension/status returns playwriterVersion → CLI/executor checks & warns
2026-02-16 19:42:58 +01:00
Morse 387149c649 docs: add Chrome launch commands to skill.md for when browser is closed
When the Playwriter extension can't connect because Chrome isn't running,
agents now have platform-specific commands (macOS, Linux, Windows) to start
Chrome from the CLI. Also documents the --allowlisted-extension-id and
--auto-accept-this-tab-capture flags for enabling automatic tab capture
for screen recording without manual extension clicks.

Closes #48
2026-02-16 14:44:12 +01:00
Tommy D. Rossi ce775c06f6 fix: hide frontmatter in remote-access doc from GitHub rendering 2026-02-16 11:32:12 +01:00
Tommy D. Rossi f61509a91f release: playwriter@0.0.62 2026-02-14 16:32:17 +01:00
Tommy D. Rossi fa68e33a78 feat: support HTTPS URLs in PLAYWRITER_HOST + remote access guide
PLAYWRITER_HOST now accepts full URLs like `https://x-tunnel.traforo.dev`
in addition to plain hostnames. Previously it always constructed
`http://${host}:19988` which broke when using traforo tunnels (HTTPS on
port 443).

Added `parseRelayHost()` utility that detects URL protocols and returns
correct HTTP/WebSocket base URLs. Updated all consumers:
- cli.ts: getServerUrl()
- mcp.ts: getLogServerUrl(), checkRemoteServer()
- executor.ts: checkExtensionStatus()
- utils.ts: getCdpUrl() (ws:// → wss:// for HTTPS hosts)

Plain hostnames still work as before (appends :19988).

Added docs/remote-access.md covering:
- Architecture: playwriter serve + traforo tunnel through Cloudflare
- Host and remote machine setup with env vars
- Use cases: remote Mac mini, user support, multi-machine, VM/devcontainer
- Security model: non-guessable URLs, token auth, localhost-only extension
  endpoint, no open ports, visible automation, instant revocation
2026-02-14 16:31:04 +01:00
Tommy D. Rossi 737133641f release: playwriter@0.0.61
Simplify Unix port killing by replacing shell pipelines with direct lsof -t and process.kill().
2026-02-14 00:08:41 +01:00
Tommy D. Rossi 744a9b913a fix: recover relay startup from EADDRINUSE 2026-02-13 15:42:43 +01:00
Tommy D. Rossi 8ffaa9333b Add GitHub Sponsors funding option
- Create .github/FUNDING.yml to enable Sponsor button in repo sidebar
- Add Support section to README with sponsor link

Closes #46
2026-02-11 20:36:05 +01:00
Tommy D. Rossi 674e7c73ad release: @xmorse/playwright-core@1.59.3, playwriter@0.0.59
Fix 'Cannot find module graceful-fs' error on clean npx playwriter installs.

@xmorse/playwright-core@1.59.3:
- Add missing runtime dependencies: graceful-fs, retry, signal-exit
- Fixes GitHub #45

playwriter@0.0.59:
- Update @xmorse/playwright-core to 1.59.3
2026-02-11 19:28:08 +01:00
Tommy D. Rossi b60bbdd052 release: playwriter@0.0.58 2026-02-11 16:51:47 +01:00
Tommy D. Rossi e9e9c2de08 agents 2026-02-11 16:43:36 +01:00
Tommy D. Rossi e0eba5cf77 release: playwriter@0.0.57 2026-02-11 16:35:43 +01:00
Tommy D. Rossi 5098154585 docs: avoid focus stealing in framer iframe workflow
Document the page-reuse pattern for the Framer project tab so repeated checks do not spawn duplicate tabs, and explicitly ban bringToFront in this guide to avoid interrupting the active browser window during local debugging.
2026-02-11 16:16:39 +01:00
Tommy D. Rossi e6f1e8c089 fix extension runtime session routing for oopif iframe locators
Route Runtime.enable/disable through the incoming child sessionId instead of always using the tab root session so OOPIF iframe targets receive execution contexts reliably. Add a focused relay regression test for empty-src cross-origin iframe attach flow and update extension version/changelog for release tracking.
2026-02-11 16:15:02 +01:00
Tommy D. Rossi 1b6c66fed0 dist release 2026-02-07 18:32:03 +01:00
Tommy D. Rossi 150d252b59 fix: stabilize youtube navigation ready-state assertion
Retry the post-goto readyState check when Chromium tears down the execution context during ongoing navigation, so the relay navigation test validates page readiness without intermittent race failures.
2026-02-07 17:37:00 +01:00
Tommy D. Rossi eb36291212 Update AGENTS.md 2026-02-07 09:51:15 +01:00
Tommy D. Rossi be94434c3c Update PLAYWRITER_AGENTS.md 2026-02-07 09:51:10 +01:00
Tommy D. Rossi 5a3f344a0b Update manifest.json 2026-02-07 09:49:41 +01:00
Tommy D. Rossi 8ef3b21776 fix: prioritize test IDs over id attribute in aria snapshot refs
getStableRefFromAttributes checked id before data-testid, opposite of
what getRefsForLocators does. Now both are consistent: test IDs first,
id second. Test IDs are developer-intentional and stable, id is often
auto-generated by frameworks.
2026-02-07 09:25:28 +01:00
Tommy D. Rossi e851adfcb6 refactor: replace CDPSession class with type-safe ICDPSession backed by Playwright's internal CDP session
Remove the custom WebSocket-based CDPSession class entirely. All CDP
communication now goes through PlaywrightCDPSessionAdapter which wraps
Playwright's existing CDP session, avoiding duplicate WebSocket connections
and Target.attachToTarget calls that the relay intercepts.

ICDPSession interface uses ProtocolMapping generics from devtools-protocol
so send/on/off methods are fully type-safe — return types are inferred
from the CDP command string (e.g. 'Page.getLayoutMetrics' returns
Protocol.Page.GetLayoutMetricsResponse).

- Remove CDPSession class and getCDPSessionForPage WebSocket factory
- Remove wsUrl parameter from all snapshot/label functions
- Remove CDPSession cache from executor (adapter is stateless)
- Remove 'as CDPSession' casts from debugger, editor, styles, react-source
- Rename getExistingCDPSessionForPage → getCDPSessionForPage
- Remove test for old getCDPSession through relay
2026-02-06 18:38:26 +01:00
Tommy D. Rossi 682bde5c14 Update PLAYWRITER_AGENTS.md 2026-02-06 18:03:58 +01:00
Tommy D. Rossi 87188423b1 feat: reuse Playwright's internal CDP session instead of creating new WebSocket connections
Switch from getCDPSessionForPage (creates a new WS via Target.attachToTarget)
to getExistingCDPSessionForPage which reuses Playwright's internal CRSession.
This is critical for the relay server where Target.attachToTarget is intercepted
and cannot create real new sessions.

Also add FrameLocator support in accessibilitySnapshot — FrameLocator (from
locator.contentFrame()) is now auto-resolved to the real Frame object needed
for OOPIF CDP session attachment.

- New PlaywrightCDPSessionAdapter wrapping Playwright's CDPSession as ICDPSession
- New getExistingCDPSessionForPage() using context.getExistingCDPSession()
- resolveFrame() helper converts FrameLocator to Frame via elementHandle().contentFrame()
- getAriaSnapshot() frame param now accepts Frame | FrameLocator
- Executor CDP cache uses ICDPSession, borrowed sessions detach as no-op
- Test for getExistingCDPSession through the relay
- Updated framer iframe guide with alternative page.frames() example
- Bump playwright submodule to @xmorse/playwright-core@1.59.2
- Fix styles-api.md import path
2026-02-06 18:03:26 +01:00
Tommy D. Rossi 78734bf1e8 fix: prevent tab group add/remove infinite loop when dragging tabs
When a user drags a tab into the playwriter group, connectTab() sets
its state to 'connecting'. syncTabGroup() previously only kept
'connected' tabs in the group, so it would immediately ungroup the
'connecting' tab. This ungroup fired chrome.tabs.onUpdated, which
called disconnectTab(). When the original connectTab() resolved, it
re-added the tab, triggering onUpdated again — creating an infinite
add/remove/add/remove loop.

Fix: include 'connecting' tabs in syncTabGroup's group membership
filter. This way syncTabGroup won't fight the user's intent by
removing tabs that are still being set up. Error-state tabs are
still correctly excluded from the group.
2026-02-06 15:39:35 +01:00
Tommy D. Rossi d6adb460d5 fix: move log dir from /tmp/playwriter to ~/.playwriter (fixes #44) 2026-02-06 10:44:28 +01:00
Tommy D. Rossi 7f3fddb2af chore: update pnpm-lock.yaml 2026-02-06 10:37:45 +01:00
Tommy D. Rossi 66cdb02dd9 refactor: simplify iframe handling - use frame: Frame instead of iframe: Locator 2026-02-06 10:32:39 +01:00
Tommy D. Rossi d3a87cab2c agents 2026-02-05 22:31:09 +01:00
Tommy D. Rossi 2a95cc9a9a Update playwright 2026-02-05 22:28:59 +01:00
Tommy D. Rossi d9c3362dd9 Update PLAYWRITER_AGENTS.md 2026-02-05 22:28:56 +01:00
Tommy D. Rossi 9e88bcd64e agents 2026-02-05 22:26:47 +01:00
Tommy D. Rossi 187b8ba992 Update AGENTS.md 2026-02-05 22:14:55 +01:00
Tommy D. Rossi 2bc851e37b Update PLAYWRITER_AGENTS.md 2026-02-05 22:14:35 +01:00
Tommy D. Rossi afd0840523 chore: wire forked playwright-core into workspace 2026-02-05 17:06:08 +01:00
Tommy D. Rossi 3f24ac1d8f fix: use Runtime.evaluate fallback when setScriptSource is deprecated
Chrome deprecated Debugger.setScriptSource in Chrome 142+ (removed in 145).
Falls back to Runtime.evaluate to re-execute modified scripts, which
works for scripts defining functions at global scope.
2026-02-05 16:56:27 +01:00
Tommy D. Rossi 0eaf771c57 docs: refine Framer MCP palette verification 2026-02-05 15:48:17 +01:00
Tommy D. Rossi c4a413efba fix iframe snapshots and document Framer MCP flow 2026-02-05 14:49:32 +01:00
Tommy D. Rossi cd6d512d74 Update aria-snapshot.test.ts 2026-02-05 13:13:11 +01:00
Tommy D. Rossi 4eac3235cd waitForExtension in cli session new command 2026-02-05 12:48:37 +01:00
Tommy D. Rossi ebcfe33323 add iframe test with snapshot use 2026-02-05 12:47:15 +01:00
Tommy D. Rossi e33af55982 docs: clarify playwriter auto-use 2026-02-04 23:39:52 +01:00
Tommy D. Rossi 73c9723840 slopping around 2026-02-04 23:21:33 +01:00
Tommy D. Rossi 280572b36e refactor: track frame ownership on targets 2026-02-04 22:16:44 +01:00
Tommy D. Rossi ac49afc535 fix: route iframe targets through page sessions 2026-02-04 22:08:04 +01:00
Tommy D. Rossi dfe9738a00 Update SKILL.md 2026-02-04 22:05:28 +01:00
Tommy D. Rossi a718299b73 feat: add well-known skills discovery endpoint 2026-02-04 19:20:33 +01:00
Tommy D. Rossi 0b60fe844e chore: update diff messaging from tests
- Add "No changes since last call" hints for snapshots/html/markdown

- Adjust truncation message to suggest search

- Update skill.md snapshot behavior doc
2026-02-04 18:16:00 +01:00
Tommy D. Rossi b510f3f0d5 feat: use stable browser keys in CLI selection
- Show stableKey in session new listing
- Require stableKey for --browser selection
- Pass stableKey to session creation when available
2026-02-04 18:01:49 +01:00
Tommy D. Rossi e41c85af7b fix: match stable extension keys in status check 2026-02-04 17:57:59 +01:00
Tommy D. Rossi 1a59082e12 feat: auto-connect tabs created via ghostPublicAPI.openTab
Tabs created via Ghost Browser's openTab API now automatically
attach to Playwriter's debugger, making them immediately available
in context.pages() without requiring manual extension icon click.
2026-02-04 17:47:57 +01:00