omnicell-router 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -7
- package/README.zh-CN.md +18 -5
- package/backend/dist/auth/api-keys.js +11 -0
- package/backend/dist/auth/key-models.d.ts +36 -0
- package/backend/dist/auth/key-models.js +99 -0
- package/backend/dist/capture/recorder.d.ts +4 -10
- package/backend/dist/capture/recorder.js +6 -58
- package/backend/dist/cli/clients/activity.js +2 -0
- package/backend/dist/cli/clients/base.d.ts +36 -11
- package/backend/dist/cli/clients/base.js +31 -15
- package/backend/dist/cli/clients/claude.d.ts +9 -0
- package/backend/dist/cli/clients/claude.js +6 -0
- package/backend/dist/cli/clients/codex.d.ts +78 -0
- package/backend/dist/cli/clients/codex.js +475 -57
- package/backend/dist/cli/clients/core-adapters.d.ts +1 -1
- package/backend/dist/cli/clients/core-adapters.js +1 -1
- package/backend/dist/cli/clients/dsh.d.ts +8 -0
- package/backend/dist/cli/clients/dsh.js +5 -0
- package/backend/dist/cli/clients/follow-catalog-sync.d.ts +62 -0
- package/backend/dist/cli/clients/follow-catalog-sync.js +435 -0
- package/backend/dist/cli/clients/grok.d.ts +15 -1
- package/backend/dist/cli/clients/grok.js +16 -2
- package/backend/dist/cli/clients/index.d.ts +13 -1
- package/backend/dist/cli/clients/index.js +97 -19
- package/backend/dist/cli/clients/kimi.d.ts +6 -0
- package/backend/dist/cli/clients/kimi.js +3 -0
- package/backend/dist/cli/clients/launcher.d.ts +1 -1
- package/backend/dist/cli/clients/model-meta.js +6 -3
- package/backend/dist/cli/clients/omp.d.ts +6 -0
- package/backend/dist/cli/clients/omp.js +3 -0
- package/backend/dist/cli/clients/openclaw.d.ts +6 -0
- package/backend/dist/cli/clients/openclaw.js +3 -0
- package/backend/dist/cli/clients/opencode.d.ts +8 -0
- package/backend/dist/cli/clients/opencode.js +8 -2
- package/backend/dist/cli/clients/pi.d.ts +6 -0
- package/backend/dist/cli/clients/pi.js +3 -0
- package/backend/dist/cli/clients/reserved.js +2 -0
- package/backend/dist/cli/clients/update-check.d.ts +37 -0
- package/backend/dist/cli/clients/update-check.js +309 -0
- package/backend/dist/cli/clients/workbuddy.d.ts +19 -0
- package/backend/dist/cli/clients/workbuddy.js +66 -0
- package/backend/dist/cli/index.js +5 -4
- package/backend/dist/cli/paths.js +8 -0
- package/backend/dist/cli/types.d.ts +101 -16
- package/backend/dist/config/comments-en.js +34 -25
- package/backend/dist/config/comments-zh.js +33 -24
- package/backend/dist/config/defaults.d.ts +280 -22
- package/backend/dist/config/defaults.js +279 -21
- package/backend/dist/config/env.d.ts +10 -0
- package/backend/dist/config/env.js +3 -2
- package/backend/dist/config/index.d.ts +22 -1
- package/backend/dist/config/index.js +218 -43
- package/backend/dist/config/migrations/v0-to-v1.d.ts +2 -2
- package/backend/dist/config/migrations/v10-to-v11.d.ts +38 -0
- package/backend/dist/config/migrations/v10-to-v11.js +43 -0
- package/backend/dist/config/migrations/v4-to-v5.d.ts +36 -0
- package/backend/dist/config/migrations/v4-to-v5.js +42 -0
- package/backend/dist/config/migrations/v5-to-v6.d.ts +27 -0
- package/backend/dist/config/migrations/v5-to-v6.js +29 -0
- package/backend/dist/config/migrations/v6-to-v7.d.ts +45 -0
- package/backend/dist/config/migrations/v6-to-v7.js +97 -0
- package/backend/dist/config/migrations/v7-to-v8.d.ts +36 -0
- package/backend/dist/config/migrations/v7-to-v8.js +43 -0
- package/backend/dist/config/migrations/v8-to-v9.d.ts +38 -0
- package/backend/dist/config/migrations/v8-to-v9.js +43 -0
- package/backend/dist/config/migrations/v9-to-v10.d.ts +51 -0
- package/backend/dist/config/migrations/v9-to-v10.js +71 -0
- package/backend/dist/config/runtime.js +1 -1
- package/backend/dist/config/schema.d.ts +3 -3
- package/backend/dist/config/schema.js +18 -4
- package/backend/dist/config/types.d.ts +221 -41
- package/backend/dist/egress-proxy/asset-download.d.ts +54 -0
- package/backend/dist/egress-proxy/asset-download.js +420 -0
- package/backend/dist/egress-proxy/manual-node-spec.d.ts +92 -0
- package/backend/dist/egress-proxy/manual-node-spec.js +408 -0
- package/backend/dist/egress-proxy/mihomo-binary.d.ts +54 -0
- package/backend/dist/egress-proxy/mihomo-binary.js +278 -0
- package/backend/dist/egress-proxy/mihomo-client.d.ts +94 -0
- package/backend/dist/egress-proxy/mihomo-client.js +308 -0
- package/backend/dist/egress-proxy/mihomo-config.d.ts +40 -0
- package/backend/dist/egress-proxy/mihomo-config.js +161 -0
- package/backend/dist/egress-proxy/mihomo-geo.d.ts +87 -0
- package/backend/dist/egress-proxy/mihomo-geo.js +213 -0
- package/backend/dist/egress-proxy/mihomo-logs.d.ts +43 -0
- package/backend/dist/egress-proxy/mihomo-logs.js +84 -0
- package/backend/dist/egress-proxy/mihomo-pac.d.ts +37 -0
- package/backend/dist/egress-proxy/mihomo-pac.js +75 -0
- package/backend/dist/egress-proxy/mihomo-rules-import.d.ts +43 -0
- package/backend/dist/egress-proxy/mihomo-rules-import.js +193 -0
- package/backend/dist/egress-proxy/mihomo-sidecar.d.ts +81 -0
- package/backend/dist/egress-proxy/mihomo-sidecar.js +637 -0
- package/backend/dist/forward-proxy/egress.d.ts +50 -11
- package/backend/dist/forward-proxy/egress.js +63 -17
- package/backend/dist/forward-proxy/h2-forward.js +42 -15
- package/backend/dist/forward-proxy/index.d.ts +11 -8
- package/backend/dist/forward-proxy/index.js +27 -60
- package/backend/dist/forward-proxy/interceptor.d.ts +3 -2
- package/backend/dist/forward-proxy/interceptor.js +4 -4
- package/backend/dist/forward-proxy/relay.js +3 -3
- package/backend/dist/forward-proxy/rules.d.ts +4 -4
- package/backend/dist/forward-proxy/rules.js +25 -4
- package/backend/dist/forward-proxy/server.d.ts +12 -16
- package/backend/dist/forward-proxy/server.js +237 -171
- package/backend/dist/harness/host/hosts.js +3 -2
- package/backend/dist/index.js +59 -19
- package/backend/dist/ingress-proxy/access-log.d.ts +176 -0
- package/backend/dist/ingress-proxy/access-log.js +774 -0
- package/backend/dist/ingress-proxy/ca-inventory.d.ts +106 -0
- package/backend/dist/ingress-proxy/ca-inventory.js +525 -0
- package/backend/dist/ingress-proxy/ca-trust.d.ts +96 -0
- package/backend/dist/ingress-proxy/ca-trust.js +315 -0
- package/backend/dist/ingress-proxy/ca.d.ts +104 -0
- package/backend/dist/ingress-proxy/ca.js +273 -0
- package/backend/dist/ingress-proxy/data-dir.d.ts +28 -0
- package/backend/dist/ingress-proxy/data-dir.js +45 -0
- package/backend/dist/ingress-proxy/egress.d.ts +151 -0
- package/backend/dist/ingress-proxy/egress.js +364 -0
- package/backend/dist/ingress-proxy/h2-forward.d.ts +66 -0
- package/backend/dist/ingress-proxy/h2-forward.js +561 -0
- package/backend/dist/ingress-proxy/index.d.ts +24 -0
- package/backend/dist/ingress-proxy/index.js +144 -0
- package/backend/dist/ingress-proxy/interceptor.d.ts +25 -0
- package/backend/dist/ingress-proxy/interceptor.js +52 -0
- package/backend/dist/ingress-proxy/ordered-relay.d.ts +29 -0
- package/backend/dist/ingress-proxy/ordered-relay.js +46 -0
- package/backend/dist/ingress-proxy/relay.d.ts +54 -0
- package/backend/dist/ingress-proxy/relay.js +188 -0
- package/backend/dist/ingress-proxy/rules.d.ts +195 -0
- package/backend/dist/ingress-proxy/rules.js +348 -0
- package/backend/dist/ingress-proxy/server.d.ts +153 -0
- package/backend/dist/ingress-proxy/server.js +2065 -0
- package/backend/dist/ingress-proxy/sni.d.ts +35 -0
- package/backend/dist/ingress-proxy/sni.js +124 -0
- package/backend/dist/ingress-proxy/status.d.ts +32 -0
- package/backend/dist/ingress-proxy/status.js +15 -0
- package/backend/dist/ingress-proxy/system-proxy.d.ts +112 -0
- package/backend/dist/ingress-proxy/system-proxy.js +481 -0
- package/backend/dist/ingress-proxy/traffic-delete.d.ts +21 -0
- package/backend/dist/ingress-proxy/traffic-delete.js +64 -0
- package/backend/dist/ingress-proxy/traffic-delete.worker.d.ts +44 -0
- package/backend/dist/ingress-proxy/traffic-delete.worker.js +228 -0
- package/backend/dist/ingress-proxy/traffic-files.d.ts +10 -0
- package/backend/dist/ingress-proxy/traffic-files.js +10 -0
- package/backend/dist/ingress-proxy/upstream-tls.d.ts +46 -0
- package/backend/dist/ingress-proxy/upstream-tls.js +105 -0
- package/backend/dist/ingress-proxy/ws-frames.d.ts +45 -0
- package/backend/dist/ingress-proxy/ws-frames.js +153 -0
- package/backend/dist/ir/adapters/anthropic-messages-stream.js +6 -1
- package/backend/dist/ir/adapters/anthropic-messages.js +12 -5
- package/backend/dist/ir/adapters/google-gemini-stream.js +7 -2
- package/backend/dist/ir/adapters/google-gemini.js +5 -2
- package/backend/dist/ir/adapters/openai-chat-stream.js +5 -1
- package/backend/dist/ir/adapters/openai-chat.d.ts +25 -0
- package/backend/dist/ir/adapters/openai-chat.js +50 -6
- package/backend/dist/ir/adapters/openai-responses-output.d.ts +1 -0
- package/backend/dist/ir/adapters/openai-responses-output.js +67 -21
- package/backend/dist/ir/adapters/openai-responses-stream.d.ts +13 -0
- package/backend/dist/ir/adapters/openai-responses-stream.js +34 -1
- package/backend/dist/ir/adapters/openai-responses.d.ts +92 -1
- package/backend/dist/ir/adapters/openai-responses.js +163 -12
- package/backend/dist/ir/capabilities.js +4 -0
- package/backend/dist/ir/media.d.ts +20 -0
- package/backend/dist/ir/media.js +41 -0
- package/backend/dist/ir/tool-identity.d.ts +35 -0
- package/backend/dist/ir/tool-identity.js +40 -0
- package/backend/dist/ir/types.d.ts +9 -1
- package/backend/dist/ir/validate.d.ts +24 -0
- package/backend/dist/ir/validate.js +113 -63
- package/backend/dist/local/build-jobs.d.ts +66 -0
- package/backend/dist/local/build-jobs.js +243 -0
- package/backend/dist/local/detect.d.ts +32 -0
- package/backend/dist/local/detect.js +145 -0
- package/backend/dist/local/draft-match.d.ts +58 -0
- package/backend/dist/local/draft-match.js +124 -0
- package/backend/dist/local/engine-runtime.d.ts +522 -0
- package/backend/dist/local/engine-runtime.js +1 -0
- package/backend/dist/local/engines.d.ts +241 -0
- package/backend/dist/local/engines.js +651 -0
- package/backend/dist/local/gguf.d.ts +35 -0
- package/backend/dist/local/gguf.js +314 -0
- package/backend/dist/local/hf.d.ts +120 -0
- package/backend/dist/local/hf.js +304 -0
- package/backend/dist/local/install.d.ts +90 -0
- package/backend/dist/local/install.js +421 -0
- package/backend/dist/local/llamacpp.d.ts +55 -0
- package/backend/dist/local/llamacpp.js +177 -0
- package/backend/dist/local/local-provider.d.ts +81 -0
- package/backend/dist/local/local-provider.js +301 -0
- package/backend/dist/local/machine-stats.d.ts +87 -0
- package/backend/dist/local/machine-stats.js +332 -0
- package/backend/dist/local/model-store.d.ts +347 -0
- package/backend/dist/local/model-store.js +1215 -0
- package/backend/dist/local/part-sweep.d.ts +32 -0
- package/backend/dist/local/part-sweep.js +156 -0
- package/backend/dist/local/plan.d.ts +65 -0
- package/backend/dist/local/plan.js +146 -0
- package/backend/dist/local/resources.d.ts +49 -0
- package/backend/dist/local/resources.js +64 -0
- package/backend/dist/local/run-stats.d.ts +95 -0
- package/backend/dist/local/run-stats.js +195 -0
- package/backend/dist/local/runner.d.ts +235 -0
- package/backend/dist/local/runner.js +1392 -0
- package/backend/dist/local/settings.d.ts +79 -0
- package/backend/dist/local/settings.js +180 -0
- package/backend/dist/local/strata-catalog.d.ts +30 -0
- package/backend/dist/local/strata-catalog.js +511 -0
- package/backend/dist/local/strata-drafting.d.ts +46 -0
- package/backend/dist/local/strata-drafting.js +265 -0
- package/backend/dist/local/strata.d.ts +278 -0
- package/backend/dist/local/strata.js +1392 -0
- package/backend/dist/local/tar.d.ts +20 -0
- package/backend/dist/local/tar.js +367 -0
- package/backend/dist/local/transport.d.ts +35 -0
- package/backend/dist/local/transport.js +89 -0
- package/backend/dist/local/tune.d.ts +58 -0
- package/backend/dist/local/tune.js +324 -0
- package/backend/dist/observability/http-exchange.d.ts +2 -2
- package/backend/dist/opencode/catalog/auto-pull.d.ts +14 -3
- package/backend/dist/opencode/catalog/auto-pull.js +284 -77
- package/backend/dist/opencode/catalog/ocr-store.d.ts +7 -6
- package/backend/dist/opencode/catalog/ocr-store.js +4 -2
- package/backend/dist/opencode/catalog/overrides-store.d.ts +15 -4
- package/backend/dist/opencode/catalog/overrides-store.js +28 -19
- package/backend/dist/opencode/catalog/reasoning-declaration.d.ts +35 -0
- package/backend/dist/opencode/catalog/reasoning-declaration.js +66 -0
- package/backend/dist/opencode/catalog/repository.js +28 -5
- package/backend/dist/opencode/catalog/sources/models-dev.d.ts +3 -3
- package/backend/dist/opencode/catalog/sources/models-dev.js +42 -14
- package/backend/dist/opencode/catalog/types.d.ts +42 -12
- package/backend/dist/opencode/catalog/types.js +38 -1
- package/backend/dist/opencode/credentials/def-materialize.js +27 -21
- package/backend/dist/opencode/credentials/ocr-store.js +11 -2
- package/backend/dist/opencode/credentials/sync.js +12 -3
- package/backend/dist/opencode/credentials/types.d.ts +31 -4
- package/backend/dist/opencode/credentials/types.js +25 -0
- package/backend/dist/opencode/migrate/engine.d.ts +20 -0
- package/backend/dist/opencode/migrate/engine.js +71 -0
- package/backend/dist/opencode/migrate/migrator.d.ts +11 -0
- package/backend/dist/opencode/migrate/migrator.js +6 -0
- package/backend/dist/opencode/migrate/steps/overrides-v1-to-v2.d.ts +6 -0
- package/backend/dist/opencode/migrate/steps/overrides-v1-to-v2.js +31 -0
- package/backend/dist/opencode/migrate/steps/providers-v1-to-v2.d.ts +6 -0
- package/backend/dist/opencode/migrate/steps/providers-v1-to-v2.js +62 -0
- package/backend/dist/opencode/probe.d.ts +21 -4
- package/backend/dist/opencode/probe.js +34 -10
- package/backend/dist/opencode/provider-def-adapters.d.ts +12 -11
- package/backend/dist/opencode/provider-def-adapters.js +43 -27
- package/backend/dist/opencode/provider-defs.d.ts +10 -16
- package/backend/dist/opencode/provider-defs.js +45 -45
- package/backend/dist/opencode/user-config.d.ts +23 -26
- package/backend/dist/opencode/user-config.js +95 -77
- package/backend/dist/pipeline/directives.d.ts +9 -4
- package/backend/dist/pipeline/directives.js +14 -10
- package/backend/dist/pipeline/orchestrator.d.ts +42 -13
- package/backend/dist/pipeline/orchestrator.js +514 -172
- package/backend/dist/plugins/builtin/model-gateway.js +38 -12
- package/backend/dist/plugins/environment-ack.d.ts +51 -0
- package/backend/dist/plugins/environment-ack.js +81 -0
- package/backend/dist/plugins/gateways.d.ts +6 -6
- package/backend/dist/plugins/gateways.js +2 -2
- package/backend/dist/plugins/host.d.ts +100 -16
- package/backend/dist/plugins/host.js +637 -99
- package/backend/dist/plugins/install-run.d.ts +27 -0
- package/backend/dist/plugins/install-run.js +99 -0
- package/backend/dist/plugins/manifest.d.ts +84 -32
- package/backend/dist/plugins/manifest.js +149 -45
- package/backend/dist/plugins/market-install.d.ts +18 -0
- package/backend/dist/plugins/market-install.js +111 -0
- package/backend/dist/plugins/market-source.d.ts +100 -0
- package/backend/dist/plugins/market-source.js +449 -0
- package/backend/dist/plugins/market-updates.d.ts +70 -0
- package/backend/dist/plugins/market-updates.js +97 -0
- package/backend/dist/plugins/market.d.ts +677 -0
- package/backend/dist/plugins/market.js +2113 -0
- package/backend/dist/plugins/source-index.d.ts +155 -0
- package/backend/dist/plugins/source-index.js +217 -0
- package/backend/dist/plugins/types.d.ts +402 -37
- package/backend/dist/projects/worktrees.d.ts +88 -0
- package/backend/dist/projects/worktrees.js +220 -0
- package/backend/dist/providers/boot-direct.d.ts +41 -7
- package/backend/dist/providers/boot-direct.js +284 -44
- package/backend/dist/providers/compat/tool-markup-recovery.js +31 -6
- package/backend/dist/providers/dial-wire.d.ts +17 -0
- package/backend/dist/providers/dial-wire.js +49 -0
- package/backend/dist/providers/executors/dispatch.d.ts +17 -7
- package/backend/dist/providers/executors/dispatch.js +28 -9
- package/backend/dist/providers/executors/openai-chat.js +14 -2
- package/backend/dist/providers/executors/plugin-adapter.d.ts +23 -1
- package/backend/dist/providers/executors/plugin-adapter.js +59 -3
- package/backend/dist/providers/member-match.d.ts +32 -9
- package/backend/dist/providers/member-match.js +65 -21
- package/backend/dist/providers/model-resolution.d.ts +62 -0
- package/backend/dist/providers/model-resolution.js +62 -0
- package/backend/dist/providers/price-order.d.ts +51 -0
- package/backend/dist/providers/price-order.js +54 -0
- package/backend/dist/providers/protocols-field.d.ts +24 -0
- package/backend/dist/providers/protocols-field.js +66 -0
- package/backend/dist/providers/provider-takedown.d.ts +5 -2
- package/backend/dist/providers/registry.d.ts +87 -26
- package/backend/dist/providers/registry.js +232 -121
- package/backend/dist/providers/selection.d.ts +91 -0
- package/backend/dist/providers/selection.js +158 -0
- package/backend/dist/providers/virtual-meta.d.ts +33 -2
- package/backend/dist/providers/virtual-meta.js +74 -18
- package/backend/dist/quota/cli-login.d.ts +25 -4
- package/backend/dist/quota/cli-login.js +38 -6
- package/backend/dist/quota/coverage-generation.d.ts +24 -0
- package/backend/dist/quota/coverage-generation.js +29 -0
- package/backend/dist/quota/declarations.js +8 -4
- package/backend/dist/quota/engine.js +2 -2
- package/backend/dist/quota/prober.d.ts +43 -2
- package/backend/dist/quota/prober.js +97 -22
- package/backend/dist/ratelimit/rate-limiter.d.ts +1 -1
- package/backend/dist/resilience/error-classifier.js +29 -0
- package/backend/dist/router/index.d.ts +1 -1
- package/backend/dist/router/index.js +17 -1
- package/backend/dist/router/layer2-decision.d.ts +1 -1
- package/backend/dist/router/layer2-decision.js +2 -2
- package/backend/dist/routes/console.js +1043 -405
- package/backend/dist/routes/environments.js +1 -1
- package/backend/dist/routes/local-models.d.ts +2 -0
- package/backend/dist/routes/local-models.js +1414 -0
- package/backend/dist/routes/mihomo.d.ts +2 -2
- package/backend/dist/routes/mihomo.js +20 -11
- package/backend/dist/routes/projects.js +121 -0
- package/backend/dist/server.js +409 -15
- package/backend/dist/session/session-manager.d.ts +42 -5
- package/backend/dist/session/session-manager.js +64 -11
- package/backend/dist/session/session-row.d.ts +29 -8
- package/backend/dist/session/session-row.js +18 -13
- package/backend/dist/snapshot/bundle.d.ts +40 -0
- package/backend/dist/snapshot/bundle.js +177 -0
- package/backend/dist/snapshot/handoff/compress.d.ts +46 -0
- package/backend/dist/snapshot/handoff/compress.js +77 -0
- package/backend/dist/snapshot/handoff/index.d.ts +119 -0
- package/backend/dist/snapshot/handoff/index.js +160 -0
- package/backend/dist/snapshot/handoff/jsonl-writer.d.ts +78 -0
- package/backend/dist/snapshot/handoff/jsonl-writer.js +175 -0
- package/backend/dist/snapshot/handoff/opencode-writer.d.ts +51 -0
- package/backend/dist/snapshot/handoff/opencode-writer.js +214 -0
- package/backend/dist/snapshot/handoff/summarize.d.ts +39 -0
- package/backend/dist/snapshot/handoff/summarize.js +118 -0
- package/backend/dist/snapshot/handoff/transcript.d.ts +71 -0
- package/backend/dist/snapshot/handoff/transcript.js +167 -0
- package/backend/dist/snapshot/media-fs.d.ts +10 -0
- package/backend/dist/snapshot/media-fs.js +50 -0
- package/backend/dist/snapshot/media.d.ts +32 -0
- package/backend/dist/snapshot/media.js +87 -0
- package/backend/dist/snapshot/store.d.ts +226 -0
- package/backend/dist/snapshot/store.js +887 -0
- package/backend/dist/snapshot/tree.d.ts +112 -0
- package/backend/dist/snapshot/tree.js +207 -0
- package/backend/dist/snapshot/types.d.ts +212 -0
- package/backend/dist/snapshot/types.js +14 -0
- package/backend/dist/snapshot/view.d.ts +19 -0
- package/backend/dist/snapshot/view.js +57 -0
- package/backend/dist/snapshot/write-worker.d.ts +67 -0
- package/backend/dist/snapshot/write-worker.js +129 -0
- package/backend/dist/surfaces/anthropic.js +4 -1
- package/backend/dist/surfaces/body-admission.d.ts +344 -0
- package/backend/dist/surfaces/body-admission.js +818 -0
- package/backend/dist/surfaces/chat-pipeline.js +8 -0
- package/backend/dist/surfaces/decision-pipeline.js +10 -7
- package/backend/dist/surfaces/gateway-catalog.d.ts +26 -0
- package/backend/dist/surfaces/gateway-catalog.js +202 -0
- package/backend/dist/surfaces/gateway-chat.d.ts +7 -11
- package/backend/dist/surfaces/gateway-chat.js +50 -12
- package/backend/dist/surfaces/ocr-headers.d.ts +6 -4
- package/backend/dist/surfaces/ocr-headers.js +11 -7
- package/backend/dist/surfaces/systemone.js +1 -1
- package/backend/dist/surfaces/transport-fastify.js +32 -5
- package/backend/dist/surfaces/transport-node-http.d.ts +51 -6
- package/backend/dist/surfaces/transport-node-http.js +76 -16
- package/backend/dist/surfaces/types.d.ts +11 -3
- package/backend/dist/trace/persist.js +21 -1
- package/backend/dist/trace/tracker.d.ts +35 -3
- package/backend/dist/trace/tracker.js +23 -0
- package/backend/dist/types/openai.d.ts +8 -0
- package/backend/dist/types/router.d.ts +17 -6
- package/backend/dist/types/router.js +14 -2
- package/backend/dist/utils/client-families.d.ts +66 -0
- package/backend/dist/utils/client-families.js +127 -0
- package/backend/dist/utils/event-ring.d.ts +1 -1
- package/backend/dist/utils/event-ring.js +1 -1
- package/backend/dist/utils/proxy-node.js +1 -1
- package/backend/dist/utils/proxy.d.ts +135 -11
- package/backend/dist/utils/proxy.js +144 -29
- package/backend/dist/utils/run-command.d.ts +21 -1
- package/backend/dist/utils/run-command.js +64 -4
- package/backend/dist/utils/server-liveness.d.ts +28 -0
- package/backend/dist/utils/server-liveness.js +32 -0
- package/backend/dist/utils/session-file.d.ts +28 -0
- package/backend/dist/utils/session-file.js +34 -0
- package/frontend/dist/assets/antigravity.color-DXFfVr6X.svg +39 -0
- package/frontend/dist/assets/gemini-cli.color-BfquLd1p.svg +1 -0
- package/frontend/dist/assets/index-CTZNvn1d.js +1707 -0
- package/frontend/dist/assets/{index-DxZ9MHKB.css → index-CqDSOPQ0.css} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +3 -1
- package/frontend/dist/assets/index-55VVwfFQ.js +0 -1521
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CatalogModel } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The catalog's DECLARED on/off fact for a reasoning model — the one reader of
|
|
4
|
+
* "may this model be turned off?", shared by the boot/routing side
|
|
5
|
+
* (`providers/boot-direct.ts`) and the published-capability side
|
|
6
|
+
* (`providers/virtual-meta.ts`).
|
|
7
|
+
*
|
|
8
|
+
* It lives in this neutral module rather than `boot-direct` because both
|
|
9
|
+
* consumers need it and `virtual-meta` is imported by `boot-direct`, so
|
|
10
|
+
* exporting it from `boot-direct` would close a load-time module cycle — the
|
|
11
|
+
* same class of failure as the `surfaces/table.ts` cycle the body-admission ADR
|
|
12
|
+
* documents.
|
|
13
|
+
*
|
|
14
|
+
* models.dev spells "off exists" four ways, and this function reads all four:
|
|
15
|
+
* - a bare `toggle` row (no effort table) — an on/off control, no levels;
|
|
16
|
+
* - an effort table containing `none` — off is spelled as a level;
|
|
17
|
+
* - a `toggle` beside an effort table or budget — off is that toggle;
|
|
18
|
+
* - a budget whose `min` is absent or ≤ 0 — budget ZERO is a legal request.
|
|
19
|
+
*
|
|
20
|
+
* It spells "always thinks" three ways:
|
|
21
|
+
* - an effort table WITHOUT `none` and WITHOUT a `toggle` (2,873 rows — OpenAI
|
|
22
|
+
* `gpt-5` / `gpt-6-astra`, Gemini 3.x). A `budget` beside the table does NOT
|
|
23
|
+
* cancel this: `min: 1024` is a relay's thinking-ON floor, not the off fact,
|
|
24
|
+
* and reading it as "always thinks" clamped real off-asks up to `low` on the
|
|
25
|
+
* 162 claude-opus relay rows — a silent capability LOSS.
|
|
26
|
+
* - an empty `[]` (971 rows — MiniMax M2): always-on, no control at all;
|
|
27
|
+
* - a budget-only row with `min > 0` and no toggle: zero is out of range, so
|
|
28
|
+
* off is inexpressible (87 rows — Anthropic claude `min: 1024`, Gemini 2.5
|
|
29
|
+
* Pro `min: 128`).
|
|
30
|
+
*
|
|
31
|
+
* The `min` of a budget-only row therefore DOES decide (zero legal or not);
|
|
32
|
+
* the `min` beside an effort table does NOT (the table shape decides). Returns
|
|
33
|
+
* `undefined` only when the declaration states no ladder and no budget.
|
|
34
|
+
*/
|
|
35
|
+
export declare function catalogDisableable(catModel: CatalogModel | undefined): boolean | undefined;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalog's DECLARED on/off fact for a reasoning model — the one reader of
|
|
3
|
+
* "may this model be turned off?", shared by the boot/routing side
|
|
4
|
+
* (`providers/boot-direct.ts`) and the published-capability side
|
|
5
|
+
* (`providers/virtual-meta.ts`).
|
|
6
|
+
*
|
|
7
|
+
* It lives in this neutral module rather than `boot-direct` because both
|
|
8
|
+
* consumers need it and `virtual-meta` is imported by `boot-direct`, so
|
|
9
|
+
* exporting it from `boot-direct` would close a load-time module cycle — the
|
|
10
|
+
* same class of failure as the `surfaces/table.ts` cycle the body-admission ADR
|
|
11
|
+
* documents.
|
|
12
|
+
*
|
|
13
|
+
* models.dev spells "off exists" four ways, and this function reads all four:
|
|
14
|
+
* - a bare `toggle` row (no effort table) — an on/off control, no levels;
|
|
15
|
+
* - an effort table containing `none` — off is spelled as a level;
|
|
16
|
+
* - a `toggle` beside an effort table or budget — off is that toggle;
|
|
17
|
+
* - a budget whose `min` is absent or ≤ 0 — budget ZERO is a legal request.
|
|
18
|
+
*
|
|
19
|
+
* It spells "always thinks" three ways:
|
|
20
|
+
* - an effort table WITHOUT `none` and WITHOUT a `toggle` (2,873 rows — OpenAI
|
|
21
|
+
* `gpt-5` / `gpt-6-astra`, Gemini 3.x). A `budget` beside the table does NOT
|
|
22
|
+
* cancel this: `min: 1024` is a relay's thinking-ON floor, not the off fact,
|
|
23
|
+
* and reading it as "always thinks" clamped real off-asks up to `low` on the
|
|
24
|
+
* 162 claude-opus relay rows — a silent capability LOSS.
|
|
25
|
+
* - an empty `[]` (971 rows — MiniMax M2): always-on, no control at all;
|
|
26
|
+
* - a budget-only row with `min > 0` and no toggle: zero is out of range, so
|
|
27
|
+
* off is inexpressible (87 rows — Anthropic claude `min: 1024`, Gemini 2.5
|
|
28
|
+
* Pro `min: 128`).
|
|
29
|
+
*
|
|
30
|
+
* The `min` of a budget-only row therefore DOES decide (zero legal or not);
|
|
31
|
+
* the `min` beside an effort table does NOT (the table shape decides). Returns
|
|
32
|
+
* `undefined` only when the declaration states no ladder and no budget.
|
|
33
|
+
*/
|
|
34
|
+
export function catalogDisableable(catModel) {
|
|
35
|
+
const opts = catModel?.reasoningOptions;
|
|
36
|
+
if (!Array.isArray(opts) || opts.length === 0)
|
|
37
|
+
return undefined;
|
|
38
|
+
const hasToggle = opts.some((o) => o?.type === 'toggle');
|
|
39
|
+
const effort = opts.find((o) => o?.type === 'effort');
|
|
40
|
+
const hasEffortTable = !!(effort && Array.isArray(effort.values) && effort.values.length > 0);
|
|
41
|
+
// A bare toggle (no table to decide against) asserts off on its own.
|
|
42
|
+
if (hasToggle && !hasEffortTable && !opts.some((o) => o?.type === 'budget_tokens'))
|
|
43
|
+
return true;
|
|
44
|
+
if (hasEffortTable) {
|
|
45
|
+
// `none` in the table ⇒ off is a level. Otherwise the TOGGLE decides (a
|
|
46
|
+
// toggle beside the table is off; no toggle ⇒ always-think). A budget
|
|
47
|
+
// beside the table never overrides either way.
|
|
48
|
+
if (effort.values.includes('none'))
|
|
49
|
+
return true;
|
|
50
|
+
return hasToggle ? true : false;
|
|
51
|
+
}
|
|
52
|
+
// A toggle + budget (no table) ⇒ off is the toggle. A budget ZERO is also
|
|
53
|
+
// legal there, but the toggle already answers `true`; keep reading `min`
|
|
54
|
+
// below so a budget-only row is judged by its range.
|
|
55
|
+
const budget = opts.find((o) => o?.type === 'budget_tokens');
|
|
56
|
+
if (budget) {
|
|
57
|
+
if (hasToggle)
|
|
58
|
+
return true;
|
|
59
|
+
// Budget-only: `min > 0` ⇒ zero out of range ⇒ always-think; absent or ≤ 0
|
|
60
|
+
// ⇒ zero legal ⇒ off exists.
|
|
61
|
+
return typeof budget.min === 'number' && budget.min > 0 ? false : true;
|
|
62
|
+
}
|
|
63
|
+
// A toggle with no table and no budget already returned above; anything left
|
|
64
|
+
// states no ladder and no budget: "no control", which withholds nothing.
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
@@ -202,8 +202,16 @@ export class CatalogRepository {
|
|
|
202
202
|
console.log(`[OCR] Catalog store: ${this.ocrLoadOrigin} (${this.ocr?.length ?? 0} providers) — ${getOcrStorePath()}`);
|
|
203
203
|
// Auto-pull models for custom providers in the background (ADD-ONLY,
|
|
204
204
|
// gated by catalog.autoPullModels + the per-provider autoPullPatterns
|
|
205
|
-
// whitelist) — boot completes without waiting for it.
|
|
206
|
-
|
|
205
|
+
// whitelist) — boot completes without waiting for it. The boot fire waits
|
|
206
|
+
// for the plugin host's first load: catalog start precedes
|
|
207
|
+
// loadInstalledPlugins(), and a plugin-owned wire answers the pull through
|
|
208
|
+
// its own pullModels() — sweeping first would read every plugin wire as
|
|
209
|
+
// "plugin is not installed".
|
|
210
|
+
void (async () => {
|
|
211
|
+
const { pluginsReady } = await import('../../plugins/host.js');
|
|
212
|
+
await pluginsReady;
|
|
213
|
+
await this.autoPullSafely();
|
|
214
|
+
})();
|
|
207
215
|
}
|
|
208
216
|
/** Auto-pull sweep with full failure containment (scheduler + boot hook). */
|
|
209
217
|
async autoPullSafely() {
|
|
@@ -217,6 +225,15 @@ export class CatalogRepository {
|
|
|
217
225
|
// are routable (and visible in the matrix) without a restart/console hit.
|
|
218
226
|
requestPoolRefresh();
|
|
219
227
|
}
|
|
228
|
+
// Stale `disabled` flags cleared on defined models change the defs file
|
|
229
|
+
// with no new model — the pool must resync too, or a previously hidden
|
|
230
|
+
// model stays excluded from routing until the next restart.
|
|
231
|
+
const cleared = results.reduce((n, r) => n + (r.cleared ?? 0), 0);
|
|
232
|
+
if (cleared > 0) {
|
|
233
|
+
console.log(`[OCR] Auto model pull: cleared stale hidden flags on ${cleared} model(s)`);
|
|
234
|
+
if (pulled === 0)
|
|
235
|
+
requestPoolRefresh();
|
|
236
|
+
}
|
|
220
237
|
}
|
|
221
238
|
catch {
|
|
222
239
|
// best effort — next sync period retries
|
|
@@ -606,7 +623,7 @@ export class CatalogRepository {
|
|
|
606
623
|
unified.set(v.id, {
|
|
607
624
|
id: v.id,
|
|
608
625
|
name: v.name,
|
|
609
|
-
|
|
626
|
+
protocols: v.protocols,
|
|
610
627
|
baseURL: v.baseURL,
|
|
611
628
|
// dynamic tag — final value derived at the step-5 mapping
|
|
612
629
|
custom: false,
|
|
@@ -782,8 +799,8 @@ export class CatalogRepository {
|
|
|
782
799
|
? [{ type: 'effort', values: [...entry.reasoningEfforts] }]
|
|
783
800
|
: [{ type: 'toggle' }]; // empty = no explicit level control
|
|
784
801
|
}
|
|
785
|
-
if (entry.
|
|
786
|
-
model.
|
|
802
|
+
if (entry.protocols !== undefined)
|
|
803
|
+
model.protocols = entry.protocols;
|
|
787
804
|
if (entry.defaultEffort !== undefined) {
|
|
788
805
|
if (entry.defaultEffort === null)
|
|
789
806
|
delete model.defaultEffort; // clear → follow catalog/def
|
|
@@ -797,6 +814,12 @@ export class CatalogRepository {
|
|
|
797
814
|
.filter((v) => v.id && v.effort)
|
|
798
815
|
.map((v) => ({ id: v.id, settings: { reasoningEffort: v.effort } }));
|
|
799
816
|
}
|
|
817
|
+
// Operator type correction — the ONLY editing plane for admission, since
|
|
818
|
+
// the routing pool decides on the model's type (e.g. opt a genuinely
|
|
819
|
+
// dual-use image model into the text pool).
|
|
820
|
+
if (entry.type !== undefined && entry.type !== null) {
|
|
821
|
+
model.type = entry.type;
|
|
822
|
+
}
|
|
800
823
|
}
|
|
801
824
|
}
|
|
802
825
|
// 4. live service baseURL hints (effective routing endpoints)
|
|
@@ -2,9 +2,9 @@ import type { CatalogProviderRecord, CatalogSourceState } from '../types.js';
|
|
|
2
2
|
export declare function modelsDevLogoUrl(providerId: string): string;
|
|
3
3
|
/** Pure normalizer (unit-tested without network). models.dev shape ≈ opencode schema. */
|
|
4
4
|
export declare function normalizeModelsDev(raw: Record<string, any>): CatalogProviderRecord[];
|
|
5
|
-
/**
|
|
6
|
-
* Idempotent
|
|
7
|
-
*
|
|
5
|
+
/** External npm / raw protocol strings become OCR `protocols: string[]`.
|
|
6
|
+
* Idempotent on already-canonical ids. Cache replays call this too, including
|
|
7
|
+
* caches a pre-protocols build wrote in the retired singular `npm` slot. */
|
|
8
8
|
export declare function withProtocolIds(providers: CatalogProviderRecord[]): CatalogProviderRecord[];
|
|
9
9
|
/**
|
|
10
10
|
* Sync models.dev: network → 24h cache → stale-on-error.
|
|
@@ -24,8 +24,10 @@ export function normalizeModelsDev(raw) {
|
|
|
24
24
|
models.push({
|
|
25
25
|
id: mid,
|
|
26
26
|
name: m.name || undefined,
|
|
27
|
-
// model-level protocol override; SDK package names
|
|
28
|
-
|
|
27
|
+
// model-level protocol override; SDK package names → protocols[] below
|
|
28
|
+
protocols: m.provider && typeof m.provider === 'object' && m.provider.npm
|
|
29
|
+
? [String(m.provider.npm)]
|
|
30
|
+
: undefined,
|
|
29
31
|
attachment: m.attachment === true || undefined,
|
|
30
32
|
reasoning: m.reasoning === true || undefined,
|
|
31
33
|
tool_call: m.tool_call === true || undefined,
|
|
@@ -35,9 +37,19 @@ export function normalizeModelsDev(raw) {
|
|
|
35
37
|
// false with unknown, leaving the provider layer unable to strip the
|
|
36
38
|
// param (upstream 400 "`temperature` is deprecated").
|
|
37
39
|
temperature: m.temperature === true ? true : m.temperature === false ? false : undefined,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// `reasoning_options` is required by models.dev whenever
|
|
41
|
+
// `reasoning: true`, and an EMPTY array is a real declaration:
|
|
42
|
+
// "always-on, the caller has no level control". Folding `[]` into
|
|
43
|
+
// `undefined` would erase that and let the legacy boolean expansion
|
|
44
|
+
// advertise all seven levels on 971 always-on rows (ADR-0035 rule 3).
|
|
45
|
+
// Keep the array verbatim (`[]` included); a source that truly omits
|
|
46
|
+
// the field stays `undefined`.
|
|
47
|
+
reasoningOptions: Array.isArray(m.reasoning_options) ? m.reasoning_options : undefined,
|
|
48
|
+
// models.dev publishes the model type as `type` (its `ModelTypeV2`
|
|
49
|
+
// enum: chat/image/embedding/…). OCR stores it under the SAME name —
|
|
50
|
+
// one vocabulary from upstream to the wire. `modalities.output` is NOT
|
|
51
|
+
// a substitute: an embedding or ASR row declares `output: ['text']`.
|
|
52
|
+
type: m.type ? String(m.type) : undefined,
|
|
41
53
|
interleaved: m.interleaved && typeof m.interleaved === 'object' ? m.interleaved : undefined,
|
|
42
54
|
structured_output: m.structured_output === true || undefined,
|
|
43
55
|
status: m.status || undefined,
|
|
@@ -62,7 +74,7 @@ export function normalizeModelsDev(raw) {
|
|
|
62
74
|
id,
|
|
63
75
|
name: entry.name || id,
|
|
64
76
|
logo: modelsDevLogoUrl(id),
|
|
65
|
-
|
|
77
|
+
protocols: entry.npm ? [String(entry.npm)] : undefined,
|
|
66
78
|
api: entry.api || undefined,
|
|
67
79
|
doc: entry.doc || undefined,
|
|
68
80
|
env: Array.isArray(entry.env) ? entry.env : undefined,
|
|
@@ -75,15 +87,31 @@ export function normalizeModelsDev(raw) {
|
|
|
75
87
|
list.sort((a, b) => (a.name || '').localeCompare(b.name || ''));
|
|
76
88
|
return withProtocolIds(list);
|
|
77
89
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Idempotent
|
|
80
|
-
*
|
|
90
|
+
/** External npm / raw protocol strings become OCR `protocols: string[]`.
|
|
91
|
+
* Idempotent on already-canonical ids. Cache replays call this too, including
|
|
92
|
+
* caches a pre-protocols build wrote in the retired singular `npm` slot. */
|
|
81
93
|
export function withProtocolIds(providers) {
|
|
82
|
-
return providers.map((p) =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
94
|
+
return providers.map((p) => {
|
|
95
|
+
const legacyProvider = p;
|
|
96
|
+
const rawProvider = p.protocols ?? (typeof legacyProvider.npm === 'string' ? [legacyProvider.npm] : []);
|
|
97
|
+
const protocols = rawProvider
|
|
98
|
+
.map((id) => protocolIdFromNpm(id) ?? id)
|
|
99
|
+
.filter((id) => typeof id === 'string' && id.length > 0);
|
|
100
|
+
const { npm: _legacyProviderNpm, ...provider } = legacyProvider;
|
|
101
|
+
return {
|
|
102
|
+
...provider,
|
|
103
|
+
protocols: protocols.length > 0 ? [...new Set(protocols)] : undefined,
|
|
104
|
+
models: p.models.map((m) => {
|
|
105
|
+
const legacyModel = m;
|
|
106
|
+
const rawModel = m.protocols ?? (typeof legacyModel.npm === 'string' ? [legacyModel.npm] : []);
|
|
107
|
+
const mp = rawModel
|
|
108
|
+
.map((id) => protocolIdFromNpm(id) ?? id)
|
|
109
|
+
.filter((id) => typeof id === 'string' && id.length > 0);
|
|
110
|
+
const { npm: _legacyNpm, ...model } = legacyModel;
|
|
111
|
+
return mp.length > 0 ? { ...model, protocols: [...new Set(mp)] } : { ...model, protocols: undefined };
|
|
112
|
+
}),
|
|
113
|
+
};
|
|
114
|
+
});
|
|
87
115
|
}
|
|
88
116
|
/**
|
|
89
117
|
* Sync models.dev: network → 24h cache → stale-on-error.
|
|
@@ -33,18 +33,38 @@ export interface CatalogReasoningOption {
|
|
|
33
33
|
min?: number;
|
|
34
34
|
[k: string]: unknown;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A model's KIND (what it is FOR) — the single-value enum copied verbatim from
|
|
38
|
+
* the models.dev schema (`ModelTypeV2Values`). OCR names the field `type`, the
|
|
39
|
+
* SAME word models.dev publishes, so there is one vocabulary: the upstream
|
|
40
|
+
* spelling, the stored field, and the console all say `type`.
|
|
41
|
+
*
|
|
42
|
+
* One model has exactly ONE type in models.dev (multi-capability lives in
|
|
43
|
+
* `modalities` / `capabilities`). Admission therefore needs a single value: it
|
|
44
|
+
* answers "is this model's PRIMARY use chat?", which a multi-valued category
|
|
45
|
+
* set cannot express without an ordering convention.
|
|
46
|
+
*/
|
|
47
|
+
export declare const CATALOG_MODEL_TYPES: readonly ["chat", "image", "video", "embedding", "reranking", "decision", "transcription", "speech", "realtime", "extraction", "audio"];
|
|
48
|
+
export type CatalogModelType = (typeof CATALOG_MODEL_TYPES)[number];
|
|
49
|
+
/** The types that belong in the TEXT routing pool. */
|
|
50
|
+
export declare const TEXT_MODEL_TYPES: ReadonlySet<CatalogModelType>;
|
|
51
|
+
/**
|
|
52
|
+
* Is this model type a text-chat model? An ABSENT value is `chat` (the
|
|
53
|
+
* models.dev documented default). Any value NOT in `CATALOG_MODEL_TYPES` — a
|
|
54
|
+
* source drift or a future type — is treated as NON-TEXT, so it can never
|
|
55
|
+
* silently enter the text pool; the caller reports the exclusion.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isTextModelType(type: string | undefined): boolean;
|
|
36
58
|
export interface CatalogModel {
|
|
37
59
|
id: string;
|
|
38
60
|
name?: string;
|
|
39
61
|
/**
|
|
40
|
-
* Model-level protocol
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* `openai-
|
|
44
|
-
* wire with `ModelProtocolUnsupported`. The slot name stays `npm` because
|
|
45
|
-
* that is the upstream and model-def file spelling.
|
|
62
|
+
* Model-level outbound protocol set (ordered). models.dev publishes a
|
|
63
|
+
* singular `model.provider.npm`; ingest translates it to `protocols: [id]`.
|
|
64
|
+
* Beats the provider-level list when present — e.g. opencode(Zen) is
|
|
65
|
+
* `openai-chat` overall, but a model may list `openai-responses`.
|
|
46
66
|
*/
|
|
47
|
-
|
|
67
|
+
protocols?: string[];
|
|
48
68
|
/** Model-default thinking level (OCR extension — pinned when the client omits `reasoning_effort`). */
|
|
49
69
|
defaultEffort?: ReasoningEffort;
|
|
50
70
|
attachment?: boolean;
|
|
@@ -60,6 +80,13 @@ export interface CatalogModel {
|
|
|
60
80
|
reasoningDisableable?: boolean;
|
|
61
81
|
tool_call?: boolean;
|
|
62
82
|
temperature?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* models.dev `type` — the model's single PRIMARY use (the `CatalogModelType`
|
|
85
|
+
* enum). Absent = `chat`, the documented default. Read through
|
|
86
|
+
* `isTextModelType()`; a value outside the enum is source drift and is
|
|
87
|
+
* treated as non-text.
|
|
88
|
+
*/
|
|
89
|
+
type?: string;
|
|
63
90
|
/**
|
|
64
91
|
* Override-only capability flag (no catalog source publishes role support):
|
|
65
92
|
* `supportsDeveloperRole` — see ModelRegistration for the semantics. Kept
|
|
@@ -78,10 +105,13 @@ export interface CatalogModel {
|
|
|
78
105
|
/**
|
|
79
106
|
* models.dev `reasoning_options` — the model's real reasoning-tier declaration,
|
|
80
107
|
* kept verbatim (the shape varies per vendor): `{type:'effort', values:[...]}`
|
|
81
|
-
* = exact tier table / `{type:'budget_tokens', min}` =
|
|
82
|
-
* `
|
|
108
|
+
* = exact tier table / `{type:'budget_tokens', min, max}` = a reasoning-token
|
|
109
|
+
* WINDOW (the window maps onto the ladder; `min`/`max` bound it, they do not
|
|
110
|
+
* declare tiers) / `{type:'toggle'}` = on/off only. An EMPTY array is itself a
|
|
111
|
+
* declaration ("reasoning, but no caller-visible level control"), distinct
|
|
112
|
+
* from `undefined` ("nothing stated"). boot-direct derives
|
|
83
113
|
* supportedReasoningEfforts from this instead of assuming "boolean expands
|
|
84
|
-
* into the full ladder".
|
|
114
|
+
* into the full ladder"; see ADR-0035 §3a–3e.
|
|
85
115
|
*/
|
|
86
116
|
reasoningOptions?: CatalogReasoningOption[];
|
|
87
117
|
/**
|
|
@@ -122,8 +152,8 @@ export interface CatalogProviderRecord {
|
|
|
122
152
|
name?: string;
|
|
123
153
|
/** models.dev logo asset (svg); frontend falls back to an initial-letter avatar on error */
|
|
124
154
|
logo?: string;
|
|
125
|
-
/**
|
|
126
|
-
|
|
155
|
+
/** Outbound protocol set. models.dev `npm` is translated at ingest. */
|
|
156
|
+
protocols?: string[];
|
|
127
157
|
/** default API base from the catalog */
|
|
128
158
|
api?: string;
|
|
129
159
|
/** effective base URL override (defs-file definition wins, then live service) */
|
|
@@ -8,4 +8,41 @@
|
|
|
8
8
|
* into the defs file needs no reshaping. Pricing/cost unit: USD per 1M tokens
|
|
9
9
|
* (models.dev `cost` is already $/1M; OpenRouter is converted at the source).
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A model's KIND (what it is FOR) — the single-value enum copied verbatim from
|
|
13
|
+
* the models.dev schema (`ModelTypeV2Values`). OCR names the field `type`, the
|
|
14
|
+
* SAME word models.dev publishes, so there is one vocabulary: the upstream
|
|
15
|
+
* spelling, the stored field, and the console all say `type`.
|
|
16
|
+
*
|
|
17
|
+
* One model has exactly ONE type in models.dev (multi-capability lives in
|
|
18
|
+
* `modalities` / `capabilities`). Admission therefore needs a single value: it
|
|
19
|
+
* answers "is this model's PRIMARY use chat?", which a multi-valued category
|
|
20
|
+
* set cannot express without an ordering convention.
|
|
21
|
+
*/
|
|
22
|
+
export const CATALOG_MODEL_TYPES = [
|
|
23
|
+
'chat',
|
|
24
|
+
'image',
|
|
25
|
+
'video',
|
|
26
|
+
'embedding',
|
|
27
|
+
'reranking',
|
|
28
|
+
'decision',
|
|
29
|
+
'transcription',
|
|
30
|
+
'speech',
|
|
31
|
+
'realtime',
|
|
32
|
+
'extraction',
|
|
33
|
+
// Non-speech audio generation (music, sound effects); text-to-speech is `speech`.
|
|
34
|
+
'audio',
|
|
35
|
+
];
|
|
36
|
+
/** The types that belong in the TEXT routing pool. */
|
|
37
|
+
export const TEXT_MODEL_TYPES = new Set(['chat']);
|
|
38
|
+
/**
|
|
39
|
+
* Is this model type a text-chat model? An ABSENT value is `chat` (the
|
|
40
|
+
* models.dev documented default). Any value NOT in `CATALOG_MODEL_TYPES` — a
|
|
41
|
+
* source drift or a future type — is treated as NON-TEXT, so it can never
|
|
42
|
+
* silently enter the text pool; the caller reports the exclusion.
|
|
43
|
+
*/
|
|
44
|
+
export function isTextModelType(type) {
|
|
45
|
+
if (type === undefined)
|
|
46
|
+
return true;
|
|
47
|
+
return TEXT_MODEL_TYPES.has(type);
|
|
48
|
+
}
|
|
@@ -2,6 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import { resolveOpencodeConfigPath } from './paths.js';
|
|
3
3
|
import { CLIENT_COMPATIBLE_PACKAGE, readJsonc } from '../user-config.js';
|
|
4
4
|
import { currentPackageFor, opencodePackageFor } from '../provider-package.js';
|
|
5
|
+
import { normalizeProtocols, primaryProtocol } from '../../providers/protocols-field.js';
|
|
5
6
|
import { wireFor } from '../../providers/wire.js';
|
|
6
7
|
import { isPluginWire } from '../../providers/plugin-wires.js';
|
|
7
8
|
import { clientDefNodes, writeDefSlot } from '../provider-def-adapters.js';
|
|
@@ -60,36 +61,41 @@ function clientPackageFallbackFor(wire) {
|
|
|
60
61
|
return isPluginWire(wire) ? CLIENT_COMPATIBLE_PACKAGE : undefined;
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* the vocabulary retirement; the client copy is mapped to the SDK package
|
|
66
|
-
* afterwards and must never carry a retired spelling.
|
|
64
|
+
* Lift OCR `protocols[]` (or any leftover singular package/npm) into the
|
|
65
|
+
* client-shaped singular `package` slot before SDK spelling translation.
|
|
67
66
|
*/
|
|
68
67
|
function currentPackageNode(node) {
|
|
69
|
-
let out = node;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
let out = { ...node };
|
|
69
|
+
const protocols = normalizeProtocols(node?.protocols ?? node?.package ?? node?.npm);
|
|
70
|
+
delete out.protocols;
|
|
71
|
+
delete out.npm;
|
|
72
|
+
delete out.protocol;
|
|
73
|
+
if (protocols.length > 0)
|
|
74
|
+
out.package = currentPackageFor(primaryProtocol(protocols));
|
|
75
|
+
else
|
|
76
|
+
delete out.package;
|
|
75
77
|
const models = out?.models;
|
|
76
78
|
if (models && typeof models === 'object') {
|
|
77
|
-
let changed = false;
|
|
78
79
|
const next = {};
|
|
79
80
|
for (const [mid, model] of Object.entries(models)) {
|
|
80
81
|
const provider = model?.provider;
|
|
81
|
-
if (provider && typeof provider
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
if (provider && typeof provider === 'object') {
|
|
83
|
+
const mp = normalizeProtocols(provider.protocols ?? provider.package ?? provider.npm);
|
|
84
|
+
const nextProvider = { ...provider };
|
|
85
|
+
delete nextProvider.protocols;
|
|
86
|
+
delete nextProvider.npm;
|
|
87
|
+
delete nextProvider.protocol;
|
|
88
|
+
if (mp.length > 0)
|
|
89
|
+
nextProvider.package = currentPackageFor(primaryProtocol(mp));
|
|
90
|
+
else
|
|
91
|
+
delete nextProvider.package;
|
|
92
|
+
next[mid] = { ...model, provider: nextProvider };
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
next[mid] = model;
|
|
88
96
|
}
|
|
89
|
-
next[mid] = model;
|
|
90
97
|
}
|
|
91
|
-
|
|
92
|
-
out = { ...out, models: next };
|
|
98
|
+
out = { ...out, models: next };
|
|
93
99
|
}
|
|
94
100
|
return out;
|
|
95
101
|
}
|
|
@@ -5,7 +5,7 @@ import { maskSecret } from '../user-config.js';
|
|
|
5
5
|
import { ocrCredentialsFile, resolveDefaultPaths } from './paths.js';
|
|
6
6
|
import { renameWithRetry } from '../../utils/atomic-write.js';
|
|
7
7
|
import { CREDENTIAL_WEIGHT_MAX } from '../../config/defaults.js';
|
|
8
|
-
import { CredentialNotFoundError, CapabilityUnsupportedError, RESERVED_PROVIDER_IDS, StoreUnreadableError, keyHashPrefix, sha256KeyHash, } from './types.js';
|
|
8
|
+
import { CredentialNotFoundError, CapabilityUnsupportedError, RESERVED_PROVIDER_IDS, StoreUnreadableError, isMachineLoginValue, keyHashPrefix, sha256KeyHash, } from './types.js';
|
|
9
9
|
const OCR_CAPABILITIES = {
|
|
10
10
|
multiCredential: true,
|
|
11
11
|
activate: true,
|
|
@@ -17,6 +17,9 @@ const OCR_CAPABILITIES = {
|
|
|
17
17
|
integrationScoped: false, // any provider id is addressable: OCR owns the file
|
|
18
18
|
};
|
|
19
19
|
function toMeta(providerId, credential) {
|
|
20
|
+
// The machine-login marker is not a secret: masking it would render `ocr:••••hine`
|
|
21
|
+
// and invite a "copy key" click. The flag is what lets a view name the row instead.
|
|
22
|
+
const machineLogin = isMachineLoginValue(credential.key);
|
|
20
23
|
return {
|
|
21
24
|
id: credential.credentialId,
|
|
22
25
|
providerId,
|
|
@@ -25,7 +28,7 @@ function toMeta(providerId, credential) {
|
|
|
25
28
|
active: credential.active,
|
|
26
29
|
routable: Boolean(credential.key),
|
|
27
30
|
keyHashPrefix: keyHashPrefix(credential.key),
|
|
28
|
-
maskedKey: maskSecret(credential.key),
|
|
31
|
+
...(machineLogin ? { machineLogin: true } : { maskedKey: maskSecret(credential.key) }),
|
|
29
32
|
...(credential.weight !== undefined ? { weight: credential.weight } : {}),
|
|
30
33
|
};
|
|
31
34
|
}
|
|
@@ -131,6 +134,12 @@ export class OcrStore {
|
|
|
131
134
|
return found.credential.key;
|
|
132
135
|
}
|
|
133
136
|
async connectKey(providerId, key, label) {
|
|
137
|
+
// THE READ-MODIFY-WRITE WINDOW MUST STAY AWAIT-FREE. `save()` is
|
|
138
|
+
// read-file → mutate one provider → atomic rename; Node runs each mutator to
|
|
139
|
+
// completion before the next starts, which is what makes concurrent console
|
|
140
|
+
// connects safe. An `await` anywhere between `load()` and `save()` would let
|
|
141
|
+
// a sibling writer interleave and silently drop this row (pinned by the
|
|
142
|
+
// concurrency test in credentials-console-routes.test.ts).
|
|
134
143
|
if (!key)
|
|
135
144
|
throw new Error('connectKey requires a non-empty key');
|
|
136
145
|
if (!providerId || /[^A-Za-z0-9._\-\/]/.test(providerId)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { credentialSyncFile, defaultEnv, isV1ClientPresent, resolveDefaultPaths, resolveOpencodeConfigPath, } from './paths.js';
|
|
3
|
-
import { StoreUnreadableError, keyHashPrefix } from './types.js';
|
|
3
|
+
import { StoreUnreadableError, isMachineLoginValue, keyHashPrefix } from './types.js';
|
|
4
4
|
import { OpencodeV2Store, fetchClientDefinedProviderIds, reloadOpencodeService, resolveServiceConfigForPaths, } from './opencode-v2-store.js';
|
|
5
5
|
import { authSnapshot } from './auth-snapshot.js';
|
|
6
6
|
import { atomicWriteWithRetry } from './factory.js';
|
|
@@ -407,7 +407,10 @@ async function pushOcrIntoV1(ocr, overrides) {
|
|
|
407
407
|
let deduped = 0;
|
|
408
408
|
const next = { ...existing };
|
|
409
409
|
for (const providerId of providerIds) {
|
|
410
|
-
|
|
410
|
+
// The machine-login marker is not a secret: pushing it would write `ocr:machine`
|
|
411
|
+
// into the client's auth.json as if it were an API key, and every request through
|
|
412
|
+
// that client would fail with no hint why. Such a provider has nothing to share.
|
|
413
|
+
const head = ocr.resolveKeyChain(providerId).find((c) => c.key && !isMachineLoginValue(c.key));
|
|
411
414
|
if (!head)
|
|
412
415
|
continue; // nothing to push for this provider
|
|
413
416
|
const existingKey = existingKeys.get(providerId.toLowerCase());
|
|
@@ -494,8 +497,14 @@ async function pushOcrIntoV2(ocr, overrides) {
|
|
|
494
497
|
// Keys are collected per provider, in CHAIN order (the active head first,
|
|
495
498
|
// then the fallbacks), because the write path must restore the client's
|
|
496
499
|
// active credential to the OCR head after the keys land (see below).
|
|
500
|
+
//
|
|
501
|
+
// The machine-login marker (`ocr:machine`) is dropped HERE, per row, not only
|
|
502
|
+
// at the head: it is not a secret, and pushing it would write it into the
|
|
503
|
+
// client as if it were an API key — every request through that client would
|
|
504
|
+
// fail with no hint why. Dropping it only from the head still let it land as a
|
|
505
|
+
// fallback on a two-door provider.
|
|
497
506
|
const chains = providerIds
|
|
498
|
-
.map((id) => ({ id, chain: ocr.resolveKeyChain(id) }))
|
|
507
|
+
.map((id) => ({ id, chain: ocr.resolveKeyChain(id).filter((c) => c.key && !isMachineLoginValue(c.key)) }))
|
|
499
508
|
.filter((g) => g.chain.length > 0);
|
|
500
509
|
// Def materialization — converge the client's `providers` slot BEFORE any
|
|
501
510
|
// key push, so a brand-new custom provider's id is registered (via the
|
|
@@ -81,12 +81,19 @@ export interface CredentialMeta {
|
|
|
81
81
|
/** maskSecret() output — existing masking rule. */
|
|
82
82
|
maskedKey?: string;
|
|
83
83
|
/**
|
|
84
|
-
* Spread weight for the deterministic new-session
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* read it.
|
|
84
|
+
* Spread weight for the deterministic new-session spread (integers >= 1, absent = 1).
|
|
85
|
+
* OCR-file rows carry it; opencode v2 rows never do. Shapes NEW placements only —
|
|
86
|
+
* failover order, the ratchet and the sync boundary never read it.
|
|
88
87
|
*/
|
|
89
88
|
weight?: number;
|
|
89
|
+
/**
|
|
90
|
+
* This row carries the machine-login marker (`MACHINE_LOGIN_VALUE`), not a secret.
|
|
91
|
+
* Set by the store so a view can label it as "this machine's login" instead of
|
|
92
|
+
* masking a marker, and withhold the "copy key" action. Nothing about ROUTING reads
|
|
93
|
+
* it: the row is an ordinary chain member and the plugin decides what the value
|
|
94
|
+
* means.
|
|
95
|
+
*/
|
|
96
|
+
machineLogin?: boolean;
|
|
90
97
|
}
|
|
91
98
|
export interface ResolvedCredential {
|
|
92
99
|
key: string;
|
|
@@ -268,3 +275,23 @@ export declare class CredentialNotFoundError extends Error {
|
|
|
268
275
|
export declare function sha256KeyHash(rawKey: string): string;
|
|
269
276
|
/** Display-safe prefix of the key hash (logs/traces/console can name an credential without secrets). */
|
|
270
277
|
export declare function keyHashPrefix(rawKey: string, length?: number): string;
|
|
278
|
+
/**
|
|
279
|
+
* The credential VALUE that means "do not hand the CLI any credential — use the login
|
|
280
|
+
* this machine already holds".
|
|
281
|
+
*
|
|
282
|
+
* Some plugins declare both a credential door and their own login. Storing an ordinary
|
|
283
|
+
* key made the plugin's own login unreachable (the plugin reads any non-empty value as
|
|
284
|
+
* "use this key"), so the only way back was deleting everything. This value is an
|
|
285
|
+
* ordinary STORE ROW whose meaning is "no auth payload": the plugin maps it to
|
|
286
|
+
* `qodercliAuth()` instead of `accessToken()`, which is the ONE execution-line
|
|
287
|
+
* difference — the daemon, the chain, the spread and every credential route are
|
|
288
|
+
* unchanged.
|
|
289
|
+
*
|
|
290
|
+
* Storing it (rather than synthesizing a view of it) is what keeps the rest of the
|
|
291
|
+
* system simple: the row is visible and disableable/deletable through the same routes
|
|
292
|
+
* as any key, so an operator always has the escape hatch. Only the surfaces that would
|
|
293
|
+
* mistake it for a secret need to know it exists.
|
|
294
|
+
*/
|
|
295
|
+
export declare const MACHINE_LOGIN_VALUE = "ocr:machine";
|
|
296
|
+
/** True when a stored value is the machine-login marker rather than a real secret. */
|
|
297
|
+
export declare function isMachineLoginValue(value: unknown): boolean;
|
|
@@ -86,3 +86,28 @@ export function sha256KeyHash(rawKey) {
|
|
|
86
86
|
export function keyHashPrefix(rawKey, length = 12) {
|
|
87
87
|
return sha256KeyHash(rawKey).slice(0, length);
|
|
88
88
|
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// The machine-login marker
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
/**
|
|
93
|
+
* The credential VALUE that means "do not hand the CLI any credential — use the login
|
|
94
|
+
* this machine already holds".
|
|
95
|
+
*
|
|
96
|
+
* Some plugins declare both a credential door and their own login. Storing an ordinary
|
|
97
|
+
* key made the plugin's own login unreachable (the plugin reads any non-empty value as
|
|
98
|
+
* "use this key"), so the only way back was deleting everything. This value is an
|
|
99
|
+
* ordinary STORE ROW whose meaning is "no auth payload": the plugin maps it to
|
|
100
|
+
* `qodercliAuth()` instead of `accessToken()`, which is the ONE execution-line
|
|
101
|
+
* difference — the daemon, the chain, the spread and every credential route are
|
|
102
|
+
* unchanged.
|
|
103
|
+
*
|
|
104
|
+
* Storing it (rather than synthesizing a view of it) is what keeps the rest of the
|
|
105
|
+
* system simple: the row is visible and disableable/deletable through the same routes
|
|
106
|
+
* as any key, so an operator always has the escape hatch. Only the surfaces that would
|
|
107
|
+
* mistake it for a secret need to know it exists.
|
|
108
|
+
*/
|
|
109
|
+
export const MACHINE_LOGIN_VALUE = 'ocr:machine';
|
|
110
|
+
/** True when a stored value is the machine-login marker rather than a real secret. */
|
|
111
|
+
export function isMachineLoginValue(value) {
|
|
112
|
+
return typeof value === 'string' && value.trim() === MACHINE_LOGIN_VALUE;
|
|
113
|
+
}
|