@corbits/codex-provider gives an Interchange host a Responses-protocol
adapter and OAuth building blocks for OpenAI Codex ("Login with ChatGPT").
It composes @corbits/oauth-core and @corbits/openai-responses rather
than reimplementing OAuth or the Responses wire protocol.
src/constants.ts— endpoints, client id, headers, timeouts.src/oauth.ts—codexOAuthConfig,accountIdFromIdToken, token-response mapping.src/instructions.ts— the bridge-message wrap for the host's operating prompt.src/quirks.ts—CodexQuirks, the host-identity bagwrapCodexBridgeMessageneeds.src/responses-adapter.ts—createCodexResponsesAdapter, a plain(source, quirks?)AdapterFactory.src/content-type-repair.ts—withCodexContentTypeRepair, a fetch decorator for a backend content-type bug.src/index.ts— the public surface; nothing else is imported by consumers.src/*.test.ts— unit tests, excluded from the build.e2e/live.test.ts— the opt-in live suite (CODEX_LIVE_ACCESS_TOKEN).
@corbits/oauth-core,@corbits/openai-responses,@intx/inference, and@intx/typesare peer dependencies (^0.1.0and^0.4.0, pinned exactly indevDependencies) — never vendor or fork them. An adapter must plug into the host's own copies of the harness and its sibling packages, not second bundled ones.- Parse every trust boundary with arktype (
CodexQuirks, id_token claims); neveras Tuntrusted input. exactOptionalPropertyTypesis on: omit optional keys, never assignundefinedto them.bun.lockis committed. Never commit a lockfile written againstbun linksymlinks — it would not resolve for anyone else.- No product strings baked in;
CodexQuirksis the only injection point for a host's identity, and an absent bag is a validation error, not a default. - Relative imports inside
src/carry explicit.jssuffixes so the compileddist/output resolves under native Node ESM. Never add a build-time rewrite script to paper over an extensionless import. - Tests exist only for load-bearing risk: the exact Codex request shape,
accountIdFromIdTokenon hostile input, the bridge-message tag structure, and the content-type repair's conditions.
bun install && bun run check@corbits/oauth-core and @corbits/openai-responses resolve from npm, so
bun install needs no git access. To work against an unpushed local checkout
of either, bun link it here; a later bun install re-resolves from the
registry and drops the link.
CodexQuirks in src/quirks.ts is explicitly typed as Type<CodexQuirksShape>
rather than left to inference: a consumer can end up with two resolved
copies of arktype on disk, and TypeScript cannot name the inferred type
across that boundary.