Adding Providers
Each AI platform is implemented as a provider — a self-contained plugin consisting of an Extractor, a Transformer, and a Provider registration.
Provider structure
Section titled “Provider structure”Each provider lives in src/providers/{platform}/:
src/providers/myplatform/├── extractor.ts # Fetches raw data from the platform├── transformer.ts # Converts raw data to HAEVN.Chat format├── model.ts # TypeScript types for the raw data└── provider.ts # Registers the provider with the systemStep-by-step guide
Section titled “Step-by-step guide”-
Create the provider directory
Terminal window mkdir src/providers/myplatform -
Define your raw data model (
model.ts)Define TypeScript types matching the platform’s API or DOM structure.
-
Write the Extractor (
extractor.ts)Implement the
Extractor<TRaw>interface. For API-based platforms, this makes fetch calls using the existing browser session. For DOM-based platforms, this reads from the page DOM. -
Write the Transformer (
transformer.ts)Implement the
Transformer<TRaw>interface. This converts your raw data into the canonicalHAEVN.Chatformat. See Data Model for the format spec. -
Register the provider (
provider.ts)Export a
Providerobject with your extractor, transformer, and platform metadata (name, icon URL, host patterns). -
Register in init.ts
Add your provider to the provider registry in
src/background/init.ts. -
Add host permissions
Add the platform’s domain to
manifest.json’shost_permissionsarray. -
Add platform detection
Update
src/utils/platform.tsto recognize the platform’s URLs and return the correct provider ID.
Testing your provider
Section titled “Testing your provider”pnpm testWrite unit tests for your transformer in tests/providers/myplatform/. Use real (anonymized) API response fixtures to validate the transformation.