@bitkyc08/opencodex 2.91.0 → 2.93.0-preview.20261027
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 +47 -8
- package/gui/dist/assets/App-CJZoq-uF.js +58 -0
- package/gui/dist/assets/{Tray-BuLy7hL1.js → Tray-BWQPcgZn.js} +1 -1
- package/gui/dist/assets/index-DRe8Hhfz.css +1 -0
- package/gui/dist/assets/index-Xfct8owH.js +94 -0
- package/gui/dist/assets/quota-summary-DxToX1rV.js +1 -0
- package/gui/dist/index.html +2 -2
- package/gui/dist/provider-icons/workbuddy-color.svg +29 -0
- package/package.json +8 -7
- package/src/adapters/anthropic.ts +28 -5
- package/src/adapters/coding-agent/batch-dispatcher.ts +122 -0
- package/src/adapters/coding-agent/profile.ts +54 -16
- package/src/adapters/coding-agent/turn.ts +30 -2
- package/src/adapters/command-code.ts +114 -7
- package/src/adapters/cursor/native-exec-fs.ts +11 -9
- package/src/adapters/devin/live-models.ts +4 -0
- package/src/adapters/google-vertex-endpoint.ts +9 -1
- package/src/adapters/google-vertex-key-project.ts +223 -0
- package/src/adapters/google-wire-compiler.ts +1 -2
- package/src/adapters/google.ts +13 -3
- package/src/adapters/kiro/reasoning.ts +2 -0
- package/src/adapters/kiro-refusal.ts +6 -1
- package/src/adapters/kiro-wire.ts +1 -1
- package/src/adapters/openai-chat/messages.ts +8 -2
- package/src/adapters/openai-chat/passthrough.ts +35 -14
- package/src/adapters/openai-chat/reasoning-replay.ts +27 -16
- package/src/adapters/openai-chat/reasoning-wire.ts +117 -8
- package/src/adapters/openai-chat/required-tool-result.ts +64 -0
- package/src/adapters/openai-chat/tool-name-registry.ts +3 -1
- package/src/adapters/openai-chat.ts +9 -10
- package/src/adapters/openai-responses/passthrough.ts +7 -4
- package/src/adapters/openai-responses/reasoning.ts +13 -0
- package/src/adapters/openai-responses/request-strips.ts +60 -0
- package/src/adapters/qoder/adapter.ts +129 -8
- package/src/adapters/qoder/scaffold-guard.ts +5 -0
- package/src/adapters/reasoning-controls.ts +16 -0
- package/src/adapters/registry.ts +5 -0
- package/src/adapters/tool-call-id.ts +1 -3
- package/src/adapters/workbuddy-schema.ts +61 -0
- package/src/adapters/workbuddy.ts +68 -0
- package/src/bridge/errors.ts +27 -0
- package/src/bridge/response-json.ts +1 -1
- package/src/bridge/sse.ts +1 -1
- package/src/bridge.ts +1 -1
- package/src/chat/inbound.ts +4 -1
- package/src/chat/outbound.ts +20 -6
- package/src/chat/reasoning-details.ts +28 -5
- package/src/claude/desktop-first-party.ts +54 -4
- package/src/claude/desktop-picker.ts +11 -8
- package/src/claude/first-party-settings.ts +3 -1
- package/src/claude/inbound.ts +2 -1
- package/src/claude/intercept/local-ca.ts +2 -1
- package/src/claude/intercept/picker-ca-cleanup.ts +4 -2
- package/src/claude/intercept/picker-ca-startup.ts +3 -1
- package/src/claude/intercept/picker-models.ts +6 -3
- package/src/claude/intercept/picker-runtime.ts +3 -2
- package/src/claude/intercept/runtime.ts +6 -3
- package/src/claude/model-info.ts +31 -8
- package/src/cli/account-api.ts +11 -0
- package/src/cli/capabilities-agents-routing.ts +3 -3
- package/src/cli/capabilities-base.ts +7 -1
- package/src/cli/capabilities-observe-system.ts +10 -0
- package/src/cli/claude-desktop.ts +9 -8
- package/src/cli/claude.ts +3 -2
- package/src/cli/codex-cli-update.ts +8 -0
- package/src/cli/codex-shim-autorestore.ts +9 -0
- package/src/cli/combo-result.ts +13 -0
- package/src/cli/combo-stats.ts +3 -0
- package/src/cli/combo.ts +83 -41
- package/src/cli/cross-home-owner.ts +13 -1
- package/src/cli/dispatch.ts +25 -6
- package/src/cli/ensure-desired-integrations.ts +8 -6
- package/src/cli/export-command.ts +4 -1
- package/src/cli/help.ts +2 -1
- package/src/cli/index.ts +45 -45
- package/src/cli/integration-plan-dto.ts +4 -0
- package/src/cli/launcher-context.ts +49 -2
- package/src/cli/link.ts +45 -32
- package/src/cli/opencode.ts +20 -9
- package/src/cli/provider.ts +2 -1
- package/src/cli/registry.ts +6 -4
- package/src/cli/root.ts +9 -0
- package/src/cli/status.ts +59 -1
- package/src/cli/stop-restore.ts +113 -0
- package/src/cli/sync-expectation.ts +60 -0
- package/src/cli/uninstall-integrations.ts +41 -7
- package/src/cli/usage-compare.ts +68 -12
- package/src/client/connect.ts +40 -3
- package/src/client/link-home.ts +10 -1
- package/src/client/link-ingress.ts +1 -1
- package/src/client/link-readiness.ts +97 -0
- package/src/client/link-relay-transport.ts +79 -11
- package/src/client/link-relay.ts +74 -15
- package/src/client/link-tunnel.ts +45 -18
- package/src/client/machine-api.ts +3 -1
- package/src/client/machine-listener.ts +20 -2
- package/src/client/runtime.ts +20 -2
- package/src/client/sync-expectation.ts +118 -0
- package/src/clients/config-export/agent-clients.ts +96 -0
- package/src/clients/config-export/contracts.ts +25 -7
- package/src/clients/config-export/qoder.ts +38 -23
- package/src/clients/config-export/reasoning-metadata.ts +55 -8
- package/src/clients/config-export.ts +12 -0
- package/src/clients/lazycodex.ts +7 -2
- package/src/clients/reasoning-controls.ts +49 -0
- package/src/codex/account-store.ts +17 -3
- package/src/codex/app-server-restart-service.ts +6 -5
- package/src/codex/auth-api/account-identity.ts +14 -0
- package/src/codex/auth-api/account-list.ts +29 -2
- package/src/codex/auth-api/http.ts +13 -0
- package/src/codex/auth-api/main-account-probe.ts +2 -2
- package/src/codex/auth-api/pool-mode-gate.ts +16 -3
- package/src/codex/auth-api/pool-quota-probe.ts +15 -0
- package/src/codex/auth-context.ts +15 -12
- package/src/codex/catalog/build-entries.ts +22 -0
- package/src/codex/catalog/configured-tiers.ts +70 -0
- package/src/codex/catalog/effort.ts +52 -11
- package/src/codex/catalog/gather-capture.ts +5 -2
- package/src/codex/catalog/heal-observation.ts +155 -13
- package/src/codex/catalog/metadata.ts +6 -0
- package/src/codex/catalog/model-hints.ts +60 -11
- package/src/codex/catalog/model-visibility.ts +3 -2
- package/src/codex/catalog/native-models.ts +18 -3
- package/src/codex/catalog/parsing.ts +10 -8
- package/src/codex/catalog/pinned-models.ts +2 -1
- package/src/codex/catalog/provider-models.ts +18 -13
- package/src/codex/catalog/retained-sync.ts +2 -1
- package/src/codex/catalog/routed-gather.ts +19 -20
- package/src/codex/catalog/write-audit.ts +3 -2
- package/src/codex/catalog-self-heal.ts +43 -23
- package/src/codex/chatgpt-refresh-failure.ts +6 -2
- package/src/codex/cli-install-provenance.ts +418 -0
- package/src/codex/cli-installation-targets.ts +5 -1
- package/src/codex/cli-update-plan.ts +43 -16
- package/src/codex/collision-identity.ts +30 -5
- package/src/codex/convergence.ts +4 -3
- package/src/codex/data/roster-pinned-models.json +177 -1
- package/src/codex/desired-state.ts +6 -1
- package/src/codex/desktop-app/picker-freshness.ts +10 -8
- package/src/codex/desktop-compatibility/installed-build.ts +88 -12
- package/src/codex/desktop-compatibility/runtime.ts +29 -5
- package/src/codex/desktop-compatibility/usage-activation.ts +2 -1
- package/src/codex/desktop-compatibility/usage-controller.ts +9 -1
- package/src/codex/desktop-compatibility/windows-certificate-trust.ts +46 -12
- package/src/codex/inject/config-toml.ts +0 -18
- package/src/codex/inject/plan.ts +18 -3
- package/src/codex/inject/remove.ts +6 -2
- package/src/codex/inject.ts +1 -1
- package/src/codex/journal.ts +61 -1
- package/src/codex/model-entitlements.ts +1 -1
- package/src/codex/native-main-owner.ts +27 -1
- package/src/codex/native-profile-store.ts +2 -1
- package/src/codex/pool-credit-policy.ts +35 -1
- package/src/codex/pool-refresh-backoff.ts +3 -1
- package/src/codex/quota-types.ts +3 -0
- package/src/codex/quota.ts +24 -4
- package/src/codex/role-auto-assign.ts +6 -2
- package/src/codex/subagent-defaults.ts +49 -4
- package/src/codex/user-identity.ts +35 -6
- package/src/codex/windows-current-sid.ts +162 -0
- package/src/combos/failover.ts +17 -2
- package/src/combos/jev-decision-contract.ts +22 -1
- package/src/combos/jev-quota-activation.ts +5 -1
- package/src/combos/jev-quota-route.ts +1 -1
- package/src/combos/jev-quota.ts +9 -1
- package/src/combos/jev-service-exchange.ts +3 -1
- package/src/combos/jev-session-pin-config.ts +51 -0
- package/src/combos/jev.ts +101 -9
- package/src/combos/resolve.ts +45 -1
- package/src/combos/types.ts +43 -0
- package/src/config/load-degrade.ts +5 -0
- package/src/config/paths.ts +19 -3
- package/src/config/pending-teardown.ts +22 -1
- package/src/config/provider-validation.ts +22 -4
- package/src/config/removed-opencode-free.ts +11 -0
- package/src/config/schema/leaf-validators.ts +6 -0
- package/src/generated/compatibility-version.json +467 -311
- package/src/generated/model-metadata.ts +5 -5
- package/src/images/loop.ts +16 -2
- package/src/integrations/catalog-refresh.ts +1 -1
- package/src/integrations/hermes-profiles.ts +251 -0
- package/src/integrations/merge.ts +8 -0
- package/src/integrations/mutation-plan.ts +19 -4
- package/src/integrations/registry.ts +5 -0
- package/src/integrations/state.ts +36 -1
- package/src/integrations/writer.ts +18 -4
- package/src/lib/bun-path-runtime.mjs +2 -1
- package/src/lib/decision-quota-sink.ts +10 -0
- package/src/lib/errors.ts +62 -0
- package/src/lib/eventstream-decoder.ts +81 -37
- package/src/lib/opaque-proxy-tunnel.ts +32 -8
- package/src/lib/pinned-http.ts +35 -2
- package/src/lib/process-control.ts +13 -1
- package/src/lib/socks5-fetch.ts +59 -64
- package/src/lib/socks5-upload-waiter.ts +50 -0
- package/src/lib/sse-decoder.ts +7 -2
- package/src/lib/state-store-sweeper.ts +40 -14
- package/src/lib/translator-budget.ts +4 -4
- package/src/lib/upstream-retry.ts +4 -1
- package/src/lib/windows-native-principal-worker.ts +14 -0
- package/src/lib/windows-native-principal.ts +188 -0
- package/src/lib/windows-secret-acl.ts +39 -3
- package/src/lib/windows-user-principal.ts +62 -18
- package/src/link/diagnostics.ts +193 -0
- package/src/link/relay-auth.ts +6 -0
- package/src/link/ssh-config.ts +35 -3
- package/src/link/status-projection.ts +39 -0
- package/src/link/supervisor.ts +45 -12
- package/src/link/tunnel-history.ts +109 -0
- package/src/link/tunnel-state.ts +80 -17
- package/src/messaging/remote-files.ts +24 -1
- package/src/oauth/generic-account-failover.ts +91 -7
- package/src/oauth/index.ts +15 -0
- package/src/oauth/model-discovery-auth.ts +5 -0
- package/src/oauth/store.ts +4 -1
- package/src/oauth/token-guardian.ts +7 -0
- package/src/oauth/types.ts +9 -0
- package/src/oauth/workbuddy.ts +139 -0
- package/src/providers/account-quota-disk.ts +12 -4
- package/src/providers/antigravity-quota-identity.ts +37 -0
- package/src/providers/base-url-choices.ts +8 -5
- package/src/providers/codebuddy-models.ts +6 -0
- package/src/providers/codex-capacity.ts +3 -1
- package/src/providers/derive.ts +51 -3
- package/src/providers/kiro-models.ts +3 -0
- package/src/providers/mimo-thinking.ts +12 -0
- package/src/providers/model-discovery.ts +2 -0
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/model-rename-migration.ts +10 -0
- package/src/providers/openai-sidecar-credit.ts +2 -2
- package/src/providers/quota/account-cache.ts +3 -2
- package/src/providers/quota/antigravity.ts +25 -14
- package/src/providers/quota/report-cache.ts +13 -4
- package/src/providers/quota/vendor-probes-key.ts +60 -0
- package/src/providers/quota/workbuddy.ts +83 -0
- package/src/providers/quota-decision-antigravity.ts +64 -0
- package/src/providers/quota-decision-publication.ts +11 -0
- package/src/providers/quota-decision-snapshot.ts +21 -4
- package/src/providers/quota-types.ts +2 -0
- package/src/providers/quota.ts +3 -1
- package/src/providers/reasoning-capabilities.ts +76 -0
- package/src/providers/registry/entries-core.ts +23 -12
- package/src/providers/registry/entries-extended.ts +83 -27
- package/src/providers/registry/model-ids.ts +5 -0
- package/src/providers/registry/model-seeds.ts +120 -56
- package/src/providers/registry/types.ts +29 -2
- package/src/providers/resolved-model-policy.ts +30 -10
- package/src/providers/routed-config.ts +24 -1
- package/src/providers/stale-model-roster-migration.ts +123 -18
- package/src/providers/workbuddy-credit-balance.ts +81 -0
- package/src/providers/workbuddy-models.ts +37 -0
- package/src/providers/workbuddy.ts +60 -0
- package/src/remote-control/workspace-pi-runtime.ts +11 -6
- package/src/responses/compaction-summary.ts +45 -0
- package/src/responses/muse-tool-name-alias.ts +1 -2
- package/src/responses/parser.ts +3 -2
- package/src/responses/reasoning-replay-cache.ts +18 -14
- package/src/responses/schema.ts +1 -0
- package/src/responses/thought-signature-replay.ts +10 -2
- package/src/router.ts +2 -0
- package/src/routing/analytics.ts +2 -3
- package/src/routing/capability.ts +8 -2
- package/src/routing/fallback-policy.ts +3 -3
- package/src/routing/history/ingest.ts +28 -3
- package/src/server/auth-cors.ts +4 -2
- package/src/server/chat-completions.ts +21 -1
- package/src/server/chat-native-eligibility.ts +7 -0
- package/src/server/chat-native-reasoning.ts +24 -7
- package/src/server/chat-native.ts +13 -2
- package/src/server/claude-messages.ts +3 -0
- package/src/server/direct-local-http.ts +5 -2
- package/src/server/effort-policy.ts +5 -1
- package/src/server/index/link-relay-sessions.ts +9 -5
- package/src/server/index/live-sideband.ts +18 -15
- package/src/server/index/optional-listeners.ts +4 -0
- package/src/server/index/serve-options.ts +5 -4
- package/src/server/local-management-read-client.ts +3 -1
- package/src/server/management/agent-settings-routes.ts +27 -15
- package/src/server/management/combo-routes.ts +14 -4
- package/src/server/management/config-routes.ts +2 -2
- package/src/server/management/decision-discovery.ts +12 -2
- package/src/server/management/hermes-profile-routes.ts +156 -0
- package/src/server/management/integration-routes.ts +85 -24
- package/src/server/management/link-routes.ts +5 -2
- package/src/server/management/model-routes.ts +2 -2
- package/src/server/management/model-row-export-metadata.ts +25 -6
- package/src/server/management/model-rows.ts +15 -20
- package/src/server/management/native-integration-routes.ts +11 -8
- package/src/server/management/provider-routes.ts +1 -1
- package/src/server/management/route-registry.ts +4 -0
- package/src/server/management-api.ts +5 -0
- package/src/server/models-capabilities.ts +21 -3
- package/src/server/port-reclaim.ts +51 -9
- package/src/server/request-log-conversation.ts +49 -0
- package/src/server/request-log.ts +2 -0
- package/src/server/responses/adapter-delivery.ts +11 -1
- package/src/server/responses/adapter-dispatch.ts +2 -2
- package/src/server/responses/anthropic-thinking-recovery.ts +1 -0
- package/src/server/responses/codex-ws-exchange.ts +39 -9
- package/src/server/responses/codex-ws-session.ts +38 -4
- package/src/server/responses/codex-ws-wire.ts +6 -1
- package/src/server/responses/combo-required-tool-contract.ts +103 -0
- package/src/server/responses/combo-stream-preflight.ts +8 -1
- package/src/server/responses/compact.ts +14 -5
- package/src/server/responses/context-overflow.ts +8 -1
- package/src/server/responses/core-combo-failure.ts +10 -0
- package/src/server/responses/core-combo.ts +74 -44
- package/src/server/responses/core-lifetime.ts +5 -2
- package/src/server/responses/core-normalize.ts +17 -4
- package/src/server/responses/core-opaque-recovery.ts +1 -0
- package/src/server/responses/core-options.ts +7 -0
- package/src/server/responses/core-replay.ts +2 -1
- package/src/server/responses/jev-combo-choice.ts +39 -0
- package/src/server/responses/jev-session-pin.ts +203 -0
- package/src/server/responses/main-hard-lock-routing.ts +60 -44
- package/src/server/responses/passthrough-delivery.ts +44 -2
- package/src/server/responses/policy-fallback.ts +6 -1
- package/src/server/responses/request-compression.ts +12 -7
- package/src/server/responses/request-prepare.ts +32 -7
- package/src/server/responses/request-sidecar-auth.ts +2 -0
- package/src/server/responses/request-transport.ts +25 -6
- package/src/server/responses/response-effects.ts +22 -10
- package/src/server/responses/run-turn-execution.ts +2 -4
- package/src/server/responses/sidecar-execution.ts +13 -7
- package/src/server/responses-phase-inference.ts +267 -0
- package/src/server/sse-payload-rewrite.ts +14 -1
- package/src/server/stop-teardown.ts +36 -1
- package/src/server/ws-bridge.ts +1 -1
- package/src/service/definition.ts +20 -8
- package/src/service/desktop-supervision.d.mts +7 -4
- package/src/service/desktop-supervision.mjs +90 -13
- package/src/service/ownership-mutation-lease.mjs +21 -7
- package/src/types/config.ts +14 -2
- package/src/types/provider.ts +29 -7
- package/src/types/request.ts +11 -0
- package/src/types/wire.ts +1 -0
- package/src/types.ts +1 -0
- package/src/update/bind-probe.ts +29 -0
- package/src/update/codex-cli-update-launch-policy.d.mts +9 -0
- package/src/update/codex-cli-update-launch-policy.mjs +30 -0
- package/src/update/job.ts +10 -29
- package/src/update/npm-install-job.ps1 +173 -0
- package/src/update/npm-install.mjs +70 -0
- package/src/update/stop-contract.d.mts +1 -0
- package/src/update/stop-contract.mjs +14 -0
- package/src/update/stop-decision.d.mts +1 -1
- package/src/update/stop-decision.mjs +13 -3
- package/src/update/teardown-handover.ts +166 -0
- package/src/update/transactional-install.d.mts +14 -3
- package/src/update/transactional-install.mjs +33 -7
- package/src/usage/expected-prices.ts +64 -31
- package/src/usage/jev-stats.ts +54 -14
- package/src/usage/timeline.ts +19 -9
- package/src/vision/eligibility.ts +15 -5
- package/src/vision/plan.ts +2 -2
- package/src/web-search/loop.ts +16 -2
- package/gui/dist/assets/App-nZ34cR5G.js +0 -58
- package/gui/dist/assets/index-DGXS51sp.js +0 -94
- package/gui/dist/assets/index-DPeB9HpV.css +0 -1
- package/gui/dist/assets/quota-summary-DO1Sx5TM.js +0 -1
|
@@ -9,6 +9,7 @@ import { CODEX_CONFIG_PATH, CODEX_MODELS_CACHE_PATH, DEFAULT_CATALOG_PATH, readR
|
|
|
9
9
|
import { clearModelCache, DEFAULT_MODEL_CACHE_TTL_MS, getFreshCached, getStaleCached, isModelsFetchCoolingDown, markModelsFetchFailure, setCached } from "../model-cache";
|
|
10
10
|
import { buildModelsRequest, resolveModelsAuthToken } from "../../oauth";
|
|
11
11
|
import type { OcxConfig, OcxProviderConfig } from "../../types";
|
|
12
|
+
import { exportDefaultReasoningEffort, exportReasoningEfforts } from "../../clients/config-export/reasoning-metadata";
|
|
12
13
|
import { modelInList } from "../../types";
|
|
13
14
|
import { CODEX_REASONING_LEVELS, codexEffortRank, configuredReasoningEfforts, modelRecordValue, sanitizeCodexReasoningEfforts, type CodexReasoningLevel } from "../../reasoning-effort";
|
|
14
15
|
import { getModelMetadata, getModelMetadataCaseInsensitive, listModelMetadata, resolveMetadataProvider } from "../../generated/model-metadata";
|
|
@@ -53,28 +54,35 @@ import {
|
|
|
53
54
|
} from "../runtime";
|
|
54
55
|
|
|
55
56
|
export function nativeEffortClamp(slug: string, effort: string | undefined): string | null {
|
|
56
|
-
if (!effort
|
|
57
|
+
if (!effort) return null;
|
|
57
58
|
if (slug.includes("/")) return null; // routed models map efforts in their adapters
|
|
59
|
+
// `ultra` is a client-facing catalog choice (max reasoning plus proactive delegation) that
|
|
60
|
+
// codex-rs converts to `max` before any request (core/src/client.rs
|
|
61
|
+
// `reasoning_effort_for_request`). The ChatGPT backend rejects it with HTTP 400 even for a
|
|
62
|
+
// model whose pinned ladder lists it (#7590), so it is never a native wire value: fold it to
|
|
63
|
+
// `max`, then clamp `max` like a direct selection.
|
|
64
|
+
const wire = effort === "ultra" ? "max" : effort;
|
|
58
65
|
const entry = UPSTREAM_NATIVE_ENTRIES.get(slug);
|
|
59
66
|
const levels = Array.isArray(entry?.supported_reasoning_levels)
|
|
60
67
|
? entry.supported_reasoning_levels as Array<{ effort?: string }>
|
|
61
68
|
: [];
|
|
62
69
|
if (levels.length === 0) {
|
|
70
|
+
if (wire !== "max") return null;
|
|
63
71
|
// Not snapshot-covered. gpt-5.6 natives have a REAL max rung (ensureGpt56ReasoningLevels
|
|
64
72
|
// restores it even off-snapshot) -> never clamp. Every other bare native (gpt-5.5,
|
|
65
73
|
// a retired slug a client still asks for, and future old-ladder slugs)
|
|
66
74
|
// really stops at xhigh — the ChatGPT backend error names exactly none..xhigh — so clamp
|
|
67
75
|
// the synthetic top tier.
|
|
68
|
-
|
|
76
|
+
if (!isGpt56NativeSlug(slug)) return "xhigh";
|
|
77
|
+
return effort === wire ? null : wire;
|
|
69
78
|
}
|
|
70
79
|
const supported = levels.flatMap(l => typeof l.effort === "string" ? [l.effort] : []);
|
|
71
|
-
if (supported.includes(
|
|
72
|
-
const rank = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return highest ?? null;
|
|
80
|
+
if (supported.includes(wire)) return effort === wire ? null : wire;
|
|
81
|
+
const rank = ["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"];
|
|
82
|
+
const requestedRank = rank.indexOf(wire);
|
|
83
|
+
if (requestedRank < 0) return null;
|
|
84
|
+
const available = supported.filter(e => rank.includes(e)).sort((a, b) => rank.indexOf(a) - rank.indexOf(b));
|
|
85
|
+
return available.filter(e => rank.indexOf(e) <= requestedRank).at(-1) ?? available[0] ?? null;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
export function shouldApplyNativeEffortClamp(
|
|
@@ -132,6 +140,13 @@ export const ROUTED_REASONING_LEVELS = [...CODEX_REASONING_LEVELS];
|
|
|
132
140
|
|
|
133
141
|
export function applyCatalogModelMetadata(entry: RawEntry, model?: CatalogModel): void {
|
|
134
142
|
if (!model) return;
|
|
143
|
+
applyClientReasoningCapabilities(entry, model);
|
|
144
|
+
if (model.supportsThinkingToggle === true && model.supportsReasoningEffort === false
|
|
145
|
+
&& Array.isArray(entry.supported_reasoning_levels)) {
|
|
146
|
+
entry.supported_reasoning_levels = entry.supported_reasoning_levels.map(level => ({
|
|
147
|
+
...level, description: level.effort === "none" ? "Thinking off" : "Thinking on",
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
135
150
|
// This marker survives strict catalog normalization and lets sync distinguish a stale
|
|
136
151
|
// bare combo alias from a genuine native model row.
|
|
137
152
|
if (model.provider === COMBO_NAMESPACE) entry.owned_by = model.owned_by ?? COMBO_NAMESPACE;
|
|
@@ -177,6 +192,8 @@ export function applyCatalogModelMetadata(entry: RawEntry, model?: CatalogModel)
|
|
|
177
192
|
entry.supports_reasoning_summaries = model.supportsReasoningSummaries;
|
|
178
193
|
}
|
|
179
194
|
if (model.supportsServiceTier === true) {
|
|
195
|
+
const eligibleRoutedFlex = model.supportsFlexTier === true
|
|
196
|
+
&& model.provider !== COMBO_NAMESPACE && model.nativeAlias !== true;
|
|
180
197
|
const nativeFast = model.codexForwardNativeCapabilityAlias && Array.isArray(entry.service_tiers)
|
|
181
198
|
? entry.service_tiers.find(tier => tier?.id === "priority")
|
|
182
199
|
: undefined;
|
|
@@ -185,8 +202,12 @@ export function applyCatalogModelMetadata(entry: RawEntry, model?: CatalogModel)
|
|
|
185
202
|
id: "priority",
|
|
186
203
|
name: "Fast",
|
|
187
204
|
description: model.fastTierDescription ?? nativeFast?.description ?? "1.5x speed, increased usage",
|
|
188
|
-
}
|
|
189
|
-
|
|
205
|
+
}, ...(eligibleRoutedFlex ? [{
|
|
206
|
+
id: "flex",
|
|
207
|
+
name: "Flex",
|
|
208
|
+
description: "Capacity-dependent processing; availability and latency may vary",
|
|
209
|
+
}] : [])];
|
|
210
|
+
entry.additional_speed_tiers = eligibleRoutedFlex ? ["fast", "flex"] : ["fast"];
|
|
190
211
|
}
|
|
191
212
|
stampCapabilityProvenance(entry, model);
|
|
192
213
|
}
|
|
@@ -241,6 +262,26 @@ function stampCapabilityProvenance(entry: RawEntry, model: CatalogModel): void {
|
|
|
241
262
|
};
|
|
242
263
|
}
|
|
243
264
|
|
|
265
|
+
/** Project explicit independent capabilities only at Codex's effort-enum boundary. */
|
|
266
|
+
function applyClientReasoningCapabilities(entry: RawEntry, model: CatalogModel): void {
|
|
267
|
+
// Positive effort support can be inferred from a legacy ladder. It does not classify
|
|
268
|
+
// independent controls or opt that model out of the existing max/ultra synthesis.
|
|
269
|
+
if (model.supportsThinkingToggle === undefined && model.supportsReasoningEffort !== false
|
|
270
|
+
&& model.supportsReasoning !== false) return;
|
|
271
|
+
const efforts = exportReasoningEfforts(model);
|
|
272
|
+
if (efforts === undefined && model.supportsReasoningEffort === undefined) {
|
|
273
|
+
// A negative toggle declaration says nothing about an unknown effort capability.
|
|
274
|
+
const legacy = catalogEntryEfforts(entry).filter(effort => effort !== "none");
|
|
275
|
+
applyReasoningLevels(entry, legacy, typeof entry.default_reasoning_level === "string" ? entry.default_reasoning_level : undefined, true);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const declaredDefault = exportDefaultReasoningEffort(model);
|
|
279
|
+
applyReasoningLevels(entry, efforts ?? [], declaredDefault, true);
|
|
280
|
+
if (model.supportsThinkingToggle === true && declaredDefault === undefined) {
|
|
281
|
+
delete entry.default_reasoning_level;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
244
285
|
export function applyReasoningLevels(
|
|
245
286
|
entry: RawEntry,
|
|
246
287
|
effortsOverride?: string[],
|
|
@@ -119,6 +119,7 @@ export interface CatalogGatherProviderModelOutcome {
|
|
|
119
119
|
readonly state: "authoritative" | "degraded";
|
|
120
120
|
}
|
|
121
121
|
export interface ModelsAuthResolution {
|
|
122
|
+
readonly workbuddy?: import("../../oauth/types").WorkBuddyOAuthMetadata;
|
|
122
123
|
readonly apiKey: string | undefined;
|
|
123
124
|
readonly observed: boolean;
|
|
124
125
|
readonly oauthAccountId?: string;
|
|
@@ -334,8 +335,9 @@ export function captureModelsRequest(
|
|
|
334
335
|
name: string,
|
|
335
336
|
provider: OcxProviderConfig,
|
|
336
337
|
oauthApiBaseUrl: string | undefined,
|
|
338
|
+
workbuddy?: import("../../oauth/types").WorkBuddyOAuthMetadata,
|
|
337
339
|
): CapturedModelsRequest {
|
|
338
|
-
const observed = { oauthApiBaseUrl };
|
|
340
|
+
const observed = { oauthApiBaseUrl, workbuddy };
|
|
339
341
|
const withoutCredential = buildModelsRequest(provider, undefined, name, observed);
|
|
340
342
|
const withCredential = buildModelsRequest(provider, REQUEST_CREDENTIAL_SENTINEL, name, observed);
|
|
341
343
|
const method = withoutCredential.method ?? "GET";
|
|
@@ -400,7 +402,7 @@ export function captureProviderGather(
|
|
|
400
402
|
: authResolver.kind === "refreshing" && provider.authMode === "oauth" && mayResolveModelsOAuth(name, provider)
|
|
401
403
|
? getOAuthCredentialApiBaseUrl(name)
|
|
402
404
|
: undefined;
|
|
403
|
-
const request = captureModelsRequest(name, provider, oauthApiBaseUrl);
|
|
405
|
+
const request = captureModelsRequest(name, provider, oauthApiBaseUrl, observedAuth?.workbuddy);
|
|
404
406
|
const refreshingOAuthAccountId = !observedAuth && authResolver.kind === "refreshing" && provider.authMode === "oauth" && mayResolveModelsOAuth(name, provider)
|
|
405
407
|
? getAccountSet(name)?.activeAccountId
|
|
406
408
|
: undefined;
|
|
@@ -550,6 +552,7 @@ function providerCatalogFingerprint(name: string, prov: OcxProviderConfig): Reco
|
|
|
550
552
|
maxOut: prov.modelMaxOutputTokens ?? null,
|
|
551
553
|
autoCompact: prov.modelAutoCompactTokenLimits ?? null,
|
|
552
554
|
inMod: prov.modelInputModalities ?? null,
|
|
555
|
+
inModAll: prov.inputModalities ?? null,
|
|
553
556
|
capabilities: prov.modelCapabilities ?? null,
|
|
554
557
|
re: prov.modelReasoningEfforts ?? null,
|
|
555
558
|
suppressMax: prov.modelSuppressSyntheticMax ?? null,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync, type
|
|
1
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync, readSync, realpathSync, statSync, type BigIntStats } from "node:fs";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
2
3
|
import { readCodexHomeJournal } from "../codex-home-owner";
|
|
3
4
|
import { samePath, type RawCatalog } from "./parsing";
|
|
4
5
|
|
|
@@ -9,10 +10,151 @@ export interface CatalogObservation {
|
|
|
9
10
|
readonly catalog: RawCatalog | null;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
export type CatalogHealPathComparison = "same" | "different" | "unknown";
|
|
14
|
+
export const CATALOG_HEAL_MAX_LINKS = 40;
|
|
15
|
+
// Small catalog-path comparisons need only a handful of reads; unusual paths defer.
|
|
16
|
+
export const CATALOG_HEAL_MAX_PATH_READS = 64;
|
|
17
|
+
type PathRead = <T>(read: () => T) => T;
|
|
18
|
+
type LinkObservation = { path: string; stat: BigIntStats; value: string; parent: string; parentStat: BigIntStats; resolved?: string; resolvedStat?: BigIntStats };
|
|
19
|
+
type PathObservation = {
|
|
20
|
+
kind: "native" | "hardlink"; path: string; stat: BigIntStats; links: LinkObservation[];
|
|
21
|
+
canonical: string; parent: string; parentStat: BigIntStats;
|
|
22
|
+
} | { kind: "unavailable"; hardlink: boolean };
|
|
23
|
+
|
|
24
|
+
function unchanged(before: BigIntStats, after: BigIntStats): boolean {
|
|
25
|
+
return before.dev === after.dev && before.ino === after.ino && before.mode === after.mode
|
|
26
|
+
&& before.nlink === after.nlink && before.size === after.size
|
|
27
|
+
&& before.mtimeNs === after.mtimeNs && before.ctimeNs === after.ctimeNs;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Windows normalizes ".." lexically across reparse points; POSIX resolves each component. */
|
|
31
|
+
function resolveLinkTarget(base: string, value: string, read: PathRead, links: LinkObservation[]): string {
|
|
32
|
+
if (process.platform === "win32") return resolve(base, value);
|
|
33
|
+
let current = base;
|
|
34
|
+
if (isAbsolute(value)) current = parse(value).root;
|
|
35
|
+
const segments = (isAbsolute(value) ? value.slice(parse(value).root.length) : value).split("/");
|
|
36
|
+
for (let index = 0; index < segments.length; index += 1) {
|
|
37
|
+
const segment = segments[index];
|
|
38
|
+
if (segment === "" || segment === ".") continue;
|
|
39
|
+
if (segment === "..") { current = dirname(current); continue; }
|
|
40
|
+
const next = join(current, segment);
|
|
41
|
+
if (index === segments.length - 1) return next;
|
|
42
|
+
const stat = read(() => lstatSync(next, { bigint: true }));
|
|
43
|
+
if (stat.isSymbolicLink()) {
|
|
44
|
+
// Keep the intermediate link inside the same revalidation snapshot as leaf hops.
|
|
45
|
+
const parent = current, parentStat = read(() => statSync(parent, { bigint: true })), target = read(() => readlinkSync(next));
|
|
46
|
+
const resolvedStat = read(() => statSync(next, { bigint: true }));
|
|
47
|
+
// POSIX refuses ".." across a non-directory; statSync follows the link.
|
|
48
|
+
if (!resolvedStat.isDirectory()) throw new Error("Link target crosses a non-directory");
|
|
49
|
+
const resolved = read(() => realpathSync.native(next));
|
|
50
|
+
links.push({ path: next, stat, value: target, parent, parentStat, resolved, resolvedStat });
|
|
51
|
+
current = resolved;
|
|
52
|
+
}
|
|
53
|
+
else if (stat.isDirectory()) current = next;
|
|
54
|
+
else throw new Error("Link target crosses a non-directory");
|
|
55
|
+
}
|
|
56
|
+
return current;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** @internal Path observation seam; production callers supply the fixed read budget below. */
|
|
60
|
+
export function inspectHealPath(path: string, read: PathRead): PathObservation {
|
|
61
|
+
let hardlink = false;
|
|
62
|
+
let observedEntry = false;
|
|
63
|
+
const links: LinkObservation[] = [];
|
|
64
|
+
try {
|
|
65
|
+
for (let count = 0; count < CATALOG_HEAL_MAX_LINKS; count += 1) {
|
|
66
|
+
const stat = read(() => lstatSync(path, { bigint: true }));
|
|
67
|
+
observedEntry = true;
|
|
68
|
+
if (stat.isSymbolicLink()) {
|
|
69
|
+
const parent = dirname(path), parentStat = read(() => statSync(parent, { bigint: true })), value = read(() => readlinkSync(path));
|
|
70
|
+
links.push({ path, stat, value, parent, parentStat });
|
|
71
|
+
path = resolveLinkTarget(read(() => realpathSync.native(parent)), value, read, links);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// Keep native leaf aliases outside the macOS multi-link FD-name bug.
|
|
75
|
+
hardlink = process.platform === "darwin" && stat.isFile() && stat.nlink > 1n;
|
|
76
|
+
const parent = read(() => realpathSync.native(dirname(path))), parentStat = read(() => statSync(parent, { bigint: true }));
|
|
77
|
+
if (!parentStat.isDirectory() || !unchanged(parentStat, read(() => statSync(dirname(path), { bigint: true })))) throw new Error("Changed parent");
|
|
78
|
+
return { kind: hardlink ? "hardlink" : "native", path, stat, links, parent, parentStat,
|
|
79
|
+
canonical: hardlink ? join(parent, basename(path)) : read(() => realpathSync.native(path)) };
|
|
80
|
+
}
|
|
81
|
+
// Hop exhaustion requires identity evidence; it must never fall back to lexical comparison.
|
|
82
|
+
return { kind: "unavailable", hardlink: true };
|
|
83
|
+
} catch { /* Observed entry evidence cannot fall back to lexical identity after a failed lookup. */ }
|
|
84
|
+
return { kind: "unavailable", hardlink: hardlink || observedEntry };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function revalidateHealPath(seen: Exclude<PathObservation, { kind: "unavailable" }>, read: PathRead): boolean {
|
|
88
|
+
if (!unchanged(seen.stat, read(() => lstatSync(seen.path, { bigint: true })))) return false;
|
|
89
|
+
for (const link of seen.links) {
|
|
90
|
+
if (!unchanged(link.stat, read(() => lstatSync(link.path, { bigint: true }))) || read(() => readlinkSync(link.path)) !== link.value
|
|
91
|
+
|| !unchanged(link.parentStat, read(() => statSync(link.parent, { bigint: true })))) return false;
|
|
92
|
+
const resolved = link.resolved, resolvedStat = link.resolvedStat;
|
|
93
|
+
if (resolved !== undefined && resolvedStat !== undefined
|
|
94
|
+
&& !unchanged(resolvedStat, read(() => statSync(resolved, { bigint: true })))) return false;
|
|
95
|
+
}
|
|
96
|
+
return unchanged(seen.parentStat, read(() => statSync(seen.parent, { bigint: true })))
|
|
97
|
+
&& unchanged(seen.parentStat, read(() => statSync(dirname(seen.path), { bigint: true })));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Retain publication entry/link/parent evidence across its catalog read, within one budget. */
|
|
101
|
+
export function retainCatalogHealPath(path: string): (signature: string) => boolean {
|
|
102
|
+
let reads = 0;
|
|
103
|
+
const read: PathRead = fn => {
|
|
104
|
+
if (reads++ >= CATALOG_HEAL_MAX_PATH_READS) throw new Error("Catalog path read limit reached");
|
|
105
|
+
return fn();
|
|
106
|
+
};
|
|
107
|
+
const seen = inspectHealPath(path, read);
|
|
108
|
+
return observedSignature => {
|
|
109
|
+
try {
|
|
110
|
+
return seen.kind !== "unavailable" && signature(seen.stat) === observedSignature && revalidateHealPath(seen, read);
|
|
111
|
+
} catch { return false; }
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Entry uncertainty is distinct from a proven different path, especially for releases. */
|
|
116
|
+
export function compareCatalogHealPaths(left: string, right: string): CatalogHealPathComparison {
|
|
117
|
+
let reads = 0, exhausted = false;
|
|
118
|
+
const read: PathRead = fn => {
|
|
119
|
+
if (reads >= CATALOG_HEAL_MAX_PATH_READS) { exhausted = true; throw new Error("Catalog path read limit reached"); }
|
|
120
|
+
reads += 1;
|
|
121
|
+
return fn();
|
|
122
|
+
};
|
|
123
|
+
const a = inspectHealPath(left, read), b = inspectHealPath(right, read);
|
|
124
|
+
if (exhausted) return "unknown";
|
|
125
|
+
const needsEntry = a.kind === "hardlink" || b.kind === "hardlink"
|
|
126
|
+
|| (a.kind === "unavailable" && a.hardlink) || (b.kind === "unavailable" && b.hardlink);
|
|
127
|
+
if (!needsEntry) {
|
|
128
|
+
if (a.kind === "unavailable" || b.kind === "unavailable") {
|
|
129
|
+
try {
|
|
130
|
+
if ((a.kind !== "unavailable" && !revalidateHealPath(a, read))
|
|
131
|
+
|| (b.kind !== "unavailable" && !revalidateHealPath(b, read))) return "unknown";
|
|
132
|
+
return samePath(left, right) ? "same" : "different";
|
|
133
|
+
} catch { return "unknown"; }
|
|
134
|
+
}
|
|
135
|
+
const result = samePath(a.canonical, b.canonical) ? "same" : "different";
|
|
136
|
+
// Native normalization must not hide changed entries, links or parents on any platform.
|
|
137
|
+
try {
|
|
138
|
+
return revalidateHealPath(a, read) && revalidateHealPath(b, read) ? result : "unknown";
|
|
139
|
+
} catch { return "unknown"; }
|
|
140
|
+
}
|
|
141
|
+
if (a.kind === "unavailable" || b.kind === "unavailable") return "unknown";
|
|
142
|
+
try {
|
|
143
|
+
let result: CatalogHealPathComparison = "unknown";
|
|
144
|
+
if (a.stat.dev !== b.stat.dev || a.stat.ino !== b.stat.ino) result = "different";
|
|
145
|
+
else if (a.kind === "hardlink" && b.kind === "hardlink") {
|
|
146
|
+
if (a.parentStat.dev !== b.parentStat.dev || a.parentStat.ino !== b.parentStat.ino) result = "different";
|
|
147
|
+
else if (basename(a.path) === basename(b.path)) result = "same";
|
|
148
|
+
// Bun 1.4.3 opendir/Glob eagerly enumerate the whole directory. Without a
|
|
149
|
+
// bounded entry-name primitive, aliases and sibling hardlinks stay unknown.
|
|
150
|
+
}
|
|
151
|
+
return revalidateHealPath(a, read) && revalidateHealPath(b, read) ? result : "unknown";
|
|
152
|
+
} catch { return "unknown"; }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Admission-style convenience; release consumers must retain the unknown result. */
|
|
13
156
|
export function sameCatalogHealPath(left: string, right: string): boolean {
|
|
14
|
-
|
|
15
|
-
catch { return samePath(left, right); }
|
|
157
|
+
return compareCatalogHealPaths(left, right) === "same";
|
|
16
158
|
}
|
|
17
159
|
|
|
18
160
|
/** Resolve authority without reading catalog bytes or cleaning journal evidence. */
|
|
@@ -32,29 +174,29 @@ export function selectCatalogHealPath(
|
|
|
32
174
|
catch { return null; }
|
|
33
175
|
}
|
|
34
176
|
|
|
35
|
-
function signature(stat:
|
|
36
|
-
return `${stat.dev}:${stat.ino}:${stat.size}:${stat.
|
|
177
|
+
function signature(stat: BigIntStats): string {
|
|
178
|
+
return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
|
|
37
179
|
}
|
|
38
180
|
|
|
39
181
|
/** Bounded regular descriptor reads; never open a FIFO/device or follow a replaced symlink. */
|
|
40
182
|
export function observeCatalogHealFile(path: string, readContent: boolean): CatalogObservation | null {
|
|
41
183
|
let fd: number | undefined;
|
|
42
184
|
try {
|
|
43
|
-
const before = lstatSync(path);
|
|
44
|
-
if (!before.isFile() || before.size > CATALOG_HEAL_MAX_BYTES) return null;
|
|
185
|
+
const before = lstatSync(path, { bigint: true });
|
|
186
|
+
if (!before.isFile() || before.size > BigInt(CATALOG_HEAL_MAX_BYTES)) return null;
|
|
45
187
|
if (!readContent) return { signature: signature(before), catalog: null };
|
|
46
188
|
fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
47
|
-
const opened = fstatSync(fd);
|
|
48
|
-
if (!opened.isFile() || opened.size > CATALOG_HEAL_MAX_BYTES || signature(before) !== signature(opened)) return null;
|
|
49
|
-
const bytes = Buffer.alloc(opened.size + 1);
|
|
189
|
+
const opened = fstatSync(fd, { bigint: true });
|
|
190
|
+
if (!opened.isFile() || opened.size > BigInt(CATALOG_HEAL_MAX_BYTES) || signature(before) !== signature(opened)) return null;
|
|
191
|
+
const bytes = Buffer.alloc(Number(opened.size) + 1);
|
|
50
192
|
let length = 0;
|
|
51
193
|
while (length < bytes.length) {
|
|
52
194
|
const count = readSync(fd, bytes, length, bytes.length - length, null);
|
|
53
195
|
if (count === 0) break;
|
|
54
196
|
length += count;
|
|
55
197
|
}
|
|
56
|
-
if (length !== opened.size || signature(fstatSync(fd)) !== signature(opened)
|
|
57
|
-
|| signature(lstatSync(path)) !== signature(opened)) return null;
|
|
198
|
+
if (length !== Number(opened.size) || signature(fstatSync(fd, { bigint: true })) !== signature(opened)
|
|
199
|
+
|| signature(lstatSync(path, { bigint: true })) !== signature(opened)) return null;
|
|
58
200
|
let catalog: RawCatalog | null = null;
|
|
59
201
|
try {
|
|
60
202
|
const value: unknown = JSON.parse(bytes.subarray(0, length).toString("utf8"));
|
|
@@ -44,12 +44,14 @@ import {
|
|
|
44
44
|
ACCOUNT_GATED_NATIVE_OPENAI_MODELS,
|
|
45
45
|
NATIVE_GPT6_CONTEXT,
|
|
46
46
|
NATIVE_GPT61_SOL_CONTEXT,
|
|
47
|
+
NATIVE_GPT61_TERRA_CONTEXT,
|
|
47
48
|
NATIVE_DAYBREAK_BLUE_MODEL,
|
|
48
49
|
NATIVE_GPT6_ASTRA_MINOR_MODEL,
|
|
49
50
|
NATIVE_GPT6_ASTRA_MODEL,
|
|
50
51
|
NATIVE_GPT6_LUNA_MODEL,
|
|
51
52
|
NATIVE_GPT6_SOL_MODEL,
|
|
52
53
|
NATIVE_GPT61_SOL_MODEL,
|
|
54
|
+
NATIVE_GPT61_TERRA_MODEL,
|
|
53
55
|
NATIVE_RESERVE_MODEL,
|
|
54
56
|
NATIVE_OPENAI_CAPABILITY_ALIAS_MODELS,
|
|
55
57
|
NATIVE_OPENAI_MODELS,
|
|
@@ -76,6 +78,7 @@ export {
|
|
|
76
78
|
NATIVE_GPT6_LUNA_MODEL,
|
|
77
79
|
NATIVE_GPT6_SOL_MODEL,
|
|
78
80
|
NATIVE_GPT61_SOL_MODEL,
|
|
81
|
+
NATIVE_GPT61_TERRA_MODEL,
|
|
79
82
|
NATIVE_OPENAI_CAPABILITY_ALIAS_MODELS,
|
|
80
83
|
NATIVE_OPENAI_MODELS,
|
|
81
84
|
SELF_DESCRIBED_NATIVE_OPENAI_MODELS,
|
|
@@ -97,6 +100,8 @@ export const DOCUMENTED_NATIVE_OPENAI_ADDITIONS = [
|
|
|
97
100
|
NATIVE_GPT6_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL,
|
|
98
101
|
// GPT-6.1 Sol needs client_version >= 0.153.0 upstream; older installed catalogs lack it.
|
|
99
102
|
NATIVE_GPT61_SOL_MODEL,
|
|
103
|
+
// Terra's pinned row has the same client floor and backfills older installed catalogs too.
|
|
104
|
+
NATIVE_GPT61_TERRA_MODEL,
|
|
100
105
|
];
|
|
101
106
|
|
|
102
107
|
export function configuredNativeAliasSlugs(
|
|
@@ -207,6 +212,7 @@ export const NATIVE_OPENAI_CONTEXT_OVERRIDES: Record<string, { contextWindow?: n
|
|
|
207
212
|
// GPT-6.1 Sol's row (openai/codex models.json after #49318) ships 272,000 / 872,000, but OpenAI
|
|
208
213
|
// raised its Codex & Work default to 500,000 on 2026-10-11; the 872,000 ceiling is unchanged.
|
|
209
214
|
[NATIVE_GPT61_SOL_MODEL]: { ...NATIVE_GPT61_SOL_CONTEXT },
|
|
215
|
+
[NATIVE_GPT61_TERRA_MODEL]: { ...NATIVE_GPT61_TERRA_CONTEXT },
|
|
210
216
|
// Astra Minor borrows Astra's row, so it inherits Astra's numbers. No account we hold can reach
|
|
211
217
|
// it, so this is inheritance, not a measurement.
|
|
212
218
|
[NATIVE_GPT6_ASTRA_MINOR_MODEL]: { ...NATIVE_GPT6_CONTEXT },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canInferVendorContext, vendorContextInference } from "./vendor-context";
|
|
2
2
|
import { effectiveProviderAlias, effectiveProviderAliasDecision } from "../../providers/default-aliases";
|
|
3
3
|
import { initialModelSelectionPending } from "../../providers/initial-model-selection";
|
|
4
|
-
import { supportsConfiguredUltraFast } from "./configured-tiers";
|
|
4
|
+
import { supportsConfiguredFlex, supportsConfiguredUltraFast } from "./configured-tiers";
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
6
|
import { createHash, createHmac, randomBytes } from "node:crypto";
|
|
7
7
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
} from "../../oauth";
|
|
35
35
|
import type { OcxConfig, OcxProviderConfig } from "../../types";
|
|
36
36
|
import { modelInList } from "../../types";
|
|
37
|
+
import { declaredModelCapabilities, REASONING_CAPABILITY_FIELDS } from "../../providers/reasoning-capabilities";
|
|
37
38
|
import { CODEX_REASONING_LEVELS, codexEffortRank, configuredReasoningEfforts, modelRecordValue, sanitizeCodexReasoningEfforts } from "../../reasoning-effort";
|
|
38
39
|
import { isModelVisionSidecarConsumer } from "../../vision/eligibility";
|
|
39
40
|
import { getModelMetadata, getModelMetadataCaseInsensitive, listModelMetadata, resolveMetadataProvider, type ModelMetadata } from "../../generated/model-metadata";
|
|
@@ -260,7 +261,17 @@ export function withVisionSidecarInput(
|
|
|
260
261
|
): CatalogModel {
|
|
261
262
|
if (!enabled || !provider || !isModelVisionSidecarConsumer(provider, model.id)) return model;
|
|
262
263
|
const modalities = model.inputModalities ?? ["text"];
|
|
263
|
-
return modalities.includes("image") ? model
|
|
264
|
+
return modalities.includes("image") ? model
|
|
265
|
+
: copyReasoningHintSource(model, { ...model, inputModalities: [...modalities, "image"] });
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const reasoningHintSources = new WeakMap<CatalogModel, Partial<CatalogModel>>();
|
|
269
|
+
|
|
270
|
+
/** Forward discovery provenance only across transparent clones, never custom reasoning overrides. */
|
|
271
|
+
export function copyReasoningHintSource(source: CatalogModel, clone: CatalogModel): CatalogModel {
|
|
272
|
+
const reasoningSource = reasoningHintSources.get(source);
|
|
273
|
+
if (reasoningSource) reasoningHintSources.set(clone, reasoningSource);
|
|
274
|
+
return clone;
|
|
264
275
|
}
|
|
265
276
|
|
|
266
277
|
/** Reapply configured limits and captured wire capabilities without trusting stale discovery hints. */
|
|
@@ -302,10 +313,25 @@ export function applyProviderConfigHints(
|
|
|
302
313
|
const resolvedModalities = staticPolicy.model.inputModalities ?? model.inputModalities
|
|
303
314
|
?? (azureMetadata?.input ? modelInputModalities({ id: model.id, input_modalities: azureMetadata.input }, undefined) : undefined);
|
|
304
315
|
const inputModalities = resolvedModalities ? [...resolvedModalities] : undefined;
|
|
305
|
-
const
|
|
316
|
+
const reasoningSource = reasoningHintSources.get(model) ?? model;
|
|
317
|
+
const declaredCapabilities = declaredModelCapabilities(prov.modelCapabilities, model.id);
|
|
318
|
+
const reasoningCapabilities: Partial<CatalogModel> = {};
|
|
319
|
+
for (const field of REASONING_CAPABILITY_FIELDS) {
|
|
320
|
+
const value = modelInList(prov.noReasoningModels, model.id) ? staticPolicy.model[field]
|
|
321
|
+
: declaredCapabilities?.[field] ?? reasoningSource[field] ?? staticPolicy.model[field];
|
|
322
|
+
if (typeof value === "boolean") reasoningCapabilities[field] = value;
|
|
323
|
+
}
|
|
324
|
+
if (reasoningCapabilities.supportsReasoning === false) {
|
|
325
|
+
reasoningCapabilities.supportsThinkingToggle = false;
|
|
326
|
+
reasoningCapabilities.supportsReasoningEffort = false;
|
|
327
|
+
reasoningCapabilities.defaultThinkingEnabled = false;
|
|
328
|
+
}
|
|
329
|
+
const reasoningEfforts = reasoningCapabilities.supportsReasoningEffort === false ? []
|
|
330
|
+
: configuredReasoningEfforts(prov, model.id) ?? reasoningSource.reasoningEfforts;
|
|
306
331
|
const suppressSyntheticMax = modelRecordValue(prov.modelSuppressSyntheticMax, model.id)
|
|
307
332
|
?? (model.antigravityEffortWireModelIds !== undefined);
|
|
308
|
-
const defaultReasoningEffort =
|
|
333
|
+
const defaultReasoningEffort = reasoningCapabilities.supportsReasoningEffort === false ? undefined
|
|
334
|
+
: staticPolicy.model.defaultReasoningEffort ?? reasoningSource.defaultReasoningEffort;
|
|
309
335
|
const supportsReasoningSummaries = staticPolicy.model.supportsReasoningSummaries;
|
|
310
336
|
const supportsVerbosity = staticPolicy.model.supportsVerbosity;
|
|
311
337
|
const fastPolicy = fastPolicyForModel(prov, model.id, name);
|
|
@@ -319,9 +345,16 @@ export function applyProviderConfigHints(
|
|
|
319
345
|
contextCapped: previousContextCapped,
|
|
320
346
|
supportsServiceTier: _staleServiceTier,
|
|
321
347
|
supportsUltraFastTier: _staleUltraFastTier,
|
|
348
|
+
supportsFlexTier: _staleFlexTier,
|
|
322
349
|
fastTierDescription: _staleFastTierDescription,
|
|
323
350
|
providerAlias: _staleProviderAlias,
|
|
324
351
|
suppressSyntheticMax: _staleSuppressSyntheticMax,
|
|
352
|
+
supportsReasoning: _staleSupportsReasoning,
|
|
353
|
+
supportsThinkingToggle: _staleThinkingToggle,
|
|
354
|
+
supportsReasoningEffort: _staleReasoningEffort,
|
|
355
|
+
defaultThinkingEnabled: _staleDefaultThinking,
|
|
356
|
+
reasoningEfforts: _staleReasoningEfforts,
|
|
357
|
+
defaultReasoningEffort: _staleDefaultEffort,
|
|
325
358
|
...modelWithoutServiceTier
|
|
326
359
|
} = model;
|
|
327
360
|
// 已发现窗口只允许被配置值压低;缺窗口时,已开的 Context cap 就是实际窗口。
|
|
@@ -355,11 +388,13 @@ export function applyProviderConfigHints(
|
|
|
355
388
|
}
|
|
356
389
|
: {}),
|
|
357
390
|
...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
|
|
391
|
+
...reasoningCapabilities,
|
|
358
392
|
...(defaultReasoningEffort ? { defaultReasoningEffort } : {}),
|
|
359
393
|
...(typeof supportsReasoningSummaries === "boolean" ? { supportsReasoningSummaries } : {}),
|
|
360
394
|
...(typeof supportsVerbosity === "boolean" ? { supportsVerbosity } : {}),
|
|
361
395
|
...(typeof supportsServiceTier === "boolean" ? { supportsServiceTier } : {}),
|
|
362
396
|
supportsUltraFastTier: supportsConfiguredUltraFast(fastPolicy),
|
|
397
|
+
supportsFlexTier: supportsConfiguredFlex(fastPolicy),
|
|
363
398
|
...(supportsServiceTier === true && fastPolicy.fastTierDescription !== undefined
|
|
364
399
|
? { fastTierDescription: fastPolicy.fastTierDescription }
|
|
365
400
|
: {}),
|
|
@@ -387,8 +422,7 @@ export function applyProviderConfigHints(
|
|
|
387
422
|
: withCap;
|
|
388
423
|
const softCandidates = [model.autoCompactTokenLimit, configuredAutoCompact]
|
|
389
424
|
.filter((value): value is number => typeof value === "number" && value > 0);
|
|
390
|
-
|
|
391
|
-
return {
|
|
425
|
+
const result = contextWindow === undefined || softCandidates.length === 0 ? withHardBounds : {
|
|
392
426
|
...withHardBounds,
|
|
393
427
|
autoCompactTokenLimit: clampAutoCompactTokenLimit(
|
|
394
428
|
contextWindow,
|
|
@@ -396,6 +430,10 @@ export function applyProviderConfigHints(
|
|
|
396
430
|
Math.min(...softCandidates),
|
|
397
431
|
),
|
|
398
432
|
};
|
|
433
|
+
reasoningHintSources.set(result, Object.fromEntries([
|
|
434
|
+
...REASONING_CAPABILITY_FIELDS, "reasoningEfforts", "defaultReasoningEffort",
|
|
435
|
+
].map(field => [field, reasoningSource[field as keyof CatalogModel]])));
|
|
436
|
+
return result;
|
|
399
437
|
}
|
|
400
438
|
|
|
401
439
|
/** Project a configured row, optionally deferring sidecar attachment metadata until publication. */
|
|
@@ -468,13 +506,13 @@ export const CALLABLE_CONFIGURED_COMPATIBILITY_MODELS: Readonly<Record<string, R
|
|
|
468
506
|
"codebuddy-cn": new Set([
|
|
469
507
|
"default",
|
|
470
508
|
]),
|
|
471
|
-
// MiniMax serves MiniMax-M3.1-Flash
|
|
472
|
-
// does not list
|
|
509
|
+
// MiniMax serves MiniMax-M3.1-Flash to Token Plan keys, but its /v1/models roster
|
|
510
|
+
// does not list Flash (probed 2026-10-21), so a live roster would drop it.
|
|
473
511
|
minimax: new Set([
|
|
474
|
-
"MiniMax-M3.1-Flash
|
|
512
|
+
"MiniMax-M3.1-Flash",
|
|
475
513
|
]),
|
|
476
514
|
"minimax-cn": new Set([
|
|
477
|
-
"MiniMax-M3.1-Flash
|
|
515
|
+
"MiniMax-M3.1-Flash",
|
|
478
516
|
]),
|
|
479
517
|
kimi: new Set([
|
|
480
518
|
"k3[1m]",
|
|
@@ -695,6 +733,15 @@ export function discoveredPricingStatus(item: ProviderModelsApiItem): "free" | "
|
|
|
695
733
|
export function catalogHintsFromModelsApiItem(providerName: string, item: ProviderModelsApiItem): Partial<CatalogModel> {
|
|
696
734
|
const metadata = plainRecord(item.metadata);
|
|
697
735
|
const capabilityRecord = plainRecord(metadata?.capabilities) ?? plainRecord(item.capabilities);
|
|
736
|
+
const reasoningCapabilities: Partial<CatalogModel> = {};
|
|
737
|
+
for (const [wire, field] of [
|
|
738
|
+
["supports_reasoning", "supportsReasoning"],
|
|
739
|
+
["supports_thinking_toggle", "supportsThinkingToggle"],
|
|
740
|
+
["supports_reasoning_effort", "supportsReasoningEffort"],
|
|
741
|
+
["default_thinking_enabled", "defaultThinkingEnabled"],
|
|
742
|
+
] as const) {
|
|
743
|
+
if (typeof capabilityRecord?.[wire] === "boolean") reasoningCapabilities[field] = capabilityRecord[wire];
|
|
744
|
+
}
|
|
698
745
|
const limits = plainRecord(metadata?.limits);
|
|
699
746
|
const capabilityLimits = plainRecord(plainRecord(item.capabilities)?.limits);
|
|
700
747
|
const contextWindow =
|
|
@@ -746,7 +793,8 @@ export function catalogHintsFromModelsApiItem(providerName: string, item: Provid
|
|
|
746
793
|
?? item.reasoning_efforts
|
|
747
794
|
?? reasoningParameters?.efforts;
|
|
748
795
|
const listedReasoningEfforts = normalizedStringList(rawReasoningEfforts, 8, 24);
|
|
749
|
-
const reasoningEfforts =
|
|
796
|
+
const reasoningEfforts = reasoningCapabilities.supportsReasoning === false || reasoningCapabilities.supportsReasoningEffort === false ? []
|
|
797
|
+
: listedReasoningEfforts
|
|
750
798
|
? sanitizeCodexReasoningEfforts(listedReasoningEfforts)
|
|
751
799
|
: typeof rawReasoningEfforts === "boolean"
|
|
752
800
|
? (rawReasoningEfforts
|
|
@@ -764,6 +812,7 @@ export function catalogHintsFromModelsApiItem(providerName: string, item: Provid
|
|
|
764
812
|
...(contextWindow && contextWindow > 0 ? { contextWindow } : {}),
|
|
765
813
|
...(maxInputTokens && maxInputTokens > 0 ? { maxInputTokens } : {}),
|
|
766
814
|
...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
|
|
815
|
+
...reasoningCapabilities,
|
|
767
816
|
...(reasoningEfforts !== undefined ? { reasoningEfforts } : {}),
|
|
768
817
|
...(inputModalities ? { inputModalities } : {}),
|
|
769
818
|
...(capabilities ? { capabilities } : {}),
|
|
@@ -102,7 +102,7 @@ import type {
|
|
|
102
102
|
CatalogSourceEvidence,
|
|
103
103
|
CatalogTrustedOpenAiApiPolicySnapshot,
|
|
104
104
|
} from "../convergence-types";
|
|
105
|
-
import { CALLABLE_CONFIGURED_COMPATIBILITY_MODELS, applyProviderConfigHints } from "./model-hints";
|
|
105
|
+
import { CALLABLE_CONFIGURED_COMPATIBILITY_MODELS, applyProviderConfigHints, copyReasoningHintSource } from "./model-hints";
|
|
106
106
|
|
|
107
107
|
const DATED_VARIANT_YYYYMMDD = /^(\d{4})(\d{2})(\d{2})$/;
|
|
108
108
|
const DATED_VARIANT_YYMMDD = /^(2\d)(\d{2})(\d{2})$/;
|
|
@@ -250,7 +250,8 @@ export function mergeConfiguredModelsIntoLiveCatalog(opts: {
|
|
|
250
250
|
if (present.has(candidate.id)) continue;
|
|
251
251
|
const dated = out.find(live => isDatedVariantId(live.id, candidate.id));
|
|
252
252
|
if (dated) {
|
|
253
|
-
|
|
253
|
+
const alias = copyReasoningHintSource(dated, { ...dated, id: candidate.id });
|
|
254
|
+
out.push(applyProviderConfigHints(name, prov, alias, contextCap, metadataModelIdCaseFold, undefined, metadataConfigDir, includeVisionSidecar));
|
|
254
255
|
present.add(candidate.id);
|
|
255
256
|
continue;
|
|
256
257
|
}
|
|
@@ -38,8 +38,8 @@ export const NATIVE_GPT6_SOL_MODEL = "gpt-6-sol";
|
|
|
38
38
|
export const NATIVE_GPT6_LUNA_MODEL = "gpt-6-luna";
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* GPT-6.1 Sol, announced 2026-09-29 (https://openai.com/index/introducing-gpt-6-1-sol/).
|
|
42
|
-
*
|
|
41
|
+
* GPT-6.1 Sol, announced 2026-09-29 (https://openai.com/index/introducing-gpt-6-1-sol/).
|
|
42
|
+
* Astra and Luna stay on GPT-6.
|
|
43
43
|
*
|
|
44
44
|
* SELF-DESCRIBED: its row is pinned verbatim in `src/codex/data/roster-pinned-models.json` from
|
|
45
45
|
* openai/codex `codex-rs/models-manager/models.json` after #49318, which also made it the Codex
|
|
@@ -49,6 +49,14 @@ export const NATIVE_GPT6_LUNA_MODEL = "gpt-6-luna";
|
|
|
49
49
|
*/
|
|
50
50
|
export const NATIVE_GPT61_SOL_MODEL = "gpt-6.1-sol";
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* GPT-6.1 Terra, announced 2026-10-26 (https://openai.com/index/introducing-gpt-6-1-terra/).
|
|
54
|
+
* Its verbatim openai/codex models.json row is roster-pinned (captured 2026-10-27):
|
|
55
|
+
* low..ultra, default low, native 500,000 / 872,000 context, multi-agent v2, Fast only.
|
|
56
|
+
* Self-described and ungated alongside GPT-5.6 Terra; no default or roster migration.
|
|
57
|
+
*/
|
|
58
|
+
export const NATIVE_GPT61_TERRA_MODEL = "gpt-6.1-terra";
|
|
59
|
+
|
|
52
60
|
/**
|
|
53
61
|
* Unreleased GPT-6 Astra variant. No public row exists anywhere — neither the codex-rs bundle nor
|
|
54
62
|
* the 2026-09-23 main-account roster probe carries it — so it is ACCOUNT-GATED: hidden and
|
|
@@ -64,7 +72,7 @@ export const NATIVE_GPT6_ASTRA_MINOR_MODEL = "gpt-6-astra-minor";
|
|
|
64
72
|
* Context pair every GPT-6 native ships in its upstream row: a 272,000-token default window
|
|
65
73
|
* against an 872,000-token ceiling (and input limit) reached only through the long-window opt-in.
|
|
66
74
|
* The built-in GPT-6 rows and every configured native (below) inherit this one value, except
|
|
67
|
-
* GPT-6.1 Sol, whose default
|
|
75
|
+
* GPT-6.1 Sol and Terra, whose default windows are 500,000.
|
|
68
76
|
*/
|
|
69
77
|
export const NATIVE_GPT6_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
|
|
70
78
|
Object.freeze({ contextWindow: 272_000, maxContextWindow: 872_000, maxInputTokens: 872_000 });
|
|
@@ -81,6 +89,10 @@ export const NATIVE_GPT6_CONTEXT: Readonly<{ contextWindow: number; maxContextWi
|
|
|
81
89
|
export const NATIVE_GPT61_SOL_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
|
|
82
90
|
Object.freeze({ ...NATIVE_GPT6_CONTEXT, contextWindow: 500_000 });
|
|
83
91
|
|
|
92
|
+
/** GPT-6.1 Terra's native row ships 500,000 default / 872,000 maximum (not the API window). */
|
|
93
|
+
export const NATIVE_GPT61_TERRA_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
|
|
94
|
+
Object.freeze({ ...NATIVE_GPT6_CONTEXT, contextWindow: 500_000 });
|
|
95
|
+
|
|
84
96
|
/** Pinned row a configured native borrows its capability metadata from: the current Sol. */
|
|
85
97
|
export const CONFIGURED_NATIVE_OPENAI_TEMPLATE_MODEL = NATIVE_GPT61_SOL_MODEL;
|
|
86
98
|
|
|
@@ -149,6 +161,7 @@ const selfDescribedNativeModels = new Set<string>([
|
|
|
149
161
|
NATIVE_GPT6_SOL_MODEL,
|
|
150
162
|
NATIVE_GPT6_LUNA_MODEL,
|
|
151
163
|
NATIVE_GPT61_SOL_MODEL,
|
|
164
|
+
NATIVE_GPT61_TERRA_MODEL,
|
|
152
165
|
]);
|
|
153
166
|
|
|
154
167
|
export const SELF_DESCRIBED_NATIVE_OPENAI_MODELS: ReadonlySet<string> = selfDescribedNativeModels;
|
|
@@ -252,6 +265,7 @@ const BUILT_IN_NATIVE_OPENAI_MODELS: readonly string[] = Object.freeze([
|
|
|
252
265
|
NATIVE_GPT6_ASTRA_MODEL,
|
|
253
266
|
NATIVE_GPT6_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL,
|
|
254
267
|
NATIVE_GPT61_SOL_MODEL,
|
|
268
|
+
NATIVE_GPT61_TERRA_MODEL,
|
|
255
269
|
NATIVE_GPT6_ASTRA_MINOR_MODEL,
|
|
256
270
|
]);
|
|
257
271
|
|
|
@@ -397,4 +411,5 @@ export const NATIVE_MAIN_DRAIN_SENTINEL_MODELS: ReadonlySet<string> = new Set([
|
|
|
397
411
|
NATIVE_GPT6_SOL_MODEL,
|
|
398
412
|
NATIVE_GPT6_LUNA_MODEL,
|
|
399
413
|
NATIVE_GPT61_SOL_MODEL,
|
|
414
|
+
NATIVE_GPT61_TERRA_MODEL,
|
|
400
415
|
]);
|