@tianshu-ai/tianshu 0.3.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/LICENSE +200 -0
- package/README.md +284 -0
- package/README.zh-CN.md +136 -0
- package/bin/tianshu.mjs +32 -0
- package/package.json +60 -0
- package/packages/plugin-sdk/dist/agent-loop.d.ts +96 -0
- package/packages/plugin-sdk/dist/agent-loop.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/agent-loop.js +11 -0
- package/packages/plugin-sdk/dist/agent-loop.js.map +1 -0
- package/packages/plugin-sdk/dist/capabilities.d.ts +48 -0
- package/packages/plugin-sdk/dist/capabilities.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/capabilities.js +61 -0
- package/packages/plugin-sdk/dist/capabilities.js.map +1 -0
- package/packages/plugin-sdk/dist/catalog.d.ts +60 -0
- package/packages/plugin-sdk/dist/catalog.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/catalog.js +11 -0
- package/packages/plugin-sdk/dist/catalog.js.map +1 -0
- package/packages/plugin-sdk/dist/client.d.ts +171 -0
- package/packages/plugin-sdk/dist/client.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/client.js +96 -0
- package/packages/plugin-sdk/dist/client.js.map +1 -0
- package/packages/plugin-sdk/dist/index.d.ts +9 -0
- package/packages/plugin-sdk/dist/index.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/index.js +19 -0
- package/packages/plugin-sdk/dist/index.js.map +1 -0
- package/packages/plugin-sdk/dist/lsp.d.ts +32 -0
- package/packages/plugin-sdk/dist/lsp.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/lsp.js +19 -0
- package/packages/plugin-sdk/dist/lsp.js.map +1 -0
- package/packages/plugin-sdk/dist/manifest.d.ts +423 -0
- package/packages/plugin-sdk/dist/manifest.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/manifest.js +7 -0
- package/packages/plugin-sdk/dist/manifest.js.map +1 -0
- package/packages/plugin-sdk/dist/mcp-client.d.ts +74 -0
- package/packages/plugin-sdk/dist/mcp-client.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/mcp-client.js +226 -0
- package/packages/plugin-sdk/dist/mcp-client.js.map +1 -0
- package/packages/plugin-sdk/dist/mcp-fetch.d.ts +10 -0
- package/packages/plugin-sdk/dist/mcp-fetch.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/mcp-fetch.js +130 -0
- package/packages/plugin-sdk/dist/mcp-fetch.js.map +1 -0
- package/packages/plugin-sdk/dist/mcp-toolset.d.ts +128 -0
- package/packages/plugin-sdk/dist/mcp-toolset.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/mcp-toolset.js +246 -0
- package/packages/plugin-sdk/dist/mcp-toolset.js.map +1 -0
- package/packages/plugin-sdk/dist/server.d.ts +486 -0
- package/packages/plugin-sdk/dist/server.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/server.js +10 -0
- package/packages/plugin-sdk/dist/server.js.map +1 -0
- package/packages/plugin-sdk/dist/session-inbox.d.ts +56 -0
- package/packages/plugin-sdk/dist/session-inbox.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/session-inbox.js +12 -0
- package/packages/plugin-sdk/dist/session-inbox.js.map +1 -0
- package/packages/plugin-sdk/package.json +36 -0
- package/packages/server/builtinConfig/plugins/README.md +1 -0
- package/packages/server/builtinConfig/plugins/files/manifest.json +100 -0
- package/packages/server/builtinConfig/plugins/files/skills/files-workspace-layout.md +29 -0
- package/packages/server/builtinConfig/plugins/microsandbox/manifest.json +177 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-config.md +38 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-main-orchestration.md +75 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/README.md +26 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/browser.yaml +105 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner-with-browser.yaml +80 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner.yaml +80 -0
- package/packages/server/builtinConfig/plugins/web-search/manifest.json +65 -0
- package/packages/server/builtinConfig/plugins/web-search/skills/web-search-howto.md +69 -0
- package/packages/server/builtinConfig/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
- package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
- package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
- package/packages/server/builtinConfig/plugins/workboard/manifest.json +180 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/large-input-large-output.md +185 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/workboard-howto.md +166 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/worker-creator.md +267 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/worker-fleet.md +431 -0
- package/packages/server/dist/catalog.d.ts +52 -0
- package/packages/server/dist/catalog.d.ts.map +1 -0
- package/packages/server/dist/catalog.js +189 -0
- package/packages/server/dist/catalog.js.map +1 -0
- package/packages/server/dist/chat/active-harnesses.d.ts +34 -0
- package/packages/server/dist/chat/active-harnesses.d.ts.map +1 -0
- package/packages/server/dist/chat/active-harnesses.js +118 -0
- package/packages/server/dist/chat/active-harnesses.js.map +1 -0
- package/packages/server/dist/chat/agent-loop.d.ts +64 -0
- package/packages/server/dist/chat/agent-loop.d.ts.map +1 -0
- package/packages/server/dist/chat/agent-loop.js +597 -0
- package/packages/server/dist/chat/agent-loop.js.map +1 -0
- package/packages/server/dist/chat/agent-tool-adapter.d.ts +33 -0
- package/packages/server/dist/chat/agent-tool-adapter.d.ts.map +1 -0
- package/packages/server/dist/chat/agent-tool-adapter.js +260 -0
- package/packages/server/dist/chat/agent-tool-adapter.js.map +1 -0
- package/packages/server/dist/chat/compact.d.ts +52 -0
- package/packages/server/dist/chat/compact.d.ts.map +1 -0
- package/packages/server/dist/chat/compact.js +248 -0
- package/packages/server/dist/chat/compact.js.map +1 -0
- package/packages/server/dist/chat/dump-system-prompt.d.ts +17 -0
- package/packages/server/dist/chat/dump-system-prompt.d.ts.map +1 -0
- package/packages/server/dist/chat/dump-system-prompt.js +58 -0
- package/packages/server/dist/chat/dump-system-prompt.js.map +1 -0
- package/packages/server/dist/chat/handler.d.ts +186 -0
- package/packages/server/dist/chat/handler.d.ts.map +1 -0
- package/packages/server/dist/chat/handler.js +1248 -0
- package/packages/server/dist/chat/handler.js.map +1 -0
- package/packages/server/dist/chat/image-fit.d.ts +34 -0
- package/packages/server/dist/chat/image-fit.d.ts.map +1 -0
- package/packages/server/dist/chat/image-fit.js +157 -0
- package/packages/server/dist/chat/image-fit.js.map +1 -0
- package/packages/server/dist/chat/messages.d.ts +118 -0
- package/packages/server/dist/chat/messages.d.ts.map +1 -0
- package/packages/server/dist/chat/messages.js +341 -0
- package/packages/server/dist/chat/messages.js.map +1 -0
- package/packages/server/dist/chat/session-inbox.d.ts +114 -0
- package/packages/server/dist/chat/session-inbox.d.ts.map +1 -0
- package/packages/server/dist/chat/session-inbox.js +418 -0
- package/packages/server/dist/chat/session-inbox.js.map +1 -0
- package/packages/server/dist/chat/sqlite-session-repo.d.ts +26 -0
- package/packages/server/dist/chat/sqlite-session-repo.d.ts.map +1 -0
- package/packages/server/dist/chat/sqlite-session-repo.js +132 -0
- package/packages/server/dist/chat/sqlite-session-repo.js.map +1 -0
- package/packages/server/dist/chat/sqlite-session-storage.d.ts +83 -0
- package/packages/server/dist/chat/sqlite-session-storage.d.ts.map +1 -0
- package/packages/server/dist/chat/sqlite-session-storage.js +418 -0
- package/packages/server/dist/chat/sqlite-session-storage.js.map +1 -0
- package/packages/server/dist/chat/stub-execution-env.d.ts +3 -0
- package/packages/server/dist/chat/stub-execution-env.d.ts.map +1 -0
- package/packages/server/dist/chat/stub-execution-env.js +87 -0
- package/packages/server/dist/chat/stub-execution-env.js.map +1 -0
- package/packages/server/dist/chat/token-estimate.d.ts +11 -0
- package/packages/server/dist/chat/token-estimate.d.ts.map +1 -0
- package/packages/server/dist/chat/token-estimate.js +67 -0
- package/packages/server/dist/chat/token-estimate.js.map +1 -0
- package/packages/server/dist/chat/ws-protocol.d.ts +244 -0
- package/packages/server/dist/chat/ws-protocol.d.ts.map +1 -0
- package/packages/server/dist/chat/ws-protocol.js +193 -0
- package/packages/server/dist/chat/ws-protocol.js.map +1 -0
- package/packages/server/dist/cli.d.ts +9 -0
- package/packages/server/dist/cli.d.ts.map +1 -0
- package/packages/server/dist/cli.js +329 -0
- package/packages/server/dist/cli.js.map +1 -0
- package/packages/server/dist/core/agent-seeds.d.ts +25 -0
- package/packages/server/dist/core/agent-seeds.d.ts.map +1 -0
- package/packages/server/dist/core/agent-seeds.js +69 -0
- package/packages/server/dist/core/agent-seeds.js.map +1 -0
- package/packages/server/dist/core/config.d.ts +172 -0
- package/packages/server/dist/core/config.d.ts.map +1 -0
- package/packages/server/dist/core/config.js +155 -0
- package/packages/server/dist/core/config.js.map +1 -0
- package/packages/server/dist/core/db-pool.d.ts +32 -0
- package/packages/server/dist/core/db-pool.d.ts.map +1 -0
- package/packages/server/dist/core/db-pool.js +108 -0
- package/packages/server/dist/core/db-pool.js.map +1 -0
- package/packages/server/dist/core/dev-mode.d.ts +13 -0
- package/packages/server/dist/core/dev-mode.d.ts.map +1 -0
- package/packages/server/dist/core/dev-mode.js +51 -0
- package/packages/server/dist/core/dev-mode.js.map +1 -0
- package/packages/server/dist/core/global-ops.d.ts +54 -0
- package/packages/server/dist/core/global-ops.d.ts.map +1 -0
- package/packages/server/dist/core/global-ops.js +143 -0
- package/packages/server/dist/core/global-ops.js.map +1 -0
- package/packages/server/dist/core/identity-resolvers.d.ts +102 -0
- package/packages/server/dist/core/identity-resolvers.d.ts.map +1 -0
- package/packages/server/dist/core/identity-resolvers.js +176 -0
- package/packages/server/dist/core/identity-resolvers.js.map +1 -0
- package/packages/server/dist/core/index.d.ts +13 -0
- package/packages/server/dist/core/index.d.ts.map +1 -0
- package/packages/server/dist/core/index.js +18 -0
- package/packages/server/dist/core/index.js.map +1 -0
- package/packages/server/dist/core/llm.d.ts +45 -0
- package/packages/server/dist/core/llm.d.ts.map +1 -0
- package/packages/server/dist/core/llm.js +140 -0
- package/packages/server/dist/core/llm.js.map +1 -0
- package/packages/server/dist/core/mcp-manager.d.ts +47 -0
- package/packages/server/dist/core/mcp-manager.d.ts.map +1 -0
- package/packages/server/dist/core/mcp-manager.js +129 -0
- package/packages/server/dist/core/mcp-manager.js.map +1 -0
- package/packages/server/dist/core/middleware.d.ts +31 -0
- package/packages/server/dist/core/middleware.d.ts.map +1 -0
- package/packages/server/dist/core/middleware.js +102 -0
- package/packages/server/dist/core/middleware.js.map +1 -0
- package/packages/server/dist/core/migrations/001-initial.d.ts +4 -0
- package/packages/server/dist/core/migrations/001-initial.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/001-initial.js +66 -0
- package/packages/server/dist/core/migrations/001-initial.js.map +1 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.d.ts +4 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.js +20 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.js.map +1 -0
- package/packages/server/dist/core/migrations/003-session-tree.d.ts +4 -0
- package/packages/server/dist/core/migrations/003-session-tree.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/003-session-tree.js +96 -0
- package/packages/server/dist/core/migrations/003-session-tree.js.map +1 -0
- package/packages/server/dist/core/migrations/003-worker-agents.d.ts +4 -0
- package/packages/server/dist/core/migrations/003-worker-agents.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/003-worker-agents.js +65 -0
- package/packages/server/dist/core/migrations/003-worker-agents.js.map +1 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts +4 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.js +52 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.js.map +1 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.d.ts +4 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.js +64 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.js.map +1 -0
- package/packages/server/dist/core/migrations/006-task-labels.d.ts +4 -0
- package/packages/server/dist/core/migrations/006-task-labels.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/006-task-labels.js +43 -0
- package/packages/server/dist/core/migrations/006-task-labels.js.map +1 -0
- package/packages/server/dist/core/migrations/007-session-inbox.d.ts +4 -0
- package/packages/server/dist/core/migrations/007-session-inbox.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/007-session-inbox.js +67 -0
- package/packages/server/dist/core/migrations/007-session-inbox.js.map +1 -0
- package/packages/server/dist/core/migrations/008-task-intervention.d.ts +4 -0
- package/packages/server/dist/core/migrations/008-task-intervention.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/008-task-intervention.js +60 -0
- package/packages/server/dist/core/migrations/008-task-intervention.js.map +1 -0
- package/packages/server/dist/core/migrations/index.d.ts +12 -0
- package/packages/server/dist/core/migrations/index.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/index.js +58 -0
- package/packages/server/dist/core/migrations/index.js.map +1 -0
- package/packages/server/dist/core/paths.d.ts +53 -0
- package/packages/server/dist/core/paths.d.ts.map +1 -0
- package/packages/server/dist/core/paths.js +125 -0
- package/packages/server/dist/core/paths.js.map +1 -0
- package/packages/server/dist/core/plugins/builtin-loader.d.ts +56 -0
- package/packages/server/dist/core/plugins/builtin-loader.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/builtin-loader.js +153 -0
- package/packages/server/dist/core/plugins/builtin-loader.js.map +1 -0
- package/packages/server/dist/core/plugins/discovery.d.ts +28 -0
- package/packages/server/dist/core/plugins/discovery.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/discovery.js +97 -0
- package/packages/server/dist/core/plugins/discovery.js.map +1 -0
- package/packages/server/dist/core/plugins/index.d.ts +6 -0
- package/packages/server/dist/core/plugins/index.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/index.js +6 -0
- package/packages/server/dist/core/plugins/index.js.map +1 -0
- package/packages/server/dist/core/plugins/manifest.d.ts +9 -0
- package/packages/server/dist/core/plugins/manifest.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/manifest.js +584 -0
- package/packages/server/dist/core/plugins/manifest.js.map +1 -0
- package/packages/server/dist/core/plugins/registry.d.ts +269 -0
- package/packages/server/dist/core/plugins/registry.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/registry.js +1003 -0
- package/packages/server/dist/core/plugins/registry.js.map +1 -0
- package/packages/server/dist/core/plugins/secrets.d.ts +46 -0
- package/packages/server/dist/core/plugins/secrets.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/secrets.js +174 -0
- package/packages/server/dist/core/plugins/secrets.js.map +1 -0
- package/packages/server/dist/core/plugins/skills.d.ts +131 -0
- package/packages/server/dist/core/plugins/skills.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/skills.js +389 -0
- package/packages/server/dist/core/plugins/skills.js.map +1 -0
- package/packages/server/dist/core/templates.d.ts +28 -0
- package/packages/server/dist/core/templates.d.ts.map +1 -0
- package/packages/server/dist/core/templates.js +103 -0
- package/packages/server/dist/core/templates.js.map +1 -0
- package/packages/server/dist/core/tenant-context.d.ts +18 -0
- package/packages/server/dist/core/tenant-context.d.ts.map +1 -0
- package/packages/server/dist/core/tenant-context.js +42 -0
- package/packages/server/dist/core/tenant-context.js.map +1 -0
- package/packages/server/dist/core/tenant-id.d.ts +8 -0
- package/packages/server/dist/core/tenant-id.d.ts.map +1 -0
- package/packages/server/dist/core/tenant-id.js +53 -0
- package/packages/server/dist/core/tenant-id.js.map +1 -0
- package/packages/server/dist/core/tenant-skills.d.ts +29 -0
- package/packages/server/dist/core/tenant-skills.d.ts.map +1 -0
- package/packages/server/dist/core/tenant-skills.js +77 -0
- package/packages/server/dist/core/tenant-skills.js.map +1 -0
- package/packages/server/dist/core/worker-agents-fs.d.ts +44 -0
- package/packages/server/dist/core/worker-agents-fs.d.ts.map +1 -0
- package/packages/server/dist/core/worker-agents-fs.js +86 -0
- package/packages/server/dist/core/worker-agents-fs.js.map +1 -0
- package/packages/server/dist/core/worker-agents.d.ts +77 -0
- package/packages/server/dist/core/worker-agents.d.ts.map +1 -0
- package/packages/server/dist/core/worker-agents.js +191 -0
- package/packages/server/dist/core/worker-agents.js.map +1 -0
- package/packages/server/dist/index.d.ts +2 -0
- package/packages/server/dist/index.d.ts.map +1 -0
- package/packages/server/dist/index.js +623 -0
- package/packages/server/dist/index.js.map +1 -0
- package/packages/server/dist/lsp/client.d.ts +53 -0
- package/packages/server/dist/lsp/client.d.ts.map +1 -0
- package/packages/server/dist/lsp/client.js +258 -0
- package/packages/server/dist/lsp/client.js.map +1 -0
- package/packages/server/dist/lsp/format.d.ts +13 -0
- package/packages/server/dist/lsp/format.d.ts.map +1 -0
- package/packages/server/dist/lsp/format.js +55 -0
- package/packages/server/dist/lsp/format.js.map +1 -0
- package/packages/server/dist/lsp/index.d.ts +20 -0
- package/packages/server/dist/lsp/index.d.ts.map +1 -0
- package/packages/server/dist/lsp/index.js +32 -0
- package/packages/server/dist/lsp/index.js.map +1 -0
- package/packages/server/dist/lsp/language-registry.d.ts +29 -0
- package/packages/server/dist/lsp/language-registry.d.ts.map +1 -0
- package/packages/server/dist/lsp/language-registry.js +62 -0
- package/packages/server/dist/lsp/language-registry.js.map +1 -0
- package/packages/server/dist/lsp/manager.d.ts +77 -0
- package/packages/server/dist/lsp/manager.d.ts.map +1 -0
- package/packages/server/dist/lsp/manager.js +300 -0
- package/packages/server/dist/lsp/manager.js.map +1 -0
- package/packages/server/dist/plugins-routes.d.ts +96 -0
- package/packages/server/dist/plugins-routes.d.ts.map +1 -0
- package/packages/server/dist/plugins-routes.js +627 -0
- package/packages/server/dist/plugins-routes.js.map +1 -0
- package/packages/server/dist/setup/checks/config.d.ts +9 -0
- package/packages/server/dist/setup/checks/config.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/config.js +66 -0
- package/packages/server/dist/setup/checks/config.js.map +1 -0
- package/packages/server/dist/setup/checks/db.d.ts +6 -0
- package/packages/server/dist/setup/checks/db.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/db.js +79 -0
- package/packages/server/dist/setup/checks/db.js.map +1 -0
- package/packages/server/dist/setup/checks/known-models.d.ts +18 -0
- package/packages/server/dist/setup/checks/known-models.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/known-models.js +119 -0
- package/packages/server/dist/setup/checks/known-models.js.map +1 -0
- package/packages/server/dist/setup/checks/network.d.ts +11 -0
- package/packages/server/dist/setup/checks/network.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/network.js +176 -0
- package/packages/server/dist/setup/checks/network.js.map +1 -0
- package/packages/server/dist/setup/checks/plugins.d.ts +9 -0
- package/packages/server/dist/setup/checks/plugins.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/plugins.js +194 -0
- package/packages/server/dist/setup/checks/plugins.js.map +1 -0
- package/packages/server/dist/setup/checks/providers.d.ts +12 -0
- package/packages/server/dist/setup/checks/providers.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/providers.js +368 -0
- package/packages/server/dist/setup/checks/providers.js.map +1 -0
- package/packages/server/dist/setup/checks/runtime.d.ts +3 -0
- package/packages/server/dist/setup/checks/runtime.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/runtime.js +44 -0
- package/packages/server/dist/setup/checks/runtime.js.map +1 -0
- package/packages/server/dist/setup/checks/sandbox.d.ts +9 -0
- package/packages/server/dist/setup/checks/sandbox.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/sandbox.js +110 -0
- package/packages/server/dist/setup/checks/sandbox.js.map +1 -0
- package/packages/server/dist/setup/checks/tenants.d.ts +9 -0
- package/packages/server/dist/setup/checks/tenants.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/tenants.js +509 -0
- package/packages/server/dist/setup/checks/tenants.js.map +1 -0
- package/packages/server/dist/setup/cli-agent.d.ts +39 -0
- package/packages/server/dist/setup/cli-agent.d.ts.map +1 -0
- package/packages/server/dist/setup/cli-agent.js +1353 -0
- package/packages/server/dist/setup/cli-agent.js.map +1 -0
- package/packages/server/dist/setup/doctor.d.ts +32 -0
- package/packages/server/dist/setup/doctor.d.ts.map +1 -0
- package/packages/server/dist/setup/doctor.js +80 -0
- package/packages/server/dist/setup/doctor.js.map +1 -0
- package/packages/server/dist/setup/launchd.d.ts +107 -0
- package/packages/server/dist/setup/launchd.d.ts.map +1 -0
- package/packages/server/dist/setup/launchd.js +309 -0
- package/packages/server/dist/setup/launchd.js.map +1 -0
- package/packages/server/dist/setup/load-env.d.ts +21 -0
- package/packages/server/dist/setup/load-env.d.ts.map +1 -0
- package/packages/server/dist/setup/load-env.js +88 -0
- package/packages/server/dist/setup/load-env.js.map +1 -0
- package/packages/server/dist/setup/probe-default-model.d.ts +28 -0
- package/packages/server/dist/setup/probe-default-model.d.ts.map +1 -0
- package/packages/server/dist/setup/probe-default-model.js +133 -0
- package/packages/server/dist/setup/probe-default-model.js.map +1 -0
- package/packages/server/dist/setup/render.d.ts +28 -0
- package/packages/server/dist/setup/render.d.ts.map +1 -0
- package/packages/server/dist/setup/render.js +60 -0
- package/packages/server/dist/setup/render.js.map +1 -0
- package/packages/server/dist/setup/repo-root.d.ts +3 -0
- package/packages/server/dist/setup/repo-root.d.ts.map +1 -0
- package/packages/server/dist/setup/repo-root.js +43 -0
- package/packages/server/dist/setup/repo-root.js.map +1 -0
- package/packages/server/dist/setup/service.d.ts +60 -0
- package/packages/server/dist/setup/service.d.ts.map +1 -0
- package/packages/server/dist/setup/service.js +345 -0
- package/packages/server/dist/setup/service.js.map +1 -0
- package/packages/server/dist/setup/start-server.d.ts +23 -0
- package/packages/server/dist/setup/start-server.d.ts.map +1 -0
- package/packages/server/dist/setup/start-server.js +465 -0
- package/packages/server/dist/setup/start-server.js.map +1 -0
- package/packages/server/dist/setup/wizard.d.ts +59 -0
- package/packages/server/dist/setup/wizard.d.ts.map +1 -0
- package/packages/server/dist/setup/wizard.js +556 -0
- package/packages/server/dist/setup/wizard.js.map +1 -0
- package/packages/server/dist/tools/edit-file.d.ts +13 -0
- package/packages/server/dist/tools/edit-file.d.ts.map +1 -0
- package/packages/server/dist/tools/edit-file.js +90 -0
- package/packages/server/dist/tools/edit-file.js.map +1 -0
- package/packages/server/dist/tools/glob.d.ts +12 -0
- package/packages/server/dist/tools/glob.d.ts.map +1 -0
- package/packages/server/dist/tools/glob.js +82 -0
- package/packages/server/dist/tools/glob.js.map +1 -0
- package/packages/server/dist/tools/index.d.ts +82 -0
- package/packages/server/dist/tools/index.d.ts.map +1 -0
- package/packages/server/dist/tools/index.js +72 -0
- package/packages/server/dist/tools/index.js.map +1 -0
- package/packages/server/dist/tools/list-dir.d.ts +24 -0
- package/packages/server/dist/tools/list-dir.d.ts.map +1 -0
- package/packages/server/dist/tools/list-dir.js +99 -0
- package/packages/server/dist/tools/list-dir.js.map +1 -0
- package/packages/server/dist/tools/path-helper.d.ts +15 -0
- package/packages/server/dist/tools/path-helper.d.ts.map +1 -0
- package/packages/server/dist/tools/path-helper.js +72 -0
- package/packages/server/dist/tools/path-helper.js.map +1 -0
- package/packages/server/dist/tools/read-file.d.ts +17 -0
- package/packages/server/dist/tools/read-file.d.ts.map +1 -0
- package/packages/server/dist/tools/read-file.js +94 -0
- package/packages/server/dist/tools/read-file.js.map +1 -0
- package/packages/server/dist/tools/sandbox.d.ts +57 -0
- package/packages/server/dist/tools/sandbox.d.ts.map +1 -0
- package/packages/server/dist/tools/sandbox.js +291 -0
- package/packages/server/dist/tools/sandbox.js.map +1 -0
- package/packages/server/dist/tools/write-file.d.ts +12 -0
- package/packages/server/dist/tools/write-file.d.ts.map +1 -0
- package/packages/server/dist/tools/write-file.js +67 -0
- package/packages/server/dist/tools/write-file.js.map +1 -0
- package/packages/server/dist/worker-agents-routes.d.ts +11 -0
- package/packages/server/dist/worker-agents-routes.d.ts.map +1 -0
- package/packages/server/dist/worker-agents-routes.js +253 -0
- package/packages/server/dist/worker-agents-routes.js.map +1 -0
- package/packages/server/package.json +41 -0
- package/packages/web/dist/assets/index-DH-gJ09_.js +60 -0
- package/packages/web/dist/assets/index-xU4lYYqY.css +2 -0
- package/packages/web/dist/index.html +14 -0
- package/packages/web/package.json +36 -0
- package/plugins/README.md +64 -0
- package/plugins/files/dist/client.d.ts +5 -0
- package/plugins/files/dist/client.d.ts.map +1 -0
- package/plugins/files/dist/client.js +354 -0
- package/plugins/files/dist/client.js.map +1 -0
- package/plugins/files/dist/server.d.ts +32 -0
- package/plugins/files/dist/server.d.ts.map +1 -0
- package/plugins/files/dist/server.js +514 -0
- package/plugins/files/dist/server.js.map +1 -0
- package/plugins/files/dist/tools/edit-file.d.ts +29 -0
- package/plugins/files/dist/tools/edit-file.d.ts.map +1 -0
- package/plugins/files/dist/tools/edit-file.js +230 -0
- package/plugins/files/dist/tools/edit-file.js.map +1 -0
- package/plugins/files/dist/tools/edit-file.prompt.md +36 -0
- package/plugins/files/dist/tools/glob.d.ts +12 -0
- package/plugins/files/dist/tools/glob.d.ts.map +1 -0
- package/plugins/files/dist/tools/glob.js +84 -0
- package/plugins/files/dist/tools/glob.js.map +1 -0
- package/plugins/files/dist/tools/index.d.ts +13 -0
- package/plugins/files/dist/tools/index.d.ts.map +1 -0
- package/plugins/files/dist/tools/index.js +158 -0
- package/plugins/files/dist/tools/index.js.map +1 -0
- package/plugins/files/dist/tools/list-dir.d.ts +24 -0
- package/plugins/files/dist/tools/list-dir.d.ts.map +1 -0
- package/plugins/files/dist/tools/list-dir.js +104 -0
- package/plugins/files/dist/tools/list-dir.js.map +1 -0
- package/plugins/files/dist/tools/load-prompt.d.ts +5 -0
- package/plugins/files/dist/tools/load-prompt.d.ts.map +1 -0
- package/plugins/files/dist/tools/load-prompt.js +39 -0
- package/plugins/files/dist/tools/load-prompt.js.map +1 -0
- package/plugins/files/dist/tools/path-helper.d.ts +32 -0
- package/plugins/files/dist/tools/path-helper.d.ts.map +1 -0
- package/plugins/files/dist/tools/path-helper.js +113 -0
- package/plugins/files/dist/tools/path-helper.js.map +1 -0
- package/plugins/files/dist/tools/read-file.d.ts +17 -0
- package/plugins/files/dist/tools/read-file.d.ts.map +1 -0
- package/plugins/files/dist/tools/read-file.js +109 -0
- package/plugins/files/dist/tools/read-file.js.map +1 -0
- package/plugins/files/dist/tools/read-tracker.d.ts +28 -0
- package/plugins/files/dist/tools/read-tracker.d.ts.map +1 -0
- package/plugins/files/dist/tools/read-tracker.js +135 -0
- package/plugins/files/dist/tools/read-tracker.js.map +1 -0
- package/plugins/files/dist/tools/replacers.d.ts +27 -0
- package/plugins/files/dist/tools/replacers.d.ts.map +1 -0
- package/plugins/files/dist/tools/replacers.js +221 -0
- package/plugins/files/dist/tools/replacers.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-delete.d.ts +12 -0
- package/plugins/files/dist/tools/tenant-config-delete.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-delete.js +70 -0
- package/plugins/files/dist/tools/tenant-config-delete.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-edit.d.ts +25 -0
- package/plugins/files/dist/tools/tenant-config-edit.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-edit.js +142 -0
- package/plugins/files/dist/tools/tenant-config-edit.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-glob.d.ts +12 -0
- package/plugins/files/dist/tools/tenant-config-glob.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-glob.js +64 -0
- package/plugins/files/dist/tools/tenant-config-glob.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-helper.d.ts +64 -0
- package/plugins/files/dist/tools/tenant-config-helper.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-helper.js +162 -0
- package/plugins/files/dist/tools/tenant-config-helper.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-list.d.ts +20 -0
- package/plugins/files/dist/tools/tenant-config-list.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-list.js +95 -0
- package/plugins/files/dist/tools/tenant-config-list.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-read.d.ts +17 -0
- package/plugins/files/dist/tools/tenant-config-read.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-read.js +87 -0
- package/plugins/files/dist/tools/tenant-config-read.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-write.d.ts +14 -0
- package/plugins/files/dist/tools/tenant-config-write.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-write.js +78 -0
- package/plugins/files/dist/tools/tenant-config-write.js.map +1 -0
- package/plugins/files/dist/tools/text-shape.d.ts +20 -0
- package/plugins/files/dist/tools/text-shape.d.ts.map +1 -0
- package/plugins/files/dist/tools/text-shape.js +57 -0
- package/plugins/files/dist/tools/text-shape.js.map +1 -0
- package/plugins/files/dist/tools/write-file.d.ts +12 -0
- package/plugins/files/dist/tools/write-file.d.ts.map +1 -0
- package/plugins/files/dist/tools/write-file.js +89 -0
- package/plugins/files/dist/tools/write-file.js.map +1 -0
- package/plugins/files/dist/tools/write-file.prompt.md +14 -0
- package/plugins/files/manifest.json +100 -0
- package/plugins/files/package.json +39 -0
- package/plugins/files/skills/files-workspace-layout.md +29 -0
- package/plugins/microsandbox/dist/admin/browser-routes.d.ts +41 -0
- package/plugins/microsandbox/dist/admin/browser-routes.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/browser-routes.js +208 -0
- package/plugins/microsandbox/dist/admin/browser-routes.js.map +1 -0
- package/plugins/microsandbox/dist/admin/preview-exec.d.ts +38 -0
- package/plugins/microsandbox/dist/admin/preview-exec.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/preview-exec.js +185 -0
- package/plugins/microsandbox/dist/admin/preview-exec.js.map +1 -0
- package/plugins/microsandbox/dist/admin/routes.d.ts +35 -0
- package/plugins/microsandbox/dist/admin/routes.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/routes.js +728 -0
- package/plugins/microsandbox/dist/admin/routes.js.map +1 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts +11 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.js +72 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.js.map +1 -0
- package/plugins/microsandbox/dist/admin/templates.d.ts +16 -0
- package/plugins/microsandbox/dist/admin/templates.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/templates.js +66 -0
- package/plugins/microsandbox/dist/admin/templates.js.map +1 -0
- package/plugins/microsandbox/dist/admin.d.ts +5 -0
- package/plugins/microsandbox/dist/admin.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin.js +256 -0
- package/plugins/microsandbox/dist/admin.js.map +1 -0
- package/plugins/microsandbox/dist/build/builder.d.ts +69 -0
- package/plugins/microsandbox/dist/build/builder.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/builder.js +257 -0
- package/plugins/microsandbox/dist/build/builder.js.map +1 -0
- package/plugins/microsandbox/dist/build/metadata.d.ts +27 -0
- package/plugins/microsandbox/dist/build/metadata.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/metadata.js +55 -0
- package/plugins/microsandbox/dist/build/metadata.js.map +1 -0
- package/plugins/microsandbox/dist/build/pointer.d.ts +51 -0
- package/plugins/microsandbox/dist/build/pointer.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/pointer.js +130 -0
- package/plugins/microsandbox/dist/build/pointer.js.map +1 -0
- package/plugins/microsandbox/dist/build/sandboxfile.d.ts +15 -0
- package/plugins/microsandbox/dist/build/sandboxfile.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/sandboxfile.js +176 -0
- package/plugins/microsandbox/dist/build/sandboxfile.js.map +1 -0
- package/plugins/microsandbox/dist/client.d.ts +5 -0
- package/plugins/microsandbox/dist/client.d.ts.map +1 -0
- package/plugins/microsandbox/dist/client.js +941 -0
- package/plugins/microsandbox/dist/client.js.map +1 -0
- package/plugins/microsandbox/dist/runner/browser.d.ts +50 -0
- package/plugins/microsandbox/dist/runner/browser.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/browser.js +142 -0
- package/plugins/microsandbox/dist/runner/browser.js.map +1 -0
- package/plugins/microsandbox/dist/runner/free-port.d.ts +6 -0
- package/plugins/microsandbox/dist/runner/free-port.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/free-port.js +53 -0
- package/plugins/microsandbox/dist/runner/free-port.js.map +1 -0
- package/plugins/microsandbox/dist/runner/index.d.ts +28 -0
- package/plugins/microsandbox/dist/runner/index.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/index.js +72 -0
- package/plugins/microsandbox/dist/runner/index.js.map +1 -0
- package/plugins/microsandbox/dist/runner/microsandbox.d.ts +64 -0
- package/plugins/microsandbox/dist/runner/microsandbox.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/microsandbox.js +668 -0
- package/plugins/microsandbox/dist/runner/microsandbox.js.map +1 -0
- package/plugins/microsandbox/dist/runner/nullable.d.ts +36 -0
- package/plugins/microsandbox/dist/runner/nullable.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/nullable.js +82 -0
- package/plugins/microsandbox/dist/runner/nullable.js.map +1 -0
- package/plugins/microsandbox/dist/runner/pool.d.ts +97 -0
- package/plugins/microsandbox/dist/runner/pool.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/pool.js +494 -0
- package/plugins/microsandbox/dist/runner/pool.js.map +1 -0
- package/plugins/microsandbox/dist/runner/types.d.ts +33 -0
- package/plugins/microsandbox/dist/runner/types.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/types.js +79 -0
- package/plugins/microsandbox/dist/runner/types.js.map +1 -0
- package/plugins/microsandbox/dist/server.d.ts +7 -0
- package/plugins/microsandbox/dist/server.d.ts.map +1 -0
- package/plugins/microsandbox/dist/server.js +276 -0
- package/plugins/microsandbox/dist/server.js.map +1 -0
- package/plugins/microsandbox/dist/tools/browser.d.ts +25 -0
- package/plugins/microsandbox/dist/tools/browser.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/browser.js +78 -0
- package/plugins/microsandbox/dist/tools/browser.js.map +1 -0
- package/plugins/microsandbox/dist/tools/build.d.ts +5 -0
- package/plugins/microsandbox/dist/tools/build.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/build.js +243 -0
- package/plugins/microsandbox/dist/tools/build.js.map +1 -0
- package/plugins/microsandbox/dist/tools/index.d.ts +9 -0
- package/plugins/microsandbox/dist/tools/index.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/index.js +430 -0
- package/plugins/microsandbox/dist/tools/index.js.map +1 -0
- package/plugins/microsandbox/dist/tools/mcp-client.d.ts +63 -0
- package/plugins/microsandbox/dist/tools/mcp-client.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/mcp-client.js +226 -0
- package/plugins/microsandbox/dist/tools/mcp-client.js.map +1 -0
- package/plugins/microsandbox/manifest.json +177 -0
- package/plugins/microsandbox/package.json +38 -0
- package/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
- package/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
- package/plugins/microsandbox/skills/microsandbox-config.md +38 -0
- package/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
- package/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
- package/plugins/microsandbox/templates/README.md +26 -0
- package/plugins/web-search/dist/server.d.ts +4 -0
- package/plugins/web-search/dist/server.d.ts.map +1 -0
- package/plugins/web-search/dist/server.js +73 -0
- package/plugins/web-search/dist/server.js.map +1 -0
- package/plugins/web-search/dist/tools/health.d.ts +31 -0
- package/plugins/web-search/dist/tools/health.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/health.js +59 -0
- package/plugins/web-search/dist/tools/health.js.map +1 -0
- package/plugins/web-search/dist/tools/index.d.ts +3 -0
- package/plugins/web-search/dist/tools/index.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/index.js +2 -0
- package/plugins/web-search/dist/tools/index.js.map +1 -0
- package/plugins/web-search/dist/tools/providers.d.ts +43 -0
- package/plugins/web-search/dist/tools/providers.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/providers.js +140 -0
- package/plugins/web-search/dist/tools/providers.js.map +1 -0
- package/plugins/web-search/dist/tools/web-search.d.ts +15 -0
- package/plugins/web-search/dist/tools/web-search.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/web-search.js +244 -0
- package/plugins/web-search/dist/tools/web-search.js.map +1 -0
- package/plugins/web-search/manifest.json +65 -0
- package/plugins/web-search/node_modules/@esbuild/darwin-arm64/README.md +3 -0
- package/plugins/web-search/node_modules/@esbuild/darwin-arm64/package.json +20 -0
- package/plugins/web-search/node_modules/@vitest/expect/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/expect/README.md +21 -0
- package/plugins/web-search/node_modules/@vitest/expect/dist/index.d.ts +808 -0
- package/plugins/web-search/node_modules/@vitest/expect/dist/index.js +1799 -0
- package/plugins/web-search/node_modules/@vitest/expect/package.json +46 -0
- package/plugins/web-search/node_modules/@vitest/mocker/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/mocker/README.md +5 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.d.ts +2 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.js +9 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.d.ts +53 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.js +91 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js +15 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-mocker.js +1602 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js +174 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-registry.js +182 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-utils.js +16 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/index.d.ts +21 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/index.js +174 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/mocker.d-Ce9_ySj5.d.ts +83 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/node.d.ts +821 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/node.js +1306 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.d.ts +3 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.js +75 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/register.d.ts +9 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/register.js +41 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/registry.d-D765pazg.d.ts +87 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/types.d-D_aRZRdy.d.ts +8 -0
- package/plugins/web-search/node_modules/@vitest/mocker/package.json +82 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.d.ts +119 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.js +1387 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/package.json +44 -0
- package/plugins/web-search/node_modules/@vitest/runner/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/runner/README.md +5 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/chunk-hooks.js +2254 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/index.d.ts +261 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/index.js +6 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/tasks.d-CkscK4of.d.ts +558 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/types.d.ts +163 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/types.js +1 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/utils.d.ts +47 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/utils.js +6 -0
- package/plugins/web-search/node_modules/@vitest/runner/package.json +49 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/README.md +84 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts +22 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d.ts +16 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.js +40 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.d.ts +137 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.js +2305 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.d.ts +18 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.js +73 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/package.json +54 -0
- package/plugins/web-search/node_modules/@vitest/spy/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/spy/README.md +3 -0
- package/plugins/web-search/node_modules/@vitest/spy/dist/index.d.ts +356 -0
- package/plugins/web-search/node_modules/@vitest/spy/dist/index.js +191 -0
- package/plugins/web-search/node_modules/@vitest/spy/package.json +38 -0
- package/plugins/web-search/node_modules/@vitest/utils/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +158 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/diff.d.ts +104 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/diff.js +2185 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/error.d.ts +9 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/error.js +162 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.d.ts +56 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.js +251 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/index.d.ts +57 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/index.js +633 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.d.ts +139 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.js +996 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts +53 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/types.d.ts +53 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/types.js +1 -0
- package/plugins/web-search/node_modules/@vitest/utils/package.json +77 -0
- package/plugins/web-search/node_modules/chai/LICENSE +21 -0
- package/plugins/web-search/node_modules/chai/README.md +162 -0
- package/plugins/web-search/node_modules/chai/package.json +74 -0
- package/plugins/web-search/node_modules/esbuild/README.md +3 -0
- package/plugins/web-search/node_modules/esbuild/package.json +49 -0
- package/plugins/web-search/node_modules/std-env/README.md +118 -0
- package/plugins/web-search/node_modules/std-env/dist/index.cjs +1 -0
- package/plugins/web-search/node_modules/std-env/dist/index.d.cts +92 -0
- package/plugins/web-search/node_modules/std-env/dist/index.d.mts +92 -0
- package/plugins/web-search/node_modules/std-env/dist/index.d.ts +92 -0
- package/plugins/web-search/node_modules/std-env/dist/index.mjs +1 -0
- package/plugins/web-search/node_modules/std-env/package.json +46 -0
- package/plugins/web-search/node_modules/tinyexec/LICENSE +21 -0
- package/plugins/web-search/node_modules/tinyexec/README.md +256 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.cjs +575 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.d.cts +70 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.d.ts +70 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.js +578 -0
- package/plugins/web-search/node_modules/tinyexec/package.json +66 -0
- package/plugins/web-search/node_modules/tinyrainbow/README.md +28 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/browser.d.ts +8 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/browser.js +20 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +90 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/index-8b61d5bc.d.ts +59 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/node.d.ts +8 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/node.js +22 -0
- package/plugins/web-search/node_modules/tinyrainbow/package.json +37 -0
- package/plugins/web-search/node_modules/typescript/README.md +50 -0
- package/plugins/web-search/node_modules/typescript/package.json +120 -0
- package/plugins/web-search/node_modules/vite/README.md +20 -0
- package/plugins/web-search/node_modules/vite/dist/client/client.mjs +1106 -0
- package/plugins/web-search/node_modules/vite/dist/client/env.mjs +19 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/build.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/build2.js +5538 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/chunk.js +48 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/config.js +36065 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/config2.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/dist.js +6758 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/lib.js +377 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/logger.js +329 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/optimizer.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/postcss-import.js +479 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/preview.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/server.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/cli.js +698 -0
- package/plugins/web-search/node_modules/vite/dist/node/index.d.ts +3717 -0
- package/plugins/web-search/node_modules/vite/dist/node/index.js +30 -0
- package/plugins/web-search/node_modules/vite/dist/node/module-runner.d.ts +311 -0
- package/plugins/web-search/node_modules/vite/dist/node/module-runner.js +1160 -0
- package/plugins/web-search/node_modules/vite/package.json +199 -0
- package/plugins/web-search/node_modules/vite/types/package.json +4 -0
- package/plugins/web-search/node_modules/vitest/README.md +7 -0
- package/plugins/web-search/node_modules/vitest/dist/browser.d.ts +34 -0
- package/plugins/web-search/node_modules/vitest/dist/browser.js +8 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +7 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/base.DfmxU-tU.js +38 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.CYdenmiT.js +37 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.d.BwvBVTda.d.ts +24 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/cac.0BJqEUeA.js +1469 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/cli-api.DWGBtMmz.js +10660 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/config.d.BKdhh7Zx.d.ts +224 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/console.CtFJOzRO.js +153 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/constants.DnKduX2e.js +44 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DVF1vEu8.js +25 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DfSpMS-b.js +4350 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/creator.GK6I-cL4.js +640 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +73 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/defaults.B7q_naMc.js +115 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/env.D4Lgay0q.js +8 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/environment.d.cL3nLXbE.d.ts +119 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/execute.B7h3T_Hc.js +708 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/git.BVQ8w_Sw.js +72 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/global.d.MAmajcmJ.d.ts +136 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/globals.DEHgCU4V.js +26 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.B521nVV-.js +157 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.BCWujgDG.js +231 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.CdQS2e2Q.js +37 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.CmSc2RE5.js +587 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.CwejwG0H.js +105 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.D3XRDfWc.js +213 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.VByaPkjc.js +2183 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.X0nbfr6-.js +6584 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/inspector.C914Efll.js +57 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/mocker.d.BE_2ls6u.d.ts +17 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/node.fjCdwEIl.js +15 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/reporters.d.BuRON0I0.d.ts +3168 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/rpc.-pEldfrD.js +83 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/runBaseTests.9Ij9_de-.js +129 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/setup-common.Dd054P77.js +60 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/suite.d.FvehnV49.d.ts +10 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/typechecker.DRKU1-1g.js +874 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/utils.CAioKnHs.js +61 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +65 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +4015 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/vite.d.BnOPPc46.d.ts +25 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/vm.BThCzidc.js +756 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.CUgIPz9V.d.ts +176 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.uzWsCv9X.d.ts +8 -0
- package/plugins/web-search/node_modules/vitest/dist/cli.js +27 -0
- package/plugins/web-search/node_modules/vitest/dist/config.cjs +148 -0
- package/plugins/web-search/node_modules/vitest/dist/config.d.ts +100 -0
- package/plugins/web-search/node_modules/vitest/dist/config.js +21 -0
- package/plugins/web-search/node_modules/vitest/dist/coverage.d.ts +108 -0
- package/plugins/web-search/node_modules/vitest/dist/coverage.js +34 -0
- package/plugins/web-search/node_modules/vitest/dist/environments.d.ts +26 -0
- package/plugins/web-search/node_modules/vitest/dist/environments.js +2 -0
- package/plugins/web-search/node_modules/vitest/dist/execute.d.ts +150 -0
- package/plugins/web-search/node_modules/vitest/dist/execute.js +13 -0
- package/plugins/web-search/node_modules/vitest/dist/index.d.ts +651 -0
- package/plugins/web-search/node_modules/vitest/dist/index.js +18 -0
- package/plugins/web-search/node_modules/vitest/dist/mocker.d.ts +1 -0
- package/plugins/web-search/node_modules/vitest/dist/mocker.js +1 -0
- package/plugins/web-search/node_modules/vitest/dist/node.d.ts +158 -0
- package/plugins/web-search/node_modules/vitest/dist/node.js +105 -0
- package/plugins/web-search/node_modules/vitest/dist/path.js +7 -0
- package/plugins/web-search/node_modules/vitest/dist/reporters.d.ts +25 -0
- package/plugins/web-search/node_modules/vitest/dist/reporters.js +23 -0
- package/plugins/web-search/node_modules/vitest/dist/runners.d.ts +46 -0
- package/plugins/web-search/node_modules/vitest/dist/runners.js +235 -0
- package/plugins/web-search/node_modules/vitest/dist/snapshot.d.ts +9 -0
- package/plugins/web-search/node_modules/vitest/dist/snapshot.js +4 -0
- package/plugins/web-search/node_modules/vitest/dist/spy.js +1 -0
- package/plugins/web-search/node_modules/vitest/dist/suite.d.ts +5 -0
- package/plugins/web-search/node_modules/vitest/dist/suite.js +5 -0
- package/plugins/web-search/node_modules/vitest/dist/worker.js +124 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/forks.js +43 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/runVmTests.js +90 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/threads.js +31 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/vmForks.js +47 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/vmThreads.js +37 -0
- package/plugins/web-search/node_modules/vitest/dist/workers.d.ts +40 -0
- package/plugins/web-search/node_modules/vitest/dist/workers.js +30 -0
- package/plugins/web-search/node_modules/vitest/package.json +207 -0
- package/plugins/web-search/package.json +30 -0
- package/plugins/web-search/skills/web-search-howto.md +69 -0
- package/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
- package/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
- package/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
- package/plugins/workboard/dist/client.d.ts +5 -0
- package/plugins/workboard/dist/client.d.ts.map +1 -0
- package/plugins/workboard/dist/client.js +895 -0
- package/plugins/workboard/dist/client.js.map +1 -0
- package/plugins/workboard/dist/db/agents.d.ts +100 -0
- package/plugins/workboard/dist/db/agents.d.ts.map +1 -0
- package/plugins/workboard/dist/db/agents.js +280 -0
- package/plugins/workboard/dist/db/agents.js.map +1 -0
- package/plugins/workboard/dist/db/schema.d.ts +3 -0
- package/plugins/workboard/dist/db/schema.d.ts.map +1 -0
- package/plugins/workboard/dist/db/schema.js +31 -0
- package/plugins/workboard/dist/db/schema.js.map +1 -0
- package/plugins/workboard/dist/db/session-history.d.ts +28 -0
- package/plugins/workboard/dist/db/session-history.d.ts.map +1 -0
- package/plugins/workboard/dist/db/session-history.js +224 -0
- package/plugins/workboard/dist/db/session-history.js.map +1 -0
- package/plugins/workboard/dist/db/tasks.d.ts +260 -0
- package/plugins/workboard/dist/db/tasks.d.ts.map +1 -0
- package/plugins/workboard/dist/db/tasks.js +451 -0
- package/plugins/workboard/dist/db/tasks.js.map +1 -0
- package/plugins/workboard/dist/db/worker-agents.d.ts +16 -0
- package/plugins/workboard/dist/db/worker-agents.d.ts.map +1 -0
- package/plugins/workboard/dist/db/worker-agents.js +62 -0
- package/plugins/workboard/dist/db/worker-agents.js.map +1 -0
- package/plugins/workboard/dist/effective-skills.d.ts +13 -0
- package/plugins/workboard/dist/effective-skills.d.ts.map +1 -0
- package/plugins/workboard/dist/effective-skills.js +126 -0
- package/plugins/workboard/dist/effective-skills.js.map +1 -0
- package/plugins/workboard/dist/fs-worker-agents.d.ts +35 -0
- package/plugins/workboard/dist/fs-worker-agents.d.ts.map +1 -0
- package/plugins/workboard/dist/fs-worker-agents.js +199 -0
- package/plugins/workboard/dist/fs-worker-agents.js.map +1 -0
- package/plugins/workboard/dist/migrate-worker-agents.d.ts +11 -0
- package/plugins/workboard/dist/migrate-worker-agents.d.ts.map +1 -0
- package/plugins/workboard/dist/migrate-worker-agents.js +89 -0
- package/plugins/workboard/dist/migrate-worker-agents.js.map +1 -0
- package/plugins/workboard/dist/routes/handlers.d.ts +106 -0
- package/plugins/workboard/dist/routes/handlers.d.ts.map +1 -0
- package/plugins/workboard/dist/routes/handlers.js +668 -0
- package/plugins/workboard/dist/routes/handlers.js.map +1 -0
- package/plugins/workboard/dist/server.d.ts +6 -0
- package/plugins/workboard/dist/server.d.ts.map +1 -0
- package/plugins/workboard/dist/server.js +368 -0
- package/plugins/workboard/dist/server.js.map +1 -0
- package/plugins/workboard/dist/tools/index.d.ts +70 -0
- package/plugins/workboard/dist/tools/index.d.ts.map +1 -0
- package/plugins/workboard/dist/tools/index.js +963 -0
- package/plugins/workboard/dist/tools/index.js.map +1 -0
- package/plugins/workboard/dist/types.d.ts +27 -0
- package/plugins/workboard/dist/types.d.ts.map +1 -0
- package/plugins/workboard/dist/types.js +16 -0
- package/plugins/workboard/dist/types.js.map +1 -0
- package/plugins/workboard/dist/worker/pool.d.ts +220 -0
- package/plugins/workboard/dist/worker/pool.d.ts.map +1 -0
- package/plugins/workboard/dist/worker/pool.js +866 -0
- package/plugins/workboard/dist/worker/pool.js.map +1 -0
- package/plugins/workboard/dist/worker/tool-policy.d.ts +27 -0
- package/plugins/workboard/dist/worker/tool-policy.d.ts.map +1 -0
- package/plugins/workboard/dist/worker/tool-policy.js +76 -0
- package/plugins/workboard/dist/worker/tool-policy.js.map +1 -0
- package/plugins/workboard/dist/worker-agents-page.d.ts +4 -0
- package/plugins/workboard/dist/worker-agents-page.d.ts.map +1 -0
- package/plugins/workboard/dist/worker-agents-page.js +193 -0
- package/plugins/workboard/dist/worker-agents-page.js.map +1 -0
- package/plugins/workboard/manifest.json +180 -0
- package/plugins/workboard/package.json +37 -0
- package/plugins/workboard/skills/large-input-large-output.md +185 -0
- package/plugins/workboard/skills/workboard-howto.md +166 -0
- package/plugins/workboard/skills/worker-creator.md +267 -0
- package/plugins/workboard/skills/worker-fleet.md +431 -0
|
@@ -0,0 +1,1003 @@
|
|
|
1
|
+
// Server-side plugin registry: discovers + activates the plugins
|
|
2
|
+
// enabled for a given tenant. Cached per tenant, invalidated on
|
|
3
|
+
// tenant DB pool eviction or via PATCH /api/plugins/:id.
|
|
4
|
+
//
|
|
5
|
+
// State machine for a discovered plugin id:
|
|
6
|
+
//
|
|
7
|
+
// discovered → enabled-in-config? → activate() resolves
|
|
8
|
+
// │ │ │
|
|
9
|
+
// │ └─ no → state: "disabled"
|
|
10
|
+
// │ │
|
|
11
|
+
// │ ├─ ok → state: "active"
|
|
12
|
+
// │ │
|
|
13
|
+
// │ └─ throws → state: "failed"
|
|
14
|
+
// │
|
|
15
|
+
// └─ manifest.json invalid → state: "failed" (collected by discovery)
|
|
16
|
+
//
|
|
17
|
+
// "client-bundle-missing" is reserved for v1 — we'll set it once
|
|
18
|
+
// dynamic-import client loading lands. Today we always return
|
|
19
|
+
// "active" / "disabled" / "failed".
|
|
20
|
+
//
|
|
21
|
+
// ADR-0004 additions on top of ADR-0003:
|
|
22
|
+
//
|
|
23
|
+
// - Topological activation order based on `requires[]` edges. A
|
|
24
|
+
// plugin's `activate()` only runs after every plugin providing its
|
|
25
|
+
// required capabilities is already active. Cycles fail the whole
|
|
26
|
+
// cycle (each member marked failed); plugins outside the cycle
|
|
27
|
+
// continue.
|
|
28
|
+
// - Capability registry: a per-tenant map from capability name →
|
|
29
|
+
// provider entry + value. Sandbox runners are values of type
|
|
30
|
+
// `SandboxRunner` (registered under `sandbox.shell`); browser
|
|
31
|
+
// sidecars piggyback on the same runner via `runner.browser`
|
|
32
|
+
// (registered under `browser.cdp`).
|
|
33
|
+
// - Exclusivity enforcement: capabilities flagged `exclusive: true`
|
|
34
|
+
// in `KNOWN_CAPABILITIES` reject a second provider; the second
|
|
35
|
+
// plugin in topo order is marked failed.
|
|
36
|
+
// - Visibility (§17): builtin plugins NOT listed in tenant config
|
|
37
|
+
// still appear in `listForTenant()` as `state: "disabled"`. Tenant
|
|
38
|
+
// plugins on disk but not in config also appear as disabled.
|
|
39
|
+
import path from "node:path";
|
|
40
|
+
import { isCapabilityName, KNOWN_CAPABILITIES } from "@tianshu/plugin-sdk";
|
|
41
|
+
import { discoverPlugins } from "./discovery.js";
|
|
42
|
+
import { loadSkillsForPlugin, mirrorSkillsToTenantConfig, } from "./skills.js";
|
|
43
|
+
import { loadPluginSecrets, mergePluginSecrets, } from "./secrets.js";
|
|
44
|
+
import { seedAgentDirs } from "../agent-seeds.js";
|
|
45
|
+
function summariseToolset(args) {
|
|
46
|
+
let snapshot = null;
|
|
47
|
+
try {
|
|
48
|
+
snapshot = args.provider.snapshot ? args.provider.snapshot() : null;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
console.warn(`[${args.logTag}] toolset "${args.id}" snapshot() threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
52
|
+
}
|
|
53
|
+
let toolCount = snapshot?.tools.length ?? 0;
|
|
54
|
+
if (toolCount === 0) {
|
|
55
|
+
try {
|
|
56
|
+
toolCount = args.provider.listTools().length;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
toolCount = 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
source: args.source,
|
|
64
|
+
sourceId: args.sourceId,
|
|
65
|
+
id: args.id,
|
|
66
|
+
displayName: args.displayName,
|
|
67
|
+
enabled: args.enabled,
|
|
68
|
+
providerName: args.provider.name,
|
|
69
|
+
snapshot,
|
|
70
|
+
toolCount,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export class PluginRegistry {
|
|
74
|
+
opts;
|
|
75
|
+
cache = new Map();
|
|
76
|
+
constructor(opts) {
|
|
77
|
+
this.opts = opts;
|
|
78
|
+
}
|
|
79
|
+
/** Idempotent: returns cached if already initialised for this tenant. */
|
|
80
|
+
async ensureForTenant(ctx) {
|
|
81
|
+
const cached = this.cache.get(ctx.tenantId);
|
|
82
|
+
if (cached)
|
|
83
|
+
return cached.entries;
|
|
84
|
+
const cfg = readPluginsConfig(ctx);
|
|
85
|
+
const discovery = discoverPlugins(ctx.tenantId, this.opts.discoveryDirs);
|
|
86
|
+
const entries = [];
|
|
87
|
+
// Failed manifests come through as failed entries with whatever id we
|
|
88
|
+
// could parse from the manifest (if any).
|
|
89
|
+
for (const f of discovery.failed) {
|
|
90
|
+
entries.push({
|
|
91
|
+
manifest: {
|
|
92
|
+
id: f.pluginId ?? `(invalid:${f.dir})`,
|
|
93
|
+
version: "0.0.0",
|
|
94
|
+
displayName: f.pluginId ?? "(invalid manifest)",
|
|
95
|
+
},
|
|
96
|
+
source: f.source,
|
|
97
|
+
dir: f.dir,
|
|
98
|
+
state: "failed",
|
|
99
|
+
failedReason: f.issues.join("; "),
|
|
100
|
+
capabilityInfo: emptyCapabilityInfo(),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Compute activation order over the subset enabled in tenant
|
|
104
|
+
// config. `requires` edges only matter between enabled plugins;
|
|
105
|
+
// a disabled plugin can't satisfy anything.
|
|
106
|
+
const enabledIds = new Set(discovery.plugins
|
|
107
|
+
.filter((p) => cfg[p.manifest.id]?.enabled === true)
|
|
108
|
+
.map((p) => p.manifest.id));
|
|
109
|
+
const ordered = topologicalOrder(discovery.plugins, enabledIds);
|
|
110
|
+
const enabledById = new Map(discovery.plugins.map((p) => [p.manifest.id, p]));
|
|
111
|
+
// Plugins that aren't enabled show up as disabled rows, with
|
|
112
|
+
// their capabilityInfo precomputed for the UI.
|
|
113
|
+
for (const p of discovery.plugins) {
|
|
114
|
+
if (enabledIds.has(p.manifest.id))
|
|
115
|
+
continue;
|
|
116
|
+
entries.push({
|
|
117
|
+
manifest: p.manifest,
|
|
118
|
+
source: p.source,
|
|
119
|
+
dir: p.dir,
|
|
120
|
+
state: "disabled",
|
|
121
|
+
capabilityInfo: {
|
|
122
|
+
provided: [],
|
|
123
|
+
requires: capabilityList(p.manifest.requires),
|
|
124
|
+
missing: [],
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// Cycle members are precomputed so we can fail them in one shot.
|
|
129
|
+
const cycleMembers = new Set(ordered.cycle);
|
|
130
|
+
const byCapability = new Map();
|
|
131
|
+
// Pre-seed host-provided capabilities so plugins requiring
|
|
132
|
+
// them can resolve. The synthetic provider id `__host__` makes
|
|
133
|
+
// it obvious in logs that no plugin owns these.
|
|
134
|
+
for (const [cap, factory] of Object.entries(this.opts.hostCapabilities ?? {})) {
|
|
135
|
+
if (!isCapabilityName(cap) || !factory)
|
|
136
|
+
continue;
|
|
137
|
+
const value = factory(ctx);
|
|
138
|
+
if (value === undefined || value === null)
|
|
139
|
+
continue;
|
|
140
|
+
byCapability.set(cap, {
|
|
141
|
+
capability: cap,
|
|
142
|
+
pluginId: "__host__",
|
|
143
|
+
exclusive: KNOWN_CAPABILITIES[cap].exclusive,
|
|
144
|
+
value,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Activate plugins in topological order.
|
|
148
|
+
for (const id of ordered.order) {
|
|
149
|
+
const p = enabledById.get(id);
|
|
150
|
+
if (!p)
|
|
151
|
+
continue;
|
|
152
|
+
// 1) Cycle members fail with a specific reason.
|
|
153
|
+
if (cycleMembers.has(id)) {
|
|
154
|
+
entries.push({
|
|
155
|
+
manifest: p.manifest,
|
|
156
|
+
source: p.source,
|
|
157
|
+
dir: p.dir,
|
|
158
|
+
state: "failed",
|
|
159
|
+
failedReason: `circular requires: ${ordered.cycle.join(" → ")}`,
|
|
160
|
+
capabilityInfo: {
|
|
161
|
+
provided: [],
|
|
162
|
+
requires: capabilityList(p.manifest.requires),
|
|
163
|
+
missing: [],
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// 2) Resolve requires: every required capability must already
|
|
169
|
+
// be in byCapability.
|
|
170
|
+
const requires = capabilityList(p.manifest.requires);
|
|
171
|
+
const missing = requires.filter((c) => !byCapability.has(c));
|
|
172
|
+
if (missing.length > 0) {
|
|
173
|
+
entries.push({
|
|
174
|
+
manifest: p.manifest,
|
|
175
|
+
source: p.source,
|
|
176
|
+
dir: p.dir,
|
|
177
|
+
state: "failed",
|
|
178
|
+
failedReason: `requires capability ${missing
|
|
179
|
+
.map((c) => `"${c}"`)
|
|
180
|
+
.join(", ")} — no provider enabled`,
|
|
181
|
+
capabilityInfo: { provided: [], requires, missing },
|
|
182
|
+
});
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// 3) Exclusivity check: if this plugin provides any exclusive
|
|
186
|
+
// capability already taken, fail it.
|
|
187
|
+
const declared = capabilityList(p.manifest.provides);
|
|
188
|
+
const conflict = declared.find((c) => {
|
|
189
|
+
const spec = KNOWN_CAPABILITIES[c];
|
|
190
|
+
return spec.exclusive && byCapability.has(c);
|
|
191
|
+
});
|
|
192
|
+
if (conflict) {
|
|
193
|
+
const owner = byCapability.get(conflict).pluginId;
|
|
194
|
+
entries.push({
|
|
195
|
+
manifest: p.manifest,
|
|
196
|
+
source: p.source,
|
|
197
|
+
dir: p.dir,
|
|
198
|
+
state: "failed",
|
|
199
|
+
failedReason: `capability "${conflict}" already provided by plugin ${owner}`,
|
|
200
|
+
capabilityInfo: { provided: [], requires, missing: [] },
|
|
201
|
+
});
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
// 4) Activate the plugin.
|
|
205
|
+
const activated = await this.activate(ctx, p, byCapability);
|
|
206
|
+
entries.push(activated);
|
|
207
|
+
// 5) On success, register capabilities the plugin actually
|
|
208
|
+
// backed (sandboxes contribution + runner.browser for
|
|
209
|
+
// browser.cdp). If a declared capability has no backing
|
|
210
|
+
// runner, mark the plugin failed.
|
|
211
|
+
if (activated.state === "active") {
|
|
212
|
+
const ok = registerProvidedCapabilities(activated, byCapability);
|
|
213
|
+
if (!ok.ok) {
|
|
214
|
+
activated.state = "failed";
|
|
215
|
+
activated.failedReason = ok.reason;
|
|
216
|
+
delete activated.exports;
|
|
217
|
+
activated.capabilityInfo = {
|
|
218
|
+
provided: [],
|
|
219
|
+
requires,
|
|
220
|
+
missing: [],
|
|
221
|
+
};
|
|
222
|
+
// Roll back any partial registrations from this plugin.
|
|
223
|
+
for (const cap of activated.capabilityInfo.provided) {
|
|
224
|
+
const owner = byCapability.get(cap);
|
|
225
|
+
if (owner?.pluginId === activated.manifest.id)
|
|
226
|
+
byCapability.delete(cap);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Build the WS dispatch map. Duplicate `wsMessages.type` registrations
|
|
232
|
+
// mean the second plugin is rejected (state: failed).
|
|
233
|
+
const byWsType = new Map();
|
|
234
|
+
for (const e of entries) {
|
|
235
|
+
if (e.state !== "active" || !e.manifest.contributes?.wsMessages)
|
|
236
|
+
continue;
|
|
237
|
+
const wsHandlers = e.exports?.wsHandlers ?? {};
|
|
238
|
+
for (const ws of e.manifest.contributes.wsMessages) {
|
|
239
|
+
const existing = byWsType.get(ws.type);
|
|
240
|
+
if (existing) {
|
|
241
|
+
e.state = "failed";
|
|
242
|
+
e.failedReason = `ws message type "${ws.type}" already registered by plugin ${existing.entry.manifest.id}`;
|
|
243
|
+
delete e.exports;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const fn = wsHandlers[ws.handler];
|
|
247
|
+
if (!fn) {
|
|
248
|
+
// Manifest claimed a handler that isn't exported. Mark failed
|
|
249
|
+
// but keep other plugins alive.
|
|
250
|
+
e.state = "failed";
|
|
251
|
+
e.failedReason = `wsHandlers["${ws.handler}"] missing in plugin ${e.manifest.id}`;
|
|
252
|
+
delete e.exports;
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
byWsType.set(ws.type, { entry: e, handler: fn });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Sort entries deterministically by id.
|
|
259
|
+
entries.sort((a, b) => a.manifest.id < b.manifest.id ? -1 : a.manifest.id > b.manifest.id ? 1 : 0);
|
|
260
|
+
// Mirror host + plugin skills into the tenant config tree.
|
|
261
|
+
// We collect plugin skills the same way `skillsForTenant` does
|
|
262
|
+
// and append host skills via the optional loader. The mirror
|
|
263
|
+
// helper rewrites each entry's filePath to the tenant-config
|
|
264
|
+
// path so the system prompt's <available_skills> block can
|
|
265
|
+
// advertise URIs the agent can actually read.
|
|
266
|
+
const tenantConfigDir = path.join(ctx.workspaceDir, "_tenant", "config");
|
|
267
|
+
const collected = [];
|
|
268
|
+
for (const e of entries) {
|
|
269
|
+
if (e.state !== "active" || !e.manifest.contributes?.skills)
|
|
270
|
+
continue;
|
|
271
|
+
const r = loadSkillsForPlugin({
|
|
272
|
+
pluginId: e.manifest.id,
|
|
273
|
+
pluginDir: e.dir,
|
|
274
|
+
contributions: e.manifest.contributes.skills,
|
|
275
|
+
});
|
|
276
|
+
collected.push(...r.skills);
|
|
277
|
+
}
|
|
278
|
+
if (this.opts.hostSkillsLoader) {
|
|
279
|
+
collected.push(...this.opts.hostSkillsLoader());
|
|
280
|
+
}
|
|
281
|
+
const mirroredSkills = mirrorSkillsToTenantConfig({
|
|
282
|
+
tenantConfigDir,
|
|
283
|
+
skills: collected,
|
|
284
|
+
log: {
|
|
285
|
+
info: (m, meta) => console.log(`[skill-mirror] ${m}`, meta ?? ""),
|
|
286
|
+
warn: (m, meta) => console.warn(`[skill-mirror] ${m}`, meta ?? ""),
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
this.cache.set(ctx.tenantId, {
|
|
290
|
+
entries,
|
|
291
|
+
byWsType,
|
|
292
|
+
byCapability,
|
|
293
|
+
mirroredSkills,
|
|
294
|
+
});
|
|
295
|
+
return entries;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Plugin + host skills, with `filePath` pointing at the
|
|
299
|
+
* mirrored copy under `_tenant/config/skills/_host/...`.
|
|
300
|
+
* Replaces `skillsForTenant` for runtime callers (system
|
|
301
|
+
* prompt, tool factories). The original method is kept for
|
|
302
|
+
* tests that pre-date the mirror layer.
|
|
303
|
+
*/
|
|
304
|
+
mirroredSkillsForTenant(tenantId) {
|
|
305
|
+
return this.cache.get(tenantId)?.mirroredSkills ?? [];
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Drop a tenant's cached registry. Calls each active plugin's
|
|
309
|
+
* `deactivate()` hook (best-effort, sequential) so plugins can
|
|
310
|
+
* release resources — sandbox VMs, child processes, file
|
|
311
|
+
* watchers, etc. — before the next `ensureForTenant()` rebuilds
|
|
312
|
+
* everything from scratch.
|
|
313
|
+
*
|
|
314
|
+
* Returns a promise so callers that want to ensure deactivation
|
|
315
|
+
* finished before re-entering `ensureForTenant` can await it. The
|
|
316
|
+
* existing `void`-returning callers (e.g. tenant softDelete on
|
|
317
|
+
* pool eviction) ignore the promise and that's fine — the host
|
|
318
|
+
* just won't wait for slow shutdowns to land.
|
|
319
|
+
*/
|
|
320
|
+
invalidate(tenantId) {
|
|
321
|
+
const cached = this.cache.get(tenantId);
|
|
322
|
+
this.cache.delete(tenantId);
|
|
323
|
+
if (!cached)
|
|
324
|
+
return Promise.resolve();
|
|
325
|
+
return this.runDeactivations(cached.entries);
|
|
326
|
+
}
|
|
327
|
+
async runDeactivations(entries) {
|
|
328
|
+
// Sequential, reverse-of-entries order. v0 ordering is
|
|
329
|
+
// reverse id-sort (entries are sorted alphabetically); a
|
|
330
|
+
// plugin's deactivate() should not rely on another plugin's
|
|
331
|
+
// capabilities still being up. A future revision may promote
|
|
332
|
+
// this to true reverse-topological if a real consumer needs
|
|
333
|
+
// it.
|
|
334
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
335
|
+
const e = entries[i];
|
|
336
|
+
if (e.state !== "active")
|
|
337
|
+
continue;
|
|
338
|
+
const fn = e.module?.deactivate;
|
|
339
|
+
if (typeof fn !== "function")
|
|
340
|
+
continue;
|
|
341
|
+
try {
|
|
342
|
+
await fn();
|
|
343
|
+
}
|
|
344
|
+
catch (err) {
|
|
345
|
+
// eslint-disable-next-line no-console
|
|
346
|
+
console.warn(`[plugin:${e.manifest.id}] deactivate() threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/** For routes layer: look up the WS handler for a {tenant, type}. */
|
|
351
|
+
resolveWsHandler(tenantId, type) {
|
|
352
|
+
return this.cache.get(tenantId)?.byWsType.get(type);
|
|
353
|
+
}
|
|
354
|
+
/** For routes layer: list all plugins (active + disabled + failed). */
|
|
355
|
+
listForTenant(tenantId) {
|
|
356
|
+
return this.cache.get(tenantId)?.entries ?? [];
|
|
357
|
+
}
|
|
358
|
+
/** For agent / other host code: read the tenant capability registry. */
|
|
359
|
+
capabilityFor(tenantId, name) {
|
|
360
|
+
return this.cache.get(tenantId)?.byCapability.get(name)?.value;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Collect every tool every active plugin contributed for this
|
|
364
|
+
* tenant. Each entry pairs the tool object with its source
|
|
365
|
+
* plugin id (used for logging / Plugin Manager UI). The agent
|
|
366
|
+
* loop further filters by each tool's `available()` gate before
|
|
367
|
+
* registering with pi-ai.
|
|
368
|
+
*/
|
|
369
|
+
toolsForTenant(tenantId) {
|
|
370
|
+
const out = [];
|
|
371
|
+
const cached = this.cache.get(tenantId);
|
|
372
|
+
if (!cached)
|
|
373
|
+
return out;
|
|
374
|
+
// (0) User-configured MCP toolsets (host-owned). These are
|
|
375
|
+
// surfaced under a synthetic plugin id of `core` so the agent
|
|
376
|
+
// logging + plugin manager UI can tell them apart from plugin
|
|
377
|
+
// contributions.
|
|
378
|
+
if (this.opts.mcpManager) {
|
|
379
|
+
for (const provider of this.opts.mcpManager.providersForTenant(tenantId)) {
|
|
380
|
+
try {
|
|
381
|
+
for (const tool of provider.listTools()) {
|
|
382
|
+
out.push({ pluginId: "core", tool });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (err) {
|
|
386
|
+
console.warn(`[mcp:user] toolset "${provider.name}" listTools() threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
for (const e of cached.entries) {
|
|
391
|
+
if (e.state !== "active")
|
|
392
|
+
continue;
|
|
393
|
+
// (1) Static tool contributions: one AgentTool per
|
|
394
|
+
// `manifest.contributes.tools[]` entry, looked up by `module`.
|
|
395
|
+
const toolModules = e.exports?.tools ?? {};
|
|
396
|
+
for (const t of e.manifest.contributes?.tools ?? []) {
|
|
397
|
+
const tool = toolModules[t.module];
|
|
398
|
+
if (!tool) {
|
|
399
|
+
// Manifest claimed a tool but exports.tools didn't expose
|
|
400
|
+
// the matching module. Mark plugin failed so the operator
|
|
401
|
+
// sees it in /api/plugins; skip emission.
|
|
402
|
+
e.state = "failed";
|
|
403
|
+
e.failedReason = `tools["${t.module}"] missing in plugin ${e.manifest.id}`;
|
|
404
|
+
delete e.exports;
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
out.push({ pluginId: e.manifest.id, tool });
|
|
408
|
+
}
|
|
409
|
+
// (2) Dynamic toolset providers: each provider's listTools()
|
|
410
|
+
// is read every turn so MCP servers can come/go without a
|
|
411
|
+
// plugin reactivation. Errors inside listTools() are isolated
|
|
412
|
+
// (logged + skipped) so a single misbehaving toolset doesn't
|
|
413
|
+
// black out the agent's other tools.
|
|
414
|
+
if (e.state !== "active")
|
|
415
|
+
continue;
|
|
416
|
+
const providerModules = e.exports?.toolsetProviders ?? {};
|
|
417
|
+
for (const ts of e.manifest.contributes?.toolsets ?? []) {
|
|
418
|
+
const provider = providerModules[ts.module];
|
|
419
|
+
if (!provider) {
|
|
420
|
+
e.state = "failed";
|
|
421
|
+
e.failedReason = `toolsetProviders["${ts.module}"] missing in plugin ${e.manifest.id}`;
|
|
422
|
+
delete e.exports;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
let dynamic = [];
|
|
426
|
+
try {
|
|
427
|
+
dynamic = provider.listTools();
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
// Same behaviour as a per-call error inside an AgentTool:
|
|
431
|
+
// log and keep going. Don't poison the rest of the run.
|
|
432
|
+
console.warn(`[plugins:${e.manifest.id}] toolset "${ts.id}" listTools() threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
433
|
+
}
|
|
434
|
+
for (const tool of dynamic) {
|
|
435
|
+
out.push({ pluginId: e.manifest.id, tool });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return out;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Collect every toolset provider every active plugin contributed
|
|
443
|
+
* for this tenant. Powers the global `/admin/mcp` view, which
|
|
444
|
+
* lists every connected MCP server (or other dynamic toolset)
|
|
445
|
+
* across plugins. Each entry includes the snapshot if the
|
|
446
|
+
* provider exposes one.
|
|
447
|
+
*/
|
|
448
|
+
/**
|
|
449
|
+
* Look up the live ToolsetProvider behind a toolset summary, so
|
|
450
|
+
* routes can call refresh() on it. Returns null when the source
|
|
451
|
+
* has gone away (plugin disabled, user entry deleted) since the
|
|
452
|
+
* summary was generated.
|
|
453
|
+
*/
|
|
454
|
+
toolsetProviderFor(summary, tenantId) {
|
|
455
|
+
if (summary.source === "user") {
|
|
456
|
+
if (!this.opts.mcpManager)
|
|
457
|
+
return null;
|
|
458
|
+
const snaps = this.opts.mcpManager.snapshotsForTenant(tenantId);
|
|
459
|
+
return snaps.find((s) => s.id === summary.id)?.provider ?? null;
|
|
460
|
+
}
|
|
461
|
+
// source === "plugin"
|
|
462
|
+
const cached = this.cache.get(tenantId);
|
|
463
|
+
if (!cached)
|
|
464
|
+
return null;
|
|
465
|
+
const entry = cached.entries.find((e) => e.manifest.id === summary.sourceId);
|
|
466
|
+
if (!entry || entry.state !== "active")
|
|
467
|
+
return null;
|
|
468
|
+
const ts = entry.manifest.contributes?.toolsets?.find((t) => t.id === summary.id);
|
|
469
|
+
if (!ts)
|
|
470
|
+
return null;
|
|
471
|
+
return entry.exports?.toolsetProviders?.[ts.module] ?? null;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Re-probe every toolset whose snapshot looks stale (no
|
|
475
|
+
* endpoint, errored last attempt, or empty after a never-yet
|
|
476
|
+
* refresh). Used by both the chat handler (per-turn warmup so
|
|
477
|
+
* MCP tools that came online after plugin activation — e.g.
|
|
478
|
+
* Playwright once the sandbox boots — reach the agent surface
|
|
479
|
+
* without a manual /admin/mcp refresh) and the admin servers
|
|
480
|
+
* route (so the page render reflects fresh state).
|
|
481
|
+
*
|
|
482
|
+
* Refreshes run in parallel and the whole helper resolves no
|
|
483
|
+
* later than `deadlineMs`. We swallow per-toolset errors so a
|
|
484
|
+
* single broken upstream doesn't poison the warmup pass; the
|
|
485
|
+
* snapshot keeps `lastError` for the admin UI to surface.
|
|
486
|
+
*
|
|
487
|
+
* Returns the number of refresh() calls actually issued so
|
|
488
|
+
* callers can log / decide whether the call was worth it.
|
|
489
|
+
*/
|
|
490
|
+
async refreshStaleToolsets(tenantId, deadlineMs) {
|
|
491
|
+
const tsets = this.toolsetsForTenant(tenantId);
|
|
492
|
+
const stale = [];
|
|
493
|
+
for (const ts of tsets) {
|
|
494
|
+
const snap = ts.snapshot;
|
|
495
|
+
const isStale = !snap ||
|
|
496
|
+
snap.lastError !== undefined ||
|
|
497
|
+
(snap.tools.length === 0 &&
|
|
498
|
+
(snap.endpoint === undefined || snap.lastRefreshAt === undefined));
|
|
499
|
+
if (!isStale)
|
|
500
|
+
continue;
|
|
501
|
+
const provider = this.toolsetProviderFor(ts, tenantId);
|
|
502
|
+
const refreshFn = provider
|
|
503
|
+
?.refresh;
|
|
504
|
+
if (typeof refreshFn === "function") {
|
|
505
|
+
stale.push(refreshFn.call(provider).catch(() => undefined));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (stale.length === 0)
|
|
509
|
+
return 0;
|
|
510
|
+
await Promise.race([
|
|
511
|
+
Promise.all(stale),
|
|
512
|
+
new Promise((resolve) => setTimeout(resolve, deadlineMs)),
|
|
513
|
+
]);
|
|
514
|
+
return stale.length;
|
|
515
|
+
}
|
|
516
|
+
toolsetsForTenant(tenantId) {
|
|
517
|
+
const out = [];
|
|
518
|
+
// (1) Plugin-contributed toolsets. Source: their plugin id.
|
|
519
|
+
const cached = this.cache.get(tenantId);
|
|
520
|
+
if (cached) {
|
|
521
|
+
for (const e of cached.entries) {
|
|
522
|
+
if (e.state !== "active")
|
|
523
|
+
continue;
|
|
524
|
+
const providers = e.exports?.toolsetProviders ?? {};
|
|
525
|
+
for (const ts of e.manifest.contributes?.toolsets ?? []) {
|
|
526
|
+
const provider = providers[ts.module];
|
|
527
|
+
if (!provider)
|
|
528
|
+
continue;
|
|
529
|
+
out.push(summariseToolset({
|
|
530
|
+
source: "plugin",
|
|
531
|
+
sourceId: e.manifest.id,
|
|
532
|
+
id: ts.id,
|
|
533
|
+
displayName: ts.displayName ?? ts.id,
|
|
534
|
+
enabled: true,
|
|
535
|
+
provider,
|
|
536
|
+
logTag: `plugins:${e.manifest.id}`,
|
|
537
|
+
}));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
// (2) User-configured toolsets (host-owned). Source: `"user"`.
|
|
542
|
+
if (this.opts.mcpManager) {
|
|
543
|
+
for (const snap of this.opts.mcpManager.snapshotsForTenant(tenantId)) {
|
|
544
|
+
out.push({
|
|
545
|
+
source: "user",
|
|
546
|
+
sourceId: "core",
|
|
547
|
+
id: snap.id,
|
|
548
|
+
displayName: snap.displayName,
|
|
549
|
+
enabled: snap.enabled,
|
|
550
|
+
providerName: snap.provider?.name ?? snap.displayName,
|
|
551
|
+
snapshot: snap.toolsetSnapshot,
|
|
552
|
+
toolCount: snap.toolsetSnapshot?.tools.length ?? 0,
|
|
553
|
+
// Round-trip the user's stored config so the admin UI can
|
|
554
|
+
// show url / upstreamHost / prefix in edit dialogs.
|
|
555
|
+
userEntry: {
|
|
556
|
+
id: snap.entry.id,
|
|
557
|
+
displayName: snap.entry.displayName,
|
|
558
|
+
url: snap.entry.url,
|
|
559
|
+
prefix: snap.entry.prefix,
|
|
560
|
+
upstreamHost: snap.entry.upstreamHost,
|
|
561
|
+
enabled: snap.entry.enabled !== false,
|
|
562
|
+
},
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return out;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Collect every skill contributed by every active plugin for
|
|
570
|
+
* this tenant. The host adds its own self-shipped skills on top
|
|
571
|
+
* of these (they live under `<repoRoot>/skills/`, not in any
|
|
572
|
+
* plugin). Caller filters by `when:` predicate against the
|
|
573
|
+
* current tool/capability set; see `filterSkillsForTenant`.
|
|
574
|
+
*/
|
|
575
|
+
skillsForTenant(tenantId) {
|
|
576
|
+
const out = [];
|
|
577
|
+
const cached = this.cache.get(tenantId);
|
|
578
|
+
if (!cached)
|
|
579
|
+
return out;
|
|
580
|
+
for (const e of cached.entries) {
|
|
581
|
+
if (e.state !== "active" || !e.manifest.contributes?.skills)
|
|
582
|
+
continue;
|
|
583
|
+
const result = loadSkillsForPlugin({
|
|
584
|
+
pluginId: e.manifest.id,
|
|
585
|
+
pluginDir: e.dir,
|
|
586
|
+
contributions: e.manifest.contributes.skills,
|
|
587
|
+
});
|
|
588
|
+
out.push(...result.skills);
|
|
589
|
+
for (const f of result.failures) {
|
|
590
|
+
// Surface skill load failures as plugin-failed so the Plugin
|
|
591
|
+
// Manager UI shows them; we don't fail the whole plugin
|
|
592
|
+
// because a missing skill file shouldn't kill its tools.
|
|
593
|
+
// eslint-disable-next-line no-console
|
|
594
|
+
console.warn(`[plugin:${f.source.pluginId}] skill ${f.source.contributionId} (${f.filePath}): ${f.reason}`);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return out;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Static system-prompt fragments contributed by every active
|
|
601
|
+
* plugin in this tenant. Each entry carries the plugin id +
|
|
602
|
+
* displayName so the host can wrap fragments in a section
|
|
603
|
+
* header before injection. Order: stable by plugin id, then
|
|
604
|
+
* by contribution id, so the resulting prompt is
|
|
605
|
+
* deterministic across reloads.
|
|
606
|
+
*/
|
|
607
|
+
systemPromptFragmentsForTenant(tenantId) {
|
|
608
|
+
const out = [];
|
|
609
|
+
const cached = this.cache.get(tenantId);
|
|
610
|
+
if (!cached)
|
|
611
|
+
return out;
|
|
612
|
+
for (const e of cached.entries) {
|
|
613
|
+
if (e.state !== "active")
|
|
614
|
+
continue;
|
|
615
|
+
const fragments = e.manifest.contributes?.systemPromptFragments;
|
|
616
|
+
if (!fragments || fragments.length === 0)
|
|
617
|
+
continue;
|
|
618
|
+
for (const f of fragments) {
|
|
619
|
+
out.push({
|
|
620
|
+
pluginId: e.manifest.id,
|
|
621
|
+
pluginDisplayName: e.manifest.displayName ?? e.manifest.id,
|
|
622
|
+
fragmentId: f.id,
|
|
623
|
+
text: f.text,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return out.sort((a, b) => {
|
|
628
|
+
if (a.pluginId !== b.pluginId) {
|
|
629
|
+
return a.pluginId.localeCompare(b.pluginId);
|
|
630
|
+
}
|
|
631
|
+
return a.fragmentId.localeCompare(b.fragmentId);
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Build a small read-only capability lookup handle scoped to one
|
|
636
|
+
* tenant. Same shape as `PluginContext.capabilities` but for
|
|
637
|
+
* host-side consumers (agent loop, tool factories) that don't
|
|
638
|
+
* have a `PluginContext`.
|
|
639
|
+
*/
|
|
640
|
+
hostCapabilities(tenantId) {
|
|
641
|
+
return {
|
|
642
|
+
get: (name) => this.capabilityFor(tenantId, name),
|
|
643
|
+
has: (name) => Boolean(this.cache.get(tenantId)?.byCapability.has(name)),
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
// ─── internals ─────────────────────────────────────────────────
|
|
647
|
+
async activate(ctx, p, byCapability) {
|
|
648
|
+
const requires = capabilityList(p.manifest.requires);
|
|
649
|
+
if (!p.manifest.server?.entry) {
|
|
650
|
+
// No server entry → the plugin is client-only. v0 doesn't load
|
|
651
|
+
// those (we'd need a registry for client-only plugins too); mark
|
|
652
|
+
// as active with no exports.
|
|
653
|
+
return {
|
|
654
|
+
manifest: p.manifest,
|
|
655
|
+
source: p.source,
|
|
656
|
+
dir: p.dir,
|
|
657
|
+
state: "active",
|
|
658
|
+
capabilityInfo: { provided: [], requires, missing: [] },
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
let mod = null;
|
|
662
|
+
try {
|
|
663
|
+
mod = await this.opts.resolver.resolve(p.manifest.server.entry);
|
|
664
|
+
}
|
|
665
|
+
catch (err) {
|
|
666
|
+
return failed(p, requires, `module resolve threw: ${describe(err)}`);
|
|
667
|
+
}
|
|
668
|
+
if (!mod) {
|
|
669
|
+
return failed(p, requires, `server.entry "${p.manifest.server.entry}" not registered`);
|
|
670
|
+
}
|
|
671
|
+
if (typeof mod.activate !== "function") {
|
|
672
|
+
return failed(p, requires, "server module does not export activate()");
|
|
673
|
+
}
|
|
674
|
+
const pluginCtx = makePluginContext({
|
|
675
|
+
pluginId: p.manifest.id,
|
|
676
|
+
ctx,
|
|
677
|
+
broadcast: this.opts.broadcast,
|
|
678
|
+
byCapability,
|
|
679
|
+
});
|
|
680
|
+
let exports_;
|
|
681
|
+
try {
|
|
682
|
+
exports_ = await mod.activate(pluginCtx);
|
|
683
|
+
}
|
|
684
|
+
catch (err) {
|
|
685
|
+
return failed(p, requires, `activate() threw: ${describe(err)}`);
|
|
686
|
+
}
|
|
687
|
+
// Drop manifest-declared agent seeds into the tenant's worker
|
|
688
|
+
// config tree. Idempotent (existing slots are preserved), so
|
|
689
|
+
// it's safe to run on every activate — including hot reloads
|
|
690
|
+
// that re-activate a plugin in the same process.
|
|
691
|
+
const seeds = p.manifest.contributes?.agentSeeds;
|
|
692
|
+
if (seeds && seeds.length > 0) {
|
|
693
|
+
try {
|
|
694
|
+
const r = seedAgentDirs({
|
|
695
|
+
tenantId: ctx.tenantId,
|
|
696
|
+
pluginId: p.manifest.id,
|
|
697
|
+
pluginDir: p.dir,
|
|
698
|
+
seeds,
|
|
699
|
+
});
|
|
700
|
+
if (r.inserted.length || r.invalid.length) {
|
|
701
|
+
// eslint-disable-next-line no-console
|
|
702
|
+
console.log(`[plugin:${p.manifest.id}] [tenant:${ctx.tenantId}] agent-seeds inserted=[${r.inserted.join(", ")}] preserved=[${r.preserved.join(", ")}] invalid=[${r.invalid.join(", ")}]`);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
catch (err) {
|
|
706
|
+
// Don't fail activation just because a seed couldn't be
|
|
707
|
+
// copied — the worker pool can still run any user-managed
|
|
708
|
+
// workers already on disk.
|
|
709
|
+
// eslint-disable-next-line no-console
|
|
710
|
+
console.warn(`[plugin:${p.manifest.id}] agent-seeds failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return {
|
|
714
|
+
manifest: p.manifest,
|
|
715
|
+
source: p.source,
|
|
716
|
+
dir: p.dir,
|
|
717
|
+
state: "active",
|
|
718
|
+
exports: exports_,
|
|
719
|
+
module: mod,
|
|
720
|
+
capabilityInfo: { provided: [], requires, missing: [] },
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function failed(p, requires, reason) {
|
|
725
|
+
return {
|
|
726
|
+
manifest: p.manifest,
|
|
727
|
+
source: p.source,
|
|
728
|
+
dir: p.dir,
|
|
729
|
+
state: "failed",
|
|
730
|
+
failedReason: reason,
|
|
731
|
+
capabilityInfo: { provided: [], requires, missing: [] },
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function describe(err) {
|
|
735
|
+
if (err instanceof Error)
|
|
736
|
+
return err.message;
|
|
737
|
+
return String(err);
|
|
738
|
+
}
|
|
739
|
+
function readPluginsConfig(ctx) {
|
|
740
|
+
const cfg = ctx.config.plugins;
|
|
741
|
+
if (!cfg || typeof cfg !== "object" || Array.isArray(cfg))
|
|
742
|
+
return {};
|
|
743
|
+
return cfg;
|
|
744
|
+
}
|
|
745
|
+
function readPluginConfig(ctx, pluginId) {
|
|
746
|
+
const all = readPluginsConfig(ctx);
|
|
747
|
+
const c = all[pluginId]?.config;
|
|
748
|
+
const raw = c && typeof c === "object" && !Array.isArray(c)
|
|
749
|
+
? c
|
|
750
|
+
: {};
|
|
751
|
+
// Splice in any plugin secrets stored under <tenant>/secrets/
|
|
752
|
+
// BEFORE handing the object to the plugin. The plugin sees a
|
|
753
|
+
// single flat config blob; the split between config.json and
|
|
754
|
+
// secrets/ is a host concern.
|
|
755
|
+
const secrets = loadPluginSecrets(ctx.secretsDir, pluginId);
|
|
756
|
+
return mergePluginSecrets(raw, secrets);
|
|
757
|
+
}
|
|
758
|
+
function makePluginContext(args) {
|
|
759
|
+
const { pluginId, ctx, broadcast, byCapability } = args;
|
|
760
|
+
const log = bindLogger(pluginId, ctx.tenantId);
|
|
761
|
+
const capabilities = {
|
|
762
|
+
get: (name) => byCapability.get(name)?.value,
|
|
763
|
+
has: (name) => byCapability.has(name),
|
|
764
|
+
on: () => () => {
|
|
765
|
+
// v0: no-op. Lifecycle events are fired by registry.invalidate
|
|
766
|
+
// → ensureForTenant rebuilds, but we don't yet plumb listeners
|
|
767
|
+
// through. ADR-0004 §8 says v0 ships get/has only; on() is
|
|
768
|
+
// declared so plugins can write code that targets v1 already.
|
|
769
|
+
},
|
|
770
|
+
};
|
|
771
|
+
return {
|
|
772
|
+
pluginId,
|
|
773
|
+
tenantId: ctx.tenantId,
|
|
774
|
+
db: ctx.db,
|
|
775
|
+
tenantConfig: { defaultModel: ctx.config.defaultModel, branding: ctx.config.branding },
|
|
776
|
+
// Deprecated alias kept until the next major SDK bump so v0
|
|
777
|
+
// plugin code that read `ctx.config` still works.
|
|
778
|
+
config: { defaultModel: ctx.config.defaultModel, branding: ctx.config.branding },
|
|
779
|
+
log,
|
|
780
|
+
workspaceDir: ctx.workspaceDir,
|
|
781
|
+
userHomeDir: (userId) => ctx.userHomeDir(userId),
|
|
782
|
+
broadcast: (type, payload) => broadcast?.(ctx.tenantId, `${pluginId}:${type}`, payload),
|
|
783
|
+
capabilities,
|
|
784
|
+
pluginConfig: readPluginConfig(ctx, pluginId),
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
function bindLogger(pluginId, tenantId) {
|
|
788
|
+
const prefix = `[plugin:${pluginId}] [tenant:${tenantId}]`;
|
|
789
|
+
return {
|
|
790
|
+
info: (msg, meta) => console.log(`${prefix} ${msg}`, meta ?? ""),
|
|
791
|
+
warn: (msg, meta) => console.warn(`${prefix} ${msg}`, meta ?? ""),
|
|
792
|
+
error: (msg, meta) => console.error(`${prefix} ${msg}`, meta ?? ""),
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
/** A handler resolver from a plain server-module map (used by tests +
|
|
796
|
+
* builtin module wiring). */
|
|
797
|
+
export function moduleMapResolver(map) {
|
|
798
|
+
return {
|
|
799
|
+
resolve: (entry) => map[entry] ?? null,
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
/** Build the API surface exposed via /api/p/<plugin-id>/<path>. */
|
|
803
|
+
export function collectRoutesForTenant(registry, tenantId) {
|
|
804
|
+
const out = [];
|
|
805
|
+
for (const e of registry.listForTenant(tenantId)) {
|
|
806
|
+
if (e.state !== "active" || !e.manifest.contributes?.apiRoutes)
|
|
807
|
+
continue;
|
|
808
|
+
const routeHandlers = e.exports?.routes ?? {};
|
|
809
|
+
for (const r of e.manifest.contributes.apiRoutes) {
|
|
810
|
+
const fn = routeHandlers[r.handler];
|
|
811
|
+
if (!fn) {
|
|
812
|
+
e.state = "failed";
|
|
813
|
+
e.failedReason = `routes["${r.handler}"] missing in plugin ${e.manifest.id}`;
|
|
814
|
+
delete e.exports;
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
out.push({
|
|
818
|
+
pluginId: e.manifest.id,
|
|
819
|
+
method: r.method,
|
|
820
|
+
path: r.path,
|
|
821
|
+
handler: fn,
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return out;
|
|
826
|
+
}
|
|
827
|
+
// ─── helpers ─────────────────────────────────────────────────────
|
|
828
|
+
function capabilityList(raw) {
|
|
829
|
+
if (!raw)
|
|
830
|
+
return [];
|
|
831
|
+
// Manifest validator already filtered to known names, but be
|
|
832
|
+
// defensive in case someone constructs a manifest in code (tests).
|
|
833
|
+
return raw.filter(isCapabilityName);
|
|
834
|
+
}
|
|
835
|
+
function emptyCapabilityInfo() {
|
|
836
|
+
return { provided: [], requires: [], missing: [] };
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Kahn's algorithm over plugins in the enabled set. Edges are
|
|
840
|
+
* `requires(provider)` (provider satisfies the required capability),
|
|
841
|
+
* resolved by scanning every enabled plugin's `provides[]`. We don't
|
|
842
|
+
* care which specific provider satisfies a capability — any works.
|
|
843
|
+
*/
|
|
844
|
+
function topologicalOrder(plugins, enabledIds) {
|
|
845
|
+
// capability → ids of providers (within enabled set)
|
|
846
|
+
const providers = new Map();
|
|
847
|
+
for (const p of plugins) {
|
|
848
|
+
if (!enabledIds.has(p.manifest.id))
|
|
849
|
+
continue;
|
|
850
|
+
for (const cap of capabilityList(p.manifest.provides)) {
|
|
851
|
+
const arr = providers.get(cap) ?? [];
|
|
852
|
+
arr.push(p.manifest.id);
|
|
853
|
+
providers.set(cap, arr);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
// For each enabled plugin, compute the set of plugin-ids it depends
|
|
857
|
+
// on (every provider of every required capability). Self-loops are
|
|
858
|
+
// dropped — a plugin can both provide and require the same capability
|
|
859
|
+
// (e.g. self-tests); we don't treat that as a cycle.
|
|
860
|
+
const deps = new Map();
|
|
861
|
+
for (const p of plugins) {
|
|
862
|
+
if (!enabledIds.has(p.manifest.id))
|
|
863
|
+
continue;
|
|
864
|
+
const set = new Set();
|
|
865
|
+
for (const cap of capabilityList(p.manifest.requires)) {
|
|
866
|
+
const provs = providers.get(cap) ?? [];
|
|
867
|
+
for (const provId of provs) {
|
|
868
|
+
if (provId !== p.manifest.id)
|
|
869
|
+
set.add(provId);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
deps.set(p.manifest.id, set);
|
|
873
|
+
}
|
|
874
|
+
const order = [];
|
|
875
|
+
const remaining = new Map(deps);
|
|
876
|
+
const ids = [...remaining.keys()].sort();
|
|
877
|
+
while (remaining.size > 0) {
|
|
878
|
+
// Pick all plugins with zero remaining deps; sort for determinism.
|
|
879
|
+
const ready = ids.filter((id) => remaining.has(id) && remaining.get(id).size === 0);
|
|
880
|
+
if (ready.length === 0)
|
|
881
|
+
break; // cycle
|
|
882
|
+
for (const id of ready) {
|
|
883
|
+
order.push(id);
|
|
884
|
+
remaining.delete(id);
|
|
885
|
+
for (const [other, set] of remaining) {
|
|
886
|
+
if (set.delete(id) && set.size === 0) {
|
|
887
|
+
// Will be picked next iteration.
|
|
888
|
+
}
|
|
889
|
+
void other;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
// Anything left is in a cycle.
|
|
894
|
+
const cycle = [...remaining.keys()].sort();
|
|
895
|
+
for (const id of cycle)
|
|
896
|
+
order.push(id);
|
|
897
|
+
return { order, cycle };
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* After a plugin's `activate()` returns successfully, map its
|
|
901
|
+
* `provides[]` declarations to the actual values it exposes
|
|
902
|
+
* (sandbox runners, optional browser sidecar) and register them.
|
|
903
|
+
*
|
|
904
|
+
* Returns `{ ok: true }` if every declared capability was backed,
|
|
905
|
+
* or `{ ok: false, reason }` if a backing was missing.
|
|
906
|
+
*
|
|
907
|
+
* Side effects: mutates `entry.capabilityInfo.provided` and the
|
|
908
|
+
* passed-in `byCapability` map.
|
|
909
|
+
*/
|
|
910
|
+
function registerProvidedCapabilities(entry, byCapability) {
|
|
911
|
+
const declared = capabilityList(entry.manifest.provides);
|
|
912
|
+
if (declared.length === 0)
|
|
913
|
+
return { ok: true };
|
|
914
|
+
const sandboxes = entry.manifest.contributes?.sandboxes ?? [];
|
|
915
|
+
const sandboxModules = entry.exports?.sandboxes ?? {};
|
|
916
|
+
// Lazily start the first matching sandbox runner per kind.
|
|
917
|
+
// We only need one runner per provided sandbox.<kind> capability.
|
|
918
|
+
// The sandbox module's start() returned the runner object eagerly
|
|
919
|
+
// inside activate() — we expect plugins to surface ready runners
|
|
920
|
+
// via exports.sandboxes after their start logic runs in activate.
|
|
921
|
+
// Convention: exports.sandboxes is keyed by manifest.module string.
|
|
922
|
+
for (const cap of declared) {
|
|
923
|
+
if (cap === "sandbox.taskPool") {
|
|
924
|
+
// Per-task sandbox manager: backed by
|
|
925
|
+
// exports.taskSandboxPool, not by a sandboxes[] contribution
|
|
926
|
+
// entry. (A taskPool is a *manager* of per-task runners, not
|
|
927
|
+
// a single SandboxRunner, so it doesn't fit the
|
|
928
|
+
// sandboxes[].kind == cap.slice("sandbox.") convention.)
|
|
929
|
+
const pool = entry.exports?.taskSandboxPool;
|
|
930
|
+
if (!pool || typeof pool !== "object") {
|
|
931
|
+
return {
|
|
932
|
+
ok: false,
|
|
933
|
+
reason: `provides["sandbox.taskPool"] declared but exports.taskSandboxPool missing in plugin ${entry.manifest.id}`,
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
byCapability.set(cap, {
|
|
937
|
+
capability: cap,
|
|
938
|
+
pluginId: entry.manifest.id,
|
|
939
|
+
exclusive: KNOWN_CAPABILITIES[cap].exclusive,
|
|
940
|
+
value: pool,
|
|
941
|
+
});
|
|
942
|
+
entry.capabilityInfo.provided.push(cap);
|
|
943
|
+
continue;
|
|
944
|
+
}
|
|
945
|
+
if (cap.startsWith("sandbox.")) {
|
|
946
|
+
const kind = cap.slice("sandbox.".length);
|
|
947
|
+
const matching = sandboxes.find((s) => s.kind === kind);
|
|
948
|
+
if (!matching) {
|
|
949
|
+
return {
|
|
950
|
+
ok: false,
|
|
951
|
+
reason: `provides[\"${cap}\"] declared without a backing sandboxes[] entry of kind=${kind}`,
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
const runner = sandboxModules[matching.module];
|
|
955
|
+
if (!runner || typeof runner !== "object") {
|
|
956
|
+
return {
|
|
957
|
+
ok: false,
|
|
958
|
+
reason: `sandboxes["${matching.module}"] missing or not an object in plugin ${entry.manifest.id}`,
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
byCapability.set(cap, {
|
|
962
|
+
capability: cap,
|
|
963
|
+
pluginId: entry.manifest.id,
|
|
964
|
+
exclusive: KNOWN_CAPABILITIES[cap].exclusive,
|
|
965
|
+
value: runner,
|
|
966
|
+
});
|
|
967
|
+
entry.capabilityInfo.provided.push(cap);
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
if (cap === "browser.cdp") {
|
|
971
|
+
// browser.cdp piggybacks on a sandbox runner with a populated
|
|
972
|
+
// `.browser` field. Find the first runner that exposes one.
|
|
973
|
+
let sidecar;
|
|
974
|
+
for (const s of sandboxes) {
|
|
975
|
+
const runner = sandboxModules[s.module];
|
|
976
|
+
if (runner && runner.browser) {
|
|
977
|
+
sidecar = runner.browser;
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (!sidecar) {
|
|
982
|
+
return {
|
|
983
|
+
ok: false,
|
|
984
|
+
reason: `provides[\"browser.cdp\"] declared but no sandbox runner exposes a .browser sidecar`,
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
byCapability.set(cap, {
|
|
988
|
+
capability: cap,
|
|
989
|
+
pluginId: entry.manifest.id,
|
|
990
|
+
exclusive: KNOWN_CAPABILITIES[cap].exclusive,
|
|
991
|
+
value: sidecar,
|
|
992
|
+
});
|
|
993
|
+
entry.capabilityInfo.provided.push(cap);
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
return {
|
|
997
|
+
ok: false,
|
|
998
|
+
reason: `unknown capability "${cap}" in provides[] (KNOWN_CAPABILITIES is the single source of truth)`,
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
return { ok: true };
|
|
1002
|
+
}
|
|
1003
|
+
//# sourceMappingURL=registry.js.map
|