omnicell-router 0.2.0 → 0.7.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 +70 -10
- package/README.zh-CN.md +57 -8
- package/RELEASING.md +6 -0
- package/RELEASING.zh-CN.md +5 -0
- package/backend/dist/auth/api-keys.d.ts +14 -2
- package/backend/dist/auth/api-keys.js +26 -14
- package/backend/dist/auth/model-access.d.ts +27 -10
- package/backend/dist/auth/model-access.js +34 -17
- package/backend/dist/capture/migrate/engine.d.ts +38 -0
- package/backend/dist/capture/migrate/engine.js +307 -0
- package/backend/dist/capture/migrate/index.d.ts +18 -0
- package/backend/dist/capture/migrate/index.js +18 -0
- package/backend/dist/capture/migrate/migrator.d.ts +113 -0
- package/backend/dist/capture/migrate/migrator.js +16 -0
- package/backend/dist/capture/migrate/registry.d.ts +16 -0
- package/backend/dist/capture/migrate/registry.js +19 -0
- package/backend/dist/capture/migrate/steps/v1-to-v2.d.ts +86 -0
- package/backend/dist/capture/migrate/steps/v1-to-v2.js +396 -0
- package/backend/dist/capture/recorder.d.ts +422 -272
- package/backend/dist/capture/recorder.js +873 -417
- package/backend/dist/capture/turn-boundary.d.ts +17 -0
- package/backend/dist/capture/turn-boundary.js +31 -0
- package/backend/dist/cli/clients/base.d.ts +158 -23
- package/backend/dist/cli/clients/base.js +150 -4
- package/backend/dist/cli/clients/claude.d.ts +3 -2
- package/backend/dist/cli/clients/claude.js +4 -3
- package/backend/dist/cli/clients/codex.d.ts +3 -2
- package/backend/dist/cli/clients/codex.js +4 -3
- package/backend/dist/cli/clients/core-adapters.d.ts +25 -0
- package/backend/dist/cli/clients/core-adapters.js +44 -0
- package/backend/dist/cli/clients/dsh.d.ts +5 -3
- package/backend/dist/cli/clients/dsh.js +29 -18
- package/backend/dist/cli/clients/grok.d.ts +53 -0
- package/backend/dist/cli/clients/grok.js +249 -0
- package/backend/dist/cli/clients/index.d.ts +28 -19
- package/backend/dist/cli/clients/index.js +156 -58
- package/backend/dist/cli/clients/kimi.d.ts +75 -0
- package/backend/dist/cli/clients/kimi.js +316 -0
- package/backend/dist/cli/clients/launcher.d.ts +48 -0
- package/backend/dist/cli/clients/launcher.js +41 -0
- package/backend/dist/cli/clients/omp.d.ts +43 -0
- package/backend/dist/cli/clients/omp.js +537 -0
- package/backend/dist/cli/clients/openclaw.d.ts +55 -0
- package/backend/dist/cli/clients/openclaw.js +525 -0
- package/backend/dist/cli/clients/opencode.d.ts +7 -20
- package/backend/dist/cli/clients/opencode.js +32 -159
- package/backend/dist/cli/clients/pi.d.ts +7 -21
- package/backend/dist/cli/clients/pi.js +87 -229
- package/backend/dist/cli/clients/plugin-adapters.d.ts +20 -0
- package/backend/dist/cli/clients/plugin-adapters.js +88 -0
- package/backend/dist/cli/clients/reserved.d.ts +51 -0
- package/backend/dist/cli/clients/reserved.js +53 -0
- package/backend/dist/cli/clients/workbuddy.d.ts +31 -0
- package/backend/dist/cli/clients/workbuddy.js +259 -0
- package/backend/dist/cli/daemon.d.ts +105 -27
- package/backend/dist/cli/daemon.js +509 -151
- package/backend/dist/cli/index.d.ts +6 -1
- package/backend/dist/cli/index.js +238 -22
- package/backend/dist/cli/paths.d.ts +86 -0
- package/backend/dist/cli/paths.js +269 -0
- package/backend/dist/cli/shim.d.ts +47 -1
- package/backend/dist/cli/shim.js +180 -13
- package/backend/dist/cli/types.d.ts +102 -16
- package/backend/dist/cli/types.js +5 -4
- package/backend/dist/compression/caveman-prompts.d.ts +1 -1
- package/backend/dist/compression/caveman.d.ts +2 -16
- package/backend/dist/compression/caveman.js +25 -37
- package/backend/dist/compression/headroom.d.ts +4 -3
- package/backend/dist/compression/headroom.js +2 -2
- package/backend/dist/compression/index.d.ts +5 -26
- package/backend/dist/compression/index.js +79 -17
- package/backend/dist/compression/tool-output.d.ts +2 -20
- package/backend/dist/compression/tool-output.js +40 -47
- package/backend/dist/config/comments-en.d.ts +17 -0
- package/backend/dist/config/comments-en.js +232 -0
- package/backend/dist/config/comments-zh.d.ts +10 -0
- package/backend/dist/config/comments-zh.js +217 -0
- package/backend/dist/config/defaults.d.ts +190 -2
- package/backend/dist/config/defaults.js +191 -2
- package/backend/dist/config/env-archive.js +77 -38
- package/backend/dist/config/env.d.ts +4 -0
- package/backend/dist/config/env.js +16 -0
- package/backend/dist/config/index.d.ts +48 -12
- package/backend/dist/config/index.js +794 -368
- package/backend/dist/config/layout.d.ts +29 -0
- package/backend/dist/config/layout.js +86 -0
- package/backend/dist/config/migrations/v0-to-v1.d.ts +105 -0
- package/backend/dist/config/migrations/v0-to-v1.js +78 -0
- package/backend/dist/config/migrations/v1-to-v2.d.ts +14 -0
- package/backend/dist/config/migrations/v1-to-v2.js +41 -0
- package/backend/dist/config/migrations/v2-to-v3.d.ts +34 -0
- package/backend/dist/config/migrations/v2-to-v3.js +66 -0
- package/backend/dist/config/migrations/v3-to-v4.d.ts +34 -0
- package/backend/dist/config/migrations/v3-to-v4.js +61 -0
- package/backend/dist/config/runtime.d.ts +13 -0
- package/backend/dist/config/runtime.js +26 -0
- package/backend/dist/config/schema.d.ts +28 -0
- package/backend/dist/config/schema.js +98 -0
- package/backend/dist/config/types.d.ts +501 -84
- package/backend/dist/forward-proxy/access-log.d.ts +173 -0
- package/backend/dist/forward-proxy/access-log.js +657 -0
- package/backend/dist/forward-proxy/ca-trust.d.ts +42 -0
- package/backend/dist/forward-proxy/ca-trust.js +242 -0
- package/backend/dist/forward-proxy/ca.d.ts +66 -2
- package/backend/dist/forward-proxy/ca.js +146 -11
- package/backend/dist/forward-proxy/caller-context.d.ts +18 -0
- package/backend/dist/forward-proxy/caller-context.js +20 -0
- package/backend/dist/forward-proxy/egress.d.ts +104 -0
- package/backend/dist/forward-proxy/egress.js +280 -0
- package/backend/dist/forward-proxy/h2-forward.d.ts +66 -0
- package/backend/dist/forward-proxy/h2-forward.js +526 -0
- package/backend/dist/forward-proxy/index.d.ts +13 -1
- package/backend/dist/forward-proxy/index.js +148 -7
- package/backend/dist/forward-proxy/interceptor.d.ts +16 -13
- package/backend/dist/forward-proxy/interceptor.js +35 -57
- package/backend/dist/forward-proxy/relay.d.ts +21 -1
- package/backend/dist/forward-proxy/relay.js +48 -1
- package/backend/dist/forward-proxy/rules.d.ts +148 -0
- package/backend/dist/forward-proxy/rules.js +280 -0
- package/backend/dist/forward-proxy/server.d.ts +102 -9
- package/backend/dist/forward-proxy/server.js +1310 -305
- package/backend/dist/forward-proxy/sni.d.ts +29 -7
- package/backend/dist/forward-proxy/sni.js +109 -47
- package/backend/dist/forward-proxy/system-proxy.d.ts +72 -0
- package/backend/dist/forward-proxy/system-proxy.js +303 -0
- package/backend/dist/forward-proxy/upstream-tls.d.ts +46 -0
- package/backend/dist/forward-proxy/upstream-tls.js +105 -0
- package/backend/dist/forward-proxy/ws-frames.d.ts +45 -0
- package/backend/dist/forward-proxy/ws-frames.js +153 -0
- package/backend/dist/harness/common/catalog-registry.d.ts +63 -0
- package/backend/dist/harness/common/catalog-registry.js +77 -0
- package/backend/dist/harness/common/github.d.ts +6 -0
- package/backend/dist/harness/common/github.js +13 -0
- package/backend/dist/harness/common/market.d.ts +590 -0
- package/backend/dist/harness/common/market.js +1079 -0
- package/backend/dist/harness/common/marketplace-rescan-scheduler.d.ts +24 -0
- package/backend/dist/harness/common/marketplace-rescan-scheduler.js +62 -0
- package/backend/dist/harness/{catalog-npm.d.ts → common/npm-catalog.d.ts} +5 -5
- package/backend/dist/harness/{catalog-npm.js → common/npm-catalog.js} +7 -7
- package/backend/dist/harness/common/npm-source.d.ts +29 -0
- package/backend/dist/harness/common/npm-source.js +121 -0
- package/backend/dist/harness/common/pypi-source.d.ts +28 -0
- package/backend/dist/harness/common/pypi-source.js +71 -0
- package/backend/dist/harness/common/source-views.d.ts +22 -0
- package/backend/dist/harness/common/source-views.js +25 -0
- package/backend/dist/harness/{stars.d.ts → common/stars.d.ts} +1 -1
- package/backend/dist/harness/{stars.js → common/stars.js} +2 -2
- package/backend/dist/harness/common/text.d.ts +11 -0
- package/backend/dist/harness/common/text.js +18 -0
- package/backend/dist/harness/config-file.d.ts +14 -1
- package/backend/dist/harness/config-file.js +38 -0
- package/backend/dist/harness/db-probe.d.ts +29 -0
- package/backend/dist/harness/db-probe.js +270 -0
- package/backend/dist/harness/detail.d.ts +10 -1
- package/backend/dist/harness/detail.js +144 -7
- package/backend/dist/harness/host/adapters/amp.d.ts +19 -0
- package/backend/dist/harness/host/adapters/amp.js +21 -0
- package/backend/dist/harness/host/adapters/antigravity.d.ts +18 -0
- package/backend/dist/harness/host/adapters/antigravity.js +21 -0
- package/backend/dist/harness/host/adapters/base.d.ts +225 -0
- package/backend/dist/harness/host/adapters/base.js +521 -0
- package/backend/dist/harness/host/adapters/claude.d.ts +54 -0
- package/backend/dist/harness/host/adapters/claude.js +145 -0
- package/backend/dist/harness/host/adapters/cline.d.ts +18 -0
- package/backend/dist/harness/host/adapters/cline.js +20 -0
- package/backend/dist/harness/host/adapters/codex.d.ts +54 -0
- package/backend/dist/harness/host/adapters/codex.js +133 -0
- package/backend/dist/harness/host/adapters/cursor.d.ts +18 -0
- package/backend/dist/harness/host/adapters/cursor.js +24 -0
- package/backend/dist/harness/host/adapters/declarative.d.ts +22 -0
- package/backend/dist/harness/host/adapters/declarative.js +38 -0
- package/backend/dist/harness/host/adapters/dsh.d.ts +76 -0
- package/backend/dist/harness/host/adapters/dsh.js +253 -0
- package/backend/dist/harness/host/adapters/factory.d.ts +36 -0
- package/backend/dist/harness/host/adapters/factory.js +34 -0
- package/backend/dist/harness/host/adapters/gemini-cli.d.ts +17 -0
- package/backend/dist/harness/host/adapters/gemini-cli.js +19 -0
- package/backend/dist/harness/host/adapters/grok.d.ts +66 -0
- package/backend/dist/harness/host/adapters/grok.js +136 -0
- package/backend/dist/harness/{adapters → host/adapters}/index.d.ts +18 -5
- package/backend/dist/harness/{adapters → host/adapters}/index.js +73 -5
- package/backend/dist/harness/host/adapters/kimi.d.ts +30 -0
- package/backend/dist/harness/host/adapters/kimi.js +59 -0
- package/backend/dist/harness/host/adapters/omp.d.ts +55 -0
- package/backend/dist/harness/host/adapters/omp.js +90 -0
- package/backend/dist/harness/host/adapters/openclaw.d.ts +54 -0
- package/backend/dist/harness/host/adapters/openclaw.js +141 -0
- package/backend/dist/harness/host/adapters/opencode.d.ts +24 -0
- package/backend/dist/harness/host/adapters/opencode.js +48 -0
- package/backend/dist/harness/host/adapters/pi.d.ts +27 -0
- package/backend/dist/harness/host/adapters/pi.js +58 -0
- package/backend/dist/harness/host/adapters/types.d.ts +395 -0
- package/backend/dist/harness/host/adapters/types.js +17 -0
- package/backend/dist/harness/host/adapters/universal.d.ts +14 -0
- package/backend/dist/harness/host/adapters/universal.js +18 -0
- package/backend/dist/harness/host/adapters/windsurf.d.ts +20 -0
- package/backend/dist/harness/host/adapters/windsurf.js +22 -0
- package/backend/dist/harness/host/adapters/zed.d.ts +12 -0
- package/backend/dist/harness/host/adapters/zed.js +14 -0
- package/backend/dist/harness/host/claude-mcp-runtime.d.ts +6 -0
- package/backend/dist/harness/host/claude-mcp-runtime.js +56 -0
- package/backend/dist/harness/{discover.d.ts → host/discover.d.ts} +54 -18
- package/backend/dist/harness/{discover.js → host/discover.js} +314 -53
- package/backend/dist/harness/{drift.d.ts → host/drift.d.ts} +1 -1
- package/backend/dist/harness/{drift.js → host/drift.js} +1 -1
- package/backend/dist/harness/host/grok-mcp-runtime.d.ts +6 -0
- package/backend/dist/harness/host/grok-mcp-runtime.js +56 -0
- package/backend/dist/harness/{hosts.d.ts → host/hosts.d.ts} +3 -3
- package/backend/dist/harness/{hosts.js → host/hosts.js} +7 -2
- package/backend/dist/harness/host/index.d.ts +10 -0
- package/backend/dist/harness/host/index.js +12 -0
- package/backend/dist/harness/host/install-log.d.ts +22 -0
- package/backend/dist/harness/host/install-log.js +106 -0
- package/backend/dist/harness/{install.d.ts → host/install.d.ts} +32 -13
- package/backend/dist/harness/{install.js → host/install.js} +133 -50
- package/backend/dist/harness/host/inventory.d.ts +30 -0
- package/backend/dist/harness/{inventory.js → host/inventory.js} +107 -16
- package/backend/dist/harness/host/kimi-mcp-runtime.d.ts +6 -0
- package/backend/dist/harness/host/kimi-mcp-runtime.js +84 -0
- package/backend/dist/harness/{ledger.d.ts → host/ledger.d.ts} +1 -1
- package/backend/dist/harness/{ledger.js → host/ledger.js} +3 -3
- package/backend/dist/harness/{maintenance.d.ts → host/maintenance.d.ts} +23 -6
- package/backend/dist/harness/{maintenance.js → host/maintenance.js} +355 -63
- package/backend/dist/harness/{manifest.d.ts → host/manifest.d.ts} +11 -2
- package/backend/dist/harness/{manifest.js → host/manifest.js} +76 -15
- package/backend/dist/harness/host/marketplace-sync.d.ts +64 -0
- package/backend/dist/harness/host/marketplace-sync.js +231 -0
- package/backend/dist/harness/host/mcp-cli.d.ts +44 -0
- package/backend/dist/harness/host/mcp-cli.js +545 -0
- package/backend/dist/harness/host/mcp-edit.d.ts +89 -0
- package/backend/dist/harness/host/mcp-edit.js +342 -0
- package/backend/dist/harness/host/mcp-entry.d.ts +100 -0
- package/backend/dist/harness/host/mcp-entry.js +435 -0
- package/backend/dist/harness/host/mcp-inspector.d.ts +125 -0
- package/backend/dist/harness/host/mcp-inspector.js +634 -0
- package/backend/dist/harness/host/mcp-registry.d.ts +66 -0
- package/backend/dist/harness/host/mcp-registry.js +331 -0
- package/backend/dist/harness/host/mcp-runtime.d.ts +19 -0
- package/backend/dist/harness/host/mcp-runtime.js +22 -0
- package/backend/dist/harness/host/opencode-mcp-runtime.d.ts +7 -0
- package/backend/dist/harness/host/opencode-mcp-runtime.js +73 -0
- package/backend/dist/harness/{probe.d.ts → host/probe.d.ts} +4 -4
- package/backend/dist/harness/{probe.js → host/probe.js} +8 -8
- package/backend/dist/harness/{registry.d.ts → host/registry.d.ts} +1 -1
- package/backend/dist/harness/host/registry.js +28 -0
- package/backend/dist/harness/host/request.d.ts +56 -0
- package/backend/dist/harness/host/request.js +1 -0
- package/backend/dist/harness/{sources → host/resolvers}/clawhub.d.ts +1 -1
- package/backend/dist/harness/{sources → host/resolvers}/clawhub.js +1 -1
- package/backend/dist/harness/host/resolvers/git-marketplace.d.ts +16 -0
- package/backend/dist/harness/host/resolvers/git-marketplace.js +53 -0
- package/backend/dist/harness/{sources → host/resolvers}/github.d.ts +1 -1
- package/backend/dist/harness/{sources → host/resolvers}/github.js +2 -2
- package/backend/dist/harness/host/resolvers/npm.d.ts +2 -0
- package/backend/dist/harness/{sources → host/resolvers}/npm.js +16 -10
- package/backend/dist/harness/host/resolvers/pypi.d.ts +2 -0
- package/backend/dist/harness/host/resolvers/pypi.js +100 -0
- package/backend/dist/harness/host/scopes.d.ts +11 -0
- package/backend/dist/harness/host/scopes.js +12 -0
- package/backend/dist/harness/host/timeouts.d.ts +8 -0
- package/backend/dist/harness/host/timeouts.js +8 -0
- package/backend/dist/harness/host/writers/kimi-web.d.ts +70 -0
- package/backend/dist/harness/host/writers/kimi-web.js +222 -0
- package/backend/dist/harness/host/writers/mcp.d.ts +119 -0
- package/backend/dist/harness/host/writers/mcp.js +359 -0
- package/backend/dist/harness/host/writers/plugin.d.ts +176 -0
- package/backend/dist/harness/host/writers/plugin.js +528 -0
- package/backend/dist/harness/{writers → host/writers}/skill.d.ts +3 -3
- package/backend/dist/harness/{writers → host/writers}/skill.js +6 -3
- package/backend/dist/harness/lang.d.ts +14 -0
- package/backend/dist/harness/lang.js +33 -0
- package/backend/dist/harness/net.d.ts +33 -0
- package/backend/dist/harness/net.js +63 -0
- package/backend/dist/harness/plugin/adapters/antigravity.d.ts +11 -0
- package/backend/dist/harness/plugin/adapters/antigravity.js +14 -0
- package/backend/dist/harness/plugin/adapters/base.d.ts +107 -0
- package/backend/dist/harness/plugin/adapters/base.js +454 -0
- package/backend/dist/harness/plugin/adapters/claude.d.ts +28 -0
- package/backend/dist/harness/plugin/adapters/claude.js +63 -0
- package/backend/dist/harness/plugin/adapters/codex.d.ts +13 -0
- package/backend/dist/harness/plugin/adapters/codex.js +16 -0
- package/backend/dist/harness/plugin/adapters/cursor.d.ts +13 -0
- package/backend/dist/harness/plugin/adapters/cursor.js +16 -0
- package/backend/dist/harness/plugin/adapters/dsh-plugin-net.d.ts +20 -0
- package/backend/dist/harness/plugin/adapters/dsh-plugin-net.js +371 -0
- package/backend/dist/harness/plugin/adapters/dsh.d.ts +22 -0
- package/backend/dist/harness/plugin/adapters/dsh.js +50 -0
- package/backend/dist/harness/plugin/adapters/factory.d.ts +11 -0
- package/backend/dist/harness/plugin/adapters/factory.js +19 -0
- package/backend/dist/harness/plugin/adapters/gemini.d.ts +12 -0
- package/backend/dist/harness/plugin/adapters/gemini.js +22 -0
- package/backend/dist/harness/plugin/adapters/grok.d.ts +15 -0
- package/backend/dist/harness/plugin/adapters/grok.js +23 -0
- package/backend/dist/harness/plugin/adapters/index.d.ts +41 -0
- package/backend/dist/harness/plugin/adapters/index.js +143 -0
- package/backend/dist/harness/plugin/adapters/kimi.d.ts +6 -0
- package/backend/dist/harness/plugin/adapters/kimi.js +35 -0
- package/backend/dist/harness/plugin/adapters/omp.d.ts +19 -0
- package/backend/dist/harness/plugin/adapters/omp.js +26 -0
- package/backend/dist/harness/plugin/adapters/openclaw.d.ts +20 -0
- package/backend/dist/harness/plugin/adapters/openclaw.js +36 -0
- package/backend/dist/harness/plugin/adapters/pi-dev.d.ts +124 -0
- package/backend/dist/harness/plugin/adapters/pi-dev.js +420 -0
- package/backend/dist/harness/plugin/adapters/pi-github.d.ts +18 -0
- package/backend/dist/harness/plugin/adapters/pi-github.js +27 -0
- package/backend/dist/harness/plugin/adapters/universal.d.ts +11 -0
- package/backend/dist/harness/plugin/adapters/universal.js +18 -0
- package/backend/dist/harness/plugin/builtin.d.ts +13 -0
- package/backend/dist/harness/plugin/builtin.js +34 -0
- package/backend/dist/harness/plugin/catalog.d.ts +30 -0
- package/backend/dist/harness/plugin/catalog.js +200 -0
- package/backend/dist/harness/plugin/index.d.ts +9 -0
- package/backend/dist/harness/plugin/index.js +9 -0
- package/backend/dist/harness/plugin/types.d.ts +164 -0
- package/backend/dist/harness/plugin/types.js +1 -0
- package/backend/dist/harness/{clawhub.d.ts → skill/clawhub.d.ts} +28 -5
- package/backend/dist/harness/{clawhub.js → skill/clawhub.js} +170 -5
- package/backend/dist/harness/skill/skills-sh.d.ts +47 -0
- package/backend/dist/harness/skill/skills-sh.js +270 -0
- package/backend/dist/harness/skill/sources.d.ts +41 -0
- package/backend/dist/harness/skill/sources.js +131 -0
- package/backend/dist/harness/spi.d.ts +11 -7
- package/backend/dist/harness/tcp-reach.d.ts +30 -0
- package/backend/dist/harness/tcp-reach.js +61 -0
- package/backend/dist/harness/translation.d.ts +31 -13
- package/backend/dist/harness/translation.js +212 -62
- package/backend/dist/harness/types.d.ts +61 -16
- package/backend/dist/index.js +170 -16
- package/backend/dist/ir/adapters/anthropic-messages-stream.d.ts +18 -0
- package/backend/dist/ir/adapters/anthropic-messages-stream.js +266 -0
- package/backend/dist/ir/adapters/anthropic-messages.d.ts +30 -0
- package/backend/dist/ir/adapters/anthropic-messages.js +870 -0
- package/backend/dist/ir/adapters/google-gemini-stream.d.ts +22 -0
- package/backend/dist/ir/adapters/google-gemini-stream.js +246 -0
- package/backend/dist/ir/adapters/google-gemini.d.ts +9 -0
- package/backend/dist/ir/adapters/google-gemini.js +450 -0
- package/backend/dist/ir/adapters/openai-chat-stream.d.ts +41 -0
- package/backend/dist/ir/adapters/openai-chat-stream.js +369 -0
- package/backend/dist/ir/adapters/openai-chat.d.ts +17 -0
- package/backend/dist/ir/adapters/openai-chat.js +670 -0
- package/backend/dist/ir/adapters/openai-responses-output.d.ts +50 -0
- package/backend/dist/ir/adapters/openai-responses-output.js +353 -0
- package/backend/dist/ir/adapters/openai-responses-stream.d.ts +12 -0
- package/backend/dist/ir/adapters/openai-responses-stream.js +193 -0
- package/backend/dist/ir/adapters/openai-responses.d.ts +14 -0
- package/backend/dist/ir/adapters/openai-responses.js +670 -0
- package/backend/dist/ir/capabilities.d.ts +41 -0
- package/backend/dist/ir/capabilities.js +147 -0
- package/backend/dist/ir/errors.d.ts +23 -0
- package/backend/dist/ir/errors.js +31 -0
- package/backend/dist/ir/index.d.ts +5 -0
- package/backend/dist/ir/index.js +5 -0
- package/backend/dist/ir/media.d.ts +2 -0
- package/backend/dist/ir/media.js +2 -0
- package/backend/dist/ir/stream.d.ts +17 -0
- package/backend/dist/ir/stream.js +250 -0
- package/backend/dist/ir/types.d.ts +523 -0
- package/backend/dist/ir/types.js +19 -0
- package/backend/dist/ir/validate.d.ts +18 -0
- package/backend/dist/ir/validate.js +272 -0
- package/backend/dist/metrics/request-cost.d.ts +3 -11
- package/backend/dist/metrics/request-cost.js +9 -27
- package/backend/dist/observability/failure-events.d.ts +20 -4
- package/backend/dist/observability/failure-events.js +9 -1
- package/backend/dist/observability/http-exchange.d.ts +75 -27
- package/backend/dist/observability/http-exchange.js +136 -39
- package/backend/dist/observability/request-identity.d.ts +40 -0
- package/backend/dist/observability/request-identity.js +102 -0
- package/backend/dist/observability/traffic-live-hidden.d.ts +24 -0
- package/backend/dist/observability/traffic-live-hidden.js +82 -0
- package/backend/dist/observability/upstream-body-redaction.d.ts +23 -0
- package/backend/dist/observability/upstream-body-redaction.js +72 -0
- package/backend/dist/observability/upstream-events.d.ts +16 -10
- package/backend/dist/observability/upstream-events.js +17 -11
- package/backend/dist/opencode/agents.d.ts +10 -2
- package/backend/dist/opencode/agents.js +22 -3
- package/backend/dist/opencode/catalog/auto-pull.d.ts +35 -1
- package/backend/dist/opencode/catalog/auto-pull.js +169 -33
- package/backend/dist/opencode/catalog/ocr-store.d.ts +6 -6
- package/backend/dist/opencode/catalog/ocr-store.js +2 -2
- package/backend/dist/opencode/catalog/overrides-store.d.ts +6 -5
- package/backend/dist/opencode/catalog/overrides-store.js +28 -3
- package/backend/dist/opencode/catalog/repository.d.ts +4 -0
- package/backend/dist/opencode/catalog/repository.js +19 -0
- package/backend/dist/opencode/catalog/sources/models-dev.d.ts +4 -0
- package/backend/dist/opencode/catalog/sources/models-dev.js +15 -4
- package/backend/dist/opencode/catalog/types.d.ts +10 -7
- package/backend/dist/opencode/connector.d.ts +2 -2
- package/backend/dist/opencode/connector.js +2 -2
- package/backend/dist/opencode/credentials/def-materialize.d.ts +0 -5
- package/backend/dist/opencode/credentials/def-materialize.js +149 -11
- package/backend/dist/opencode/credentials/ocr-store.d.ts +18 -0
- package/backend/dist/opencode/credentials/ocr-store.js +88 -7
- package/backend/dist/opencode/credentials/opencode-v2-store.d.ts +24 -13
- package/backend/dist/opencode/credentials/opencode-v2-store.js +70 -29
- package/backend/dist/opencode/credentials/paths.d.ts +8 -0
- package/backend/dist/opencode/credentials/paths.js +10 -0
- package/backend/dist/opencode/credentials/sync.d.ts +1 -1
- package/backend/dist/opencode/credentials/sync.js +4 -4
- package/backend/dist/opencode/credentials/types.d.ts +40 -4
- package/backend/dist/opencode/probe.d.ts +9 -5
- package/backend/dist/opencode/probe.js +68 -15
- package/backend/dist/opencode/provider-defs.js +59 -2
- package/backend/dist/opencode/provider-package.d.ts +31 -0
- package/backend/dist/opencode/provider-package.js +70 -0
- package/backend/dist/opencode/user-config.d.ts +11 -17
- package/backend/dist/opencode/user-config.js +42 -66
- package/backend/dist/pipeline/credential-selection.d.ts +13 -0
- package/backend/dist/pipeline/credential-selection.js +29 -1
- package/backend/dist/pipeline/directives.d.ts +14 -22
- package/backend/dist/pipeline/directives.js +122 -68
- package/backend/dist/pipeline/orchestrator.d.ts +42 -7
- package/backend/dist/pipeline/orchestrator.js +736 -235
- package/backend/dist/pipeline/prompt-optimizer.d.ts +6 -13
- package/backend/dist/pipeline/prompt-optimizer.js +9 -52
- package/backend/dist/pipeline/streaming-posture.d.ts +29 -0
- package/backend/dist/pipeline/streaming-posture.js +27 -0
- package/backend/dist/pipeline/tool-pairing.d.ts +10 -0
- package/backend/dist/pipeline/tool-pairing.js +90 -0
- package/backend/dist/plugins/builtin/model-gateway.d.ts +30 -0
- package/backend/dist/plugins/builtin/model-gateway.js +98 -0
- package/backend/dist/plugins/config.d.ts +41 -0
- package/backend/dist/plugins/config.js +113 -0
- package/backend/dist/plugins/gateways.d.ts +98 -0
- package/backend/dist/plugins/gateways.js +151 -0
- package/backend/dist/plugins/host.d.ts +203 -0
- package/backend/dist/plugins/host.js +1310 -0
- package/backend/dist/plugins/manifest.d.ts +43 -0
- package/backend/dist/plugins/manifest.js +462 -0
- package/backend/dist/plugins/pack.d.ts +32 -0
- package/backend/dist/plugins/pack.js +222 -0
- package/backend/dist/plugins/seed.d.ts +53 -0
- package/backend/dist/plugins/seed.js +136 -0
- package/backend/dist/plugins/types.d.ts +721 -0
- package/backend/dist/plugins/types.js +1 -0
- package/backend/dist/projects/store.d.ts +56 -0
- package/backend/dist/projects/store.js +194 -0
- package/backend/dist/projects/types.d.ts +12 -0
- package/backend/dist/projects/types.js +1 -0
- package/backend/dist/protocols/chat-compat.d.ts +2 -0
- package/backend/dist/protocols/chat-compat.js +137 -0
- package/backend/dist/protocols/systemone/convert.d.ts +5 -4
- package/backend/dist/protocols/systemone/convert.js +72 -26
- package/backend/dist/protocols/systemone/decide.js +128 -51
- package/backend/dist/protocols/systemone/native.d.ts +1 -1
- package/backend/dist/protocols/systemone/native.js +6 -6
- package/backend/dist/providers/anthropic.js +6 -6
- package/backend/dist/providers/base.d.ts +8 -47
- package/backend/dist/providers/boot-direct.d.ts +20 -2
- package/backend/dist/providers/boot-direct.js +72 -23
- package/backend/dist/providers/compat/tool-markup-leak.d.ts +41 -0
- package/backend/dist/providers/compat/tool-markup-leak.js +57 -0
- package/backend/dist/providers/compat/tool-markup-recovery.d.ts +27 -0
- package/backend/dist/providers/compat/tool-markup-recovery.js +831 -0
- package/backend/dist/providers/dispatch.d.ts +5 -8
- package/backend/dist/providers/dispatch.js +18 -12
- package/backend/dist/providers/executors/anthropic-messages.d.ts +12 -0
- package/backend/dist/providers/executors/anthropic-messages.js +56 -0
- package/backend/dist/providers/executors/dispatch.d.ts +14 -0
- package/backend/dist/providers/executors/dispatch.js +71 -0
- package/backend/dist/providers/executors/google-gemini.d.ts +12 -0
- package/backend/dist/providers/executors/google-gemini.js +53 -0
- package/backend/dist/providers/executors/http-json.d.ts +19 -0
- package/backend/dist/providers/executors/http-json.js +125 -0
- package/backend/dist/providers/executors/http-stream.d.ts +53 -0
- package/backend/dist/providers/executors/http-stream.js +472 -0
- package/backend/dist/providers/executors/openai-chat.d.ts +13 -0
- package/backend/dist/providers/executors/openai-chat.js +89 -0
- package/backend/dist/providers/executors/openai-responses.d.ts +12 -0
- package/backend/dist/providers/executors/openai-responses.js +71 -0
- package/backend/dist/providers/executors/plugin-adapter.d.ts +9 -0
- package/backend/dist/providers/executors/plugin-adapter.js +31 -0
- package/backend/dist/providers/google.js +6 -6
- package/backend/dist/providers/openai-compatible.js +13 -13
- package/backend/dist/providers/opencode-proxy.js +6 -6
- package/backend/dist/providers/plugin-wires.d.ts +34 -0
- package/backend/dist/providers/plugin-wires.js +82 -0
- package/backend/dist/providers/pool-refresh.d.ts +14 -0
- package/backend/dist/providers/pool-refresh.js +13 -0
- package/backend/dist/providers/protocol.d.ts +4 -0
- package/backend/dist/providers/protocol.js +61 -0
- package/backend/dist/providers/provider-takedown.d.ts +59 -0
- package/backend/dist/providers/provider-takedown.js +135 -0
- package/backend/dist/providers/registry.d.ts +37 -21
- package/backend/dist/providers/registry.js +204 -109
- package/backend/dist/providers/responses.d.ts +4 -2
- package/backend/dist/providers/responses.js +12 -9
- package/backend/dist/providers/vocabulary.d.ts +24 -6
- package/backend/dist/providers/vocabulary.js +75 -33
- package/backend/dist/providers/wire.d.ts +12 -17
- package/backend/dist/providers/wire.js +43 -91
- package/backend/dist/proxy/manual-node-spec.d.ts +92 -0
- package/backend/dist/proxy/manual-node-spec.js +408 -0
- package/backend/dist/proxy/mihomo-binary.d.ts +39 -0
- package/backend/dist/proxy/mihomo-binary.js +267 -0
- package/backend/dist/proxy/mihomo-client.d.ts +94 -0
- package/backend/dist/proxy/mihomo-client.js +294 -0
- package/backend/dist/proxy/mihomo-config.d.ts +40 -0
- package/backend/dist/proxy/mihomo-config.js +152 -0
- package/backend/dist/proxy/mihomo-pac.d.ts +26 -0
- package/backend/dist/proxy/mihomo-pac.js +60 -0
- package/backend/dist/proxy/mihomo-rules-import.d.ts +43 -0
- package/backend/dist/proxy/mihomo-rules-import.js +193 -0
- package/backend/dist/proxy/mihomo-sidecar.d.ts +65 -0
- package/backend/dist/proxy/mihomo-sidecar.js +515 -0
- package/backend/dist/quota/engine.d.ts +9 -2
- package/backend/dist/quota/engine.js +19 -1
- package/backend/dist/quota/prober.d.ts +8 -4
- package/backend/dist/quota/prober.js +9 -10
- package/backend/dist/ratelimit/rate-limiter.d.ts +119 -6
- package/backend/dist/ratelimit/rate-limiter.js +358 -20
- package/backend/dist/ratelimit/window-store.d.ts +34 -0
- package/backend/dist/ratelimit/window-store.js +70 -0
- package/backend/dist/resilience/breaker-state.js +8 -1
- package/backend/dist/resilience/circuit-breaker-manager.d.ts +229 -132
- package/backend/dist/resilience/circuit-breaker-manager.js +566 -297
- package/backend/dist/resilience/circuit-breaker.d.ts +11 -0
- package/backend/dist/resilience/circuit-breaker.js +39 -7
- package/backend/dist/resilience/error-classifier.d.ts +31 -3
- package/backend/dist/resilience/error-classifier.js +159 -31
- package/backend/dist/resilience/health-prober.d.ts +21 -4
- package/backend/dist/resilience/health-prober.js +100 -18
- package/backend/dist/resilience/types.d.ts +56 -9
- package/backend/dist/resilience/types.js +1 -1
- package/backend/dist/router/index.d.ts +6 -29
- package/backend/dist/router/index.js +15 -61
- package/backend/dist/router/layer2-decision.d.ts +2 -2
- package/backend/dist/router/layer2-decision.js +22 -19
- package/backend/dist/router/request-traits.d.ts +4 -11
- package/backend/dist/router/request-traits.js +5 -13
- package/backend/dist/routes/console.js +1948 -253
- package/backend/dist/routes/environments.d.ts +3 -2
- package/backend/dist/routes/environments.js +8 -4
- package/backend/dist/routes/harness.d.ts +3 -1
- package/backend/dist/routes/harness.js +1164 -355
- package/backend/dist/routes/mihomo.d.ts +5 -0
- package/backend/dist/routes/mihomo.js +882 -0
- package/backend/dist/routes/projects.d.ts +2 -0
- package/backend/dist/routes/projects.js +90 -0
- package/backend/dist/routes/responses.d.ts +20 -1
- package/backend/dist/routes/responses.js +65 -3
- package/backend/dist/routes/translation.d.ts +9 -0
- package/backend/dist/routes/translation.js +155 -0
- package/backend/dist/server.d.ts +0 -15
- package/backend/dist/server.js +388 -105
- package/backend/dist/session/resp-store.d.ts +18 -49
- package/backend/dist/session/resp-store.js +114 -122
- package/backend/dist/session/session-manager.d.ts +237 -81
- package/backend/dist/session/session-manager.js +445 -180
- package/backend/dist/session/session-row.d.ts +157 -0
- package/backend/dist/session/session-row.js +120 -0
- package/backend/dist/surfaces/anthropic.d.ts +1 -15
- package/backend/dist/surfaces/anthropic.js +63 -44
- package/backend/dist/surfaces/chat-pipeline.d.ts +8 -4
- package/backend/dist/surfaces/chat-pipeline.js +102 -35
- package/backend/dist/surfaces/chat.d.ts +1 -9
- package/backend/dist/surfaces/chat.js +52 -29
- package/backend/dist/surfaces/decision-pipeline.js +26 -18
- package/backend/dist/surfaces/gateway-chat.d.ts +53 -0
- package/backend/dist/surfaces/gateway-chat.js +204 -0
- package/backend/dist/surfaces/ocr-headers.d.ts +25 -4
- package/backend/dist/surfaces/ocr-headers.js +52 -6
- package/backend/dist/surfaces/responses.d.ts +9 -1
- package/backend/dist/surfaces/responses.js +141 -141
- package/backend/dist/surfaces/systemone-probe.js +1 -1
- package/backend/dist/surfaces/systemone.d.ts +1 -1
- package/backend/dist/surfaces/systemone.js +1 -1
- package/backend/dist/surfaces/table.d.ts +15 -0
- package/backend/dist/surfaces/table.js +15 -0
- package/backend/dist/surfaces/transport-backpressure.d.ts +46 -0
- package/backend/dist/surfaces/transport-backpressure.js +122 -0
- package/backend/dist/surfaces/transport-fastify.js +92 -21
- package/backend/dist/surfaces/transport-node-http.js +92 -18
- package/backend/dist/surfaces/types.d.ts +74 -12
- package/backend/dist/trace/persist.d.ts +5 -0
- package/backend/dist/trace/persist.js +185 -24
- package/backend/dist/trace/tracker.d.ts +153 -16
- package/backend/dist/trace/tracker.js +77 -27
- package/backend/dist/translation/index.d.ts +151 -0
- package/backend/dist/translation/index.js +735 -0
- package/backend/dist/types/openai.d.ts +82 -1
- package/backend/dist/types/router.d.ts +71 -6
- package/backend/dist/types/router.js +33 -1
- package/backend/dist/update/check.d.ts +43 -0
- package/backend/dist/update/check.js +126 -0
- package/backend/dist/utils/chat-sse.d.ts +2 -22
- package/backend/dist/utils/chat-sse.js +1 -69
- package/backend/dist/utils/chat-stream.d.ts +2 -1
- package/backend/dist/utils/client-envelope.d.ts +108 -0
- package/backend/dist/utils/client-envelope.js +305 -0
- package/backend/dist/utils/event-ring.d.ts +8 -1
- package/backend/dist/utils/event-ring.js +13 -5
- package/backend/dist/utils/harness-profiles.d.ts +51 -0
- package/backend/dist/utils/harness-profiles.js +70 -0
- package/backend/dist/utils/percentile.d.ts +16 -0
- package/backend/dist/utils/percentile.js +29 -0
- package/backend/dist/utils/popularity.d.ts +4 -0
- package/backend/dist/utils/popularity.js +33 -0
- package/backend/dist/utils/probe-interval.d.ts +12 -0
- package/backend/dist/utils/probe-interval.js +16 -0
- package/backend/dist/utils/proxy-node.d.ts +13 -0
- package/backend/dist/utils/proxy-node.js +471 -0
- package/backend/dist/utils/proxy.d.ts +12 -0
- package/backend/dist/utils/proxy.js +44 -4
- package/backend/dist/utils/run-command.d.ts +42 -0
- package/backend/dist/utils/run-command.js +93 -0
- package/backend/dist/utils/self-url.d.ts +13 -0
- package/backend/dist/utils/self-url.js +90 -2
- package/backend/dist/utils/semver.d.ts +22 -0
- package/backend/dist/utils/semver.js +75 -0
- package/backend/dist/utils/stream-relay.d.ts +35 -0
- package/backend/dist/utils/stream-relay.js +1 -0
- package/backend/dist/utils/upstream-url-guard.d.ts +15 -0
- package/backend/dist/utils/upstream-url-guard.js +107 -0
- package/backend/dist/validator/parser.d.ts +2 -5
- package/backend/dist/validator/parser.js +12 -16
- package/backend/dist/validator/schema-assertion.d.ts +3 -2
- package/backend/dist/validator/schema-assertion.js +53 -8
- package/bin/ocr.js +2 -2
- package/frontend/dist/assets/index-CLvxJjp_.js +1476 -0
- package/frontend/dist/assets/index-CQSLGFTV.css +1 -0
- package/frontend/dist/assets/qoder.color-tVX5GCcD.svg +5 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/provider-logos/302ai.svg +7 -0
- package/frontend/dist/provider-logos/NOTICE.txt +39 -0
- package/frontend/dist/provider-logos/abacus.svg +14 -0
- package/frontend/dist/provider-logos/abliteration-ai.svg +6 -0
- package/frontend/dist/provider-logos/above.svg +3 -0
- package/frontend/dist/provider-logos/agentrouter.svg +4 -0
- package/frontend/dist/provider-logos/agnes.svg +1 -0
- package/frontend/dist/provider-logos/ai-router.svg +5 -0
- package/frontend/dist/provider-logos/ai21.svg +3 -0
- package/frontend/dist/provider-logos/aiand.svg +4 -0
- package/frontend/dist/provider-logos/aihubmix.svg +3 -0
- package/frontend/dist/provider-logos/aimlapi.svg +3 -0
- package/frontend/dist/provider-logos/ainetcafe.svg +1 -0
- package/frontend/dist/provider-logos/aixy.svg +4 -0
- package/frontend/dist/provider-logos/aki-io.svg +8 -0
- package/frontend/dist/provider-logos/alibaba-cn.svg +3 -0
- package/frontend/dist/provider-logos/alibaba-coding-plan-cn.svg +3 -0
- package/frontend/dist/provider-logos/alibaba-coding-plan.svg +3 -0
- package/frontend/dist/provider-logos/alibaba-token-plan-cn.svg +1 -0
- package/frontend/dist/provider-logos/alibaba-token-plan.svg +1 -0
- package/frontend/dist/provider-logos/alibaba.svg +3 -0
- package/frontend/dist/provider-logos/amazon-bedrock.svg +3 -0
- package/frontend/dist/provider-logos/ambient.svg +3 -0
- package/frontend/dist/provider-logos/amd.svg +3 -0
- package/frontend/dist/provider-logos/anthropic.svg +3 -0
- package/frontend/dist/provider-logos/anyapi.svg +3 -0
- package/frontend/dist/provider-logos/arcee.svg +3 -0
- package/frontend/dist/provider-logos/atomic-chat.svg +1 -0
- package/frontend/dist/provider-logos/auriko.svg +6 -0
- package/frontend/dist/provider-logos/azure-cognitive-services.svg +3 -0
- package/frontend/dist/provider-logos/azure.svg +3 -0
- package/frontend/dist/provider-logos/bailing.svg +3 -0
- package/frontend/dist/provider-logos/baseten.svg +3 -0
- package/frontend/dist/provider-logos/bee.svg +1 -0
- package/frontend/dist/provider-logos/berget.svg +3 -0
- package/frontend/dist/provider-logos/blueclaw.svg +3 -0
- package/frontend/dist/provider-logos/bothub.svg +33 -0
- package/frontend/dist/provider-logos/boundless.svg +12 -0
- package/frontend/dist/provider-logos/cerebras.svg +4 -0
- package/frontend/dist/provider-logos/chutes.svg +24 -0
- package/frontend/dist/provider-logos/clarifai.svg +3 -0
- package/frontend/dist/provider-logos/claudinio.svg +19 -0
- package/frontend/dist/provider-logos/cline-pass.svg +24 -0
- package/frontend/dist/provider-logos/cloudferro-sherlock.svg +5 -0
- package/frontend/dist/provider-logos/cloudflare-ai-gateway.svg +4 -0
- package/frontend/dist/provider-logos/cloudflare-workers-ai.svg +4 -0
- package/frontend/dist/provider-logos/cohere.svg +5 -0
- package/frontend/dist/provider-logos/commandcode.svg +11 -0
- package/frontend/dist/provider-logos/coralbricks.svg +6 -0
- package/frontend/dist/provider-logos/cortecs.svg +24 -0
- package/frontend/dist/provider-logos/crossmodel.svg +5 -0
- package/frontend/dist/provider-logos/crusoe.svg +23 -0
- package/frontend/dist/provider-logos/daoxe.svg +3 -0
- package/frontend/dist/provider-logos/databricks.svg +3 -0
- package/frontend/dist/provider-logos/deepinfra.svg +4 -0
- package/frontend/dist/provider-logos/deepseek.svg +3 -0
- package/frontend/dist/provider-logos/digitalocean.svg +6 -0
- package/frontend/dist/provider-logos/dinference.svg +1 -0
- package/frontend/dist/provider-logos/drun.svg +8 -0
- package/frontend/dist/provider-logos/ebcloud.svg +8 -0
- package/frontend/dist/provider-logos/echo.svg +7 -0
- package/frontend/dist/provider-logos/edenai.svg +8 -0
- package/frontend/dist/provider-logos/empiriolabs.svg +1 -0
- package/frontend/dist/provider-logos/engy.svg +1 -0
- package/frontend/dist/provider-logos/evroc.svg +3 -0
- package/frontend/dist/provider-logos/fastrouter.svg +3 -0
- package/frontend/dist/provider-logos/fireworks-ai.svg +3 -0
- package/frontend/dist/provider-logos/freemodel.svg +3 -0
- package/frontend/dist/provider-logos/friendli.svg +3 -0
- package/frontend/dist/provider-logos/frogbot.svg +36 -0
- package/frontend/dist/provider-logos/github-copilot.svg +3 -0
- package/frontend/dist/provider-logos/gitlab.svg +3 -0
- package/frontend/dist/provider-logos/gmicloud.svg +24 -0
- package/frontend/dist/provider-logos/google-vertex-anthropic.svg +10 -0
- package/frontend/dist/provider-logos/google-vertex.svg +10 -0
- package/frontend/dist/provider-logos/google.svg +3 -0
- package/frontend/dist/provider-logos/greenpt.svg +6 -0
- package/frontend/dist/provider-logos/groq.svg +3 -0
- package/frontend/dist/provider-logos/helicone.svg +6 -0
- package/frontend/dist/provider-logos/hetzner.svg +3 -0
- package/frontend/dist/provider-logos/hopper.svg +4 -0
- package/frontend/dist/provider-logos/hpc-ai.svg +446 -0
- package/frontend/dist/provider-logos/huggingface.svg +3 -0
- package/frontend/dist/provider-logos/hyper.svg +20 -0
- package/frontend/dist/provider-logos/impossibl.svg +3 -0
- package/frontend/dist/provider-logos/inception.svg +14 -0
- package/frontend/dist/provider-logos/inceptron.svg +14 -0
- package/frontend/dist/provider-logos/inco.svg +3 -0
- package/frontend/dist/provider-logos/infer.svg +4 -0
- package/frontend/dist/provider-logos/inference.svg +3 -0
- package/frontend/dist/provider-logos/inferx.svg +5 -0
- package/frontend/dist/provider-logos/infomaniak.svg +3 -0
- package/frontend/dist/provider-logos/io-net.svg +5 -0
- package/frontend/dist/provider-logos/iteracompute.svg +7 -0
- package/frontend/dist/provider-logos/jalapeno.svg +8 -0
- package/frontend/dist/provider-logos/jiekou.svg +4 -0
- package/frontend/dist/provider-logos/kenari.svg +4 -0
- package/frontend/dist/provider-logos/kilo.svg +4 -0
- package/frontend/dist/provider-logos/kimi-code-plan-cn.svg +3 -0
- package/frontend/dist/provider-logos/kimi-code-plan-global.svg +3 -0
- package/frontend/dist/provider-logos/klokintegration.svg +11 -0
- package/frontend/dist/provider-logos/kosmik.svg +28 -0
- package/frontend/dist/provider-logos/kuae-cloud-coding-plan.svg +3 -0
- package/frontend/dist/provider-logos/lilac.svg +6 -0
- package/frontend/dist/provider-logos/liquid.svg +1 -0
- package/frontend/dist/provider-logos/llmgateway-providers.svg +6 -0
- package/frontend/dist/provider-logos/llmgateway.svg +6 -0
- package/frontend/dist/provider-logos/llmtech.svg +6 -0
- package/frontend/dist/provider-logos/llmtr.svg +12 -0
- package/frontend/dist/provider-logos/lmstudio.svg +3 -0
- package/frontend/dist/provider-logos/longcat.svg +6 -0
- package/frontend/dist/provider-logos/lowrouter.svg +8 -0
- package/frontend/dist/provider-logos/lucidquery.svg +3 -0
- package/frontend/dist/provider-logos/lynkr.svg +1 -0
- package/frontend/dist/provider-logos/meganova.svg +3 -0
- package/frontend/dist/provider-logos/melious.svg +3 -0
- package/frontend/dist/provider-logos/merge-gateway.svg +4 -0
- package/frontend/dist/provider-logos/meta.svg +3 -0
- package/frontend/dist/provider-logos/minimax-cn-coding-plan.svg +3 -0
- package/frontend/dist/provider-logos/minimax-cn.svg +3 -0
- package/frontend/dist/provider-logos/minimax-coding-plan.svg +3 -0
- package/frontend/dist/provider-logos/minimax.svg +3 -0
- package/frontend/dist/provider-logos/mistral.svg +3 -0
- package/frontend/dist/provider-logos/mixlayer.svg +9 -0
- package/frontend/dist/provider-logos/moark.svg +3 -0
- package/frontend/dist/provider-logos/modal.svg +3 -0
- package/frontend/dist/provider-logos/model-oracle-ai.svg +11 -0
- package/frontend/dist/provider-logos/modelis.svg +1 -0
- package/frontend/dist/provider-logos/modelscope.svg +5 -0
- package/frontend/dist/provider-logos/modular.svg +3 -0
- package/frontend/dist/provider-logos/moonshotai-cn.svg +3 -0
- package/frontend/dist/provider-logos/moonshotai.svg +3 -0
- package/frontend/dist/provider-logos/morph.svg +24 -0
- package/frontend/dist/provider-logos/munito-eu.svg +1 -0
- package/frontend/dist/provider-logos/munito.svg +1 -0
- package/frontend/dist/provider-logos/nan.svg +1 -0
- package/frontend/dist/provider-logos/nano-gpt.svg +3 -0
- package/frontend/dist/provider-logos/nearai.svg +1 -0
- package/frontend/dist/provider-logos/nebius.svg +4 -0
- package/frontend/dist/provider-logos/neon.svg +3 -0
- package/frontend/dist/provider-logos/neosmith.svg +6 -0
- package/frontend/dist/provider-logos/neuralwatt.svg +27 -0
- package/frontend/dist/provider-logos/nova.svg +3 -0
- package/frontend/dist/provider-logos/novita-ai.svg +10 -0
- package/frontend/dist/provider-logos/nvidia.svg +3 -0
- package/frontend/dist/provider-logos/oci.svg +3 -0
- package/frontend/dist/provider-logos/ofox.svg +5 -0
- package/frontend/dist/provider-logos/ollama-cloud.svg +7 -0
- package/frontend/dist/provider-logos/openai.svg +3 -0
- package/frontend/dist/provider-logos/opencode-go.svg +4 -0
- package/frontend/dist/provider-logos/opencode.svg +4 -0
- package/frontend/dist/provider-logos/openreason.svg +8 -0
- package/frontend/dist/provider-logos/openrouter.svg +5 -0
- package/frontend/dist/provider-logos/opper.svg +3 -0
- package/frontend/dist/provider-logos/orcarouter.svg +2 -0
- package/frontend/dist/provider-logos/ovhcloud.svg +3 -0
- package/frontend/dist/provider-logos/pareto.svg +5 -0
- package/frontend/dist/provider-logos/pendra.svg +10 -0
- package/frontend/dist/provider-logos/perplexity-agent.svg +3 -0
- package/frontend/dist/provider-logos/perplexity.svg +3 -0
- package/frontend/dist/provider-logos/pioneer.svg +3 -0
- package/frontend/dist/provider-logos/poe.svg +7 -0
- package/frontend/dist/provider-logos/poolside.svg +3 -0
- package/frontend/dist/provider-logos/prime.svg +7 -0
- package/frontend/dist/provider-logos/privatemode-ai.svg +5 -0
- package/frontend/dist/provider-logos/qihang-ai.svg +9 -0
- package/frontend/dist/provider-logos/qiniu-ai.svg +7 -0
- package/frontend/dist/provider-logos/qvac.svg +6 -0
- package/frontend/dist/provider-logos/reflection.svg +3 -0
- package/frontend/dist/provider-logos/regolo-ai.svg +46 -0
- package/frontend/dist/provider-logos/requesty.svg +24 -0
- package/frontend/dist/provider-logos/routing-run.svg +4 -0
- package/frontend/dist/provider-logos/runinfra.svg +10 -0
- package/frontend/dist/provider-logos/sakana.svg +24 -0
- package/frontend/dist/provider-logos/salad-cloud.svg +15 -0
- package/frontend/dist/provider-logos/sambanova.svg +26 -0
- package/frontend/dist/provider-logos/sap-ai-core.svg +24 -0
- package/frontend/dist/provider-logos/sarvam.svg +24 -0
- package/frontend/dist/provider-logos/scaleway.svg +5 -0
- package/frontend/dist/provider-logos/scnet-token-plan.svg +8 -0
- package/frontend/dist/provider-logos/scx-ai.svg +1 -0
- package/frontend/dist/provider-logos/sensenova.svg +18 -0
- package/frontend/dist/provider-logos/siliconflow-cn.svg +3 -0
- package/frontend/dist/provider-logos/siliconflow.svg +3 -0
- package/frontend/dist/provider-logos/snowflake-cortex.svg +3 -0
- package/frontend/dist/provider-logos/stackit.svg +4 -0
- package/frontend/dist/provider-logos/standardcompute.svg +5 -0
- package/frontend/dist/provider-logos/stepfun-ai-step-plan.svg +16 -0
- package/frontend/dist/provider-logos/stepfun-ai.svg +16 -0
- package/frontend/dist/provider-logos/stepfun-step-plan.svg +16 -0
- package/frontend/dist/provider-logos/stepfun.svg +16 -0
- package/frontend/dist/provider-logos/subconscious.svg +3 -0
- package/frontend/dist/provider-logos/submodel.svg +3 -0
- package/frontend/dist/provider-logos/synthetic.svg +24 -0
- package/frontend/dist/provider-logos/tempr.svg +4 -0
- package/frontend/dist/provider-logos/tencent-coding-plan.svg +5 -0
- package/frontend/dist/provider-logos/tencent-token-plan.svg +3 -0
- package/frontend/dist/provider-logos/tencent-tokenhub.svg +3 -0
- package/frontend/dist/provider-logos/tensorx.svg +6 -0
- package/frontend/dist/provider-logos/the-grid-ai.svg +14 -0
- package/frontend/dist/provider-logos/thinkingmachines.svg +3 -0
- package/frontend/dist/provider-logos/tinfoil.svg +3 -0
- package/frontend/dist/provider-logos/togetherai.svg +4 -0
- package/frontend/dist/provider-logos/tokengo.svg +3 -0
- package/frontend/dist/provider-logos/tokenrouter.svg +4 -0
- package/frontend/dist/provider-logos/trustedrouter.svg +4 -0
- package/frontend/dist/provider-logos/umans-ai-coding-plan.svg +29 -0
- package/frontend/dist/provider-logos/umans-ai.svg +29 -0
- package/frontend/dist/provider-logos/unorouter.svg +7 -0
- package/frontend/dist/provider-logos/upstage.svg +24 -0
- package/frontend/dist/provider-logos/vancine.svg +6 -0
- package/frontend/dist/provider-logos/venice.svg +4 -0
- package/frontend/dist/provider-logos/vercel.svg +3 -0
- package/frontend/dist/provider-logos/vispark.svg +3 -0
- package/frontend/dist/provider-logos/vivgrid.svg +4 -0
- package/frontend/dist/provider-logos/volcengine-coding-plan.svg +1 -0
- package/frontend/dist/provider-logos/volcengine.svg +1 -0
- package/frontend/dist/provider-logos/vultr.svg +6 -0
- package/frontend/dist/provider-logos/wafer.ai.svg +3 -0
- package/frontend/dist/provider-logos/wallaby.svg +4 -0
- package/frontend/dist/provider-logos/wally.svg +1 -0
- package/frontend/dist/provider-logos/wandb.svg +6 -0
- package/frontend/dist/provider-logos/watsonx.svg +5 -0
- package/frontend/dist/provider-logos/xai.svg +3 -0
- package/frontend/dist/provider-logos/xiaomi-token-plan-ams.svg +3 -0
- package/frontend/dist/provider-logos/xiaomi-token-plan-cn.svg +3 -0
- package/frontend/dist/provider-logos/xiaomi-token-plan-sgp.svg +3 -0
- package/frontend/dist/provider-logos/xiaomi.svg +3 -0
- package/frontend/dist/provider-logos/xpersona.svg +8 -0
- package/frontend/dist/provider-logos/zai-coding-plan.svg +3 -0
- package/frontend/dist/provider-logos/zai.svg +3 -0
- package/frontend/dist/provider-logos/zeldoc.svg +3 -0
- package/frontend/dist/provider-logos/zenifra.svg +4 -0
- package/frontend/dist/provider-logos/zenmux.svg +4 -0
- package/frontend/dist/provider-logos/zhipuai-coding-plan.svg +3 -0
- package/frontend/dist/provider-logos/zhipuai.svg +3 -0
- package/package.json +13 -5
- package/backend/dist/cli/clients/opencode-proxy.d.ts +0 -16
- package/backend/dist/cli/clients/opencode-proxy.js +0 -372
- package/backend/dist/forward-proxy/bypass.d.ts +0 -20
- package/backend/dist/forward-proxy/bypass.js +0 -28
- package/backend/dist/harness/adapters/amp.d.ts +0 -2
- package/backend/dist/harness/adapters/amp.js +0 -7
- package/backend/dist/harness/adapters/claude.d.ts +0 -2
- package/backend/dist/harness/adapters/claude.js +0 -7
- package/backend/dist/harness/adapters/cline.d.ts +0 -2
- package/backend/dist/harness/adapters/cline.js +0 -6
- package/backend/dist/harness/adapters/codex.d.ts +0 -2
- package/backend/dist/harness/adapters/codex.js +0 -6
- package/backend/dist/harness/adapters/cursor.d.ts +0 -5
- package/backend/dist/harness/adapters/cursor.js +0 -10
- package/backend/dist/harness/adapters/declarative.d.ts +0 -62
- package/backend/dist/harness/adapters/declarative.js +0 -202
- package/backend/dist/harness/adapters/dsh.d.ts +0 -5
- package/backend/dist/harness/adapters/dsh.js +0 -6
- package/backend/dist/harness/adapters/gemini-cli.d.ts +0 -2
- package/backend/dist/harness/adapters/gemini-cli.js +0 -7
- package/backend/dist/harness/adapters/github-copilot.d.ts +0 -5
- package/backend/dist/harness/adapters/github-copilot.js +0 -10
- package/backend/dist/harness/adapters/opencode.d.ts +0 -2
- package/backend/dist/harness/adapters/opencode.js +0 -55
- package/backend/dist/harness/adapters/pi.d.ts +0 -1
- package/backend/dist/harness/adapters/pi.js +0 -22
- package/backend/dist/harness/adapters/types.d.ts +0 -174
- package/backend/dist/harness/adapters/types.js +0 -12
- package/backend/dist/harness/adapters/universal.d.ts +0 -6
- package/backend/dist/harness/adapters/universal.js +0 -10
- package/backend/dist/harness/adapters/windsurf.d.ts +0 -2
- package/backend/dist/harness/adapters/windsurf.js +0 -10
- package/backend/dist/harness/adapters/zed.d.ts +0 -2
- package/backend/dist/harness/adapters/zed.js +0 -6
- package/backend/dist/harness/awesome-opencode.d.ts +0 -40
- package/backend/dist/harness/awesome-opencode.js +0 -75
- package/backend/dist/harness/browse.d.ts +0 -202
- package/backend/dist/harness/browse.js +0 -1214
- package/backend/dist/harness/inventory.d.ts +0 -10
- package/backend/dist/harness/opencode-cafe.d.ts +0 -40
- package/backend/dist/harness/opencode-cafe.js +0 -85
- package/backend/dist/harness/opencode-ecosystem.d.ts +0 -34
- package/backend/dist/harness/opencode-ecosystem.js +0 -246
- package/backend/dist/harness/pi-dev.d.ts +0 -81
- package/backend/dist/harness/pi-dev.js +0 -187
- package/backend/dist/harness/registry.js +0 -26
- package/backend/dist/harness/scopes.d.ts +0 -21
- package/backend/dist/harness/scopes.js +0 -22
- package/backend/dist/harness/skills-sh.d.ts +0 -109
- package/backend/dist/harness/skills-sh.js +0 -178
- package/backend/dist/harness/smithery.d.ts +0 -64
- package/backend/dist/harness/smithery.js +0 -146
- package/backend/dist/harness/sources/awesome-opencode.d.ts +0 -11
- package/backend/dist/harness/sources/awesome-opencode.js +0 -39
- package/backend/dist/harness/sources/mcp-official.d.ts +0 -2
- package/backend/dist/harness/sources/mcp-official.js +0 -110
- package/backend/dist/harness/sources/npm.d.ts +0 -2
- package/backend/dist/harness/sources/opencode-cafe.d.ts +0 -11
- package/backend/dist/harness/sources/opencode-cafe.js +0 -41
- package/backend/dist/harness/sources/smithery.d.ts +0 -2
- package/backend/dist/harness/sources/smithery.js +0 -81
- package/backend/dist/harness/writers/extension.d.ts +0 -116
- package/backend/dist/harness/writers/extension.js +0 -219
- package/backend/dist/harness/writers/mcp.d.ts +0 -72
- package/backend/dist/harness/writers/mcp.js +0 -195
- package/backend/dist/observability/trace-id.d.ts +0 -40
- package/backend/dist/observability/trace-id.js +0 -134
- package/frontend/dist/assets/index-1o7qI-KJ.css +0 -1
- package/frontend/dist/assets/index-DvXKvNxl.js +0 -962
- package/frontend/dist/assets/inter-cyrillic-800-normal-C7MGvYyJ.woff2 +0 -0
- package/frontend/dist/assets/inter-cyrillic-800-normal-CCHyn08d.woff +0 -0
- package/frontend/dist/assets/inter-cyrillic-ext-800-normal-BZOjs1Xv.woff2 +0 -0
- package/frontend/dist/assets/inter-cyrillic-ext-800-normal-Ca-gJeZY.woff +0 -0
- package/frontend/dist/assets/inter-greek-800-normal-BU00tryP.woff +0 -0
- package/frontend/dist/assets/inter-greek-800-normal-CLIouy3y.woff2 +0 -0
- package/frontend/dist/assets/inter-greek-ext-800-normal-B--PVpEC.woff2 +0 -0
- package/frontend/dist/assets/inter-greek-ext-800-normal-DUe57HfS.woff +0 -0
- package/frontend/dist/assets/inter-latin-800-normal-BYj_oED-.woff2 +0 -0
- package/frontend/dist/assets/inter-latin-800-normal-D1mf63XC.woff +0 -0
- package/frontend/dist/assets/inter-latin-ext-800-normal-BOMpwxm3.woff +0 -0
- package/frontend/dist/assets/inter-latin-ext-800-normal-DZJjya6U.woff2 +0 -0
- package/frontend/dist/assets/inter-vietnamese-800-normal-Cm7tD1pz.woff2 +0 -0
- package/frontend/dist/assets/inter-vietnamese-800-normal-DDlpr_Ee.woff +0 -0
- /package/backend/dist/harness/{adapters → host/adapters}/skills-paths.d.ts +0 -0
- /package/backend/dist/harness/{adapters → host/adapters}/skills-paths.js +0 -0
- /package/backend/dist/harness/{skill-md.d.ts → skill/skill-md.d.ts} +0 -0
- /package/backend/dist/harness/{skill-md.js → skill/skill-md.js} +0 -0
|
@@ -1,253 +1,586 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getProject } from '../projects/store.js';
|
|
4
|
+
import { HOSTS } from '../harness/host/hosts.js';
|
|
5
|
+
import { popularityRank } from '../utils/popularity.js';
|
|
6
|
+
import { adapterFor, hostDetected, isPluginHost, isMcpHost, isSkillsHost, mcpHostIds, skillOwner, skillRootsFor, } from '../harness/host/adapters/index.js';
|
|
7
|
+
import { scanInventory } from '../harness/host/inventory.js';
|
|
8
|
+
import { claimsPath, manifestPath } from '../harness/host/manifest.js';
|
|
9
|
+
import { applyRemove, planRemove } from '../harness/host/maintenance.js';
|
|
10
|
+
import { isSupportedLang } from '../translation/index.js';
|
|
7
11
|
import { probeSystemoneDefault } from '../surfaces/systemone-probe.js';
|
|
8
|
-
import { browseSource } from '../harness/
|
|
9
|
-
import {
|
|
12
|
+
import { browseSource } from '../harness/common/market.js';
|
|
13
|
+
import { allHostProbes, createPluginAdapter, probeOptionsFor } from '../harness/plugin/adapters/index.js';
|
|
14
|
+
import { appendInstallLog, finishInstallLog, readInstallLog, startInstallLog } from '../harness/host/install-log.js';
|
|
15
|
+
import { fetchRepoStars, peekStarCache } from '../harness/common/stars.js';
|
|
10
16
|
import { readMarketDetail } from '../harness/detail.js';
|
|
11
|
-
import { installArtifact } from '../harness/install.js';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
17
|
+
import { installArtifact } from '../harness/host/install.js';
|
|
18
|
+
import { editMcpServer, readMcpEntry } from '../harness/host/mcp-edit.js';
|
|
19
|
+
import { callMcpTool, disconnectMcpSession, getMcpPrompt, inspectMcpServer, readMcpResource, } from '../harness/host/mcp-inspector.js';
|
|
20
|
+
import { searchMcpRegistry } from '../harness/host/mcp-registry.js';
|
|
21
|
+
import { probeMcpCli } from '../harness/host/mcp-cli.js';
|
|
22
|
+
import { probeMcpRuntimes } from '../harness/host/mcp-runtime.js';
|
|
23
|
+
import { isProbeHost, probeTcp } from '../harness/tcp-reach.js';
|
|
24
|
+
import { mcpServerNameFromPackage } from '../harness/host/mcp-entry.js';
|
|
25
|
+
import { dbEngineFor, probeDatabase } from '../harness/db-probe.js';
|
|
26
|
+
import { recentApplies } from '../harness/host/ledger.js';
|
|
27
|
+
import { ENABLED_SCOPES, isEnabledScope } from '../harness/host/scopes.js';
|
|
28
|
+
import { MCP_DEFAULT_VIEWS, SKILL_VIEWS, SOURCES } from '../harness/common/source-views.js';
|
|
29
|
+
import { checkSkillSource, registerSkillSource, removeSkillSource, rescanSkillSource, skillSourceEntry, updateSkillSource, } from '../harness/skill/sources.js';
|
|
30
|
+
import { harvestAll } from '../harness/plugin/catalog.js';
|
|
31
|
+
import { browseMarketplace, getMarketplaceEntry, listMarketplaceEntries, latestSnapshot, marketplaceSourceId, probeMarketplace, snapshotHistory, updateMarketplaceEntry, writeMcpSourceSnapshot, writeNpmSourceSnapshot, } from '../harness/common/market.js';
|
|
32
|
+
import { parseNpmSource, probeNpmSource } from '../harness/common/npm-source.js';
|
|
33
|
+
import { parsePypiSource, probePypiSource } from '../harness/common/pypi-source.js';
|
|
34
|
+
import { getBuiltinViewsForHarness } from '../harness/plugin/builtin.js';
|
|
35
|
+
import { reconcileMarketplaces } from '../harness/host/marketplace-sync.js';
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the project attribution one harness request claims.
|
|
38
|
+
*
|
|
39
|
+
* `projectRoot`/`projectId` arrive from the console and become the base a writer lands in or a scan
|
|
40
|
+
* reads; an unvalidated string would let a request aim either at any directory on the machine.
|
|
41
|
+
* A `projectId` is looked up in the registry (a stale id is an ERROR, never a silent global read),
|
|
42
|
+
* and a raw root must name an existing directory — the same rule install already enforced.
|
|
43
|
+
*/
|
|
44
|
+
function resolveProjectRoot(input, opts) {
|
|
45
|
+
const rawRoot = typeof input.projectRoot === 'string' ? input.projectRoot.trim() : '';
|
|
46
|
+
const rawId = typeof input.projectId === 'string' ? input.projectId.trim() : '';
|
|
47
|
+
let projectRoot;
|
|
48
|
+
if (rawRoot) {
|
|
49
|
+
projectRoot = path.resolve(rawRoot);
|
|
50
|
+
try {
|
|
51
|
+
if (!fs.statSync(projectRoot).isDirectory()) {
|
|
52
|
+
return { ok: false, message: `projectRoot is not a directory: ${projectRoot}` };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return { ok: false, message: `projectRoot does not exist: ${projectRoot}` };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (rawId) {
|
|
60
|
+
const proj = getProject(rawId);
|
|
61
|
+
if (!proj)
|
|
62
|
+
return { ok: false, message: `projectId '${rawId}' not found` };
|
|
63
|
+
projectRoot = path.resolve(proj.path);
|
|
64
|
+
}
|
|
65
|
+
if (!projectRoot && opts.required) {
|
|
66
|
+
return { ok: false, message: 'projectRoot is required for project scope' };
|
|
67
|
+
}
|
|
68
|
+
return { ok: true, ...(projectRoot ? { projectRoot } : {}) };
|
|
69
|
+
}
|
|
14
70
|
/**
|
|
15
71
|
* Harness admin surface (ADR-0015): sources, hosts, inventory, install, uninstall, translate.
|
|
16
72
|
*
|
|
17
|
-
* Install goes through the source SPI (adapter.resolve → kind writer). MCP/
|
|
73
|
+
* Install goes through the source SPI (adapter.resolve → kind writer). MCP/plugin writers land
|
|
18
74
|
* with their milestones; a request they cannot serve answers `unsupported_source`/`unsupported_kind`
|
|
19
75
|
* — an endpoint that accepts a plan it cannot execute would be worse than a typed refusal.
|
|
20
76
|
*
|
|
21
|
-
* Measured accessibility, 2026-10-24:
|
|
22
|
-
* anonymous
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `skills.sh`'s leaderboard PAGES 200 anonymous (`/`, `/trending`, `/hot`, each shipping its 600-row
|
|
26
|
-
* board in the RSC flight payload) and so does its own search endpoint (`/api/search`, 200 anonymous,
|
|
27
|
-
* capped at 200 rows per query) even though its API stays closed. Measured the same day, ClawHub's
|
|
77
|
+
* Measured accessibility, 2026-10-24: npm registry 200
|
|
78
|
+
* anonymous. Measured 2026-10-25: `pi.dev/packages` 200 anonymous
|
|
79
|
+
* (server-rendered HTML, no JSON API — the reader keys off the catalog's own card attributes).
|
|
80
|
+
* Measured the same day, ClawHub's
|
|
28
81
|
* public v1 API (`clawhub.ai`) answers 200 anonymous throughout — cursor-paged catalog, capped
|
|
29
82
|
* whole-catalog search, and deterministic per-version ZIP downloads (3000 reads/min/IP).
|
|
30
|
-
* The curated OpenCode catalog is
|
|
31
|
-
* NOT a network source: it ships as a snapshot
|
|
32
|
-
* (`harness/opencode-ecosystem.ts`), because `raw.githubusercontent.com` and `cdn.jsdelivr.net` both
|
|
33
|
-
* reset the connection from here.
|
|
34
83
|
*/
|
|
35
84
|
/**
|
|
36
85
|
* The array order IS the console's display order and landing priority: per axis, the chip row
|
|
37
86
|
* follows this sequence and the market opens on the FIRST enabled+browsable source for that axis.
|
|
38
87
|
* The principle is low-noise first — within an axis, the order follows how far a row's claim
|
|
39
|
-
* reaches: a catalog whose row IS the artifact (an official catalog, a
|
|
88
|
+
* reaches: a catalog whose row IS the artifact (an official catalog, a
|
|
40
89
|
* leaderboard entry) outranks a search over containers that CARRY the artifact (github's
|
|
41
90
|
* topic-qualified repo search — the topic is self-declared, the stars reward the repo), which
|
|
42
91
|
* outranks the one source that searches an entire package registry: npm, the wide net, is LAST
|
|
43
92
|
* on purpose.
|
|
44
93
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// own install tally. github's topic-qualified search answers with REPOS that self-declare the
|
|
66
|
-
// topic — a noisier unit, one repo holding any number of skills or none — and npm's
|
|
67
|
-
// registry-wide keyword search (whose rows cannot install as skills at all) is the wide net
|
|
68
|
-
// below that.
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: 'clawhub',
|
|
72
|
-
label: 'ClawHub',
|
|
73
|
-
kinds: ['skill'],
|
|
94
|
+
/** One operator git-marketplace chip, materialized from the store: enabled state from the entry,
|
|
95
|
+
* browsable only once a probe has left a snapshot to browse. */
|
|
96
|
+
function mpSourceView(slug) {
|
|
97
|
+
const entry = getMarketplaceEntry(slug);
|
|
98
|
+
if (!entry)
|
|
99
|
+
return undefined;
|
|
100
|
+
const snap = latestSnapshot(slug, entry.harness);
|
|
101
|
+
const mcp = entry.axis === 'mcp';
|
|
102
|
+
const packageType = entry.type === 'npm' || entry.type === 'pypi' ? entry.type : null;
|
|
103
|
+
const label = mcp
|
|
104
|
+
? `${slug} (${packageType === 'pypi' ? 'PyPI' : 'npm'} MCP)`
|
|
105
|
+
: packageType === 'npm'
|
|
106
|
+
? `${slug} (npm)`
|
|
107
|
+
: `${slug} (git marketplace)`;
|
|
108
|
+
return {
|
|
109
|
+
catalog: entry.catalog ?? 'default',
|
|
110
|
+
id: marketplaceSourceId(slug),
|
|
111
|
+
label,
|
|
112
|
+
// A package entry carries packages only and serves ONE axis; a git entry may carry both kinds.
|
|
113
|
+
kinds: mcp ? ['mcp'] : packageType ? ['plugin'] : ['skill', 'plugin'],
|
|
74
114
|
trust: 'community',
|
|
75
115
|
auth: 'none',
|
|
76
|
-
enabled:
|
|
77
|
-
browsable:
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
id: 'smithery',
|
|
106
|
-
label: 'Smithery',
|
|
107
|
-
kinds: ['mcp'],
|
|
108
|
-
trust: 'aggregator',
|
|
109
|
-
auth: 'none',
|
|
110
|
-
enabled: true,
|
|
111
|
-
browsable: true,
|
|
112
|
-
// Browse reads `GET /servers?page=&pageSize=&q=` (200 anonymous, measured 2026-10-25). No `sorts`:
|
|
113
|
-
// the registry publishes one order (its own usage ranking) and no parameter to change it. The
|
|
114
|
-
// listing serves 500 rows at most while claiming ~20 765, so the market reports the REACHABLE count
|
|
115
|
-
// and says so (`noteCode: 'smithery-window'`). Install resolves `GET /servers/<qualifiedName>` and
|
|
116
|
-
// emits the HOSTED deployment plus an `Authorization` env reference — Smithery hosts these servers,
|
|
117
|
-
// which is why it is the one aggregator allowed to supply a launch spec (ADR-0015 §D6).
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: 'pi-dev',
|
|
121
|
-
label: 'pi.dev (official)',
|
|
122
|
-
kinds: ['extension'],
|
|
123
|
-
trust: 'official',
|
|
124
|
-
auth: 'none',
|
|
125
|
-
enabled: true,
|
|
126
|
-
browsable: true,
|
|
127
|
-
// The official Pi package catalog (`pi.dev/packages`): extensions plus untyped Pi packages, every
|
|
128
|
-
// row printed with its own `pi install npm:<pkg>` command. Rows therefore carry an `npm:<pkg>`
|
|
129
|
-
// handle and install through the npm source — one package, ONE identity, and the console's
|
|
130
|
-
// installed-state join stays exact. This source produces no payload of its own (browse-only).
|
|
131
|
-
//
|
|
132
|
-
// First for the extension axis on purpose: a pi page should open on its own official catalog, not
|
|
133
|
-
// on a keyword search of the whole npm registry.
|
|
134
|
-
hosts: ['pi'],
|
|
135
|
-
// The catalog's sort CONTROL offers three orders (`Most downloads` / `Recently published` / `A-Z`),
|
|
136
|
-
// which map to `?sort=downloads|recent|name` — measured 2026-10-25: each reorders the page, and an
|
|
137
|
-
// unknown value silently falls back to downloads. Those three are the source's whole official set.
|
|
138
|
-
sorts: ['downloads', 'recent', 'name'],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
id: 'github',
|
|
142
|
-
label: 'GitHub',
|
|
143
|
-
kinds: ['skill'],
|
|
144
|
-
trust: 'community',
|
|
145
|
-
auth: 'none',
|
|
146
|
-
enabled: true,
|
|
147
|
-
browsable: true,
|
|
148
|
-
// AFTER skills-sh and clawhub on the skills axis on purpose: both answer with rows that ARE
|
|
149
|
-
// skills — the leaderboard ranked by installs, the registry by its own tally — while a topic
|
|
150
|
-
// is self-declared on the REPO and a star count rewards the repo, not the skill. github is
|
|
151
|
-
// the wider net here, and npm — whose rows cannot install as skills at all — stays below it.
|
|
152
|
-
//
|
|
153
|
-
// GitHub search repositories is the ONE market source with a published ordering contract:
|
|
154
|
-
// `sort=stars|forks|help-wanted-issues|updated` (+ best-match when the parameter is omitted).
|
|
155
|
-
// ALL of them are offered — the official set is the ceiling, not a curation of it; `stars` stays
|
|
156
|
-
// first because it is what this market has always shown.
|
|
157
|
-
sorts: ['stars', 'best-match', 'forks', 'updated', 'help-wanted-issues'],
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: 'static-opencode',
|
|
161
|
-
label: 'OpenCode ecosystem (curated)',
|
|
162
|
-
kinds: ['extension'],
|
|
163
|
-
trust: 'community',
|
|
164
|
-
auth: 'none',
|
|
165
|
-
enabled: true,
|
|
166
|
-
browsable: true,
|
|
167
|
-
// The curated list is OpenCode's own plugin catalog: those packages are written against the
|
|
168
|
-
// OpenCode plugin API, so the source is bound to that one harness (ADR-0015 §D2 — no free host
|
|
169
|
-
// checkbox list). Browse reads a shipped snapshot (no network); a row that has a verified npm
|
|
170
|
-
// package name carries an `npm:<pkg>` install key, so installing it runs the npm source — this
|
|
171
|
-
// source produces no payload of its own and has no install adapter.
|
|
172
|
-
//
|
|
173
|
-
// First of the opencode cluster on purpose: a curated snapshot whose rows were verified
|
|
174
|
-
// against the registry is the lowest-noise answer for this runtime, so an opencode page opens
|
|
175
|
-
// on it — the community catalogs follow, and npm's registry-wide search closes the axis.
|
|
176
|
-
hosts: ['opencode'],
|
|
177
|
-
// Full-catalog sources are read WHOLE by the backend before paging, so an order computed here is
|
|
178
|
-
// global and honest (unlike a console-side re-sort of the visible page). `catalog` is the
|
|
179
|
-
// snapshot's own order; `name` is the one dimension these rows all carry.
|
|
180
|
-
sorts: ['catalog', 'name'],
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
id: 'awesome-opencode',
|
|
184
|
-
label: 'awesome-opencode (community)',
|
|
185
|
-
kinds: ['extension'],
|
|
186
|
-
trust: 'community',
|
|
187
|
-
auth: 'none',
|
|
188
|
-
enabled: true,
|
|
189
|
-
browsable: true,
|
|
190
|
-
// The community list publishes `dist/registry.json` — a flat array with a declared shape
|
|
191
|
-
// (`data/schema.json`), generated from one YAML file per entry. It is read through the GitHub
|
|
192
|
-
// contents API (raw mirrors reset from this environment). Entries carry no package name, so the
|
|
193
|
-
// install adapter resolves one on demand (declared name → repository-verified candidate) and
|
|
194
|
-
// answers the npm identity; the row's key stays this source's until install time.
|
|
195
|
-
hosts: ['opencode'],
|
|
196
|
-
sorts: ['catalog', 'name'],
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
id: 'opencode-cafe',
|
|
200
|
-
label: 'opencode.cafe (community)',
|
|
201
|
-
kinds: ['extension'],
|
|
202
|
-
trust: 'community',
|
|
203
|
-
auth: 'none',
|
|
204
|
-
enabled: true,
|
|
205
|
-
browsable: true,
|
|
206
|
-
// A Next.js site over a Convex deployment; the catalog query (`extensions:listAllApproved`) is
|
|
207
|
-
// anonymously readable and is read directly with a POST. Undocumented contract: a re-provisioned
|
|
208
|
-
// deployment answers `upstream`, never an empty catalog. Only `type: 'plugin'` rows are
|
|
209
|
-
// extensions. The public query ships author e-mail addresses, which `opencode-cafe.ts` narrows
|
|
210
|
-
// away before anything else sees a row.
|
|
211
|
-
hosts: ['opencode'],
|
|
212
|
-
sorts: ['catalog', 'name'],
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
id: 'npm',
|
|
216
|
-
label: 'npm registry',
|
|
217
|
-
kinds: ['skill', 'extension', 'mcp'],
|
|
218
|
-
trust: 'community',
|
|
219
|
-
auth: 'none',
|
|
220
|
-
enabled: true,
|
|
221
|
-
browsable: true,
|
|
222
|
-
// LAST in the array on purpose — the noisiest surface in the registry. An empty query is a
|
|
223
|
-
// relevance guess across the WHOLE npm registry (the pinned per-runtime tag below narrows it),
|
|
224
|
-
// it is bound to no runtime, and its search serves the most rows. Every source above pins its
|
|
225
|
-
// rows to the artifact kind harder than npm does, so npm is the wide net an operator opts
|
|
226
|
-
// into, never the landing state.
|
|
227
|
-
//
|
|
228
|
-
// npm's registry search has NO `sort` and its documented ranking weights are inert today
|
|
229
|
-
// (measured 2026-10-25). `name`/`updated` are therefore ordered by the BACKEND over one maximum
|
|
230
|
-
// window of the registry's own ranking — server-side, not in the page, and the note names the
|
|
231
|
-
// window. `relevance` is the registry's untouched order.
|
|
232
|
-
sorts: ['relevance', 'updated', 'name'],
|
|
233
|
-
// The MCP axis opens on the author's own `mcp-server` tag (measured 2026-10-25: 10 501
|
|
234
|
-
// packages; the wider `model-context-protocol` tag at 41 344 is mostly SDKs and clients), and
|
|
235
|
-
// an mcp row resolves to a launch over the pinned spec (`npx -y <pkg@version>` + integrity).
|
|
236
|
-
// No `hosts`: a package is not bound to a runtime until the operator names the harness, and
|
|
237
|
-
// only a runtime with a verified package-manager landing can take it.
|
|
238
|
-
},
|
|
239
|
-
];
|
|
240
|
-
export function registerHarnessRoutes(app) {
|
|
116
|
+
enabled: entry.enabled,
|
|
117
|
+
browsable: entry.enabled && snap !== null,
|
|
118
|
+
// MCP: one shared catalogue, listed on every host with a verified landing. A package source
|
|
119
|
+
// has no detected form set, so the landing table (not the snapshot) is the honest host claim.
|
|
120
|
+
hosts: mcp ? mcpHostIds() : entry.harness ? [entry.harness] : snap?.hosts,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** Re-read one MCP package source's row from its own registry (npm / PyPI). The source names ONE
|
|
124
|
+
* package, so the probe answers at most one row; a missing record is a probe failure, never an
|
|
125
|
+
* empty success. */
|
|
126
|
+
async function probeMcpPackage(entry, fetchImpl) {
|
|
127
|
+
if (entry.type === 'pypi') {
|
|
128
|
+
const query = parsePypiSource(entry.repo);
|
|
129
|
+
if (!query.ok)
|
|
130
|
+
return { ok: false, message: query.message };
|
|
131
|
+
const probed = await probePypiSource(query, fetchImpl);
|
|
132
|
+
return probed.ok ? { ok: true, row: probed.pkg } : { ok: false, message: probed.message };
|
|
133
|
+
}
|
|
134
|
+
const query = parseNpmSource(entry.repo);
|
|
135
|
+
if (!query.ok)
|
|
136
|
+
return { ok: false, message: query.message };
|
|
137
|
+
const probed = await probeNpmSource(query, fetchImpl);
|
|
138
|
+
const pkg = probed.ok ? probed.packages[0] : undefined;
|
|
139
|
+
if (!pkg) {
|
|
140
|
+
return { ok: false, message: probed.ok ? `'${entry.repo}' published no package record` : probed.message };
|
|
141
|
+
}
|
|
142
|
+
return { ok: true, row: { name: pkg.name, description: pkg.description, version: null } };
|
|
143
|
+
}
|
|
144
|
+
export function registerHarnessRoutes(app, opts = {}) {
|
|
241
145
|
// Source registry + health. The console derives its tab row from this, never from a hardcoded list.
|
|
242
|
-
app.get('/api/admin/harness/sources', async () => ({
|
|
146
|
+
app.get('/api/admin/harness/sources', async () => ({
|
|
147
|
+
status: 'ok',
|
|
148
|
+
sources: [...SOURCES, ...listMarketplaceEntries().map((e) => mpSourceView(e.slug))],
|
|
149
|
+
}));
|
|
150
|
+
// Per-harness plugin market (ADR-0015 §D10): the maintenance verbs live HERE, scoped to the
|
|
151
|
+
// harness whose market tab is showing them — never on a global surface. The adapter forwards to
|
|
152
|
+
// the SHARED marketplace store; the store being global is stated in §D11, and every mutation
|
|
153
|
+
// re-harvests all served harnesses' indexes so no sibling tab goes stale.
|
|
154
|
+
const pluginAdapterFor = (harness) => {
|
|
155
|
+
if (!HOSTS.some((h) => h.id === harness))
|
|
156
|
+
return undefined;
|
|
157
|
+
// The dialog maintains OPERATOR sources, so it always gets the writable chain: pi's official
|
|
158
|
+
// surface is read-only by contract, while its git-source chain is the one that can add/remove.
|
|
159
|
+
return createPluginAdapter(harness, opts.marketplaceFetch, { custom: true });
|
|
160
|
+
};
|
|
161
|
+
/** The entry behind a plugin-axis request: an entry whose snapshot carries no plugin or MCP row
|
|
162
|
+
* serves the skill axis only, so this route must not edit or delete it (§D11 route isolation). */
|
|
163
|
+
const pluginEntry = (slug, harness) => {
|
|
164
|
+
const entry = getMarketplaceEntry(slug, harness);
|
|
165
|
+
if (!entry)
|
|
166
|
+
return undefined;
|
|
167
|
+
const snap = latestSnapshot(slug, entry.axis === 'mcp' ? null : (entry.harness ?? harness));
|
|
168
|
+
const rows = (snap?.plugins.length ?? 0) + (snap?.mcps?.length ?? 0);
|
|
169
|
+
return rows > 0 ? entry : undefined;
|
|
170
|
+
};
|
|
171
|
+
// Per-harness sync: imports the marketplaces already configured in THIS harness's native
|
|
172
|
+
// environment and pushes OCR's registrations back into it (ADR-0015 §D9, one direction each).
|
|
173
|
+
app.get('/api/admin/harness/plugins/:harness/sources', async (req, reply) => {
|
|
174
|
+
const harnessParam = req.params.harness;
|
|
175
|
+
const adapter = pluginAdapterFor(harnessParam);
|
|
176
|
+
if (!adapter) {
|
|
177
|
+
reply.code(404);
|
|
178
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
179
|
+
}
|
|
180
|
+
// KIND isolation (§D11): this route is the PER-HARNESS surface (plugin, plus MCP views when a
|
|
181
|
+
// directory is wired). SKILLS are a GLOBAL directory with their OWN route (`/skills/sources`):
|
|
182
|
+
// they are never served from a harness-scoped endpoint, because a skill source is not any
|
|
183
|
+
// harness's private market. A source that cannot serve the open kind is noise, not information.
|
|
184
|
+
const kindQ = (req.query || {}).kind;
|
|
185
|
+
const kindOk = (kinds) => !kindQ || kinds.includes(kindQ);
|
|
186
|
+
const harness = harnessParam;
|
|
187
|
+
const perHarness = [...MCP_DEFAULT_VIEWS, ...getBuiltinViewsForHarness(harness)].filter((v) => !v.hosts || v.hosts.includes(harness));
|
|
188
|
+
return {
|
|
189
|
+
status: 'ok',
|
|
190
|
+
// This harness's published extension layer (`pi-extension`, `.claude-plugin`, …) or null.
|
|
191
|
+
// The dialog pre-fills the add form with it; the API never applies it implicitly.
|
|
192
|
+
extensionDir: adapter.extensionDir,
|
|
193
|
+
sources: perHarness.filter((s) => kindOk(s.kinds)).map((s) => ({
|
|
194
|
+
id: s.id,
|
|
195
|
+
label: s.label,
|
|
196
|
+
tier: 'federated',
|
|
197
|
+
sorts: s.sorts ?? [],
|
|
198
|
+
counts: false,
|
|
199
|
+
})),
|
|
200
|
+
operator: listMarketplaceEntries(harness)
|
|
201
|
+
.map((e) => {
|
|
202
|
+
const snap = latestSnapshot(e.slug, e.axis === 'mcp' ? null : harness);
|
|
203
|
+
// A plugin entry lists on a tab only when its snapshot detected that harness's form
|
|
204
|
+
// (pre-detection snapshots recorded nothing and keep the tolerant everywhere-visibility).
|
|
205
|
+
// An MCP package source is shared, so its host claim is the LANDING table instead.
|
|
206
|
+
const hosts = e.axis === 'mcp' ? mcpHostIds() : snap?.hosts ?? [];
|
|
207
|
+
if (!e.harness && hosts.length > 0 && !hosts.includes(harness))
|
|
208
|
+
return null;
|
|
209
|
+
const kinds = [
|
|
210
|
+
...((snap?.rows.length ?? 0) > 0 ? ['skill'] : []),
|
|
211
|
+
...((snap?.plugins.length ?? 0) > 0 ? ['plugin'] : []),
|
|
212
|
+
...((snap?.mcps?.length ?? 0) > 0 ? ['mcp'] : []),
|
|
213
|
+
];
|
|
214
|
+
return {
|
|
215
|
+
...e,
|
|
216
|
+
type: e.type ?? 'github',
|
|
217
|
+
/** Harnesses the repository's own forms declare (detected at probe time). */
|
|
218
|
+
hosts,
|
|
219
|
+
marketplace: snap?.marketplace ?? null,
|
|
220
|
+
kinds,
|
|
221
|
+
};
|
|
222
|
+
})
|
|
223
|
+
.filter((e) => e !== null && kindOk(e.kinds)),
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
// Full CRUD (§D11): the dialog edits the entry config in place — enable/disable and the rescan
|
|
227
|
+
// schedule are independent fields, updated through this PATCH without a whole-store replace.
|
|
228
|
+
app.patch('/api/admin/harness/plugins/:harness/sources/:slug', async (req, reply) => {
|
|
229
|
+
const harnessParam = req.params.harness;
|
|
230
|
+
const adapter = pluginAdapterFor(harnessParam);
|
|
231
|
+
if (!adapter) {
|
|
232
|
+
reply.code(404);
|
|
233
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
234
|
+
}
|
|
235
|
+
const { slug } = req.params;
|
|
236
|
+
const entry = pluginEntry(slug, harnessParam);
|
|
237
|
+
if (!entry) {
|
|
238
|
+
reply.code(404);
|
|
239
|
+
return { status: 'error', code: 'not_found', message: `no source '${slug}'` };
|
|
240
|
+
}
|
|
241
|
+
const body = (req.body || {});
|
|
242
|
+
const patch = {};
|
|
243
|
+
if (typeof body.enabled === 'boolean')
|
|
244
|
+
patch.enabled = body.enabled;
|
|
245
|
+
if (typeof body.catalog === 'string')
|
|
246
|
+
patch.catalog = body.catalog;
|
|
247
|
+
if (body.rescan)
|
|
248
|
+
patch.rescan = body.rescan;
|
|
249
|
+
if (Object.keys(patch).length === 0)
|
|
250
|
+
return { status: 'ok' };
|
|
251
|
+
if (!updateMarketplaceEntry(slug, patch, harnessParam)) {
|
|
252
|
+
reply.code(404);
|
|
253
|
+
return { status: 'error', code: 'not_found', message: `no source '${slug}'` };
|
|
254
|
+
}
|
|
255
|
+
// Enabling/disabling or re-cataloguing moves rows: every index re-reads the snapshot now.
|
|
256
|
+
harvestAll();
|
|
257
|
+
return { status: 'ok' };
|
|
258
|
+
});
|
|
259
|
+
// Manual rescan from the dialog (reports the diff: added / removed row counts).
|
|
260
|
+
app.post('/api/admin/harness/plugins/:harness/sources/:slug/rescan', async (req, reply) => {
|
|
261
|
+
const harnessParam = req.params.harness;
|
|
262
|
+
const adapter = pluginAdapterFor(harnessParam);
|
|
263
|
+
if (!adapter) {
|
|
264
|
+
reply.code(404);
|
|
265
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
266
|
+
}
|
|
267
|
+
const { slug } = req.params;
|
|
268
|
+
const entry = pluginEntry(slug, harnessParam);
|
|
269
|
+
if (!entry) {
|
|
270
|
+
reply.code(404);
|
|
271
|
+
return { status: 'error', code: 'not_found', message: `no source '${slug}'` };
|
|
272
|
+
}
|
|
273
|
+
// An MCP package source has no harness scope: its snapshot is the one every capable tab
|
|
274
|
+
// reads, so a rescan from any tab rewrites the global file (legacy harness snapshots stay
|
|
275
|
+
// readable through the global fallback but are never written again).
|
|
276
|
+
const scope = entry.axis === 'mcp' ? null : (entry.harness ?? harnessParam);
|
|
277
|
+
if (entry.type === 'npm' || entry.type === 'pypi') {
|
|
278
|
+
if (entry.axis === 'mcp') {
|
|
279
|
+
// An MCP package source's freshness is its registry read: one package, one rewritten row.
|
|
280
|
+
const probed = await probeMcpPackage(entry, opts.marketplaceFetch);
|
|
281
|
+
if (!probed.ok) {
|
|
282
|
+
reply.code(400);
|
|
283
|
+
return { status: 'error', code: 'probe_failed', message: probed.message };
|
|
284
|
+
}
|
|
285
|
+
writeMcpSourceSnapshot(slug, probed.row, scope);
|
|
286
|
+
return { status: 'ok', rows: 1 };
|
|
287
|
+
}
|
|
288
|
+
const parsed = parseNpmSource(entry.repo);
|
|
289
|
+
if (!parsed) {
|
|
290
|
+
reply.code(400);
|
|
291
|
+
return { status: 'error', code: 'invalid_source', message: 'invalid npm source spec' };
|
|
292
|
+
}
|
|
293
|
+
const probed = await probeNpmSource(parsed, opts.marketplaceFetch);
|
|
294
|
+
if (!probed.ok) {
|
|
295
|
+
reply.code(400);
|
|
296
|
+
return { status: 'error', code: 'probe_failed', message: probed.message };
|
|
297
|
+
}
|
|
298
|
+
writeNpmSourceSnapshot(slug, probed.packages, scope);
|
|
299
|
+
harvestAll();
|
|
300
|
+
return { status: 'ok', rows: probed.packages.length };
|
|
301
|
+
}
|
|
302
|
+
const prev = latestSnapshot(slug, scope);
|
|
303
|
+
const probe = await probeMarketplace(entry, opts.marketplaceFetch, {
|
|
304
|
+
...probeOptionsFor(entry.harness ?? harnessParam),
|
|
305
|
+
hosts: allHostProbes(),
|
|
306
|
+
});
|
|
307
|
+
if (!probe.ok) {
|
|
308
|
+
reply.code(400);
|
|
309
|
+
return { status: 'error', code: 'probe_failed', message: probe.message };
|
|
310
|
+
}
|
|
311
|
+
// The new snapshot is the index's input: re-harvest every served harness so a rescan that
|
|
312
|
+
// gained rows is visible in the catalog immediately.
|
|
313
|
+
harvestAll();
|
|
314
|
+
// Snapshots retain history: diff is against the IMMEDIATELY PRECEDING snapshot, not empty.
|
|
315
|
+
const added = prev ? probe.snapshot.rows.filter((r) => !prev.rows.some((p) => p.name === r.name)).map((r) => r.name) : [];
|
|
316
|
+
const removed = prev ? prev.rows.filter((p) => !probe.snapshot.rows.some((r) => r.name === p.name)).map((p) => p.name) : [];
|
|
317
|
+
return { status: 'ok', rows: probe.snapshot.rows.length, diff: { added, removed } };
|
|
318
|
+
});
|
|
319
|
+
// Snapshot ledger inspection: the dialog can render recent scans with their timestamps.
|
|
320
|
+
app.get('/api/admin/harness/plugins/:harness/sources/:slug/snapshots', async (req, reply) => {
|
|
321
|
+
const harnessParam = req.params.harness;
|
|
322
|
+
const adapter = pluginAdapterFor(harnessParam);
|
|
323
|
+
if (!adapter) {
|
|
324
|
+
reply.code(404);
|
|
325
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
326
|
+
}
|
|
327
|
+
const slug = req.params.slug;
|
|
328
|
+
const entry = getMarketplaceEntry(slug, harnessParam);
|
|
329
|
+
if (!entry) {
|
|
330
|
+
reply.code(404);
|
|
331
|
+
return { status: 'error', code: 'unknown_source', message: `unknown source '${slug}'` };
|
|
332
|
+
}
|
|
333
|
+
const history = snapshotHistory(slug, entry.axis === 'mcp' ? null : harnessParam);
|
|
334
|
+
return {
|
|
335
|
+
status: 'ok',
|
|
336
|
+
slug,
|
|
337
|
+
snapshots: history.map((s) => ({
|
|
338
|
+
probedAt: s.probedAt,
|
|
339
|
+
sha: s.sha,
|
|
340
|
+
rows: s.rows.length,
|
|
341
|
+
plugins: s.plugins?.length ?? 0,
|
|
342
|
+
stars: s.stars,
|
|
343
|
+
pushedAt: s.pushedAt,
|
|
344
|
+
marketplace: s.marketplace ?? null,
|
|
345
|
+
})),
|
|
346
|
+
};
|
|
347
|
+
});
|
|
348
|
+
// Register PROBES FIRST (an entry is written only when its repo answers a manifest or a
|
|
349
|
+
// SKILL.md scan) and re-harvests every served harness's index; duplicate slugs answer 409.
|
|
350
|
+
app.post('/api/admin/harness/plugins/:harness/sources', async (req, reply) => {
|
|
351
|
+
const adapter = pluginAdapterFor(req.params.harness);
|
|
352
|
+
if (!adapter) {
|
|
353
|
+
reply.code(404);
|
|
354
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
355
|
+
}
|
|
356
|
+
const body = (req.body || {});
|
|
357
|
+
if (!body.url) {
|
|
358
|
+
reply.code(400);
|
|
359
|
+
return { status: 'error', code: 'bad_request', message: 'url is required' };
|
|
360
|
+
}
|
|
361
|
+
const outcome = await adapter.registerSource(body.url, {
|
|
362
|
+
catalog: body.catalog,
|
|
363
|
+
rescan: body.rescan,
|
|
364
|
+
extensionDir: body.extensionDir,
|
|
365
|
+
...(body.type ? { type: body.type } : {}),
|
|
366
|
+
...(body.kind ? { kind: body.kind } : {}),
|
|
367
|
+
...(body.shared ? { shared: true } : {}),
|
|
368
|
+
});
|
|
369
|
+
if (!outcome.ok) {
|
|
370
|
+
const reason = outcome.reason;
|
|
371
|
+
// `no_form`/`probe_failed` are answers about the SOURCE; only a duplicate is a conflict.
|
|
372
|
+
const conflict = reason === 'already_configured' || reason === 'slug_taken';
|
|
373
|
+
reply.code(conflict ? 409 : 400);
|
|
374
|
+
return {
|
|
375
|
+
status: 'error',
|
|
376
|
+
code: conflict ? 'conflict' : 'bad_request',
|
|
377
|
+
reason,
|
|
378
|
+
params: outcome.params,
|
|
379
|
+
message: outcome.message ?? '',
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
return { status: 'ok', reason: outcome.reason, params: outcome.params, message: outcome.message };
|
|
383
|
+
});
|
|
384
|
+
// Dry-run probe: reports counts without writing anything (the operator's "check before add").
|
|
385
|
+
app.post('/api/admin/harness/plugins/:harness/sources/check', async (req, reply) => {
|
|
386
|
+
const adapter = pluginAdapterFor(req.params.harness);
|
|
387
|
+
if (!adapter) {
|
|
388
|
+
reply.code(404);
|
|
389
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
390
|
+
}
|
|
391
|
+
const body = (req.body || {});
|
|
392
|
+
if (!body.url) {
|
|
393
|
+
reply.code(400);
|
|
394
|
+
return { status: 'error', code: 'bad_request', message: 'url is required' };
|
|
395
|
+
}
|
|
396
|
+
const check = await adapter.checkSource(body.url, {
|
|
397
|
+
extensionDir: body.extensionDir,
|
|
398
|
+
...(body.type ? { type: body.type } : {}),
|
|
399
|
+
...(body.kind ? { kind: body.kind } : {}),
|
|
400
|
+
});
|
|
401
|
+
return { status: 'ok', ...check };
|
|
402
|
+
});
|
|
403
|
+
app.delete('/api/admin/harness/plugins/:harness/sources/:slug', async (req, reply) => {
|
|
404
|
+
const harnessParam = req.params.harness;
|
|
405
|
+
const adapter = pluginAdapterFor(harnessParam);
|
|
406
|
+
if (!adapter) {
|
|
407
|
+
reply.code(404);
|
|
408
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
409
|
+
}
|
|
410
|
+
const { slug } = req.params;
|
|
411
|
+
if (!pluginEntry(slug, harnessParam) || !adapter.unregisterSource(slug)) {
|
|
412
|
+
reply.code(404);
|
|
413
|
+
return { status: 'error', code: 'unknown_source', message: `unknown source '${slug}'` };
|
|
414
|
+
}
|
|
415
|
+
return { status: 'ok' };
|
|
416
|
+
});
|
|
417
|
+
app.post('/api/admin/harness/plugins/:harness/sources/sync', async (req, reply) => {
|
|
418
|
+
const harnessParam = req.params.harness;
|
|
419
|
+
if (!pluginAdapterFor(harnessParam)) {
|
|
420
|
+
reply.code(404);
|
|
421
|
+
return { status: 'error', code: 'unknown_harness', message: 'unknown harness' };
|
|
422
|
+
}
|
|
423
|
+
const report = await reconcileMarketplaces([harnessParam], opts.marketplaceFetch);
|
|
424
|
+
return { status: 'ok', ...report };
|
|
425
|
+
});
|
|
426
|
+
// ── Skill sources: the GLOBAL maintenance surface (§D11) ─────────────────────────────────────
|
|
427
|
+
// The skill axis is not harness-scoped, so these verbs carry NO `:harness`: the registry is
|
|
428
|
+
// code-configured (ClawHub) and an operator extension is a GitHub repository that publishes
|
|
429
|
+
// SKILL.md rows. Plugin maintenance lives under `/plugins/:harness/sources*`; the two surfaces
|
|
430
|
+
// never serve each other's axis.
|
|
431
|
+
app.get('/api/admin/harness/skills/sources', async () => ({
|
|
432
|
+
status: 'ok',
|
|
433
|
+
sources: SKILL_VIEWS.map((s) => ({
|
|
434
|
+
id: s.id,
|
|
435
|
+
label: s.label,
|
|
436
|
+
tier: 'federated',
|
|
437
|
+
sorts: s.sorts ?? [],
|
|
438
|
+
counts: false,
|
|
439
|
+
})),
|
|
440
|
+
operator: listMarketplaceEntries()
|
|
441
|
+
.map((e) => {
|
|
442
|
+
const snap = latestSnapshot(e.slug, e.harness);
|
|
443
|
+
const kinds = [
|
|
444
|
+
...((snap?.rows.length ?? 0) > 0 ? ['skill'] : []),
|
|
445
|
+
...((snap?.plugins.length ?? 0) > 0 ? ['plugin'] : []),
|
|
446
|
+
...((snap?.mcps?.length ?? 0) > 0 ? ['mcp'] : []),
|
|
447
|
+
];
|
|
448
|
+
return {
|
|
449
|
+
...e,
|
|
450
|
+
type: e.type ?? 'github',
|
|
451
|
+
hosts: snap?.hosts ?? [],
|
|
452
|
+
marketplace: snap?.marketplace ?? null,
|
|
453
|
+
kinds,
|
|
454
|
+
};
|
|
455
|
+
})
|
|
456
|
+
.filter((e) => e.kinds.includes('skill')),
|
|
457
|
+
}));
|
|
458
|
+
// Dry-run probe: a skill source must actually publish skills (check-before-add).
|
|
459
|
+
app.post('/api/admin/harness/skills/sources/check', async (req, reply) => {
|
|
460
|
+
const body = (req.body || {});
|
|
461
|
+
if (!body.url) {
|
|
462
|
+
reply.code(400);
|
|
463
|
+
return { status: 'error', code: 'bad_request', message: 'url is required' };
|
|
464
|
+
}
|
|
465
|
+
return { status: 'ok', ...(await checkSkillSource(body.url, opts.marketplaceFetch)) };
|
|
466
|
+
});
|
|
467
|
+
app.post('/api/admin/harness/skills/sources', async (req, reply) => {
|
|
468
|
+
const body = (req.body || {});
|
|
469
|
+
if (!body.url) {
|
|
470
|
+
reply.code(400);
|
|
471
|
+
return { status: 'error', code: 'bad_request', message: 'url is required' };
|
|
472
|
+
}
|
|
473
|
+
const outcome = await registerSkillSource(body.url, { catalog: body.catalog, rescan: body.rescan }, opts.marketplaceFetch);
|
|
474
|
+
if (!outcome.ok) {
|
|
475
|
+
const conflict = outcome.reason === 'already_configured' || outcome.reason === 'slug_taken';
|
|
476
|
+
reply.code(conflict ? 409 : 400);
|
|
477
|
+
return {
|
|
478
|
+
status: 'error',
|
|
479
|
+
code: conflict ? 'conflict' : 'bad_request',
|
|
480
|
+
reason: outcome.reason,
|
|
481
|
+
params: outcome.params,
|
|
482
|
+
message: outcome.message ?? '',
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
return { status: 'ok', reason: outcome.reason, params: outcome.params, message: outcome.message };
|
|
486
|
+
});
|
|
487
|
+
app.patch('/api/admin/harness/skills/sources/:slug', async (req, reply) => {
|
|
488
|
+
const body = (req.body || {});
|
|
489
|
+
if (!updateSkillSource(req.params.slug, body)) {
|
|
490
|
+
reply.code(404);
|
|
491
|
+
return { status: 'error', code: 'not_found', message: `no source '${req.params.slug}'` };
|
|
492
|
+
}
|
|
493
|
+
return { status: 'ok' };
|
|
494
|
+
});
|
|
495
|
+
app.delete('/api/admin/harness/skills/sources/:slug', async (req, reply) => {
|
|
496
|
+
const { slug } = req.params;
|
|
497
|
+
if (!removeSkillSource(slug)) {
|
|
498
|
+
reply.code(404);
|
|
499
|
+
return { status: 'error', code: 'unknown_source', message: `unknown source '${slug}'` };
|
|
500
|
+
}
|
|
501
|
+
return { status: 'ok' };
|
|
502
|
+
});
|
|
503
|
+
app.post('/api/admin/harness/skills/sources/:slug/rescan', async (req, reply) => {
|
|
504
|
+
const { slug } = req.params;
|
|
505
|
+
if (!skillSourceEntry(slug)) {
|
|
506
|
+
reply.code(404);
|
|
507
|
+
return { status: 'error', code: 'not_found', message: `no source '${slug}'` };
|
|
508
|
+
}
|
|
509
|
+
const result = await rescanSkillSource(slug, opts.marketplaceFetch);
|
|
510
|
+
if (!result.ok) {
|
|
511
|
+
reply.code(400);
|
|
512
|
+
return { status: 'error', code: 'probe_failed', message: result.message };
|
|
513
|
+
}
|
|
514
|
+
return { status: 'ok', rows: result.rows, diff: { added: result.diff.added, removed: result.diff.removed } };
|
|
515
|
+
});
|
|
516
|
+
app.get('/api/admin/harness/plugins/:harness/catalog', async (req, reply) => {
|
|
517
|
+
const adapter = pluginAdapterFor(req.params.harness);
|
|
518
|
+
if (!adapter) {
|
|
519
|
+
reply.code(404);
|
|
520
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
521
|
+
}
|
|
522
|
+
const query = (req.query || {});
|
|
523
|
+
const page = await adapter.search(query.q ?? '', {
|
|
524
|
+
...(query.page ? { page: Number(query.page) || 1 } : {}),
|
|
525
|
+
...(query.pageSize ? { pageSize: Number(query.pageSize) || 24 } : {}),
|
|
526
|
+
...(query.sort ? { sort: query.sort } : {}),
|
|
527
|
+
});
|
|
528
|
+
return { status: 'ok', ...page };
|
|
529
|
+
});
|
|
530
|
+
// Install funnels through the adapter into the HOST axis (§D11): the market adapter only
|
|
531
|
+
// translates the row; the write lands via HarnessHostAdapter with gate-3 discipline intact.
|
|
532
|
+
app.post('/api/admin/harness/plugins/:harness/install', async (req, reply) => {
|
|
533
|
+
const adapter = pluginAdapterFor(req.params.harness);
|
|
534
|
+
if (!adapter) {
|
|
535
|
+
reply.code(404);
|
|
536
|
+
return { status: 'error', code: 'unknown_harness', message: `unknown harness` };
|
|
537
|
+
}
|
|
538
|
+
const body = (req.body || {});
|
|
539
|
+
if (!body.row || typeof body.row !== 'object') {
|
|
540
|
+
reply.code(400);
|
|
541
|
+
return { status: 'error', code: 'bad_request', message: 'row is required' };
|
|
542
|
+
}
|
|
543
|
+
// Same trust boundary as the main install route: the body cannot widen the scope set the rest
|
|
544
|
+
// of the domain reads from `ENABLED_SCOPES`, and a project landing needs a verified root.
|
|
545
|
+
const scope = body.scope ?? 'global';
|
|
546
|
+
if (!isEnabledScope(scope)) {
|
|
547
|
+
reply.code(400);
|
|
548
|
+
return {
|
|
549
|
+
status: 'error',
|
|
550
|
+
code: 'unsupported_scope',
|
|
551
|
+
message: `scope '${scope}' is not supported — installs target ${ENABLED_SCOPES.join(', ')} scope`,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
const root = resolveProjectRoot(body, { required: scope === 'project' });
|
|
555
|
+
if (!root.ok) {
|
|
556
|
+
reply.code(400);
|
|
557
|
+
return { status: 'error', code: 'bad_request', message: root.message };
|
|
558
|
+
}
|
|
559
|
+
const result = await adapter.install(body.row, {
|
|
560
|
+
scope,
|
|
561
|
+
...(root.projectRoot ? { projectRoot: root.projectRoot } : {}),
|
|
562
|
+
confirm: body.confirm === true,
|
|
563
|
+
});
|
|
564
|
+
if (!result.ok) {
|
|
565
|
+
const status = result.code === 'exists' || result.code === 'foreign' || result.code === 'confirm_required'
|
|
566
|
+
? 409
|
|
567
|
+
: result.code === 'upstream' || result.code === 'unavailable'
|
|
568
|
+
? 502
|
|
569
|
+
: 400;
|
|
570
|
+
reply.code(status);
|
|
571
|
+
return { status: 'error', ...result };
|
|
572
|
+
}
|
|
573
|
+
return { status: 'ok', ...result };
|
|
574
|
+
});
|
|
243
575
|
// Host catalog + resolved roots. `origin` explains why a path is what it is.
|
|
244
576
|
app.get('/api/admin/harness/hosts', async () => ({
|
|
245
577
|
status: 'ok',
|
|
246
|
-
// The scopes this build accepts (ADR-0015 §D2 "Scope")
|
|
247
|
-
//
|
|
248
|
-
//
|
|
578
|
+
// The scopes this build accepts (ADR-0015 §D2 "Scope") — the build-wide accept list. What a
|
|
579
|
+
// given host can actually land per kind is narrower: `kindScopes` below is the per-host
|
|
580
|
+
// answer, and the writers refuse a scope absent from it.
|
|
249
581
|
scopes: [...ENABLED_SCOPES],
|
|
250
582
|
hosts: HOSTS.map((host) => {
|
|
583
|
+
const adapter = adapterFor(host.id);
|
|
251
584
|
const roots = {
|
|
252
585
|
global: skillRootsFor(host.id, 'global'),
|
|
253
586
|
};
|
|
@@ -256,11 +589,27 @@ export function registerHarnessRoutes(app) {
|
|
|
256
589
|
return {
|
|
257
590
|
id: host.id,
|
|
258
591
|
label: host.label,
|
|
259
|
-
|
|
592
|
+
/** Popularity order shared with the Clients page (1 = most popular; unranked = last).
|
|
593
|
+
* `universal` is unranked by design — the rail pins it first by id. */
|
|
594
|
+
rank: popularityRank(host.id),
|
|
595
|
+
/** Present on this machine (executable, config dir, or an existing skills root). The
|
|
596
|
+
* console rail hides undetected hosts — but never one whose rows are already landed. */
|
|
597
|
+
detected: hostDetected(adapter),
|
|
598
|
+
hasSkills: isSkillsHost(adapter),
|
|
260
599
|
/** MCP-capable host: its adapter implements the MCP landing capability. */
|
|
261
|
-
hasMcp: isMcpHost(
|
|
262
|
-
/**
|
|
263
|
-
hasExt:
|
|
600
|
+
hasMcp: isMcpHost(adapter),
|
|
601
|
+
/** Plugin-capable host: its adapter implements the plugin landing capability. */
|
|
602
|
+
hasExt: isPluginHost(adapter),
|
|
603
|
+
/** Per-profile plugin store (DSH): the targets the console may pick. */
|
|
604
|
+
...(isPluginHost(adapter) && adapter.installProfiles ? { profiles: adapter.installProfiles() } : {}),
|
|
605
|
+
/** Per-kind scope capability (ADR-0015 §D2): the scopes an install may target for each
|
|
606
|
+
* kind. The console greys out a scope absent from the kind's list instead of letting
|
|
607
|
+
* the operator aim an install at a landing the runtime has no write grammar for. */
|
|
608
|
+
kindScopes: {
|
|
609
|
+
skill: [...adapter.supportedScopes('skill')],
|
|
610
|
+
mcp: [...adapter.supportedScopes('mcp')],
|
|
611
|
+
plugin: [...adapter.supportedScopes('plugin')],
|
|
612
|
+
},
|
|
264
613
|
roots,
|
|
265
614
|
owner: {
|
|
266
615
|
global: roots.global[0] ? skillOwner(roots.global[0].root, 'global') : null,
|
|
@@ -271,8 +620,14 @@ export function registerHarnessRoutes(app) {
|
|
|
271
620
|
// Apply ledger — the audit trail behind every install/remove (ADR-0015 apply ledger).
|
|
272
621
|
app.get('/api/admin/harness/applies', async () => ({ status: 'ok', applies: recentApplies(100) }));
|
|
273
622
|
// Installed artifacts + untracked directories, reconciled per copy.
|
|
274
|
-
app.get('/api/admin/harness/inventory', async () => {
|
|
275
|
-
const
|
|
623
|
+
app.get('/api/admin/harness/inventory', async (req, reply) => {
|
|
624
|
+
const query = (req.query || {});
|
|
625
|
+
const root = resolveProjectRoot(query, { required: false });
|
|
626
|
+
if (!root.ok) {
|
|
627
|
+
reply.code(400);
|
|
628
|
+
return { status: 'error', code: 'bad_request', message: root.message };
|
|
629
|
+
}
|
|
630
|
+
const inventory = scanInventory(root.projectRoot);
|
|
276
631
|
return {
|
|
277
632
|
status: 'ok',
|
|
278
633
|
...inventory,
|
|
@@ -304,14 +659,19 @@ export function registerHarnessRoutes(app) {
|
|
|
304
659
|
}
|
|
305
660
|
if (item.removal !== undefined) {
|
|
306
661
|
const op = item.removal?.op;
|
|
307
|
-
if (op !== 'trash-path' && op !== 'drop-entry' && op !== 'drop-server') {
|
|
662
|
+
if (op !== 'trash-path' && op !== 'drop-entry' && op !== 'drop-server' && op !== 'cli-remove') {
|
|
308
663
|
reply.code(400);
|
|
309
664
|
return { status: 'error', code: 'bad_request', message: `unknown removal op '${String(op)}'` };
|
|
310
665
|
}
|
|
311
666
|
}
|
|
312
667
|
}
|
|
313
668
|
// artifactId null = a directory with no manifest entry; root containment is the guard.
|
|
314
|
-
const
|
|
669
|
+
const root = resolveProjectRoot(body, { required: false });
|
|
670
|
+
if (!root.ok) {
|
|
671
|
+
reply.code(400);
|
|
672
|
+
return { status: 'error', code: 'bad_request', message: root.message };
|
|
673
|
+
}
|
|
674
|
+
const plan = planRemove(body.items, { projectRoot: root.projectRoot });
|
|
315
675
|
if ('error' in plan) {
|
|
316
676
|
reply.code(400);
|
|
317
677
|
return { status: 'error', code: 'plan_rejected', message: plan.error };
|
|
@@ -322,21 +682,107 @@ export function registerHarnessRoutes(app) {
|
|
|
322
682
|
// an empty market reads as "nothing exists", which is a different (and false) claim.
|
|
323
683
|
app.get('/api/admin/harness/browse', async (req, reply) => {
|
|
324
684
|
const query = (req.query || {});
|
|
325
|
-
const
|
|
685
|
+
const requestedSource = query.source || SOURCES[0]?.id || '';
|
|
686
|
+
const source = SOURCES.find((s) => s.id === requestedSource) ??
|
|
687
|
+
mpSourceView(requestedSource.startsWith('mp-') ? requestedSource.slice(3) : requestedSource);
|
|
326
688
|
if (!source) {
|
|
327
689
|
reply.code(404);
|
|
328
|
-
return { status: 'error', code: 'unknown_source', message: `unknown source '${
|
|
690
|
+
return { status: 'error', code: 'unknown_source', message: `unknown source '${requestedSource}'` };
|
|
691
|
+
}
|
|
692
|
+
// An operator entry browses from its own snapshot, not the live-source dispatcher. The plugin
|
|
693
|
+
// axis reads the snapshot's plugin rows: those ARE the plugins the operator added, and their
|
|
694
|
+
// keys are the native install handles (`mp-<slug>:<repo>#<source>` / `npm:<pkg>`).
|
|
695
|
+
if (source.id.startsWith('mp-')) {
|
|
696
|
+
const slug = source.id.slice(3);
|
|
697
|
+
const page = Math.max(Number(query.page) || 1, 1);
|
|
698
|
+
const pageSize = Math.min(Number(query.limit) || 24, 100);
|
|
699
|
+
const entry = getMarketplaceEntry(slug);
|
|
700
|
+
if (query.kind === 'mcp' && entry) {
|
|
701
|
+
// The MCP axis reads the snapshot's single package row; the install handle is the
|
|
702
|
+
// registry key (`npm:<pkg>` / `pypi:<pkg>`), which the resolver pins at install time.
|
|
703
|
+
const snapshot = latestSnapshot(slug);
|
|
704
|
+
const needle = (query.q || '').trim().toLowerCase();
|
|
705
|
+
const ecosystem = entry.type === 'pypi' ? 'pypi' : 'npm';
|
|
706
|
+
const all = (snapshot?.mcps ?? [])
|
|
707
|
+
.filter((m) => !needle || m.name.toLowerCase().includes(needle) || (m.description ?? '').toLowerCase().includes(needle))
|
|
708
|
+
.map((m) => ({
|
|
709
|
+
id: `${ecosystem}:${m.name}`,
|
|
710
|
+
key: `${ecosystem}:${m.name}`,
|
|
711
|
+
sourceId: source.id,
|
|
712
|
+
installKind: 'mcp',
|
|
713
|
+
name: m.name,
|
|
714
|
+
// The key the install will merge under, derived by the SAME rule the resolver applies
|
|
715
|
+
// (`mcpServerNameFromPackage`): the sheet shows it read-only, and it must not promise a
|
|
716
|
+
// name the host grammar refuses (`@bytebase/dbhub` fails every verified landing).
|
|
717
|
+
serverName: mcpServerNameFromPackage(m.name),
|
|
718
|
+
description: m.description,
|
|
719
|
+
url: ecosystem === 'pypi' ? `https://pypi.org/project/${m.name}/` : `https://www.npmjs.com/package/${m.name}`,
|
|
720
|
+
version: m.version,
|
|
721
|
+
stars: null,
|
|
722
|
+
updatedAt: '',
|
|
723
|
+
topics: [],
|
|
724
|
+
}));
|
|
725
|
+
return {
|
|
726
|
+
status: 'ok',
|
|
727
|
+
source: source.id,
|
|
728
|
+
page,
|
|
729
|
+
items: all.slice((page - 1) * pageSize, page * pageSize),
|
|
730
|
+
hasMore: page * pageSize < all.length,
|
|
731
|
+
total: all.length,
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
if (query.kind === 'plugin' && entry) {
|
|
735
|
+
const snapshot = latestSnapshot(slug);
|
|
736
|
+
const needle = (query.q || '').trim().toLowerCase();
|
|
737
|
+
const all = (snapshot?.plugins ?? [])
|
|
738
|
+
.filter((p) => !needle || p.name.toLowerCase().includes(needle) || (p.description ?? '').toLowerCase().includes(needle))
|
|
739
|
+
.map((p) => {
|
|
740
|
+
const key = entry.type === 'npm' ? `npm:${p.name}` : `${source.id}:${entry.repo}#${p.source}`;
|
|
741
|
+
return {
|
|
742
|
+
id: key,
|
|
743
|
+
key,
|
|
744
|
+
sourceId: source.id,
|
|
745
|
+
installKind: 'plugin',
|
|
746
|
+
name: p.name,
|
|
747
|
+
...(entry.type === 'npm' ? {} : { repo: entry.repo }),
|
|
748
|
+
description: p.description,
|
|
749
|
+
url: entry.type === 'npm'
|
|
750
|
+
? `https://www.npmjs.com/package/${p.name}`
|
|
751
|
+
: `https://github.com/${entry.repo}`,
|
|
752
|
+
stars: entry.type === 'npm' ? null : snapshot?.stars ?? null,
|
|
753
|
+
updatedAt: '',
|
|
754
|
+
topics: [],
|
|
755
|
+
// The install command spells `<plugin>@<marketplace>`; an npm row installs by spec.
|
|
756
|
+
...(entry.type === 'npm' ? {} : { marketplace: snapshot?.marketplace ?? null }),
|
|
757
|
+
};
|
|
758
|
+
});
|
|
759
|
+
return {
|
|
760
|
+
status: 'ok',
|
|
761
|
+
source: source.id,
|
|
762
|
+
page,
|
|
763
|
+
items: all.slice((page - 1) * pageSize, page * pageSize),
|
|
764
|
+
hasMore: page * pageSize < all.length,
|
|
765
|
+
total: all.length,
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
const browsed = browseMarketplace(slug, { query: query.q, page, pageSize });
|
|
769
|
+
if (!browsed.ok) {
|
|
770
|
+
reply.code(browsed.code === 'unknown_source' ? 404 : 409);
|
|
771
|
+
return { status: 'error', code: browsed.code, message: browsed.message, source: source.id };
|
|
772
|
+
}
|
|
773
|
+
return {
|
|
774
|
+
status: 'ok',
|
|
775
|
+
source: source.id,
|
|
776
|
+
page,
|
|
777
|
+
items: browsed.items.map((i) => ({ ...i, id: i.key, sourceId: source.id, installKind: 'skill', stars: null, updatedAt: '', url: null, topics: [] })),
|
|
778
|
+
hasMore: browsed.hasMore,
|
|
779
|
+
total: browsed.total,
|
|
780
|
+
};
|
|
329
781
|
}
|
|
330
|
-
// The market axis the console is browsing. Only npm forks on it today (default query + row
|
|
331
|
-
// install kind); a value outside the kind vocabulary is dropped, never forwarded.
|
|
332
|
-
const kind = ['skill', 'mcp', 'extension'].includes(query.kind ?? '')
|
|
333
|
-
? query.kind
|
|
334
|
-
: undefined;
|
|
335
782
|
// `page` is 1-based; a nonsense value falls back to the first page rather than answering empty.
|
|
336
783
|
const page = Math.max(Number(query.page) || 1, 1);
|
|
337
784
|
const result = await browseSource(source, query.q || '', Number(query.limit) || 24, {
|
|
338
785
|
...(query.harness ? { harness: query.harness } : {}),
|
|
339
|
-
...(kind ? { kind } : {}),
|
|
340
786
|
page,
|
|
341
787
|
// `sort` is validated against the source's OWN declared orderings inside `browseSource`: an
|
|
342
788
|
// order the upstream cannot serve is dropped, never forwarded as a guess.
|
|
@@ -416,16 +862,228 @@ export function registerHarnessRoutes(app) {
|
|
|
416
862
|
// would turn an admin GET into an arbitrary-URL proxy.
|
|
417
863
|
app.get('/api/admin/harness/detail', async (req, reply) => {
|
|
418
864
|
const query = (req.query || {});
|
|
419
|
-
|
|
420
|
-
if (
|
|
421
|
-
|
|
422
|
-
|
|
865
|
+
let sourceId = 'direct';
|
|
866
|
+
if (query.source) {
|
|
867
|
+
const source = SOURCES.find((s) => s.id === query.source) ??
|
|
868
|
+
mpSourceView(query.source.startsWith('mp-') ? query.source.slice(3) : query.source);
|
|
869
|
+
if (!source) {
|
|
870
|
+
reply.code(404);
|
|
871
|
+
return { status: 'error', code: 'unknown_source', message: `unknown source '${query.source}'` };
|
|
872
|
+
}
|
|
873
|
+
sourceId = source.id;
|
|
423
874
|
}
|
|
875
|
+
// The console's language lets the reader prefer the README's own localized edition (and report
|
|
876
|
+
// `readmeLang`), so an already-Chinese/Japanese/Korean page is shown instead of translated.
|
|
877
|
+
const lang = query.lang && isSupportedLang(query.lang) ? query.lang : undefined;
|
|
424
878
|
const detail = await readMarketDetail({
|
|
425
879
|
...(query.key ? { key: query.key } : {}),
|
|
426
880
|
...(query.repo ? { repo: query.repo } : {}),
|
|
881
|
+
...(lang ? { lang } : {}),
|
|
427
882
|
});
|
|
428
|
-
return { status: 'ok', source:
|
|
883
|
+
return { status: 'ok', source: sourceId, detail };
|
|
884
|
+
});
|
|
885
|
+
// ── MCP entry read / edit (ADR-0015 §D8 amendment, 2026-11-01) ──────────────────────────────
|
|
886
|
+
// The harness page's edit surface. A read answers the launch behind ONE existing server member,
|
|
887
|
+
// with env/header KEY NAMES plus the set of keys that already hold a value; the write changes that
|
|
888
|
+
// member through the same gate-2 discipline as install. `name` names an EXISTING key — renaming is
|
|
889
|
+
// delete + add, never an edit.
|
|
890
|
+
// ── MCP Registry parameter schema (ADR-0015 §D8 amendment, 2026-11-01) ──────────────────────
|
|
891
|
+
// The add/edit sheet's visual form is generated from the registry's own `server.json`, so it works
|
|
892
|
+
// for any server instead of a hand-written per-package form. Read-only: nothing here is written.
|
|
893
|
+
app.get('/api/admin/harness/mcp/registry', async (req, reply) => {
|
|
894
|
+
const query = (req.query || {});
|
|
895
|
+
if (!query.q) {
|
|
896
|
+
reply.code(400);
|
|
897
|
+
return { status: 'error', code: 'bad_request', message: 'q is required' };
|
|
898
|
+
}
|
|
899
|
+
const result = await searchMcpRegistry(query.q);
|
|
900
|
+
if (!result.ok) {
|
|
901
|
+
reply.code(result.code === 'bad_request' ? 400 : 502);
|
|
902
|
+
return { status: 'error', code: result.code, message: result.message };
|
|
903
|
+
}
|
|
904
|
+
return { status: 'ok', candidates: result.candidates };
|
|
905
|
+
});
|
|
906
|
+
// ── MCP npm package CLI flags (ADR-0015 §D8 amendment, 2026-11-01) ──────────────────────────
|
|
907
|
+
// The registry declares DBHub's environment variables and no `runtimeArguments`, so the package
|
|
908
|
+
// itself is read for the flags it parses (`--transport`, `--port`, `--dsn`). The tarball is
|
|
909
|
+
// downloaded into memory and scanned; the package is never executed and nothing is written.
|
|
910
|
+
app.get('/api/admin/harness/mcp/cli', async (req, reply) => {
|
|
911
|
+
const query = (req.query || {});
|
|
912
|
+
if (!query.pkg) {
|
|
913
|
+
reply.code(400);
|
|
914
|
+
return { status: 'error', code: 'bad_request', message: 'pkg is required' };
|
|
915
|
+
}
|
|
916
|
+
// npx / bunx resolve on npm; uvx resolves on PyPI. No parameter means npm.
|
|
917
|
+
if (query.registry !== undefined && query.registry !== 'npm' && query.registry !== 'pypi') {
|
|
918
|
+
reply.code(400);
|
|
919
|
+
return { status: 'error', code: 'bad_request', message: "registry must be 'npm' or 'pypi'" };
|
|
920
|
+
}
|
|
921
|
+
const result = await probeMcpCli(query.pkg, { registry: query.registry ?? 'npm' });
|
|
922
|
+
if (!result.ok) {
|
|
923
|
+
reply.code(result.code === 'bad_request'
|
|
924
|
+
? 400
|
|
925
|
+
: result.code === 'not_found'
|
|
926
|
+
? 404
|
|
927
|
+
: result.code === 'too_large'
|
|
928
|
+
? 413
|
|
929
|
+
: 502);
|
|
930
|
+
return { status: 'error', code: result.code, message: result.message };
|
|
931
|
+
}
|
|
932
|
+
return { status: 'ok', ...result };
|
|
933
|
+
});
|
|
934
|
+
// ── Live MCP runtime status (ADR-0015 §D8.8) ────────────────────────────────────────────────
|
|
935
|
+
// The config landing says a server was WRITTEN; only the runtime knows whether it CONNECTED.
|
|
936
|
+
// Read-only, never installs or spawns a server, and a host absent from the answer (or reported
|
|
937
|
+
// unreachable) is "no live claim": the console keeps its on-disk state and adds no runtime verdict.
|
|
938
|
+
app.get('/api/admin/harness/mcp/runtime', async () => ({ status: 'ok', ...(await probeMcpRuntimes()) }));
|
|
939
|
+
// ── DSN connection test (ADR-0015 §D11 amendment, 2026-11) ──────────────────────────────────
|
|
940
|
+
// Two tiers, both read-only. For postgres/postgresql and mysql/mariadb the route logs in with the
|
|
941
|
+
// operator's values through the real driver (`select 1` / `ping`) and answers a verdict code,
|
|
942
|
+
// because a TCP answer cannot tell a wrong password from a missing database. Every other scheme
|
|
943
|
+
// gets the credential-free TCP dial. The credential is used for this one request: the admin route
|
|
944
|
+
// is auth + CSRF gated, the value is never logged and never echoed back, and the driver's failure
|
|
945
|
+
// text (which does not contain the password) is all that returns.
|
|
946
|
+
app.post('/api/admin/harness/mcp/dsn-probe', async (req, reply) => {
|
|
947
|
+
const body = (req.body ?? {});
|
|
948
|
+
const text = (value, max) => typeof value === 'string' ? value.slice(0, max) : '';
|
|
949
|
+
const host = text(body.host, 253).trim();
|
|
950
|
+
const port = typeof body.port === 'number' ? body.port : Number.NaN;
|
|
951
|
+
if (!isProbeHost(host) || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
952
|
+
reply.code(400);
|
|
953
|
+
return { status: 'error', code: 'bad_request', message: 'host and port (1-65535) are required' };
|
|
954
|
+
}
|
|
955
|
+
const target = `${host}:${port}`;
|
|
956
|
+
const params = {};
|
|
957
|
+
if (body.params && typeof body.params === 'object' && !Array.isArray(body.params)) {
|
|
958
|
+
for (const [key, value] of Object.entries(body.params).slice(0, 64)) {
|
|
959
|
+
if (key !== '' && typeof value === 'string')
|
|
960
|
+
params[key.slice(0, 64)] = value.slice(0, 256);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
const engine = dbEngineFor(text(body.driver, 32));
|
|
964
|
+
if (engine) {
|
|
965
|
+
const result = await probeDatabase({
|
|
966
|
+
engine,
|
|
967
|
+
host,
|
|
968
|
+
port,
|
|
969
|
+
user: text(body.user, 256),
|
|
970
|
+
password: text(body.password, 4_096),
|
|
971
|
+
database: text(body.database, 256),
|
|
972
|
+
params,
|
|
973
|
+
});
|
|
974
|
+
return { status: 'ok', target, engine, ...result };
|
|
975
|
+
}
|
|
976
|
+
const dial = await probeTcp(host, port);
|
|
977
|
+
const failure = dial.message ?? '';
|
|
978
|
+
const code = dial.reachable
|
|
979
|
+
? 'reachable'
|
|
980
|
+
: failure.includes('ECONNREFUSED')
|
|
981
|
+
? 'refused'
|
|
982
|
+
: /timeout/i.test(failure)
|
|
983
|
+
? 'timeout'
|
|
984
|
+
: 'unreachable';
|
|
985
|
+
return {
|
|
986
|
+
status: 'ok',
|
|
987
|
+
target,
|
|
988
|
+
engine: null,
|
|
989
|
+
reachable: dial.reachable,
|
|
990
|
+
verified: false,
|
|
991
|
+
code,
|
|
992
|
+
...(dial.message ? { message: dial.message } : {}),
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
app.get('/api/admin/harness/mcp/entry', async (req, reply) => {
|
|
996
|
+
const query = (req.query || {});
|
|
997
|
+
if (!query.host || !query.name) {
|
|
998
|
+
reply.code(400);
|
|
999
|
+
return { status: 'error', code: 'bad_request', message: 'host and name are required' };
|
|
1000
|
+
}
|
|
1001
|
+
if (!HOSTS.some((host) => host.id === query.host)) {
|
|
1002
|
+
reply.code(400);
|
|
1003
|
+
return { status: 'error', code: 'bad_request', message: `unknown host '${query.host}'` };
|
|
1004
|
+
}
|
|
1005
|
+
const scope = query.scope ?? 'global';
|
|
1006
|
+
if (!isEnabledScope(scope)) {
|
|
1007
|
+
reply.code(400);
|
|
1008
|
+
return {
|
|
1009
|
+
status: 'error',
|
|
1010
|
+
code: 'unsupported_scope',
|
|
1011
|
+
message: `scope '${scope}' is not supported — reads target ${ENABLED_SCOPES.join(', ')} scope`,
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
const root = resolveProjectRoot(query, { required: false });
|
|
1015
|
+
if (!root.ok) {
|
|
1016
|
+
reply.code(400);
|
|
1017
|
+
return { status: 'error', code: 'bad_request', message: root.message };
|
|
1018
|
+
}
|
|
1019
|
+
const result = readMcpEntry({
|
|
1020
|
+
host: query.host,
|
|
1021
|
+
scope,
|
|
1022
|
+
name: query.name,
|
|
1023
|
+
...(root.projectRoot ? { projectRoot: root.projectRoot } : {}),
|
|
1024
|
+
});
|
|
1025
|
+
if (!result.ok) {
|
|
1026
|
+
reply.code(result.code === 'not_found' ? 404 : 400);
|
|
1027
|
+
return { status: 'error', code: result.code, message: result.message };
|
|
1028
|
+
}
|
|
1029
|
+
return {
|
|
1030
|
+
status: 'ok',
|
|
1031
|
+
host: result.host,
|
|
1032
|
+
name: result.name,
|
|
1033
|
+
file: result.file,
|
|
1034
|
+
container: result.container,
|
|
1035
|
+
launch: result.launch,
|
|
1036
|
+
setKeys: result.setKeys,
|
|
1037
|
+
};
|
|
1038
|
+
});
|
|
1039
|
+
app.post('/api/admin/harness/mcp/edit', async (req, reply) => {
|
|
1040
|
+
const body = (req.body || {});
|
|
1041
|
+
if (!body.host || !body.name || body.launch === undefined) {
|
|
1042
|
+
reply.code(400);
|
|
1043
|
+
return { status: 'error', code: 'bad_request', message: 'host, name and launch are required' };
|
|
1044
|
+
}
|
|
1045
|
+
if (!HOSTS.some((host) => host.id === body.host)) {
|
|
1046
|
+
reply.code(400);
|
|
1047
|
+
return { status: 'error', code: 'bad_request', message: `unknown host '${body.host}'` };
|
|
1048
|
+
}
|
|
1049
|
+
// Same scope boundary as install: the body cannot widen the set the rest of the domain reads.
|
|
1050
|
+
const scope = body.scope ?? 'global';
|
|
1051
|
+
if (!isEnabledScope(scope)) {
|
|
1052
|
+
reply.code(400);
|
|
1053
|
+
return {
|
|
1054
|
+
status: 'error',
|
|
1055
|
+
code: 'unsupported_scope',
|
|
1056
|
+
message: `scope '${scope}' is not supported — edits target ${ENABLED_SCOPES.join(', ')} scope`,
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
const root = resolveProjectRoot(body, { required: scope === 'project' });
|
|
1060
|
+
if (!root.ok) {
|
|
1061
|
+
reply.code(400);
|
|
1062
|
+
return { status: 'error', code: 'bad_request', message: root.message };
|
|
1063
|
+
}
|
|
1064
|
+
const result = await editMcpServer({
|
|
1065
|
+
host: body.host,
|
|
1066
|
+
scope,
|
|
1067
|
+
name: body.name,
|
|
1068
|
+
launch: body.launch,
|
|
1069
|
+
...(typeof body.artifactId === 'string' ? { artifactId: body.artifactId } : {}),
|
|
1070
|
+
...(root.projectRoot ? { projectRoot: root.projectRoot } : {}),
|
|
1071
|
+
confirm: body.confirm === true,
|
|
1072
|
+
});
|
|
1073
|
+
if (!result.ok) {
|
|
1074
|
+
const status = result.code === 'not_found' ? 404 : result.code === 'bad_request' ? 400 : 409;
|
|
1075
|
+
reply.code(status);
|
|
1076
|
+
return { status: 'error', ...result };
|
|
1077
|
+
}
|
|
1078
|
+
return {
|
|
1079
|
+
status: 'ok',
|
|
1080
|
+
changed: result.changed,
|
|
1081
|
+
host: result.host,
|
|
1082
|
+
name: result.name,
|
|
1083
|
+
file: result.file,
|
|
1084
|
+
container: result.container,
|
|
1085
|
+
artifactId: result.artifactId,
|
|
1086
|
+
};
|
|
429
1087
|
});
|
|
430
1088
|
// Install one artifact into one or more host locations — one store entry, N copies. The route
|
|
431
1089
|
// speaks keys (`<sourceId>:<ref>[#detail]`); the SPI resolves the payload, the kind writer does
|
|
@@ -438,9 +1096,8 @@ export function registerHarnessRoutes(app) {
|
|
|
438
1096
|
reply.code(400);
|
|
439
1097
|
return { status: 'error', code: 'bad_request', message: 'hosts[] and scope are required' };
|
|
440
1098
|
}
|
|
441
|
-
// Scope is a capability, not a free-form field
|
|
442
|
-
//
|
|
443
|
-
// a request naming `project` must not reach a writer that would happily land inside the repo.
|
|
1099
|
+
// Scope is a capability, not a free-form field (ADR-0015 §D2 "Scope"): the build's accept set is
|
|
1100
|
+
// `ENABLED_SCOPES`, and a `project` landing additionally requires a verified `projectRoot` below.
|
|
444
1101
|
if (!isEnabledScope(body.scope)) {
|
|
445
1102
|
reply.code(400);
|
|
446
1103
|
return {
|
|
@@ -449,6 +1106,12 @@ export function registerHarnessRoutes(app) {
|
|
|
449
1106
|
message: `scope '${body.scope}' is not supported — installs target ${ENABLED_SCOPES.join(', ')} scope`,
|
|
450
1107
|
};
|
|
451
1108
|
}
|
|
1109
|
+
const root = resolveProjectRoot(body, { required: body.scope === 'project' });
|
|
1110
|
+
if (!root.ok) {
|
|
1111
|
+
reply.code(400);
|
|
1112
|
+
return { status: 'error', code: 'bad_request', message: root.message };
|
|
1113
|
+
}
|
|
1114
|
+
const projectRoot = root.projectRoot;
|
|
452
1115
|
// Validate the host catalog HERE, at the trust boundary: an unknown id would otherwise travel
|
|
453
1116
|
// through resolve/write and fail deep inside a writer with a message about the wrong thing.
|
|
454
1117
|
const unknown = hosts.find((id) => !HOSTS.some((host) => host.id === id));
|
|
@@ -465,7 +1128,7 @@ export function registerHarnessRoutes(app) {
|
|
|
465
1128
|
}
|
|
466
1129
|
// Kind is validated HERE, at the trust boundary, for the same reason as hosts above: an unknown
|
|
467
1130
|
// kind must fail with a message about kind, not deep inside the orchestrator's default branch.
|
|
468
|
-
if (body.kind !== 'skill' && body.kind !== 'mcp' && body.kind !== '
|
|
1131
|
+
if (body.kind !== 'skill' && body.kind !== 'mcp' && body.kind !== 'plugin') {
|
|
469
1132
|
reply.code(400);
|
|
470
1133
|
return { status: 'error', code: 'bad_request', message: `unknown kind '${body.kind}'` };
|
|
471
1134
|
}
|
|
@@ -475,23 +1138,61 @@ export function registerHarnessRoutes(app) {
|
|
|
475
1138
|
: undefined;
|
|
476
1139
|
// Listing surfaces are validated HERE, at the trust boundary, against the same registry the
|
|
477
1140
|
// console builds its source chips from: a claim about where a row was browsed must name a source
|
|
478
|
-
// this gateway declares
|
|
1141
|
+
// this gateway declares — built-in views OR an operator git source (`mp-*`, materialized from
|
|
1142
|
+
// the marketplace store) — or it is dropped rather than recorded.
|
|
479
1143
|
const listedOn = Array.isArray(body.listedOn)
|
|
480
|
-
? body.listedOn.filter((id) => typeof id === 'string' && SOURCES.some((s) => s.id === id))
|
|
1144
|
+
? body.listedOn.filter((id) => typeof id === 'string' && (SOURCES.some((s) => s.id === id) || /^mp-[a-z0-9][a-z0-9-]{0,38}$/.test(id)))
|
|
481
1145
|
: undefined;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
1146
|
+
const logId = body.confirm === true && kind === 'plugin' && typeof body.installLogId === 'string'
|
|
1147
|
+
? body.installLogId
|
|
1148
|
+
: undefined;
|
|
1149
|
+
if (logId && !startInstallLog(logId)) {
|
|
1150
|
+
reply.code(400);
|
|
1151
|
+
return { status: 'error', code: 'bad_request', message: 'invalid installLogId' };
|
|
1152
|
+
}
|
|
1153
|
+
let failure;
|
|
1154
|
+
let result;
|
|
1155
|
+
try {
|
|
1156
|
+
result = await installArtifact({
|
|
1157
|
+
sourceId: body.sourceId,
|
|
1158
|
+
key: body.key,
|
|
1159
|
+
repo: body.repo,
|
|
1160
|
+
kind,
|
|
1161
|
+
skillDir: body.skillDir,
|
|
1162
|
+
launch: kind === 'mcp' && body.launch && typeof body.launch === 'object'
|
|
1163
|
+
? body.launch
|
|
1164
|
+
: undefined,
|
|
1165
|
+
manualPayload,
|
|
1166
|
+
manualSpec: typeof body.manualSpec === 'string' ? body.manualSpec : undefined,
|
|
1167
|
+
confirm: body.confirm === true,
|
|
1168
|
+
listedOn,
|
|
1169
|
+
...(typeof body.description === 'string' ? { description: body.description } : {}),
|
|
1170
|
+
hosts: hostIds,
|
|
1171
|
+
scope: body.scope,
|
|
1172
|
+
...(projectRoot ? { projectRoot } : {}),
|
|
1173
|
+
...(kind === 'plugin' &&
|
|
1174
|
+
body.marketplace &&
|
|
1175
|
+
typeof body.marketplace.repo === 'string' &&
|
|
1176
|
+
typeof body.marketplace.plugin === 'string' &&
|
|
1177
|
+
typeof body.marketplace.name === 'string'
|
|
1178
|
+
? { marketplace: { repo: body.marketplace.repo, plugin: body.marketplace.plugin, name: body.marketplace.name } }
|
|
1179
|
+
: {}),
|
|
1180
|
+
...(typeof body.profile === 'string' && body.profile.trim() ? { profile: body.profile.trim() } : {}),
|
|
1181
|
+
...(logId ? { onOutput: (chunk, stream) => appendInstallLog(logId, stream, chunk) } : {}),
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
catch (e) {
|
|
1185
|
+
failure = e instanceof Error ? e.message : String(e);
|
|
1186
|
+
throw e;
|
|
1187
|
+
}
|
|
1188
|
+
finally {
|
|
1189
|
+
if (logId)
|
|
1190
|
+
finishInstallLog(logId, failure ?? (result && !result.ok ? result.message : undefined));
|
|
1191
|
+
}
|
|
1192
|
+
if (!result) {
|
|
1193
|
+
reply.code(500);
|
|
1194
|
+
return { status: 'error', code: 'internal', message: 'install returned no result' };
|
|
1195
|
+
}
|
|
495
1196
|
if (!result.ok) {
|
|
496
1197
|
const status = result.code === 'exists' || result.code === 'foreign' || result.code === 'confirm_required'
|
|
497
1198
|
? 409
|
|
@@ -503,120 +1204,228 @@ export function registerHarnessRoutes(app) {
|
|
|
503
1204
|
}
|
|
504
1205
|
return { status: 'ok', ...result };
|
|
505
1206
|
});
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (!text) {
|
|
514
|
-
reply.code(400);
|
|
515
|
-
return { status: 'error', code: 'bad_request', message: 'text is required' };
|
|
1207
|
+
/** Poll target for the install sheet: the child's mirrored stdout/stderr while POST /install runs. */
|
|
1208
|
+
app.get('/api/admin/harness/install-log/:id', async (req, reply) => {
|
|
1209
|
+
const { id } = req.params;
|
|
1210
|
+
const log = readInstallLog(id);
|
|
1211
|
+
if (!log) {
|
|
1212
|
+
reply.code(404);
|
|
1213
|
+
return { status: 'error', code: 'not_found', message: 'install log not found or expired' };
|
|
516
1214
|
}
|
|
517
|
-
|
|
1215
|
+
return { status: 'ok', ...log };
|
|
1216
|
+
});
|
|
1217
|
+
// System One default-model probe — the Settings "default model" card's second "test" button. Fires
|
|
1218
|
+
// the REAL /v1/systemone fallback path; with a pending selection it rides as an explicit
|
|
1219
|
+
// `model` through the surface's own admission gates.
|
|
1220
|
+
app.post('/api/admin/systemone/probe', async (req) => {
|
|
1221
|
+
const body = (req.body || {});
|
|
1222
|
+
return probeSystemoneDefault(typeof body.model === 'string' ? body.model : undefined);
|
|
1223
|
+
});
|
|
1224
|
+
// Execute a plan. 409 for every refusal — the plan is stale, unknown, or needs a discard flag.
|
|
1225
|
+
app.post('/api/admin/harness/apply', async (req, reply) => {
|
|
1226
|
+
const body = (req.body || {});
|
|
1227
|
+
if (!body.planId) {
|
|
518
1228
|
reply.code(400);
|
|
519
|
-
return { status: 'error', code: 'bad_request', message: '
|
|
1229
|
+
return { status: 'error', code: 'bad_request', message: 'planId is required' };
|
|
520
1230
|
}
|
|
521
|
-
const result = body.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
reply.code(result.code === 'no_api_key' ? 409 : 502);
|
|
526
|
-
return { status: 'error', ...result };
|
|
1231
|
+
const result = await applyRemove(body.planId, { discardLocalEdits: body.discardLocalEdits === true });
|
|
1232
|
+
if (!result.ok) {
|
|
1233
|
+
reply.code(409);
|
|
1234
|
+
return { status: 'error', code: result.code, message: result.message };
|
|
527
1235
|
}
|
|
528
1236
|
return { status: 'ok', ...result };
|
|
529
1237
|
});
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
const result = await translateDescription(text, body.lang);
|
|
551
|
-
if ('code' in result)
|
|
552
|
-
errors.push({ text, code: result.code, message: result.message });
|
|
553
|
-
else
|
|
554
|
-
results[text] = result;
|
|
1238
|
+
const parseInspectTarget = (raw) => {
|
|
1239
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
1240
|
+
return { ok: false, code: 'bad_request', message: 'target object is required' };
|
|
1241
|
+
}
|
|
1242
|
+
const input = raw;
|
|
1243
|
+
if (input.mode === 'custom') {
|
|
1244
|
+
const transport = typeof input.transport === 'string' ? input.transport : 'stdio';
|
|
1245
|
+
if (transport === 'stdio') {
|
|
1246
|
+
const command = typeof input.command === 'string' ? input.command.trim() : '';
|
|
1247
|
+
if (!command)
|
|
1248
|
+
return { ok: false, code: 'bad_request', message: 'command is required' };
|
|
1249
|
+
const args = Array.isArray(input.args) ? input.args.filter((a) => typeof a === 'string') : [];
|
|
1250
|
+
const env = input.env && typeof input.env === 'object' && !Array.isArray(input.env)
|
|
1251
|
+
? Object.fromEntries(Object.entries(input.env).filter((kv) => typeof kv[1] === 'string'))
|
|
1252
|
+
: undefined;
|
|
1253
|
+
const cwd = typeof input.cwd === 'string' && input.cwd.trim() ? input.cwd.trim() : undefined;
|
|
1254
|
+
return {
|
|
1255
|
+
ok: true,
|
|
1256
|
+
target: { mode: 'custom', transport: 'stdio', command, args, ...(env ? { env } : {}), ...(cwd ? { cwd } : {}) },
|
|
1257
|
+
};
|
|
555
1258
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
1259
|
+
if (transport === 'auto' || transport === 'streamable-http' || transport === 'sse') {
|
|
1260
|
+
const url = typeof input.url === 'string' ? input.url.trim() : '';
|
|
1261
|
+
if (!url)
|
|
1262
|
+
return { ok: false, code: 'bad_request', message: 'url is required' };
|
|
1263
|
+
const headers = input.headers && typeof input.headers === 'object' && !Array.isArray(input.headers)
|
|
1264
|
+
? Object.fromEntries(Object.entries(input.headers).filter((kv) => typeof kv[1] === 'string'))
|
|
1265
|
+
: undefined;
|
|
1266
|
+
return {
|
|
1267
|
+
ok: true,
|
|
1268
|
+
target: { mode: 'custom', transport, url, ...(headers ? { headers } : {}) },
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
return { ok: false, code: 'bad_request', message: `unsupported transport '${transport}'` };
|
|
562
1272
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if (!
|
|
569
|
-
|
|
570
|
-
|
|
1273
|
+
const host = typeof input.host === 'string' ? input.host : '';
|
|
1274
|
+
const name = typeof input.name === 'string' ? input.name : '';
|
|
1275
|
+
if (!host || !name) {
|
|
1276
|
+
return { ok: false, code: 'bad_request', message: 'host and name are required' };
|
|
1277
|
+
}
|
|
1278
|
+
if (!HOSTS.some((h) => h.id === host)) {
|
|
1279
|
+
return { ok: false, code: 'bad_request', message: `unknown host '${host}'` };
|
|
1280
|
+
}
|
|
1281
|
+
const scope = typeof input.scope === 'string' ? input.scope : 'global';
|
|
1282
|
+
if (!isEnabledScope(scope)) {
|
|
1283
|
+
return {
|
|
1284
|
+
ok: false,
|
|
1285
|
+
code: 'unsupported_scope',
|
|
1286
|
+
message: `scope '${scope}' is not supported — reads target ${ENABLED_SCOPES.join(', ')} scope`,
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
const root = resolveProjectRoot({ projectRoot: input.projectRoot, projectId: input.projectId }, { required: scope === 'project' });
|
|
1290
|
+
if (!root.ok) {
|
|
1291
|
+
return { ok: false, code: 'bad_request', message: root.message };
|
|
571
1292
|
}
|
|
572
|
-
const texts = body.texts
|
|
573
|
-
.filter((x) => typeof x === 'string' && x.trim().length > 0)
|
|
574
|
-
.slice(0, 500);
|
|
575
1293
|
return {
|
|
576
|
-
|
|
577
|
-
|
|
1294
|
+
ok: true,
|
|
1295
|
+
target: {
|
|
1296
|
+
mode: 'host',
|
|
1297
|
+
host: host,
|
|
1298
|
+
scope,
|
|
1299
|
+
name,
|
|
1300
|
+
...(root.projectRoot ? { projectRoot: root.projectRoot } : {}),
|
|
1301
|
+
},
|
|
1302
|
+
};
|
|
1303
|
+
};
|
|
1304
|
+
const inspectErrorReply = (reply, err) => {
|
|
1305
|
+
const e = err;
|
|
1306
|
+
const status = e.code === 'not_found' ? 404 : e.code === 'bad_request' || e.code === 'unsupported_scope' ? 400 : 502;
|
|
1307
|
+
reply.code(status);
|
|
1308
|
+
return {
|
|
1309
|
+
status: 'error',
|
|
1310
|
+
code: e.code ?? 'inspect_failed',
|
|
1311
|
+
message: e instanceof Error ? e.message : String(err),
|
|
578
1312
|
};
|
|
1313
|
+
};
|
|
1314
|
+
app.post('/api/admin/harness/mcp/inspect', async (req, reply) => {
|
|
1315
|
+
const body = (req.body || {});
|
|
1316
|
+
const rawTarget = body.target ?? body;
|
|
1317
|
+
const parsed = parseInspectTarget(rawTarget);
|
|
1318
|
+
if (!parsed.ok) {
|
|
1319
|
+
reply.code(400);
|
|
1320
|
+
return { status: 'error', code: parsed.code, message: parsed.message };
|
|
1321
|
+
}
|
|
1322
|
+
try {
|
|
1323
|
+
const snapshot = await inspectMcpServer(parsed.target, { refresh: body.refresh === true });
|
|
1324
|
+
return { status: 'ok', ...snapshot };
|
|
1325
|
+
}
|
|
1326
|
+
catch (err) {
|
|
1327
|
+
return inspectErrorReply(reply, err);
|
|
1328
|
+
}
|
|
579
1329
|
});
|
|
580
|
-
|
|
581
|
-
// size budget. Writes sweep on a throttle; this is the manual lever for an operator (or a future
|
|
582
|
-
// console button) that wants it now. Nothing here is correctness-bearing — the cache is derived.
|
|
583
|
-
app.post('/api/admin/harness/translations/prune', async (req) => {
|
|
1330
|
+
app.post('/api/admin/harness/mcp/disconnect', async (req, reply) => {
|
|
584
1331
|
const body = (req.body || {});
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
591
|
-
return { status: 'ok', ...stats };
|
|
1332
|
+
if (typeof body.sessionId !== 'string' || !body.sessionId.trim()) {
|
|
1333
|
+
reply.code(400);
|
|
1334
|
+
return { status: 'error', code: 'bad_request', message: 'sessionId is required' };
|
|
1335
|
+
}
|
|
1336
|
+
const closed = await disconnectMcpSession(body.sessionId.trim());
|
|
1337
|
+
return { status: 'ok', closed };
|
|
592
1338
|
});
|
|
593
|
-
|
|
594
|
-
// PICKER'S PENDING value (test BEFORE save; empty string = "as if unset"); absent → the saved
|
|
595
|
-
// config. Both probes under one diagnostic contract: explicit click = explicit one-call spend,
|
|
596
|
-
// honest verdicts, nothing persisted by the probe itself.
|
|
597
|
-
app.post('/api/admin/harness/translations/probe', async (req) => {
|
|
1339
|
+
app.post('/api/admin/harness/mcp/call-tool', async (req, reply) => {
|
|
598
1340
|
const body = (req.body || {});
|
|
599
|
-
|
|
1341
|
+
if (typeof body.toolName !== 'string' || !body.toolName.trim()) {
|
|
1342
|
+
reply.code(400);
|
|
1343
|
+
return { status: 'error', code: 'bad_request', message: 'toolName is required' };
|
|
1344
|
+
}
|
|
1345
|
+
let target;
|
|
1346
|
+
if (body.target !== undefined) {
|
|
1347
|
+
const parsed = parseInspectTarget(body.target);
|
|
1348
|
+
if (!parsed.ok) {
|
|
1349
|
+
reply.code(400);
|
|
1350
|
+
return { status: 'error', code: parsed.code, message: parsed.message };
|
|
1351
|
+
}
|
|
1352
|
+
target = parsed.target;
|
|
1353
|
+
}
|
|
1354
|
+
const args = body.arguments && typeof body.arguments === 'object' && !Array.isArray(body.arguments)
|
|
1355
|
+
? body.arguments
|
|
1356
|
+
: {};
|
|
1357
|
+
try {
|
|
1358
|
+
const result = await callMcpTool({
|
|
1359
|
+
...(typeof body.sessionId === 'string' && body.sessionId ? { sessionId: body.sessionId } : {}),
|
|
1360
|
+
...(target ? { target } : {}),
|
|
1361
|
+
toolName: body.toolName.trim(),
|
|
1362
|
+
arguments: args,
|
|
1363
|
+
...(typeof body.timeoutMs === 'number' ? { timeoutMs: body.timeoutMs } : {}),
|
|
1364
|
+
});
|
|
1365
|
+
return { status: 'ok', ...result };
|
|
1366
|
+
}
|
|
1367
|
+
catch (err) {
|
|
1368
|
+
return inspectErrorReply(reply, err);
|
|
1369
|
+
}
|
|
600
1370
|
});
|
|
601
|
-
|
|
602
|
-
// the REAL /v1/systemone fallback path; with a pending selection it rides as an explicit
|
|
603
|
-
// `model` through the surface's own admission gates.
|
|
604
|
-
app.post('/api/admin/systemone/probe', async (req) => {
|
|
1371
|
+
app.post('/api/admin/harness/mcp/read-resource', async (req, reply) => {
|
|
605
1372
|
const body = (req.body || {});
|
|
606
|
-
|
|
1373
|
+
if (typeof body.uri !== 'string' || !body.uri.trim()) {
|
|
1374
|
+
reply.code(400);
|
|
1375
|
+
return { status: 'error', code: 'bad_request', message: 'uri is required' };
|
|
1376
|
+
}
|
|
1377
|
+
let target;
|
|
1378
|
+
if (body.target !== undefined) {
|
|
1379
|
+
const parsed = parseInspectTarget(body.target);
|
|
1380
|
+
if (!parsed.ok) {
|
|
1381
|
+
reply.code(400);
|
|
1382
|
+
return { status: 'error', code: parsed.code, message: parsed.message };
|
|
1383
|
+
}
|
|
1384
|
+
target = parsed.target;
|
|
1385
|
+
}
|
|
1386
|
+
try {
|
|
1387
|
+
const result = await readMcpResource({
|
|
1388
|
+
...(typeof body.sessionId === 'string' && body.sessionId ? { sessionId: body.sessionId } : {}),
|
|
1389
|
+
...(target ? { target } : {}),
|
|
1390
|
+
uri: body.uri.trim(),
|
|
1391
|
+
...(typeof body.timeoutMs === 'number' ? { timeoutMs: body.timeoutMs } : {}),
|
|
1392
|
+
});
|
|
1393
|
+
return { status: 'ok', ...result };
|
|
1394
|
+
}
|
|
1395
|
+
catch (err) {
|
|
1396
|
+
return inspectErrorReply(reply, err);
|
|
1397
|
+
}
|
|
607
1398
|
});
|
|
608
|
-
|
|
609
|
-
app.post('/api/admin/harness/apply', async (req, reply) => {
|
|
1399
|
+
app.post('/api/admin/harness/mcp/get-prompt', async (req, reply) => {
|
|
610
1400
|
const body = (req.body || {});
|
|
611
|
-
if (!body.
|
|
1401
|
+
if (typeof body.promptName !== 'string' || !body.promptName.trim()) {
|
|
612
1402
|
reply.code(400);
|
|
613
|
-
return { status: 'error', code: 'bad_request', message: '
|
|
1403
|
+
return { status: 'error', code: 'bad_request', message: 'promptName is required' };
|
|
614
1404
|
}
|
|
615
|
-
|
|
616
|
-
if (
|
|
617
|
-
|
|
618
|
-
|
|
1405
|
+
let target;
|
|
1406
|
+
if (body.target !== undefined) {
|
|
1407
|
+
const parsed = parseInspectTarget(body.target);
|
|
1408
|
+
if (!parsed.ok) {
|
|
1409
|
+
reply.code(400);
|
|
1410
|
+
return { status: 'error', code: parsed.code, message: parsed.message };
|
|
1411
|
+
}
|
|
1412
|
+
target = parsed.target;
|
|
1413
|
+
}
|
|
1414
|
+
const args = body.arguments && typeof body.arguments === 'object' && !Array.isArray(body.arguments)
|
|
1415
|
+
? Object.fromEntries(Object.entries(body.arguments).filter((kv) => typeof kv[1] === 'string'))
|
|
1416
|
+
: undefined;
|
|
1417
|
+
try {
|
|
1418
|
+
const result = await getMcpPrompt({
|
|
1419
|
+
...(typeof body.sessionId === 'string' && body.sessionId ? { sessionId: body.sessionId } : {}),
|
|
1420
|
+
...(target ? { target } : {}),
|
|
1421
|
+
promptName: body.promptName.trim(),
|
|
1422
|
+
...(args ? { arguments: args } : {}),
|
|
1423
|
+
...(typeof body.timeoutMs === 'number' ? { timeoutMs: body.timeoutMs } : {}),
|
|
1424
|
+
});
|
|
1425
|
+
return { status: 'ok', ...result };
|
|
1426
|
+
}
|
|
1427
|
+
catch (err) {
|
|
1428
|
+
return inspectErrorReply(reply, err);
|
|
619
1429
|
}
|
|
620
|
-
return { status: 'ok', ...result };
|
|
621
1430
|
});
|
|
622
1431
|
}
|