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
This commit is contained in:
Tommy D. Rossi
2026-02-16 19:42:58 +01:00
parent 387149c649
commit 44370833f7
6 changed files with 90 additions and 18 deletions
+6
View File
@@ -1,4 +1,7 @@
declare const process: { env: { PLAYWRITER_PORT: string } }
// Injected by vite at build time from playwriter/package.json version.
// CLI/MCP compare this against their own version to warn when the extension is outdated.
declare const __PLAYWRITER_VERSION__: string
import { createStore } from 'zustand/vanilla'
import type { ExtensionState, ConnectionState, TabState, TabInfo } from './types'
@@ -206,6 +209,9 @@ class ConnectionManager {
if (identity.id) {
relayUrl.searchParams.set('id', identity.id)
}
if (typeof __PLAYWRITER_VERSION__ !== 'undefined') {
relayUrl.searchParams.set('v', __PLAYWRITER_VERSION__)
}
logger.debug('Creating WebSocket connection to:', relayUrl)
const socket = new WebSocket(relayUrl.toString())