@bitkyc08/opencodex 2.7.28 → 2.7.29

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.ko.md CHANGED
@@ -247,6 +247,7 @@ ocx sync # 모델 갱신 + Codex에 재주입
247
247
  ocx status # 프록시 실행 중인지 확인
248
248
  ocx login <xai|anthropic|kimi> # OAuth 로그인
249
249
  ocx logout <provider> # 저장된 로그인 정보 삭제
250
+ ocx account <list|current|use> # 계정/API key pool 조회·전환 (마스킹; refresh/auto-switch/remove/add-key 포함)
250
251
  ocx gui # 웹 대시보드 열기
251
252
  ocx claude [args...] # 프록시에 연결된 Claude Code 실행 (모델 디스커버리 켜짐)
252
253
  ocx codex-shim install # codex 실행 시 `ocx ensure` 실행
package/README.md CHANGED
@@ -280,6 +280,7 @@ ocx codex-shim install # run `ocx ensure` whenever `codex` is launched
280
280
  ocx status # is the proxy running?
281
281
  ocx login <provider> # OAuth login (xai, anthropic, kimi, cursor, ...)
282
282
  ocx logout <provider> # remove a stored login
283
+ ocx account <list|current|use> # list/switch accounts & API-key pools (masked; also refresh/auto-switch/remove/add-key)
283
284
  ocx gui # open the web dashboard
284
285
  ocx claude [args...] # launch Claude Code wired to the proxy (model discovery on)
285
286
  ocx service [install|start|stop|status|uninstall] # install/update/start background service
package/README.zh-CN.md CHANGED
@@ -240,6 +240,7 @@ ocx sync # 刷新模型列表 + 重新注入 Codex
240
240
  ocx status # 查看代理是否在运行
241
241
  ocx login <xai|anthropic|kimi> # OAuth 登录
242
242
  ocx logout <provider> # 移除已保存的登录
243
+ ocx account <list|current|use> # 查看/切换账号与 API-key pool(脱敏;含 refresh/auto-switch/remove/add-key)
243
244
  ocx gui # 打开 Web 仪表盘
244
245
  ocx claude [args...] # 启动接入代理的 Claude Code(模型发现已开启)
245
246
  ocx codex-shim install # 运行 codex 时自动启动代理
package/bin/ocx.mjs CHANGED
@@ -124,6 +124,37 @@ function runNpmSelfUpdate() {
124
124
  return [launcher, "service", "install"];
125
125
  }
126
126
 
127
+ // Capture listen target before stop clears runtime-port.json (mirrors GUI/CLI update worker).
128
+ // Do not treat a live runtime port of 10100 as "missing" — track whether the read succeeded.
129
+ let bakePort = 10100;
130
+ let sawRuntimePort = false;
131
+ try {
132
+ const rt = JSON.parse(readFileSync(join(configDir(), "runtime-port.json"), "utf8"));
133
+ if (Number.isFinite(rt?.port) && rt.port > 0 && rt.port <= 65535) {
134
+ // Only trust runtime when its pid still looks alive (stale crash leftovers fall back to config).
135
+ const rtPid = Number(rt?.pid);
136
+ let runtimeLive = false;
137
+ if (Number.isSafeInteger(rtPid) && rtPid > 0) {
138
+ try {
139
+ process.kill(rtPid, 0);
140
+ runtimeLive = true;
141
+ } catch (e) {
142
+ if (e && typeof e === "object" && "code" in e && e.code === "EPERM") runtimeLive = true;
143
+ }
144
+ }
145
+ if (runtimeLive) {
146
+ bakePort = Math.trunc(rt.port);
147
+ sawRuntimePort = true;
148
+ }
149
+ }
150
+ } catch { /* fall through to config */ }
151
+ if (!sawRuntimePort) {
152
+ try {
153
+ const cfg = JSON.parse(readFileSync(join(configDir(), "config.json"), "utf8"));
154
+ if (Number.isFinite(cfg?.port) && cfg.port > 0 && cfg.port <= 65535) bakePort = Math.trunc(cfg.port);
155
+ } catch { /* keep default */ }
156
+ }
157
+
127
158
  // Never replace package files under a live proxy — stop it first (full `ocx stop`
128
159
  // semantics: graceful drain, service stop, native Codex restore). Gate on the service
129
160
  // and the runtime-port record too: a service-managed or orphaned proxy can be live
@@ -163,9 +194,16 @@ function runNpmSelfUpdate() {
163
194
  // launcher so the new files write the baked paths and the service restarts.
164
195
  if (serviceWasInstalled) {
165
196
  console.log("Reinstalling the background service with the updated files...");
166
- const svcArgs = serviceReinstallArgs();
167
- const svc = spawnSync(process.execPath, svcArgs, { stdio: "inherit", windowsHide: true });
168
- if (svc.status !== 0) console.warn("opencodex: service refresh failed — run 'ocx service install' manually.");
197
+ const prevBake = process.env.OCX_BAKE_PORT;
198
+ process.env.OCX_BAKE_PORT = String(bakePort);
199
+ try {
200
+ const svcArgs = serviceReinstallArgs();
201
+ const svc = spawnSync(process.execPath, svcArgs, { stdio: "inherit", windowsHide: true });
202
+ if (svc.status !== 0) console.warn("opencodex: service refresh failed — run 'ocx service install' manually.");
203
+ } finally {
204
+ if (prevBake === undefined) delete process.env.OCX_BAKE_PORT;
205
+ else process.env.OCX_BAKE_PORT = prevBake;
206
+ }
169
207
  } else {
170
208
  console.log("Restart the proxy: ocx start");
171
209
  }