@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
|
+
// HTTP route handlers for the workboard admin + chat-shell panel.
|
|
2
|
+
//
|
|
3
|
+
// Routes are mounted at `/api/p/workboard/*` by the host (see
|
|
4
|
+
// manifest.contributes.apiRoutes). Every handler reads the calling
|
|
5
|
+
// user's id from `req.ctx.userId` (set by the host's auth middleware)
|
|
6
|
+
// and scopes reads/writes to that user — workboard rows are
|
|
7
|
+
// per-owner inside a tenant (ADR-0002 §6 owner_user_id).
|
|
8
|
+
//
|
|
9
|
+
// We deliberately keep the JSON shape close to the underlying Task
|
|
10
|
+
// type, so the React panel can decode by hand without a generated
|
|
11
|
+
// client. Error envelopes are { error: "<code>" } for parity with
|
|
12
|
+
// the rest of the open-source repo's plugin routes.
|
|
13
|
+
import { randomUUID } from "node:crypto";
|
|
14
|
+
import { createTask, deleteTask, getTask, listProjects, listTasks, updateTask, isTaskStatus, } from "../db/tasks.js";
|
|
15
|
+
import { readSessionHistory } from "../db/session-history.js";
|
|
16
|
+
/**
|
|
17
|
+
* Validate that a task's worker assignment can actually be picked
|
|
18
|
+
* up by some live worker, before we let it land in the DB.
|
|
19
|
+
*
|
|
20
|
+
* Without this check a task could be created against an agent the
|
|
21
|
+
* user disabled (or that never existed), or with a worker_role no
|
|
22
|
+
* enabled agent matches — the pool would silently never claim
|
|
23
|
+
* it. The user sees a forever-`ready` card with no explanation.
|
|
24
|
+
*
|
|
25
|
+
* Returns null when the assignment is fine (or absent), and an
|
|
26
|
+
* `{ code, message }` envelope when it isn't. Caller maps that
|
|
27
|
+
* to a 400 + JSON.
|
|
28
|
+
*
|
|
29
|
+
* Rules:
|
|
30
|
+
* - workerAgentId set: must exist for this tenant AND be enabled.
|
|
31
|
+
* If both are set, workerRole is ignored (the pool uses agent
|
|
32
|
+
* pinning when present), so we don't enforce role-match here.
|
|
33
|
+
* - workerRole set, workerAgentId absent: at least one enabled
|
|
34
|
+
* agent in this tenant must have `kind === workerRole`.
|
|
35
|
+
* - both absent: any enabled agent (regardless of role) can pick
|
|
36
|
+
* the task up. The pool only fails closed if there are zero
|
|
37
|
+
* enabled agents at all — we surface that case as a warning,
|
|
38
|
+
* not an error, since the user can fix it later by enabling
|
|
39
|
+
* a worker.
|
|
40
|
+
*/
|
|
41
|
+
export function validateAssignableWorker(agents, args) {
|
|
42
|
+
const { workerAgentId, workerRole } = args;
|
|
43
|
+
if (workerAgentId) {
|
|
44
|
+
const target = agents.find((a) => a.id === workerAgentId);
|
|
45
|
+
if (!target) {
|
|
46
|
+
return {
|
|
47
|
+
code: "agent_not_found",
|
|
48
|
+
message: `Worker agent ${workerAgentId} doesn't exist in this tenant.`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (!target.enabled) {
|
|
52
|
+
return {
|
|
53
|
+
code: "agent_disabled",
|
|
54
|
+
message: `Worker agent "${target.name}" is disabled. Enable it under Settings → Plugins → Worker agents, or pick another agent.`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (workerRole) {
|
|
60
|
+
const candidates = agents.filter((a) => a.enabled && a.kind === workerRole);
|
|
61
|
+
if (candidates.length === 0) {
|
|
62
|
+
return {
|
|
63
|
+
code: "no_enabled_worker_for_role",
|
|
64
|
+
message: `No enabled worker has kind="${workerRole}". Either enable an existing worker of that kind or pick a different role.`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Maximum number of tasks accepted in a single batch create / delete
|
|
73
|
+
* request. Picked to be generous for human-driven UI cases ("select
|
|
74
|
+
* 30 cards, delete") while still bounding the worst case for the
|
|
75
|
+
* single-statement assignable-worker validation pass.
|
|
76
|
+
*/
|
|
77
|
+
const BATCH_LIMIT = 100;
|
|
78
|
+
export const ALL_WORKER_KIND_FIELDS = [
|
|
79
|
+
"description",
|
|
80
|
+
"modelId",
|
|
81
|
+
"systemPrompt",
|
|
82
|
+
"toolsAllow",
|
|
83
|
+
"skills",
|
|
84
|
+
];
|
|
85
|
+
/** Internal alias kept for the in-file references that predate
|
|
86
|
+
* the `ALL_WORKER_KIND_FIELDS` export. */
|
|
87
|
+
const ALL_FIELDS = ALL_WORKER_KIND_FIELDS;
|
|
88
|
+
export function allowedFieldsFor(kind, defs) {
|
|
89
|
+
const def = defs.find((k) => k.id === kind);
|
|
90
|
+
return new Set(def?.fields ?? ALL_WORKER_KIND_FIELDS);
|
|
91
|
+
}
|
|
92
|
+
function userIdFromReq(req) {
|
|
93
|
+
const ctx = req.ctx;
|
|
94
|
+
return ctx?.userId ?? null;
|
|
95
|
+
}
|
|
96
|
+
/** Coerce Express's `req.params[name]` (typed `string | string[]` in
|
|
97
|
+
* v5) to a plain string. We never declare array-shape route params,
|
|
98
|
+
* so the array branch is impossible at runtime.
|
|
99
|
+
*/
|
|
100
|
+
function stringParam(req, name) {
|
|
101
|
+
const raw = req.params[name];
|
|
102
|
+
if (typeof raw === "string")
|
|
103
|
+
return raw;
|
|
104
|
+
if (Array.isArray(raw) && raw.length > 0)
|
|
105
|
+
return String(raw[0]);
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
function taskJson(t, tenantId) {
|
|
109
|
+
return {
|
|
110
|
+
id: t.id,
|
|
111
|
+
title: t.title,
|
|
112
|
+
description: t.description,
|
|
113
|
+
project: t.projectSlug,
|
|
114
|
+
workerRole: t.workerRole,
|
|
115
|
+
workerAgentId: t.workerAgentId,
|
|
116
|
+
status: t.status,
|
|
117
|
+
priority: t.priority,
|
|
118
|
+
resultSummary: t.resultSummary,
|
|
119
|
+
resultFiles: t.resultFiles,
|
|
120
|
+
sessionId: t.sessionId,
|
|
121
|
+
dependsOn: t.dependsOn,
|
|
122
|
+
labels: t.labels,
|
|
123
|
+
failureReason: t.failureReason,
|
|
124
|
+
attempts: t.attempts,
|
|
125
|
+
createdAt: t.createdAt,
|
|
126
|
+
startedAt: t.startedAt,
|
|
127
|
+
endedAt: t.endedAt,
|
|
128
|
+
// 008+ intervention markers — the UI uses these to render
|
|
129
|
+
// the awaiting-intervention chip + relative timestamp.
|
|
130
|
+
interventionReason: t.interventionReason,
|
|
131
|
+
interventionAt: t.interventionAt,
|
|
132
|
+
timeoutMs: t.timeoutMs,
|
|
133
|
+
// Sandbox name in microsandbox's lifecycle: the per-task pool
|
|
134
|
+
// names the VM `tianshu-task-<tenantId>-<taskId>`. Surfaced
|
|
135
|
+
// here so the UI's task detail dialog can show it for
|
|
136
|
+
// tracing during a run, after a release (stopped) or after a
|
|
137
|
+
// delete (gone). When microsandbox isn't loaded for this
|
|
138
|
+
// tenant the name is informational only — nothing is using
|
|
139
|
+
// it.
|
|
140
|
+
sandboxName: `tianshu-task-${tenantId}-${t.id}`,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** Reduce caller-supplied dependsOn to ids that actually belong to
|
|
144
|
+
* the same owner. Silently drops the rest — simpler than rejecting
|
|
145
|
+
* the whole request just because one id is bogus. */
|
|
146
|
+
function filterOwnedDeps(db, ownerUserId, raw) {
|
|
147
|
+
if (raw === undefined)
|
|
148
|
+
return undefined;
|
|
149
|
+
if (!Array.isArray(raw))
|
|
150
|
+
return [];
|
|
151
|
+
const ids = raw.filter((x) => typeof x === "string" && x.length > 0);
|
|
152
|
+
if (ids.length === 0)
|
|
153
|
+
return [];
|
|
154
|
+
const placeholders = ids.map(() => "?").join(",");
|
|
155
|
+
const rows = db
|
|
156
|
+
.prepare(`SELECT id FROM tasks WHERE owner_user_id = ? AND id IN (${placeholders})`)
|
|
157
|
+
.all(ownerUserId, ...ids);
|
|
158
|
+
return rows.map((r) => r.id);
|
|
159
|
+
}
|
|
160
|
+
/** Compile-time-only marker so we can reuse the deps.db type without
|
|
161
|
+
* importing the SDK type into a free function above. */
|
|
162
|
+
const deps_unused_marker = null;
|
|
163
|
+
function projectsJson(rows) {
|
|
164
|
+
return rows.map((p) => ({
|
|
165
|
+
project: p.projectSlug,
|
|
166
|
+
ready: p.ready,
|
|
167
|
+
inProgress: p.inProgress,
|
|
168
|
+
done: p.done,
|
|
169
|
+
total: p.total,
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
export function buildRoutes(deps) {
|
|
173
|
+
const listTasksHandler = (req, res) => {
|
|
174
|
+
const userId = userIdFromReq(req);
|
|
175
|
+
if (!userId) {
|
|
176
|
+
res.status(401).json({ error: "no_user" });
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const project = typeof req.query.project === "string" ? req.query.project : undefined;
|
|
180
|
+
const includeAborted = req.query.include_aborted === "1";
|
|
181
|
+
const statusParam = typeof req.query.status === "string" ? req.query.status : undefined;
|
|
182
|
+
let statuses;
|
|
183
|
+
if (statusParam) {
|
|
184
|
+
statuses = [];
|
|
185
|
+
for (const s of statusParam.split(",")) {
|
|
186
|
+
const trimmed = s.trim();
|
|
187
|
+
if (!trimmed)
|
|
188
|
+
continue;
|
|
189
|
+
if (!isTaskStatus(trimmed)) {
|
|
190
|
+
res.status(400).json({ error: "bad_status", status: trimmed });
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
statuses.push(trimmed);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (includeAborted) {
|
|
197
|
+
statuses = ["ready", "in_progress", "done"];
|
|
198
|
+
}
|
|
199
|
+
const rows = listTasks(deps.db, {
|
|
200
|
+
ownerUserId: userId,
|
|
201
|
+
projectSlug: project ?? null,
|
|
202
|
+
statuses,
|
|
203
|
+
});
|
|
204
|
+
res.json({ tasks: rows.map((t) => taskJson(t, deps.tenantId)) });
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Try to create one task on behalf of `userId`. Returns either
|
|
208
|
+
* `{ ok: true, task }` or `{ ok: false, error, status }` so the
|
|
209
|
+
* batch handler can aggregate results without short-circuiting.
|
|
210
|
+
*
|
|
211
|
+
* `agents` is passed in instead of being fetched per-row so a
|
|
212
|
+
* 100-task batch only hits the DB once for the worker list.
|
|
213
|
+
*/
|
|
214
|
+
const createOne = (userId, body, agents) => {
|
|
215
|
+
const title = typeof body.title === "string" ? body.title.trim() : "";
|
|
216
|
+
if (!title)
|
|
217
|
+
return { ok: false, error: "title_required", status: 400 };
|
|
218
|
+
if (title.length > 200)
|
|
219
|
+
return { ok: false, error: "title_too_long", status: 400 };
|
|
220
|
+
let initialStatus = null;
|
|
221
|
+
if (typeof body.status === "string") {
|
|
222
|
+
if (!isTaskStatus(body.status)) {
|
|
223
|
+
return {
|
|
224
|
+
ok: false,
|
|
225
|
+
error: "bad_status",
|
|
226
|
+
status: 400,
|
|
227
|
+
received: body.status,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
initialStatus = body.status;
|
|
231
|
+
}
|
|
232
|
+
const description = typeof body.description === "string" ? body.description : null;
|
|
233
|
+
const project = typeof body.project === "string" ? body.project : undefined;
|
|
234
|
+
const priority = typeof body.priority === "number" ? body.priority : 0;
|
|
235
|
+
const workerRole = typeof body.workerRole === "string" ? body.workerRole : null;
|
|
236
|
+
const workerAgentId = typeof body.workerAgentId === "string" ? body.workerAgentId : null;
|
|
237
|
+
const assignErr = validateAssignableWorker(agents, {
|
|
238
|
+
workerAgentId,
|
|
239
|
+
workerRole,
|
|
240
|
+
});
|
|
241
|
+
if (assignErr)
|
|
242
|
+
return { ok: false, ...assignErr, status: 400 };
|
|
243
|
+
const dependsOn = filterOwnedDeps(deps.db, userId, body.dependsOn);
|
|
244
|
+
const labelsArg = Array.isArray(body.labels)
|
|
245
|
+
? body.labels.filter((l) => typeof l === "string")
|
|
246
|
+
: undefined;
|
|
247
|
+
let task = createTask(deps.db, randomUUID(), {
|
|
248
|
+
ownerUserId: userId,
|
|
249
|
+
title,
|
|
250
|
+
description,
|
|
251
|
+
projectSlug: project,
|
|
252
|
+
priority,
|
|
253
|
+
workerRole,
|
|
254
|
+
workerAgentId,
|
|
255
|
+
dependsOn,
|
|
256
|
+
labels: labelsArg,
|
|
257
|
+
});
|
|
258
|
+
// Optional second-step patch when caller pre-selected a non-`ready`
|
|
259
|
+
// status (e.g. user added a card directly into the In-progress
|
|
260
|
+
// column). Done in-process so the create + status flip land
|
|
261
|
+
// atomically from the client's perspective.
|
|
262
|
+
if (initialStatus && initialStatus !== "ready") {
|
|
263
|
+
const now = Date.now();
|
|
264
|
+
const patch = { status: initialStatus };
|
|
265
|
+
if (initialStatus === "in_progress")
|
|
266
|
+
patch.startedAt = now;
|
|
267
|
+
if (initialStatus === "done") {
|
|
268
|
+
patch.endedAt = now;
|
|
269
|
+
}
|
|
270
|
+
const after = updateTask(deps.db, task.id, patch);
|
|
271
|
+
if (after)
|
|
272
|
+
task = after;
|
|
273
|
+
}
|
|
274
|
+
return { ok: true, task: taskJson(task, deps.tenantId) };
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* POST /tasks — batch create.
|
|
278
|
+
*
|
|
279
|
+
* Accepts either:
|
|
280
|
+
* - `{ tasks: TaskInput[] }` (preferred, batch shape)
|
|
281
|
+
* - `TaskInput` (legacy single-task body — wrapped
|
|
282
|
+
* into a 1-element batch internally)
|
|
283
|
+
*
|
|
284
|
+
* Always responds with `{ results: BatchResult[] }` whose order
|
|
285
|
+
* matches the input. Each result is either
|
|
286
|
+
* `{ ok: true, task }`
|
|
287
|
+
* or
|
|
288
|
+
* `{ ok: false, error, ...details }`
|
|
289
|
+
*
|
|
290
|
+
* Per-item failures do NOT abort the batch — good rows still
|
|
291
|
+
* land. The HTTP status is 201 if at least one task was created,
|
|
292
|
+
* 400 if every row failed.
|
|
293
|
+
*
|
|
294
|
+
* The single-task wrapping is here so existing clients (the
|
|
295
|
+
* react panel + the chat-shell) keep working without a flag
|
|
296
|
+
* day; new callers should send the batch shape.
|
|
297
|
+
*/
|
|
298
|
+
const createTaskHandler = (req, res) => {
|
|
299
|
+
const userId = userIdFromReq(req);
|
|
300
|
+
if (!userId) {
|
|
301
|
+
res.status(401).json({ error: "no_user" });
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const body = (req.body ?? {});
|
|
305
|
+
const inputs = Array.isArray(body.tasks)
|
|
306
|
+
? body.tasks
|
|
307
|
+
: [body];
|
|
308
|
+
if (inputs.length === 0) {
|
|
309
|
+
res.status(400).json({ error: "tasks_empty" });
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (inputs.length > BATCH_LIMIT) {
|
|
313
|
+
res
|
|
314
|
+
.status(400)
|
|
315
|
+
.json({ error: "batch_too_large", limit: BATCH_LIMIT });
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
// Cache the agent list once for the whole batch.
|
|
319
|
+
const agents = deps.listMergedAgents();
|
|
320
|
+
let anyOk = false;
|
|
321
|
+
const results = inputs.map((input) => {
|
|
322
|
+
if (!input || typeof input !== "object") {
|
|
323
|
+
return { ok: false, error: "task_input_not_object" };
|
|
324
|
+
}
|
|
325
|
+
const r = createOne(userId, input, agents);
|
|
326
|
+
if (r.ok)
|
|
327
|
+
anyOk = true;
|
|
328
|
+
// Strip the internal `status` hint before sending — clients
|
|
329
|
+
// get a flat envelope per row.
|
|
330
|
+
const { status: _ignored, ...rest } = r;
|
|
331
|
+
return rest;
|
|
332
|
+
});
|
|
333
|
+
if (anyOk)
|
|
334
|
+
deps.onTaskWrite();
|
|
335
|
+
res.status(anyOk ? 201 : 400).json({ results });
|
|
336
|
+
};
|
|
337
|
+
const patchTaskHandler = (req, res) => {
|
|
338
|
+
const userId = userIdFromReq(req);
|
|
339
|
+
if (!userId) {
|
|
340
|
+
res.status(401).json({ error: "no_user" });
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const id = stringParam(req, "id");
|
|
344
|
+
if (!id) {
|
|
345
|
+
res.status(400).json({ error: "id_required" });
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const before = getTask(deps.db, id);
|
|
349
|
+
if (!before) {
|
|
350
|
+
res.status(404).json({ error: "not_found" });
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (before.ownerUserId !== userId) {
|
|
354
|
+
res.status(403).json({ error: "not_yours" });
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const body = (req.body ?? {});
|
|
358
|
+
const patch = {};
|
|
359
|
+
if (typeof body.title === "string")
|
|
360
|
+
patch.title = body.title;
|
|
361
|
+
if (body.description === null || typeof body.description === "string") {
|
|
362
|
+
patch.description = body.description;
|
|
363
|
+
}
|
|
364
|
+
if (typeof body.project === "string")
|
|
365
|
+
patch.projectSlug = body.project;
|
|
366
|
+
if (typeof body.priority === "number")
|
|
367
|
+
patch.priority = body.priority;
|
|
368
|
+
if (body.workerRole === null || typeof body.workerRole === "string") {
|
|
369
|
+
patch.workerRole = body.workerRole;
|
|
370
|
+
}
|
|
371
|
+
if (body.workerAgentId === null ||
|
|
372
|
+
typeof body.workerAgentId === "string") {
|
|
373
|
+
patch.workerAgentId = body.workerAgentId;
|
|
374
|
+
}
|
|
375
|
+
// If the patch touches the assignment surface, validate the new
|
|
376
|
+
// (post-patch) target. Falling through to the pool with a stale
|
|
377
|
+
// assignment would silently park the task in `ready` after a
|
|
378
|
+
// re-queue. Use the patched values where present, otherwise the
|
|
379
|
+
// current row's values — we don't want to spuriously fail when
|
|
380
|
+
// the user is patching only e.g. priority and the agent assigned
|
|
381
|
+
// long ago has since been disabled (different bug to surface).
|
|
382
|
+
const touchesAssignment = patch.workerAgentId !== undefined || patch.workerRole !== undefined;
|
|
383
|
+
if (touchesAssignment) {
|
|
384
|
+
const nextAgentId = patch.workerAgentId !== undefined
|
|
385
|
+
? patch.workerAgentId
|
|
386
|
+
: before.workerAgentId;
|
|
387
|
+
const nextRole = patch.workerRole !== undefined ? patch.workerRole : before.workerRole;
|
|
388
|
+
const assignErr = validateAssignableWorker(deps.listMergedAgents(), { workerAgentId: nextAgentId, workerRole: nextRole });
|
|
389
|
+
if (assignErr) {
|
|
390
|
+
res.status(400).json(assignErr);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (typeof body.status === "string") {
|
|
395
|
+
if (!isTaskStatus(body.status)) {
|
|
396
|
+
res.status(400).json({ error: "bad_status", status: body.status });
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
patch.status = body.status;
|
|
400
|
+
const now = Date.now();
|
|
401
|
+
if (body.status === "in_progress" && !before.startedAt) {
|
|
402
|
+
patch.startedAt = now;
|
|
403
|
+
}
|
|
404
|
+
if (body.status === "done") {
|
|
405
|
+
patch.endedAt = now;
|
|
406
|
+
}
|
|
407
|
+
if (body.status === "ready") {
|
|
408
|
+
patch.startedAt = null;
|
|
409
|
+
patch.endedAt = null;
|
|
410
|
+
patch.resultSummary = null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (typeof body.resultSummary === "string" ||
|
|
414
|
+
body.resultSummary === null) {
|
|
415
|
+
patch.resultSummary = body.resultSummary;
|
|
416
|
+
}
|
|
417
|
+
if (Array.isArray(body.dependsOn) || body.dependsOn === null) {
|
|
418
|
+
const filtered = filterOwnedDeps(deps.db, userId, body.dependsOn ?? []);
|
|
419
|
+
if (filtered !== undefined) {
|
|
420
|
+
patch.dependsOn = filtered.filter((depId) => depId !== id);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
if (Array.isArray(body.labels)) {
|
|
424
|
+
patch.labels = body.labels.filter((l) => typeof l === "string");
|
|
425
|
+
}
|
|
426
|
+
if (typeof body.attempts === "number" && Number.isFinite(body.attempts)) {
|
|
427
|
+
// Allow the user to reset the retry counter ("Retry" button
|
|
428
|
+
// on the stalled-label chip). We don't need a stricter
|
|
429
|
+
// contract — attempts is informational; if a client sets a
|
|
430
|
+
// weird value the worker pool just keeps incrementing from
|
|
431
|
+
// there.
|
|
432
|
+
patch.attempts = body.attempts;
|
|
433
|
+
}
|
|
434
|
+
if (typeof body.failureReason === "string" ||
|
|
435
|
+
body.failureReason === null) {
|
|
436
|
+
patch.failureReason = body.failureReason;
|
|
437
|
+
}
|
|
438
|
+
if (typeof body.interventionReason === "string" ||
|
|
439
|
+
body.interventionReason === null) {
|
|
440
|
+
patch.interventionReason = body.interventionReason;
|
|
441
|
+
}
|
|
442
|
+
if (typeof body.interventionAt === "number" ||
|
|
443
|
+
body.interventionAt === null) {
|
|
444
|
+
patch.interventionAt = body.interventionAt;
|
|
445
|
+
}
|
|
446
|
+
if (typeof body.timeoutMs === "number" &&
|
|
447
|
+
Number.isFinite(body.timeoutMs)) {
|
|
448
|
+
patch.timeoutMs = body.timeoutMs;
|
|
449
|
+
}
|
|
450
|
+
const after = updateTask(deps.db, id, patch);
|
|
451
|
+
// If the patch removed a pool-skip label (e.g. user cleared
|
|
452
|
+
// 'awaiting-intervention' / 'stalled' to retry), nudge so the
|
|
453
|
+
// pool re-considers the row even though status didn't change.
|
|
454
|
+
// 008+ added `awaiting-intervention`; clearing it via the UI
|
|
455
|
+
// should re-queue exactly the same way clearing `stalled` does.
|
|
456
|
+
if (after && patch.labels !== undefined) {
|
|
457
|
+
const skipLabels = ["awaiting-intervention", "stalled", "draft"];
|
|
458
|
+
const wasSkipped = before.labels.some((l) => skipLabels.includes(l));
|
|
459
|
+
const stillSkipped = after.labels.some((l) => skipLabels.includes(l));
|
|
460
|
+
if (wasSkipped && !stillSkipped && after.status === "ready") {
|
|
461
|
+
deps.onTaskWrite();
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
// Nudge the pool whenever the patch could change task
|
|
465
|
+
// eligibility for ANY downstream worker:
|
|
466
|
+
// - status → 'ready' : this task itself just became eligible.
|
|
467
|
+
// - status → 'done' : downstream tasks that depend on this
|
|
468
|
+
// one may now be unblocked.
|
|
469
|
+
// Forgetting the second case is the bug Yu hit: T1–T3 manually
|
|
470
|
+
// patched to 'done' didn't release T4, which kept the chain
|
|
471
|
+
// wedged until a manual workers/restart.
|
|
472
|
+
if (after && after.status !== before.status) {
|
|
473
|
+
if (after.status === "ready" || after.status === "done") {
|
|
474
|
+
deps.onTaskWrite();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
res.json({ task: after ? taskJson(after, deps.tenantId) : null });
|
|
478
|
+
};
|
|
479
|
+
/**
|
|
480
|
+
* GET /tasks/:id/history
|
|
481
|
+
*
|
|
482
|
+
* Returns the worker session transcript for the task's most
|
|
483
|
+
* recent run (`tasks.session_id`). The kanban Execution tab and
|
|
484
|
+
* the chat-side `task_get_history` agent tool both consume this.
|
|
485
|
+
*
|
|
486
|
+
* Auth: same as listTasks — you can only see history for tasks
|
|
487
|
+
* you own. A task without `session_id` (never claimed) returns
|
|
488
|
+
* `{ entries: [] }` rather than 404 so the UI can still render
|
|
489
|
+
* an "hasn't run yet" empty state without an error toast.
|
|
490
|
+
*/
|
|
491
|
+
const taskHistoryHandler = (req, res) => {
|
|
492
|
+
const userId = userIdFromReq(req);
|
|
493
|
+
if (!userId) {
|
|
494
|
+
res.status(401).json({ error: "no_user" });
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const id = stringParam(req, "id");
|
|
498
|
+
if (!id) {
|
|
499
|
+
res.status(400).json({ error: "id_required" });
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
const task = getTask(deps.db, id);
|
|
503
|
+
if (!task) {
|
|
504
|
+
res.status(404).json({ error: "not_found" });
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (task.ownerUserId !== userId) {
|
|
508
|
+
res.status(403).json({ error: "not_yours" });
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const sessionId = task.sessionId;
|
|
512
|
+
if (!sessionId) {
|
|
513
|
+
res.json({
|
|
514
|
+
sessionId: null,
|
|
515
|
+
entries: [],
|
|
516
|
+
attempts: task.attempts,
|
|
517
|
+
failureReason: task.failureReason,
|
|
518
|
+
});
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const entries = readSessionHistory(deps.db, sessionId);
|
|
522
|
+
res.json({
|
|
523
|
+
sessionId,
|
|
524
|
+
entries,
|
|
525
|
+
attempts: task.attempts,
|
|
526
|
+
failureReason: task.failureReason,
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Try to delete one task on behalf of `userId`. Returns a per-row
|
|
531
|
+
* result envelope so the batch handler can aggregate.
|
|
532
|
+
*/
|
|
533
|
+
const deleteOne = (userId, id) => {
|
|
534
|
+
if (typeof id !== "string" || !id.trim()) {
|
|
535
|
+
return { ok: false, error: "id_required" };
|
|
536
|
+
}
|
|
537
|
+
const before = getTask(deps.db, id);
|
|
538
|
+
if (!before)
|
|
539
|
+
return { ok: false, id, error: "not_found" };
|
|
540
|
+
if (before.ownerUserId !== userId)
|
|
541
|
+
return { ok: false, id, error: "not_yours" };
|
|
542
|
+
deleteTask(deps.db, id);
|
|
543
|
+
return { ok: true, id };
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* POST /tasks/delete — batch delete.
|
|
547
|
+
*
|
|
548
|
+
* Body: `{ ids: string[] }`. Always responds with
|
|
549
|
+
* `{ results: { ok, id, error? }[] }` whose order matches the
|
|
550
|
+
* input.
|
|
551
|
+
*
|
|
552
|
+
* We use POST + a side path instead of `DELETE /tasks` because
|
|
553
|
+
* not every HTTP intermediary forwards a request body on DELETE,
|
|
554
|
+
* and we want the contract to be unambiguous.
|
|
555
|
+
*
|
|
556
|
+
* Per-item failures do not abort the batch. The HTTP status is
|
|
557
|
+
* 200 if any row was deleted, 400 if every row failed (most
|
|
558
|
+
* commonly: ids belonged to someone else, or were unknown).
|
|
559
|
+
*/
|
|
560
|
+
const deleteTaskHandler = (req, res) => {
|
|
561
|
+
const userId = userIdFromReq(req);
|
|
562
|
+
if (!userId) {
|
|
563
|
+
res.status(401).json({ error: "no_user" });
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const body = (req.body ?? {});
|
|
567
|
+
const ids = Array.isArray(body.ids) ? body.ids : null;
|
|
568
|
+
if (!ids) {
|
|
569
|
+
res.status(400).json({ error: "ids_required" });
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
if (ids.length === 0) {
|
|
573
|
+
res.status(400).json({ error: "ids_empty" });
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (ids.length > BATCH_LIMIT) {
|
|
577
|
+
res
|
|
578
|
+
.status(400)
|
|
579
|
+
.json({ error: "batch_too_large", limit: BATCH_LIMIT });
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
let anyOk = false;
|
|
583
|
+
const results = ids.map((id) => {
|
|
584
|
+
const r = deleteOne(userId, id);
|
|
585
|
+
if (r.ok)
|
|
586
|
+
anyOk = true;
|
|
587
|
+
return r;
|
|
588
|
+
});
|
|
589
|
+
if (anyOk)
|
|
590
|
+
deps.onTaskWrite();
|
|
591
|
+
res.status(anyOk ? 200 : 400).json({ results });
|
|
592
|
+
};
|
|
593
|
+
const listProjectsHandler = (req, res) => {
|
|
594
|
+
const userId = userIdFromReq(req);
|
|
595
|
+
if (!userId) {
|
|
596
|
+
res.status(401).json({ error: "no_user" });
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
res.json({ projects: projectsJson(listProjects(deps.db, userId)) });
|
|
600
|
+
};
|
|
601
|
+
const workerStatusHandler = (_req, res) => {
|
|
602
|
+
res.json(deps.pool.status());
|
|
603
|
+
};
|
|
604
|
+
const workerRestartHandler = (_req, res) => {
|
|
605
|
+
deps.pool.nudge();
|
|
606
|
+
res.json({ ok: true });
|
|
607
|
+
};
|
|
608
|
+
// ─── Worker agents (N+6.2 v2: plugin-owned) ───────────────────
|
|
609
|
+
const listAgentsHandler = (_req, res) => {
|
|
610
|
+
const agents = deps.listMergedAgents();
|
|
611
|
+
const augmented = agents.map((a) => ({
|
|
612
|
+
...a,
|
|
613
|
+
effectiveSkills: deps.computeEffectiveSkills(a),
|
|
614
|
+
}));
|
|
615
|
+
res.json({
|
|
616
|
+
agents: augmented,
|
|
617
|
+
kinds: deps.workerKinds,
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
// PATCH /agents/:slug/enabled — flip the enabled flag on the
|
|
621
|
+
// worker's agent.json. Used by the worker-agents page's enable /
|
|
622
|
+
// disable toggle. The fs watcher in server.ts picks up the file
|
|
623
|
+
// write and triggers a pool rebuild, so the change takes effect
|
|
624
|
+
// on the next task pickup without a process restart.
|
|
625
|
+
const setAgentEnabledHandler = async (req, res) => {
|
|
626
|
+
const slug = typeof req.params?.slug === "string"
|
|
627
|
+
? req.params.slug
|
|
628
|
+
: typeof req.query.slug === "string"
|
|
629
|
+
? req.query.slug
|
|
630
|
+
: "";
|
|
631
|
+
if (!slug) {
|
|
632
|
+
res.status(400).json({ error: "slug_required" });
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
const body = req.body ?? {};
|
|
636
|
+
if (typeof body.enabled !== "boolean") {
|
|
637
|
+
res.status(400).json({
|
|
638
|
+
error: "enabled_required",
|
|
639
|
+
message: "PATCH body must be { enabled: true | false }",
|
|
640
|
+
});
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
const result = deps.setAgentEnabled({ slug, enabled: body.enabled });
|
|
644
|
+
if (!result.ok) {
|
|
645
|
+
// Map common errors to the right HTTP code.
|
|
646
|
+
const status = result.error.includes("not found") || result.error.includes("invalid")
|
|
647
|
+
? 404
|
|
648
|
+
: 500;
|
|
649
|
+
res.status(status).json({ error: "update_failed", message: result.error });
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
deps.onTaskWrite();
|
|
653
|
+
res.json({ ok: true, slug, enabled: result.enabled });
|
|
654
|
+
};
|
|
655
|
+
return {
|
|
656
|
+
listTasks: listTasksHandler,
|
|
657
|
+
createTask: createTaskHandler,
|
|
658
|
+
patchTask: patchTaskHandler,
|
|
659
|
+
taskHistory: taskHistoryHandler,
|
|
660
|
+
deleteTask: deleteTaskHandler,
|
|
661
|
+
listProjects: listProjectsHandler,
|
|
662
|
+
workerStatus: workerStatusHandler,
|
|
663
|
+
workerRestart: workerRestartHandler,
|
|
664
|
+
listAgents: listAgentsHandler,
|
|
665
|
+
setAgentEnabled: setAgentEnabledHandler,
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
//# sourceMappingURL=handlers.js.map
|