@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.
- Consume
@corbits/oauth-coreand@corbits/openai-responsesas packages (github:specifiers) only — never vendor or fork them.@intx/inferenceand@intx/typesare peer dependencies: an adapter must plug into the host's own copy of the harness, not a second bundled one. - Parse every trust boundary with arktype (
CodexQuirks, id_token claims); neveras Tuntrusted input. exactOptionalPropertyTypesis on: omit optional keys, never assignundefinedto them.bun.lockis committed once@corbits/oauth-coreand@corbits/openai-responsesare on GitHub; a lockfile written againstbun linksymlinks 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. - 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 # typecheck + lint + format:check + test@corbits/oauth-core and @corbits/openai-responses resolve from their
GitHub repos, so bun install needs those repos pushed. To work against an
unpushed local checkout of either, bun link it here; a later bun install
re-resolves from git 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.
The package ships TypeScript source: exports points at src/index.ts,
there is no build step and no dist/. Consumers install it with
bun add github:corbitsdev/corbits-codex-provider and Bun runs the source
as-is.