@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,230 @@
|
|
|
1
|
+
// edit_file — exact text replacement, in-place, with optional
|
|
2
|
+
// batch updates per call.
|
|
3
|
+
//
|
|
4
|
+
// One call carries an `edits: Edit[]` array; the file is loaded
|
|
5
|
+
// once, every edit is applied in order in memory, and the
|
|
6
|
+
// composite result is written atomically (temp sibling + rename)
|
|
7
|
+
// only if every edit succeeds. Same uniqueness contract as before
|
|
8
|
+
// — each `old_text` must appear exactly once at the moment that
|
|
9
|
+
// edit runs (so cascading edits where one substring becomes
|
|
10
|
+
// non-unique mid-batch are caught and surfaced; the file on disk
|
|
11
|
+
// is unchanged in that case).
|
|
12
|
+
//
|
|
13
|
+
// Why batch: long-form synthesis (HTML reports, multi-section
|
|
14
|
+
// markdown) wants to fill several `<!-- TODO -->` placeholders or
|
|
15
|
+
// patch several function bodies in one round-trip. The non-batch
|
|
16
|
+
// API forced one tool call per patch, multiplying turns and tool
|
|
17
|
+
// result tokens.
|
|
18
|
+
//
|
|
19
|
+
// Backwards compat: a single `{ old_text, new_text }` at the top
|
|
20
|
+
// level still works — we re-shape it into `edits: [{...}]` before
|
|
21
|
+
// running. Old prompts and existing tests keep passing without
|
|
22
|
+
// edits to call sites.
|
|
23
|
+
//
|
|
24
|
+
// Modelled on OpenClaw / Claude Code's edit tool, where the
|
|
25
|
+
// `edits` array is the canonical shape.
|
|
26
|
+
import fs from "node:fs";
|
|
27
|
+
import { Type } from "typebox";
|
|
28
|
+
import { loadPrompt } from "./load-prompt.js";
|
|
29
|
+
import { hasRead, markRead } from "./read-tracker.js";
|
|
30
|
+
import { resolveInUserHome, toWorkspaceUri, PathOutsideRootError, } from "./path-helper.js";
|
|
31
|
+
import { applyShape, normaliseEnding, shapeOf } from "./text-shape.js";
|
|
32
|
+
import { findMatch } from "./replacers.js";
|
|
33
|
+
export function editFileSchema() {
|
|
34
|
+
return {
|
|
35
|
+
name: "edit_file",
|
|
36
|
+
description: loadPrompt("edit-file.prompt.md"),
|
|
37
|
+
parameters: Type.Object({
|
|
38
|
+
path: Type.String({
|
|
39
|
+
description: 'Path relative to the workspace root, e.g. "notes/today.md". ' +
|
|
40
|
+
'Prefer relative paths over a leading slash \u2014 a leading slash ' +
|
|
41
|
+
'here means workspace root, NOT the sandbox OS root that `exec` sees.',
|
|
42
|
+
}),
|
|
43
|
+
// `edits` is REQUIRED at the schema level so the host's
|
|
44
|
+
// truncation detector fires when the model emits
|
|
45
|
+
// `{path: "..."}` with the array dropped — a common stream
|
|
46
|
+
// truncation pattern. The legacy `{old_text, new_text}`
|
|
47
|
+
// shorthand is still accepted at runtime (executeEditFile
|
|
48
|
+
// re-shapes it into a single-element edits array) for
|
|
49
|
+
// back-compat with existing callers, but the schema only
|
|
50
|
+
// documents the canonical form.
|
|
51
|
+
edits: Type.Array(Type.Object({
|
|
52
|
+
old_text: Type.String({
|
|
53
|
+
description: "Exact text to find. Must appear exactly once at edit time " +
|
|
54
|
+
"unless `replace_all` is set. Whitespace-only and indentation-only " +
|
|
55
|
+
"differences are tolerated via fuzzy matching; if no match is " +
|
|
56
|
+
"found at all the whole batch fails atomically.",
|
|
57
|
+
}),
|
|
58
|
+
new_text: Type.String({
|
|
59
|
+
description: "Replacement text.",
|
|
60
|
+
}),
|
|
61
|
+
replace_all: Type.Optional(Type.Boolean({
|
|
62
|
+
description: "Replace every occurrence of `old_text`. Use for renaming " +
|
|
63
|
+
"a symbol across the file (the typical multi-occurrence case). " +
|
|
64
|
+
"Default false: requires the match to be unique.",
|
|
65
|
+
})),
|
|
66
|
+
}), {
|
|
67
|
+
minItems: 1,
|
|
68
|
+
description: "List of edits to apply in order, atomic (all or nothing). " +
|
|
69
|
+
"Each entry is one find/replace pair.",
|
|
70
|
+
}),
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function executeEditFile(userHome, args, sessionId) {
|
|
75
|
+
// Normalise to a non-empty edits array. Single-edit shorthand
|
|
76
|
+
// wins only if `edits` is missing — passing both is ambiguous,
|
|
77
|
+
// we prefer the structured form.
|
|
78
|
+
const edits = args.edits
|
|
79
|
+
? args.edits
|
|
80
|
+
: args.old_text !== undefined && args.new_text !== undefined
|
|
81
|
+
? [
|
|
82
|
+
{
|
|
83
|
+
old_text: args.old_text,
|
|
84
|
+
new_text: args.new_text,
|
|
85
|
+
replace_all: args.replace_all,
|
|
86
|
+
},
|
|
87
|
+
]
|
|
88
|
+
: null;
|
|
89
|
+
if (!edits) {
|
|
90
|
+
return {
|
|
91
|
+
ok: false,
|
|
92
|
+
text: "edit_file: pass either `edits` array or both `old_text` + `new_text`",
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (edits.length === 0) {
|
|
96
|
+
return { ok: false, text: "edit_file: edits array is empty" };
|
|
97
|
+
}
|
|
98
|
+
let resolved;
|
|
99
|
+
try {
|
|
100
|
+
resolved = resolveInUserHome(userHome, args.path);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
if (err instanceof PathOutsideRootError) {
|
|
104
|
+
return { ok: false, text: `path is outside the workspace: ${args.path}` };
|
|
105
|
+
}
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
if (!fs.existsSync(resolved)) {
|
|
109
|
+
return { ok: false, text: `not found: ${args.path}` };
|
|
110
|
+
}
|
|
111
|
+
if (fs.statSync(resolved).isDirectory()) {
|
|
112
|
+
return { ok: false, text: `is a directory: ${args.path}` };
|
|
113
|
+
}
|
|
114
|
+
// Read-required: every edit_file call must follow a read_file
|
|
115
|
+
// on the same path in the same session. Without that the agent
|
|
116
|
+
// is matching against text it never actually saw, which is how
|
|
117
|
+
// overconfident overwrites land. The error tells the agent
|
|
118
|
+
// exactly what to do next.
|
|
119
|
+
if (!hasRead(sessionId, resolved)) {
|
|
120
|
+
return {
|
|
121
|
+
ok: false,
|
|
122
|
+
text: `edit_file: call read_file on ${args.path} once before editing — ` +
|
|
123
|
+
`exact-text matching needs the file's actual current contents in your context. ` +
|
|
124
|
+
`A single full read (offset=0, no limit) is enough; the host remembers it ` +
|
|
125
|
+
`for the rest of this session and any number of follow-up edits.`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// Read once, peel BOM, detect line ending. We work on the
|
|
129
|
+
// BOM-less, already-text representation throughout the batch;
|
|
130
|
+
// only re-prepend BOM at the final write step.
|
|
131
|
+
const raw = fs.readFileSync(resolved, "utf8");
|
|
132
|
+
const shape = shapeOf(raw);
|
|
133
|
+
const applied = [];
|
|
134
|
+
let working = shape.text;
|
|
135
|
+
for (let i = 0; i < edits.length; i++) {
|
|
136
|
+
const e = edits[i];
|
|
137
|
+
// Normalise the model's input to the file's actual line
|
|
138
|
+
// ending so a CRLF file matches even when the model sent LF
|
|
139
|
+
// (and vice-versa).
|
|
140
|
+
const oldText = normaliseEnding(e.old_text, shape.ending);
|
|
141
|
+
const newText = normaliseEnding(e.new_text, shape.ending);
|
|
142
|
+
if (oldText.length === 0) {
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
text: `edit_file: edit #${i + 1} has empty old_text`,
|
|
146
|
+
failedEditIndex: i + 1,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (oldText === newText) {
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
text: `edit_file: edit #${i + 1} old_text and new_text are identical`,
|
|
153
|
+
failedEditIndex: i + 1,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const match = findMatch(working, oldText);
|
|
157
|
+
if (!match) {
|
|
158
|
+
return {
|
|
159
|
+
ok: false,
|
|
160
|
+
text: `edit_file: edit #${i + 1} old_text not found in ${args.path} (after ${i} prior edit${i === 1 ? "" : "s"} applied in memory). The match is whitespace- and indent-tolerant; if it still doesn't fit, re-read the file and pull a fresh, larger unique window.`,
|
|
161
|
+
failedEditIndex: i + 1,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (e.replace_all) {
|
|
165
|
+
// Global replace using the *matched* span, not the
|
|
166
|
+
// original `oldText`. If a fuzzy replacer rewrote
|
|
167
|
+
// whitespace, we want to keep replacing the file's
|
|
168
|
+
// shape, not the model's.
|
|
169
|
+
const before = working;
|
|
170
|
+
working = working.split(match.matched).join(newText);
|
|
171
|
+
const replaced = (before.length - working.length) / Math.max(1, match.matched.length - newText.length);
|
|
172
|
+
void replaced;
|
|
173
|
+
applied.push({
|
|
174
|
+
ok: true,
|
|
175
|
+
oldLen: oldText.length,
|
|
176
|
+
newLen: newText.length,
|
|
177
|
+
});
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
// Uniqueness check on the *exact match span* — if a fuzzy
|
|
181
|
+
// candidate appears more than once, we still want the agent
|
|
182
|
+
// to disambiguate.
|
|
183
|
+
const occ = countOccurrences(working, match.matched);
|
|
184
|
+
if (occ > 1) {
|
|
185
|
+
return {
|
|
186
|
+
ok: false,
|
|
187
|
+
text: `edit_file: edit #${i + 1} old_text matches ${occ} places in ${args.path} (after ${i} prior edit${i === 1 ? "" : "s"}); pull a wider unique window or set replace_all=true if you really mean every occurrence`,
|
|
188
|
+
failedEditIndex: i + 1,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
working =
|
|
192
|
+
working.slice(0, match.start) + newText + working.slice(match.end);
|
|
193
|
+
applied.push({
|
|
194
|
+
ok: true,
|
|
195
|
+
oldLen: oldText.length,
|
|
196
|
+
newLen: newText.length,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
// Atomic write: temp sibling then rename. Only if every edit ran.
|
|
200
|
+
// Re-attach the BOM here — BOM-preservation is the contract; the
|
|
201
|
+
// batch above never saw it.
|
|
202
|
+
const finalText = applyShape(working, shape);
|
|
203
|
+
const tmp = `${resolved}.tmp.${process.pid}.${Date.now()}`;
|
|
204
|
+
fs.writeFileSync(tmp, finalText);
|
|
205
|
+
fs.renameSync(tmp, resolved);
|
|
206
|
+
// After a successful edit the agent's mental model of the file
|
|
207
|
+
// is now `working`, which is in its context (it just wrote
|
|
208
|
+
// those edits). Treat that as equivalent to having read the new
|
|
209
|
+
// bytes — otherwise a second edit_file in the same turn would
|
|
210
|
+
// need a fresh read_file in between, which is wasteful.
|
|
211
|
+
markRead(sessionId, resolved);
|
|
212
|
+
const totalDelta = applied.reduce((acc, a) => acc + (a.newLen - a.oldLen), 0);
|
|
213
|
+
const summary = applied.length === 1
|
|
214
|
+
? `edited ${toWorkspaceUri(userHome, resolved)} (${applied[0].oldLen} → ${applied[0].newLen} chars)`
|
|
215
|
+
: `edited ${toWorkspaceUri(userHome, resolved)} (${applied.length} edits, net ${totalDelta >= 0 ? "+" : ""}${totalDelta} chars)`;
|
|
216
|
+
return { ok: true, text: summary, edits: applied };
|
|
217
|
+
}
|
|
218
|
+
function countOccurrences(haystack, needle) {
|
|
219
|
+
let count = 0;
|
|
220
|
+
let from = 0;
|
|
221
|
+
while (true) {
|
|
222
|
+
const idx = haystack.indexOf(needle, from);
|
|
223
|
+
if (idx < 0)
|
|
224
|
+
break;
|
|
225
|
+
count++;
|
|
226
|
+
from = idx + needle.length;
|
|
227
|
+
}
|
|
228
|
+
return count;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=edit-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-file.js","sourceRoot":"","sources":["../../src/tools/edit-file.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,0BAA0B;AAC1B,EAAE;AACF,gEAAgE;AAChE,0DAA0D;AAC1D,iEAAiE;AACjE,kEAAkE;AAClE,gEAAgE;AAChE,4DAA4D;AAC5D,iEAAiE;AACjE,8BAA8B;AAC9B,EAAE;AACF,8DAA8D;AAC9D,kEAAkE;AAClE,iEAAiE;AACjE,iEAAiE;AACjE,iBAAiB;AACjB,EAAE;AACF,iEAAiE;AACjE,kEAAkE;AAClE,+DAA+D;AAC/D,uBAAuB;AACvB,EAAE;AACF,4DAA4D;AAC5D,wCAAwC;AAExC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,GACrB,MAAM,kBAA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AAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,EACvC,CAAC,CACF,CAAC;IACF,MAAM,OAAO,GACX,OAAO,CAAC,MAAM,KAAK,CAAC;QAClB,CAAC,CAAC,UAAU,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,CAAE,CAAC,MAAM,MAAM,OAAO,CAAC,CAAC,CAAE,CAAC,MAAM,SAAS;QACtG,CAAC,CAAC,UAAU,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,MAAM,eAAe,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,SAAS,CAAC;IACrI,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAgB,EAAE,MAAc;IACxD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,GAAG,GAAG,CAAC;YAAE,MAAM;QACnB,KAAK,EAAE,CAAC;QACR,IAAI,GAAG,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Apply one or more exact-text replacements inside an existing file.
|
|
2
|
+
|
|
3
|
+
Pass `edits: [{old_text, new_text}, ...]` for a batch — the file
|
|
4
|
+
is read once, edits run in order in memory, and the result is
|
|
5
|
+
written atomically only if every edit succeeds (so a partial
|
|
6
|
+
batch never lands on disk). Each `old_text` must appear exactly
|
|
7
|
+
once at the moment its edit runs, otherwise the whole batch
|
|
8
|
+
fails and reports which edit tripped.
|
|
9
|
+
|
|
10
|
+
Use `write_file` for new files or full rewrites; reach for
|
|
11
|
+
`edit_file` when you're patching specific regions.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
- **You must call `read_file` on the target path first.**
|
|
16
|
+
`edit_file` will refuse with a specific error if the path was
|
|
17
|
+
never read in this session — exact text matching only works
|
|
18
|
+
when you've actually seen the bytes you're matching against.
|
|
19
|
+
- Keep `old_text` as small as possible while still being unique
|
|
20
|
+
in the file. Don't pad with large unchanged regions to
|
|
21
|
+
"connect" two distant changes; emit two separate edits in the
|
|
22
|
+
same batch instead.
|
|
23
|
+
- The only edit kind is exact-text replace. Insertions /
|
|
24
|
+
deletions / appends are expressed as a replace where `new_text`
|
|
25
|
+
includes the surrounding anchor (e.g. delete = `{old_text:
|
|
26
|
+
"X", new_text: ""}`; insert-before-X = `{old_text: "X",
|
|
27
|
+
new_text: "new\nX"}`).
|
|
28
|
+
- Line endings (CRLF vs LF) and BOM are preserved automatically.
|
|
29
|
+
Match by content; you don't need to know which the file uses.
|
|
30
|
+
- Whitespace and indentation are tolerated: trailing-whitespace
|
|
31
|
+
drift, run-of-spaces collapse, and whole-block indent shift
|
|
32
|
+
are matched fuzzily. You still need to send the right text
|
|
33
|
+
in the right order; just stop polishing whitespace by hand.
|
|
34
|
+
- For renaming a symbol that occurs many times, set
|
|
35
|
+
`replace_all: true` on that edit instead of writing one edit
|
|
36
|
+
per occurrence.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Tool } from "@earendil-works/pi-ai";
|
|
2
|
+
export interface GlobToolResult {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
text: string;
|
|
5
|
+
matches?: string[];
|
|
6
|
+
truncated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function globSchema(): Tool;
|
|
9
|
+
export declare function executeGlob(userHome: string, args: {
|
|
10
|
+
pattern: string;
|
|
11
|
+
}): Promise<GlobToolResult>;
|
|
12
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/tools/glob.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AASlD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,UAAU,IAAI,IAAI,CAgBjC;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACxB,OAAO,CAAC,cAAc,CAAC,CA0DzB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// glob — match file paths against a shell-style pattern, scoped to
|
|
2
|
+
// the per-user workspace home.
|
|
3
|
+
//
|
|
4
|
+
// Backed by fast-glob so brace expansion, alternation, double-star,
|
|
5
|
+
// case sensitivity, and gitignore-shaped traversal all behave the way
|
|
6
|
+
// the LLM expects from prior training data.
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import fg from "fast-glob";
|
|
9
|
+
import { Type } from "typebox";
|
|
10
|
+
import { resolveInUserHome, toWorkspaceUri, PathOutsideRootError, } from "./path-helper.js";
|
|
11
|
+
const MAX_RESULTS = 1000;
|
|
12
|
+
export function globSchema() {
|
|
13
|
+
return {
|
|
14
|
+
name: "glob",
|
|
15
|
+
description: `Find files matching a shell-style glob pattern, rooted at the workspace.\n` +
|
|
16
|
+
`Supports the usual glob syntax: \`*\`, \`**\`, \`?\`, \`{a,b}\`, character classes.\n` +
|
|
17
|
+
`Patterns are interpreted relative to the workspace root \u2014 write \`**/*.md\`, \
|
|
18
|
+
not \`/**/*.md\`.\n` +
|
|
19
|
+
`Returns up to ${MAX_RESULTS} matching paths, sorted alphabetically.`,
|
|
20
|
+
parameters: Type.Object({
|
|
21
|
+
pattern: Type.String({
|
|
22
|
+
description: 'Glob pattern relative to the workspace root, e.g. "**/*.md", "src/*.ts", "{notes,journal}/**/*.txt".',
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export async function executeGlob(userHome, args) {
|
|
28
|
+
if (!args.pattern || typeof args.pattern !== "string") {
|
|
29
|
+
return { ok: false, text: "pattern is required" };
|
|
30
|
+
}
|
|
31
|
+
// Strip the optional `/workspace/` prefix or leading `/` so the
|
|
32
|
+
// pattern is fast-glob-relative to userHome. We forbid `..` outright
|
|
33
|
+
// to keep the search inside the user home regardless of any path
|
|
34
|
+
// tricks fast-glob might otherwise resolve.
|
|
35
|
+
let pat = args.pattern.replace(/\\/g, "/");
|
|
36
|
+
if (pat.startsWith("/workspace/"))
|
|
37
|
+
pat = pat.slice("/workspace/".length);
|
|
38
|
+
else if (pat === "/workspace")
|
|
39
|
+
pat = "";
|
|
40
|
+
if (pat.startsWith("/"))
|
|
41
|
+
pat = pat.slice(1);
|
|
42
|
+
if (pat.includes("..")) {
|
|
43
|
+
return { ok: false, text: `pattern cannot contain ".."` };
|
|
44
|
+
}
|
|
45
|
+
if (pat.length === 0) {
|
|
46
|
+
return { ok: false, text: "pattern is empty" };
|
|
47
|
+
}
|
|
48
|
+
// Resolve root and auto-create on first call so a fresh tenant
|
|
49
|
+
// doesn't blow up.
|
|
50
|
+
let root;
|
|
51
|
+
try {
|
|
52
|
+
root = resolveInUserHome(userHome, "/");
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
if (err instanceof PathOutsideRootError) {
|
|
56
|
+
return { ok: false, text: "could not resolve workspace root" };
|
|
57
|
+
}
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
if (!fs.existsSync(root))
|
|
61
|
+
fs.mkdirSync(root, { recursive: true });
|
|
62
|
+
// fast-glob honours `cwd`, returns paths relative to that cwd, and
|
|
63
|
+
// we ask it for files only. `dot: true` so dotfiles surface (the
|
|
64
|
+
// workspace deliberately uses .config/ etc.).
|
|
65
|
+
const found = await fg(pat, {
|
|
66
|
+
cwd: root,
|
|
67
|
+
onlyFiles: true,
|
|
68
|
+
dot: true,
|
|
69
|
+
suppressErrors: true,
|
|
70
|
+
followSymbolicLinks: false,
|
|
71
|
+
});
|
|
72
|
+
found.sort();
|
|
73
|
+
const truncated = found.length > MAX_RESULTS;
|
|
74
|
+
const slice = truncated ? found.slice(0, MAX_RESULTS) : found;
|
|
75
|
+
const matches = slice.map((rel) => toWorkspaceUri(root, `${root}/${rel}`));
|
|
76
|
+
const header = `${matches.length} match${matches.length === 1 ? "" : "es"}${truncated ? ` (truncated at ${MAX_RESULTS})` : ""}:`;
|
|
77
|
+
return {
|
|
78
|
+
ok: true,
|
|
79
|
+
text: [header, ...matches].join("\n"),
|
|
80
|
+
matches,
|
|
81
|
+
truncated,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/tools/glob.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,+BAA+B;AAC/B,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,4CAA4C;AAE5C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,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;AASzB,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,4EAA4E;YAC5E,uFAAuF;YACvF;oBACc;YACd,iBAAiB,WAAW,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AE,EAAE,IAAI;QACR,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACrC,OAAO;QACP,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentTool } from "@tianshu/plugin-sdk";
|
|
2
|
+
export declare const ListDirTool: AgentTool;
|
|
3
|
+
export declare const ReadFileTool: AgentTool;
|
|
4
|
+
export declare const WriteFileTool: AgentTool;
|
|
5
|
+
export declare const EditFileTool: AgentTool;
|
|
6
|
+
export declare const GlobTool: AgentTool;
|
|
7
|
+
export declare const TenantConfigListTool: AgentTool;
|
|
8
|
+
export declare const TenantConfigReadTool: AgentTool;
|
|
9
|
+
export declare const TenantConfigWriteTool: AgentTool;
|
|
10
|
+
export declare const TenantConfigEditTool: AgentTool;
|
|
11
|
+
export declare const TenantConfigDeleteTool: AgentTool;
|
|
12
|
+
export declare const TenantConfigGlobTool: AgentTool;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,qBAAqB,CAAC;AAuC7B,eAAO,MAAM,WAAW,EAAE,SAIzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAQ1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAc3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAmB1B,CAAC;AAuEF,eAAO,MAAM,QAAQ,EAAE,SAItB,CAAC;AASF,eAAO,MAAM,oBAAoB,EAAE,SAIlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAOlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,SAQnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAalC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,SAQpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAOlC,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Agent tools the `files` plugin contributes.
|
|
2
|
+
//
|
|
3
|
+
// These five tools (list_dir / read_file / write_file / edit_file /
|
|
4
|
+
// glob) operate on the **per-user host workspace** \u2014
|
|
5
|
+
// <tenant>/workspace/users/<userId>/. They are NOT sandbox-aware:
|
|
6
|
+
// when the microsandbox plugin is also enabled, the agent will see
|
|
7
|
+
// these alongside microsandbox's `exec` etc. and use whichever fits
|
|
8
|
+
// the task (host fs is direct + persistent; sandbox fs lives inside
|
|
9
|
+
// /workspace which is bind-mounted from the same dir, so changes
|
|
10
|
+
// flow both ways).
|
|
11
|
+
//
|
|
12
|
+
// Ownership rationale: the `files` plugin already owns the file
|
|
13
|
+
// browser UI panel + upload + the HTTP /list /read /raw /upload
|
|
14
|
+
// routes. Putting the agent tools here keeps every "files for the
|
|
15
|
+
// agent / user" surface in one plugin.
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { resolveInUserHome } from "./path-helper.js";
|
|
18
|
+
import { listDirSchema, executeListDir } from "./list-dir.js";
|
|
19
|
+
import { readFileSchema, executeReadFile } from "./read-file.js";
|
|
20
|
+
import { writeFileSchema, executeWriteFile } from "./write-file.js";
|
|
21
|
+
import { editFileSchema, executeEditFile } from "./edit-file.js";
|
|
22
|
+
import { globSchema, executeGlob } from "./glob.js";
|
|
23
|
+
import { tenantConfigListSchema, executeTenantConfigList, } from "./tenant-config-list.js";
|
|
24
|
+
import { tenantConfigReadSchema, executeTenantConfigRead, } from "./tenant-config-read.js";
|
|
25
|
+
import { tenantConfigWriteSchema, executeTenantConfigWrite, } from "./tenant-config-write.js";
|
|
26
|
+
import { tenantConfigEditSchema, executeTenantConfigEdit, } from "./tenant-config-edit.js";
|
|
27
|
+
import { tenantConfigGlobSchema, executeTenantConfigGlob, } from "./tenant-config-glob.js";
|
|
28
|
+
import { tenantConfigDeleteSchema, executeTenantConfigDelete, } from "./tenant-config-delete.js";
|
|
29
|
+
/** Pull the agent's scope from the host-supplied context. Defaults
|
|
30
|
+
* to main if the host doesn't provide one (older host versions). */
|
|
31
|
+
function scopeFromCtx(ctx) {
|
|
32
|
+
return ctx.agentScope ?? { kind: "main" };
|
|
33
|
+
}
|
|
34
|
+
export const ListDirTool = {
|
|
35
|
+
schema: listDirSchema(),
|
|
36
|
+
execute: (args, ctx) => executeListDir(ctx.userHomeDir, args),
|
|
37
|
+
};
|
|
38
|
+
export const ReadFileTool = {
|
|
39
|
+
schema: readFileSchema(),
|
|
40
|
+
execute: (args, ctx) => executeReadFile(ctx.userHomeDir, args, ctx.sessionId),
|
|
41
|
+
};
|
|
42
|
+
export const WriteFileTool = {
|
|
43
|
+
schema: writeFileSchema(),
|
|
44
|
+
execute: async (args, ctx) => {
|
|
45
|
+
const result = executeWriteFile(ctx.userHomeDir, args, ctx.sessionId);
|
|
46
|
+
return appendLspDiagnostics(result, ctx, args);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export const EditFileTool = {
|
|
50
|
+
schema: editFileSchema(),
|
|
51
|
+
execute: async (args, ctx) => {
|
|
52
|
+
const result = executeEditFile(ctx.userHomeDir, args, ctx.sessionId);
|
|
53
|
+
return appendLspDiagnostics(result, ctx, args);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* After a successful write/edit, ask the host's LSP service for
|
|
58
|
+
* diagnostics on the touched file and append the formatted block
|
|
59
|
+
* to the tool's text. ADR-0005 §"Diagnostic delivery" — sync,
|
|
60
|
+
* 3 s timeout, never throws, degrades silently when LSP is
|
|
61
|
+
* disabled or the language has no LSP. The text appended is
|
|
62
|
+
* what we want the model to see in the same turn that produced
|
|
63
|
+
* the edit, so it can react inline rather than several tool
|
|
64
|
+
* calls later.
|
|
65
|
+
*/
|
|
66
|
+
async function appendLspDiagnostics(result, ctx, args) {
|
|
67
|
+
// Don't bother on failed writes — there's nothing on disk to
|
|
68
|
+
// diagnose.
|
|
69
|
+
if (!result.ok)
|
|
70
|
+
return result;
|
|
71
|
+
const cap = ctx.capabilities.get("host.lsp");
|
|
72
|
+
if (!cap)
|
|
73
|
+
return result;
|
|
74
|
+
let resolved;
|
|
75
|
+
try {
|
|
76
|
+
resolved = resolveInUserHome(ctx.userHomeDir, args.path);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Path checks already happened in the underlying tool; if it
|
|
80
|
+
// somehow rejects here just skip diagnostics.
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
// We need the post-edit contents to push via didChange. For
|
|
84
|
+
// write_file the agent supplied them; for edit_file the
|
|
85
|
+
// executor returned ok without echoing them, so we read from
|
|
86
|
+
// disk — cheap (we just wrote it) and avoids drifting from
|
|
87
|
+
// what the LS will actually see when it loads the file.
|
|
88
|
+
let contents;
|
|
89
|
+
if (typeof args.content === "string") {
|
|
90
|
+
contents = args.content;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
try {
|
|
94
|
+
contents = fsReadFile(resolved);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let diag;
|
|
101
|
+
try {
|
|
102
|
+
diag = await cap.diagnoseAfterEdit({
|
|
103
|
+
filePath: resolved,
|
|
104
|
+
contents,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Capability is supposed to never throw, but if it does
|
|
109
|
+
// we'd rather drop diagnostics than break the edit.
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
if (!diag.text && !diag.unavailable)
|
|
113
|
+
return result;
|
|
114
|
+
const trailer = diag.text
|
|
115
|
+
? `\n\n${diag.text}`
|
|
116
|
+
: `\n\n[lsp] diagnostics unavailable: ${diag.unavailable}`;
|
|
117
|
+
return { ...result, text: result.text + trailer };
|
|
118
|
+
}
|
|
119
|
+
function fsReadFile(absolutePath) {
|
|
120
|
+
// Lazy-import node:fs so this module stays browser-bundle-safe
|
|
121
|
+
// (the SDK consumer only imports tool schemas).
|
|
122
|
+
return readFileSync(absolutePath, "utf8");
|
|
123
|
+
}
|
|
124
|
+
export const GlobTool = {
|
|
125
|
+
schema: globSchema(),
|
|
126
|
+
execute: (args, ctx) => executeGlob(ctx.userHomeDir, args),
|
|
127
|
+
};
|
|
128
|
+
// ─── Tenant-config tools ────────────────────────────────────────
|
|
129
|
+
//
|
|
130
|
+
// These five mirror the per-user fs tools but operate on the
|
|
131
|
+
// tenant-shared config tree at `<tenant>/workspace/_tenant/config/`.
|
|
132
|
+
// Reads are unrestricted; writes are scope-gated (main agent vs
|
|
133
|
+
// worker:<kind>) by `tenant-config-helper.checkWritable`.
|
|
134
|
+
export const TenantConfigListTool = {
|
|
135
|
+
schema: tenantConfigListSchema(),
|
|
136
|
+
execute: (args, ctx) => executeTenantConfigList(ctx.tenantHomeDir, args),
|
|
137
|
+
};
|
|
138
|
+
export const TenantConfigReadTool = {
|
|
139
|
+
schema: tenantConfigReadSchema(),
|
|
140
|
+
execute: (args, ctx) => executeTenantConfigRead(ctx.tenantHomeDir, args),
|
|
141
|
+
};
|
|
142
|
+
export const TenantConfigWriteTool = {
|
|
143
|
+
schema: tenantConfigWriteSchema(),
|
|
144
|
+
execute: (args, ctx) => executeTenantConfigWrite(ctx.tenantHomeDir, scopeFromCtx(ctx), args),
|
|
145
|
+
};
|
|
146
|
+
export const TenantConfigEditTool = {
|
|
147
|
+
schema: tenantConfigEditSchema(),
|
|
148
|
+
execute: (args, ctx) => executeTenantConfigEdit(ctx.tenantHomeDir, scopeFromCtx(ctx), args),
|
|
149
|
+
};
|
|
150
|
+
export const TenantConfigDeleteTool = {
|
|
151
|
+
schema: tenantConfigDeleteSchema(),
|
|
152
|
+
execute: (args, ctx) => executeTenantConfigDelete(ctx.tenantHomeDir, scopeFromCtx(ctx), args),
|
|
153
|
+
};
|
|
154
|
+
export const TenantConfigGlobTool = {
|
|
155
|
+
schema: tenantConfigGlobSchema(),
|
|
156
|
+
execute: (args, ctx) => executeTenantConfigGlob(ctx.tenantHomeDir, args),
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,oEAAoE;AACpE,0DAA0D;AAC1D,kEAAkE;AAClE,mEAAmE;AACnE,oEAAoE;AACpE,oEAAoE;AACpE,iEAAiE;AACjE,mBAAmB;AACnB,EAAE;AACF,gEAAgE;AAChE,gEAAgE;AAChE,kEAAkE;AAClE,uCAAuC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;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,CAAC,GAAG,CAAC,EACjB,IAAyC,CAC1C;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAc;IAC7C,MAAM,EAAE,sBAAsB,EAAE;IAChC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAqB,EAAE,EAAE,CACvC,uBAAuB,CACrB,GAAG,CAAC,aAAa,EACjB,YAAY,CAAC,GAAG,CAAC,EACjB,IAKC,CACF;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAc;IAC/C,MAAM,EAAE,wBAAwB,EAAE;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAqB,EAAE,EAAE,CACvC,yBAAyB,CACvB,GAAG,CAAC,aAAa,EACjB,YAAY,CAAC,GAAG,CAAC,EACjB,IAA6C,CAC9C;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAc;IAC7C,MAAM,EAAE,sBAAsB,EAAE;IAChC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAqB,EAAE,EAAE,CACvC,uBAAuB,CACrB,GAAG,CAAC,aAAa,EACjB,IAA2B,CAC5B;CACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Tool } from "@earendil-works/pi-ai";
|
|
2
|
+
interface ListEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
type: "directory" | "file" | "other";
|
|
6
|
+
size: number;
|
|
7
|
+
modifiedMs: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ListDirToolResult {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
text: string;
|
|
12
|
+
entries?: ListEntry[];
|
|
13
|
+
truncated?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Build the tool definition (Type schema) and a separate executor.
|
|
16
|
+
* Keeping these separate lets the chat handler register the schema
|
|
17
|
+
* with pi-ai while invoking the executor inside its own loop with
|
|
18
|
+
* the per-request user home. */
|
|
19
|
+
export declare function listDirSchema(): Tool;
|
|
20
|
+
export declare function executeListDir(userHome: string, args: {
|
|
21
|
+
path?: string;
|
|
22
|
+
}): ListDirToolResult;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=list-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-dir.d.ts","sourceRoot":"","sources":["../../src/tools/list-dir.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AASlD,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;iCAGiC;AACjC,wBAAgB,aAAa,IAAI,IAAI,CAmBpC;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,iBAAiB,CAwEnB"}
|