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
|
@@ -3,7 +3,7 @@ import type { CoreClientId } from './reserved.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* The hooks this BUILD ships — one instance per client id.
|
|
5
5
|
*
|
|
6
|
-
* The whole
|
|
6
|
+
* The whole ingress-proxy family (Cursor, Qoder, JetBrains) is NOT here: those
|
|
7
7
|
* hooks ship INSIDE their gateway packages (`cursor-gateway`, `qoder-gateway`,
|
|
8
8
|
* `jetbrains-gateway`) as a `client-adapter` part, next to the gateway that
|
|
9
9
|
* answers the hosts they point at. Nothing in this file decides that a client
|
|
@@ -11,7 +11,7 @@ import { WorkBuddyClientAdapter } from './workbuddy.js';
|
|
|
11
11
|
/**
|
|
12
12
|
* The hooks this BUILD ships — one instance per client id.
|
|
13
13
|
*
|
|
14
|
-
* The whole
|
|
14
|
+
* The whole ingress-proxy family (Cursor, Qoder, JetBrains) is NOT here: those
|
|
15
15
|
* hooks ship INSIDE their gateway packages (`cursor-gateway`, `qoder-gateway`,
|
|
16
16
|
* `jetbrains-gateway`) as a `client-adapter` part, next to the gateway that
|
|
17
17
|
* answers the hosts they point at. Nothing in this file decides that a client
|
|
@@ -4,6 +4,14 @@ export declare class DshClientAdapter implements ClientAdapter {
|
|
|
4
4
|
name: "dsh";
|
|
5
5
|
hookKind: "config";
|
|
6
6
|
displayName: string;
|
|
7
|
+
/** `dsh --version`. A shim whose package was removed answers with a module
|
|
8
|
+
* error, NOT a "no such command" — the probe reports that as `unknown`, so a
|
|
9
|
+
* broken install is never rendered as "not installed". */
|
|
10
|
+
versionCmd: string[];
|
|
11
|
+
updateSource: {
|
|
12
|
+
readonly kind: "npm";
|
|
13
|
+
readonly package: "@deepseek-ai/dsh";
|
|
14
|
+
};
|
|
7
15
|
/**
|
|
8
16
|
* The profiles ROOT (not one file): every profile under it is a hook
|
|
9
17
|
* target. Public for test stubbing.
|
|
@@ -52,6 +52,11 @@ export class DshClientAdapter {
|
|
|
52
52
|
name = 'dsh';
|
|
53
53
|
hookKind = 'config';
|
|
54
54
|
displayName = 'DeepSeek Harness';
|
|
55
|
+
/** `dsh --version`. A shim whose package was removed answers with a module
|
|
56
|
+
* error, NOT a "no such command" — the probe reports that as `unknown`, so a
|
|
57
|
+
* broken install is never rendered as "not installed". */
|
|
58
|
+
versionCmd = ['dsh', '--version'];
|
|
59
|
+
updateSource = { kind: 'npm', package: '@deepseek-ai/dsh' };
|
|
55
60
|
/**
|
|
56
61
|
* The profiles ROOT (not one file): every profile under it is a hook
|
|
57
62
|
* target. Public for test stubbing.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ClientProfileMemoryEntry } from '../../config/types.js';
|
|
2
|
+
import type { ProviderRegistry } from '../../providers/registry.js';
|
|
3
|
+
export type FollowCatalogSyncReason = 'key' | 'pool';
|
|
4
|
+
export type FollowCatalogSyncRequest = {
|
|
5
|
+
reason: FollowCatalogSyncReason;
|
|
6
|
+
keyId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type FollowCatalogSyncError = {
|
|
9
|
+
target: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
};
|
|
12
|
+
export type FollowCatalogSyncRun = {
|
|
13
|
+
at: number;
|
|
14
|
+
reason: FollowCatalogSyncReason;
|
|
15
|
+
keyId?: string;
|
|
16
|
+
synced: number;
|
|
17
|
+
skipped: number;
|
|
18
|
+
failed: number;
|
|
19
|
+
errors: FollowCatalogSyncError[];
|
|
20
|
+
};
|
|
21
|
+
/** Per-target issue until a successful rewrite clears it (in-process; restart resets). */
|
|
22
|
+
export type FollowCatalogIssue = {
|
|
23
|
+
id: string;
|
|
24
|
+
kind: 'client' | 'gateway';
|
|
25
|
+
/** pending = waiting (usually ide_running); failed = hard error. */
|
|
26
|
+
status: 'pending' | 'failed';
|
|
27
|
+
reason: string;
|
|
28
|
+
apiKeyId?: string;
|
|
29
|
+
at: number;
|
|
30
|
+
};
|
|
31
|
+
export type FollowCatalogSyncState = {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
/** Ids still waiting (subset of issues with status pending). */
|
|
34
|
+
pending: string[];
|
|
35
|
+
/** Ids with a hard failure (subset of issues with status failed). */
|
|
36
|
+
failed: string[];
|
|
37
|
+
/** Full issue list for console cards / banner. */
|
|
38
|
+
issues: FollowCatalogIssue[];
|
|
39
|
+
lastRun?: FollowCatalogSyncRun;
|
|
40
|
+
};
|
|
41
|
+
export declare function setFollowCatalogSyncRegistry(registry: ProviderRegistry | undefined): void;
|
|
42
|
+
/** Resolve the kill switch: explicit false disables; absent → default ON. */
|
|
43
|
+
export declare function isFollowCatalogAutoResyncEnabled(): boolean;
|
|
44
|
+
export declare function getFollowCatalogSyncState(): FollowCatalogSyncState;
|
|
45
|
+
export declare function isFollowCatalogPending(clientOrPluginId: string): boolean;
|
|
46
|
+
/** Issue for a client name or its catalogPlugin id (card hint). */
|
|
47
|
+
export declare function getFollowCatalogIssue(clientOrPluginId: string): FollowCatalogIssue | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Schedule a sync pass. Key edits coalesce into a Set (multi-key → one pool
|
|
50
|
+
* pass so no earlier keyId is dropped); pool rebuilds share one 2s timer.
|
|
51
|
+
*/
|
|
52
|
+
export declare function requestFollowCatalogSync(req: FollowCatalogSyncRequest): void;
|
|
53
|
+
/** Retry every open issue (pending + failed). May pass acknowledgeRunning. */
|
|
54
|
+
export declare function retryFollowCatalogPending(opts?: {
|
|
55
|
+
acknowledgeRunning?: boolean;
|
|
56
|
+
}): Promise<FollowCatalogSyncRun>;
|
|
57
|
+
/** Persist modelMode / apiKeyId after a successful console setup (authoritative index). */
|
|
58
|
+
export declare function stampClientProfileMemory(clientName: string, patch: Partial<ClientProfileMemoryEntry>): void;
|
|
59
|
+
/** Drop follow index on teardown so unloaded clients are not auto-synced. */
|
|
60
|
+
export declare function clearClientProfileMemory(clientName: string): void;
|
|
61
|
+
/** Test helpers — reset in-process state between cases. */
|
|
62
|
+
export declare function _resetFollowCatalogSyncForTests(): void;
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Follow-catalog auto-resync — event-driven rewrite of follow-mode snapshots.
|
|
3
|
+
*
|
|
4
|
+
* Triggers (callers): API key `modelAccess` edits (`reason: 'key'`) and live
|
|
5
|
+
* model-pool rebuilds (`reason: 'pool'`). enabled / expiry / delete do not fire
|
|
6
|
+
* — they only affect auth. Debounced, not polled. Targets:
|
|
7
|
+
* - config hooks with clientProfileMemory.modelMode === 'follow' + hooked
|
|
8
|
+
* - gateway plugins with modelListMode === 'follow' + bound key
|
|
9
|
+
*
|
|
10
|
+
* Auto path never sets acknowledgeRunning — running clients land in `pending`.
|
|
11
|
+
* No background retry loop: debounce coalesces bursts; open issues wait for a
|
|
12
|
+
* manual POST .../retry (may acknowledgeRunning) or the next key/pool event.
|
|
13
|
+
* Auto-polling ide_running would write behind the operator's back; hard fails
|
|
14
|
+
* (api_key_unusable, adapter errors) do not heal by waiting.
|
|
15
|
+
* Not a profile write-through (ADR-0031): N targeted setups / plugin config writes.
|
|
16
|
+
*/
|
|
17
|
+
import { DEFAULT_AUTO_RESYNC_FOLLOW_CATALOGS, FOLLOW_CATALOG_KEY_DEBOUNCE_MS, FOLLOW_CATALOG_POOL_DEBOUNCE_MS, } from '../../config/defaults.js';
|
|
18
|
+
import { loadConfig, saveConfig } from '../../config/index.js';
|
|
19
|
+
import { isApiKeyUsable, listApiKeys } from '../../auth/api-keys.js';
|
|
20
|
+
import { allowedFollowLists, buildKeyModelsView } from '../../auth/key-models.js';
|
|
21
|
+
import { getClientAdapter, getAllClientAdapters, setupClient } from './index.js';
|
|
22
|
+
let registryRef;
|
|
23
|
+
const fingerprints = new Map();
|
|
24
|
+
/** In-process until success — drives card/banner hints (cleared on restart). */
|
|
25
|
+
const issues = new Map();
|
|
26
|
+
let lastRun;
|
|
27
|
+
let keyTimer;
|
|
28
|
+
let poolTimer;
|
|
29
|
+
/** Coalesce concurrent key edits — a single keyId would drop earlier keys. */
|
|
30
|
+
const pendingKeyIds = new Set();
|
|
31
|
+
let inFlight;
|
|
32
|
+
export function setFollowCatalogSyncRegistry(registry) {
|
|
33
|
+
registryRef = registry;
|
|
34
|
+
}
|
|
35
|
+
/** Resolve the kill switch: explicit false disables; absent → default ON. */
|
|
36
|
+
export function isFollowCatalogAutoResyncEnabled() {
|
|
37
|
+
const v = loadConfig().autoResyncFollowCatalogs;
|
|
38
|
+
if (v === false)
|
|
39
|
+
return false;
|
|
40
|
+
if (v === true)
|
|
41
|
+
return true;
|
|
42
|
+
return DEFAULT_AUTO_RESYNC_FOLLOW_CATALOGS;
|
|
43
|
+
}
|
|
44
|
+
function fingerprintOf(ids) {
|
|
45
|
+
return [...ids].sort().join('\n');
|
|
46
|
+
}
|
|
47
|
+
function issueKey(kind, id) {
|
|
48
|
+
return `${kind}:${id}`;
|
|
49
|
+
}
|
|
50
|
+
function noteIssue(kind, id, status, reason, apiKeyId) {
|
|
51
|
+
issues.set(issueKey(kind, id), {
|
|
52
|
+
id,
|
|
53
|
+
kind,
|
|
54
|
+
status,
|
|
55
|
+
reason,
|
|
56
|
+
...(apiKeyId ? { apiKeyId } : {}),
|
|
57
|
+
at: Date.now(),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function clearIssue(kind, id) {
|
|
61
|
+
issues.delete(issueKey(kind, id));
|
|
62
|
+
}
|
|
63
|
+
export function getFollowCatalogSyncState() {
|
|
64
|
+
const all = [...issues.values()];
|
|
65
|
+
return {
|
|
66
|
+
enabled: isFollowCatalogAutoResyncEnabled(),
|
|
67
|
+
pending: all.filter((i) => i.status === 'pending').map((i) => i.id),
|
|
68
|
+
failed: all.filter((i) => i.status === 'failed').map((i) => i.id),
|
|
69
|
+
issues: all,
|
|
70
|
+
...(lastRun ? { lastRun } : {}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function isFollowCatalogPending(clientOrPluginId) {
|
|
74
|
+
const c = issues.get(issueKey('client', clientOrPluginId));
|
|
75
|
+
const g = issues.get(issueKey('gateway', clientOrPluginId));
|
|
76
|
+
return c?.status === 'pending' || g?.status === 'pending';
|
|
77
|
+
}
|
|
78
|
+
/** Issue for a client name or its catalogPlugin id (card hint). */
|
|
79
|
+
export function getFollowCatalogIssue(clientOrPluginId) {
|
|
80
|
+
return (issues.get(issueKey('client', clientOrPluginId)) ||
|
|
81
|
+
issues.get(issueKey('gateway', clientOrPluginId)));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Schedule a sync pass. Key edits coalesce into a Set (multi-key → one pool
|
|
85
|
+
* pass so no earlier keyId is dropped); pool rebuilds share one 2s timer.
|
|
86
|
+
*/
|
|
87
|
+
export function requestFollowCatalogSync(req) {
|
|
88
|
+
if (!isFollowCatalogAutoResyncEnabled())
|
|
89
|
+
return;
|
|
90
|
+
if (req.reason === 'key') {
|
|
91
|
+
if (req.keyId)
|
|
92
|
+
pendingKeyIds.add(req.keyId);
|
|
93
|
+
if (keyTimer)
|
|
94
|
+
clearTimeout(keyTimer);
|
|
95
|
+
keyTimer = setTimeout(() => {
|
|
96
|
+
keyTimer = undefined;
|
|
97
|
+
const ids = [...pendingKeyIds];
|
|
98
|
+
pendingKeyIds.clear();
|
|
99
|
+
if (ids.length === 0) {
|
|
100
|
+
void runFollowCatalogSync({ reason: 'pool' });
|
|
101
|
+
}
|
|
102
|
+
else if (ids.length === 1) {
|
|
103
|
+
void runFollowCatalogSync({ reason: 'key', keyId: ids[0] });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// Several keys changed inside the debounce window — one pool pass
|
|
107
|
+
// covers every follow target instead of dropping all but the last id.
|
|
108
|
+
void runFollowCatalogSync({ reason: 'pool' });
|
|
109
|
+
}
|
|
110
|
+
}, FOLLOW_CATALOG_KEY_DEBOUNCE_MS);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (poolTimer)
|
|
114
|
+
clearTimeout(poolTimer);
|
|
115
|
+
poolTimer = setTimeout(() => {
|
|
116
|
+
poolTimer = undefined;
|
|
117
|
+
void runFollowCatalogSync({ reason: 'pool' });
|
|
118
|
+
}, FOLLOW_CATALOG_POOL_DEBOUNCE_MS);
|
|
119
|
+
}
|
|
120
|
+
/** Retry every open issue (pending + failed). May pass acknowledgeRunning. */
|
|
121
|
+
export async function retryFollowCatalogPending(opts) {
|
|
122
|
+
const snapshot = [...issues.values()]
|
|
123
|
+
.filter((i) => !!i.apiKeyId)
|
|
124
|
+
.map((i) => ({ kind: i.kind, id: i.id, apiKeyId: i.apiKeyId }));
|
|
125
|
+
// Nothing open: an empty retry must NOT fall through to a full pool pass —
|
|
126
|
+
// that would re-setup every follow client and fabricate pending issues for
|
|
127
|
+
// running apps the operator never asked to touch. Answer an empty run.
|
|
128
|
+
if (issues.size === 0) {
|
|
129
|
+
return {
|
|
130
|
+
at: Date.now(),
|
|
131
|
+
reason: 'pool',
|
|
132
|
+
synced: 0,
|
|
133
|
+
skipped: 0,
|
|
134
|
+
failed: 0,
|
|
135
|
+
errors: [],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
// Issues without apiKeyId (rare) still need a rematch from memory/plugin —
|
|
139
|
+
// fall through to a full pool pass when the snapshot is empty but issues remain.
|
|
140
|
+
if (snapshot.length === 0) {
|
|
141
|
+
return runFollowCatalogSync({
|
|
142
|
+
reason: 'pool',
|
|
143
|
+
acknowledgeRunning: opts?.acknowledgeRunning === true,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return runFollowCatalogSync({
|
|
147
|
+
reason: 'pool',
|
|
148
|
+
onlyPending: snapshot,
|
|
149
|
+
acknowledgeRunning: opts?.acknowledgeRunning === true,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async function runFollowCatalogSync(opts) {
|
|
153
|
+
// Serialize runs so a key edit mid-pool-pass does not interleave writes.
|
|
154
|
+
const wait = inFlight ?? Promise.resolve();
|
|
155
|
+
let resolve;
|
|
156
|
+
inFlight = new Promise((r) => {
|
|
157
|
+
resolve = r;
|
|
158
|
+
});
|
|
159
|
+
await wait;
|
|
160
|
+
try {
|
|
161
|
+
return await runFollowCatalogSyncInner(opts);
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
resolve();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function runFollowCatalogSyncInner(opts) {
|
|
168
|
+
const run = {
|
|
169
|
+
at: Date.now(),
|
|
170
|
+
reason: opts.reason,
|
|
171
|
+
...(opts.keyId ? { keyId: opts.keyId } : {}),
|
|
172
|
+
synced: 0,
|
|
173
|
+
skipped: 0,
|
|
174
|
+
failed: 0,
|
|
175
|
+
errors: [],
|
|
176
|
+
};
|
|
177
|
+
if (!isFollowCatalogAutoResyncEnabled() && !opts.onlyPending) {
|
|
178
|
+
lastRun = run;
|
|
179
|
+
return run;
|
|
180
|
+
}
|
|
181
|
+
const registry = registryRef;
|
|
182
|
+
if (!registry) {
|
|
183
|
+
run.failed += 1;
|
|
184
|
+
run.errors.push({ target: '*', reason: 'registry_unavailable' });
|
|
185
|
+
lastRun = run;
|
|
186
|
+
return run;
|
|
187
|
+
}
|
|
188
|
+
if (opts.onlyPending && opts.onlyPending.length > 0) {
|
|
189
|
+
for (const entry of opts.onlyPending) {
|
|
190
|
+
if (entry.kind === 'client') {
|
|
191
|
+
await syncConfigClient(entry.id, entry.apiKeyId, registry, run, opts.acknowledgeRunning === true);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
await syncGatewayPlugin(entry.id, entry.apiKeyId, registry, run);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
lastRun = run;
|
|
198
|
+
return run;
|
|
199
|
+
}
|
|
200
|
+
const mem = loadConfig().clientProfileMemory || {};
|
|
201
|
+
for (const [name, entry] of Object.entries(mem)) {
|
|
202
|
+
if (entry?.modelMode !== 'follow' || !entry.apiKeyId)
|
|
203
|
+
continue;
|
|
204
|
+
if (opts.reason === 'key' && opts.keyId && entry.apiKeyId !== opts.keyId)
|
|
205
|
+
continue;
|
|
206
|
+
await syncConfigClient(name, entry.apiKeyId, registry, run, false);
|
|
207
|
+
}
|
|
208
|
+
await syncAllGatewayFollow(opts, registry, run);
|
|
209
|
+
lastRun = run;
|
|
210
|
+
return run;
|
|
211
|
+
}
|
|
212
|
+
async function syncConfigClient(name, apiKeyId, registry, run, acknowledgeRunning) {
|
|
213
|
+
// Checked here, not only in the caller's loop: a manual retry arrives from the
|
|
214
|
+
// issue map, which a leave-follow edit that bypassed the stamp never visited.
|
|
215
|
+
const memEntry = (loadConfig().clientProfileMemory || {})[name];
|
|
216
|
+
if (memEntry?.modelMode !== 'follow') {
|
|
217
|
+
clearIssue('client', name);
|
|
218
|
+
fingerprints.delete(issueKey('client', name));
|
|
219
|
+
run.skipped += 1;
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const adapter = getClientAdapter(name);
|
|
223
|
+
if (!adapter) {
|
|
224
|
+
run.skipped += 1;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
let status;
|
|
228
|
+
try {
|
|
229
|
+
status = await adapter.getStatus();
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
233
|
+
run.failed += 1;
|
|
234
|
+
run.errors.push({ target: name, reason });
|
|
235
|
+
noteIssue('client', name, 'failed', reason, apiKeyId);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (!status.hooked) {
|
|
239
|
+
clearIssue('client', name);
|
|
240
|
+
run.skipped += 1;
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const keys = listApiKeys(false);
|
|
244
|
+
const key = keys.find((k) => k.id === apiKeyId);
|
|
245
|
+
if (!key || !isApiKeyUsable(key)) {
|
|
246
|
+
run.failed += 1;
|
|
247
|
+
run.errors.push({ target: name, reason: 'api_key_unusable' });
|
|
248
|
+
noteIssue('client', name, 'failed', 'api_key_unusable', apiKeyId);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const view = buildKeyModelsView(apiKeyId, registry);
|
|
252
|
+
if (view.status === 'error') {
|
|
253
|
+
run.failed += 1;
|
|
254
|
+
run.errors.push({ target: name, reason: view.message });
|
|
255
|
+
noteIssue('client', name, 'failed', view.message, apiKeyId);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const { extraModels, virtualModels, allAllowedIds } = allowedFollowLists(view);
|
|
259
|
+
const fp = fingerprintOf(allAllowedIds);
|
|
260
|
+
if (fingerprints.get(issueKey('client', name)) === fp) {
|
|
261
|
+
clearIssue('client', name);
|
|
262
|
+
run.skipped += 1;
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
// Cold process: adapters usually echo concrete extras only — never stamp the
|
|
266
|
+
// full (extras+virtuals) fingerprint from an extras-only match, or virtual
|
|
267
|
+
// drift would be skipped forever after the first post-restart pass.
|
|
268
|
+
const result = await setupClient(name, {
|
|
269
|
+
apiKey: key.key,
|
|
270
|
+
extraModels,
|
|
271
|
+
virtualModels,
|
|
272
|
+
...(memEntry.models ? { models: memEntry.models } : {}),
|
|
273
|
+
...(memEntry.agentModels ? { agentModels: memEntry.agentModels } : {}),
|
|
274
|
+
...(typeof memEntry.contextWindow === 'number' && memEntry.contextWindow > 0
|
|
275
|
+
? { contextWindow: memEntry.contextWindow }
|
|
276
|
+
: {}),
|
|
277
|
+
...(acknowledgeRunning ? { acknowledgeRunning: true } : {}),
|
|
278
|
+
});
|
|
279
|
+
if (!result.success) {
|
|
280
|
+
if (result.reasonCode === 'ide_running') {
|
|
281
|
+
noteIssue('client', name, 'pending', 'ide_running', apiKeyId);
|
|
282
|
+
run.skipped += 1;
|
|
283
|
+
run.errors.push({ target: name, reason: 'ide_running' });
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const reason = result.reasonCode || result.message;
|
|
287
|
+
run.failed += 1;
|
|
288
|
+
run.errors.push({ target: name, reason });
|
|
289
|
+
noteIssue('client', name, 'failed', reason, apiKeyId);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
fingerprints.set(issueKey('client', name), fp);
|
|
293
|
+
clearIssue('client', name);
|
|
294
|
+
run.synced += 1;
|
|
295
|
+
}
|
|
296
|
+
async function syncAllGatewayFollow(opts, registry, run) {
|
|
297
|
+
const host = await import('../../plugins/host.js');
|
|
298
|
+
const installed = host.listInstalledPlugins();
|
|
299
|
+
const installedById = new Map(installed.map((v) => [v.id, v]));
|
|
300
|
+
for (const view of installed) {
|
|
301
|
+
if (view.disabled)
|
|
302
|
+
continue;
|
|
303
|
+
const cfg = host.getPluginConfig(view.id);
|
|
304
|
+
if (!cfg)
|
|
305
|
+
continue;
|
|
306
|
+
const mode = cfg.values.modelListMode;
|
|
307
|
+
if (mode !== 'follow')
|
|
308
|
+
continue;
|
|
309
|
+
const keyField = cfg.schema.find((f) => f.control === 'apiKey')?.key;
|
|
310
|
+
if (!keyField)
|
|
311
|
+
continue;
|
|
312
|
+
const bound = cfg.values[keyField];
|
|
313
|
+
if (typeof bound !== 'string' || !bound.trim())
|
|
314
|
+
continue;
|
|
315
|
+
if (opts.reason === 'key' && opts.keyId && bound !== opts.keyId)
|
|
316
|
+
continue;
|
|
317
|
+
await syncGatewayPlugin(view.id, bound, registry, run);
|
|
318
|
+
}
|
|
319
|
+
// Leave-follow / uninstall / disable: drop stale card issues. Do NOT use the
|
|
320
|
+
// key-scoped visit set — a key-only pass legitimately skips other gateways.
|
|
321
|
+
for (const issue of [...issues.values()]) {
|
|
322
|
+
if (issue.kind !== 'gateway')
|
|
323
|
+
continue;
|
|
324
|
+
const row = installedById.get(issue.id);
|
|
325
|
+
const cfg = host.getPluginConfig(issue.id);
|
|
326
|
+
const stillFollow = !!row && !row.disabled && !!cfg && cfg.values.modelListMode === 'follow';
|
|
327
|
+
if (!stillFollow) {
|
|
328
|
+
clearIssue('gateway', issue.id);
|
|
329
|
+
fingerprints.delete(issueKey('gateway', issue.id));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
async function syncGatewayPlugin(pluginId, apiKeyId, registry, run) {
|
|
334
|
+
const host = await import('../../plugins/host.js');
|
|
335
|
+
const cfg = host.getPluginConfig(pluginId);
|
|
336
|
+
if (!cfg) {
|
|
337
|
+
run.skipped += 1;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (cfg.values.modelListMode !== 'follow') {
|
|
341
|
+
clearIssue('gateway', pluginId);
|
|
342
|
+
run.skipped += 1;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const keys = listApiKeys(false);
|
|
346
|
+
const key = keys.find((k) => k.id === apiKeyId);
|
|
347
|
+
if (!key || !isApiKeyUsable(key)) {
|
|
348
|
+
run.failed += 1;
|
|
349
|
+
run.errors.push({ target: pluginId, reason: 'api_key_unusable' });
|
|
350
|
+
noteIssue('gateway', pluginId, 'failed', 'api_key_unusable', apiKeyId);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const view = buildKeyModelsView(apiKeyId, registry);
|
|
354
|
+
if (view.status === 'error') {
|
|
355
|
+
run.failed += 1;
|
|
356
|
+
run.errors.push({ target: pluginId, reason: view.message });
|
|
357
|
+
noteIssue('gateway', pluginId, 'failed', view.message, apiKeyId);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const models = view.models.filter((m) => m.allowed).map((m) => m.id);
|
|
361
|
+
const fp = fingerprintOf(models);
|
|
362
|
+
const current = Array.isArray(cfg.values.models)
|
|
363
|
+
? cfg.values.models.map((id) => String(id).replace(/^ocr\//, ''))
|
|
364
|
+
: [];
|
|
365
|
+
if (fingerprints.get(issueKey('gateway', pluginId)) === fp || fingerprintOf(current) === fp) {
|
|
366
|
+
fingerprints.set(issueKey('gateway', pluginId), fp);
|
|
367
|
+
clearIssue('gateway', pluginId);
|
|
368
|
+
run.skipped += 1;
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
await host.applyPluginConfig(pluginId, { ...cfg.values, models });
|
|
373
|
+
for (const adapter of getAllClientAdapters()) {
|
|
374
|
+
if (adapter.catalogPlugin !== pluginId || !adapter.refreshModelSurface)
|
|
375
|
+
continue;
|
|
376
|
+
try {
|
|
377
|
+
await adapter.refreshModelSurface();
|
|
378
|
+
}
|
|
379
|
+
catch (err) {
|
|
380
|
+
console.warn(`[follow-catalog] refreshModelSurface ${adapter.name}:`, err instanceof Error ? err.message : err);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
fingerprints.set(issueKey('gateway', pluginId), fp);
|
|
384
|
+
clearIssue('gateway', pluginId);
|
|
385
|
+
run.synced += 1;
|
|
386
|
+
}
|
|
387
|
+
catch (err) {
|
|
388
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
389
|
+
run.failed += 1;
|
|
390
|
+
run.errors.push({ target: pluginId, reason });
|
|
391
|
+
noteIssue('gateway', pluginId, 'failed', reason, apiKeyId);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/** Persist modelMode / apiKeyId after a successful console setup (authoritative index). */
|
|
395
|
+
export function stampClientProfileMemory(clientName, patch) {
|
|
396
|
+
const cfg = loadConfig();
|
|
397
|
+
const mem = { ...(cfg.clientProfileMemory || {}) };
|
|
398
|
+
const prev = mem[clientName] || {};
|
|
399
|
+
mem[clientName] = { ...prev, ...patch };
|
|
400
|
+
saveConfig({ clientProfileMemory: mem });
|
|
401
|
+
// Leave-follow: drop card issue + fingerprint so a prior pending/fail does not linger.
|
|
402
|
+
if (patch.modelMode !== undefined && patch.modelMode !== 'follow') {
|
|
403
|
+
clearIssue('client', clientName);
|
|
404
|
+
fingerprints.delete(issueKey('client', clientName));
|
|
405
|
+
}
|
|
406
|
+
else if (patch.modelMode === 'follow') {
|
|
407
|
+
// Fresh follow setup succeeded — clear any stale auto-sync residue.
|
|
408
|
+
clearIssue('client', clientName);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/** Drop follow index on teardown so unloaded clients are not auto-synced. */
|
|
412
|
+
export function clearClientProfileMemory(clientName) {
|
|
413
|
+
const cfg = loadConfig();
|
|
414
|
+
const mem = { ...(cfg.clientProfileMemory || {}) };
|
|
415
|
+
if (!(clientName in mem))
|
|
416
|
+
return;
|
|
417
|
+
delete mem[clientName];
|
|
418
|
+
saveConfig({ clientProfileMemory: mem });
|
|
419
|
+
clearIssue('client', clientName);
|
|
420
|
+
fingerprints.delete(issueKey('client', clientName));
|
|
421
|
+
}
|
|
422
|
+
/** Test helpers — reset in-process state between cases. */
|
|
423
|
+
export function _resetFollowCatalogSyncForTests() {
|
|
424
|
+
if (keyTimer)
|
|
425
|
+
clearTimeout(keyTimer);
|
|
426
|
+
if (poolTimer)
|
|
427
|
+
clearTimeout(poolTimer);
|
|
428
|
+
keyTimer = undefined;
|
|
429
|
+
poolTimer = undefined;
|
|
430
|
+
pendingKeyIds.clear();
|
|
431
|
+
fingerprints.clear();
|
|
432
|
+
issues.clear();
|
|
433
|
+
lastRun = undefined;
|
|
434
|
+
inFlight = undefined;
|
|
435
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ClientAdapter } from './base.js';
|
|
2
2
|
import { ClientHookStatus } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Hook target: Grok
|
|
4
|
+
* Hook target: Grok Build TUI (formerly the xAI Grok CLI). Grok reads
|
|
5
|
+
* `~/.grok/config.toml`; custom
|
|
5
6
|
* endpoints are `[model.<name>]` tables pointing at a `model_provider` (a
|
|
6
7
|
* `[model_providers.<id>]` block) or a direct `base_url`. We register ONE
|
|
7
8
|
* managed provider (`ocr`) on the gateway's OpenAI Chat Completions endpoint
|
|
@@ -15,6 +16,19 @@ export declare class GrokClientAdapter implements ClientAdapter {
|
|
|
15
16
|
name: "grok";
|
|
16
17
|
hookKind: "config";
|
|
17
18
|
displayName: string;
|
|
19
|
+
/** `grok --version` prints `grok 1.0.77 (50ca579fa996)` — the first token is
|
|
20
|
+
* the release, the hash in parentheses is a build id. */
|
|
21
|
+
versionCmd: string[];
|
|
22
|
+
/**
|
|
23
|
+
* xAI publishes the released CLI version as the first line of
|
|
24
|
+
* `https://x.ai/cli/stable` — the exact probe its own `install.sh` reads.
|
|
25
|
+
* The human download page is `https://x.ai/cli` (no `/stable`).
|
|
26
|
+
*/
|
|
27
|
+
updateSource: {
|
|
28
|
+
readonly kind: "endpoint";
|
|
29
|
+
readonly url: "https://x.ai/cli/stable";
|
|
30
|
+
readonly page: "https://x.ai/cli";
|
|
31
|
+
};
|
|
18
32
|
/** Provider table id this adapter owns inside `[model_providers]`. */
|
|
19
33
|
private static readonly PROVIDER_ID;
|
|
20
34
|
/** Catalog key of the main-slot entry inside `[model]`. */
|
|
@@ -6,7 +6,8 @@ import { createBackup, describeBackup, restoreBackup, defaultGatewayPort, OCR_WA
|
|
|
6
6
|
import { renameWithRetry } from '../../utils/atomic-write.js';
|
|
7
7
|
import { VIRTUAL_AUTO_IDS } from '../types.js';
|
|
8
8
|
/**
|
|
9
|
-
* Hook target: Grok
|
|
9
|
+
* Hook target: Grok Build TUI (formerly the xAI Grok CLI). Grok reads
|
|
10
|
+
* `~/.grok/config.toml`; custom
|
|
10
11
|
* endpoints are `[model.<name>]` tables pointing at a `model_provider` (a
|
|
11
12
|
* `[model_providers.<id>]` block) or a direct `base_url`. We register ONE
|
|
12
13
|
* managed provider (`ocr`) on the gateway's OpenAI Chat Completions endpoint
|
|
@@ -19,7 +20,20 @@ import { VIRTUAL_AUTO_IDS } from '../types.js';
|
|
|
19
20
|
export class GrokClientAdapter {
|
|
20
21
|
name = 'grok';
|
|
21
22
|
hookKind = 'config';
|
|
22
|
-
displayName = 'Grok CLI';
|
|
23
|
+
displayName = 'Grok Build CLI';
|
|
24
|
+
/** `grok --version` prints `grok 1.0.77 (50ca579fa996)` — the first token is
|
|
25
|
+
* the release, the hash in parentheses is a build id. */
|
|
26
|
+
versionCmd = ['grok', '--version'];
|
|
27
|
+
/**
|
|
28
|
+
* xAI publishes the released CLI version as the first line of
|
|
29
|
+
* `https://x.ai/cli/stable` — the exact probe its own `install.sh` reads.
|
|
30
|
+
* The human download page is `https://x.ai/cli` (no `/stable`).
|
|
31
|
+
*/
|
|
32
|
+
updateSource = {
|
|
33
|
+
kind: 'endpoint',
|
|
34
|
+
url: 'https://x.ai/cli/stable',
|
|
35
|
+
page: 'https://x.ai/cli',
|
|
36
|
+
};
|
|
23
37
|
/** Provider table id this adapter owns inside `[model_providers]`. */
|
|
24
38
|
static PROVIDER_ID = 'ocr';
|
|
25
39
|
/** Catalog key of the main-slot entry inside `[model]`. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientAdapter, ClientActionResult } from './base.js';
|
|
2
|
-
import { ClientHookStatus } from '../types.js';
|
|
2
|
+
import { ClientHookStatus, ClientUpdateInfo } from '../types.js';
|
|
3
3
|
export declare function ensurePluginClientAdapters(): Promise<void>;
|
|
4
4
|
/** Advisory texts (`manifest.warningLabels`) declared by the package that owns
|
|
5
5
|
* this hook; undefined for a core hook or an unloaded package. */
|
|
@@ -11,6 +11,18 @@ export declare function getAllClientAdapters(): ClientAdapter[];
|
|
|
11
11
|
export declare function getAllClientStatuses(options?: {
|
|
12
12
|
refresh?: boolean;
|
|
13
13
|
}): Promise<ClientHookStatus[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Drop the roster snapshot so the next read rebuilds it. The update checker
|
|
16
|
+
* fills its OWN cache, but the stamped rows only change when the roster is
|
|
17
|
+
* rebuilt — a manual check must not leave the console showing the old chips.
|
|
18
|
+
*/
|
|
19
|
+
export declare function invalidateRosterCache(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Force a fresh "is there a newer version" check for every hook that declares
|
|
22
|
+
* a source, and wait for the answers — the console's manual button. Hooked
|
|
23
|
+
* clients still go first; nothing here installs or upgrades anything.
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkClientUpdatesNow(): Promise<Record<string, ClientUpdateInfo>>;
|
|
14
26
|
/**
|
|
15
27
|
* Every passthrough launch verb any hook (core or package) publishes, in
|
|
16
28
|
* roster order. The CLI resolves `ocr <verb>` from here instead of importing a
|