@bitkyc08/opencodex 2.84.0 → 2.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/bin/ocx.mjs +61 -3
- package/gui/dist/assets/App-ZfYbLHkB.js +58 -0
- package/gui/dist/assets/App-wT3mXqFz.css +1 -0
- package/gui/dist/assets/{Tray-C9TGtwad.js → Tray-DCd-A1az.js} +1 -1
- package/gui/dist/assets/index-CfYDMj34.js +94 -0
- package/gui/dist/assets/index-DPeB9HpV.css +1 -0
- package/gui/dist/assets/quota-summary-ChvmKGOk.js +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -2
- package/src/adapters/anthropic/beta-allowlist.ts +91 -11
- package/src/adapters/anthropic/beta-body-pairs.ts +93 -0
- package/src/adapters/anthropic/client-identity.ts +1 -1
- package/src/adapters/anthropic/passthrough.ts +16 -3
- package/src/adapters/anthropic-progress.ts +84 -0
- package/src/adapters/anthropic.ts +108 -21
- package/src/adapters/azure.ts +19 -1
- package/src/adapters/base.ts +2 -0
- package/src/adapters/claude-cli/adapter.ts +111 -23
- package/src/adapters/claude-cli/profiles.ts +2 -1
- package/src/adapters/claude-cli/stable-replay.ts +108 -0
- package/src/adapters/claude-cli/usage-admission.ts +230 -0
- package/src/adapters/client-fingerprint.ts +24 -0
- package/src/adapters/coding-agent/protocol.ts +1 -1
- package/src/adapters/coding-agent/turn.ts +40 -11
- package/src/adapters/cursor/arg-codec.ts +17 -5
- package/src/adapters/cursor/catalog.ts +8 -0
- package/src/adapters/cursor/effort-map.ts +3 -0
- package/src/adapters/cursor/freeform-args.ts +75 -0
- package/src/adapters/cursor/protobuf-events.ts +36 -23
- package/src/adapters/dsh-account.ts +97 -0
- package/src/adapters/google-antigravity-wire.ts +22 -1
- package/src/adapters/google.ts +37 -10
- package/src/adapters/openai-chat/messages.ts +4 -3
- package/src/adapters/openai-chat/passthrough.ts +8 -2
- package/src/adapters/openai-chat/reasoning-replay.ts +52 -0
- package/src/adapters/openai-chat/response-events.ts +59 -1
- package/src/adapters/openai-chat.ts +8 -5
- package/src/adapters/openai-responses/compaction-search-history.ts +14 -7
- package/src/adapters/openai-responses/passthrough.ts +57 -125
- package/src/adapters/openai-responses/request-strips.ts +25 -3
- package/src/adapters/openai-responses/transport.ts +81 -0
- package/src/adapters/qoder/adapter.ts +44 -3
- package/src/adapters/registry.ts +5 -0
- package/src/adapters/zed.ts +26 -1
- package/src/advisor/activity.ts +55 -0
- package/src/advisor/budget.ts +62 -0
- package/src/advisor/consult.ts +223 -0
- package/src/advisor/context.ts +238 -0
- package/src/advisor/disclosure.ts +20 -0
- package/src/advisor/evidence-tool.ts +21 -0
- package/src/advisor/evidence.ts +117 -0
- package/src/advisor/runtime.ts +353 -0
- package/src/advisor/settings.ts +144 -0
- package/src/advisor/state.ts +369 -0
- package/src/advisor/synthetic-tool.ts +33 -0
- package/src/bridge/errors.ts +24 -1
- package/src/bridge/internal.ts +3 -1
- package/src/bridge/response-json.ts +18 -3
- package/src/bridge/sse.ts +58 -8
- package/src/bridge/terminal-refusal.ts +59 -0
- package/src/chat/inbound.ts +30 -6
- package/src/chat/outbound.ts +5 -0
- package/src/claude/desktop-3p-library.ts +72 -7
- package/src/claude/desktop-3p.ts +75 -19
- package/src/claude/desktop-first-party.ts +1 -1
- package/src/claude/desktop-picker-platform.ts +4 -0
- package/src/claude/desktop-picker-profile.ts +11 -4
- package/src/claude/desktop-picker.ts +15 -8
- package/src/claude/desktop-profile.ts +10 -1
- package/src/claude/desktop-remote-store-io.ts +5 -3
- package/src/claude/desktop-system-proxy.ts +50 -4
- package/src/claude/inbound-content-options.ts +11 -0
- package/src/claude/inbound.ts +154 -50
- package/src/claude/intercept/local-ca.ts +8 -1
- package/src/claude/intercept/picker-ca-startup.ts +2 -1
- package/src/claude/intercept/picker-runtime.ts +6 -5
- package/src/claude/intercept/picker-trust-windows.ts +338 -0
- package/src/claude/intercept/picker-trust.ts +19 -0
- package/src/claude/intercept/port-policy.ts +30 -0
- package/src/claude/intercept/runtime.ts +97 -94
- package/src/claude/model-default-settings.ts +154 -0
- package/src/claude/model-info.ts +7 -7
- package/src/claude/outbound.ts +51 -19
- package/src/cli/account-api.ts +1 -0
- package/src/cli/account-policy-dto.ts +6 -0
- package/src/cli/account-policy.ts +34 -5
- package/src/cli/account-preservation.ts +44 -0
- package/src/cli/account.ts +8 -2
- package/src/cli/advisor.ts +165 -0
- package/src/cli/auxiliary-listener-preflight.ts +37 -0
- package/src/cli/capabilities-accounts.ts +20 -1
- package/src/cli/capabilities-agents-routing.ts +23 -2
- package/src/cli/capabilities-base.ts +39 -11
- package/src/cli/capabilities-observe-system.ts +63 -3
- package/src/cli/capabilities-provider-models.ts +11 -0
- package/src/cli/chatgpt-command.ts +35 -14
- package/src/cli/claude.ts +46 -6
- package/src/cli/codex-cli-update.ts +151 -41
- package/src/cli/codex-provider.ts +44 -0
- package/src/cli/combo-input.ts +10 -1
- package/src/cli/combo-result.ts +1 -1
- package/src/cli/combo.ts +2 -1
- package/src/cli/cross-home-owner.ts +17 -14
- package/src/cli/dispatch.ts +30 -5
- package/src/cli/doctor.ts +15 -1
- package/src/cli/ensure-desktop-cold-start.ts +382 -0
- package/src/cli/export-command.ts +1 -1
- package/src/cli/help.ts +4 -2
- package/src/cli/index.ts +14 -5
- package/src/cli/integration-plan-dto.ts +3 -0
- package/src/cli/log-history.ts +172 -0
- package/src/cli/models-runtime-subcommands.ts +1 -0
- package/src/cli/models-runtime.ts +72 -8
- package/src/cli/observe-stream.ts +2 -0
- package/src/cli/observe.ts +16 -4
- package/src/cli/provider.ts +27 -5
- package/src/cli/registry.ts +41 -9
- package/src/cli/restart-scope.ts +3 -1
- package/src/cli/runtime-api.ts +5 -3
- package/src/cli/system-command.ts +40 -8
- package/src/cli/uninstall-client-state.ts +32 -0
- package/src/cli/usage-compare.ts +309 -0
- package/src/cli/usage-model-search.ts +4 -4
- package/src/cli/usage-report.ts +2 -2
- package/src/cli/v2.ts +1 -1
- package/src/client/machine-listener.ts +1 -3
- package/src/client/runtime.ts +1 -0
- package/src/clients/client-path.ts +51 -0
- package/src/clients/config-export/contracts.ts +3 -1
- package/src/clients/config-export/model-metadata.ts +3 -2
- package/src/clients/config-export/qoder.ts +93 -0
- package/src/clients/config-export.ts +35 -48
- package/src/clients/gentle-shell-path.ts +87 -0
- package/src/codex/account-auto-switch.ts +2 -0
- package/src/codex/account-identity.ts +29 -0
- package/src/codex/account-label.ts +1 -1
- package/src/codex/account-lifecycle.ts +21 -5
- package/src/codex/account-preservation.ts +28 -0
- package/src/codex/account-use-remaining.ts +23 -0
- package/src/codex/app-server-processes.ts +97 -7
- package/src/codex/app-server-restart-service.ts +55 -4
- package/src/codex/auth-api/account-list.ts +4 -0
- package/src/codex/auth-api/account-pause-group.ts +6 -50
- package/src/codex/auth-api/account-preservation.ts +57 -0
- package/src/codex/auth-api/pool-mode-gate.ts +5 -2
- package/src/codex/auth-api/routes.ts +8 -0
- package/src/codex/auth-api/use-remaining-route.ts +36 -0
- package/src/codex/auth-api.ts +0 -1
- package/src/codex/auth-context.ts +81 -7
- package/src/codex/autostart-health.ts +4 -0
- package/src/codex/catalog/auto-review.ts +20 -3
- package/src/codex/catalog/build-entries.ts +19 -2
- package/src/codex/catalog/combo-member.ts +14 -5
- package/src/codex/catalog/configured-tiers.ts +50 -0
- package/src/codex/catalog/effort.ts +4 -1
- package/src/codex/catalog/gather-capture.ts +2 -0
- package/src/codex/catalog/metadata.ts +11 -9
- package/src/codex/catalog/model-hints.ts +42 -19
- package/src/codex/catalog/model-visibility.ts +3 -1
- package/src/codex/catalog/native-ultrafast.ts +106 -0
- package/src/codex/catalog/parsing.ts +35 -86
- package/src/codex/catalog/provider-models.ts +40 -34
- package/src/codex/catalog/retained-sync.ts +2 -0
- package/src/codex/catalog/routed-gather.ts +33 -16
- package/src/codex/catalog/vendor-context.ts +82 -0
- package/src/codex/cli-install-provenance.ts +105 -17
- package/src/codex/cli-update-plan.ts +545 -0
- package/src/codex/config-write-lock.ts +63 -4
- package/src/codex/convergence.ts +2 -0
- package/src/codex/desktop-app/picker-freshness.ts +96 -0
- package/src/codex/desktop-app/types.ts +2 -0
- package/src/codex/desktop-app/windows.ts +29 -16
- package/src/codex/desktop-app-restart.ts +25 -2
- package/src/codex/desktop-compatibility/certificate-service.ts +99 -0
- package/src/codex/desktop-compatibility/certificate-store.ts +193 -0
- package/src/codex/desktop-compatibility/connection-store.ts +87 -0
- package/src/codex/desktop-compatibility/installed-build.ts +73 -0
- package/src/codex/desktop-compatibility/json-body.ts +29 -0
- package/src/codex/desktop-compatibility/native-identity.ts +62 -0
- package/src/codex/desktop-compatibility/relay-listener.ts +93 -0
- package/src/codex/desktop-compatibility/routing-binding.ts +10 -0
- package/src/codex/desktop-compatibility/routing-preflight.ts +69 -0
- package/src/codex/desktop-compatibility/runtime-ownership.ts +28 -0
- package/src/codex/desktop-compatibility/runtime.ts +182 -0
- package/src/codex/desktop-compatibility/service.ts +30 -0
- package/src/codex/desktop-compatibility/startup-settings.ts +50 -0
- package/src/codex/desktop-compatibility/usage-activation.ts +86 -0
- package/src/codex/desktop-compatibility/usage-controlled-fetch.ts +59 -0
- package/src/codex/desktop-compatibility/usage-controller.ts +107 -0
- package/src/codex/desktop-compatibility/usage-policy.ts +59 -0
- package/src/codex/desktop-compatibility/usage-refresh.ts +33 -0
- package/src/codex/desktop-compatibility/usage-sse-controller.ts +86 -0
- package/src/codex/desktop-compatibility/windows-activation-source.ts +44 -0
- package/src/codex/desktop-compatibility/windows-certificate-trust.ts +81 -0
- package/src/codex/desktop-compatibility/windows-key-protection.ts +165 -0
- package/src/codex/desktop-compatibility/windows-package-command.ts +86 -0
- package/src/codex/desktop-compatibility/windows-package-launch.ts +28 -0
- package/src/codex/features.ts +85 -45
- package/src/codex/history-provider.ts +1 -1
- package/src/codex/inject/config-write-section.ts +4 -1
- package/src/codex/inject/history-failure.ts +27 -0
- package/src/codex/inject/remove.ts +18 -6
- package/src/codex/inject/restore.ts +24 -2
- package/src/codex/inject/routing-classify.ts +4 -3
- package/src/codex/inject.ts +18 -27
- package/src/codex/journal.ts +16 -1
- package/src/codex/main-account-hard-lock.ts +30 -1
- package/src/codex/main-account.ts +99 -15
- package/src/codex/native-main-refresh-mode.ts +217 -0
- package/src/codex/native-profile-startup.ts +1 -1
- package/src/codex/ocx-compaction-history.ts +12 -10
- package/src/codex/paths.ts +86 -1
- package/src/codex/provider-routing.ts +174 -0
- package/src/codex/refresh.ts +2 -2
- package/src/codex/routing/health-store.ts +2 -2
- package/src/codex/routing/pool-recovery.ts +79 -0
- package/src/codex/routing/selection.ts +4 -3
- package/src/codex/routing/thread-affinity.ts +1 -1
- package/src/codex/shim-diagnostics.ts +6 -0
- package/src/codex/shim-overlay.ts +7 -2
- package/src/codex/signed-in-identity.ts +43 -0
- package/src/codex/subagent-model-fallback.ts +1 -1
- package/src/codex/sync.ts +6 -1
- package/src/codex/user-identity.ts +16 -5
- package/src/codex/windows-local-appdata.ts +84 -0
- package/src/combos/failover.ts +6 -1
- package/src/combos/index.ts +1 -0
- package/src/combos/resolve.ts +46 -10
- package/src/combos/types.ts +15 -0
- package/src/config/diagnostics.ts +35 -7
- package/src/config/live-reconcile.ts +51 -2
- package/src/config/load-degrade.ts +23 -1
- package/src/config/opencode-wire-upgrade.ts +54 -0
- package/src/config/opencode-zen-upgrade.ts +52 -0
- package/src/config/owner-registry.ts +22 -17
- package/src/config/paths.ts +10 -3
- package/src/config/provider-validation.ts +45 -2
- package/src/config/schema/config-schema.ts +39 -0
- package/src/config/schema/desktop-compatibility.ts +9 -0
- package/src/config/schema/leaf-validators.ts +39 -9
- package/src/config/schema/main-account-hard-lock-fallback.ts +26 -0
- package/src/config/schema/native-reasoning-retention.ts +26 -0
- package/src/config.ts +2 -0
- package/src/generated/compatibility-version.json +962 -350
- package/src/generated/model-metadata.ts +1 -1
- package/src/grok/sync.ts +1 -1
- package/src/images/loop.ts +46 -8
- package/src/integrations/catalog-refresh.ts +1 -1
- package/src/integrations/config-io.ts +20 -2
- package/src/integrations/journal.ts +15 -1
- package/src/integrations/mutation-plan.ts +2 -0
- package/src/integrations/registry.ts +15 -0
- package/src/integrations/store.ts +3 -0
- package/src/integrations/writer.ts +10 -1
- package/src/lib/advisor-activation.ts +16 -0
- package/src/lib/background-work.ts +65 -0
- package/src/lib/bounded-file-read.ts +58 -0
- package/src/lib/bun-path-runtime.d.mts +10 -1
- package/src/lib/bun-path-runtime.mjs +62 -3
- package/src/lib/codex-restart-contract.ts +15 -0
- package/src/lib/desktop-proxy-route.ts +30 -0
- package/src/lib/desktop-upstream-tunnel.ts +72 -0
- package/src/lib/empty-tool-catalog.ts +62 -0
- package/src/lib/errors.ts +26 -3
- package/src/lib/gcp-adc.ts +96 -9
- package/src/lib/gcp-credential-input.ts +12 -0
- package/src/lib/lab-live-route-production.ts +5 -0
- package/src/lib/local-internal-call-capability.ts +55 -0
- package/src/lib/opaque-proxy-tunnel.ts +217 -0
- package/src/lib/package-tree-integrity.ts +2 -2
- package/src/lib/redact.ts +2 -2
- package/src/lib/socks5-fetch.ts +48 -71
- package/src/lib/socks5-handshake.ts +112 -0
- package/src/lib/translator-budget.ts +7 -1
- package/src/oauth/account-quota-rank.ts +69 -2
- package/src/oauth/anthropic-account-refusal.ts +20 -2
- package/src/oauth/anthropic-oauth-definitions.ts +3 -1
- package/src/oauth/anthropic-routing.ts +1 -21
- package/src/oauth/anthropic.ts +38 -7
- package/src/oauth/callback-server.ts +27 -1
- package/src/oauth/chatgpt-device.ts +1 -1
- package/src/oauth/chatgpt-shared.ts +83 -0
- package/src/oauth/chatgpt.ts +8 -72
- package/src/oauth/dsh.ts +203 -0
- package/src/oauth/generic-account-failover.ts +62 -12
- package/src/oauth/generic-session-affinity.ts +125 -0
- package/src/oauth/index.ts +188 -111
- package/src/oauth/kiro-device-login.ts +2 -1
- package/src/oauth/kiro.ts +7 -1
- package/src/oauth/local-token-detect.ts +21 -1
- package/src/oauth/login-cli-errors.ts +44 -0
- package/src/oauth/login-cli.ts +69 -7
- package/src/oauth/login-flow-state.ts +371 -23
- package/src/oauth/meta-muse-errors.ts +41 -0
- package/src/oauth/meta-muse-keychain.ts +52 -0
- package/src/oauth/meta-muse.ts +51 -84
- package/src/oauth/model-discovery-auth.ts +3 -0
- package/src/oauth/pool-settings-capability.ts +4 -2
- package/src/oauth/refresh-flight-retirement.ts +48 -0
- package/src/oauth/session-affinity-key.ts +23 -0
- package/src/oauth/store-anthropic-instance.ts +9 -2
- package/src/oauth/store.ts +12 -5
- package/src/protocols/codecs/chat-ir.ts +467 -0
- package/src/protocols/codecs/chat.ts +10 -1
- package/src/protocols/codecs/messages-ir.ts +500 -0
- package/src/protocols/encoders/adapter-events.ts +5 -4
- package/src/protocols/encoders/messages.ts +9 -6
- package/src/protocols/features.ts +10 -2
- package/src/protocols/path.ts +11 -1
- package/src/protocols/plan-snapshot.ts +39 -16
- package/src/protocols/plan.ts +9 -1
- package/src/protocols/provider-summary.ts +2 -1
- package/src/protocols/settings.ts +8 -0
- package/src/providers/antigravity-account-roster.ts +102 -0
- package/src/providers/antigravity-models.ts +85 -7
- package/src/providers/api-key-cooldowns.ts +49 -0
- package/src/providers/api-key-resolve.ts +11 -6
- package/src/providers/api-key-response-ownership.ts +57 -0
- package/src/providers/api-key-selection.ts +31 -6
- package/src/providers/api-keys.ts +214 -3
- package/src/providers/claude-cli-usage.ts +96 -0
- package/src/providers/dsh-account-destination.ts +31 -0
- package/src/providers/dsh-account-models.ts +41 -0
- package/src/providers/gcp-credential-cleanup.ts +59 -0
- package/src/providers/key-failover.ts +54 -50
- package/src/providers/key-store.ts +7 -2
- package/src/providers/model-rename-fields.ts +5 -0
- package/src/providers/model-rename-migration.ts +7 -5
- package/src/providers/openai-tiers-destination.ts +11 -2
- package/src/providers/openai-tiers.ts +5 -12
- package/src/providers/opencode-go-transport.ts +3 -1
- package/src/providers/quota/account-cache.ts +6 -5
- package/src/providers/quota/account-row.ts +34 -0
- package/src/providers/quota/antigravity.ts +28 -7
- package/src/providers/quota/dsh-account.ts +70 -0
- package/src/providers/quota/vendor-probes-oauth.ts +1 -93
- package/src/providers/quota-types.ts +2 -0
- package/src/providers/quota.ts +14 -20
- package/src/providers/registry/entries-core.ts +44 -14
- package/src/providers/registry/entries-extended.ts +19 -0
- package/src/providers/registry/types.ts +1 -1
- package/src/providers/request-pacing.ts +77 -19
- package/src/providers/routed-config.ts +339 -0
- package/src/providers/service-tier.ts +2 -1
- package/src/quota/window-mapping.ts +5 -2
- package/src/responses/anthropic-progress.ts +34 -0
- package/src/responses/assistant-replay.ts +35 -0
- package/src/responses/compaction-history-framing.ts +65 -0
- package/src/responses/compaction.ts +6 -1
- package/src/responses/incomplete-reason.ts +31 -0
- package/src/responses/parser.ts +78 -22
- package/src/responses/reasoning-envelope.ts +4 -0
- package/src/responses/reasoning-replay-cache.ts +24 -2
- package/src/responses/reasoning-retention.ts +173 -0
- package/src/responses/retained-compaction.ts +46 -0
- package/src/responses/schema.ts +23 -0
- package/src/responses/state.ts +32 -29
- package/src/router.ts +8 -321
- package/src/routing/health.ts +37 -22
- package/src/routing/history/build-file.ts +92 -0
- package/src/routing/history/indexer.ts +254 -221
- package/src/routing/history/ingest.ts +242 -0
- package/src/routing/history/rebuild-job.ts +111 -0
- package/src/routing/history/rebuild-protocol.ts +15 -0
- package/src/routing/history/rebuild-worker.ts +34 -0
- package/src/routing/profile.ts +1 -1
- package/src/server/admission-model-scope.ts +21 -1
- package/src/server/antigravity-direct-eligibility.ts +208 -0
- package/src/server/auth-cors.ts +15 -0
- package/src/server/chat-completions.ts +82 -10
- package/src/server/chat-native-reasoning.ts +123 -0
- package/src/server/chat-native-sse.ts +110 -7
- package/src/server/chat-native.ts +76 -17
- package/src/server/claude-messages.ts +164 -433
- package/src/server/effort-policy.ts +1 -1
- package/src/server/images.ts +15 -2
- package/src/server/index/desktop-compatibility-startup.ts +56 -0
- package/src/server/index/model-alias-id.ts +36 -0
- package/src/server/index/optional-listeners.ts +2 -0
- package/src/server/index/serve-options.ts +11 -3
- package/src/server/index/startup-warnings.ts +11 -0
- package/src/server/index/websocket-handler.ts +9 -0
- package/src/server/index.ts +14 -11
- package/src/server/inference/advisor-diagnostics.ts +31 -0
- package/src/server/inference/client-encoder-delivery.ts +6 -5
- package/src/server/login-shell-path.ts +146 -0
- package/src/server/management/advisor-routes.ts +202 -0
- package/src/server/management/agent-settings-routes.ts +22 -4
- package/src/server/management/claude-desktop-picker-routes.ts +1 -1
- package/src/server/management/combo-routes.ts +176 -50
- package/src/server/management/companion-routes.ts +4 -0
- package/src/server/management/config-routes.ts +77 -6
- package/src/server/management/context.ts +4 -0
- package/src/server/management/cursor-integration-routes.ts +1 -1
- package/src/server/management/desktop-compatibility-routes.ts +46 -0
- package/src/server/management/desktop-compatibility-runtime-routes.ts +46 -0
- package/src/server/management/desktop-compatibility-settings-routes.ts +27 -0
- package/src/server/management/model-routes.ts +13 -8
- package/src/server/management/model-rows.ts +14 -0
- package/src/server/management/native-integration-routes.ts +2 -7
- package/src/server/management/native-reasoning-retention-routes.ts +41 -0
- package/src/server/management/oauth-account-routes.ts +87 -14
- package/src/server/management/protocol-settings-patch.ts +1 -0
- package/src/server/management/provider-gcp-credential-routes.ts +29 -0
- package/src/server/management/provider-key-pacing-routes.ts +31 -0
- package/src/server/management/provider-overwrite-carry.ts +7 -0
- package/src/server/management/provider-routes.ts +25 -30
- package/src/server/management/route-registry.ts +21 -1
- package/src/server/management/sibling-guard.ts +1 -0
- package/src/server/management-api.ts +9 -1
- package/src/server/messages-antigravity-direct.ts +195 -0
- package/src/server/messages-native-tool-guard.ts +185 -0
- package/src/server/messages-native.ts +106 -22
- package/src/server/messages-shared.ts +431 -0
- package/src/server/relay.ts +1 -1
- package/src/server/request-log-terminal-status.ts +1 -1
- package/src/server/request-log.ts +13 -1
- package/src/server/responses/account-change-state.ts +8 -2
- package/src/server/responses/adapter-continuation.ts +48 -19
- package/src/server/responses/adapter-delivery.ts +43 -8
- package/src/server/responses/adapter-dispatch.ts +48 -4
- package/src/server/responses/advisor-plan-slot.ts +27 -0
- package/src/server/responses/advisor-retention.ts +117 -0
- package/src/server/responses/advisor-slot.ts +368 -0
- package/src/server/responses/code-mode-collab-surface.ts +116 -8
- package/src/server/responses/codex-ws-wire.ts +15 -8
- package/src/server/responses/compact.ts +303 -125
- package/src/server/responses/compaction-recovery.ts +18 -10
- package/src/server/responses/compaction-retention.ts +61 -0
- package/src/server/responses/context-overflow.ts +11 -6
- package/src/server/responses/core-auth.ts +6 -0
- package/src/server/responses/core-codex-account.ts +11 -1
- package/src/server/responses/core-combo-failure.ts +12 -1
- package/src/server/responses/core-combo.ts +141 -36
- package/src/server/responses/core-errors.ts +3 -3
- package/src/server/responses/core-lifetime.ts +7 -2
- package/src/server/responses/core-normalize.ts +11 -0
- package/src/server/responses/core-opaque-recovery.ts +35 -0
- package/src/server/responses/core-options.ts +51 -0
- package/src/server/responses/core-pipeline.ts +141 -0
- package/src/server/responses/core-replay.ts +25 -6
- package/src/server/responses/core.ts +3 -116
- package/src/server/responses/fetch-helpers.ts +73 -19
- package/src/server/responses/main-hard-lock-routing.ts +109 -0
- package/src/server/responses/native-response-control.ts +4 -2
- package/src/server/responses/passthrough-delivery.ts +19 -11
- package/src/server/responses/passthrough-dispatch.ts +29 -16
- package/src/server/responses/request-prepare.ts +144 -17
- package/src/server/responses/request-sidecar-auth.ts +2 -2
- package/src/server/responses/request-transport.ts +120 -27
- package/src/server/responses/response-effects.ts +1 -0
- package/src/server/responses/run-turn-execution.ts +166 -38
- package/src/server/responses/sidecar-execution.ts +98 -5
- package/src/server/responses/terminal-guard.ts +4 -17
- package/src/server/responses-undeclared-tool-guard.ts +30 -9
- package/src/server/startup-action-control.ts +16 -2
- package/src/server/startup-health-cache.ts +1 -0
- package/src/service/auth-preflight.ts +71 -0
- package/src/service/cli.ts +4 -2
- package/src/service/definition.ts +97 -0
- package/src/service/desktop-startup.ts +14 -0
- package/src/service/guards.ts +1 -61
- package/src/service/health-sentinel-linux.ts +112 -0
- package/src/service/health-sentinel-main.ts +99 -61
- package/src/service/health-sentinel-probe.ts +24 -7
- package/src/service/health.ts +5 -89
- package/src/service/launchd.ts +27 -7
- package/src/service/logging.ts +135 -0
- package/src/service/repair.ts +2 -1
- package/src/service/state.ts +7 -8
- package/src/service/systemd.ts +1 -1
- package/src/service/windows-guarded-manager.ts +2 -1
- package/src/service/windows-ops.ts +1 -1
- package/src/service/windows-scheduler.ts +2 -7
- package/src/service/windows-taskxml.ts +2 -2
- package/src/service/windows-wscript.ts +14 -0
- package/src/service.ts +4 -2
- package/src/sidecar/auth.ts +2 -0
- package/src/tray/windows-tray.ps1 +43 -24
- package/src/types/config.ts +124 -6
- package/src/types/opencode-go.ts +61 -0
- package/src/types/opencode-zen.ts +29 -0
- package/src/types/provider.ts +39 -6
- package/src/types/request.ts +38 -2
- package/src/types/tools.ts +2 -0
- package/src/types/wire.ts +29 -37
- package/src/types.ts +1 -0
- package/src/update/async-check.ts +1 -1
- package/src/update/badge.ts +2 -2
- package/src/update/index.ts +88 -15
- package/src/update/job-supervised-restart.ts +107 -0
- package/src/update/job.ts +32 -32
- package/src/update/notify.ts +1 -1
- package/src/update/npm-invocation.mjs +12 -2
- package/src/update/refresh-scheduler.ts +2 -2
- package/src/update/supervised-recovery.d.mts +27 -0
- package/src/update/supervised-recovery.mjs +157 -0
- package/src/usage/cache-diagnostic.ts +2 -0
- package/src/usage/cost.ts +48 -12
- package/src/usage/expected-prices.ts +15 -0
- package/src/usage/ledger-retention.ts +2 -1
- package/src/usage/ledger-scanner.ts +6 -5
- package/src/usage/log.ts +17 -8
- package/src/usage/summary.ts +22 -9
- package/src/usage/user-cost-overlays.ts +14 -19
- package/src/usage/user-cost-validation.ts +38 -0
- package/src/vision/eligibility.ts +13 -0
- package/src/web-search/gemini-executor.ts +2 -2
- package/src/web-search/loop.ts +55 -5
- package/src/web-search/progress-stream.ts +4 -1
- package/src/web-search/run-turn-loop.ts +9 -1
- package/assets/sponsors/packycode.png +0 -0
- package/gui/dist/assets/App-CSJvmjNs.css +0 -1
- package/gui/dist/assets/App-CZtqiGcw.js +0 -56
- package/gui/dist/assets/index-BB6uK6tU.css +0 -1
- package/gui/dist/assets/index-CTm4l-HQ.js +0 -94
- package/gui/dist/assets/quota-summary-BbEeRfPY.js +0 -1
package/src/types/config.ts
CHANGED
|
@@ -30,6 +30,11 @@ export interface OcxProtocolsConfig {
|
|
|
30
30
|
managedMessagesNativeOAuth?: boolean;
|
|
31
31
|
/** Chat and Messages clients are encoded directly from adapter events. */
|
|
32
32
|
directEncoders?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Chat requests to a concrete Google Antigravity route decode straight into the IR and are
|
|
35
|
+
* answered through the direct encoders, with no internal Responses body in either direction.
|
|
36
|
+
*/
|
|
37
|
+
antigravityDirect?: boolean;
|
|
33
38
|
/** Compare the dispatch plan with the observed path; never sends a second request. */
|
|
34
39
|
shadowPlan?: boolean;
|
|
35
40
|
};
|
|
@@ -344,6 +349,12 @@ export interface OcxApiKeyEntry {
|
|
|
344
349
|
* that is the only point at which the model about to be billed is known.
|
|
345
350
|
*/
|
|
346
351
|
allowedModels?: string[];
|
|
352
|
+
/**
|
|
353
|
+
* Lets this key reach combo targets marked `metered`. Absent means no: an issued key stops
|
|
354
|
+
* at the last unmetered target. The environment token never qualifies. A loopback bind
|
|
355
|
+
* reads no key; local operator consent is instead declared on the combo.
|
|
356
|
+
*/
|
|
357
|
+
allowMeteredComboTargets?: boolean;
|
|
347
358
|
}
|
|
348
359
|
|
|
349
360
|
export interface OcxPendingApiKeyRotation {
|
|
@@ -564,6 +575,21 @@ export interface OcxConfig {
|
|
|
564
575
|
};
|
|
565
576
|
/** Enable the shipped model alias patterns for providers without an override. */
|
|
566
577
|
defaultModelAliases?: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* When `true`, the raw OpenAI-compatible `/v1/models` list publishes a safe alias (e.g.
|
|
580
|
+
* `SEK-glm-4.7-flash`) as the row `id` instead of `provider/nativeId`
|
|
581
|
+
* (e.g. `Seek/glm-4.7-flash`). The original `provider/nativeId` moves to a
|
|
582
|
+
* new `native_id` field so clients that need it can still read it.
|
|
583
|
+
*
|
|
584
|
+
* **Default: `false`** — the historical `provider/nativeId` form remains the
|
|
585
|
+
* published `id`, and the alias is in the informational `alias_of` field.
|
|
586
|
+
*
|
|
587
|
+
* Codex (`client_version`) and Anthropic-specific discovery retain their own
|
|
588
|
+
* identities and are unchanged. Ambiguous or shadowed short aliases retain the
|
|
589
|
+
* qualified ID, as do aliases with unparseable synthetic Fast siblings.
|
|
590
|
+
* Existing requests using `provider/nativeId` continue to work unchanged.
|
|
591
|
+
*/
|
|
592
|
+
preferModelAliasIds?: boolean;
|
|
567
593
|
/**
|
|
568
594
|
* Opt-in Cursor Private Inference compatibility rows. When true, `/v1/models`
|
|
569
595
|
* adds `<base-id>--<effort>` selectors for reasoning-capable model ids absent
|
|
@@ -581,12 +607,13 @@ export interface OcxConfig {
|
|
|
581
607
|
/**
|
|
582
608
|
* Opt-in Ultra Fast service tier, default off.
|
|
583
609
|
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
* `ultrafast` the
|
|
589
|
-
*
|
|
610
|
+
* On native GPT-6 Astra and GPT-6.1 Sol rows (bare and account-bound), the flag adds the
|
|
611
|
+
* Ultrafast speed choice OpenAI documents for those two models, so the Codex picker offers
|
|
612
|
+
* it even though `model_catalog_json` replaces ChatGPT's live, plan-aware model list
|
|
613
|
+
* (`src/codex/catalog/native-ultrafast.ts`). On routed rows it still never invents a tier:
|
|
614
|
+
* it keeps an `ultrafast` the operator configured from being stripped on regeneration
|
|
615
|
+
* (PR #2994 was closed for adding one the wire could not honor). Turning it off withdraws
|
|
616
|
+
* the generated native tier on the next catalog write.
|
|
590
617
|
*/
|
|
591
618
|
ultraFastTier?: boolean;
|
|
592
619
|
/**
|
|
@@ -599,6 +626,22 @@ export interface OcxConfig {
|
|
|
599
626
|
codexMainAccountHardLock?: boolean;
|
|
600
627
|
/** Per-window percentages: short defaults to 90, long to 98; integers 80..100, short <= long. */
|
|
601
628
|
codexMainAccountHardLockThresholds?: { short?: number; long?: number };
|
|
629
|
+
/**
|
|
630
|
+
* Extended hard-lock settings: while the lock blocks and no Codex account can serve a
|
|
631
|
+
* qualifying request, the request reroutes to `model` (with `reasoningEffort` when set)
|
|
632
|
+
* instead of failing. The lock itself stays on and releases on its own as before; an
|
|
633
|
+
* absent section or model means the refusal behavior is unchanged.
|
|
634
|
+
*/
|
|
635
|
+
codexMainAccountHardLockFallback?: { enabled?: boolean; model?: string; reasoningEffort?: string };
|
|
636
|
+
/**
|
|
637
|
+
* Who refreshes the native main ChatGPT login in CODEX_HOME (#2999). "codex" asks the Codex
|
|
638
|
+
* binary through app-server `getAuthStatus` and never writes auth.json; "opencodex" keeps the
|
|
639
|
+
* guarded writer. Absent means "codex" when a Codex binary at or above the supported version
|
|
640
|
+
* is found, otherwise "opencodex". "codex" also falls back when no such binary exists.
|
|
641
|
+
*/
|
|
642
|
+
nativeMainRefresh?: "codex" | "opencodex";
|
|
643
|
+
/** Use included quota to 100% for these accounts; preserves thresholds and credit-spending policy. */
|
|
644
|
+
codexUseRemainingQuotaAccountIds?: string[];
|
|
602
645
|
/** Explicit top-level deletion intent used by stale whole-config rebases. */
|
|
603
646
|
configRebaseProvenance?: OcxConfigRebaseProvenance | Record<string, unknown>;
|
|
604
647
|
/** OpenAI provider-contract migration marker (v2 = single `openai` provider with account mode). */
|
|
@@ -770,6 +813,15 @@ export interface OcxConfig {
|
|
|
770
813
|
};
|
|
771
814
|
/** Opt-in failure-only recovery; never replaces the initial compaction model. */
|
|
772
815
|
compactionRecovery?: { enabled: boolean; model: string; allowDevinInvalidArgument?: boolean };
|
|
816
|
+
/** Explicit opt-in (enabled === true), default off, for routed v1/v2 readable reasoning retention.
|
|
817
|
+
* Defaults: 20% of the compacting model's context window and 100,000 tokens (the smaller limit).
|
|
818
|
+
* Unknown windows use maxTokens alone; overflow is archived locally with a path notice.
|
|
819
|
+
* Native and opaque compaction output keep their existing protocols. */
|
|
820
|
+
reasoningRetention?: { enabled?: boolean; maxContextPercent?: number; maxTokens?: number };
|
|
821
|
+
/** Canonical ChatGPT reasoning replay allowances; both default off. */
|
|
822
|
+
nativeReasoningRetention?: { modelSwitch?: boolean; accountSwitch?: boolean };
|
|
823
|
+
/** Explicit opt-in; resumes Observe only using an existing trusted certificate and endpoints. */
|
|
824
|
+
desktopCompatibility?: { startOnProxyStart: boolean };
|
|
773
825
|
/**
|
|
774
826
|
* Destination model for Codex's own memory pipeline, per phase
|
|
775
827
|
* (src/server/responses/memory-models.ts).
|
|
@@ -827,6 +879,19 @@ export interface OcxConfig {
|
|
|
827
879
|
/** Optional override of intercepted source-model prefixes (default: gpt-6-luna, gpt-5.6-luna). */
|
|
828
880
|
sourceModels?: string[];
|
|
829
881
|
};
|
|
882
|
+
/**
|
|
883
|
+
* Global auto-review (approval reviewer) selector for every catalog row, written by the
|
|
884
|
+
* Models settings panel. During catalog sync OpenCodex stamps it as
|
|
885
|
+
* `auto_review_model_override` on rows that carry no provider-scoped stamp, so an enabled block
|
|
886
|
+
* wins over Codex's own root `auto_review_model`; disabling it restores that fallback.
|
|
887
|
+
* `autoReviewModel` keeps its precedence on its own provider's rows.
|
|
888
|
+
*/
|
|
889
|
+
autoReviewOverride?: {
|
|
890
|
+
/** When true, the configured model replaces the reviewer on every unowned row. */
|
|
891
|
+
enabled?: boolean;
|
|
892
|
+
/** Public catalog selector in `provider/model` form; blank or absent clears the override. */
|
|
893
|
+
model?: string;
|
|
894
|
+
};
|
|
830
895
|
/**
|
|
831
896
|
* Optional map of blocked model IDs to their replacement model IDs.
|
|
832
897
|
* When configured, incoming requests targeting a blocked model (including
|
|
@@ -1028,6 +1093,16 @@ export interface OcxConfig {
|
|
|
1028
1093
|
cacheRetention?: "none" | "short" | "long";
|
|
1029
1094
|
/** Web-search sidecar: route web_search for non-OpenAI models through a gpt-mini via ChatGPT passthrough. */
|
|
1030
1095
|
webSearchSidecar?: OcxWebSearchSidecarConfig;
|
|
1096
|
+
/**
|
|
1097
|
+
* Advisor sidecar: an OpenCodex-owned expert consultation runtime. The proxy injects a synthetic
|
|
1098
|
+
* `advisor` tool into routed worker turns, executes the configured expert model itself (loopback
|
|
1099
|
+
* through the normal routing authority, so the advisor may be ANY routable provider/model), and
|
|
1100
|
+
* reinjects the advice so the original worker continues. `policy: "preflight"` additionally
|
|
1101
|
+
* attempts one automatic consultation per task without worker cooperation, once the task has
|
|
1102
|
+
* produced orientation evidence. Task context is sent only after
|
|
1103
|
+
* `contextSharingConsent` is the current version; `enabled` does not grant that consent.
|
|
1104
|
+
*/
|
|
1105
|
+
advisor?: OcxAdvisorConfig;
|
|
1031
1106
|
/** Vision sidecar: describe images via a gpt vision model so text-only models can "see" them. */
|
|
1032
1107
|
visionSidecar?: OcxVisionSidecarConfig;
|
|
1033
1108
|
/** /v1/images relay for codex's built-in image_gen tool. */
|
|
@@ -1182,6 +1257,8 @@ export interface OcxConfig {
|
|
|
1182
1257
|
autoSwitchThreshold?: number;
|
|
1183
1258
|
/** Opt-in: return bound quota-strategy tasks to recovered higher-priority accounts. */
|
|
1184
1259
|
codexAccountPriorityFailback?: boolean;
|
|
1260
|
+
/** Prefer other identities, reserving the current native sign-in as pool fallback. */
|
|
1261
|
+
codexPreserveSignedInAccount?: boolean;
|
|
1185
1262
|
/** New-session account rotation strategy for the Codex pool. Default quota (today's behaviour). */
|
|
1186
1263
|
accountPoolStrategy?: OcxAccountPoolRotationStrategy | "reset-first";
|
|
1187
1264
|
/** Successful new-session binds retained on one round-robin selection. Default 1; range 1..100. */
|
|
@@ -1313,10 +1390,18 @@ export interface OcxComboTarget {
|
|
|
1313
1390
|
* see `OcxComboConfig.cooldownWaitPolicy` (#5691).
|
|
1314
1391
|
*/
|
|
1315
1392
|
lastResort?: boolean;
|
|
1393
|
+
/**
|
|
1394
|
+
* Pay-per-use target (for example an API-key row behind subscription targets). Only the
|
|
1395
|
+
* configured keys with `allowMeteredComboTargets: true`, or a loopback-only combo
|
|
1396
|
+
* with `allowMeteredTargets: true`, may reach it.
|
|
1397
|
+
*/
|
|
1398
|
+
metered?: boolean;
|
|
1316
1399
|
}
|
|
1317
1400
|
|
|
1318
1401
|
export interface OcxComboConfig {
|
|
1319
1402
|
targets: OcxComboTarget[];
|
|
1403
|
+
/** Operator consent for metered targets on a loopback-only proxy. Default false; public listeners still require key consent. */
|
|
1404
|
+
allowMeteredTargets?: boolean;
|
|
1320
1405
|
/** Ordered failover (default), round-robin, weighted random, least-used, or quota reset-window selection. */
|
|
1321
1406
|
strategy?: OcxComboStrategy;
|
|
1322
1407
|
/** Successful requests retained on one RR selection batch. Default 1; range 1..100. */
|
|
@@ -1552,6 +1637,39 @@ export interface OcxVisionSidecarConfig {
|
|
|
1552
1637
|
timeoutMs?: number;
|
|
1553
1638
|
}
|
|
1554
1639
|
|
|
1640
|
+
/**
|
|
1641
|
+
* Advisor sidecar configuration. Automatic triggers require deterministic task evidence.
|
|
1642
|
+
*/
|
|
1643
|
+
export interface OcxAdvisorConfig {
|
|
1644
|
+
/** Master switch. Default: false — the advisor stays off the request path entirely. */
|
|
1645
|
+
enabled?: boolean;
|
|
1646
|
+
/**
|
|
1647
|
+
* The expert model consulted by the sidecar. Any model string the routing authority accepts:
|
|
1648
|
+
* a bare native model ("gpt-6-astra"), an explicit "provider/model" ("anthropic/claude-...",
|
|
1649
|
+
* "xai/grok-..."), or an account-qualified native model ("<namespace>/gpt-6-astra").
|
|
1650
|
+
*/
|
|
1651
|
+
model?: string;
|
|
1652
|
+
/** Reasoning effort for the advisor call. Validated against the canonical effort ladder. */
|
|
1653
|
+
effort?: "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
|
|
1654
|
+
/**
|
|
1655
|
+
* When the advisor is consulted. "manual" (default): only when the worker explicitly calls the
|
|
1656
|
+
* synthetic `advisor` tool. "preflight": OpenCodex additionally attempts one automatic
|
|
1657
|
+
* consultation per task once the task has produced orientation evidence (an assistant tool call
|
|
1658
|
+
* or a tool result after the latest user message).
|
|
1659
|
+
*/
|
|
1660
|
+
policy?: "manual" | "preflight" | "adaptive";
|
|
1661
|
+
/** Adaptive task consultation attempts (manual + automatic). Integer 1–3, default 3. */
|
|
1662
|
+
maxConsultationsPerTask?: number;
|
|
1663
|
+
/** Advisor fetch timeout (ms). Default 120000. */
|
|
1664
|
+
timeoutMs?: number;
|
|
1665
|
+
/**
|
|
1666
|
+
* Operator consent to send task conversation and tool results to the configured Advisor
|
|
1667
|
+
* provider. Only `"v1"` is current. Absent or any other value means the runtime must not
|
|
1668
|
+
* send task context. `enabled: true` does not grant this, and upgrades do not write it.
|
|
1669
|
+
*/
|
|
1670
|
+
contextSharingConsent?: "v1";
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1555
1673
|
export interface OcxWebSearchSidecarConfig {
|
|
1556
1674
|
/** Explicit Anthropic account pool; unset inherits the request's instance. */
|
|
1557
1675
|
anthropicInstance?: AnthropicInstanceId;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Exact-model protocols from https://opencode.ai/v2/docs/console/go/#endpoints (2026-10-15).
|
|
2
|
+
* Unknown models retain Chat. Responses entries are overridable registry defaults;
|
|
3
|
+
* the native wires are hard pins because modelAdapters cannot select those adapters.
|
|
4
|
+
*/
|
|
5
|
+
export const OPENCODE_GO_BASE_URL = "https://opencode.ai/zen/go/v1";
|
|
6
|
+
|
|
7
|
+
export const OPENCODE_GO_MODEL_WIRES: Readonly<Record<string, "google" | "anthropic" | "openai-responses">> = Object.freeze({
|
|
8
|
+
"gemini-4-argon-contributor": "google",
|
|
9
|
+
"claude-haiku-5-5": "anthropic",
|
|
10
|
+
"minimax-m2.7": "anthropic",
|
|
11
|
+
"minimax-m3": "anthropic",
|
|
12
|
+
"qwen3.7-plus": "anthropic",
|
|
13
|
+
"qwen3.8-max": "anthropic",
|
|
14
|
+
"qwen3.8-flash": "anthropic",
|
|
15
|
+
"gpt-6-luna": "openai-responses",
|
|
16
|
+
"gpt-5.6-luna": "openai-responses",
|
|
17
|
+
"grok-4.6": "openai-responses",
|
|
18
|
+
"grok-4.7": "openai-responses",
|
|
19
|
+
"muse-spark-1.2-contributor": "openai-responses",
|
|
20
|
+
"muse-spark-1.3-contributor": "openai-responses",
|
|
21
|
+
// Retain previously supported Go models absent from the current endpoint table (#4847).
|
|
22
|
+
"minimax-m2.5": "anthropic",
|
|
23
|
+
"union-alpha": "anthropic",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** Compatibility: these five pins predate destination scoping. New native pins require Go. */
|
|
27
|
+
export const OPENCODE_GO_LEGACY_NAME_PINS: ReadonlySet<string> = new Set([
|
|
28
|
+
"claude-haiku-5-5", "minimax-m2.5", "minimax-m2.7", "minimax-m3", "union-alpha",
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
export const OPENCODE_GO_RESPONSES_DEFAULTS = Object.freeze(Object.fromEntries(
|
|
32
|
+
Object.entries(OPENCODE_GO_MODEL_WIRES).filter(([, wire]) => wire === "openai-responses"),
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
export interface OpenCodeGoDestination {
|
|
36
|
+
readonly baseUrl?: unknown;
|
|
37
|
+
readonly authMode?: unknown;
|
|
38
|
+
readonly googleMode?: unknown;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** A provider name alone must never authorize redirecting a credential to OpenCode. */
|
|
42
|
+
export function isOpenCodeGoGeminiDestination(provider: OpenCodeGoDestination | undefined): boolean {
|
|
43
|
+
if (!provider || typeof provider.baseUrl !== "string") return false;
|
|
44
|
+
if (provider.authMode !== undefined && provider.authMode !== "key") return false;
|
|
45
|
+
if (provider.googleMode !== undefined && provider.googleMode !== "ai-studio") return false;
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(provider.baseUrl.trim());
|
|
48
|
+
return url.origin === "https://opencode.ai"
|
|
49
|
+
&& !url.username && !url.password && !url.search && !url.hash
|
|
50
|
+
&& ["/zen/go/v1", "/inference/go/v1"].includes(url.pathname.replace(/\/+$/, ""));
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Return the fixed Gemini endpoint only for the exact model and an eligible Go destination. */
|
|
57
|
+
export function openCodeGoGeminiEndpoint(provider: OpenCodeGoDestination, modelId: string): string | undefined {
|
|
58
|
+
return Object.hasOwn(OPENCODE_GO_MODEL_WIRES, modelId) && OPENCODE_GO_MODEL_WIRES[modelId] === "google" && isOpenCodeGoGeminiDestination(provider)
|
|
59
|
+
? `https://opencode.ai/inference/go/v1/models/${encodeURIComponent(modelId)}`
|
|
60
|
+
: undefined;
|
|
61
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Fixed-key OpenCode Zen destinations exposing the native Gemini endpoint. */
|
|
2
|
+
export interface OpenCodeZenDestination {
|
|
3
|
+
readonly baseUrl?: unknown;
|
|
4
|
+
readonly authMode?: unknown;
|
|
5
|
+
readonly googleMode?: unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function openCodeZenBaseUrl(provider: OpenCodeZenDestination | undefined): string | undefined {
|
|
9
|
+
if (!provider || typeof provider.baseUrl !== "string") return undefined;
|
|
10
|
+
if (provider.authMode !== undefined && provider.authMode !== "key") return undefined;
|
|
11
|
+
if (provider.googleMode !== undefined && provider.googleMode !== "ai-studio") return undefined;
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(provider.baseUrl.trim());
|
|
14
|
+
const pathname = url.pathname.replace(/\/+$/, "");
|
|
15
|
+
if (url.origin !== "https://opencode.ai" || url.username || url.password || url.search || url.hash) return undefined;
|
|
16
|
+
if (pathname !== "/zen/v1" && pathname !== "/inference/v1") return undefined;
|
|
17
|
+
return url.origin + pathname;
|
|
18
|
+
} catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Keep the selected destination; Zen omits AI Studio's /v1beta segment. */
|
|
24
|
+
export function openCodeZenGeminiEndpoint(provider: OpenCodeZenDestination, modelId: string): string | undefined {
|
|
25
|
+
const baseUrl = openCodeZenBaseUrl(provider);
|
|
26
|
+
return baseUrl && modelId.toLowerCase().startsWith("gemini-")
|
|
27
|
+
? baseUrl + "/models/" + encodeURIComponent(modelId)
|
|
28
|
+
: undefined;
|
|
29
|
+
}
|
package/src/types/provider.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface ProviderApiKeySelection {
|
|
|
14
14
|
entryId?: string;
|
|
15
15
|
reference?: string;
|
|
16
16
|
revision?: string;
|
|
17
|
+
/** Request-local allocation; does not replace the saved active key. */
|
|
18
|
+
distributed?: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export interface OpenRouterProviderRouting {
|
|
@@ -164,16 +166,25 @@ export interface ProviderWebSearchBridgeConfig {
|
|
|
164
166
|
endpoint?: string;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
/** Optional user-owned prompt-length policy; rates are USD per 1M tokens. */
|
|
170
|
+
export type PromptLengthPricing =
|
|
171
|
+
| { mode: "automatic" }
|
|
172
|
+
| { mode: "flat" }
|
|
173
|
+
| {
|
|
174
|
+
mode: "custom";
|
|
175
|
+
thresholdTokens: number;
|
|
176
|
+
comparison: "gt" | "gte";
|
|
177
|
+
rates: { input: number; output: number; cacheRead: number; cacheWrite: number };
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/** Complete base rates for one model, with automatic pricing when policy is absent. */
|
|
172
181
|
export interface ProviderCostOverlay {
|
|
173
182
|
input: number;
|
|
174
183
|
output: number;
|
|
175
184
|
cacheRead: number;
|
|
176
185
|
cacheWrite: number;
|
|
186
|
+
/** Absent means automatic vendor prompt-length pricing. */
|
|
187
|
+
promptLengthPricing?: PromptLengthPricing;
|
|
177
188
|
}
|
|
178
189
|
|
|
179
190
|
export interface RequestPacingRule {
|
|
@@ -190,6 +201,10 @@ export interface ProviderRequestPacingConfig extends RequestPacingRule {
|
|
|
190
201
|
enabled: boolean;
|
|
191
202
|
/** Exact upstream model-id overrides; other models inherit the provider rule. */
|
|
192
203
|
models?: Record<string, RequestPacingRule>;
|
|
204
|
+
/** Normal request allocation, separate from cooldown recovery ordering. */
|
|
205
|
+
keySelection?: "active" | "round-robin";
|
|
206
|
+
/** Additional uniform limits per pool credential, across all models. */
|
|
207
|
+
keys?: RequestPacingRule;
|
|
193
208
|
}
|
|
194
209
|
|
|
195
210
|
export interface FastWire {
|
|
@@ -432,6 +447,11 @@ export interface OcxProviderConfig {
|
|
|
432
447
|
* to extract turn provenance (#6220).
|
|
433
448
|
*/
|
|
434
449
|
preserveResponsesMessageMetadata?: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Opt in to lossy hosted-search history notes on ordinary canonical Codex Lite requests.
|
|
452
|
+
* Default off; only literal true enables it, and non-Lite/native compact stay unchanged.
|
|
453
|
+
*/
|
|
454
|
+
projectResponsesLiteHostedSearchHistory?: boolean;
|
|
435
455
|
/**
|
|
436
456
|
* Treat this provider's `modelReasoningEfforts` as authoritative at the wire, not only in the
|
|
437
457
|
* catalog. Adapters that ship their own per-model effort table (currently `command-code`)
|
|
@@ -453,6 +473,10 @@ export interface OcxProviderConfig {
|
|
|
453
473
|
* compaction blobs. Absent or false degrades foreign blobs to an opaque note.
|
|
454
474
|
*/
|
|
455
475
|
decodesNativeCompactionBlobs?: boolean;
|
|
476
|
+
/** Accept native Responses v2 `input` compaction_trigger items. Responses adapter only. */
|
|
477
|
+
supportsNativeCompactionTrigger?: boolean;
|
|
478
|
+
/** Serve native Responses v1 /responses/compact. Responses adapter only; no auth authority. */
|
|
479
|
+
supportsNativeCompactEndpoint?: boolean;
|
|
456
480
|
/**
|
|
457
481
|
* Trust this direct key-auth Responses provider to consume or relay opaque encrypted
|
|
458
482
|
* V2 agent tasks. OpenCodex does not decrypt, translate, or recover an eligible task.
|
|
@@ -622,6 +646,11 @@ export interface OcxProviderConfig {
|
|
|
622
646
|
contextWindow?: number;
|
|
623
647
|
/** Per-model fallback when context metadata is absent; otherwise caps the reported window. */
|
|
624
648
|
modelContextWindows?: Record<string, number>;
|
|
649
|
+
/**
|
|
650
|
+
* Custom providers only, default off: fill a missing context window from bundled model-ID
|
|
651
|
+
* metadata before the Context cap / 128k fallback. An estimate, not verified relay capacity.
|
|
652
|
+
*/
|
|
653
|
+
inferContextWindow?: boolean;
|
|
625
654
|
/** Per-model Copilot upstream tier; only the github-copilot route sends it. */
|
|
626
655
|
modelContextTiers?: Record<string, "default" | "long_context">;
|
|
627
656
|
/** Model-specific Codex catalog input modalities, e.g. ["text"] or ["text", "image"]. */
|
|
@@ -639,6 +668,8 @@ export interface OcxProviderConfig {
|
|
|
639
668
|
* Responses `max_output_tokens`. Adapters still let an explicit request win.
|
|
640
669
|
*/
|
|
641
670
|
defaultMaxOutputTokens?: number;
|
|
671
|
+
/** Opt-in Azure Responses floor for explicit positive output budgets; may raise the caller cap. */
|
|
672
|
+
minMaxOutputTokens?: number;
|
|
642
673
|
/** Model-specific fallback output token budgets. Exact/model-pattern entries beat the provider default. */
|
|
643
674
|
modelMaxOutputTokens?: Record<string, number>;
|
|
644
675
|
/**
|
|
@@ -705,12 +736,14 @@ export interface OcxProviderConfig {
|
|
|
705
736
|
/** Kiro OAuth only: active serving requests per account, 1..100. */
|
|
706
737
|
maxConcurrentPerAccount?: number;
|
|
707
738
|
enabled?: boolean;
|
|
739
|
+
/** Opt-in process-local conversation ownership; requires proactive enablement. */
|
|
740
|
+
sessionAffinity?: "conversation" | "none";
|
|
708
741
|
/**
|
|
709
742
|
* Generic OAuth pool selection strategy (#695). Persisted through the pool-settings
|
|
710
743
|
* contract. Consumed by the selector only while `pool.kernel` is on; with the flag off
|
|
711
744
|
* it is still merely persisted, so omitted and set behave the same.
|
|
712
745
|
*/
|
|
713
|
-
strategy?: "quota" | "round-robin" | "fill-first" | "least-loaded";
|
|
746
|
+
strategy?: "quota" | "round-robin" | "fill-first" | "reset-first" | "least-loaded";
|
|
714
747
|
/**
|
|
715
748
|
* 0-100 usage percent at which fill-first advances off the active account (#695).
|
|
716
749
|
* Read only under `pool.kernel` with `strategy: "fill-first"`; 80 when unset, matching
|
package/src/types/request.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { KiroOAuthMetadata } from "../oauth/types";
|
|
|
2
2
|
import type { NativeReasoningOwner } from "../responses/reasoning-replay-cache";
|
|
3
3
|
import type { OcxTool, OcxToolChoice } from "./tools";
|
|
4
4
|
import type { TierDecision, TierObservationContext } from "./provider";
|
|
5
|
+
import type { TranslatorBudget } from "../lib/translator-budget";
|
|
5
6
|
|
|
6
7
|
/** Exact provider/credential namespace for process-local reasoning replay. */
|
|
7
8
|
export interface OcxReasoningReplayIdentity {
|
|
@@ -62,6 +63,11 @@ export interface OcxParsedRequest {
|
|
|
62
63
|
_nativeReasoningReplay?: ReadonlyMap<string, string>;
|
|
63
64
|
_nativeReasoningBoundOwner?: NativeReasoningOwner;
|
|
64
65
|
_nativeReasoningMint?: { owner?: NativeReasoningOwner };
|
|
66
|
+
/**
|
|
67
|
+
* The Claude client's typed Anthropic web tools, as declared. Only the anthropic adapter reads
|
|
68
|
+
* them, and only for api.anthropic.com; every other destination never sees them.
|
|
69
|
+
*/
|
|
70
|
+
_anthropicServerTools?: readonly Record<string, unknown>[];
|
|
65
71
|
/**
|
|
66
72
|
* Boundary between replayed history and this turn's newly appended input. Usually the
|
|
67
73
|
* items the proxy restored from local previous_response_id state; also set when the
|
|
@@ -92,11 +98,17 @@ export interface OcxParsedRequest {
|
|
|
92
98
|
_cursorClientThreadId?: string;
|
|
93
99
|
/** Conversation/provider/account/model-bound namespace for reasoning replay state. */
|
|
94
100
|
_reasoningReplayScope?: OcxReasoningReplayScopeRef;
|
|
101
|
+
/** Trusted configuration snapshot; never read from the client's request body. */
|
|
102
|
+
_nativeReasoningRetention?: Readonly<{ modelSwitch: boolean; accountSwitch: boolean }>;
|
|
95
103
|
/**
|
|
96
104
|
* Set by bindRouteReasoningReplayScope after a proven serving-identity change, or by
|
|
97
105
|
* prepareOpaqueBlobRecovery after an authoritative rejection; consumers strip replayed blobs.
|
|
98
106
|
*/
|
|
99
107
|
_stripReasoningEncryptedContent?: boolean;
|
|
108
|
+
/** Native compaction remains nonportable even when reasoning-only retention is enabled. */
|
|
109
|
+
_stripNativeCompactionEncryptedContent?: boolean;
|
|
110
|
+
/** Retention kept reasoning ciphertext across a model/account change; arms streamed rejection recovery. */
|
|
111
|
+
_nativeReasoningRetainedAcrossRoute?: boolean;
|
|
100
112
|
/**
|
|
101
113
|
* Set when replayed reasoning item ids name items in a store this destination cannot read: by
|
|
102
114
|
* prepareOpaqueBlobRecovery before the one recovery rebuild, and by bindRouteReasoningReplayScope
|
|
@@ -150,6 +162,8 @@ export interface OcxParsedRequest {
|
|
|
150
162
|
* (see src/responses/compaction.ts).
|
|
151
163
|
*/
|
|
152
164
|
_compactionRequest?: boolean;
|
|
165
|
+
/** Request-owned encoding of readable routed v2 retention; never used for native ciphertext. */
|
|
166
|
+
_compactionRetention?: { encode(summary: string): string; commit(): void };
|
|
153
167
|
/** Manual compaction moved to another provider: summarize portably even on a canonical ChatGPT target. */
|
|
154
168
|
_portableCompaction?: boolean;
|
|
155
169
|
/**
|
|
@@ -164,6 +178,20 @@ export interface OcxParsedRequest {
|
|
|
164
178
|
* provider-private continuation caches again on every later turn.
|
|
165
179
|
*/
|
|
166
180
|
_contextCompactionBoundary?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Core-owned registration slot for the optional advisor subsystem (src/advisor). Set per request
|
|
183
|
+
* by the sidecar planner, never at module load: the core Responses path only sees this
|
|
184
|
+
* structural shape, so an advisor-disabled install imports no advisor module. When present, the
|
|
185
|
+
* adapter delivery wraps the worker's event stream with it — the guard holds synthetic
|
|
186
|
+
* `advisor` tool calls, consults the configured expert model, and re-dispatches the worker.
|
|
187
|
+
*/
|
|
188
|
+
_advisorGuard?: (options: {
|
|
189
|
+
parsed: OcxParsedRequest;
|
|
190
|
+
translatorBudget?: TranslatorBudget;
|
|
191
|
+
firstEvents: AsyncIterable<AdapterEvent>;
|
|
192
|
+
/** One bounded worker continuation re-dispatch (same machinery as the terminal guard). */
|
|
193
|
+
continuation: (parsed: OcxParsedRequest) => AsyncIterable<AdapterEvent> | Promise<AsyncIterable<AdapterEvent>>;
|
|
194
|
+
}) => AsyncGenerator<AdapterEvent>;
|
|
167
195
|
}
|
|
168
196
|
|
|
169
197
|
export interface OcxContext {
|
|
@@ -388,7 +416,9 @@ export interface OcxProviderContinuationState {
|
|
|
388
416
|
|
|
389
417
|
export type AdapterEvent =
|
|
390
418
|
| { type: "heartbeat"; replayUnsafe?: true; preflightReady?: true }
|
|
391
|
-
| { type: "text_delta"; text: string; phase?: OcxMessagePhase
|
|
419
|
+
| { type: "text_delta"; text: string; phase?: OcxMessagePhase;
|
|
420
|
+
/** Complete documented Anthropic progress block: text remains signed thinking on replay. */
|
|
421
|
+
anthropicThinkingSignature?: string }
|
|
392
422
|
| { type: "thinking_delta"; thinking: string }
|
|
393
423
|
// Anthropic extended-thinking round-trip: signature_delta for the current thinking block, and
|
|
394
424
|
// opaque redacted_thinking blocks. Both must be replayed verbatim or tool-use turns 400.
|
|
@@ -411,7 +441,11 @@ export type AdapterEvent =
|
|
|
411
441
|
// output_item.added(in_progress) and end → the matching output_item.done(completed|failed) under
|
|
412
442
|
// the SAME output index, so the activity animates instead of flashing completed instantly.
|
|
413
443
|
| { type: "web_search_call_begin"; id: string }
|
|
414
|
-
| {
|
|
444
|
+
| {
|
|
445
|
+
type: "web_search_call_end"; id: string; queries: string[]; status?: "completed" | "failed"; sources?: OcxUrlCitation[];
|
|
446
|
+
/** Anthropic's server-side web_fetch (adapters/anthropic.ts): the opened page and its `web_fetch_tool_result` content, verbatim. */
|
|
447
|
+
fetch?: { url: string; result: unknown };
|
|
448
|
+
}
|
|
415
449
|
| {
|
|
416
450
|
type: "done";
|
|
417
451
|
usage?: OcxUsage;
|
|
@@ -441,6 +475,8 @@ export type AdapterEvent =
|
|
|
441
475
|
/** Responses error type and code when the adapter has a structured provider failure. */
|
|
442
476
|
errorType?: string;
|
|
443
477
|
code?: string;
|
|
478
|
+
/** Proxy-internal permission to consider API-key recovery; never serialized. */
|
|
479
|
+
apiKeyRecovery?: true;
|
|
444
480
|
retryable?: boolean;
|
|
445
481
|
/**
|
|
446
482
|
* Proxy-internal, never serialized: the upstream failed the turn before producing text or a
|
package/src/types/tools.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface OcxTool {
|
|
|
25
25
|
imageGeneration?: boolean;
|
|
26
26
|
/** Synthetic video_gen tool: executed by the xAI video bridge sidecar. */
|
|
27
27
|
videoGeneration?: boolean;
|
|
28
|
+
/** Synthetic advisor tool: the model's call is intercepted by the advisor sidecar (see src/advisor), never relayed to the client. */
|
|
29
|
+
advisor?: boolean;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
package/src/types/wire.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { isOpenCodeGoGeminiDestination, OPENCODE_GO_BASE_URL, OPENCODE_GO_MODEL_WIRES, OPENCODE_GO_LEGACY_NAME_PINS, type OpenCodeGoDestination } from "./opencode-go";
|
|
2
|
+
import { openCodeZenBaseUrl, type OpenCodeZenDestination } from "./opencode-zen";
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Accepted values for the per-provider upstream HTTP-version pin (#1668). Shared by the
|
|
3
6
|
* zod load schema, the management write boundary (POST/PATCH), and the fetch runtime, so
|
|
@@ -40,35 +43,16 @@ export const MODEL_ADAPTER_OVERRIDE_ALLOWED: ReadonlySet<string> = new Set([
|
|
|
40
43
|
"openai-responses",
|
|
41
44
|
]);
|
|
42
45
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
"minimax-m3",
|
|
54
|
-
// OpenCode's catalog identifies Union Alpha as @ai-sdk/anthropic while the
|
|
55
|
-
// provider defaults to OpenAI-compatible; direct Chat returns 500 and direct
|
|
56
|
-
// Messages reaches the session check (#4847).
|
|
57
|
-
"union-alpha",
|
|
58
|
-
]),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
function anthropicWireModelsForProvider(providerName: string): ReadonlySet<string> | undefined {
|
|
62
|
-
return Object.hasOwn(ANTHROPIC_WIRE_MODELS, providerName)
|
|
63
|
-
? ANTHROPIC_WIRE_MODELS[providerName]
|
|
64
|
-
: undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Detached provider-local hard-pin table for pure wire-policy resolution. */
|
|
68
|
-
export function captureWireAdapterHardPins(providerName: string): Readonly<Record<string, string>> {
|
|
69
|
-
const models = anthropicWireModelsForProvider(providerName);
|
|
70
|
-
if (!models) return Object.freeze({});
|
|
71
|
-
return Object.freeze(Object.fromEntries([...models].map(modelId => [modelId, "anthropic"])));
|
|
46
|
+
/** Native Go wire pins share the exact-model table with registry Responses defaults. */
|
|
47
|
+
export function captureWireAdapterHardPins(providerName: string, provider?: WirePinProvider): Readonly<Record<string, string>> {
|
|
48
|
+
if (providerName !== "opencode-go") return Object.freeze({});
|
|
49
|
+
// The existing Go preset pins saved URLs to this endpoint before dispatch. Pure policy
|
|
50
|
+
// captures must use that same destination even when handed an unnormalized config row.
|
|
51
|
+
const destination = provider && { ...provider, baseUrl: OPENCODE_GO_BASE_URL };
|
|
52
|
+
return Object.freeze(Object.fromEntries(Object.entries(OPENCODE_GO_MODEL_WIRES).filter(([modelId, wire]) =>
|
|
53
|
+
(wire === "anthropic" && OPENCODE_GO_LEGACY_NAME_PINS.has(modelId))
|
|
54
|
+
|| (wire !== "openai-responses" && isOpenCodeGoGeminiDestination(destination)),
|
|
55
|
+
)));
|
|
72
56
|
}
|
|
73
57
|
|
|
74
58
|
interface WirePinPrefixRule {
|
|
@@ -98,9 +82,7 @@ const WIRE_ADAPTER_PIN_PREFIXES: Readonly<Record<string, WirePinPrefixRule>> = O
|
|
|
98
82
|
});
|
|
99
83
|
|
|
100
84
|
/** Just enough of a provider config to tell whether it still points at the pinned endpoint. */
|
|
101
|
-
export interface WirePinProvider {
|
|
102
|
-
readonly baseUrl?: unknown;
|
|
103
|
-
}
|
|
85
|
+
export interface WirePinProvider extends OpenCodeGoDestination, OpenCodeZenDestination {}
|
|
104
86
|
|
|
105
87
|
function normalizedEndpoint(value: unknown): string | undefined {
|
|
106
88
|
if (typeof value !== "string") return undefined;
|
|
@@ -112,7 +94,19 @@ function normalizedEndpoint(value: unknown): string | undefined {
|
|
|
112
94
|
}
|
|
113
95
|
}
|
|
114
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Providers whose adapter is their credential boundary: the adapter alone pins the destination and
|
|
99
|
+
* the auth header for an account token. No model may switch wires, whatever `baseUrl` or the row's
|
|
100
|
+
* own `adapter` says, because a generic wire would send that token as a Bearer key to the configured
|
|
101
|
+
* URL. The empty prefix covers every model id.
|
|
102
|
+
*/
|
|
103
|
+
const CREDENTIAL_PINNED_ADAPTERS: Readonly<Record<string, Readonly<Record<string, string>>>> = Object.freeze({
|
|
104
|
+
"dsh-account": Object.freeze({ "": "dsh-account" }),
|
|
105
|
+
});
|
|
106
|
+
|
|
115
107
|
function prefixPinsFor(providerName: string, provider: WirePinProvider | undefined): Readonly<Record<string, string>> | undefined {
|
|
108
|
+
if (Object.hasOwn(CREDENTIAL_PINNED_ADAPTERS, providerName)) return CREDENTIAL_PINNED_ADAPTERS[providerName];
|
|
109
|
+
if (providerName === "opencode-zen" && openCodeZenBaseUrl(provider)) return { "gemini-": "google" };
|
|
116
110
|
if (!provider || !Object.hasOwn(WIRE_ADAPTER_PIN_PREFIXES, providerName)) return undefined;
|
|
117
111
|
const rule = WIRE_ADAPTER_PIN_PREFIXES[providerName]!;
|
|
118
112
|
return normalizedEndpoint(provider.baseUrl) === rule.endpoint ? rule.prefixes : undefined;
|
|
@@ -148,13 +142,11 @@ function prefixedWireAdapter(providerName: string, modelId: string, provider: Wi
|
|
|
148
142
|
* adapter" would pass on the first pass and then let the override win on the second.
|
|
149
143
|
*/
|
|
150
144
|
export function isWirePinnedModel(providerName: string, modelId: string, provider?: WirePinProvider): boolean {
|
|
151
|
-
return (
|
|
152
|
-
|| prefixedWireAdapter(providerName, modelId, provider) !== undefined;
|
|
145
|
+
return pinnedWireAdapter(providerName, modelId, provider) !== undefined;
|
|
153
146
|
}
|
|
154
147
|
|
|
155
148
|
/** The wire a pinned model must use, or undefined when the model is not pinned. */
|
|
156
149
|
export function pinnedWireAdapter(providerName: string, modelId: string, provider?: WirePinProvider): string | undefined {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
: prefixedWireAdapter(providerName, modelId, provider);
|
|
150
|
+
const pins = captureWireAdapterHardPins(providerName, provider);
|
|
151
|
+
return Object.hasOwn(pins, modelId) ? pins[modelId] : prefixedWireAdapter(providerName, modelId, provider);
|
|
160
152
|
}
|
package/src/types.ts
CHANGED
|
@@ -51,7 +51,7 @@ export async function latestVersionAsync(
|
|
|
51
51
|
installer: Installer,
|
|
52
52
|
deps: AsyncLookupDeps = defaultDeps,
|
|
53
53
|
): Promise<string | null> {
|
|
54
|
-
if (installer === "source" || installer === "mise") return null;
|
|
54
|
+
if (installer === "source" || installer === "standalone" || installer === "mise") return null;
|
|
55
55
|
let owner: PnpmGlobalOwner | null | undefined;
|
|
56
56
|
try { owner = installer === "pnpm" ? await deps.ownerFn() : undefined; }
|
|
57
57
|
catch { return null; }
|
package/src/update/badge.ts
CHANGED
|
@@ -44,11 +44,11 @@ export function readUpdateBadge(deps: UpdateBadgeDeps = defaultDeps): UpdateBadg
|
|
|
44
44
|
latestVersion: null,
|
|
45
45
|
channel,
|
|
46
46
|
installer,
|
|
47
|
-
canUpdate: installer !== "source" && installer !== "mise",
|
|
47
|
+
canUpdate: installer !== "source" && installer !== "standalone" && installer !== "mise",
|
|
48
48
|
unknown: true,
|
|
49
49
|
};
|
|
50
50
|
// A source checkout has nothing to compare against, so "unknown" is not useful there.
|
|
51
|
-
if (installer === "source" || current === "?" || isSourceBuildVersion(current)) {
|
|
51
|
+
if (installer === "source" || installer === "standalone" || current === "?" || isSourceBuildVersion(current)) {
|
|
52
52
|
return { ...base, canUpdate: false, unknown: false };
|
|
53
53
|
}
|
|
54
54
|
|