@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,728 @@
|
|
|
1
|
+
// HTTP route handlers for the MicroSandbox admin page.
|
|
2
|
+
//
|
|
3
|
+
// These mirror the agent-tool surface (build_sandbox /
|
|
4
|
+
// list_sandbox_builds / use_sandbox_build / reset_sandbox) but for
|
|
5
|
+
// human use from the chat shell's `/admin` UI. We don't try to
|
|
6
|
+
// abstract a single "operations" layer between the two — the agent
|
|
7
|
+
// tools already encapsulate the workflow nicely, and the routes
|
|
8
|
+
// have to deal with HTTP-shaped concerns the tools don't (status
|
|
9
|
+
// codes, header-shaped errors). They share the underlying build
|
|
10
|
+
// helpers (sandboxfile parser, builder, metadata, pointer) instead.
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { buildSnapshot, BuildFailedError, snapshotExists, } from "../build/builder.js";
|
|
13
|
+
import { parseSandboxfile, SandboxfileError, } from "../build/sandboxfile.js";
|
|
14
|
+
import { listBuildMetadata, readBuildMetadata, writeBuildMetadata, } from "../build/metadata.js";
|
|
15
|
+
import { pointerPath, readPointers, writePointers, } from "../build/pointer.js";
|
|
16
|
+
import { readSandboxfile, writeSandboxfile, } from "./sandboxfile-io.js";
|
|
17
|
+
import { previewExec } from "./preview-exec.js";
|
|
18
|
+
function ctx(req) {
|
|
19
|
+
// The host's tenantMiddleware leaves `req.ctx = { tenant, userId }`.
|
|
20
|
+
// We don't reach for the full type here to avoid a server-side
|
|
21
|
+
// import in plugin code.
|
|
22
|
+
const c = req.ctx;
|
|
23
|
+
if (!c?.userId)
|
|
24
|
+
return null;
|
|
25
|
+
return { userId: c.userId };
|
|
26
|
+
}
|
|
27
|
+
function userHomeDir(deps, userId) {
|
|
28
|
+
// Same layout the agent tool helpers and runner use.
|
|
29
|
+
return path.join(deps.tenantHomeDir, "tenants", deps.tenantId, "workspace", "users", userId);
|
|
30
|
+
}
|
|
31
|
+
function pickBuildId() {
|
|
32
|
+
const d = new Date();
|
|
33
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
34
|
+
return (`${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-` +
|
|
35
|
+
`${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`);
|
|
36
|
+
}
|
|
37
|
+
// ─── routes ────────────────────────────────────────────────────
|
|
38
|
+
export function buildAdminRoutes(deps) {
|
|
39
|
+
// GET /sandboxfile → { content, exists, path }
|
|
40
|
+
const getSandboxfile = async (req, res) => {
|
|
41
|
+
const c = ctx(req);
|
|
42
|
+
if (!c) {
|
|
43
|
+
res.status(401).json({ error: "no_user" });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const home = userHomeDir(deps, c.userId);
|
|
47
|
+
try {
|
|
48
|
+
const r = await readSandboxfile(home);
|
|
49
|
+
res.json(r);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
res.status(500).json({
|
|
53
|
+
error: "read_failed",
|
|
54
|
+
message: err instanceof Error ? err.message : String(err),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
// PUT /sandboxfile body: { content }
|
|
59
|
+
const putSandboxfile = async (req, res) => {
|
|
60
|
+
const c = ctx(req);
|
|
61
|
+
if (!c) {
|
|
62
|
+
res.status(401).json({ error: "no_user" });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const body = req.body;
|
|
66
|
+
if (typeof body?.content !== "string") {
|
|
67
|
+
res.status(400).json({ error: "missing_content_string" });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Eager-parse as feedback so the user knows whether they just
|
|
71
|
+
// saved a Sandboxfile that won't build. We still write it — the
|
|
72
|
+
// user might be saving a draft — but surface the parse error
|
|
73
|
+
// alongside the success response.
|
|
74
|
+
let parseError = null;
|
|
75
|
+
try {
|
|
76
|
+
parseSandboxfile(body.content);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
parseError =
|
|
80
|
+
err instanceof SandboxfileError
|
|
81
|
+
? err.message
|
|
82
|
+
: err instanceof Error
|
|
83
|
+
? err.message
|
|
84
|
+
: String(err);
|
|
85
|
+
}
|
|
86
|
+
const home = userHomeDir(deps, c.userId);
|
|
87
|
+
try {
|
|
88
|
+
const r = await writeSandboxfile(home, body.content);
|
|
89
|
+
res.json({ ok: true, path: r.path, parseError });
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
res.status(500).json({
|
|
93
|
+
error: "write_failed",
|
|
94
|
+
message: err instanceof Error ? err.message : String(err),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
// GET /builds → each build is annotated with `roles: { browser, task }`
|
|
99
|
+
// booleans so the UI can render the per-role pills. The legacy
|
|
100
|
+
// `published` field stays on the wire (== browser-role pointer)
|
|
101
|
+
// for backwards compat with older clients reading via that name.
|
|
102
|
+
const getBuilds = async (req, res) => {
|
|
103
|
+
const c = ctx(req);
|
|
104
|
+
if (!c) {
|
|
105
|
+
res.status(401).json({ error: "no_user" });
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const home = userHomeDir(deps, c.userId);
|
|
109
|
+
try {
|
|
110
|
+
const builds = await listBuildMetadata(home);
|
|
111
|
+
const pointers = await readPointers(deps.workspaceDir);
|
|
112
|
+
const enriched = builds.map((b) => {
|
|
113
|
+
const browserActive = pointers.browser?.snapshotName === b.snapshotName;
|
|
114
|
+
const taskActive = pointers.task?.snapshotName === b.snapshotName;
|
|
115
|
+
return {
|
|
116
|
+
...b,
|
|
117
|
+
// Legacy field — older UIs / scripts read this.
|
|
118
|
+
published: browserActive,
|
|
119
|
+
roles: {
|
|
120
|
+
browser: browserActive,
|
|
121
|
+
task: taskActive,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
res.json({
|
|
126
|
+
builds: enriched,
|
|
127
|
+
// Legacy field; matches the browser pointer.
|
|
128
|
+
published: pointers.browser,
|
|
129
|
+
pointers,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
res.status(500).json({
|
|
134
|
+
error: "list_failed",
|
|
135
|
+
message: err instanceof Error ? err.message : String(err),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// POST /builds → kick off a build.
|
|
140
|
+
//
|
|
141
|
+
// Two response modes share the same endpoint so we don't have to
|
|
142
|
+
// mint a second route in the manifest:
|
|
143
|
+
//
|
|
144
|
+
// - default (no `stream` query): block until done, return one
|
|
145
|
+
// JSON envelope { ok, build }. Test-friendly and equivalent to
|
|
146
|
+
// the agent-tool path.
|
|
147
|
+
// - `?stream=1` (or any truthy `stream`): respond with NDJSON
|
|
148
|
+
// events as the build progresses, one JSON object per line:
|
|
149
|
+
// {"type":"start","buildId":"…"}
|
|
150
|
+
// {"type":"log","line":"[builder] apt-get install …"}
|
|
151
|
+
// …
|
|
152
|
+
// {"type":"done","build":{…}} # success
|
|
153
|
+
// {"type":"error","message":"…","stderr":"…"} # failure
|
|
154
|
+
// The HTTP status is always 200 in stream mode — callers
|
|
155
|
+
// decide success from the final event — because we've already
|
|
156
|
+
// sent the headers by the time the build outcome is known.
|
|
157
|
+
const postBuilds = async (req, res) => {
|
|
158
|
+
const c = ctx(req);
|
|
159
|
+
if (!c) {
|
|
160
|
+
res.status(401).json({ error: "no_user" });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (!deps.getRunner()) {
|
|
164
|
+
res.status(503).json({ error: "runner_not_ready" });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const home = userHomeDir(deps, c.userId);
|
|
168
|
+
let spec;
|
|
169
|
+
let sandboxfilePath;
|
|
170
|
+
try {
|
|
171
|
+
const sf = await readSandboxfile(home);
|
|
172
|
+
if (!sf.exists) {
|
|
173
|
+
res
|
|
174
|
+
.status(400)
|
|
175
|
+
.json({ error: "no_sandboxfile", message: "Save a Sandboxfile first." });
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
spec = parseSandboxfile(sf.content);
|
|
179
|
+
sandboxfilePath = sf.path;
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
const message = err instanceof SandboxfileError
|
|
183
|
+
? err.message
|
|
184
|
+
: err instanceof Error
|
|
185
|
+
? err.message
|
|
186
|
+
: String(err);
|
|
187
|
+
res.status(400).json({ error: "sandboxfile_invalid", message });
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const buildId = pickBuildId();
|
|
191
|
+
const stream = req.query.stream !== undefined &&
|
|
192
|
+
req.query.stream !== "" &&
|
|
193
|
+
req.query.stream !== "0" &&
|
|
194
|
+
req.query.stream !== "false";
|
|
195
|
+
// Optional: layer this build on top of an existing snapshot
|
|
196
|
+
// instead of pulling Sandboxfile's `image:` from the
|
|
197
|
+
// registry. Accepts the snapshot name, not the build id, so
|
|
198
|
+
// the UI sends e.g. `tianshu-default-build-20260619-abc123`.
|
|
199
|
+
const fromSnapshotParam = typeof req.query.from_snapshot === "string"
|
|
200
|
+
? req.query.from_snapshot.trim()
|
|
201
|
+
: typeof req.body?.from_snapshot ===
|
|
202
|
+
"string"
|
|
203
|
+
? (req.body.from_snapshot).trim()
|
|
204
|
+
: "";
|
|
205
|
+
const fromSnapshot = fromSnapshotParam || undefined;
|
|
206
|
+
if (stream) {
|
|
207
|
+
// NDJSON stream. Set headers up front so the browser starts
|
|
208
|
+
// rendering as soon as the first chunk lands; flush manually
|
|
209
|
+
// after each write because Express + Node's default chunked
|
|
210
|
+
// encoding will otherwise buffer until the stream closes.
|
|
211
|
+
res.status(200);
|
|
212
|
+
res.setHeader("Content-Type", "application/x-ndjson; charset=utf-8");
|
|
213
|
+
res.setHeader("Cache-Control", "no-cache, no-transform");
|
|
214
|
+
res.setHeader("X-Accel-Buffering", "no");
|
|
215
|
+
// Express's compression middleware (when present) buffers
|
|
216
|
+
// unless we mark the response as no-transform; we set the
|
|
217
|
+
// header above and also call flushHeaders so the client sees
|
|
218
|
+
// 200 immediately.
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
220
|
+
const r = res;
|
|
221
|
+
if (typeof r.flushHeaders === "function")
|
|
222
|
+
r.flushHeaders();
|
|
223
|
+
const send = (obj) => {
|
|
224
|
+
try {
|
|
225
|
+
res.write(`${JSON.stringify(obj)}\n`);
|
|
226
|
+
if (typeof r.flush === "function")
|
|
227
|
+
r.flush();
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
/* socket gone; let the build finish anyway */
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
send({
|
|
234
|
+
type: "start",
|
|
235
|
+
buildId,
|
|
236
|
+
image: spec.image,
|
|
237
|
+
...(fromSnapshot ? { fromSnapshot } : {}),
|
|
238
|
+
});
|
|
239
|
+
try {
|
|
240
|
+
const result = await buildSnapshot({
|
|
241
|
+
spec,
|
|
242
|
+
sandboxName: deps.sandboxName,
|
|
243
|
+
buildId,
|
|
244
|
+
tenantId: deps.tenantId,
|
|
245
|
+
workspaceDir: deps.workspaceDir,
|
|
246
|
+
onLog: (line) => send({ type: "log", line }),
|
|
247
|
+
fromSnapshot,
|
|
248
|
+
});
|
|
249
|
+
const meta = {
|
|
250
|
+
buildId,
|
|
251
|
+
snapshotName: result.snapshotName,
|
|
252
|
+
baseImage: result.baseImage,
|
|
253
|
+
builtAt: new Date().toISOString(),
|
|
254
|
+
durationMs: result.durationMs,
|
|
255
|
+
logTail: result.logTail,
|
|
256
|
+
sandboxfilePath,
|
|
257
|
+
...(fromSnapshot ? { basedOnSnapshot: fromSnapshot } : {}),
|
|
258
|
+
};
|
|
259
|
+
await writeBuildMetadata(home, meta);
|
|
260
|
+
send({ type: "done", build: meta });
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
if (err instanceof BuildFailedError) {
|
|
264
|
+
send({ type: "error", message: err.message, stderr: err.stderr });
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
send({
|
|
268
|
+
type: "error",
|
|
269
|
+
message: err instanceof Error ? err.message : String(err),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
finally {
|
|
274
|
+
res.end();
|
|
275
|
+
}
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
// Buffered mode — unchanged from the original implementation.
|
|
279
|
+
try {
|
|
280
|
+
const result = await buildSnapshot({
|
|
281
|
+
spec,
|
|
282
|
+
sandboxName: deps.sandboxName,
|
|
283
|
+
buildId,
|
|
284
|
+
tenantId: deps.tenantId,
|
|
285
|
+
workspaceDir: deps.workspaceDir,
|
|
286
|
+
fromSnapshot,
|
|
287
|
+
});
|
|
288
|
+
const meta = {
|
|
289
|
+
buildId,
|
|
290
|
+
snapshotName: result.snapshotName,
|
|
291
|
+
baseImage: result.baseImage,
|
|
292
|
+
builtAt: new Date().toISOString(),
|
|
293
|
+
durationMs: result.durationMs,
|
|
294
|
+
logTail: result.logTail,
|
|
295
|
+
sandboxfilePath,
|
|
296
|
+
...(fromSnapshot ? { basedOnSnapshot: fromSnapshot } : {}),
|
|
297
|
+
};
|
|
298
|
+
await writeBuildMetadata(home, meta);
|
|
299
|
+
res.json({ ok: true, build: meta });
|
|
300
|
+
}
|
|
301
|
+
catch (err) {
|
|
302
|
+
if (err instanceof BuildFailedError) {
|
|
303
|
+
res
|
|
304
|
+
.status(422)
|
|
305
|
+
.json({ error: "build_failed", message: err.message, stderr: err.stderr });
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
res.status(500).json({
|
|
309
|
+
error: "build_threw",
|
|
310
|
+
message: err instanceof Error ? err.message : String(err),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
// POST /builds/use?build_id=…[&reset=1] → mark a build as the
|
|
315
|
+
// one this tenant uses. With reset=1 we also tear down + restart
|
|
316
|
+
// the live VM so the new snapshot takes effect immediately;
|
|
317
|
+
// without it the pointer is updated but the live VM still runs
|
|
318
|
+
// the old image until the next manual reset (or process restart).
|
|
319
|
+
// We use a query string instead of a path param because v0's
|
|
320
|
+
// plugin route dispatcher does literal-path matching (no `:id`).
|
|
321
|
+
//
|
|
322
|
+
// Why "use" and not "publish": this is a tenant-internal switch,
|
|
323
|
+
// not an external publication. "Publish" implied broadcasting
|
|
324
|
+
// outside the tenant.
|
|
325
|
+
const postUseBuild = async (req, res) => {
|
|
326
|
+
const c = ctx(req);
|
|
327
|
+
if (!c) {
|
|
328
|
+
res.status(401).json({ error: "no_user" });
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const buildId = typeof req.query.build_id === "string" ? req.query.build_id : "";
|
|
332
|
+
if (!buildId) {
|
|
333
|
+
res.status(400).json({ error: "missing_build_id" });
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const wantReset = req.query.reset !== undefined &&
|
|
337
|
+
req.query.reset !== "" &&
|
|
338
|
+
req.query.reset !== "0" &&
|
|
339
|
+
req.query.reset !== "false";
|
|
340
|
+
// Which role pointer(s) to update. Defaults to `both` to
|
|
341
|
+
// preserve pre-split behaviour where one snapshot served both
|
|
342
|
+
// the long-lived browser sandbox and (future) per-task pool.
|
|
343
|
+
const roleParam = typeof req.query.role === "string" ? req.query.role : "both";
|
|
344
|
+
const targetRoles = roleParam === "browser"
|
|
345
|
+
? ["browser"]
|
|
346
|
+
: roleParam === "task"
|
|
347
|
+
? ["task"]
|
|
348
|
+
: roleParam === "both"
|
|
349
|
+
? ["browser", "task"]
|
|
350
|
+
: [];
|
|
351
|
+
if (targetRoles.length === 0) {
|
|
352
|
+
res.status(400).json({
|
|
353
|
+
error: "invalid_role",
|
|
354
|
+
message: `role must be one of: browser, task, both (got ${JSON.stringify(roleParam)})`,
|
|
355
|
+
});
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const home = userHomeDir(deps, c.userId);
|
|
359
|
+
let meta;
|
|
360
|
+
try {
|
|
361
|
+
meta = await readBuildMetadata(home, buildId);
|
|
362
|
+
}
|
|
363
|
+
catch (err) {
|
|
364
|
+
res.status(500).json({
|
|
365
|
+
error: "read_metadata_failed",
|
|
366
|
+
message: err instanceof Error ? err.message : String(err),
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (!meta) {
|
|
371
|
+
res.status(404).json({ error: "build_not_found", buildId });
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
const exists = await snapshotExists(meta.snapshotName);
|
|
376
|
+
if (!exists) {
|
|
377
|
+
res.status(410).json({
|
|
378
|
+
error: "snapshot_missing",
|
|
379
|
+
message: `snapshot "${meta.snapshotName}" no longer exists; rebuild first`,
|
|
380
|
+
});
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const pointer = {
|
|
384
|
+
snapshotName: meta.snapshotName,
|
|
385
|
+
baseImage: meta.baseImage,
|
|
386
|
+
publishedAt: new Date().toISOString(),
|
|
387
|
+
publishedBy: c.userId,
|
|
388
|
+
};
|
|
389
|
+
// Read current state then patch only the selected roles, so
|
|
390
|
+
// toggling "task" doesn't accidentally clobber "browser" (and
|
|
391
|
+
// vice-versa).
|
|
392
|
+
const currentPointers = await readPointers(deps.workspaceDir);
|
|
393
|
+
const nextPointers = { ...currentPointers };
|
|
394
|
+
for (const role of targetRoles) {
|
|
395
|
+
nextPointers[role] = pointer;
|
|
396
|
+
}
|
|
397
|
+
await writePointers(deps.workspaceDir, nextPointers);
|
|
398
|
+
// Optional reset: bring the live VM down and back up so it
|
|
399
|
+
// boots fromSnapshot(<just-selected>). Without this the
|
|
400
|
+
// pointer is durable but the running VM stays on the old
|
|
401
|
+
// image until something else triggers a restart.
|
|
402
|
+
let resetResult = "skipped";
|
|
403
|
+
if (wantReset) {
|
|
404
|
+
const runner = deps.getRunner();
|
|
405
|
+
if (!runner) {
|
|
406
|
+
resetResult = { failed: "runner_not_ready" };
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
try {
|
|
410
|
+
await runner.reset();
|
|
411
|
+
resetResult = "ok";
|
|
412
|
+
}
|
|
413
|
+
catch (err) {
|
|
414
|
+
resetResult = {
|
|
415
|
+
failed: err instanceof Error ? err.message : String(err),
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
res.json({
|
|
421
|
+
ok: true,
|
|
422
|
+
pointer,
|
|
423
|
+
pointers: nextPointers,
|
|
424
|
+
roles: targetRoles,
|
|
425
|
+
pointerPath: pointerPath(deps.workspaceDir),
|
|
426
|
+
reset: resetResult,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
res.status(500).json({
|
|
431
|
+
error: "use_build_failed",
|
|
432
|
+
message: err instanceof Error ? err.message : String(err),
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
// POST /reset → forces the running runner to reset (restart from
|
|
437
|
+
// the in-use build pointer or the configured default image). Mirrors
|
|
438
|
+
// the agent's `reset_sandbox` tool.
|
|
439
|
+
const postReset = async (_req, res) => {
|
|
440
|
+
const runner = deps.getRunner();
|
|
441
|
+
if (!runner) {
|
|
442
|
+
res.status(503).json({ error: "runner_not_ready" });
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
try {
|
|
446
|
+
await runner.reset();
|
|
447
|
+
const status = await runner.status();
|
|
448
|
+
res.json({ ok: true, status });
|
|
449
|
+
}
|
|
450
|
+
catch (err) {
|
|
451
|
+
res.status(500).json({
|
|
452
|
+
error: "reset_failed",
|
|
453
|
+
message: err instanceof Error ? err.message : String(err),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
// POST /exec body: { command, workdir?, timeoutMs?, build_id? }
|
|
458
|
+
// Run a one-shot command. Two execution modes share the same
|
|
459
|
+
// endpoint:
|
|
460
|
+
//
|
|
461
|
+
// - `build_id` omitted (default): run inside the tenant's live
|
|
462
|
+
// sandbox VM. Cheap, immediate, but reflects whatever is
|
|
463
|
+
// currently in use.
|
|
464
|
+
// - `build_id` set: spin up a short-lived preview VM
|
|
465
|
+
// `fromSnapshot(<that build's snapshot>)`, run the command,
|
|
466
|
+
// tear it down. Lets the user sanity-check a build before
|
|
467
|
+
// switching the tenant to it.
|
|
468
|
+
//
|
|
469
|
+
// We cap the per-call timeout at 5 minutes; the live runner
|
|
470
|
+
// honors that natively, and previews ignore it (no SDK timeout
|
|
471
|
+
// hook in v0.4.x) but cap the boot+run+teardown sequence with
|
|
472
|
+
// their own internal handling.
|
|
473
|
+
const ADMIN_EXEC_DEFAULT_TIMEOUT_MS = 60_000;
|
|
474
|
+
const ADMIN_EXEC_MAX_TIMEOUT_MS = 5 * 60_000;
|
|
475
|
+
const ADMIN_EXEC_OUTPUT_BYTE_CAP = 256 * 1024;
|
|
476
|
+
const postExec = async (req, res) => {
|
|
477
|
+
const c = ctx(req);
|
|
478
|
+
if (!c) {
|
|
479
|
+
res.status(401).json({ error: "no_user" });
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const body = req.body;
|
|
483
|
+
const command = typeof body?.command === "string" ? body.command : "";
|
|
484
|
+
if (!command.trim()) {
|
|
485
|
+
res.status(400).json({ error: "missing_command" });
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const workdir = typeof body?.workdir === "string" && body.workdir.length > 0
|
|
489
|
+
? body.workdir
|
|
490
|
+
: undefined;
|
|
491
|
+
let timeoutMs = ADMIN_EXEC_DEFAULT_TIMEOUT_MS;
|
|
492
|
+
if (typeof body?.timeoutMs === "number" && Number.isFinite(body.timeoutMs)) {
|
|
493
|
+
timeoutMs = Math.max(1, Math.floor(body.timeoutMs));
|
|
494
|
+
}
|
|
495
|
+
if (timeoutMs > ADMIN_EXEC_MAX_TIMEOUT_MS) {
|
|
496
|
+
timeoutMs = ADMIN_EXEC_MAX_TIMEOUT_MS;
|
|
497
|
+
}
|
|
498
|
+
const buildId = typeof body?.build_id === "string" && body.build_id.length > 0
|
|
499
|
+
? body.build_id
|
|
500
|
+
: null;
|
|
501
|
+
const half = Math.floor(ADMIN_EXEC_OUTPUT_BYTE_CAP / 2);
|
|
502
|
+
if (buildId) {
|
|
503
|
+
// Preview mode: boot a short-lived VM from the build's
|
|
504
|
+
// snapshot. The live VM is untouched.
|
|
505
|
+
const home = userHomeDir(deps, c.userId);
|
|
506
|
+
let meta;
|
|
507
|
+
try {
|
|
508
|
+
meta = await readBuildMetadata(home, buildId);
|
|
509
|
+
}
|
|
510
|
+
catch (err) {
|
|
511
|
+
res.status(500).json({
|
|
512
|
+
error: "read_metadata_failed",
|
|
513
|
+
message: err instanceof Error ? err.message : String(err),
|
|
514
|
+
});
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
if (!meta) {
|
|
518
|
+
res.status(404).json({ error: "build_not_found", buildId });
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
try {
|
|
522
|
+
const exists = await snapshotExists(meta.snapshotName);
|
|
523
|
+
if (!exists) {
|
|
524
|
+
res.status(410).json({
|
|
525
|
+
error: "snapshot_missing",
|
|
526
|
+
message: `snapshot "${meta.snapshotName}" no longer exists; rebuild first`,
|
|
527
|
+
});
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
const r = await previewExec({
|
|
531
|
+
snapshotName: meta.snapshotName,
|
|
532
|
+
command,
|
|
533
|
+
workdir,
|
|
534
|
+
workspaceDir: deps.workspaceDir,
|
|
535
|
+
sandboxNamePrefix: deps.sandboxName,
|
|
536
|
+
timeoutMs,
|
|
537
|
+
});
|
|
538
|
+
res.json({
|
|
539
|
+
ok: r.exitCode === 0 && !r.timedOut,
|
|
540
|
+
exitCode: r.exitCode,
|
|
541
|
+
stdout: capUtf8(r.stdout, half),
|
|
542
|
+
stderr: capUtf8(r.stderr, half),
|
|
543
|
+
durationMs: r.durationMs,
|
|
544
|
+
timedOut: r.timedOut,
|
|
545
|
+
target: { kind: "build", buildId, snapshotName: meta.snapshotName },
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
res.status(500).json({
|
|
550
|
+
error: "preview_exec_failed",
|
|
551
|
+
message: err instanceof Error ? err.message : String(err),
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
// Live mode (default).
|
|
557
|
+
const runner = deps.getRunner();
|
|
558
|
+
if (!runner) {
|
|
559
|
+
res.status(503).json({ error: "runner_not_ready" });
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
try {
|
|
563
|
+
const r = await runner.exec({ command, workdir, timeoutMs });
|
|
564
|
+
// Cap stdout/stderr so a runaway command can't pin the
|
|
565
|
+
// browser. Each capped to ~128 KB; agent has its own caps
|
|
566
|
+
// upstream of this for tool calls.
|
|
567
|
+
res.json({
|
|
568
|
+
ok: r.exitCode === 0 && !r.timedOut,
|
|
569
|
+
exitCode: r.exitCode,
|
|
570
|
+
stdout: capUtf8(r.stdout, half),
|
|
571
|
+
stderr: capUtf8(r.stderr, half),
|
|
572
|
+
durationMs: r.durationMs,
|
|
573
|
+
timedOut: r.timedOut,
|
|
574
|
+
target: { kind: "live" },
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
catch (err) {
|
|
578
|
+
res.status(500).json({
|
|
579
|
+
error: "exec_failed",
|
|
580
|
+
message: err instanceof Error ? err.message : String(err),
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
// GET /task-pool — list every per-task microVM tracked by the
|
|
585
|
+
// pool plus any orphan tianshu-task-* VMs still on disk. Useful
|
|
586
|
+
// when an operator wants to see what sandboxes are around
|
|
587
|
+
// (running, stopped, or zombie from a prior process incarnation).
|
|
588
|
+
const getTaskPool = async (req, res) => {
|
|
589
|
+
const c = ctx(req);
|
|
590
|
+
if (!c) {
|
|
591
|
+
res.status(401).json({ error: "no_user" });
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const pool = deps.getPool?.();
|
|
595
|
+
const inMemory = pool ? pool.list() : [];
|
|
596
|
+
const inMemoryByName = new Map(inMemory.map((e) => [e.sandboxName, e]));
|
|
597
|
+
const merged = [];
|
|
598
|
+
const taskPrefix = `tianshu-task-${deps.tenantId}-`;
|
|
599
|
+
try {
|
|
600
|
+
const sdkMod = await import("microsandbox").catch(() => null);
|
|
601
|
+
const Sandbox = sdkMod?.Sandbox;
|
|
602
|
+
if (Sandbox?.list) {
|
|
603
|
+
const handles = (await Sandbox.list());
|
|
604
|
+
for (const h of handles) {
|
|
605
|
+
if (!h.name.startsWith(taskPrefix))
|
|
606
|
+
continue;
|
|
607
|
+
const taskId = h.name.slice(taskPrefix.length);
|
|
608
|
+
const inMem = inMemoryByName.get(h.name);
|
|
609
|
+
merged.push({
|
|
610
|
+
taskId,
|
|
611
|
+
sandboxName: h.name,
|
|
612
|
+
poolState: inMem ? inMem.state : "orphan",
|
|
613
|
+
sdkStatus: typeof h.status === "string" ? h.status : null,
|
|
614
|
+
createdAt: h.createdAt instanceof Date
|
|
615
|
+
? h.createdAt.toISOString()
|
|
616
|
+
: typeof h.createdAt === "string"
|
|
617
|
+
? h.createdAt
|
|
618
|
+
: null,
|
|
619
|
+
startError: inMem?.startError ?? null,
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
catch (err) {
|
|
625
|
+
// SDK unavailable (probe failed or not installed) — fall
|
|
626
|
+
// back to whatever we have in memory.
|
|
627
|
+
}
|
|
628
|
+
// Also fold in pool entries that the SDK didn't return (rare;
|
|
629
|
+
// can happen when the VM was created out-of-band and the SDK
|
|
630
|
+
// index is stale). Avoids hiding state from the operator.
|
|
631
|
+
for (const inMem of inMemory) {
|
|
632
|
+
if (merged.some((e) => e.sandboxName === inMem.sandboxName))
|
|
633
|
+
continue;
|
|
634
|
+
merged.push({
|
|
635
|
+
taskId: inMem.taskId,
|
|
636
|
+
sandboxName: inMem.sandboxName,
|
|
637
|
+
poolState: inMem.state,
|
|
638
|
+
sdkStatus: null,
|
|
639
|
+
createdAt: null,
|
|
640
|
+
startError: inMem.startError,
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
// Sort newest-first by createdAt (nulls last).
|
|
644
|
+
merged.sort((a, b) => {
|
|
645
|
+
if (a.createdAt && b.createdAt) {
|
|
646
|
+
return a.createdAt < b.createdAt ? 1 : -1;
|
|
647
|
+
}
|
|
648
|
+
if (a.createdAt)
|
|
649
|
+
return -1;
|
|
650
|
+
if (b.createdAt)
|
|
651
|
+
return 1;
|
|
652
|
+
return a.sandboxName.localeCompare(b.sandboxName);
|
|
653
|
+
});
|
|
654
|
+
res.json({ entries: merged });
|
|
655
|
+
};
|
|
656
|
+
// POST /task-pool/destroy?sandbox_name=<name> — stop + remove
|
|
657
|
+
// a per-task microVM. Used by the admin UI's "Forget" button on
|
|
658
|
+
// orphan / stopped task sandboxes.
|
|
659
|
+
const postTaskPoolDestroy = async (req, res) => {
|
|
660
|
+
const c = ctx(req);
|
|
661
|
+
if (!c) {
|
|
662
|
+
res.status(401).json({ error: "no_user" });
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const sandboxName = typeof req.query.sandbox_name === "string"
|
|
666
|
+
? req.query.sandbox_name
|
|
667
|
+
: "";
|
|
668
|
+
if (!sandboxName) {
|
|
669
|
+
res.status(400).json({ error: "missing_sandbox_name" });
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
const taskPrefix = `tianshu-task-${deps.tenantId}-`;
|
|
673
|
+
if (!sandboxName.startsWith(taskPrefix)) {
|
|
674
|
+
res.status(400).json({
|
|
675
|
+
error: "unsupported_sandbox",
|
|
676
|
+
message: `only ${taskPrefix}* sandboxes can be destroyed via this route`,
|
|
677
|
+
});
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
const taskId = sandboxName.slice(taskPrefix.length);
|
|
681
|
+
const pool = deps.getPool?.();
|
|
682
|
+
try {
|
|
683
|
+
if (pool) {
|
|
684
|
+
// The pool path stops + removes; if the entry isn't in
|
|
685
|
+
// memory it falls through to a direct Sandbox.remove.
|
|
686
|
+
await pool.destroyTask(taskId);
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
// Pool not active — best-effort SDK remove so an orphan
|
|
690
|
+
// VM can still be reclaimed.
|
|
691
|
+
const sdkMod = await import("microsandbox").catch(() => null);
|
|
692
|
+
const Sandbox = sdkMod?.Sandbox;
|
|
693
|
+
if (Sandbox?.get) {
|
|
694
|
+
const handle = await Sandbox.get(sandboxName);
|
|
695
|
+
await handle.remove();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
res.json({ ok: true, sandboxName });
|
|
699
|
+
}
|
|
700
|
+
catch (err) {
|
|
701
|
+
res.status(500).json({
|
|
702
|
+
error: "destroy_failed",
|
|
703
|
+
message: err instanceof Error ? err.message : String(err),
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
return {
|
|
708
|
+
getSandboxfile,
|
|
709
|
+
putSandboxfile,
|
|
710
|
+
getBuilds,
|
|
711
|
+
postBuilds,
|
|
712
|
+
postUseBuild,
|
|
713
|
+
postReset,
|
|
714
|
+
postExec,
|
|
715
|
+
getTaskPool,
|
|
716
|
+
postTaskPoolDestroy,
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
/** Truncate from the head so the most recent output stays visible.
|
|
720
|
+
* Adds a marker line when truncation occurs. */
|
|
721
|
+
function capUtf8(s, maxBytes) {
|
|
722
|
+
const buf = Buffer.from(s, "utf8");
|
|
723
|
+
if (buf.byteLength <= maxBytes)
|
|
724
|
+
return s;
|
|
725
|
+
const sliced = buf.subarray(buf.byteLength - maxBytes).toString("utf8");
|
|
726
|
+
return `[… ${buf.byteLength - maxBytes} bytes truncated …]\n${sliced}`;
|
|
727
|
+
}
|
|
728
|
+
//# sourceMappingURL=routes.js.map
|