CodeVetter · Repo Unpack · Extension points
microsoft/playwright
The repository provides concrete registries, factories, and schemas for extending behavior. Some are public configuration surfaces, while others are internal integration seams. Protocol and generated-type changes require coordinated edits across boundaries. Browser engines and injected selector behavior have explicit synchronization requirements.
- Connection.registerObjectFactories installs type-to-ChannelOwner constructors in a map; the constructor registers Browser, BrowserContext, Page, Route, Tracing, Android, Electron, and other protocol object types.
- Protocol commands are declared in YAML with parameter mixins and typed returns; generate_channels emits client/server channel interfaces, structs, metadata, and runtime validators.
- createReporters is a constructor registry for built-ins and loads custom reporter modules from configuration or PW_TEST_REPORTER, adapting them through wrapReporterAsV2.
- TestRunnerPlugin defines asynchronous setup/teardown hooks; registration accepts an instance or synchronous/asynchronous factory, and createPluginSetupTasks invokes those lifecycle hooks.
- Selectors.register accepts custom engines after name/reserved/duplicate checks; parseSelector selects main or utility execution worlds based on engine contentScript and built-in requirements.
- Agent tool modules are assembled in browserTools; filteredTools retains core or enabled capabilities, excludes skillOnly tools, and removes selector fields from exposed schemas.
- defineTool preserves a typed schema/handler definition; defineTabTool wraps handlers with ensureTab and modal-state compatibility checks, allowing tools to declare which modal state they clear.
- BrowserType is an abstract engine seam for defaultArgs, connectToTransport, amendEnvironment, startup-log rewriting, and graceful close; CLI additions attach through decorateProgram and the testOptions command table.