@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,276 @@
|
|
|
1
|
+
// MicroSandbox plugin server entry (ADR-0004 §9 + §10, N+3, N+4).
|
|
2
|
+
//
|
|
3
|
+
// What activate() does:
|
|
4
|
+
// - buildRunner() picks between the real microsandbox runner and
|
|
5
|
+
// the nullable fallback.
|
|
6
|
+
// - exports.sandboxes["MicroSandboxRunner"] registers the runner
|
|
7
|
+
// under the manifest's `sandbox.shell` capability.
|
|
8
|
+
// - exports.tools registers seven agent tools (exec, reset_sandbox,
|
|
9
|
+
// get_sandbox_status, update_sandbox_config, build_sandbox,
|
|
10
|
+
// list_sandbox_builds, use_sandbox_build). The host collects
|
|
11
|
+
// these via PluginRegistry.toolsForTenant() each agent turn and
|
|
12
|
+
// gates each through its own `available()` hook.
|
|
13
|
+
// - exports.routes wires the GET /status, the four admin endpoints
|
|
14
|
+
// (sandboxfile read/write, builds list/build/use), and the
|
|
15
|
+
// reset endpoint behind /api/p/microsandbox/<route>.
|
|
16
|
+
//
|
|
17
|
+
// Browser sidecar (browser.cdp) and the chromium/Playwright-MCP
|
|
18
|
+
// stack land in a follow-up PR.
|
|
19
|
+
import * as path from "node:path";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
import { buildRunner } from "./runner/index.js";
|
|
22
|
+
import { SandboxPool } from "./runner/pool.js";
|
|
23
|
+
import { BrowserHealthCheckTool, BuildSandboxTool, ExecTool, GetSandboxStatusTool, ListSandboxBuildsTool, ResetSandboxTool, UpdateSandboxConfigTool, UseSandboxBuildTool, makeBrowserToolset, } from "./tools/index.js";
|
|
24
|
+
import { buildAdminRoutes } from "./admin/routes.js";
|
|
25
|
+
import { buildBrowserRoutes } from "./admin/browser-routes.js";
|
|
26
|
+
import { loadTemplates } from "./admin/templates.js";
|
|
27
|
+
let active = null;
|
|
28
|
+
function getRunner() {
|
|
29
|
+
return active?.built.runner ?? null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build the SandboxRunner facade exposed under `sandbox.shell`.
|
|
33
|
+
* Almost every method delegates to the long-lived Browser runner
|
|
34
|
+
* unchanged. The exception is `exec()`: when the call carries a
|
|
35
|
+
* taskId (explicit or resolved via session binding), we dispatch
|
|
36
|
+
* to the pool's per-task sandbox.
|
|
37
|
+
*/
|
|
38
|
+
function buildRoutedRunner(browserRunner, pool) {
|
|
39
|
+
// Build a lightweight proxy that forwards every field except
|
|
40
|
+
// exec to the underlying browser runner. Plain `Proxy` keeps
|
|
41
|
+
// the prototype + future SDK additions auto-forwarded without a
|
|
42
|
+
// version-bump churn here.
|
|
43
|
+
return new Proxy(browserRunner, {
|
|
44
|
+
get(target, prop, receiver) {
|
|
45
|
+
if (prop === "exec") {
|
|
46
|
+
return async (req) => {
|
|
47
|
+
const taskId = req.taskId ??
|
|
48
|
+
(req.sessionId
|
|
49
|
+
? pool.resolveBySession(req.sessionId)?.taskId
|
|
50
|
+
: undefined);
|
|
51
|
+
if (taskId && pool.get(taskId)) {
|
|
52
|
+
return pool.execForTask(taskId, req);
|
|
53
|
+
}
|
|
54
|
+
return target.exec(req);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const value = Reflect.get(target, prop, receiver);
|
|
58
|
+
// Bind functions so `this` stays the underlying runner.
|
|
59
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const templatesRoute = async (_req, res) => {
|
|
64
|
+
if (!active) {
|
|
65
|
+
res.status(503).json({ error: "not_started" });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
res.json({ templates: active.templates });
|
|
69
|
+
};
|
|
70
|
+
const statusRoute = async (_req, res) => {
|
|
71
|
+
if (!active) {
|
|
72
|
+
res.status(503).json({ error: "not_started" });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const status = await active.built.runner.status();
|
|
77
|
+
// Live memory probe — cheap, useful, and the user's #1 ask
|
|
78
|
+
// ("is the sandbox actually using the 8 GiB I gave it, or
|
|
79
|
+
// OOM-ing at 2 GiB because of some default I don't see?").
|
|
80
|
+
// Only probe when state==='ready' so a status poll doesn't
|
|
81
|
+
// cold-start an idle sandbox; nullable / starting / error all
|
|
82
|
+
// skip and the UI just shows "—".
|
|
83
|
+
let liveMemory = null;
|
|
84
|
+
if (status.state === "ready" && active.built.ready) {
|
|
85
|
+
try {
|
|
86
|
+
const r = await active.built.runner.exec({
|
|
87
|
+
command: "awk '/^MemTotal/{t=$2}/^MemAvailable/{a=$2}END{print t\" \"a}' /proc/meminfo",
|
|
88
|
+
// Tight timeout: meminfo on a live VM is a sub-ms read.
|
|
89
|
+
// If we can't get an answer in 2s the VM is wedged and
|
|
90
|
+
// skipping memory in the response is the right call.
|
|
91
|
+
timeoutMs: 2000,
|
|
92
|
+
});
|
|
93
|
+
if (r.exitCode === 0) {
|
|
94
|
+
const [tStr, aStr] = r.stdout.trim().split(/\s+/);
|
|
95
|
+
const t = Number(tStr);
|
|
96
|
+
const a = Number(aStr);
|
|
97
|
+
if (Number.isFinite(t) && Number.isFinite(a)) {
|
|
98
|
+
liveMemory = {
|
|
99
|
+
totalKb: t,
|
|
100
|
+
availableKb: a,
|
|
101
|
+
usedKb: Math.max(0, t - a),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Probe is best-effort. Fall through with liveMemory=null.
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
res.json({
|
|
111
|
+
...status,
|
|
112
|
+
ready: active.built.ready,
|
|
113
|
+
runner: active.built.ready ? "microsandbox" : "nullable",
|
|
114
|
+
liveMemory,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
res.status(500).json({
|
|
119
|
+
error: "status_failed",
|
|
120
|
+
message: err instanceof Error ? err.message : String(err),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
export default {
|
|
125
|
+
async activate(ctx) {
|
|
126
|
+
const built = await buildRunner({
|
|
127
|
+
pluginId: ctx.pluginId,
|
|
128
|
+
contributionId: "main",
|
|
129
|
+
workspaceDir: ctx.workspaceDir,
|
|
130
|
+
tenantId: ctx.tenantId,
|
|
131
|
+
rawConfig: ctx.pluginConfig,
|
|
132
|
+
});
|
|
133
|
+
// ctx.workspaceDir is `<tenantHomeDir>/tenants/<id>/workspace`,
|
|
134
|
+
// so two `dirname()` calls reach the host's tenants root, then
|
|
135
|
+
// one more reaches the tenant home root used by AgentToolContext.
|
|
136
|
+
// (path.dirname twice → strip "/workspace" + strip "/<tenantId>"
|
|
137
|
+
// gives `<tenantHomeDir>/tenants`; we want one more level up.)
|
|
138
|
+
const tenantHomeDir = pathTenantHomeDir(ctx.workspaceDir);
|
|
139
|
+
// Templates live next to the manifest at runtime, mirrored
|
|
140
|
+
// to builtinConfig by sync-builtin-plugins.mjs. Resolve
|
|
141
|
+
// relative to this server.js (`dist/server.js`); the manifest
|
|
142
|
+
// dir is one level up.
|
|
143
|
+
const templatesDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "templates");
|
|
144
|
+
let templates = [];
|
|
145
|
+
try {
|
|
146
|
+
templates = await loadTemplates(templatesDir);
|
|
147
|
+
ctx.log.info(`loaded ${templates.length} sandbox template(s) from ${templatesDir}`);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
// Don't fail activate — the user can still author from
|
|
151
|
+
// scratch. Surface as a warning so the plugin manager UI
|
|
152
|
+
// shows it.
|
|
153
|
+
ctx.log.warn(`failed to load sandbox templates from ${templatesDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
154
|
+
}
|
|
155
|
+
const pool = new SandboxPool({
|
|
156
|
+
tenantId: ctx.tenantId,
|
|
157
|
+
workspaceDir: ctx.workspaceDir,
|
|
158
|
+
config: built.config,
|
|
159
|
+
log: ctx.log,
|
|
160
|
+
});
|
|
161
|
+
const routedRunner = buildRoutedRunner(built.runner, pool);
|
|
162
|
+
active = {
|
|
163
|
+
built,
|
|
164
|
+
log: ctx.log,
|
|
165
|
+
tenantHomeDir,
|
|
166
|
+
tenantId: ctx.tenantId,
|
|
167
|
+
workspaceDir: ctx.workspaceDir,
|
|
168
|
+
sandboxName: `tianshu-${ctx.tenantId}`,
|
|
169
|
+
templates,
|
|
170
|
+
pool,
|
|
171
|
+
routedRunner,
|
|
172
|
+
};
|
|
173
|
+
if (built.ready) {
|
|
174
|
+
ctx.log.info(built.selectedReason);
|
|
175
|
+
// Eager start: kick off the VM in the background so the
|
|
176
|
+
// sandbox is warm by the time the agent (or the user) calls
|
|
177
|
+
// anything. Per Yu 2026-06-06: "还是一直开着,以后还要做后台一直跑的服务".
|
|
178
|
+
// Errors during warm-up land in runner.status().lastError; we
|
|
179
|
+
// don't await because activate() shouldn't block on it.
|
|
180
|
+
const runner = built.runner;
|
|
181
|
+
if (typeof runner.warmUp === "function") {
|
|
182
|
+
runner.warmUp();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
ctx.log.warn(built.selectedReason);
|
|
187
|
+
}
|
|
188
|
+
const browserRoutes = buildBrowserRoutes({
|
|
189
|
+
getRunner,
|
|
190
|
+
});
|
|
191
|
+
const adminRoutes = buildAdminRoutes({
|
|
192
|
+
getRunner,
|
|
193
|
+
// The pool is owned by the activate closure (no module
|
|
194
|
+
// global), so we expose it via a closure rather than a
|
|
195
|
+
// module-level getter. Returns null only if a future
|
|
196
|
+
// refactor decouples pool creation from activate.
|
|
197
|
+
getPool: () => active?.pool ?? null,
|
|
198
|
+
tenantId: active.tenantId,
|
|
199
|
+
workspaceDir: active.workspaceDir,
|
|
200
|
+
tenantHomeDir: active.tenantHomeDir,
|
|
201
|
+
sandboxName: active.sandboxName,
|
|
202
|
+
});
|
|
203
|
+
// The Playwright MCP toolset is wired regardless of whether
|
|
204
|
+
// the runner currently exposes a browser sidecar — listTools()
|
|
205
|
+
// simply returns [] until the sandbox starts emitting an MCP
|
|
206
|
+
// host port. Refresh on demand from the host /api/mcp/servers
|
|
207
|
+
// route or implicitly each agent turn.
|
|
208
|
+
const browserToolset = makeBrowserToolset({
|
|
209
|
+
getSidecar: () => getRunner()?.browser ?? null,
|
|
210
|
+
log: ctx.log,
|
|
211
|
+
});
|
|
212
|
+
return {
|
|
213
|
+
sandboxes: {
|
|
214
|
+
MicroSandboxRunner: routedRunner,
|
|
215
|
+
},
|
|
216
|
+
taskSandboxPool: pool,
|
|
217
|
+
tools: {
|
|
218
|
+
ExecTool,
|
|
219
|
+
ResetSandboxTool,
|
|
220
|
+
GetSandboxStatusTool,
|
|
221
|
+
UpdateSandboxConfigTool,
|
|
222
|
+
BuildSandboxTool,
|
|
223
|
+
ListSandboxBuildsTool,
|
|
224
|
+
UseSandboxBuildTool,
|
|
225
|
+
BrowserHealthCheckTool,
|
|
226
|
+
},
|
|
227
|
+
toolsetProviders: {
|
|
228
|
+
BrowserToolset: browserToolset,
|
|
229
|
+
},
|
|
230
|
+
routes: {
|
|
231
|
+
status: statusRoute,
|
|
232
|
+
getSandboxfile: adminRoutes.getSandboxfile,
|
|
233
|
+
putSandboxfile: adminRoutes.putSandboxfile,
|
|
234
|
+
getSandboxfileTemplates: templatesRoute,
|
|
235
|
+
getBuilds: adminRoutes.getBuilds,
|
|
236
|
+
postBuilds: adminRoutes.postBuilds,
|
|
237
|
+
postUseBuild: adminRoutes.postUseBuild,
|
|
238
|
+
postReset: adminRoutes.postReset,
|
|
239
|
+
postExec: adminRoutes.postExec,
|
|
240
|
+
getTaskPool: adminRoutes.getTaskPool,
|
|
241
|
+
postTaskPoolDestroy: adminRoutes.postTaskPoolDestroy,
|
|
242
|
+
getBrowserStatus: browserRoutes.getBrowserStatus,
|
|
243
|
+
postBrowserRestart: browserRoutes.postBrowserRestart,
|
|
244
|
+
postBrowserResize: browserRoutes.postBrowserResize,
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
async deactivate() {
|
|
249
|
+
if (!active)
|
|
250
|
+
return;
|
|
251
|
+
// Stop every running task sandbox first; they hold per-task
|
|
252
|
+
// microVMs that the long-lived runner doesn't know about.
|
|
253
|
+
try {
|
|
254
|
+
await active.pool.dispose();
|
|
255
|
+
}
|
|
256
|
+
catch (err) {
|
|
257
|
+
active.log.warn(`task pool dispose during deactivate failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
await active.built.runner.shutdown();
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
// best-effort
|
|
264
|
+
}
|
|
265
|
+
active = null;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* `ctx.workspaceDir` is `<tenantHomeDir>/tenants/<tenantId>/workspace`.
|
|
270
|
+
* Walk up three directory levels to recover the tenant home dir
|
|
271
|
+
* (the same value the host sets as `AgentToolContext.tenantHomeDir`).
|
|
272
|
+
*/
|
|
273
|
+
function pathTenantHomeDir(workspaceDir) {
|
|
274
|
+
return path.resolve(workspaceDir, "..", "..", "..");
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,wBAAwB;AACxB,iEAAiE;AACjE,2BAA2B;AAC3B,iEAAiE;AACjE,qDAAqD;AACrD,oEAAoE;AACpE,8DAA8D;AAC9D,+DAA+D;AAC/D,kEAAkE;AAClE,mDAAmD;AACnD,mEAAmE;AACnE,6DAA6D;AAC7D,uDAAuD;AACvD,EAAE;AACF,gEAAgE;AAChE,gCAAgC;AAEhC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWzC,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OA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AA+C,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,cAAc;QAChB,CAAC;QACD,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;CACF,CAAC;AAEF;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,YAAoB;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AgentToolContext, BrowserSidecar, PluginLogger } from "@tianshu/plugin-sdk";
|
|
2
|
+
import { McpToolset } from "@tianshu/plugin-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Build the Playwright-MCP toolset for one active plugin tenant.
|
|
5
|
+
* Caller wires this object into `exports.toolsetProviders` and
|
|
6
|
+
* triggers `refresh()` whenever the BrowserSidecar's MCP host port
|
|
7
|
+
* transitions from undefined → number (e.g. after sandbox start).
|
|
8
|
+
*
|
|
9
|
+
* The endpoint resolver re-reads `sidecar.mcpHostPort()` on every
|
|
10
|
+
* refresh, so a sandbox reset (which picks a new free port) is
|
|
11
|
+
* handled transparently.
|
|
12
|
+
*/
|
|
13
|
+
export declare function makeBrowserToolset(opts: {
|
|
14
|
+
/** Sidecar wrapper around the active runner. Read every refresh. */
|
|
15
|
+
getSidecar: () => BrowserSidecar | null;
|
|
16
|
+
/** Plugin logger; used for refresh-error breadcrumbs. */
|
|
17
|
+
log: PluginLogger;
|
|
18
|
+
}): McpToolset;
|
|
19
|
+
/**
|
|
20
|
+
* Type-marker re-export so server.ts stays self-contained when we
|
|
21
|
+
* later add per-tool helpers (post-processing, custom describe()
|
|
22
|
+
* blocks) without churning the import graph.
|
|
23
|
+
*/
|
|
24
|
+
export type { AgentToolContext };
|
|
25
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/tools/browser.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,oEAAoE;IACpE,UAAU,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IACxC,yDAAyD;IACzD,GAAG,EAAE,YAAY,CAAC;CACnB,GAAG,UAAU,CA0Cb;AAED;;;;GAIG;AACH,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Browser toolset: reflect every tool advertised by the per-tenant
|
|
2
|
+
// Playwright MCP server into AgentTools.
|
|
3
|
+
//
|
|
4
|
+
// History: in N+5.3 we hand-wrote three wrappers (browser_navigate,
|
|
5
|
+
// browser_snapshot, browser_screenshot) that proxied through the
|
|
6
|
+
// internal McpClient. Yu's correct push-back ("why not just expose
|
|
7
|
+
// MCP directly?") plus the realisation that we were burning a wrapper
|
|
8
|
+
// per tool for no real win led to N+5.4. Now we use the SDK-supplied
|
|
9
|
+
// `McpToolset`, which:
|
|
10
|
+
//
|
|
11
|
+
// - calls Playwright MCP's `tools/list` once the sandbox is up
|
|
12
|
+
// - reflects every advertised tool (~25 today) into a pi-ai
|
|
13
|
+
// AgentTool with the upstream schema verbatim
|
|
14
|
+
// - re-runs `tools/list` on demand (refresh()) so we pick up
|
|
15
|
+
// additions when the upstream package upgrades
|
|
16
|
+
// - keeps tool names prefixed with "" (no extra prefix — the
|
|
17
|
+
// upstream already names them `browser_*`) so the agent UI
|
|
18
|
+
// stays readable
|
|
19
|
+
// - shows up in the global /admin/mcp page via
|
|
20
|
+
// `provider.snapshot()`
|
|
21
|
+
//
|
|
22
|
+
// What's *not* here: post-processing of MCP results. The SDK's
|
|
23
|
+
// `textOfMcpContent` already extracts text blocks and surfaces
|
|
24
|
+
// them as the tool's `text` field (with the structured payload
|
|
25
|
+
// preserved on `data`). Anything fancier (e.g. snapshot
|
|
26
|
+
// summarisation) goes in describe() / a custom Toolset subclass.
|
|
27
|
+
import { McpToolset } from "@tianshu/plugin-sdk";
|
|
28
|
+
/**
|
|
29
|
+
* Build the Playwright-MCP toolset for one active plugin tenant.
|
|
30
|
+
* Caller wires this object into `exports.toolsetProviders` and
|
|
31
|
+
* triggers `refresh()` whenever the BrowserSidecar's MCP host port
|
|
32
|
+
* transitions from undefined → number (e.g. after sandbox start).
|
|
33
|
+
*
|
|
34
|
+
* The endpoint resolver re-reads `sidecar.mcpHostPort()` on every
|
|
35
|
+
* refresh, so a sandbox reset (which picks a new free port) is
|
|
36
|
+
* handled transparently.
|
|
37
|
+
*/
|
|
38
|
+
export function makeBrowserToolset(opts) {
|
|
39
|
+
const toolset = new McpToolset({
|
|
40
|
+
name: "playwright",
|
|
41
|
+
// Upstream tools are already `browser_*`; an extra prefix would
|
|
42
|
+
// give us `playwright_browser_*` which is silly. The model-facing
|
|
43
|
+
// name stays the same as before.
|
|
44
|
+
prefix: "",
|
|
45
|
+
resolve: () => {
|
|
46
|
+
const s = opts.getSidecar();
|
|
47
|
+
const port = s?.mcpHostPort();
|
|
48
|
+
return port ? `http://127.0.0.1:${port}` : undefined;
|
|
49
|
+
},
|
|
50
|
+
// Playwright MCP server inside the sandbox is bound to
|
|
51
|
+
// `localhost:3200`; we connect through a host-side port forward
|
|
52
|
+
// so set the Host header to match what the upstream allows.
|
|
53
|
+
upstreamHost: "localhost:3200",
|
|
54
|
+
// Trim Playwright's wall-of-text descriptions to something
|
|
55
|
+
// closer to one line per tool — the agent's prompt budget is
|
|
56
|
+
// tight and the upstream descriptions repeat a lot of preamble.
|
|
57
|
+
describe: (t) => {
|
|
58
|
+
if (!t.description)
|
|
59
|
+
return undefined;
|
|
60
|
+
const firstSentence = t.description.split(/(?<=[.!?])\s+/)[0]?.trim();
|
|
61
|
+
// Keep first sentence + "(Playwright MCP)" suffix so the
|
|
62
|
+
// model knows where the capability comes from. This mirrors
|
|
63
|
+
// the labelling style of other server-prefixed tools.
|
|
64
|
+
return firstSentence
|
|
65
|
+
? `${firstSentence} (Playwright MCP)`
|
|
66
|
+
: t.description;
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
// Best-effort prime: try to populate the tool list now so the
|
|
70
|
+
// first agent turn already sees the surface. The toolset itself
|
|
71
|
+
// also self-refreshes lazily on each tools call, so failures here
|
|
72
|
+
// (sandbox not booted yet) are non-fatal.
|
|
73
|
+
void toolset.refresh().catch((err) => {
|
|
74
|
+
opts.log.warn(`playwright MCP toolset initial refresh failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
75
|
+
});
|
|
76
|
+
return toolset;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/tools/browser.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yCAAyC;AACzC,EAAE;AACF,oEAAoE;AACpE,iEAAiE;AACjE,mEAAmE;AACnE,sEAAsE;AACtE,qEAAqE;AACrE,uBAAuB;AACvB,EAAE;AACF,iEAAiE;AACjE,8DAA8D;AAC9D,kDAAkD;AAClD,+DAA+D;AAC/D,mDAAmD;AACnD,+DAA+D;AAC/D,+DAA+D;AAC/D,qBAAqB;AACrB,iDAAiD;AACjD,4BAA4B;AAC5B,EAAE;AACF,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,iEAAiE;AAOjE,OAAO,EAAE,UAAU,EAAE,MAAM,qBA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EAAE,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,qBAAqB,CAAC;AA2E7B,eAAO,MAAM,gBAAgB,EAAE,SAyG9B,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,SA0CnC,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,SAsDjC,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// Build / use agent tools.
|
|
2
|
+
//
|
|
3
|
+
// Workflow (per ADR design 2026-06-07):
|
|
4
|
+
//
|
|
5
|
+
// 1. agent edits <userHome>/sandbox/Sandboxfile via the existing
|
|
6
|
+
// file tools (write_file / edit_file) — same per-user fs
|
|
7
|
+
// surface, no new fs primitive needed.
|
|
8
|
+
// 2. agent calls `build_sandbox` → plugin reads the Sandboxfile,
|
|
9
|
+
// runs apt/pip/npm/exec inside a short-lived builder VM,
|
|
10
|
+
// captures a Snapshot in microsandbox's DB, drops a metadata
|
|
11
|
+
// json under <userHome>/sandbox/builds/<id>.json. Tenant state
|
|
12
|
+
// not touched.
|
|
13
|
+
// 3. agent calls `list_sandbox_builds` to review past builds.
|
|
14
|
+
// 4. agent (or a tenant admin) calls `publish_sandbox(build_id)`
|
|
15
|
+
// → plugin writes <tenant>/_tenant/sandbox/current.json
|
|
16
|
+
// pointer. Next sandbox restart (reset_sandbox / next session)
|
|
17
|
+
// starts from the in-use snapshot via fromSnapshot(...).
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import { promises as fs } from "node:fs";
|
|
20
|
+
import { Type } from "typebox";
|
|
21
|
+
import { errorResult, okResult, } from "@tianshu/plugin-sdk";
|
|
22
|
+
import { buildSnapshot, BuildFailedError, snapshotExists, } from "../build/builder.js";
|
|
23
|
+
import { parseSandboxfile, SandboxfileError, } from "../build/sandboxfile.js";
|
|
24
|
+
import { listBuildMetadata, readBuildMetadata, writeBuildMetadata, } from "../build/metadata.js";
|
|
25
|
+
import { pointerPath, readPointer, writePointer, } from "../build/pointer.js";
|
|
26
|
+
const DEFAULT_SANDBOXFILE_REL = "sandbox/Sandboxfile";
|
|
27
|
+
// ─── helpers ───────────────────────────────────────────────────
|
|
28
|
+
function tenantWorkspaceDir(ctx) {
|
|
29
|
+
// <tenantHomeDir>/tenants/<tenantId>/workspace — same layout
|
|
30
|
+
// microsandbox runner uses for its bind mount.
|
|
31
|
+
return path.join(ctx.tenantHomeDir, "tenants", ctx.tenantId, "workspace");
|
|
32
|
+
}
|
|
33
|
+
function pickBuildId() {
|
|
34
|
+
const d = new Date();
|
|
35
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
36
|
+
return (`${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-` +
|
|
37
|
+
`${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`);
|
|
38
|
+
}
|
|
39
|
+
async function loadSpec(ctx, relPath) {
|
|
40
|
+
const full = path.resolve(ctx.userHomeDir, relPath.replace(/^\/+/, ""));
|
|
41
|
+
if (!full.startsWith(ctx.userHomeDir)) {
|
|
42
|
+
return { error: `Sandboxfile path "${relPath}" escapes user home` };
|
|
43
|
+
}
|
|
44
|
+
let raw;
|
|
45
|
+
try {
|
|
46
|
+
raw = await fs.readFile(full, "utf8");
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (err.code === "ENOENT") {
|
|
50
|
+
return { error: `Sandboxfile not found at ${relPath}` };
|
|
51
|
+
}
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return { spec: parseSandboxfile(raw), sourcePath: relPath };
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
if (err instanceof SandboxfileError)
|
|
59
|
+
return { error: err.message };
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// ─── build_sandbox ─────────────────────────────────────────────
|
|
64
|
+
export const BuildSandboxTool = {
|
|
65
|
+
schema: {
|
|
66
|
+
name: "build_sandbox",
|
|
67
|
+
description: `Build a custom sandbox image from your Sandboxfile.
|
|
68
|
+
|
|
69
|
+
Reads <user-home>/sandbox/Sandboxfile (or whatever \`spec_path\` points at), \
|
|
70
|
+
boots a short-lived builder VM from the spec's base image, runs the apt/pip/npm/exec \
|
|
71
|
+
steps in order, captures a snapshot into microsandbox's local store, and drops a \
|
|
72
|
+
metadata json under <user-home>/sandbox/builds/<build_id>.json so you can list the \
|
|
73
|
+
result later.
|
|
74
|
+
|
|
75
|
+
This does NOT change the tenant's currently-running sandbox \u2014 your build is \
|
|
76
|
+
private to you until you call \`publish_sandbox(build_id)\`.
|
|
77
|
+
|
|
78
|
+
Sandboxfile shape (YAML-ish, v0):
|
|
79
|
+
\`\`\`yaml
|
|
80
|
+
image: python:3.12-slim # required
|
|
81
|
+
cpus: 4 # optional, default 4
|
|
82
|
+
memory_mib: 4096 # optional, default 4096
|
|
83
|
+
apt: [libreoffice-writer, fonts-noto-cjk]
|
|
84
|
+
pip: [pandas, numpy]
|
|
85
|
+
npm: [tsx, typescript]
|
|
86
|
+
exec:
|
|
87
|
+
- cp /workspace/users/<your-userId>/sandbox/my.whl /tmp/
|
|
88
|
+
- pip install /tmp/my.whl
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
Returns the build id, snapshot name, base image, and a tail of the build log.`,
|
|
92
|
+
parameters: Type.Object({
|
|
93
|
+
spec_path: Type.Optional(Type.String({
|
|
94
|
+
description: `Path to the Sandboxfile, relative to your user home. Default "${DEFAULT_SANDBOXFILE_REL}".`,
|
|
95
|
+
})),
|
|
96
|
+
}),
|
|
97
|
+
},
|
|
98
|
+
async available(ctx) {
|
|
99
|
+
return ctx.capabilities.has("sandbox.shell");
|
|
100
|
+
},
|
|
101
|
+
async execute(args, ctx) {
|
|
102
|
+
const specPath = args.spec_path ??
|
|
103
|
+
`/${DEFAULT_SANDBOXFILE_REL}`;
|
|
104
|
+
const loaded = await loadSpec(ctx, specPath);
|
|
105
|
+
if ("error" in loaded)
|
|
106
|
+
return errorResult(loaded.error);
|
|
107
|
+
const buildId = pickBuildId();
|
|
108
|
+
const sandboxName = `tianshu-${ctx.tenantId}`;
|
|
109
|
+
const wsDir = tenantWorkspaceDir(ctx);
|
|
110
|
+
// Capture every onLog line. The host doesn't yet stream
|
|
111
|
+
// tool-internal log lines to the chat UI, but we (a) tee them
|
|
112
|
+
// through ctx.log.info for the server console, and (b) include
|
|
113
|
+
// a tail (or full body on failure) in the agent-visible result
|
|
114
|
+
// so the agent isn't staring at a black box for 5+ minutes.
|
|
115
|
+
const log = [];
|
|
116
|
+
const onLog = (line) => {
|
|
117
|
+
log.push(line);
|
|
118
|
+
ctx.log.info(`[build_sandbox] ${line}`);
|
|
119
|
+
};
|
|
120
|
+
try {
|
|
121
|
+
const result = await buildSnapshot({
|
|
122
|
+
spec: loaded.spec,
|
|
123
|
+
sandboxName,
|
|
124
|
+
buildId,
|
|
125
|
+
tenantId: ctx.tenantId,
|
|
126
|
+
workspaceDir: wsDir,
|
|
127
|
+
onLog,
|
|
128
|
+
});
|
|
129
|
+
const meta = {
|
|
130
|
+
buildId,
|
|
131
|
+
snapshotName: result.snapshotName,
|
|
132
|
+
baseImage: result.baseImage,
|
|
133
|
+
builtAt: new Date().toISOString(),
|
|
134
|
+
durationMs: result.durationMs,
|
|
135
|
+
logTail: result.logTail,
|
|
136
|
+
sandboxfilePath: loaded.sourcePath,
|
|
137
|
+
};
|
|
138
|
+
await writeBuildMetadata(ctx.userHomeDir, meta);
|
|
139
|
+
return okResult(`Built ${result.snapshotName} in ${(result.durationMs / 1000).toFixed(1)}s. ` +
|
|
140
|
+
`Run publish_sandbox("${buildId}") to make it the tenant's active sandbox image.\n\n` +
|
|
141
|
+
`Build log tail:\n${result.logTail}`, meta);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
if (err instanceof BuildFailedError) {
|
|
145
|
+
// Surface the failing step + stderr in the human-visible
|
|
146
|
+
// text. The agent reads `text` first; previously this only
|
|
147
|
+
// had "build failed: <step>" with the stderr stashed in the
|
|
148
|
+
// structured payload, which several models silently ignored.
|
|
149
|
+
const tail = log.slice(-40).join("\n");
|
|
150
|
+
return errorResult(`build failed: ${err.message}\n\n` +
|
|
151
|
+
`--- stderr ---\n${err.stderr}\n` +
|
|
152
|
+
`--- last log lines ---\n${tail}`, { stderr: err.stderr, logTail: tail });
|
|
153
|
+
}
|
|
154
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
155
|
+
return errorResult(`build threw: ${msg}`);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
// ─── list_sandbox_builds ───────────────────────────────────────
|
|
160
|
+
export const ListSandboxBuildsTool = {
|
|
161
|
+
schema: {
|
|
162
|
+
name: "list_sandbox_builds",
|
|
163
|
+
description: `List past sandbox builds in your user home, newest first. Each row \
|
|
164
|
+
includes build id, base image, build time, duration, and whether it's currently \
|
|
165
|
+
in use as the tenant's sandbox image.`,
|
|
166
|
+
parameters: Type.Object({}),
|
|
167
|
+
},
|
|
168
|
+
async available(ctx) {
|
|
169
|
+
return ctx.capabilities.has("sandbox.shell");
|
|
170
|
+
},
|
|
171
|
+
async execute(_args, ctx) {
|
|
172
|
+
const builds = await listBuildMetadata(ctx.userHomeDir);
|
|
173
|
+
const wsDir = tenantWorkspaceDir(ctx);
|
|
174
|
+
const pointer = await readPointer(wsDir);
|
|
175
|
+
const enriched = builds.map((b) => ({
|
|
176
|
+
build_id: b.buildId,
|
|
177
|
+
snapshot_name: b.snapshotName,
|
|
178
|
+
base_image: b.baseImage,
|
|
179
|
+
built_at: b.builtAt,
|
|
180
|
+
duration_ms: b.durationMs,
|
|
181
|
+
sandboxfile_path: b.sandboxfilePath,
|
|
182
|
+
published: pointer ? pointer.snapshotName === b.snapshotName : false,
|
|
183
|
+
}));
|
|
184
|
+
if (enriched.length === 0) {
|
|
185
|
+
return okResult("No builds yet. Use build_sandbox to make one.", {
|
|
186
|
+
builds: [],
|
|
187
|
+
published: pointer?.snapshotName ?? null,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const summary = `${enriched.length} build(s); in use: ${pointer?.snapshotName ?? "(none)"}\n` +
|
|
191
|
+
enriched
|
|
192
|
+
.map((b) => ` ${b.published ? "*" : " "} ${b.build_id} ${b.base_image} ${(b.duration_ms / 1000).toFixed(1)}s`)
|
|
193
|
+
.join("\n");
|
|
194
|
+
return okResult(summary, { builds: enriched, published: pointer?.snapshotName ?? null });
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
// ─── use_sandbox_build ─────────────────────────────────────────
|
|
198
|
+
export const UseSandboxBuildTool = {
|
|
199
|
+
schema: {
|
|
200
|
+
name: "use_sandbox_build",
|
|
201
|
+
description: `Switch the tenant to a previously-built sandbox image. Writes \
|
|
202
|
+
<tenant>/_tenant/sandbox/current.json so the next reset_sandbox (or the next \
|
|
203
|
+
session) boots from this snapshot instead of the configured default image.
|
|
204
|
+
|
|
205
|
+
This is a tenant-scoped switch — it does not publish anything outside the \
|
|
206
|
+
tenant. The currently-running sandbox VM is **not** automatically restarted. \
|
|
207
|
+
Call \`reset_sandbox\` after this to make it live now.`,
|
|
208
|
+
parameters: Type.Object({
|
|
209
|
+
build_id: Type.String({
|
|
210
|
+
description: "Build id from list_sandbox_builds (e.g. \"20260607-084230\"). Use list_sandbox_builds first if you don't remember.",
|
|
211
|
+
}),
|
|
212
|
+
}),
|
|
213
|
+
},
|
|
214
|
+
async available(ctx) {
|
|
215
|
+
return ctx.capabilities.has("sandbox.shell");
|
|
216
|
+
},
|
|
217
|
+
async execute(args, ctx) {
|
|
218
|
+
const buildId = String(args.build_id ?? "");
|
|
219
|
+
if (!buildId)
|
|
220
|
+
return errorResult("build_id is required");
|
|
221
|
+
const meta = await readBuildMetadata(ctx.userHomeDir, buildId);
|
|
222
|
+
if (!meta) {
|
|
223
|
+
return errorResult(`build "${buildId}" not found in your home (run list_sandbox_builds to see what's available)`);
|
|
224
|
+
}
|
|
225
|
+
const exists = await snapshotExists(meta.snapshotName);
|
|
226
|
+
if (!exists) {
|
|
227
|
+
return errorResult(`snapshot "${meta.snapshotName}" no longer exists in microsandbox; rebuild with build_sandbox`);
|
|
228
|
+
}
|
|
229
|
+
const wsDir = tenantWorkspaceDir(ctx);
|
|
230
|
+
const pointer = {
|
|
231
|
+
snapshotName: meta.snapshotName,
|
|
232
|
+
baseImage: meta.baseImage,
|
|
233
|
+
// Field names on disk stay publishedAt/publishedBy to keep
|
|
234
|
+
// existing pointer files readable without a migration. The
|
|
235
|
+
// user-facing terminology is "in use" / "switch".
|
|
236
|
+
publishedAt: new Date().toISOString(),
|
|
237
|
+
publishedBy: ctx.userId,
|
|
238
|
+
};
|
|
239
|
+
await writePointer(wsDir, pointer);
|
|
240
|
+
return okResult(`Switched tenant to ${meta.snapshotName}. Call reset_sandbox to apply it to the running VM.`, { pointer, pointerPath: pointerPath(wsDir) });
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=build.js.map
|