@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
|
@@ -12,7 +12,7 @@ export const FREE_PROVIDER_ACCESS_GROUPS = {
|
|
|
12
12
|
"cloudflare-ai", "cohere", "coze", "duckduckgo-web", "felo-web", "friendliai", "gemini", "github-models",
|
|
13
13
|
"groq", "hackclub", "huggingchat", "huggingface", "iflytek", "inference-net", "kiro", "liquid", "llm7",
|
|
14
14
|
"mistral", "morph", "muse-spark-web", "nara", "navy", "nlpcloud", "ollama-cloud", "opencode", "openrouter",
|
|
15
|
-
"ovhcloud", "pollinations", "puter", "qwen-web", "reka", "runcrate", "sambanova", "sparkdesk", "t3-web", "uncloseai",
|
|
15
|
+
"ovhcloud", "perch", "pollinations", "puter", "qwen-web", "reka", "runcrate", "sambanova", "sparkdesk", "t3-web", "uncloseai",
|
|
16
16
|
],
|
|
17
17
|
"recurring-uncapped": [
|
|
18
18
|
"agnes", "ainative", "aion", "baidu", "glm", "glm-cn", "kilo-gateway", "opencode-zen", "requesty",
|
|
@@ -204,7 +204,7 @@ const LABELS: Record<string, string> = {
|
|
|
204
204
|
gemini: "Google Gemini", "github-models": "GitHub Models", huggingchat: "HuggingChat", huggingface: "Hugging Face",
|
|
205
205
|
iflytek: "iFlytek", "inference-net": "Inference.net", llm7: "LLM7", "muse-spark-web": "Muse Spark Web",
|
|
206
206
|
nlpcloud: "NLP Cloud", "ollama-cloud": "Ollama Cloud", ovhcloud: "OVHcloud", "qwen-web": "Qwen Web",
|
|
207
|
-
"t3-web": "T3 Web", uncloseai: "UncloseAI", ainative: "AI Native", baidu: "Baidu Qianfan",
|
|
207
|
+
"t3-web": "T3 Web", uncloseai: "UncloseAI", perch: "Perch", ainative: "AI Native", baidu: "Baidu Qianfan",
|
|
208
208
|
glm: "Z.AI GLM", "glm-cn": "BigModel GLM (CN)", "kilo-gateway": "Kilo Gateway", "opencode-zen": "OpenCode Zen",
|
|
209
209
|
sealion: "SEA-LION", bytez: "Bytez", "nous-research": "Nous Research", agentrouter: "AgentRouter",
|
|
210
210
|
ai21: "AI21", baichuan: "Baichuan", crusoe: "Crusoe", deepinfra: "DeepInfra", deepseek: "DeepSeek", doubao: "Doubao",
|
|
@@ -19,9 +19,11 @@ function scopedFamily(row: Record<string, unknown>): "fable" | "opus" | "sonnet"
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Recognized rows supersede legacy duplicates even when skipped or malformed; duplicates
|
|
23
|
+
* and malformed shared measurements make family enumeration incomplete. Shared finite
|
|
24
|
+
* measurements apply regardless of the binding flag, though an unknown flag also makes
|
|
25
|
+
* enumeration incomplete. A null legacy five_hour requires an explicitly active session.
|
|
26
|
+
* Scoped rows retain active-only behavior; unknown kinds/families cannot clear refusals.
|
|
25
27
|
*/
|
|
26
28
|
export function anthropicUsageBuckets(body: Record<string, unknown>): {
|
|
27
29
|
buckets: AnthropicUsageBucket[]; familyEnumeration: boolean;
|
|
@@ -37,6 +39,14 @@ export function anthropicUsageBuckets(body: Record<string, unknown>): {
|
|
|
37
39
|
if (!row || !window) { familyEnumeration = false; continue; }
|
|
38
40
|
if (represented.has(window)) { familyEnumeration = false; continue; }
|
|
39
41
|
represented.add(window);
|
|
42
|
+
if (window === "5h" || window === "weekly") {
|
|
43
|
+
const flag = row.is_active;
|
|
44
|
+
if (flag !== undefined && typeof flag !== "boolean") familyEnumeration = false;
|
|
45
|
+
if (toFiniteNumber(row.percent) === undefined) { familyEnumeration = false; continue; }
|
|
46
|
+
if (window === "5h" && body.five_hour === null && flag !== true) continue;
|
|
47
|
+
selected.set(window, { window, row, percentField: "percent" });
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
40
50
|
if (row.is_active === false) continue;
|
|
41
51
|
if (row.is_active !== undefined && row.is_active !== true) { familyEnumeration = false; continue; }
|
|
42
52
|
if (toFiniteNumber(row.percent) === undefined) familyEnumeration = false;
|
|
@@ -1125,18 +1125,17 @@ export function isCanonicalCommandCodeBaseUrl(baseUrl: string): boolean {
|
|
|
1125
1125
|
return normalized === COMMAND_CODE_BASE_URL || normalized === `${COMMAND_CODE_BASE_URL}/provider/v1`;
|
|
1126
1126
|
}
|
|
1127
1127
|
|
|
1128
|
-
/**
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
// { usage: null, data: { usage: {...} } }
|
|
1128
|
+
/**
|
|
1129
|
+
* Pick the envelope carrying the legacy windows (weekly, 5h, total credits). The monthly
|
|
1130
|
+
* `usages` container is located separately, so its presence never hides a nested window.
|
|
1131
|
+
*/
|
|
1132
|
+
function kimiLegacyWindowBody(root: Record<string, unknown>): Record<string, unknown> {
|
|
1133
|
+
const nested = asRecord(root.data);
|
|
1134
|
+
if (!nested) return root;
|
|
1135
|
+
// A null outer field is a placeholder, not data — { usage: null, data: { usage: {...} } } unwraps.
|
|
1136
1136
|
const usable = (field: unknown): boolean => field !== undefined && field !== null;
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
return !outerHasUsage && nestedHasUsage ? nested : body;
|
|
1137
|
+
const hasLegacy = (body: Record<string, unknown>): boolean => usable(body.usage) || usable(body.limits) || usable(body.totalQuota);
|
|
1138
|
+
return !hasLegacy(root) && hasLegacy(nested) ? nested : root;
|
|
1140
1139
|
}
|
|
1141
1140
|
|
|
1142
1141
|
function kimiLimitLabel(item: Record<string, unknown>, detail: Record<string, unknown>): string {
|
|
@@ -1146,21 +1145,43 @@ function kimiLimitLabel(item: Record<string, unknown>, detail: Record<string, un
|
|
|
1146
1145
|
.toLowerCase();
|
|
1147
1146
|
}
|
|
1148
1147
|
|
|
1148
|
+
/** Highest percentage a window with a positive remainder may report; 100 means exhausted. */
|
|
1149
|
+
const KIMI_BELOW_EXHAUSTED_PERCENT = 99.999;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Counter-derived percentage, or undefined when the counters cannot be trusted. Any
|
|
1153
|
+
* exhaustion signal (used at or past the limit, or remaining at or below zero) wins first,
|
|
1154
|
+
* even beside an impossible companion counter: dropping it would let an over-quota account
|
|
1155
|
+
* look available. Otherwise a negative used or a remaining above the limit is impossible.
|
|
1156
|
+
* A positive remainder never rounds up to exhaustion.
|
|
1157
|
+
*/
|
|
1158
|
+
function kimiCounterPercent(row: Record<string, unknown>): number | undefined {
|
|
1159
|
+
const limit = toFiniteNumber(row.limit);
|
|
1160
|
+
if (limit === undefined || limit <= 0) return undefined;
|
|
1161
|
+
const used = toFiniteNumber(row.used);
|
|
1162
|
+
const remaining = toFiniteNumber(row.remaining);
|
|
1163
|
+
if ((used !== undefined && used >= limit) || (remaining !== undefined && remaining <= 0)) return 100;
|
|
1164
|
+
if ((used !== undefined && used < 0) || (remaining !== undefined && remaining > limit)) return undefined;
|
|
1165
|
+
if (used !== undefined) return (used / limit) * 100;
|
|
1166
|
+
if (remaining === undefined) return undefined;
|
|
1167
|
+
return Math.min(((limit - remaining) / limit) * 100, KIMI_BELOW_EXHAUSTED_PERCENT);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/** Parse consumed usage, preferring valid counters, then a valid [0, 1] ratio, then direct percentages. */
|
|
1149
1171
|
function parseKimiQuotaRow(value: unknown, resetFallback?: Record<string, unknown>): { percent: number; resetAt?: number } | null {
|
|
1150
1172
|
const row = asRecord(value);
|
|
1151
1173
|
if (!row) return null;
|
|
1152
1174
|
const resetAt = quotaResetAt(row) ?? (resetFallback ? quotaResetAt(resetFallback) : undefined);
|
|
1153
|
-
const
|
|
1154
|
-
if (
|
|
1155
|
-
|
|
1156
|
-
if (
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1175
|
+
const counterPercent = kimiCounterPercent(row);
|
|
1176
|
+
if (counterPercent !== undefined) {
|
|
1177
|
+
const percent = normalizePercent(counterPercent);
|
|
1178
|
+
if (percent !== undefined) return { percent, ...(resetAt !== undefined ? { resetAt } : {}) };
|
|
1179
|
+
}
|
|
1180
|
+
// Newer Kimi responses expose utilization as a fraction in [0, 1].
|
|
1181
|
+
const ratio = toFiniteNumber(row.used_ratio ?? row.usedRatio);
|
|
1182
|
+
if (ratio !== undefined && ratio >= 0 && ratio <= 1) {
|
|
1183
|
+
const percent = normalizePercent(ratio * 100);
|
|
1184
|
+
if (percent !== undefined) return { percent, ...(resetAt !== undefined ? { resetAt } : {}) };
|
|
1164
1185
|
}
|
|
1165
1186
|
// Some payloads expose utilisation directly when limit/used arithmetic is absent.
|
|
1166
1187
|
const direct = normalizePercent(row.utilization ?? row.percent ?? row.usedPercent ?? row.used_percent);
|
|
@@ -1181,11 +1202,22 @@ function isKimiWeeklyLimit(item: Record<string, unknown>, detail: Record<string,
|
|
|
1181
1202
|
return /weekly|7\s*(?:d|day)/.test(kimiLimitLabel(item, detail));
|
|
1182
1203
|
}
|
|
1183
1204
|
|
|
1205
|
+
/** Keep legacy windows separate and use the first parseable monthly row across supported envelopes. */
|
|
1184
1206
|
function parseKimiQuotaPayload(value: unknown): ProviderQuota | null {
|
|
1185
|
-
const
|
|
1186
|
-
if (!
|
|
1207
|
+
const root = asRecord(value);
|
|
1208
|
+
if (!root) return null;
|
|
1209
|
+
const body = kimiLegacyWindowBody(root);
|
|
1187
1210
|
let weekly = parseKimiQuotaRow(body.usage);
|
|
1188
1211
|
const total = parseKimiQuotaRow(body.totalQuota);
|
|
1212
|
+
const nested = asRecord(root.data);
|
|
1213
|
+
let monthly: { percent: number; resetAt?: number } | null = null;
|
|
1214
|
+
for (const container of [root, nested, asRecord(root.quota), asRecord(nested?.quota)]) {
|
|
1215
|
+
const usages = asRecord(container?.usages);
|
|
1216
|
+
if (!usages) continue;
|
|
1217
|
+
monthly = parseKimiQuotaRow(usages.limit_month_total ?? usages.monthTotal)
|
|
1218
|
+
?? parseKimiQuotaRow(usages.limit_month_code ?? usages.monthCode);
|
|
1219
|
+
if (monthly) break;
|
|
1220
|
+
}
|
|
1189
1221
|
let fiveHour: { percent: number; resetAt?: number } | null = null;
|
|
1190
1222
|
if (Array.isArray(body.limits)) {
|
|
1191
1223
|
for (const rawItem of body.limits) {
|
|
@@ -1211,6 +1243,10 @@ function parseKimiQuotaPayload(value: unknown): ProviderQuota | null {
|
|
|
1211
1243
|
weeklyPercent: weekly.percent,
|
|
1212
1244
|
...(weekly.resetAt !== undefined ? { weeklyResetAt: weekly.resetAt } : {}),
|
|
1213
1245
|
} : {}),
|
|
1246
|
+
...(monthly ? {
|
|
1247
|
+
monthlyPercent: monthly.percent,
|
|
1248
|
+
...(monthly.resetAt !== undefined ? { monthlyResetAt: monthly.resetAt } : {}),
|
|
1249
|
+
} : {}),
|
|
1214
1250
|
...(total ? { customWindows: [{ label: "Total subscription credits", percent: total.percent, ...(total.resetAt !== undefined ? { resetAt: total.resetAt } : {}) }] } : {}),
|
|
1215
1251
|
updatedAt: Date.now(),
|
|
1216
1252
|
};
|
|
@@ -324,8 +324,9 @@ export function dropLearnedUnsupportedReasoningEfforts(
|
|
|
324
324
|
): string[] {
|
|
325
325
|
if (efforts.length === 0) return [...efforts];
|
|
326
326
|
const key = metadataProviderKey(provider);
|
|
327
|
+
if (!key) return [...efforts];
|
|
327
328
|
const credential = credentialIdentity(provider);
|
|
328
|
-
if (!
|
|
329
|
+
if (!credential) return [...efforts];
|
|
329
330
|
const support = loadSupport();
|
|
330
331
|
if (support.size === 0) return [...efforts];
|
|
331
332
|
const kept = efforts.filter(effort => !support.has(supportKey(key, credential, modelId, effort)));
|
|
@@ -1046,6 +1046,15 @@ export const PROVIDER_REGISTRY_EXTENDED: readonly ProviderRegistryEntry[] = [
|
|
|
1046
1046
|
dashboardUrl: "https://console.mistral.ai/api-keys", defaultModel: "codestral-latest", promptCacheKey: true,
|
|
1047
1047
|
// Native text-only input enrolls this model in the existing vision sidecar.
|
|
1048
1048
|
modelInputModalities: { "zai-glm-5-3": ["text"] },
|
|
1049
|
+
// Images per request above the documented 8, measured on api.mistral.ai on 2026-11-04 as the
|
|
1050
|
+
// largest count accepted before a refusal (Flash answers HTTP 503, code 3800, at 21; Large 4
|
|
1051
|
+
// answers HTTP 400 at 101). GLM 5.3 Flash accepted every count tried, up to 256.
|
|
1052
|
+
modelCapabilities: {
|
|
1053
|
+
"deepseek-v4-1-flash-1017": { mistralMaxImages: 20 },
|
|
1054
|
+
"mistral-large-4": { mistralMaxImages: 100 },
|
|
1055
|
+
"mistral-large-4-0": { mistralMaxImages: 100 },
|
|
1056
|
+
"zai-glm-5-3-flash": { mistralMaxImages: 256 },
|
|
1057
|
+
},
|
|
1049
1058
|
},
|
|
1050
1059
|
{
|
|
1051
1060
|
id: "minimax", label: "MiniMax — Coding Plan", baseUrl: "https://api.minimax.io/v1", adapter: "openai-chat", authKind: "key",
|
|
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import type { GenerationContext } from "../lib/state-store-sweeper";
|
|
4
4
|
import { carryReplayRefusal, isNonReplayableResponse, markResponseNonReplayable } from "../lib/upstream-retry";
|
|
5
5
|
import { redactSecretString } from "../lib/redact";
|
|
6
|
+
import { errorDestinationText, providerErrorDestinationLabel } from "../lib/error-destination";
|
|
6
7
|
|
|
7
8
|
export const REQUEST_PACING_MAX_QUEUE_DEPTH = 256;
|
|
8
9
|
export const REQUEST_PACING_MAX_QUEUE_AGE_MS = 60_000;
|
|
@@ -49,8 +50,8 @@ export class RequestPacingQueueOverloadError extends Error {
|
|
|
49
50
|
public readonly retryAfterSeconds: number,
|
|
50
51
|
) {
|
|
51
52
|
super(reason === "keys_exhausted" ? "No eligible API key remains; wait for the provider cooldown before retrying" : reason === "queue_full"
|
|
52
|
-
? `request pacing queue for provider '${providerName}' is full`
|
|
53
|
-
: `request pacing queue for provider '${providerName}' exceeded the maximum queued age`);
|
|
53
|
+
? `request pacing queue for provider '${errorDestinationText(providerErrorDestinationLabel(providerName))}' is full`
|
|
54
|
+
: `request pacing queue for provider '${errorDestinationText(providerErrorDestinationLabel(providerName))}' exceeded the maximum queued age`);
|
|
54
55
|
this.name = "RequestPacingQueueOverloadError";
|
|
55
56
|
}
|
|
56
57
|
}
|
package/src/reasoning-effort.ts
CHANGED
|
@@ -153,8 +153,13 @@ export function sanitizeCodexReasoningEfforts(efforts: readonly string[] | undef
|
|
|
153
153
|
/**
|
|
154
154
|
* Provider/model configured reasoning levels for the Codex catalog. `undefined` means “no override”,
|
|
155
155
|
* while an empty array means “intentionally expose no effort control for this model”.
|
|
156
|
+
* Read-only callers can suppress stale-snapshot refresh without changing the returned ladder.
|
|
156
157
|
*/
|
|
157
|
-
export function configuredReasoningEfforts(
|
|
158
|
+
export function configuredReasoningEfforts(
|
|
159
|
+
provider: OcxProviderConfig,
|
|
160
|
+
modelId: string,
|
|
161
|
+
options?: { refreshMetadata?: boolean },
|
|
162
|
+
): string[] | undefined {
|
|
158
163
|
if (modelInList(provider.noReasoningModels, modelId)) return [];
|
|
159
164
|
const modelEfforts = modelRecordValue(provider.modelReasoningEfforts, modelId);
|
|
160
165
|
// Rungs this account actually had refused are removed for every ladder source (registry
|
|
@@ -180,7 +185,7 @@ export function configuredReasoningEfforts(provider: OcxProviderConfig, modelId:
|
|
|
180
185
|
// not request work.
|
|
181
186
|
const fromMetadata = reasoningEffortsFromMetadata(provider, modelId);
|
|
182
187
|
if (fromMetadata !== undefined) {
|
|
183
|
-
ensureReasoningMetadataSnapshot();
|
|
188
|
+
if (options?.refreshMetadata !== false) ensureReasoningMetadataSnapshot();
|
|
184
189
|
return dropLearnedUnsupportedReasoningEfforts(provider, modelId, healMappedTiers(provider, modelId, fromMetadata));
|
|
185
190
|
}
|
|
186
191
|
return undefined;
|
package/src/remote/hub-usage.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { USAGE_SOURCE_CLIENTS } from "../usage/source-filter";
|
|
2
3
|
|
|
3
4
|
export const MAX_HUB_USAGE_BYTES = 1024 * 1024;
|
|
4
5
|
const count = z.number().finite().nonnegative();
|
|
@@ -20,6 +21,8 @@ const hubUsageSchema = z.object({
|
|
|
20
21
|
days: z.array(z.object({ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/), ...costs })).max(366),
|
|
21
22
|
filter: z.object({ provider: label.nullable(), model: label.nullable(),
|
|
22
23
|
matched: z.boolean(), comboOverlap: z.boolean() }),
|
|
24
|
+
sourceFilter: z.object({ client: z.enum(USAGE_SOURCE_CLIENTS), scope: z.literal("authenticated-key") }).optional(),
|
|
25
|
+
legacyUnclassifiedRequests: count.optional(),
|
|
23
26
|
usageIncomplete: z.literal(true).optional(),
|
|
24
27
|
usageIncompleteReason: z.literal("oversized_rows").optional(),
|
|
25
28
|
});
|
|
@@ -39,6 +39,22 @@ function stripMarkdownCodeFence(text: string, toolName: string): string {
|
|
|
39
39
|
return match ? match[1] : text;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/** Repair one extra canonical wrapper inside an already unwrapped executable body. */
|
|
43
|
+
function repairUnwrappedBody(text: string, toolName: string): string {
|
|
44
|
+
if (toolName !== "exec" && toolName !== "apply_patch") return text;
|
|
45
|
+
try {
|
|
46
|
+
const nested: unknown = JSON.parse(text);
|
|
47
|
+
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
48
|
+
const record = nested as Record<string, unknown>;
|
|
49
|
+
const keys = Object.keys(record);
|
|
50
|
+
if (keys.length === 1 && keys[0] === "input" && typeof record.input === "string") text = record.input;
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
// Ordinary JavaScript and patches are not JSON wrappers.
|
|
54
|
+
}
|
|
55
|
+
return stripMarkdownCodeFence(text, toolName);
|
|
56
|
+
}
|
|
57
|
+
|
|
42
58
|
/** Unwrap the `{input:string}` function-call wrapper used for freeform tools. */
|
|
43
59
|
export function unwrapFreeformToolInput(argumentsText: unknown, toolName = ""): string {
|
|
44
60
|
if (typeof argumentsText !== "string") return "";
|
|
@@ -48,13 +64,13 @@ export function unwrapFreeformToolInput(argumentsText: unknown, toolName = ""):
|
|
|
48
64
|
const record = parsed as Record<string, unknown>;
|
|
49
65
|
if (Object.prototype.hasOwnProperty.call(record, "input")) {
|
|
50
66
|
return typeof record.input === "string"
|
|
51
|
-
?
|
|
67
|
+
? repairUnwrappedBody(record.input, toolName)
|
|
52
68
|
: argumentsText;
|
|
53
69
|
}
|
|
54
70
|
const fallbackKeys = freeformFallbackKeys(toolName);
|
|
55
71
|
const candidates = fallbackKeys.filter(key => typeof record[key] === "string");
|
|
56
72
|
if (candidates.length === 1) {
|
|
57
|
-
return
|
|
73
|
+
return repairUnwrappedBody(record[candidates[0]] as string, toolName);
|
|
58
74
|
}
|
|
59
75
|
}
|
|
60
76
|
} catch {
|
|
@@ -115,36 +131,46 @@ export function mayBecomePatchEnvelope(text: string): boolean {
|
|
|
115
131
|
}
|
|
116
132
|
|
|
117
133
|
/** Largest prefix of an exactly opened patch that completion cannot rewrite. */
|
|
118
|
-
export function stableCanonicalPatchPrefix(
|
|
134
|
+
export function stableCanonicalPatchPrefix(
|
|
135
|
+
text: string,
|
|
136
|
+
boundedTail = text,
|
|
137
|
+
openingValidated = false,
|
|
138
|
+
): string | null {
|
|
119
139
|
const lfOpening = `${PATCH_BEGIN}\n`;
|
|
120
140
|
const crlfOpening = `${PATCH_BEGIN}\r\n`;
|
|
121
|
-
if (!text.startsWith(lfOpening) && !text.startsWith(crlfOpening)) {
|
|
141
|
+
if (!openingValidated && !text.startsWith(lfOpening) && !text.startsWith(crlfOpening)) {
|
|
122
142
|
return lfOpening.startsWith(text) || crlfOpening.startsWith(text) ? "" : null;
|
|
123
143
|
}
|
|
124
144
|
|
|
125
|
-
let
|
|
145
|
+
let coreLength = text.length;
|
|
146
|
+
let tail = boundedTail;
|
|
126
147
|
let trailingBreak = "";
|
|
127
|
-
if (
|
|
128
|
-
|
|
148
|
+
if (tail.endsWith("\r\n")) {
|
|
149
|
+
coreLength -= 2;
|
|
150
|
+
tail = tail.slice(0, -2);
|
|
129
151
|
trailingBreak = "\r\n";
|
|
130
|
-
} else if (
|
|
131
|
-
|
|
152
|
+
} else if (tail.endsWith("\n")) {
|
|
153
|
+
coreLength -= 1;
|
|
154
|
+
tail = tail.slice(0, -1);
|
|
132
155
|
trailingBreak = "\n";
|
|
133
|
-
} else if (
|
|
156
|
+
} else if (tail.endsWith("\r")) {
|
|
134
157
|
// This may become the first byte of a CRLF. It is stable for a canonical
|
|
135
158
|
// closer, but must remain behind a decorated closer that may be rewritten.
|
|
136
|
-
|
|
159
|
+
coreLength -= 1;
|
|
160
|
+
tail = tail.slice(0, -1);
|
|
137
161
|
trailingBreak = "\r";
|
|
138
162
|
}
|
|
139
|
-
const lineStart = Math.max(core.lastIndexOf("\n"), core.lastIndexOf("\r")) + 1;
|
|
140
|
-
const line = core.slice(lineStart);
|
|
141
|
-
if (!line.startsWith(PATCH_END)) return text;
|
|
142
|
-
|
|
143
|
-
const suffix = line.slice(PATCH_END.length);
|
|
144
163
|
const decoration = " ***";
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
164
|
+
// Only a partial terminal decoration can be rewritten at completion. Match its
|
|
165
|
+
// bounded tail instead of searching the complete accumulated patch on every delta.
|
|
166
|
+
for (let suffixLength = decoration.length; suffixLength > 0; suffixLength--) {
|
|
167
|
+
const candidate = PATCH_END + decoration.slice(0, suffixLength);
|
|
168
|
+
if (!tail.endsWith(candidate)) continue;
|
|
169
|
+
const lineStart = coreLength - candidate.length;
|
|
170
|
+
const preceding = tail[tail.length - candidate.length - 1];
|
|
171
|
+
if (lineStart === 0 || preceding === "\n" || preceding === "\r") {
|
|
172
|
+
return text.slice(0, lineStart + PATCH_END.length);
|
|
173
|
+
}
|
|
148
174
|
}
|
|
149
175
|
return text;
|
|
150
176
|
}
|
|
@@ -21,6 +21,10 @@ function plainUserText(item: unknown): string | null {
|
|
|
21
21
|
return texts.join("\n");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export function isLocalCompactionCheckpoint(input: unknown): boolean {
|
|
25
|
+
return Array.isArray(input) && plainUserText(input.at(-1))?.trim() === COMPACT_PROMPT;
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
function isContext(text: string): boolean {
|
|
25
29
|
const head = text.trimStart();
|
|
26
30
|
return head.startsWith("<") || head.startsWith("# AGENTS.md") || head.startsWith("# Context from my IDE");
|
|
@@ -44,7 +48,7 @@ export function frameCompactionHistory<T extends { input?: unknown; instructions
|
|
|
44
48
|
if (!Array.isArray(input) || input.some(item => isRecord(item) && item.type === "compaction_trigger")) return body;
|
|
45
49
|
// Codex local compaction appends this user prompt without a compaction_trigger.
|
|
46
50
|
// Keep that summarizer turn free of generation-only continuation instructions.
|
|
47
|
-
if (
|
|
51
|
+
if (isLocalCompactionCheckpoint(input)) return body;
|
|
48
52
|
let checkpointIndex = -1;
|
|
49
53
|
for (let index = input.length - 1; index >= 0; index--) {
|
|
50
54
|
if (isCheckpoint(input[index])) {
|
|
@@ -56,7 +56,9 @@ const NEVER = -2;
|
|
|
56
56
|
export type FreeformWrapperScan =
|
|
57
57
|
| { kind: "hold" }
|
|
58
58
|
| { kind: "raw" }
|
|
59
|
-
|
|
59
|
+
// `canonical` is false for a fallback field, which a closed object resolved and trailing text
|
|
60
|
+
// can still withdraw; an own `input` is decided by its prefix and stays decided.
|
|
61
|
+
| { kind: "input"; valueStart: number; canonical: boolean };
|
|
60
62
|
|
|
61
63
|
/** Index of the first non-whitespace character at or after `from`, or HOLD past the end. */
|
|
62
64
|
function skipWhitespace(text: string, from: number): number {
|
|
@@ -249,7 +251,7 @@ export function scanFreeformWrapper(text: string, fallbackKeys: readonly string[
|
|
|
249
251
|
// non-string value is decidable too, in the other direction: completion hands back the
|
|
250
252
|
// argument text unchanged rather than unwrapping a value it cannot use.
|
|
251
253
|
return bounded[valueAt] === '"'
|
|
252
|
-
? { kind: "input", valueStart: valueAt + 1 }
|
|
254
|
+
? { kind: "input", valueStart: valueAt + 1, canonical: true }
|
|
253
255
|
: { kind: "raw" };
|
|
254
256
|
}
|
|
255
257
|
|
|
@@ -300,7 +302,7 @@ function afterTopLevelClose(
|
|
|
300
302
|
if (!wholeText) return { kind: "hold" };
|
|
301
303
|
const candidates = fallbackKeys.filter(key => members.get(key)?.stringValue === true);
|
|
302
304
|
if (candidates.length === 1) {
|
|
303
|
-
return { kind: "input", valueStart: members.get(candidates[0]!)!.valueStart };
|
|
305
|
+
return { kind: "input", valueStart: members.get(candidates[0]!)!.valueStart, canonical: false };
|
|
304
306
|
}
|
|
305
307
|
return { kind: "raw" };
|
|
306
308
|
}
|