@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
package/src/combos/resolve.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { getCachedProviderRoutingQuota } from "../providers/quota-routing-cache"
|
|
|
3
3
|
import type { ProviderQuota, ProviderQuotaWindow } from "../providers/quota-types";
|
|
4
4
|
import { sleepWithAbort } from "../lib/upstream-retry";
|
|
5
5
|
import {
|
|
6
|
+
clearComboTargetCooldowns,
|
|
6
7
|
coolComboTarget,
|
|
7
8
|
earliestComboCooldown,
|
|
8
9
|
isComboTargetInCooldown,
|
|
@@ -26,6 +27,7 @@ export interface ComboPick {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
interface SelectionState {
|
|
30
|
+
lastCooldownReprobeAt?: number;
|
|
29
31
|
activeKey?: string;
|
|
30
32
|
successes: number;
|
|
31
33
|
currentWeights: Map<string, number>;
|
|
@@ -286,12 +288,42 @@ function resetWindowIndex(
|
|
|
286
288
|
return selected;
|
|
287
289
|
}
|
|
288
290
|
|
|
291
|
+
/** Reserve one recovery pass before mutating cooldowns; preview and in-flight picks never call this. */
|
|
292
|
+
function reopenAllCooledTargets(
|
|
293
|
+
config: OcxConfig, comboId: string, now: number,
|
|
294
|
+
eligible?: (target: NormalizedComboTarget) => boolean,
|
|
295
|
+
): void {
|
|
296
|
+
const combo = getCombo(config, comboId);
|
|
297
|
+
if (!combo?.cooldownReprobe?.enabled) return;
|
|
298
|
+
const state = selectionState.get(comboId);
|
|
299
|
+
if (state?.lastCooldownReprobeAt !== undefined
|
|
300
|
+
&& now - state.lastCooldownReprobeAt < combo.cooldownReprobe.intervalMs) return;
|
|
301
|
+
const reprobeEligible = (target: NormalizedComboTarget): boolean => {
|
|
302
|
+
if (!targetProviderIsUsable(config, target, now)) return false;
|
|
303
|
+
try { return eligible?.(target) ?? true; } catch { return false; }
|
|
304
|
+
};
|
|
305
|
+
// Ordinary selection skips cooled targets without evaluating their request predicate.
|
|
306
|
+
// Preserve that behavior when a sibling is already available.
|
|
307
|
+
if (combo.targets.some(target => !isComboTargetInCooldown(comboId, target, now)
|
|
308
|
+
&& reprobeEligible(target))) return;
|
|
309
|
+
const usable = combo.targets.filter(reprobeEligible);
|
|
310
|
+
if (usable.length === 0 || !usable.every(target => isComboTargetInCooldown(comboId, target, now))) return;
|
|
311
|
+
// No await between reservation and reset: concurrent requests cannot reserve another pass.
|
|
312
|
+
const next = state ?? { successes: 0, currentWeights: new Map<string, number>(), successfulUses: new Map<string, number>() };
|
|
313
|
+
next.lastCooldownReprobeAt = now;
|
|
314
|
+
selectionState.set(comboId, next);
|
|
315
|
+
clearComboTargetCooldowns(comboId, usable.map(targetKey));
|
|
316
|
+
console.warn(`[combo] ${comboId}: reopening all-cooled targets; minimum reprobe interval ${combo.cooldownReprobe.intervalMs}ms`);
|
|
317
|
+
}
|
|
318
|
+
|
|
289
319
|
export function pickComboTarget(
|
|
290
320
|
config: OcxConfig,
|
|
291
321
|
comboId: string,
|
|
292
322
|
options: {
|
|
293
323
|
exclude?: Iterable<string>;
|
|
294
324
|
eligible?: (target: NormalizedComboTarget) => boolean;
|
|
325
|
+
/** Disable recovery for picks without request context or picks already in flight. */
|
|
326
|
+
allowCooldownReprobe?: boolean;
|
|
295
327
|
now?: number;
|
|
296
328
|
/** Inspect a round-robin choice without mutating its sticky/weight state. */
|
|
297
329
|
preview?: boolean;
|
|
@@ -302,6 +334,9 @@ export function pickComboTarget(
|
|
|
302
334
|
if (!combo) throw new UnknownComboError(comboId);
|
|
303
335
|
const excluded = new Set(options.exclude ?? []);
|
|
304
336
|
const now = options.now ?? Date.now();
|
|
337
|
+
if (options.allowCooldownReprobe !== false && !options.preview && excluded.size === 0) {
|
|
338
|
+
reopenAllCooledTargets(config, comboId, now, options.eligible);
|
|
339
|
+
}
|
|
305
340
|
const eligible = (target: NormalizedComboTarget): boolean =>
|
|
306
341
|
targetProviderIsUsable(config, target, now)
|
|
307
342
|
&& !isComboTargetInCooldown(comboId, target, now)
|
|
@@ -498,6 +533,8 @@ export async function pickComboTargetWithWait(
|
|
|
498
533
|
eligible?: (target: NormalizedComboTarget) => boolean;
|
|
499
534
|
waitForCooldownMs: number;
|
|
500
535
|
abortSignal?: AbortSignal;
|
|
536
|
+
/** Disable recovery when retrying a target after its normal cooldown. */
|
|
537
|
+
allowCooldownReprobe?: boolean;
|
|
501
538
|
now?: number;
|
|
502
539
|
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
503
540
|
},
|
|
@@ -505,6 +542,9 @@ export async function pickComboTargetWithWait(
|
|
|
505
542
|
const now = options.now ?? Date.now();
|
|
506
543
|
const excluded = new Set(options.exclude ?? []);
|
|
507
544
|
const customEligible = options.eligible;
|
|
545
|
+
if (options.allowCooldownReprobe !== false && excluded.size === 0 && !options.abortSignal?.aborted) {
|
|
546
|
+
reopenAllCooledTargets(config, comboId, now, customEligible);
|
|
547
|
+
}
|
|
508
548
|
const eligibleAt = (target: NormalizedComboTarget, at: number): boolean =>
|
|
509
549
|
!isComboTargetInCooldown(comboId, target, at)
|
|
510
550
|
&& (customEligible?.(target) ?? true);
|
|
@@ -529,6 +569,7 @@ export async function pickComboTargetWithWait(
|
|
|
529
569
|
const normalOnly = (target: NormalizedComboTarget): boolean =>
|
|
530
570
|
!target.lastResort && eligible(target);
|
|
531
571
|
const normalPick = pickComboTarget(config, comboId, {
|
|
572
|
+
allowCooldownReprobe: false,
|
|
532
573
|
exclude: excluded,
|
|
533
574
|
eligible: normalOnly,
|
|
534
575
|
now,
|
|
@@ -559,6 +600,7 @@ export async function pickComboTargetWithWait(
|
|
|
559
600
|
// The combo can be deleted or renamed while this request sleeps.
|
|
560
601
|
if (!getCombo(config, comboId)) return null;
|
|
561
602
|
const waited = pickComboTarget(config, comboId, {
|
|
603
|
+
allowCooldownReprobe: false,
|
|
562
604
|
exclude: excluded,
|
|
563
605
|
now: now + normalDelay,
|
|
564
606
|
eligible: target => !target.lastResort
|
|
@@ -576,6 +618,7 @@ export async function pickComboTargetWithWait(
|
|
|
576
618
|
const remainingWaitMs = options.waitForCooldownMs - spentWaitMs;
|
|
577
619
|
|
|
578
620
|
const pick = pickComboTarget(config, comboId, {
|
|
621
|
+
allowCooldownReprobe: false,
|
|
579
622
|
exclude: excluded,
|
|
580
623
|
eligible: target => eligibleAt(target, clock),
|
|
581
624
|
now: clock,
|
|
@@ -610,6 +653,7 @@ export async function pickComboTargetWithWait(
|
|
|
610
653
|
if (!getCombo(config, comboId)) return null;
|
|
611
654
|
return pickComboTarget(config, comboId, {
|
|
612
655
|
exclude: excluded,
|
|
656
|
+
allowCooldownReprobe: false,
|
|
613
657
|
now: clock + delay,
|
|
614
658
|
eligible: targetCandidate => eligibleAt(targetCandidate, clock + delay),
|
|
615
659
|
});
|
|
@@ -659,7 +703,7 @@ export function tryPickComboModel(config: OcxConfig, modelId: string, preview =
|
|
|
659
703
|
const comboId = resolveComboId(config, modelId);
|
|
660
704
|
if (!comboId) return null;
|
|
661
705
|
if (!getCombo(config, comboId)) throw new UnknownComboError(comboId);
|
|
662
|
-
const picked = pickComboTarget(config, comboId, { preview });
|
|
706
|
+
const picked = pickComboTarget(config, comboId, { preview, allowCooldownReprobe: false });
|
|
663
707
|
if (!picked) throw new NoAvailableComboTargetsError(comboId, comboExclusionReasons(config, comboId));
|
|
664
708
|
return picked;
|
|
665
709
|
}
|
package/src/combos/types.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { normalizeJevQuotaTiers, type ResolvedJevQuotaTiers } from "./jev-quota-config";
|
|
2
|
+
import {
|
|
3
|
+
JEV_SESSION_PIN_TTL_MAX_MS,
|
|
4
|
+
JEV_SESSION_PIN_TTL_MIN_MS,
|
|
5
|
+
normalizeJevSessionPin,
|
|
6
|
+
type JevSessionPinConfig,
|
|
7
|
+
} from "./jev-session-pin-config";
|
|
2
8
|
import { isCodexReasoningEffort, isDeclaredReasoningEffort } from "../reasoning-effort";
|
|
3
9
|
import { SUPPORTED_NATIVE_OPENAI_SLUGS } from "../codex/catalog/native-models";
|
|
4
10
|
import type { OcxComboConfig, OcxComboCooldownWaitPolicy, OcxComboDefaultEffort, OcxComboDefaultEffortMode, OcxComboReasoningEffortMode, OcxComboStrategy, OcxComboTarget, OcxProviderConfig } from "../types";
|
|
@@ -11,6 +17,7 @@ import {
|
|
|
11
17
|
} from "./jev-decision-contract";
|
|
12
18
|
|
|
13
19
|
export const COMBO_DEFAULT_WAIT_FOR_COOLDOWN_MS = 0;
|
|
20
|
+
export const COMBO_DEFAULT_COOLDOWN_REPROBE_INTERVAL_MS = 300_000;
|
|
14
21
|
export const JEV_MAX_CANDIDATE_FIELD_CHARS = 512;
|
|
15
22
|
export {
|
|
16
23
|
JEV_DECISION_TIMEOUT_DEFAULT_MS,
|
|
@@ -54,6 +61,7 @@ export interface NormalizedComboConfig {
|
|
|
54
61
|
stickyLimit: number;
|
|
55
62
|
cooldownMs?: number;
|
|
56
63
|
waitForCooldownMs: number;
|
|
64
|
+
cooldownReprobe?: { enabled: true; intervalMs: number };
|
|
57
65
|
/** `before-last-resort` defers lastResort targets while a normal one can be waited out (#5691). */
|
|
58
66
|
cooldownWaitPolicy: OcxComboCooldownWaitPolicy | null;
|
|
59
67
|
defaultEffort: OcxComboDefaultEffort | null;
|
|
@@ -79,6 +87,8 @@ export interface NormalizedComboConfig {
|
|
|
79
87
|
decisionTimeoutMs?: number;
|
|
80
88
|
decisionQuotaSignals?: boolean;
|
|
81
89
|
decisionQuotaTiers?: ResolvedJevQuotaTiers;
|
|
90
|
+
/** JEV only, opt-in: keep a session on the target JEV chose for it (#7525). */
|
|
91
|
+
sessionPin?: JevSessionPinConfig;
|
|
82
92
|
targets: NormalizedComboTarget[];
|
|
83
93
|
}
|
|
84
94
|
|
|
@@ -214,6 +224,24 @@ export function comboConfigIssues(
|
|
|
214
224
|
|| body.waitForCooldownMs > 600_000)) {
|
|
215
225
|
issues.push({ path: ["waitForCooldownMs"], message: "waitForCooldownMs must be an integer from 0 to 600000" });
|
|
216
226
|
}
|
|
227
|
+
if (body.cooldownReprobe !== undefined) {
|
|
228
|
+
const value = body.cooldownReprobe;
|
|
229
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
230
|
+
issues.push({ path: ["cooldownReprobe"], message: "cooldownReprobe must be an object" });
|
|
231
|
+
} else {
|
|
232
|
+
const reprobe = value as Record<string, unknown>;
|
|
233
|
+
if (typeof reprobe.enabled !== "boolean") {
|
|
234
|
+
issues.push({ path: ["cooldownReprobe", "enabled"], message: "cooldownReprobe.enabled must be a boolean" });
|
|
235
|
+
}
|
|
236
|
+
if (reprobe.intervalMs !== undefined && (typeof reprobe.intervalMs !== "number"
|
|
237
|
+
|| !Number.isSafeInteger(reprobe.intervalMs) || reprobe.intervalMs < 1000 || reprobe.intervalMs > 86_400_000)) {
|
|
238
|
+
issues.push({ path: ["cooldownReprobe", "intervalMs"], message: "cooldownReprobe.intervalMs must be an integer from 1000 to 86400000" });
|
|
239
|
+
}
|
|
240
|
+
if (Object.keys(reprobe).some(key => key !== "enabled" && key !== "intervalMs")) {
|
|
241
|
+
issues.push({ path: ["cooldownReprobe"], message: "cooldownReprobe supports only enabled and intervalMs" });
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
217
245
|
if (body.cooldownWaitPolicy !== undefined && body.cooldownWaitPolicy !== null
|
|
218
246
|
&& body.cooldownWaitPolicy !== "before-last-resort") {
|
|
219
247
|
issues.push({
|
|
@@ -310,6 +338,16 @@ export function comboConfigIssues(
|
|
|
310
338
|
if (field === "decisionQuotaSignals" ? typeof body[field] !== "boolean" : !normalizeJevQuotaTiers(body[field]))
|
|
311
339
|
issues.push({ path: [field], message: field === "decisionQuotaSignals" ? "decisionQuotaSignals must be a boolean" : "decisionQuotaTiers must contain finite 0..100 strictly ascending thresholds" });
|
|
312
340
|
}
|
|
341
|
+
if (body.sessionPin !== undefined && body.sessionPin !== null) {
|
|
342
|
+
if (body.strategy !== "jev") {
|
|
343
|
+
issues.push({ path: ["sessionPin"], message: 'sessionPin is only valid with strategy "jev"' });
|
|
344
|
+
} else if (!normalizeJevSessionPin(body.sessionPin)) {
|
|
345
|
+
issues.push({
|
|
346
|
+
path: ["sessionPin"],
|
|
347
|
+
message: `sessionPin must be { "ttlMs": <integer from ${JEV_SESSION_PIN_TTL_MIN_MS} to ${JEV_SESSION_PIN_TTL_MAX_MS}> }`,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
313
351
|
if (body.decisionProvider !== undefined && body.decisionProvider !== null) {
|
|
314
352
|
const decisionProvider = typeof body.decisionProvider === "string" ? body.decisionProvider.trim() : "";
|
|
315
353
|
if (!decisionProvider) {
|
|
@@ -517,6 +555,10 @@ export function normalizeComboConfig(raw: OcxComboConfig): NormalizedComboConfig
|
|
|
517
555
|
...(raw.allowMeteredTargets === true ? { allowMeteredTargets: true } : {}),
|
|
518
556
|
stickyLimit: raw.stickyLimit ?? 1,
|
|
519
557
|
cooldownMs: raw.cooldownMs,
|
|
558
|
+
...(raw.cooldownReprobe?.enabled === true ? { cooldownReprobe: {
|
|
559
|
+
enabled: true as const,
|
|
560
|
+
intervalMs: raw.cooldownReprobe.intervalMs ?? COMBO_DEFAULT_COOLDOWN_REPROBE_INTERVAL_MS,
|
|
561
|
+
} } : {}),
|
|
520
562
|
waitForCooldownMs: raw.waitForCooldownMs ?? COMBO_DEFAULT_WAIT_FOR_COOLDOWN_MS,
|
|
521
563
|
cooldownWaitPolicy: raw.cooldownWaitPolicy === "before-last-resort" ? "before-last-resort" : null,
|
|
522
564
|
defaultEffort,
|
|
@@ -533,6 +575,7 @@ export function normalizeComboConfig(raw: OcxComboConfig): NormalizedComboConfig
|
|
|
533
575
|
...(typeof raw.decisionTimeoutMs === "number" ? { decisionTimeoutMs: raw.decisionTimeoutMs } : {}),
|
|
534
576
|
...(raw.strategy === "jev" && raw.decisionQuotaSignals === true ? { decisionQuotaSignals: true } : {}),
|
|
535
577
|
...(raw.strategy === "jev" && normalizeJevQuotaTiers(raw.decisionQuotaTiers) ? { decisionQuotaTiers: normalizeJevQuotaTiers(raw.decisionQuotaTiers)! } : {}),
|
|
578
|
+
...(raw.strategy === "jev" && normalizeJevSessionPin(raw.sessionPin) ? { sessionPin: normalizeJevSessionPin(raw.sessionPin)! } : {}),
|
|
536
579
|
targets: raw.targets.map(target => ({
|
|
537
580
|
provider: target.provider.trim(),
|
|
538
581
|
model: target.model.trim(),
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
autoReviewModelOverridesConfigError,
|
|
17
17
|
autoReviewModelTargetConfigError,
|
|
18
18
|
modelCapabilitiesConfigError,
|
|
19
|
+
providerInputModalitiesConfigError,
|
|
19
20
|
sanitizeModelCapabilitiesForLoad,
|
|
20
21
|
modelDisplayNamesConfigError,
|
|
21
22
|
} from "./provider-validation";
|
|
@@ -359,6 +360,10 @@ export function sanitizeCapabilityDeclarationsForLoad(parsed: unknown): void {
|
|
|
359
360
|
for (const [name, value] of Object.entries(providers)) {
|
|
360
361
|
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
361
362
|
const provider = value as Record<string, unknown>;
|
|
363
|
+
if (providerInputModalitiesConfigError(provider.inputModalities) !== null) {
|
|
364
|
+
console.warn(`config.json provider ${JSON.stringify(redactSecretString(name))} has malformed inputModalities; restricting input modalities to text`);
|
|
365
|
+
provider.inputModalities = ["text"];
|
|
366
|
+
}
|
|
362
367
|
if (provider.modelCapabilities === undefined) continue;
|
|
363
368
|
if (modelCapabilitiesConfigError(provider.modelCapabilities) !== null) {
|
|
364
369
|
console.warn(`config.json provider ${JSON.stringify(redactSecretString(name))} has malformed modelCapabilities; retaining valid axes and restricting malformed input modalities to text`);
|
package/src/config/paths.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { chmodSync,
|
|
1
|
+
import { chmodSync, statSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
|
-
import { flushWindowsSecretAclReapsBeforeRemoval, hardenSecretDirAsync, windowsSecretAclApplies } from "../lib/windows-secret-acl";
|
|
4
|
+
import { flushWindowsSecretAclReapsBeforeRemoval, hardenSecretDirAsync, windowsSecretAclApplies, withWindowsSecretAclSettled } from "../lib/windows-secret-acl";
|
|
5
5
|
import { assertNotRealHomeUnderTest } from "../lib/test-home-guard";
|
|
6
6
|
import { isPassiveRead } from "../lib/passive-read";
|
|
7
7
|
import { trackBackgroundWork } from "../lib/background-work";
|
|
@@ -37,7 +37,8 @@ export function hardenConfigDir(): void {
|
|
|
37
37
|
// The guard runs before any mutation: refusing after chmod/ACL would already
|
|
38
38
|
// have changed the protected directory used by the test-home boundary.
|
|
39
39
|
assertNotRealHomeUnderTest(dir);
|
|
40
|
-
|
|
40
|
+
// Follow directory links as before, but never apply directory permissions to a file.
|
|
41
|
+
try { if (!statSync(dir).isDirectory()) return; } catch { return; }
|
|
41
42
|
// Windows privacy is enforced by NTFS ACLs. chmod only changes DOS attributes there;
|
|
42
43
|
// doing it before the ACL lookup can invalidate its ctime-based successful observation.
|
|
43
44
|
if (!windowsSecretAclApplies()) {
|
|
@@ -73,6 +74,21 @@ export async function flushConfigDirHardening(dir: string = getConfigDir()): Pro
|
|
|
73
74
|
if (flight) await flight;
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Intercept CA/token/picker writers call this after their last unrelated await. Parent
|
|
79
|
+
* inheritable ACL propagation can overwrite a child's concurrent explicit grant. Drain the
|
|
80
|
+
* registered config flight and overlapping work (including ancestors and timeout reaps),
|
|
81
|
+
* within one ACL deadline. Timeout refuses admission without dropping child cleanup ownership.
|
|
82
|
+
* The final registry check and synchronous callback share a turn: promise continuations and
|
|
83
|
+
* newly queued hardeners cannot start icacls between that check and secret publication.
|
|
84
|
+
* Keep the callback synchronous; an await inside it would reopen the propagation race.
|
|
85
|
+
*/
|
|
86
|
+
export async function withConfigDirHardeningSettled<T>(dir: string, mutate: () => T): Promise<T> {
|
|
87
|
+
// Async work registers before its factory starts, including the optional config flight.
|
|
88
|
+
// A separate flush here would escape the registry's total admission deadline.
|
|
89
|
+
return withWindowsSecretAclSettled(dir, mutate);
|
|
90
|
+
}
|
|
91
|
+
|
|
76
92
|
/** A settled ACL deadline is not proof its child has exited; stop must drain both before removal. */
|
|
77
93
|
export async function flushConfigDirHardeningAndReaps(dir: string): Promise<void> {
|
|
78
94
|
try { await flushConfigDirHardening(dir); }
|
|
@@ -54,6 +54,15 @@ export type PendingTeardownReceipt = {
|
|
|
54
54
|
* guessed receipt therefore fails closed into manual recovery.
|
|
55
55
|
*/
|
|
56
56
|
endpointSource: "exact" | "guessed";
|
|
57
|
+
/**
|
|
58
|
+
* Set when the stop handed its teardown to a replacement proxy instead of performing it
|
|
59
|
+
* (#7423). An update that is about to restart the proxy keeps Codex routing and the
|
|
60
|
+
* routed catalog in place across the gap, so a Codex process that loads them while the
|
|
61
|
+
* package is replaced still sees the routed rows. The obligation is the same one: the
|
|
62
|
+
* replacement discharges it after its first successful publication, and if no
|
|
63
|
+
* replacement ever comes up, the next `ocx stop` finishes it like any abandoned receipt.
|
|
64
|
+
*/
|
|
65
|
+
handover?: "update-restart";
|
|
57
66
|
};
|
|
58
67
|
|
|
59
68
|
/**
|
|
@@ -111,6 +120,7 @@ function isReceipt(value: unknown, nonce: string): value is PendingTeardownRecei
|
|
|
111
120
|
&& receipt.nonce === nonce
|
|
112
121
|
&& typeof receipt.createdAt === "string"
|
|
113
122
|
&& (receipt.endpointSource === "exact" || receipt.endpointSource === "guessed")
|
|
123
|
+
&& (receipt.handover === undefined || receipt.handover === "update-restart")
|
|
114
124
|
&& endpointOk;
|
|
115
125
|
}
|
|
116
126
|
|
|
@@ -119,11 +129,15 @@ export function claimPendingTeardown(
|
|
|
119
129
|
endpoint: { hostname: string; port: number },
|
|
120
130
|
endpointSource: "exact" | "guessed",
|
|
121
131
|
ownerPid: number = process.pid,
|
|
132
|
+
handover?: "update-restart",
|
|
122
133
|
): PendingTeardownReceipt {
|
|
123
134
|
const dir = getConfigDir();
|
|
124
135
|
assertNotRealHomeUnderTest(dir);
|
|
125
136
|
const nonce = randomBytes(16).toString("hex");
|
|
126
|
-
const receipt: PendingTeardownReceipt = {
|
|
137
|
+
const receipt: PendingTeardownReceipt = {
|
|
138
|
+
ownerPid, nonce, createdAt: new Date().toISOString(), endpoint, endpointSource,
|
|
139
|
+
...(handover ? { handover } : {}),
|
|
140
|
+
};
|
|
127
141
|
atomicWriteFile(pendingTeardownPathFor(nonce), JSON.stringify(receipt, null, 2) + "\n");
|
|
128
142
|
return receipt;
|
|
129
143
|
}
|
|
@@ -323,3 +337,10 @@ export function deferralMatchesReceipt(nonce: string | null): boolean {
|
|
|
323
337
|
if (!nonce || !NONCE_RE.test(nonce)) return false;
|
|
324
338
|
return readPendingTeardown(nonce).state === "valid";
|
|
325
339
|
}
|
|
340
|
+
|
|
341
|
+
/** Does this request name a valid obligation that an update handed to its replacement (#7423)? */
|
|
342
|
+
export function isUpdateHandoverReceipt(nonce: string | null): boolean {
|
|
343
|
+
if (!nonce || !NONCE_RE.test(nonce)) return false;
|
|
344
|
+
const read = readPendingTeardown(nonce);
|
|
345
|
+
return read.state === "valid" && read.receipt.handover === "update-restart";
|
|
346
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isCanonicalOpenAiForwardProvider } from "../providers/openai-tiers";
|
|
2
|
+
import { assertWorkBuddyDestination } from "../providers/workbuddy";
|
|
2
3
|
import { resolveDshAccountMessagesUrl } from "../providers/dsh-account-destination";
|
|
3
4
|
import { redactSecretString } from "../lib/redact";
|
|
4
5
|
import {
|
|
@@ -421,6 +422,12 @@ export function credentialPinnedProviderConfigError(
|
|
|
421
422
|
providerName: string,
|
|
422
423
|
provider: { adapter?: unknown; baseUrl?: unknown },
|
|
423
424
|
): string | null {
|
|
425
|
+
if (providerName === "workbuddy-ai" || provider.adapter === "workbuddy-ai") {
|
|
426
|
+
if (provider.adapter !== undefined && provider.adapter !== "workbuddy-ai") return 'adapter must stay "workbuddy-ai"';
|
|
427
|
+
try { if (typeof provider.baseUrl === "string") assertWorkBuddyDestination(provider.baseUrl); }
|
|
428
|
+
catch { return "WorkBuddy AI credentials require https://www.workbuddy.ai/v2"; }
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
424
431
|
if (providerName !== "dsh-account") return null;
|
|
425
432
|
if (provider.adapter !== undefined && provider.adapter !== "dsh-account") {
|
|
426
433
|
return 'adapter must stay "dsh-account": its account token is pinned to that adapter';
|
|
@@ -438,6 +445,14 @@ function capabilityRecord(value: unknown): value is Record<string, unknown> {
|
|
|
438
445
|
&& [Object.prototype, null].includes(Object.getPrototypeOf(value));
|
|
439
446
|
}
|
|
440
447
|
|
|
448
|
+
/** Provider-wide fallback; the same modality vocabulary as exact model declarations. */
|
|
449
|
+
export function providerInputModalitiesConfigError(value: unknown): string | null {
|
|
450
|
+
if (value === undefined) return null;
|
|
451
|
+
return Array.isArray(value) && value.length > 0
|
|
452
|
+
&& value.every(item => typeof item === "string" && ["text", "image", "audio", "video"].includes(item))
|
|
453
|
+
? null : "inputModalities must be a nonempty array of text, image, audio or video";
|
|
454
|
+
}
|
|
455
|
+
|
|
441
456
|
/** Strict per-model context-tier values; PATCH accepts null to clear the entire map. */
|
|
442
457
|
export function contextTierRecordConfigError(value: unknown, allowClear = false): string | null {
|
|
443
458
|
if (value === undefined || (allowClear && value === null)) return null;
|
|
@@ -463,7 +478,7 @@ export function modelCapabilitiesConfigError(value: unknown, allowTombstones = f
|
|
|
463
478
|
if (allowTombstones && row === null) continue;
|
|
464
479
|
if (!capabilityRecord(row)) return "modelCapabilities rows must be plain objects";
|
|
465
480
|
for (const [axis, declaration] of Object.entries(row)) {
|
|
466
|
-
if (!["inputModalities", "contextTier", "video", "deepseekImageFiles"].includes(axis)) return "modelCapabilities contains an unknown axis";
|
|
481
|
+
if (!["inputModalities", "contextTier", "video", "deepseekImageFiles", "supportsReasoning", "supportsThinkingToggle", "supportsReasoningEffort", "defaultThinkingEnabled"].includes(axis)) return "modelCapabilities contains an unknown axis";
|
|
467
482
|
if (allowTombstones && declaration === null) continue;
|
|
468
483
|
if (axis === "inputModalities") {
|
|
469
484
|
if (!Array.isArray(declaration) || declaration.length === 0
|
|
@@ -472,8 +487,8 @@ export function modelCapabilitiesConfigError(value: unknown, allowTombstones = f
|
|
|
472
487
|
}
|
|
473
488
|
} else if (axis === "contextTier") {
|
|
474
489
|
if (declaration !== "default" && declaration !== "long_context") return "modelCapabilities contextTier must be default or long_context";
|
|
475
|
-
} else if (
|
|
476
|
-
if (typeof declaration !== "boolean") return
|
|
490
|
+
} else if (["deepseekImageFiles", "supportsReasoning", "supportsThinkingToggle", "supportsReasoningEffort", "defaultThinkingEnabled"].includes(axis)) {
|
|
491
|
+
if (typeof declaration !== "boolean") return `modelCapabilities ${axis} must be a boolean`;
|
|
477
492
|
} else {
|
|
478
493
|
if (!capabilityRecord(declaration) || Object.keys(declaration).some(key => key !== "processing")) {
|
|
479
494
|
return "modelCapabilities video must be a plain object containing only processing";
|
|
@@ -506,6 +521,9 @@ export function mergeModelCapabilities(
|
|
|
506
521
|
} else if (axis === "deepseekImageFiles") {
|
|
507
522
|
if (value === null) delete row.deepseekImageFiles;
|
|
508
523
|
else row.deepseekImageFiles = value as boolean;
|
|
524
|
+
} else if (axis === "supportsReasoning" || axis === "supportsThinkingToggle" || axis === "supportsReasoningEffort" || axis === "defaultThinkingEnabled") {
|
|
525
|
+
if (value === null) delete row[axis];
|
|
526
|
+
else row[axis] = value as boolean;
|
|
509
527
|
} else if (axis === "video") {
|
|
510
528
|
if (value === null) delete row.video;
|
|
511
529
|
else {
|
|
@@ -533,7 +551,7 @@ export function sanitizeModelCapabilitiesForLoad(value: unknown): Record<string,
|
|
|
533
551
|
for (const [id, raw] of Object.entries(value).slice(0, MODEL_DISCOVERY_MAX_MODELS)) {
|
|
534
552
|
if (!capabilityRecord(raw) || !isValidModelDiscoveryModelId(id) || ["__proto__", "prototype", "constructor"].includes(id)) continue;
|
|
535
553
|
const row: Record<string, unknown> = {};
|
|
536
|
-
for (const axis of ["inputModalities", "contextTier", "video", "deepseekImageFiles"] as const) {
|
|
554
|
+
for (const axis of ["inputModalities", "contextTier", "video", "deepseekImageFiles", "supportsReasoning", "supportsThinkingToggle", "supportsReasoningEffort", "defaultThinkingEnabled"] as const) {
|
|
537
555
|
if (!Object.hasOwn(raw, axis)) continue;
|
|
538
556
|
const declaration = raw[axis];
|
|
539
557
|
if (modelCapabilitiesConfigError({ [id]: { [axis]: declaration } }) === null) row[axis] = declaration;
|
|
@@ -95,6 +95,17 @@ export function sanitizeRemovedOpenCodeFreeForLoad(parsed: unknown): void {
|
|
|
95
95
|
delete config.syncCodexSubagentDefaults;
|
|
96
96
|
delete config.injectionEffort;
|
|
97
97
|
}
|
|
98
|
+
// These sidecars default on or inherit global settings when absent. Preserve the
|
|
99
|
+
// off switch at both supported owners before pruning their retired model target.
|
|
100
|
+
for (const owner of [config, record(config.claudeCode)]) {
|
|
101
|
+
for (const key of ["visionSidecar", "webSearchSidecar"]) {
|
|
102
|
+
const sidecar = record(owner?.[key]);
|
|
103
|
+
if (!sidecar || !retired(sidecar.model)) continue;
|
|
104
|
+
sidecar.enabled = false;
|
|
105
|
+
delete sidecar.model;
|
|
106
|
+
changed = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
98
109
|
for (const [key, value] of Object.entries(config)) {
|
|
99
110
|
if (key === "providers" || !/model|provider|combo|routing|claudeCode|fallback|redirect|compaction|autoReview|advisor|tokenGuardian|images|codexRoleTiers|sidecar|shadowCallIntercept/i.test(key)) continue;
|
|
100
111
|
const next = prune(value, key === "claudeCode");
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
normalizeNonBlankStringArray,
|
|
14
14
|
normalizeAutoReviewModelOverrides,
|
|
15
15
|
modelCapabilitiesConfigError,
|
|
16
|
+
providerInputModalitiesConfigError,
|
|
16
17
|
contextTierRecordConfigError,
|
|
17
18
|
mergeModelCapabilities,
|
|
18
19
|
} from "../provider-validation";
|
|
@@ -310,6 +311,10 @@ export const providerConfigSchema = z.object({
|
|
|
310
311
|
// Raw diagnostics/writes reject malformed provenance; tolerant loads preserve the custom row.
|
|
311
312
|
anthropicOAuthInstance: z.literal("anthropic2").optional().catch(undefined),
|
|
312
313
|
modelCapabilities: modelCapabilitiesSchema.optional(),
|
|
314
|
+
inputModalities: z.unknown().superRefine((value, ctx) => {
|
|
315
|
+
const error = providerInputModalitiesConfigError(value);
|
|
316
|
+
if (error) ctx.addIssue({ code: "custom", message: error });
|
|
317
|
+
}).optional().transform(value => value as OcxProviderConfig["inputModalities"]),
|
|
313
318
|
modelContextTiers: z.unknown().superRefine((value, ctx) => {
|
|
314
319
|
const error = contextTierRecordConfigError(value);
|
|
315
320
|
if (error) ctx.addIssue({ code: "custom", message: error });
|
|
@@ -427,6 +432,7 @@ export const providerConfigSchema = z.object({
|
|
|
427
432
|
repairInvalidIds: z.boolean().optional(),
|
|
428
433
|
}).strict().optional(),
|
|
429
434
|
responsesSnapshotRepair: z.boolean().optional(),
|
|
435
|
+
messagePhaseInference: z.boolean().optional(),
|
|
430
436
|
hideRawReasoning: z.boolean().optional(),
|
|
431
437
|
// Invalid blocks degrade to "absent" rather than failing the whole config load: an unusable
|
|
432
438
|
// bridge block must never send an operator through invalid-config recovery for an opt-in
|