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
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { parse, stringify } from 'yaml';
|
|
4
|
-
import { INTERCEPT_POSTURES, lintRules, normalizeRuleTable } from '../
|
|
4
|
+
import { INTERCEPT_POSTURES, lintRules, normalizeRuleTable } from '../ingress-proxy/rules.js';
|
|
5
5
|
import { DEFAULT_RETRIABLE_CAUSES } from '../resilience/types.js';
|
|
6
6
|
import { DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_MAX_RATE_LIMIT_WAIT_MS } from '../resilience/circuit-breaker.js';
|
|
7
7
|
import { EFFORT_LADDER } from '../types/router.js';
|
|
8
8
|
import { resolveDirectivePrefix } from '../pipeline/directives.js';
|
|
9
|
-
import {
|
|
9
|
+
import { canonicalizeSelectionValues } from '../providers/selection.js';
|
|
10
|
+
import { MEMBER_TIER_ORDER, sanitizeEffortMap } from '../providers/member-match.js';
|
|
11
|
+
import { missingNodeCredential, sanitizeTypedNode } from '../egress-proxy/manual-node-spec.js';
|
|
10
12
|
import { ensureEnvScaffold, getEnvPaths, resolveEnvName } from './env.js';
|
|
11
|
-
import {
|
|
13
|
+
import { DEFAULT_INGRESS_PROXY_PORT, DEFAULT_INGRESS_PROXY_HOST, DEFAULT_INGRESS_PROXY_MAX_CONNECTIONS, DEFAULT_INGRESS_PROXY_RULES, DEFAULT_INGRESS_PROXY_INTERCEPT, INGRESS_PROXY_MAX_CONNECTIONS_MIN, INGRESS_PROXY_MAX_CONNECTIONS_MAX, DEFAULT_PROXY_ACCESS_LOG_PERSIST_DAYS, PROXY_ACCESS_LOG_PERSIST_DAYS_MIN, PROXY_ACCESS_LOG_PERSIST_DAYS_MAX, DEFAULT_HEADROOM_TIMEOUT_MS, DEFAULT_DIRECTIVE_PREFIX, DEFAULT_HEADROOM_URL, DEFAULT_LAYER2_EFFORT_FLOOR, DEFAULT_LAYER2_TIMEOUT_MS, DEFAULT_MAX_BODY_BYTES, GATEWAY_MAX_BODY_BYTES, ADMIN_MAX_BODY_BYTES, BODY_LIMIT_MIN_BYTES, BODY_LIMIT_MAX_BYTES, DEFAULT_AUTO_RESYNC_FOLLOW_CATALOGS, DEFAULT_ROUTE_ENTRIES_MAX, DEFAULT_GATEWAY_PORT, DEFAULT_MIHOMO_CONTROLLER_PORT, DEFAULT_MIHOMO_GROUP, DEFAULT_MIHOMO_MIXED_PORT, DEFAULT_MIHOMO_SUB_INTERVAL_SEC, MIHOMO_SUB_INTERVAL_MAX_SEC, MIHOMO_SUB_INTERVAL_MIN_SEC, MIHOMO_GROUP_INTERVAL_MAX_SEC, MIHOMO_GROUP_INTERVAL_MIN_SEC, DEFAULT_MIHOMO_GROUP_TOLERANCE_MS, MIHOMO_GROUP_TOLERANCE_MAX_MS, DEFAULT_MIHOMO_TEST_URL, MIHOMO_LAN_DIRECT_RULES, } from './defaults.js';
|
|
12
14
|
import { getRateLimiter } from '../ratelimit/rate-limiter.js';
|
|
13
15
|
import { getQuotaProber } from '../quota/prober.js';
|
|
14
16
|
import { migrateConfig, toDiskConfig, toRuntimeConfig, SCHEMA_VERSION } from './schema.js';
|
|
@@ -44,6 +46,13 @@ export const MAX_GRACE_SLEEPERS = 64;
|
|
|
44
46
|
* debounce).
|
|
45
47
|
*/
|
|
46
48
|
export const RATE_LIMIT_CHECKPOINT_INTERVAL_MS = 30_000;
|
|
49
|
+
/**
|
|
50
|
+
* Upper bound on the snapshot drain during a graceful shutdown. The record is
|
|
51
|
+
* assembled in the write worker, so the exit path must AWAIT it to land the
|
|
52
|
+
* last turn; the bound keeps a stalled disk from turning a restart into a hang
|
|
53
|
+
* (the plane fails open by contract, ADR-0038).
|
|
54
|
+
*/
|
|
55
|
+
export const SNAPSHOT_SHUTDOWN_FLUSH_MS = 2_000;
|
|
47
56
|
const DEFAULT_CONFIG = {
|
|
48
57
|
port: parseInt(process.env.PORT || String(DEFAULT_GATEWAY_PORT), 10),
|
|
49
58
|
host: process.env.HOST || '127.0.0.1',
|
|
@@ -60,7 +69,7 @@ const DEFAULT_CONFIG = {
|
|
|
60
69
|
pro: {},
|
|
61
70
|
ultra: {},
|
|
62
71
|
},
|
|
63
|
-
routing: { mode: 'smart' },
|
|
72
|
+
routing: { mode: 'smart', costEscalation: 'to_fallback_tier' },
|
|
64
73
|
fallback: {
|
|
65
74
|
enabled: true,
|
|
66
75
|
maxRetries: 1,
|
|
@@ -104,19 +113,18 @@ const DEFAULT_CONFIG = {
|
|
|
104
113
|
selectedNodes: {},
|
|
105
114
|
},
|
|
106
115
|
},
|
|
107
|
-
|
|
116
|
+
ingressProxy: {
|
|
108
117
|
enabled: false, // opt-in: full-capture MITM proxy must be enabled consciously
|
|
109
|
-
port:
|
|
110
|
-
host:
|
|
111
|
-
maxConnections:
|
|
112
|
-
requireCredential: false, // opt-in: loopback clients must also present an API key
|
|
118
|
+
port: DEFAULT_INGRESS_PROXY_PORT,
|
|
119
|
+
host: DEFAULT_INGRESS_PROXY_HOST,
|
|
120
|
+
maxConnections: DEFAULT_INGRESS_PROXY_MAX_CONNECTIONS,
|
|
113
121
|
// Rule table (ADR-0018 Revision 4): the fresh-install seed routes everything
|
|
114
122
|
// through the outbound proxy policy as a BLIND TUNNEL. Inert until BOTH this
|
|
115
123
|
// listener and `proxy.enabled` are on, so it costs a fresh install nothing.
|
|
116
|
-
rules:
|
|
124
|
+
rules: DEFAULT_INGRESS_PROXY_RULES,
|
|
117
125
|
// Interception posture: decrypt only what a capability declares (live
|
|
118
126
|
// client-gateway plugin claims + explicit `ingress: intercept` rows).
|
|
119
|
-
intercept:
|
|
127
|
+
intercept: DEFAULT_INGRESS_PROXY_INTERCEPT,
|
|
120
128
|
accessLog: { enabled: true, persist: true, persistDays: DEFAULT_PROXY_ACCESS_LOG_PERSIST_DAYS },
|
|
121
129
|
// Upstream TLS trust for the origin legs (ADR-0019): system trust store
|
|
122
130
|
// unless the operator names a private CA or disables verification.
|
|
@@ -145,6 +153,19 @@ const DEFAULT_CONFIG = {
|
|
|
145
153
|
retentionDays: 7,
|
|
146
154
|
maxTotalMB: 100,
|
|
147
155
|
},
|
|
156
|
+
sessionSnapshots: {
|
|
157
|
+
// ON by default (ADR-0038 amendment): this plane is the PREREQUISITE for the
|
|
158
|
+
// console's message list/tree view and for handoff to another client — not an
|
|
159
|
+
// optional audit extra. `requestCapture`/`responses.persist` default off
|
|
160
|
+
// because turning them off costs only a log copy; turning THIS off costs the
|
|
161
|
+
// feature. The disk/privacy bound is the 30-day retention + 1 GB cap + 8 MB
|
|
162
|
+
// per-request-record cap below, and an operator who wants nothing on disk
|
|
163
|
+
// turns it off.
|
|
164
|
+
enabled: true,
|
|
165
|
+
retentionDays: 30,
|
|
166
|
+
maxTotalMB: 1024,
|
|
167
|
+
maxTurnMB: 8,
|
|
168
|
+
},
|
|
148
169
|
circuitBreaker: {
|
|
149
170
|
// Global knobs mirror the runtime default exactly once (single source:
|
|
150
171
|
// resilience/circuit-breaker.ts); shadow/persistence/rules below are
|
|
@@ -201,6 +222,16 @@ const DEFAULT_CONFIG = {
|
|
|
201
222
|
inboundGraceMs: DEFAULT_INBOUND_GRACE_MS,
|
|
202
223
|
persist: { enabled: true },
|
|
203
224
|
},
|
|
225
|
+
// The shipped admission caps live in defaults.ts as the single source; this is
|
|
226
|
+
// the config face of the same two numbers (ADR-0008). A file with no
|
|
227
|
+
// `client.bodyLimits` therefore keeps exactly the pre-knob behavior.
|
|
228
|
+
bodyLimits: {
|
|
229
|
+
maxBytes: GATEWAY_MAX_BODY_BYTES,
|
|
230
|
+
adminMaxBytes: ADMIN_MAX_BODY_BYTES,
|
|
231
|
+
},
|
|
232
|
+
// Follow-catalog auto-resync: default ON (lazy-operator default). Hot-read
|
|
233
|
+
// by the sync module — unlike bodyLimits, no restart required.
|
|
234
|
+
autoResyncFollowCatalogs: DEFAULT_AUTO_RESYNC_FOLLOW_CATALOGS,
|
|
204
235
|
// Two axes (ADR-0008 §1): `allow` streams only when the caller asks;
|
|
205
236
|
// `stream` keeps the provider leg on the upstream SSE reader even for JSON
|
|
206
237
|
// callers — TTFT/stall measurement on by default, client timing unchanged.
|
|
@@ -229,6 +260,39 @@ export function sanitizeWebAuthInput(input) {
|
|
|
229
260
|
delete wa.password;
|
|
230
261
|
return wa;
|
|
231
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Combos sanitizer: each member ref may carry its OWN `effortMap` (per-model
|
|
265
|
+
* translation, ADR-0003), so every member table gets the same trust-boundary
|
|
266
|
+
* clamp as a tier member rule — only EFFORT_LADDER → EFFORT_LADDER pairs
|
|
267
|
+
* survive and an empty result is dropped (`undefined` = passthrough, never
|
|
268
|
+
* `{}`). A combo-level `effortMap` is dropped so the redefined-away
|
|
269
|
+
* block-wide shape never re-persists. Everything else passes through
|
|
270
|
+
* untouched; the registry validates member refs when the combo is applied.
|
|
271
|
+
*/
|
|
272
|
+
function sanitizeCombos(input) {
|
|
273
|
+
if (!Array.isArray(input))
|
|
274
|
+
return [];
|
|
275
|
+
return input.map((entry) => {
|
|
276
|
+
if (entry === null || typeof entry !== 'object' || Array.isArray(entry))
|
|
277
|
+
return entry;
|
|
278
|
+
const combo = { ...entry };
|
|
279
|
+
delete combo.effortMap;
|
|
280
|
+
if (Array.isArray(combo.models)) {
|
|
281
|
+
combo.models = combo.models.map((m) => {
|
|
282
|
+
if (m === null || typeof m !== 'object' || Array.isArray(m))
|
|
283
|
+
return m;
|
|
284
|
+
const ref = { ...m };
|
|
285
|
+
const map = sanitizeEffortMap(ref.effortMap);
|
|
286
|
+
if (map)
|
|
287
|
+
ref.effortMap = map;
|
|
288
|
+
else
|
|
289
|
+
delete ref.effortMap;
|
|
290
|
+
return ref;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
return combo;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
232
296
|
/**
|
|
233
297
|
* Layer 2 sanitizer: drops the retired vendor-connection keys (`provider`,
|
|
234
298
|
* `baseUrl`, `apiKey`) left over from the pre-System-One decision layer, which talked
|
|
@@ -322,6 +386,27 @@ function resolveRequestCapture(parsed) {
|
|
|
322
386
|
dir: pick('dir'),
|
|
323
387
|
};
|
|
324
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Resolve the `sessionSnapshots:` tree (ADR-0038). Only known keys are picked,
|
|
391
|
+
* so retired/junk keys never round-trip into a saved config.yaml. Numeric caps
|
|
392
|
+
* are floored at 1 for the same irreversibility reason as `requestCapture`
|
|
393
|
+
* (a zero/negative cap would seal every session at its first turn).
|
|
394
|
+
*/
|
|
395
|
+
function resolveSessionSnapshots(parsed) {
|
|
396
|
+
const base = DEFAULT_CONFIG.sessionSnapshots;
|
|
397
|
+
const raw = (parsed?.sessionSnapshots ?? {});
|
|
398
|
+
const pickPos = (key) => {
|
|
399
|
+
const v = Number(raw[key] ?? base[key]);
|
|
400
|
+
return Number.isFinite(v) ? Math.max(1, Math.round(v)) : base[key];
|
|
401
|
+
};
|
|
402
|
+
return {
|
|
403
|
+
enabled: (raw.enabled ?? base.enabled),
|
|
404
|
+
retentionDays: pickPos('retentionDays'),
|
|
405
|
+
maxTotalMB: pickPos('maxTotalMB'),
|
|
406
|
+
maxTurnMB: pickPos('maxTurnMB'),
|
|
407
|
+
dir: (raw.dir ?? base.dir),
|
|
408
|
+
};
|
|
409
|
+
}
|
|
325
410
|
/**
|
|
326
411
|
* Resolve the `streaming:` tree (ADR-0008 §1). Only the two registered axes
|
|
327
412
|
* are picked, so a retired key (`enabled` before schemaVersion 3 — rewritten
|
|
@@ -343,28 +428,34 @@ function resolveStreamingConfig(raw) {
|
|
|
343
428
|
const STREAMING_CLIENT_MODES = ['allow', 'deny', 'always'];
|
|
344
429
|
const STREAMING_UPSTREAM_MODES = ['follow', 'stream', 'buffered'];
|
|
345
430
|
/**
|
|
346
|
-
* Resolve the whole `
|
|
431
|
+
* Resolve the whole `ingressProxy` section (ADR-0018).
|
|
347
432
|
*/
|
|
348
|
-
function
|
|
433
|
+
function resolveIngressProxyConfig(raw) {
|
|
349
434
|
const rawFp = (raw ?? {});
|
|
350
|
-
const fp = { ...DEFAULT_CONFIG.
|
|
351
|
-
// The section carries exactly the keys `
|
|
435
|
+
const fp = { ...DEFAULT_CONFIG.ingressProxy, ...rawFp };
|
|
436
|
+
// The section carries exactly the keys `IngressProxyConfig` declares. Any
|
|
352
437
|
// other key a hand-edited file still holds — a retired key (`bypassHosts`,
|
|
353
438
|
// `viaOutboundProxy`, `mitmHosts`, the interim `egress` / `egressRules` /
|
|
354
|
-
// `decryptRules` shapes, `authToken`) or a typo — is
|
|
355
|
-
// folded, never translated, never re-persisted on the
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
//
|
|
439
|
+
// `decryptRules` shapes, `authToken`, `requireCredential`) or a typo — is
|
|
440
|
+
// dropped here: never folded, never translated, never re-persisted on the
|
|
441
|
+
// next console save. Retired keys are never translated (ADR-0018 §6).
|
|
442
|
+
//
|
|
443
|
+
// `requireCredential` is the retired key an operator must never lose in
|
|
444
|
+
// silence, but the notice does NOT live here: this resolver only ever sees
|
|
445
|
+
// the whitelisted runtime shape, where the key is already gone. The v9→v10
|
|
446
|
+
// migration step (`config/migrations/v9-to-v10.ts`) removes it from the file
|
|
447
|
+
// and emits the warning — see `migrateConfig`'s `warnings`.
|
|
361
448
|
const declared = {
|
|
362
449
|
enabled: fp.enabled,
|
|
363
450
|
port: fp.port,
|
|
364
|
-
|
|
451
|
+
// The inbound proxy authenticates nobody, so a non-loopback bind would be
|
|
452
|
+
// an unauthenticated full-capture MITM proxy on the LAN. The value is NOT
|
|
453
|
+
// folded here (see `normalizeIngressProxyHost`): the listener refuses such a
|
|
454
|
+
// bind at start and the console shows that failure, so the resolved config
|
|
455
|
+
// keeps saying what the operator actually asked for.
|
|
456
|
+
host: normalizeIngressProxyHost(fp.host),
|
|
365
457
|
caDir: fp.caDir,
|
|
366
458
|
maxConnections: fp.maxConnections,
|
|
367
|
-
requireCredential: fp.requireCredential === true,
|
|
368
459
|
accessLog: fp.accessLog,
|
|
369
460
|
rules: fp.rules,
|
|
370
461
|
/** ADR-0018 Revision 4: only the two declared words survive; anything else
|
|
@@ -385,7 +476,7 @@ function resolveForwardProxyConfig(raw) {
|
|
|
385
476
|
};
|
|
386
477
|
}
|
|
387
478
|
/**
|
|
388
|
-
* Resolve `
|
|
479
|
+
* Resolve `ingressProxy.intercept` (ADR-0018 Revision 4): exactly `'claims'`
|
|
389
480
|
* and `'all'` parse; every other value (a typo, a retired word, a non-string)
|
|
390
481
|
* is ignored and the safe posture applies. Junk must never buy machine-wide
|
|
391
482
|
* decryption.
|
|
@@ -393,10 +484,21 @@ function resolveForwardProxyConfig(raw) {
|
|
|
393
484
|
function normalizeInterceptPosture(raw) {
|
|
394
485
|
return typeof raw === 'string' && INTERCEPT_POSTURES.includes(raw)
|
|
395
486
|
? raw
|
|
396
|
-
:
|
|
487
|
+
: DEFAULT_INGRESS_PROXY_INTERCEPT;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* The inbound proxy authenticates NOBODY (ADR-0008 §3), so its bind address is
|
|
491
|
+
* a security property, not a preference: only a literal loopback address can
|
|
492
|
+
* serve it. `0.0.0.0` is deliberately NOT folded into loopback here — the
|
|
493
|
+
* listener refuses such a bind at start (`assertIngressProxyBindSafety`), and
|
|
494
|
+
* silently rewriting the operator's address to 127.0.0.1 would hide that.
|
|
495
|
+
*/
|
|
496
|
+
function normalizeIngressProxyHost(raw) {
|
|
497
|
+
const host = typeof raw === 'string' ? raw.trim() : '';
|
|
498
|
+
return host || DEFAULT_INGRESS_PROXY_HOST;
|
|
397
499
|
}
|
|
398
500
|
/**
|
|
399
|
-
* Resolve `
|
|
501
|
+
* Resolve `ingressProxy.upstreamTls` (ADR-0019) — same trust boundary as the
|
|
400
502
|
* rest of the section: junk falls back to the system trust store, never to a
|
|
401
503
|
* silently disabled verification. `insecure` is only ever true when the operator
|
|
402
504
|
* literally wrote `true`.
|
|
@@ -407,17 +509,17 @@ function normalizeUpstreamTlsConfig(raw) {
|
|
|
407
509
|
return { ...(caFile ? { caFile } : {}), insecure: r.insecure === true };
|
|
408
510
|
}
|
|
409
511
|
/**
|
|
410
|
-
* Resolve `
|
|
512
|
+
* Resolve `ingressProxy.maxConnections` — junk falls back to the default (no
|
|
411
513
|
* coercion), a real number is floored and clamped to the declared bounds so a
|
|
412
514
|
* typo cannot turn the cap into "unlimited" or "reject everything".
|
|
413
515
|
*/
|
|
414
516
|
function normalizeMaxConnections(raw) {
|
|
415
517
|
if (typeof raw !== 'number' || !Number.isFinite(raw))
|
|
416
|
-
return
|
|
417
|
-
return Math.min(
|
|
518
|
+
return DEFAULT_INGRESS_PROXY_MAX_CONNECTIONS;
|
|
519
|
+
return Math.min(INGRESS_PROXY_MAX_CONNECTIONS_MAX, Math.max(INGRESS_PROXY_MAX_CONNECTIONS_MIN, Math.floor(raw)));
|
|
418
520
|
}
|
|
419
521
|
/**
|
|
420
|
-
* Resolve `
|
|
522
|
+
* Resolve `ingressProxy.accessLog` — same trust boundary as resolveRateLimit:
|
|
421
523
|
* junk values fall back to defaults, not coercion. bodyBytes: absent = the
|
|
422
524
|
* consumer applies DEFAULT_PROXY_ACCESS_LOG_BODY_BYTES (1 MiB, spill-to-file);
|
|
423
525
|
* 0 = headers only; a positive number = per-side inline cap.
|
|
@@ -575,6 +677,27 @@ function resolveCircuitBreaker(parsed) {
|
|
|
575
677
|
* doctrine as resolveRequestCapture). `persist.enabled` defaults to true —
|
|
576
678
|
* only an explicit `false` disables the ledger store. Exported for tests.
|
|
577
679
|
*/
|
|
680
|
+
/**
|
|
681
|
+
* Resolve the `client.bodyLimits` tree (ADR-0008) — the two request-body
|
|
682
|
+
* admission caps. `clampRange` is the same trust-boundary cleaner the grace
|
|
683
|
+
* window uses: a cap is a MEMORY promise the gateway makes for every in-flight
|
|
684
|
+
* request, so junk (string, NaN, negative) falls back to the shipped default and
|
|
685
|
+
* an absurd number is clamped to `BODY_LIMIT_MIN_BYTES`..`BODY_LIMIT_MAX_BYTES`
|
|
686
|
+
* instead of being honoured. Both bounds and the two defaults come from
|
|
687
|
+
* defaults.ts -- never re-declared here.
|
|
688
|
+
*
|
|
689
|
+
* Both members are always present on the resolved object: a partial file must not
|
|
690
|
+
* turn the other plane's cap undefined, and the boot-time installer
|
|
691
|
+
* (`surfaces/body-admission.ts`) treats undefined as "use the default" anyway.
|
|
692
|
+
*/
|
|
693
|
+
export function resolveBodyLimits(parsed) {
|
|
694
|
+
const raw = (parsed?.bodyLimits ?? {});
|
|
695
|
+
const base = DEFAULT_CONFIG.bodyLimits;
|
|
696
|
+
return {
|
|
697
|
+
maxBytes: clampRange(raw.maxBytes, BODY_LIMIT_MIN_BYTES, BODY_LIMIT_MAX_BYTES, base.maxBytes),
|
|
698
|
+
adminMaxBytes: clampRange(raw.adminMaxBytes, BODY_LIMIT_MIN_BYTES, BODY_LIMIT_MAX_BYTES, base.adminMaxBytes),
|
|
699
|
+
};
|
|
700
|
+
}
|
|
578
701
|
export function resolveRateLimit(parsed) {
|
|
579
702
|
const raw = (parsed?.rateLimit ?? {});
|
|
580
703
|
const v = raw.inboundGraceMs;
|
|
@@ -590,7 +713,7 @@ export function resolveRateLimit(parsed) {
|
|
|
590
713
|
let _schemaVersionWarned = false;
|
|
591
714
|
/** One-shot guard for the schemaVersion-position warning. */
|
|
592
715
|
let _schemaOrderWarned = false;
|
|
593
|
-
/** One-shot guard for the
|
|
716
|
+
/** One-shot guard for the ingress-proxy rule-table lint (ADR-0018). */
|
|
594
717
|
let _rulesLintWarned = false;
|
|
595
718
|
/**
|
|
596
719
|
* The port the config FILE names, captured on the read path. The `PORT` env
|
|
@@ -605,10 +728,10 @@ let _diskPort;
|
|
|
605
728
|
* with translations, but a hand-edited config.yaml never opens the console —
|
|
606
729
|
* one warn per process so a table that cannot do what it says is never silent.
|
|
607
730
|
*
|
|
608
|
-
* Gated on `
|
|
731
|
+
* Gated on `ingressProxy.enabled`: with the listener off the table routes
|
|
609
732
|
* nothing, so warning about it would be noise on every fresh install.
|
|
610
733
|
*/
|
|
611
|
-
function
|
|
734
|
+
function warnIngressProxyRulesOnce(raw, proxyEnabled) {
|
|
612
735
|
if (_rulesLintWarned)
|
|
613
736
|
return;
|
|
614
737
|
const fp = (raw ?? {});
|
|
@@ -619,7 +742,7 @@ function warnForwardProxyRulesOnce(raw, proxyEnabled) {
|
|
|
619
742
|
// the resolver, so a warning's index addresses the row the operator typed.
|
|
620
743
|
for (const w of lintRules(fp.rules, proxyEnabled, normalizeInterceptPosture(fp.intercept))) {
|
|
621
744
|
const at = w.ruleIndex === undefined ? '' : ` rule #${w.ruleIndex + 1}`;
|
|
622
|
-
console.warn(`[Config]
|
|
745
|
+
console.warn(`[Config] ingressProxy.rules${at}: ${w.code}${w.detail ? ` (${w.detail})` : ''}`);
|
|
623
746
|
}
|
|
624
747
|
}
|
|
625
748
|
const SUBSCRIPTION_ID_RE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
@@ -1056,10 +1179,16 @@ export function loadConfig(configPath) {
|
|
|
1056
1179
|
return DEFAULT_CONFIG;
|
|
1057
1180
|
}
|
|
1058
1181
|
const flat = toRuntimeConfig(parsed);
|
|
1182
|
+
// Canonical strategy values at the read boundary: a hand-edited file (or
|
|
1183
|
+
// a config copied in without the boot upgrade) must not leak an unknown
|
|
1184
|
+
// or retired spelling into the runtime object — every consumer, and the
|
|
1185
|
+
// next save, reads one of the three strategies only (anything else is
|
|
1186
|
+
// the default `priority`).
|
|
1187
|
+
canonicalizeSelectionValues(flat);
|
|
1059
1188
|
if (configPath === undefined) {
|
|
1060
1189
|
_diskPort = typeof flat.port === 'number' && Number.isFinite(flat.port) ? flat.port : undefined;
|
|
1061
1190
|
}
|
|
1062
|
-
|
|
1191
|
+
warnIngressProxyRulesOnce(flat.ingressProxy, flat.proxy?.enabled === true);
|
|
1063
1192
|
return {
|
|
1064
1193
|
...DEFAULT_CONFIG,
|
|
1065
1194
|
...flat,
|
|
@@ -1095,7 +1224,7 @@ export function loadConfig(configPath) {
|
|
|
1095
1224
|
routeEntries: sanitizeRouteEntriesInput(flat.routeEntries),
|
|
1096
1225
|
directives: sanitizeDirectivesInput(flat.directives),
|
|
1097
1226
|
proxy: sanitizeProxyConfig(flat.proxy ?? DEFAULT_CONFIG.proxy),
|
|
1098
|
-
|
|
1227
|
+
ingressProxy: resolveIngressProxyConfig(flat.ingressProxy),
|
|
1099
1228
|
compression: {
|
|
1100
1229
|
rtk: { ...DEFAULT_CONFIG.compression?.rtk, ...flat.compression?.rtk },
|
|
1101
1230
|
headroom: { ...DEFAULT_CONFIG.compression?.headroom, ...flat.compression?.headroom },
|
|
@@ -1104,8 +1233,12 @@ export function loadConfig(configPath) {
|
|
|
1104
1233
|
streaming: resolveStreamingConfig(flat.streaming),
|
|
1105
1234
|
requestCapture: resolveRequestCapture(flat),
|
|
1106
1235
|
tracePersist: { ...DEFAULT_CONFIG.tracePersist, ...flat.tracePersist },
|
|
1236
|
+
sessionSnapshots: resolveSessionSnapshots(flat),
|
|
1107
1237
|
circuitBreaker: resolveCircuitBreaker(flat),
|
|
1108
1238
|
rateLimit: resolveRateLimit(flat),
|
|
1239
|
+
bodyLimits: resolveBodyLimits(flat),
|
|
1240
|
+
// Explicit false disables; absent / junk / true → shipped default ON.
|
|
1241
|
+
autoResyncFollowCatalogs: flat.autoResyncFollowCatalogs === false ? false : DEFAULT_AUTO_RESYNC_FOLLOW_CATALOGS,
|
|
1109
1242
|
retry: {
|
|
1110
1243
|
enabled: flat.retry?.enabled ?? DEFAULT_CONFIG.retry?.enabled,
|
|
1111
1244
|
inplace: { ...DEFAULT_CONFIG.retry?.inplace, ...flat.retry?.inplace },
|
|
@@ -1114,7 +1247,7 @@ export function loadConfig(configPath) {
|
|
|
1114
1247
|
// RUNTIME carrier only — the disk value never maps; index.ts
|
|
1115
1248
|
// assigns boot.models over this before registry construction.
|
|
1116
1249
|
models: DEFAULT_CONFIG.models,
|
|
1117
|
-
combos: flat.combos
|
|
1250
|
+
combos: sanitizeCombos(flat.combos),
|
|
1118
1251
|
clientProfileMemory: flat.clientProfileMemory || {},
|
|
1119
1252
|
catalog: flat.catalog,
|
|
1120
1253
|
};
|
|
@@ -1256,6 +1389,11 @@ export function saveRawConfig(yamlContent) {
|
|
|
1256
1389
|
error: `config schemaVersion ${fromVersion} is newer than this build supports (current ${SCHEMA_VERSION}) — upgrade OmniCellRouter`,
|
|
1257
1390
|
};
|
|
1258
1391
|
}
|
|
1392
|
+
// Canonical strategy values at the raw-save boundary: a hand-pasted unknown
|
|
1393
|
+
// or retired spelling on an otherwise current-version draft would otherwise
|
|
1394
|
+
// be written back verbatim (migrateConfig is a no-op for a current-version
|
|
1395
|
+
// file). A change forces the canonical regroup write below.
|
|
1396
|
+
const canonicalizedSelection = canonicalizeSelectionValues(disk.routing);
|
|
1259
1397
|
if (fs.existsSync(configPath)) {
|
|
1260
1398
|
fs.copyFileSync(configPath, `${configPath}.bak`);
|
|
1261
1399
|
}
|
|
@@ -1264,7 +1402,8 @@ export function saveRawConfig(yamlContent) {
|
|
|
1264
1402
|
// is BOTH current AND the first key; anything else goes through the
|
|
1265
1403
|
// canonical regroup, which rewrites it first with the current version.
|
|
1266
1404
|
const firstIsVersion = parsed.schemaVersion === SCHEMA_VERSION && Object.keys(parsed)[0] === 'schemaVersion';
|
|
1267
|
-
|
|
1405
|
+
const writeVerbatim = fromVersion === SCHEMA_VERSION && firstIsVersion && !canonicalizedSelection;
|
|
1406
|
+
fs.writeFileSync(configPath, writeVerbatim ? yamlContent : stringify(disk), 'utf8');
|
|
1268
1407
|
if (warnings.length > 0) {
|
|
1269
1408
|
console.warn(`[Config] ${configPath}: draft upgraded v${fromVersion} → v${SCHEMA_VERSION}:`);
|
|
1270
1409
|
for (const w of warnings)
|
|
@@ -1320,11 +1459,10 @@ function syncRuntimeAuthView(fresh) {
|
|
|
1320
1459
|
// only the WIRE capability (which providers implement createStream) is
|
|
1321
1460
|
// boot-fixed. The pipeline gate is re-seeded by the save handlers.
|
|
1322
1461
|
live.streaming = fresh.streaming;
|
|
1323
|
-
//
|
|
1462
|
+
// ingressProxy too — the MITM rule table and admission gate read the live
|
|
1324
1463
|
// boot snapshot per request, so a save must land here or the console's
|
|
1325
|
-
// "takes effect immediately" promise is false.
|
|
1326
|
-
|
|
1327
|
-
live.forwardProxy = fresh.forwardProxy;
|
|
1464
|
+
// "takes effect immediately" promise is false.
|
|
1465
|
+
live.ingressProxy = fresh.ingressProxy;
|
|
1328
1466
|
// proxy policy is hot-applied (initProxyConfig on the save path). Keep
|
|
1329
1467
|
// the boot snapshot on the same object so a later reader of the live
|
|
1330
1468
|
// ref does not keep the pre-save endpoint.
|
|
@@ -1380,6 +1518,43 @@ export function saveConfig(newConfig) {
|
|
|
1380
1518
|
merged.webAuth = { ...merged.webAuth, passwordHash: current.webAuth.passwordHash };
|
|
1381
1519
|
}
|
|
1382
1520
|
merged.webAuth = sanitizeWebAuthInput(merged.webAuth);
|
|
1521
|
+
// Canonical strategy values at the WRITE boundary: a stale console tab (or a
|
|
1522
|
+
// hand-built PUT) that still posts an unknown/retired spelling must never
|
|
1523
|
+
// reach disk — it resolves to the default `priority`.
|
|
1524
|
+
canonicalizeSelectionValues(merged);
|
|
1525
|
+
// Runtime-projection-only rule fields never reach disk: `exact` is derived
|
|
1526
|
+
// by markExactFullIds / combo expansion at commit time, so a stale console
|
|
1527
|
+
// tab (or a hand-built PUT) that echoes committed rules back must not
|
|
1528
|
+
// freeze it into the file. Strip it here, next to the other write-boundary
|
|
1529
|
+
// sanitizers.
|
|
1530
|
+
if (merged.tiers) {
|
|
1531
|
+
const nextTiers = { ...merged.tiers };
|
|
1532
|
+
for (const tier of MEMBER_TIER_ORDER) {
|
|
1533
|
+
const policy = nextTiers[tier];
|
|
1534
|
+
if (policy && Array.isArray(policy.members)) {
|
|
1535
|
+
nextTiers[tier] = {
|
|
1536
|
+
...policy,
|
|
1537
|
+
members: policy.members.map((rule) => {
|
|
1538
|
+
if (rule.exact === undefined)
|
|
1539
|
+
return rule;
|
|
1540
|
+
const clean = { pattern: rule.pattern };
|
|
1541
|
+
if (rule.weight !== undefined)
|
|
1542
|
+
clean.weight = rule.weight;
|
|
1543
|
+
if (rule.effortMap !== undefined)
|
|
1544
|
+
clean.effortMap = rule.effortMap;
|
|
1545
|
+
return clean;
|
|
1546
|
+
}),
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
merged.tiers = nextTiers;
|
|
1551
|
+
}
|
|
1552
|
+
// A combo member's `effortMap` is the same trust boundary as a tier
|
|
1553
|
+
// member rule's table: a hand-built PUT / stale console tab must never
|
|
1554
|
+
// persist an out-of-ladder translation (or an empty `{}` that would read
|
|
1555
|
+
// as a table rather than passthrough). Mirrors the load-path
|
|
1556
|
+
// `sanitizeCombos` (per member) and drops any stale combo-level table.
|
|
1557
|
+
merged.combos = sanitizeCombos(merged.combos);
|
|
1383
1558
|
// One-step undo for EVERY save, not just the raw-page editor: a sanitizer
|
|
1384
1559
|
// regression once dropped a whole section and the console save persisted
|
|
1385
1560
|
// the loss with no previous file to restore. Best effort — an absent file
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* anchor the exact transform. schema.ts binds `SECTION_MOVES_V1` as the
|
|
21
21
|
* CURRENT layout (see LATEST_LAYOUT there) — bump that pointer when v2 ships.
|
|
22
22
|
*/
|
|
23
|
-
import type { ApiKeyConfig, CatalogConfig, ClassifierConfig, ClientProfileMemoryEntry, ComboConfig, CompressionConfig, CredentialLimitConfig, DefaultModelsConfig, DirectivesConfig,
|
|
23
|
+
import type { ApiKeyConfig, CatalogConfig, ClassifierConfig, ClientProfileMemoryEntry, ComboConfig, CompressionConfig, CredentialLimitConfig, DefaultModelsConfig, DirectivesConfig, IngressProxyConfig, FallbackConfig, LoggingConfig, OpenCodeConfig, ProxyConfig, QuotaConfig, RateLimitConfig, RequestCaptureConfig, ResponsesSurfaceConfig, RoutingMode, SessionConfig, SystemoneSurfaceConfig, TiersConfig, TracePersistConfig, WebAuthConfig } from '../types.js';
|
|
24
24
|
import type { CircuitBreakerConfig } from '../../resilience/types.js';
|
|
25
25
|
import type { RouteEntriesConfig, RetryConfig } from '../types.js';
|
|
26
26
|
import type { Migration } from '../schema.js';
|
|
@@ -50,7 +50,7 @@ export interface DiskConfigV1 {
|
|
|
50
50
|
webAuth?: WebAuthConfig;
|
|
51
51
|
apiKeys?: ApiKeyConfig[];
|
|
52
52
|
rateLimit?: RateLimitConfig;
|
|
53
|
-
forwardProxy?:
|
|
53
|
+
forwardProxy?: IngressProxyConfig;
|
|
54
54
|
};
|
|
55
55
|
protocol?: {
|
|
56
56
|
systemone?: SystemoneSurfaceConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration v10 → v11 — a config knob for the session-snapshot handoff store
|
|
3
|
+
* (ADR-0038).
|
|
4
|
+
*
|
|
5
|
+
* schemaVersion 10 had no operator lever for persisting a semantic, turn-level
|
|
6
|
+
* transcript that can be MOVED to another instance. v11 adds
|
|
7
|
+
* `ops.sessionSnapshots`, default ON: this plane is the PREREQUISITE for the
|
|
8
|
+
* console's message list/tree view and for handoff, so an off default would ship
|
|
9
|
+
* a feature that looks unimplemented (contrast `requestCapture`, whose off
|
|
10
|
+
* default costs only a log copy). The disk/privacy bound is its retention window
|
|
11
|
+
* and size caps; an operator who wants nothing on disk disables it.
|
|
12
|
+
*
|
|
13
|
+
* The step MOVES NOTHING and RENAMES NOTHING: `migrate` is the identity. The
|
|
14
|
+
* layout row is what makes the knob persist in BOTH directions — a disk path
|
|
15
|
+
* absent from the table is silently dropped by `toDiskConfigWith` /
|
|
16
|
+
* `toRuntimeConfigWith` (never written, never read, therefore never able to
|
|
17
|
+
* re-persist), exactly the reason v5/v6/v8 added their knobs with an identity
|
|
18
|
+
* transform. Bumping `SCHEMA_VERSION` is what makes a saved file declare the
|
|
19
|
+
* layout it was written under. No v10 key disappears, so a v10 file keeps every
|
|
20
|
+
* value it had.
|
|
21
|
+
*
|
|
22
|
+
* FROZEN after release: later schema versions MUST NOT edit this file — the
|
|
23
|
+
* chain v0→…→v10→v11→… only appends. schema.ts binds `SECTION_MOVES_V11` as the
|
|
24
|
+
* CURRENT layout (see LATEST_LAYOUT there) — bump that pointer when v12 ships.
|
|
25
|
+
*/
|
|
26
|
+
import { type DiskConfigV10 } from './v9-to-v10.js';
|
|
27
|
+
import type { SessionSnapshotConfig } from '../types.js';
|
|
28
|
+
import type { SectionMove } from '../layout.js';
|
|
29
|
+
import type { Migration } from '../schema.js';
|
|
30
|
+
/** THE v11 layout: the v10 moves plus the session-snapshot store section. */
|
|
31
|
+
export declare const SECTION_MOVES_V11: ReadonlyArray<SectionMove>;
|
|
32
|
+
/** Disk format of schemaVersion 11: v10 with `ops.sessionSnapshots` available. */
|
|
33
|
+
export type DiskConfigV11 = DiskConfigV10 & {
|
|
34
|
+
ops?: DiskConfigV10['ops'] & {
|
|
35
|
+
sessionSnapshots?: SessionSnapshotConfig;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const migrationV10ToV11: Migration;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration v10 → v11 — a config knob for the session-snapshot handoff store
|
|
3
|
+
* (ADR-0038).
|
|
4
|
+
*
|
|
5
|
+
* schemaVersion 10 had no operator lever for persisting a semantic, turn-level
|
|
6
|
+
* transcript that can be MOVED to another instance. v11 adds
|
|
7
|
+
* `ops.sessionSnapshots`, default ON: this plane is the PREREQUISITE for the
|
|
8
|
+
* console's message list/tree view and for handoff, so an off default would ship
|
|
9
|
+
* a feature that looks unimplemented (contrast `requestCapture`, whose off
|
|
10
|
+
* default costs only a log copy). The disk/privacy bound is its retention window
|
|
11
|
+
* and size caps; an operator who wants nothing on disk disables it.
|
|
12
|
+
*
|
|
13
|
+
* The step MOVES NOTHING and RENAMES NOTHING: `migrate` is the identity. The
|
|
14
|
+
* layout row is what makes the knob persist in BOTH directions — a disk path
|
|
15
|
+
* absent from the table is silently dropped by `toDiskConfigWith` /
|
|
16
|
+
* `toRuntimeConfigWith` (never written, never read, therefore never able to
|
|
17
|
+
* re-persist), exactly the reason v5/v6/v8 added their knobs with an identity
|
|
18
|
+
* transform. Bumping `SCHEMA_VERSION` is what makes a saved file declare the
|
|
19
|
+
* layout it was written under. No v10 key disappears, so a v10 file keeps every
|
|
20
|
+
* value it had.
|
|
21
|
+
*
|
|
22
|
+
* FROZEN after release: later schema versions MUST NOT edit this file — the
|
|
23
|
+
* chain v0→…→v10→v11→… only appends. schema.ts binds `SECTION_MOVES_V11` as the
|
|
24
|
+
* CURRENT layout (see LATEST_LAYOUT there) — bump that pointer when v12 ships.
|
|
25
|
+
*/
|
|
26
|
+
import { SECTION_MOVES_V10 } from './v9-to-v10.js';
|
|
27
|
+
/** THE v11 layout: the v10 moves plus the session-snapshot store section. */
|
|
28
|
+
export const SECTION_MOVES_V11 = [
|
|
29
|
+
...SECTION_MOVES_V10,
|
|
30
|
+
['ops.sessionSnapshots', 'sessionSnapshots'],
|
|
31
|
+
];
|
|
32
|
+
export const migrationV10ToV11 = {
|
|
33
|
+
from: 10,
|
|
34
|
+
to: 11,
|
|
35
|
+
warn: [
|
|
36
|
+
'schemaVersion 11 adds ops.sessionSnapshots (default ON): a semantic, turn-level transcript store that can be exported as a portable bundle and handed to another instance (ADR-0038), and the prerequisite for the console message list/tree view. Set enabled: false to keep nothing on disk. Distinct from ops.requestCapture (a byte-faithful debug log, default off)',
|
|
37
|
+
],
|
|
38
|
+
// Nothing moved, so nothing to rewrite — the identity is deliberate (v4→v5,
|
|
39
|
+
// v5→v6, v7→v8, v8→v9 precedent): materialising an absent section on files
|
|
40
|
+
// that never had one adds noise the writer does not need and breaks the
|
|
41
|
+
// migrate-idempotence contract the migration tests pin.
|
|
42
|
+
migrate: (raw) => ({ ...raw }),
|
|
43
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration v4 → v5 (ADR-0008) — body admission becomes operator-tunable.
|
|
3
|
+
*
|
|
4
|
+
* schemaVersion 4 hard-wired the request-body ceilings to the constants in
|
|
5
|
+
* `config/defaults.ts`: nothing on either HTTP plane read config for admission,
|
|
6
|
+
* so an operator who needed a bigger cap (a 40 MB agent upload) or a smaller one
|
|
7
|
+
* (a memory-constrained box) had no lever — and, worse, no way to *see* the
|
|
8
|
+
* number the gateway would answer with short of triggering a 413. v5 adds
|
|
9
|
+
* `client.bodyLimits`, the disk home for the two per-plane caps.
|
|
10
|
+
*
|
|
11
|
+
* The step MOVES NOTHING and RENAMES NOTHING: `migrate` is the identity, exactly
|
|
12
|
+
* like the v3→v4 layout row. It exists because the layout tables are frozen
|
|
13
|
+
* per version and `toDiskConfigWith` / `toRuntimeConfigWith` iterate ONLY the
|
|
14
|
+
* rows of the bound table — a new disk path that is not a row is silently dropped
|
|
15
|
+
* in both directions (never persisted, never loaded, and therefore never able to
|
|
16
|
+
* re-persist). Appending the row here is what makes the knob real; bumping
|
|
17
|
+
* `SCHEMA_VERSION` is what makes a saved file declare the layout it was written
|
|
18
|
+
* under. No v4 key disappears, so a v4 file keeps every value it had.
|
|
19
|
+
*
|
|
20
|
+
* FROZEN after release: later schema versions MUST NOT edit this file — the chain
|
|
21
|
+
* v0→…→v4→v5→… only appends. schema.ts binds `SECTION_MOVES_V5` as the CURRENT
|
|
22
|
+
* layout (see LATEST_LAYOUT there) — bump that pointer when v6 ships.
|
|
23
|
+
*/
|
|
24
|
+
import { type DiskConfigV4 } from './v3-to-v4.js';
|
|
25
|
+
import type { BodyLimitsConfig } from '../types.js';
|
|
26
|
+
import type { SectionMove } from '../layout.js';
|
|
27
|
+
import type { Migration } from '../schema.js';
|
|
28
|
+
/** THE v5 layout: the v4 moves plus the new admission-cap section. */
|
|
29
|
+
export declare const SECTION_MOVES_V5: ReadonlyArray<SectionMove>;
|
|
30
|
+
/** Disk format of schemaVersion 5: v4 with `client.bodyLimits` available. */
|
|
31
|
+
export type DiskConfigV5 = DiskConfigV4 & {
|
|
32
|
+
client?: DiskConfigV4['client'] & {
|
|
33
|
+
bodyLimits?: BodyLimitsConfig;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare const migrationV4ToV5: Migration;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration v4 → v5 (ADR-0008) — body admission becomes operator-tunable.
|
|
3
|
+
*
|
|
4
|
+
* schemaVersion 4 hard-wired the request-body ceilings to the constants in
|
|
5
|
+
* `config/defaults.ts`: nothing on either HTTP plane read config for admission,
|
|
6
|
+
* so an operator who needed a bigger cap (a 40 MB agent upload) or a smaller one
|
|
7
|
+
* (a memory-constrained box) had no lever — and, worse, no way to *see* the
|
|
8
|
+
* number the gateway would answer with short of triggering a 413. v5 adds
|
|
9
|
+
* `client.bodyLimits`, the disk home for the two per-plane caps.
|
|
10
|
+
*
|
|
11
|
+
* The step MOVES NOTHING and RENAMES NOTHING: `migrate` is the identity, exactly
|
|
12
|
+
* like the v3→v4 layout row. It exists because the layout tables are frozen
|
|
13
|
+
* per version and `toDiskConfigWith` / `toRuntimeConfigWith` iterate ONLY the
|
|
14
|
+
* rows of the bound table — a new disk path that is not a row is silently dropped
|
|
15
|
+
* in both directions (never persisted, never loaded, and therefore never able to
|
|
16
|
+
* re-persist). Appending the row here is what makes the knob real; bumping
|
|
17
|
+
* `SCHEMA_VERSION` is what makes a saved file declare the layout it was written
|
|
18
|
+
* under. No v4 key disappears, so a v4 file keeps every value it had.
|
|
19
|
+
*
|
|
20
|
+
* FROZEN after release: later schema versions MUST NOT edit this file — the chain
|
|
21
|
+
* v0→…→v4→v5→… only appends. schema.ts binds `SECTION_MOVES_V5` as the CURRENT
|
|
22
|
+
* layout (see LATEST_LAYOUT there) — bump that pointer when v6 ships.
|
|
23
|
+
*/
|
|
24
|
+
import { SECTION_MOVES_V4 } from './v3-to-v4.js';
|
|
25
|
+
/** THE v5 layout: the v4 moves plus the new admission-cap section. */
|
|
26
|
+
export const SECTION_MOVES_V5 = [
|
|
27
|
+
...SECTION_MOVES_V4,
|
|
28
|
+
['client.bodyLimits', 'bodyLimits'],
|
|
29
|
+
];
|
|
30
|
+
export const migrationV4ToV5 = {
|
|
31
|
+
from: 4,
|
|
32
|
+
to: 5,
|
|
33
|
+
warn: [
|
|
34
|
+
'schemaVersion 5 adds client.bodyLimits (maxBytes | adminMaxBytes): the request-body admission caps per HTTP plane, previously fixed constants (ADR-0008)',
|
|
35
|
+
],
|
|
36
|
+
// Nothing moved, so nothing to rewrite. The identity is deliberate: reading the
|
|
37
|
+
// tree to "helpfully" materialise `client: {}` on files that never had a
|
|
38
|
+
// `client` section would add noise the writer does not need (the section is
|
|
39
|
+
// created on the first real save) and break the migrate-idempotence contract
|
|
40
|
+
// the migration tests pin.
|
|
41
|
+
migrate: (raw) => ({ ...raw }),
|
|
42
|
+
};
|