@dexto/core 1.1.11 → 1.2.1
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 +24 -4
- package/dist/Dexto.cjs +4 -14
- package/dist/Dexto.d.ts +8 -29
- package/dist/Dexto.d.ts.map +1 -1
- package/dist/Dexto.js +4 -12
- package/dist/agent/DextoAgent.cjs +92 -3
- package/dist/agent/DextoAgent.d.ts +12 -4
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +52 -3
- package/dist/agent/agentCard.js +1 -0
- package/dist/agent/error-codes.cjs +1 -0
- package/dist/agent/error-codes.d.ts +1 -0
- package/dist/agent/error-codes.d.ts.map +1 -1
- package/dist/agent/error-codes.js +2 -0
- package/dist/agent/errors.cjs +13 -0
- package/dist/agent/errors.d.ts +4 -0
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/errors.js +14 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/registry/error-codes.js +1 -0
- package/dist/agent/registry/errors.js +1 -0
- package/dist/agent/registry/registry.js +1 -0
- package/dist/agent/registry/types.js +1 -0
- package/dist/agent/registry/user-registry.js +1 -0
- package/dist/agent/schemas.cjs +6 -1
- package/dist/agent/schemas.d.ts +113 -3
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +7 -1
- package/dist/agent/state-manager.js +1 -0
- package/dist/approval/error-codes.js +1 -0
- package/dist/approval/errors.js +1 -0
- package/dist/approval/index.js +1 -0
- package/dist/approval/manager.cjs +30 -0
- package/dist/approval/manager.d.ts +23 -1
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +31 -0
- package/dist/approval/providers/event-based-approval-provider.js +1 -0
- package/dist/approval/providers/factory.js +1 -0
- package/dist/approval/providers/noop-approval-provider.js +1 -0
- package/dist/approval/schemas.cjs +36 -0
- package/dist/approval/schemas.d.ts +173 -0
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +33 -0
- package/dist/approval/types.cjs +1 -0
- package/dist/approval/types.d.ts +27 -1
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +2 -0
- package/dist/chunk-C6A6W6XS.js +53 -0
- package/dist/config/agent-resolver.js +1 -0
- package/dist/config/error-codes.js +1 -0
- package/dist/config/errors.js +1 -0
- package/dist/config/loader.js +1 -0
- package/dist/config/writer.js +1 -0
- package/dist/context/compression/middle-removal.js +1 -0
- package/dist/context/compression/oldest-removal.js +1 -0
- package/dist/context/error-codes.js +1 -0
- package/dist/context/errors.js +1 -0
- package/dist/context/index.js +1 -0
- package/dist/context/manager.cjs +36 -1
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +27 -1
- package/dist/context/media-helpers.js +1 -0
- package/dist/context/utils.cjs +102 -6
- package/dist/context/utils.d.ts +35 -2
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +100 -6
- package/dist/errors/DextoBaseError.js +1 -0
- package/dist/errors/DextoRuntimeError.js +1 -0
- package/dist/errors/DextoValidationError.js +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/result-bridge.js +1 -0
- package/dist/errors/types.cjs +3 -0
- package/dist/errors/types.d.ts +7 -2
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +4 -0
- package/dist/events/index.cjs +1 -0
- package/dist/events/index.d.ts +6 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +2 -0
- package/dist/filesystem/error-codes.cjs +53 -0
- package/dist/filesystem/error-codes.d.ts +31 -0
- package/dist/filesystem/error-codes.d.ts.map +1 -0
- package/dist/filesystem/error-codes.js +30 -0
- package/dist/filesystem/errors.cjs +303 -0
- package/dist/filesystem/errors.d.ts +109 -0
- package/dist/filesystem/errors.d.ts.map +1 -0
- package/dist/filesystem/errors.js +280 -0
- package/dist/filesystem/filesystem-service.cjs +482 -0
- package/dist/filesystem/filesystem-service.d.ts +57 -0
- package/dist/filesystem/filesystem-service.d.ts.map +1 -0
- package/dist/filesystem/filesystem-service.js +449 -0
- package/dist/filesystem/index.cjs +37 -0
- package/dist/filesystem/index.d.ts +11 -0
- package/dist/filesystem/index.d.ts.map +1 -0
- package/dist/filesystem/index.js +11 -0
- package/dist/filesystem/path-validator.cjs +172 -0
- package/dist/filesystem/path-validator.d.ts +53 -0
- package/dist/filesystem/path-validator.d.ts.map +1 -0
- package/dist/filesystem/path-validator.js +139 -0
- package/dist/filesystem/types.cjs +16 -0
- package/dist/filesystem/types.d.ts +171 -0
- package/dist/filesystem/types.d.ts.map +1 -0
- package/dist/filesystem/types.js +0 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/llm/error-codes.js +1 -0
- package/dist/llm/errors.js +1 -0
- package/dist/llm/formatters/anthropic.js +1 -0
- package/dist/llm/formatters/factory.js +1 -0
- package/dist/llm/formatters/openai.js +1 -0
- package/dist/llm/formatters/vercel.js +1 -0
- package/dist/llm/registry.cjs +15 -15
- package/dist/llm/registry.d.ts +1 -1
- package/dist/llm/registry.js +16 -15
- package/dist/llm/resolver.js +1 -0
- package/dist/llm/schemas.cjs +6 -2
- package/dist/llm/schemas.d.ts +10 -0
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +7 -2
- package/dist/llm/services/anthropic.cjs +67 -0
- package/dist/llm/services/anthropic.d.ts +6 -0
- package/dist/llm/services/anthropic.d.ts.map +1 -1
- package/dist/llm/services/anthropic.js +27 -0
- package/dist/llm/services/factory.js +1 -0
- package/dist/llm/services/openai.cjs +87 -0
- package/dist/llm/services/openai.d.ts +6 -0
- package/dist/llm/services/openai.d.ts.map +1 -1
- package/dist/llm/services/openai.js +47 -0
- package/dist/llm/services/test-utils.integration.cjs +1 -1
- package/dist/llm/services/test-utils.integration.js +2 -1
- package/dist/llm/services/vercel.cjs +144 -97
- package/dist/llm/services/vercel.d.ts +6 -1
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +105 -98
- package/dist/llm/tokenizer/anthropic.js +1 -0
- package/dist/llm/tokenizer/default.js +1 -0
- package/dist/llm/tokenizer/factory.js +1 -0
- package/dist/llm/tokenizer/google.js +1 -0
- package/dist/llm/tokenizer/openai.cjs +1 -1
- package/dist/llm/tokenizer/openai.d.ts +1 -1
- package/dist/llm/tokenizer/openai.js +2 -1
- package/dist/llm/tokenizer/types.js +1 -0
- package/dist/llm/types.d.ts +2 -2
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -0
- package/dist/llm/validation.js +1 -0
- package/dist/logger/browser.js +1 -0
- package/dist/logger/logger.d.ts +42 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +1 -0
- package/dist/mcp/error-codes.cjs +1 -0
- package/dist/mcp/error-codes.d.ts +1 -0
- package/dist/mcp/error-codes.d.ts.map +1 -1
- package/dist/mcp/error-codes.js +2 -0
- package/dist/mcp/errors.cjs +12 -0
- package/dist/mcp/errors.d.ts +7 -0
- package/dist/mcp/errors.d.ts.map +1 -1
- package/dist/mcp/errors.js +13 -0
- package/dist/mcp/manager.cjs +66 -16
- package/dist/mcp/manager.d.ts +7 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +67 -16
- package/dist/mcp/mcp-client.js +1 -0
- package/dist/mcp/resolver.js +1 -0
- package/dist/mcp/schemas.js +1 -0
- package/dist/mcp/types.d.ts +1 -1
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/error-codes.js +1 -0
- package/dist/memory/errors.js +1 -0
- package/dist/memory/index.js +1 -0
- package/dist/memory/manager.js +1 -0
- package/dist/memory/schemas.js +1 -0
- package/dist/plugins/builtins/content-policy.js +1 -0
- package/dist/plugins/builtins/response-sanitizer.js +1 -0
- package/dist/plugins/error-codes.js +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/loader.js +1 -0
- package/dist/plugins/manager.js +1 -0
- package/dist/plugins/registrations/builtins.js +1 -0
- package/dist/plugins/schemas.js +1 -0
- package/dist/preferences/constants.js +1 -0
- package/dist/preferences/error-codes.js +1 -0
- package/dist/preferences/errors.js +1 -0
- package/dist/preferences/index.js +1 -0
- package/dist/preferences/loader.cjs +3 -1
- package/dist/preferences/loader.d.ts +10 -1
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +4 -1
- package/dist/preferences/schemas.cjs +2 -1
- package/dist/preferences/schemas.d.ts +8 -0
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +3 -1
- package/dist/process/command-validator.cjs +544 -0
- package/dist/process/command-validator.d.ts +46 -0
- package/dist/process/command-validator.d.ts.map +1 -0
- package/dist/process/command-validator.js +521 -0
- package/dist/process/error-codes.cjs +47 -0
- package/dist/process/error-codes.d.ts +25 -0
- package/dist/process/error-codes.d.ts.map +1 -0
- package/dist/process/error-codes.js +24 -0
- package/dist/process/errors.cjs +244 -0
- package/dist/process/errors.d.ts +87 -0
- package/dist/process/errors.d.ts.map +1 -0
- package/dist/process/errors.js +221 -0
- package/dist/process/index.cjs +37 -0
- package/dist/process/index.d.ts +11 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +11 -0
- package/dist/process/process-service.cjs +443 -0
- package/dist/process/process-service.d.ts +62 -0
- package/dist/process/process-service.d.ts.map +1 -0
- package/dist/process/process-service.js +410 -0
- package/dist/process/types.cjs +16 -0
- package/dist/process/types.d.ts +107 -0
- package/dist/process/types.d.ts.map +1 -0
- package/dist/process/types.js +0 -0
- package/dist/prompts/error-codes.js +1 -0
- package/dist/prompts/errors.js +1 -0
- package/dist/prompts/index.js +1 -0
- package/dist/prompts/name-validation.js +1 -0
- package/dist/prompts/prompt-manager.js +1 -0
- package/dist/prompts/providers/custom-prompt-provider.js +1 -0
- package/dist/prompts/providers/file-prompt-provider.js +1 -0
- package/dist/prompts/providers/mcp-prompt-provider.js +1 -0
- package/dist/prompts/providers/starter-prompt-provider.js +1 -0
- package/dist/prompts/schemas.js +1 -0
- package/dist/prompts/utils.js +1 -0
- package/dist/resources/error-codes.js +1 -0
- package/dist/resources/errors.js +1 -0
- package/dist/resources/handlers/blob-handler.js +1 -0
- package/dist/resources/handlers/factory.js +1 -0
- package/dist/resources/handlers/filesystem-handler.cjs +1 -1
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +2 -1
- package/dist/resources/index.js +1 -0
- package/dist/resources/internal-provider.js +1 -0
- package/dist/resources/manager.js +1 -0
- package/dist/resources/reference-parser.js +1 -0
- package/dist/resources/schemas.js +1 -0
- package/dist/search/index.js +1 -0
- package/dist/search/search-service.js +1 -0
- package/dist/session/chat-session.cjs +2 -2
- package/dist/session/chat-session.d.ts +2 -2
- package/dist/session/chat-session.js +3 -2
- package/dist/session/error-codes.js +1 -0
- package/dist/session/errors.js +1 -0
- package/dist/session/history/database.js +1 -0
- package/dist/session/history/factory.js +1 -0
- package/dist/session/history/memory.js +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/schemas.js +1 -0
- package/dist/session/session-manager.d.ts +6 -0
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +1 -0
- package/dist/session/title-generator.js +1 -0
- package/dist/storage/blob/factory.cjs +3 -3
- package/dist/storage/blob/factory.d.ts +3 -1
- package/dist/storage/blob/factory.d.ts.map +1 -1
- package/dist/storage/blob/factory.js +4 -3
- package/dist/storage/blob/local-blob-store.cjs +18 -2
- package/dist/storage/blob/local-blob-store.d.ts +2 -1
- package/dist/storage/blob/local-blob-store.d.ts.map +1 -1
- package/dist/storage/blob/local-blob-store.js +19 -2
- package/dist/storage/blob/schemas.js +1 -0
- package/dist/storage/cache/factory.js +1 -0
- package/dist/storage/cache/memory-cache-store.js +1 -0
- package/dist/storage/cache/redis-store.js +1 -0
- package/dist/storage/cache/schemas.js +1 -0
- package/dist/storage/database/factory.cjs +7 -5
- package/dist/storage/database/factory.d.ts +3 -1
- package/dist/storage/database/factory.d.ts.map +1 -1
- package/dist/storage/database/factory.js +8 -5
- package/dist/storage/database/memory-database-store.js +1 -0
- package/dist/storage/database/postgres-store.js +1 -0
- package/dist/storage/database/schemas.cjs +1 -1
- package/dist/storage/database/schemas.js +2 -1
- package/dist/storage/database/sqlite-store.cjs +20 -2
- package/dist/storage/database/sqlite-store.d.ts +2 -1
- package/dist/storage/database/sqlite-store.d.ts.map +1 -1
- package/dist/storage/database/sqlite-store.js +21 -2
- package/dist/storage/error-codes.cjs +1 -0
- package/dist/storage/error-codes.d.ts +1 -0
- package/dist/storage/error-codes.d.ts.map +1 -1
- package/dist/storage/error-codes.js +2 -0
- package/dist/storage/errors.cjs +15 -0
- package/dist/storage/errors.d.ts +4 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +16 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/schemas.js +1 -0
- package/dist/storage/storage-manager.cjs +7 -5
- package/dist/storage/storage-manager.d.ts +5 -2
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +8 -5
- package/dist/systemPrompt/contributors.js +1 -0
- package/dist/systemPrompt/error-codes.js +1 -0
- package/dist/systemPrompt/errors.js +1 -0
- package/dist/systemPrompt/in-built-prompts.js +1 -0
- package/dist/systemPrompt/index.js +1 -0
- package/dist/systemPrompt/manager.js +1 -0
- package/dist/systemPrompt/registry.js +1 -0
- package/dist/systemPrompt/schemas.js +1 -0
- package/dist/telemetry/decorators.cjs +175 -0
- package/dist/telemetry/decorators.d.ts +17 -0
- package/dist/telemetry/decorators.d.ts.map +1 -0
- package/dist/telemetry/decorators.js +157 -0
- package/dist/telemetry/exporters.cjs +108 -0
- package/dist/telemetry/exporters.d.ts +29 -0
- package/dist/telemetry/exporters.d.ts.map +1 -0
- package/dist/telemetry/exporters.js +85 -0
- package/dist/telemetry/index.cjs +28 -0
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/schemas.cjs +71 -0
- package/dist/telemetry/schemas.d.ts +54 -0
- package/dist/telemetry/schemas.d.ts.map +1 -0
- package/dist/telemetry/schemas.js +48 -0
- package/dist/telemetry/telemetry.cjs +228 -0
- package/dist/telemetry/telemetry.d.ts +74 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -0
- package/dist/telemetry/telemetry.js +205 -0
- package/dist/telemetry/types.cjs +16 -0
- package/dist/telemetry/types.d.ts +22 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +0 -0
- package/dist/telemetry/utils.cjs +87 -0
- package/dist/telemetry/utils.d.ts +21 -0
- package/dist/telemetry/utils.d.ts.map +1 -0
- package/dist/telemetry/utils.js +62 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.js +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.js +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/storage.js +1 -0
- package/dist/tools/error-codes.js +1 -0
- package/dist/tools/errors.js +1 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/internal-tools/constants.cjs +39 -0
- package/dist/tools/internal-tools/constants.d.ts +12 -0
- package/dist/tools/internal-tools/constants.d.ts.map +1 -0
- package/dist/tools/internal-tools/constants.js +16 -0
- package/dist/tools/internal-tools/implementations/ask-user-tool.js +1 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.cjs +106 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts +13 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.js +73 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.cjs +49 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.js +26 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.cjs +62 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.js +39 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.cjs +57 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.js +34 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.cjs +71 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.js +48 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.cjs +47 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.js +24 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.cjs +55 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.js +32 -0
- package/dist/tools/internal-tools/implementations/search-history-tool.js +1 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.cjs +56 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.js +33 -0
- package/dist/tools/internal-tools/index.cjs +3 -1
- package/dist/tools/internal-tools/index.d.ts +1 -0
- package/dist/tools/internal-tools/index.d.ts.map +1 -1
- package/dist/tools/internal-tools/index.js +1 -0
- package/dist/tools/internal-tools/provider.js +1 -0
- package/dist/tools/internal-tools/registry.cjs +40 -4
- package/dist/tools/internal-tools/registry.d.ts +5 -9
- package/dist/tools/internal-tools/registry.d.ts.map +1 -1
- package/dist/tools/internal-tools/registry.js +41 -3
- package/dist/tools/schemas.cjs +18 -5
- package/dist/tools/schemas.d.ts +30 -1
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +15 -2
- package/dist/tools/tool-manager.cjs +158 -19
- package/dist/tools/tool-manager.d.ts +48 -2
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +118 -19
- package/dist/utils/api-key-resolver.js +1 -0
- package/dist/utils/api-key-store.js +1 -0
- package/dist/utils/async-context.js +1 -0
- package/dist/utils/debug.js +1 -0
- package/dist/utils/env.js +1 -0
- package/dist/utils/error-conversion.js +1 -0
- package/dist/utils/execution-context.js +1 -0
- package/dist/utils/fs-walk.js +1 -0
- package/dist/utils/path.js +1 -0
- package/dist/utils/port-utils.js +1 -0
- package/dist/utils/redactor.js +1 -0
- package/dist/utils/result.js +1 -0
- package/dist/utils/safe-stringify.js +1 -0
- package/dist/utils/schema-metadata.js +1 -0
- package/dist/utils/schema.js +1 -0
- package/dist/utils/service-initializer.cjs +42 -4
- package/dist/utils/service-initializer.d.ts +2 -1
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +33 -4
- package/dist/utils/user-info.js +1 -0
- package/dist/utils/zod-schema-converter.js +1 -0
- package/package.json +11 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var bash_exec_tool_exports = {};
|
|
30
|
+
__export(bash_exec_tool_exports, {
|
|
31
|
+
createBashExecTool: () => createBashExecTool
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(bash_exec_tool_exports);
|
|
34
|
+
var path = __toESM(require("node:path"), 1);
|
|
35
|
+
var import_zod = require("zod");
|
|
36
|
+
var import_types2 = require("../../../approval/types.js");
|
|
37
|
+
var import_errors = require("../../../process/errors.js");
|
|
38
|
+
const BashExecInputSchema = import_zod.z.object({
|
|
39
|
+
command: import_zod.z.string().describe("Shell command to execute"),
|
|
40
|
+
description: import_zod.z.string().optional().describe("Human-readable description of what the command does (5-10 words)"),
|
|
41
|
+
timeout: import_zod.z.number().int().positive().max(6e5).optional().default(12e4).describe(
|
|
42
|
+
"Timeout in milliseconds (max: 600000 = 10 minutes, default: 120000 = 2 minutes)"
|
|
43
|
+
),
|
|
44
|
+
run_in_background: import_zod.z.boolean().optional().default(false).describe("Execute command in background (default: false)"),
|
|
45
|
+
cwd: import_zod.z.string().optional().describe("Working directory for command execution (optional)")
|
|
46
|
+
}).strict();
|
|
47
|
+
function createBashExecTool(processService, approvalManager) {
|
|
48
|
+
return {
|
|
49
|
+
id: "bash_exec",
|
|
50
|
+
description: "Execute a shell command. Returns stdout, stderr, exit code, and duration. Use run_in_background=true for long-running commands (use bash_output to retrieve results later). Requires approval for all commands. Dangerous commands (rm, git push, etc.) require additional per-command approval. Always quote file paths with spaces. Set timeout to prevent hanging commands. Security: dangerous commands are blocked, injection attempts are detected.",
|
|
51
|
+
inputSchema: BashExecInputSchema,
|
|
52
|
+
execute: async (input, context) => {
|
|
53
|
+
const { command, description, timeout, run_in_background, cwd } = input;
|
|
54
|
+
let validatedCwd = cwd;
|
|
55
|
+
if (cwd) {
|
|
56
|
+
const baseDir = processService.getConfig().workingDirectory || process.cwd();
|
|
57
|
+
const candidatePath = path.isAbsolute(cwd) ? path.resolve(cwd) : path.resolve(baseDir, cwd);
|
|
58
|
+
const relativePath = path.relative(baseDir, candidatePath);
|
|
59
|
+
const isOutsideBase = relativePath.startsWith("..") || path.isAbsolute(relativePath);
|
|
60
|
+
if (isOutsideBase) {
|
|
61
|
+
throw import_errors.ProcessError.invalidWorkingDirectory(
|
|
62
|
+
cwd,
|
|
63
|
+
`Working directory must be within ${baseDir}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
validatedCwd = candidatePath;
|
|
67
|
+
}
|
|
68
|
+
const result = await processService.executeCommand(command, {
|
|
69
|
+
description,
|
|
70
|
+
timeout,
|
|
71
|
+
runInBackground: run_in_background,
|
|
72
|
+
cwd: validatedCwd,
|
|
73
|
+
// Provide approval function for dangerous commands
|
|
74
|
+
approvalFunction: async (normalizedCommand) => {
|
|
75
|
+
const metadata = {
|
|
76
|
+
toolName: "bash_exec",
|
|
77
|
+
command: normalizedCommand,
|
|
78
|
+
originalCommand: command
|
|
79
|
+
};
|
|
80
|
+
if (context?.sessionId) {
|
|
81
|
+
metadata.sessionId = context.sessionId;
|
|
82
|
+
}
|
|
83
|
+
const response = await approvalManager.requestCommandConfirmation(metadata);
|
|
84
|
+
return response.status === import_types2.ApprovalStatus.APPROVED;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if ("stdout" in result) {
|
|
88
|
+
return {
|
|
89
|
+
stdout: result.stdout,
|
|
90
|
+
stderr: result.stderr,
|
|
91
|
+
exit_code: result.exitCode,
|
|
92
|
+
duration: result.duration
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
return {
|
|
96
|
+
process_id: result.processId,
|
|
97
|
+
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output.`
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
createBashExecTool
|
|
106
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bash Execute Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for executing shell commands (requires approval)
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { ProcessService } from '../../../process/index.js';
|
|
8
|
+
import type { ApprovalManager } from '../../../approval/manager.js';
|
|
9
|
+
/**
|
|
10
|
+
* Create the bash_exec internal tool
|
|
11
|
+
*/
|
|
12
|
+
export declare function createBashExecTool(processService: ProcessService, approvalManager: ApprovalManager): InternalTool;
|
|
13
|
+
//# sourceMappingURL=bash-exec-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash-exec-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/bash-exec-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAgCpE;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,GACjC,YAAY,CAoFd"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { ApprovalStatus } from "../../../approval/types.js";
|
|
5
|
+
import { ProcessError } from "../../../process/errors.js";
|
|
6
|
+
const BashExecInputSchema = z.object({
|
|
7
|
+
command: z.string().describe("Shell command to execute"),
|
|
8
|
+
description: z.string().optional().describe("Human-readable description of what the command does (5-10 words)"),
|
|
9
|
+
timeout: z.number().int().positive().max(6e5).optional().default(12e4).describe(
|
|
10
|
+
"Timeout in milliseconds (max: 600000 = 10 minutes, default: 120000 = 2 minutes)"
|
|
11
|
+
),
|
|
12
|
+
run_in_background: z.boolean().optional().default(false).describe("Execute command in background (default: false)"),
|
|
13
|
+
cwd: z.string().optional().describe("Working directory for command execution (optional)")
|
|
14
|
+
}).strict();
|
|
15
|
+
function createBashExecTool(processService, approvalManager) {
|
|
16
|
+
return {
|
|
17
|
+
id: "bash_exec",
|
|
18
|
+
description: "Execute a shell command. Returns stdout, stderr, exit code, and duration. Use run_in_background=true for long-running commands (use bash_output to retrieve results later). Requires approval for all commands. Dangerous commands (rm, git push, etc.) require additional per-command approval. Always quote file paths with spaces. Set timeout to prevent hanging commands. Security: dangerous commands are blocked, injection attempts are detected.",
|
|
19
|
+
inputSchema: BashExecInputSchema,
|
|
20
|
+
execute: async (input, context) => {
|
|
21
|
+
const { command, description, timeout, run_in_background, cwd } = input;
|
|
22
|
+
let validatedCwd = cwd;
|
|
23
|
+
if (cwd) {
|
|
24
|
+
const baseDir = processService.getConfig().workingDirectory || process.cwd();
|
|
25
|
+
const candidatePath = path.isAbsolute(cwd) ? path.resolve(cwd) : path.resolve(baseDir, cwd);
|
|
26
|
+
const relativePath = path.relative(baseDir, candidatePath);
|
|
27
|
+
const isOutsideBase = relativePath.startsWith("..") || path.isAbsolute(relativePath);
|
|
28
|
+
if (isOutsideBase) {
|
|
29
|
+
throw ProcessError.invalidWorkingDirectory(
|
|
30
|
+
cwd,
|
|
31
|
+
`Working directory must be within ${baseDir}`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
validatedCwd = candidatePath;
|
|
35
|
+
}
|
|
36
|
+
const result = await processService.executeCommand(command, {
|
|
37
|
+
description,
|
|
38
|
+
timeout,
|
|
39
|
+
runInBackground: run_in_background,
|
|
40
|
+
cwd: validatedCwd,
|
|
41
|
+
// Provide approval function for dangerous commands
|
|
42
|
+
approvalFunction: async (normalizedCommand) => {
|
|
43
|
+
const metadata = {
|
|
44
|
+
toolName: "bash_exec",
|
|
45
|
+
command: normalizedCommand,
|
|
46
|
+
originalCommand: command
|
|
47
|
+
};
|
|
48
|
+
if (context?.sessionId) {
|
|
49
|
+
metadata.sessionId = context.sessionId;
|
|
50
|
+
}
|
|
51
|
+
const response = await approvalManager.requestCommandConfirmation(metadata);
|
|
52
|
+
return response.status === ApprovalStatus.APPROVED;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
if ("stdout" in result) {
|
|
56
|
+
return {
|
|
57
|
+
stdout: result.stdout,
|
|
58
|
+
stderr: result.stderr,
|
|
59
|
+
exit_code: result.exitCode,
|
|
60
|
+
duration: result.duration
|
|
61
|
+
};
|
|
62
|
+
} else {
|
|
63
|
+
return {
|
|
64
|
+
process_id: result.processId,
|
|
65
|
+
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output.`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
createBashExecTool
|
|
73
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var bash_output_tool_exports = {};
|
|
20
|
+
__export(bash_output_tool_exports, {
|
|
21
|
+
createBashOutputTool: () => createBashOutputTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(bash_output_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const BashOutputInputSchema = import_zod.z.object({
|
|
26
|
+
process_id: import_zod.z.string().describe("Process ID from bash_exec (when run_in_background=true)")
|
|
27
|
+
}).strict();
|
|
28
|
+
function createBashOutputTool(processService) {
|
|
29
|
+
return {
|
|
30
|
+
id: "bash_output",
|
|
31
|
+
description: "Retrieve output from a background process started with bash_exec. Returns stdout, stderr, status (running/completed/failed), exit code, and duration. Each call returns only new output since last read. The output buffer is cleared after reading. Use this tool to monitor long-running commands.",
|
|
32
|
+
inputSchema: BashOutputInputSchema,
|
|
33
|
+
execute: async (input, _context) => {
|
|
34
|
+
const { process_id } = input;
|
|
35
|
+
const result = await processService.getProcessOutput(process_id);
|
|
36
|
+
return {
|
|
37
|
+
stdout: result.stdout,
|
|
38
|
+
stderr: result.stderr,
|
|
39
|
+
status: result.status,
|
|
40
|
+
...result.exitCode !== void 0 && { exit_code: result.exitCode },
|
|
41
|
+
...result.duration !== void 0 && { duration: result.duration }
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
createBashOutputTool
|
|
49
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bash Output Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for retrieving output from background processes
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { ProcessService } from '../../../process/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the bash_output internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createBashOutputTool(processService: ProcessService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=bash-output-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash-output-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/bash-output-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,cAAc,GAAG,YAAY,CAsBjF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const BashOutputInputSchema = z.object({
|
|
4
|
+
process_id: z.string().describe("Process ID from bash_exec (when run_in_background=true)")
|
|
5
|
+
}).strict();
|
|
6
|
+
function createBashOutputTool(processService) {
|
|
7
|
+
return {
|
|
8
|
+
id: "bash_output",
|
|
9
|
+
description: "Retrieve output from a background process started with bash_exec. Returns stdout, stderr, status (running/completed/failed), exit code, and duration. Each call returns only new output since last read. The output buffer is cleared after reading. Use this tool to monitor long-running commands.",
|
|
10
|
+
inputSchema: BashOutputInputSchema,
|
|
11
|
+
execute: async (input, _context) => {
|
|
12
|
+
const { process_id } = input;
|
|
13
|
+
const result = await processService.getProcessOutput(process_id);
|
|
14
|
+
return {
|
|
15
|
+
stdout: result.stdout,
|
|
16
|
+
stderr: result.stderr,
|
|
17
|
+
status: result.status,
|
|
18
|
+
...result.exitCode !== void 0 && { exit_code: result.exitCode },
|
|
19
|
+
...result.duration !== void 0 && { duration: result.duration }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
createBashOutputTool
|
|
26
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var edit_file_tool_exports = {};
|
|
20
|
+
__export(edit_file_tool_exports, {
|
|
21
|
+
createEditFileTool: () => createEditFileTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(edit_file_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const EditFileInputSchema = import_zod.z.object({
|
|
26
|
+
file_path: import_zod.z.string().describe("Absolute path to the file to edit"),
|
|
27
|
+
old_string: import_zod.z.string().describe("Text to replace (must be unique unless replace_all is true)"),
|
|
28
|
+
new_string: import_zod.z.string().describe("Replacement text"),
|
|
29
|
+
replace_all: import_zod.z.boolean().optional().default(false).describe("Replace all occurrences (default: false, requires unique match)")
|
|
30
|
+
}).strict();
|
|
31
|
+
function createEditFileTool(fileSystemService) {
|
|
32
|
+
return {
|
|
33
|
+
id: "edit_file",
|
|
34
|
+
description: "Edit a file by replacing text. By default, old_string must be unique in the file (will error if found multiple times). Set replace_all=true to replace all occurrences. Automatically creates backup before editing. Requires approval. Returns success status, path, number of changes made, and backup path.",
|
|
35
|
+
inputSchema: EditFileInputSchema,
|
|
36
|
+
execute: async (input, _context) => {
|
|
37
|
+
const { file_path, old_string, new_string, replace_all } = input;
|
|
38
|
+
const result = await fileSystemService.editFile(
|
|
39
|
+
file_path,
|
|
40
|
+
{
|
|
41
|
+
oldString: old_string,
|
|
42
|
+
newString: new_string,
|
|
43
|
+
replaceAll: replace_all
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
backup: true
|
|
47
|
+
// Always create backup for internal tools
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
return {
|
|
51
|
+
success: result.success,
|
|
52
|
+
path: result.path,
|
|
53
|
+
changes_count: result.changesCount,
|
|
54
|
+
...result.backupPath && { backup_path: result.backupPath }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
createEditFileTool
|
|
62
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edit File Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for editing files by replacing text (requires approval)
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the edit_file internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createEditFileTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=edit-file-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/edit-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAmBjE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CA+BrF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const EditFileInputSchema = z.object({
|
|
4
|
+
file_path: z.string().describe("Absolute path to the file to edit"),
|
|
5
|
+
old_string: z.string().describe("Text to replace (must be unique unless replace_all is true)"),
|
|
6
|
+
new_string: z.string().describe("Replacement text"),
|
|
7
|
+
replace_all: z.boolean().optional().default(false).describe("Replace all occurrences (default: false, requires unique match)")
|
|
8
|
+
}).strict();
|
|
9
|
+
function createEditFileTool(fileSystemService) {
|
|
10
|
+
return {
|
|
11
|
+
id: "edit_file",
|
|
12
|
+
description: "Edit a file by replacing text. By default, old_string must be unique in the file (will error if found multiple times). Set replace_all=true to replace all occurrences. Automatically creates backup before editing. Requires approval. Returns success status, path, number of changes made, and backup path.",
|
|
13
|
+
inputSchema: EditFileInputSchema,
|
|
14
|
+
execute: async (input, _context) => {
|
|
15
|
+
const { file_path, old_string, new_string, replace_all } = input;
|
|
16
|
+
const result = await fileSystemService.editFile(
|
|
17
|
+
file_path,
|
|
18
|
+
{
|
|
19
|
+
oldString: old_string,
|
|
20
|
+
newString: new_string,
|
|
21
|
+
replaceAll: replace_all
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
backup: true
|
|
25
|
+
// Always create backup for internal tools
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
success: result.success,
|
|
30
|
+
path: result.path,
|
|
31
|
+
changes_count: result.changesCount,
|
|
32
|
+
...result.backupPath && { backup_path: result.backupPath }
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
createEditFileTool
|
|
39
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var glob_files_tool_exports = {};
|
|
20
|
+
__export(glob_files_tool_exports, {
|
|
21
|
+
createGlobFilesTool: () => createGlobFilesTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(glob_files_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const GlobFilesInputSchema = import_zod.z.object({
|
|
26
|
+
pattern: import_zod.z.string().describe('Glob pattern to match files (e.g., "**/*.ts", "src/**/*.js")'),
|
|
27
|
+
path: import_zod.z.string().optional().describe("Base directory to search from (defaults to working directory)"),
|
|
28
|
+
max_results: import_zod.z.number().int().positive().optional().default(1e3).describe("Maximum number of results to return (default: 1000)")
|
|
29
|
+
}).strict();
|
|
30
|
+
function createGlobFilesTool(fileSystemService) {
|
|
31
|
+
return {
|
|
32
|
+
id: "glob_files",
|
|
33
|
+
description: "Find files matching a glob pattern. Supports standard glob syntax like **/*.js for recursive matches, *.ts for files in current directory, and src/**/*.tsx for nested paths. Returns array of file paths with metadata (size, modified date). Results are limited to allowed paths only.",
|
|
34
|
+
inputSchema: GlobFilesInputSchema,
|
|
35
|
+
execute: async (input, _context) => {
|
|
36
|
+
const { pattern, path, max_results } = input;
|
|
37
|
+
const result = await fileSystemService.globFiles(pattern, {
|
|
38
|
+
cwd: path,
|
|
39
|
+
maxResults: max_results,
|
|
40
|
+
includeMetadata: true
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
files: result.files.map((file) => ({
|
|
44
|
+
path: file.path,
|
|
45
|
+
size: file.size,
|
|
46
|
+
modified: file.modified.toISOString()
|
|
47
|
+
})),
|
|
48
|
+
total_found: result.totalFound,
|
|
49
|
+
truncated: result.truncated
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
createGlobFilesTool
|
|
57
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob Files Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for finding files using glob patterns
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the glob_files internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createGlobFilesTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=glob-files-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob-files-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/glob-files-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAuBjE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CA4BtF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const GlobFilesInputSchema = z.object({
|
|
4
|
+
pattern: z.string().describe('Glob pattern to match files (e.g., "**/*.ts", "src/**/*.js")'),
|
|
5
|
+
path: z.string().optional().describe("Base directory to search from (defaults to working directory)"),
|
|
6
|
+
max_results: z.number().int().positive().optional().default(1e3).describe("Maximum number of results to return (default: 1000)")
|
|
7
|
+
}).strict();
|
|
8
|
+
function createGlobFilesTool(fileSystemService) {
|
|
9
|
+
return {
|
|
10
|
+
id: "glob_files",
|
|
11
|
+
description: "Find files matching a glob pattern. Supports standard glob syntax like **/*.js for recursive matches, *.ts for files in current directory, and src/**/*.tsx for nested paths. Returns array of file paths with metadata (size, modified date). Results are limited to allowed paths only.",
|
|
12
|
+
inputSchema: GlobFilesInputSchema,
|
|
13
|
+
execute: async (input, _context) => {
|
|
14
|
+
const { pattern, path, max_results } = input;
|
|
15
|
+
const result = await fileSystemService.globFiles(pattern, {
|
|
16
|
+
cwd: path,
|
|
17
|
+
maxResults: max_results,
|
|
18
|
+
includeMetadata: true
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
files: result.files.map((file) => ({
|
|
22
|
+
path: file.path,
|
|
23
|
+
size: file.size,
|
|
24
|
+
modified: file.modified.toISOString()
|
|
25
|
+
})),
|
|
26
|
+
total_found: result.totalFound,
|
|
27
|
+
truncated: result.truncated
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
createGlobFilesTool
|
|
34
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var grep_content_tool_exports = {};
|
|
20
|
+
__export(grep_content_tool_exports, {
|
|
21
|
+
createGrepContentTool: () => createGrepContentTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(grep_content_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const GrepContentInputSchema = import_zod.z.object({
|
|
26
|
+
pattern: import_zod.z.string().describe("Regular expression pattern to search for"),
|
|
27
|
+
path: import_zod.z.string().optional().describe("Directory to search in (defaults to working directory)"),
|
|
28
|
+
glob: import_zod.z.string().optional().describe('Glob pattern to filter files (e.g., "*.ts", "**/*.js")'),
|
|
29
|
+
context_lines: import_zod.z.number().int().min(0).optional().default(0).describe(
|
|
30
|
+
"Number of context lines to include before and after each match (default: 0)"
|
|
31
|
+
),
|
|
32
|
+
case_insensitive: import_zod.z.boolean().optional().default(false).describe("Perform case-insensitive search (default: false)"),
|
|
33
|
+
max_results: import_zod.z.number().int().positive().optional().default(100).describe("Maximum number of results to return (default: 100)")
|
|
34
|
+
}).strict();
|
|
35
|
+
function createGrepContentTool(fileSystemService) {
|
|
36
|
+
return {
|
|
37
|
+
id: "grep_content",
|
|
38
|
+
description: 'Search for text patterns in files using regular expressions. Returns matching lines with file path, line number, and optional context lines. Use glob parameter to filter specific file types (e.g., "*.ts"). Supports case-insensitive search. Great for finding code patterns, function definitions, or specific text across multiple files.',
|
|
39
|
+
inputSchema: GrepContentInputSchema,
|
|
40
|
+
execute: async (input, _context) => {
|
|
41
|
+
const { pattern, path, glob, context_lines, case_insensitive, max_results } = input;
|
|
42
|
+
const result = await fileSystemService.searchContent(pattern, {
|
|
43
|
+
path,
|
|
44
|
+
glob,
|
|
45
|
+
contextLines: context_lines,
|
|
46
|
+
caseInsensitive: case_insensitive,
|
|
47
|
+
maxResults: max_results
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
matches: result.matches.map((match) => ({
|
|
51
|
+
file: match.file,
|
|
52
|
+
line_number: match.lineNumber,
|
|
53
|
+
line: match.line,
|
|
54
|
+
...match.context && {
|
|
55
|
+
context: {
|
|
56
|
+
before: match.context.before,
|
|
57
|
+
after: match.context.after
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})),
|
|
61
|
+
total_matches: result.totalMatches,
|
|
62
|
+
files_searched: result.filesSearched,
|
|
63
|
+
truncated: result.truncated
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
createGrepContentTool
|
|
71
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grep Content Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for searching file contents using regex patterns
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the grep_content internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createGrepContentTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=grep-content-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep-content-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/grep-content-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAuCjE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAsCxF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const GrepContentInputSchema = z.object({
|
|
4
|
+
pattern: z.string().describe("Regular expression pattern to search for"),
|
|
5
|
+
path: z.string().optional().describe("Directory to search in (defaults to working directory)"),
|
|
6
|
+
glob: z.string().optional().describe('Glob pattern to filter files (e.g., "*.ts", "**/*.js")'),
|
|
7
|
+
context_lines: z.number().int().min(0).optional().default(0).describe(
|
|
8
|
+
"Number of context lines to include before and after each match (default: 0)"
|
|
9
|
+
),
|
|
10
|
+
case_insensitive: z.boolean().optional().default(false).describe("Perform case-insensitive search (default: false)"),
|
|
11
|
+
max_results: z.number().int().positive().optional().default(100).describe("Maximum number of results to return (default: 100)")
|
|
12
|
+
}).strict();
|
|
13
|
+
function createGrepContentTool(fileSystemService) {
|
|
14
|
+
return {
|
|
15
|
+
id: "grep_content",
|
|
16
|
+
description: 'Search for text patterns in files using regular expressions. Returns matching lines with file path, line number, and optional context lines. Use glob parameter to filter specific file types (e.g., "*.ts"). Supports case-insensitive search. Great for finding code patterns, function definitions, or specific text across multiple files.',
|
|
17
|
+
inputSchema: GrepContentInputSchema,
|
|
18
|
+
execute: async (input, _context) => {
|
|
19
|
+
const { pattern, path, glob, context_lines, case_insensitive, max_results } = input;
|
|
20
|
+
const result = await fileSystemService.searchContent(pattern, {
|
|
21
|
+
path,
|
|
22
|
+
glob,
|
|
23
|
+
contextLines: context_lines,
|
|
24
|
+
caseInsensitive: case_insensitive,
|
|
25
|
+
maxResults: max_results
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
matches: result.matches.map((match) => ({
|
|
29
|
+
file: match.file,
|
|
30
|
+
line_number: match.lineNumber,
|
|
31
|
+
line: match.line,
|
|
32
|
+
...match.context && {
|
|
33
|
+
context: {
|
|
34
|
+
before: match.context.before,
|
|
35
|
+
after: match.context.after
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
})),
|
|
39
|
+
total_matches: result.totalMatches,
|
|
40
|
+
files_searched: result.filesSearched,
|
|
41
|
+
truncated: result.truncated
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
createGrepContentTool
|
|
48
|
+
};
|