Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/check.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ci

on:
pull_request:
push:
branches: [main]

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run check
- name: node consumer smoke
run: |
set -euo pipefail
TARBALL="$PWD/$(npm pack --silent)"
mkdir -p "$RUNNER_TEMP/c" && cd "$RUNNER_TEMP/c"
npm init -y >/dev/null && npm pkg set type=module >/dev/null
npm install "$TARBALL"
node -e 'import("@corbits/codex-provider").then((m) => { for (const n of ["createCodexResponsesAdapter", "withCodexContentTypeRepair", "exchangeCodexCode", "refreshCodexTokens"]) if (typeof m[n] !== "function") throw new Error("missing export: " + n); })'
53 changes: 53 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CLA Assistant

on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, synchronize]

permissions:
actions: write
contents: write
pull-requests: write
statuses: write

concurrency:
group: cla-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}
cancel-in-progress: true

jobs:
cla:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Maintainer fast path
if: >-
github.event_name == 'pull_request_target' &&
(contains(fromJSON('["TheGreatAxios","brianjfox"]'), github.event.pull_request.user.login) ||
endsWith(github.event.pull_request.user.login, '[bot]'))
run: echo "Maintainer or bot pull request; CLA not required."
- name: CLA Assistant
if: >-
((github.event.comment.body == 'recreate-signatures' ||
github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') ||
github.event_name == 'pull_request_target') &&
!(github.event_name == 'pull_request_target' &&
(contains(fromJSON('["TheGreatAxios","brianjfox"]'), github.event.pull_request.user.login) ||
endsWith(github.event.pull_request.user.login, '[bot]')))
# corbitsdev/cla-assistant-action v2.6.1-node24: upstream v2.6.1 on node24.
uses: corbitsdev/cla-assistant-action@ef6d3e51db8232fe93090810f13bde30497c1d74
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path-to-document: "https://github.com/${{ github.repository }}/blob/main/CLA.md"
path-to-signatures: "signatures/version1/cla.json"
branch: "cla-signatures"
allowlist: TheGreatAxios,brianjfox,*[bot]
custom-notsigned-prcomment: >-
Thank you for your contribution. Before it can be merged, please read our
[Contributor License Agreement](https://github.com/${{ github.repository }}/blob/main/CLA.md)
and sign it by posting a new comment on this pull request containing
exactly the line below (nothing else):
custom-pr-sign-comment: "I have read the CLA Document and I hereby sign the CLA"
custom-allsigned-prcomment: "All contributors have signed the CLA."
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
node_modules/
dist/
.corbits/
.DS_Store
*.tsbuildinfo
*.tgz
coverage/
.env
.env.*
.DS_Store
23 changes: 7 additions & 16 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ than reimplementing OAuth or the Responses wire protocol.
- `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`).

## Rules

- `@corbits/oauth-core`, `@corbits/openai-responses`, `@intx/inference`,
and `@intx/types` are peer dependencies (npm semver ranges) — 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.
and `@intx/types` are peer dependencies (`^0.1.0` and `^0.4.0`, pinned
exactly in `devDependencies`) — 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);
never `as T` untrusted input.
- `exactOptionalPropertyTypes` is on: omit optional keys, never assign
Expand All @@ -41,9 +44,7 @@ than reimplementing OAuth or the Responses wire protocol.
## Local development

```sh
bun install
bun run build # tsc -p tsconfig.build.json -> dist/
bun run check # typecheck + lint + format:check + test
bun install && bun run check
```

`@corbits/oauth-core` and `@corbits/openai-responses` resolve from npm, so
Expand All @@ -55,13 +56,3 @@ registry and drops the link.
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.

## Distribution

The package ships compiled `dist/` on npm as `@corbits/codex-provider`:
`exports` points at `dist/index.js` (types at `dist/index.d.ts`), built with
`bun run build` (`tsc -p tsconfig.build.json`) via the `prepack` hook.
Consumers install the published package (`bun add @corbits/codex-provider`
or `npm install @corbits/codex-provider`) on Bun >= 1.2 or Node.js >= 24,
both of which load the compiled output. Only `dist` ships (`files` is
dist-only).
64 changes: 64 additions & 0 deletions CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Contributor License Agreement (CLA)

Version 1.0

This Contributor License Agreement ("Agreement") is entered into between the contributor ("Contributor") and ABK Labs, Inc. ("Maintainer").

By submitting any Contribution to a project maintained by Maintainer, the Contributor agrees to the following terms.

## 1. Definitions

"Contribution" means any source code, object code, documentation, test cases, designs, specifications, bug fixes, enhancements, comments, pull requests, commits, issues containing code, or other materials intentionally submitted to a project maintained by Maintainer.

## 2. Copyright Ownership

The Contributor retains ownership of the Contributor's copyrights in the Contribution.

No transfer of copyright ownership is required by this Agreement.

## 3. License Grant to Maintainer

The Contributor grants Maintainer a perpetual, worldwide, non-exclusive, irrevocable, royalty-free license to:

- use, reproduce, modify, distribute, display, perform, and sublicense the Contribution;
- combine the Contribution with other software and works;
- distribute the Contribution under the project's current license;
- distribute the Contribution under future versions of the project's license;
- distribute the Contribution under alternative open-source, source-available, commercial, proprietary, or dual-license terms.

