@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,866 @@
|
|
|
1
|
+
// In-memory worker pool.
|
|
2
|
+
//
|
|
3
|
+
// One pool per active tenant. Each "slot" inside the pool wraps a
|
|
4
|
+
// configured worker agent (host table `worker_agents`, declared by
|
|
5
|
+
// migration 003-worker-agents and seeded by plugins via the
|
|
6
|
+
// `defaultWorkerAgents` manifest contribution).
|
|
7
|
+
//
|
|
8
|
+
// Lifecycle of a task:
|
|
9
|
+
// 1. Anyone (REST, agent tool, kanban UI) writes a `todo` row and
|
|
10
|
+
// nudges the pool.
|
|
11
|
+
// 2. Each non-busy slot calls `claimNextTask` with its agent id +
|
|
12
|
+
// kind-derived role; SQLite's serialised writer makes the
|
|
13
|
+
// claim atomic. Tasks pinned to a different agent are skipped.
|
|
14
|
+
// 3. The slot's `WorkerHandle.run()` does the real work and
|
|
15
|
+
// resolves with a terminal status. v0.2 ships one runtime,
|
|
16
|
+
// `echo`, that just sleeps + reflects the title; real LLM /
|
|
17
|
+
// tool runtimes ship later as separate plugins (ADR-0002 §1).
|
|
18
|
+
//
|
|
19
|
+
// `nudge()` is event-driven: every write path calls it. There's no
|
|
20
|
+
// polling loop. On plugin activate we also call `recoverOrphaned`
|
|
21
|
+
// once to flip in-flight tasks (left over from a process crash)
|
|
22
|
+
// back to `todo`.
|
|
23
|
+
//
|
|
24
|
+
// `rebuild()` lets the host call back when the agent list changes
|
|
25
|
+
// (create / patch / delete / reset). The new slot set is computed
|
|
26
|
+
// from a fresh agent snapshot; in-flight slots that still match an
|
|
27
|
+
// agent id keep going (no work is killed).
|
|
28
|
+
import { claimNextTask, getTask, updateTask, INTERVENTION_LABEL, } from "../db/tasks.js";
|
|
29
|
+
import { WORKER_DENY_TOOLS as WORKER_DENY_TOOLS_LIST, WORKER_DENY_TOOLS_SET, WORKER_REQUIRED_TOOLS, } from "./tool-policy.js";
|
|
30
|
+
/**
|
|
31
|
+
* Legacy threshold from the auto-retry era. Migration 008 replaced
|
|
32
|
+
* the auto-retry loop with main-agent intervention, so the pool no
|
|
33
|
+
* longer consults this value to decide whether to give up. We keep
|
|
34
|
+
* it exported (1) for the existing test that locks in the
|
|
35
|
+
* "give up" behaviour against the old API, and (2) so external
|
|
36
|
+
* callers depending on the symbol don't trip a build break in the
|
|
37
|
+
* same release that ships the behaviour change. Any future use
|
|
38
|
+
* site should treat "any failure" as the give-up condition.
|
|
39
|
+
*/
|
|
40
|
+
export const MAX_ATTEMPTS = 1;
|
|
41
|
+
const DEFAULT_POLL_INTERVAL_MS = 15_000;
|
|
42
|
+
export class WorkerPool {
|
|
43
|
+
deps;
|
|
44
|
+
nudgeTimer = null;
|
|
45
|
+
pollTimer = null;
|
|
46
|
+
watchdogTimer = null;
|
|
47
|
+
/** agentId → "in-flight task id" (or undefined = idle). */
|
|
48
|
+
busy = new Map();
|
|
49
|
+
/** taskId → AbortController for the run. Lets the watchdog (or
|
|
50
|
+
* pool shutdown) cancel a worker mid-flight without scanning
|
|
51
|
+
* every WorkerHandle. */
|
|
52
|
+
runControllers = new Map();
|
|
53
|
+
workers = [];
|
|
54
|
+
stopped = false;
|
|
55
|
+
constructor(deps) {
|
|
56
|
+
this.deps = deps;
|
|
57
|
+
this.workers = this.buildHandles(deps.agents);
|
|
58
|
+
}
|
|
59
|
+
/** Drain orphaned in_progress rows + kick off processing. */
|
|
60
|
+
start() {
|
|
61
|
+
this.recoverOrphaned();
|
|
62
|
+
this.nudge();
|
|
63
|
+
// Fallback periodic drain. The pool is primarily event-driven,
|
|
64
|
+
// but a cheap interval catches tasks that became eligible
|
|
65
|
+
// through a code path that forgot to call onTaskWrite() (e.g.
|
|
66
|
+
// a worker outside this plugin marking its predecessor done).
|
|
67
|
+
// The work itself is `claimNextTask` which is a single SQLite
|
|
68
|
+
// SELECT — it costs effectively nothing when the queue is
|
|
69
|
+
// empty, so we don't need to be clever about scheduling.
|
|
70
|
+
const poll = this.deps.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
71
|
+
if (poll > 0) {
|
|
72
|
+
this.pollTimer = setInterval(() => {
|
|
73
|
+
if (!this.stopped)
|
|
74
|
+
this.nudge();
|
|
75
|
+
}, poll);
|
|
76
|
+
// Don't keep the process alive just for the poll timer.
|
|
77
|
+
this.pollTimer.unref?.();
|
|
78
|
+
}
|
|
79
|
+
// Watchdog: every 5s scan in-flight tasks and cancel any
|
|
80
|
+
// whose `started_at + timeout_ms` has passed. Cancelling the
|
|
81
|
+
// AbortController causes the agent-loop runner to wind down,
|
|
82
|
+
// returning a terminal `aborted` update; runOne's terminal
|
|
83
|
+
// handler then routes the task into intervention with a
|
|
84
|
+
// "timeout" reason. 5s polling is fine — the budget is in
|
|
85
|
+
// minutes, and a few seconds of slop is invisible to humans.
|
|
86
|
+
this.watchdogTimer = setInterval(() => {
|
|
87
|
+
if (this.stopped)
|
|
88
|
+
return;
|
|
89
|
+
this.runWatchdog();
|
|
90
|
+
}, 5_000);
|
|
91
|
+
this.watchdogTimer.unref?.();
|
|
92
|
+
}
|
|
93
|
+
/** Mark the pool stopped. Any work already in flight finishes;
|
|
94
|
+
* no further claims happen. */
|
|
95
|
+
stop() {
|
|
96
|
+
this.stopped = true;
|
|
97
|
+
if (this.nudgeTimer) {
|
|
98
|
+
clearTimeout(this.nudgeTimer);
|
|
99
|
+
this.nudgeTimer = null;
|
|
100
|
+
}
|
|
101
|
+
if (this.pollTimer) {
|
|
102
|
+
clearInterval(this.pollTimer);
|
|
103
|
+
this.pollTimer = null;
|
|
104
|
+
}
|
|
105
|
+
if (this.watchdogTimer) {
|
|
106
|
+
clearInterval(this.watchdogTimer);
|
|
107
|
+
this.watchdogTimer = null;
|
|
108
|
+
}
|
|
109
|
+
// Be polite: cancel every in-flight run so we don't keep
|
|
110
|
+
// burning model tokens after a tenant disable.
|
|
111
|
+
for (const ctl of this.runControllers.values()) {
|
|
112
|
+
try {
|
|
113
|
+
ctl.abort();
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// best-effort
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.runControllers.clear();
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Cancel an in-flight run by task id. Returns true iff there
|
|
123
|
+
* was a controller to abort. Used by `task_extend_timeout` is
|
|
124
|
+
* NOT — that one just bumps the row's timeout_ms; the watchdog
|
|
125
|
+
* picks the new value up on its next tick — but `task_abort`
|
|
126
|
+
* uses it to interrupt a runaway worker.
|
|
127
|
+
*/
|
|
128
|
+
cancelTaskRun(taskId) {
|
|
129
|
+
const ctl = this.runControllers.get(taskId);
|
|
130
|
+
if (!ctl)
|
|
131
|
+
return false;
|
|
132
|
+
try {
|
|
133
|
+
ctl.abort();
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// best-effort
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
/** Watchdog scan. Visible for testing. */
|
|
141
|
+
runWatchdog() {
|
|
142
|
+
const now = Date.now();
|
|
143
|
+
for (const [taskId] of this.runControllers) {
|
|
144
|
+
// Re-read the row each tick so a `task_extend_timeout` that
|
|
145
|
+
// grew the budget mid-flight takes effect immediately.
|
|
146
|
+
const fresh = getTask(this.deps.db, taskId);
|
|
147
|
+
if (!fresh || !fresh.startedAt)
|
|
148
|
+
continue;
|
|
149
|
+
const deadline = fresh.startedAt + fresh.timeoutMs;
|
|
150
|
+
if (now < deadline)
|
|
151
|
+
continue;
|
|
152
|
+
this.deps.log.warn("workboard: watchdog cancelling task", {
|
|
153
|
+
taskId,
|
|
154
|
+
startedAt: fresh.startedAt,
|
|
155
|
+
timeoutMs: fresh.timeoutMs,
|
|
156
|
+
overrunMs: now - deadline,
|
|
157
|
+
});
|
|
158
|
+
const ctl = this.runControllers.get(taskId);
|
|
159
|
+
if (ctl) {
|
|
160
|
+
try {
|
|
161
|
+
// Mark the reason on the row BEFORE aborting so the
|
|
162
|
+
// terminal handler in runOne (which writes the
|
|
163
|
+
// intervention payload) sees "watchdog timeout" rather
|
|
164
|
+
// than the bare "aborted" the agent-loop reports.
|
|
165
|
+
updateTask(this.deps.db, taskId, {
|
|
166
|
+
failureReason: `watchdog timeout (${Math.round(fresh.timeoutMs / 1000)}s budget exceeded by ${Math.round((now - deadline) / 1000)}s)`,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
this.deps.log.warn("workboard: watchdog stamp failed", {
|
|
171
|
+
taskId,
|
|
172
|
+
err: err instanceof Error ? err.message : String(err),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
ctl.abort();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** Replace the agent set (host calls this after worker_agents
|
|
180
|
+
* rows change). In-flight agents that survive the swap keep
|
|
181
|
+
* draining their current task; agents that vanished are
|
|
182
|
+
* abandoned (their in-flight task will end and just not be
|
|
183
|
+
* re-claimed). */
|
|
184
|
+
rebuild(agents) {
|
|
185
|
+
if (this.stopped)
|
|
186
|
+
return;
|
|
187
|
+
const next = this.buildHandles(agents);
|
|
188
|
+
// Drop busy entries whose agent no longer exists, so a future
|
|
189
|
+
// resurrection of the same id starts clean.
|
|
190
|
+
const survivingIds = new Set(next.map((w) => w.agentId));
|
|
191
|
+
for (const id of [...this.busy.keys()]) {
|
|
192
|
+
if (!survivingIds.has(id))
|
|
193
|
+
this.busy.delete(id);
|
|
194
|
+
}
|
|
195
|
+
this.workers = next;
|
|
196
|
+
this.deps.log.info("workboard: rebuilt pool", {
|
|
197
|
+
workerCount: next.length,
|
|
198
|
+
agents: next.map((w) => ({ id: w.agentId, kind: w.kind })),
|
|
199
|
+
});
|
|
200
|
+
this.nudge();
|
|
201
|
+
}
|
|
202
|
+
/** Snapshot for the admin page + `GET /workers/status`. */
|
|
203
|
+
status() {
|
|
204
|
+
return {
|
|
205
|
+
workers: this.workers.map((w) => ({
|
|
206
|
+
agentId: w.agentId,
|
|
207
|
+
name: w.name,
|
|
208
|
+
kind: w.kind,
|
|
209
|
+
busy: this.busy.has(w.agentId),
|
|
210
|
+
})),
|
|
211
|
+
running: [...this.busy.values()],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/** Schedule one drain pass on the next tick. Called from the
|
|
215
|
+
* REST handler / agent tool every time a new task lands. */
|
|
216
|
+
nudge() {
|
|
217
|
+
if (this.stopped)
|
|
218
|
+
return;
|
|
219
|
+
if (this.nudgeTimer)
|
|
220
|
+
return; // coalesce multiple nudges
|
|
221
|
+
this.nudgeTimer = setTimeout(() => {
|
|
222
|
+
this.nudgeTimer = null;
|
|
223
|
+
void this.drain();
|
|
224
|
+
}, 0);
|
|
225
|
+
}
|
|
226
|
+
// ─── internals ─────────────────────────────────────────
|
|
227
|
+
buildHandles(agents) {
|
|
228
|
+
const out = [];
|
|
229
|
+
for (const a of agents) {
|
|
230
|
+
const handle = this.deps.factory(a);
|
|
231
|
+
if (!handle) {
|
|
232
|
+
this.deps.log.info("workboard: skipping agent (kind unsupported)", {
|
|
233
|
+
agentId: a.id,
|
|
234
|
+
kind: a.kind,
|
|
235
|
+
name: a.name,
|
|
236
|
+
});
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
out.push(handle);
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
242
|
+
}
|
|
243
|
+
async drain() {
|
|
244
|
+
if (this.stopped)
|
|
245
|
+
return;
|
|
246
|
+
for (const worker of this.workers) {
|
|
247
|
+
if (this.busy.has(worker.agentId))
|
|
248
|
+
continue;
|
|
249
|
+
const claimed = claimNextTask(this.deps.db, {
|
|
250
|
+
workerAgentId: worker.agentId,
|
|
251
|
+
workerRole: worker.kind,
|
|
252
|
+
});
|
|
253
|
+
if (!claimed)
|
|
254
|
+
continue;
|
|
255
|
+
this.busy.set(worker.agentId, claimed.id);
|
|
256
|
+
this.deps.broadcast("workboard.task", {
|
|
257
|
+
kind: "claimed",
|
|
258
|
+
taskId: claimed.id,
|
|
259
|
+
workerAgentId: worker.agentId,
|
|
260
|
+
workerName: worker.name,
|
|
261
|
+
});
|
|
262
|
+
this.deps.log.info("workboard: claimed task", {
|
|
263
|
+
taskId: claimed.id,
|
|
264
|
+
agentId: worker.agentId,
|
|
265
|
+
worker: worker.name,
|
|
266
|
+
title: claimed.title,
|
|
267
|
+
});
|
|
268
|
+
// Run the worker async so we don't block the drain loop.
|
|
269
|
+
void this.runOne(worker, claimed).finally(() => {
|
|
270
|
+
this.busy.delete(worker.agentId);
|
|
271
|
+
// After one completion there might be more tasks waiting —
|
|
272
|
+
// re-nudge so the pool keeps draining.
|
|
273
|
+
if (!this.stopped)
|
|
274
|
+
this.nudge();
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
async runOne(worker, task) {
|
|
279
|
+
// Per-run AbortController. Two things can fire it:
|
|
280
|
+
// 1. The watchdog (deadline = startedAt + timeout_ms).
|
|
281
|
+
// 2. The pool stopping (`stop()` aborts every in-flight
|
|
282
|
+
// controller so workers don't keep burning model
|
|
283
|
+
// tokens past shutdown).
|
|
284
|
+
// The controller lives in `runControllers` keyed by taskId
|
|
285
|
+
// so the watchdog can reach it without holding a closure
|
|
286
|
+
// reference.
|
|
287
|
+
const ctl = new AbortController();
|
|
288
|
+
this.runControllers.set(task.id, ctl);
|
|
289
|
+
// Acquire a per-task sandbox before the agent loop starts so
|
|
290
|
+
// the very first ExecTool call lands in a ready VM (the
|
|
291
|
+
// worker's onSessionStart hook later binds the session id to
|
|
292
|
+
// this task). When the microsandbox plugin isn't loaded the
|
|
293
|
+
// capability is undefined and we skip silently — ExecTool
|
|
294
|
+
// falls back to the long-lived runner.
|
|
295
|
+
if (this.deps.taskPool) {
|
|
296
|
+
try {
|
|
297
|
+
await this.deps.taskPool.acquireTask(task.id);
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
this.deps.log.warn("workboard: taskPool.acquireTask failed", {
|
|
301
|
+
taskId: task.id,
|
|
302
|
+
err: err instanceof Error ? err.message : String(err),
|
|
303
|
+
});
|
|
304
|
+
// Fall through; the run can still proceed against the
|
|
305
|
+
// long-lived runner.
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
let update;
|
|
309
|
+
try {
|
|
310
|
+
update = await worker.run(task, ctl.signal);
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
this.deps.log.error("workboard: worker threw", {
|
|
314
|
+
taskId: task.id,
|
|
315
|
+
agentId: worker.agentId,
|
|
316
|
+
worker: worker.name,
|
|
317
|
+
err: err instanceof Error ? err.message : String(err),
|
|
318
|
+
});
|
|
319
|
+
update = {
|
|
320
|
+
status: "stalled",
|
|
321
|
+
resultSummary: `Worker error: ${err instanceof Error ? err.message : String(err)}`,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
finally {
|
|
325
|
+
this.runControllers.delete(task.id);
|
|
326
|
+
// Release the sandbox: stop without removing so disk state
|
|
327
|
+
// (installed packages, generated files) survives for the
|
|
328
|
+
// next attempt. Fire-and-forget — we don't block the next
|
|
329
|
+
// pickup on graceful VM shutdown.
|
|
330
|
+
if (this.deps.taskPool) {
|
|
331
|
+
try {
|
|
332
|
+
this.deps.taskPool.releaseTask(task.id);
|
|
333
|
+
}
|
|
334
|
+
catch (err) {
|
|
335
|
+
this.deps.log.warn("workboard: taskPool.releaseTask failed", {
|
|
336
|
+
taskId: task.id,
|
|
337
|
+
err: err instanceof Error ? err.message : String(err),
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (this.stopped)
|
|
343
|
+
return;
|
|
344
|
+
const now = Date.now();
|
|
345
|
+
if (update.status === "done") {
|
|
346
|
+
// Success: clear the failure trail and reset the attempt
|
|
347
|
+
// counter so future re-runs (e.g. a follow-up edit + manual
|
|
348
|
+
// re-queue) start clean. Also drop the intervention labels —
|
|
349
|
+
// a manual retry that succeeds shouldn't leave the warning
|
|
350
|
+
// badge stuck on the card.
|
|
351
|
+
const fresh = getTask(this.deps.db, task.id) ?? task;
|
|
352
|
+
const cleanedLabels = fresh.labels.filter((l) => l !== INTERVENTION_LABEL && l !== "stalled");
|
|
353
|
+
updateTask(this.deps.db, task.id, {
|
|
354
|
+
status: "done",
|
|
355
|
+
resultSummary: update.resultSummary ?? null,
|
|
356
|
+
resultFiles: update.resultFiles ?? [],
|
|
357
|
+
failureReason: null,
|
|
358
|
+
labels: cleanedLabels,
|
|
359
|
+
attempts: 0,
|
|
360
|
+
endedAt: now,
|
|
361
|
+
interventionReason: null,
|
|
362
|
+
interventionAt: null,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
// Failure (worker stalled / aborted, exception, or watchdog
|
|
367
|
+
// timeout). Post-008 behaviour: do NOT auto-retry. Stamp
|
|
368
|
+
// `awaiting-intervention`, write a structured reason, and
|
|
369
|
+
// notify the parent session so the main agent decides
|
|
370
|
+
// whether to continue (resume same session), retry fresh,
|
|
371
|
+
// extend the timeout, or abort.
|
|
372
|
+
//
|
|
373
|
+
// We still bump `attempts` as a passive counter (it shows
|
|
374
|
+
// up in the UI / inbox text), but it no longer drives any
|
|
375
|
+
// policy.
|
|
376
|
+
const fresh = getTask(this.deps.db, task.id) ?? task;
|
|
377
|
+
const nextAttempts = (fresh.attempts ?? 0) + 1;
|
|
378
|
+
const reason = update.resultSummary ?? `worker ${update.status} without summary`;
|
|
379
|
+
const baseLabels = fresh.labels.filter((l) => l !== INTERVENTION_LABEL && l !== "stalled");
|
|
380
|
+
const nextLabels = [...baseLabels, INTERVENTION_LABEL];
|
|
381
|
+
updateTask(this.deps.db, task.id, {
|
|
382
|
+
status: "ready",
|
|
383
|
+
resultSummary: null,
|
|
384
|
+
resultFiles: update.resultFiles ?? [],
|
|
385
|
+
failureReason: reason,
|
|
386
|
+
attempts: nextAttempts,
|
|
387
|
+
labels: nextLabels,
|
|
388
|
+
// Keep session_id pointing at the most recent run — the
|
|
389
|
+
// chat agent uses it (via task_continue) to resume the
|
|
390
|
+
// same conversation.
|
|
391
|
+
startedAt: null,
|
|
392
|
+
// Stamp ended_at so the timeline shows when the run
|
|
393
|
+
// ended; task_continue / task_retry_fresh clears it on
|
|
394
|
+
// re-queue.
|
|
395
|
+
endedAt: now,
|
|
396
|
+
interventionReason: reason,
|
|
397
|
+
interventionAt: now,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
this.deps.broadcast("workboard.task", {
|
|
401
|
+
kind: "completed",
|
|
402
|
+
taskId: task.id,
|
|
403
|
+
workerAgentId: worker.agentId,
|
|
404
|
+
workerName: worker.name,
|
|
405
|
+
status: update.status,
|
|
406
|
+
});
|
|
407
|
+
this.deps.log.info("workboard: task completed", {
|
|
408
|
+
taskId: task.id,
|
|
409
|
+
agentId: worker.agentId,
|
|
410
|
+
worker: worker.name,
|
|
411
|
+
status: update.status,
|
|
412
|
+
});
|
|
413
|
+
// Drop a system-level note into the asking session's inbox.
|
|
414
|
+
// Post-008: every non-`done` terminal update is an
|
|
415
|
+
// intervention event — the pool no longer auto-retries. The
|
|
416
|
+
// payload tells the main agent which task, why it failed, and
|
|
417
|
+
// which tools are available to revive it.
|
|
418
|
+
if (this.deps.notifyParentSession && task.parentSessionId) {
|
|
419
|
+
try {
|
|
420
|
+
const finalRow = getTask(this.deps.db, task.id) ?? task;
|
|
421
|
+
if (update.status === "done") {
|
|
422
|
+
this.deps.notifyParentSession(task.parentSessionId, {
|
|
423
|
+
kind: "task_done",
|
|
424
|
+
text: `Task "${task.title}" finished. Summary: ${update.resultSummary ?? "(none)"}` +
|
|
425
|
+
(update.resultFiles && update.resultFiles.length > 0
|
|
426
|
+
? `\nFiles: ${update.resultFiles.join(", ")}`
|
|
427
|
+
: ""),
|
|
428
|
+
meta: {
|
|
429
|
+
taskId: task.id,
|
|
430
|
+
workerAgentId: worker.agentId,
|
|
431
|
+
files: update.resultFiles ?? [],
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
this.deps.notifyParentSession(task.parentSessionId, {
|
|
437
|
+
kind: "task_intervention_required",
|
|
438
|
+
text: `Task "${task.title}" needs your attention.\n` +
|
|
439
|
+
`Reason: ${update.resultSummary ?? "(no summary)"}\n` +
|
|
440
|
+
`Decide: task_continue (resume same session, optional hint), ` +
|
|
441
|
+
`task_retry_fresh (start over with a new session, optional ` +
|
|
442
|
+
`revised description), task_extend_timeout (give it more ` +
|
|
443
|
+
`wall-clock time), or task_abort (mark done with a failure ` +
|
|
444
|
+
`summary).`,
|
|
445
|
+
meta: {
|
|
446
|
+
taskId: task.id,
|
|
447
|
+
workerAgentId: worker.agentId,
|
|
448
|
+
workerKind: worker.kind,
|
|
449
|
+
attempts: finalRow.attempts,
|
|
450
|
+
sessionId: finalRow.sessionId,
|
|
451
|
+
terminalStatus: update.status,
|
|
452
|
+
interventionReason: finalRow.interventionReason,
|
|
453
|
+
suggestedActions: [
|
|
454
|
+
"task_continue",
|
|
455
|
+
"task_retry_fresh",
|
|
456
|
+
"task_extend_timeout",
|
|
457
|
+
"task_abort",
|
|
458
|
+
],
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
catch (err) {
|
|
464
|
+
// notifyParentSession is best-effort; a failure must not
|
|
465
|
+
// break the pool. Log and continue.
|
|
466
|
+
this.deps.log.warn("workboard: notifyParentSession failed", {
|
|
467
|
+
taskId: task.id,
|
|
468
|
+
err: err instanceof Error ? err.message : String(err),
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
// No automatic re-nudge on failure: the row is parked under
|
|
473
|
+
// `awaiting-intervention` and the pool's claim filter skips it
|
|
474
|
+
// until the main agent revives it explicitly. Nudging would
|
|
475
|
+
// just spin one drain pass that finds nothing.
|
|
476
|
+
}
|
|
477
|
+
recoverOrphaned() {
|
|
478
|
+
// Any task left in `in_progress` when this pool boots is by
|
|
479
|
+
// definition orphaned: the previous host process died (crash,
|
|
480
|
+
// restart, dev-time `touch index.ts`) while a worker was
|
|
481
|
+
// mid-run, and there's no in-memory busy slot to inherit.
|
|
482
|
+
//
|
|
483
|
+
// Post-008 we treat it the same way runtime failures get
|
|
484
|
+
// treated: park in `ready` + `awaiting-intervention`, write
|
|
485
|
+
// a reason, notify the parent session if any. The main agent
|
|
486
|
+
// then decides task_continue / task_retry_fresh / task_abort.
|
|
487
|
+
//
|
|
488
|
+
// session_id is intentionally NOT cleared here: the previous
|
|
489
|
+
// transcript is still useful for debugging "why did this
|
|
490
|
+
// crash?" and main agent's task_continue resumes from it.
|
|
491
|
+
const orphans = this.deps.db
|
|
492
|
+
.prepare(`SELECT id, attempts, labels, parent_session_id, title
|
|
493
|
+
FROM tasks WHERE status = 'in_progress'`)
|
|
494
|
+
.all();
|
|
495
|
+
if (orphans.length === 0)
|
|
496
|
+
return;
|
|
497
|
+
const now = Date.now();
|
|
498
|
+
const update = this.deps.db.prepare(`UPDATE tasks
|
|
499
|
+
SET status = 'ready',
|
|
500
|
+
started_at = NULL,
|
|
501
|
+
ended_at = ?,
|
|
502
|
+
attempts = ?,
|
|
503
|
+
failure_reason = ?,
|
|
504
|
+
labels = ?,
|
|
505
|
+
intervention_reason = ?,
|
|
506
|
+
intervention_at = ?
|
|
507
|
+
WHERE id = ?`);
|
|
508
|
+
const reason = "reclaimed after host restart (worker did not finish)";
|
|
509
|
+
for (const row of orphans) {
|
|
510
|
+
const nextAttempts = (row.attempts ?? 0) + 1;
|
|
511
|
+
let labels = [];
|
|
512
|
+
try {
|
|
513
|
+
const parsed = JSON.parse(row.labels);
|
|
514
|
+
if (Array.isArray(parsed)) {
|
|
515
|
+
labels = parsed.filter((l) => typeof l === "string");
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
catch {
|
|
519
|
+
labels = [];
|
|
520
|
+
}
|
|
521
|
+
const baseLabels = labels.filter((l) => l !== INTERVENTION_LABEL && l !== "stalled");
|
|
522
|
+
const nextLabels = [...baseLabels, INTERVENTION_LABEL];
|
|
523
|
+
update.run(now, nextAttempts, reason, JSON.stringify(nextLabels), reason, now, row.id);
|
|
524
|
+
// Inbox-notify the parent so the main agent picks the
|
|
525
|
+
// intervention up on its next turn rather than discovering
|
|
526
|
+
// a stuck task days later.
|
|
527
|
+
if (this.deps.notifyParentSession && row.parent_session_id) {
|
|
528
|
+
try {
|
|
529
|
+
this.deps.notifyParentSession(row.parent_session_id, {
|
|
530
|
+
kind: "task_intervention_required",
|
|
531
|
+
text: `Task "${row.title}" needs your attention.\n` +
|
|
532
|
+
`Reason: ${reason}\n` +
|
|
533
|
+
`Decide: task_continue / task_retry_fresh / ` +
|
|
534
|
+
`task_extend_timeout / task_abort.`,
|
|
535
|
+
meta: {
|
|
536
|
+
taskId: row.id,
|
|
537
|
+
attempts: nextAttempts,
|
|
538
|
+
terminalStatus: "orphaned",
|
|
539
|
+
suggestedActions: [
|
|
540
|
+
"task_continue",
|
|
541
|
+
"task_retry_fresh",
|
|
542
|
+
"task_extend_timeout",
|
|
543
|
+
"task_abort",
|
|
544
|
+
],
|
|
545
|
+
},
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
catch {
|
|
549
|
+
// best-effort
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
this.deps.log.info("workboard: reclaimed orphaned in_progress tasks", {
|
|
554
|
+
count: orphans.length,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
/** Echo worker — useful as a v0.2 demo and a regression test bed. */
|
|
559
|
+
export class EchoWorker {
|
|
560
|
+
agentId;
|
|
561
|
+
name;
|
|
562
|
+
opts;
|
|
563
|
+
kind = "echo";
|
|
564
|
+
/** Default 30s; tests pass a smaller value. */
|
|
565
|
+
constructor(agentId, name, opts = {}) {
|
|
566
|
+
this.agentId = agentId;
|
|
567
|
+
this.name = name;
|
|
568
|
+
this.opts = opts;
|
|
569
|
+
}
|
|
570
|
+
async run(task, signal) {
|
|
571
|
+
const ms = this.opts.delayMs ?? 30_000;
|
|
572
|
+
// Two cancellation sources: the constructor-level signal
|
|
573
|
+
// (tests use it to short-circuit a long sleep) and the
|
|
574
|
+
// pool-supplied per-run signal (watchdog / shutdown). Either
|
|
575
|
+
// wins.
|
|
576
|
+
const merged = mergeAbortSignals(this.opts.signal, signal);
|
|
577
|
+
try {
|
|
578
|
+
await sleep(ms, merged);
|
|
579
|
+
}
|
|
580
|
+
catch (err) {
|
|
581
|
+
// Aborted echo worker still returns a terminal update so the
|
|
582
|
+
// pool can route to intervention rather than blowing up.
|
|
583
|
+
return {
|
|
584
|
+
status: "aborted",
|
|
585
|
+
resultSummary: `Echo worker aborted: ${err instanceof Error ? err.message : String(err)}`,
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
return {
|
|
589
|
+
status: "done",
|
|
590
|
+
resultSummary: `Echo worker reflected: "${task.title}"`,
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
/** Merge an arbitrary number of AbortSignals into one. The result
|
|
595
|
+
* fires when any input fires. */
|
|
596
|
+
function mergeAbortSignals(...signals) {
|
|
597
|
+
const ctl = new AbortController();
|
|
598
|
+
for (const s of signals) {
|
|
599
|
+
if (!s)
|
|
600
|
+
continue;
|
|
601
|
+
if (s.aborted) {
|
|
602
|
+
ctl.abort();
|
|
603
|
+
return ctl.signal;
|
|
604
|
+
}
|
|
605
|
+
s.addEventListener("abort", () => {
|
|
606
|
+
try {
|
|
607
|
+
ctl.abort();
|
|
608
|
+
}
|
|
609
|
+
catch {
|
|
610
|
+
// ignore
|
|
611
|
+
}
|
|
612
|
+
}, { once: true });
|
|
613
|
+
}
|
|
614
|
+
return ctl.signal;
|
|
615
|
+
}
|
|
616
|
+
// Deny / required sets live in `./tool-policy.ts` so server seeds,
|
|
617
|
+
// the runtime pool, and the admin UI all share the same list.
|
|
618
|
+
const WORKER_DENY_TOOLS = WORKER_DENY_TOOLS_SET;
|
|
619
|
+
/**
|
|
620
|
+
* Combine the user-supplied `toolsAllow` (per-agent allow-list) with
|
|
621
|
+
* the worker-wide deny-list and required-list above.
|
|
622
|
+
*
|
|
623
|
+
* - cfg.toolsAllow == null → "all tools". The runner sees an
|
|
624
|
+
* undefined allow-list (= no narrowing) and `toolsDeny` does the
|
|
625
|
+
* scrubbing. task_complete is automatically in the all-tools
|
|
626
|
+
* set, so we don't need to inject it here.
|
|
627
|
+
* - cfg.toolsAllow is a list → strip the deny set from it AND
|
|
628
|
+
* ensure the required-set is present, so the user can't
|
|
629
|
+
* accidentally lock the worker out of its own exit hatch.
|
|
630
|
+
*
|
|
631
|
+
* NOTE: the deny set is enforced again inside `agent-loop.ts` so the
|
|
632
|
+
* pool agent and the loop are belt-and-braces protected.
|
|
633
|
+
*/
|
|
634
|
+
export function effectiveToolsAllow(cfgToolsAllow) {
|
|
635
|
+
if (!cfgToolsAllow)
|
|
636
|
+
return undefined;
|
|
637
|
+
const filtered = cfgToolsAllow.filter((t) => !WORKER_DENY_TOOLS.has(t));
|
|
638
|
+
// Force-inject required tools the user may have omitted. We add
|
|
639
|
+
// rather than replace so the rest of their curated allow-list
|
|
640
|
+
// stays intact.
|
|
641
|
+
for (const t of WORKER_REQUIRED_TOOLS) {
|
|
642
|
+
if (!filtered.includes(t))
|
|
643
|
+
filtered.push(t);
|
|
644
|
+
}
|
|
645
|
+
return filtered;
|
|
646
|
+
}
|
|
647
|
+
export class LLMWorker {
|
|
648
|
+
cfg;
|
|
649
|
+
kind = "llm";
|
|
650
|
+
agentId;
|
|
651
|
+
name;
|
|
652
|
+
constructor(cfg) {
|
|
653
|
+
this.cfg = cfg;
|
|
654
|
+
this.agentId = cfg.agentId;
|
|
655
|
+
this.name = cfg.name;
|
|
656
|
+
}
|
|
657
|
+
async run(task, signal) {
|
|
658
|
+
const userId = task.ownerUserId || this.cfg.defaultUserId;
|
|
659
|
+
// Resume vs. fresh-start:
|
|
660
|
+
// - First time the row is seen (attempts=0) or no
|
|
661
|
+
// session_id captured yet → fresh session, full brief.
|
|
662
|
+
// - attempts>0 with a session_id → either main agent
|
|
663
|
+
// called task_continue (which set session_continuation_hint)
|
|
664
|
+
// or task_retry_fresh (which cleared session_id, so we
|
|
665
|
+
// don't enter this branch). Resume the prior session and
|
|
666
|
+
// pass a short nudge instead of re-pasting the brief.
|
|
667
|
+
const shouldResume = (task.attempts ?? 0) > 0 && Boolean(task.sessionId);
|
|
668
|
+
const initialUserMessage = shouldResume
|
|
669
|
+
? buildContinuationPrompt(task)
|
|
670
|
+
: buildInitialPrompt(task);
|
|
671
|
+
const result = await this.cfg.runner.run({
|
|
672
|
+
userId,
|
|
673
|
+
signal,
|
|
674
|
+
initialUserMessage,
|
|
675
|
+
systemPrompt: this.cfg.systemPrompt ?? undefined,
|
|
676
|
+
modelId: this.cfg.modelId ?? undefined,
|
|
677
|
+
toolsAllow: effectiveToolsAllow(this.cfg.toolsAllow),
|
|
678
|
+
toolsDeny: [...WORKER_DENY_TOOLS_LIST],
|
|
679
|
+
skillsAllow: this.cfg.skillsAllow ?? undefined,
|
|
680
|
+
sessionTitle: task.title,
|
|
681
|
+
workerRole: this.kind,
|
|
682
|
+
// The fs migration uses the agent id as the directory slug
|
|
683
|
+
// (see plugin/workboard/src/fs-worker-agents.ts:toWorkerAgent).
|
|
684
|
+
// Forward it so tenant_config_write knows which workers/<slug>/
|
|
685
|
+
// bundle this run owns.
|
|
686
|
+
workerSlug: this.cfg.agentId,
|
|
687
|
+
timeouts: this.cfg.timeouts,
|
|
688
|
+
// Resume the prior conversation when continuing so the LLM
|
|
689
|
+
// sees its own earlier work + tool results, doesn't waste
|
|
690
|
+
// a full re-research cycle, and — critically for the user
|
|
691
|
+
// — the kanban Execution dialog shows one continuous
|
|
692
|
+
// transcript across attempts instead of N independent
|
|
693
|
+
// session windows.
|
|
694
|
+
resumeSessionId: shouldResume ? task.sessionId ?? undefined : undefined,
|
|
695
|
+
// Per-task sandbox: the host pipes this through to
|
|
696
|
+
// `AgentToolContext.taskId`; microsandbox routes `exec`
|
|
697
|
+
// calls under this task to its dedicated sandbox.
|
|
698
|
+
taskId: task.id,
|
|
699
|
+
// Stamp the session id on the task row as soon as the host
|
|
700
|
+
// creates the session, not when the run terminates. The
|
|
701
|
+
// kanban Execution tab tails this in-progress conversation
|
|
702
|
+
// via /tasks/:id/history; without an early stamp the tab
|
|
703
|
+
// can't find a session id until the LLM finishes.
|
|
704
|
+
onSessionStart: (sessionId) => {
|
|
705
|
+
try {
|
|
706
|
+
updateTask(this.cfg.db, task.id, { sessionId });
|
|
707
|
+
}
|
|
708
|
+
catch (err) {
|
|
709
|
+
this.cfg.log.warn("workboard: stamp sessionId on task failed", {
|
|
710
|
+
taskId: task.id,
|
|
711
|
+
err: err instanceof Error ? err.message : String(err),
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
// Bind the freshly-created worker session to this task
|
|
715
|
+
// so per-task sandbox tooling (microsandbox `exec`) can
|
|
716
|
+
// resolve `ctx.sessionId → taskId → sandbox` in addition to
|
|
717
|
+
// the explicit `ctx.taskId` path.
|
|
718
|
+
if (this.cfg.taskPool) {
|
|
719
|
+
try {
|
|
720
|
+
this.cfg.taskPool.bindSession(sessionId, task.id);
|
|
721
|
+
}
|
|
722
|
+
catch (err) {
|
|
723
|
+
this.cfg.log.warn("workboard: taskPool.bindSession failed", {
|
|
724
|
+
taskId: task.id,
|
|
725
|
+
sessionId,
|
|
726
|
+
err: err instanceof Error ? err.message : String(err),
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
},
|
|
731
|
+
});
|
|
732
|
+
this.cfg.log.info("llm worker terminal", {
|
|
733
|
+
agentId: this.agentId,
|
|
734
|
+
taskId: task.id,
|
|
735
|
+
status: result.status,
|
|
736
|
+
reason: result.reason,
|
|
737
|
+
sessionId: result.sessionId,
|
|
738
|
+
turns: result.turns,
|
|
739
|
+
});
|
|
740
|
+
if (result.status === "done") {
|
|
741
|
+
return {
|
|
742
|
+
status: "done",
|
|
743
|
+
resultSummary: result.summary,
|
|
744
|
+
resultFiles: result.files,
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
if (result.status === "aborted") {
|
|
748
|
+
// Distinguish three abort sources for the intervention text:
|
|
749
|
+
// 1. watchdog stamped a `failureReason` before aborting
|
|
750
|
+
// — the row already carries the message; just echo
|
|
751
|
+
// something concise here.
|
|
752
|
+
// 2. shutdown / explicit cancel without a reason — keep
|
|
753
|
+
// the runner's own summary.
|
|
754
|
+
// Either way the row ends up in awaiting-intervention.
|
|
755
|
+
const fresh = getTask(this.cfg.db, task.id);
|
|
756
|
+
const watchdogReason = fresh?.failureReason;
|
|
757
|
+
return {
|
|
758
|
+
status: "aborted",
|
|
759
|
+
resultSummary: watchdogReason ?? result.summary ?? "aborted",
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
// stalled / error → stalled (keeps task on the kanban so the
|
|
763
|
+
// user can see the failure and decide whether to retry).
|
|
764
|
+
return {
|
|
765
|
+
status: "stalled",
|
|
766
|
+
resultSummary: `[${result.reason}] ${result.summary}`.slice(0, 800) ||
|
|
767
|
+
"worker stalled",
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
function buildInitialPrompt(task) {
|
|
772
|
+
const lines = [`Execute the task: "${task.title}".`];
|
|
773
|
+
if (task.description && task.description.trim()) {
|
|
774
|
+
lines.push("", `Details:`, task.description.trim());
|
|
775
|
+
}
|
|
776
|
+
lines.push("", `When you finish, call the \`task_complete\` tool with a one-line ` +
|
|
777
|
+
`\`summary\` of what you produced and (optional) a list of \`files\` ` +
|
|
778
|
+
`you wrote. Don't reply with prose alone — the orchestrator only sees ` +
|
|
779
|
+
`the summary you pass to task_complete.`);
|
|
780
|
+
return lines.join("\n");
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Prompt used when the main agent revives a task via
|
|
784
|
+
* task_continue and we resume the prior session. The LLM already
|
|
785
|
+
* sees its earlier turns + tool results in context, so this is a
|
|
786
|
+
* thin nudge — plus the optional hint the main agent attached.
|
|
787
|
+
*
|
|
788
|
+
* Why we don't repeat the full brief: it's at the top of the
|
|
789
|
+
* resumed transcript. Repeating inflates context and risks the
|
|
790
|
+
* worker treating it as a fresh task, undoing prior progress.
|
|
791
|
+
*/
|
|
792
|
+
function buildContinuationPrompt(task) {
|
|
793
|
+
const reason = task.interventionReason ?? task.failureReason;
|
|
794
|
+
const lines = [
|
|
795
|
+
`(continuing from prior session; attempt #${(task.attempts ?? 0) + 1})`,
|
|
796
|
+
"",
|
|
797
|
+
];
|
|
798
|
+
if (reason) {
|
|
799
|
+
lines.push(`The previous run did not finish cleanly. Recorded reason:`);
|
|
800
|
+
lines.push(reason.slice(0, 400));
|
|
801
|
+
lines.push("");
|
|
802
|
+
}
|
|
803
|
+
// The main agent may have appended a hint via task.description
|
|
804
|
+
// before re-queueing (task_continue forwards the hint into a
|
|
805
|
+
// dedicated marker block). Surface it loud and clear.
|
|
806
|
+
const hint = extractContinuationHint(task.description);
|
|
807
|
+
if (hint) {
|
|
808
|
+
lines.push(`Operator note: ${hint}`);
|
|
809
|
+
lines.push("");
|
|
810
|
+
}
|
|
811
|
+
lines.push(`Continue from where you left off. If the work is actually done, ` +
|
|
812
|
+
`call \`task_complete\` with a one-line summary now — the ` +
|
|
813
|
+
`orchestrator only counts a task as finished when you call ` +
|
|
814
|
+
`that tool.`);
|
|
815
|
+
return lines.join("\n");
|
|
816
|
+
}
|
|
817
|
+
const CONTINUATION_HINT_BEGIN = "<!-- continuation-hint -->";
|
|
818
|
+
const CONTINUATION_HINT_END = "<!-- /continuation-hint -->";
|
|
819
|
+
export function extractContinuationHint(description) {
|
|
820
|
+
if (!description)
|
|
821
|
+
return null;
|
|
822
|
+
const start = description.lastIndexOf(CONTINUATION_HINT_BEGIN);
|
|
823
|
+
if (start < 0)
|
|
824
|
+
return null;
|
|
825
|
+
const end = description.indexOf(CONTINUATION_HINT_END, start);
|
|
826
|
+
if (end < 0)
|
|
827
|
+
return null;
|
|
828
|
+
return description
|
|
829
|
+
.slice(start + CONTINUATION_HINT_BEGIN.length, end)
|
|
830
|
+
.trim() || null;
|
|
831
|
+
}
|
|
832
|
+
export function appendContinuationHint(description, hint) {
|
|
833
|
+
// Wipe any previous hint marker so we don't accumulate stale
|
|
834
|
+
// notes across multiple task_continue calls.
|
|
835
|
+
const cleaned = stripContinuationHint(description ?? "");
|
|
836
|
+
const block = `${CONTINUATION_HINT_BEGIN}\n${hint.trim()}\n${CONTINUATION_HINT_END}`;
|
|
837
|
+
return cleaned ? `${cleaned.trimEnd()}\n\n${block}` : block;
|
|
838
|
+
}
|
|
839
|
+
export function stripContinuationHint(description) {
|
|
840
|
+
const start = description.lastIndexOf(CONTINUATION_HINT_BEGIN);
|
|
841
|
+
if (start < 0)
|
|
842
|
+
return description;
|
|
843
|
+
const end = description.indexOf(CONTINUATION_HINT_END, start);
|
|
844
|
+
if (end < 0)
|
|
845
|
+
return description;
|
|
846
|
+
return (description.slice(0, start) +
|
|
847
|
+
description.slice(end + CONTINUATION_HINT_END.length)).replace(/\n{3,}/g, "\n\n");
|
|
848
|
+
}
|
|
849
|
+
function sleep(ms, signal) {
|
|
850
|
+
return new Promise((resolve, reject) => {
|
|
851
|
+
if (signal?.aborted) {
|
|
852
|
+
reject(new Error("aborted"));
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const t = setTimeout(() => {
|
|
856
|
+
signal?.removeEventListener("abort", onAbort);
|
|
857
|
+
resolve();
|
|
858
|
+
}, ms);
|
|
859
|
+
const onAbort = () => {
|
|
860
|
+
clearTimeout(t);
|
|
861
|
+
reject(new Error("aborted"));
|
|
862
|
+
};
|
|
863
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
//# sourceMappingURL=pool.js.map
|