@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,47 @@
|
|
|
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 kill_process_tool_exports = {};
|
|
20
|
+
__export(kill_process_tool_exports, {
|
|
21
|
+
createKillProcessTool: () => createKillProcessTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(kill_process_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const KillProcessInputSchema = import_zod.z.object({
|
|
26
|
+
process_id: import_zod.z.string().describe("Process ID of the background process to terminate")
|
|
27
|
+
}).strict();
|
|
28
|
+
function createKillProcessTool(processService) {
|
|
29
|
+
return {
|
|
30
|
+
id: "kill_process",
|
|
31
|
+
description: "Terminate a background process started with bash_exec. Sends SIGTERM signal first, then SIGKILL if process doesn't terminate within 5 seconds. Only works on processes started by this agent. Returns success status and whether the process was running. Does not require additional approval (process was already approved when started).",
|
|
32
|
+
inputSchema: KillProcessInputSchema,
|
|
33
|
+
execute: async (input, _context) => {
|
|
34
|
+
const { process_id } = input;
|
|
35
|
+
await processService.killProcess(process_id);
|
|
36
|
+
return {
|
|
37
|
+
success: true,
|
|
38
|
+
process_id,
|
|
39
|
+
message: `Termination signal sent to process ${process_id}`
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
createKillProcessTool
|
|
47
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kill Process Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for terminating background processes
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { ProcessService } from '../../../process/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the kill_process internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createKillProcessTool(processService: ProcessService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=kill-process-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kill-process-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/kill-process-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,qBAAqB,CAAC,cAAc,EAAE,cAAc,GAAG,YAAY,CAqBlF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const KillProcessInputSchema = z.object({
|
|
4
|
+
process_id: z.string().describe("Process ID of the background process to terminate")
|
|
5
|
+
}).strict();
|
|
6
|
+
function createKillProcessTool(processService) {
|
|
7
|
+
return {
|
|
8
|
+
id: "kill_process",
|
|
9
|
+
description: "Terminate a background process started with bash_exec. Sends SIGTERM signal first, then SIGKILL if process doesn't terminate within 5 seconds. Only works on processes started by this agent. Returns success status and whether the process was running. Does not require additional approval (process was already approved when started).",
|
|
10
|
+
inputSchema: KillProcessInputSchema,
|
|
11
|
+
execute: async (input, _context) => {
|
|
12
|
+
const { process_id } = input;
|
|
13
|
+
await processService.killProcess(process_id);
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
process_id,
|
|
17
|
+
message: `Termination signal sent to process ${process_id}`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
createKillProcessTool
|
|
24
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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 read_file_tool_exports = {};
|
|
20
|
+
__export(read_file_tool_exports, {
|
|
21
|
+
createReadFileTool: () => createReadFileTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(read_file_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const ReadFileInputSchema = import_zod.z.object({
|
|
26
|
+
file_path: import_zod.z.string().describe("Absolute path to the file to read"),
|
|
27
|
+
limit: import_zod.z.number().int().positive().optional().describe("Maximum number of lines to read (optional)"),
|
|
28
|
+
offset: import_zod.z.number().int().min(1).optional().describe("Starting line number (1-based, optional)")
|
|
29
|
+
}).strict();
|
|
30
|
+
function createReadFileTool(fileSystemService) {
|
|
31
|
+
return {
|
|
32
|
+
id: "read_file",
|
|
33
|
+
description: "Read the contents of a file with optional pagination. Returns file content, line count, encoding, and whether the output was truncated. Use limit and offset parameters for large files to read specific sections. This tool is for reading files within allowed paths only.",
|
|
34
|
+
inputSchema: ReadFileInputSchema,
|
|
35
|
+
execute: async (input, _context) => {
|
|
36
|
+
const { file_path, limit, offset } = input;
|
|
37
|
+
const result = await fileSystemService.readFile(file_path, {
|
|
38
|
+
limit,
|
|
39
|
+
offset
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
content: result.content,
|
|
43
|
+
lines: result.lines,
|
|
44
|
+
encoding: result.encoding,
|
|
45
|
+
truncated: result.truncated,
|
|
46
|
+
size: result.size,
|
|
47
|
+
...result.mimeType && { mimeType: result.mimeType }
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
createReadFileTool
|
|
55
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read File Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for reading file contents with size limits and pagination
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the read_file internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createReadFileTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=read-file-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/read-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAsBjE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CA0BrF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const ReadFileInputSchema = z.object({
|
|
4
|
+
file_path: z.string().describe("Absolute path to the file to read"),
|
|
5
|
+
limit: z.number().int().positive().optional().describe("Maximum number of lines to read (optional)"),
|
|
6
|
+
offset: z.number().int().min(1).optional().describe("Starting line number (1-based, optional)")
|
|
7
|
+
}).strict();
|
|
8
|
+
function createReadFileTool(fileSystemService) {
|
|
9
|
+
return {
|
|
10
|
+
id: "read_file",
|
|
11
|
+
description: "Read the contents of a file with optional pagination. Returns file content, line count, encoding, and whether the output was truncated. Use limit and offset parameters for large files to read specific sections. This tool is for reading files within allowed paths only.",
|
|
12
|
+
inputSchema: ReadFileInputSchema,
|
|
13
|
+
execute: async (input, _context) => {
|
|
14
|
+
const { file_path, limit, offset } = input;
|
|
15
|
+
const result = await fileSystemService.readFile(file_path, {
|
|
16
|
+
limit,
|
|
17
|
+
offset
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
content: result.content,
|
|
21
|
+
lines: result.lines,
|
|
22
|
+
encoding: result.encoding,
|
|
23
|
+
truncated: result.truncated,
|
|
24
|
+
size: result.size,
|
|
25
|
+
...result.mimeType && { mimeType: result.mimeType }
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
createReadFileTool
|
|
32
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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 write_file_tool_exports = {};
|
|
20
|
+
__export(write_file_tool_exports, {
|
|
21
|
+
createWriteFileTool: () => createWriteFileTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(write_file_tool_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const WriteFileInputSchema = import_zod.z.object({
|
|
26
|
+
file_path: import_zod.z.string().describe("Absolute path where the file should be written"),
|
|
27
|
+
content: import_zod.z.string().describe("Content to write to the file"),
|
|
28
|
+
create_dirs: import_zod.z.boolean().optional().default(false).describe("Create parent directories if they don't exist (default: false)"),
|
|
29
|
+
encoding: import_zod.z.enum(["utf-8", "ascii", "latin1", "utf16le"]).optional().default("utf-8").describe("File encoding (default: utf-8)")
|
|
30
|
+
}).strict();
|
|
31
|
+
function createWriteFileTool(fileSystemService) {
|
|
32
|
+
return {
|
|
33
|
+
id: "write_file",
|
|
34
|
+
description: "Write content to a file. Creates a new file or overwrites existing file. Automatically creates backup of existing files before overwriting. Use create_dirs to create parent directories. Requires approval for all write operations. Returns success status, path, bytes written, and backup path if applicable.",
|
|
35
|
+
inputSchema: WriteFileInputSchema,
|
|
36
|
+
execute: async (input, _context) => {
|
|
37
|
+
const { file_path, content, create_dirs, encoding } = input;
|
|
38
|
+
const result = await fileSystemService.writeFile(file_path, content, {
|
|
39
|
+
createDirs: create_dirs,
|
|
40
|
+
encoding,
|
|
41
|
+
backup: true
|
|
42
|
+
// Always create backup for internal tools
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
success: result.success,
|
|
46
|
+
path: result.path,
|
|
47
|
+
bytes_written: result.bytesWritten,
|
|
48
|
+
...result.backupPath && { backup_path: result.backupPath }
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
createWriteFileTool
|
|
56
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write File Tool
|
|
3
|
+
*
|
|
4
|
+
* Internal tool for writing content to files (requires approval)
|
|
5
|
+
*/
|
|
6
|
+
import { InternalTool } from '../../types.js';
|
|
7
|
+
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the write_file internal tool
|
|
10
|
+
*/
|
|
11
|
+
export declare function createWriteFileTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
+
//# sourceMappingURL=write-file-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/write-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAkB,MAAM,8BAA8B,CAAC;AAqBjF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAyBtF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "../../../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const WriteFileInputSchema = z.object({
|
|
4
|
+
file_path: z.string().describe("Absolute path where the file should be written"),
|
|
5
|
+
content: z.string().describe("Content to write to the file"),
|
|
6
|
+
create_dirs: z.boolean().optional().default(false).describe("Create parent directories if they don't exist (default: false)"),
|
|
7
|
+
encoding: z.enum(["utf-8", "ascii", "latin1", "utf16le"]).optional().default("utf-8").describe("File encoding (default: utf-8)")
|
|
8
|
+
}).strict();
|
|
9
|
+
function createWriteFileTool(fileSystemService) {
|
|
10
|
+
return {
|
|
11
|
+
id: "write_file",
|
|
12
|
+
description: "Write content to a file. Creates a new file or overwrites existing file. Automatically creates backup of existing files before overwriting. Use create_dirs to create parent directories. Requires approval for all write operations. Returns success status, path, bytes written, and backup path if applicable.",
|
|
13
|
+
inputSchema: WriteFileInputSchema,
|
|
14
|
+
execute: async (input, _context) => {
|
|
15
|
+
const { file_path, content, create_dirs, encoding } = input;
|
|
16
|
+
const result = await fileSystemService.writeFile(file_path, content, {
|
|
17
|
+
createDirs: create_dirs,
|
|
18
|
+
encoding,
|
|
19
|
+
backup: true
|
|
20
|
+
// Always create backup for internal tools
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
success: result.success,
|
|
24
|
+
path: result.path,
|
|
25
|
+
bytes_written: result.bytesWritten,
|
|
26
|
+
...result.backupPath && { backup_path: result.backupPath }
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
createWriteFileTool
|
|
33
|
+
};
|
|
@@ -17,8 +17,10 @@ var internal_tools_exports = {};
|
|
|
17
17
|
module.exports = __toCommonJS(internal_tools_exports);
|
|
18
18
|
__reExport(internal_tools_exports, require("./provider.js"), module.exports);
|
|
19
19
|
__reExport(internal_tools_exports, require("./registry.js"), module.exports);
|
|
20
|
+
__reExport(internal_tools_exports, require("./constants.js"), module.exports);
|
|
20
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
22
|
0 && (module.exports = {
|
|
22
23
|
...require("./provider.js"),
|
|
23
|
-
...require("./registry.js")
|
|
24
|
+
...require("./registry.js"),
|
|
25
|
+
...require("./constants.js")
|
|
24
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/internal-tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/internal-tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
@@ -18,14 +18,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var registry_exports = {};
|
|
20
20
|
__export(registry_exports, {
|
|
21
|
-
INTERNAL_TOOL_NAMES: () => INTERNAL_TOOL_NAMES,
|
|
22
21
|
INTERNAL_TOOL_REGISTRY: () => INTERNAL_TOOL_REGISTRY,
|
|
23
22
|
getInternalToolInfo: () => getInternalToolInfo
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(registry_exports);
|
|
26
25
|
var import_search_history_tool = require("./implementations/search-history-tool.js");
|
|
27
26
|
var import_ask_user_tool = require("./implementations/ask-user-tool.js");
|
|
28
|
-
|
|
27
|
+
var import_read_file_tool = require("./implementations/read-file-tool.js");
|
|
28
|
+
var import_glob_files_tool = require("./implementations/glob-files-tool.js");
|
|
29
|
+
var import_grep_content_tool = require("./implementations/grep-content-tool.js");
|
|
30
|
+
var import_write_file_tool = require("./implementations/write-file-tool.js");
|
|
31
|
+
var import_edit_file_tool = require("./implementations/edit-file-tool.js");
|
|
32
|
+
var import_bash_exec_tool = require("./implementations/bash-exec-tool.js");
|
|
33
|
+
var import_bash_output_tool = require("./implementations/bash-output-tool.js");
|
|
34
|
+
var import_kill_process_tool = require("./implementations/kill-process-tool.js");
|
|
29
35
|
const INTERNAL_TOOL_REGISTRY = {
|
|
30
36
|
search_history: {
|
|
31
37
|
factory: (services) => (0, import_search_history_tool.createSearchHistoryTool)(services.searchService),
|
|
@@ -34,15 +40,45 @@ const INTERNAL_TOOL_REGISTRY = {
|
|
|
34
40
|
ask_user: {
|
|
35
41
|
factory: (services) => (0, import_ask_user_tool.createAskUserTool)(services.approvalManager),
|
|
36
42
|
requiredServices: ["approvalManager"]
|
|
43
|
+
},
|
|
44
|
+
read_file: {
|
|
45
|
+
factory: (services) => (0, import_read_file_tool.createReadFileTool)(services.fileSystemService),
|
|
46
|
+
requiredServices: ["fileSystemService"]
|
|
47
|
+
},
|
|
48
|
+
glob_files: {
|
|
49
|
+
factory: (services) => (0, import_glob_files_tool.createGlobFilesTool)(services.fileSystemService),
|
|
50
|
+
requiredServices: ["fileSystemService"]
|
|
51
|
+
},
|
|
52
|
+
grep_content: {
|
|
53
|
+
factory: (services) => (0, import_grep_content_tool.createGrepContentTool)(services.fileSystemService),
|
|
54
|
+
requiredServices: ["fileSystemService"]
|
|
55
|
+
},
|
|
56
|
+
write_file: {
|
|
57
|
+
factory: (services) => (0, import_write_file_tool.createWriteFileTool)(services.fileSystemService),
|
|
58
|
+
requiredServices: ["fileSystemService"]
|
|
59
|
+
},
|
|
60
|
+
edit_file: {
|
|
61
|
+
factory: (services) => (0, import_edit_file_tool.createEditFileTool)(services.fileSystemService),
|
|
62
|
+
requiredServices: ["fileSystemService"]
|
|
63
|
+
},
|
|
64
|
+
bash_exec: {
|
|
65
|
+
factory: (services) => (0, import_bash_exec_tool.createBashExecTool)(services.processService, services.approvalManager),
|
|
66
|
+
requiredServices: ["processService", "approvalManager"]
|
|
67
|
+
},
|
|
68
|
+
bash_output: {
|
|
69
|
+
factory: (services) => (0, import_bash_output_tool.createBashOutputTool)(services.processService),
|
|
70
|
+
requiredServices: ["processService"]
|
|
71
|
+
},
|
|
72
|
+
kill_process: {
|
|
73
|
+
factory: (services) => (0, import_kill_process_tool.createKillProcessTool)(services.processService),
|
|
74
|
+
requiredServices: ["processService"]
|
|
37
75
|
}
|
|
38
|
-
// Add new tools here - must match INTERNAL_TOOL_NAMES array above
|
|
39
76
|
};
|
|
40
77
|
function getInternalToolInfo(toolName) {
|
|
41
78
|
return INTERNAL_TOOL_REGISTRY[toolName];
|
|
42
79
|
}
|
|
43
80
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
81
|
0 && (module.exports = {
|
|
45
|
-
INTERNAL_TOOL_NAMES,
|
|
46
82
|
INTERNAL_TOOL_REGISTRY,
|
|
47
83
|
getInternalToolInfo
|
|
48
84
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { InternalTool } from '../types.js';
|
|
2
2
|
import { SearchService } from '../../search/index.js';
|
|
3
3
|
import { ApprovalManager } from '../../approval/manager.js';
|
|
4
|
+
import { FileSystemService } from '../../filesystem/index.js';
|
|
5
|
+
import { ProcessService } from '../../process/index.js';
|
|
6
|
+
import type { KnownInternalTool } from './constants.js';
|
|
4
7
|
/**
|
|
5
8
|
* Services available to internal tools
|
|
6
9
|
* Add new services here as needed for internal tools
|
|
@@ -8,20 +11,13 @@ import { ApprovalManager } from '../../approval/manager.js';
|
|
|
8
11
|
export interface InternalToolsServices {
|
|
9
12
|
searchService?: SearchService;
|
|
10
13
|
approvalManager?: ApprovalManager;
|
|
14
|
+
fileSystemService?: FileSystemService;
|
|
15
|
+
processService?: ProcessService;
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Internal tool factory function type
|
|
14
19
|
*/
|
|
15
20
|
type InternalToolFactory = (services: InternalToolsServices) => InternalTool;
|
|
16
|
-
/**
|
|
17
|
-
* Internal tool names - Manual array preserves literal types for z.enum()
|
|
18
|
-
* Add new tool names here first, then implement in registry below
|
|
19
|
-
*/
|
|
20
|
-
export declare const INTERNAL_TOOL_NAMES: readonly ["search_history", "ask_user"];
|
|
21
|
-
/**
|
|
22
|
-
* Derive type from names array - preserves literal union
|
|
23
|
-
*/
|
|
24
|
-
export type KnownInternalTool = (typeof INTERNAL_TOOL_NAMES)[number];
|
|
25
21
|
/**
|
|
26
22
|
* Internal tool registry - Must match names array exactly (TypeScript enforces this)
|
|
27
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/tools/internal-tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/tools/internal-tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAWxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,cAAc,CAAC,EAAE,cAAc,CAAC;CAKnC;AAED;;GAEG;AACH,KAAK,mBAAmB,GAAG,CAAC,QAAQ,EAAE,qBAAqB,KAAK,YAAY,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACvC,iBAAiB,EACjB;IACI,OAAO,EAAE,mBAAmB,CAAC;IAC7B,gBAAgB,EAAE,SAAS,CAAC,MAAM,qBAAqB,CAAC,EAAE,CAAC;CAC9D,CAmDJ,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB;aA1D9C,mBAAmB;sBACV,SAAS,CAAC,MAAM,qBAAqB,CAAC,EAAE;EA2DjE"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import "../../chunk-C6A6W6XS.js";
|
|
1
2
|
import { createSearchHistoryTool } from "./implementations/search-history-tool.js";
|
|
2
3
|
import { createAskUserTool } from "./implementations/ask-user-tool.js";
|
|
3
|
-
|
|
4
|
+
import { createReadFileTool } from "./implementations/read-file-tool.js";
|
|
5
|
+
import { createGlobFilesTool } from "./implementations/glob-files-tool.js";
|
|
6
|
+
import { createGrepContentTool } from "./implementations/grep-content-tool.js";
|
|
7
|
+
import { createWriteFileTool } from "./implementations/write-file-tool.js";
|
|
8
|
+
import { createEditFileTool } from "./implementations/edit-file-tool.js";
|
|
9
|
+
import { createBashExecTool } from "./implementations/bash-exec-tool.js";
|
|
10
|
+
import { createBashOutputTool } from "./implementations/bash-output-tool.js";
|
|
11
|
+
import { createKillProcessTool } from "./implementations/kill-process-tool.js";
|
|
4
12
|
const INTERNAL_TOOL_REGISTRY = {
|
|
5
13
|
search_history: {
|
|
6
14
|
factory: (services) => createSearchHistoryTool(services.searchService),
|
|
@@ -9,14 +17,44 @@ const INTERNAL_TOOL_REGISTRY = {
|
|
|
9
17
|
ask_user: {
|
|
10
18
|
factory: (services) => createAskUserTool(services.approvalManager),
|
|
11
19
|
requiredServices: ["approvalManager"]
|
|
20
|
+
},
|
|
21
|
+
read_file: {
|
|
22
|
+
factory: (services) => createReadFileTool(services.fileSystemService),
|
|
23
|
+
requiredServices: ["fileSystemService"]
|
|
24
|
+
},
|
|
25
|
+
glob_files: {
|
|
26
|
+
factory: (services) => createGlobFilesTool(services.fileSystemService),
|
|
27
|
+
requiredServices: ["fileSystemService"]
|
|
28
|
+
},
|
|
29
|
+
grep_content: {
|
|
30
|
+
factory: (services) => createGrepContentTool(services.fileSystemService),
|
|
31
|
+
requiredServices: ["fileSystemService"]
|
|
32
|
+
},
|
|
33
|
+
write_file: {
|
|
34
|
+
factory: (services) => createWriteFileTool(services.fileSystemService),
|
|
35
|
+
requiredServices: ["fileSystemService"]
|
|
36
|
+
},
|
|
37
|
+
edit_file: {
|
|
38
|
+
factory: (services) => createEditFileTool(services.fileSystemService),
|
|
39
|
+
requiredServices: ["fileSystemService"]
|
|
40
|
+
},
|
|
41
|
+
bash_exec: {
|
|
42
|
+
factory: (services) => createBashExecTool(services.processService, services.approvalManager),
|
|
43
|
+
requiredServices: ["processService", "approvalManager"]
|
|
44
|
+
},
|
|
45
|
+
bash_output: {
|
|
46
|
+
factory: (services) => createBashOutputTool(services.processService),
|
|
47
|
+
requiredServices: ["processService"]
|
|
48
|
+
},
|
|
49
|
+
kill_process: {
|
|
50
|
+
factory: (services) => createKillProcessTool(services.processService),
|
|
51
|
+
requiredServices: ["processService"]
|
|
12
52
|
}
|
|
13
|
-
// Add new tools here - must match INTERNAL_TOOL_NAMES array above
|
|
14
53
|
};
|
|
15
54
|
function getInternalToolInfo(toolName) {
|
|
16
55
|
return INTERNAL_TOOL_REGISTRY[toolName];
|
|
17
56
|
}
|
|
18
57
|
export {
|
|
19
|
-
INTERNAL_TOOL_NAMES,
|
|
20
58
|
INTERNAL_TOOL_REGISTRY,
|
|
21
59
|
getInternalToolInfo
|
|
22
60
|
};
|
package/dist/tools/schemas.cjs
CHANGED
|
@@ -23,18 +23,27 @@ __export(schemas_exports, {
|
|
|
23
23
|
DEFAULT_TOOL_CONFIRMATION_MODE: () => DEFAULT_TOOL_CONFIRMATION_MODE,
|
|
24
24
|
InternalToolsSchema: () => InternalToolsSchema,
|
|
25
25
|
TOOL_CONFIRMATION_MODES: () => TOOL_CONFIRMATION_MODES,
|
|
26
|
-
ToolConfirmationConfigSchema: () => ToolConfirmationConfigSchema
|
|
26
|
+
ToolConfirmationConfigSchema: () => ToolConfirmationConfigSchema,
|
|
27
|
+
ToolPoliciesSchema: () => ToolPoliciesSchema
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(schemas_exports);
|
|
29
30
|
var import_zod = require("zod");
|
|
30
|
-
var
|
|
31
|
+
var import_constants = require("./internal-tools/constants.js");
|
|
31
32
|
const TOOL_CONFIRMATION_MODES = ["event-based", "auto-approve", "auto-deny"];
|
|
32
33
|
const ALLOWED_TOOLS_STORAGE_TYPES = ["memory", "storage"];
|
|
33
34
|
const DEFAULT_TOOL_CONFIRMATION_MODE = "event-based";
|
|
34
35
|
const DEFAULT_ALLOWED_TOOLS_STORAGE = "storage";
|
|
35
|
-
const InternalToolsSchema = import_zod.z.array(import_zod.z.enum(
|
|
36
|
-
`Array of internal tool names to enable. Empty array = disabled. Available tools: ${
|
|
36
|
+
const InternalToolsSchema = import_zod.z.array(import_zod.z.enum(import_constants.INTERNAL_TOOL_NAMES).describe("Available internal tool names")).default([]).describe(
|
|
37
|
+
`Array of internal tool names to enable. Empty array = disabled. Available tools: ${import_constants.INTERNAL_TOOL_NAMES.join(", ")}`
|
|
37
38
|
);
|
|
39
|
+
const ToolPoliciesSchema = import_zod.z.object({
|
|
40
|
+
alwaysAllow: import_zod.z.array(import_zod.z.string()).default([]).describe(
|
|
41
|
+
'Tools that never require approval (low-risk). Use full qualified names (e.g., "internal--ask_user", "mcp--filesystem--read_file")'
|
|
42
|
+
),
|
|
43
|
+
alwaysDeny: import_zod.z.array(import_zod.z.string()).default([]).describe(
|
|
44
|
+
'Tools that are always denied (high-risk). Takes precedence over alwaysAllow. Use full qualified names (e.g., "mcp--filesystem--delete_file")'
|
|
45
|
+
)
|
|
46
|
+
}).strict().default({ alwaysAllow: [], alwaysDeny: [] }).describe("Static tool policies for allow/deny lists");
|
|
38
47
|
const ToolConfirmationConfigSchema = import_zod.z.object({
|
|
39
48
|
mode: import_zod.z.enum(TOOL_CONFIRMATION_MODES).default(DEFAULT_TOOL_CONFIRMATION_MODE).describe(
|
|
40
49
|
"Tool confirmation mode: event-based (interactive), auto-approve (all tools), auto-deny (no tools)"
|
|
@@ -44,6 +53,9 @@ const ToolConfirmationConfigSchema = import_zod.z.object({
|
|
|
44
53
|
),
|
|
45
54
|
allowedToolsStorage: import_zod.z.enum(ALLOWED_TOOLS_STORAGE_TYPES).default(DEFAULT_ALLOWED_TOOLS_STORAGE).describe(
|
|
46
55
|
"Storage type for remembered tool approvals: memory (session-only) or storage (persistent)"
|
|
56
|
+
),
|
|
57
|
+
toolPolicies: ToolPoliciesSchema.optional().describe(
|
|
58
|
+
"Static tool policies for fine-grained allow/deny control. Deny list takes precedence over allow list."
|
|
47
59
|
)
|
|
48
60
|
}).strict().describe("Tool confirmation and approval configuration");
|
|
49
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -53,5 +65,6 @@ const ToolConfirmationConfigSchema = import_zod.z.object({
|
|
|
53
65
|
DEFAULT_TOOL_CONFIRMATION_MODE,
|
|
54
66
|
InternalToolsSchema,
|
|
55
67
|
TOOL_CONFIRMATION_MODES,
|
|
56
|
-
ToolConfirmationConfigSchema
|
|
68
|
+
ToolConfirmationConfigSchema,
|
|
69
|
+
ToolPoliciesSchema
|
|
57
70
|
});
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -5,20 +5,49 @@ export declare const ALLOWED_TOOLS_STORAGE_TYPES: readonly ["memory", "storage"]
|
|
|
5
5
|
export type AllowedToolsStorageType = (typeof ALLOWED_TOOLS_STORAGE_TYPES)[number];
|
|
6
6
|
export declare const DEFAULT_TOOL_CONFIRMATION_MODE: ToolConfirmationMode;
|
|
7
7
|
export declare const DEFAULT_ALLOWED_TOOLS_STORAGE: AllowedToolsStorageType;
|
|
8
|
-
export declare const InternalToolsSchema: z.ZodDefault<z.ZodArray<z.ZodEnum<["search_history", "ask_user"]>, "many">>;
|
|
8
|
+
export declare const InternalToolsSchema: z.ZodDefault<z.ZodArray<z.ZodEnum<["search_history", "ask_user", "read_file", "glob_files", "grep_content", "write_file", "edit_file", "bash_exec", "bash_output", "kill_process"]>, "many">>;
|
|
9
9
|
export type InternalToolsConfig = z.output<typeof InternalToolsSchema>;
|
|
10
|
+
export declare const ToolPoliciesSchema: z.ZodDefault<z.ZodObject<{
|
|
11
|
+
alwaysAllow: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
alwaysDeny: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
alwaysAllow: string[];
|
|
15
|
+
alwaysDeny: string[];
|
|
16
|
+
}, {
|
|
17
|
+
alwaysAllow?: string[] | undefined;
|
|
18
|
+
alwaysDeny?: string[] | undefined;
|
|
19
|
+
}>>;
|
|
20
|
+
export type ToolPolicies = z.output<typeof ToolPoliciesSchema>;
|
|
10
21
|
export declare const ToolConfirmationConfigSchema: z.ZodObject<{
|
|
11
22
|
mode: z.ZodDefault<z.ZodEnum<["event-based", "auto-approve", "auto-deny"]>>;
|
|
12
23
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
13
24
|
allowedToolsStorage: z.ZodDefault<z.ZodEnum<["memory", "storage"]>>;
|
|
25
|
+
toolPolicies: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
26
|
+
alwaysAllow: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
27
|
+
alwaysDeny: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
28
|
+
}, "strict", z.ZodTypeAny, {
|
|
29
|
+
alwaysAllow: string[];
|
|
30
|
+
alwaysDeny: string[];
|
|
31
|
+
}, {
|
|
32
|
+
alwaysAllow?: string[] | undefined;
|
|
33
|
+
alwaysDeny?: string[] | undefined;
|
|
34
|
+
}>>>;
|
|
14
35
|
}, "strict", z.ZodTypeAny, {
|
|
15
36
|
timeout: number;
|
|
16
37
|
mode: "event-based" | "auto-approve" | "auto-deny";
|
|
17
38
|
allowedToolsStorage: "storage" | "memory";
|
|
39
|
+
toolPolicies?: {
|
|
40
|
+
alwaysAllow: string[];
|
|
41
|
+
alwaysDeny: string[];
|
|
42
|
+
} | undefined;
|
|
18
43
|
}, {
|
|
19
44
|
timeout?: number | undefined;
|
|
20
45
|
mode?: "event-based" | "auto-approve" | "auto-deny" | undefined;
|
|
21
46
|
allowedToolsStorage?: "storage" | "memory" | undefined;
|
|
47
|
+
toolPolicies?: {
|
|
48
|
+
alwaysAllow?: string[] | undefined;
|
|
49
|
+
alwaysDeny?: string[] | undefined;
|
|
50
|
+
} | undefined;
|
|
22
51
|
}>;
|
|
23
52
|
export type ToolConfirmationConfig = z.input<typeof ToolConfirmationConfigSchema>;
|
|
24
53
|
export type ValidatedToolConfirmationConfig = z.output<typeof ToolConfirmationConfigSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB,uDAAwD,CAAC;AAC7F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,gCAAiC,CAAC;AAC1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnF,eAAO,MAAM,8BAA8B,EAAE,oBAAoC,CAAC;AAClF,eAAO,MAAM,6BAA6B,EAAE,uBAAmC,CAAC;AAIhF,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB,uDAAwD,CAAC;AAC7F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,gCAAiC,CAAC;AAC1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnF,eAAO,MAAM,8BAA8B,EAAE,oBAAoC,CAAC;AAClF,eAAO,MAAM,6BAA6B,EAAE,uBAAmC,CAAC;AAIhF,eAAO,MAAM,mBAAmB,+LAK3B,CAAC;AAEN,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGvE,eAAO,MAAM,kBAAkB;;;;;;;;;GAiB2B,CAAC;AAE3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BoB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|