## 4. License Grant to the Public

The Contributor agrees that the Contribution may be distributed as part of the applicable project under the project's then-current license terms, including LGPL-2.1 or any successor license adopted by Maintainer.

## 5. Contributor Representations

The Contributor represents and warrants that:

1. The Contributor created the Contribution or otherwise has sufficient rights to submit it.
2. The Contributor has the legal authority to grant the rights described in this Agreement.
3. To the best of the Contributor's knowledge, the Contribution does not knowingly infringe the intellectual property rights of any third party.
4. Any third-party material included in the Contribution has been properly disclosed and is compatible with the rights granted under this Agreement.

## 6. Corporate Contributions

If a Contribution is submitted on behalf of an employer or other legal entity, the person accepting this Agreement represents that they are authorized to bind that entity to this Agreement.

## 7. No Obligation

Maintainer is not obligated to use, distribute, maintain, support, or accept any Contribution.

## 8. Disclaimer

Except as expressly stated in this Agreement, the Contribution is provided "AS IS" without warranties or conditions of any kind.

## 9. Electronic Acceptance

The Contributor agrees that electronic acceptance of this Agreement, including acceptance through a website, source-control platform, click-through process, pull-request workflow, or similar mechanism, shall have the same force and effect as a handwritten signature.

## 10. Governing Law

This Agreement shall be governed by the laws of the State of California, excluding its conflict-of-law provisions.

---

By submitting a Contribution, the Contributor acknowledges that they have read and agree to this Agreement.
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributing

## Development

```sh
bun install
bun run check
```

`bun run check` runs typecheck, lint, format check and unit tests. `bun run format` rewrites the tree.

Contributors sign the [CLA](CLA.md) on their first PR; the CLA bot explains how.

Unit tests sit next to the code in `src/`; end-to-end tests live in `e2e/`.
`e2e/live.test.ts` calls the ChatGPT Codex backend and runs only when
`CODEX_LIVE_ACCESS_TOKEN` is set:

```sh
CODEX_LIVE_ACCESS_TOKEN=<access token> CODEX_LIVE_ACCOUNT_ID=<account id> \
bun run test:e2e
```

`CODEX_LIVE_MODEL` is optional (default `gpt-5.5`).

## Commit messages

Commit subjects and PR titles follow [Conventional Commits](https://www.conventionalcommits.org): `feat`, `fix`, `refactor`, `test`, `docs`, `build`, `ci`, `perf`, and `chore(release): x.y.z` for releases.
Add `!` only for public API breaks: removed or renamed exports, changed signatures, newly required params. Peer and dependency range changes are `build(deps):` with no `!`.
Keep subjects imperative, lowercase after the colon, 72 characters or less, and free of ticket IDs.
Every PR links its issue with a `Closes <issue id>` line in the PR body.

## Releasing

Releases are manual. On a clean, up-to-date `main`:

```sh
npm version <patch|minor> -m "chore(release): %s"
git push --follow-tags
gh release create "v$(node -p 'require("./package.json").version')" --generate-notes
npm publish
```

Bump minor only for breaking API changes; everything else is a patch. `prepack` builds `dist/` from the tagged commit.
23 changes: 15 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "@corbits/codex-provider",
"version": "0.1.0",
"version": "0.1.1",
"description": "OpenAI Codex (Login with ChatGPT) as an Interchange inference provider, with OAuth token exchange, a Responses-protocol adapter, and a content-type repair for the ChatGPT backend.",
"homepage": "https://github.com/corbitsdev/corbits-codex-provider",
"keywords": [
"codex",
"corbits",
"inference",
"interchange",
"oauth",
"openai",
"responses"
],
"homepage": "https://github.com/corbitsdev/corbits-codex-provider#readme",
"bugs": {
"url": "https://github.com/corbitsdev/corbits-codex-provider/issues"
},
Expand All @@ -19,8 +28,6 @@
],
"type": "module",
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand All @@ -31,15 +38,15 @@
"access": "public"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"build": "rm -rf dist && tsc -p tsconfig.build.json",
"prepack": "bun run build",
"typecheck": "tsc --noEmit",
"lint": "oxlint",
"format": "oxfmt",
"format:check": "oxfmt --check",
"test": "bun test src",
"check": "bun run typecheck && bun run lint && bun run format:check && bun run test",
"test:e2e": "bun test e2e"
"test": "bun test src --pass-with-no-tests",
"test:e2e": "bun test e2e",
"check": "bun run typecheck && bun run lint && bun run format:check && bun run test"
},
"dependencies": {
"arktype": "^2.2.3"
Expand Down
6 changes: 2 additions & 4 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": false,
"composite": false,
"noEmit": false,
"declaration": true,
"declarationMap": false,
"sourceMap": false,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": "src"
},
Expand Down
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ESNext",
"allowJs": true,
"resolveJsonModule": true,
"module": "ESNext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"exactOptionalPropertyTypes": true,
"module": "ESNext",
"noEmit": true,
"lib": ["ESNext"],
"types": ["bun"]
Expand Down
Loading