@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,329 @@
|
|
|
1
|
+
// `tianshu` CLI — top-level dispatch.
|
|
2
|
+
//
|
|
3
|
+
// Commands:
|
|
4
|
+
// tianshu doctor [--probe-providers] [--probe-sandbox] [--json]
|
|
5
|
+
// tianshu setup [--wizard] [--non-interactive --provider X --api-key Y [--base-url URL] [--default-model Z]] [--force] [--dry-run] [--use-env]
|
|
6
|
+
// tianshu start | stop | restart | status [--json] [--no-wait]
|
|
7
|
+
// tianshu logs [--follow] [--lines=N] [--stream=out|err|both]
|
|
8
|
+
// tianshu tenant list [--json] [--plain] | create <id> | delete <id>
|
|
9
|
+
// tianshu user create <tenantId> <userId> [--provider=dev] [--external-id=<x>]
|
|
10
|
+
// tianshu version
|
|
11
|
+
// tianshu help [<command>]
|
|
12
|
+
//
|
|
13
|
+
// Service lifecycle commands wrap launchctl so users (and
|
|
14
|
+
// debugging agents) don't need to know launchd plist paths
|
|
15
|
+
// and `bootstrap gui/$(id -u) ~/Library/LaunchAgents/...`
|
|
16
|
+
// invocations. `tianshu logs` reads the same files the wizard
|
|
17
|
+
// configured the agent to write into.
|
|
18
|
+
import fs from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { GlobalOps, InvalidTenantIdError, TenantAlreadyExistsError, TenantNotFoundError, getTianshuHome, loadGlobalConfig, } from "./core/index.js";
|
|
21
|
+
import { loadEnv } from "./setup/load-env.js";
|
|
22
|
+
import { runDoctor } from "./setup/doctor.js";
|
|
23
|
+
import { runSetupWizard } from "./setup/wizard.js";
|
|
24
|
+
import { runStart, runStop, runRestart, runStatus, runLogs, } from "./setup/service.js";
|
|
25
|
+
// Load .env up front, same as the server boot path. Without this,
|
|
26
|
+
// `tianshu doctor` would diagnose the user's setup using whatever
|
|
27
|
+
// the shell happens to export — typically nothing — and report
|
|
28
|
+
// every provider as 'API key not set' even though the keys are
|
|
29
|
+
// sitting in .env right next to the config it just validated.
|
|
30
|
+
loadEnv();
|
|
31
|
+
export function parseArgs(argv) {
|
|
32
|
+
const positional = [];
|
|
33
|
+
const options = {};
|
|
34
|
+
const flags = new Set();
|
|
35
|
+
for (const arg of argv) {
|
|
36
|
+
if (arg.startsWith("--")) {
|
|
37
|
+
const eq = arg.indexOf("=");
|
|
38
|
+
if (eq > 0) {
|
|
39
|
+
options[arg.slice(2, eq)] = arg.slice(eq + 1);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
flags.add(arg.slice(2));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
positional.push(arg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const [command, ...rest] = positional;
|
|
50
|
+
return { command: command ?? "", positional: rest, options, flags };
|
|
51
|
+
}
|
|
52
|
+
function topLevelUsage() {
|
|
53
|
+
return [
|
|
54
|
+
"Usage:",
|
|
55
|
+
" tianshu doctor [--probe-providers] [--probe-sandbox] [--json]",
|
|
56
|
+
" tianshu setup [--wizard] [--non-interactive --provider X --api-key Y [--base-url URL] [--default-model Z]] [--use-env]",
|
|
57
|
+
" tianshu start | stop | restart | status [--json] [--no-wait]",
|
|
58
|
+
" tianshu logs [--follow] [--lines=N] [--stream=out|err|both]",
|
|
59
|
+
" tianshu tenant list [--json] [--plain] | create <id> | delete <id>",
|
|
60
|
+
" tianshu user create <tenantId> <userId> [--provider=dev] [--external-id=<x>]",
|
|
61
|
+
" tianshu version",
|
|
62
|
+
" tianshu help [<command>]",
|
|
63
|
+
"",
|
|
64
|
+
`TIANSHU_HOME currently resolves to: ${getTianshuHome()}`,
|
|
65
|
+
].join("\n");
|
|
66
|
+
}
|
|
67
|
+
async function getPackageVersion() {
|
|
68
|
+
// Single source of truth: the root package.json. The CLI is
|
|
69
|
+
// short-lived so reading from disk per invocation is fine.
|
|
70
|
+
try {
|
|
71
|
+
const fs = await import("node:fs");
|
|
72
|
+
const url = new URL("../../../package.json", import.meta.url);
|
|
73
|
+
const json = JSON.parse(fs.readFileSync(url, "utf8"));
|
|
74
|
+
return json.version ?? "0.0.0";
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return "0.0.0";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export async function main(argv) {
|
|
81
|
+
const parsed = parseArgs(argv);
|
|
82
|
+
// Top-level lifecycle commands first.
|
|
83
|
+
switch (parsed.command) {
|
|
84
|
+
case "":
|
|
85
|
+
case "help": {
|
|
86
|
+
const target = parsed.positional[0];
|
|
87
|
+
if (!target) {
|
|
88
|
+
console.log(topLevelUsage());
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
// For now help <cmd> just prints the same top-level usage —
|
|
92
|
+
// sub-commands' own help is implicit. Easy to expand later.
|
|
93
|
+
console.log(topLevelUsage());
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
case "version":
|
|
97
|
+
case "--version":
|
|
98
|
+
case "-v":
|
|
99
|
+
console.log(await getPackageVersion());
|
|
100
|
+
return 0;
|
|
101
|
+
case "doctor":
|
|
102
|
+
return runDoctor({
|
|
103
|
+
probeProviders: parsed.flags.has("probe-providers"),
|
|
104
|
+
probeSandbox: parsed.flags.has("probe-sandbox"),
|
|
105
|
+
json: parsed.flags.has("json"),
|
|
106
|
+
});
|
|
107
|
+
case "setup": {
|
|
108
|
+
try {
|
|
109
|
+
const res = await runSetupWizard({
|
|
110
|
+
nonInteractive: parsed.flags.has("non-interactive"),
|
|
111
|
+
provider: parsed.options.provider,
|
|
112
|
+
apiKey: parsed.options["api-key"],
|
|
113
|
+
baseUrl: parsed.options["base-url"],
|
|
114
|
+
defaultModel: parsed.options["default-model"],
|
|
115
|
+
force: parsed.flags.has("force"),
|
|
116
|
+
dryRun: parsed.flags.has("dry-run"),
|
|
117
|
+
useEnv: parsed.flags.has("use-env"),
|
|
118
|
+
});
|
|
119
|
+
if (parsed.flags.has("non-interactive")) {
|
|
120
|
+
for (const note of res.notes)
|
|
121
|
+
console.log(note);
|
|
122
|
+
}
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
console.error(`setup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
127
|
+
return 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
case "start":
|
|
131
|
+
return runStart({
|
|
132
|
+
wait: !parsed.flags.has("no-wait"),
|
|
133
|
+
json: parsed.flags.has("json"),
|
|
134
|
+
});
|
|
135
|
+
case "stop":
|
|
136
|
+
return runStop({ json: parsed.flags.has("json") });
|
|
137
|
+
case "restart":
|
|
138
|
+
return runRestart({
|
|
139
|
+
wait: !parsed.flags.has("no-wait"),
|
|
140
|
+
json: parsed.flags.has("json"),
|
|
141
|
+
});
|
|
142
|
+
case "status":
|
|
143
|
+
return runStatus({ json: parsed.flags.has("json") });
|
|
144
|
+
case "logs": {
|
|
145
|
+
const linesOpt = parsed.options.lines;
|
|
146
|
+
const streamOpt = parsed.options.stream;
|
|
147
|
+
const stream = streamOpt === "out" || streamOpt === "err" || streamOpt === "both"
|
|
148
|
+
? streamOpt
|
|
149
|
+
: undefined;
|
|
150
|
+
return runLogs({
|
|
151
|
+
follow: parsed.flags.has("follow") || parsed.flags.has("f"),
|
|
152
|
+
lines: linesOpt ? Number.parseInt(linesOpt, 10) : undefined,
|
|
153
|
+
stream,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Tenant / user commands keep their original semantics.
|
|
158
|
+
const ops = new GlobalOps();
|
|
159
|
+
try {
|
|
160
|
+
if (parsed.command === "tenant" && parsed.positional[0] === "list") {
|
|
161
|
+
// Default output is a tree of tenants → users → dev URLs,
|
|
162
|
+
// because the bare list of tenant ids isn't useful by
|
|
163
|
+
// itself — the typical follow-up question is "and who's
|
|
164
|
+
// in each", and the typical follow-up action is "copy a
|
|
165
|
+
// URL to share with that user". --plain restores the
|
|
166
|
+
// legacy one-id-per-line format for shell scripting.
|
|
167
|
+
// --json emits the same data structurally for consumers
|
|
168
|
+
// who can parse it.
|
|
169
|
+
const ids = ops.list();
|
|
170
|
+
const wantJson = parsed.flags.has("json");
|
|
171
|
+
const wantPlain = parsed.flags.has("plain");
|
|
172
|
+
if (ids.length === 0) {
|
|
173
|
+
if (wantJson)
|
|
174
|
+
console.log("[]");
|
|
175
|
+
else
|
|
176
|
+
console.log("(no tenants)");
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
if (wantPlain) {
|
|
180
|
+
for (const id of ids)
|
|
181
|
+
console.log(id);
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
const webBase = resolveWebBaseUrl();
|
|
185
|
+
const tree = ids.map((tenantId) => ({
|
|
186
|
+
tenantId,
|
|
187
|
+
users: listTenantUsers(tenantId),
|
|
188
|
+
}));
|
|
189
|
+
if (wantJson) {
|
|
190
|
+
console.log(JSON.stringify(tree.map((t) => ({
|
|
191
|
+
tenantId: t.tenantId,
|
|
192
|
+
users: t.users,
|
|
193
|
+
urls: t.users.map((u) => ({
|
|
194
|
+
userId: u,
|
|
195
|
+
url: `${webBase}/tenants/${t.tenantId}/users/${u}/`,
|
|
196
|
+
})),
|
|
197
|
+
})), null, 2));
|
|
198
|
+
return 0;
|
|
199
|
+
}
|
|
200
|
+
// Human-readable tree. Indent + URL per (tenant, user)
|
|
201
|
+
// makes it copyable straight from the terminal into a
|
|
202
|
+
// browser or share message.
|
|
203
|
+
for (const t of tree) {
|
|
204
|
+
if (t.users.length === 0) {
|
|
205
|
+
console.log(`${t.tenantId} (no users)`);
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
console.log(t.tenantId);
|
|
209
|
+
for (const u of t.users) {
|
|
210
|
+
console.log(` ${u.padEnd(16)} ${webBase}/tenants/${t.tenantId}/users/${u}/`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
if (parsed.command === "tenant" && parsed.positional[0] === "create") {
|
|
216
|
+
const id = parsed.positional[1];
|
|
217
|
+
if (!id) {
|
|
218
|
+
console.error("missing <id>\n" + topLevelUsage());
|
|
219
|
+
return 2;
|
|
220
|
+
}
|
|
221
|
+
const ctx = ops.create(id);
|
|
222
|
+
console.log(`created tenant ${ctx.tenantId} at ${ctx.root}`);
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
if (parsed.command === "tenant" && parsed.positional[0] === "delete") {
|
|
226
|
+
const id = parsed.positional[1];
|
|
227
|
+
if (!id) {
|
|
228
|
+
console.error("missing <id>\n" + topLevelUsage());
|
|
229
|
+
return 2;
|
|
230
|
+
}
|
|
231
|
+
ops.softDelete(id);
|
|
232
|
+
console.log(`soft-deleted tenant ${id} (renamed to ${id}.deleted.<ts>)`);
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
if (parsed.command === "user" && parsed.positional[0] === "create") {
|
|
236
|
+
const [, tenantId, userId] = parsed.positional;
|
|
237
|
+
if (!tenantId || !userId) {
|
|
238
|
+
console.error("missing <tenantId> or <userId>\n" + topLevelUsage());
|
|
239
|
+
return 2;
|
|
240
|
+
}
|
|
241
|
+
const ctx = ops.open(tenantId);
|
|
242
|
+
ops.ensureUser(ctx, {
|
|
243
|
+
userId,
|
|
244
|
+
provider: parsed.options.provider ?? "dev",
|
|
245
|
+
externalId: parsed.options["external-id"] ?? `${userId}@local`,
|
|
246
|
+
displayName: parsed.options["display-name"],
|
|
247
|
+
});
|
|
248
|
+
console.log(`ensured user ${userId} in tenant ${ctx.tenantId}`);
|
|
249
|
+
return 0;
|
|
250
|
+
}
|
|
251
|
+
console.error(topLevelUsage());
|
|
252
|
+
return 2;
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
if (err instanceof InvalidTenantIdError) {
|
|
256
|
+
console.error(`error: ${err.message}`);
|
|
257
|
+
return 2;
|
|
258
|
+
}
|
|
259
|
+
if (err instanceof TenantAlreadyExistsError ||
|
|
260
|
+
err instanceof TenantNotFoundError) {
|
|
261
|
+
console.error(`error: ${err.message}`);
|
|
262
|
+
return 1;
|
|
263
|
+
}
|
|
264
|
+
console.error(err instanceof Error ? err.stack ?? err.message : String(err));
|
|
265
|
+
return 1;
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
ops.closePool();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* List user ids under a tenant by reading
|
|
273
|
+
* `<TIANSHU_HOME>/tenants/<id>/workspace/users/`. We don't go
|
|
274
|
+
* through a higher-level API because GlobalOps doesn't expose
|
|
275
|
+
* users; this surface is the same one
|
|
276
|
+
* checks/tenants.ts uses and the two should not drift. If a
|
|
277
|
+
* proper UsersOps lands in core, swap to it.
|
|
278
|
+
*/
|
|
279
|
+
function listTenantUsers(tenantId) {
|
|
280
|
+
const usersDir = path.join(getTianshuHome(), "tenants", tenantId, "workspace", "users");
|
|
281
|
+
if (!fs.existsSync(usersDir))
|
|
282
|
+
return [];
|
|
283
|
+
try {
|
|
284
|
+
return fs
|
|
285
|
+
.readdirSync(usersDir, { withFileTypes: true })
|
|
286
|
+
.filter((d) => d.isDirectory())
|
|
287
|
+
.map((d) => d.name)
|
|
288
|
+
.sort();
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Best-effort "where does the user open this in a browser?".
|
|
296
|
+
* Resolution order:
|
|
297
|
+
* 1. TIANSHU_WEB_URL env (explicit override, e.g.
|
|
298
|
+
* cloudflare tunnel hostname)
|
|
299
|
+
* 2. global config server.publicUrl
|
|
300
|
+
* 3. http://localhost:<webPort> where webPort comes from
|
|
301
|
+
* .env's WEB_PORT or the default 5183
|
|
302
|
+
* The fallback uses the *web* port (vite dev server), not the
|
|
303
|
+
* server port — the URL we print is what the user opens, not
|
|
304
|
+
* what fetch hits.
|
|
305
|
+
*/
|
|
306
|
+
function resolveWebBaseUrl() {
|
|
307
|
+
const envUrl = process.env.TIANSHU_WEB_URL;
|
|
308
|
+
if (envUrl)
|
|
309
|
+
return envUrl.replace(/\/+$/, "");
|
|
310
|
+
try {
|
|
311
|
+
const cfg = loadGlobalConfig();
|
|
312
|
+
const pub = cfg.server?.publicUrl;
|
|
313
|
+
if (pub)
|
|
314
|
+
return pub.replace(/\/+$/, "");
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
/* no global config yet — fall through */
|
|
318
|
+
}
|
|
319
|
+
const webPort = process.env.WEB_PORT ?? "5183";
|
|
320
|
+
return `http://localhost:${webPort}`;
|
|
321
|
+
}
|
|
322
|
+
// Direct invocation: `node dist/cli.js …`. The `bin/tianshu.mjs`
|
|
323
|
+
// shim also calls `main()` after dynamic-importing this module,
|
|
324
|
+
// so we only auto-run when the module *is* the entry point.
|
|
325
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
326
|
+
const code = await main(process.argv.slice(2));
|
|
327
|
+
process.exit(code);
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,YAAY;AACZ,kEAAkE;AAClE,iJAAiJ;AACjJ,iEAAiE;AACjE,gEAAgE;AAChE,uEAAuE;AACvE,iFAAiF;AACjF,oBAAoB;AACpB,6BAA6B;AAC7B,EAAE;AACF,0DAA0D;AAC1D,2DAA2D;AAC3D,0DAA0D;AAC1D,8DAA8D;AAC9D,sCAAsC;AAEtC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,OAAO,GACR,MAAM,oBAAoB,CAAC;AAE5B,kEAAkE;AAClE,kEAAkE;AAClE,+DAA+D;AAC/D,+DAA+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IAC/C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AgentSeedContribution } from "@tianshu/plugin-sdk";
|
|
2
|
+
export interface SeedAgentDirsArgs {
|
|
3
|
+
tenantId: string;
|
|
4
|
+
/** Plugin id, used in log lines + collision warnings. */
|
|
5
|
+
pluginId: string;
|
|
6
|
+
/** Plugin's manifest dir. Seed paths in the contribution are
|
|
7
|
+
* resolved against this. */
|
|
8
|
+
pluginDir: string;
|
|
9
|
+
/** Manifest-declared seeds. Empty / missing → no-op. */
|
|
10
|
+
seeds: readonly AgentSeedContribution[];
|
|
11
|
+
/** Override for tests. */
|
|
12
|
+
home?: string;
|
|
13
|
+
/** Optional sink — defaults to console.warn. */
|
|
14
|
+
onWarn?: (msg: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface SeedAgentDirsResult {
|
|
17
|
+
/** Slugs that just got copied in. */
|
|
18
|
+
inserted: string[];
|
|
19
|
+
/** Slugs already on disk (untouched). */
|
|
20
|
+
preserved: string[];
|
|
21
|
+
/** Slugs whose source path didn't exist or wasn't a directory. */
|
|
22
|
+
invalid: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare function seedAgentDirs(args: SeedAgentDirsArgs): SeedAgentDirsResult;
|
|
25
|
+
//# sourceMappingURL=agent-seeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-seeds.d.ts","sourceRoot":"","sources":["../../src/core/agent-seeds.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB;iCAC6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,yCAAyC;IACzC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kEAAkE;IAClE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,CA0D1E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Plugin-contributed worker-agent seed copy.
|
|
2
|
+
//
|
|
3
|
+
// The mechanism mirrors `ensureTenantConfigDefaults` (templates):
|
|
4
|
+
// once per (tenant, plugin, seed.id) we copy the bundle into
|
|
5
|
+
// `<tenant>/_tenant/config/workers/<seed.id>/` if the slot is
|
|
6
|
+
// empty. Existing slots are never touched, so:
|
|
7
|
+
//
|
|
8
|
+
// * a user edit (e.g. swapping the model in agent.json) is
|
|
9
|
+
// preserved across plugin upgrades
|
|
10
|
+
// * a deleted seed stays deleted — re-seeding only happens when
|
|
11
|
+
// the slot is missing, which means the user explicitly nuked it
|
|
12
|
+
// OR the tenant is brand-new
|
|
13
|
+
//
|
|
14
|
+
// Cross-plugin slug collisions are resolved last-writer-wins with
|
|
15
|
+
// a console warning. We don't try to be clever about it; plugin
|
|
16
|
+
// authors should pick globally distinctive ids.
|
|
17
|
+
//
|
|
18
|
+
// This runs synchronously after a plugin successfully `activate()`s.
|
|
19
|
+
// It's filesystem-only (no DB), idempotent, and cheap (one stat
|
|
20
|
+
// per seed in the common case).
|
|
21
|
+
import fs from "node:fs";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { getTenantConfigDir } from "./paths.js";
|
|
24
|
+
export function seedAgentDirs(args) {
|
|
25
|
+
const { tenantId, pluginId, pluginDir, seeds, home, onWarn } = args;
|
|
26
|
+
const inserted = [];
|
|
27
|
+
const preserved = [];
|
|
28
|
+
const invalid = [];
|
|
29
|
+
const warn = onWarn ?? ((msg) => console.warn(msg));
|
|
30
|
+
if (!seeds || seeds.length === 0) {
|
|
31
|
+
return { inserted, preserved, invalid };
|
|
32
|
+
}
|
|
33
|
+
const workersRoot = path.join(getTenantConfigDir(tenantId, home), "workers");
|
|
34
|
+
fs.mkdirSync(workersRoot, { recursive: true });
|
|
35
|
+
for (const seed of seeds) {
|
|
36
|
+
if (!seed.id || !seed.path) {
|
|
37
|
+
warn(`[agent-seeds:${pluginId}] skipping seed with missing id/path: ${JSON.stringify(seed)}`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (!/^[a-z0-9][a-z0-9-]{0,62}$/i.test(seed.id)) {
|
|
41
|
+
warn(`[agent-seeds:${pluginId}] seed id "${seed.id}" rejected (kebab-case [a-z0-9][a-z0-9-]*)`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const srcDir = path.resolve(pluginDir, seed.path);
|
|
45
|
+
if (!fs.existsSync(srcDir) || !fs.statSync(srcDir).isDirectory()) {
|
|
46
|
+
warn(`[agent-seeds:${pluginId}] seed "${seed.id}" path not a directory: ${srcDir}`);
|
|
47
|
+
invalid.push(seed.id);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const dstDir = path.join(workersRoot, seed.id);
|
|
51
|
+
if (fs.existsSync(dstDir)) {
|
|
52
|
+
// Existing slot wins. Cross-plugin collision: log it but
|
|
53
|
+
// keep going \u2014 the first plugin to seed this slug owns it
|
|
54
|
+
// until the user removes the directory.
|
|
55
|
+
preserved.push(seed.id);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
fs.cpSync(srcDir, dstDir, { recursive: true });
|
|
60
|
+
inserted.push(seed.id);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
warn(`[agent-seeds:${pluginId}] failed to copy seed "${seed.id}": ${err instanceof Error ? err.message : String(err)}`);
|
|
64
|
+
invalid.push(seed.id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { inserted, preserved, invalid };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=agent-seeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-seeds.js","sourceRoot":"","sources":["../../src/core/agent-seeds.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,kEAAkE;AAClE,6DAA6D;AAC7D,8DAA8D;AAC9D,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,uCAAuC;AACvC,kEAAkE;AAClE,oEAAoE;AACpE,iCAAiC;AACjC,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,gDAAgD;AAChD,EAAE;AACF,qEAAqE;AACrE,gEAAgE;AAChE,gCAAgC;AAEhC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA0BhD,MAAM,UAAU,aAAa,CAAC,IAAuB;IACnD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACpE,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEpD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,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C;YACxC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACxB,SAAS;QACX,CAAC;QACD,IAAI,CAAC;YACH,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CACF,gBAAgB,QAAQ,0BAA0B,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAClH,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/** Plugin enable/disable map (per ADR-0003 §4). Keys are plugin ids. */
|
|
2
|
+
export type PluginsConfig = Record<string, {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
/** Opaque per-plugin config; the host doesn't interpret it. */
|
|
5
|
+
config?: Record<string, unknown>;
|
|
6
|
+
}>;
|
|
7
|
+
/** Fields that BOTH global and tenant configs can set. Tenant wins on conflict. */
|
|
8
|
+
export interface OverridableConfig {
|
|
9
|
+
defaultModel?: string;
|
|
10
|
+
/** Per-plugin enable/disable. Listed-but-disabled and not-listed are
|
|
11
|
+
* distinct: not listed = invisible everywhere. See ADR-0003 §4. */
|
|
12
|
+
plugins?: PluginsConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Provider catalog. Mirrors the closed-source `tianshu.models.json`
|
|
15
|
+
* format so existing config files transplant cleanly. The shape is
|
|
16
|
+
* `{ providers: { <providerId>: ProviderEntry } }`.
|
|
17
|
+
*
|
|
18
|
+
* `apiKey` strings support `${VAR}` and `${VAR:-fallback}` placeholders
|
|
19
|
+
* that we resolve at request time (not at config-load time, so secrets
|
|
20
|
+
* never sit in memory longer than necessary).
|
|
21
|
+
*/
|
|
22
|
+
models?: ModelsCatalog;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated 2026-06-21 — never wired up in the open-source
|
|
25
|
+
* repo. The three sub-keys (count / pollMs / model) had no
|
|
26
|
+
* runtime consumers: workboard sizes its pool from the
|
|
27
|
+
* agent-seeds bundle (one worker per enabled agent.json),
|
|
28
|
+
* there is no polling (task ready queue is SQLite-driven),
|
|
29
|
+
* and model selection is per-worker via agent.json's
|
|
30
|
+
* `modelId` (falling back to the resolved tenant
|
|
31
|
+
* defaultModel). Field kept in the type for backwards
|
|
32
|
+
* compat (so config files that already set it don't fail to
|
|
33
|
+
* parse), but doctor flags it as ignored and cli-agent
|
|
34
|
+
* refuses to write it. If/when an actual cross-cutting
|
|
35
|
+
* worker config is needed, wire the consumers first and
|
|
36
|
+
* then resurrect with a real shape.
|
|
37
|
+
*/
|
|
38
|
+
worker?: WorkerSettings;
|
|
39
|
+
oauth?: OAuthProviderConfig[];
|
|
40
|
+
branding?: BrandingConfig;
|
|
41
|
+
apiKeys?: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* User-managed MCP servers (additional to whatever active plugins
|
|
44
|
+
* contribute). Each entry becomes a `McpToolset` instance owned
|
|
45
|
+
* by the host's `McpManager`, so reflected tools land in the
|
|
46
|
+
* agent's tool list alongside plugin-contributed toolsets.
|
|
47
|
+
*
|
|
48
|
+
* Stored on the tenant config so per-tenant servers don't leak
|
|
49
|
+
* across tenants and so `tianshu/.config.json` survives a server
|
|
50
|
+
* restart. The host writes this surface through the `/api/mcp`
|
|
51
|
+
* routes; users can also hand-edit — we re-read on every config
|
|
52
|
+
* cycle.
|
|
53
|
+
*/
|
|
54
|
+
mcp?: McpUserConfig;
|
|
55
|
+
}
|
|
56
|
+
export interface McpUserConfig {
|
|
57
|
+
servers?: McpServerEntry[];
|
|
58
|
+
}
|
|
59
|
+
export interface McpServerEntry {
|
|
60
|
+
/** Local id used in URLs + logs. Lowercase letters, digits, dashes. */
|
|
61
|
+
id: string;
|
|
62
|
+
/** Display name in the admin UI. Defaults to `id`. */
|
|
63
|
+
displayName?: string;
|
|
64
|
+
/** Tool name prefix. Defaults to `<id>_`. Pass `""` to disable. */
|
|
65
|
+
prefix?: string;
|
|
66
|
+
/** Streamable HTTP MCP endpoint URL (must include `/mcp` path). */
|
|
67
|
+
url: string;
|
|
68
|
+
/** Optional Host header override (when fronting an upstream that
|
|
69
|
+
* validates Host — e.g. Playwright MCP behind a port forward). */
|
|
70
|
+
upstreamHost?: string;
|
|
71
|
+
/** Whether the server is currently active. Stored on the entry
|
|
72
|
+
* rather than as a separate map so `mcp.servers[]` is a single
|
|
73
|
+
* source of truth. Default true. */
|
|
74
|
+
enabled?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Fields that ONLY the global config controls. Tenant config attempting these is rejected. */
|
|
77
|
+
export interface GlobalOnlyConfig {
|
|
78
|
+
server?: {
|
|
79
|
+
port?: number;
|
|
80
|
+
corsOrigin?: string;
|
|
81
|
+
publicUrl?: string;
|
|
82
|
+
};
|
|
83
|
+
logging?: {
|
|
84
|
+
level?: "debug" | "info" | "warn" | "error";
|
|
85
|
+
/**
|
|
86
|
+
* When true, every assembled system prompt (main chat agent +
|
|
87
|
+
* worker agents) is dumped to
|
|
88
|
+
* `<tenantHomeDir>/logs/system-prompt-<role>-<userId>.txt`,
|
|
89
|
+
* overwriting on each run. Off by default; debug-only switch
|
|
90
|
+
* for inspecting plugin fragment / SOUL / skill stitching
|
|
91
|
+
* without booting tracing infrastructure.
|
|
92
|
+
*
|
|
93
|
+
* Global-only because it writes to disk and the tenant
|
|
94
|
+
* shouldn't be able to silently turn host-side logging on.
|
|
95
|
+
*/
|
|
96
|
+
dumpSystemPrompt?: boolean;
|
|
97
|
+
};
|
|
98
|
+
/** Auto-create a `default` tenant if no tenants exist on first boot. */
|
|
99
|
+
autoCreateDefault?: boolean;
|
|
100
|
+
/** Override builtinConfig directory (handy for tests / Docker). */
|
|
101
|
+
builtinConfigDir?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ModelsCatalog {
|
|
104
|
+
providers: Record<string, ProviderEntry>;
|
|
105
|
+
}
|
|
106
|
+
export interface ProviderEntry {
|
|
107
|
+
baseUrl?: string;
|
|
108
|
+
api?: "anthropic-messages" | "openai-completions" | "google-generative-ai" | string;
|
|
109
|
+
apiKey?: string;
|
|
110
|
+
group?: string;
|
|
111
|
+
models?: ModelEntry[];
|
|
112
|
+
}
|
|
113
|
+
export interface ModelEntry {
|
|
114
|
+
id: string;
|
|
115
|
+
name?: string;
|
|
116
|
+
reasoning?: boolean;
|
|
117
|
+
contextWindow?: number;
|
|
118
|
+
maxTokens?: number;
|
|
119
|
+
supportsImages?: boolean;
|
|
120
|
+
/** Per-image byte cap before we hand it to the provider. Defaults
|
|
121
|
+
* by provider when omitted (see resolveImageMaxBytes). Override
|
|
122
|
+
* for self-hosted gateways with custom limits. */
|
|
123
|
+
imageMaxBytes?: number;
|
|
124
|
+
mode?: "chat" | "image-gen" | string;
|
|
125
|
+
/** Free-form provider-specific compat flags. */
|
|
126
|
+
compat?: Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
export interface WorkerSettings {
|
|
129
|
+
count?: number;
|
|
130
|
+
pollMs?: number;
|
|
131
|
+
model?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface OAuthProviderConfig {
|
|
134
|
+
id: string;
|
|
135
|
+
type: "github" | "google" | "oidc" | "lark";
|
|
136
|
+
clientId?: string;
|
|
137
|
+
clientSecret?: string;
|
|
138
|
+
issuer?: string;
|
|
139
|
+
scopes?: string[];
|
|
140
|
+
}
|
|
141
|
+
export interface BrandingConfig {
|
|
142
|
+
name?: string;
|
|
143
|
+
emoji?: string;
|
|
144
|
+
}
|
|
145
|
+
export type GlobalConfig = OverridableConfig & GlobalOnlyConfig;
|
|
146
|
+
export type TenantConfig = OverridableConfig;
|
|
147
|
+
/** Result of merging global ⊕ tenant. */
|
|
148
|
+
export interface ResolvedConfig extends OverridableConfig, GlobalOnlyConfig {
|
|
149
|
+
}
|
|
150
|
+
export declare const DEFAULTS: Required<Pick<GlobalOnlyConfig, "autoCreateDefault">> & Pick<GlobalOnlyConfig, "server" | "logging">;
|
|
151
|
+
export declare class TenantConfigForbiddenFieldError extends Error {
|
|
152
|
+
readonly tenantId: string;
|
|
153
|
+
readonly field: string;
|
|
154
|
+
readonly code: "TENANT_CONFIG_FORBIDDEN_FIELD";
|
|
155
|
+
constructor(tenantId: string, field: string);
|
|
156
|
+
}
|
|
157
|
+
export declare function loadGlobalConfig(home?: string): GlobalConfig;
|
|
158
|
+
export declare function loadTenantConfig(tenantId: string, home?: string): TenantConfig;
|
|
159
|
+
/** Compute the effective config for a tenant. */
|
|
160
|
+
export declare function resolveTenantConfig(tenantId: string, home?: string): ResolvedConfig;
|
|
161
|
+
/**
|
|
162
|
+
* Merge global and tenant configs. Tenant wins on overridable fields.
|
|
163
|
+
*
|
|
164
|
+
* - Scalars and arrays: tenant replaces global wholesale.
|
|
165
|
+
* - Objects (worker, branding, apiKeys): shallow-merge so tenant can override
|
|
166
|
+
* single keys without restating the whole object.
|
|
167
|
+
*/
|
|
168
|
+
export declare function mergeConfigs(global: GlobalConfig, tenant: TenantConfig): ResolvedConfig;
|
|
169
|
+
/** Atomic write. Writes to a temp file first, then rename. */
|
|
170
|
+
export declare function writeTenantConfig(tenantId: string, cfg: TenantConfig, home?: string): void;
|
|
171
|
+
export declare function writeGlobalConfig(cfg: GlobalConfig, home?: string): void;
|
|
172
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAqBA,wEAAwE;AACxE,MAAM,MAA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