@bitkyc08/opencodex 2.10.2 → 2.11.0-preview.20260808
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/bin/ocx.mjs +10 -0
- package/gui/dist/assets/index-B1P60C4o.js +70 -0
- package/gui/dist/assets/index-Bk-PN-70.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +4 -2
- package/src/adapters/cursor/effort-map.ts +11 -0
- package/src/adapters/cursor/live-transport.ts +11 -0
- package/src/adapters/cursor/native-exec-fs.ts +9 -6
- package/src/adapters/cursor/native-exec.ts +4 -2
- package/src/adapters/cursor/protobuf-events.ts +176 -4
- package/src/adapters/cursor/request-builder.ts +15 -4
- package/src/adapters/cursor/tool-definitions.ts +118 -2
- package/src/adapters/google.ts +15 -5
- package/src/adapters/openai-chat.ts +24 -2
- package/src/adapters/openai-responses.ts +2 -1
- package/src/bridge.ts +9 -5
- package/src/chat/outbound.ts +4 -3
- package/src/claude/desktop-3p.ts +222 -2
- package/src/claude/outbound.ts +15 -6
- package/src/cli/account-api.ts +4 -0
- package/src/cli/account-extended.ts +112 -0
- package/src/cli/account.ts +23 -6
- package/src/cli/claude-desktop.ts +26 -3
- package/src/cli/config-command.ts +9 -0
- package/src/cli/help.ts +18 -2
- package/src/cli/index.ts +277 -55
- package/src/cli/models.ts +5 -1
- package/src/cli/provider.ts +8 -2
- package/src/cli/ready.ts +301 -0
- package/src/cli/system-restart-client.ts +146 -0
- package/src/cli/tray-proxy.ts +153 -6
- package/src/clients/config-export.ts +12 -19
- package/src/codex/account-lifecycle.ts +3 -0
- package/src/codex/account-namespaces.ts +49 -3
- package/src/codex/account-priority.ts +83 -0
- package/src/codex/auth-api.ts +83 -0
- package/src/codex/auth-context.ts +5 -2
- package/src/codex/catalog/provider-fetch.ts +11 -0
- package/src/codex/catalog/sync.ts +23 -1
- package/src/codex/codex-write-lock.ts +16 -4
- package/src/codex/desired-state.ts +37 -4
- package/src/codex/history-job.ts +15 -5
- package/src/codex/history-provider.ts +31 -14
- package/src/codex/history-worker.ts +28 -4
- package/src/codex/inject-coordination.ts +13 -1
- package/src/codex/inject.ts +360 -66
- package/src/codex/internal/history-writer.ts +1 -1
- package/src/codex/native-main-lock-file.ts +5 -1
- package/src/codex/native-main-owner.ts +17 -3
- package/src/codex/native-profile-manager.ts +19 -0
- package/src/codex/native-profile-startup.ts +8 -0
- package/src/codex/native-residue.ts +140 -27
- package/src/codex/pool-rotation.ts +74 -4
- package/src/codex/refresh.ts +7 -0
- package/src/codex/routing.ts +177 -36
- package/src/codex/subagent-model-fallback.ts +34 -4
- package/src/codex/sync.ts +61 -0
- package/src/codex/upstream-host-health.ts +329 -31
- package/src/combos/request.ts +2 -0
- package/src/config.ts +221 -2
- package/src/images/loop.ts +1 -1
- package/src/integrations/native/ownership-preflight.ts +39 -2
- package/src/lib/bun-stream-caps.ts +3 -3
- package/src/lib/sse-decoder.ts +41 -0
- package/src/lib/system-restart-contract.ts +73 -0
- package/src/lib/windows-secret-acl.ts +141 -39
- package/src/lib/windows-user-principal.ts +283 -0
- package/src/lib/winsw.ts +18 -2
- package/src/oauth/key-providers.ts +12 -0
- package/src/providers/derive.ts +54 -2
- package/src/providers/free-directory.ts +6 -5
- package/src/providers/model-discovery.ts +9 -3
- package/src/providers/quota.ts +592 -0
- package/src/providers/registry.ts +316 -13
- package/src/responses/parser.ts +26 -10
- package/src/responses/reasoning-replay-cache.ts +1 -0
- package/src/routing/profile-namespace.ts +15 -0
- package/src/routing/profile.ts +2 -1
- package/src/server/auth-cors.ts +44 -13
- package/src/server/chat-completions.ts +0 -4
- package/src/server/claude-messages.ts +73 -15
- package/src/server/github-copilot-responses-repair.ts +338 -0
- package/src/server/index.ts +328 -111
- package/src/server/lifecycle.ts +36 -0
- package/src/server/management/agent-settings-routes.ts +147 -56
- package/src/server/management/config-routes.ts +7 -2
- package/src/server/management/context.ts +4 -0
- package/src/server/management/native-integration-routes.ts +199 -20
- package/src/server/management/provider-routes.ts +41 -0
- package/src/server/management/routing-profile-routes.ts +234 -5
- package/src/server/management/system-restart.ts +12 -10
- package/src/server/management/system-routes.ts +20 -0
- package/src/server/management-auth.ts +51 -3
- package/src/server/ports.ts +41 -1
- package/src/server/proxy-liveness.ts +129 -4
- package/src/server/readiness.ts +99 -0
- package/src/server/relay.ts +113 -97
- package/src/server/request-log.ts +10 -4
- package/src/server/responses/compact.ts +107 -12
- package/src/server/responses/core.ts +220 -39
- package/src/server/responses-item-id-repair.ts +22 -3
- package/src/server/responses-model-rewrite.ts +29 -0
- package/src/server/sse-frame-buffer.ts +292 -0
- package/src/server/sse-payload-rewrite.ts +25 -14
- package/src/server/ws-bridge.ts +27 -22
- package/src/service-manager-probe.ts +520 -10
- package/src/service.ts +134 -2
- package/src/storage/worker-lifecycle.ts +14 -14
- package/src/tray/windows-tray.ps1 +74 -9
- package/src/types.ts +68 -2
- package/src/update/index.ts +12 -0
- package/src/update/job.ts +392 -18
- package/src/update/npm-cache-preflight.d.mts +47 -0
- package/src/update/npm-cache-preflight.mjs +201 -0
- package/src/usage/log.ts +1 -1
- package/src/vision/index.ts +77 -2
- package/src/web-search/loop.ts +1 -1
- package/src/web-search/parse.ts +4 -1
- package/gui/dist/assets/index-BKVqyYqT.js +0 -70
- package/gui/dist/assets/index-Ca_3269W.css +0 -1
package/README.md
CHANGED
|
@@ -60,6 +60,14 @@ ocx start # or `ocx service` to run it in the backgro
|
|
|
60
60
|
Open **http://localhost:10100** and configure everything in the web dashboard — add providers
|
|
61
61
|
(40+ built-ins, or any OpenAI-compatible endpoint), pick models, manage accounts. `ocx gui`
|
|
62
62
|
re-opens the dashboard at any time.
|
|
63
|
+
It can also manage a **ChatGPT account pool** for Codex auth. Add multiple ChatGPT / Codex accounts,
|
|
64
|
+
refresh their 5h / weekly / 30d quota in the dashboard. Under quota routing, new sessions can use
|
|
65
|
+
the lowest-usage healthy account; round-robin and fill-first use their own policies. Existing Codex
|
|
66
|
+
threads normally retain affinity to the account that started them, so long SSH, tmux, or
|
|
67
|
+
mobile-connected sessions do not jump accounts mid-conversation — but quota re-evaluation, failover,
|
|
68
|
+
account exclusion, affinity expiry, or 401/403 and 429 recovery can rebind them. Give the accounts a
|
|
69
|
+
selection order when one of them — usually your Codex Desktop login — should only be reached for
|
|
70
|
+
once the others are drained.
|
|
63
71
|
|
|
64
72
|
### For agents
|
|
65
73
|
|
|
@@ -139,6 +147,8 @@ ocx start [--port 10100] # start the proxy in the foreground
|
|
|
139
147
|
ocx stop # stop + restore native Codex
|
|
140
148
|
ocx service [install|start|stop|status|uninstall|remove] # background service
|
|
141
149
|
ocx codex-shim install # start the proxy on demand whenever `codex` launches
|
|
150
|
+
ocx health [--json] # check immediate proxy liveness
|
|
151
|
+
ocx ready [--json] [--wait [--timeout <seconds>]] # check post-sync readiness
|
|
142
152
|
ocx status # is the proxy running?
|
|
143
153
|
ocx gui # open the web dashboard
|
|
144
154
|
ocx provider <...> # manage providers (list/add/edit/test/remove)
|
|
@@ -151,6 +161,27 @@ ocx update [--tag preview] # update opencodex
|
|
|
151
161
|
Unpinned starts may pick another free port if the preferred one is busy; an explicit `--port`
|
|
152
162
|
never hops. Full reference: [CLI docs](https://opencodex.me/reference/cli/).
|
|
153
163
|
|
|
164
|
+
### Health and readiness
|
|
165
|
+
|
|
166
|
+
`GET /healthz` reports immediate proxy liveness. The unauthenticated `GET /readyz` endpoint reports
|
|
167
|
+
post-sync readiness with the sanitized JSON identity `{service, version, uptime, pid, port, status}`.
|
|
168
|
+
It returns `200` when `status` is `ready`; `pending` and terminal `failed` return `503` with
|
|
169
|
+
`Retry-After: 1`.
|
|
170
|
+
|
|
171
|
+
`ocx ready [--json] [--wait [--timeout <seconds>]]` performs one probe by default. `--wait` polls
|
|
172
|
+
for up to 45 seconds by default, but exits immediately when it observes terminal `failed`;
|
|
173
|
+
`--timeout <seconds>` sets a 1–300 second limit, requires `--wait`, and accepts only positive integers. CLI `--json` output is
|
|
174
|
+
`{ready, status, pid, port}`, where `status` is `ready`, `pending`, `failed`, or `unreachable`.
|
|
175
|
+
|
|
176
|
+
| Exit | Result |
|
|
177
|
+
| --- | --- |
|
|
178
|
+
| `0` | Ready |
|
|
179
|
+
| `1` | Not ready: pending, failed, timeout, or unreachable |
|
|
180
|
+
| `64` | Invalid arguments |
|
|
181
|
+
|
|
182
|
+
An older proxy without `/readyz` fails closed as `unreachable` with exit 1, while `ocx health`
|
|
183
|
+
remains compatible.
|
|
184
|
+
|
|
154
185
|
### Autostart: service vs shim
|
|
155
186
|
|
|
156
187
|
Use the **service** (`ocx service`) for an always-on proxy that restarts on crash. Use the
|
package/bin/ocx.mjs
CHANGED
|
@@ -17,6 +17,10 @@ import { dirname, join, resolve } from "node:path";
|
|
|
17
17
|
import { fileURLToPath } from "node:url";
|
|
18
18
|
import { isRealBunBinary } from "../src/lib/bun-binary-validator.mjs";
|
|
19
19
|
import { npmInvocation } from "../src/update/npm-invocation.mjs";
|
|
20
|
+
import {
|
|
21
|
+
npmCachePreflightFailureMessage,
|
|
22
|
+
runNpmCachePreflight,
|
|
23
|
+
} from "../src/update/npm-cache-preflight.mjs";
|
|
20
24
|
import { handoffWindowsTrayForUpdate, planWindowsTrayUpdate } from "../src/update/tray-update-plan.mjs";
|
|
21
25
|
|
|
22
26
|
const PKG = "@bitkyc08/opencodex";
|
|
@@ -136,6 +140,12 @@ function runNpmSelfUpdate() {
|
|
|
136
140
|
process.exit(0);
|
|
137
141
|
}
|
|
138
142
|
|
|
143
|
+
const cachePreflight = runNpmCachePreflight();
|
|
144
|
+
if (!cachePreflight.ok) {
|
|
145
|
+
console.error(`opencodex: ${npmCachePreflightFailureMessage(cachePreflight.reason)}. Aborting before stopping the proxy.`);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
|
|
139
149
|
// Remember whether a background service manages the proxy BEFORE stopping — `ocx stop`
|
|
140
150
|
// unloads it, so a successful update must refresh and restart it afterwards.
|
|
141
151
|
const serviceStatePath = join(configDir(), "service-state.json");
|