@bitkyc08/opencodex 2.6.2-preview.20260628 → 2.6.2

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.
Files changed (48) hide show
  1. package/README.md +8 -0
  2. package/bin/ocx.mjs +41 -9
  3. package/gui/dist/assets/index-LK87QnT7.js +9 -0
  4. package/gui/dist/index.html +1 -1
  5. package/package.json +1 -1
  6. package/src/abort.ts +22 -0
  7. package/src/adapters/base.ts +17 -4
  8. package/src/adapters/kiro-errors.ts +101 -0
  9. package/src/adapters/kiro-events.ts +48 -0
  10. package/src/adapters/kiro-images.ts +33 -0
  11. package/src/adapters/kiro-retry.ts +95 -0
  12. package/src/adapters/kiro-thinking.ts +82 -0
  13. package/src/adapters/kiro-tool-fallback.ts +36 -0
  14. package/src/adapters/kiro-tools.ts +44 -0
  15. package/src/adapters/kiro-truncation.ts +33 -0
  16. package/src/adapters/kiro-wire.ts +51 -0
  17. package/src/adapters/kiro.ts +527 -0
  18. package/src/adapters/openai-chat.ts +10 -1
  19. package/src/bridge.ts +1 -1
  20. package/src/cli.ts +25 -3
  21. package/src/codex-catalog.ts +97 -13
  22. package/src/codex-inject.ts +18 -0
  23. package/src/config.ts +52 -0
  24. package/src/crash-guard.ts +197 -9
  25. package/src/debug.ts +11 -0
  26. package/src/errors.ts +39 -3
  27. package/src/lib/eventstream-decoder.ts +244 -0
  28. package/src/lib/token-estimate.ts +43 -0
  29. package/src/oauth/anthropic.ts +1 -1
  30. package/src/oauth/index.ts +53 -6
  31. package/src/oauth/kiro-credentials.ts +256 -0
  32. package/src/oauth/kiro.ts +164 -0
  33. package/src/oauth/local-token-detect.ts +2 -1
  34. package/src/oauth/store.ts +36 -3
  35. package/src/oauth/types.ts +3 -0
  36. package/src/oauth/xai.ts +1 -1
  37. package/src/providers/kiro-models.ts +55 -0
  38. package/src/providers/registry.ts +15 -0
  39. package/src/redact.ts +71 -0
  40. package/src/server.ts +40 -22
  41. package/src/sidecar-tracker.ts +49 -0
  42. package/src/types.ts +3 -0
  43. package/src/usage-debug.ts +7 -4
  44. package/src/usage-log.ts +41 -3
  45. package/src/vision/describe.ts +11 -2
  46. package/src/web-search/executor.ts +10 -2
  47. package/src/web-search/loop.ts +27 -7
  48. package/gui/dist/assets/index-BoyaAoi4.js +0 -9
package/README.md CHANGED
@@ -264,6 +264,14 @@ Codex-visible context cap, `modelContextWindows` for model-specific caps, and
264
264
  `["text", "image"]`. Context values cap live `/models` metadata; they never raise a smaller live
265
265
  context window. See the configuration reference for the full field list.
266
266
 
267
+ > **GLM-5.2 1M context via Z.AI:** through the `openai-chat` adapter, both `glm-5.2`
268
+ > and `glm-5.2[1m]` work — opencodex strips the trailing `[1m]` suffix before
269
+ > sending the request, since OpenAI-compatible endpoints reject the bracketed id
270
+ > (Z.AI 400 code 1211). The `[1m]` suffix is a Claude-Code / Anthropic-endpoint
271
+ > convention; to use it natively, point the `anthropic` adapter at Z.AI's coding
272
+ > base (`https://api.z.ai/api/coding/paas/v4`). Set the 1M context window via the
273
+ > model catalog (`modelContextWindows`), not the model name.
274
+
267
275
  Local models work too. Point opencodex at any OpenAI-compatible server running on your machine:
268
276
 
269
277
  ```json
package/bin/ocx.mjs CHANGED
@@ -8,7 +8,7 @@
8
8
  * Node shim. (Dev still runs `bun run src/cli.ts` directly via the shebang on
9
9
  * src/cli.ts — only the published npm `bin` routes through here.)
10
10
  */
11
- import { spawnSync } from "node:child_process";
11
+ import { spawn, spawnSync } from "node:child_process";
12
12
  import { createRequire } from "node:module";
13
13
  import { existsSync, readFileSync, statSync } from "node:fs";
14
14
  import { homedir } from "node:os";
@@ -160,12 +160,44 @@ if (process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstal
160
160
  }
161
161
 
162
162
  const bun = resolveBun();
163
- const res = spawnSync(bun, [cliPath, ...process.argv.slice(2)], { stdio: "inherit" });
164
- if (res.error) {
165
- console.error(`opencodex: failed to launch Bun runtime: ${res.error.message}`);
163
+
164
+ // Run the Bun child asynchronously and FORWARD termination signals to it, then wait
165
+ // for its graceful shutdown before this launcher exits. The previous blocking
166
+ // spawnSync() could not run JS signal handlers and did not forward signals, so a
167
+ // signal delivered only to this launcher (Codex app, IDE terminal, service wrapper,
168
+ // or `kill -INT <launcherPid>`) killed the launcher and ORPHANED the Bun proxy —
169
+ // port left bound, pid/runtime-port files left behind, Codex config not restored.
170
+ const child = spawn(bun, [cliPath, ...process.argv.slice(2)], { stdio: "inherit" });
171
+
172
+ // Windows has no real POSIX signals (no SIGHUP); forwarding is best-effort there.
173
+ const FORWARDED = process.platform === "win32" ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
174
+ const handlers = FORWARDED.map(sig => {
175
+ const handler = () => {
176
+ try {
177
+ child.kill(sig);
178
+ } catch {
179
+ /* child already exited */
180
+ }
181
+ };
182
+ process.on(sig, handler);
183
+ return [sig, handler];
184
+ });
185
+ const clearHandlers = () => {
186
+ for (const [sig, handler] of handlers) process.removeListener(sig, handler);
187
+ };
188
+
189
+ child.on("error", err => {
190
+ clearHandlers();
191
+ console.error(`opencodex: failed to launch Bun runtime: ${err.message}`);
166
192
  process.exit(1);
167
- }
168
- if (res.signal) {
169
- process.kill(process.pid, res.signal);
170
- }
171
- process.exit(res.status ?? 1);
193
+ });
194
+
195
+ child.on("exit", (code, signal) => {
196
+ clearHandlers();
197
+ // Mirror the child's terminating signal/exit code so this launcher's status matches.
198
+ if (signal) {
199
+ process.kill(process.pid, signal);
200
+ return;
201
+ }
202
+ process.exit(code ?? 1);
203
+ });