@bitkyc08/opencodex 2.7.26 → 2.7.27

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 CHANGED
@@ -62,7 +62,7 @@ flowchart LR
62
62
  |---|---|---|
63
63
  | macOS (arm64 / x64) | Fully supported | launchd |
64
64
  | Linux (x64 / arm64) | Fully supported | systemd (user unit) |
65
- | Windows (x64) | Fully supported | Task Scheduler |
65
+ | Windows (x64) | Fully supported | Task Scheduler (hidden) / opt-in native service (`--native`, WinSW) |
66
66
 
67
67
  Requires [Node](https://nodejs.org) 18+. The Bun runtime is bundled automatically on `npm install` — no separate Bun install needed. All three platforms work natively (no WSL needed on Windows).
68
68
 
@@ -234,7 +234,7 @@ next Codex session. opencodex keeps these behaviors:
234
234
  - **Give any model superpowers.** Non-OpenAI models get real web search and image understanding via a `gpt-5.4-mini` sidecar over your ChatGPT login.
235
235
  - **Generate images natively.** Codex's standalone `image_gen` tool uses `POST /v1/images/generations` for generation and `POST /v1/images/edits` for edits; it is separate from the hosted Responses `image_generation` tool.
236
236
  - **See what's happening.** The web dashboard shows providers, OAuth status, model selection, and a live request log, including cached/cache-write token counts when upstream reports them — no more guessing why a request failed.
237
- - **Runs in the background.** Install as a system service (launchd / systemd / Task Scheduler) and forget about it. The proxy starts on boot and stays out of your way.
237
+ - **Runs in the background.** Install as a system service (launchd / systemd / Task Scheduler) and forget about it. On macOS/Linux the proxy starts at login; on Windows the default Task Scheduler backend starts at logon (windowless), or use `ocx service install --native` for a real Windows service that starts at boot.
238
238
  - **Clean exit, zero residue.** `ocx stop` (or the dashboard's Stop button) shuts down the proxy, stops the background service if one is installed, and restores Codex to its original configuration. Plain `codex` works exactly as it did before — no leftover config, no orphaned processes.
239
239
 
240
240
  ## Providers & adapters
package/bin/ocx.mjs CHANGED
@@ -113,7 +113,16 @@ function runNpmSelfUpdate() {
113
113
 
114
114
  // Remember whether a background service manages the proxy BEFORE stopping — `ocx stop`
115
115
  // unloads it permanently, so a successful update must reinstall it afterwards.
116
- const serviceWasInstalled = existsSync(join(configDir(), "service-state.json"));
116
+ const serviceStatePath = join(configDir(), "service-state.json");
117
+ const serviceWasInstalled = existsSync(serviceStatePath);
118
+ /** Read the backend from service-state.json so the update reinstalls the same one. */
119
+ function serviceReinstallArgs() {
120
+ try {
121
+ const state = JSON.parse(readFileSync(serviceStatePath, "utf8"));
122
+ if (state.backend === "native") return [launcher, "service", "install", "--native"];
123
+ } catch { /* missing or corrupt — fall through to default */ }
124
+ return [launcher, "service", "install"];
125
+ }
117
126
 
118
127
  // Never replace package files under a live proxy — stop it first (full `ocx stop`
119
128
  // semantics: graceful drain, service stop, native Codex restore). Gate on the service
@@ -154,7 +163,8 @@ function runNpmSelfUpdate() {
154
163
  // launcher so the new files write the baked paths and the service restarts.
155
164
  if (serviceWasInstalled) {
156
165
  console.log("Reinstalling the background service with the updated files...");
157
- const svc = spawnSync(process.execPath, [launcher, "service", "install"], { stdio: "inherit", windowsHide: true });
166
+ const svcArgs = serviceReinstallArgs();
167
+ const svc = spawnSync(process.execPath, svcArgs, { stdio: "inherit", windowsHide: true });
158
168
  if (svc.status !== 0) console.warn("opencodex: service refresh failed — run 'ocx service install' manually.");
159
169
  } else {
160
170
  console.log("Restart the proxy: ocx start");
@@ -222,6 +232,17 @@ function resolveBun() {
222
232
  return bin;
223
233
  }
224
234
 
235
+ // `ocx update --help` prints usage and exits WITHOUT side effects. The npm launcher
236
+ // intercepts `update` before the Bun CLI starts, so the help short-circuit must live
237
+ // here too — otherwise --help runs the real self-update, stops the proxy, and drops
238
+ // in-flight routed streams (issue #168).
239
+ const updateHelpRequested = process.argv[2] === "update" &&
240
+ process.argv.slice(3).some(a => a === "--help" || a === "-h" || a === "help");
241
+ if (updateHelpRequested) {
242
+ console.log("Usage: ocx update [--tag latest|preview]\n\nUpdate opencodex. Preview installs stay on the preview tag unless overridden.");
243
+ process.exit(0);
244
+ }
245
+
225
246
  if (process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstall()) {
226
247
  runNpmSelfUpdate();
227
248
  }