@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,52 @@
|
|
|
1
|
+
// Migration 004 — rebuild every session's message chain into a
|
|
2
|
+
// strict linked list ordered by (created_at ASC, rowid ASC).
|
|
3
|
+
//
|
|
4
|
+
// Why this exists: migration 003 set up the chain correctly for
|
|
5
|
+
// legacy rows, but the first cut of N+6.4 had a bug in
|
|
6
|
+
// SqliteSessionStorage.appendEntry that left `sessions.leaf_id`
|
|
7
|
+
// pointing at the previous turn's leaf for every new row — so all
|
|
8
|
+
// entries written between N+6.4 deploy and the leaf-id fix landed
|
|
9
|
+
// share the SAME parent (a fan-out), and `getPathToRoot` only
|
|
10
|
+
// walked the most recent branch.
|
|
11
|
+
//
|
|
12
|
+
// `getPathToRoot` had a splice fallback that papered over this for
|
|
13
|
+
// reads, but the fan stayed in the DB. Rather than carry the
|
|
14
|
+
// fallback forever, this migration rewrites every parent_id to
|
|
15
|
+
// point at the predecessor row in chronological order. This is
|
|
16
|
+
// safe for already-chained sessions (we just re-write the same
|
|
17
|
+
// values) and idempotent in practice — re-running on a chain that
|
|
18
|
+
// is already correct is a no-op.
|
|
19
|
+
//
|
|
20
|
+
// We also re-stamp `sessions.leaf_id` to the chronologically last
|
|
21
|
+
// row in case it drifted: pi's harness reads leaf_id at run-start,
|
|
22
|
+
// so an out-of-date pointer would make new turns parent off the
|
|
23
|
+
// wrong row.
|
|
24
|
+
export const ID = "004-rebuild-message-chain";
|
|
25
|
+
export function up(db) {
|
|
26
|
+
const sessions = db
|
|
27
|
+
.prepare(`SELECT id FROM sessions`)
|
|
28
|
+
.all();
|
|
29
|
+
const selectMsgs = db.prepare(`SELECT id FROM messages
|
|
30
|
+
WHERE session_id = ?
|
|
31
|
+
ORDER BY created_at ASC, rowid ASC`);
|
|
32
|
+
const updateParent = db.prepare(`UPDATE messages SET parent_id = ? WHERE id = ?`);
|
|
33
|
+
const updateLeaf = db.prepare(`UPDATE sessions SET leaf_id = ? WHERE id = ?`);
|
|
34
|
+
for (const s of sessions) {
|
|
35
|
+
const ids = selectMsgs.all(s.id);
|
|
36
|
+
if (ids.length === 0) {
|
|
37
|
+
// Session had no messages — clear leaf_id if it was somehow
|
|
38
|
+
// set, otherwise nothing to do.
|
|
39
|
+
updateLeaf.run(null, s.id);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
let prev = null;
|
|
43
|
+
for (const row of ids) {
|
|
44
|
+
// First row gets parent_id=NULL; every subsequent row points
|
|
45
|
+
// at the row immediately before it in chronological order.
|
|
46
|
+
updateParent.run(prev, row.id);
|
|
47
|
+
prev = row.id;
|
|
48
|
+
}
|
|
49
|
+
updateLeaf.run(prev, s.id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=004-rebuild-message-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"004-rebuild-message-chain.js","sourceRoot":"","sources":["../../../src/core/migrations/004-rebuild-message-chain.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,6DAA6D;AAC7D,EAAE;AACF,gEAAgE;AAChE,uDAAuD;AACvD,gEAAgE;AAChE,kEAAkE;AAClE,kEAAkE;AAClE,8DAA8D;AAC9D,iCAAiC;AACjC,EAAE;AACF,mEAAmE;AACnE,6DAA6D;AAC7D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,kEAAkE;AAClE,iCAAiC;AACjC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,gEAAgE;AAChE,aAAa;AAIb,MAAM,CAAC,MAAM,EAAE,GAAG,2BAA2B,CAAC;AAE9C,MAAM,UAAU,EAAE,CAAC,EAAY;IAC7B,MAAM,QAAQ,GAAG,EAAE;SAChB,OAAO,CAAqB,yBAAyB,CAAC;SACtD,GAAG,EAAE,CAAC;IACT,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAC3B;;wCAEoC,CACrC,CAAC;IACF,MAAM,YAAY,GAAG,EAAE,CAAC,OAAO,CAC7B,gDAAgD,CACjD,CAAC;IACF,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAC3B,8CAA8C,CAC/C,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,4DAA4D;YAC5D,gCAAgC;YAChC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,IAAI,IAAI,GAAkB,IAAI,CAAC;QAC/B,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACtB,6DAA6D;YAC7D,2DAA2D;YAC3D,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;YAC/B,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QAChB,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"005-task-status-rename.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/005-task-status-rename.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,EAAE,2BAA2B,CAAC;AAS3C,wBAAgB,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA+BrC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Migration 005 — rename `todo` → `ready`, fold `aborted` into
|
|
2
|
+
// `ready`, add `failure_reason` + `attempts` columns for the retry
|
|
3
|
+
// loop.
|
|
4
|
+
//
|
|
5
|
+
// Why:
|
|
6
|
+
// - "todo" is what humans put on a kanban; this board feeds a
|
|
7
|
+
// worker pool, so "ready" (ready-to-claim) is the accurate
|
|
8
|
+
// semantics. Matches the design used by the closed-source
|
|
9
|
+
// predecessor.
|
|
10
|
+
// - "aborted" was a separate persistent state that we never
|
|
11
|
+
// showed by default (UI archived it). After the
|
|
12
|
+
// agent-frameworks-research run we found agents can
|
|
13
|
+
// legitimately abort mid-flight (timeout, external cancel) —
|
|
14
|
+
// the right action is to put the task back in the queue with
|
|
15
|
+
// a failure note, not bury it.
|
|
16
|
+
// - "stalled" survives, but only as the FINAL graveyard for
|
|
17
|
+
// tasks that have failed `MAX_ATTEMPTS` times. Worker pool
|
|
18
|
+
// puts a fresh failure back to `ready` and bumps `attempts`.
|
|
19
|
+
//
|
|
20
|
+
// `failure_reason` carries the last error string so the UI can
|
|
21
|
+
// render a "⚠️ failed N times: <reason>" badge on the card.
|
|
22
|
+
//
|
|
23
|
+
// Idempotent: re-running on already-migrated data is a no-op
|
|
24
|
+
// because the UPDATEs target only the obsolete status values and
|
|
25
|
+
// the ALTER TABLE adds use IF NOT EXISTS semantics via a column
|
|
26
|
+
// presence check.
|
|
27
|
+
export const ID = "005-task-status-rename";
|
|
28
|
+
function hasColumn(db, table, column) {
|
|
29
|
+
const cols = db
|
|
30
|
+
.prepare(`PRAGMA table_info(${table})`)
|
|
31
|
+
.all();
|
|
32
|
+
return cols.some((c) => c.name === column);
|
|
33
|
+
}
|
|
34
|
+
export function up(db) {
|
|
35
|
+
// 1. Add new columns if they don't exist yet.
|
|
36
|
+
if (!hasColumn(db, "tasks", "failure_reason")) {
|
|
37
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN failure_reason TEXT`);
|
|
38
|
+
}
|
|
39
|
+
if (!hasColumn(db, "tasks", "attempts")) {
|
|
40
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN attempts INTEGER NOT NULL DEFAULT 0`);
|
|
41
|
+
}
|
|
42
|
+
// 2. Rename status values. `aborted` rows had no useful
|
|
43
|
+
// information beyond "the worker bailed", so we fold them
|
|
44
|
+
// into `ready` with a failure_reason so the user can see
|
|
45
|
+
// what happened. Tasks already at status='aborted' usually
|
|
46
|
+
// have a `result_summary` containing the abort reason; copy
|
|
47
|
+
// it across.
|
|
48
|
+
db.exec(`
|
|
49
|
+
UPDATE tasks
|
|
50
|
+
SET status = 'ready'
|
|
51
|
+
WHERE status = 'todo';
|
|
52
|
+
`);
|
|
53
|
+
db.exec(`
|
|
54
|
+
UPDATE tasks
|
|
55
|
+
SET status = 'ready',
|
|
56
|
+
failure_reason = COALESCE(failure_reason, result_summary)
|
|
57
|
+
WHERE status = 'aborted';
|
|
58
|
+
`);
|
|
59
|
+
// 3. NB: the index on `status` (idx_tasks_status_priority)
|
|
60
|
+
// keeps working unchanged — SQLite stores text values
|
|
61
|
+
// directly in the index, no rebuild needed when a few rows
|
|
62
|
+
// change.
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=005-task-status-rename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"005-task-status-rename.js","sourceRoot":"","sources":["../../../src/core/migrations/005-task-status-rename.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,mEAAmE;AACnE,QAAQ;AACR,EAAE;AACF,OAAO;AACP,gEAAgE;AAChE,+DAA+D;AAC/D,8DAA8D;AAC9D,mBAAmB;AACnB,8DAA8D;AAC9D,oDAAoD;AACpD,wDAAwD;AACxD,iEAAiE;AACjE,iEAAiE;AACjE,mCAAmC;AACnC,8DAA8D;AAC9D,+DAA+D;AAC/D,iEAAiE;AACjE,EAAE;AACF,+DAA+D;AAC/D,4DAA4D;AAC5D,EAAE;AACF,6DAA6D;AAC7D,iEAAiE;AACjE,gEAAgE;AAChE,kBAAkB;AAIlB,MAAM,CAAC,MAAM,EAAE,GAAG,wBAAwB,CAAC;AAE3C,SAAS,SAAS,CAAC,EAAY,EAAE,KAAa,EAAE,MAAc;IAC5D,MAAM,IAAI,GAAG,EAAE;SACZ,OAAO,CAAuB,qBAAqB,KAAK,GAAG,CAAC;SAC5D,GAAG,EAAE,CAAC;IACT,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,EAAE,CAAC,EAAY;IAC7B,8CAA8C;IAC9C,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC;QAC9C,EAAE,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC;QACxC,EAAE,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;IAC9E,CAAC;IAED,wDAAwD;IACxD,6DAA6D;IAC7D,4DAA4D;IAC5D,8DAA8D;IAC9D,+DAA+D;IAC/D,gBAAgB;IAChB,EAAE,CAAC,IAAI,CAAC;;;;GAIP,CAAC,CAAC;IACH,EAAE,CAAC,IAAI,CAAC;;;;;GAKP,CAAC,CAAC;IAEH,2DAA2D;IAC3D,yDAAyD;IACzD,8DAA8D;IAC9D,aAAa;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"006-task-labels.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/006-task-labels.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,EAAE,oBAAoB,CAAC;AASpC,wBAAgB,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAerC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Migration 006 — turn the `stalled` task STATUS into a `stalled` LABEL.
|
|
2
|
+
//
|
|
3
|
+
// 005 made `stalled` the final-failure column. Yu cross-checked
|
|
4
|
+
// against the closed-source predecessor and pointed out it gets
|
|
5
|
+
// the model wrong: there, `stalled` (and `draft`, and short-term
|
|
6
|
+
// `failed`) are TAGS on otherwise-normal tasks, not separate
|
|
7
|
+
// columns. The kanban only ever shows ready/in-progress/done; a
|
|
8
|
+
// failed task lives in `ready` with a `stalled` label, and the
|
|
9
|
+
// scheduler skips ready+stalled rows when picking work.
|
|
10
|
+
//
|
|
11
|
+
// Why this matters: a 4th column ("Stalled") is hidden behind a
|
|
12
|
+
// toggle, so failed tasks vanish from the user's mental
|
|
13
|
+
// kanban. With a label, the failure stays visible in the same
|
|
14
|
+
// place the task already lives — UI can paint a ⚠️ badge.
|
|
15
|
+
//
|
|
16
|
+
// Schema:
|
|
17
|
+
// - tasks.labels TEXT NOT NULL DEFAULT '[]' (JSON array of strings)
|
|
18
|
+
// - existing rows with status='stalled' → status='ready' + labels=['stalled']
|
|
19
|
+
//
|
|
20
|
+
// Idempotent. The column-presence check guards re-runs.
|
|
21
|
+
export const ID = "006-task-labels";
|
|
22
|
+
function hasColumn(db, table, column) {
|
|
23
|
+
const cols = db
|
|
24
|
+
.prepare(`PRAGMA table_info(${table})`)
|
|
25
|
+
.all();
|
|
26
|
+
return cols.some((c) => c.name === column);
|
|
27
|
+
}
|
|
28
|
+
export function up(db) {
|
|
29
|
+
if (!hasColumn(db, "tasks", "labels")) {
|
|
30
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN labels TEXT NOT NULL DEFAULT '[]'`);
|
|
31
|
+
}
|
|
32
|
+
// Existing stalled rows become ready+labels=['stalled']. Note we
|
|
33
|
+
// overwrite labels rather than append because before this migration
|
|
34
|
+
// the column didn't exist (default ''[]'' applied per row); a
|
|
35
|
+
// user-stamped label would have been impossible.
|
|
36
|
+
db.exec(`
|
|
37
|
+
UPDATE tasks
|
|
38
|
+
SET labels = '["stalled"]',
|
|
39
|
+
status = 'ready'
|
|
40
|
+
WHERE status = 'stalled';
|
|
41
|
+
`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=006-task-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"006-task-labels.js","sourceRoot":"","sources":["../../../src/core/migrations/006-task-labels.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,gEAAgE;AAChE,gEAAgE;AAChE,iEAAiE;AACjE,6DAA6D;AAC7D,gEAAgE;AAChE,+DAA+D;AAC/D,wDAAwD;AACxD,EAAE;AACF,gEAAgE;AAChE,wDAAwD;AACxD,8DAA8D;AAC9D,0DAA0D;AAC1D,EAAE;AACF,UAAU;AACV,uEAAuE;AACvE,gFAAgF;AAChF,EAAE;AACF,wDAAwD;AAIxD,MAAM,CAAC,MAAM,EAAE,GAAG,iBAAiB,CAAC;AAEpC,SAAS,SAAS,CAAC,EAAY,EAAE,KAAa,EAAE,MAAc;IAC5D,MAAM,IAAI,GAAG,EAAE;SACZ,OAAO,CAAuB,qBAAqB,KAAK,GAAG,CAAC;SAC5D,GAAG,EAAE,CAAC;IACT,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,EAAE,CAAC,EAAY;IAC7B,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtC,EAAE,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IAC5E,CAAC;IAED,iEAAiE;IACjE,oEAAoE;IACpE,8DAA8D;IAC9D,iDAAiD;IACjD,EAAE,CAAC,IAAI,CAAC;;;;;GAKP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"007-session-inbox.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/007-session-inbox.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,EAAE,sBAAsB,CAAC;AAkBtC,wBAAgB,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAmBrC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Migration 007 — session inbox + tasks.parent_session_id.
|
|
2
|
+
//
|
|
3
|
+
// Why we need this:
|
|
4
|
+
// When a chat session calls `task_create` to delegate work to a
|
|
5
|
+
// worker, the resulting kanban task has, until now, no link
|
|
6
|
+
// back to *which* session asked for it. So when the worker
|
|
7
|
+
// finishes (done) or fails (stalled), nobody can tell the
|
|
8
|
+
// asking agent — the agent has to keep polling task_get_history
|
|
9
|
+
// to find out.
|
|
10
|
+
//
|
|
11
|
+
// Yu wants the OpenClaw model: when the worker terminates, drop
|
|
12
|
+
// a message into the parent session's inbox. If that session
|
|
13
|
+
// currently has an active turn running, the inbox dispatcher
|
|
14
|
+
// forwards the message to `harness.followUp(...)`; if the
|
|
15
|
+
// session is idle, the message sits in the inbox until the next
|
|
16
|
+
// user turn flushes it as a system-note prefix.
|
|
17
|
+
//
|
|
18
|
+
// Schema:
|
|
19
|
+
// tasks.parent_session_id TEXT NULL
|
|
20
|
+
// The session that asked for the task. NULL for tasks created
|
|
21
|
+
// outside a chat session (kanban UI add button, REST API).
|
|
22
|
+
//
|
|
23
|
+
// session_inbox
|
|
24
|
+
// id TEXT PRIMARY KEY
|
|
25
|
+
// target_session_id TEXT NOT NULL
|
|
26
|
+
// payload TEXT NOT NULL (JSON; { kind, text, ...meta })
|
|
27
|
+
// status TEXT NOT NULL ('pending' | 'delivered')
|
|
28
|
+
// created_at INTEGER NOT NULL
|
|
29
|
+
// delivered_at INTEGER NULL
|
|
30
|
+
//
|
|
31
|
+
// Index on (target_session_id, status, created_at) so the
|
|
32
|
+
// pending-flush query (drainPending) is a single index seek.
|
|
33
|
+
//
|
|
34
|
+
// Idempotent: column / table presence is checked before the DDL.
|
|
35
|
+
export const ID = "007-session-inbox";
|
|
36
|
+
function hasColumn(db, table, column) {
|
|
37
|
+
const cols = db
|
|
38
|
+
.prepare(`PRAGMA table_info(${table})`)
|
|
39
|
+
.all();
|
|
40
|
+
return cols.some((c) => c.name === column);
|
|
41
|
+
}
|
|
42
|
+
function hasTable(db, name) {
|
|
43
|
+
const row = db
|
|
44
|
+
.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name=?`)
|
|
45
|
+
.get(name);
|
|
46
|
+
return Boolean(row);
|
|
47
|
+
}
|
|
48
|
+
export function up(db) {
|
|
49
|
+
if (!hasColumn(db, "tasks", "parent_session_id")) {
|
|
50
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN parent_session_id TEXT`);
|
|
51
|
+
}
|
|
52
|
+
if (!hasTable(db, "session_inbox")) {
|
|
53
|
+
db.exec(`
|
|
54
|
+
CREATE TABLE session_inbox (
|
|
55
|
+
id TEXT PRIMARY KEY,
|
|
56
|
+
target_session_id TEXT NOT NULL,
|
|
57
|
+
payload TEXT NOT NULL,
|
|
58
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
59
|
+
created_at INTEGER NOT NULL,
|
|
60
|
+
delivered_at INTEGER
|
|
61
|
+
);
|
|
62
|
+
CREATE INDEX idx_session_inbox_pending
|
|
63
|
+
ON session_inbox(target_session_id, status, created_at);
|
|
64
|
+
`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=007-session-inbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"007-session-inbox.js","sourceRoot":"","sources":["../../../src/core/migrations/007-session-inbox.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,oBAAoB;AACpB,kEAAkE;AAClE,8DAA8D;AAC9D,6DAA6D;AAC7D,4DAA4D;AAC5D,kEAAkE;AAClE,iBAAiB;AACjB,EAAE;AACF,kEAAkE;AAClE,+DAA+D;AAC/D,+DAA+D;AAC/D,4DAA4D;AAC5D,kEAAkE;AAClE,kDAAkD;AAClD,EAAE;AACF,UAAU;AACV,uCAAuC;AACvC,kEAAkE;AAClE,+DAA+D;AAC/D,EAAE;AACF,kBAAkB;AAClB,4CAA4C;AAC5C,yCAAyC;AACzC,0EAA0E;AAC1E,oEAAoE;AACpE,2CAA2C;AAC3C,uCAAuC;AACvC,EAAE;AACF,4DAA4D;AAC5D,+DAA+D;AAC/D,EAAE;AACF,iEAAiE;AAIjE,MAAM,CAAC,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAEtC,SAAS,SAAS,CAAC,EAAY,EAAE,KAAa,EAAE,MAAc;IAC5D,MAAM,IAAI,GAAG,EAAE;SACZ,OAAO,CAAuB,qBAAqB,KAAK,GAAG,CAAC;SAC5D,GAAG,EAAE,CAAC;IACT,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,EAAY,EAAE,IAAY;IAC1C,MAAM,GAAG,GAAG,EAAE;SACX,OAAO,CACN,8DAA8D,CAC/D;SACA,GAAG,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,EAAE,CAAC,EAAY;IAC7B,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,mBAAmB,CAAC,EAAE,CAAC;QACjD,EAAE,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC;QACnC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;KAWP,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"008-task-intervention.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/008-task-intervention.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,EAAE,0BAA0B,CAAC;AAS1C,wBAAgB,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAYrC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Migration 008 — task intervention model.
|
|
2
|
+
//
|
|
3
|
+
// Replaces the auto-retry-up-to-MAX_ATTEMPTS loop with an
|
|
4
|
+
// "awaiting-intervention" model: any failure (worker error,
|
|
5
|
+
// stream tear, no_completion) parks the task in ready+
|
|
6
|
+
// awaiting-intervention label and asks the parent (main) agent
|
|
7
|
+
// what to do next. The pool no longer re-queues automatically.
|
|
8
|
+
//
|
|
9
|
+
// New columns on `tasks`:
|
|
10
|
+
//
|
|
11
|
+
// timeout_ms INTEGER NOT NULL DEFAULT 600000
|
|
12
|
+
// Per-task budget. The worker pool starts a soft watchdog at
|
|
13
|
+
// `started_at + timeout_ms`; on overrun it cancels the
|
|
14
|
+
// worker run and routes to intervention. Main agent can
|
|
15
|
+
// extend by calling task_extend_timeout. Default 10 minutes
|
|
16
|
+
// matches the previous unspoken "if it hasn't finished by
|
|
17
|
+
// now, something's wrong" behaviour.
|
|
18
|
+
//
|
|
19
|
+
// intervention_reason TEXT
|
|
20
|
+
// Free-text human-readable description of why the task is
|
|
21
|
+
// awaiting intervention. Populated when the pool stamps the
|
|
22
|
+
// `awaiting-intervention` label; cleared on a fresh claim.
|
|
23
|
+
// Examples: "worker stream terminated mid tool call",
|
|
24
|
+
// "worker timed out after 10m / extend or abort?",
|
|
25
|
+
// "worker called task_complete with status=stalled".
|
|
26
|
+
//
|
|
27
|
+
// intervention_at INTEGER
|
|
28
|
+
// ms timestamp the row entered the intervention state. Used
|
|
29
|
+
// by the UI to surface "stuck for 5 min" badges and by the
|
|
30
|
+
// pool to decide whether the row is fresh enough to retry
|
|
31
|
+
// automatically (it never is — but having the timestamp lets
|
|
32
|
+
// us add expiry policies later without another migration).
|
|
33
|
+
//
|
|
34
|
+
// All three columns are nullable / defaulted, so the migration
|
|
35
|
+
// is backwards-compatible: existing rows just get the defaults.
|
|
36
|
+
//
|
|
37
|
+
// We do NOT drop the `attempts` column. It's still useful as a
|
|
38
|
+
// read-only counter ("how many times has main agent reset this")
|
|
39
|
+
// and the pool still increments it on every fresh claim. The
|
|
40
|
+
// behaviour change is that `attempts >= MAX_ATTEMPTS` no longer
|
|
41
|
+
// triggers anything.
|
|
42
|
+
export const ID = "008-task-intervention";
|
|
43
|
+
function hasColumn(db, table, column) {
|
|
44
|
+
const cols = db
|
|
45
|
+
.prepare(`PRAGMA table_info(${table})`)
|
|
46
|
+
.all();
|
|
47
|
+
return cols.some((c) => c.name === column);
|
|
48
|
+
}
|
|
49
|
+
export function up(db) {
|
|
50
|
+
if (!hasColumn(db, "tasks", "timeout_ms")) {
|
|
51
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN timeout_ms INTEGER NOT NULL DEFAULT 600000`);
|
|
52
|
+
}
|
|
53
|
+
if (!hasColumn(db, "tasks", "intervention_reason")) {
|
|
54
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN intervention_reason TEXT`);
|
|
55
|
+
}
|
|
56
|
+
if (!hasColumn(db, "tasks", "intervention_at")) {
|
|
57
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN intervention_at INTEGER`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=008-task-intervention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"008-task-intervention.js","sourceRoot":"","sources":["../../../src/core/migrations/008-task-intervention.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,0DAA0D;AAC1D,4DAA4D;AAC5D,uDAAuD;AACvD,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,0BAA0B;AAC1B,EAAE;AACF,wDAAwD;AACxD,iEAAiE;AACjE,2DAA2D;AAC3D,4DAA4D;AAC5D,gEAAgE;AAChE,8DAA8D;AAC9D,yCAAyC;AACzC,EAAE;AACF,6BAA6B;AAC7B,8DAA8D;AAC9D,gEAAgE;AAChE,+DAA+D;AAC/D,0DAA0D;AAC1D,uDAAuD;AACvD,yDAAyD;AACzD,EAAE;AACF,gCAAgC;AAChC,gEAAgE;AAChE,+DAA+D;AAC/D,8DAA8D;AAC9D,iEAAiE;AACjE,+DAA+D;AAC/D,EAAE;AACF,+DAA+D;AAC/D,gEAAgE;AAChE,EAAE;AACF,+DAA+D;AAC/D,iEAAiE;AACjE,6DAA6D;AAC7D,gEAAgE;AAChE,qBAAqB;AAIrB,MAAM,CAAC,MAAM,EAAE,GAAG,uBAAuB,CAAC;AAE1C,SAAS,SAAS,CAAC,EAAY,EAAE,KAAa,EAAE,MAAc;IAC5D,MAAM,IAAI,GAAG,EAAE;SACZ,OAAO,CAAuB,qBAAqB,KAAK,GAAG,CAAC;SAC5D,GAAG,EAAE,CAAC;IACT,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,EAAE,CAAC,EAAY;IAC7B,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC;QAC1C,EAAE,CAAC,IAAI,CACL,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,CAAC,EAAE,CAAC;QACnD,EAAE,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,CAAC;QAC/C,EAAE,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Database } from "better-sqlite3";
|
|
2
|
+
export interface Migration {
|
|
3
|
+
id: string;
|
|
4
|
+
up: (db: Database) => void;
|
|
5
|
+
}
|
|
6
|
+
/** Ordered list of migrations. Append, never reorder, never edit past entries. */
|
|
7
|
+
export declare const MIGRATIONS: Migration[];
|
|
8
|
+
export declare function runMigrations(db: Database): {
|
|
9
|
+
applied: string[];
|
|
10
|
+
alreadyApplied: string[];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAU/C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC5B;AAED,kFAAkF;AAClF,eAAO,MAAM,UAAU,EAAE,SAAS,EASjC,CAAC;AASF,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CA6B3F"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Migration runner.
|
|
2
|
+
//
|
|
3
|
+
// Migrations are simple: an ordered list, each with a unique id and an `up`
|
|
4
|
+
// function. We track applied ids in a `schema_migrations` table inside the
|
|
5
|
+
// tenant DB, so the runner is idempotent — calling it on an up-to-date DB
|
|
6
|
+
// is a no-op.
|
|
7
|
+
//
|
|
8
|
+
// Down migrations are intentionally NOT supported. SQLite + downgrade is
|
|
9
|
+
// painful; we'd rather forward-fix.
|
|
10
|
+
import * as initial from "./001-initial.js";
|
|
11
|
+
import * as taskDependencies from "./002-task-dependencies.js";
|
|
12
|
+
import * as sessionTree from "./003-session-tree.js";
|
|
13
|
+
import * as rebuildMessageChain from "./004-rebuild-message-chain.js";
|
|
14
|
+
import * as taskStatusRename from "./005-task-status-rename.js";
|
|
15
|
+
import * as taskLabels from "./006-task-labels.js";
|
|
16
|
+
import * as sessionInbox from "./007-session-inbox.js";
|
|
17
|
+
import * as taskIntervention from "./008-task-intervention.js";
|
|
18
|
+
/** Ordered list of migrations. Append, never reorder, never edit past entries. */
|
|
19
|
+
export const MIGRATIONS = [
|
|
20
|
+
{ id: initial.ID, up: initial.up },
|
|
21
|
+
{ id: taskDependencies.ID, up: taskDependencies.up },
|
|
22
|
+
{ id: sessionTree.ID, up: sessionTree.up },
|
|
23
|
+
{ id: rebuildMessageChain.ID, up: rebuildMessageChain.up },
|
|
24
|
+
{ id: taskStatusRename.ID, up: taskStatusRename.up },
|
|
25
|
+
{ id: taskLabels.ID, up: taskLabels.up },
|
|
26
|
+
{ id: sessionInbox.ID, up: sessionInbox.up },
|
|
27
|
+
{ id: taskIntervention.ID, up: taskIntervention.up },
|
|
28
|
+
];
|
|
29
|
+
const ENSURE_MIGRATIONS_TABLE = `
|
|
30
|
+
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
31
|
+
id TEXT PRIMARY KEY,
|
|
32
|
+
applied_at INTEGER NOT NULL
|
|
33
|
+
);
|
|
34
|
+
`;
|
|
35
|
+
export function runMigrations(db) {
|
|
36
|
+
db.exec(ENSURE_MIGRATIONS_TABLE);
|
|
37
|
+
const existing = db
|
|
38
|
+
.prepare("SELECT id FROM schema_migrations")
|
|
39
|
+
.all()
|
|
40
|
+
.map((r) => r.id);
|
|
41
|
+
const seen = new Set(existing);
|
|
42
|
+
const applied = [];
|
|
43
|
+
const alreadyApplied = [];
|
|
44
|
+
const recordStmt = db.prepare("INSERT INTO schema_migrations (id, applied_at) VALUES (?, ?)");
|
|
45
|
+
for (const m of MIGRATIONS) {
|
|
46
|
+
if (seen.has(m.id)) {
|
|
47
|
+
alreadyApplied.push(m.id);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
db.transaction(() => {
|
|
51
|
+
m.up(db);
|
|
52
|
+
recordStmt.run(m.id, Date.now());
|
|
53
|
+
})();
|
|
54
|
+
applied.push(m.id);
|
|
55
|
+
}
|
|
56
|
+
return { applied, alreadyApplied };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/migrations/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,cAAc;AACd,EAAE;AACF,yEAAyE;AACzE,oCAAoC;AAGpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,gBAAgB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,mBAAmB,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,gBAAgB,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,gBAAgB,MAAM,4BAA4B,CAAC;AAO/D,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE;IAClC,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE;IACpD,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE;IAC1C,EAAE,EAAE,EAAE,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,mBAAmB,CAAC,EAAE,EAAE;IAC1D,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE;IACpD,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE;IACxC,EAAE,EAAE,EAAE,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,YAAY,CAAC,EAAE,EAAE;IAC5C,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE;CACrD,CAAC;AAEF,MAAM,uBAAuB,GAAG;;;;;CAK/B,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,EAAY;IACxC,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,EAAE;SAChB,OAAO,CAAqB,kCAAkC,CAAC;SAC/D,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACpB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAa,EAAE,CAAC;IAEpC,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAC3B,8DAA8D,CAC/D,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YACnB,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;YAClB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACT,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const SOFT_DELETE_SUFFIX = ".deleted";
|
|
2
|
+
/** Resolve TIANSHU_HOME at call time so tests can monkey-patch process.env. */
|
|
3
|
+
export declare function getTianshuHome(): string;
|
|
4
|
+
export declare function getGlobalConfigPath(home?: string): string;
|
|
5
|
+
export declare function getTenantsRoot(home?: string): string;
|
|
6
|
+
export declare function getTenantRoot(tenantId: string, home?: string): string;
|
|
7
|
+
export declare function getTenantConfigPath(tenantId: string, home?: string): string;
|
|
8
|
+
export declare function getTenantDbPath(tenantId: string, home?: string): string;
|
|
9
|
+
export declare function getTenantSecretsDir(tenantId: string, home?: string): string;
|
|
10
|
+
export declare function getTenantWorkspaceDir(tenantId: string, home?: string): string;
|
|
11
|
+
export declare function getTenantSharedDir(tenantId: string, home?: string): string;
|
|
12
|
+
/** Per-tenant logs directory. Sibling to `db.sqlite`, not under
|
|
13
|
+
* `workspace/`, so that tenant-visible workspace tools never see
|
|
14
|
+
* these files. Created lazily on first write. */
|
|
15
|
+
export declare function getTenantLogsDir(tenantId: string, home?: string): string;
|
|
16
|
+
/** Per-tenant agent-config root, where SKILL.md trees, SOUL.md and
|
|
17
|
+
* related agent-facing files live. The chat handler scans this on
|
|
18
|
+
* every turn (no host restart required for new skills).
|
|
19
|
+
*
|
|
20
|
+
* Layout:
|
|
21
|
+
* _tenant/config/skills/<name>/SKILL.md — shared skills
|
|
22
|
+
* _tenant/config/main/skills/<name>/SKILL.md — main agent only
|
|
23
|
+
* _tenant/config/workers/<kind>/skills/<name>/SKILL.md
|
|
24
|
+
* — worker-kind only
|
|
25
|
+
* (More files like SOUL.md / MEMORY.md are reserved for follow-up
|
|
26
|
+
* changes; the directory shape is intentionally future-compatible.)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTenantConfigDir(tenantId: string, home?: string): string;
|
|
29
|
+
export declare function getTenantSharedSkillsDir(tenantId: string, home?: string): string;
|
|
30
|
+
export declare function getTenantMainSkillsDir(tenantId: string, home?: string): string;
|
|
31
|
+
export declare function getTenantWorkerSkillsDir(tenantId: string, workerKind: string, home?: string): string;
|
|
32
|
+
export declare function getTenantUsersDir(tenantId: string, home?: string): string;
|
|
33
|
+
export declare function getUserHomeDir(tenantId: string, userId: string, home?: string): string;
|
|
34
|
+
export declare function getDeletedTenantPath(tenantId: string, timestamp: number, home?: string): string;
|
|
35
|
+
/** True for any soft-deleted directory name like `myorg.deleted` or `myorg.deleted.171…`. */
|
|
36
|
+
export declare function isSoftDeletedDirName(name: string): boolean;
|
|
37
|
+
/** True iff a name starts with the system-reserved underscore prefix. */
|
|
38
|
+
export declare function isSystemReserved(name: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Validate a path is within `root` after canonicalisation.
|
|
41
|
+
*
|
|
42
|
+
* Used by every tool / API endpoint that takes a user-supplied path.
|
|
43
|
+
* Returns the resolved absolute path on success, or throws.
|
|
44
|
+
*
|
|
45
|
+
* Note we do NOT call fs.realpath because (a) the path may not exist yet
|
|
46
|
+
* and (b) we explicitly do not want to follow symlinks out of root.
|
|
47
|
+
*/
|
|
48
|
+
export declare function ensureInside(root: string, candidate: string): string;
|
|
49
|
+
export declare const __forTest: {
|
|
50
|
+
RESERVED_TENANT_IDS: Set<string>;
|
|
51
|
+
SYSTEM_PREFIX: string;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAO7C,+EAA+E;AAC/E,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,MAAyB,GAAG,MAAM,CAE3E;AAED,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAyB,GAAG,MAAM,CAEtE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB,GAAG,MAAM,CAEvF;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;kDAEkD;AAClD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAER;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAER;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAOR;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,MAAyB,GAC9B,MAAM,CAER;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAYpE;AAED,eAAO,MAAM,SAAS;;;CAAyC,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Filesystem layout for Tianshu, per ADR-0001.
|
|
2
|
+
//
|
|
3
|
+
// <TIANSHU_HOME>/
|
|
4
|
+
// ├── config.json
|
|
5
|
+
// └── tenants/
|
|
6
|
+
// ├── <tenantId>/
|
|
7
|
+
// │ ├── config.json
|
|
8
|
+
// │ ├── db.sqlite
|
|
9
|
+
// │ ├── secrets/
|
|
10
|
+
// │ └── workspace/
|
|
11
|
+
// └── <tenantId>.deleted/
|
|
12
|
+
//
|
|
13
|
+
// Default TIANSHU_HOME is ~/.tianshu but every test, every CLI invocation,
|
|
14
|
+
// and every container deploy can override it via the env var. Centralising
|
|
15
|
+
// path math here keeps the rest of the server code from sprinkling
|
|
16
|
+
// path.join(...) and lets tests use isolated temp dirs trivially.
|
|
17
|
+
import os from "node:os";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
export const SOFT_DELETE_SUFFIX = ".deleted";
|
|
20
|
+
const SYSTEM_PREFIX = "_";
|
|
21
|
+
/** Reserved tenant ids that must not be allowed even if the regex passes. */
|
|
22
|
+
const RESERVED_TENANT_IDS = new Set(["", ".", "..", "tenants", "config", "global"]);
|
|
23
|
+
/** Resolve TIANSHU_HOME at call time so tests can monkey-patch process.env. */
|
|
24
|
+
export function getTianshuHome() {
|
|
25
|
+
const env = process.env.TIANSHU_HOME?.trim();
|
|
26
|
+
if (env)
|
|
27
|
+
return path.resolve(env);
|
|
28
|
+
return path.join(os.homedir(), ".tianshu");
|
|
29
|
+
}
|
|
30
|
+
export function getGlobalConfigPath(home = getTianshuHome()) {
|
|
31
|
+
return path.join(home, "config.json");
|
|
32
|
+
}
|
|
33
|
+
export function getTenantsRoot(home = getTianshuHome()) {
|
|
34
|
+
return path.join(home, "tenants");
|
|
35
|
+
}
|
|
36
|
+
export function getTenantRoot(tenantId, home = getTianshuHome()) {
|
|
37
|
+
return path.join(getTenantsRoot(home), tenantId);
|
|
38
|
+
}
|
|
39
|
+
export function getTenantConfigPath(tenantId, home) {
|
|
40
|
+
return path.join(getTenantRoot(tenantId, home), "config.json");
|
|
41
|
+
}
|
|
42
|
+
export function getTenantDbPath(tenantId, home) {
|
|
43
|
+
return path.join(getTenantRoot(tenantId, home), "db.sqlite");
|
|
44
|
+
}
|
|
45
|
+
export function getTenantSecretsDir(tenantId, home) {
|
|
46
|
+
return path.join(getTenantRoot(tenantId, home), "secrets");
|
|
47
|
+
}
|
|
48
|
+
export function getTenantWorkspaceDir(tenantId, home) {
|
|
49
|
+
return path.join(getTenantRoot(tenantId, home), "workspace");
|
|
50
|
+
}
|
|
51
|
+
export function getTenantSharedDir(tenantId, home) {
|
|
52
|
+
return path.join(getTenantWorkspaceDir(tenantId, home), "_tenant");
|
|
53
|
+
}
|
|
54
|
+
/** Per-tenant logs directory. Sibling to `db.sqlite`, not under
|
|
55
|
+
* `workspace/`, so that tenant-visible workspace tools never see
|
|
56
|
+
* these files. Created lazily on first write. */
|
|
57
|
+
export function getTenantLogsDir(tenantId, home) {
|
|
58
|
+
return path.join(getTenantRoot(tenantId, home), "logs");
|
|
59
|
+
}
|
|
60
|
+
/** Per-tenant agent-config root, where SKILL.md trees, SOUL.md and
|
|
61
|
+
* related agent-facing files live. The chat handler scans this on
|
|
62
|
+
* every turn (no host restart required for new skills).
|
|
63
|
+
*
|
|
64
|
+
* Layout:
|
|
65
|
+
* _tenant/config/skills/<name>/SKILL.md — shared skills
|
|
66
|
+
* _tenant/config/main/skills/<name>/SKILL.md — main agent only
|
|
67
|
+
* _tenant/config/workers/<kind>/skills/<name>/SKILL.md
|
|
68
|
+
* — worker-kind only
|
|
69
|
+
* (More files like SOUL.md / MEMORY.md are reserved for follow-up
|
|
70
|
+
* changes; the directory shape is intentionally future-compatible.)
|
|
71
|
+
*/
|
|
72
|
+
export function getTenantConfigDir(tenantId, home) {
|
|
73
|
+
return path.join(getTenantSharedDir(tenantId, home), "config");
|
|
74
|
+
}
|
|
75
|
+
export function getTenantSharedSkillsDir(tenantId, home) {
|
|
76
|
+
return path.join(getTenantConfigDir(tenantId, home), "skills");
|
|
77
|
+
}
|
|
78
|
+
export function getTenantMainSkillsDir(tenantId, home) {
|
|
79
|
+
return path.join(getTenantConfigDir(tenantId, home), "main", "skills");
|
|
80
|
+
}
|
|
81
|
+
export function getTenantWorkerSkillsDir(tenantId, workerKind, home) {
|
|
82
|
+
return path.join(getTenantConfigDir(tenantId, home), "workers", workerKind, "skills");
|
|
83
|
+
}
|
|
84
|
+
export function getTenantUsersDir(tenantId, home) {
|
|
85
|
+
return path.join(getTenantWorkspaceDir(tenantId, home), "users");
|
|
86
|
+
}
|
|
87
|
+
export function getUserHomeDir(tenantId, userId, home) {
|
|
88
|
+
return path.join(getTenantUsersDir(tenantId, home), userId);
|
|
89
|
+
}
|
|
90
|
+
export function getDeletedTenantPath(tenantId, timestamp, home = getTianshuHome()) {
|
|
91
|
+
return path.join(getTenantsRoot(home), `${tenantId}.deleted.${timestamp}`);
|
|
92
|
+
}
|
|
93
|
+
/** True for any soft-deleted directory name like `myorg.deleted` or `myorg.deleted.171…`. */
|
|
94
|
+
export function isSoftDeletedDirName(name) {
|
|
95
|
+
return name === SOFT_DELETE_SUFFIX.slice(1) // edge case: literally ".deleted"
|
|
96
|
+
? false
|
|
97
|
+
: name.includes(SOFT_DELETE_SUFFIX);
|
|
98
|
+
}
|
|
99
|
+
/** True iff a name starts with the system-reserved underscore prefix. */
|
|
100
|
+
export function isSystemReserved(name) {
|
|
101
|
+
return name.startsWith(SYSTEM_PREFIX);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Validate a path is within `root` after canonicalisation.
|
|
105
|
+
*
|
|
106
|
+
* Used by every tool / API endpoint that takes a user-supplied path.
|
|
107
|
+
* Returns the resolved absolute path on success, or throws.
|
|
108
|
+
*
|
|
109
|
+
* Note we do NOT call fs.realpath because (a) the path may not exist yet
|
|
110
|
+
* and (b) we explicitly do not want to follow symlinks out of root.
|
|
111
|
+
*/
|
|
112
|
+
export function ensureInside(root, candidate) {
|
|
113
|
+
const resolvedRoot = path.resolve(root);
|
|
114
|
+
const resolved = path.resolve(resolvedRoot, candidate);
|
|
115
|
+
// path.relative gives "../something" when escaping; absolute paths get
|
|
116
|
+
// resolved first so an absolute candidate that doesn't start with root
|
|
117
|
+
// is also caught.
|
|
118
|
+
const rel = path.relative(resolvedRoot, resolved);
|
|
119
|
+
if (rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel))) {
|
|
120
|
+
return resolved;
|
|
121
|
+
}
|
|
122
|
+
throw new Error(`path escapes root: ${candidate} (root=${resolvedRoot})`);
|
|
123
|
+
}
|
|
124
|
+
export const __forTest = { RESERVED_TENANT_IDS, SYSTEM_PREFIX };
|
|
125
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,oBAAoB;AACpB,oBAAoB;AACpB,iBAAiB;AACjB,wBAAwB;AACxB,4BAA4B;AAC5B,0BAA0B;AAC1B,yBAAyB;AACzB,2BAA2B;AAC3B,gCAAgC;AAChC,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,mEAAmE;AACnE,kEAAkE;AAElE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE7C,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,6EAA6E;AAC7E,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEpF,+EAA+E;AAC/E,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe,cAAc,EAAE;IACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAe,cAAc,EAAE;IAC5D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,OAAe,cAAc,EAAE;IAC7E,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,IAAa;IACjE,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB,EAAE,IAAa;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,IAAa;IACjE,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,IAAa;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,IAAa;IAChE,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AACrE,CAAC;AAED;;kDAEkD;AAClD,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,IAAa;IAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,IAAa;IAChE,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,QAAgB,EAChB,IAAa;IAEb,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAgB,EAChB,IAAa;IAEb,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,QAAgB,EAChB,UAAkB,EAClB,IAAa;IAEb,OAAO,IAAI,CAAC,IAAI,CACd,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAClC,SAAS,EACT,UAAU,EACV,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,IAAa;IAC/D,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,MAAc,EAAE,IAAa;IAC5E,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,QAAgB,EAChB,SAAiB,EACjB,OAAe,cAAc,EAAE;IAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,GAAG,QAAQ,YAAY,SAAS,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,kCAAkC;QAC5E,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,SAAiB;IAC1D,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEvD,uEAAuE;IACvE,uEAAuE;IACvE,kBAAkB;IAClB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,UAAU,YAAY,GAAG,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,mBAAmB,EAAE,aAAa,EAAE,CAAC"}
|