@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,668 @@
|
|
|
1
|
+
// Real microsandbox runner.
|
|
2
|
+
//
|
|
3
|
+
// Uses the `microsandbox` npm package directly (napi-rs bindings to
|
|
4
|
+
// the Rust runtime) — no CLI, no per-call process spawn. The plugin
|
|
5
|
+
// keeps a single long-lived Sandbox per tenant for its lifetime,
|
|
6
|
+
// matching the closed-source repo's pattern.
|
|
7
|
+
//
|
|
8
|
+
// v0 scope (this PR, ADR-0004 N+2.5):
|
|
9
|
+
// - Lazy start: the actual `Sandbox.builder(...).create()` runs on
|
|
10
|
+
// first `exec()` (or first explicit `start()`). Plugin activation
|
|
11
|
+
// is cheap; we don't want enabling the plugin to block on a
|
|
12
|
+
// first-time image pull (~1-2 minutes for python:3.12).
|
|
13
|
+
// - Single VM per tenant. Lives until plugin deactivate, an admin
|
|
14
|
+
// `reset()`, or tenant DB pool eviction.
|
|
15
|
+
// - workspace bind-mount: <tenant>/workspace → /workspace inside the
|
|
16
|
+
// guest. readFile/writeFile use the host path directly.
|
|
17
|
+
// - python:3.12-slim default. Custom images come in N+5 (Sandboxfile
|
|
18
|
+
// editor UI).
|
|
19
|
+
//
|
|
20
|
+
// What this is NOT yet:
|
|
21
|
+
// - No browser sidecar. Lands in the follow-up that adds chromium +
|
|
22
|
+
// Playwright MCP through the same VM.
|
|
23
|
+
// - No idle reaping. The closed-source repo pauses VMs after 4h; v0
|
|
24
|
+
// keeps them around until the plugin is disabled.
|
|
25
|
+
import * as path from "node:path";
|
|
26
|
+
import { promises as fs } from "node:fs";
|
|
27
|
+
import { readPointer } from "../build/pointer.js";
|
|
28
|
+
import { snapshotExists } from "../build/builder.js";
|
|
29
|
+
import { MicrosandboxBrowserSidecar } from "./browser.js";
|
|
30
|
+
import { pickFreePorts } from "./free-port.js";
|
|
31
|
+
// Guest ports for the optional browser stack. The Sandboxfile
|
|
32
|
+
// browser template wires CloakBrowser to 9222, Playwright MCP to
|
|
33
|
+
// 3200, noVNC to 6080. We always forward all three even when
|
|
34
|
+
// the active image doesn't include the browser layer —
|
|
35
|
+
// microsandbox is fine with port forwards that nothing inside the
|
|
36
|
+
// guest is listening on.
|
|
37
|
+
const BROWSER_GUEST_CDP_PORT = 9222;
|
|
38
|
+
const BROWSER_GUEST_MCP_PORT = 3200;
|
|
39
|
+
const BROWSER_GUEST_VNC_PORT = 6080;
|
|
40
|
+
let msbModuleP = null;
|
|
41
|
+
function loadMsb() {
|
|
42
|
+
if (!msbModuleP) {
|
|
43
|
+
msbModuleP = import("microsandbox");
|
|
44
|
+
}
|
|
45
|
+
return msbModuleP;
|
|
46
|
+
}
|
|
47
|
+
export class MicrosandboxRunner {
|
|
48
|
+
id;
|
|
49
|
+
kind = "shell";
|
|
50
|
+
/** Browser sidecar exposed via `provides: [browser.cdp]`. The
|
|
51
|
+
* N+5.1 scaffold returns undefined ports; N+5.3 will fill them
|
|
52
|
+
* in once chromium + Playwright MCP are running inside the VM. */
|
|
53
|
+
browser = new MicrosandboxBrowserSidecar();
|
|
54
|
+
opts;
|
|
55
|
+
bornAt = Date.now();
|
|
56
|
+
state = "stopped";
|
|
57
|
+
startError = null;
|
|
58
|
+
startedAt = 0;
|
|
59
|
+
handle = null;
|
|
60
|
+
startPromise = null;
|
|
61
|
+
lastExec = null;
|
|
62
|
+
/** Snapshot name actually being used by the live VM, or null when
|
|
63
|
+
* booted from `image(...)`. Surfaced in status().meta. */
|
|
64
|
+
activeSnapshot = null;
|
|
65
|
+
constructor(opts) {
|
|
66
|
+
this.id = `${opts.pluginId}.${opts.contributionId}`;
|
|
67
|
+
this.opts = opts;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Kick off a VM start without waiting for it. Used by the plugin's
|
|
71
|
+
* `activate()` so the sandbox is warm by the time the user opens
|
|
72
|
+
* the chat — no first-exec stall, status panel reads `ready`
|
|
73
|
+
* within ~10s of plugin enable.
|
|
74
|
+
*
|
|
75
|
+
* Errors during warm-up land in `this.startError` and surface via
|
|
76
|
+
* `status()`; we don't throw because the caller (activate hook)
|
|
77
|
+
* shouldn't fail just because a background warm-up failed. The
|
|
78
|
+
* next real `exec()` will see the error state and surface it to
|
|
79
|
+
* the agent properly.
|
|
80
|
+
*/
|
|
81
|
+
warmUp() {
|
|
82
|
+
if (this.state === "ready")
|
|
83
|
+
return;
|
|
84
|
+
if (this.startPromise)
|
|
85
|
+
return;
|
|
86
|
+
this.state = "starting";
|
|
87
|
+
this.startError = null;
|
|
88
|
+
this.startPromise = this.doStart()
|
|
89
|
+
.catch(() => {
|
|
90
|
+
// doStart already set state="error" + startError. Swallow
|
|
91
|
+
// here so the unhandled-rejection guard doesn't fire.
|
|
92
|
+
})
|
|
93
|
+
.finally(() => {
|
|
94
|
+
this.startPromise = null;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async exec(req) {
|
|
98
|
+
const start = Date.now();
|
|
99
|
+
// Resolve effective timeout: caller-supplied wins, then
|
|
100
|
+
// tenant-config (configurable via the new admin form), then
|
|
101
|
+
// DEFAULT_CONFIG.execTimeoutMs (5 min). 0 / undefined means
|
|
102
|
+
// "no timeout" — we still recommend the configured one but
|
|
103
|
+
// honour an explicit opt-out for the rare e2e fixture.
|
|
104
|
+
const timeoutMs = typeof req.timeoutMs === "number" && Number.isFinite(req.timeoutMs)
|
|
105
|
+
? Math.max(0, req.timeoutMs)
|
|
106
|
+
: this.opts.config.execTimeoutMs;
|
|
107
|
+
try {
|
|
108
|
+
const handle = await this.ensureStarted();
|
|
109
|
+
const workdir = req.workdir ?? "/workspace";
|
|
110
|
+
// Switch to the tenant user (created on demand) instead of
|
|
111
|
+
// running every command as root. microsandbox v0 has no user
|
|
112
|
+
// namespace, so the OS-level uid was always 0; the agent's
|
|
113
|
+
// `whoami` answered "root", and there was no way to express
|
|
114
|
+
// "I am tenant user dev" except via the env hack we used to
|
|
115
|
+
// ship in PR #137.
|
|
116
|
+
//
|
|
117
|
+
// New approach: each `req.userId` becomes a real Linux
|
|
118
|
+
// account inside the guest with `useradd`, gets nopasswd
|
|
119
|
+
// sudoers, and the actual command runs through
|
|
120
|
+
// `runuser -u <id> -- bash -c '...'`. So:
|
|
121
|
+
// - `whoami` returns <id> (real uid)
|
|
122
|
+
// - `$USER` / `$LOGNAME` set to <id> (runuser injects)
|
|
123
|
+
// - `$HOME` set to /workspace/users/<id> (passwd entry)
|
|
124
|
+
// - `~` expands to that home (shell honours $HOME)
|
|
125
|
+
// - `sudo apt install ...` works (nopasswd sudoers)
|
|
126
|
+
// - `id <id>` returns a stable uid (cksum-derived, so
|
|
127
|
+
// the same userId
|
|
128
|
+
// always picks the
|
|
129
|
+
// same uid)
|
|
130
|
+
//
|
|
131
|
+
// The user creation is idempotent (`id <id>` short-circuits
|
|
132
|
+
// when the account already exists). Sandboxfile build steps
|
|
133
|
+
// and admin/debug exec calls (no req.userId) keep the legacy
|
|
134
|
+
// root-with-empty-env behaviour — useful for image setup
|
|
135
|
+
// and debugging the system layer directly.
|
|
136
|
+
//
|
|
137
|
+
// We also export `MSB_USER_ID` after `runuser` so scripts
|
|
138
|
+
// that want an unambiguous "injected by microsandbox" name
|
|
139
|
+
// can read it.
|
|
140
|
+
const userBlock = req.userId
|
|
141
|
+
? buildTenantUserBlock(req.userId, workdir, req.command)
|
|
142
|
+
: `set -e; cd "${shellEscape(workdir)}"; ${req.command}`;
|
|
143
|
+
const script = userBlock;
|
|
144
|
+
// Use shellStream (which yields an ExecHandle we can kill)
|
|
145
|
+
// instead of shell (which is fire-and-wait). With a handle
|
|
146
|
+
// we can race `collect()` against a timeout and call
|
|
147
|
+
// `handle.kill()` on overrun, instead of letting the SDK
|
|
148
|
+
// sit forever waiting for an exit event that never comes.
|
|
149
|
+
// The "exec session ended without exit event" failure mode
|
|
150
|
+
// Yu was hitting was specifically this: a 13-minute exec
|
|
151
|
+
// where the host-guest channel had broken, but our code had
|
|
152
|
+
// no way to give up on it.
|
|
153
|
+
// Sentinel object identity — not a string — so TS narrows
|
|
154
|
+
// the union cleanly without us casting the ExecOutput shape.
|
|
155
|
+
const TIMEOUT = Symbol("exec-timeout");
|
|
156
|
+
const HANDSHAKE = Symbol("exec-handshake-timeout");
|
|
157
|
+
const ABORTED = Symbol("exec-aborted");
|
|
158
|
+
// Shared abort race used by both the handshake and the
|
|
159
|
+
// collect step below. If the caller already aborted before
|
|
160
|
+
// we got here, fast-path back; otherwise listen once.
|
|
161
|
+
const buildAbortP = () => {
|
|
162
|
+
const sig = req.signal;
|
|
163
|
+
if (!sig)
|
|
164
|
+
return new Promise(() => { });
|
|
165
|
+
if (sig.aborted)
|
|
166
|
+
return Promise.resolve(ABORTED);
|
|
167
|
+
return new Promise((resolve) => {
|
|
168
|
+
sig.addEventListener("abort", () => resolve(ABORTED), {
|
|
169
|
+
once: true,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
// `shellStream(script)` itself can hang if the host-guest
|
|
174
|
+
// agent socket is dead — the SDK is waiting on a
|
|
175
|
+
// start-of-stream ack that will never come. Without this
|
|
176
|
+
// race, the timeout below is *never armed* and the call
|
|
177
|
+
// blocks forever. We give the handshake the same budget as
|
|
178
|
+
// the exec itself; whichever fires first surfaces a
|
|
179
|
+
// structured timeout instead of an unbounded hang.
|
|
180
|
+
const handshakeP = timeoutMs > 0
|
|
181
|
+
? new Promise((resolve) => setTimeout(() => resolve(HANDSHAKE), timeoutMs))
|
|
182
|
+
: new Promise(() => { });
|
|
183
|
+
const startedExec = await Promise.race([
|
|
184
|
+
handle.shellStream(script),
|
|
185
|
+
handshakeP,
|
|
186
|
+
buildAbortP(),
|
|
187
|
+
]);
|
|
188
|
+
if (startedExec === HANDSHAKE) {
|
|
189
|
+
const durationMs = Date.now() - start;
|
|
190
|
+
this.lastExec = {
|
|
191
|
+
at: Date.now(),
|
|
192
|
+
ok: false,
|
|
193
|
+
durationMs,
|
|
194
|
+
exitCode: -1,
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
exitCode: -1,
|
|
198
|
+
stdout: "",
|
|
199
|
+
stderr: `[microsandbox] shellStream() did not return within ${timeoutMs}ms — ` +
|
|
200
|
+
`the host-guest agent socket may be wedged. Try \`reset_sandbox\`; ` +
|
|
201
|
+
`if it repeats across resets, the VM itself is stuck.`,
|
|
202
|
+
durationMs,
|
|
203
|
+
timedOut: true,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
if (startedExec === ABORTED) {
|
|
207
|
+
// Abort fired before shellStream even returned. Nothing to
|
|
208
|
+
// kill on the guest side; just surface the cancellation.
|
|
209
|
+
const durationMs = Date.now() - start;
|
|
210
|
+
this.lastExec = {
|
|
211
|
+
at: Date.now(),
|
|
212
|
+
ok: false,
|
|
213
|
+
durationMs,
|
|
214
|
+
exitCode: -1,
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
exitCode: -1,
|
|
218
|
+
stdout: "",
|
|
219
|
+
stderr: `[microsandbox] exec aborted by caller before shellStream returned.`,
|
|
220
|
+
durationMs,
|
|
221
|
+
timedOut: false,
|
|
222
|
+
aborted: true,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const exec = startedExec;
|
|
226
|
+
let timer = null;
|
|
227
|
+
const collectP = exec.collect();
|
|
228
|
+
const timeoutP = timeoutMs > 0
|
|
229
|
+
? new Promise((resolve) => {
|
|
230
|
+
timer = setTimeout(() => {
|
|
231
|
+
// Best-effort: SIGKILL the running process. If the
|
|
232
|
+
// channel itself is dead, kill() may also fail;
|
|
233
|
+
// we just want to break out of collect()'s wait so
|
|
234
|
+
// the caller sees a structured timeout instead of
|
|
235
|
+
// an unbounded hang.
|
|
236
|
+
exec.kill().catch(() => { });
|
|
237
|
+
resolve(TIMEOUT);
|
|
238
|
+
}, timeoutMs);
|
|
239
|
+
})
|
|
240
|
+
: new Promise(() => { });
|
|
241
|
+
// Abort race for the collect step: when the agent loop's
|
|
242
|
+
// signal fires, SIGKILL the guest process and surface a
|
|
243
|
+
// structured `aborted` result. Mirror of the timeout path
|
|
244
|
+
// but distinguishable to the caller (`aborted: true`,
|
|
245
|
+
// `timedOut: false`).
|
|
246
|
+
const collectAbortP = buildAbortP();
|
|
247
|
+
const winner = await Promise.race([collectP, timeoutP, collectAbortP]);
|
|
248
|
+
if (timer)
|
|
249
|
+
clearTimeout(timer);
|
|
250
|
+
if (winner === ABORTED) {
|
|
251
|
+
exec.kill().catch(() => { });
|
|
252
|
+
// Best-effort drain so the agent sees whatever stdout
|
|
253
|
+
// the killed command produced before it died.
|
|
254
|
+
let partial = { stdout: "", stderr: "" };
|
|
255
|
+
try {
|
|
256
|
+
const drained = await Promise.race([
|
|
257
|
+
collectP,
|
|
258
|
+
new Promise((r) => setTimeout(() => r(null), 1500)),
|
|
259
|
+
]);
|
|
260
|
+
if (drained) {
|
|
261
|
+
partial = { stdout: drained.stdout(), stderr: drained.stderr() };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
// best-effort
|
|
266
|
+
}
|
|
267
|
+
const durationMs = Date.now() - start;
|
|
268
|
+
this.lastExec = {
|
|
269
|
+
at: Date.now(),
|
|
270
|
+
ok: false,
|
|
271
|
+
durationMs,
|
|
272
|
+
exitCode: -1,
|
|
273
|
+
};
|
|
274
|
+
return {
|
|
275
|
+
exitCode: -1,
|
|
276
|
+
stdout: partial.stdout,
|
|
277
|
+
stderr: (partial.stderr ? partial.stderr + "\n" : "") +
|
|
278
|
+
`[microsandbox] exec aborted by caller; SIGKILL sent.`,
|
|
279
|
+
durationMs,
|
|
280
|
+
timedOut: false,
|
|
281
|
+
aborted: true,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (winner === TIMEOUT) {
|
|
285
|
+
// Try to drain whatever stdout/stderr the kill produced;
|
|
286
|
+
// collect() resolves shortly after kill on a healthy channel.
|
|
287
|
+
let partial = {
|
|
288
|
+
stdout: "",
|
|
289
|
+
stderr: "",
|
|
290
|
+
};
|
|
291
|
+
try {
|
|
292
|
+
const drained = await Promise.race([
|
|
293
|
+
collectP,
|
|
294
|
+
new Promise((r) => setTimeout(() => r(null), 1500)),
|
|
295
|
+
]);
|
|
296
|
+
if (drained) {
|
|
297
|
+
partial = { stdout: drained.stdout(), stderr: drained.stderr() };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
// best-effort drain
|
|
302
|
+
}
|
|
303
|
+
const durationMs = Date.now() - start;
|
|
304
|
+
this.lastExec = {
|
|
305
|
+
at: Date.now(),
|
|
306
|
+
ok: false,
|
|
307
|
+
durationMs,
|
|
308
|
+
exitCode: -1,
|
|
309
|
+
};
|
|
310
|
+
return {
|
|
311
|
+
exitCode: -1,
|
|
312
|
+
stdout: partial.stdout,
|
|
313
|
+
stderr: (partial.stderr ? partial.stderr + "\n" : "") +
|
|
314
|
+
`[microsandbox] exec timed out after ${timeoutMs}ms; sent SIGKILL. ` +
|
|
315
|
+
`If you need a longer budget, raise plugins.microsandbox.config.execTimeoutMs ` +
|
|
316
|
+
`(currently ${this.opts.config.execTimeoutMs}ms) or pass timeoutMs in the call. ` +
|
|
317
|
+
`For commands that should outlive the call (servers, supervisord), ` +
|
|
318
|
+
`start them with 'nohup setsid … > /tmp/log 2>&1 < /dev/null &'.`,
|
|
319
|
+
durationMs,
|
|
320
|
+
timedOut: true,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
const out = winner;
|
|
324
|
+
const durationMs = Date.now() - start;
|
|
325
|
+
const exitCode = out.code;
|
|
326
|
+
this.lastExec = {
|
|
327
|
+
at: Date.now(),
|
|
328
|
+
ok: exitCode === 0,
|
|
329
|
+
durationMs,
|
|
330
|
+
exitCode,
|
|
331
|
+
};
|
|
332
|
+
return {
|
|
333
|
+
exitCode,
|
|
334
|
+
stdout: out.stdout(),
|
|
335
|
+
stderr: out.stderr(),
|
|
336
|
+
durationMs,
|
|
337
|
+
timedOut: false,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
catch (err) {
|
|
341
|
+
const durationMs = Date.now() - start;
|
|
342
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
343
|
+
this.lastExec = { at: Date.now(), ok: false, durationMs, exitCode: -1 };
|
|
344
|
+
// "exec session ended without exit event" is the SDK's way
|
|
345
|
+
// of saying the host-guest channel died mid-stream. The
|
|
346
|
+
// sandbox itself may still be reachable (status=ready) but
|
|
347
|
+
// any further `exec` calls have a high chance of doing the
|
|
348
|
+
// same. Surface a recovery hint so the agent doesn't loop.
|
|
349
|
+
const looksLikeChannelLoss = message.includes("exec session ended") ||
|
|
350
|
+
message.includes("without exit event") ||
|
|
351
|
+
message.includes("connection closed") ||
|
|
352
|
+
message.includes("channel closed");
|
|
353
|
+
const advice = looksLikeChannelLoss
|
|
354
|
+
? "\n[microsandbox] the exec channel between host and guest agent died " +
|
|
355
|
+
"mid-stream. The VM itself may still be running, but new exec calls " +
|
|
356
|
+
"are likely to repeat the failure. Recovery: call `reset_sandbox`. " +
|
|
357
|
+
"Files under /workspace survive a reset."
|
|
358
|
+
: "";
|
|
359
|
+
return {
|
|
360
|
+
exitCode: -1,
|
|
361
|
+
stdout: "",
|
|
362
|
+
stderr: `microsandbox exec failed: ${message}${advice}`,
|
|
363
|
+
durationMs,
|
|
364
|
+
timedOut: false,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async readFile(relPath) {
|
|
369
|
+
return fs.readFile(this.resolveSafe(relPath), "utf8");
|
|
370
|
+
}
|
|
371
|
+
async writeFile(relPath, content) {
|
|
372
|
+
const abs = this.resolveSafe(relPath);
|
|
373
|
+
await fs.mkdir(path.dirname(abs), { recursive: true });
|
|
374
|
+
await fs.writeFile(abs, content, "utf8");
|
|
375
|
+
}
|
|
376
|
+
workspacePath() {
|
|
377
|
+
return this.opts.workspaceDir;
|
|
378
|
+
}
|
|
379
|
+
async reset() {
|
|
380
|
+
console.log("[microsandbox] reset() begin");
|
|
381
|
+
await this.shutdown();
|
|
382
|
+
console.log(`[microsandbox] reset() shutdown done state=${this.state}`);
|
|
383
|
+
this.state = "stopped";
|
|
384
|
+
this.startError = null;
|
|
385
|
+
this.handle = null;
|
|
386
|
+
this.startPromise = null;
|
|
387
|
+
this.lastExec = null;
|
|
388
|
+
this.activeSnapshot = null;
|
|
389
|
+
console.log("[microsandbox] reset() calling warmUp()");
|
|
390
|
+
this.warmUp();
|
|
391
|
+
console.log(`[microsandbox] reset() after warmUp state=${this.state} hasStartPromise=${!!this.startPromise}`);
|
|
392
|
+
}
|
|
393
|
+
async shutdown() {
|
|
394
|
+
if (this.handle) {
|
|
395
|
+
// SDK rename: stopAndWait → stop / stopWithTimeout. Try modern
|
|
396
|
+
// shape first, fall back to legacy. All wrapped in try/catch
|
|
397
|
+
// because shutdown is idempotent and best-effort.
|
|
398
|
+
try {
|
|
399
|
+
const h = this.handle;
|
|
400
|
+
if (typeof h.stopWithTimeout === "function") {
|
|
401
|
+
await h.stopWithTimeout(15_000);
|
|
402
|
+
}
|
|
403
|
+
else if (typeof h.stop === "function") {
|
|
404
|
+
await h.stop();
|
|
405
|
+
}
|
|
406
|
+
else if (typeof h.stopAndWait === "function") {
|
|
407
|
+
await h.stopAndWait();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
catch {
|
|
411
|
+
/* may have already exited */
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
414
|
+
const h = this.handle;
|
|
415
|
+
if (typeof h.removePersisted === "function") {
|
|
416
|
+
await h.removePersisted();
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
// Modern SDK uses static Sandbox.remove(name).
|
|
420
|
+
const msb = await import("microsandbox");
|
|
421
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
422
|
+
const SandboxAny = msb.Sandbox;
|
|
423
|
+
if (h.name && SandboxAny && typeof SandboxAny.remove === "function") {
|
|
424
|
+
await SandboxAny.remove(h.name);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
catch {
|
|
429
|
+
/* idempotent */
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
this.handle = null;
|
|
433
|
+
this.state = "stopped";
|
|
434
|
+
}
|
|
435
|
+
async status() {
|
|
436
|
+
const stateForClient = this.state === "stopped"
|
|
437
|
+
? "stopped"
|
|
438
|
+
: this.state === "starting"
|
|
439
|
+
? "starting"
|
|
440
|
+
: this.state === "error"
|
|
441
|
+
? "error"
|
|
442
|
+
: "ready";
|
|
443
|
+
return {
|
|
444
|
+
state: stateForClient,
|
|
445
|
+
uptimeMs: this.state === "ready" && this.startedAt > 0
|
|
446
|
+
? Date.now() - this.startedAt
|
|
447
|
+
: Date.now() - this.bornAt,
|
|
448
|
+
lastError: this.startError ?? undefined,
|
|
449
|
+
meta: {
|
|
450
|
+
runner: "microsandbox",
|
|
451
|
+
sandboxName: this.opts.config.sandboxName,
|
|
452
|
+
image: this.opts.config.image,
|
|
453
|
+
cpus: this.opts.config.cpus,
|
|
454
|
+
memoryMib: this.opts.config.memoryMib,
|
|
455
|
+
workspaceDir: this.opts.workspaceDir,
|
|
456
|
+
activeSnapshot: this.activeSnapshot ?? undefined,
|
|
457
|
+
lastExec: this.lastExec ?? undefined,
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
// ─── internals ──────────────────────────────────────────────────
|
|
462
|
+
/** Ensure the sandbox is running. Single-flight: concurrent exec
|
|
463
|
+
* calls during startup share the same in-flight promise. */
|
|
464
|
+
async ensureStarted() {
|
|
465
|
+
if (this.handle && this.state === "ready")
|
|
466
|
+
return this.handle;
|
|
467
|
+
if (this.startPromise) {
|
|
468
|
+
await this.startPromise;
|
|
469
|
+
if (this.state !== "ready" || !this.handle) {
|
|
470
|
+
throw new Error(this.startError ?? "sandbox failed to start");
|
|
471
|
+
}
|
|
472
|
+
return this.handle;
|
|
473
|
+
}
|
|
474
|
+
this.state = "starting";
|
|
475
|
+
this.startError = null;
|
|
476
|
+
this.startPromise = this.doStart().finally(() => {
|
|
477
|
+
this.startPromise = null;
|
|
478
|
+
});
|
|
479
|
+
await this.startPromise;
|
|
480
|
+
if (this.state !== "ready" || !this.handle) {
|
|
481
|
+
throw new Error(this.startError ?? "sandbox failed to start");
|
|
482
|
+
}
|
|
483
|
+
return this.handle;
|
|
484
|
+
}
|
|
485
|
+
async doStart() {
|
|
486
|
+
try {
|
|
487
|
+
const { Sandbox } = await loadMsb();
|
|
488
|
+
const ws = this.opts.workspaceDir;
|
|
489
|
+
await fs.mkdir(ws, { recursive: true });
|
|
490
|
+
// If the tenant has selected a custom build via
|
|
491
|
+
// use_sandbox_build, prefer that over the configured base
|
|
492
|
+
// image. Falls back to image(...) if no pointer or the
|
|
493
|
+
// snapshot was removed out-of-band.
|
|
494
|
+
const pointer = await readPointer(ws);
|
|
495
|
+
let useSnapshot = null;
|
|
496
|
+
if (pointer) {
|
|
497
|
+
const exists = await snapshotExists(pointer.snapshotName);
|
|
498
|
+
if (exists) {
|
|
499
|
+
useSnapshot = pointer.snapshotName;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
// Pick host ports for the browser stack BEFORE we hand the
|
|
503
|
+
// builder to napi. Doing this lazily later means another
|
|
504
|
+
// process could grab the port between snapshot boot and our
|
|
505
|
+
// .port() call.
|
|
506
|
+
const [cdpHost, mcpHost, vncHost] = await pickFreePorts(3);
|
|
507
|
+
// napi-rs builder methods are runtime-typed; we re-cast through
|
|
508
|
+
// a structural any-shape to keep the call sites readable.
|
|
509
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
510
|
+
let builder = Sandbox
|
|
511
|
+
.builder(this.opts.config.sandboxName)
|
|
512
|
+
.cpus(this.opts.config.cpus)
|
|
513
|
+
.memory(this.opts.config.memoryMib)
|
|
514
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
515
|
+
.volume("/workspace", (m) =>
|
|
516
|
+
// statVirtualization("off") makes the guest see the real
|
|
517
|
+
// host uid/gid on bind-mounted files, instead of the
|
|
518
|
+
// virtualized 0:0 view that microsandbox defaults to. This
|
|
519
|
+
// is what lets a non-root tenant user (created via
|
|
520
|
+
// `useradd -u <hostUid>` below) actually read and write
|
|
521
|
+
// its own workspace directory — chmod / chown on the
|
|
522
|
+
// virtualized view of a bind-mount has no effect on the
|
|
523
|
+
// underlying access check, which is performed against the
|
|
524
|
+
// host filesystem with the real host uid.
|
|
525
|
+
m.bind(ws).statVirtualization("off"))
|
|
526
|
+
// Forward host:cdp -> guest:9222 and friends. Always wired
|
|
527
|
+
// even when the active image doesn't include the browser
|
|
528
|
+
// stack; the forward is a no-op until something inside the
|
|
529
|
+
// guest binds the matching guest port.
|
|
530
|
+
.port(cdpHost, BROWSER_GUEST_CDP_PORT)
|
|
531
|
+
.port(mcpHost, BROWSER_GUEST_MCP_PORT)
|
|
532
|
+
.port(vncHost, BROWSER_GUEST_VNC_PORT)
|
|
533
|
+
.replace(true);
|
|
534
|
+
if (useSnapshot) {
|
|
535
|
+
builder = builder.fromSnapshot(useSnapshot);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
builder = builder.image(this.opts.config.image);
|
|
539
|
+
}
|
|
540
|
+
this.handle = (await builder.create());
|
|
541
|
+
this.activeSnapshot = useSnapshot;
|
|
542
|
+
this.state = "ready";
|
|
543
|
+
this.startedAt = Date.now();
|
|
544
|
+
// Surface the host ports through the sidecar so the host
|
|
545
|
+
// capability registry advertises browser.cdp with real
|
|
546
|
+
// values, and the admin Browser page renders them.
|
|
547
|
+
// __setDetectedPorts is the runner's back-channel into its
|
|
548
|
+
// own sidecar; the public BrowserSidecar surface stays
|
|
549
|
+
// read-only.
|
|
550
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
551
|
+
this.browser.__setDetectedPorts({
|
|
552
|
+
cdp: cdpHost,
|
|
553
|
+
mcp: mcpHost,
|
|
554
|
+
vnc: vncHost,
|
|
555
|
+
});
|
|
556
|
+
// If the snapshot includes the browser stack (its rootfs has
|
|
557
|
+
// the supervisord conf we ship in templates/browser.yaml),
|
|
558
|
+
// bring supervisord up. Otherwise it's a no-op silent.
|
|
559
|
+
// We don't await: supervisord forks into daemon mode in <1s
|
|
560
|
+
// and the sandbox is already "ready" once the VM exists.
|
|
561
|
+
void this.maybeStartBrowserStack();
|
|
562
|
+
}
|
|
563
|
+
catch (err) {
|
|
564
|
+
this.state = "error";
|
|
565
|
+
this.startError = err instanceof Error ? err.message : String(err);
|
|
566
|
+
this.handle = null;
|
|
567
|
+
throw err;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* If the active image ships /etc/supervisor/conf.d/browser.conf
|
|
572
|
+
* (browser-template-built sandboxes), start supervisord. Best
|
|
573
|
+
* effort: any failure logs and is forgotten so the shell sandbox
|
|
574
|
+
* stays usable on plain images. The runtime conf check + the
|
|
575
|
+
* existing rm of the chrome profile lock from a previous boot
|
|
576
|
+
* keep restarts idempotent.
|
|
577
|
+
*/
|
|
578
|
+
async maybeStartBrowserStack() {
|
|
579
|
+
if (!this.handle)
|
|
580
|
+
return;
|
|
581
|
+
try {
|
|
582
|
+
const probe = await this.handle.shell("test -f /etc/supervisor/conf.d/browser.conf && command -v supervisord >/dev/null && echo present || echo absent");
|
|
583
|
+
const stdout = probe.stdout().trim();
|
|
584
|
+
if (stdout !== "present")
|
|
585
|
+
return;
|
|
586
|
+
// Clean stale state from prior boots: socket from a dead
|
|
587
|
+
// supervisord, pid file, and the chrome profile lock the
|
|
588
|
+
// build VM may have left behind. Then daemonise.
|
|
589
|
+
await this.handle.shell("rm -f /var/run/supervisor.sock /var/run/supervisord.pid; rm -rf /tmp/chrome-profile; supervisord -c /etc/supervisor/conf.d/browser.conf");
|
|
590
|
+
}
|
|
591
|
+
catch {
|
|
592
|
+
// Don't surface to startError — the shell sandbox itself is
|
|
593
|
+
// fine, only the optional browser stack failed.
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
resolveSafe(relPath) {
|
|
597
|
+
if (path.isAbsolute(relPath)) {
|
|
598
|
+
throw new Error(`absolute paths not allowed: ${relPath}`);
|
|
599
|
+
}
|
|
600
|
+
const abs = path.resolve(this.opts.workspaceDir, relPath);
|
|
601
|
+
const rel = path.relative(this.opts.workspaceDir, abs);
|
|
602
|
+
if (rel.startsWith("..") || path.isAbsolute(rel)) {
|
|
603
|
+
throw new Error(`path escapes workspace: ${relPath}`);
|
|
604
|
+
}
|
|
605
|
+
return abs;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
function shellEscape(s) {
|
|
609
|
+
return s.replace(/(["\\$`])/g, "\\$1");
|
|
610
|
+
}
|
|
611
|
+
// Tenant user ids reach this code from `ctx.userId`, which the host
|
|
612
|
+
// derives from the auth resolver (today: hardcoded "dev"; future:
|
|
613
|
+
// JWT subject). We still validate here as a defence-in-depth check
|
|
614
|
+
// because the value ends up as part of a shell script (useradd /
|
|
615
|
+
// runuser arguments) inside the guest.
|
|
616
|
+
const TENANT_USER_ID_RE = /^[a-zA-Z][a-zA-Z0-9_-]{0,30}$/;
|
|
617
|
+
/**
|
|
618
|
+
* Build the bash script that
|
|
619
|
+
* 1. ensures a Linux user matching `userId` exists in the guest
|
|
620
|
+
* (idempotent useradd + sudoers grant)
|
|
621
|
+
* 2. drops to that user via `runuser` and runs `command` in `cwd`.
|
|
622
|
+
*
|
|
623
|
+
* Why host uid: microsandbox bind-mounts enforce permissions against
|
|
624
|
+
* the host's real uid even when the guest sees a virtualised owner.
|
|
625
|
+
* Combined with `.statVirtualization("off")` on the mount (set at
|
|
626
|
+
* sandbox boot) the guest now sees the real host uid, and creating
|
|
627
|
+
* the tenant user with that same uid is the only way a non-root
|
|
628
|
+
* guest process can actually access its own workspace files. All
|
|
629
|
+
* tenant users on this host therefore share one numeric uid, which
|
|
630
|
+
* is fine because the sandbox is per-tenant and per-user role names
|
|
631
|
+
* still come from `useradd -o ${name}`.
|
|
632
|
+
*/
|
|
633
|
+
function hostUid() {
|
|
634
|
+
const fn = process.getuid;
|
|
635
|
+
return typeof fn === "function" ? fn.call(process) : 1000;
|
|
636
|
+
}
|
|
637
|
+
function buildTenantUserBlock(userId, cwd, command) {
|
|
638
|
+
if (!TENANT_USER_ID_RE.test(userId)) {
|
|
639
|
+
throw new Error(`invalid tenant userId for sandbox exec: ${JSON.stringify(userId)}`);
|
|
640
|
+
}
|
|
641
|
+
const safeUserId = userId; // already regex-validated above
|
|
642
|
+
const home = `/workspace/users/${safeUserId}`;
|
|
643
|
+
const uid = hostUid();
|
|
644
|
+
// Shell-safe quoting of the user-supplied command: pass it as a
|
|
645
|
+
// single argv to `bash -c`, embedded as a single-quoted string so
|
|
646
|
+
// no inner expansion happens at the outer layer (the inner
|
|
647
|
+
// `bash -c` does its own parsing).
|
|
648
|
+
const innerCmd = command.replace(/'/g, `'\\''`);
|
|
649
|
+
return [
|
|
650
|
+
`set -e`,
|
|
651
|
+
// Idempotent user creation. `id <user>` short-circuits when the
|
|
652
|
+
// account exists. The `-o` flag allows reuse of an already-taken
|
|
653
|
+
// uid (necessary because we deliberately match the host uid),
|
|
654
|
+
// and the workspace bind-mount becomes the user's $HOME so a
|
|
655
|
+
// bare `cd ~` lands where the file tools see "/".
|
|
656
|
+
`if ! id ${safeUserId} >/dev/null 2>&1; then`,
|
|
657
|
+
` useradd -d "${home}" -s /bin/bash -u ${uid} -o ${safeUserId} >/dev/null 2>&1 || true`,
|
|
658
|
+
` echo '${safeUserId} ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/${safeUserId}`,
|
|
659
|
+
` chmod 440 /etc/sudoers.d/${safeUserId}`,
|
|
660
|
+
`fi`,
|
|
661
|
+
// Drop to the tenant user and run the command. `runuser`
|
|
662
|
+
// initialises HOME / USER / LOGNAME from /etc/passwd, and we
|
|
663
|
+
// additionally export MSB_USER_ID for scripts that want an
|
|
664
|
+
// unambiguous "injected by microsandbox" handle.
|
|
665
|
+
`runuser -u ${safeUserId} -- env MSB_USER_ID=${safeUserId} bash -c 'cd "${shellEscape(cwd)}" && ${innerCmd}'`,
|
|
666
|
+
].join("\n");
|
|
667
|
+
}
|
|
668
|
+
//# sourceMappingURL=microsandbox.js.map
|