orbitx 0.0.7 → 0.0.9
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/Readme.md +227 -67
- package/dist/core/agent-providers.d.ts +16 -0
- package/dist/core/agent-providers.d.ts.map +1 -0
- package/dist/core/agent-providers.js +21 -0
- package/dist/core/agent-providers.js.map +1 -0
- package/dist/core/ai-provider.d.ts +69 -1
- package/dist/core/ai-provider.d.ts.map +1 -1
- package/dist/core/ai-provider.js.map +1 -1
- package/dist/core/base-agent.d.ts +8 -4
- package/dist/core/base-agent.d.ts.map +1 -1
- package/dist/core/base-agent.js +220 -88
- package/dist/core/base-agent.js.map +1 -1
- package/dist/core/deepseek-provider.d.ts +10 -3
- package/dist/core/deepseek-provider.d.ts.map +1 -1
- package/dist/core/deepseek-provider.js +144 -39
- package/dist/core/deepseek-provider.js.map +1 -1
- package/dist/core/image-describer.d.ts +13 -0
- package/dist/core/image-describer.d.ts.map +1 -0
- package/dist/core/image-describer.js +33 -0
- package/dist/core/image-describer.js.map +1 -0
- package/dist/core/mcp-client.d.ts +17 -4
- package/dist/core/mcp-client.d.ts.map +1 -1
- package/dist/core/mcp-client.js +32 -16
- package/dist/core/mcp-client.js.map +1 -1
- package/dist/core/mcp-computer.d.ts +10 -2
- package/dist/core/mcp-computer.d.ts.map +1 -1
- package/dist/core/mcp-computer.js +108 -2
- package/dist/core/mcp-computer.js.map +1 -1
- package/dist/core/mcp-fs-storage.d.ts +8 -0
- package/dist/core/mcp-fs-storage.d.ts.map +1 -0
- package/dist/core/mcp-fs-storage.js +27 -0
- package/dist/core/mcp-fs-storage.js.map +1 -0
- package/dist/core/mcp-rng.d.ts +7 -0
- package/dist/core/mcp-rng.d.ts.map +1 -0
- package/dist/core/mcp-rng.js +14 -0
- package/dist/core/mcp-rng.js.map +1 -0
- package/dist/core/mcp-server.d.ts +8 -4
- package/dist/core/mcp-server.d.ts.map +1 -1
- package/dist/core/mcp-server.js +20 -3
- package/dist/core/mcp-server.js.map +1 -1
- package/dist/core/mcp-storage.d.ts +5 -0
- package/dist/core/mcp-storage.d.ts.map +1 -0
- package/dist/core/mcp-storage.js +3 -0
- package/dist/core/mcp-storage.js.map +1 -0
- package/dist/core/mcp.d.ts +37 -3
- package/dist/core/mcp.d.ts.map +1 -1
- package/dist/core/mcp.js +42 -1
- package/dist/core/mcp.js.map +1 -1
- package/dist/core/ollama-provider.d.ts +10 -3
- package/dist/core/ollama-provider.d.ts.map +1 -1
- package/dist/core/ollama-provider.js +122 -41
- package/dist/core/ollama-provider.js.map +1 -1
- package/dist/core/retry.d.ts +10 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/core/retry.js +39 -0
- package/dist/core/retry.js.map +1 -0
- package/dist/core/skill.d.ts +3 -0
- package/dist/core/skill.d.ts.map +1 -1
- package/dist/core/skill.js.map +1 -1
- package/dist/core/tool-schema-translator.d.ts +10 -0
- package/dist/core/tool-schema-translator.d.ts.map +1 -0
- package/dist/core/tool-schema-translator.js +29 -0
- package/dist/core/tool-schema-translator.js.map +1 -0
- package/dist/index.d.ts +34 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +27 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/skills/backend-security.d.ts +4 -0
- package/dist/skills/backend-security.d.ts.map +1 -0
- package/dist/skills/backend-security.js +74 -0
- package/dist/skills/backend-security.js.map +1 -0
- package/dist/skills/big-task.d.ts +4 -0
- package/dist/skills/big-task.d.ts.map +1 -0
- package/dist/skills/big-task.js +66 -0
- package/dist/skills/big-task.js.map +1 -0
- package/dist/skills/code-verification.d.ts +4 -0
- package/dist/skills/code-verification.d.ts.map +1 -0
- package/dist/skills/code-verification.js +59 -0
- package/dist/skills/code-verification.js.map +1 -0
- package/dist/skills/long-task-efficiency.d.ts +4 -0
- package/dist/skills/long-task-efficiency.d.ts.map +1 -0
- package/dist/skills/long-task-efficiency.js +50 -0
- package/dist/skills/long-task-efficiency.js.map +1 -0
- package/dist/skills/node-backend.d.ts +4 -0
- package/dist/skills/node-backend.d.ts.map +1 -0
- package/dist/skills/node-backend.js +110 -0
- package/dist/skills/node-backend.js.map +1 -0
- package/dist/skills/planner.d.ts +4 -0
- package/dist/skills/planner.d.ts.map +1 -0
- package/dist/skills/planner.js +49 -0
- package/dist/skills/planner.js.map +1 -0
- package/dist/skills/present.d.ts +4 -0
- package/dist/skills/present.d.ts.map +1 -0
- package/dist/skills/present.js +56 -0
- package/dist/skills/present.js.map +1 -0
- package/dist/skills/question-answer.d.ts +4 -0
- package/dist/skills/question-answer.d.ts.map +1 -0
- package/dist/skills/question-answer.js +55 -0
- package/dist/skills/question-answer.js.map +1 -0
- package/dist/skills/react-frontend.d.ts +4 -0
- package/dist/skills/react-frontend.d.ts.map +1 -0
- package/dist/skills/react-frontend.js +111 -0
- package/dist/skills/react-frontend.js.map +1 -0
- package/dist/skills/research.d.ts +4 -0
- package/dist/skills/research.d.ts.map +1 -0
- package/dist/skills/research.js +81 -0
- package/dist/skills/research.js.map +1 -0
- package/dist/skills/shopping.d.ts +4 -0
- package/dist/skills/shopping.d.ts.map +1 -0
- package/dist/skills/shopping.js +71 -0
- package/dist/skills/shopping.js.map +1 -0
- package/dist/skills/ui-ux-design.d.ts +4 -0
- package/dist/skills/ui-ux-design.d.ts.map +1 -0
- package/dist/skills/ui-ux-design.js +70 -0
- package/dist/skills/ui-ux-design.js.map +1 -0
- package/dist/skills/web-end-to-end-test.d.ts +4 -0
- package/dist/skills/web-end-to-end-test.d.ts.map +1 -0
- package/dist/skills/web-end-to-end-test.js +76 -0
- package/dist/skills/web-end-to-end-test.js.map +1 -0
- package/dist/templates/simple.d.ts +1 -1
- package/dist/templates/simple.d.ts.map +1 -1
- package/dist/templates/simple.js +4 -0
- package/dist/templates/simple.js.map +1 -1
- package/dist/tests/mcp.test.js +2 -54
- package/dist/tests/mcp.test.js.map +1 -1
- package/dist/tools/bash/index.d.ts +10 -0
- package/dist/tools/bash/index.d.ts.map +1 -0
- package/dist/tools/bash/index.js +22 -0
- package/dist/tools/bash/index.js.map +1 -0
- package/dist/tools/bash/interaction.d.ts +29 -0
- package/dist/tools/bash/interaction.d.ts.map +1 -0
- package/dist/tools/bash/interaction.js +13 -0
- package/dist/tools/bash/interaction.js.map +1 -0
- package/dist/tools/bash/list.d.ts +4 -0
- package/dist/tools/bash/list.d.ts.map +1 -0
- package/dist/tools/bash/list.js +23 -0
- package/dist/tools/bash/list.js.map +1 -0
- package/dist/tools/bash/logs.d.ts +4 -0
- package/dist/tools/bash/logs.d.ts.map +1 -0
- package/dist/tools/bash/logs.js +47 -0
- package/dist/tools/bash/logs.js.map +1 -0
- package/dist/tools/bash/process-manager.d.ts +35 -0
- package/dist/tools/bash/process-manager.d.ts.map +1 -0
- package/dist/tools/bash/process-manager.js +137 -0
- package/dist/tools/bash/process-manager.js.map +1 -0
- package/dist/tools/bash/run.d.ts +5 -0
- package/dist/tools/bash/run.d.ts.map +1 -0
- package/dist/tools/bash/run.js +57 -0
- package/dist/tools/bash/run.js.map +1 -0
- package/dist/tools/bash/terminate.d.ts +5 -0
- package/dist/tools/bash/terminate.d.ts.map +1 -0
- package/dist/tools/bash/terminate.js +39 -0
- package/dist/tools/bash/terminate.js.map +1 -0
- package/dist/tools/bash/wait.d.ts +5 -0
- package/dist/tools/bash/wait.d.ts.map +1 -0
- package/dist/tools/bash/wait.js +50 -0
- package/dist/tools/bash/wait.js.map +1 -0
- package/dist/tools/bash/write-input.d.ts +5 -0
- package/dist/tools/bash/write-input.d.ts.map +1 -0
- package/dist/tools/bash/write-input.js +47 -0
- package/dist/tools/bash/write-input.js.map +1 -0
- package/dist/tools/browser/click.d.ts +5 -0
- package/dist/tools/browser/click.d.ts.map +1 -0
- package/dist/tools/browser/click.js +44 -0
- package/dist/tools/browser/click.js.map +1 -0
- package/dist/tools/browser/console.d.ts +4 -0
- package/dist/tools/browser/console.d.ts.map +1 -0
- package/dist/tools/browser/console.js +41 -0
- package/dist/tools/browser/console.js.map +1 -0
- package/dist/tools/browser/create-session.d.ts +5 -0
- package/dist/tools/browser/create-session.d.ts.map +1 -0
- package/dist/tools/browser/create-session.js +30 -0
- package/dist/tools/browser/create-session.js.map +1 -0
- package/dist/tools/browser/evaluate-safe.d.ts +10 -0
- package/dist/tools/browser/evaluate-safe.d.ts.map +1 -0
- package/dist/tools/browser/evaluate-safe.js +65 -0
- package/dist/tools/browser/evaluate-safe.js.map +1 -0
- package/dist/tools/browser/fill.d.ts +5 -0
- package/dist/tools/browser/fill.d.ts.map +1 -0
- package/dist/tools/browser/fill.js +78 -0
- package/dist/tools/browser/fill.js.map +1 -0
- package/dist/tools/browser/get-sessions.d.ts +4 -0
- package/dist/tools/browser/get-sessions.d.ts.map +1 -0
- package/dist/tools/browser/get-sessions.js +14 -0
- package/dist/tools/browser/get-sessions.js.map +1 -0
- package/dist/tools/browser/index.d.ts +19 -0
- package/dist/tools/browser/index.d.ts.map +1 -0
- package/dist/tools/browser/index.js +49 -0
- package/dist/tools/browser/index.js.map +1 -0
- package/dist/tools/browser/inject.d.ts +5 -0
- package/dist/tools/browser/inject.d.ts.map +1 -0
- package/dist/tools/browser/inject.js +51 -0
- package/dist/tools/browser/inject.js.map +1 -0
- package/dist/tools/browser/interaction.d.ts +49 -0
- package/dist/tools/browser/interaction.d.ts.map +1 -0
- package/dist/tools/browser/interaction.js +14 -0
- package/dist/tools/browser/interaction.js.map +1 -0
- package/dist/tools/browser/navigate.d.ts +5 -0
- package/dist/tools/browser/navigate.d.ts.map +1 -0
- package/dist/tools/browser/navigate.js +39 -0
- package/dist/tools/browser/navigate.js.map +1 -0
- package/dist/tools/browser/network-status.d.ts +4 -0
- package/dist/tools/browser/network-status.d.ts.map +1 -0
- package/dist/tools/browser/network-status.js +35 -0
- package/dist/tools/browser/network-status.js.map +1 -0
- package/dist/tools/browser/network.d.ts +4 -0
- package/dist/tools/browser/network.d.ts.map +1 -0
- package/dist/tools/browser/network.js +51 -0
- package/dist/tools/browser/network.js.map +1 -0
- package/dist/tools/browser/read-page.d.ts +45 -0
- package/dist/tools/browser/read-page.d.ts.map +1 -0
- package/dist/tools/browser/read-page.js +264 -0
- package/dist/tools/browser/read-page.js.map +1 -0
- package/dist/tools/browser/read.d.ts +5 -0
- package/dist/tools/browser/read.d.ts.map +1 -0
- package/dist/tools/browser/read.js +56 -0
- package/dist/tools/browser/read.js.map +1 -0
- package/dist/tools/browser/remove-session.d.ts +5 -0
- package/dist/tools/browser/remove-session.d.ts.map +1 -0
- package/dist/tools/browser/remove-session.js +29 -0
- package/dist/tools/browser/remove-session.js.map +1 -0
- package/dist/tools/browser/screenshot.d.ts +5 -0
- package/dist/tools/browser/screenshot.d.ts.map +1 -0
- package/dist/tools/browser/screenshot.js +50 -0
- package/dist/tools/browser/screenshot.js.map +1 -0
- package/dist/tools/browser/scroll-info.d.ts +4 -0
- package/dist/tools/browser/scroll-info.d.ts.map +1 -0
- package/dist/tools/browser/scroll-info.js +28 -0
- package/dist/tools/browser/scroll-info.js.map +1 -0
- package/dist/tools/browser/scroll.d.ts +5 -0
- package/dist/tools/browser/scroll.d.ts.map +1 -0
- package/dist/tools/browser/scroll.js +43 -0
- package/dist/tools/browser/scroll.js.map +1 -0
- package/dist/tools/browser/session-manager.d.ts +35 -0
- package/dist/tools/browser/session-manager.d.ts.map +1 -0
- package/dist/tools/browser/session-manager.js +101 -0
- package/dist/tools/browser/session-manager.js.map +1 -0
- package/dist/tools/browser/submit-form.d.ts +5 -0
- package/dist/tools/browser/submit-form.d.ts.map +1 -0
- package/dist/tools/browser/submit-form.js +45 -0
- package/dist/tools/browser/submit-form.js.map +1 -0
- package/dist/tools/fs/create-dir.d.ts +5 -0
- package/dist/tools/fs/create-dir.d.ts.map +1 -0
- package/dist/tools/fs/create-dir.js +28 -0
- package/dist/tools/fs/create-dir.js.map +1 -0
- package/dist/tools/fs/delete.d.ts +5 -0
- package/dist/tools/fs/delete.d.ts.map +1 -0
- package/dist/tools/fs/delete.js +45 -0
- package/dist/tools/fs/delete.js.map +1 -0
- package/dist/tools/fs/edit-file.d.ts +5 -0
- package/dist/tools/fs/edit-file.d.ts.map +1 -0
- package/dist/tools/fs/edit-file.js +74 -0
- package/dist/tools/fs/edit-file.js.map +1 -0
- package/dist/tools/fs/index.d.ts +11 -2
- package/dist/tools/fs/index.d.ts.map +1 -1
- package/dist/tools/fs/index.js +27 -2
- package/dist/tools/fs/index.js.map +1 -1
- package/dist/tools/fs/interaction.d.ts +37 -0
- package/dist/tools/fs/interaction.d.ts.map +1 -0
- package/dist/tools/fs/interaction.js +13 -0
- package/dist/tools/fs/interaction.js.map +1 -0
- package/dist/tools/fs/list-dir.d.ts +5 -0
- package/dist/tools/fs/list-dir.d.ts.map +1 -0
- package/dist/tools/fs/list-dir.js +87 -0
- package/dist/tools/fs/list-dir.js.map +1 -0
- package/dist/tools/fs/move.d.ts +5 -0
- package/dist/tools/fs/move.d.ts.map +1 -0
- package/dist/tools/fs/move.js +44 -0
- package/dist/tools/fs/move.js.map +1 -0
- package/dist/tools/fs/read-file.d.ts +4 -3
- package/dist/tools/fs/read-file.d.ts.map +1 -1
- package/dist/tools/fs/read-file.js +50 -42
- package/dist/tools/fs/read-file.js.map +1 -1
- package/dist/tools/fs/stat.d.ts +5 -0
- package/dist/tools/fs/stat.d.ts.map +1 -0
- package/dist/tools/fs/stat.js +40 -0
- package/dist/tools/fs/stat.js.map +1 -0
- package/dist/tools/fs/utils.d.ts +20 -0
- package/dist/tools/fs/utils.d.ts.map +1 -0
- package/dist/tools/fs/utils.js +33 -0
- package/dist/tools/fs/utils.js.map +1 -0
- package/dist/tools/fs/write-file.d.ts +4 -3
- package/dist/tools/fs/write-file.d.ts.map +1 -1
- package/dist/tools/fs/write-file.js +39 -58
- package/dist/tools/fs/write-file.js.map +1 -1
- package/dist/tools/present/add.d.ts +5 -0
- package/dist/tools/present/add.d.ts.map +1 -0
- package/dist/tools/present/add.js +54 -0
- package/dist/tools/present/add.js.map +1 -0
- package/dist/tools/present/clear.d.ts +5 -0
- package/dist/tools/present/clear.d.ts.map +1 -0
- package/dist/tools/present/clear.js +23 -0
- package/dist/tools/present/clear.js.map +1 -0
- package/dist/tools/present/get-list.d.ts +5 -0
- package/dist/tools/present/get-list.d.ts.map +1 -0
- package/dist/tools/present/get-list.js +24 -0
- package/dist/tools/present/get-list.js.map +1 -0
- package/dist/tools/present/index.d.ts +8 -0
- package/dist/tools/present/index.d.ts.map +1 -0
- package/dist/tools/present/index.js +14 -0
- package/dist/tools/present/index.js.map +1 -0
- package/dist/tools/present/interaction.d.ts +17 -0
- package/dist/tools/present/interaction.d.ts.map +1 -0
- package/dist/tools/present/interaction.js +15 -0
- package/dist/tools/present/interaction.js.map +1 -0
- package/dist/tools/present/utils.d.ts +12 -0
- package/dist/tools/present/utils.d.ts.map +1 -0
- package/dist/tools/present/utils.js +40 -0
- package/dist/tools/present/utils.js.map +1 -0
- package/dist/tools/question-answer/index.d.ts +5 -0
- package/dist/tools/question-answer/index.d.ts.map +1 -0
- package/dist/tools/question-answer/index.js +7 -0
- package/dist/tools/question-answer/index.js.map +1 -0
- package/dist/tools/question-answer/interaction.d.ts +14 -0
- package/dist/tools/question-answer/interaction.d.ts.map +1 -0
- package/dist/tools/question-answer/interaction.js +13 -0
- package/dist/tools/question-answer/interaction.js.map +1 -0
- package/dist/tools/question-answer/question-answer.d.ts +5 -0
- package/dist/tools/question-answer/question-answer.d.ts.map +1 -0
- package/dist/tools/question-answer/question-answer.js +24 -0
- package/dist/tools/question-answer/question-answer.js.map +1 -0
- package/dist/tools/todo/check-task.d.ts +5 -0
- package/dist/tools/todo/check-task.d.ts.map +1 -0
- package/dist/tools/todo/check-task.js +49 -0
- package/dist/tools/todo/check-task.js.map +1 -0
- package/dist/tools/todo/create-list.d.ts +5 -0
- package/dist/tools/todo/create-list.d.ts.map +1 -0
- package/dist/tools/todo/create-list.js +36 -0
- package/dist/tools/todo/create-list.js.map +1 -0
- package/dist/tools/todo/create-task.d.ts +5 -0
- package/dist/tools/todo/create-task.d.ts.map +1 -0
- package/dist/tools/todo/create-task.js +63 -0
- package/dist/tools/todo/create-task.js.map +1 -0
- package/dist/tools/todo/get-list.d.ts +4 -0
- package/dist/tools/todo/get-list.d.ts.map +1 -0
- package/dist/tools/todo/get-list.js +38 -0
- package/dist/tools/todo/get-list.js.map +1 -0
- package/dist/tools/todo/get-lists.d.ts +4 -0
- package/dist/tools/todo/get-lists.d.ts.map +1 -0
- package/dist/tools/todo/get-lists.js +18 -0
- package/dist/tools/todo/get-lists.js.map +1 -0
- package/dist/tools/todo/index.d.ts +12 -0
- package/dist/tools/todo/index.d.ts.map +1 -0
- package/dist/tools/todo/index.js +25 -0
- package/dist/tools/todo/index.js.map +1 -0
- package/dist/tools/todo/interaction.d.ts +30 -0
- package/dist/tools/todo/interaction.d.ts.map +1 -0
- package/dist/tools/todo/interaction.js +13 -0
- package/dist/tools/todo/interaction.js.map +1 -0
- package/dist/tools/todo/remove-list.d.ts +5 -0
- package/dist/tools/todo/remove-list.d.ts.map +1 -0
- package/dist/tools/todo/remove-list.js +42 -0
- package/dist/tools/todo/remove-list.js.map +1 -0
- package/dist/tools/todo/remove-task.d.ts +5 -0
- package/dist/tools/todo/remove-task.d.ts.map +1 -0
- package/dist/tools/todo/remove-task.js +45 -0
- package/dist/tools/todo/remove-task.js.map +1 -0
- package/dist/tools/todo/storage.d.ts +22 -0
- package/dist/tools/todo/storage.d.ts.map +1 -0
- package/dist/tools/todo/storage.js +44 -0
- package/dist/tools/todo/storage.js.map +1 -0
- package/dist/tools/utils/delay.d.ts +10 -0
- package/dist/tools/utils/delay.d.ts.map +1 -0
- package/dist/tools/utils/delay.js +33 -0
- package/dist/tools/utils/delay.js.map +1 -0
- package/dist/tools/utils/get-current-time.d.ts +7 -2
- package/dist/tools/utils/get-current-time.d.ts.map +1 -1
- package/dist/tools/utils/get-current-time.js +12 -31
- package/dist/tools/utils/get-current-time.js.map +1 -1
- package/dist/tools/utils/index.d.ts +2 -0
- package/dist/tools/utils/index.d.ts.map +1 -1
- package/dist/tools/utils/index.js +7 -0
- package/dist/tools/utils/index.js.map +1 -1
- package/package.json +54 -56
- package/dist/templates/researcher.d.ts +0 -27
- package/dist/templates/researcher.d.ts.map +0 -1
- package/dist/templates/researcher.js +0 -70
- package/dist/templates/researcher.js.map +0 -1
- package/dist/tools/www/fetch.d.ts +0 -4
- package/dist/tools/www/fetch.d.ts.map +0 -1
- package/dist/tools/www/fetch.js +0 -147
- package/dist/tools/www/fetch.js.map +0 -1
- package/dist/tools/www/index.d.ts +0 -4
- package/dist/tools/www/index.d.ts.map +0 -1
- package/dist/tools/www/index.js +0 -4
- package/dist/tools/www/index.js.map +0 -1
- package/dist/tools/www/read-web-page.d.ts +0 -4
- package/dist/tools/www/read-web-page.d.ts.map +0 -1
- package/dist/tools/www/read-web-page.js +0 -330
- package/dist/tools/www/read-web-page.js.map +0 -1
- package/dist/tools/www/web-search.d.ts +0 -4
- package/dist/tools/www/web-search.d.ts.map +0 -1
- package/dist/tools/www/web-search.js +0 -82
- package/dist/tools/www/web-search.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/move.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,UAAU,8BA4CrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { rename, mkdir } from "fs/promises";
|
|
2
|
+
import { dirname } from "path";
|
|
3
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
4
|
+
import { FsInteraction } from "./interaction.js";
|
|
5
|
+
import { resolvePath } from "./utils.js";
|
|
6
|
+
export const FsMoveTool = () => new MCPTool({
|
|
7
|
+
name: "fs-move",
|
|
8
|
+
description: "move or rename a file or directory",
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: "from",
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "absolute or cwd-relative source path",
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "to",
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "absolute or cwd-relative destination path",
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
customClass: new FsInteraction(),
|
|
24
|
+
execute: async (_envID, inputs, _mcp, customClass) => {
|
|
25
|
+
const { from, to } = inputs;
|
|
26
|
+
const fullFrom = resolvePath(from);
|
|
27
|
+
const fullTo = resolvePath(to);
|
|
28
|
+
customClass?.emitFsEvent({ type: "moving", from: fullFrom, to: fullTo });
|
|
29
|
+
await mkdir(dirname(fullTo), { recursive: true });
|
|
30
|
+
try {
|
|
31
|
+
await rename(fullFrom, fullTo);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
if (err.code === "ENOENT")
|
|
35
|
+
throw new Error(`no file or directory found at "${from}"`);
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
message: "success",
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export default FsMoveTool;
|
|
44
|
+
//# sourceMappingURL=move.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.js","sourceRoot":"","sources":["../../../src/tools/fs/move.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,O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ACJ,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import MCPTool from "../../core/mcp.js";
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
2
|
+
import { FsInteraction } from "./interaction.js";
|
|
3
|
+
export declare const FsReadFileTool: () => MCPTool<FsInteraction>;
|
|
4
|
+
export default FsReadFileTool;
|
|
4
5
|
//# sourceMappingURL=read-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,cAAc,8BA0DzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -1,49 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { readFile } from "fs/promises";
|
|
2
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
3
|
+
import { FsInteraction } from "./interaction.js";
|
|
4
|
+
import { resolvePath, toLines, paginateLines } from "./utils.js";
|
|
5
|
+
export const FsReadFileTool = () => new MCPTool({
|
|
6
|
+
name: "fs-read-file",
|
|
7
|
+
description: "read a text file from disk, optionally paging through it by line so large files never need to be read in one shot",
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: "path",
|
|
9
11
|
type: "string",
|
|
10
|
-
description:
|
|
12
|
+
description: "absolute or cwd-relative path to the file",
|
|
11
13
|
required: true,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "offsetLine",
|
|
17
|
+
type: "number",
|
|
18
|
+
description: "line offset to start reading from",
|
|
19
|
+
required: false,
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "limitLine",
|
|
24
|
+
type: "number",
|
|
25
|
+
description: "max number of lines to return",
|
|
26
|
+
required: false,
|
|
27
|
+
default: 2000,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
customClass: new FsInteraction(),
|
|
31
|
+
execute: async (_envID, inputs, _mcp, customClass) => {
|
|
32
|
+
const { path, offsetLine = 0, limitLine = 2000 } = inputs;
|
|
33
|
+
const fullPath = resolvePath(path);
|
|
34
|
+
customClass?.emitFsEvent({ type: "reading", path: fullPath });
|
|
35
|
+
let raw;
|
|
14
36
|
try {
|
|
15
|
-
|
|
16
|
-
if (!filePath || typeof filePath !== "string") {
|
|
17
|
-
throw new Error("filePath must be a non-empty string");
|
|
18
|
-
}
|
|
19
|
-
const normalizedPath = path.normalize(filePath);
|
|
20
|
-
const data = await fs.readFile(normalizedPath, "utf-8");
|
|
21
|
-
return {
|
|
22
|
-
message: `File read successfully: ${normalizedPath}`,
|
|
23
|
-
path: normalizedPath,
|
|
24
|
-
content: data,
|
|
25
|
-
size: data.length
|
|
26
|
-
};
|
|
37
|
+
raw = await readFile(fullPath, { encoding: "utf-8" });
|
|
27
38
|
}
|
|
28
|
-
catch (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
else if (err.code === "EACCES") {
|
|
36
|
-
errorMessage = `Permission denied: ${inputs.filePath}`;
|
|
37
|
-
}
|
|
38
|
-
else if (err.code === "EISDIR") {
|
|
39
|
-
errorMessage = `Path is a directory, not a file: ${inputs.filePath}`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
error: errorMessage
|
|
44
|
-
};
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (err.code === "ENOENT")
|
|
41
|
+
throw new Error(`no file found at "${path}"`);
|
|
42
|
+
if (err.code === "EISDIR")
|
|
43
|
+
throw new Error(`"${path}" is a directory, not a file`);
|
|
44
|
+
throw err;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
const lines = toLines(raw);
|
|
47
|
+
const { content, totalLines, startLine, endLine } = paginateLines(lines, offsetLine, limitLine);
|
|
48
|
+
return {
|
|
49
|
+
content,
|
|
50
|
+
totalLines,
|
|
51
|
+
startLine,
|
|
52
|
+
endLine,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
47
55
|
});
|
|
48
|
-
export default
|
|
56
|
+
export default FsReadFileTool;
|
|
49
57
|
//# sourceMappingURL=read-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAgB;IAC3D,IAAI,EAAE,cAAc;IACpB,WAAW,EACP,mHAAmH;IACvH,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2CAA2C;YACxD,QAAQ,EAAE,IAAI;SACjB;QACD;YACI,IAAI,EAAE,YAAY;YAClB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H,OAAO;YACP,UAAU;YACV,SAAS;YACT,OAAO;SACV,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/stat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,UAAU,8BAwCrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { stat } from "fs/promises";
|
|
2
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
3
|
+
import { FsInteraction } from "./interaction.js";
|
|
4
|
+
import { resolvePath } from "./utils.js";
|
|
5
|
+
export const FsStatTool = () => new MCPTool({
|
|
6
|
+
name: "fs-stat",
|
|
7
|
+
description: "check whether a path exists and get its metadata (type, size, modified time)",
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: "path",
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "absolute or cwd-relative path to inspect",
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
customClass: new FsInteraction(),
|
|
17
|
+
execute: async (_envID, inputs, _mcp, customClass) => {
|
|
18
|
+
const { path } = inputs;
|
|
19
|
+
const fullPath = resolvePath(path);
|
|
20
|
+
customClass?.emitFsEvent({ type: "stat", path: fullPath });
|
|
21
|
+
try {
|
|
22
|
+
const s = await stat(fullPath);
|
|
23
|
+
return {
|
|
24
|
+
exists: true,
|
|
25
|
+
type: s.isDirectory() ? "directory" : s.isSymbolicLink() ? "symlink" : "file",
|
|
26
|
+
size: s.size,
|
|
27
|
+
modifiedAt: s.mtime.toISOString(),
|
|
28
|
+
createdAt: s.birthtime.toISOString(),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (err.code === "ENOENT") {
|
|
33
|
+
return { exists: false };
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
export default FsStatTool;
|
|
40
|
+
//# sourceMappingURL=stat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/tools/fs/stat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAgB;IACvD,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,8EAA8E;IAC3F,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;SACjB;KACJ;IACD,WAAW,EAAE,IAAI,aAAa,EAAE;IAChC,OAAO,EAAE,KAAK,EACV,MAAc,EACd,MAA2B,EAC3B,IAAU,EACV,WAA2B,EACf,EAAE;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAEnC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE3D,IAAI,CAAC;YACD,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/B,OAAO;gBACH,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;gBAC7E,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE;gBACjC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;aACvC,CAAC;QACN,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YAC7B,CAAC;YACD,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a user/agent supplied path to an absolute path. Relative paths
|
|
3
|
+
* are resolved against process.cwd() so agent-provided paths behave the same
|
|
4
|
+
* regardless of where the host process was started from.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolvePath(path: string): string;
|
|
7
|
+
/** Splits text into lines the same way across every fs tool (handles \r\n). */
|
|
8
|
+
export declare function toLines(content: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Slices an array of lines by offset/limit, clamping to bounds, and returns
|
|
11
|
+
* both the slice and the total line count so callers can page through large
|
|
12
|
+
* files without ever loading the whole thing into a response.
|
|
13
|
+
*/
|
|
14
|
+
export declare function paginateLines(lines: string[], offsetLine: number, limitLine: number): {
|
|
15
|
+
content: string;
|
|
16
|
+
totalLines: number;
|
|
17
|
+
startLine: number;
|
|
18
|
+
endLine: number;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;EAUnF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a user/agent supplied path to an absolute path. Relative paths
|
|
4
|
+
* are resolved against process.cwd() so agent-provided paths behave the same
|
|
5
|
+
* regardless of where the host process was started from.
|
|
6
|
+
*/
|
|
7
|
+
export function resolvePath(path) {
|
|
8
|
+
if (!path || typeof path !== "string") {
|
|
9
|
+
throw new Error("path must be a non-empty string");
|
|
10
|
+
}
|
|
11
|
+
return resolve(process.cwd(), path);
|
|
12
|
+
}
|
|
13
|
+
/** Splits text into lines the same way across every fs tool (handles \r\n). */
|
|
14
|
+
export function toLines(content) {
|
|
15
|
+
return content.split(/\r\n|\r|\n/);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Slices an array of lines by offset/limit, clamping to bounds, and returns
|
|
19
|
+
* both the slice and the total line count so callers can page through large
|
|
20
|
+
* files without ever loading the whole thing into a response.
|
|
21
|
+
*/
|
|
22
|
+
export function paginateLines(lines, offsetLine, limitLine) {
|
|
23
|
+
const totalLines = lines.length;
|
|
24
|
+
const start = Math.max(0, Math.min(offsetLine, totalLines));
|
|
25
|
+
const end = Math.max(start, Math.min(start + limitLine, totalLines));
|
|
26
|
+
return {
|
|
27
|
+
content: lines.slice(start, end).join("\n"),
|
|
28
|
+
totalLines,
|
|
29
|
+
startLine: start,
|
|
30
|
+
endLine: end,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/tools/fs/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACpC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAe,EAAE,UAAkB,EAAE,SAAiB;IAChF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACrE,OAAO;QACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3C,UAAU;QACV,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,GAAG;KACf,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import MCPTool from "../../core/mcp.js";
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
2
|
+
import { FsInteraction } from "./interaction.js";
|
|
3
|
+
export declare const FsWriteFileTool: () => MCPTool<FsInteraction>;
|
|
4
|
+
export default FsWriteFileTool;
|
|
4
5
|
//# sourceMappingURL=write-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,eAAe,8BAqD1B,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -1,68 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { writeFile, mkdir } from "fs/promises";
|
|
2
|
+
import { dirname } from "path";
|
|
3
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
4
|
+
import { FsInteraction } from "./interaction.js";
|
|
5
|
+
import { resolvePath } from "./utils.js";
|
|
6
|
+
export const FsWriteFileTool = () => new MCPTool({
|
|
7
|
+
name: "fs-write-file",
|
|
8
|
+
description: "write text content to a file, overwriting it if it already exists (or creating it, along with any missing parent directories, if it doesn't). USE WITH CAUTION: this permanently overwrites existing file content with no undo.",
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: "path",
|
|
9
12
|
type: "string",
|
|
10
|
-
description:
|
|
13
|
+
description: "absolute or cwd-relative path to the file",
|
|
11
14
|
required: true,
|
|
12
15
|
},
|
|
13
16
|
{
|
|
14
|
-
name: "
|
|
17
|
+
name: "content",
|
|
15
18
|
type: "string",
|
|
16
|
-
description: "
|
|
19
|
+
description: "full text content to write",
|
|
17
20
|
required: true,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
message: `File written: ${normalizedPath}`,
|
|
34
|
-
path: normalizedPath,
|
|
35
|
-
size: data.length
|
|
36
|
-
};
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "createDirs",
|
|
24
|
+
type: "boolean",
|
|
25
|
+
description: "create missing parent directories if needed",
|
|
26
|
+
required: false,
|
|
27
|
+
default: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
customClass: new FsInteraction(),
|
|
31
|
+
execute: async (_envID, inputs, _mcp, customClass) => {
|
|
32
|
+
const { path, content, createDirs = true } = inputs;
|
|
33
|
+
if (typeof content !== "string") {
|
|
34
|
+
throw new Error("content must be a string");
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (err.code === "EACCES") {
|
|
43
|
-
errorMessage = `Permission denied: Cannot write to ${inputs.filePath}`;
|
|
44
|
-
}
|
|
45
|
-
else if (err.code === "ENOENT") {
|
|
46
|
-
errorMessage = `Directory does not exist or cannot be created: ${path.dirname(inputs.filePath)}`;
|
|
47
|
-
}
|
|
48
|
-
else if (err.code === "EISDIR") {
|
|
49
|
-
errorMessage = `Path is a directory, cannot write file: ${inputs.filePath}`;
|
|
50
|
-
}
|
|
51
|
-
else if (err.code === "ENOSPC") {
|
|
52
|
-
errorMessage = `No space left on device: Cannot write to ${inputs.filePath}`;
|
|
53
|
-
}
|
|
54
|
-
else if (err.code === "EROFS") {
|
|
55
|
-
errorMessage = `Read-only file system: Cannot write to ${inputs.filePath}`;
|
|
56
|
-
}
|
|
57
|
-
else if (err.code === "ENAMETOOLONG") {
|
|
58
|
-
errorMessage = `File path is too long: ${inputs.filePath}`;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
error: errorMessage
|
|
63
|
-
};
|
|
36
|
+
const fullPath = resolvePath(path);
|
|
37
|
+
customClass?.emitFsEvent({ type: "writing", path: fullPath });
|
|
38
|
+
if (createDirs) {
|
|
39
|
+
await mkdir(dirname(fullPath), { recursive: true });
|
|
64
40
|
}
|
|
65
|
-
|
|
41
|
+
await writeFile(fullPath, content, { encoding: "utf-8" });
|
|
42
|
+
return {
|
|
43
|
+
message: "success",
|
|
44
|
+
bytesWritten: Buffer.byteLength(content, "utf-8"),
|
|
45
|
+
};
|
|
46
|
+
},
|
|
66
47
|
});
|
|
67
|
-
export default
|
|
48
|
+
export default FsWriteFileTool;
|
|
68
49
|
//# sourceMappingURL=write-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAgB;IAC5D,IAAI,EAAE,eAAe;IACrB,WAAW,EACP,iOAAiO;IACrO,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EA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../../src/tools/present/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,cAAc,mCA6DzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { copyFile, stat } from "fs/promises";
|
|
2
|
+
import { basename, join, resolve } from "path";
|
|
3
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
4
|
+
import { PresentInteraction } from "./interaction.js";
|
|
5
|
+
import { ensurePresentFolder, listPresentFiles } from "./utils.js";
|
|
6
|
+
export const PresentAddTool = () => new MCPTool({
|
|
7
|
+
name: "present-add",
|
|
8
|
+
description: "present a file to the user by copying it into the present folder so the host application can surface it (e.g. as a download link or preview). " +
|
|
9
|
+
"the path MUST point to a single file, never a directory/folder — if you want to present a whole folder, zip it first (e.g. with the bash/shell tool) and pass the path to the resulting .zip file instead. " +
|
|
10
|
+
"call this once per file you want to present; presenting multiple files just means calling present-add multiple times.",
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
name: "path",
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "absolute or cwd-relative path to the FILE to present (not a directory)",
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
customClass: new PresentInteraction(),
|
|
20
|
+
execute: async (_envID, inputs, _mcp, customClass) => {
|
|
21
|
+
const { path } = inputs;
|
|
22
|
+
if (!path || typeof path !== "string") {
|
|
23
|
+
throw new Error("path must be a non-empty string");
|
|
24
|
+
}
|
|
25
|
+
const sourcePath = resolve(process.cwd(), path);
|
|
26
|
+
let sourceStat;
|
|
27
|
+
try {
|
|
28
|
+
sourceStat = await stat(sourcePath);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (err.code === "ENOENT")
|
|
32
|
+
throw new Error(`no file found at "${path}"`);
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
if (sourceStat.isDirectory()) {
|
|
36
|
+
throw new Error(`"${path}" is a directory — presents must be files. zip the folder first and present the .zip file instead.`);
|
|
37
|
+
}
|
|
38
|
+
const presentFolder = await ensurePresentFolder();
|
|
39
|
+
const destPath = join(presentFolder, basename(sourcePath));
|
|
40
|
+
// Copy via Node's fs API only — never shell out for this, so the
|
|
41
|
+
// present folder's contents are always exactly what was requested.
|
|
42
|
+
await copyFile(sourcePath, destPath);
|
|
43
|
+
const paths = await listPresentFiles();
|
|
44
|
+
// Emitted AFTER the copy completes, so anything listening always
|
|
45
|
+
// sees an up-to-date present folder the moment it's notified.
|
|
46
|
+
customClass?.emitPresentEvent({ type: "presents-updated", paths });
|
|
47
|
+
return {
|
|
48
|
+
message: "success",
|
|
49
|
+
path: destPath,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export default PresentAddTool;
|
|
54
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/tools/present/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAqB;IAChE,IAAI,EAAE,aAAa;IACnB,WAAW,EACP,gJAAgJ;QAChJ,6MAA6M;QAC7M,uHAAuH;IAC3H,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,M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BAAkB,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnE,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,QAAQ;SACjB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../src/tools/present/clear.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,mCAwB3B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { rm } from "fs/promises";
|
|
2
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
3
|
+
import { PresentInteraction } from "./interaction.js";
|
|
4
|
+
import { listPresentFiles } from "./utils.js";
|
|
5
|
+
export const PresentClearTool = () => new MCPTool({
|
|
6
|
+
name: "present-clear",
|
|
7
|
+
description: "remove every file currently presented to the user, emptying the present folder. use this to clear out stale presents before presenting a fresh set.",
|
|
8
|
+
inputs: [],
|
|
9
|
+
customClass: new PresentInteraction(),
|
|
10
|
+
execute: async (_envID, _inputs, _mcp, customClass) => {
|
|
11
|
+
const existing = await listPresentFiles();
|
|
12
|
+
await Promise.all(existing.map((path) => rm(path, { force: true })));
|
|
13
|
+
// Present folder is now empty; still emit so listeners can
|
|
14
|
+
// immediately reflect that nothing is presented anymore.
|
|
15
|
+
customClass?.emitPresentEvent({ type: "presents-updated", paths: [] });
|
|
16
|
+
return {
|
|
17
|
+
message: "success",
|
|
18
|
+
removed: existing.length,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export default PresentClearTool;
|
|
23
|
+
//# sourceMappingURL=clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../src/tools/present/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAqB;IAClE,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,qJAAqJ;IAClK,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,IAAI,kBAAkB,EAAE;IACrC,OAAO,EAAE,KAAK,EACV,MAAc,EACd,OAA4B,EAC5B,IAAU,EACV,WAAgC,EACpB,EAAE;QACd,MAAM,QAAQ,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAE1C,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAErE,2DAA2D;QAC3D,yDAAyD;QACzD,WAAW,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAEvE,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,QAAQ,CAAC,MAAM;SAC3B,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list.d.ts","sourceRoot":"","sources":["../../../src/tools/present/get-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,kBAAkB,mCAqB7B,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { basename } from "path";
|
|
2
|
+
import { MCPTool } from "../../core/mcp.js";
|
|
3
|
+
import { PresentInteraction } from "./interaction.js";
|
|
4
|
+
import { listPresentFiles, fileSize } from "./utils.js";
|
|
5
|
+
export const PresentGetListTool = () => new MCPTool({
|
|
6
|
+
name: "present-get-list",
|
|
7
|
+
description: "get the list of files currently presented to the user (their paths inside the present folder)",
|
|
8
|
+
inputs: [],
|
|
9
|
+
customClass: new PresentInteraction(),
|
|
10
|
+
execute: async () => {
|
|
11
|
+
const paths = await listPresentFiles();
|
|
12
|
+
const files = await Promise.all(paths.map(async (path) => ({
|
|
13
|
+
name: basename(path),
|
|
14
|
+
path,
|
|
15
|
+
size: await fileSize(path),
|
|
16
|
+
})));
|
|
17
|
+
return {
|
|
18
|
+
files,
|
|
19
|
+
total: files.length,
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export default PresentGetListTool;
|
|
24
|
+
//# sourceMappingURL=get-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list.js","sourceRoot":"","sources":["../../../src/tools/present/get-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAqB;IACpE,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,+FAA+F;IAC5G,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,IAAI,kBAAkB,EAAE;IACrC,OAAO,EAAE,KAAK,IAAkB,EAAE;QAC9B,MAAM,KAAK,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAEvC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC3B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;YACpB,IAAI;YACJ,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC;SAC7B,CAAC,CAAC,CACN,CAAC;QAEF,OAAO;YACH,KAAK;YACL,KAAK,EAAE,KAAK,CAAC,MAAM;SACtB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { PresentAddTool } from "./add.js";
|
|
2
|
+
export { PresentClearTool } from "./clear.js";
|
|
3
|
+
export { PresentGetListTool } from "./get-list.js";
|
|
4
|
+
export { PresentInteraction } from "./interaction.js";
|
|
5
|
+
export type { PresentEvent } from "./interaction.js";
|
|
6
|
+
export { getPresentFolder } from "./utils.js";
|
|
7
|
+
export declare const PresentTools: () => import("../../index.js").MCPTool<import("./interaction.js").PresentInteraction>[];
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|