@dexto/core 1.2.6 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -13
- package/dist/agent/DextoAgent.cjs +627 -228
- package/dist/agent/DextoAgent.d.ts +157 -34
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +625 -227
- package/dist/agent/agentCard.js +1 -1
- package/dist/agent/error-codes.cjs +1 -0
- package/dist/agent/error-codes.d.ts +2 -1
- package/dist/agent/error-codes.d.ts.map +1 -1
- package/dist/agent/error-codes.js +2 -1
- 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 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/schemas.cjs +4 -1
- package/dist/agent/schemas.d.ts +92 -55
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +7 -3
- package/dist/agent/state-manager.cjs +5 -5
- package/dist/agent/state-manager.d.ts +4 -4
- package/dist/agent/state-manager.js +6 -6
- package/dist/agent/types.d.ts +24 -11
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/approval/error-codes.js +1 -1
- package/dist/approval/errors.js +1 -1
- package/dist/approval/factory.js +1 -1
- package/dist/approval/index.js +1 -1
- package/dist/approval/manager.cjs +69 -3
- package/dist/approval/manager.d.ts +41 -3
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +70 -4
- package/dist/approval/schemas.cjs +20 -5
- package/dist/approval/schemas.d.ts +127 -52
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +21 -6
- package/dist/approval/types.d.ts +6 -0
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +1 -1
- package/dist/{chunk-C6A6W6XS.js → chunk-PTJYTZNU.js} +44 -1
- package/dist/{llm/tokenizer/factory.cjs → context/compression/overflow.cjs} +20 -21
- package/dist/context/compression/overflow.d.ts +33 -0
- package/dist/context/compression/overflow.d.ts.map +1 -0
- package/dist/context/compression/overflow.js +19 -0
- package/dist/context/compression/reactive-overflow.cjs +201 -0
- package/dist/context/compression/reactive-overflow.d.ts +81 -0
- package/dist/context/compression/reactive-overflow.d.ts.map +1 -0
- package/dist/context/compression/reactive-overflow.js +178 -0
- package/dist/context/compression/types.d.ts +9 -7
- package/dist/context/compression/types.d.ts.map +1 -1
- package/dist/context/error-codes.cjs +3 -0
- package/dist/context/error-codes.d.ts +4 -1
- package/dist/context/error-codes.d.ts.map +1 -1
- package/dist/context/error-codes.js +4 -1
- package/dist/context/errors.cjs +28 -0
- package/dist/context/errors.d.ts +7 -0
- package/dist/context/errors.d.ts.map +1 -1
- package/dist/context/errors.js +29 -1
- package/dist/context/index.js +1 -1
- package/dist/context/manager.cjs +287 -323
- package/dist/context/manager.d.ts +65 -111
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +287 -328
- package/dist/context/media-helpers.js +1 -1
- package/dist/context/types.cjs +49 -0
- package/dist/context/types.d.ts +185 -72
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/types.js +35 -0
- package/dist/context/utils.cjs +266 -283
- package/dist/context/utils.d.ts +32 -18
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +266 -283
- package/dist/errors/DextoBaseError.js +1 -1
- package/dist/errors/DextoRuntimeError.js +1 -1
- package/dist/errors/DextoValidationError.js +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/result-bridge.js +1 -1
- package/dist/errors/types.cjs +1 -0
- package/dist/errors/types.d.ts +4 -2
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +2 -1
- package/dist/events/index.cjs +22 -2
- package/dist/events/index.d.ts +170 -62
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +23 -3
- package/dist/filesystem/error-codes.js +1 -1
- package/dist/filesystem/errors.js +1 -1
- package/dist/filesystem/filesystem-service.js +1 -1
- package/dist/filesystem/index.js +1 -1
- package/dist/filesystem/path-validator.js +1 -1
- package/dist/index.browser.cjs +23 -8
- package/dist/index.browser.d.ts +4 -3
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +20 -3
- package/dist/index.js +1 -1
- package/dist/llm/error-codes.cjs +0 -1
- package/dist/llm/error-codes.d.ts +0 -1
- package/dist/llm/error-codes.d.ts.map +1 -1
- package/dist/llm/error-codes.js +1 -2
- package/dist/llm/errors.cjs +10 -10
- package/dist/llm/errors.d.ts +5 -6
- package/dist/llm/errors.d.ts.map +1 -1
- package/dist/llm/errors.js +12 -12
- package/dist/llm/executor/stream-processor.cjs +367 -0
- package/dist/llm/executor/stream-processor.d.ts +55 -0
- package/dist/llm/executor/stream-processor.d.ts.map +1 -0
- package/dist/llm/executor/stream-processor.js +344 -0
- package/dist/llm/executor/tool-output-truncator.cjs +75 -0
- package/dist/llm/executor/tool-output-truncator.d.ts +27 -0
- package/dist/llm/executor/tool-output-truncator.d.ts.map +1 -0
- package/dist/llm/executor/tool-output-truncator.js +48 -0
- package/dist/llm/executor/turn-executor.cjs +753 -0
- package/dist/llm/executor/turn-executor.d.ts +166 -0
- package/dist/llm/executor/turn-executor.d.ts.map +1 -0
- package/dist/llm/executor/turn-executor.js +684 -0
- package/dist/llm/executor/types.d.ts +27 -0
- package/dist/llm/executor/types.d.ts.map +1 -0
- package/dist/llm/formatters/vercel.cjs +20 -186
- package/dist/llm/formatters/vercel.d.ts +2 -14
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +19 -185
- package/dist/llm/registry.cjs +36 -45
- package/dist/llm/registry.d.ts +53 -39
- package/dist/llm/registry.d.ts.map +1 -1
- package/dist/llm/registry.js +34 -42
- package/dist/llm/resolver.cjs +1 -31
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +2 -34
- package/dist/llm/schemas.cjs +2 -17
- package/dist/llm/schemas.d.ts +10 -23
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +5 -22
- package/dist/llm/services/factory.cjs +3 -92
- package/dist/llm/services/factory.d.ts +14 -4
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +4 -83
- package/dist/llm/services/test-utils.integration.cjs +6 -8
- package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
- package/dist/llm/services/test-utils.integration.js +7 -9
- package/dist/llm/services/types.d.ts +1 -28
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +54 -468
- package/dist/llm/services/vercel.d.ts +38 -21
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +56 -475
- package/dist/llm/types.cjs +0 -3
- package/dist/llm/types.d.ts +8 -8
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -3
- package/dist/llm/validation.js +1 -1
- package/dist/logger/browser.js +1 -1
- package/dist/logger/factory.js +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logger/logger.js +1 -1
- package/dist/logger/v2/dexto-logger.cjs +34 -6
- package/dist/logger/v2/dexto-logger.d.ts +20 -2
- package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
- package/dist/logger/v2/dexto-logger.js +35 -7
- package/dist/logger/v2/error-codes.js +1 -1
- package/dist/logger/v2/errors.js +1 -1
- package/dist/logger/v2/schemas.cjs +1 -1
- package/dist/logger/v2/schemas.js +2 -2
- package/dist/logger/v2/test-utils.cjs +70 -0
- package/dist/logger/v2/test-utils.d.ts +17 -0
- package/dist/logger/v2/test-utils.d.ts.map +1 -0
- package/dist/logger/v2/test-utils.js +46 -0
- package/dist/logger/v2/transport-factory.js +1 -1
- package/dist/logger/v2/transports/console-transport.js +1 -1
- package/dist/logger/v2/transports/file-transport.cjs +6 -0
- package/dist/logger/v2/transports/file-transport.d.ts +4 -0
- package/dist/logger/v2/transports/file-transport.d.ts.map +1 -1
- package/dist/logger/v2/transports/file-transport.js +7 -1
- package/dist/logger/v2/types.cjs +1 -0
- package/dist/logger/v2/types.d.ts +18 -2
- package/dist/logger/v2/types.d.ts.map +1 -1
- package/dist/logger/v2/types.js +2 -1
- 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 -1
- package/dist/mcp/errors.cjs +13 -0
- package/dist/mcp/errors.d.ts +7 -0
- package/dist/mcp/errors.d.ts.map +1 -1
- package/dist/mcp/errors.js +14 -1
- package/dist/mcp/manager.cjs +4 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +5 -1
- package/dist/mcp/mcp-client.js +1 -1
- package/dist/mcp/resolver.js +1 -1
- package/dist/mcp/schemas.cjs +6 -0
- package/dist/mcp/schemas.d.ts +52 -0
- package/dist/mcp/schemas.d.ts.map +1 -1
- package/dist/mcp/schemas.js +6 -1
- package/dist/memory/error-codes.js +1 -1
- package/dist/memory/errors.js +1 -1
- package/dist/memory/index.js +1 -1
- package/dist/memory/manager.js +1 -1
- package/dist/memory/schemas.d.ts +2 -2
- package/dist/memory/schemas.js +1 -1
- package/dist/plugins/builtins/content-policy.js +1 -1
- package/dist/plugins/builtins/response-sanitizer.js +1 -1
- package/dist/plugins/error-codes.cjs +1 -0
- package/dist/plugins/error-codes.d.ts +3 -1
- package/dist/plugins/error-codes.d.ts.map +1 -1
- package/dist/plugins/error-codes.js +2 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/loader.cjs +25 -5
- package/dist/plugins/loader.d.ts.map +1 -1
- package/dist/plugins/loader.js +26 -6
- package/dist/plugins/manager.js +1 -1
- package/dist/plugins/registrations/builtins.js +1 -1
- package/dist/plugins/schemas.d.ts +3 -3
- package/dist/plugins/schemas.js +1 -1
- package/dist/plugins/types.d.ts +0 -1
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/process/command-validator.js +1 -1
- package/dist/process/error-codes.js +1 -1
- package/dist/process/errors.js +1 -1
- package/dist/process/index.js +1 -1
- package/dist/process/process-service.cjs +78 -26
- package/dist/process/process-service.d.ts +6 -1
- package/dist/process/process-service.d.ts.map +1 -1
- package/dist/process/process-service.js +79 -27
- package/dist/process/types.d.ts +2 -2
- package/dist/process/types.d.ts.map +1 -1
- package/dist/prompts/error-codes.cjs +1 -0
- package/dist/prompts/error-codes.d.ts +2 -1
- package/dist/prompts/error-codes.d.ts.map +1 -1
- package/dist/prompts/error-codes.js +2 -1
- package/dist/prompts/errors.cjs +15 -0
- package/dist/prompts/errors.d.ts +4 -0
- package/dist/prompts/errors.d.ts.map +1 -1
- package/dist/prompts/errors.js +16 -1
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/name-validation.js +1 -1
- package/dist/prompts/prompt-manager.cjs +13 -2
- package/dist/prompts/prompt-manager.d.ts +7 -0
- package/dist/prompts/prompt-manager.d.ts.map +1 -1
- package/dist/prompts/prompt-manager.js +14 -3
- package/dist/prompts/providers/config-prompt-provider.cjs +12 -3
- package/dist/prompts/providers/config-prompt-provider.d.ts +2 -1
- package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.js +13 -4
- package/dist/prompts/providers/custom-prompt-provider.cjs +2 -2
- package/dist/prompts/providers/custom-prompt-provider.d.ts +1 -1
- package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/custom-prompt-provider.js +3 -3
- package/dist/prompts/providers/mcp-prompt-provider.js +1 -1
- package/dist/prompts/schemas.d.ts +12 -0
- package/dist/prompts/schemas.d.ts.map +1 -1
- package/dist/prompts/schemas.js +1 -1
- package/dist/prompts/types.d.ts +2 -0
- package/dist/prompts/types.d.ts.map +1 -1
- package/dist/prompts/utils.js +1 -1
- package/dist/resources/error-codes.js +1 -1
- package/dist/resources/errors.js +1 -1
- package/dist/resources/handlers/blob-handler.js +1 -1
- package/dist/resources/handlers/factory.js +1 -1
- package/dist/resources/handlers/filesystem-handler.js +1 -1
- package/dist/resources/index.js +1 -1
- package/dist/resources/internal-provider.js +1 -1
- package/dist/resources/manager.js +1 -1
- package/dist/resources/reference-parser.js +1 -1
- package/dist/resources/schemas.js +1 -1
- package/dist/search/index.js +1 -1
- package/dist/search/search-service.js +1 -1
- package/dist/session/chat-session.cjs +149 -51
- package/dist/session/chat-session.d.ts +69 -29
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +150 -52
- package/dist/session/error-codes.js +1 -1
- package/dist/session/errors.js +1 -1
- package/dist/session/history/database.cjs +134 -21
- package/dist/session/history/database.d.ts +37 -8
- package/dist/session/history/database.d.ts.map +1 -1
- package/dist/session/history/database.js +135 -22
- package/dist/session/history/factory.js +1 -1
- package/dist/session/history/memory.cjs +18 -0
- package/dist/session/history/memory.d.ts +8 -0
- package/dist/session/history/memory.d.ts.map +1 -1
- package/dist/session/history/memory.js +19 -1
- package/dist/session/history/types.d.ts +13 -1
- package/dist/session/history/types.d.ts.map +1 -1
- package/dist/session/index.cjs +3 -0
- package/dist/session/index.d.ts +3 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +3 -1
- package/dist/session/message-queue.cjs +201 -0
- package/dist/session/message-queue.d.ts +114 -0
- package/dist/session/message-queue.d.ts.map +1 -0
- package/dist/session/message-queue.js +178 -0
- package/dist/session/schemas.js +1 -1
- package/dist/session/session-manager.cjs +57 -7
- package/dist/session/session-manager.d.ts +18 -0
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +58 -8
- package/dist/session/title-generator.cjs +4 -8
- package/dist/session/title-generator.d.ts +1 -2
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/title-generator.js +5 -9
- package/dist/session/types.cjs +16 -0
- package/dist/session/types.d.ts +14 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +0 -0
- package/dist/storage/blob/factory.js +1 -1
- package/dist/storage/blob/local-blob-store.js +1 -1
- package/dist/storage/blob/memory-blob-store.js +1 -1
- package/dist/storage/blob/schemas.js +1 -1
- package/dist/storage/cache/factory.cjs +6 -2
- package/dist/storage/cache/factory.d.ts +2 -1
- package/dist/storage/cache/factory.d.ts.map +1 -1
- package/dist/storage/cache/factory.js +7 -3
- package/dist/storage/cache/memory-cache-store.js +1 -1
- package/dist/storage/cache/redis-store.js +1 -1
- package/dist/storage/cache/schemas.js +1 -1
- package/dist/storage/database/factory.cjs +11 -17
- package/dist/storage/database/factory.d.ts +2 -1
- package/dist/storage/database/factory.d.ts.map +1 -1
- package/dist/storage/database/factory.js +12 -18
- package/dist/storage/database/memory-database-store.js +1 -1
- package/dist/storage/database/postgres-store.cjs +12 -0
- package/dist/storage/database/postgres-store.d.ts.map +1 -1
- package/dist/storage/database/postgres-store.js +13 -1
- package/dist/storage/database/schemas.js +1 -1
- package/dist/storage/database/sqlite-store.cjs +8 -0
- package/dist/storage/database/sqlite-store.d.ts.map +1 -1
- package/dist/storage/database/sqlite-store.js +9 -1
- 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 -1
- package/dist/storage/errors.cjs +17 -0
- package/dist/storage/errors.d.ts +9 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +18 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/schemas.js +1 -1
- package/dist/storage/storage-manager.js +1 -1
- package/dist/systemPrompt/contributors.js +1 -1
- package/dist/systemPrompt/error-codes.js +1 -1
- package/dist/systemPrompt/errors.js +1 -1
- package/dist/systemPrompt/in-built-prompts.js +1 -1
- package/dist/systemPrompt/index.js +1 -1
- package/dist/systemPrompt/manager.js +1 -1
- package/dist/systemPrompt/registry.js +1 -1
- package/dist/systemPrompt/schemas.d.ts +5 -5
- package/dist/systemPrompt/schemas.js +1 -1
- package/dist/telemetry/decorators.js +1 -1
- package/dist/{llm/tokenizer/default.cjs → telemetry/error-codes.cjs} +14 -19
- package/dist/telemetry/error-codes.d.ts +13 -0
- package/dist/telemetry/error-codes.d.ts.map +1 -0
- package/dist/telemetry/error-codes.js +13 -0
- package/dist/telemetry/errors.cjs +105 -0
- package/dist/telemetry/errors.d.ts +28 -0
- package/dist/telemetry/errors.d.ts.map +1 -0
- package/dist/telemetry/errors.js +82 -0
- package/dist/telemetry/exporters.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/schemas.js +1 -1
- package/dist/telemetry/telemetry.cjs +92 -26
- package/dist/telemetry/telemetry.d.ts +1 -1
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/telemetry/telemetry.js +75 -19
- package/dist/telemetry/utils.js +1 -1
- package/dist/tools/bash-pattern-utils.cjs +91 -0
- package/dist/tools/bash-pattern-utils.d.ts +58 -0
- package/dist/tools/bash-pattern-utils.d.ts.map +1 -0
- package/dist/tools/bash-pattern-utils.js +64 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.js +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.js +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/storage.js +1 -1
- package/dist/tools/display-types.cjs +60 -0
- package/dist/tools/display-types.d.ts +133 -0
- package/dist/tools/display-types.d.ts.map +1 -0
- package/dist/tools/display-types.js +32 -0
- package/dist/tools/error-codes.cjs +2 -0
- package/dist/tools/error-codes.d.ts +3 -1
- package/dist/tools/error-codes.d.ts.map +1 -1
- package/dist/tools/error-codes.js +3 -1
- package/dist/tools/errors.cjs +30 -0
- package/dist/tools/errors.d.ts +16 -0
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +31 -1
- package/dist/tools/index.cjs +2 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/internal-tools/constants.js +1 -1
- package/dist/tools/internal-tools/implementations/ask-user-tool.cjs +1 -1
- package/dist/tools/internal-tools/implementations/ask-user-tool.js +2 -2
- package/dist/tools/internal-tools/implementations/bash-exec-tool.cjs +42 -18
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts +3 -3
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts.map +1 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.js +43 -19
- package/dist/tools/internal-tools/implementations/bash-output-tool.js +1 -1
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.js +1 -1
- package/dist/tools/internal-tools/implementations/edit-file-tool.cjs +66 -1
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts.map +1 -1
- package/dist/tools/internal-tools/implementations/edit-file-tool.js +67 -2
- package/dist/tools/internal-tools/implementations/glob-files-tool.cjs +14 -1
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts.map +1 -1
- package/dist/tools/internal-tools/implementations/glob-files-tool.js +15 -2
- package/dist/tools/internal-tools/implementations/grep-content-tool.cjs +16 -1
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts.map +1 -1
- package/dist/tools/internal-tools/implementations/grep-content-tool.js +17 -2
- package/dist/tools/internal-tools/implementations/kill-process-tool.js +1 -1
- package/dist/tools/internal-tools/implementations/read-file-tool.cjs +9 -1
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts.map +1 -1
- package/dist/tools/internal-tools/implementations/read-file-tool.js +10 -2
- package/dist/tools/internal-tools/implementations/search-history-tool.js +1 -1
- package/dist/tools/internal-tools/implementations/write-file-tool.cjs +69 -1
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts.map +1 -1
- package/dist/tools/internal-tools/implementations/write-file-tool.js +72 -2
- package/dist/tools/internal-tools/provider.cjs +27 -10
- package/dist/tools/internal-tools/provider.d.ts +8 -5
- package/dist/tools/internal-tools/provider.d.ts.map +1 -1
- package/dist/tools/internal-tools/provider.js +28 -11
- package/dist/tools/internal-tools/registry.cjs +4 -3
- package/dist/tools/internal-tools/registry.d.ts +28 -7
- package/dist/tools/internal-tools/registry.d.ts.map +1 -1
- package/dist/tools/internal-tools/registry.js +5 -4
- package/dist/tools/schemas.cjs +17 -7
- package/dist/tools/schemas.d.ts +31 -4
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +15 -7
- package/dist/tools/tool-manager.cjs +140 -18
- package/dist/tools/tool-manager.d.ts +23 -1
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +145 -19
- package/dist/tools/types.d.ts +20 -11
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +1 -1
- package/dist/utils/async-context.js +1 -1
- package/dist/utils/debug.js +1 -1
- package/dist/{llm/tokenizer/types.cjs → utils/defer.cjs} +19 -10
- package/dist/utils/defer.d.ts +63 -0
- package/dist/utils/defer.d.ts.map +1 -0
- package/dist/utils/defer.js +19 -0
- package/dist/utils/env-file.js +1 -1
- package/dist/utils/error-conversion.js +1 -1
- package/dist/utils/execution-context.js +1 -1
- package/dist/utils/fs-walk.js +1 -1
- package/dist/utils/index.cjs +3 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/path.js +1 -1
- package/dist/utils/redactor.js +1 -1
- package/dist/utils/result.js +1 -1
- package/dist/utils/safe-stringify.js +1 -1
- package/dist/utils/schema-metadata.js +1 -1
- package/dist/utils/schema.d.ts +6 -0
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +1 -1
- package/dist/utils/service-initializer.cjs +6 -2
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +7 -3
- package/dist/utils/user-info.js +1 -1
- package/dist/utils/zod-schema-converter.js +1 -1
- package/package.json +54 -17
- package/dist/context/compression/middle-removal.cjs +0 -95
- package/dist/context/compression/middle-removal.d.ts +0 -47
- package/dist/context/compression/middle-removal.d.ts.map +0 -1
- package/dist/context/compression/middle-removal.js +0 -72
- package/dist/context/compression/oldest-removal.cjs +0 -83
- package/dist/context/compression/oldest-removal.d.ts +0 -42
- package/dist/context/compression/oldest-removal.d.ts.map +0 -1
- package/dist/context/compression/oldest-removal.js +0 -60
- package/dist/llm/formatters/anthropic.cjs +0 -257
- package/dist/llm/formatters/anthropic.d.ts +0 -46
- package/dist/llm/formatters/anthropic.d.ts.map +0 -1
- package/dist/llm/formatters/anthropic.js +0 -239
- package/dist/llm/formatters/factory.cjs +0 -50
- package/dist/llm/formatters/factory.d.ts +0 -10
- package/dist/llm/formatters/factory.d.ts.map +0 -1
- package/dist/llm/formatters/factory.js +0 -27
- package/dist/llm/formatters/openai.cjs +0 -196
- package/dist/llm/formatters/openai.d.ts +0 -39
- package/dist/llm/formatters/openai.d.ts.map +0 -1
- package/dist/llm/formatters/openai.js +0 -177
- package/dist/llm/formatters/types.d.ts +0 -41
- package/dist/llm/formatters/types.d.ts.map +0 -1
- package/dist/llm/services/anthropic.cjs +0 -511
- package/dist/llm/services/anthropic.d.ts +0 -48
- package/dist/llm/services/anthropic.d.ts.map +0 -1
- package/dist/llm/services/anthropic.js +0 -447
- package/dist/llm/services/openai.cjs +0 -611
- package/dist/llm/services/openai.d.ts +0 -48
- package/dist/llm/services/openai.d.ts.map +0 -1
- package/dist/llm/services/openai.js +0 -547
- package/dist/llm/tokenizer/anthropic.cjs +0 -43
- package/dist/llm/tokenizer/anthropic.d.ts +0 -19
- package/dist/llm/tokenizer/anthropic.d.ts.map +0 -1
- package/dist/llm/tokenizer/anthropic.js +0 -20
- package/dist/llm/tokenizer/default.d.ts +0 -14
- package/dist/llm/tokenizer/default.d.ts.map +0 -1
- package/dist/llm/tokenizer/default.js +0 -18
- package/dist/llm/tokenizer/factory.d.ts +0 -12
- package/dist/llm/tokenizer/factory.d.ts.map +0 -1
- package/dist/llm/tokenizer/factory.js +0 -21
- package/dist/llm/tokenizer/google.cjs +0 -52
- package/dist/llm/tokenizer/google.d.ts +0 -29
- package/dist/llm/tokenizer/google.d.ts.map +0 -1
- package/dist/llm/tokenizer/google.js +0 -29
- package/dist/llm/tokenizer/openai.cjs +0 -115
- package/dist/llm/tokenizer/openai.d.ts +0 -33
- package/dist/llm/tokenizer/openai.d.ts.map +0 -1
- package/dist/llm/tokenizer/openai.js +0 -91
- package/dist/llm/tokenizer/types.d.ts +0 -18
- package/dist/llm/tokenizer/types.d.ts.map +0 -1
- package/dist/llm/tokenizer/types.js +0 -10
- /package/dist/llm/{formatters → executor}/types.cjs +0 -0
- /package/dist/llm/{formatters → executor}/types.js +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-PTJYTZNU.js";
|
|
2
2
|
var ToolErrorCode = /* @__PURE__ */ ((ToolErrorCode2) => {
|
|
3
3
|
ToolErrorCode2["EXECUTION_DENIED"] = "tools_execution_denied";
|
|
4
4
|
ToolErrorCode2["EXECUTION_TIMEOUT"] = "tools_execution_timeout";
|
|
5
5
|
ToolErrorCode2["EXECUTION_FAILED"] = "tools_execution_failed";
|
|
6
|
+
ToolErrorCode2["VALIDATION_FAILED"] = "tools_validation_failed";
|
|
6
7
|
ToolErrorCode2["CONFIRMATION_HANDLER_MISSING"] = "tools_confirmation_handler_missing";
|
|
7
8
|
ToolErrorCode2["CONFIRMATION_TIMEOUT"] = "tools_confirmation_timeout";
|
|
8
9
|
ToolErrorCode2["CONFIRMATION_CANCELLED"] = "tools_confirmation_cancelled";
|
|
@@ -10,6 +11,7 @@ var ToolErrorCode = /* @__PURE__ */ ((ToolErrorCode2) => {
|
|
|
10
11
|
ToolErrorCode2["TOOL_INVALID_ARGS"] = "tools_invalid_args";
|
|
11
12
|
ToolErrorCode2["TOOL_UNAUTHORIZED"] = "tools_unauthorized";
|
|
12
13
|
ToolErrorCode2["CONFIG_INVALID"] = "tools_config_invalid";
|
|
14
|
+
ToolErrorCode2["FEATURE_DISABLED"] = "tools_feature_disabled";
|
|
13
15
|
return ToolErrorCode2;
|
|
14
16
|
})(ToolErrorCode || {});
|
|
15
17
|
export {
|
package/dist/tools/errors.cjs
CHANGED
|
@@ -74,6 +74,20 @@ class ToolError {
|
|
|
74
74
|
{ toolName, timeoutMs, sessionId }
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Tool validation failed (pre-execution check)
|
|
79
|
+
* Used when tool inputs are semantically invalid (e.g., file not found, string not in file)
|
|
80
|
+
* This should fail before approval, not after.
|
|
81
|
+
*/
|
|
82
|
+
static validationFailed(toolName, reason, context) {
|
|
83
|
+
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
84
|
+
import_error_codes.ToolErrorCode.VALIDATION_FAILED,
|
|
85
|
+
import_types.ErrorScope.TOOLS,
|
|
86
|
+
import_types.ErrorType.USER,
|
|
87
|
+
`Tool '${toolName}' validation failed: ${reason}`,
|
|
88
|
+
{ toolName, reason, ...context }
|
|
89
|
+
);
|
|
90
|
+
}
|
|
77
91
|
/**
|
|
78
92
|
* Tool unauthorized access
|
|
79
93
|
*/
|
|
@@ -158,6 +172,22 @@ class ToolError {
|
|
|
158
172
|
{ toolName, reason }
|
|
159
173
|
);
|
|
160
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Tool requires features which are currently disabled
|
|
177
|
+
*/
|
|
178
|
+
static featureDisabled(toolName, missingFeatures, message) {
|
|
179
|
+
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
180
|
+
import_error_codes.ToolErrorCode.FEATURE_DISABLED,
|
|
181
|
+
import_types.ErrorScope.TOOLS,
|
|
182
|
+
import_types.ErrorType.USER,
|
|
183
|
+
message,
|
|
184
|
+
{ toolName, missingFeatures },
|
|
185
|
+
[
|
|
186
|
+
`Remove '${toolName}' from internalTools in your agent config`,
|
|
187
|
+
`Or enable required features: ${missingFeatures.map((f) => `${f}.enabled: true`).join(", ")}`
|
|
188
|
+
]
|
|
189
|
+
);
|
|
190
|
+
}
|
|
161
191
|
}
|
|
162
192
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
193
|
0 && (module.exports = {
|
package/dist/tools/errors.d.ts
CHANGED
|
@@ -33,6 +33,15 @@ export declare class ToolError {
|
|
|
33
33
|
timeoutMs: number;
|
|
34
34
|
sessionId: string | undefined;
|
|
35
35
|
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Tool validation failed (pre-execution check)
|
|
38
|
+
* Used when tool inputs are semantically invalid (e.g., file not found, string not in file)
|
|
39
|
+
* This should fail before approval, not after.
|
|
40
|
+
*/
|
|
41
|
+
static validationFailed(toolName: string, reason: string, context?: Record<string, unknown>): DextoRuntimeError<{
|
|
42
|
+
toolName: string;
|
|
43
|
+
reason: string;
|
|
44
|
+
}>;
|
|
36
45
|
/**
|
|
37
46
|
* Tool unauthorized access
|
|
38
47
|
*/
|
|
@@ -78,5 +87,12 @@ export declare class ToolError {
|
|
|
78
87
|
toolName: string;
|
|
79
88
|
reason: string;
|
|
80
89
|
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Tool requires features which are currently disabled
|
|
92
|
+
*/
|
|
93
|
+
static featureDisabled(toolName: string, missingFeatures: string[], message: string): DextoRuntimeError<{
|
|
94
|
+
toolName: string;
|
|
95
|
+
missingFeatures: string[];
|
|
96
|
+
}>;
|
|
81
97
|
}
|
|
82
98
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/tools/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAItE;;;GAGG;AACH,qBAAa,SAAS;IAClB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM;;;IAUhC;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;;IAU3E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;IAU3D;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;;IAc/E;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;IAUxD;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAAC,QAAQ,EAAE,MAAM;;;IAUlD;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;;IAUlF;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;IAUnD;;OAEG;IACH,MAAM,CAAC,2BAA2B,CAAC,QAAQ,EAAE,MAAM;;;IAUnD;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM;IAUpC;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/tools/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAItE;;;GAGG;AACH,qBAAa,SAAS;IAClB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM;;;IAUhC;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;;IAU3E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;IAU3D;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;;IAc/E;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAU3F;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;IAUxD;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAAC,QAAQ,EAAE,MAAM;;;IAUlD;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;;IAUlF;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;IAUnD;;OAEG;IACH,MAAM,CAAC,2BAA2B,CAAC,QAAQ,EAAE,MAAM;;;IAUnD;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM;IAUpC;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;IAU7D;;OAEG;IACH,MAAM,CAAC,eAAe,CAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EAAE,EACzB,OAAO,EAAE,MAAM,GAChB,iBAAiB,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAaxE"}
|
package/dist/tools/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-PTJYTZNU.js";
|
|
2
2
|
import { DextoRuntimeError } from "../errors/DextoRuntimeError.js";
|
|
3
3
|
import { ErrorScope, ErrorType } from "../errors/types.js";
|
|
4
4
|
import { ToolErrorCode } from "./error-codes.js";
|
|
@@ -52,6 +52,20 @@ class ToolError {
|
|
|
52
52
|
{ toolName, timeoutMs, sessionId }
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Tool validation failed (pre-execution check)
|
|
57
|
+
* Used when tool inputs are semantically invalid (e.g., file not found, string not in file)
|
|
58
|
+
* This should fail before approval, not after.
|
|
59
|
+
*/
|
|
60
|
+
static validationFailed(toolName, reason, context) {
|
|
61
|
+
return new DextoRuntimeError(
|
|
62
|
+
ToolErrorCode.VALIDATION_FAILED,
|
|
63
|
+
ErrorScope.TOOLS,
|
|
64
|
+
ErrorType.USER,
|
|
65
|
+
`Tool '${toolName}' validation failed: ${reason}`,
|
|
66
|
+
{ toolName, reason, ...context }
|
|
67
|
+
);
|
|
68
|
+
}
|
|
55
69
|
/**
|
|
56
70
|
* Tool unauthorized access
|
|
57
71
|
*/
|
|
@@ -136,6 +150,22 @@ class ToolError {
|
|
|
136
150
|
{ toolName, reason }
|
|
137
151
|
);
|
|
138
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Tool requires features which are currently disabled
|
|
155
|
+
*/
|
|
156
|
+
static featureDisabled(toolName, missingFeatures, message) {
|
|
157
|
+
return new DextoRuntimeError(
|
|
158
|
+
ToolErrorCode.FEATURE_DISABLED,
|
|
159
|
+
ErrorScope.TOOLS,
|
|
160
|
+
ErrorType.USER,
|
|
161
|
+
message,
|
|
162
|
+
{ toolName, missingFeatures },
|
|
163
|
+
[
|
|
164
|
+
`Remove '${toolName}' from internalTools in your agent config`,
|
|
165
|
+
`Or enable required features: ${missingFeatures.map((f) => `${f}.enabled: true`).join(", ")}`
|
|
166
|
+
]
|
|
167
|
+
);
|
|
168
|
+
}
|
|
139
169
|
}
|
|
140
170
|
export {
|
|
141
171
|
ToolError
|
package/dist/tools/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ __export(tools_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(tools_exports);
|
|
25
25
|
__reExport(tools_exports, require("./types.js"), module.exports);
|
|
26
|
+
__reExport(tools_exports, require("./display-types.js"), module.exports);
|
|
26
27
|
__reExport(tools_exports, require("./internal-tools/index.js"), module.exports);
|
|
27
28
|
__reExport(tools_exports, require("./schemas.js"), module.exports);
|
|
28
29
|
var import_tool_manager = require("./tool-manager.js");
|
|
@@ -30,6 +31,7 @@ var import_tool_manager = require("./tool-manager.js");
|
|
|
30
31
|
0 && (module.exports = {
|
|
31
32
|
ToolManager,
|
|
32
33
|
...require("./types.js"),
|
|
34
|
+
...require("./display-types.js"),
|
|
33
35
|
...require("./internal-tools/index.js"),
|
|
34
36
|
...require("./schemas.js")
|
|
35
37
|
});
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,2BAA2B,CAAC;AAG1C,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -29,7 +29,7 @@ const AskUserInputSchema = import_zod.z.object({
|
|
|
29
29
|
properties: import_zod.z.record(import_zod.z.unknown()),
|
|
30
30
|
required: import_zod.z.array(import_zod.z.string()).optional()
|
|
31
31
|
}).passthrough().describe(
|
|
32
|
-
'JSON Schema defining
|
|
32
|
+
'JSON Schema defining form fields. Use descriptive property names as labels (e.g., "favorite_team", "World Cup winner country") - NOT generic names like "q1". Use "enum" for dropdowns, "boolean" for yes/no, "number" for numeric inputs, "string" for text. Include "required" array for mandatory fields.'
|
|
33
33
|
)
|
|
34
34
|
}).strict();
|
|
35
35
|
function createAskUserTool(approvalManager) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../../chunk-
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
const AskUserInputSchema = z.object({
|
|
4
4
|
question: z.string().describe("The question or prompt to display to the user"),
|
|
@@ -7,7 +7,7 @@ const AskUserInputSchema = z.object({
|
|
|
7
7
|
properties: z.record(z.unknown()),
|
|
8
8
|
required: z.array(z.string()).optional()
|
|
9
9
|
}).passthrough().describe(
|
|
10
|
-
'JSON Schema defining
|
|
10
|
+
'JSON Schema defining form fields. Use descriptive property names as labels (e.g., "favorite_team", "World Cup winner country") - NOT generic names like "q1". Use "enum" for dropdowns, "boolean" for yes/no, "number" for numeric inputs, "string" for text. Include "required" array for mandatory fields.'
|
|
11
11
|
)
|
|
12
12
|
}).strict();
|
|
13
13
|
function createAskUserTool(approvalManager) {
|
|
@@ -33,7 +33,6 @@ __export(bash_exec_tool_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(bash_exec_tool_exports);
|
|
34
34
|
var path = __toESM(require("node:path"), 1);
|
|
35
35
|
var import_zod = require("zod");
|
|
36
|
-
var import_types2 = require("../../../approval/types.js");
|
|
37
36
|
var import_errors = require("../../../process/errors.js");
|
|
38
37
|
const BashExecInputSchema = import_zod.z.object({
|
|
39
38
|
command: import_zod.z.string().describe("Shell command to execute"),
|
|
@@ -44,11 +43,27 @@ const BashExecInputSchema = import_zod.z.object({
|
|
|
44
43
|
run_in_background: import_zod.z.boolean().optional().default(false).describe("Execute command in background (default: false)"),
|
|
45
44
|
cwd: import_zod.z.string().optional().describe("Working directory for command execution (optional)")
|
|
46
45
|
}).strict();
|
|
47
|
-
function createBashExecTool(processService
|
|
46
|
+
function createBashExecTool(processService) {
|
|
48
47
|
return {
|
|
49
48
|
id: "bash_exec",
|
|
50
|
-
description: "Execute a shell command with 2-minute default timeout. Returns stdout, stderr, exit code, and duration. For long-running commands (servers, watchers, npm run dev), MUST use run_in_background=true (use bash_output to retrieve results later). Commands ending with & are blocked - use run_in_background instead. Requires approval
|
|
49
|
+
description: "Execute a shell command with 2-minute default timeout. Returns stdout, stderr, exit code, and duration. For long-running commands (servers, watchers, npm run dev), MUST use run_in_background=true (use bash_output to retrieve results later). Commands ending with & are blocked - use run_in_background instead. Requires approval (with pattern-based session memory). Always quote file paths with spaces. Security: dangerous commands are blocked, injection attempts are detected.",
|
|
51
50
|
inputSchema: BashExecInputSchema,
|
|
51
|
+
/**
|
|
52
|
+
* Generate preview for approval UI - shows the command to be executed
|
|
53
|
+
*/
|
|
54
|
+
generatePreview: async (input, _context) => {
|
|
55
|
+
const { command, run_in_background } = input;
|
|
56
|
+
const preview = {
|
|
57
|
+
type: "shell",
|
|
58
|
+
command,
|
|
59
|
+
exitCode: 0,
|
|
60
|
+
// Placeholder - not executed yet
|
|
61
|
+
duration: 0,
|
|
62
|
+
// Placeholder - not executed yet
|
|
63
|
+
...run_in_background !== void 0 && { isBackground: run_in_background }
|
|
64
|
+
};
|
|
65
|
+
return preview;
|
|
66
|
+
},
|
|
52
67
|
execute: async (input, context) => {
|
|
53
68
|
const { command, description, timeout, run_in_background, cwd } = input;
|
|
54
69
|
let validatedCwd = cwd;
|
|
@@ -70,31 +85,40 @@ function createBashExecTool(processService, approvalManager) {
|
|
|
70
85
|
timeout,
|
|
71
86
|
runInBackground: run_in_background,
|
|
72
87
|
cwd: validatedCwd,
|
|
73
|
-
//
|
|
74
|
-
|
|
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
|
-
}
|
|
88
|
+
// Pass abort signal for cancellation support
|
|
89
|
+
abortSignal: context?.abortSignal
|
|
86
90
|
});
|
|
87
91
|
if ("stdout" in result) {
|
|
92
|
+
const _display = {
|
|
93
|
+
type: "shell",
|
|
94
|
+
command,
|
|
95
|
+
exitCode: result.exitCode,
|
|
96
|
+
duration: result.duration,
|
|
97
|
+
isBackground: false,
|
|
98
|
+
stdout: result.stdout,
|
|
99
|
+
stderr: result.stderr
|
|
100
|
+
};
|
|
88
101
|
return {
|
|
89
102
|
stdout: result.stdout,
|
|
90
103
|
stderr: result.stderr,
|
|
91
104
|
exit_code: result.exitCode,
|
|
92
|
-
duration: result.duration
|
|
105
|
+
duration: result.duration,
|
|
106
|
+
_display
|
|
93
107
|
};
|
|
94
108
|
} else {
|
|
109
|
+
const _display = {
|
|
110
|
+
type: "shell",
|
|
111
|
+
command,
|
|
112
|
+
exitCode: 0,
|
|
113
|
+
// Background process hasn't exited yet
|
|
114
|
+
duration: 0,
|
|
115
|
+
// Still running
|
|
116
|
+
isBackground: true
|
|
117
|
+
};
|
|
95
118
|
return {
|
|
96
119
|
process_id: result.processId,
|
|
97
|
-
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output
|
|
120
|
+
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output.`,
|
|
121
|
+
_display
|
|
98
122
|
};
|
|
99
123
|
}
|
|
100
124
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bash Execute Tool
|
|
3
3
|
*
|
|
4
|
-
* Internal tool for executing shell commands
|
|
4
|
+
* Internal tool for executing shell commands.
|
|
5
|
+
* Approval is handled at the ToolManager level with pattern-based approval.
|
|
5
6
|
*/
|
|
6
7
|
import { InternalTool } from '../../types.js';
|
|
7
8
|
import { ProcessService } from '../../../process/index.js';
|
|
8
|
-
import type { ApprovalManager } from '../../../approval/manager.js';
|
|
9
9
|
/**
|
|
10
10
|
* Create the bash_exec internal tool
|
|
11
11
|
*/
|
|
12
|
-
export declare function createBashExecTool(processService: ProcessService
|
|
12
|
+
export declare function createBashExecTool(processService: ProcessService): InternalTool;
|
|
13
13
|
//# sourceMappingURL=bash-exec-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-exec-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/bash-exec-tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bash-exec-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/bash-exec-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAgC3D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,cAAc,GAAG,YAAY,CAuG/E"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import "../../../chunk-
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { ApprovalStatus } from "../../../approval/types.js";
|
|
5
4
|
import { ProcessError } from "../../../process/errors.js";
|
|
6
5
|
const BashExecInputSchema = z.object({
|
|
7
6
|
command: z.string().describe("Shell command to execute"),
|
|
@@ -12,11 +11,27 @@ const BashExecInputSchema = z.object({
|
|
|
12
11
|
run_in_background: z.boolean().optional().default(false).describe("Execute command in background (default: false)"),
|
|
13
12
|
cwd: z.string().optional().describe("Working directory for command execution (optional)")
|
|
14
13
|
}).strict();
|
|
15
|
-
function createBashExecTool(processService
|
|
14
|
+
function createBashExecTool(processService) {
|
|
16
15
|
return {
|
|
17
16
|
id: "bash_exec",
|
|
18
|
-
description: "Execute a shell command with 2-minute default timeout. Returns stdout, stderr, exit code, and duration. For long-running commands (servers, watchers, npm run dev), MUST use run_in_background=true (use bash_output to retrieve results later). Commands ending with & are blocked - use run_in_background instead. Requires approval
|
|
17
|
+
description: "Execute a shell command with 2-minute default timeout. Returns stdout, stderr, exit code, and duration. For long-running commands (servers, watchers, npm run dev), MUST use run_in_background=true (use bash_output to retrieve results later). Commands ending with & are blocked - use run_in_background instead. Requires approval (with pattern-based session memory). Always quote file paths with spaces. Security: dangerous commands are blocked, injection attempts are detected.",
|
|
19
18
|
inputSchema: BashExecInputSchema,
|
|
19
|
+
/**
|
|
20
|
+
* Generate preview for approval UI - shows the command to be executed
|
|
21
|
+
*/
|
|
22
|
+
generatePreview: async (input, _context) => {
|
|
23
|
+
const { command, run_in_background } = input;
|
|
24
|
+
const preview = {
|
|
25
|
+
type: "shell",
|
|
26
|
+
command,
|
|
27
|
+
exitCode: 0,
|
|
28
|
+
// Placeholder - not executed yet
|
|
29
|
+
duration: 0,
|
|
30
|
+
// Placeholder - not executed yet
|
|
31
|
+
...run_in_background !== void 0 && { isBackground: run_in_background }
|
|
32
|
+
};
|
|
33
|
+
return preview;
|
|
34
|
+
},
|
|
20
35
|
execute: async (input, context) => {
|
|
21
36
|
const { command, description, timeout, run_in_background, cwd } = input;
|
|
22
37
|
let validatedCwd = cwd;
|
|
@@ -38,31 +53,40 @@ function createBashExecTool(processService, approvalManager) {
|
|
|
38
53
|
timeout,
|
|
39
54
|
runInBackground: run_in_background,
|
|
40
55
|
cwd: validatedCwd,
|
|
41
|
-
//
|
|
42
|
-
|
|
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
|
-
}
|
|
56
|
+
// Pass abort signal for cancellation support
|
|
57
|
+
abortSignal: context?.abortSignal
|
|
54
58
|
});
|
|
55
59
|
if ("stdout" in result) {
|
|
60
|
+
const _display = {
|
|
61
|
+
type: "shell",
|
|
62
|
+
command,
|
|
63
|
+
exitCode: result.exitCode,
|
|
64
|
+
duration: result.duration,
|
|
65
|
+
isBackground: false,
|
|
66
|
+
stdout: result.stdout,
|
|
67
|
+
stderr: result.stderr
|
|
68
|
+
};
|
|
56
69
|
return {
|
|
57
70
|
stdout: result.stdout,
|
|
58
71
|
stderr: result.stderr,
|
|
59
72
|
exit_code: result.exitCode,
|
|
60
|
-
duration: result.duration
|
|
73
|
+
duration: result.duration,
|
|
74
|
+
_display
|
|
61
75
|
};
|
|
62
76
|
} else {
|
|
77
|
+
const _display = {
|
|
78
|
+
type: "shell",
|
|
79
|
+
command,
|
|
80
|
+
exitCode: 0,
|
|
81
|
+
// Background process hasn't exited yet
|
|
82
|
+
duration: 0,
|
|
83
|
+
// Still running
|
|
84
|
+
isBackground: true
|
|
85
|
+
};
|
|
63
86
|
return {
|
|
64
87
|
process_id: result.processId,
|
|
65
|
-
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output
|
|
88
|
+
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output.`,
|
|
89
|
+
_display
|
|
66
90
|
};
|
|
67
91
|
}
|
|
68
92
|
}
|
|
@@ -22,19 +22,80 @@ __export(edit_file_tool_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(edit_file_tool_exports);
|
|
24
24
|
var import_zod = require("zod");
|
|
25
|
+
var import_diff = require("diff");
|
|
26
|
+
var import_errors = require("../../errors.js");
|
|
27
|
+
var import_error_codes = require("../../error-codes.js");
|
|
28
|
+
var import_errors2 = require("../../../errors/index.js");
|
|
25
29
|
const EditFileInputSchema = import_zod.z.object({
|
|
26
30
|
file_path: import_zod.z.string().describe("Absolute path to the file to edit"),
|
|
27
31
|
old_string: import_zod.z.string().describe("Text to replace (must be unique unless replace_all is true)"),
|
|
28
32
|
new_string: import_zod.z.string().describe("Replacement text"),
|
|
29
33
|
replace_all: import_zod.z.boolean().optional().default(false).describe("Replace all occurrences (default: false, requires unique match)")
|
|
30
34
|
}).strict();
|
|
35
|
+
function generateDiffPreview(filePath, originalContent, newContent) {
|
|
36
|
+
const unified = (0, import_diff.createPatch)(filePath, originalContent, newContent, "before", "after", {
|
|
37
|
+
context: 3
|
|
38
|
+
});
|
|
39
|
+
const additions = (unified.match(/^\+[^+]/gm) || []).length;
|
|
40
|
+
const deletions = (unified.match(/^-[^-]/gm) || []).length;
|
|
41
|
+
return {
|
|
42
|
+
type: "diff",
|
|
43
|
+
unified,
|
|
44
|
+
filename: filePath,
|
|
45
|
+
additions,
|
|
46
|
+
deletions
|
|
47
|
+
};
|
|
48
|
+
}
|
|
31
49
|
function createEditFileTool(fileSystemService) {
|
|
32
50
|
return {
|
|
33
51
|
id: "edit_file",
|
|
34
52
|
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
53
|
inputSchema: EditFileInputSchema,
|
|
54
|
+
/**
|
|
55
|
+
* Generate preview for approval UI - shows diff without modifying file
|
|
56
|
+
* Throws ToolError.validationFailed() for validation errors (file not found, string not found)
|
|
57
|
+
*/
|
|
58
|
+
generatePreview: async (input, _context) => {
|
|
59
|
+
const { file_path, old_string, new_string, replace_all } = input;
|
|
60
|
+
try {
|
|
61
|
+
const originalFile = await fileSystemService.readFile(file_path);
|
|
62
|
+
const originalContent = originalFile.content;
|
|
63
|
+
if (!replace_all) {
|
|
64
|
+
const occurrences = originalContent.split(old_string).length - 1;
|
|
65
|
+
if (occurrences > 1) {
|
|
66
|
+
throw import_errors.ToolError.validationFailed(
|
|
67
|
+
"edit_file",
|
|
68
|
+
`String found ${occurrences} times in file. Set replace_all=true to replace all, or provide more context to make old_string unique.`,
|
|
69
|
+
{ file_path, occurrences }
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const newContent = replace_all ? originalContent.split(old_string).join(new_string) : originalContent.replace(old_string, new_string);
|
|
74
|
+
if (originalContent === newContent) {
|
|
75
|
+
throw import_errors.ToolError.validationFailed(
|
|
76
|
+
"edit_file",
|
|
77
|
+
`String not found in file: "${old_string.slice(0, 50)}${old_string.length > 50 ? "..." : ""}"`,
|
|
78
|
+
{ file_path, old_string_preview: old_string.slice(0, 100) }
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return generateDiffPreview(file_path, originalContent, newContent);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if (error instanceof import_errors2.DextoRuntimeError && error.code === import_error_codes.ToolErrorCode.VALIDATION_FAILED) {
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
if (error instanceof import_errors2.DextoRuntimeError) {
|
|
87
|
+
throw import_errors.ToolError.validationFailed("edit_file", error.message, {
|
|
88
|
+
file_path,
|
|
89
|
+
originalErrorCode: error.code
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
36
95
|
execute: async (input, _context) => {
|
|
37
96
|
const { file_path, old_string, new_string, replace_all } = input;
|
|
97
|
+
const originalFile = await fileSystemService.readFile(file_path);
|
|
98
|
+
const originalContent = originalFile.content;
|
|
38
99
|
const result = await fileSystemService.editFile(
|
|
39
100
|
file_path,
|
|
40
101
|
{
|
|
@@ -47,11 +108,15 @@ function createEditFileTool(fileSystemService) {
|
|
|
47
108
|
// Always create backup for internal tools
|
|
48
109
|
}
|
|
49
110
|
);
|
|
111
|
+
const newFile = await fileSystemService.readFile(file_path);
|
|
112
|
+
const newContent = newFile.content;
|
|
113
|
+
const _display = generateDiffPreview(file_path, originalContent, newContent);
|
|
50
114
|
return {
|
|
51
115
|
success: result.success,
|
|
52
116
|
path: result.path,
|
|
53
117
|
changes_count: result.changesCount,
|
|
54
|
-
...result.backupPath && { backup_path: result.backupPath }
|
|
118
|
+
...result.backupPath && { backup_path: result.backupPath },
|
|
119
|
+
_display
|
|
55
120
|
};
|
|
56
121
|
}
|
|
57
122
|
};
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"edit-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/edit-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA8CjE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAuGrF"}
|
|
@@ -1,18 +1,79 @@
|
|
|
1
|
-
import "../../../chunk-
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { createPatch } from "diff";
|
|
4
|
+
import { ToolError } from "../../errors.js";
|
|
5
|
+
import { ToolErrorCode } from "../../error-codes.js";
|
|
6
|
+
import { DextoRuntimeError } from "../../../errors/index.js";
|
|
3
7
|
const EditFileInputSchema = z.object({
|
|
4
8
|
file_path: z.string().describe("Absolute path to the file to edit"),
|
|
5
9
|
old_string: z.string().describe("Text to replace (must be unique unless replace_all is true)"),
|
|
6
10
|
new_string: z.string().describe("Replacement text"),
|
|
7
11
|
replace_all: z.boolean().optional().default(false).describe("Replace all occurrences (default: false, requires unique match)")
|
|
8
12
|
}).strict();
|
|
13
|
+
function generateDiffPreview(filePath, originalContent, newContent) {
|
|
14
|
+
const unified = createPatch(filePath, originalContent, newContent, "before", "after", {
|
|
15
|
+
context: 3
|
|
16
|
+
});
|
|
17
|
+
const additions = (unified.match(/^\+[^+]/gm) || []).length;
|
|
18
|
+
const deletions = (unified.match(/^-[^-]/gm) || []).length;
|
|
19
|
+
return {
|
|
20
|
+
type: "diff",
|
|
21
|
+
unified,
|
|
22
|
+
filename: filePath,
|
|
23
|
+
additions,
|
|
24
|
+
deletions
|
|
25
|
+
};
|
|
26
|
+
}
|
|
9
27
|
function createEditFileTool(fileSystemService) {
|
|
10
28
|
return {
|
|
11
29
|
id: "edit_file",
|
|
12
30
|
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
31
|
inputSchema: EditFileInputSchema,
|
|
32
|
+
/**
|
|
33
|
+
* Generate preview for approval UI - shows diff without modifying file
|
|
34
|
+
* Throws ToolError.validationFailed() for validation errors (file not found, string not found)
|
|
35
|
+
*/
|
|
36
|
+
generatePreview: async (input, _context) => {
|
|
37
|
+
const { file_path, old_string, new_string, replace_all } = input;
|
|
38
|
+
try {
|
|
39
|
+
const originalFile = await fileSystemService.readFile(file_path);
|
|
40
|
+
const originalContent = originalFile.content;
|
|
41
|
+
if (!replace_all) {
|
|
42
|
+
const occurrences = originalContent.split(old_string).length - 1;
|
|
43
|
+
if (occurrences > 1) {
|
|
44
|
+
throw ToolError.validationFailed(
|
|
45
|
+
"edit_file",
|
|
46
|
+
`String found ${occurrences} times in file. Set replace_all=true to replace all, or provide more context to make old_string unique.`,
|
|
47
|
+
{ file_path, occurrences }
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const newContent = replace_all ? originalContent.split(old_string).join(new_string) : originalContent.replace(old_string, new_string);
|
|
52
|
+
if (originalContent === newContent) {
|
|
53
|
+
throw ToolError.validationFailed(
|
|
54
|
+
"edit_file",
|
|
55
|
+
`String not found in file: "${old_string.slice(0, 50)}${old_string.length > 50 ? "..." : ""}"`,
|
|
56
|
+
{ file_path, old_string_preview: old_string.slice(0, 100) }
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return generateDiffPreview(file_path, originalContent, newContent);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (error instanceof DextoRuntimeError && error.code === ToolErrorCode.VALIDATION_FAILED) {
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
if (error instanceof DextoRuntimeError) {
|
|
65
|
+
throw ToolError.validationFailed("edit_file", error.message, {
|
|
66
|
+
file_path,
|
|
67
|
+
originalErrorCode: error.code
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
14
73
|
execute: async (input, _context) => {
|
|
15
74
|
const { file_path, old_string, new_string, replace_all } = input;
|
|
75
|
+
const originalFile = await fileSystemService.readFile(file_path);
|
|
76
|
+
const originalContent = originalFile.content;
|
|
16
77
|
const result = await fileSystemService.editFile(
|
|
17
78
|
file_path,
|
|
18
79
|
{
|
|
@@ -25,11 +86,15 @@ function createEditFileTool(fileSystemService) {
|
|
|
25
86
|
// Always create backup for internal tools
|
|
26
87
|
}
|
|
27
88
|
);
|
|
89
|
+
const newFile = await fileSystemService.readFile(file_path);
|
|
90
|
+
const newContent = newFile.content;
|
|
91
|
+
const _display = generateDiffPreview(file_path, originalContent, newContent);
|
|
28
92
|
return {
|
|
29
93
|
success: result.success,
|
|
30
94
|
path: result.path,
|
|
31
95
|
changes_count: result.changesCount,
|
|
32
|
-
...result.backupPath && { backup_path: result.backupPath }
|
|
96
|
+
...result.backupPath && { backup_path: result.backupPath },
|
|
97
|
+
_display
|
|
33
98
|
};
|
|
34
99
|
}
|
|
35
100
|
};
|