@dexto/core 1.3.0 → 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 +17 -9
- package/dist/agent/DextoAgent.cjs +548 -207
- package/dist/agent/DextoAgent.d.ts +156 -33
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +545 -204
- 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 +3 -0
- package/dist/agent/schemas.d.ts +92 -55
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +6 -2
- 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 -10
- 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 +18 -4
- package/dist/approval/schemas.d.ts +106 -32
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +19 -5
- 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/default.cjs → context/compression/overflow.cjs} +20 -18
- 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 +280 -323
- package/dist/context/manager.d.ts +65 -111
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +280 -328
- package/dist/context/media-helpers.js +1 -1
- package/dist/context/types.cjs +49 -0
- package/dist/context/types.d.ts +181 -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.js +1 -1
- package/dist/events/index.cjs +18 -1
- package/dist/events/index.d.ts +149 -12
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +19 -2
- 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.js +1 -1
- 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.js +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/loader.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/dist/storage/error-codes.js +1 -1
- package/dist/storage/errors.js +1 -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/telemetry/error-codes.js +1 -1
- package/dist/telemetry/errors.js +1 -1
- 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.js +1 -1
- 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 +16 -6
- package/dist/tools/schemas.d.ts +31 -4
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +14 -6
- 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 -0
- 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.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 +6 -7
- 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 -203
- 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 -184
- 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.cjs +0 -44
- 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 -41
- 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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var bash_pattern_utils_exports = {};
|
|
20
|
+
__export(bash_pattern_utils_exports, {
|
|
21
|
+
DANGEROUS_COMMAND_PREFIXES: () => DANGEROUS_COMMAND_PREFIXES,
|
|
22
|
+
generateBashPatternKey: () => generateBashPatternKey,
|
|
23
|
+
generateBashPatternSuggestions: () => generateBashPatternSuggestions,
|
|
24
|
+
isDangerousCommand: () => isDangerousCommand,
|
|
25
|
+
patternCovers: () => patternCovers
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(bash_pattern_utils_exports);
|
|
28
|
+
function patternCovers(storedPattern, targetPatternKey) {
|
|
29
|
+
if (storedPattern === targetPatternKey) return true;
|
|
30
|
+
const storedBase = storedPattern.endsWith(" *") ? storedPattern.slice(0, -2) : storedPattern;
|
|
31
|
+
const targetBase = targetPatternKey.endsWith(" *") ? targetPatternKey.slice(0, -2) : targetPatternKey;
|
|
32
|
+
return targetBase.startsWith(storedBase + " ");
|
|
33
|
+
}
|
|
34
|
+
const DANGEROUS_COMMAND_PREFIXES = [
|
|
35
|
+
"rm",
|
|
36
|
+
"chmod",
|
|
37
|
+
"chown",
|
|
38
|
+
"chgrp",
|
|
39
|
+
"sudo",
|
|
40
|
+
"su",
|
|
41
|
+
"dd",
|
|
42
|
+
"mkfs",
|
|
43
|
+
"fdisk",
|
|
44
|
+
"parted",
|
|
45
|
+
"kill",
|
|
46
|
+
"killall",
|
|
47
|
+
"pkill",
|
|
48
|
+
"shutdown",
|
|
49
|
+
"reboot",
|
|
50
|
+
"halt",
|
|
51
|
+
"poweroff"
|
|
52
|
+
];
|
|
53
|
+
function isDangerousCommand(command) {
|
|
54
|
+
const tokens = command.trim().split(/\s+/);
|
|
55
|
+
if (tokens.length === 0 || !tokens[0]) return false;
|
|
56
|
+
const head = tokens[0].toLowerCase();
|
|
57
|
+
return DANGEROUS_COMMAND_PREFIXES.includes(head);
|
|
58
|
+
}
|
|
59
|
+
function generateBashPatternKey(command) {
|
|
60
|
+
const tokens = command.trim().split(/\s+/);
|
|
61
|
+
if (tokens.length === 0 || !tokens[0]) return null;
|
|
62
|
+
const head = tokens[0];
|
|
63
|
+
if (isDangerousCommand(command)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const subcommand = tokens.slice(1).find((arg) => !arg.startsWith("-"));
|
|
67
|
+
return subcommand ? `${head} ${subcommand} *` : `${head} *`;
|
|
68
|
+
}
|
|
69
|
+
function generateBashPatternSuggestions(command) {
|
|
70
|
+
const tokens = command.trim().split(/\s+/);
|
|
71
|
+
if (tokens.length === 0 || !tokens[0]) return [];
|
|
72
|
+
const head = tokens[0];
|
|
73
|
+
if (isDangerousCommand(command)) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const patterns = [];
|
|
77
|
+
const nonFlagArgs = tokens.slice(1).filter((arg) => !arg.startsWith("-"));
|
|
78
|
+
if (nonFlagArgs.length > 0) {
|
|
79
|
+
patterns.push(`${head} ${nonFlagArgs[0]} *`);
|
|
80
|
+
}
|
|
81
|
+
patterns.push(`${head} *`);
|
|
82
|
+
return patterns;
|
|
83
|
+
}
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
DANGEROUS_COMMAND_PREFIXES,
|
|
87
|
+
generateBashPatternKey,
|
|
88
|
+
generateBashPatternSuggestions,
|
|
89
|
+
isDangerousCommand,
|
|
90
|
+
patternCovers
|
|
91
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for bash command pattern generation and matching.
|
|
3
|
+
*
|
|
4
|
+
* Pattern-based approval allows users to approve command patterns like "git *"
|
|
5
|
+
* that automatically cover future matching commands (e.g., "git status", "git push").
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if a stored pattern covers a target pattern key.
|
|
9
|
+
* Pattern A covers pattern B if:
|
|
10
|
+
* 1. A == B (exact match), OR
|
|
11
|
+
* 2. B's base starts with A's base + " " (broader pattern covers narrower)
|
|
12
|
+
*
|
|
13
|
+
* Examples:
|
|
14
|
+
* - `git *` covers `git push *`: base `git` is prefix of base `git push`
|
|
15
|
+
* - `ls *` covers `ls *`: exact match
|
|
16
|
+
* - `npm *` does NOT cover `npx *`: `npx` doesn't start with `npm `
|
|
17
|
+
*
|
|
18
|
+
* @param storedPattern The approved pattern (e.g., "git *")
|
|
19
|
+
* @param targetPatternKey The pattern key to check (e.g., "git push *")
|
|
20
|
+
* @returns true if storedPattern covers targetPatternKey
|
|
21
|
+
*/
|
|
22
|
+
export declare function patternCovers(storedPattern: string, targetPatternKey: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Commands that should never get auto-approve pattern suggestions.
|
|
25
|
+
* These require explicit approval each time for safety.
|
|
26
|
+
*/
|
|
27
|
+
export declare const DANGEROUS_COMMAND_PREFIXES: readonly ["rm", "chmod", "chown", "chgrp", "sudo", "su", "dd", "mkfs", "fdisk", "parted", "kill", "killall", "pkill", "shutdown", "reboot", "halt", "poweroff"];
|
|
28
|
+
/**
|
|
29
|
+
* Check if a command prefix is dangerous (should not get pattern suggestions).
|
|
30
|
+
*/
|
|
31
|
+
export declare function isDangerousCommand(command: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Generate the pattern key for a bash command.
|
|
34
|
+
* This is what gets stored when user approves, and what gets checked against approved patterns.
|
|
35
|
+
*
|
|
36
|
+
* Examples:
|
|
37
|
+
* - "ls -la" → "ls *" (flags don't count as subcommand)
|
|
38
|
+
* - "git push origin" → "git push *" (first non-flag arg is subcommand)
|
|
39
|
+
* - "git status" → "git status *"
|
|
40
|
+
* - "rm -rf /" → null (dangerous command)
|
|
41
|
+
*
|
|
42
|
+
* @param command The bash command to generate a pattern key for
|
|
43
|
+
* @returns The pattern key, or null if the command is dangerous
|
|
44
|
+
*/
|
|
45
|
+
export declare function generateBashPatternKey(command: string): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Generate suggested patterns for UI selection.
|
|
48
|
+
* Returns progressively broader patterns from specific to general.
|
|
49
|
+
*
|
|
50
|
+
* Example: "git push origin main" generates:
|
|
51
|
+
* - "git push *" (the pattern key)
|
|
52
|
+
* - "git *" (broader)
|
|
53
|
+
*
|
|
54
|
+
* @param command The bash command to generate suggestions for
|
|
55
|
+
* @returns Array of pattern suggestions (empty for dangerous commands)
|
|
56
|
+
*/
|
|
57
|
+
export declare function generateBashPatternSuggestions(command: string): string[];
|
|
58
|
+
//# sourceMappingURL=bash-pattern-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash-pattern-utils.d.ts","sourceRoot":"","sources":["../../src/tools/bash-pattern-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAatF;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,iKAkB7B,CAAC;AAEX;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAK3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAerE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBxE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import "../chunk-PTJYTZNU.js";
|
|
2
|
+
function patternCovers(storedPattern, targetPatternKey) {
|
|
3
|
+
if (storedPattern === targetPatternKey) return true;
|
|
4
|
+
const storedBase = storedPattern.endsWith(" *") ? storedPattern.slice(0, -2) : storedPattern;
|
|
5
|
+
const targetBase = targetPatternKey.endsWith(" *") ? targetPatternKey.slice(0, -2) : targetPatternKey;
|
|
6
|
+
return targetBase.startsWith(storedBase + " ");
|
|
7
|
+
}
|
|
8
|
+
const DANGEROUS_COMMAND_PREFIXES = [
|
|
9
|
+
"rm",
|
|
10
|
+
"chmod",
|
|
11
|
+
"chown",
|
|
12
|
+
"chgrp",
|
|
13
|
+
"sudo",
|
|
14
|
+
"su",
|
|
15
|
+
"dd",
|
|
16
|
+
"mkfs",
|
|
17
|
+
"fdisk",
|
|
18
|
+
"parted",
|
|
19
|
+
"kill",
|
|
20
|
+
"killall",
|
|
21
|
+
"pkill",
|
|
22
|
+
"shutdown",
|
|
23
|
+
"reboot",
|
|
24
|
+
"halt",
|
|
25
|
+
"poweroff"
|
|
26
|
+
];
|
|
27
|
+
function isDangerousCommand(command) {
|
|
28
|
+
const tokens = command.trim().split(/\s+/);
|
|
29
|
+
if (tokens.length === 0 || !tokens[0]) return false;
|
|
30
|
+
const head = tokens[0].toLowerCase();
|
|
31
|
+
return DANGEROUS_COMMAND_PREFIXES.includes(head);
|
|
32
|
+
}
|
|
33
|
+
function generateBashPatternKey(command) {
|
|
34
|
+
const tokens = command.trim().split(/\s+/);
|
|
35
|
+
if (tokens.length === 0 || !tokens[0]) return null;
|
|
36
|
+
const head = tokens[0];
|
|
37
|
+
if (isDangerousCommand(command)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const subcommand = tokens.slice(1).find((arg) => !arg.startsWith("-"));
|
|
41
|
+
return subcommand ? `${head} ${subcommand} *` : `${head} *`;
|
|
42
|
+
}
|
|
43
|
+
function generateBashPatternSuggestions(command) {
|
|
44
|
+
const tokens = command.trim().split(/\s+/);
|
|
45
|
+
if (tokens.length === 0 || !tokens[0]) return [];
|
|
46
|
+
const head = tokens[0];
|
|
47
|
+
if (isDangerousCommand(command)) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
const patterns = [];
|
|
51
|
+
const nonFlagArgs = tokens.slice(1).filter((arg) => !arg.startsWith("-"));
|
|
52
|
+
if (nonFlagArgs.length > 0) {
|
|
53
|
+
patterns.push(`${head} ${nonFlagArgs[0]} *`);
|
|
54
|
+
}
|
|
55
|
+
patterns.push(`${head} *`);
|
|
56
|
+
return patterns;
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
DANGEROUS_COMMAND_PREFIXES,
|
|
60
|
+
generateBashPatternKey,
|
|
61
|
+
generateBashPatternSuggestions,
|
|
62
|
+
isDangerousCommand,
|
|
63
|
+
patternCovers
|
|
64
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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 display_types_exports = {};
|
|
20
|
+
__export(display_types_exports, {
|
|
21
|
+
isDiffDisplay: () => isDiffDisplay,
|
|
22
|
+
isFileDisplay: () => isFileDisplay,
|
|
23
|
+
isGenericDisplay: () => isGenericDisplay,
|
|
24
|
+
isSearchDisplay: () => isSearchDisplay,
|
|
25
|
+
isShellDisplay: () => isShellDisplay,
|
|
26
|
+
isValidDisplayData: () => isValidDisplayData
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(display_types_exports);
|
|
29
|
+
function isDiffDisplay(d) {
|
|
30
|
+
return d.type === "diff";
|
|
31
|
+
}
|
|
32
|
+
function isShellDisplay(d) {
|
|
33
|
+
return d.type === "shell";
|
|
34
|
+
}
|
|
35
|
+
function isSearchDisplay(d) {
|
|
36
|
+
return d.type === "search";
|
|
37
|
+
}
|
|
38
|
+
function isFileDisplay(d) {
|
|
39
|
+
return d.type === "file";
|
|
40
|
+
}
|
|
41
|
+
function isGenericDisplay(d) {
|
|
42
|
+
return d.type === "generic";
|
|
43
|
+
}
|
|
44
|
+
const VALID_DISPLAY_TYPES = ["diff", "shell", "search", "file", "generic"];
|
|
45
|
+
function isValidDisplayData(d) {
|
|
46
|
+
if (d === null || typeof d !== "object") {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const obj = d;
|
|
50
|
+
return typeof obj.type === "string" && VALID_DISPLAY_TYPES.includes(obj.type);
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
isDiffDisplay,
|
|
55
|
+
isFileDisplay,
|
|
56
|
+
isGenericDisplay,
|
|
57
|
+
isSearchDisplay,
|
|
58
|
+
isShellDisplay,
|
|
59
|
+
isValidDisplayData
|
|
60
|
+
});
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Display Types
|
|
3
|
+
*
|
|
4
|
+
* Discriminated union types for structured tool result rendering.
|
|
5
|
+
* These types enable both CLI and WebUI to render tool results with
|
|
6
|
+
* appropriate formatting (diffs, shell output, search results, etc.)
|
|
7
|
+
*
|
|
8
|
+
* Tools return `_display` field in their result, which is preserved
|
|
9
|
+
* by the sanitizer in `SanitizedToolResult.meta.display`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Discriminated union of all tool display data types.
|
|
13
|
+
* Switch on `type` field for exhaustive handling.
|
|
14
|
+
*/
|
|
15
|
+
export type ToolDisplayData = DiffDisplayData | ShellDisplayData | SearchDisplayData | FileDisplayData | GenericDisplayData;
|
|
16
|
+
/**
|
|
17
|
+
* Display data for file edit operations (edit_file, write_file overwrites).
|
|
18
|
+
* Contains unified diff format for rendering changes.
|
|
19
|
+
*/
|
|
20
|
+
export interface DiffDisplayData {
|
|
21
|
+
type: 'diff';
|
|
22
|
+
/** Unified diff string (output of `diff` package's createPatch) */
|
|
23
|
+
unified: string;
|
|
24
|
+
/** Path to the file that was modified */
|
|
25
|
+
filename: string;
|
|
26
|
+
/** Number of lines added */
|
|
27
|
+
additions: number;
|
|
28
|
+
/** Number of lines removed */
|
|
29
|
+
deletions: number;
|
|
30
|
+
/** Original file content (optional, for approval preview) */
|
|
31
|
+
beforeContent?: string;
|
|
32
|
+
/** New file content (optional, for approval preview) */
|
|
33
|
+
afterContent?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Display data for shell command execution (bash_exec).
|
|
37
|
+
* Contains command metadata and output for structured rendering.
|
|
38
|
+
*/
|
|
39
|
+
export interface ShellDisplayData {
|
|
40
|
+
type: 'shell';
|
|
41
|
+
/** The command that was executed */
|
|
42
|
+
command: string;
|
|
43
|
+
/** Exit code from the command (0 = success) */
|
|
44
|
+
exitCode: number;
|
|
45
|
+
/** Execution duration in milliseconds */
|
|
46
|
+
duration: number;
|
|
47
|
+
/** Whether command is running in background */
|
|
48
|
+
isBackground?: boolean;
|
|
49
|
+
/** Standard output from the command */
|
|
50
|
+
stdout?: string;
|
|
51
|
+
/** Standard error from the command */
|
|
52
|
+
stderr?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Display data for search operations (grep_content, glob_files).
|
|
56
|
+
* Contains structured match results for formatted rendering.
|
|
57
|
+
*/
|
|
58
|
+
export interface SearchDisplayData {
|
|
59
|
+
type: 'search';
|
|
60
|
+
/** The search pattern used */
|
|
61
|
+
pattern: string;
|
|
62
|
+
/** Array of match results */
|
|
63
|
+
matches: SearchMatch[];
|
|
64
|
+
/** Total number of matches found (may exceed displayed matches) */
|
|
65
|
+
totalMatches: number;
|
|
66
|
+
/** Whether results were truncated due to limits */
|
|
67
|
+
truncated: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Individual search match result.
|
|
71
|
+
*/
|
|
72
|
+
export interface SearchMatch {
|
|
73
|
+
/** File path where match was found */
|
|
74
|
+
file: string;
|
|
75
|
+
/** Line number of the match (0 for glob results) */
|
|
76
|
+
line: number;
|
|
77
|
+
/** Content of the matching line or filename */
|
|
78
|
+
content: string;
|
|
79
|
+
/** Optional surrounding context lines */
|
|
80
|
+
context?: string[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Display data for file operations (read_file, write_file create).
|
|
84
|
+
* Contains file metadata for simple status rendering.
|
|
85
|
+
*/
|
|
86
|
+
export interface FileDisplayData {
|
|
87
|
+
type: 'file';
|
|
88
|
+
/** Path to the file */
|
|
89
|
+
path: string;
|
|
90
|
+
/** Type of operation performed */
|
|
91
|
+
operation: 'read' | 'write' | 'create' | 'delete';
|
|
92
|
+
/** File size in bytes (optional) */
|
|
93
|
+
size?: number;
|
|
94
|
+
/** Number of lines read/written (optional) */
|
|
95
|
+
lineCount?: number;
|
|
96
|
+
/** Path to backup file if created (optional) */
|
|
97
|
+
backupPath?: string;
|
|
98
|
+
/** File content for create operations (used in approval preview) */
|
|
99
|
+
content?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Fallback display data for unknown tools or MCP tools.
|
|
103
|
+
* Renderers should fall back to rendering content[] directly.
|
|
104
|
+
*/
|
|
105
|
+
export interface GenericDisplayData {
|
|
106
|
+
type: 'generic';
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Type guard for DiffDisplayData.
|
|
110
|
+
*/
|
|
111
|
+
export declare function isDiffDisplay(d: ToolDisplayData): d is DiffDisplayData;
|
|
112
|
+
/**
|
|
113
|
+
* Type guard for ShellDisplayData.
|
|
114
|
+
*/
|
|
115
|
+
export declare function isShellDisplay(d: ToolDisplayData): d is ShellDisplayData;
|
|
116
|
+
/**
|
|
117
|
+
* Type guard for SearchDisplayData.
|
|
118
|
+
*/
|
|
119
|
+
export declare function isSearchDisplay(d: ToolDisplayData): d is SearchDisplayData;
|
|
120
|
+
/**
|
|
121
|
+
* Type guard for FileDisplayData.
|
|
122
|
+
*/
|
|
123
|
+
export declare function isFileDisplay(d: ToolDisplayData): d is FileDisplayData;
|
|
124
|
+
/**
|
|
125
|
+
* Type guard for GenericDisplayData.
|
|
126
|
+
*/
|
|
127
|
+
export declare function isGenericDisplay(d: ToolDisplayData): d is GenericDisplayData;
|
|
128
|
+
/**
|
|
129
|
+
* Validates that an unknown value is a valid ToolDisplayData.
|
|
130
|
+
* Used by sanitizer to safely extract _display from tool results.
|
|
131
|
+
*/
|
|
132
|
+
export declare function isValidDisplayData(d: unknown): d is ToolDisplayData;
|
|
133
|
+
//# sourceMappingURL=display-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-types.d.ts","sourceRoot":"","sources":["../../src/tools/display-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;GAGG;AACH,MAAM,MAAM,eAAe,GACrB,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,kBAAkB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAClD,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,SAAS,CAAC;CACnB;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,eAAe,CAEtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,gBAAgB,CAExE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,iBAAiB,CAE1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,eAAe,CAEtE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,kBAAkB,CAE5E;AASD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CASnE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "../chunk-PTJYTZNU.js";
|
|
2
|
+
function isDiffDisplay(d) {
|
|
3
|
+
return d.type === "diff";
|
|
4
|
+
}
|
|
5
|
+
function isShellDisplay(d) {
|
|
6
|
+
return d.type === "shell";
|
|
7
|
+
}
|
|
8
|
+
function isSearchDisplay(d) {
|
|
9
|
+
return d.type === "search";
|
|
10
|
+
}
|
|
11
|
+
function isFileDisplay(d) {
|
|
12
|
+
return d.type === "file";
|
|
13
|
+
}
|
|
14
|
+
function isGenericDisplay(d) {
|
|
15
|
+
return d.type === "generic";
|
|
16
|
+
}
|
|
17
|
+
const VALID_DISPLAY_TYPES = ["diff", "shell", "search", "file", "generic"];
|
|
18
|
+
function isValidDisplayData(d) {
|
|
19
|
+
if (d === null || typeof d !== "object") {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const obj = d;
|
|
23
|
+
return typeof obj.type === "string" && VALID_DISPLAY_TYPES.includes(obj.type);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
isDiffDisplay,
|
|
27
|
+
isFileDisplay,
|
|
28
|
+
isGenericDisplay,
|
|
29
|
+
isSearchDisplay,
|
|
30
|
+
isShellDisplay,
|
|
31
|
+
isValidDisplayData
|
|
32
|
+
};
|
|
@@ -25,6 +25,7 @@ var ToolErrorCode = /* @__PURE__ */ ((ToolErrorCode2) => {
|
|
|
25
25
|
ToolErrorCode2["EXECUTION_DENIED"] = "tools_execution_denied";
|
|
26
26
|
ToolErrorCode2["EXECUTION_TIMEOUT"] = "tools_execution_timeout";
|
|
27
27
|
ToolErrorCode2["EXECUTION_FAILED"] = "tools_execution_failed";
|
|
28
|
+
ToolErrorCode2["VALIDATION_FAILED"] = "tools_validation_failed";
|
|
28
29
|
ToolErrorCode2["CONFIRMATION_HANDLER_MISSING"] = "tools_confirmation_handler_missing";
|
|
29
30
|
ToolErrorCode2["CONFIRMATION_TIMEOUT"] = "tools_confirmation_timeout";
|
|
30
31
|
ToolErrorCode2["CONFIRMATION_CANCELLED"] = "tools_confirmation_cancelled";
|
|
@@ -32,6 +33,7 @@ var ToolErrorCode = /* @__PURE__ */ ((ToolErrorCode2) => {
|
|
|
32
33
|
ToolErrorCode2["TOOL_INVALID_ARGS"] = "tools_invalid_args";
|
|
33
34
|
ToolErrorCode2["TOOL_UNAUTHORIZED"] = "tools_unauthorized";
|
|
34
35
|
ToolErrorCode2["CONFIG_INVALID"] = "tools_config_invalid";
|
|
36
|
+
ToolErrorCode2["FEATURE_DISABLED"] = "tools_feature_disabled";
|
|
35
37
|
return ToolErrorCode2;
|
|
36
38
|
})(ToolErrorCode || {});
|
|
37
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -6,12 +6,14 @@ export declare enum ToolErrorCode {
|
|
|
6
6
|
EXECUTION_DENIED = "tools_execution_denied",
|
|
7
7
|
EXECUTION_TIMEOUT = "tools_execution_timeout",
|
|
8
8
|
EXECUTION_FAILED = "tools_execution_failed",
|
|
9
|
+
VALIDATION_FAILED = "tools_validation_failed",
|
|
9
10
|
CONFIRMATION_HANDLER_MISSING = "tools_confirmation_handler_missing",
|
|
10
11
|
CONFIRMATION_TIMEOUT = "tools_confirmation_timeout",
|
|
11
12
|
CONFIRMATION_CANCELLED = "tools_confirmation_cancelled",
|
|
12
13
|
TOOL_NOT_FOUND = "tools_tool_not_found",
|
|
13
14
|
TOOL_INVALID_ARGS = "tools_invalid_args",
|
|
14
15
|
TOOL_UNAUTHORIZED = "tools_unauthorized",
|
|
15
|
-
CONFIG_INVALID = "tools_config_invalid"
|
|
16
|
+
CONFIG_INVALID = "tools_config_invalid",
|
|
17
|
+
FEATURE_DISABLED = "tools_feature_disabled"
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=error-codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/tools/error-codes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,aAAa;IAErB,gBAAgB,2BAA2B;IAC3C,iBAAiB,4BAA4B;IAC7C,gBAAgB,2BAA2B;IAG3C,4BAA4B,uCAAuC;IACnE,oBAAoB,+BAA+B;IACnD,sBAAsB,iCAAiC;IAGvD,cAAc,yBAAyB;IACvC,iBAAiB,uBAAuB;IACxC,iBAAiB,uBAAuB;IAGxC,cAAc,yBAAyB;
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/tools/error-codes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,aAAa;IAErB,gBAAgB,2BAA2B;IAC3C,iBAAiB,4BAA4B;IAC7C,gBAAgB,2BAA2B;IAG3C,iBAAiB,4BAA4B;IAG7C,4BAA4B,uCAAuC;IACnE,oBAAoB,+BAA+B;IACnD,sBAAsB,iCAAiC;IAGvD,cAAc,yBAAyB;IACvC,iBAAiB,uBAAuB;IACxC,iBAAiB,uBAAuB;IAGxC,cAAc,yBAAyB;IACvC,gBAAgB,2BAA2B;CAC9C"}
|
|
@@ -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
|