omnicell-router 0.8.4 → 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/capture/recorder.d.ts +4 -10
- package/backend/dist/capture/recorder.js +6 -58
- 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 +8 -0
- package/backend/dist/cli/clients/codex.js +5 -0
- 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/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 +5 -0
- package/backend/dist/cli/clients/pi.d.ts +6 -0
- package/backend/dist/cli/clients/pi.js +3 -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 +92 -16
- package/backend/dist/config/comments-en.js +31 -26
- package/backend/dist/config/comments-zh.js +29 -24
- package/backend/dist/config/defaults.d.ts +194 -33
- package/backend/dist/config/defaults.js +193 -32
- package/backend/dist/config/env.d.ts +10 -0
- package/backend/dist/config/env.js +3 -2
- package/backend/dist/config/index.d.ts +7 -0
- package/backend/dist/config/index.js +184 -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/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 +14 -4
- package/backend/dist/config/types.d.ts +167 -38
- 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 +50 -17
- package/backend/dist/forward-proxy/h2-forward.js +36 -10
- package/backend/dist/forward-proxy/index.d.ts +11 -8
- package/backend/dist/forward-proxy/index.js +22 -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 +0 -16
- package/backend/dist/forward-proxy/server.js +124 -156
- package/backend/dist/harness/host/hosts.js +3 -2
- package/backend/dist/index.js +53 -18
- 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 +45 -3
- 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 +82 -24
- package/backend/dist/ir/adapters/openai-responses.js +146 -37
- 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/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 +276 -70
- package/backend/dist/opencode/catalog/ocr-store.js +3 -1
- package/backend/dist/opencode/catalog/overrides-store.d.ts +10 -1
- package/backend/dist/opencode/catalog/overrides-store.js +6 -0
- 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 +25 -2
- package/backend/dist/opencode/catalog/sources/models-dev.js +13 -3
- package/backend/dist/opencode/catalog/types.d.ts +35 -3
- package/backend/dist/opencode/catalog/types.js +38 -1
- 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/probe.d.ts +21 -4
- package/backend/dist/opencode/probe.js +34 -10
- 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 +497 -165
- 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 +98 -14
- package/backend/dist/plugins/host.js +622 -87
- 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 +252 -36
- package/backend/dist/providers/compat/tool-markup-recovery.js +31 -6
- 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/provider-takedown.d.ts +5 -2
- package/backend/dist/providers/registry.d.ts +84 -25
- package/backend/dist/providers/registry.js +209 -114
- 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 +35 -5
- 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 +928 -310
- 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 +318 -13
- 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/body-admission.d.ts +67 -2
- package/backend/dist/surfaces/body-admission.js +218 -13
- 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 +9 -3
- package/backend/dist/surfaces/transport-node-http.js +6 -19
- 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 +3 -2
- package/backend/dist/utils/server-liveness.js +3 -2
- 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-KI1OW5x6.css → index-CqDSOPQ0.css} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +3 -1
- package/frontend/dist/assets/index-Dk76uc7e.js +0 -1522
|
@@ -33,6 +33,28 @@ 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;
|
|
@@ -58,6 +80,13 @@ export interface CatalogModel {
|
|
|
58
80
|
reasoningDisableable?: boolean;
|
|
59
81
|
tool_call?: boolean;
|
|
60
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;
|
|
61
90
|
/**
|
|
62
91
|
* Override-only capability flag (no catalog source publishes role support):
|
|
63
92
|
* `supportsDeveloperRole` — see ModelRegistration for the semantics. Kept
|
|
@@ -76,10 +105,13 @@ export interface CatalogModel {
|
|
|
76
105
|
/**
|
|
77
106
|
* models.dev `reasoning_options` — the model's real reasoning-tier declaration,
|
|
78
107
|
* kept verbatim (the shape varies per vendor): `{type:'effort', values:[...]}`
|
|
79
|
-
* = exact tier table / `{type:'budget_tokens', min}` =
|
|
80
|
-
* `
|
|
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
|
|
81
113
|
* supportedReasoningEfforts from this instead of assuming "boolean expands
|
|
82
|
-
* into the full ladder".
|
|
114
|
+
* into the full ladder"; see ADR-0035 §3a–3e.
|
|
83
115
|
*/
|
|
84
116
|
reasoningOptions?: CatalogReasoningOption[];
|
|
85
117
|
/**
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -31,7 +31,11 @@ export type ProbeHintCode = 'regionBlocked' | 'authFailed' | 'protocolMismatch'
|
|
|
31
31
|
/** 404 with a provider-shaped JSON body: the API answered, rejected at business level. */
|
|
32
32
|
| 'businessRejected'
|
|
33
33
|
/** 404 with a gateway-shaped body (HTML/empty): the mount itself is absent. */
|
|
34
|
-
| 'endpointNotFound'
|
|
34
|
+
| 'endpointNotFound'
|
|
35
|
+
/** Nothing was dialed: `proxy.includes` demanded the proxy for this provider and
|
|
36
|
+
* the machine has no usable endpoint, so the provider axle REFUSED rather than
|
|
37
|
+
* leaking a direct dial. The fix lives on the proxy page, not the provider. */
|
|
38
|
+
| 'egressRefused';
|
|
35
39
|
export type ProbeTransportCode = 'timeout' | 'unreachable';
|
|
36
40
|
export interface ProbeOptions {
|
|
37
41
|
baseURL: string;
|
|
@@ -86,9 +90,14 @@ export interface ProbeResult {
|
|
|
86
90
|
/**
|
|
87
91
|
* Where the probe's bytes actually left (ADR-0018 / ADR-0022 vocabulary).
|
|
88
92
|
* `direct` = straight out of the machine, `proxy` = through the operator's
|
|
89
|
-
* outbound proxy at `egressProxy` (redacted origin).
|
|
90
|
-
*
|
|
91
|
-
*
|
|
93
|
+
* outbound proxy at `egressProxy` (redacted origin).
|
|
94
|
+
*
|
|
95
|
+
* WHO reports it follows who DIALS. A core wire is stamped here. An
|
|
96
|
+
* in-process plugin wire reports it from `host.egressProxyFor` (the same
|
|
97
|
+
* resolver its `host.fetch` dial runs), because the core never sees that hop.
|
|
98
|
+
* Only a plugin whose child process owns the socket leaves both unset — the
|
|
99
|
+
* core did not make that dial and must not claim a direction for it. UNKNOWN
|
|
100
|
+
* is never read as direct.
|
|
92
101
|
*
|
|
93
102
|
* This is the console's answer to "did my proxy split actually apply", which
|
|
94
103
|
* the include/exclude page cannot answer on its own.
|
|
@@ -96,6 +105,14 @@ export interface ProbeResult {
|
|
|
96
105
|
egress?: 'direct' | 'proxy';
|
|
97
106
|
/** Redacted `scheme://host:port` of the outbound proxy; only with `egress: 'proxy'`. */
|
|
98
107
|
egressProxy?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The operator DEMANDED the proxy for this caller (`proxy.includes` matched) but
|
|
110
|
+
* there was no usable endpoint, so the dial was REFUSED before any socket
|
|
111
|
+
* existed. `egress` is absent on a refusal — nothing was dialed — while this flag
|
|
112
|
+
* says what was ASKED for. A refusal is a gateway-config verdict, not a direct
|
|
113
|
+
* dial and not an unreachable host.
|
|
114
|
+
*/
|
|
115
|
+
wantsProxy?: boolean;
|
|
99
116
|
}
|
|
100
117
|
/**
|
|
101
118
|
* Wire decision for probes — DELEGATES to the shared `wireFor()` —
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* include/exclude page cannot otherwise tell the operator whether their split
|
|
19
19
|
* reached this provider at all.
|
|
20
20
|
*/
|
|
21
|
-
import { proxiedFetch,
|
|
21
|
+
import { proxiedFetch, resolveEgress } from '../utils/proxy.js';
|
|
22
22
|
import { wireFor, unroutableInfo, anthropicMessagesUrl } from '../providers/wire.js';
|
|
23
23
|
import { redactBodySecrets } from './credentials/opencode-v2-store.js';
|
|
24
24
|
import { redactUpstreamBody } from '../observability/upstream-body-redaction.js';
|
|
@@ -109,9 +109,11 @@ export async function probeProvider(opts) {
|
|
|
109
109
|
// implemented by the model-service plugin. Built-in wires have no plugin
|
|
110
110
|
// and fall through to the wire-specific HTTP logic.
|
|
111
111
|
const plugin = getModelServicePlugin(kind);
|
|
112
|
-
// A plugin probe runs ITS OWN transport: the core never touches the socket,
|
|
113
|
-
//
|
|
114
|
-
// the
|
|
112
|
+
// A plugin probe runs ITS OWN transport: the core never touches the socket,
|
|
113
|
+
// so the core cannot stamp the leg. The PLUGIN must report it, from
|
|
114
|
+
// `host.egressProxyFor` — the same resolver its `host.fetch` dial uses — and
|
|
115
|
+
// an in-process wire always can. A plugin whose child process owns the socket
|
|
116
|
+
// leaves both fields unset (UNKNOWN), never a guessed `direct`.
|
|
115
117
|
if (plugin?.probe)
|
|
116
118
|
return { ...(await plugin.probe(opts)), kind };
|
|
117
119
|
if (!BUILTIN_PROBE_KINDS[kind]) {
|
|
@@ -174,13 +176,23 @@ export async function probeProvider(opts) {
|
|
|
174
176
|
// Resolve the egress ONCE and reuse it for the dial: the operator's question is
|
|
175
177
|
// "did my include/exclude split apply to THIS provider/model", and the probe is
|
|
176
178
|
// the only place that can answer before a real request burns a turn. Same
|
|
177
|
-
// resolver the executors
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
// resolver the executors dial with, so the answer cannot drift — and the
|
|
180
|
+
// verdict's `origin` is already redacted, so no credential can ride a report.
|
|
181
|
+
//
|
|
182
|
+
// No plugin claim rides in here on purpose: every plugin wire answered above
|
|
183
|
+
// (its own `probe()`, which reads `host.egressProxyFor` and therefore already
|
|
184
|
+
// carries the operator's switch), and a built-in wire has no plugin whose
|
|
185
|
+
// switch could apply. Adding one would be a second voice with nothing to say.
|
|
186
|
+
const verdict = resolveEgress(url, { provider: opts.provider, model: opts.model });
|
|
187
|
+
const egress = verdict.mode;
|
|
188
|
+
const egressProxy = verdict.mode === 'proxy' ? verdict.origin : undefined;
|
|
189
|
+
// A demanded proxy that cannot be dialed is a REFUSAL, not a direct dial: the
|
|
190
|
+
// verdict says `direct` because no leg was taken, so the intent flag is the
|
|
191
|
+
// only honest thing to report alongside it.
|
|
192
|
+
const wantsProxy = verdict.mode === 'direct' && verdict.wantsProxy === true;
|
|
181
193
|
try {
|
|
182
194
|
// proxiedFetch resolves the proxy itself from these same arguments — the
|
|
183
|
-
// pre-resolved `
|
|
195
|
+
// pre-resolved `verdict` above is only for the REPORT, never a second gate.
|
|
184
196
|
const res = await proxiedFetch(url, {
|
|
185
197
|
method: 'POST',
|
|
186
198
|
headers,
|
|
@@ -239,6 +251,11 @@ export async function probeProvider(opts) {
|
|
|
239
251
|
const latencyMs = Date.now() - started;
|
|
240
252
|
const aborted = err?.name === 'AbortError' || err?.name === 'TimeoutError';
|
|
241
253
|
const cause = err?.cause?.code || err?.cause?.message || err?.message;
|
|
254
|
+
// The provider axle REFUSES rather than dialing direct when the operator's
|
|
255
|
+
// include matched but no endpoint is usable (utils/proxy.ts). That is a
|
|
256
|
+
// CONFIG verdict, not an unreachable host: reporting `unreachable` would send
|
|
257
|
+
// the operator to check DNS/firewall while the fix is on the proxy page.
|
|
258
|
+
const egressRefused = err?.code === 'outbound_egress_refused';
|
|
242
259
|
return {
|
|
243
260
|
ok: false,
|
|
244
261
|
kind,
|
|
@@ -248,8 +265,15 @@ export async function probeProvider(opts) {
|
|
|
248
265
|
transportUrl: url,
|
|
249
266
|
transportCause: cause ? String(cause) : undefined,
|
|
250
267
|
timeoutMs: opts.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
251
|
-
|
|
268
|
+
// A refused dial took NO leg. Reporting `direct` here would be a lie the
|
|
269
|
+
// console renders as "this provider goes direct" — the exact defect the
|
|
270
|
+
// intent flag exists to prevent, so the leg stays UNKNOWN on a refusal.
|
|
271
|
+
...(egressRefused ? {} : { egress }),
|
|
252
272
|
...(egressProxy ? { egressProxy } : {}),
|
|
273
|
+
...(wantsProxy ? { wantsProxy: true } : {}),
|
|
274
|
+
...(egressRefused
|
|
275
|
+
? { hintCode: 'egressRefused', upstreamBody: String(err?.message ?? '') }
|
|
276
|
+
: {}),
|
|
253
277
|
};
|
|
254
278
|
}
|
|
255
279
|
}
|
|
@@ -128,10 +128,15 @@ export interface EffortDirectiveResult {
|
|
|
128
128
|
* ask. Downward over-shoot is legal there (the promise is only "never
|
|
129
129
|
* ABOVE what was asked").
|
|
130
130
|
*
|
|
131
|
-
* A PIN is
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
131
|
+
* A PIN is an absolute ask, so it is written VERBATIM: the serving model
|
|
132
|
+
* translates it through its own `effortMap` and capability-clamps it there,
|
|
133
|
+
* exactly like a client's explicit field (degraded-or-equal; the serve is
|
|
134
|
+
* reported as `reasoningDegraded`). Clamping here — against the pre-pick
|
|
135
|
+
* model, before the serving ladder and map are known — would bypass a
|
|
136
|
+
* `high->xhigh` translation and read an arbitrary pool head. `clamped` is
|
|
137
|
+
* therefore false for a pin by construction: the capability truth belongs to
|
|
138
|
+
* routing, not to the ask. A model declaring an explicit EMPTY support set
|
|
139
|
+
* makes effort directives a no-op; a model declaring neither support field
|
|
135
140
|
* still gets the raised ask, which the executor then honestly degrades
|
|
136
141
|
* (`reasoningDegraded`).
|
|
137
142
|
*/
|
|
@@ -393,10 +393,15 @@ export function applyTierDirectives(actions, baseTier) {
|
|
|
393
393
|
* ask. Downward over-shoot is legal there (the promise is only "never
|
|
394
394
|
* ABOVE what was asked").
|
|
395
395
|
*
|
|
396
|
-
* A PIN is
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
396
|
+
* A PIN is an absolute ask, so it is written VERBATIM: the serving model
|
|
397
|
+
* translates it through its own `effortMap` and capability-clamps it there,
|
|
398
|
+
* exactly like a client's explicit field (degraded-or-equal; the serve is
|
|
399
|
+
* reported as `reasoningDegraded`). Clamping here — against the pre-pick
|
|
400
|
+
* model, before the serving ladder and map are known — would bypass a
|
|
401
|
+
* `high->xhigh` translation and read an arbitrary pool head. `clamped` is
|
|
402
|
+
* therefore false for a pin by construction: the capability truth belongs to
|
|
403
|
+
* routing, not to the ask. A model declaring an explicit EMPTY support set
|
|
404
|
+
* makes effort directives a no-op; a model declaring neither support field
|
|
400
405
|
* still gets the raised ask, which the executor then honestly degrades
|
|
401
406
|
* (`reasoningDegraded`).
|
|
402
407
|
*/
|
|
@@ -423,17 +428,16 @@ alwaysThink = false) {
|
|
|
423
428
|
const suffix = `effort-${target}`;
|
|
424
429
|
if (supportedEmpty)
|
|
425
430
|
return noop(0, true, suffix);
|
|
426
|
-
const served = downgradeReasoning(target, supportedEfforts, alwaysThink);
|
|
427
431
|
const baseRank = baseEffort === undefined ? -1 : EFFORT_LADDER.indexOf(baseEffort);
|
|
428
|
-
const
|
|
432
|
+
const targetRank = EFFORT_LADDER.indexOf(target);
|
|
429
433
|
return {
|
|
430
|
-
effort:
|
|
434
|
+
effort: target,
|
|
431
435
|
delta: 0,
|
|
432
|
-
changed:
|
|
433
|
-
clamped:
|
|
436
|
+
changed: target !== baseEffort,
|
|
437
|
+
clamped: false,
|
|
434
438
|
applied: true,
|
|
435
439
|
pinned: true,
|
|
436
|
-
direction:
|
|
440
|
+
direction: targetRank === baseRank ? 'none' : targetRank > baseRank ? 'up' : 'down',
|
|
437
441
|
suffix,
|
|
438
442
|
ignoredSteps: stepCount(actions, 'effort'),
|
|
439
443
|
};
|
|
@@ -7,6 +7,7 @@ import { SessionManager } from '../session/session-manager.js';
|
|
|
7
7
|
import { TraceTracker } from '../trace/tracker.js';
|
|
8
8
|
import { CaptureRecorder } from '../capture/recorder.js';
|
|
9
9
|
import type { CaptureKeyIdentity } from '../capture/recorder.js';
|
|
10
|
+
import { SessionSnapshotStore } from '../snapshot/store.js';
|
|
10
11
|
import type { StreamRelay } from '../utils/stream-relay.js';
|
|
11
12
|
import { type CaptureClientRequest, type ClientExchangeContext } from '../observability/http-exchange.js';
|
|
12
13
|
import { CircuitBreakerManager } from '../resilience/index.js';
|
|
@@ -32,7 +33,7 @@ export interface ProcessContext {
|
|
|
32
33
|
fastifyRequest?: import('fastify').FastifyRequest;
|
|
33
34
|
/**
|
|
34
35
|
* Transport observation for non-Fastify entry points (the MITM
|
|
35
|
-
*
|
|
36
|
+
* ingress-proxy interceptor): the ORIGINAL client request line + headers.
|
|
36
37
|
* Ignored when `fastifyRequest` is present; recorded into the capture's
|
|
37
38
|
* inbound http-exchange exactly like the Fastify leg.
|
|
38
39
|
*/
|
|
@@ -66,6 +67,24 @@ export interface ProcessContext {
|
|
|
66
67
|
* Session identity and execution keep using the scrubbed IR snapshot.
|
|
67
68
|
*/
|
|
68
69
|
clientBody?: unknown;
|
|
70
|
+
/**
|
|
71
|
+
* Transport's own "the client is gone" probe (ADR-0040). The gateway keeps
|
|
72
|
+
* draining the upstream after a client disconnect (the response is already
|
|
73
|
+
* committed), so a turn can COMPLETE upstream while nobody received it. This
|
|
74
|
+
* probe lets the snapshot plane record such a turn as `aborted` instead of
|
|
75
|
+
* `completed`, so a half-delivered answer is never presented as finished to a
|
|
76
|
+
* later reader or another client. Absent = the leg has no such signal
|
|
77
|
+
* (in-process/tests), which reads as "client still there".
|
|
78
|
+
*/
|
|
79
|
+
isClientGone?: () => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* STICKY variant of {@link isClientGone} (ADR-0040): "did the client leave at
|
|
82
|
+
* some point DURING this turn". Read after the upstream drained, where a
|
|
83
|
+
* currently-closed socket can no longer tell a mid-stream departure from a
|
|
84
|
+
* keep-alive teardown. When present it is authoritative for the snapshot
|
|
85
|
+
* outcome; otherwise `isClientGone` is used.
|
|
86
|
+
*/
|
|
87
|
+
didClientLeave?: () => boolean;
|
|
69
88
|
}
|
|
70
89
|
export declare class PipelineOrchestrator {
|
|
71
90
|
private config;
|
|
@@ -74,12 +93,14 @@ export declare class PipelineOrchestrator {
|
|
|
74
93
|
private sessionManager;
|
|
75
94
|
private traceTracker;
|
|
76
95
|
private captureRecorder;
|
|
96
|
+
private snapshotStore;
|
|
77
97
|
private healthProber?;
|
|
78
98
|
constructor(config: RouterConfig, registry: ProviderRegistry, tracker: FinOpsTracker, sessionManager?: SessionManager);
|
|
79
99
|
getTracker(): FinOpsTracker;
|
|
80
100
|
getSessionManager(): SessionManager;
|
|
81
101
|
getTraceTracker(): TraceTracker;
|
|
82
102
|
getCaptureRecorder(): CaptureRecorder;
|
|
103
|
+
getSnapshotStore(): SessionSnapshotStore;
|
|
83
104
|
getRegistry(): ProviderRegistry;
|
|
84
105
|
getCircuitBreakerManager(): CircuitBreakerManager;
|
|
85
106
|
/**
|
|
@@ -94,10 +115,10 @@ export declare class PipelineOrchestrator {
|
|
|
94
115
|
/**
|
|
95
116
|
* Auto-request routing with the experience table in front of the decision layer
|
|
96
117
|
* (ADR-0011): an entry hit short-circuits L2 entirely — the table IS a
|
|
97
|
-
* prior judgment. Explicit request tiers (`forceTier
|
|
98
|
-
* mode
|
|
99
|
-
*
|
|
100
|
-
*
|
|
118
|
+
* prior judgment. Explicit request tiers (`forceTier`) and the global
|
|
119
|
+
* routing mode's tier pin (`modeTier`) skip the table: both are layer0
|
|
120
|
+
* decisions by definition. On an L2 judgment the router behaves exactly as
|
|
121
|
+
* before (decision layer → plus baseline).
|
|
101
122
|
*/
|
|
102
123
|
private routeAutoDecision;
|
|
103
124
|
startProber(): void;
|
|
@@ -124,6 +145,14 @@ export declare class PipelineOrchestrator {
|
|
|
124
145
|
* written to the client before the first forwarded chunk.
|
|
125
146
|
*/
|
|
126
147
|
relay?: StreamRelay): Promise<ExecutionResult>;
|
|
148
|
+
/**
|
|
149
|
+
* Did the CLIENT disconnect for this request? Best-effort, from the transport's
|
|
150
|
+
* socket state: `destroyed` on the raw request with the readable side not
|
|
151
|
+
* ended is the signature of a peer that hung up mid-response. Absent transport
|
|
152
|
+
* (in-process callers / tests) always reads as "not gone" — the turn is then
|
|
153
|
+
* attributed to the upstream, which is the honest default when we cannot tell.
|
|
154
|
+
*/
|
|
155
|
+
private isClientAborted;
|
|
127
156
|
/**
|
|
128
157
|
* Apply `streaming.upstream.mode` to the surface-supplied relay. The sink
|
|
129
158
|
* relay is a module constant: it carries no per-request state (it forwards
|
|
@@ -132,11 +161,11 @@ export declare class PipelineOrchestrator {
|
|
|
132
161
|
*/
|
|
133
162
|
private resolveUpstreamRelay;
|
|
134
163
|
/**
|
|
135
|
-
* Names the model the client addressed
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* Does not resolve a session.
|
|
164
|
+
* Names the model the client addressed — the execution-side consumer of
|
|
165
|
+
* `resolveModel` (the pure, draw-free ladder lives there, shared with
|
|
166
|
+
* every other reader). Applies the mutations the name implies (forceTier,
|
|
167
|
+
* variant rewrite + effort pin) and enforces the key's model policy for an
|
|
168
|
+
* explicitly named model. Does not resolve a session.
|
|
140
169
|
*/
|
|
141
170
|
private resolveAddressedModel;
|
|
142
171
|
/**
|
|
@@ -163,9 +192,9 @@ export declare class PipelineOrchestrator {
|
|
|
163
192
|
*
|
|
164
193
|
* Chain contract: chain[0] is the leader (pinned model / explicit model /
|
|
165
194
|
* combo leader), the rest follow failover order. When `allowEscalate` is
|
|
166
|
-
* set (auto lite-tier only),
|
|
167
|
-
* cross-tier escalation tail — Strict
|
|
168
|
-
* get lite models appended.
|
|
195
|
+
* set (auto lite-tier only), the resolved escalation-tier models (see
|
|
196
|
+
* `escalateTier`) are appended as a cross-tier escalation tail — Strict
|
|
197
|
+
* Anti-Downgrade: plus chains never get lite models appended.
|
|
169
198
|
*
|
|
170
199
|
* Two-Tier Cost-Aware Resilience Architecture:
|
|
171
200
|
* 1. In-Place Retry (Preserve Upstream KV Prompt Cache, Prevent 10x Cost Invalidation):
|