Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
54dafde
device/stealth: commit local changes in submodule
riatzukiza Nov 16, 2025
2b0adf4
Docs: fix test README package name (#18)
riatzukiza Nov 17, 2025
f56e506
Add fork-aware prompt_cache_key derivation (#19)
riatzukiza Nov 17, 2025
e420e66
Refactor: Eliminate code duplication and improve maintainability
riatzukiza Nov 17, 2025
6b7227e
testing!
riatzukiza Nov 17, 2025
8757e76
Merge branch 'device/stealth' of github.com:open-hax/codex into devic…
riatzukiza Nov 17, 2025
2f3e7e5
Address review: plugin config errors, compaction gating, cache key fa…
riatzukiza Nov 17, 2025
ce75689
Style and metrics cleanup for auth, cache, and sessions
riatzukiza Nov 17, 2025
36e6a9b
linting and formatting
riatzukiza Nov 17, 2025
9c8e1e1
Finalize PR 20 review: shared clone utils and tests
riatzukiza Nov 19, 2025
4deeb6e
Merge branch 'staging' into device/stealth
riatzukiza Nov 19, 2025
875f149
Fix CI workflow YAML syntax and quoting
riatzukiza Nov 19, 2025
1133e1e
update lint rules
riatzukiza Nov 19, 2025
bee913e
allow lint warnings without masking errors
riatzukiza Nov 19, 2025
d40f3b3
seperate linting and formatting ci
riatzukiza Nov 19, 2025
915120b
seperated formatting workflow from ci yaml and gave it permissions to…
riatzukiza Nov 19, 2025
dede73d
opencode can respond to all pr comments
riatzukiza Nov 19, 2025
71fc782
Fix test/README.md documentation: update test counts and config file …
riatzukiza Nov 19, 2025
058f596
Merge pull request #20 from open-hax/device/stealth
riatzukiza Nov 19, 2025
cd19013
0.1.0
riatzukiza Nov 19, 2025
de19f8e
0.2.0
riatzukiza Nov 19, 2025
5717706
docs: update AGENTS.md for gpt-5.1-codex-max support
riatzukiza Nov 19, 2025
41755ac
chore: add v3.3.0 changelog entry for gpt-5.1-codex-max
riatzukiza Nov 19, 2025
9c7fb71
docs: update README for gpt-5.1-codex-max integration
riatzukiza Nov 19, 2025
8536bf1
config: add gpt-5.1-codex-max to full-opencode.json
riatzukiza Nov 19, 2025
564bac7
config: update minimal-opencode.json default to gpt-5.1-codex-max
riatzukiza Nov 19, 2025
2f2d238
docs: update CONFIG_FIELDS.md for gpt-5.1-codex-max
riatzukiza Nov 19, 2025
266606b
docs: add persistent logging note to TESTING.md
riatzukiza Nov 19, 2025
9175628
feat: implement persistent rolling logging in logger.ts
riatzukiza Nov 19, 2025
9cac2c2
feat: add gpt-5.1-codex-max support to request transformer
riatzukiza Nov 19, 2025
88008a9
types: add xhigh reasoning effort to TypeScript interfaces
riatzukiza Nov 19, 2025
b309387
test: add gpt-5.1-codex-max to test-all-models.sh
riatzukiza Nov 19, 2025
c452368
test: fix codex-fetcher test headers mock
riatzukiza Nov 19, 2025
3ee37ef
test: update logger tests for persistent rolling logging
riatzukiza Nov 19, 2025
3976d2e
test: add appendFileSync mock to plugin-config tests
riatzukiza Nov 19, 2025
b5a2683
test: add appendFileSync mock to prompts-codex tests
riatzukiza Nov 19, 2025
6f8cf66
test: add comprehensive fs mocks to prompts-opencode-codex tests
riatzukiza Nov 19, 2025
bd06f6e
test: add comprehensive gpt-5.1-codex-max test coverage
riatzukiza Nov 19, 2025
d451b3d
docs: add specification files for gpt-5.1-codex-max and persistent lo…
riatzukiza Nov 19, 2025
4406707
merge: resolve conflicts with staging branch
riatzukiza Nov 19, 2025
e3144f8
fix failing tests
riatzukiza Nov 19, 2025
180f9e4
fix: implement cache isolation to resolve OAuth plugin conflicts
riatzukiza Nov 19, 2025
774bcfa
fixed minor type error
riatzukiza Nov 19, 2025
4b57476
test: remove redundant env reset and header mock
riatzukiza Nov 19, 2025
c9b80f8
Reduce console logging to debug flag
riatzukiza Nov 19, 2025
ca55057
Merge pull request #27 from open-hax/feat/gpt-5-1-codex-max
riatzukiza Nov 19, 2025
63c91a6
fix: filter ENOENT errors from cache logging to reduce noise
riatzukiza Nov 19, 2025
72b7616
merge: resolve conflicts with staging branch
riatzukiza Nov 19, 2025
601ee1b
Merge pull request #28 from open-hax/fix/issue-25-oauth-cache-conflicts
riatzukiza Nov 19, 2025
3b5fb9c
Use openhax/codex as plugin identifier
riatzukiza Nov 19, 2025
0366c1f
Add fallback sources for OpenCode codex prompt
riatzukiza Nov 19, 2025
a98014d
Refresh OpenCode prompt cache metadata
riatzukiza Nov 19, 2025
c0d7856
Merge pull request #30 from open-hax/chore/handle-missing-codex-promp…
riatzukiza Nov 19, 2025
6f4d0be
Refactor metrics response helpers and fix JWT decoding
riatzukiza Nov 20, 2025
e5a5a84
Tighten session tail slice to user/assistant only
riatzukiza Nov 20, 2025
bd8bdfe
Improve compaction resilience and cache metrics safety
riatzukiza Nov 20, 2025
ea8f36c
Add release process documentation and open issues triage guide
riatzukiza Nov 20, 2025
fedb230
Merge pull request #32 from open-hax/docs/release-process-and-issues-…
riatzukiza Nov 20, 2025
034219d
Merge branch 'staging' into chore/codex-max-release-review
riatzukiza Nov 20, 2025
a820aa3
Strengthen tests for cache keys and gpt-5.1 cases
riatzukiza Nov 20, 2025
848778f
Merge branch 'chore/codex-max-release-review' of github.com:open-hax/…
riatzukiza Nov 20, 2025
80995c0
Soften first-session cache warnings and sync transformed body
riatzukiza Nov 20, 2025
63d01e9
Preseed session prompt cache keys
riatzukiza Nov 20, 2025
df60966
Memoize config loading and keep bridge prompts stable
riatzukiza Nov 20, 2025
954f559
Code cleanup: removed redundancy, improved tests
opencode-agent[bot] Nov 20, 2025
ed5ca22
Fixed test shallow copy issue with deep copy.
opencode-agent[bot] Nov 20, 2025
f3ce77e
chore(codex-max): memoize config loading, stabilize bridge prompts, a…
riatzukiza Nov 20, 2025
f43878f
stabilize oauth server tests by completing mocks
riatzukiza Nov 20, 2025
2a9b588
fix: improve token refresh error handling and add debug logging
riatzukiza Nov 20, 2025
6ef3e00
Fix test to assert on returned auth object instead of in-place mutation
riatzukiza Nov 20, 2025
bb5c250
test: add negative test for host-provided prompt_cache_key; fix: ensu…
riatzukiza Nov 20, 2025
1d6697b
fix: clone auth refresh and tighten console logging
riatzukiza Nov 20, 2025
23cee90
Merge pull request #31 from open-hax/chore/codex-max-release-review
riatzukiza Nov 20, 2025
96a80ad
chore: guard disk logging and strengthen clones/roles
riatzukiza Nov 20, 2025
1184c21
fix: simplify role validation in formatRole function
riatzukiza Nov 20, 2025
2caf840
Merge pull request #33 from open-hax/chore/guard-logging-clones
riatzukiza Nov 20, 2025
edb5807
Fix all CodeRabbit review issues from PR #29
riatzukiza Nov 20, 2025
7a23da8
📝 Add docstrings to `release/review-comments`
coderabbitai[bot] Nov 20, 2025
95fcd69
Merge pull request #35 from open-hax/coderabbitai/docstrings/edb5807
riatzukiza Nov 20, 2025
fb8e166
Enhance compaction test coverage and fix linter warning
riatzukiza Nov 20, 2025
1ac3466
Replace unsafe any cast with type-safe client access in logger
riatzukiza Nov 20, 2025
11ccc2c
Fix type safety in logger module
riatzukiza Nov 20, 2025
c9511b4
Clarify waitForCode state validation docs
riatzukiza Nov 20, 2025
5ece7c1
Merge pull request #34 from open-hax/release/review-comments
riatzukiza Nov 20, 2025
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
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
node_modules/
coverage/
.serena/
assets/
docs/
spec/
47 changes: 47 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
env: {
node: true,
es2022: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
// Keep this simple for now; add `project` later if you want type-aware rules
ecmaVersion: 2022,
sourceType: "module",
},
plugins: ["@typescript-eslint", "sonarjs"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:sonarjs/recommended",
],
rules: {
// Sonar-style cognitive complexity (adjust threshold if needed)
"sonarjs/cognitive-complexity": ["warn", 20],

// You can tune or turn off rules as needed; start conservative
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
},
overrides: [
{
files: ["test/**/*.ts"],
env: {
node: true,
},
globals: {
describe: "readonly",
it: "readonly",
test: "readonly",
expect: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
vi: "readonly",
},
},
],
};
19 changes: 9 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- '**'
- "**"
pull_request:

jobs:
Expand All @@ -28,8 +28,8 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run lint
run: pnpm lint
- name: Run ESLint
run: pnpm lint:eslint

- name: Run typecheck
run: pnpm typecheck
Expand Down Expand Up @@ -131,19 +131,19 @@ jobs:

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Validate release secrets
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "NPM_TOKEN secret is required to publish" >&2
exit 1
fi

- name: Configure npm auth

run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

- name: Read release metadata
id: release_meta
run: |
Expand All @@ -165,19 +165,18 @@ jobs:
cat "$NOTES_FILE"
echo "${NOTES_DELIM}"
} >> "$GITHUB_OUTPUT"

