omnicell-router 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -7
- package/README.zh-CN.md +18 -5
- package/backend/dist/auth/api-keys.js +11 -0
- package/backend/dist/auth/key-models.d.ts +36 -0
- package/backend/dist/auth/key-models.js +99 -0
- package/backend/dist/capture/recorder.d.ts +4 -10
- package/backend/dist/capture/recorder.js +6 -58
- package/backend/dist/cli/clients/activity.js +2 -0
- package/backend/dist/cli/clients/base.d.ts +36 -11
- package/backend/dist/cli/clients/base.js +31 -15
- package/backend/dist/cli/clients/claude.d.ts +9 -0
- package/backend/dist/cli/clients/claude.js +6 -0
- package/backend/dist/cli/clients/codex.d.ts +78 -0
- package/backend/dist/cli/clients/codex.js +475 -57
- package/backend/dist/cli/clients/core-adapters.d.ts +1 -1
- package/backend/dist/cli/clients/core-adapters.js +1 -1
- package/backend/dist/cli/clients/dsh.d.ts +8 -0
- package/backend/dist/cli/clients/dsh.js +5 -0
- package/backend/dist/cli/clients/follow-catalog-sync.d.ts +62 -0
- package/backend/dist/cli/clients/follow-catalog-sync.js +435 -0
- package/backend/dist/cli/clients/grok.d.ts +15 -1
- package/backend/dist/cli/clients/grok.js +16 -2
- package/backend/dist/cli/clients/index.d.ts +13 -1
- package/backend/dist/cli/clients/index.js +97 -19
- package/backend/dist/cli/clients/kimi.d.ts +6 -0
- package/backend/dist/cli/clients/kimi.js +3 -0
- package/backend/dist/cli/clients/launcher.d.ts +1 -1
- package/backend/dist/cli/clients/model-meta.js +6 -3
- package/backend/dist/cli/clients/omp.d.ts +6 -0
- package/backend/dist/cli/clients/omp.js +3 -0
- package/backend/dist/cli/clients/openclaw.d.ts +6 -0
- package/backend/dist/cli/clients/openclaw.js +3 -0
- package/backend/dist/cli/clients/opencode.d.ts +8 -0
- package/backend/dist/cli/clients/opencode.js +8 -2
- package/backend/dist/cli/clients/pi.d.ts +6 -0
- package/backend/dist/cli/clients/pi.js +3 -0
- package/backend/dist/cli/clients/reserved.js +2 -0
- package/backend/dist/cli/clients/update-check.d.ts +37 -0
- package/backend/dist/cli/clients/update-check.js +309 -0
- package/backend/dist/cli/clients/workbuddy.d.ts +19 -0
- package/backend/dist/cli/clients/workbuddy.js +66 -0
- package/backend/dist/cli/index.js +5 -4
- package/backend/dist/cli/paths.js +8 -0
- package/backend/dist/cli/types.d.ts +101 -16
- package/backend/dist/config/comments-en.js +34 -25
- package/backend/dist/config/comments-zh.js +33 -24
- package/backend/dist/config/defaults.d.ts +280 -22
- package/backend/dist/config/defaults.js +279 -21
- package/backend/dist/config/env.d.ts +10 -0
- package/backend/dist/config/env.js +3 -2
- package/backend/dist/config/index.d.ts +22 -1
- package/backend/dist/config/index.js +218 -43
- package/backend/dist/config/migrations/v0-to-v1.d.ts +2 -2
- package/backend/dist/config/migrations/v10-to-v11.d.ts +38 -0
- package/backend/dist/config/migrations/v10-to-v11.js +43 -0
- package/backend/dist/config/migrations/v4-to-v5.d.ts +36 -0
- package/backend/dist/config/migrations/v4-to-v5.js +42 -0
- package/backend/dist/config/migrations/v5-to-v6.d.ts +27 -0
- package/backend/dist/config/migrations/v5-to-v6.js +29 -0
- package/backend/dist/config/migrations/v6-to-v7.d.ts +45 -0
- package/backend/dist/config/migrations/v6-to-v7.js +97 -0
- package/backend/dist/config/migrations/v7-to-v8.d.ts +36 -0
- package/backend/dist/config/migrations/v7-to-v8.js +43 -0
- package/backend/dist/config/migrations/v8-to-v9.d.ts +38 -0
- package/backend/dist/config/migrations/v8-to-v9.js +43 -0
- package/backend/dist/config/migrations/v9-to-v10.d.ts +51 -0
- package/backend/dist/config/migrations/v9-to-v10.js +71 -0
- package/backend/dist/config/runtime.js +1 -1
- package/backend/dist/config/schema.d.ts +3 -3
- package/backend/dist/config/schema.js +18 -4
- package/backend/dist/config/types.d.ts +221 -41
- package/backend/dist/egress-proxy/asset-download.d.ts +54 -0
- package/backend/dist/egress-proxy/asset-download.js +420 -0
- package/backend/dist/egress-proxy/manual-node-spec.d.ts +92 -0
- package/backend/dist/egress-proxy/manual-node-spec.js +408 -0
- package/backend/dist/egress-proxy/mihomo-binary.d.ts +54 -0
- package/backend/dist/egress-proxy/mihomo-binary.js +278 -0
- package/backend/dist/egress-proxy/mihomo-client.d.ts +94 -0
- package/backend/dist/egress-proxy/mihomo-client.js +308 -0
- package/backend/dist/egress-proxy/mihomo-config.d.ts +40 -0
- package/backend/dist/egress-proxy/mihomo-config.js +161 -0
- package/backend/dist/egress-proxy/mihomo-geo.d.ts +87 -0
- package/backend/dist/egress-proxy/mihomo-geo.js +213 -0
- package/backend/dist/egress-proxy/mihomo-logs.d.ts +43 -0
- package/backend/dist/egress-proxy/mihomo-logs.js +84 -0
- package/backend/dist/egress-proxy/mihomo-pac.d.ts +37 -0
- package/backend/dist/egress-proxy/mihomo-pac.js +75 -0
- package/backend/dist/egress-proxy/mihomo-rules-import.d.ts +43 -0
- package/backend/dist/egress-proxy/mihomo-rules-import.js +193 -0
- package/backend/dist/egress-proxy/mihomo-sidecar.d.ts +81 -0
- package/backend/dist/egress-proxy/mihomo-sidecar.js +637 -0
- package/backend/dist/forward-proxy/egress.d.ts +50 -11
- package/backend/dist/forward-proxy/egress.js +63 -17
- package/backend/dist/forward-proxy/h2-forward.js +42 -15
- package/backend/dist/forward-proxy/index.d.ts +11 -8
- package/backend/dist/forward-proxy/index.js +27 -60
- package/backend/dist/forward-proxy/interceptor.d.ts +3 -2
- package/backend/dist/forward-proxy/interceptor.js +4 -4
- package/backend/dist/forward-proxy/relay.js +3 -3
- package/backend/dist/forward-proxy/rules.d.ts +4 -4
- package/backend/dist/forward-proxy/rules.js +25 -4
- package/backend/dist/forward-proxy/server.d.ts +12 -16
- package/backend/dist/forward-proxy/server.js +237 -171
- package/backend/dist/harness/host/hosts.js +3 -2
- package/backend/dist/index.js +59 -19
- package/backend/dist/ingress-proxy/access-log.d.ts +176 -0
- package/backend/dist/ingress-proxy/access-log.js +774 -0
- package/backend/dist/ingress-proxy/ca-inventory.d.ts +106 -0
- package/backend/dist/ingress-proxy/ca-inventory.js +525 -0
- package/backend/dist/ingress-proxy/ca-trust.d.ts +96 -0
- package/backend/dist/ingress-proxy/ca-trust.js +315 -0
- package/backend/dist/ingress-proxy/ca.d.ts +104 -0
- package/backend/dist/ingress-proxy/ca.js +273 -0
- package/backend/dist/ingress-proxy/data-dir.d.ts +28 -0
- package/backend/dist/ingress-proxy/data-dir.js +45 -0
- package/backend/dist/ingress-proxy/egress.d.ts +151 -0
- package/backend/dist/ingress-proxy/egress.js +364 -0
- package/backend/dist/ingress-proxy/h2-forward.d.ts +66 -0
- package/backend/dist/ingress-proxy/h2-forward.js +561 -0
- package/backend/dist/ingress-proxy/index.d.ts +24 -0
- package/backend/dist/ingress-proxy/index.js +144 -0
- package/backend/dist/ingress-proxy/interceptor.d.ts +25 -0
- package/backend/dist/ingress-proxy/interceptor.js +52 -0
- package/backend/dist/ingress-proxy/ordered-relay.d.ts +29 -0
- package/backend/dist/ingress-proxy/ordered-relay.js +46 -0
- package/backend/dist/ingress-proxy/relay.d.ts +54 -0
- package/backend/dist/ingress-proxy/relay.js +188 -0
- package/backend/dist/ingress-proxy/rules.d.ts +195 -0
- package/backend/dist/ingress-proxy/rules.js +348 -0
- package/backend/dist/ingress-proxy/server.d.ts +153 -0
- package/backend/dist/ingress-proxy/server.js +2065 -0
- package/backend/dist/ingress-proxy/sni.d.ts +35 -0
- package/backend/dist/ingress-proxy/sni.js +124 -0
- package/backend/dist/ingress-proxy/status.d.ts +32 -0
- package/backend/dist/ingress-proxy/status.js +15 -0
- package/backend/dist/ingress-proxy/system-proxy.d.ts +112 -0
- package/backend/dist/ingress-proxy/system-proxy.js +481 -0
- package/backend/dist/ingress-proxy/traffic-delete.d.ts +21 -0
- package/backend/dist/ingress-proxy/traffic-delete.js +64 -0
- package/backend/dist/ingress-proxy/traffic-delete.worker.d.ts +44 -0
- package/backend/dist/ingress-proxy/traffic-delete.worker.js +228 -0
- package/backend/dist/ingress-proxy/traffic-files.d.ts +10 -0
- package/backend/dist/ingress-proxy/traffic-files.js +10 -0
- package/backend/dist/ingress-proxy/upstream-tls.d.ts +46 -0
- package/backend/dist/ingress-proxy/upstream-tls.js +105 -0
- package/backend/dist/ingress-proxy/ws-frames.d.ts +45 -0
- package/backend/dist/ingress-proxy/ws-frames.js +153 -0
- package/backend/dist/ir/adapters/anthropic-messages-stream.js +6 -1
- package/backend/dist/ir/adapters/anthropic-messages.js +12 -5
- package/backend/dist/ir/adapters/google-gemini-stream.js +7 -2
- package/backend/dist/ir/adapters/google-gemini.js +5 -2
- package/backend/dist/ir/adapters/openai-chat-stream.js +5 -1
- package/backend/dist/ir/adapters/openai-chat.d.ts +25 -0
- package/backend/dist/ir/adapters/openai-chat.js +50 -6
- package/backend/dist/ir/adapters/openai-responses-output.d.ts +1 -0
- package/backend/dist/ir/adapters/openai-responses-output.js +67 -21
- package/backend/dist/ir/adapters/openai-responses-stream.d.ts +13 -0
- package/backend/dist/ir/adapters/openai-responses-stream.js +34 -1
- package/backend/dist/ir/adapters/openai-responses.d.ts +92 -1
- package/backend/dist/ir/adapters/openai-responses.js +163 -12
- package/backend/dist/ir/capabilities.js +4 -0
- package/backend/dist/ir/media.d.ts +20 -0
- package/backend/dist/ir/media.js +41 -0
- package/backend/dist/ir/tool-identity.d.ts +35 -0
- package/backend/dist/ir/tool-identity.js +40 -0
- package/backend/dist/ir/types.d.ts +9 -1
- package/backend/dist/ir/validate.d.ts +24 -0
- package/backend/dist/ir/validate.js +113 -63
- package/backend/dist/local/build-jobs.d.ts +66 -0
- package/backend/dist/local/build-jobs.js +243 -0
- package/backend/dist/local/detect.d.ts +32 -0
- package/backend/dist/local/detect.js +145 -0
- package/backend/dist/local/draft-match.d.ts +58 -0
- package/backend/dist/local/draft-match.js +124 -0
- package/backend/dist/local/engine-runtime.d.ts +522 -0
- package/backend/dist/local/engine-runtime.js +1 -0
- package/backend/dist/local/engines.d.ts +241 -0
- package/backend/dist/local/engines.js +651 -0
- package/backend/dist/local/gguf.d.ts +35 -0
- package/backend/dist/local/gguf.js +314 -0
- package/backend/dist/local/hf.d.ts +120 -0
- package/backend/dist/local/hf.js +304 -0
- package/backend/dist/local/install.d.ts +90 -0
- package/backend/dist/local/install.js +421 -0
- package/backend/dist/local/llamacpp.d.ts +55 -0
- package/backend/dist/local/llamacpp.js +177 -0
- package/backend/dist/local/local-provider.d.ts +81 -0
- package/backend/dist/local/local-provider.js +301 -0
- package/backend/dist/local/machine-stats.d.ts +87 -0
- package/backend/dist/local/machine-stats.js +332 -0
- package/backend/dist/local/model-store.d.ts +347 -0
- package/backend/dist/local/model-store.js +1215 -0
- package/backend/dist/local/part-sweep.d.ts +32 -0
- package/backend/dist/local/part-sweep.js +156 -0
- package/backend/dist/local/plan.d.ts +65 -0
- package/backend/dist/local/plan.js +146 -0
- package/backend/dist/local/resources.d.ts +49 -0
- package/backend/dist/local/resources.js +64 -0
- package/backend/dist/local/run-stats.d.ts +95 -0
- package/backend/dist/local/run-stats.js +195 -0
- package/backend/dist/local/runner.d.ts +235 -0
- package/backend/dist/local/runner.js +1392 -0
- package/backend/dist/local/settings.d.ts +79 -0
- package/backend/dist/local/settings.js +180 -0
- package/backend/dist/local/strata-catalog.d.ts +30 -0
- package/backend/dist/local/strata-catalog.js +511 -0
- package/backend/dist/local/strata-drafting.d.ts +46 -0
- package/backend/dist/local/strata-drafting.js +265 -0
- package/backend/dist/local/strata.d.ts +278 -0
- package/backend/dist/local/strata.js +1392 -0
- package/backend/dist/local/tar.d.ts +20 -0
- package/backend/dist/local/tar.js +367 -0
- package/backend/dist/local/transport.d.ts +35 -0
- package/backend/dist/local/transport.js +89 -0
- package/backend/dist/local/tune.d.ts +58 -0
- package/backend/dist/local/tune.js +324 -0
- package/backend/dist/observability/http-exchange.d.ts +2 -2
- package/backend/dist/opencode/catalog/auto-pull.d.ts +14 -3
- package/backend/dist/opencode/catalog/auto-pull.js +284 -77
- package/backend/dist/opencode/catalog/ocr-store.d.ts +7 -6
- package/backend/dist/opencode/catalog/ocr-store.js +4 -2
- package/backend/dist/opencode/catalog/overrides-store.d.ts +15 -4
- package/backend/dist/opencode/catalog/overrides-store.js +28 -19
- package/backend/dist/opencode/catalog/reasoning-declaration.d.ts +35 -0
- package/backend/dist/opencode/catalog/reasoning-declaration.js +66 -0
- package/backend/dist/opencode/catalog/repository.js +28 -5
- package/backend/dist/opencode/catalog/sources/models-dev.d.ts +3 -3
- package/backend/dist/opencode/catalog/sources/models-dev.js +42 -14
- package/backend/dist/opencode/catalog/types.d.ts +42 -12
- package/backend/dist/opencode/catalog/types.js +38 -1
- package/backend/dist/opencode/credentials/def-materialize.js +27 -21
- package/backend/dist/opencode/credentials/ocr-store.js +11 -2
- package/backend/dist/opencode/credentials/sync.js +12 -3
- package/backend/dist/opencode/credentials/types.d.ts +31 -4
- package/backend/dist/opencode/credentials/types.js +25 -0
- package/backend/dist/opencode/migrate/engine.d.ts +20 -0
- package/backend/dist/opencode/migrate/engine.js +71 -0
- package/backend/dist/opencode/migrate/migrator.d.ts +11 -0
- package/backend/dist/opencode/migrate/migrator.js +6 -0
- package/backend/dist/opencode/migrate/steps/overrides-v1-to-v2.d.ts +6 -0
- package/backend/dist/opencode/migrate/steps/overrides-v1-to-v2.js +31 -0
- package/backend/dist/opencode/migrate/steps/providers-v1-to-v2.d.ts +6 -0
- package/backend/dist/opencode/migrate/steps/providers-v1-to-v2.js +62 -0
- package/backend/dist/opencode/probe.d.ts +21 -4
- package/backend/dist/opencode/probe.js +34 -10
- package/backend/dist/opencode/provider-def-adapters.d.ts +12 -11
- package/backend/dist/opencode/provider-def-adapters.js +43 -27
- package/backend/dist/opencode/provider-defs.d.ts +10 -16
- package/backend/dist/opencode/provider-defs.js +45 -45
- package/backend/dist/opencode/user-config.d.ts +23 -26
- package/backend/dist/opencode/user-config.js +95 -77
- package/backend/dist/pipeline/directives.d.ts +9 -4
- package/backend/dist/pipeline/directives.js +14 -10
- package/backend/dist/pipeline/orchestrator.d.ts +42 -13
- package/backend/dist/pipeline/orchestrator.js +514 -172
- package/backend/dist/plugins/builtin/model-gateway.js +38 -12
- package/backend/dist/plugins/environment-ack.d.ts +51 -0
- package/backend/dist/plugins/environment-ack.js +81 -0
- package/backend/dist/plugins/gateways.d.ts +6 -6
- package/backend/dist/plugins/gateways.js +2 -2
- package/backend/dist/plugins/host.d.ts +100 -16
- package/backend/dist/plugins/host.js +637 -99
- package/backend/dist/plugins/install-run.d.ts +27 -0
- package/backend/dist/plugins/install-run.js +99 -0
- package/backend/dist/plugins/manifest.d.ts +84 -32
- package/backend/dist/plugins/manifest.js +149 -45
- package/backend/dist/plugins/market-install.d.ts +18 -0
- package/backend/dist/plugins/market-install.js +111 -0
- package/backend/dist/plugins/market-source.d.ts +100 -0
- package/backend/dist/plugins/market-source.js +449 -0
- package/backend/dist/plugins/market-updates.d.ts +70 -0
- package/backend/dist/plugins/market-updates.js +97 -0
- package/backend/dist/plugins/market.d.ts +677 -0
- package/backend/dist/plugins/market.js +2113 -0
- package/backend/dist/plugins/source-index.d.ts +155 -0
- package/backend/dist/plugins/source-index.js +217 -0
- package/backend/dist/plugins/types.d.ts +402 -37
- package/backend/dist/projects/worktrees.d.ts +88 -0
- package/backend/dist/projects/worktrees.js +220 -0
- package/backend/dist/providers/boot-direct.d.ts +41 -7
- package/backend/dist/providers/boot-direct.js +284 -44
- package/backend/dist/providers/compat/tool-markup-recovery.js +31 -6
- package/backend/dist/providers/dial-wire.d.ts +17 -0
- package/backend/dist/providers/dial-wire.js +49 -0
- package/backend/dist/providers/executors/dispatch.d.ts +17 -7
- package/backend/dist/providers/executors/dispatch.js +28 -9
- package/backend/dist/providers/executors/openai-chat.js +14 -2
- package/backend/dist/providers/executors/plugin-adapter.d.ts +23 -1
- package/backend/dist/providers/executors/plugin-adapter.js +59 -3
- package/backend/dist/providers/member-match.d.ts +32 -9
- package/backend/dist/providers/member-match.js +65 -21
- package/backend/dist/providers/model-resolution.d.ts +62 -0
- package/backend/dist/providers/model-resolution.js +62 -0
- package/backend/dist/providers/price-order.d.ts +51 -0
- package/backend/dist/providers/price-order.js +54 -0
- package/backend/dist/providers/protocols-field.d.ts +24 -0
- package/backend/dist/providers/protocols-field.js +66 -0
- package/backend/dist/providers/provider-takedown.d.ts +5 -2
- package/backend/dist/providers/registry.d.ts +87 -26
- package/backend/dist/providers/registry.js +232 -121
- package/backend/dist/providers/selection.d.ts +91 -0
- package/backend/dist/providers/selection.js +158 -0
- package/backend/dist/providers/virtual-meta.d.ts +33 -2
- package/backend/dist/providers/virtual-meta.js +74 -18
- package/backend/dist/quota/cli-login.d.ts +25 -4
- package/backend/dist/quota/cli-login.js +38 -6
- package/backend/dist/quota/coverage-generation.d.ts +24 -0
- package/backend/dist/quota/coverage-generation.js +29 -0
- package/backend/dist/quota/declarations.js +8 -4
- package/backend/dist/quota/engine.js +2 -2
- package/backend/dist/quota/prober.d.ts +43 -2
- package/backend/dist/quota/prober.js +97 -22
- package/backend/dist/ratelimit/rate-limiter.d.ts +1 -1
- package/backend/dist/resilience/error-classifier.js +29 -0
- package/backend/dist/router/index.d.ts +1 -1
- package/backend/dist/router/index.js +17 -1
- package/backend/dist/router/layer2-decision.d.ts +1 -1
- package/backend/dist/router/layer2-decision.js +2 -2
- package/backend/dist/routes/console.js +1043 -405
- package/backend/dist/routes/environments.js +1 -1
- package/backend/dist/routes/local-models.d.ts +2 -0
- package/backend/dist/routes/local-models.js +1414 -0
- package/backend/dist/routes/mihomo.d.ts +2 -2
- package/backend/dist/routes/mihomo.js +20 -11
- package/backend/dist/routes/projects.js +121 -0
- package/backend/dist/server.js +409 -15
- package/backend/dist/session/session-manager.d.ts +42 -5
- package/backend/dist/session/session-manager.js +64 -11
- package/backend/dist/session/session-row.d.ts +29 -8
- package/backend/dist/session/session-row.js +18 -13
- package/backend/dist/snapshot/bundle.d.ts +40 -0
- package/backend/dist/snapshot/bundle.js +177 -0
- package/backend/dist/snapshot/handoff/compress.d.ts +46 -0
- package/backend/dist/snapshot/handoff/compress.js +77 -0
- package/backend/dist/snapshot/handoff/index.d.ts +119 -0
- package/backend/dist/snapshot/handoff/index.js +160 -0
- package/backend/dist/snapshot/handoff/jsonl-writer.d.ts +78 -0
- package/backend/dist/snapshot/handoff/jsonl-writer.js +175 -0
- package/backend/dist/snapshot/handoff/opencode-writer.d.ts +51 -0
- package/backend/dist/snapshot/handoff/opencode-writer.js +214 -0
- package/backend/dist/snapshot/handoff/summarize.d.ts +39 -0
- package/backend/dist/snapshot/handoff/summarize.js +118 -0
- package/backend/dist/snapshot/handoff/transcript.d.ts +71 -0
- package/backend/dist/snapshot/handoff/transcript.js +167 -0
- package/backend/dist/snapshot/media-fs.d.ts +10 -0
- package/backend/dist/snapshot/media-fs.js +50 -0
- package/backend/dist/snapshot/media.d.ts +32 -0
- package/backend/dist/snapshot/media.js +87 -0
- package/backend/dist/snapshot/store.d.ts +226 -0
- package/backend/dist/snapshot/store.js +887 -0
- package/backend/dist/snapshot/tree.d.ts +112 -0
- package/backend/dist/snapshot/tree.js +207 -0
- package/backend/dist/snapshot/types.d.ts +212 -0
- package/backend/dist/snapshot/types.js +14 -0
- package/backend/dist/snapshot/view.d.ts +19 -0
- package/backend/dist/snapshot/view.js +57 -0
- package/backend/dist/snapshot/write-worker.d.ts +67 -0
- package/backend/dist/snapshot/write-worker.js +129 -0
- package/backend/dist/surfaces/anthropic.js +4 -1
- package/backend/dist/surfaces/body-admission.d.ts +344 -0
- package/backend/dist/surfaces/body-admission.js +818 -0
- package/backend/dist/surfaces/chat-pipeline.js +8 -0
- package/backend/dist/surfaces/decision-pipeline.js +10 -7
- package/backend/dist/surfaces/gateway-catalog.d.ts +26 -0
- package/backend/dist/surfaces/gateway-catalog.js +202 -0
- package/backend/dist/surfaces/gateway-chat.d.ts +7 -11
- package/backend/dist/surfaces/gateway-chat.js +50 -12
- package/backend/dist/surfaces/ocr-headers.d.ts +6 -4
- package/backend/dist/surfaces/ocr-headers.js +11 -7
- package/backend/dist/surfaces/systemone.js +1 -1
- package/backend/dist/surfaces/transport-fastify.js +32 -5
- package/backend/dist/surfaces/transport-node-http.d.ts +51 -6
- package/backend/dist/surfaces/transport-node-http.js +76 -16
- package/backend/dist/surfaces/types.d.ts +11 -3
- package/backend/dist/trace/persist.js +21 -1
- package/backend/dist/trace/tracker.d.ts +35 -3
- package/backend/dist/trace/tracker.js +23 -0
- package/backend/dist/types/openai.d.ts +8 -0
- package/backend/dist/types/router.d.ts +17 -6
- package/backend/dist/types/router.js +14 -2
- package/backend/dist/utils/client-families.d.ts +66 -0
- package/backend/dist/utils/client-families.js +127 -0
- package/backend/dist/utils/event-ring.d.ts +1 -1
- package/backend/dist/utils/event-ring.js +1 -1
- package/backend/dist/utils/proxy-node.js +1 -1
- package/backend/dist/utils/proxy.d.ts +135 -11
- package/backend/dist/utils/proxy.js +144 -29
- package/backend/dist/utils/run-command.d.ts +21 -1
- package/backend/dist/utils/run-command.js +64 -4
- package/backend/dist/utils/server-liveness.d.ts +28 -0
- package/backend/dist/utils/server-liveness.js +32 -0
- package/backend/dist/utils/session-file.d.ts +28 -0
- package/backend/dist/utils/session-file.js +34 -0
- package/frontend/dist/assets/antigravity.color-DXFfVr6X.svg +39 -0
- package/frontend/dist/assets/gemini-cli.color-BfquLd1p.svg +1 -0
- package/frontend/dist/assets/index-CTZNvn1d.js +1707 -0
- package/frontend/dist/assets/{index-DxZ9MHKB.css → index-CqDSOPQ0.css} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +3 -1
- package/frontend/dist/assets/index-55VVwfFQ.js +0 -1521
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-side resource readings for the Run Monitor board.
|
|
3
|
+
*
|
|
4
|
+
* Counters (`run-stats.ts`) answer "how fast"; this module answers "why".
|
|
5
|
+
* A run pinned at 6 tok/s is only diagnosable if the operator can see that the
|
|
6
|
+
* card is full, the RAM is swapping or every core is busy — and the gateway
|
|
7
|
+
* host IS the machine running the model, so `os` + `nvidia-smi` read exactly
|
|
8
|
+
* the thing the operator is asking about, not a remote approximation.
|
|
9
|
+
*
|
|
10
|
+
* Two rules shape the implementation:
|
|
11
|
+
*
|
|
12
|
+
* - **Sampling is decoupled from request handling.** The console polls the
|
|
13
|
+
* monitor every two seconds while anything is live; a probe that shells out
|
|
14
|
+
* must never sit in that path. One process-local sampler owns the cadence and
|
|
15
|
+
* the route only reads the latest snapshot.
|
|
16
|
+
* - **The sampler only runs while somebody is watching.** Every monitor request
|
|
17
|
+
* touches it; after a minute with no reader it stops, so an idle gateway pays
|
|
18
|
+
* nothing for a page nobody has open (the same reasoning that stops the
|
|
19
|
+
* board's own polling when nothing runs).
|
|
20
|
+
*
|
|
21
|
+
* VRAM is the expensive reading: on Windows every `nvidia-smi` is a process
|
|
22
|
+
* creation, so it is sampled on a slower beat than RAM/CPU. RAM and CPU come
|
|
23
|
+
* from `os` and cost nothing.
|
|
24
|
+
*/
|
|
25
|
+
import { execFile } from 'node:child_process';
|
|
26
|
+
import os from 'node:os';
|
|
27
|
+
/** How often RAM/CPU are re-read. Matches the board's live poll so a reading is
|
|
28
|
+
* never older than one refresh. */
|
|
29
|
+
export const MACHINE_TICK_MS = 2_000;
|
|
30
|
+
/** VRAM rides every Nth tick — a subprocess per probe, not a syscall. */
|
|
31
|
+
export const MACHINE_VRAM_EVERY = 3;
|
|
32
|
+
/** No reader for this long and the sampler stops. */
|
|
33
|
+
export const MACHINE_IDLE_STOP_MS = 60_000;
|
|
34
|
+
let testDeps = null;
|
|
35
|
+
/** Test seam: swap the OS readers and the GPU probe. */
|
|
36
|
+
export function setMachineStatsDepsForTests(deps) {
|
|
37
|
+
testDeps = deps;
|
|
38
|
+
stopSampler();
|
|
39
|
+
snapshot = null;
|
|
40
|
+
lastCpu = null;
|
|
41
|
+
lastTouch = 0;
|
|
42
|
+
tickCount = 0;
|
|
43
|
+
vramProbed = false;
|
|
44
|
+
vramMisses = 0;
|
|
45
|
+
probing = false;
|
|
46
|
+
procsUnusableProbes = 0;
|
|
47
|
+
procsProbeSeq = 0;
|
|
48
|
+
lastProcs = [];
|
|
49
|
+
}
|
|
50
|
+
function now(deps) {
|
|
51
|
+
return deps?.now?.() ?? Date.now();
|
|
52
|
+
}
|
|
53
|
+
function cpus(deps) {
|
|
54
|
+
return deps?.cpus?.() ?? os.cpus();
|
|
55
|
+
}
|
|
56
|
+
let snapshot = null;
|
|
57
|
+
let lastCpu = null;
|
|
58
|
+
let timer = null;
|
|
59
|
+
let lastTouch = 0;
|
|
60
|
+
let tickCount = 0;
|
|
61
|
+
let vramProbed = false;
|
|
62
|
+
/** True while a probe is in flight, so a slow `nvidia-smi` never overlaps. */
|
|
63
|
+
let probing = false;
|
|
64
|
+
/** Consecutive probes with no answer. A box without `nvidia-smi` must not pay
|
|
65
|
+
* a failing subprocess every six seconds for the whole time the page is open,
|
|
66
|
+
* so after a few misses the probe drops to a minute beat. */
|
|
67
|
+
let vramMisses = 0;
|
|
68
|
+
/** Probe cadence in ticks: every `MACHINE_VRAM_EVERY` while a GPU answers,
|
|
69
|
+
* every 30 ticks (a minute) once several probes have come back empty. */
|
|
70
|
+
function vramEveryTicks() {
|
|
71
|
+
return vramMisses >= 3 ? 30 : MACHINE_VRAM_EVERY;
|
|
72
|
+
}
|
|
73
|
+
function sumTimes(times) {
|
|
74
|
+
const busy = times.user + times.nice + times.sys + times.irq;
|
|
75
|
+
return { busy, total: busy + times.idle };
|
|
76
|
+
}
|
|
77
|
+
/** Busy share between two `os.cpus()` reads. A first read has no predecessor,
|
|
78
|
+
* so it falls back to the cumulative-since-boot average — a real number that
|
|
79
|
+
* is replaced by the true instant reading one tick later. */
|
|
80
|
+
function cpuUsage(current, previous) {
|
|
81
|
+
let busy = 0;
|
|
82
|
+
let total = 0;
|
|
83
|
+
const length = Math.min(current.length, previous?.length ?? current.length);
|
|
84
|
+
for (let i = 0; i < length; i += 1) {
|
|
85
|
+
const cur = sumTimes(current[i].times);
|
|
86
|
+
const prev = previous ? sumTimes(previous[i].times) : { busy: 0, total: 0 };
|
|
87
|
+
busy += Math.max(0, cur.busy - prev.busy);
|
|
88
|
+
total += Math.max(0, cur.total - prev.total);
|
|
89
|
+
}
|
|
90
|
+
if (total <= 0)
|
|
91
|
+
return { pct: 0, busyCores: 0 };
|
|
92
|
+
const pct = Math.min(100, (busy / total) * 100);
|
|
93
|
+
return { pct, busyCores: (pct / 100) * current.length };
|
|
94
|
+
}
|
|
95
|
+
function runCapture(command, args, timeoutMs = 6000) {
|
|
96
|
+
return new Promise((resolve) => {
|
|
97
|
+
try {
|
|
98
|
+
execFile(command, args, { timeout: timeoutMs, windowsHide: true, encoding: 'utf8', maxBuffer: 1024 * 1024 }, (err, stdout) => {
|
|
99
|
+
resolve({ ok: !err, stdout: typeof stdout === 'string' ? stdout : '' });
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
resolve({ ok: false, stdout: '' });
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Read discrete VRAM from the NVIDIA driver. `nvidia-smi` is the only portable
|
|
109
|
+
* source for live VRAM on this platform pair; an AMD/Intel box answers nothing
|
|
110
|
+
* and the snapshot simply has no GPU half (the page says so rather than
|
|
111
|
+
* drawing an empty gauge).
|
|
112
|
+
*/
|
|
113
|
+
/** Consecutive probes whose process table answered with rows but no usable
|
|
114
|
+
* memory figure — the Windows WDDM shape (`pid, [N/A]`). After a few of those
|
|
115
|
+
* the query drops to a minute beat: it scans every process, and a driver that
|
|
116
|
+
* never attributes memory should not cost that scan every six seconds. A
|
|
117
|
+
* driver that starts attributing resets the gap immediately. */
|
|
118
|
+
let procsUnusableProbes = 0;
|
|
119
|
+
/** VRAM probe counter, so the process table can ride a slower multiple of it. */
|
|
120
|
+
let procsProbeSeq = 0;
|
|
121
|
+
/** Last attribution the driver actually gave, reused while the query is throttled. */
|
|
122
|
+
let lastProcs = [];
|
|
123
|
+
function procsProbeGap() {
|
|
124
|
+
return procsUnusableProbes >= 3 ? 10 : 1;
|
|
125
|
+
}
|
|
126
|
+
async function probeNvidia(nowMs) {
|
|
127
|
+
if (process.platform === 'darwin')
|
|
128
|
+
return null;
|
|
129
|
+
procsProbeSeq += 1;
|
|
130
|
+
const askForProcs = procsProbeSeq % procsProbeGap() === 0;
|
|
131
|
+
const [memory, procs] = await Promise.all([
|
|
132
|
+
runCapture('nvidia-smi', [
|
|
133
|
+
'--query-gpu=name,memory.used,memory.total,utilization.gpu,temperature.gpu',
|
|
134
|
+
'--format=csv,noheader,nounits',
|
|
135
|
+
]),
|
|
136
|
+
askForProcs
|
|
137
|
+
? runCapture('nvidia-smi', ['--query-compute-apps=pid,used_gpu_memory', '--format=csv,noheader,nounits'])
|
|
138
|
+
: Promise.resolve({ ok: false, stdout: '' }),
|
|
139
|
+
]);
|
|
140
|
+
if (!memory.ok || !memory.stdout.trim())
|
|
141
|
+
return null;
|
|
142
|
+
let usedBytes = 0;
|
|
143
|
+
let totalBytes = 0;
|
|
144
|
+
let utilSum = 0;
|
|
145
|
+
let utilCount = 0;
|
|
146
|
+
let temperatureC = null;
|
|
147
|
+
const gpus = [];
|
|
148
|
+
for (const line of memory.stdout.split('\n')) {
|
|
149
|
+
const parts = line.split(',').map((part) => part.trim());
|
|
150
|
+
if (parts.length < 3)
|
|
151
|
+
continue;
|
|
152
|
+
const [name, usedRaw, totalRaw, utilRaw, tempRaw] = parts;
|
|
153
|
+
const used = Number(usedRaw);
|
|
154
|
+
const total = Number(totalRaw);
|
|
155
|
+
if (!Number.isFinite(total) || total <= 0)
|
|
156
|
+
continue;
|
|
157
|
+
// A total with no readable `used` is a reading that could not be taken; a 0
|
|
158
|
+
// there draws "the card is empty", the most misleading answer possible
|
|
159
|
+
// (ADR-0046: null, never 0), so the card is skipped exactly like one the
|
|
160
|
+
// driver hid.
|
|
161
|
+
if (!Number.isFinite(used) || used < 0)
|
|
162
|
+
continue;
|
|
163
|
+
gpus.push(name ?? 'GPU');
|
|
164
|
+
usedBytes += used;
|
|
165
|
+
totalBytes += total;
|
|
166
|
+
const util = Number(utilRaw);
|
|
167
|
+
if (Number.isFinite(util) && util >= 0) {
|
|
168
|
+
utilSum += util;
|
|
169
|
+
utilCount += 1;
|
|
170
|
+
}
|
|
171
|
+
const temp = Number(tempRaw);
|
|
172
|
+
if (Number.isFinite(temp) && temp > 0)
|
|
173
|
+
temperatureC = Math.max(temperatureC ?? 0, temp);
|
|
174
|
+
}
|
|
175
|
+
if (totalBytes <= 0)
|
|
176
|
+
return null;
|
|
177
|
+
// A skipped query reuses the previous attribution rather than reporting an
|
|
178
|
+
// empty card — the throttle is about cost, not about the reading.
|
|
179
|
+
let byPid = askForProcs ? [] : lastProcs;
|
|
180
|
+
if (askForProcs && procs.ok) {
|
|
181
|
+
let rows = 0;
|
|
182
|
+
for (const line of procs.stdout.split('\n')) {
|
|
183
|
+
if (!line.trim())
|
|
184
|
+
continue;
|
|
185
|
+
rows += 1;
|
|
186
|
+
const [pidRaw, usedRaw] = line.split(',').map((part) => part.trim());
|
|
187
|
+
const pid = Number(pidRaw);
|
|
188
|
+
const used = Number(usedRaw);
|
|
189
|
+
// The driver prints "[N/A]" for unreadable rows and a sentence when no
|
|
190
|
+
// process is attached; both fail the numeric check.
|
|
191
|
+
if (!Number.isFinite(pid) || pid <= 0 || !Number.isFinite(used) || used <= 0)
|
|
192
|
+
continue;
|
|
193
|
+
byPid.push({ pid, usedBytes: used * 1_048_576 });
|
|
194
|
+
}
|
|
195
|
+
// Rows but no figures is a driver limitation, not an idle card; an empty
|
|
196
|
+
// table (no processes) clears the count so attribution resumes the moment a
|
|
197
|
+
// run claims the card.
|
|
198
|
+
procsUnusableProbes = rows > 0 && byPid.length === 0 ? procsUnusableProbes + 1 : 0;
|
|
199
|
+
lastProcs = byPid;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
usedBytes: usedBytes * 1_048_576,
|
|
203
|
+
totalBytes: totalBytes * 1_048_576,
|
|
204
|
+
utilizationPct: utilCount > 0 ? utilSum / utilCount : null,
|
|
205
|
+
temperatureC,
|
|
206
|
+
gpus,
|
|
207
|
+
procs: byPid,
|
|
208
|
+
at: nowMs,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function takeTick() {
|
|
212
|
+
const deps = testDeps ?? undefined;
|
|
213
|
+
const at = now(deps);
|
|
214
|
+
const current = cpus(deps);
|
|
215
|
+
const usage = cpuUsage(current, lastCpu);
|
|
216
|
+
lastCpu = current;
|
|
217
|
+
const totalmem = deps?.totalmem ?? os.totalmem;
|
|
218
|
+
const freemem = deps?.freemem ?? os.freemem;
|
|
219
|
+
const ramTotalBytes = totalmem();
|
|
220
|
+
const ramUsedBytes = Math.max(0, ramTotalBytes - freemem());
|
|
221
|
+
const previousVram = snapshot?.vram ?? null;
|
|
222
|
+
snapshot = {
|
|
223
|
+
sampledAt: at,
|
|
224
|
+
platform: process.platform,
|
|
225
|
+
arch: process.arch,
|
|
226
|
+
cpuModel: current[0]?.model?.trim() || '',
|
|
227
|
+
cores: current.length,
|
|
228
|
+
cpuBusyCores: usage.busyCores,
|
|
229
|
+
cpuPct: usage.pct,
|
|
230
|
+
ramTotalBytes,
|
|
231
|
+
ramUsedBytes,
|
|
232
|
+
vram: previousVram,
|
|
233
|
+
vramProbed,
|
|
234
|
+
};
|
|
235
|
+
if (tickCount % vramEveryTicks() === 0 && !probing) {
|
|
236
|
+
probing = true;
|
|
237
|
+
const probe = deps?.probeVram ?? ((ms) => probeNvidia(ms));
|
|
238
|
+
void probe(at)
|
|
239
|
+
.then((vram) => {
|
|
240
|
+
vramProbed = true;
|
|
241
|
+
vramMisses = vram ? 0 : vramMisses + 1;
|
|
242
|
+
const latest = snapshot;
|
|
243
|
+
if (latest) {
|
|
244
|
+
latest.vramProbed = true;
|
|
245
|
+
// A failed probe keeps the last good reading: a transient driver
|
|
246
|
+
// hiccup is not evidence that the card vanished, and `vram.at` tells
|
|
247
|
+
// the page how old it is.
|
|
248
|
+
if (vram)
|
|
249
|
+
latest.vram = vram;
|
|
250
|
+
}
|
|
251
|
+
})
|
|
252
|
+
.catch(() => {
|
|
253
|
+
vramProbed = true;
|
|
254
|
+
vramMisses += 1;
|
|
255
|
+
if (snapshot)
|
|
256
|
+
snapshot.vramProbed = true;
|
|
257
|
+
})
|
|
258
|
+
.finally(() => {
|
|
259
|
+
probing = false;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
tickCount += 1;
|
|
263
|
+
}
|
|
264
|
+
function stopSampler() {
|
|
265
|
+
if (timer) {
|
|
266
|
+
clearInterval(timer);
|
|
267
|
+
timer = null;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function startSampler(at) {
|
|
271
|
+
lastTouch = at;
|
|
272
|
+
if (timer)
|
|
273
|
+
return;
|
|
274
|
+
takeTick();
|
|
275
|
+
timer = setInterval(() => {
|
|
276
|
+
const tickAt = now(testDeps ?? undefined);
|
|
277
|
+
if (tickAt - lastTouch > MACHINE_IDLE_STOP_MS) {
|
|
278
|
+
stopSampler();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
takeTick();
|
|
282
|
+
}, MACHINE_TICK_MS);
|
|
283
|
+
// Never hold the process open: the sampler is a console convenience, not
|
|
284
|
+
// part of the gateway's lifecycle.
|
|
285
|
+
timer.unref?.();
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Mark a reader as present and make sure the sampler is running. Call this from
|
|
289
|
+
* the monitor route — that request is the only reason the sampler exists.
|
|
290
|
+
*/
|
|
291
|
+
export function touchMachineSampler() {
|
|
292
|
+
const at = now(testDeps ?? undefined);
|
|
293
|
+
if (!timer) {
|
|
294
|
+
startSampler(at);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
lastTouch = at;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The latest reading. Synchronously takes one if none exists yet, so the first
|
|
301
|
+
* paint already has RAM/CPU; the GPU half lands on the next poll.
|
|
302
|
+
*/
|
|
303
|
+
export function machineSnapshot() {
|
|
304
|
+
if (!snapshot) {
|
|
305
|
+
if (!timer)
|
|
306
|
+
lastTouch = now(testDeps ?? undefined);
|
|
307
|
+
takeTick();
|
|
308
|
+
}
|
|
309
|
+
return snapshot;
|
|
310
|
+
}
|
|
311
|
+
/** Take a reading now (tests and any future caller that wants an immediate
|
|
312
|
+
* sample). The CPU/RAM half is synchronous; the GPU half resolves on a later
|
|
313
|
+
* turn, exactly as it does on the sampler's own beat. */
|
|
314
|
+
export function sampleMachineNow() {
|
|
315
|
+
takeTick();
|
|
316
|
+
return snapshot;
|
|
317
|
+
}
|
|
318
|
+
/** Drop the snapshot and stop sampling. Used by tests; production stops itself
|
|
319
|
+
* through the idle window (`MACHINE_IDLE_STOP_MS`) when the console closes. */
|
|
320
|
+
export function stopMachineSampler() {
|
|
321
|
+
stopSampler();
|
|
322
|
+
snapshot = null;
|
|
323
|
+
lastCpu = null;
|
|
324
|
+
lastTouch = 0;
|
|
325
|
+
tickCount = 0;
|
|
326
|
+
vramProbed = false;
|
|
327
|
+
vramMisses = 0;
|
|
328
|
+
probing = false;
|
|
329
|
+
procsUnusableProbes = 0;
|
|
330
|
+
procsProbeSeq = 0;
|
|
331
|
+
lastProcs = [];
|
|
332
|
+
}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import type { EngineServeVerdict } from './engine-runtime.js';
|
|
2
|
+
import { type DraftMatch } from './draft-match.js';
|
|
3
|
+
import { type StrataProfile } from './strata.js';
|
|
4
|
+
/** Header facts cached on a model record after the first GGUF scan (the
|
|
5
|
+
* engine badges and the run planner read these without re-parsing). */
|
|
6
|
+
export interface InstalledModelMeta {
|
|
7
|
+
/** When the header was read (ms epoch). */
|
|
8
|
+
at: number;
|
|
9
|
+
arch?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
layers?: number;
|
|
12
|
+
maxCtx?: number;
|
|
13
|
+
experts?: number;
|
|
14
|
+
expertsUsed?: number;
|
|
15
|
+
/** Attention geometry for the KV estimate (heads/kvHeads/headDim). */
|
|
16
|
+
heads?: number;
|
|
17
|
+
kvHeads?: number;
|
|
18
|
+
headDim?: number;
|
|
19
|
+
embedding?: number;
|
|
20
|
+
/** Engines that can serve the file through the runner (ADR-0045). */
|
|
21
|
+
runnable: string[];
|
|
22
|
+
moe: boolean;
|
|
23
|
+
/** Per-engine verdicts (serves / family / needsSetup / reason), so the
|
|
24
|
+
* console can explain a blocked engine without hardcoding its id. */
|
|
25
|
+
engines?: Record<string, EngineServeVerdict>;
|
|
26
|
+
/** Header-scan generation. Bumped whenever a gate's ANSWER can change for an
|
|
27
|
+
* unchanged file (a new engine, a widened family list, a new verdict field),
|
|
28
|
+
* so cached rows re-derive once instead of showing a stale "unsupported". */
|
|
29
|
+
scanVersion?: number;
|
|
30
|
+
/** @deprecated ADR-0045: read `engines[id].family`. Only records cached
|
|
31
|
+
* before the migration carry it; it is never written anew. */
|
|
32
|
+
strataFamily?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface InstalledModel {
|
|
35
|
+
/** Registry key: `<repo>/<filename>` — unique, and the delete route's id. */
|
|
36
|
+
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* Operator-chosen short name (ADR-0044 §7). When set, the model's gateway
|
|
39
|
+
* registration id is `local/<name>` instead of `local/<repo>/<filename>`,
|
|
40
|
+
* and it is the name the launched server answers as (`servedNameFor`).
|
|
41
|
+
* Optional: an unset name keeps the registry-id spelling. The registry key
|
|
42
|
+
* above never changes — runs, profiles and the file on disk stay anchored
|
|
43
|
+
* to it, so a rename touches only the gateway-visible id.
|
|
44
|
+
*/
|
|
45
|
+
name?: string;
|
|
46
|
+
repo: string;
|
|
47
|
+
filename: string;
|
|
48
|
+
/**
|
|
49
|
+
* Operator enable/disable switch. A disabled model is a registry row, not a
|
|
50
|
+
* routable address: it stays installed on disk (downloads and storage are
|
|
51
|
+
* untouched) but it is excluded from the `local` provider's registrations
|
|
52
|
+
* (`localModelRegistrations`), so `/v1/models` omits it, no client request
|
|
53
|
+
* can reach it, and the run page does not offer it. `false` means disabled —
|
|
54
|
+
* the field is absent by default because an older build reading an entry
|
|
55
|
+
* written before this feature must treat the model as enabled. Re-enabling
|
|
56
|
+
* restores the registration through the same pool refresh as a rename.
|
|
57
|
+
*/
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
/** Absolute path of the stored file. */
|
|
60
|
+
filePath: string;
|
|
61
|
+
/**
|
|
62
|
+
* EVERY file this install wrote, relative to the models root — shard
|
|
63
|
+
* siblings, a ready-made pack's `pack/*.bin`, its PLE table and embedding.
|
|
64
|
+
* `filePath` alone is the LAUNCH anchor, so deleting a row by it left the
|
|
65
|
+
* rest on disk: a removed NVFP4 size reclaimed 6 GB of 128 GB. Absent on rows
|
|
66
|
+
* written before this field (and on imports, whose files are the operator's),
|
|
67
|
+
* where removal falls back to the anchor alone.
|
|
68
|
+
*/
|
|
69
|
+
files?: string[];
|
|
70
|
+
size: number;
|
|
71
|
+
quant?: string;
|
|
72
|
+
paramsB?: number;
|
|
73
|
+
/** Bytes an interrupted earlier attempt had already fetched. */
|
|
74
|
+
resumedFrom?: number;
|
|
75
|
+
downloadedAt: number;
|
|
76
|
+
meta?: InstalledModelMeta;
|
|
77
|
+
/** Drafters this file can run, filled on import, download, and Detect. */
|
|
78
|
+
draftMatch?: DraftMatch;
|
|
79
|
+
/**
|
|
80
|
+
* Operator-supplied launch profiles, keyed by engine id (ADR-0045 — the
|
|
81
|
+
* generalised form of ADR-0044 §4). A profile lives on the RECORD, not in a
|
|
82
|
+
* global setting, because its inputs are per-model build artifacts: the
|
|
83
|
+
* profile is exactly as portable as the model it describes. Presence is what
|
|
84
|
+
* lets that engine claim the file as runnable.
|
|
85
|
+
*/
|
|
86
|
+
profiles?: Record<string, unknown>;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Single-engine spelling kept for records written before
|
|
89
|
+
* ADR-0045. Always read profiles through `profilesOf`/`profileFor`; the next
|
|
90
|
+
* write migrates the value into `profiles`.
|
|
91
|
+
*/
|
|
92
|
+
strata?: StrataProfile;
|
|
93
|
+
}
|
|
94
|
+
export declare function modelsRoot(): string;
|
|
95
|
+
export declare function readInstalledModels(): Record<string, InstalledModel>;
|
|
96
|
+
/**
|
|
97
|
+
* Every stored profile for one model, legacy fields folded in. The single
|
|
98
|
+
* read path: nothing outside this module should touch `record.strata`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function profilesOf(row: InstalledModel): Record<string, unknown>;
|
|
101
|
+
/** The stored profile of one engine, or undefined when unset. */
|
|
102
|
+
export declare function profileFor(row: InstalledModel, engineId: string): unknown;
|
|
103
|
+
/**
|
|
104
|
+
* Current header-scan generation; see `InstalledModelMeta.scanVersion`.
|
|
105
|
+
*
|
|
106
|
+
* 3: Strata's verdict stopped depending on a stored profile and started
|
|
107
|
+
* depending on whether its workspace resolves on disk (ADR-0045 §8). A cached
|
|
108
|
+
* row from generation 2 answers a question this build no longer asks, so it is
|
|
109
|
+
* re-derived once rather than leaving the console on a stale "needs setup".
|
|
110
|
+
*
|
|
111
|
+
* 4: verdicts gained `buildable` (ADR-0045 §9 — the missing pack is one the
|
|
112
|
+
* engine can build itself). A generation-3 row carries a pack refusal WITHOUT
|
|
113
|
+
* the flag, so the console would never offer the build action until the row
|
|
114
|
+
* was re-derived for another reason.
|
|
115
|
+
*
|
|
116
|
+
* 5: Strata's layout moved under the gateway home (ADR-0045 §13). A generation-4
|
|
117
|
+
* row can say `serves: true` because the model file sat inside a developer
|
|
118
|
+
* checkout the gateway no longer consults, and it never carries `buildable`
|
|
119
|
+
* for a model whose only gap is the pack under `<ocrHome>/strata/data`.
|
|
120
|
+
*
|
|
121
|
+
* Generation 5 is not a disk clock. A row scanned before the control bundle
|
|
122
|
+
* landed still says `serve/server.py` is missing after the file exists.
|
|
123
|
+
* `strataDiskStale` re-derives that row on the next list; an engine install
|
|
124
|
+
* rescans the registry outright (ADR-0045 §13).
|
|
125
|
+
*
|
|
126
|
+
* 6: a ready-made pack (NVFP4) became servable — its anchor is the DENSE half,
|
|
127
|
+
* so the generation-5 MoE-header gate refuses it — and the projector scan
|
|
128
|
+
* widened to the catalog download's `<owner>/<repo>` folders. A row cached
|
|
129
|
+
* under generation 5 carries a refusal (or a text-only launch) this build no
|
|
130
|
+
* longer gives.
|
|
131
|
+
*
|
|
132
|
+
* 7: a runnable model reports `preparable` (the draft layer it can still
|
|
133
|
+
* build). Generation 6 was written by builds that predate the flag, so their
|
|
134
|
+
* rows would never offer that build until something else re-derived them.
|
|
135
|
+
*/
|
|
136
|
+
export declare const META_SCAN_VERSION = 7;
|
|
137
|
+
/** Drop registry rows whose file vanished (manual cleanup keeps the list honest). */
|
|
138
|
+
export declare function listInstalledModels(): InstalledModel[];
|
|
139
|
+
/** Storage used by the models directory, best effort (the card footer). */
|
|
140
|
+
export declare function modelsDiskUsage(): number;
|
|
141
|
+
export type ModelDownloadStage = 'download' | 'finalize';
|
|
142
|
+
export type ModelDownloadEvent = {
|
|
143
|
+
type: 'stage';
|
|
144
|
+
stage: ModelDownloadStage;
|
|
145
|
+
asset: string;
|
|
146
|
+
} | {
|
|
147
|
+
type: 'download-start';
|
|
148
|
+
asset: string;
|
|
149
|
+
total: number;
|
|
150
|
+
} | {
|
|
151
|
+
type: 'progress';
|
|
152
|
+
asset: string;
|
|
153
|
+
downloaded: number;
|
|
154
|
+
total: number;
|
|
155
|
+
} | {
|
|
156
|
+
type: 'stage';
|
|
157
|
+
stage: 'finalize';
|
|
158
|
+
};
|
|
159
|
+
export interface DownloadModelOptions {
|
|
160
|
+
repo: string;
|
|
161
|
+
filename: string;
|
|
162
|
+
/** Pinned commit (`resolve/<sha>` instead of `resolve/main`). */
|
|
163
|
+
revision?: string;
|
|
164
|
+
/** Expected total size + digest from the tree API (drive the verifier). */
|
|
165
|
+
size?: number;
|
|
166
|
+
sha256?: string;
|
|
167
|
+
signal?: AbortSignal;
|
|
168
|
+
onEvent?: (event: ModelDownloadEvent) => void;
|
|
169
|
+
}
|
|
170
|
+
export type DownloadModelResult = {
|
|
171
|
+
ok: true;
|
|
172
|
+
installed: InstalledModel;
|
|
173
|
+
resumedFrom: number;
|
|
174
|
+
} | {
|
|
175
|
+
ok: false;
|
|
176
|
+
code: string;
|
|
177
|
+
error: string;
|
|
178
|
+
};
|
|
179
|
+
/** Re-pair every installed model with the drafters currently on disk. */
|
|
180
|
+
export declare function refreshDraftMatches(): InstalledModel[];
|
|
181
|
+
/**
|
|
182
|
+
* Download one repo file into the models tree and register it. Concurrent
|
|
183
|
+
* calls for the SAME destination serialise on the final path (two tabs must
|
|
184
|
+
* not interleave `.part` writes); different files download side by side.
|
|
185
|
+
*/
|
|
186
|
+
export declare function downloadHfModel(opts: DownloadModelOptions): Promise<DownloadModelResult>;
|
|
187
|
+
export interface DownloadModelGroupOptions {
|
|
188
|
+
repo: string;
|
|
189
|
+
/** Ordered shard parts, shard 1 first; each `{path, size?, sha256?}`. */
|
|
190
|
+
parts: Array<{
|
|
191
|
+
path: string;
|
|
192
|
+
size?: number;
|
|
193
|
+
sha256?: string;
|
|
194
|
+
}>;
|
|
195
|
+
/** Pinned commit (`resolve/<sha>` instead of `resolve/main`). */
|
|
196
|
+
revision?: string;
|
|
197
|
+
signal?: AbortSignal;
|
|
198
|
+
onEvent?: (event: ModelDownloadEvent) => void;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Download a split-weight group (…-00001-of-00002.gguf …) and register ONE
|
|
202
|
+
* model anchored at shard 1 — llama-server handed that path discovers the
|
|
203
|
+
* siblings itself. Shards fetch sequentially (one `.part` stream at a time);
|
|
204
|
+
* a mid-group failure keeps every staged part on disk, so the next attempt
|
|
205
|
+
* resumes each shard where it stopped. Progress reports cumulative bytes
|
|
206
|
+
* against the whole group.
|
|
207
|
+
*/
|
|
208
|
+
export declare function downloadHfModelGroup(opts: DownloadModelGroupOptions): Promise<DownloadModelResult>;
|
|
209
|
+
/**
|
|
210
|
+
* Bytes available on the volume holding `dir` (the nearest existing ancestor is
|
|
211
|
+
* measured for a directory that does not exist yet). `undefined` when the
|
|
212
|
+
* platform cannot answer — a missing reading must never refuse an install.
|
|
213
|
+
*/
|
|
214
|
+
export declare function freeDiskBytes(dir: string): number | undefined;
|
|
215
|
+
/** Disk headroom kept free beyond the bytes an install writes: a full volume
|
|
216
|
+
* makes every unrelated write (registry, logs, captures) fail too. */
|
|
217
|
+
export declare const INSTALL_DISK_MARGIN_BYTES: number;
|
|
218
|
+
/**
|
|
219
|
+
* Install one model from an engine's OWN catalog (ADR-0045 §5): every file the
|
|
220
|
+
* engine pinned, at the engine's commit, verified against the engine's digests,
|
|
221
|
+
* registered as ONE model anchored at shard 1. An engine catalog answers an
|
|
222
|
+
* exact file list, so this path does no tree lookup and no guesswork — what the
|
|
223
|
+
* engine would have downloaded is what lands here, and a mismatch fails the
|
|
224
|
+
* install instead of producing a model the engine would refuse.
|
|
225
|
+
*/
|
|
226
|
+
export interface CatalogModelDownloadOptions {
|
|
227
|
+
repo: string;
|
|
228
|
+
revision?: string;
|
|
229
|
+
/** The pinned files, shard 1 first. */
|
|
230
|
+
files: Array<{
|
|
231
|
+
path: string;
|
|
232
|
+
size?: number;
|
|
233
|
+
sha256?: string;
|
|
234
|
+
}>;
|
|
235
|
+
/** The file the registry row is anchored at (a ready-made pack anchors its
|
|
236
|
+
* dense GGUF; everything else anchors shard 1). Absent = the first file. */
|
|
237
|
+
anchor?: string;
|
|
238
|
+
/** The vision projector the engine pairs with the model, when it has one. */
|
|
239
|
+
mmproj?: {
|
|
240
|
+
path: string;
|
|
241
|
+
size?: number;
|
|
242
|
+
sha256?: string;
|
|
243
|
+
};
|
|
244
|
+
signal?: AbortSignal;
|
|
245
|
+
onEvent?: (event: ModelDownloadEvent) => void;
|
|
246
|
+
}
|
|
247
|
+
export declare function downloadCatalogModel(opts: CatalogModelDownloadOptions): Promise<DownloadModelResult>;
|
|
248
|
+
/**
|
|
249
|
+
* Set (or, with `null`, clear) one model's launch profile for one engine.
|
|
250
|
+
*
|
|
251
|
+
* The shape is the ENGINE's: normalization comes from its runtime, so this
|
|
252
|
+
* function never learns a field name. The meta block is re-derived in the same
|
|
253
|
+
* write because `runnable` is a FUNCTION of the profiles (ADR-0045) — a profile
|
|
254
|
+
* change that did not refresh it would leave the console claiming an engine
|
|
255
|
+
* the runner would refuse.
|
|
256
|
+
*/
|
|
257
|
+
export declare function setEngineProfile(id: string, engineId: string, raw: unknown): {
|
|
258
|
+
ok: true;
|
|
259
|
+
model: InstalledModel;
|
|
260
|
+
} | {
|
|
261
|
+
ok: false;
|
|
262
|
+
code: string;
|
|
263
|
+
error: string;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* The shape of an operator-chosen model name (ADR-0044 §7): a single URL- and
|
|
267
|
+
* config-safe token — it becomes the tail of the gateway id (`local/<name>`),
|
|
268
|
+
* so slashes, whitespace and shell-ish characters are out. Starts with a
|
|
269
|
+
* letter or digit; 1-64 chars.
|
|
270
|
+
*/
|
|
271
|
+
export declare const MODEL_NAME_RE: RegExp;
|
|
272
|
+
/**
|
|
273
|
+
* Set (or, with an empty string / null, clear) one model's operator name.
|
|
274
|
+
*
|
|
275
|
+
* Uniqueness is case-insensitive across the registry: the name becomes a
|
|
276
|
+
* gateway-visible id tail, and two ids differing only by case would route
|
|
277
|
+
* differently per surface. The registry KEY (`<repo>/<file>`) never changes —
|
|
278
|
+
* a rename moves only the `local/<…>` spelling, so the caller is responsible
|
|
279
|
+
* for reporting which config references the old id orphaned (the route scans
|
|
280
|
+
* and warns; nothing is silently rewritten).
|
|
281
|
+
*/
|
|
282
|
+
export declare function setModelName(id: string, raw: unknown): {
|
|
283
|
+
ok: true;
|
|
284
|
+
model: InstalledModel;
|
|
285
|
+
previousName?: string;
|
|
286
|
+
} | {
|
|
287
|
+
ok: false;
|
|
288
|
+
code: string;
|
|
289
|
+
error: string;
|
|
290
|
+
};
|
|
291
|
+
/** Strata's profile writer — a named alias of the generic one (ADR-0044 §4). */
|
|
292
|
+
export declare function setStrataProfile(id: string, raw: unknown): {
|
|
293
|
+
ok: true;
|
|
294
|
+
model: InstalledModel;
|
|
295
|
+
} | {
|
|
296
|
+
ok: false;
|
|
297
|
+
code: string;
|
|
298
|
+
error: string;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Enable / disable one model (the console's status toggle). The registry key,
|
|
302
|
+
* profile and file on disk never change — `enabled: false` only retires the
|
|
303
|
+
* gateway-visible id until re-enabled, which is why a disabled model cannot be
|
|
304
|
+
* launched in the meantime.
|
|
305
|
+
*/
|
|
306
|
+
export declare function setModelEnabled(id: string, enabled: boolean): {
|
|
307
|
+
ok: true;
|
|
308
|
+
model: InstalledModel;
|
|
309
|
+
} | {
|
|
310
|
+
ok: false;
|
|
311
|
+
code: string;
|
|
312
|
+
error: string;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Re-derive and persist ONE record's meta block out of band. The verdicts are
|
|
316
|
+
* a function of the DISK (ADR-0045 §8), and an engine build (ADR-0045 §9) is
|
|
317
|
+
* exactly such a change: the pack it wrote flips `serves` without any profile
|
|
318
|
+
* or registry edit, and only a rescan lets the console see it.
|
|
319
|
+
*/
|
|
320
|
+
export declare function rescanModelMeta(id: string): void;
|
|
321
|
+
/** Re-derive every GGUF row. An engine install changes the disk the verdicts
|
|
322
|
+
* read (the control bundle, the binary) without touching the model files. */
|
|
323
|
+
export declare function rescanInstalledModels(): void;
|
|
324
|
+
/** Delete one model file and its registry row. */
|
|
325
|
+
export declare function removeHfModel(id: string): {
|
|
326
|
+
ok: boolean;
|
|
327
|
+
error?: string;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Repo marker for rows imported from the local disk. Such rows register the
|
|
331
|
+
* file where it lies (multi-GB weights are never copied) and deleting them
|
|
332
|
+
* only drops the registry entry.
|
|
333
|
+
*/
|
|
334
|
+
export declare const IMPORT_REPO = "local-import";
|
|
335
|
+
export interface ImportLocalResult {
|
|
336
|
+
imported: InstalledModel[];
|
|
337
|
+
skipped: number;
|
|
338
|
+
errors: string[];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Import .gguf files that already exist on this machine. `target` may be one
|
|
342
|
+
* file or a directory (walked up to depth 4, 200-file cap). Records point at
|
|
343
|
+
* the original paths — nothing is copied or moved. Split weights
|
|
344
|
+
* (`-00001-of-00002.gguf` …) collapse into ONE row anchored at the first
|
|
345
|
+
* shard, with the size of all shards combined.
|
|
346
|
+
*/
|
|
347
|
+
export declare function importLocalModels(target: string): ImportLocalResult;
|