Open History to see the last commit
1/**
2 * BUILT_IN_DRIVERS — the static set of `ProviderDriver`s this build ships
3 * with.
4 *
5 * Every driver that the server knows how to instantiate from settings is
6 * listed here. The `ProviderInstanceRegistry` iterates this array when
7 * resolving `providerInstances` entries; anything not in the array surfaces
8 * as an `"unavailable"` shadow snapshot at runtime (see
9 * `buildUnavailableProviderSnapshot`).
10 *
11 * Adding a new first-party driver means:
12 * 1. implement `ProviderDriver` in a sibling `Drivers/<Name>Driver.ts`,
13 * 2. add it to this array,
14 * 3. ensure the runtime layer satisfies its declared `R`.
15 *
16 * The aggregated `BuiltInDriversEnv` type is the union of every driver's
17 * env requirement — the registry layer's `R` is this type, and the runtime
18 * layer (ChildProcessSpawner, FileSystem, Path, ServerConfig,
19 * OpenCodeRuntime, …) must satisfy it.
20 *
21 * @module provider/builtInDrivers
22 */
23import { ClaudeDriver, type ClaudeDriverEnv } from "./Drivers/ClaudeDriver.ts";
24import { CodexDriver, type CodexDriverEnv } from "./Drivers/CodexDriver.ts";
25import { CursorDriver, type CursorDriverEnv } from "./Drivers/CursorDriver.ts";
26import { GrokDriver, type GrokDriverEnv } from "./Drivers/GrokDriver.ts";
27import { OpenCodeDriver, type OpenCodeDriverEnv } from "./Drivers/OpenCodeDriver.ts";
28import type { AnyProviderDriver } from "./ProviderDriver.ts";
29
30/**
31 * Union of infrastructure services required to construct any built-in
32 * driver. The registry layer declares `R = BuiltInDriversEnv`; the runtime
33 * layer must provide every service in this union.
34 */
35export type BuiltInDriversEnv =
36 | ClaudeDriverEnv
37 | CodexDriverEnv
38 | CursorDriverEnv
39 | GrokDriverEnv
40 | OpenCodeDriverEnv;
41
42/**
43 * Ordered list of built-in drivers. Order matters only for tie-breaking in
44 * UI presentation — the registry itself is keyed by `driverKind`, so
45 * iteration order has no functional effect on instance lookup.
46 */
47export const BUILT_IN_DRIVERS: ReadonlyArray<AnyProviderDriver<BuiltInDriversEnv>> = [
48 CodexDriver,
49 ClaudeDriver,
50 CursorDriver,
51 GrokDriver,
52 OpenCodeDriver,
53];