@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,104 @@
|
|
|
1
|
+
// list_dir — agent tool that lists directory contents.
|
|
2
|
+
//
|
|
3
|
+
// Visibility scope is the per-user home (per-user-tools rule, see
|
|
4
|
+
// path-helper.ts). Returns a JSON-friendly tool-result; the agent
|
|
5
|
+
// then decides how to render or chain calls.
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { Type } from "typebox";
|
|
9
|
+
import { resolveInUserHome, toWorkspaceUri, PathOutsideRootError, } from "./path-helper.js";
|
|
10
|
+
const MAX_ENTRIES = 5000;
|
|
11
|
+
/** Build the tool definition (Type schema) and a separate executor.
|
|
12
|
+
* Keeping these separate lets the chat handler register the schema
|
|
13
|
+
* with pi-ai while invoking the executor inside its own loop with
|
|
14
|
+
* the per-request user home. */
|
|
15
|
+
export function listDirSchema() {
|
|
16
|
+
return {
|
|
17
|
+
name: "list_dir",
|
|
18
|
+
description: "List the entries in a directory inside the workspace. Use this to discover " +
|
|
19
|
+
"what files exist. Paths are interpreted relative to the workspace root; " +
|
|
20
|
+
"prefer relative paths (`notes`, `src/foo`) over leading-slash forms. " +
|
|
21
|
+
"Use `.` (or omit `path`) for the workspace root itself. " +
|
|
22
|
+
"NOTE: a leading-slash path here means \"workspace root\", NOT the sandbox " +
|
|
23
|
+
"OS root \u2014 inside `exec`, the same `/foo` would resolve to the sandbox " +
|
|
24
|
+
"filesystem root. Stick to relative paths to keep both worlds aligned. " +
|
|
25
|
+
"Returns at most 5000 entries; if truncated the response says so.",
|
|
26
|
+
parameters: Type.Object({
|
|
27
|
+
path: Type.String({
|
|
28
|
+
description: 'Directory path relative to the workspace root, e.g. ".", "notes", or "src/foo". Default "." (workspace root).',
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function executeListDir(userHome, args) {
|
|
34
|
+
const requested = args.path ?? "/";
|
|
35
|
+
let resolved;
|
|
36
|
+
try {
|
|
37
|
+
resolved = resolveInUserHome(userHome, requested);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (err instanceof PathOutsideRootError) {
|
|
41
|
+
return { ok: false, text: `path is outside the workspace: ${requested}` };
|
|
42
|
+
}
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
// Auto-create the user home on first read. Sub-paths are NOT auto-
|
|
46
|
+
// created — that's a 404 the agent should observe.
|
|
47
|
+
if (resolved === path.resolve(userHome) && !fs.existsSync(resolved)) {
|
|
48
|
+
fs.mkdirSync(resolved, { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
if (!fs.existsSync(resolved)) {
|
|
51
|
+
return { ok: false, text: `not found: ${requested}` };
|
|
52
|
+
}
|
|
53
|
+
const stat = fs.statSync(resolved);
|
|
54
|
+
if (!stat.isDirectory()) {
|
|
55
|
+
return { ok: false, text: `not a directory: ${requested}` };
|
|
56
|
+
}
|
|
57
|
+
const dirents = fs.readdirSync(resolved, { withFileTypes: true });
|
|
58
|
+
const truncated = dirents.length > MAX_ENTRIES;
|
|
59
|
+
const slice = dirents.slice(0, MAX_ENTRIES);
|
|
60
|
+
const entries = slice.map((d) => {
|
|
61
|
+
const full = path.join(resolved, d.name);
|
|
62
|
+
let size = 0;
|
|
63
|
+
let modifiedMs = 0;
|
|
64
|
+
try {
|
|
65
|
+
const s = fs.statSync(full);
|
|
66
|
+
size = s.size;
|
|
67
|
+
modifiedMs = s.mtimeMs;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
/* swallow — broken symlinks etc. */
|
|
71
|
+
}
|
|
72
|
+
const type = d.isDirectory()
|
|
73
|
+
? "directory"
|
|
74
|
+
: d.isFile()
|
|
75
|
+
? "file"
|
|
76
|
+
: "other";
|
|
77
|
+
return {
|
|
78
|
+
name: d.name,
|
|
79
|
+
path: toWorkspaceUri(userHome, full),
|
|
80
|
+
type,
|
|
81
|
+
size,
|
|
82
|
+
modifiedMs,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
// Directories first, then files alphabetically.
|
|
86
|
+
entries.sort((a, b) => {
|
|
87
|
+
if (a.type !== b.type) {
|
|
88
|
+
if (a.type === "directory")
|
|
89
|
+
return -1;
|
|
90
|
+
if (b.type === "directory")
|
|
91
|
+
return 1;
|
|
92
|
+
}
|
|
93
|
+
return a.name.localeCompare(b.name);
|
|
94
|
+
});
|
|
95
|
+
const lines = entries.map((e) => e.type === "directory" ? `${e.path}/` : `${e.path} (${e.size} bytes)`);
|
|
96
|
+
const header = `Directory ${toWorkspaceUri(userHome, resolved)} (${entries.length} ${entries.length === 1 ? "entry" : "entries"}${truncated ? ", truncated" : ""}):`;
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
text: [header, ...lines].join("\n"),
|
|
100
|
+
entries,
|
|
101
|
+
truncated,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=list-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-dir.js","sourceRoot":"","sources":["../../src/tools/list-dir.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,kEAAkE;AAClE,kEAAkE;AAClE,6CAA6C;AAE7C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,GAAG,IAAI,CAAC;AAiBzB;;;iCAGiC;AACjC,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,6EAA6E;YAC7E,0EAA0E;YAC1E,uEAAuE;YACvE,0DAA0D;YAC1D,4EAA4E;YAC5E,6EAA6E;YAC7E,wEAAwE;YACxE,kEAAkE;QACpE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;gBAChB,WAAW,EACT,+GAA+G;aAClH,CAAC;SACH,CAAC;KACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,IAAuB;IAEvB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,IAAI,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C,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,SAAS,CACvE,CAAC;IACF,MAAM,MAAM,GAAG,aAAa,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACrK,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnC,OAAO;QACP,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-prompt.d.ts","sourceRoot":"","sources":["../../src/tools/load-prompt.ts"],"names":[],"mappings":"AAsBA;;yCAEyC;AACzC,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAe/C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Tiny helper that loads a `*.prompt.md` sibling file at module-
|
|
2
|
+
// load time and returns its UTF-8 contents.
|
|
3
|
+
//
|
|
4
|
+
// Why a helper instead of inlining `readFileSync` at every call
|
|
5
|
+
// site: each tool has its own prompt and we want the tool file to
|
|
6
|
+
// just say `description: loadPrompt("edit-file.prompt.md")`. The
|
|
7
|
+
// helper resolves relative to the calling file's compiled
|
|
8
|
+
// location (dist/tools/), where copy-prompts.mjs has placed the
|
|
9
|
+
// markdown sibling — see scripts/copy-prompts.mjs for the build-
|
|
10
|
+
// time half of this contract.
|
|
11
|
+
//
|
|
12
|
+
// Loaded lazily and memoised: same prompt name only hits the
|
|
13
|
+
// disk once per process even if the schema function gets called
|
|
14
|
+
// many times (currently it's called once at activate(), but
|
|
15
|
+
// memoisation keeps the helper safe for hot paths too).
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { dirname, join } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
const cache = new Map();
|
|
20
|
+
/** Loads a prompt file from the same directory as the compiled
|
|
21
|
+
* caller (dist/tools/<name>.prompt.md). The argument is the
|
|
22
|
+
* filename only, no path separators. */
|
|
23
|
+
export function loadPrompt(name) {
|
|
24
|
+
if (name.includes("/") || name.includes("\\") || !name.endsWith(".prompt.md")) {
|
|
25
|
+
throw new Error(`loadPrompt: bad prompt name ${JSON.stringify(name)}`);
|
|
26
|
+
}
|
|
27
|
+
const hit = cache.get(name);
|
|
28
|
+
if (hit !== undefined)
|
|
29
|
+
return hit;
|
|
30
|
+
// dist/tools/<name>.prompt.md, resolved relative to this file's
|
|
31
|
+
// compiled location. import.meta.url points at dist/tools/load-prompt.js
|
|
32
|
+
// at runtime, so dirname() gives us dist/tools/.
|
|
33
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
34
|
+
const path = join(here, name);
|
|
35
|
+
const text = readFileSync(path, "utf8");
|
|
36
|
+
cache.set(name, text);
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=load-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-prompt.js","sourceRoot":"","sources":["../../src/tools/load-prompt.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,4CAA4C;AAC5C,EAAE;AACF,gEAAgE;AAChE,kEAAkE;AAClE,iEAAiE;AACjE,0DAA0D;AAC1D,gEAAgE;AAChE,iEAAiE;AACjE,8BAA8B;AAC9B,EAAE;AACF,6DAA6D;AAC7D,gEAAgE;AAChE,4DAA4D;AAC5D,wDAAwD;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AAExC;;yCAEyC;AACzC,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9E,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IAElC,gEAAgE;IAChE,yEAAyE;IACzE,iDAAiD;IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class PathOutsideRootError extends Error {
|
|
2
|
+
readonly requested: string;
|
|
3
|
+
readonly code: "PATH_OUTSIDE_ROOT";
|
|
4
|
+
constructor(requested: string);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a tool-supplied path against the per-user root.
|
|
8
|
+
* Throws `PathOutsideRootError` if the result would escape the root.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveInUserHome(userHome: string, requested: string): string;
|
|
11
|
+
/** Convert an absolute path back to a `/foo/bar` style display path
|
|
12
|
+
* rooted at user home. Used for tool result text so the LLM doesn't
|
|
13
|
+
* see the host filesystem prefix. */
|
|
14
|
+
export declare function toDisplayPath(userHome: string, abs: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Convert an absolute path back to a `workspace:///foo/bar` URI
|
|
17
|
+
* rooted at the user home. This is the canonical, single-source-of-
|
|
18
|
+
* truth shape every fs tool returns in its result text and entry
|
|
19
|
+
* fields, so the chat UI can recognise file references with one
|
|
20
|
+
* regex (no need to reverse-engineer the host filesystem prefix or
|
|
21
|
+
* decide whether a relative `./x` should be rewritten).
|
|
22
|
+
*
|
|
23
|
+
* The empty authority (`workspace:///foo`, three slashes) is
|
|
24
|
+
* intentional: by RFC 3986 a `file:` URL also uses an empty
|
|
25
|
+
* authority before the path. Keeping the same shape means the LLM
|
|
26
|
+
* can think of it as a file URL with a workspace scheme.
|
|
27
|
+
*
|
|
28
|
+
* Throws if `abs` is outside the user home; callers should
|
|
29
|
+
* guarantee that by going through `resolveInUserHome` first.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toWorkspaceUri(userHome: string, abs: string): string;
|
|
32
|
+
//# sourceMappingURL=path-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-helper.d.ts","sourceRoot":"","sources":["../../src/tools/path-helper.ts"],"names":[],"mappings":"AAyBA,qBAAa,oBAAqB,SAAQ,KAAK;aAEjB,SAAS,EAAE,MAAM;IAD7C,QAAQ,CAAC,IAAI,EAAG,mBAAmB,CAAU;gBACjB,SAAS,EAAE,MAAM;CAI9C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAqC7E;AAED;;sCAEsC;AACtC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAInE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAOpE"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Path helper shared by every fs tool.
|
|
2
|
+
//
|
|
3
|
+
// Every agent-tool root is the **current user's home** under the
|
|
4
|
+
// tenant workspace, i.e. `<tenant>/workspace/users/<userId>/`. This
|
|
5
|
+
// matches the `files` plugin's UI scope (PR #40) and ADR-0001 §2:
|
|
6
|
+
// - one user's tools cannot reach another user's files
|
|
7
|
+
// - the shared `_tenant/` directory is intentionally invisible to
|
|
8
|
+
// tools (host injects its contents into the system prompt instead)
|
|
9
|
+
// - host filesystem outside the user home is rejected
|
|
10
|
+
//
|
|
11
|
+
// Path inputs are accepted in four shapes for ergonomics:
|
|
12
|
+
// - "workspace:///foo/bar" → user home + foo/bar (canonical — the
|
|
13
|
+
// shape this
|
|
14
|
+
// module emits)
|
|
15
|
+
// - "/foo/bar" → user home + foo/bar
|
|
16
|
+
// - "foo/bar" → user home + foo/bar (relative is the same)
|
|
17
|
+
// - "/workspace/foo" → user home + foo (alias kept so existing
|
|
18
|
+
// LLM training data
|
|
19
|
+
// with `/workspace/...`
|
|
20
|
+
// still resolves)
|
|
21
|
+
// Anything containing a literal `..` segment is rejected up front so a
|
|
22
|
+
// trick like "/workspace/../etc/passwd" cannot squeeze past resolve().
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
export class PathOutsideRootError extends Error {
|
|
25
|
+
requested;
|
|
26
|
+
code = "PATH_OUTSIDE_ROOT";
|
|
27
|
+
constructor(requested) {
|
|
28
|
+
super(`path "${requested}" is outside the user workspace`);
|
|
29
|
+
this.requested = requested;
|
|
30
|
+
this.name = "PathOutsideRootError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a tool-supplied path against the per-user root.
|
|
35
|
+
* Throws `PathOutsideRootError` if the result would escape the root.
|
|
36
|
+
*/
|
|
37
|
+
export function resolveInUserHome(userHome, requested) {
|
|
38
|
+
if (typeof requested !== "string" || requested.length === 0) {
|
|
39
|
+
throw new PathOutsideRootError(requested);
|
|
40
|
+
}
|
|
41
|
+
let rel = requested.replace(/\\/g, "/");
|
|
42
|
+
// Strip the canonical workspace:// scheme. Two authority shapes
|
|
43
|
+
// are accepted: "workspace:///foo" (empty authority — what we
|
|
44
|
+
// emit) and "workspace://foo" (non-empty authority — a tolerated
|
|
45
|
+
// alias since LLMs sometimes drop the third slash).
|
|
46
|
+
if (rel.startsWith("workspace:///")) {
|
|
47
|
+
rel = rel.slice("workspace:///".length);
|
|
48
|
+
}
|
|
49
|
+
else if (rel.startsWith("workspace://")) {
|
|
50
|
+
rel = rel.slice("workspace://".length);
|
|
51
|
+
}
|
|
52
|
+
else if (rel === "workspace:") {
|
|
53
|
+
rel = "";
|
|
54
|
+
}
|
|
55
|
+
// Strip the optional /workspace/ prefix; agents trained on the old
|
|
56
|
+
// tianshu schema use it.
|
|
57
|
+
if (rel.startsWith("/workspace/"))
|
|
58
|
+
rel = rel.slice("/workspace/".length);
|
|
59
|
+
else if (rel === "/workspace")
|
|
60
|
+
rel = "";
|
|
61
|
+
// Strip a leading slash; "/" → root.
|
|
62
|
+
if (rel.startsWith("/"))
|
|
63
|
+
rel = rel.slice(1);
|
|
64
|
+
const segments = rel.split("/").filter((s) => s.length > 0);
|
|
65
|
+
if (segments.some((s) => s === ".." || s === ".")) {
|
|
66
|
+
// Refuse `.` too — it's harmless but gives a normalised "/" alias
|
|
67
|
+
// and we don't want LLM-confused paths sneaking in.
|
|
68
|
+
if (segments.some((s) => s === "..")) {
|
|
69
|
+
throw new PathOutsideRootError(requested);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const resolved = path.resolve(userHome, ...segments);
|
|
73
|
+
const rootAbs = path.resolve(userHome);
|
|
74
|
+
if (resolved !== rootAbs && !resolved.startsWith(rootAbs + path.sep)) {
|
|
75
|
+
throw new PathOutsideRootError(requested);
|
|
76
|
+
}
|
|
77
|
+
return resolved;
|
|
78
|
+
}
|
|
79
|
+
/** Convert an absolute path back to a `/foo/bar` style display path
|
|
80
|
+
* rooted at user home. Used for tool result text so the LLM doesn't
|
|
81
|
+
* see the host filesystem prefix. */
|
|
82
|
+
export function toDisplayPath(userHome, abs) {
|
|
83
|
+
const rel = path.relative(userHome, abs).replace(/\\/g, "/");
|
|
84
|
+
if (rel === "" || rel === ".")
|
|
85
|
+
return "/";
|
|
86
|
+
return "/" + rel;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Convert an absolute path back to a `workspace:///foo/bar` URI
|
|
90
|
+
* rooted at the user home. This is the canonical, single-source-of-
|
|
91
|
+
* truth shape every fs tool returns in its result text and entry
|
|
92
|
+
* fields, so the chat UI can recognise file references with one
|
|
93
|
+
* regex (no need to reverse-engineer the host filesystem prefix or
|
|
94
|
+
* decide whether a relative `./x` should be rewritten).
|
|
95
|
+
*
|
|
96
|
+
* The empty authority (`workspace:///foo`, three slashes) is
|
|
97
|
+
* intentional: by RFC 3986 a `file:` URL also uses an empty
|
|
98
|
+
* authority before the path. Keeping the same shape means the LLM
|
|
99
|
+
* can think of it as a file URL with a workspace scheme.
|
|
100
|
+
*
|
|
101
|
+
* Throws if `abs` is outside the user home; callers should
|
|
102
|
+
* guarantee that by going through `resolveInUserHome` first.
|
|
103
|
+
*/
|
|
104
|
+
export function toWorkspaceUri(userHome, abs) {
|
|
105
|
+
const rel = path.relative(userHome, abs).replace(/\\/g, "/");
|
|
106
|
+
if (rel.startsWith("..")) {
|
|
107
|
+
throw new PathOutsideRootError(abs);
|
|
108
|
+
}
|
|
109
|
+
if (rel === "" || rel === ".")
|
|
110
|
+
return "workspace:///";
|
|
111
|
+
return "workspace:///" + rel;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=path-helper.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,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;sCAEsC;AACtC,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,GAAW;IACzD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7D,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG;QAAE,OAAO,GAAG,CAAC;IAC1C,OAAO,GAAG,GAAG,GAAG,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,GAAW;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7D,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG;QAAE,OAAO,eAAe,CAAC;IACtD,OAAO,eAAe,GAAG,GAAG,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Tool } from "@earendil-works/pi-ai";
|
|
2
|
+
export declare const MAX_TEXT_BYTES = 500000;
|
|
3
|
+
export interface ReadFileToolResult {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
text: string;
|
|
6
|
+
binary?: boolean;
|
|
7
|
+
size?: number;
|
|
8
|
+
bytesReturned?: number;
|
|
9
|
+
nextOffset?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function readFileSchema(): Tool;
|
|
12
|
+
export declare function executeReadFile(userHome: string, args: {
|
|
13
|
+
path: string;
|
|
14
|
+
offset?: number;
|
|
15
|
+
limit?: number;
|
|
16
|
+
}, sessionId?: string): ReadFileToolResult;
|
|
17
|
+
//# sourceMappingURL=read-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQlD,eAAO,MAAM,cAAc,SAAU,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,cAAc,IAAI,IAAI,CAgCrC;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACvD,SAAS,CAAC,EAAE,MAAM,GACjB,kBAAkB,CAyEpB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// read_file — agent tool that returns the contents of a small text file.
|
|
2
|
+
//
|
|
3
|
+
// Hard cap of 500 KB per call. For larger files the agent must page
|
|
4
|
+
// through with `offset` and `limit` (the response includes the next
|
|
5
|
+
// args you should pass).
|
|
6
|
+
//
|
|
7
|
+
// Binary files are detected heuristically (NUL byte in first 4 KB)
|
|
8
|
+
// and returned as a stub message rather than raw bytes — preserving
|
|
9
|
+
// the LLM's context window.
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import { Type } from "typebox";
|
|
12
|
+
import { markChunk } from "./read-tracker.js";
|
|
13
|
+
import { resolveInUserHome, toWorkspaceUri, PathOutsideRootError, } from "./path-helper.js";
|
|
14
|
+
export const MAX_TEXT_BYTES = 500_000;
|
|
15
|
+
export function readFileSchema() {
|
|
16
|
+
return {
|
|
17
|
+
name: "read_file",
|
|
18
|
+
description: `Read a text file from the workspace. Returns up to ${MAX_TEXT_BYTES / 1000} KB per call. \
|
|
19
|
+
For larger files, pass \`offset\` (byte offset to start at) and \`limit\` (max bytes); the \
|
|
20
|
+
response will tell you the file's full size and the next offset to use.
|
|
21
|
+
|
|
22
|
+
Paths are interpreted relative to the workspace root; prefer relative paths \
|
|
23
|
+
(\`notes/today.md\`) over leading-slash forms. A leading slash here resolves \
|
|
24
|
+
to the workspace root — NOT the sandbox OS root — so to avoid confusion when \
|
|
25
|
+
\`exec\` is also in play, write paths without a leading slash.
|
|
26
|
+
|
|
27
|
+
Binary files (image, archive, etc.) return a short stub instead of bytes — extract them \
|
|
28
|
+
to text first via another tool if you need their contents.`,
|
|
29
|
+
parameters: Type.Object({
|
|
30
|
+
path: Type.String({
|
|
31
|
+
description: 'Path relative to the workspace root, e.g. "notes/today.md".',
|
|
32
|
+
}),
|
|
33
|
+
offset: Type.Optional(Type.Integer({
|
|
34
|
+
minimum: 0,
|
|
35
|
+
description: "Byte offset to start reading from. Default 0.",
|
|
36
|
+
})),
|
|
37
|
+
limit: Type.Optional(Type.Integer({
|
|
38
|
+
minimum: 1,
|
|
39
|
+
description: `Max bytes to return. Capped at ${MAX_TEXT_BYTES}.`,
|
|
40
|
+
})),
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function executeReadFile(userHome, args, sessionId) {
|
|
45
|
+
let resolved;
|
|
46
|
+
try {
|
|
47
|
+
resolved = resolveInUserHome(userHome, args.path);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (err instanceof PathOutsideRootError) {
|
|
51
|
+
return { ok: false, text: `path is outside the workspace: ${args.path}` };
|
|
52
|
+
}
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
if (!fs.existsSync(resolved)) {
|
|
56
|
+
return { ok: false, text: `not found: ${args.path}` };
|
|
57
|
+
}
|
|
58
|
+
const stat = fs.statSync(resolved);
|
|
59
|
+
if (stat.isDirectory()) {
|
|
60
|
+
return { ok: false, text: `is a directory, not a file: ${args.path}` };
|
|
61
|
+
}
|
|
62
|
+
const offset = Math.max(0, Math.floor(args.offset ?? 0));
|
|
63
|
+
const limit = Math.max(1, Math.min(args.limit ?? MAX_TEXT_BYTES, MAX_TEXT_BYTES));
|
|
64
|
+
const fd = fs.openSync(resolved, "r");
|
|
65
|
+
try {
|
|
66
|
+
const buf = Buffer.alloc(limit);
|
|
67
|
+
const bytesRead = fs.readSync(fd, buf, 0, limit, offset);
|
|
68
|
+
const slice = buf.subarray(0, bytesRead);
|
|
69
|
+
// Binary check — first 4 KB of the slice.
|
|
70
|
+
const probe = slice.subarray(0, Math.min(slice.length, 4096));
|
|
71
|
+
if (probe.includes(0)) {
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
text: `(binary file: ${stat.size} bytes; not shown)`,
|
|
75
|
+
binary: true,
|
|
76
|
+
size: stat.size,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const content = slice.toString("utf8");
|
|
80
|
+
const nextOffset = offset + bytesRead;
|
|
81
|
+
const more = nextOffset < stat.size;
|
|
82
|
+
// Track which chunk this call covered. The session-level read
|
|
83
|
+
// tracker accumulates start/end coverage across multiple
|
|
84
|
+
// `read_file` calls so that a paged read sequence (offset=0 +
|
|
85
|
+
// ... + final !more) ends up satisfying the read-required
|
|
86
|
+
// precondition just like a single one-shot read does. A purely
|
|
87
|
+
// mid-file partial read (offset>0 AND more=true) is a no-op
|
|
88
|
+
// — the agent paged a region without seeing either endpoint.
|
|
89
|
+
markChunk(sessionId, resolved, offset === 0, !more);
|
|
90
|
+
const uri = toWorkspaceUri(userHome, resolved);
|
|
91
|
+
const header = stat.size <= MAX_TEXT_BYTES
|
|
92
|
+
? `// ${uri} (${stat.size} bytes)`
|
|
93
|
+
: `// ${uri} bytes ${offset}–${nextOffset} of ${stat.size}` +
|
|
94
|
+
(more
|
|
95
|
+
? ` — call read_file again with offset=${nextOffset} for the next chunk`
|
|
96
|
+
: " (final chunk)");
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
text: `${header}\n${content}`,
|
|
100
|
+
size: stat.size,
|
|
101
|
+
bytesReturned: bytesRead,
|
|
102
|
+
nextOffset: more ? nextOffset : undefined,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
fs.closeSync(fd);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=read-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,oEAAoE;AACpE,oEAAoE;AACpE,yBAAyB;AACzB,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,4BAA4B;AAE5B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAWtC,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,sDAAsD,cAAc,GAAG,IAAI;;;;;;;;;;2DAUjC;QACvD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC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C5D,6DAA6D;QAC7D,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEpD,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/C,MAAM,MAAM,GACV,IAAI,CAAC,IAAI,IAAI,cAAc;YACzB,CAAC,CAAC,MAAM,GAAG,KAAK,IAAI,CAAC,IAAI,SAAS;YAClC,CAAC,CAAC,MAAM,GAAG,UAAU,MAAM,IAAI,UAAU,OAAO,IAAI,CAAC,IAAI,EAAE;gBACzD,CAAC,IAAI;oBACH,CAAC,CAAC,uCAAuC,UAAU,qBAAqB;oBACxE,CAAC,CAAC,gBAAgB,CAAC,CAAC;QAE5B,OAAO;YACL,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,GAAG,MAAM,KAAK,OAAO,EAAE;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,SAAS;YACxB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;SAC1C,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mark a path as fully read. Used by `read_file` for one-shot
|
|
3
|
+
* reads (offset=0 and final chunk in the same call) and by
|
|
4
|
+
* `write_file` after a successful write (the agent now "knows"
|
|
5
|
+
* the contents because it just authored them).
|
|
6
|
+
*/
|
|
7
|
+
export declare function markRead(sessionId: string | undefined, resolvedPath: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Mark a single chunk of a paged read. The host calls this for
|
|
10
|
+
* every successful `read_file` regardless of size. `isStart` is
|
|
11
|
+
* true when the chunk began at offset 0; `isEnd` is true when the
|
|
12
|
+
* server reported no more chunks left (`!more`). A path becomes
|
|
13
|
+
* `hasRead`-true only after both flags have been seen — individually
|
|
14
|
+
* or in the same call — which makes paged "read 0..N until !more"
|
|
15
|
+
* count as a complete read without forcing the agent to do a second
|
|
16
|
+
* full one-shot pass.
|
|
17
|
+
*/
|
|
18
|
+
export declare function markChunk(sessionId: string | undefined, resolvedPath: string, isStart: boolean, isEnd: boolean): void;
|
|
19
|
+
/** Returns true if `sessionId` has fully read `resolvedPath`.
|
|
20
|
+
* "Fully" means the start (offset=0) and the end (final chunk)
|
|
21
|
+
* have both been observed in this session. Returns true when
|
|
22
|
+
* sessionId is missing — tools invoked outside an agent loop
|
|
23
|
+
* (route handlers, scheduled jobs) shouldn't be blocked by the
|
|
24
|
+
* read-required check. */
|
|
25
|
+
export declare function hasRead(sessionId: string | undefined, resolvedPath: string): boolean;
|
|
26
|
+
/** Test helper: clear all session state. */
|
|
27
|
+
export declare function _resetForTests(): void;
|
|
28
|
+
//# sourceMappingURL=read-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-tracker.d.ts","sourceRoot":"","sources":["../../src/tools/read-tracker.ts"],"names":[],"mappings":"AAwFA;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,EAAE,MAAM,GACnB,IAAI,CAON;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,GACb,IAAI,CAgBN;AAED;;;;;2BAK2B;AAC3B,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAMpF;AAED,4CAA4C;AAC5C,wBAAgB,cAAc,IAAI,IAAI,CAGrC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Tracks which workspace paths each chat/worker session has loaded
|
|
2
|
+
// via `read_file` in the current process lifetime.
|
|
3
|
+
//
|
|
4
|
+
// Used by `edit_file` and `write_file` (when target exists) to
|
|
5
|
+
// refuse blind edits — if the agent never read a file, it has no
|
|
6
|
+
// business overwriting or string-replacing into it. The error
|
|
7
|
+
// surface tells the agent exactly what to do: "use read_file to
|
|
8
|
+
// load <path> first".
|
|
9
|
+
//
|
|
10
|
+
// Why per-session and not per-tenant: two parallel chats by the
|
|
11
|
+
// same user shouldn't share read state — chat A reading a file
|
|
12
|
+
// doesn't authorise chat B to edit it sight-unseen. Sessions are
|
|
13
|
+
// the natural granularity for "what the agent has seen so far".
|
|
14
|
+
//
|
|
15
|
+
// Why in-process and not persisted: the contract we want is
|
|
16
|
+
// "agent has the file's contents in this conversation's context",
|
|
17
|
+
// which is itself in-memory in the LLM provider and lives only as
|
|
18
|
+
// long as the host process anyway. Persisting readSet across
|
|
19
|
+
// restarts would create a false sense that the agent "knows" a
|
|
20
|
+
// file when in reality the model has no token of it.
|
|
21
|
+
//
|
|
22
|
+
// Memory bound: each entry is a path string (~100 bytes typical),
|
|
23
|
+
// session caps via LRU at 4096 paths per session, and we evict
|
|
24
|
+
// idle sessions after 30 min. A tenant pegging this would need
|
|
25
|
+
// ~30 MB for 1000 idle sessions — fine for our scale.
|
|
26
|
+
//
|
|
27
|
+
// Pagination semantics: a single one-shot read (offset=0 && !more)
|
|
28
|
+
// counts as fully read. Files larger than 500 KB force the agent
|
|
29
|
+
// to page through, in which case the path is fully "seen" only
|
|
30
|
+
// after both the first chunk (offset=0) AND the final chunk
|
|
31
|
+
// (!more) have been observed. We track those two flags per path
|
|
32
|
+
// rather than full byte-range coverage — the simpler model covers
|
|
33
|
+
// the realistic cases (read 0..N until !more) without the
|
|
34
|
+
// bookkeeping cost of arbitrary-range merges.
|
|
35
|
+
const SESSION_PATH_CAP = 4096;
|
|
36
|
+
const SESSION_IDLE_MS = 30 * 60 * 1000;
|
|
37
|
+
const sessions = new Map();
|
|
38
|
+
let lastSweepMs = 0;
|
|
39
|
+
function sweepIdle(now) {
|
|
40
|
+
if (now - lastSweepMs < 60_000)
|
|
41
|
+
return; // at most once a minute
|
|
42
|
+
lastSweepMs = now;
|
|
43
|
+
for (const [sid, entry] of sessions) {
|
|
44
|
+
if (now - entry.lastTouchedMs > SESSION_IDLE_MS) {
|
|
45
|
+
sessions.delete(sid);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getOrCreate(sessionId, now) {
|
|
50
|
+
let entry = sessions.get(sessionId);
|
|
51
|
+
if (!entry) {
|
|
52
|
+
entry = { paths: new Map(), order: [], lastTouchedMs: now };
|
|
53
|
+
sessions.set(sessionId, entry);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
entry.lastTouchedMs = now;
|
|
57
|
+
}
|
|
58
|
+
return entry;
|
|
59
|
+
}
|
|
60
|
+
function touchOrder(entry, resolvedPath) {
|
|
61
|
+
const idx = entry.order.indexOf(resolvedPath);
|
|
62
|
+
if (idx >= 0)
|
|
63
|
+
entry.order.splice(idx, 1);
|
|
64
|
+
entry.order.push(resolvedPath);
|
|
65
|
+
while (entry.order.length > SESSION_PATH_CAP) {
|
|
66
|
+
const evicted = entry.order.shift();
|
|
67
|
+
if (evicted !== undefined)
|
|
68
|
+
entry.paths.delete(evicted);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Mark a path as fully read. Used by `read_file` for one-shot
|
|
73
|
+
* reads (offset=0 and final chunk in the same call) and by
|
|
74
|
+
* `write_file` after a successful write (the agent now "knows"
|
|
75
|
+
* the contents because it just authored them).
|
|
76
|
+
*/
|
|
77
|
+
export function markRead(sessionId, resolvedPath) {
|
|
78
|
+
if (!sessionId)
|
|
79
|
+
return;
|
|
80
|
+
const now = Date.now();
|
|
81
|
+
sweepIdle(now);
|
|
82
|
+
const entry = getOrCreate(sessionId, now);
|
|
83
|
+
entry.paths.set(resolvedPath, { sawStart: true, sawEnd: true });
|
|
84
|
+
touchOrder(entry, resolvedPath);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Mark a single chunk of a paged read. The host calls this for
|
|
88
|
+
* every successful `read_file` regardless of size. `isStart` is
|
|
89
|
+
* true when the chunk began at offset 0; `isEnd` is true when the
|
|
90
|
+
* server reported no more chunks left (`!more`). A path becomes
|
|
91
|
+
* `hasRead`-true only after both flags have been seen — individually
|
|
92
|
+
* or in the same call — which makes paged "read 0..N until !more"
|
|
93
|
+
* count as a complete read without forcing the agent to do a second
|
|
94
|
+
* full one-shot pass.
|
|
95
|
+
*/
|
|
96
|
+
export function markChunk(sessionId, resolvedPath, isStart, isEnd) {
|
|
97
|
+
if (!sessionId)
|
|
98
|
+
return;
|
|
99
|
+
if (!isStart && !isEnd)
|
|
100
|
+
return; // mid-file chunk; nothing to flag
|
|
101
|
+
const now = Date.now();
|
|
102
|
+
sweepIdle(now);
|
|
103
|
+
const entry = getOrCreate(sessionId, now);
|
|
104
|
+
const prev = entry.paths.get(resolvedPath) ?? {
|
|
105
|
+
sawStart: false,
|
|
106
|
+
sawEnd: false,
|
|
107
|
+
};
|
|
108
|
+
const next = {
|
|
109
|
+
sawStart: prev.sawStart || isStart,
|
|
110
|
+
sawEnd: prev.sawEnd || isEnd,
|
|
111
|
+
};
|
|
112
|
+
entry.paths.set(resolvedPath, next);
|
|
113
|
+
touchOrder(entry, resolvedPath);
|
|
114
|
+
}
|
|
115
|
+
/** Returns true if `sessionId` has fully read `resolvedPath`.
|
|
116
|
+
* "Fully" means the start (offset=0) and the end (final chunk)
|
|
117
|
+
* have both been observed in this session. Returns true when
|
|
118
|
+
* sessionId is missing — tools invoked outside an agent loop
|
|
119
|
+
* (route handlers, scheduled jobs) shouldn't be blocked by the
|
|
120
|
+
* read-required check. */
|
|
121
|
+
export function hasRead(sessionId, resolvedPath) {
|
|
122
|
+
if (!sessionId)
|
|
123
|
+
return true;
|
|
124
|
+
const entry = sessions.get(sessionId);
|
|
125
|
+
if (!entry)
|
|
126
|
+
return false;
|
|
127
|
+
const state = entry.paths.get(resolvedPath);
|
|
128
|
+
return Boolean(state && state.sawStart && state.sawEnd);
|
|
129
|
+
}
|
|
130
|
+
/** Test helper: clear all session state. */
|
|
131
|
+
export function _resetForTests() {
|
|
132
|
+
sessions.clear();
|
|
133
|
+
lastSweepMs = 0;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=read-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-tracker.js","sourceRoot":"","sources":["../../src/tools/read-tracker.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,mDAAmD;AACnD,EAAE;AACF,+DAA+D;AAC/D,iEAAiE;AACjE,8DAA8D;AAC9D,gEAAgE;AAChE,sBAAsB;AACtB,EAAE;AACF,gEAAgE;AAChE,+DAA+D;AAC/D,iEAAiE;AACjE,gEAAgE;AAChE,EAAE;AACF,4DAA4D;AAC5D,kEAAkE;AAClE,kEAAkE;AAClE,6DAA6D;AAC7D,+DAA+D;AAC/D,qDAAqD;AACrD,EAAE;AACF,kEAAkE;AAClE,+DAA+D;AAC/D,+DAA+D;AAC/D,sDAAsD;AACtD,EAAE;AACF,mEAAmE;AACnE,iEAAiE;AACjE,+DAA+D;AAC/D,4DAA4D;AAC5D,gEAAgE;AAChE,kEAAkE;AAClE,0DAA0D;AAC1D,8CAA8C;AAE9C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAkBvC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;AACjD,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,SAAS,SAAS,CAAC,GAAW;IAC5B,IAAI,GAAG,GAAG,WAAW,GAAG,MAAM;QAAE,OAAO,CAAC,wBAAwB;IAChE,WAAW,GAAG,GAAG,CAAC;IAClB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IA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