@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,708 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import vm from 'node:vm';
|
|
4
|
+
import { processError } from '@vitest/utils/error';
|
|
5
|
+
import { normalize as normalize$1 } from 'pathe';
|
|
6
|
+
import { ViteNodeRunner, DEFAULT_REQUEST_STUBS } from 'vite-node/client';
|
|
7
|
+
import { isInternalRequest, isNodeBuiltin as isNodeBuiltin$1, isPrimitive, toFilePath } from 'vite-node/utils';
|
|
8
|
+
import { distDir } from '../path.js';
|
|
9
|
+
import { resolve as resolve$1, isAbsolute as isAbsolute$1 } from 'node:path';
|
|
10
|
+
import { MockerRegistry, mockObject, RedirectedModule, AutomockedModule } from '@vitest/mocker';
|
|
11
|
+
import { builtinModules } from 'node:module';
|
|
12
|
+
import { highlight } from '@vitest/utils';
|
|
13
|
+
|
|
14
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
15
|
+
function normalizeWindowsPath(input = "") {
|
|
16
|
+
if (!input) return input;
|
|
17
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
18
|
+
}
|
|
19
|
+
const _UNC_REGEX = /^[/\\]{2}/;
|
|
20
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
21
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
22
|
+
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
23
|
+
const normalize = function(path) {
|
|
24
|
+
if (path.length === 0) return ".";
|
|
25
|
+
path = normalizeWindowsPath(path);
|
|
26
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
27
|
+
const isPathAbsolute = isAbsolute(path);
|
|
28
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
29
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
30
|
+
if (path.length === 0) {
|
|
31
|
+
if (isPathAbsolute) return "/";
|
|
32
|
+
return trailingSeparator ? "./" : ".";
|
|
33
|
+
}
|
|
34
|
+
if (trailingSeparator) path += "/";
|
|
35
|
+
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
36
|
+
if (isUNCPath) {
|
|
37
|
+
if (!isPathAbsolute) return `//./${path}`;
|
|
38
|
+
return `//${path}`;
|
|
39
|
+
}
|
|
40
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
41
|
+
};
|
|
42
|
+
const join = function(...segments) {
|
|
43
|
+
let path = "";
|
|
44
|
+
for (const seg of segments) {
|
|
45
|
+
if (!seg) continue;
|
|
46
|
+
if (path.length > 0) {
|
|
47
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
48
|
+
const segLeading = seg[0] === "/";
|
|
49
|
+
const both = pathTrailing && segLeading;
|
|
50
|
+
if (both) path += seg.slice(1);
|
|
51
|
+
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
52
|
+
} else path += seg;
|
|
53
|
+
}
|
|
54
|
+
return normalize(path);
|
|
55
|
+
};
|
|
56
|
+
function cwd() {
|
|
57
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
58
|
+
return "/";
|
|
59
|
+
}
|
|
60
|
+
const resolve = function(...arguments_) {
|
|
61
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
62
|
+
let resolvedPath = "";
|
|
63
|
+
let resolvedAbsolute = false;
|
|
64
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
65
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
66
|
+
if (!path || path.length === 0) continue;
|
|
67
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
68
|
+
resolvedAbsolute = isAbsolute(path);
|
|
69
|
+
}
|
|
70
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
71
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
72
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
73
|
+
};
|
|
74
|
+
function normalizeString(path, allowAboveRoot) {
|
|
75
|
+
let res = "";
|
|
76
|
+
let lastSegmentLength = 0;
|
|
77
|
+
let lastSlash = -1;
|
|
78
|
+
let dots = 0;
|
|
79
|
+
let char = null;
|
|
80
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
81
|
+
if (index < path.length) char = path[index];
|
|
82
|
+
else if (char === "/") break;
|
|
83
|
+
else char = "/";
|
|
84
|
+
if (char === "/") {
|
|
85
|
+
if (lastSlash === index - 1 || dots === 1);
|
|
86
|
+
else if (dots === 2) {
|
|
87
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
88
|
+
if (res.length > 2) {
|
|
89
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
90
|
+
if (lastSlashIndex === -1) {
|
|
91
|
+
res = "";
|
|
92
|
+
lastSegmentLength = 0;
|
|
93
|
+
} else {
|
|
94
|
+
res = res.slice(0, lastSlashIndex);
|
|
95
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
96
|
+
}
|
|
97
|
+
lastSlash = index;
|
|
98
|
+
dots = 0;
|
|
99
|
+
continue;
|
|
100
|
+
} else if (res.length > 0) {
|
|
101
|
+
res = "";
|
|
102
|
+
lastSegmentLength = 0;
|
|
103
|
+
lastSlash = index;
|
|
104
|
+
dots = 0;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (allowAboveRoot) {
|
|
109
|
+
res += res.length > 0 ? "/.." : "..";
|
|
110
|
+
lastSegmentLength = 2;
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
114
|
+
else res = path.slice(lastSlash + 1, index);
|
|
115
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
116
|
+
}
|
|
117
|
+
lastSlash = index;
|
|
118
|
+
dots = 0;
|
|
119
|
+
} else if (char === "." && dots !== -1) ++dots;
|
|
120
|
+
else dots = -1;
|
|
121
|
+
}
|
|
122
|
+
return res;
|
|
123
|
+
}
|
|
124
|
+
const isAbsolute = function(p) {
|
|
125
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
126
|
+
};
|
|
127
|
+
const extname = function(p) {
|
|
128
|
+
if (p === "..") return "";
|
|
129
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
130
|
+
return match && match[1] || "";
|
|
131
|
+
};
|
|
132
|
+
const dirname = function(p) {
|
|
133
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
134
|
+
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
135
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
136
|
+
};
|
|
137
|
+
const basename = function(p, extension) {
|
|
138
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
139
|
+
let lastSegment = "";
|
|
140
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
141
|
+
const val = segments[i];
|
|
142
|
+
if (val) {
|
|
143
|
+
lastSegment = val;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const { existsSync, readdirSync, statSync } = fs;
|
|
151
|
+
function findMockRedirect(root, mockPath, external) {
|
|
152
|
+
const path = external || mockPath;
|
|
153
|
+
// it's a node_module alias
|
|
154
|
+
// all mocks should be inside <root>/__mocks__
|
|
155
|
+
if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
|
|
156
|
+
const mockDirname = dirname(path);
|
|
157
|
+
const mockFolder = join(root, "__mocks__", mockDirname);
|
|
158
|
+
if (!existsSync(mockFolder)) return null;
|
|
159
|
+
const baseOriginal = basename(path);
|
|
160
|
+
function findFile(mockFolder, baseOriginal) {
|
|
161
|
+
const files = readdirSync(mockFolder);
|
|
162
|
+
for (const file of files) {
|
|
163
|
+
const baseFile = basename(file, extname(file));
|
|
164
|
+
if (baseFile === baseOriginal) {
|
|
165
|
+
const path = resolve(mockFolder, file);
|
|
166
|
+
// if the same name, return the file
|
|
167
|
+
if (statSync(path).isFile()) return path;
|
|
168
|
+
else {
|
|
169
|
+
// find folder/index.{js,ts}
|
|
170
|
+
const indexFile = findFile(path, "index");
|
|
171
|
+
if (indexFile) return indexFile;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return findFile(mockFolder, baseOriginal);
|
|
178
|
+
}
|
|
179
|
+
const dir = dirname(path);
|
|
180
|
+
const baseId = basename(path);
|
|
181
|
+
const fullPath = resolve(dir, "__mocks__", baseId);
|
|
182
|
+
return existsSync(fullPath) ? fullPath : null;
|
|
183
|
+
}
|
|
184
|
+
const builtins = new Set([
|
|
185
|
+
...builtinModules,
|
|
186
|
+
"assert/strict",
|
|
187
|
+
"diagnostics_channel",
|
|
188
|
+
"dns/promises",
|
|
189
|
+
"fs/promises",
|
|
190
|
+
"path/posix",
|
|
191
|
+
"path/win32",
|
|
192
|
+
"readline/promises",
|
|
193
|
+
"stream/consumers",
|
|
194
|
+
"stream/promises",
|
|
195
|
+
"stream/web",
|
|
196
|
+
"timers/promises",
|
|
197
|
+
"util/types",
|
|
198
|
+
"wasi"
|
|
199
|
+
]);
|
|
200
|
+
// https://nodejs.org/api/modules.html#built-in-modules-with-mandatory-node-prefix
|
|
201
|
+
const prefixedBuiltins = new Set([
|
|
202
|
+
"node:sea",
|
|
203
|
+
"node:sqlite",
|
|
204
|
+
"node:test",
|
|
205
|
+
"node:test/reporters"
|
|
206
|
+
]);
|
|
207
|
+
const NODE_BUILTIN_NAMESPACE = "node:";
|
|
208
|
+
function isNodeBuiltin(id) {
|
|
209
|
+
if (prefixedBuiltins.has(id)) return true;
|
|
210
|
+
return builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(NODE_BUILTIN_NAMESPACE.length) : id);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const spyModulePath = resolve$1(distDir, "spy.js");
|
|
214
|
+
class VitestMocker {
|
|
215
|
+
static pendingIds = [];
|
|
216
|
+
spyModule;
|
|
217
|
+
primitives;
|
|
218
|
+
filterPublicKeys;
|
|
219
|
+
registries = /* @__PURE__ */ new Map();
|
|
220
|
+
mockContext = { callstack: null };
|
|
221
|
+
constructor(executor) {
|
|
222
|
+
this.executor = executor;
|
|
223
|
+
const context = this.executor.options.context;
|
|
224
|
+
if (context) this.primitives = vm.runInContext("({ Object, Error, Function, RegExp, Symbol, Array, Map })", context);
|
|
225
|
+
else this.primitives = {
|
|
226
|
+
Object,
|
|
227
|
+
Error,
|
|
228
|
+
Function,
|
|
229
|
+
RegExp,
|
|
230
|
+
Symbol: globalThis.Symbol,
|
|
231
|
+
Array,
|
|
232
|
+
Map
|
|
233
|
+
};
|
|
234
|
+
const Symbol = this.primitives.Symbol;
|
|
235
|
+
this.filterPublicKeys = [
|
|
236
|
+
"__esModule",
|
|
237
|
+
Symbol.asyncIterator,
|
|
238
|
+
Symbol.hasInstance,
|
|
239
|
+
Symbol.isConcatSpreadable,
|
|
240
|
+
Symbol.iterator,
|
|
241
|
+
Symbol.match,
|
|
242
|
+
Symbol.matchAll,
|
|
243
|
+
Symbol.replace,
|
|
244
|
+
Symbol.search,
|
|
245
|
+
Symbol.split,
|
|
246
|
+
Symbol.species,
|
|
247
|
+
Symbol.toPrimitive,
|
|
248
|
+
Symbol.toStringTag,
|
|
249
|
+
Symbol.unscopables
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
get root() {
|
|
253
|
+
return this.executor.options.root;
|
|
254
|
+
}
|
|
255
|
+
get moduleCache() {
|
|
256
|
+
return this.executor.moduleCache;
|
|
257
|
+
}
|
|
258
|
+
get moduleDirectories() {
|
|
259
|
+
return this.executor.options.moduleDirectories || [];
|
|
260
|
+
}
|
|
261
|
+
async initializeSpyModule() {
|
|
262
|
+
this.spyModule = await this.executor.executeId(spyModulePath);
|
|
263
|
+
}
|
|
264
|
+
getMockerRegistry() {
|
|
265
|
+
const suite = this.getSuiteFilepath();
|
|
266
|
+
if (!this.registries.has(suite)) this.registries.set(suite, new MockerRegistry());
|
|
267
|
+
return this.registries.get(suite);
|
|
268
|
+
}
|
|
269
|
+
reset() {
|
|
270
|
+
this.registries.clear();
|
|
271
|
+
}
|
|
272
|
+
deleteCachedItem(id) {
|
|
273
|
+
const mockId = this.getMockPath(id);
|
|
274
|
+
if (this.moduleCache.has(mockId)) this.moduleCache.delete(mockId);
|
|
275
|
+
}
|
|
276
|
+
isModuleDirectory(path) {
|
|
277
|
+
return this.moduleDirectories.some((dir) => path.includes(dir));
|
|
278
|
+
}
|
|
279
|
+
getSuiteFilepath() {
|
|
280
|
+
return this.executor.state.filepath || "global";
|
|
281
|
+
}
|
|
282
|
+
createError(message, codeFrame) {
|
|
283
|
+
const Error = this.primitives.Error;
|
|
284
|
+
const error = new Error(message);
|
|
285
|
+
Object.assign(error, { codeFrame });
|
|
286
|
+
return error;
|
|
287
|
+
}
|
|
288
|
+
async resolvePath(rawId, importer) {
|
|
289
|
+
let id;
|
|
290
|
+
let fsPath;
|
|
291
|
+
try {
|
|
292
|
+
[id, fsPath] = await this.executor.originalResolveUrl(rawId, importer);
|
|
293
|
+
} catch (error) {
|
|
294
|
+
// it's allowed to mock unresolved modules
|
|
295
|
+
if (error.code === "ERR_MODULE_NOT_FOUND") {
|
|
296
|
+
const { id: unresolvedId } = error[Symbol.for("vitest.error.not_found.data")];
|
|
297
|
+
id = unresolvedId;
|
|
298
|
+
fsPath = unresolvedId;
|
|
299
|
+
} else throw error;
|
|
300
|
+
}
|
|
301
|
+
// external is node_module or unresolved module
|
|
302
|
+
// for example, some people mock "vscode" and don't have it installed
|
|
303
|
+
const external = !isAbsolute$1(fsPath) || this.isModuleDirectory(fsPath) ? rawId : null;
|
|
304
|
+
return {
|
|
305
|
+
id,
|
|
306
|
+
fsPath,
|
|
307
|
+
external: external ? this.normalizePath(external) : external
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
async resolveMocks() {
|
|
311
|
+
if (!VitestMocker.pendingIds.length) return;
|
|
312
|
+
await Promise.all(VitestMocker.pendingIds.map(async (mock) => {
|
|
313
|
+
const { fsPath, external } = await this.resolvePath(mock.id, mock.importer);
|
|
314
|
+
if (mock.action === "unmock") this.unmockPath(fsPath);
|
|
315
|
+
if (mock.action === "mock") this.mockPath(mock.id, fsPath, external, mock.type, mock.factory);
|
|
316
|
+
}));
|
|
317
|
+
VitestMocker.pendingIds = [];
|
|
318
|
+
}
|
|
319
|
+
async callFunctionMock(dep, mock) {
|
|
320
|
+
const cached = this.moduleCache.get(dep)?.exports;
|
|
321
|
+
if (cached) return cached;
|
|
322
|
+
const exports = await mock.resolve();
|
|
323
|
+
const moduleExports = new Proxy(exports, { get: (target, prop) => {
|
|
324
|
+
const val = target[prop];
|
|
325
|
+
// 'then' can exist on non-Promise objects, need nested instanceof check for logic to work
|
|
326
|
+
if (prop === "then") {
|
|
327
|
+
if (target instanceof Promise) return target.then.bind(target);
|
|
328
|
+
} else if (!(prop in target)) {
|
|
329
|
+
if (this.filterPublicKeys.includes(prop)) return void 0;
|
|
330
|
+
throw this.createError(`[vitest] No "${String(prop)}" export is defined on the "${mock.raw}" mock. Did you forget to return it from "vi.mock"?
|
|
331
|
+
If you need to partially mock a module, you can use "importOriginal" helper inside:
|
|
332
|
+
`, highlight(`vi.mock(import("${mock.raw}"), async (importOriginal) => {
|
|
333
|
+
const actual = await importOriginal()
|
|
334
|
+
return {
|
|
335
|
+
...actual,
|
|
336
|
+
// your mocked methods
|
|
337
|
+
}
|
|
338
|
+
})`));
|
|
339
|
+
}
|
|
340
|
+
return val;
|
|
341
|
+
} });
|
|
342
|
+
this.moduleCache.set(dep, { exports: moduleExports });
|
|
343
|
+
return moduleExports;
|
|
344
|
+
}
|
|
345
|
+
// public method to avoid circular dependency
|
|
346
|
+
getMockContext() {
|
|
347
|
+
return this.mockContext;
|
|
348
|
+
}
|
|
349
|
+
// path used to store mocked dependencies
|
|
350
|
+
getMockPath(dep) {
|
|
351
|
+
return `mock:${dep}`;
|
|
352
|
+
}
|
|
353
|
+
getDependencyMock(id) {
|
|
354
|
+
const registry = this.getMockerRegistry();
|
|
355
|
+
return registry.get(id);
|
|
356
|
+
}
|
|
357
|
+
normalizePath(path) {
|
|
358
|
+
return this.moduleCache.normalizePath(path);
|
|
359
|
+
}
|
|
360
|
+
resolveMockPath(mockPath, external) {
|
|
361
|
+
return findMockRedirect(this.root, mockPath, external);
|
|
362
|
+
}
|
|
363
|
+
mockObject(object, mockExports = {}, behavior = "automock") {
|
|
364
|
+
const spyOn = this.spyModule?.spyOn;
|
|
365
|
+
if (!spyOn) throw this.createError("[vitest] `spyModule` is not defined. This is a Vitest error. Please open a new issue with reproduction.");
|
|
366
|
+
return mockObject({
|
|
367
|
+
globalConstructors: this.primitives,
|
|
368
|
+
spyOn,
|
|
369
|
+
type: behavior
|
|
370
|
+
}, object, mockExports);
|
|
371
|
+
}
|
|
372
|
+
unmockPath(path) {
|
|
373
|
+
const registry = this.getMockerRegistry();
|
|
374
|
+
const id = this.normalizePath(path);
|
|
375
|
+
registry.delete(id);
|
|
376
|
+
this.deleteCachedItem(id);
|
|
377
|
+
}
|
|
378
|
+
mockPath(originalId, path, external, mockType, factory) {
|
|
379
|
+
const registry = this.getMockerRegistry();
|
|
380
|
+
const id = this.normalizePath(path);
|
|
381
|
+
if (mockType === "manual") registry.register("manual", originalId, id, id, factory);
|
|
382
|
+
else if (mockType === "autospy") registry.register("autospy", originalId, id, id);
|
|
383
|
+
else {
|
|
384
|
+
const redirect = this.resolveMockPath(id, external);
|
|
385
|
+
if (redirect) registry.register("redirect", originalId, id, id, redirect);
|
|
386
|
+
else registry.register("automock", originalId, id, id);
|
|
387
|
+
}
|
|
388
|
+
// every time the mock is registered, we remove the previous one from the cache
|
|
389
|
+
this.deleteCachedItem(id);
|
|
390
|
+
}
|
|
391
|
+
async importActual(rawId, importer, callstack) {
|
|
392
|
+
const { id, fsPath } = await this.resolvePath(rawId, importer);
|
|
393
|
+
const result = await this.executor.cachedRequest(id, fsPath, callstack || [importer]);
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
async importMock(rawId, importee) {
|
|
397
|
+
const { id, fsPath, external } = await this.resolvePath(rawId, importee);
|
|
398
|
+
const normalizedId = this.normalizePath(fsPath);
|
|
399
|
+
let mock = this.getDependencyMock(normalizedId);
|
|
400
|
+
if (!mock) {
|
|
401
|
+
const redirect = this.resolveMockPath(normalizedId, external);
|
|
402
|
+
if (redirect) mock = new RedirectedModule(rawId, normalizedId, normalizedId, redirect);
|
|
403
|
+
else mock = new AutomockedModule(rawId, normalizedId, normalizedId);
|
|
404
|
+
}
|
|
405
|
+
if (mock.type === "automock" || mock.type === "autospy") {
|
|
406
|
+
const mod = await this.executor.cachedRequest(id, fsPath, [importee]);
|
|
407
|
+
return this.mockObject(mod, {}, mock.type);
|
|
408
|
+
}
|
|
409
|
+
if (mock.type === "manual") return this.callFunctionMock(fsPath, mock);
|
|
410
|
+
return this.executor.dependencyRequest(mock.redirect, mock.redirect, [importee]);
|
|
411
|
+
}
|
|
412
|
+
async requestWithMock(url, callstack) {
|
|
413
|
+
const id = this.normalizePath(url);
|
|
414
|
+
const mock = this.getDependencyMock(id);
|
|
415
|
+
if (!mock) return;
|
|
416
|
+
const mockPath = this.getMockPath(id);
|
|
417
|
+
if (mock.type === "automock" || mock.type === "autospy") {
|
|
418
|
+
const cache = this.moduleCache.get(mockPath);
|
|
419
|
+
if (cache.exports) return cache.exports;
|
|
420
|
+
const exports = {};
|
|
421
|
+
// Assign the empty exports object early to allow for cycles to work. The object will be filled by mockObject()
|
|
422
|
+
this.moduleCache.set(mockPath, { exports });
|
|
423
|
+
const mod = await this.executor.directRequest(url, url, callstack);
|
|
424
|
+
this.mockObject(mod, exports, mock.type);
|
|
425
|
+
return exports;
|
|
426
|
+
}
|
|
427
|
+
if (mock.type === "manual" && !callstack.includes(mockPath) && !callstack.includes(url)) try {
|
|
428
|
+
callstack.push(mockPath);
|
|
429
|
+
// this will not work if user does Promise.all(import(), import())
|
|
430
|
+
// we can also use AsyncLocalStorage to store callstack, but this won't work in the browser
|
|
431
|
+
// maybe we should improve mock API in the future?
|
|
432
|
+
this.mockContext.callstack = callstack;
|
|
433
|
+
return await this.callFunctionMock(mockPath, mock);
|
|
434
|
+
} finally {
|
|
435
|
+
this.mockContext.callstack = null;
|
|
436
|
+
const indexMock = callstack.indexOf(mockPath);
|
|
437
|
+
callstack.splice(indexMock, 1);
|
|
438
|
+
}
|
|
439
|
+
else if (mock.type === "redirect" && !callstack.includes(mock.redirect)) return mock.redirect;
|
|
440
|
+
}
|
|
441
|
+
queueMock(id, importer, factoryOrOptions) {
|
|
442
|
+
const mockType = getMockType(factoryOrOptions);
|
|
443
|
+
VitestMocker.pendingIds.push({
|
|
444
|
+
action: "mock",
|
|
445
|
+
id,
|
|
446
|
+
importer,
|
|
447
|
+
factory: typeof factoryOrOptions === "function" ? factoryOrOptions : void 0,
|
|
448
|
+
type: mockType
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
queueUnmock(id, importer) {
|
|
452
|
+
VitestMocker.pendingIds.push({
|
|
453
|
+
action: "unmock",
|
|
454
|
+
id,
|
|
455
|
+
importer
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function getMockType(factoryOrOptions) {
|
|
460
|
+
if (!factoryOrOptions) return "automock";
|
|
461
|
+
if (typeof factoryOrOptions === "function") return "manual";
|
|
462
|
+
return factoryOrOptions.spy ? "autospy" : "automock";
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const normalizedDistDir = normalize$1(distDir);
|
|
466
|
+
const { readFileSync } = fs;
|
|
467
|
+
async function createVitestExecutor(options) {
|
|
468
|
+
const runner = new VitestExecutor(options);
|
|
469
|
+
await runner.executeId("/@vite/env");
|
|
470
|
+
await runner.mocker.initializeSpyModule();
|
|
471
|
+
return runner;
|
|
472
|
+
}
|
|
473
|
+
const externalizeMap = /* @__PURE__ */ new Map();
|
|
474
|
+
const bareVitestRegexp = /^@?vitest(?:\/|$)/;
|
|
475
|
+
const dispose = [];
|
|
476
|
+
function listenForErrors(state) {
|
|
477
|
+
dispose.forEach((fn) => fn());
|
|
478
|
+
dispose.length = 0;
|
|
479
|
+
function catchError(err, type, event) {
|
|
480
|
+
const worker = state();
|
|
481
|
+
const listeners = process.listeners(event);
|
|
482
|
+
// if there is another listener, assume that it's handled by user code
|
|
483
|
+
// one is Vitest's own listener
|
|
484
|
+
if (listeners.length > 1) return;
|
|
485
|
+
const error = processError(err);
|
|
486
|
+
if (!isPrimitive(error)) {
|
|
487
|
+
error.VITEST_TEST_NAME = worker.current?.type === "test" ? worker.current.name : void 0;
|
|
488
|
+
if (worker.filepath) error.VITEST_TEST_PATH = worker.filepath;
|
|
489
|
+
error.VITEST_AFTER_ENV_TEARDOWN = worker.environmentTeardownRun;
|
|
490
|
+
}
|
|
491
|
+
state().rpc.onUnhandledError(error, type);
|
|
492
|
+
}
|
|
493
|
+
const uncaughtException = (e) => catchError(e, "Uncaught Exception", "uncaughtException");
|
|
494
|
+
const unhandledRejection = (e) => catchError(e, "Unhandled Rejection", "unhandledRejection");
|
|
495
|
+
process.on("uncaughtException", uncaughtException);
|
|
496
|
+
process.on("unhandledRejection", unhandledRejection);
|
|
497
|
+
dispose.push(() => {
|
|
498
|
+
process.off("uncaughtException", uncaughtException);
|
|
499
|
+
process.off("unhandledRejection", unhandledRejection);
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
const relativeIds = {};
|
|
503
|
+
function getVitestImport(id, state) {
|
|
504
|
+
if (externalizeMap.has(id)) return { externalize: externalizeMap.get(id) };
|
|
505
|
+
// always externalize Vitest because we import from there before running tests
|
|
506
|
+
// so we already have it cached by Node.js
|
|
507
|
+
const root = state().config.root;
|
|
508
|
+
const relativeRoot = relativeIds[root] ?? (relativeIds[root] = normalizedDistDir.slice(root.length));
|
|
509
|
+
if (id.includes(distDir) || id.includes(normalizedDistDir) || relativeRoot && relativeRoot !== "/" && id.startsWith(relativeRoot)) {
|
|
510
|
+
const { path } = toFilePath(id, root);
|
|
511
|
+
const externalize = pathToFileURL(path).toString();
|
|
512
|
+
externalizeMap.set(id, externalize);
|
|
513
|
+
return { externalize };
|
|
514
|
+
}
|
|
515
|
+
if (bareVitestRegexp.test(id)) {
|
|
516
|
+
externalizeMap.set(id, id);
|
|
517
|
+
return { externalize: id };
|
|
518
|
+
}
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
async function startVitestExecutor(options) {
|
|
522
|
+
const state = () => globalThis.__vitest_worker__ || options.state;
|
|
523
|
+
const rpc = () => state().rpc;
|
|
524
|
+
process.exit = (code = process.exitCode || 0) => {
|
|
525
|
+
throw new Error(`process.exit unexpectedly called with "${code}"`);
|
|
526
|
+
};
|
|
527
|
+
listenForErrors(state);
|
|
528
|
+
const getTransformMode = () => {
|
|
529
|
+
return state().environment.transformMode ?? "ssr";
|
|
530
|
+
};
|
|
531
|
+
return await createVitestExecutor({
|
|
532
|
+
async fetchModule(id) {
|
|
533
|
+
const vitest = getVitestImport(id, state);
|
|
534
|
+
if (vitest) return vitest;
|
|
535
|
+
const result = await rpc().fetch(id, getTransformMode());
|
|
536
|
+
if (result.id && !result.externalize) {
|
|
537
|
+
const code = readFileSync(result.id, "utf-8");
|
|
538
|
+
return { code };
|
|
539
|
+
}
|
|
540
|
+
return result;
|
|
541
|
+
},
|
|
542
|
+
resolveId(id, importer) {
|
|
543
|
+
return rpc().resolveId(id, importer, getTransformMode());
|
|
544
|
+
},
|
|
545
|
+
get moduleCache() {
|
|
546
|
+
return state().moduleCache;
|
|
547
|
+
},
|
|
548
|
+
get moduleExecutionInfo() {
|
|
549
|
+
return state().moduleExecutionInfo;
|
|
550
|
+
},
|
|
551
|
+
get interopDefault() {
|
|
552
|
+
return state().config.deps.interopDefault;
|
|
553
|
+
},
|
|
554
|
+
get moduleDirectories() {
|
|
555
|
+
return state().config.deps.moduleDirectories;
|
|
556
|
+
},
|
|
557
|
+
get root() {
|
|
558
|
+
return state().config.root;
|
|
559
|
+
},
|
|
560
|
+
get base() {
|
|
561
|
+
return state().config.base;
|
|
562
|
+
},
|
|
563
|
+
...options
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function updateStyle(id, css) {
|
|
567
|
+
if (typeof document === "undefined") return;
|
|
568
|
+
const element = document.querySelector(`[data-vite-dev-id="${id}"]`);
|
|
569
|
+
if (element) {
|
|
570
|
+
element.textContent = css;
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
const head = document.querySelector("head");
|
|
574
|
+
const style = document.createElement("style");
|
|
575
|
+
style.setAttribute("type", "text/css");
|
|
576
|
+
style.setAttribute("data-vite-dev-id", id);
|
|
577
|
+
style.textContent = css;
|
|
578
|
+
head?.appendChild(style);
|
|
579
|
+
}
|
|
580
|
+
function removeStyle(id) {
|
|
581
|
+
if (typeof document === "undefined") return;
|
|
582
|
+
const sheet = document.querySelector(`[data-vite-dev-id="${id}"]`);
|
|
583
|
+
if (sheet) document.head.removeChild(sheet);
|
|
584
|
+
}
|
|
585
|
+
function getDefaultRequestStubs(context) {
|
|
586
|
+
if (!context) {
|
|
587
|
+
const clientStub = {
|
|
588
|
+
...DEFAULT_REQUEST_STUBS["@vite/client"],
|
|
589
|
+
updateStyle,
|
|
590
|
+
removeStyle
|
|
591
|
+
};
|
|
592
|
+
return {
|
|
593
|
+
"/@vite/client": clientStub,
|
|
594
|
+
"@vite/client": clientStub
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
const clientStub = vm.runInContext(`(defaultClient) => ({ ...defaultClient, updateStyle: ${updateStyle.toString()}, removeStyle: ${removeStyle.toString()} })`, context)(DEFAULT_REQUEST_STUBS["@vite/client"]);
|
|
598
|
+
return {
|
|
599
|
+
"/@vite/client": clientStub,
|
|
600
|
+
"@vite/client": clientStub
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
class VitestExecutor extends ViteNodeRunner {
|
|
604
|
+
mocker;
|
|
605
|
+
externalModules;
|
|
606
|
+
primitives;
|
|
607
|
+
constructor(options) {
|
|
608
|
+
super({
|
|
609
|
+
...options,
|
|
610
|
+
interopDefault: options.context ? false : options.interopDefault
|
|
611
|
+
});
|
|
612
|
+
this.options = options;
|
|
613
|
+
this.mocker = new VitestMocker(this);
|
|
614
|
+
if (!options.context) {
|
|
615
|
+
Object.defineProperty(globalThis, "__vitest_mocker__", {
|
|
616
|
+
value: this.mocker,
|
|
617
|
+
writable: true,
|
|
618
|
+
configurable: true
|
|
619
|
+
});
|
|
620
|
+
this.primitives = {
|
|
621
|
+
Object,
|
|
622
|
+
Reflect,
|
|
623
|
+
Symbol
|
|
624
|
+
};
|
|
625
|
+
} else if (options.externalModulesExecutor) {
|
|
626
|
+
this.primitives = vm.runInContext("({ Object, Reflect, Symbol })", options.context);
|
|
627
|
+
this.externalModules = options.externalModulesExecutor;
|
|
628
|
+
} else throw new Error("When context is provided, externalModulesExecutor must be provided as well.");
|
|
629
|
+
}
|
|
630
|
+
getContextPrimitives() {
|
|
631
|
+
return this.primitives;
|
|
632
|
+
}
|
|
633
|
+
get state() {
|
|
634
|
+
// @ts-expect-error injected untyped global
|
|
635
|
+
return globalThis.__vitest_worker__ || this.options.state;
|
|
636
|
+
}
|
|
637
|
+
get moduleExecutionInfo() {
|
|
638
|
+
return this.options.moduleExecutionInfo;
|
|
639
|
+
}
|
|
640
|
+
shouldResolveId(id, _importee) {
|
|
641
|
+
if (isInternalRequest(id) || id.startsWith("data:")) return false;
|
|
642
|
+
const transformMode = this.state.environment?.transformMode ?? "ssr";
|
|
643
|
+
// do not try and resolve node builtins in Node
|
|
644
|
+
// import('url') returns Node internal even if 'url' package is installed
|
|
645
|
+
return transformMode === "ssr" ? !isNodeBuiltin$1(id) : !id.startsWith("node:");
|
|
646
|
+
}
|
|
647
|
+
async originalResolveUrl(id, importer) {
|
|
648
|
+
return super.resolveUrl(id, importer);
|
|
649
|
+
}
|
|
650
|
+
async resolveUrl(id, importer) {
|
|
651
|
+
if (VitestMocker.pendingIds.length) await this.mocker.resolveMocks();
|
|
652
|
+
if (importer && importer.startsWith("mock:")) importer = importer.slice(5);
|
|
653
|
+
try {
|
|
654
|
+
return await super.resolveUrl(id, importer);
|
|
655
|
+
} catch (error) {
|
|
656
|
+
if (error.code === "ERR_MODULE_NOT_FOUND") {
|
|
657
|
+
const { id } = error[Symbol.for("vitest.error.not_found.data")];
|
|
658
|
+
const path = this.mocker.normalizePath(id);
|
|
659
|
+
const mock = this.mocker.getDependencyMock(path);
|
|
660
|
+
if (mock !== void 0) return [id, id];
|
|
661
|
+
}
|
|
662
|
+
throw error;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
async runModule(context, transformed) {
|
|
666
|
+
const vmContext = this.options.context;
|
|
667
|
+
if (!vmContext || !this.externalModules) return super.runModule(context, transformed);
|
|
668
|
+
// add 'use strict' since ESM enables it by default
|
|
669
|
+
const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{`;
|
|
670
|
+
const code = `${codeDefinition}${transformed}\n}}`;
|
|
671
|
+
const options = {
|
|
672
|
+
filename: context.__filename,
|
|
673
|
+
lineOffset: 0,
|
|
674
|
+
columnOffset: -codeDefinition.length
|
|
675
|
+
};
|
|
676
|
+
const finishModuleExecutionInfo = this.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
677
|
+
try {
|
|
678
|
+
const fn = vm.runInContext(code, vmContext, {
|
|
679
|
+
...options,
|
|
680
|
+
importModuleDynamically: this.externalModules.importModuleDynamically
|
|
681
|
+
});
|
|
682
|
+
await fn(...Object.values(context));
|
|
683
|
+
} finally {
|
|
684
|
+
this.options.moduleExecutionInfo?.set(options.filename, finishModuleExecutionInfo());
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
async importExternalModule(path) {
|
|
688
|
+
if (this.externalModules) return this.externalModules.import(path);
|
|
689
|
+
return super.importExternalModule(path);
|
|
690
|
+
}
|
|
691
|
+
async dependencyRequest(id, fsPath, callstack) {
|
|
692
|
+
const mocked = await this.mocker.requestWithMock(fsPath, callstack);
|
|
693
|
+
if (typeof mocked === "string") return super.dependencyRequest(mocked, mocked, callstack);
|
|
694
|
+
if (mocked && typeof mocked === "object") return mocked;
|
|
695
|
+
return super.dependencyRequest(id, fsPath, callstack);
|
|
696
|
+
}
|
|
697
|
+
prepareContext(context) {
|
|
698
|
+
// support `import.meta.vitest` for test entry
|
|
699
|
+
if (this.state.filepath && normalize$1(this.state.filepath) === normalize$1(context.__filename)) {
|
|
700
|
+
const globalNamespace = this.options.context || globalThis;
|
|
701
|
+
Object.defineProperty(context.__vite_ssr_import_meta__, "vitest", { get: () => globalNamespace.__vitest_index__ });
|
|
702
|
+
}
|
|
703
|
+
if (this.options.context && this.externalModules) context.require = this.externalModules.createRequire(context.__filename);
|
|
704
|
+
return context;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export { VitestExecutor as V, getDefaultRequestStubs as g, startVitestExecutor as s };
|