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,677 @@
|
|
|
1
|
+
import { type SourceIndex, type SourceScanOutcome } from './source-index.js';
|
|
2
|
+
import type { PluginManifest } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The plugin MARKETPLACE (ADR-0037).
|
|
5
|
+
*
|
|
6
|
+
* A registry names GitHub repositories. This module is the ONE reader of that
|
|
7
|
+
* registry and the ONE fetcher of what a marketplace card shows: the
|
|
8
|
+
* repository's `plugin.json` (validated with the SAME validator the loader and
|
|
9
|
+
* the packager use, so a market row can never describe a package the host would
|
|
10
|
+
* refuse), its logo asset, and the installable package it publishes.
|
|
11
|
+
*
|
|
12
|
+
* Nothing here installs. It resolves, caches and reports; the console's install
|
|
13
|
+
* verb hands the resolved bytes to the SAME install path an upload takes
|
|
14
|
+
* (`installPluginPackage` + reload + rollback), so a market install and a
|
|
15
|
+
* hand-uploaded `.zip` cannot diverge.
|
|
16
|
+
*
|
|
17
|
+
* Caching is on disk, under the plugins root, because a marketplace card is
|
|
18
|
+
* re-read on every console visit while the upstream answer only moves over
|
|
19
|
+
* days. A failed fetch keeps the LAST GOOD answer and says how old it is — an
|
|
20
|
+
* offline gateway still shows the market it saw yesterday instead of an empty
|
|
21
|
+
* grid that reads as "there are no plugins".
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* How a package is obtained from its repository (ADR-0037 §4).
|
|
25
|
+
*
|
|
26
|
+
* - `release` — download the packaged zip the repository PUBLISHES (a release
|
|
27
|
+
* asset named `<manifest.id>.zip`). The default: nothing is built here, so
|
|
28
|
+
* an install cannot be held hostage by a toolchain on the gateway machine.
|
|
29
|
+
* - `code` — build from the repository SOURCE, the way `bun run plugins:build`
|
|
30
|
+
* does: shallow-clone at a ref (default branch for the latest version, a
|
|
31
|
+
* `v*` tag for an older one), install dependencies, run the shared packager
|
|
32
|
+
* (`bundlePluginDir`, ADR-0017 §6), and hand the resulting zip to the SAME
|
|
33
|
+
* install pipeline. This is the only method that can install a repository
|
|
34
|
+
* that publishes no release at all — at the cost of needing `git` and `bun`
|
|
35
|
+
* on the machine, which is exactly why it is opt-in per entry.
|
|
36
|
+
*/
|
|
37
|
+
export type PluginInstallMethod = 'code' | 'release';
|
|
38
|
+
/**
|
|
39
|
+
* One registry entry. A bare string is the shorthand for `{ repo }` — the
|
|
40
|
+
* spelling the operator writes in `registry.json`.
|
|
41
|
+
*/
|
|
42
|
+
export type PluginRegistryEntry = string | {
|
|
43
|
+
/** `owner/repo` on GitHub. */
|
|
44
|
+
repo: string;
|
|
45
|
+
/** Branch, tag or commit. Absent = the repository's default branch (`HEAD`). */
|
|
46
|
+
ref?: string;
|
|
47
|
+
/** Repo-relative directory holding `plugin.json` (a monorepo of plugins). */
|
|
48
|
+
subdir?: string;
|
|
49
|
+
/** Source build or published release; absent = `release`. */
|
|
50
|
+
method?: PluginInstallMethod;
|
|
51
|
+
};
|
|
52
|
+
/** A normalized entry: one repository, one plugin location, one method. */
|
|
53
|
+
export interface NormalizedRegistryEntry {
|
|
54
|
+
repo: string;
|
|
55
|
+
ref?: string;
|
|
56
|
+
subdir?: string;
|
|
57
|
+
/**
|
|
58
|
+
* How this entry installs.
|
|
59
|
+
*
|
|
60
|
+
* `release` / `code` — DECLARED by a registry entry, and taken literally: the
|
|
61
|
+
* operator wrote it down, so the market must not second-guess it.
|
|
62
|
+
*
|
|
63
|
+
* `auto` — a SCANNED entry, which nobody declared. A scan only learns that a
|
|
64
|
+
* repository carries a `plugin.json`; it cannot know whether the author also
|
|
65
|
+
* publishes a release zip without a second read. Hard-coding `code` there made
|
|
66
|
+
* a scanned plugin need git + bun even when a ready-made asset existed, and
|
|
67
|
+
* made one repository install differently depending on whether it came from
|
|
68
|
+
* the registry or a source. A scanned entry therefore resolves at CARD-READ
|
|
69
|
+
* time (`resolvePackage`): a published asset wins, `code` is the fallback.
|
|
70
|
+
*/
|
|
71
|
+
method: PluginInstallMethod | 'auto';
|
|
72
|
+
/** Which registry this entry came from — `official` is the committed list,
|
|
73
|
+
* `source` is what a scan found. */
|
|
74
|
+
origin?: RegistryOrigin;
|
|
75
|
+
/** For a `source` entry: the label (else target) of the source that found it.
|
|
76
|
+
* Rendered on the card so an operator sees WHICH source, not just "a source". */
|
|
77
|
+
originLabel?: string;
|
|
78
|
+
}
|
|
79
|
+
/** `official` = the committed/checked-in registry; `source` = discovered by
|
|
80
|
+
* scanning a configured source. There is no third category: a source may point
|
|
81
|
+
* at public or private repositories, and the product does not label that. */
|
|
82
|
+
export type RegistryOrigin = 'official' | 'source';
|
|
83
|
+
/** Where the market's registry came from, so the console can say it. */
|
|
84
|
+
export interface RegistrySource {
|
|
85
|
+
/** Absolute path of the file that was read. */
|
|
86
|
+
file: string;
|
|
87
|
+
/** `env` / `home` / `repo` — the precedence tier that answered. */
|
|
88
|
+
origin: 'env' | 'home' | 'repo';
|
|
89
|
+
}
|
|
90
|
+
/** Why the OFFICIAL half of the market could not be read. With scanned rows
|
|
91
|
+
* present this is advisory and rides beside them; with none it is fatal
|
|
92
|
+
* (ADR-0037 §9: the two halves are independent inputs). */
|
|
93
|
+
export interface RegistryProblem {
|
|
94
|
+
code: 'no-registry' | 'malformed-registry' | 'empty-registry' | 'egress-unavailable';
|
|
95
|
+
message: string;
|
|
96
|
+
/** Every path that was tried, in precedence order (empty for a transport problem). */
|
|
97
|
+
tried: string[];
|
|
98
|
+
}
|
|
99
|
+
/** Test seam: every upstream read goes through the resolved transport, so a
|
|
100
|
+
* market test is a stubbed fetch and never a network call. */
|
|
101
|
+
export interface MarketDeps {
|
|
102
|
+
fetchImpl?: typeof fetch;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `owner/repo`, from what an operator would reasonably paste. Full URLs, clone
|
|
106
|
+
* lines and `github:` prefixes are accepted; a path below the repo is NOT — a
|
|
107
|
+
* registry entry names a repository, and the directory inside it is `subdir`.
|
|
108
|
+
* This is the market's own narrow reader: the harness marketplace's parser
|
|
109
|
+
* tolerates deeper links because it also names an extension directory, and
|
|
110
|
+
* borrowing it here would silently accept a spelling this registry cannot use.
|
|
111
|
+
*/
|
|
112
|
+
export declare function normalizeRepo(value: string): string | undefined;
|
|
113
|
+
/** A registry entry as the market uses it, or undefined when unusable. */
|
|
114
|
+
export declare function normalizeEntry(raw: PluginRegistryEntry): NormalizedRegistryEntry | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Extract the `plugins` array out of a registry document.
|
|
117
|
+
*
|
|
118
|
+
* The registry is `registry.json` — in the checkout, in `<ocrHome>/plugins/`,
|
|
119
|
+
* and at whatever URL a remote pull reads — and it is DATA, never imported: the
|
|
120
|
+
* backend never reaches outside its own `rootDir`, and a packaged host has no
|
|
121
|
+
* checkout to load from. JSON5 does the parsing, so comments, single quotes and
|
|
122
|
+
* trailing commas are still fine; plain JSON is a subset of it.
|
|
123
|
+
*
|
|
124
|
+
* Three shapes are accepted, in order: a JSON object carrying `plugins`, an
|
|
125
|
+
* assigned array (`export const plugins = [ … ]`, or `export default [ … ]`),
|
|
126
|
+
* and a bare array. The ASSIGNMENT match is anchored to the start of a line so
|
|
127
|
+
* a sentence in the header comment can never be mistaken for it.
|
|
128
|
+
*
|
|
129
|
+
* The OBJECT branch parses the raw text, not the trimmed raw text: a `.json`
|
|
130
|
+
* file whose first line is a `//` header comment must still be recognized as a
|
|
131
|
+
* document, and stripping comments before this decision is what makes that
|
|
132
|
+
* work (`whole.startsWith('{')` on the raw text silently sent it down the TS
|
|
133
|
+
* path and threw "no `plugins` array found").
|
|
134
|
+
*/
|
|
135
|
+
export declare function parseRegistryText(text: string): PluginRegistryEntry[];
|
|
136
|
+
/** The registry file candidates, most specific first.
|
|
137
|
+
*
|
|
138
|
+
* The checkout tier is REPO-relative: this module sits at
|
|
139
|
+
* `<root>/backend/{src|dist}/plugins/`, so three levels up is the tree the
|
|
140
|
+
* registry is authored in. Inside a `bun build --compile` snapshot that walk
|
|
141
|
+
* lands on the virtual embedded FS (`B:\~BUN\root\…` on Windows) and names
|
|
142
|
+
* paths that cannot exist — two dead entries in the "tried" list that only
|
|
143
|
+
* teach the operator to hunt on a drive they do not own. A packaged host has
|
|
144
|
+
* no checkout by definition (ADR-0032: no release ships one), so the tier is
|
|
145
|
+
* omitted there and the list names exactly what was reachable.
|
|
146
|
+
*
|
|
147
|
+
* Every candidate is named `registry.json`: the checkout file, the OCR-home
|
|
148
|
+
* snapshot a remote pull writes, and the remote document itself are ONE format,
|
|
149
|
+
* so there is no second spelling for an operator to guess at. */
|
|
150
|
+
export declare function registryCandidates(opts?: {
|
|
151
|
+
packaged?: boolean;
|
|
152
|
+
}): string[];
|
|
153
|
+
/** How long one card's upstream answer is reused before the next read re-fetches
|
|
154
|
+
* it.
|
|
155
|
+
*
|
|
156
|
+
* TEN MINUTES was the first guess and it is too short for what the data is: a
|
|
157
|
+
* plugin's manifest, release assets and star count move over DAYS. Every cold
|
|
158
|
+
* console visit inside that window costs one GitHub round trip per card (eight
|
|
159
|
+
* cards = eight requests against a small anonymous budget), to learn nothing.
|
|
160
|
+
*
|
|
161
|
+
* THIRTY MINUTES keeps a stale-tolerance an operator can live with — a version
|
|
162
|
+
* published ten minutes ago is not something this page must know before they
|
|
163
|
+
* ask — while cutting the steady-state request rate to a third. The console's
|
|
164
|
+
* Refresh button still forces a re-read at any moment, and `stale` is reported
|
|
165
|
+
* when a re-read fails, so the answer is never silently old. */
|
|
166
|
+
export declare const MARKET_CACHE_TTL_MS: number;
|
|
167
|
+
/**
|
|
168
|
+
* Bump when a change to HOW a row is composed makes previously cached rows
|
|
169
|
+
* WRONG — not merely old.
|
|
170
|
+
*
|
|
171
|
+
* The first case, and the reason this exists: scanned entries used to hard-code
|
|
172
|
+
* `method: 'code'`, then learned to resolve `auto` → release-or-source. Every
|
|
173
|
+
* row cached before that change states a method the current rule would not
|
|
174
|
+
* produce, so it must be re-read instead of served.
|
|
175
|
+
*
|
|
176
|
+
* Contrast with a TTL-only change (30 → 60 minutes): that makes rows older, not
|
|
177
|
+
* wrong, so it bumps nothing.
|
|
178
|
+
*/
|
|
179
|
+
export declare const CACHE_RULE_VERSION = 2;
|
|
180
|
+
/** The logo MIME for a file name, or undefined when the format is not one the
|
|
181
|
+
* console renders. ONE table: the installed-plugin logo route serves the same
|
|
182
|
+
* formats and must answer the same types. */
|
|
183
|
+
export declare function logoMimeFor(filename: string): string | undefined;
|
|
184
|
+
/** Where a market read goes out. `direct` is the default: this console action
|
|
185
|
+
* is not model traffic, and silently borrowing the model-scoped provider split
|
|
186
|
+
* would route GitHub through the operator's egress proxy without them asking. */
|
|
187
|
+
export type MarketEgress = 'direct' | 'proxy';
|
|
188
|
+
/**
|
|
189
|
+
* The operator's market setting (`<ocrHome>/plugins/market.json`).
|
|
190
|
+
*
|
|
191
|
+
* It lives with the plugin ARTIFACTS, not in `config.yaml`: the config schema
|
|
192
|
+
* is versioned and frozen (ADR-0016), and a new knob there would cost a schema
|
|
193
|
+
* migration for one enum owned entirely by this feature. Same precedent as
|
|
194
|
+
* `disabled.json` / `registrations.json`.
|
|
195
|
+
*
|
|
196
|
+
* The REGISTRY is not read from here: the registry is a file the operator edits
|
|
197
|
+
* (checkout or `<ocrHome>/plugins/registry.json`), while this is a setting the
|
|
198
|
+
* console writes.
|
|
199
|
+
*/
|
|
200
|
+
/**
|
|
201
|
+
* ONE source the scan may look at (ADR-0037 §10).
|
|
202
|
+
*
|
|
203
|
+
* A source is a SCOPE first and a CREDENTIAL second — that is the whole point of
|
|
204
|
+
* the ordering. `target` says WHERE to look; `token` says what identity to look
|
|
205
|
+
* WITH, and it is optional because a public repository needs none.
|
|
206
|
+
*
|
|
207
|
+
* `omnicell-router-plugins` every repository in that owner
|
|
208
|
+
* `omnicell-router-plugins/qoder-*` matching repositories in that owner
|
|
209
|
+
* `omnicell-router-plugins/qoder-cli-models` exactly one repository
|
|
210
|
+
*
|
|
211
|
+
* `owner/*` and a bare `owner` mean the same thing; the console writes the bare
|
|
212
|
+
* form because it reads better.
|
|
213
|
+
*/
|
|
214
|
+
export interface MarketSource {
|
|
215
|
+
/** `owner`, `owner/repo`, or `owner/glob*`. */
|
|
216
|
+
target: string;
|
|
217
|
+
/** Optional GitHub PAT. Absent = anonymous (public repositories only). */
|
|
218
|
+
token?: string;
|
|
219
|
+
/**
|
|
220
|
+
* The source's DISPLAY NAME — REQUIRED by every write verb (ADR-0037 §9): it
|
|
221
|
+
* is what each card the scan produces prints, and it is the name a later
|
|
222
|
+
* rename matches on. Absent here only on a row written before the rule, or
|
|
223
|
+
* read back from a hand-edited `market.json`; `writeMarketSettings` accepts
|
|
224
|
+
* such a row so a legacy install keeps its scope, and the scan falls back to
|
|
225
|
+
* `target` when printing it. The add/edit verbs refuse a row without one.
|
|
226
|
+
*/
|
|
227
|
+
label?: string;
|
|
228
|
+
/** When the row was added (display only). */
|
|
229
|
+
addedAt?: string;
|
|
230
|
+
}
|
|
231
|
+
export interface MarketSettings {
|
|
232
|
+
egress: MarketEgress;
|
|
233
|
+
/**
|
|
234
|
+
* The SOURCES the scan unions (ADR-0037 §10).
|
|
235
|
+
*
|
|
236
|
+
* Empty = nothing to scan. There is deliberately no "scan everything visible"
|
|
237
|
+
* default: that is what the first release did, and it reported 82 repositories
|
|
238
|
+
* — every fork and every org the account belonged to — when the operator had
|
|
239
|
+
* granted exactly one plugin org.
|
|
240
|
+
*/
|
|
241
|
+
sources: MarketSource[];
|
|
242
|
+
/**
|
|
243
|
+
* Whether the gateway pulls the OFFICIAL registry (ADR-0037 §12). Default
|
|
244
|
+
* `true`; `false` is the operator's opt-out.
|
|
245
|
+
*
|
|
246
|
+
* The URL is NOT configurable and lives in this module, not in the settings
|
|
247
|
+
* file: the pulled document is written straight into
|
|
248
|
+
* `<pluginsRoot>/registry.json`, which the market then reads as its own
|
|
249
|
+
* curation, so a writable URL would turn a settings field into a way to hand
|
|
250
|
+
* this gateway an arbitrary plugin list. What the operator CAN say is whether
|
|
251
|
+
* this traffic happens at all — a gateway must be able to refuse to phone
|
|
252
|
+
* anywhere, which is the half of ADR-0037's original constraint that still
|
|
253
|
+
* holds.
|
|
254
|
+
*
|
|
255
|
+
* A successful pull OVERWRITES `<pluginsRoot>/registry.json` — the second
|
|
256
|
+
* precedence tier — so the market reads it exactly as if it had been written
|
|
257
|
+
* by hand. A failed pull is silent and keeps whatever that file already
|
|
258
|
+
* holds: the remote is an UPDATE channel for a file the operator could edit
|
|
259
|
+
* themselves, never a new failure mode on the market page.
|
|
260
|
+
*/
|
|
261
|
+
registrySync: boolean;
|
|
262
|
+
}
|
|
263
|
+
export declare function marketSettingsPath(): string;
|
|
264
|
+
/**
|
|
265
|
+
* The ONE remote registry this gateway pulls: the official list in the OCR
|
|
266
|
+
* gateway's own repository (ADR-0037 §12).
|
|
267
|
+
*
|
|
268
|
+
* A constant rather than a setting on purpose — see `MarketSettings.registrySync`
|
|
269
|
+
* for why the URL is not operator-editable. It is the raw file under the default
|
|
270
|
+
* branch, which is also what `plugins/registry.json` is in the checkout, so what
|
|
271
|
+
* a packaged install pulls is the same document a source run reads.
|
|
272
|
+
*/
|
|
273
|
+
export declare const OFFICIAL_REGISTRY_URL = "https://raw.githubusercontent.com/kenlin8827/omnicell-router/main/plugins/registry.json";
|
|
274
|
+
/** `<pluginsRoot>/registry.json` — the file a successful pull overwrites, and
|
|
275
|
+
* the registry tier that reads it. ONE definition: the sync writes it and the
|
|
276
|
+
* candidate list reads it, and a second spelling would let a pull land where
|
|
277
|
+
* nothing looks. */
|
|
278
|
+
export declare function registryFilePath(): string;
|
|
279
|
+
/** What the last pull did, so the console can say "synced 3 hours ago" instead
|
|
280
|
+
* of leaving the operator to guess whether the sync is doing anything. */
|
|
281
|
+
export interface RegistrySyncState {
|
|
282
|
+
/** The URL the last attempt used (always `OFFICIAL_REGISTRY_URL`). */
|
|
283
|
+
url?: string;
|
|
284
|
+
/** ISO time of the last SUCCESSFUL write (or 304 revalidation). */
|
|
285
|
+
syncedAt?: string;
|
|
286
|
+
/** The file the pull writes. */
|
|
287
|
+
file: string;
|
|
288
|
+
/** The last failure, kept until a success clears it. Never surfaced as a
|
|
289
|
+
* market `problem`: a failed pull leaves the local file in charge. */
|
|
290
|
+
lastError?: string;
|
|
291
|
+
lastErrorAt?: string;
|
|
292
|
+
/** An ETag for `If-None-Match`, so an unchanged upstream costs one 304. */
|
|
293
|
+
etag?: string;
|
|
294
|
+
}
|
|
295
|
+
export declare function registrySyncState(): RegistrySyncState;
|
|
296
|
+
/**
|
|
297
|
+
* Pull the official registry and, on success, overwrite
|
|
298
|
+
* `<pluginsRoot>/registry.json`.
|
|
299
|
+
*
|
|
300
|
+
* SWR, in the operator's words: a successful fetch REPLACES the local file, and
|
|
301
|
+
* a failed one is swallowed — the previously synced (or hand-written) file keeps
|
|
302
|
+
* serving. The only trace of a failure is `lastError` in the sync state, which
|
|
303
|
+
* the console shows, because a sync that silently stopped working is otherwise
|
|
304
|
+
* indistinguishable from one that works.
|
|
305
|
+
*
|
|
306
|
+
* The URL is `OFFICIAL_REGISTRY_URL`, never an argument: see
|
|
307
|
+
* `MarketSettings.registrySync` for why it is not configurable.
|
|
308
|
+
*
|
|
309
|
+
* Nothing here throws. A pull that fails is not a market failure.
|
|
310
|
+
*/
|
|
311
|
+
export declare function syncRemoteRegistry(deps?: MarketDeps & {
|
|
312
|
+
force?: boolean;
|
|
313
|
+
}): Promise<RegistrySyncState>;
|
|
314
|
+
/** A GitHub owner name: what an org URL and an `owner/repo` share. Refuses
|
|
315
|
+
* anything that is not ONE path component, because it is joined into an API
|
|
316
|
+
* URL. */
|
|
317
|
+
export declare function normalizeOrgName(raw: unknown): string | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Normalize a source TARGET, or undefined when it cannot be one.
|
|
320
|
+
*
|
|
321
|
+
* Three accepted shapes, all anchored on one owner:
|
|
322
|
+
* `owner` every repository of that owner
|
|
323
|
+
* `owner/repo` one repository
|
|
324
|
+
* `owner/pattern*` repositories matching a shell glob
|
|
325
|
+
*
|
|
326
|
+
* The glob lives in the REPO half only — an owner pattern would let one row
|
|
327
|
+
* match another org's repositories, which is never what a single row means.
|
|
328
|
+
*/
|
|
329
|
+
export declare function normalizeSourceTarget(raw: unknown): string | undefined;
|
|
330
|
+
/** The operator's setting, defaulting `direct` + no sources when the file is
|
|
331
|
+
* absent or unreadable. A corrupt value degrades to the default (never throws):
|
|
332
|
+
* the market is a read surface and a half-written file must not brick it. */
|
|
333
|
+
export declare function readMarketSettings(): MarketSettings;
|
|
334
|
+
/** Persist the market setting and answer the merged value. */
|
|
335
|
+
export declare function writeMarketSettings(next: {
|
|
336
|
+
egress?: unknown;
|
|
337
|
+
sources?: unknown;
|
|
338
|
+
registrySync?: unknown;
|
|
339
|
+
}): MarketSettings;
|
|
340
|
+
/** Add ONE source. A duplicate target is refused: two rows for the same owner
|
|
341
|
+
* would scan it twice and report its repositories as duplicates. `label` is
|
|
342
|
+
* REQUIRED (see `requireSourceLabel`): it is what the source's cards print. */
|
|
343
|
+
export declare function addMarketSource(input: {
|
|
344
|
+
target: string;
|
|
345
|
+
token?: string;
|
|
346
|
+
label: string;
|
|
347
|
+
}): MarketSettings;
|
|
348
|
+
/** Remove ONE source by its target (the row's identity, since targets are
|
|
349
|
+
* unique). Idempotent: removing an unknown target is not an error. */
|
|
350
|
+
export declare function removeMarketSource(target: string): MarketSettings;
|
|
351
|
+
/**
|
|
352
|
+
* Drop the index entries a removed source ALONE justified (ADR-0037 §9).
|
|
353
|
+
*
|
|
354
|
+
* `forgetSourceOutcome` forgets the row's VERDICT and keeps its entries on
|
|
355
|
+
* purpose, because one repository can be visible to two overlapping sources —
|
|
356
|
+
* but an entry NO remaining source's scope can reach is a card backed by
|
|
357
|
+
* nothing: it would keep offering a plugin whose only source was deleted,
|
|
358
|
+
* attributed to a row the drawer no longer lists. Only those are dropped. An
|
|
359
|
+
* entry a remaining scope still matches is KEPT, which is why the prune tests
|
|
360
|
+
* SCOPE rather than attribution (`via`): a rename or a shared label cannot be
|
|
361
|
+
* trusted to say which source found an entry.
|
|
362
|
+
*
|
|
363
|
+
* Removing the LAST source clears the index instead of leaving a
|
|
364
|
+
* "ready, zero entries" one. `builtAt` is never re-stamped — no scan ran.
|
|
365
|
+
*/
|
|
366
|
+
export declare function pruneSourceIndexForRemovedSource(remaining: readonly MarketSource[]): void;
|
|
367
|
+
/**
|
|
368
|
+
* The display name a source row MUST carry (ADR-0037 §9/§11).
|
|
369
|
+
*
|
|
370
|
+
* `label` is REQUIRED: it is what a scanned card prints instead of a generic
|
|
371
|
+
* "source" badge, so a row without one leaves its cards unattributable. The
|
|
372
|
+
* label is ALSO what `relabelSourceEntries` matches on when that display name
|
|
373
|
+
* changes, so a nameless row could not have its cards re-labelled at all.
|
|
374
|
+
* Absent or blank is refused; any other value is the operator's to choose.
|
|
375
|
+
*/
|
|
376
|
+
export declare function requireSourceLabel(raw: unknown): string;
|
|
377
|
+
/**
|
|
378
|
+
* Edit ONE source IN PLACE (ADR-0037 §11), including its SCOPE.
|
|
379
|
+
*
|
|
380
|
+
* `target` identifies the row being edited and `nextTarget` is the scope it
|
|
381
|
+
* should carry afterwards. Renaming is a REAL verb rather than "remove + add",
|
|
382
|
+
* because the two differ in what they preserve: `addedAt` and an untouched
|
|
383
|
+
* `token` survive, and a scope typo is one field away from the row it belongs to
|
|
384
|
+
* instead of a delete the operator has to remember to follow with an add
|
|
385
|
+
* (whose token they can no longer see, so they could not retype it).
|
|
386
|
+
*
|
|
387
|
+
* The rules that make the rename safe:
|
|
388
|
+
*
|
|
389
|
+
* - a new scope is normalized and REFUSED when it is unusable — a typo must
|
|
390
|
+
* not be silently dropped, since that would leave the operator scanning
|
|
391
|
+
* something other than what they asked for;
|
|
392
|
+
* - colliding with ANOTHER row is refused: two rows for one scope scan it
|
|
393
|
+
* twice and report its repositories as duplicates;
|
|
394
|
+
* - re-saving the SAME scope is not a collision, so a label-only edit keeps
|
|
395
|
+
* working.
|
|
396
|
+
*
|
|
397
|
+
* The other fields follow the console's mask rule:
|
|
398
|
+
*
|
|
399
|
+
* - `label` is REQUIRED on every edit (`requireSourceLabel`), so it is always
|
|
400
|
+
* sent and can never be cleared — there is no fallback name to fall back to;
|
|
401
|
+
* - `token` — the VALUE never reaches the console, so a form can only ever say
|
|
402
|
+
* "keep", "replace" or "clear", never "this is the current one":
|
|
403
|
+
* `undefined` keeps what is stored, `null` / `''` CLEARS it (anonymous,
|
|
404
|
+
* public repositories only), a string replaces it.
|
|
405
|
+
*/
|
|
406
|
+
export declare function updateMarketSource(input: {
|
|
407
|
+
target: string;
|
|
408
|
+
nextTarget?: string;
|
|
409
|
+
label: string | null;
|
|
410
|
+
token?: string | null;
|
|
411
|
+
}): MarketSettings;
|
|
412
|
+
/** One source as the CONSOLE may see it: never the token value, only whether
|
|
413
|
+
* there is one and a matchable hint. Every route that answers with a source
|
|
414
|
+
* list goes through here — `writeMarketSettings` and `readMarketSettings`
|
|
415
|
+
* answer the STORED shape, which carries the secret (ADR-0037 §8). */
|
|
416
|
+
export interface MarketSourceView {
|
|
417
|
+
target: string;
|
|
418
|
+
label?: string;
|
|
419
|
+
addedAt?: string;
|
|
420
|
+
authenticated: boolean;
|
|
421
|
+
hint?: string;
|
|
422
|
+
}
|
|
423
|
+
export declare function describeMarketSources(sources: MarketSource[]): MarketSourceView[];
|
|
424
|
+
/**
|
|
425
|
+
* The CONCRETE credential a row's `git clone` must present (ADR-0037 §8).
|
|
426
|
+
*
|
|
427
|
+
* `tokenForRowKey` answers the three scopes the market reads with:
|
|
428
|
+
*
|
|
429
|
+
* - a string — that SOURCE row's own token;
|
|
430
|
+
* - `null` — a source that carries NO token: anonymous, and the clone must be
|
|
431
|
+
* anonymous too (a source row never inherits the env token);
|
|
432
|
+
* - `undefined` — a registry row, whose scope is the env tier.
|
|
433
|
+
*
|
|
434
|
+
* A clone cannot express the third case as "no credential", so it is resolved
|
|
435
|
+
* to `GITHUB_TOKEN` here — the same token the card's own reads carried.
|
|
436
|
+
*/
|
|
437
|
+
export declare function rowAuthToken(key: string, settings?: MarketSettings): string | undefined;
|
|
438
|
+
/** Where an installable package lives. */
|
|
439
|
+
export interface MarketPackage {
|
|
440
|
+
url: string;
|
|
441
|
+
/** The version a release tag states, when it states one. */
|
|
442
|
+
version?: string;
|
|
443
|
+
/** `release` = a published release asset; `repo` = a zip committed in the tree. */
|
|
444
|
+
kind: 'release' | 'repo';
|
|
445
|
+
}
|
|
446
|
+
/** The installed package of the same id, as the card needs it. */
|
|
447
|
+
export interface MarketInstalledState {
|
|
448
|
+
version: string;
|
|
449
|
+
loaded: boolean;
|
|
450
|
+
disabled: boolean;
|
|
451
|
+
incompatible: boolean;
|
|
452
|
+
/** The market's version is NEWER than the installed one. */
|
|
453
|
+
updateAvailable: boolean;
|
|
454
|
+
}
|
|
455
|
+
export interface PluginMarketRow {
|
|
456
|
+
/** Stable card key — `<repo>@<subdir>`. */
|
|
457
|
+
key: string;
|
|
458
|
+
repo: string;
|
|
459
|
+
ref?: string;
|
|
460
|
+
subdir?: string;
|
|
461
|
+
/** Repository web page (the card's "open source" link). */
|
|
462
|
+
url: string;
|
|
463
|
+
/** Manifest id. Absent only when the manifest could not be read at all. */
|
|
464
|
+
id?: string;
|
|
465
|
+
name?: string;
|
|
466
|
+
version?: string;
|
|
467
|
+
apiVersion?: number;
|
|
468
|
+
description?: string | Record<string, string>;
|
|
469
|
+
types?: string[];
|
|
470
|
+
wires?: string[];
|
|
471
|
+
hosts?: string[];
|
|
472
|
+
/** The package's own release history, newest first. */
|
|
473
|
+
changelog?: PluginManifest['changelog'];
|
|
474
|
+
presets?: PluginManifest['presets'];
|
|
475
|
+
/** A logo asset was fetched and can be served for this card. */
|
|
476
|
+
logo?: boolean;
|
|
477
|
+
/** GitHub popularity; `null` = the source states none (never "zero stars"). */
|
|
478
|
+
stars: number | null;
|
|
479
|
+
/** Last push to the repository, ISO. */
|
|
480
|
+
updatedAt?: string;
|
|
481
|
+
/** False when this host could not run the package even if it were installed. */
|
|
482
|
+
compatible?: boolean;
|
|
483
|
+
/** How this card installs.
|
|
484
|
+
*
|
|
485
|
+
* `release` = the packaged zip the repository publishes; `code` = a build from
|
|
486
|
+
* the repository source. An `auto` entry (a SCANNED one, where nobody declared
|
|
487
|
+
* the method) is RESOLVED into one of the two by `resolvePackage` before the
|
|
488
|
+
* row is built — the card always states the concrete method it will use. */
|
|
489
|
+
method: PluginInstallMethod;
|
|
490
|
+
/** Which registry this card came from — `official` (committed) or `source`
|
|
491
|
+
* (found by a scan). The console badges an OFFICIAL card; a source card is
|
|
492
|
+
* titled by the source it came from instead. */
|
|
493
|
+
origin?: RegistryOrigin;
|
|
494
|
+
/** For a `source` card: the label (or target) of the source that found it.
|
|
495
|
+
* This is what the console shows — there is no generic "source" badge,
|
|
496
|
+
* because "which of my sources" is the question an operator actually has. */
|
|
497
|
+
originLabel?: string;
|
|
498
|
+
/** `code` only: whether `git` and `bun` are present, so the card can say a
|
|
499
|
+
* build will be refused before the operator clicks. Absent for `release`. */
|
|
500
|
+
buildReady?: boolean;
|
|
501
|
+
/** `code` only: the default branch a "latest" build pins to. */
|
|
502
|
+
codeBranch?: string;
|
|
503
|
+
/** `code` only: version-shaped tags, newest first. A source tree's latest is
|
|
504
|
+
* its default branch; an OLDER version can only be a tag, so this is the
|
|
505
|
+
* list the console offers as "earlier versions". */
|
|
506
|
+
codeTags?: string[];
|
|
507
|
+
/** The version an UPGRADE would land when the entry pins a `code` ref.
|
|
508
|
+
* `version` describes the pinned card; an upgrade follows the default branch,
|
|
509
|
+
* so the two differ and the monitor must compare against THIS one. Absent
|
|
510
|
+
* when the card's own version is already the upgrade target (every `release`
|
|
511
|
+
* row, and a `code` row that pins nothing). */
|
|
512
|
+
upgradeVersion?: string;
|
|
513
|
+
/** Where to download the installable package (`release` method only). */
|
|
514
|
+
package?: MarketPackage;
|
|
515
|
+
/** Why no package can be installed from this repository. */
|
|
516
|
+
packageError?: string;
|
|
517
|
+
/**
|
|
518
|
+
* SAME-ID COLLISION: another repository in this market declares the SAME plugin
|
|
519
|
+
* `id`. The id is the install identity, so installing either one would replace
|
|
520
|
+
* the other and rewrite its provenance — the console disables Install and
|
|
521
|
+
* names the peer repository. Absent when this row is the only claim on its id.
|
|
522
|
+
*/
|
|
523
|
+
conflict?: {
|
|
524
|
+
id: string;
|
|
525
|
+
repos: string[];
|
|
526
|
+
};
|
|
527
|
+
/** What installing this row would do, from the installed rows of the same id. */
|
|
528
|
+
installed?: MarketInstalledState;
|
|
529
|
+
/** The manifest could not be read; this says why. The card still renders (it
|
|
530
|
+
* is a repository the operator listed) instead of vanishing. */
|
|
531
|
+
error?: string;
|
|
532
|
+
/** Epoch ms of the upstream answer this row was built from. */
|
|
533
|
+
fetchedAt: number;
|
|
534
|
+
}
|
|
535
|
+
export interface PluginMarketSnapshot {
|
|
536
|
+
/** The leg this read (and any install that follows it) uses. */
|
|
537
|
+
egress: MarketEgress;
|
|
538
|
+
registry?: RegistrySource;
|
|
539
|
+
/** The OFFICIAL registry's read problem. Fatal only when `rows` is empty —
|
|
540
|
+
* otherwise the cards came from a scan and the problem is stated above them. */
|
|
541
|
+
problem?: RegistryProblem;
|
|
542
|
+
rows: PluginMarketRow[];
|
|
543
|
+
fetchedAt?: number;
|
|
544
|
+
/** True when at least one row came from the disk cache because upstream failed. */
|
|
545
|
+
stale: boolean;
|
|
546
|
+
/** The OFFICIAL registry the gateway pulls and keeps as a snapshot (ADR-0037
|
|
547
|
+
* §12) — the constant URL plus what the last attempt did. Absent while the
|
|
548
|
+
* operator has the pull turned off. */
|
|
549
|
+
registrySync?: RegistrySyncState & {
|
|
550
|
+
url: string;
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Where an installed package came from (ADR-0037 §7).
|
|
555
|
+
*
|
|
556
|
+
* A market install is the only moment the gateway KNOWS the repository behind a
|
|
557
|
+
* plugin id — `plugin.json` carries no such field, and a package installed from
|
|
558
|
+
* a `.zip` the operator downloaded by hand has no repository at all. Recording
|
|
559
|
+
* it here is what lets the updates panel answer "which installed plugins come
|
|
560
|
+
* from a registry entry, and is one newer?" without guessing, and what lets a
|
|
561
|
+
* `code` upgrade re-select the method the operator originally chose.
|
|
562
|
+
*
|
|
563
|
+
* `<pluginsRoot>/sources.json`, beside `disabled.json` / `registrations.json` /
|
|
564
|
+
* `market.json`: the config schema is frozen (ADR-0016) and this is plugin
|
|
565
|
+
* lifecycle state, so it lives with the plugin artifacts.
|
|
566
|
+
*/
|
|
567
|
+
export interface PluginSourceRecord {
|
|
568
|
+
repo: string;
|
|
569
|
+
subdir?: string;
|
|
570
|
+
method: PluginInstallMethod;
|
|
571
|
+
/** The ref a `code` build was made from, when it was pinned. */
|
|
572
|
+
ref?: string;
|
|
573
|
+
/** The version the install landed at, for a quick "moved since" read. */
|
|
574
|
+
version: string;
|
|
575
|
+
installedAt: string;
|
|
576
|
+
}
|
|
577
|
+
export declare function pluginSourcesPath(): string;
|
|
578
|
+
/** Every recorded source, keyed by plugin id. A corrupt or absent file degrades
|
|
579
|
+
* to empty (an installed plugin then simply reads as unmonitored) instead of
|
|
580
|
+
* failing. */
|
|
581
|
+
export declare function readPluginSources(): Record<string, PluginSourceRecord>;
|
|
582
|
+
/** Record (or refresh) one plugin's provenance. Best effort: a failed write
|
|
583
|
+
* must never fail the install that just succeeded. */
|
|
584
|
+
export declare function recordPluginSource(id: string, record: PluginSourceRecord): void;
|
|
585
|
+
/** Forget a plugin's provenance — an uninstall leaves nothing behind. */
|
|
586
|
+
export declare function forgetPluginSource(id: string): void;
|
|
587
|
+
/**
|
|
588
|
+
* The background pull (ADR-0037 §12).
|
|
589
|
+
*
|
|
590
|
+
* The lazy read path already keeps the official registry fresh, but "lazy" means
|
|
591
|
+
* a gateway can sit idle for a week and serve nothing new to a console that never
|
|
592
|
+
* opens the market page — while the update badge, an upgrade, and an install all
|
|
593
|
+
* read the same row set. One process-level timer closes that gap.
|
|
594
|
+
*
|
|
595
|
+
* It is armed only while the operator has NOT opted out (`registrySync`), so a
|
|
596
|
+
* gateway told to phone nowhere opens no connection and arms no timer.
|
|
597
|
+
* `unref()`s so it can never hold the process open, and calls the SAME
|
|
598
|
+
* `syncRemoteRegistry` the read path calls — so a tick, a Refresh and a boot read
|
|
599
|
+
* are one operation, one ETag, one in-flight guard.
|
|
600
|
+
*/
|
|
601
|
+
export declare class RegistrySyncScheduler {
|
|
602
|
+
private readonly tickIntervalMs;
|
|
603
|
+
private timer;
|
|
604
|
+
constructor(tickIntervalMs?: number);
|
|
605
|
+
/** Start the loop; a no-op while the official pull is opted out. */
|
|
606
|
+
start(): void;
|
|
607
|
+
/** Arm or disarm to match the CURRENT setting. Idempotent; call it after the
|
|
608
|
+
* operator flips the switch so a running gateway reacts without a restart. */
|
|
609
|
+
reconcile(): void;
|
|
610
|
+
stop(): void;
|
|
611
|
+
}
|
|
612
|
+
/** The process-wide scheduler (one timer per gateway, started at boot). */
|
|
613
|
+
export declare function startRegistrySyncScheduler(): RegistrySyncScheduler;
|
|
614
|
+
/** The cached logo for a row key (`<repo>@<subdir>`), as the logo route asks.
|
|
615
|
+
* Cache keys are the repository identity, not the install METHOD, so the method
|
|
616
|
+
* is irrelevant here — `release` is the neutral filler. */
|
|
617
|
+
export declare function cachedLogoForKey(key: string): {
|
|
618
|
+
bytes: Buffer;
|
|
619
|
+
mime: string;
|
|
620
|
+
} | undefined;
|
|
621
|
+
/**
|
|
622
|
+
* The whole market, from cache when fresh.
|
|
623
|
+
*
|
|
624
|
+
* A row is cached for `MARKET_CACHE_TTL_MS`; a FORCED refresh (the console's
|
|
625
|
+
* Refresh verb) re-reads every row. A row whose upstream read failed falls back
|
|
626
|
+
* to its last cached copy and reports `stale`, which is the difference between
|
|
627
|
+
* "this plugin is gone" and "this gateway could not reach GitHub".
|
|
628
|
+
*/
|
|
629
|
+
export declare function loadMarket(deps?: MarketDeps & {
|
|
630
|
+
refresh?: boolean;
|
|
631
|
+
}): Promise<PluginMarketSnapshot>;
|
|
632
|
+
/** ONE row by repository (the install verb's resolver). */
|
|
633
|
+
export declare function findMarketRow(repo: string, deps?: MarketDeps & {
|
|
634
|
+
refresh?: boolean;
|
|
635
|
+
}): Promise<PluginMarketRow | undefined>;
|
|
636
|
+
/** ONE row's installable bytes, by either method — what the install verb takes.
|
|
637
|
+
*
|
|
638
|
+
* `release` downloads the published zip. `code` builds one from the repository
|
|
639
|
+
* source (ADR-0037 §4a) and answers the version the built manifest declares,
|
|
640
|
+
* so the console can say what actually landed instead of what the branch held
|
|
641
|
+
* ten minutes ago. Both answers feed the SAME `installPluginBytes` pipeline.
|
|
642
|
+
*
|
|
643
|
+
* `upgrade` is the difference between "install what this card describes" and
|
|
644
|
+
* "move this plugin to the repository's tip": a `code` entry pinned in the
|
|
645
|
+
* registry rebuilds its PIN for an install, but follows the default branch for
|
|
646
|
+
* an upgrade (see the `buildRef` note below). */
|
|
647
|
+
export declare function prepareMarketPackage(row: PluginMarketRow, deps?: MarketDeps & {
|
|
648
|
+
ref?: string;
|
|
649
|
+
upgrade?: boolean;
|
|
650
|
+
}): Promise<{
|
|
651
|
+
bytes: Uint8Array;
|
|
652
|
+
version?: string;
|
|
653
|
+
} | {
|
|
654
|
+
error: string;
|
|
655
|
+
}>;
|
|
656
|
+
/**
|
|
657
|
+
* Build the index from what the configured SOURCES can see
|
|
658
|
+
* (ADR-0037 §9).
|
|
659
|
+
*
|
|
660
|
+
* `GET /user/repos` returns REPOSITORY metadata — never file contents — so
|
|
661
|
+
* "is this a plugin?" cannot be answered from the listing. Every candidate gets
|
|
662
|
+
* one `plugin.json` read; that is the N+1 the caller must expect, and the reason
|
|
663
|
+
* the result is an INDEX rather than something recomputed per page load.
|
|
664
|
+
*
|
|
665
|
+
* Failures are counted, never fatal: a repository that cannot be read (rate
|
|
666
|
+
* limit, deleted, network) increments `skipped` and the run continues, because a
|
|
667
|
+
* discovery that dies on one bad repository is worse than an index that reports
|
|
668
|
+
* what it could see.
|
|
669
|
+
*/
|
|
670
|
+
export declare function discoverFromSources(deps?: MarketDeps): Promise<{
|
|
671
|
+
index?: SourceIndex;
|
|
672
|
+
error?: string;
|
|
673
|
+
/** Per-SOURCE outcome, so a partial failure is legible instead of silent. */
|
|
674
|
+
perSource?: SourceScanOutcome[];
|
|
675
|
+
}>;
|
|
676
|
+
/** The market cache directory (tests point OCR_HOME at a sandbox). */
|
|
677
|
+
export declare function marketCacheDir(): string;
|