canonry

provider-cdp

Purpose

The cdp:chatgpt adapter uses Chrome DevTools Protocol (CDP) to submit tracked queries to the ChatGPT web UI. It reads the rendered answer and citations.

Key Files

File Role
src/adapter.ts Exports cdpChatgptAdapter — the ProviderAdapter object
src/normalize.ts Response normalization to standard NormalizedQueryResult
src/connection.ts CDPConnectionManager — manages browser connections via CDP. healthcheck(signal?) reads Chrome’s /json/version itself (CDP.Version takes no signal) at the host’s resolved address, so an aborted connection test cancels its request
src/screenshot.ts captureElementScreenshot() — captures page element screenshots
src/targets/ Target-specific automation scripts
src/targets/chatgpt.ts ChatGPT UI automation — navigation, query input, response extraction
src/targets/types.ts CDPProviderError and target type definitions
src/index.ts Re-exports public API

Patterns

This provider follows the same ProviderAdapter interface but has a more complex implementation due to browser automation:

Browser connection and evidence

Common Mistakes

See Also