- name: Build package
run: pnpm run build

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
run: pnpm publish --access public

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.release_meta.outputs.version }}
name: Release ${{ steps.release_meta.outputs.version }}
body: ${{ steps.release_meta.outputs.notes }}

45 changes: 45 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Auto Formatting

on:
push:
branches:
- "**"

jobs:
format:
name: Auto Format
runs-on: ubuntu-latest
permissions:
contents: write
workflows: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Prettier (write)
run: pnpm format:write

- name: Verify formatting
run: pnpm format:check

- name: Commit formatted changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: apply prettier formatting"
branch: ${{ github.ref }}
1 change: 1 addition & 0 deletions .github/workflows/main-merge-guard.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Main Merge Guard

on:
workflow_call:
pull_request:
branches:
- main
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: opencode

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]

jobs:
opencode:
if: |
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /opencode') ||
startsWith(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: read
issues: read
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run opencode
uses: sst/opencode/github@latest
env:
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
with:
model: zai-coding-plan/glm-4.6
26 changes: 26 additions & 0 deletions .github/workflows/pr-auto-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR Auto Base

on:
pull_request:
types: [opened]

permissions:
pull-requests: write

jobs:
retarget:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Retarget PR to staging unless from staging
run: |
if [ "${GITHUB_BASE_REF}" = "staging" ]; then
echo "PR already targets staging."; exit 0
fi
BRANCH="${GITHUB_HEAD_REF}"
if [ "$BRANCH" = "staging" ]; then
echo "Staging PRs can target main."; exit 0
fi
echo "Retargeting PR #${GITHUB_EVENT_PULL_REQUEST_NUMBER} to staging"
gh pr edit "$GITHUB_EVENT_PULL_REQUEST_NUMBER" --base staging
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ tmp
.nx/

.stryker-tmp/
.worktrees/
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/
node_modules/
coverage/
.serena/
.stryker-tmp/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": false,
"trailingComma": "all"
}
4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides coding guidance for AI agents (including Claude Code, Codex,

## Overview

This is an **opencode plugin** that enables OAuth authentication with OpenAI's ChatGPT Plus/Pro Codex backend. It allows users to access `gpt-5-codex`, `gpt-5-codex-mini`, and `gpt-5` models through their ChatGPT subscription instead of using OpenAI Platform API credits.
This is an **opencode plugin** that enables OAuth authentication with OpenAI's ChatGPT Plus/Pro Codex backend. It now mirrors the Codex CLI lineup, making `gpt-5.1-codex-max` (with optional `xhigh` reasoning) the default alongside the existing `gpt-5.1-codex`, `gpt-5.1-codex-mini`, and legacy `gpt-5` models—all available through a ChatGPT subscription instead of OpenAI Platform API credits.

**Key architecture principle**: 7-step fetch flow that intercepts opencode's OpenAI SDK requests, transforms them for the ChatGPT backend API, and handles OAuth token management.

Expand Down Expand Up @@ -157,6 +157,8 @@ This plugin **intentionally differs from opencode defaults** because it accesses
| `store` | true | false | Required for ChatGPT backend |
| `include` | (not set) | `["reasoning.encrypted_content"]` | Required for stateless operation |

> **Extra High reasoning**: `reasoningEffort: "xhigh"` is only honored for `gpt-5.1-codex-max`. Other models automatically downgrade it to `high` so their API calls remain valid.

## File Paths & Locations

- **Plugin config**: `~/.opencode/openhax-codex-config.json`
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project are documented here. Dates use the ISO format (YYYY-MM-DD).

## [3.3.0] - 2025-11-19
### Added
- Codex Max support that mirrors the Codex CLI: normalization for every `gpt-5.1-codex-max` alias, `reasoningEffort: "xhigh"`, and unit tests covering both the transformer and request body integration path.
- Documentation and configuration updates calling out Codex Max as the flagship preset, plus refreshed samples showing how to opt into the Extra High reasoning mode.

### Changed
- Sample configs (`full` + `minimal`), README tables, AGENTS.md, and the diagnostics script now prefer `gpt-5.1-codex-max`, keeping plugin defaults aligned with Codex CLI behaviour.

### Fixed
- Requests that specify `reasoningEffort: "xhigh"` for non-supported models are now automatically downgraded to `high`, preventing API errors when Codex Max isn't selected.

## [3.2.0] - 2025-11-13
### Added
- GPT-5.1 family integration: normalization for `gpt-5.1`/`gpt-5.1-codex`/`gpt-5.1-codex-mini`, expanded reasoning heuristics (including `reasoningEffort: "none"`), and preservation of the native `shell`/`apply_patch` tools emitted by Codex CLI.
Expand Down
Loading
Loading