@bitkyc08/opencodex 2.96.0 → 2.98.0-preview.20261107
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/bin/ocx.mjs +215 -20
- package/gui/dist/assets/App-6TFtZsUF.css +1 -0
- package/gui/dist/assets/App-B8_sOxoz.js +59 -0
- package/gui/dist/assets/Tray-DpWEp6ee.js +1 -0
- package/gui/dist/assets/WantedSansVariable.split.0-Dwvb1WRx.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.1-1wKD2RxI.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.10-CAKA6LIP.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.11-k5H85R4b.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.12-BHboLsUv.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.13-9GV377ix.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.14-DovDXnrj.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.15-DTdykCig.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.16-CKz2ccgK.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.17-Z2RD_KRZ.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.18-BcKtfonJ.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.19-DEQPOSZn.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.2-DryboyuA.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.20-Bia5JMls.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.21-Cr4jFw-E.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.22-DjjB69TZ.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.23-CvUzJskt.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.24-i_eMg5ox.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.25-2aKHwPX-.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.26-B6wXoCEL.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.27-D4h1WfGM.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.28-kvRPCStd.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.29-DHAiwleD.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.3-7H--eyZi.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.30-C66cfAY2.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.31-FDmtiNim.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.32-DouHt2Dd.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.33-B8HVvkJX.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.34-BtkRu1FN.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.35-DBylQbtk.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.36-Sg089Kgh.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.37-CYtvbriS.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.38-DKkSLf8Z.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.39-CecotKZD.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.4-Bv8O3ZMb.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.40-DdCvkmOU.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.41-ESn674Hc.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.42-DL9V7NNV.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.43-yipO0cyk.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.44-6rTmLZhm.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.45-BJAj8lrm.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.46-BDTzMn2c.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.47-Bxd4wGgi.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.48-DxnFBLnH.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.49-DnVD0aOD.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.5-B1wI2pp5.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.50-D9JlkZd6.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.51-D9Vw6Bu3.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.52-ClEJk4kn.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.53-BSXU0vh-.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.54-EcuxkR9v.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.55-CYiFhQX8.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.56--Gk9g8BK.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.57-DnkOPZcy.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.58-9MB8504z.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.59-ByxIsN72.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.6-Bmk0dRVw.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.60-Bxwx_aWQ.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.61-DA2z5sm7.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.62-C5iJPJZn.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.63-DAqrmaEc.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.64-BgXFsljb.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.65-DKiWujvu.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.66-8po4vUZ4.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.67-Cy5qyI9O.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.68-BKny7Fy3.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.69-B4VU4u_b.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.7-BuqwNpgA.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.70-BCd4n346.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.71-CkQppaWn.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.72-Db7vaoFs.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.73-DI80TYWl.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.74-tMCtDAHB.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.75-Ciw0D5WG.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.76-DoLjFgp-.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.77-CpT2uvMy.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.78-CkcJ4iZ1.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.79-DsOUJjEM.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.8-DsjypPd6.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.80-C0VwHTte.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.81-DTelu57i.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.82-BiMndGN1.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.83-CVcC6eDG.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.84-DlhZVt_O.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.85-S8I2D3pA.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.86-DozXXpH5.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.87-Dsn0Vuuo.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.88-iNwxxDCr.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.89-B63u_9CZ.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.9-Bi3IzpMI.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.90-ByeH1Pqf.woff2 +0 -0
- package/gui/dist/assets/WantedSansVariable.split.91-UQLlagpm.woff2 +0 -0
- package/gui/dist/assets/brand-mark-VPhzz-WE.js +1 -0
- package/gui/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/gui/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/gui/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/gui/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/gui/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/gui/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/gui/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/gui/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/gui/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/gui/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/gui/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/gui/dist/assets/index-5REODpG3.css +2 -0
- package/gui/dist/assets/index-BWKBeK77.js +94 -0
- package/gui/dist/assets/segment-thumb-features-BQYzrze9.js +1 -0
- package/gui/dist/classic/assets/App-Bz65x1J6.js +58 -0
- package/gui/dist/{assets/Tray-BOPQyDbH.js → classic/assets/Tray-kk7mdO6I.js} +1 -1
- package/gui/dist/classic/assets/index-Dp2j8bSc.js +94 -0
- package/gui/dist/classic/assets/quota-summary-CvamtHjB.js +1 -0
- package/gui/dist/classic/index.html +47 -0
- package/gui/dist/favicon.png +0 -0
- package/gui/dist/favicon.svg +14 -0
- package/gui/dist/index.html +15 -2
- package/package.json +1 -1
- package/src/adapters/anthropic.ts +17 -8
- package/src/adapters/command-code.ts +15 -16
- package/src/adapters/cursor/transport-retry.ts +2 -2
- package/src/adapters/devin/cloud-direct/chat.ts +15 -6
- package/src/adapters/google.ts +7 -7
- package/src/adapters/kiro/adapter.ts +18 -3
- package/src/adapters/kiro/conversation.ts +8 -8
- package/src/adapters/kiro/payload.ts +45 -12
- package/src/adapters/kiro/stream.ts +230 -14
- package/src/adapters/kiro/structured-output-json.ts +191 -0
- package/src/adapters/kiro/structured-output-schema.ts +542 -0
- package/src/adapters/kiro/structured-output.ts +367 -0
- package/src/adapters/kiro-constants.ts +24 -1
- package/src/adapters/kiro-events.ts +31 -1
- package/src/adapters/kiro-retry.ts +3 -3
- package/src/adapters/kiro-tools.ts +14 -9
- package/src/adapters/kiro-wire.ts +9 -5
- package/src/adapters/ollama-native.ts +11 -1
- package/src/adapters/openai-chat/messages.ts +58 -5
- package/src/adapters/openai-chat/mistral-image-limit.ts +50 -0
- package/src/adapters/openai-chat/passthrough.ts +5 -3
- package/src/adapters/openai-chat/tool-schema.ts +83 -13
- package/src/adapters/openai-responses/empty-assistant.ts +15 -3
- package/src/adapters/openai-responses/opengateway-input.ts +18 -6
- package/src/adapters/openai-responses/passthrough.ts +5 -4
- package/src/adapters/openai-responses/reasoning.ts +9 -4
- package/src/adapters/openai-responses/request-strips.ts +1 -1
- package/src/adapters/openai-responses/tool-output-recovery.ts +79 -0
- package/src/adapters/physical-send.ts +3 -3
- package/src/adapters/qoder/live-models.ts +115 -1
- package/src/adapters/zed-openai-stream.ts +2 -1
- package/src/bridge/errors.ts +11 -2
- package/src/bridge/response-json.ts +2 -1
- package/src/bridge/sse.ts +14 -6
- package/src/chat/failure-verdict.ts +21 -0
- package/src/chat/outbound.ts +139 -21
- package/src/claude/failure-verdict.ts +21 -0
- package/src/claude/inbound-content-options.ts +15 -2
- package/src/claude/inbound-model-options.ts +2 -1
- package/src/claude/inbound-records.ts +2 -0
- package/src/claude/inbound.ts +17 -11
- package/src/claude/outbound.ts +98 -22
- package/src/cli/capabilities-access-remote.ts +13 -0
- package/src/cli/capabilities-base.ts +26 -3
- package/src/cli/capabilities-command.ts +12 -3
- package/src/cli/capabilities-provider-models.ts +3 -3
- package/src/cli/capability-contracts.ts +2 -0
- package/src/cli/codex-launch-auth.ts +30 -1
- package/src/cli/codex-launcher.ts +12 -5
- package/src/cli/codex-shim-autorestore.ts +12 -4
- package/src/cli/config-command.ts +11 -2
- package/src/cli/connect.ts +17 -2
- package/src/cli/dispatch.ts +14 -177
- package/src/cli/doctor.ts +95 -7
- package/src/cli/help.ts +2 -2
- package/src/cli/index.ts +17 -8
- package/src/cli/link-apply-restart.ts +9 -2
- package/src/cli/link.ts +1 -1
- package/src/cli/models.ts +124 -38
- package/src/cli/registry.ts +12 -4
- package/src/cli/restart-failure.ts +17 -0
- package/src/cli/root.ts +8 -0
- package/src/cli/stop-approval.ts +2 -2
- package/src/cli/sync-command.ts +243 -0
- package/src/cli/sync-fanout-process.ts +92 -0
- package/src/cli/sync-fanout.ts +161 -0
- package/src/cli/sync-flags.ts +10 -0
- package/src/cli/sync-link-status.ts +39 -0
- package/src/cli/sync-update-guard.ts +18 -0
- package/src/cli/system-restart-client.ts +5 -0
- package/src/cli/uninstall-client-state.ts +12 -1
- package/src/cli/update-restart-child.ts +13 -3
- package/src/cli/update-restart-home.ts +6 -3
- package/src/cli/update-restart.ts +36 -19
- package/src/client/connect.ts +35 -15
- package/src/client/hub-client.ts +5 -0
- package/src/client/link-home.ts +3 -2
- package/src/client/link-management-relay.ts +39 -2
- package/src/client/link-readiness.ts +3 -1
- package/src/client/machine-api.ts +2 -1
- package/src/client/machine-listener.ts +10 -0
- package/src/client/orphan-token-recovery.ts +322 -0
- package/src/client/restore-ownership.ts +19 -1
- package/src/client/runtime-restart.ts +12 -4
- package/src/client/runtime.ts +40 -11
- package/src/client/stop-routing.ts +62 -0
- package/src/client/sync-runtime.ts +65 -0
- package/src/clients/config-export.ts +32 -3
- package/src/codex/auth-context.ts +49 -103
- package/src/codex/catalog/antigravity-discovery.ts +16 -5
- package/src/codex/catalog/provider-models.ts +18 -12
- package/src/codex/forward-transport-headers.ts +35 -6
- package/src/codex/inject/config-toml.ts +88 -0
- package/src/codex/inject/multi-agent-v2.ts +30 -4
- package/src/codex/inject/plan.ts +34 -7
- package/src/codex/inject-coordination.ts +11 -0
- package/src/codex/inject.ts +18 -7
- package/src/codex/lineage.ts +13 -7
- package/src/codex/native-profile-api.ts +27 -1
- package/src/codex/quota.ts +22 -6
- package/src/codex/request-owned-affinity-key.ts +11 -0
- package/src/codex/request-owned-affinity.ts +118 -0
- package/src/codex/request-owned-main-pin.ts +86 -0
- package/src/codex/role-capability.ts +52 -41
- package/src/codex/routing/active-account.ts +13 -5
- package/src/codex/routing/selection.ts +40 -1
- package/src/codex/routing/thread-affinity-store.ts +916 -0
- package/src/codex/routing/thread-affinity.ts +90 -12
- package/src/codex/shim-diagnostics.ts +7 -0
- package/src/codex/shim-legacy-record.ts +290 -0
- package/src/codex/shim-windows-refresh.ts +9 -2
- package/src/codex/shim-wrapper-write.ts +7 -0
- package/src/codex/shim.ts +80 -21
- package/src/codex/toml-source-lines.ts +72 -13
- package/src/combos/failover.ts +6 -109
- package/src/combos/request.ts +2 -2
- package/src/combos/resolve.ts +29 -11
- package/src/config/diagnostics.ts +9 -9
- package/src/config/load-degrade.ts +27 -27
- package/src/config/process-state.ts +5 -0
- package/src/config/provider-validation.ts +9 -2
- package/src/config/removed-opencode-free-backup.ts +6 -3
- package/src/config/schema/leaf-validators.ts +1 -0
- package/src/config/tracked-runtime-inspection.ts +3 -3
- package/src/generated/compatibility-version.json +595 -255
- package/src/images/loop.ts +4 -3
- package/src/lib/client-error-body.ts +215 -0
- package/src/lib/client-retry-after.ts +66 -0
- package/src/lib/config-ownership-removal.ts +422 -0
- package/src/lib/config-ownership.ts +650 -81
- package/src/lib/context-overflow-verdict.ts +113 -0
- package/src/lib/crash-guard.ts +4 -2
- package/src/lib/desktop-cli-handoff.d.mts +4 -5
- package/src/lib/desktop-cli-handoff.mjs +18 -17
- package/src/lib/empty-tool-catalog.ts +25 -3
- package/src/lib/error-destination.ts +47 -0
- package/src/lib/errors.ts +1 -0
- package/src/lib/failure-detail.ts +66 -0
- package/src/lib/local-management-capability.ts +3 -1
- package/src/lib/messages-error-body.ts +162 -0
- package/src/lib/messages-sse-error-presentation.ts +93 -0
- package/src/lib/model-identity.ts +44 -0
- package/src/lib/passive-read.ts +9 -4
- package/src/lib/private-sqlite-path.ts +124 -0
- package/src/lib/response-service-tier.ts +17 -0
- package/src/lib/retry-after.ts +3 -0
- package/src/lib/socks5-fetch.ts +21 -9
- package/src/lib/spend-ledger-owner.ts +43 -4
- package/src/lib/upstream-condition.ts +142 -0
- package/src/lib/upstream-retry.ts +95 -12
- package/src/lib/windows-owner-acl.ts +22 -9
- package/src/lib/winsw.ts +5 -5
- package/src/lib/workflow-budget.ts +3 -1
- package/src/link/remote-platform.ts +14 -0
- package/src/link/remote-windows.ts +51 -9
- package/src/link/ssh-argv.ts +63 -10
- package/src/oauth/generic-account-failover.ts +13 -11
- package/src/oauth/index.ts +42 -73
- package/src/oauth/oauth-errors.ts +67 -0
- package/src/oauth/store.ts +21 -11
- package/src/protocols/codecs/messages-ir.ts +15 -9
- package/src/protocols/codecs/ollama.ts +197 -0
- package/src/protocols/encoders/adapter-events.ts +30 -7
- package/src/protocols/encoders/chat.ts +18 -10
- package/src/protocols/encoders/messages.ts +72 -28
- package/src/protocols/trace.ts +18 -0
- package/src/providers/antigravity-models.ts +45 -12
- package/src/providers/fastwire.ts +3 -2
- package/src/providers/free-directory.ts +2 -2
- package/src/providers/quota/anthropic-usage-windows.ts +13 -3
- package/src/providers/quota/vendor-probes-key.ts +60 -24
- package/src/providers/reasoning-metadata.ts +2 -1
- package/src/providers/registry/entries-extended.ts +9 -0
- package/src/providers/request-pacing.ts +3 -2
- package/src/reasoning-effort.ts +7 -2
- package/src/remote/hub-usage.ts +3 -0
- package/src/responses/apply-patch-envelope.ts +45 -19
- package/src/responses/compaction-history-framing.ts +5 -1
- package/src/responses/freeform-wrapper-scan.ts +5 -3
- package/src/responses/progressive-freeform-input.ts +354 -45
- package/src/routing/fallback-policy.ts +3 -1
- package/src/server/admission-model-scope.ts +17 -6
- package/src/server/admitted-http-turn.ts +57 -0
- package/src/server/anthropic-rate-limit-headers.ts +75 -3
- package/src/server/auth-cors.ts +5 -0
- package/src/server/chat-completions.ts +45 -20
- package/src/server/chat-native-sse.ts +52 -7
- package/src/server/chat-native.ts +60 -35
- package/src/server/claude-bridge-pool-session.ts +59 -0
- package/src/server/claude-messages.ts +174 -84
- package/src/server/context-history.ts +5 -1
- package/src/server/gui-static.ts +4 -1
- package/src/server/hub-usage.ts +7 -2
- package/src/server/inbound-body-admission.ts +11 -4
- package/src/server/index/link-management.ts +8 -0
- package/src/server/index/ollama-routes.ts +91 -0
- package/src/server/index/serve-options.ts +44 -24
- package/src/server/index/startup-warnings.ts +5 -12
- package/src/server/index/websocket-handler.ts +5 -2
- package/src/server/index.ts +6 -36
- package/src/server/inference/client-encoder-delivery.ts +9 -3
- package/src/server/json-serialized-bytes.ts +44 -0
- package/src/server/management/agent-settings-routes.ts +24 -21
- package/src/server/management/codex-cli-update-routes.ts +2 -1
- package/src/server/management/logs-usage-routes.ts +89 -4
- package/src/server/management/provider-routes.ts +2 -22
- package/src/server/management/qoder-provider-probe.ts +105 -0
- package/src/server/management/route-registry.ts +4 -1
- package/src/server/management/usage-aggregate-cache.ts +15 -5
- package/src/server/management/usage-source-facets.ts +38 -0
- package/src/server/messages-native-scope.ts +2 -1
- package/src/server/messages-native-tool-guard.ts +12 -4
- package/src/server/messages-native.ts +123 -47
- package/src/server/messages-response-headers.ts +25 -11
- package/src/server/messages-shared.ts +99 -65
- package/src/server/messages-sse-error-filter.ts +199 -0
- package/src/server/native-final-log.ts +93 -0
- package/src/server/ollama-inbound.ts +349 -0
- package/src/server/ollama-native-paths.ts +21 -0
- package/src/server/ollama-route-policy.ts +73 -0
- package/src/server/relay.ts +22 -3
- package/src/server/request-decompress.ts +4 -2
- package/src/server/request-log-failure-attribution.ts +22 -0
- package/src/server/request-log-failure-detail.ts +80 -0
- package/src/server/request-log-terminal-status.ts +4 -2
- package/src/server/request-log.ts +91 -42
- package/src/server/response-log-body.ts +6 -1
- package/src/server/responses/account-change-state.ts +17 -6
- package/src/server/responses/adapter-continuation.ts +17 -6
- package/src/server/responses/adapter-delivery.ts +17 -10
- package/src/server/responses/adapter-dispatch.ts +32 -31
- package/src/server/responses/anthropic-thinking-recovery.ts +3 -0
- package/src/server/responses/codex-auth-error.ts +24 -19
- package/src/server/responses/codex-ws-exchange.ts +11 -8
- package/src/server/responses/codex-ws-metadata.ts +94 -21
- package/src/server/responses/codex-ws-request.ts +3 -1
- package/src/server/responses/codex-ws-wire.ts +19 -3
- package/src/server/responses/compact.ts +57 -24
- package/src/server/responses/compaction-recovery.ts +4 -2
- package/src/server/responses/compaction-routing.ts +9 -4
- package/src/server/responses/core-auth.ts +32 -14
- package/src/server/responses/core-codex-account.ts +17 -6
- package/src/server/responses/core-combo-failure.ts +7 -1
- package/src/server/responses/core-combo-native.ts +2 -1
- package/src/server/responses/core-combo.ts +43 -27
- package/src/server/responses/core-errors.ts +24 -21
- package/src/server/responses/core-lifetime.ts +6 -3
- package/src/server/responses/core-normalize.ts +1 -0
- package/src/server/responses/core-options.ts +9 -0
- package/src/server/responses/core-pipeline.ts +4 -3
- package/src/server/responses/empty-completion-guard.ts +4 -1
- package/src/server/responses/fetch-helpers.ts +7 -1
- package/src/server/responses/input-admission.ts +28 -2
- package/src/server/responses/native-injection.ts +1 -1
- package/src/server/responses/native-response-json.ts +13 -4
- package/src/server/responses/native-response-output.ts +1 -2
- package/src/server/responses/non-replayable-error.ts +2 -1
- package/src/server/responses/pacing-overload.ts +3 -2
- package/src/server/responses/passthrough-delivery.ts +55 -14
- package/src/server/responses/passthrough-dispatch.ts +20 -18
- package/src/server/responses/passthrough-error.ts +9 -9
- package/src/server/responses/policy-fallback.ts +2 -1
- package/src/server/responses/request-prepare.ts +69 -48
- package/src/server/responses/request-transport.ts +36 -31
- package/src/server/responses/response-effects.ts +3 -2
- package/src/server/responses/run-turn-execution.ts +6 -6
- package/src/server/responses/sidecar-execution.ts +16 -12
- package/src/server/responses/spend-storage-error.ts +2 -1
- package/src/server/responses/terminal-guard.ts +30 -0
- package/src/server/responses/ws-upstream.ts +9 -0
- package/src/server/responses-custom-tool-repair.ts +14 -3
- package/src/server/responses-terminal-repair.ts +5 -2
- package/src/server/responses-undeclared-tool-guard.ts +39 -16
- package/src/server/restart-replacement.ts +3 -1
- package/src/server/safe-response-headers.ts +162 -13
- package/src/server/sse-payload-rewrite.ts +23 -11
- package/src/server/turn-state-handles.ts +164 -0
- package/src/server/workflow-refusal.ts +2 -1
- package/src/server/ws-bridge.ts +4 -0
- package/src/service/definition.ts +36 -4
- package/src/service/launchd.ts +89 -32
- package/src/service/logging.ts +34 -7
- package/src/service/ownership-mutation-lease.d.mts +11 -2
- package/src/service/ownership-mutation-lease.mjs +53 -11
- package/src/service/plist-xml.ts +59 -0
- package/src/service/state.ts +8 -0
- package/src/service/systemd-env.ts +2 -0
- package/src/service/systemd.ts +31 -7
- package/src/service/windows-taskxml.ts +16 -7
- package/src/service-manager-probe.ts +4 -10
- package/src/types/config.ts +2 -0
- package/src/types/provider.ts +2 -0
- package/src/types/request.ts +13 -1
- package/src/update/config-preflight.ts +48 -0
- package/src/update/index.ts +148 -26
- package/src/update/npm-install.d.mts +8 -0
- package/src/update/npm-install.mjs +20 -1
- package/src/update/orchestrated-admission.d.mts +4 -0
- package/src/update/orchestrated-admission.mjs +12 -0
- package/src/update/orchestrated-arguments.d.mts +12 -0
- package/src/update/orchestrated-arguments.mjs +64 -0
- package/src/update/orchestrated-child.d.mts +12 -0
- package/src/update/orchestrated-child.mjs +70 -0
- package/src/update/orchestrated-entry.ts +234 -0
- package/src/update/orchestrated-identity-probe-entry.ts +20 -0
- package/src/update/orchestrated-identity.ts +53 -0
- package/src/update/orchestrated-live-identity.ts +48 -0
- package/src/update/orchestrated-node-driver.mjs +99 -0
- package/src/update/orchestrated-outcome.d.mts +21 -0
- package/src/update/orchestrated-outcome.mjs +40 -0
- package/src/update/orchestrated-plan.ts +49 -0
- package/src/update/orchestrated-pnpm.d.mts +8 -0
- package/src/update/orchestrated-pnpm.mjs +33 -0
- package/src/update/orchestrated-session.d.mts +37 -0
- package/src/update/orchestrated-session.mjs +264 -0
- package/src/update/orchestrated-token.d.mts +10 -0
- package/src/update/orchestrated-token.mjs +21 -0
- package/src/update/orchestrated-token.ts +3 -0
- package/src/update/orchestrated-tree.d.mts +1 -0
- package/src/update/orchestrated-tree.mjs +14 -0
- package/src/update/pnpm-global-install.d.mts +6 -0
- package/src/update/pnpm-global-install.mjs +9 -2
- package/src/update/posix-install-supervisor-entry.mjs +6 -0
- package/src/update/posix-install-supervisor.d.mts +10 -0
- package/src/update/posix-install-supervisor.mjs +88 -0
- package/src/update/sync-update-mutex.d.mts +10 -0
- package/src/update/sync-update-mutex.mjs +164 -0
- package/src/update/sync-update-mutex.ts +1 -0
- package/src/update/test-home-guard.mjs +33 -0
- package/src/update/transactional-install.mjs +2 -2
- package/src/usage/client.ts +43 -0
- package/src/usage/error-detail.ts +225 -0
- package/src/usage/log.ts +64 -27
- package/src/usage/source-facets.ts +51 -0
- package/src/usage/source-filter.ts +65 -0
- package/src/usage/summary.ts +50 -8
- package/src/web-search/anthropic-executor.ts +105 -24
- package/src/web-search/executor.ts +5 -3
- package/src/web-search/loop.ts +33 -6
- package/src/web-search/progress-stream.ts +64 -5
- package/gui/dist/assets/App-bwugJRKn.js +0 -58
- package/gui/dist/assets/index-ebuVUtB7.js +0 -94
- package/gui/dist/assets/quota-summary-6HsrHQAy.js +0 -1
- /package/gui/dist/{assets → classic/assets}/App-B4j-Txmb.css +0 -0
- /package/gui/dist/{assets → classic/assets}/index-CHWwDo9L.css +0 -0
package/src/cli/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { getCodexHome } from "../codex/paths";
|
|
|
13
13
|
import { admitUpdateRestartChild } from "./update-restart-child";
|
|
14
14
|
import { HEALTH_SENTINEL_STANDALONE_ARG, startServiceHealthSentinel } from "../service/health-sentinel-launch";
|
|
15
15
|
import { UpdateRestartRequired } from "./update-restart-candidate";
|
|
16
|
-
import {
|
|
16
|
+
import { reportUpdateRestartFailure, restartFromCurrentInstallation } from "./update-restart";
|
|
17
17
|
import { findGuiDist } from "../server/gui-static";
|
|
18
18
|
import { inspectGuiBundleFreshness, staleGuiBundleLines } from "../server/gui-freshness";
|
|
19
19
|
// Best-effort recovery for runtime execution and spawned children if launched
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
type ProxyRestartStartOutcome,
|
|
94
94
|
} from "./tray-proxy";
|
|
95
95
|
import { duplicateRuntimeMessage, runDesktopAwareProxyRestart } from "./desktop-runtime-guidance";
|
|
96
|
-
import { reportRestartFailure } from "./restart-failure";
|
|
96
|
+
import { deferSupervisedRestart, reportRestartFailure, type RestartSupervisor } from "./restart-failure";
|
|
97
97
|
import { requestBoundSystemRestart } from "./system-restart-client";
|
|
98
98
|
import { installCrashGuards } from "../lib/crash-guard";
|
|
99
99
|
import { SpendLedgerOwnerError } from "../lib/spend-ledger-owner";
|
|
@@ -160,6 +160,7 @@ import { productionDesktopColdStartDeps, runDesktopColdStart } from "./ensure-de
|
|
|
160
160
|
import { refreshOwnedCatalogIntegrations } from "../integrations/catalog-refresh";
|
|
161
161
|
import { loadExportModels } from "../server/management/model-rows";
|
|
162
162
|
import { removeOwnedConfigAfterDesktopCleanup } from "./uninstall-client-state";
|
|
163
|
+
import { uninstallPrivilegeRefusal } from "../lib/config-ownership";
|
|
163
164
|
import { withProcessRuntimeProvenance } from "../lib/bun-runtime";
|
|
164
165
|
import { startArgv } from "../lib/self-launch-argv";
|
|
165
166
|
import { initializeNodeLauncherContext } from "./launcher-context";
|
|
@@ -210,6 +211,7 @@ async function refreshOwnedRaycastCatalog(
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
|
|
214
|
+
if (process.argv[2] === "__update-orchestrated-identity") process.exit(await (await import("../update/orchestrated-identity-probe-entry")).runIdentityProbe(process.argv.slice(2)));
|
|
213
215
|
if (process.argv[2] === "start" && process.env.OCX_SERVICE) startServiceLogging(join(getConfigDir(), "service.log"));
|
|
214
216
|
const updateRestartChild = admitUpdateRestartChild(process.argv.slice(2));
|
|
215
217
|
initializeNodeLauncherContext();
|
|
@@ -604,8 +606,9 @@ async function handleStart(options: { block?: boolean } = {}) {
|
|
|
604
606
|
writeRuntime: bound => { updateRestartChild?.check(bound.port, bound.config.hostname ?? ""); writeRuntimePort({
|
|
605
607
|
pid: process.pid,
|
|
606
608
|
port: bound.port,
|
|
607
|
-
hostname: bound.
|
|
609
|
+
hostname: bound.server.hostname,
|
|
608
610
|
attestationSecret: bound.localAttestationSecret,
|
|
611
|
+
command: currentServingCommand(),
|
|
609
612
|
...siblingRuntimeField(),
|
|
610
613
|
}); updateRestartChild?.complete(); },
|
|
611
614
|
stopBound: bound => bound.server.stop(true),
|
|
@@ -952,10 +955,9 @@ async function handleTrayProxyStart(existingIsSuccess = true): Promise<boolean>
|
|
|
952
955
|
}
|
|
953
956
|
|
|
954
957
|
const PROXY_RESTART_OBSERVE_MS = MEMORY_DRAIN_RESTART_MS + REPLACEMENT_READY_TIMEOUT_MS + 15_000;
|
|
955
|
-
|
|
956
958
|
/** Reserve confirmation time within the shared restart deadline. */
|
|
957
959
|
async function handleProxyRestart(
|
|
958
|
-
startWhenStopped: (recoveringLiveRestart: boolean) => Promise<ProxyRestartStartOutcome>,
|
|
960
|
+
startWhenStopped: (recoveringLiveRestart: boolean) => Promise<ProxyRestartStartOutcome>, onSupervised?: (supervisor: RestartSupervisor) => void,
|
|
959
961
|
): Promise<boolean> {
|
|
960
962
|
const deadlineAt = Date.now() + PROXY_RESTART_OBSERVE_MS;
|
|
961
963
|
const result = await runDesktopAwareProxyRestart({
|
|
@@ -981,10 +983,11 @@ async function handleProxyRestart(
|
|
|
981
983
|
console.log(`🔄 Running proxy ${candidate.target.version} is older than this CLI (${candidate.cliVersion}); restarting it from the current installation...`);
|
|
982
984
|
const update = await restartFromCurrentInstallation(candidate, deadlineAt, detachedStartEnvironment());
|
|
983
985
|
if (update.ok) console.log(`✅ Proxy updated to ${update.live.version} (PID ${update.live.pid}).`);
|
|
984
|
-
else
|
|
986
|
+
else reportUpdateRestartFailure(update);
|
|
985
987
|
process.exitCode = update.ok ? 0 : 1;
|
|
986
988
|
return update.ok;
|
|
987
989
|
}
|
|
990
|
+
if (onSupervised && deferSupervisedRestart(result, onSupervised)) return false;
|
|
988
991
|
if (!result.ok) reportRestartFailure(result);
|
|
989
992
|
process.exitCode = result.ok ? 0 : 1;
|
|
990
993
|
return result.ok;
|
|
@@ -1137,7 +1140,9 @@ async function handleStopUnlocked(snapshot?: GuardedStopSnapshot) {
|
|
|
1137
1140
|
.filter(read => isPendingTeardownAbandoned(read, teardownOwnerStillRunning));
|
|
1138
1141
|
let teardownNonce: string | undefined;
|
|
1139
1142
|
// #7423: an update that restarts the proxy asks this stop to leave Codex routing for the replacement.
|
|
1140
|
-
|
|
1143
|
+
// Client start never discharges a standalone update-handover receipt or reapplies routing.
|
|
1144
|
+
const handoverRequested = updateTeardownHandoverRequested(process.env, () => shouldSyncCodexOnStart(loadConfig()))
|
|
1145
|
+
&& !stoppingSibling && readClientConnectionState().kind !== "connected";
|
|
1141
1146
|
let deferralHonoredByProxy = false;
|
|
1142
1147
|
const claimTeardown = (endpoint: { hostname: string; port: number }, endpointSource: "exact" | "guessed") => {
|
|
1143
1148
|
if (teardownNonce || stoppingSibling) return;
|
|
@@ -1525,6 +1530,9 @@ async function handleStopUnlocked(snapshot?: GuardedStopSnapshot) {
|
|
|
1525
1530
|
}
|
|
1526
1531
|
|
|
1527
1532
|
async function handleUninstall() {
|
|
1533
|
+
// Before every teardown step: an elevated run must not act on a home another account can change.
|
|
1534
|
+
const privilegeRefusal = uninstallPrivilegeRefusal(getConfigDir());
|
|
1535
|
+
if (privilegeRefusal) { console.error(`❌ ${privilegeRefusal}`); process.exit(1); }
|
|
1528
1536
|
/** Definitive "nothing is answering" on the endpoint this home would serve. */
|
|
1529
1537
|
const proxyEndpointProvenDown = async (): Promise<boolean> => {
|
|
1530
1538
|
try {
|
|
@@ -1679,7 +1687,8 @@ async function handleUninstall() {
|
|
|
1679
1687
|
try {
|
|
1680
1688
|
const { uninstallCodexShimAsync } = await import("../codex/shim");
|
|
1681
1689
|
const r = await uninstallCodexShimAsync();
|
|
1682
|
-
|
|
1690
|
+
if (r.refused) { failures.push("Codex autostart shim removed"); console.error(`⚠️ Codex autostart shim removed failed: ${r.message}`); }
|
|
1691
|
+
else console.log(r.removed ? "✅ Codex autostart shim removed" : "- Codex autostart shim removed: not installed");
|
|
1683
1692
|
} catch (err) {
|
|
1684
1693
|
failures.push("Codex autostart shim removed");
|
|
1685
1694
|
console.error(`⚠️ Codex autostart shim removed failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -11,19 +11,21 @@
|
|
|
11
11
|
import type { HomeCodexSettingsRecord } from "../client/link-home";
|
|
12
12
|
import { findLiveProxy, probeHostname, type LiveProxy } from "../server/proxy-liveness";
|
|
13
13
|
import type { ProxyRestartStartOutcome } from "./tray-proxy";
|
|
14
|
+
import type { RestartSupervisor } from "./restart-failure";
|
|
14
15
|
|
|
15
16
|
export type ApplyRestartOutcome =
|
|
16
17
|
| { kind: "current" }
|
|
17
18
|
| { kind: "not-running" }
|
|
18
19
|
| { kind: "connection-changed" }
|
|
19
20
|
| { kind: "restarted" }
|
|
21
|
+
| { kind: "deferred-supervisor"; supervisor: RestartSupervisor }
|
|
20
22
|
| { kind: "failed" };
|
|
21
23
|
|
|
22
24
|
export interface ApplyRestartDeps {
|
|
23
25
|
findLive?: () => Promise<LiveProxy | null>;
|
|
24
26
|
/** Epoch ms the live client runtime reports as its start, or null when it reports none. */
|
|
25
27
|
readStartedAt?: (live: LiveProxy) => Promise<number | null>;
|
|
26
|
-
restart: (startWhenStopped: (recoveringLiveRestart: boolean) => Promise<ProxyRestartStartOutcome
|
|
28
|
+
restart: (startWhenStopped: (recoveringLiveRestart: boolean) => Promise<ProxyRestartStartOutcome>, onSupervised: (supervisor: RestartSupervisor) => void) => Promise<boolean>;
|
|
27
29
|
recoveryStart: (recoveringLiveRestart: boolean) => Promise<ProxyRestartStartOutcome>;
|
|
28
30
|
/** Still the connection this sync applied for (rechecked right before the restart). */
|
|
29
31
|
connectionUnchanged: () => boolean;
|
|
@@ -54,9 +56,11 @@ export async function restartRuntimeAfterApply(record: HomeCodexSettingsRecord,
|
|
|
54
56
|
const startedAt = await (deps.readStartedAt ?? (target => readClientRuntimeStartedAt(target)))(live);
|
|
55
57
|
if (startedAt !== null && Number.isFinite(appliedAt) && startedAt >= appliedAt) return { kind: "current" };
|
|
56
58
|
if (!deps.connectionUnchanged()) return { kind: "connection-changed" };
|
|
59
|
+
let supervisor: RestartSupervisor | undefined;
|
|
57
60
|
const ok = await deps.restart(async recovering => recovering
|
|
58
61
|
? deps.recoveryStart(true)
|
|
59
|
-
: { status: "skipped" });
|
|
62
|
+
: { status: "skipped" }, value => { supervisor = value; });
|
|
63
|
+
if (!ok && supervisor) return { kind: "deferred-supervisor", supervisor };
|
|
60
64
|
return ok ? { kind: "restarted" } : { kind: "failed" };
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -67,6 +71,9 @@ export function applyRestartMessage(outcome: ApplyRestartOutcome): string {
|
|
|
67
71
|
case "not-running": return "No client runtime is running; the applied settings take effect when it starts.";
|
|
68
72
|
case "connection-changed": return "The connection changed during sync; the client runtime was not restarted. Run 'ocx sync' again.";
|
|
69
73
|
case "restarted": return "Client runtime restarted after applying the Home's settings.";
|
|
74
|
+
case "deferred-supervisor": return outcome.supervisor === "desktop"
|
|
75
|
+
? "Client runtime restart deferred; the settings take effect when OpenCodex Desktop restarts it. Use Quit in the OpenCodex tray menu, then reopen OpenCodex."
|
|
76
|
+
: "Client runtime restart deferred; the settings take effect when the background service restarts it. Run `ocx service restart`.";
|
|
70
77
|
case "failed": return "The client runtime restart did not complete; the previous runtime keeps serving. If a background service or the desktop app owns it, restart it there; otherwise retry with 'ocx restart' or 'ocx sync'.";
|
|
71
78
|
}
|
|
72
79
|
}
|
package/src/cli/link.ts
CHANGED
|
@@ -134,7 +134,7 @@ function validatePeer(value: unknown, index: number): LinkPeerStatus {
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
function validateStatus(value: unknown): LinkStatusPayload {
|
|
137
|
+
export function validateStatus(value: unknown): LinkStatusPayload {
|
|
138
138
|
if (!isRecord(value)) throw new Error("invalid link API response: status object");
|
|
139
139
|
assertKeys(value, ["role", "listener", "links", "child"], ["local"], "status");
|
|
140
140
|
if (value.role !== "standalone" && value.role !== "home" && value.role !== "child") {
|
package/src/cli/models.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { resolveMatchedPrice, type MatchedPrice } from "../usage/cost";
|
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { createInterface } from "node:readline/promises";
|
|
8
8
|
import { syncModelsToCodex } from "../codex/sync";
|
|
9
|
-
import { configuredContextWindow } from "../codex/catalog/provider-fetch";
|
|
9
|
+
import { applyRegistryCapabilitySeedFill, configuredContextWindow } from "../codex/catalog/provider-fetch";
|
|
10
10
|
import { hasOwnProvider, isValidProviderName, loadConfig, saveConfig } from "../config";
|
|
11
11
|
import { readCliConfigForMutation } from "./config-mutation";
|
|
12
12
|
import {
|
|
@@ -16,6 +16,20 @@ import {
|
|
|
16
16
|
import { encodedModelIdCollides, resolveSlugSelection, routedSlug } from "../providers/slug-codec";
|
|
17
17
|
import { isModelsRuntimeSubcommand } from "./models-runtime-subcommands";
|
|
18
18
|
import { knownModelIdsForProvider } from "../router";
|
|
19
|
+
import { azureVendorModelMetadata, enrichProviderFromRegistry, registryInputModalitiesForDestination } from "../providers/derive";
|
|
20
|
+
import { getProviderRegistryEntry } from "../providers/registry";
|
|
21
|
+
import { providerMatchesRegistryTransportWithStaticGuards } from "../providers/static-model-discovery";
|
|
22
|
+
import { resolveModelPolicy } from "../providers/resolved-model-policy";
|
|
23
|
+
import { customRowInputModalities } from "../vision/eligibility";
|
|
24
|
+
import { applyProviderContextCap, providerContextCap, resolveUnknownRoutedContextWindow } from "../providers/context-cap";
|
|
25
|
+
import { isCanonicalOpenAiForwardProvider, OPENAI_CODEX_PROVIDER_ID } from "../providers/openai-tiers";
|
|
26
|
+
import { reasoningCapabilitiesFromConfig } from "../providers/reasoning-capabilities";
|
|
27
|
+
import { dropLearnedUnsupportedReasoningEfforts, providerUsesReasoningMetadata } from "../providers/reasoning-metadata";
|
|
28
|
+
import { isKeychainReference } from "../providers/api-key-resolve";
|
|
29
|
+
import { hasNativeOpenAiCapabilityMetadata, nativeContextLimits, nativeDefaultReasoningEffort, nativeInputModalities, nativeOpenAiContextWindow, nativeReasoningEfforts } from "../codex/catalog/metadata";
|
|
30
|
+
import { canInferVendorContext, vendorContextInference } from "../codex/catalog/vendor-context";
|
|
31
|
+
import { terminalSafeText } from "./runtime-api";
|
|
32
|
+
import { runPassiveRead } from "../lib/passive-read";
|
|
19
33
|
import { findLiveProxy } from "../server/proxy-liveness";
|
|
20
34
|
import { modelInList, type OcxConfig, type OcxCustomModel } from "../types";
|
|
21
35
|
import type { RuntimeApiDeps } from "./runtime-api";
|
|
@@ -28,6 +42,13 @@ const REMOVE_USAGE = "Usage: ocx models remove <customId|provider/modelId> [--ye
|
|
|
28
42
|
const LIST_CUSTOM_USAGE = "Usage: ocx models list-custom [--json]";
|
|
29
43
|
const ALLOWED_MODALITIES = new Set(["text", "image", "audio"]);
|
|
30
44
|
|
|
45
|
+
function printJson(value: unknown): void {
|
|
46
|
+
const encoded = JSON.stringify(value, null, 2);
|
|
47
|
+
if (encoded === undefined) throw new TypeError("Cannot serialize model output");
|
|
48
|
+
console.log(encoded.replace(/[\u007f-\u009f\u2028\u2029]/g, character =>
|
|
49
|
+
`\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`));
|
|
50
|
+
}
|
|
51
|
+
|
|
31
52
|
import { parseReasoningArgs } from "./models-custom-input";
|
|
32
53
|
import { redactSecretArgs } from "./secret-args";
|
|
33
54
|
export { parseReasoningArgs } from "./models-custom-input";
|
|
@@ -56,35 +77,91 @@ function collectModels(config: OcxConfig, providerFilter?: string): ModelEntry[]
|
|
|
56
77
|
for (const [provName, prov] of Object.entries(providers)) {
|
|
57
78
|
if (!prov) continue;
|
|
58
79
|
const seen = new Set<string>();
|
|
59
|
-
|
|
80
|
+
// Model listing is read-only: derive effective registry policy on a private copy.
|
|
81
|
+
const effective = structuredClone(prov);
|
|
82
|
+
const registryMatches = providerMatchesRegistryTransportWithStaticGuards(provName, prov);
|
|
83
|
+
if (registryMatches) applyRegistryCapabilitySeedFill(provName, effective);
|
|
84
|
+
enrichProviderFromRegistry(provName, effective);
|
|
85
|
+
if (registryMatches) {
|
|
86
|
+
const policy = resolveModelPolicy({
|
|
87
|
+
providerName: provName, modelId: effective.defaultModel ?? "__catalog_capture__", provider: effective,
|
|
88
|
+
registryEntry: getProviderRegistryEntry(provName), transportMatchedRegistry: true,
|
|
89
|
+
...(effective.authMode ? { effectiveAuth: { authMode: effective.authMode } } : {}),
|
|
90
|
+
}).provider;
|
|
91
|
+
Object.assign(effective, policy);
|
|
92
|
+
}
|
|
93
|
+
effective.inputModalities ??= registryInputModalitiesForDestination(provName, prov);
|
|
94
|
+
const routerKnown = new Set(knownModelIdsForProvider(provName, prov));
|
|
60
95
|
|
|
61
96
|
/** Append one model with resolved metadata, ignoring duplicates within this provider. */
|
|
62
97
|
const addModel = (model: string, isDefault: boolean) => {
|
|
63
98
|
if (seen.has(model)) return;
|
|
64
99
|
seen.add(model);
|
|
65
100
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const
|
|
101
|
+
const custom = config.customModels?.find(row => row.provider === provName && row.modelId === model);
|
|
102
|
+
const nativeMetadata = custom && hasNativeOpenAiCapabilityMetadata(model);
|
|
103
|
+
const canonicalProvider = provName === OPENAI_CODEX_PROVIDER_ID && prov.authMode === undefined
|
|
104
|
+
? { ...prov, authMode: "forward" as const } : prov;
|
|
105
|
+
const canonicalNativeCustom = nativeMetadata && provName === OPENAI_CODEX_PROVIDER_ID
|
|
106
|
+
&& isCanonicalOpenAiForwardProvider(canonicalProvider);
|
|
107
|
+
const canInfer = canInferVendorContext(provName, effective);
|
|
108
|
+
const modelListEmpty = (effective.models?.length ?? 0) === 0;
|
|
109
|
+
const seededDefault = effective.defaultModel === model && modelListEmpty
|
|
110
|
+
&& (effective.liveModels === false || (effective.adapter === "google" && effective.googleMode === "vertex"));
|
|
111
|
+
const hintEligible = !custom || canInfer || routerKnown.has(model) || (effective.models ?? []).includes(model)
|
|
112
|
+
|| (effective.retainModels ?? []).includes(model) || seededDefault;
|
|
113
|
+
const azureMetadata = hintEligible ? azureVendorModelMetadata(effective.baseUrl, model, getConfigDir()) : undefined;
|
|
114
|
+
const capability = Object.hasOwn(effective.modelCapabilities ?? {}, model)
|
|
115
|
+
? effective.modelCapabilities?.[model]?.inputModalities : undefined;
|
|
116
|
+
const customModalities = customRowInputModalities(config, provName, model);
|
|
117
|
+
const modalities = capability ?? customModalities ?? (modelInList(effective.noVisionModels, model)
|
|
118
|
+
? ["text"] : modelRecordValue(effective.modelInputModalities, model) ?? effective.inputModalities
|
|
119
|
+
?? azureMetadata?.input ?? (canonicalNativeCustom ? nativeInputModalities(model) : null));
|
|
75
120
|
// Same reason, for the ladder: `configuredReasoningEfforts` is what the catalog
|
|
76
121
|
// (`provider-fetch`) and the effort cap (`effort-policy`) resolve through, and it
|
|
77
122
|
// does three things this expression did not — it returns [] for a noReasoningModels
|
|
78
123
|
// match, drops levels Codex does not declare, and re-adds tiers the wire map proves
|
|
79
124
|
// the model emits. Restating two of its five lines here reported a ladder the proxy
|
|
80
125
|
// strips, and unsanitized junk as a supported level.
|
|
81
|
-
const
|
|
126
|
+
const declaredEfforts = custom?.reasoningEfforts ?? modelRecordValue(effective.modelReasoningEfforts, model) ?? effective.reasoningEfforts;
|
|
127
|
+
// A passive CLI cannot resolve an OS-keychain reference to select account-scoped refusals.
|
|
128
|
+
// Report unknown rather than opening the keychain or claiming an unverifiable ladder.
|
|
129
|
+
const unobservedCredential = providerUsesReasoningMetadata(effective) && isKeychainReference(effective.apiKey);
|
|
130
|
+
let efforts = reasoningCapabilitiesFromConfig(effective, model).supportsReasoningEffort === false || declaredEfforts?.length === 0
|
|
131
|
+
? [] : unobservedCredential ? null : custom?.reasoningEfforts ?? configuredReasoningEfforts(effective, model, { refreshMetadata: false })
|
|
132
|
+
?? (canonicalNativeCustom ? nativeReasoningEfforts(model) : null);
|
|
133
|
+
if (nativeMetadata && efforts && efforts.length > 0) {
|
|
134
|
+
const allowed = nativeReasoningEfforts(model);
|
|
135
|
+
if (allowed.length > 0) {
|
|
136
|
+
const declared = new Set(efforts);
|
|
137
|
+
const surviving = [...new Set(allowed)].filter(effort => declared.has(effort));
|
|
138
|
+
const defaultEffort = nativeDefaultReasoningEffort(model);
|
|
139
|
+
efforts = surviving.length > 0 ? surviving : [defaultEffort && allowed.includes(defaultEffort) ? defaultEffort : allowed[0]!];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (efforts) efforts = dropLearnedUnsupportedReasoningEfforts(effective, model, efforts);
|
|
143
|
+
const nativeCustomContext = canonicalNativeCustom
|
|
144
|
+
? nativeOpenAiContextWindow(model, {
|
|
145
|
+
...nativeContextLimits(config),
|
|
146
|
+
...(custom.contextWindow ? { modelWindows: { ...nativeContextLimits(config).modelWindows, [model]: custom.contextWindow } } : {}),
|
|
147
|
+
}) : undefined;
|
|
148
|
+
const cap = providerContextCap(config, provName);
|
|
149
|
+
const explicitContext = nativeCustomContext ?? custom?.contextWindow;
|
|
150
|
+
const configuredContext = hintEligible ? configuredContextWindow(effective, model) : undefined;
|
|
151
|
+
const azureWindow = explicitContext === undefined && configuredContext === undefined
|
|
152
|
+
? azureMetadata?.contextWindow : undefined;
|
|
153
|
+
const azureContext = Number.isSafeInteger(azureWindow) && azureWindow! > 0 ? azureWindow : undefined;
|
|
154
|
+
const inferredContext = explicitContext === undefined && configuredContext === undefined && azureContext === undefined && canInfer
|
|
155
|
+
? vendorContextInference(model)?.contextWindow : undefined;
|
|
156
|
+
const fallbackContext = hintEligible && cap !== undefined ? resolveUnknownRoutedContextWindow(cap) : undefined;
|
|
157
|
+
const contextWindow = explicitContext
|
|
158
|
+
?? applyProviderContextCap(configuredContext ?? azureContext ?? inferredContext ?? fallbackContext, cap);
|
|
82
159
|
|
|
83
160
|
entries.push({
|
|
84
161
|
provider: provName,
|
|
85
162
|
model,
|
|
86
163
|
isDefault,
|
|
87
|
-
contextWindow:
|
|
164
|
+
contextWindow: contextWindow ?? null,
|
|
88
165
|
inputModalities: modalities,
|
|
89
166
|
reasoningEfforts: efforts,
|
|
90
167
|
price: resolveMatchedPrice(provName, model),
|
|
@@ -94,9 +171,17 @@ function collectModels(config: OcxConfig, providerFilter?: string): ModelEntry[]
|
|
|
94
171
|
// defaultModel first
|
|
95
172
|
if (prov.defaultModel) addModel(prov.defaultModel, true);
|
|
96
173
|
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
174
|
+
// Keep the CLI list current when this config predates a provider's registry seed.
|
|
175
|
+
// knownModelIdsForProvider is the router's own derivation: config models first, then
|
|
176
|
+
// registry seeds, hint-map keys, and live-discovered cache ids (registry-derived
|
|
177
|
+
// sources only enter when the router's registry transport guard matches), then customModels.
|
|
178
|
+
// Some legacy key presets retain registry ownership even after a destination change. Because hint-map keys
|
|
179
|
+
// are included, wire-only ids a provider's collapsed picker hides still appear here;
|
|
180
|
+
// that is router parity. A model the user pruned from `models` reappears if the
|
|
181
|
+
// registry still seeds it -- the list is a union, not the user's curation. The
|
|
182
|
+
// user's saved models remain first and are never discarded.
|
|
183
|
+
for (const m of [...(prov.models ?? []), ...knownModelIdsForProvider(provName, prov, config)]) {
|
|
184
|
+
addModel(m, m === prov.defaultModel);
|
|
100
185
|
}
|
|
101
186
|
}
|
|
102
187
|
|
|
@@ -119,8 +204,8 @@ function consumeFlagValue(args: string[], flag: string): string | undefined {
|
|
|
119
204
|
}
|
|
120
205
|
|
|
121
206
|
function fail(message: string, usage?: string): never {
|
|
122
|
-
console.error(`Error: ${message}`);
|
|
123
|
-
if (usage) console.error(usage);
|
|
207
|
+
console.error(`Error: ${terminalSafeText(message)}`);
|
|
208
|
+
if (usage) console.error(terminalSafeText(usage));
|
|
124
209
|
process.exit(1);
|
|
125
210
|
}
|
|
126
211
|
|
|
@@ -150,13 +235,13 @@ function printCustomMutation(action: "added" | "removed", model: OcxCustomModel,
|
|
|
150
235
|
const complete = sync.configApplied === true && sync.ok;
|
|
151
236
|
if (sync.status !== "not-attempted" && (!sync.ok || sync.status === "refused")) process.exitCode = 1;
|
|
152
237
|
if (wantsJson) {
|
|
153
|
-
|
|
238
|
+
printJson({ action,
|
|
154
239
|
model: action === "added" ? model : { id: model.id, provider: model.provider, modelId: model.modelId },
|
|
155
|
-
needsSync: !complete, sync }
|
|
240
|
+
needsSync: !complete, sync });
|
|
156
241
|
return;
|
|
157
242
|
}
|
|
158
|
-
if (sync.warning) console.log(`Warning: ${sync.warning}`);
|
|
159
|
-
console.log(`${action === "added" ? "Added" : "Removed"} custom model ${routedSlug(model.provider, model.modelId)}${action === "added" ? ` (${model.id})` : ""}.`);
|
|
243
|
+
if (sync.warning) console.log(`Warning: ${terminalSafeText(sync.warning)}`);
|
|
244
|
+
console.log(`${action === "added" ? "Added" : "Removed"} custom model ${terminalSafeText(routedSlug(model.provider, model.modelId))}${action === "added" ? ` (${terminalSafeText(model.id)})` : ""}.`);
|
|
160
245
|
if (sync.status === "skipped") console.log("Custom model saved; client sync was skipped by the integration policy.");
|
|
161
246
|
else if (!complete && sync.status !== "not-attempted") console.log("Custom model saved; client/catalog sync remains incomplete. Inspect the target before retrying.");
|
|
162
247
|
}
|
|
@@ -241,7 +326,7 @@ async function confirmCustomRemoval(model: OcxCustomModel): Promise<boolean> {
|
|
|
241
326
|
}
|
|
242
327
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
243
328
|
try {
|
|
244
|
-
const answer = (await rl.question(`Remove custom model ${routedSlug(model.provider, model.modelId)}? [y/N] `)).trim().toLowerCase();
|
|
329
|
+
const answer = (await rl.question(`Remove custom model ${terminalSafeText(routedSlug(model.provider, model.modelId))}? [y/N] `)).trim().toLowerCase();
|
|
245
330
|
return answer === "y" || answer === "yes";
|
|
246
331
|
} finally {
|
|
247
332
|
rl.close();
|
|
@@ -331,11 +416,11 @@ function customModelCells(model: OcxCustomModel): string[] {
|
|
|
331
416
|
}
|
|
332
417
|
|
|
333
418
|
function printCustomModelGroup(provider: string, models: OcxCustomModel[]): void {
|
|
334
|
-
const rows = models.map(customModelCells);
|
|
419
|
+
const rows = models.map(model => customModelCells(model).map(terminalSafeText));
|
|
335
420
|
const headers = ["ID", "MODEL", "DISPLAY NAME", "CONTEXT", "MODALITIES", "EFFORTS", "DEFAULT EFFORT"];
|
|
336
421
|
const widths = headers.map((header, column) => Math.max(header.length, ...rows.map(row => row[column].length)));
|
|
337
422
|
const line = (cells: string[]) => cells.map((cell, column) => cell.padEnd(widths[column])).join(" ");
|
|
338
|
-
console.log(`${provider}:`);
|
|
423
|
+
console.log(`${terminalSafeText(provider)}:`);
|
|
339
424
|
console.log(` ${line(headers)}`);
|
|
340
425
|
for (const row of rows) console.log(` ${line(row)}`);
|
|
341
426
|
console.log();
|
|
@@ -347,7 +432,7 @@ function handleCustomList(args: string[]): void {
|
|
|
347
432
|
rejectUnexpectedArgs(rest, LIST_CUSTOM_USAGE);
|
|
348
433
|
const models = loadConfig().customModels ?? [];
|
|
349
434
|
if (wantsJson) {
|
|
350
|
-
|
|
435
|
+
printJson(models);
|
|
351
436
|
return;
|
|
352
437
|
}
|
|
353
438
|
if (models.length === 0) {
|
|
@@ -372,9 +457,9 @@ function handleConfiguredModels(args: string[]): void {
|
|
|
372
457
|
const shown = redactSecretArgs(restArgs);
|
|
373
458
|
const unknown = shown.filter(a => a.startsWith("-"));
|
|
374
459
|
if (unknown.length > 0) {
|
|
375
|
-
console.error(`Unknown flag(s): ${unknown.join(", ")}`);
|
|
460
|
+
console.error(`Unknown flag(s): ${terminalSafeText(unknown.join(", "))}`);
|
|
376
461
|
} else {
|
|
377
|
-
console.error(`Unexpected argument(s): ${shown.join(", ")}`);
|
|
462
|
+
console.error(`Unexpected argument(s): ${terminalSafeText(shown.join(", "))}`);
|
|
378
463
|
}
|
|
379
464
|
console.error("Usage: ocx models [--provider <name>] [--json]");
|
|
380
465
|
process.exit(1);
|
|
@@ -383,23 +468,24 @@ function handleConfiguredModels(args: string[]): void {
|
|
|
383
468
|
const config = loadConfig();
|
|
384
469
|
|
|
385
470
|
if (providerFilter && !hasOwnProvider(config.providers, providerFilter)) {
|
|
386
|
-
console.error(`Provider "${providerFilter}" is not configured. See: ocx provider list`);
|
|
471
|
+
console.error(`Provider "${terminalSafeText(providerFilter)}" is not configured. See: ocx provider list`);
|
|
387
472
|
process.exit(1);
|
|
388
473
|
}
|
|
389
474
|
|
|
390
475
|
const models = collectModels(config, providerFilter ?? undefined);
|
|
476
|
+
const note = "Local saved and router-known IDs include registry seeds, custom models and this process's discovery cache. Reasoning may be unknown for keychain credentials. Use ocx models live for the running catalog.";
|
|
391
477
|
|
|
392
478
|
if (wantsJson) {
|
|
393
|
-
|
|
479
|
+
printJson({
|
|
394
480
|
models,
|
|
395
|
-
note
|
|
396
|
-
}
|
|
481
|
+
note,
|
|
482
|
+
});
|
|
397
483
|
return;
|
|
398
484
|
}
|
|
399
485
|
|
|
400
486
|
if (models.length === 0) {
|
|
401
487
|
console.log("No models found in configured providers.");
|
|
402
|
-
|
|
488
|
+
console.log(`Note: ${note}`);
|
|
403
489
|
return;
|
|
404
490
|
}
|
|
405
491
|
|
|
@@ -413,19 +499,19 @@ function handleConfiguredModels(args: string[]): void {
|
|
|
413
499
|
|
|
414
500
|
for (const [provName, provModels] of byProvider) {
|
|
415
501
|
const isDefaultProv = provName === config.defaultProvider ? " (default provider)" : "";
|
|
416
|
-
console.log(`${provName}${isDefaultProv}:`);
|
|
502
|
+
console.log(`${terminalSafeText(provName)}${isDefaultProv}:`);
|
|
417
503
|
for (const m of provModels) {
|
|
418
504
|
const marker = m.isDefault ? " *" : "";
|
|
419
505
|
const ctx = m.contextWindow ? ` (${Math.round(m.contextWindow / 1000)}k)` : "";
|
|
420
506
|
const rates = m.price?.cost4;
|
|
421
507
|
const pricing = rates ? ` ~$${rates.input}/$${rates.output} input/output per 1M tokens` : " price unknown";
|
|
422
|
-
console.log(` ${m.model}${marker}${ctx}${pricing}`);
|
|
508
|
+
console.log(` ${terminalSafeText(m.model)}${marker}${ctx}${pricing}`);
|
|
423
509
|
}
|
|
424
510
|
console.log();
|
|
425
511
|
}
|
|
426
512
|
|
|
427
513
|
console.log("* = default model for provider");
|
|
428
|
-
console.log(
|
|
514
|
+
console.log(`Note: ${note}`);
|
|
429
515
|
}
|
|
430
516
|
|
|
431
517
|
export async function handleModels(args: string[], deps: ModelsCommandDeps = {}): Promise<void> {
|
|
@@ -451,7 +537,7 @@ export async function handleModels(args: string[], deps: ModelsCommandDeps = {})
|
|
|
451
537
|
return;
|
|
452
538
|
}
|
|
453
539
|
if (subcommand === "list-custom") {
|
|
454
|
-
handleCustomList(rest);
|
|
540
|
+
await runPassiveRead(async () => { handleCustomList(rest); }, { onDiagnostic: message => console.error(message) });
|
|
455
541
|
return;
|
|
456
542
|
}
|
|
457
543
|
if (isModelsRuntimeSubcommand(subcommand)) {
|
|
@@ -460,5 +546,5 @@ export async function handleModels(args: string[], deps: ModelsCommandDeps = {})
|
|
|
460
546
|
if (code !== null) process.exitCode = code;
|
|
461
547
|
return;
|
|
462
548
|
}
|
|
463
|
-
handleConfiguredModels(subcommand === "list" ? rest : args);
|
|
549
|
+
await runPassiveRead(async () => { handleConfiguredModels(subcommand === "list" ? rest : args); }, { onDiagnostic: message => console.error(message) });
|
|
464
550
|
}
|
package/src/cli/registry.ts
CHANGED
|
@@ -183,10 +183,13 @@ export const CLI_COMMANDS: CliCommandEntry[] = [
|
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
name: "sync",
|
|
186
|
-
usage: "ocx sync [--expect-link <linkId> | --expect-hub-key <apiKeyId>] [--restart-codex] [--restart-app-server-only]",
|
|
186
|
+
usage: "ocx sync [--expect-link <linkId> | --expect-hub-key <apiKeyId>] [--local-only] [--json] [--restart-codex] [--restart-app-server-only]",
|
|
187
187
|
summary: "Fetch provider models and inject them into Codex config.",
|
|
188
188
|
details: [
|
|
189
|
+
"A current Home catalog fans out to linked Children; --local-only disables fan-out and --json emits the result. Partial fan-out exits 6.",
|
|
190
|
+
"Fan-out never requests a Codex app or app-server restart on a Child; use GOAT or ocx sync --restart-codex on the Child. The Child's pinned sync may restart its OpenCodex client runtime after applying changed Home settings.",
|
|
189
191
|
"After writing the catalog, warns if long-lived Codex app-server processes are still running.",
|
|
192
|
+
"An update in flight or an unavailable update/sync mutex refuses without changes: update-in-flight, exit 7. Another sync reports sync-in-progress, exit 1.",
|
|
190
193
|
"--restart-codex restarts the app-servers AND fully quits and relaunches the Codex desktop app on macOS, Linux and Windows, after catalog/cache writes or a committed configuration change. It ends live conversations.",
|
|
191
194
|
"--restart-app-server-only keeps the narrow behaviour: SIGTERM to matching app-server / code-mode-host processes, desktop app left running. It wins over --restart-codex when both are given.",
|
|
192
195
|
"--restart-desktop-app is a deprecated alias of --restart-codex and prints a notice.",
|
|
@@ -290,8 +293,12 @@ export const CLI_COMMANDS: CliCommandEntry[] = [
|
|
|
290
293
|
},
|
|
291
294
|
{
|
|
292
295
|
name: "update",
|
|
293
|
-
usage: "ocx update [--tag latest|preview]",
|
|
296
|
+
usage: "ocx update [--tag latest|preview] | --plan --json [--tag latest|preview | --version <version>] | --yes --json [--tag latest|preview | --version <version>] [--expect-plan <token>] [--not-after <unix-ms>]",
|
|
294
297
|
summary: "Update opencodex. Preview installs stay on the preview tag unless overridden.",
|
|
298
|
+
details: [
|
|
299
|
+
"--plan --json previews an orchestrated update; --yes --json applies it. --expect-plan binds apply to the returned planToken; --not-after sets a Unix millisecond mutation deadline.",
|
|
300
|
+
"Orchestrated exit codes: 0 verified or up-to-date; 10 refused; 11 failed with previous version verified; 12 unverified or still running; 64 invalid usage.",
|
|
301
|
+
],
|
|
295
302
|
},
|
|
296
303
|
{
|
|
297
304
|
name: "provider",
|
|
@@ -372,7 +379,7 @@ export const CLI_COMMANDS: CliCommandEntry[] = [
|
|
|
372
379
|
usage: "ocx models <list|live|add|edit|remove|enable|disable|provider|selected|preset|context|shadow> ...",
|
|
373
380
|
summary: "List models and manage custom (manually registered) models.",
|
|
374
381
|
details: [
|
|
375
|
-
"List available models
|
|
382
|
+
"List available models: saved and router-known IDs include custom models and the process-local cache; models live reads the running proxy catalog.",
|
|
376
383
|
"add/remove support --live for the selected proxy; live or JSON removal requires --yes.",
|
|
377
384
|
"Local add/remove JSON reports saved state and opportunistic sync; no proxy keeps the save successful/pending.",
|
|
378
385
|
"display-name <provider/raw-model> --set <label> or --clear changes an exact upstream model label.",
|
|
@@ -731,10 +738,11 @@ export const CLI_COMMANDS: CliCommandEntry[] = [
|
|
|
731
738
|
},
|
|
732
739
|
{
|
|
733
740
|
name: "capabilities",
|
|
734
|
-
usage: "ocx capabilities [--json] [--mutating-only] [--route <path>]",
|
|
741
|
+
usage: "ocx capabilities [--json] [--contracts] [--mutating-only] [--route <path>]",
|
|
735
742
|
summary: "List the declared CLI capabilities and the management routes they drive.",
|
|
736
743
|
details: [
|
|
737
744
|
"The machine-readable surface index: start here when driving ocx programmatically instead of parsing help text.",
|
|
745
|
+
"--contracts lists supported versioned contracts; it cannot be combined with --route or --mutating-only.",
|
|
738
746
|
"--route <path> answers the inverse question: which commands drive this management route.",
|
|
739
747
|
],
|
|
740
748
|
},
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import type { ProxyRestartResult } from "./tray-proxy";
|
|
2
2
|
|
|
3
|
+
export type RestartSupervisor = "desktop" | "service";
|
|
4
|
+
|
|
5
|
+
/** Only the bound client's explicit refusal establishes a supervisor for sync. */
|
|
6
|
+
export function supervisedRestartRefusal(result: ProxyRestartResult): RestartSupervisor | null {
|
|
7
|
+
if (result.ok || result.phase !== "request" || !(result.error instanceof Error)) return null;
|
|
8
|
+
if (result.error.message === "restart_supervised_desktop") return "desktop";
|
|
9
|
+
if (result.error.message === "restart_supervised_service") return "service";
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function deferSupervisedRestart(result: ProxyRestartResult, notify: (supervisor: RestartSupervisor) => void): boolean {
|
|
14
|
+
const supervisor = supervisedRestartRefusal(result);
|
|
15
|
+
if (!supervisor) return false;
|
|
16
|
+
notify(supervisor);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
3
20
|
export const INCOMPLETE_INSTALL_RECOVERY = "If the installer already exited or failed, run `ocx status`, stop any running proxy through its owner (`ocx stop`, or its service or desktop app), then reinstall with the same package manager and start it again (see https://opencodex.me/troubleshooting/update-failed/).";
|
|
4
21
|
|
|
5
22
|
export function reportRestartFailure(result: Extract<ProxyRestartResult, { ok: false }>): void {
|
package/src/cli/root.ts
CHANGED
|
@@ -13,11 +13,13 @@ import { parseReadyArgs, type ReadyArgs } from "./ready";
|
|
|
13
13
|
import { parseResolveArgs, type ResolveArgs } from "./resolve";
|
|
14
14
|
import { parseStopApproval } from "./stop-approval";
|
|
15
15
|
import { parseSyncExpectation, SYNC_EXPECTATION_USAGE_EXIT } from "./sync-expectation";
|
|
16
|
+
import { parseSyncFanoutFlags } from "./sync-flags";
|
|
16
17
|
import { maybeAutoRestoreCodexShimAsync } from "./codex-shim-autorestore";
|
|
17
18
|
import { findCommand } from "./registry";
|
|
18
19
|
import { printUnknownCommand } from "./help-recovery";
|
|
19
20
|
import { noteCredentialArgv, redactSecretArgs } from "./secret-args";
|
|
20
21
|
import { maybeNoticeVersionSkew } from "./version-skew-notice";
|
|
22
|
+
import { isOrchestratedUpdateArgv } from "../update/orchestrated-arguments.mjs";
|
|
21
23
|
|
|
22
24
|
export interface CliHead {
|
|
23
25
|
kind: "version" | "help" | "ready" | "resolve" | "command";
|
|
@@ -40,6 +42,7 @@ export function parseCliHead(argv: string[]): CliHead {
|
|
|
40
42
|
const args = argv;
|
|
41
43
|
// Codex owns its forwarded grammar; wrapper documentation is `ocx help codex`.
|
|
42
44
|
if (command === "codex") return { kind: "command", command, args };
|
|
45
|
+
if (command === "update" && isOrchestratedUpdateArgv(args.slice(1))) return { kind: "command", command, args };
|
|
43
46
|
if (command === "--version" || command === "-v" || command === "version") {
|
|
44
47
|
return { kind: "version", command, args };
|
|
45
48
|
}
|
|
@@ -147,6 +150,11 @@ export async function runCli(argv: string[]): Promise<CliHead> {
|
|
|
147
150
|
}
|
|
148
151
|
// #7694: a malformed pinned sync is refused before any preflight reads or repairs anything.
|
|
149
152
|
if (head.command === "sync") {
|
|
153
|
+
const flags = parseSyncFanoutFlags(head.args.slice(1));
|
|
154
|
+
if (!flags.ok) {
|
|
155
|
+
console.error(flags.message);
|
|
156
|
+
process.exit(SYNC_EXPECTATION_USAGE_EXIT);
|
|
157
|
+
}
|
|
150
158
|
const pinned = parseSyncExpectation(head.args.slice(1));
|
|
151
159
|
if (!pinned.ok) {
|
|
152
160
|
console.error(pinned.message);
|
package/src/cli/stop-approval.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface GuardedStopSnapshot {
|
|
|
27
27
|
* inspection probe -- it carries no path, command line, stderr, or token.
|
|
28
28
|
*/
|
|
29
29
|
export type TrackedRuntimeCheck =
|
|
30
|
-
| { pid: number; port: number; hostname: string }
|
|
30
|
+
| { pid: number; port: number; hostname: string | undefined }
|
|
31
31
|
| { untracked: string }
|
|
32
32
|
| null;
|
|
33
33
|
|
|
@@ -145,7 +145,7 @@ export async function runApprovedStop(
|
|
|
145
145
|
return approvalChanged(`the tracked runtime record could not be verified (${target.untracked})`);
|
|
146
146
|
}
|
|
147
147
|
if (target.pid !== expected.pid || target.port !== expected.port
|
|
148
|
-
|| target.hostname !== expected.hostname) {
|
|
148
|
+
|| (target.hostname === undefined ? expected.hostname !== "127.0.0.1" : target.hostname !== expected.hostname)) {
|
|
149
149
|
return approvalChanged("the tracked runtime record changed");
|
|
150
150
|
}
|
|
151
151
|
if (manager.kind === "unknown") {
|