@dexto/core 1.4.0 → 1.5.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 +36 -0
- package/dist/agent/DextoAgent.cjs +22 -3
- package/dist/agent/DextoAgent.d.ts +19 -2
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +23 -4
- package/dist/agent/index.cjs +4 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +5 -1
- package/dist/agent/schemas.cjs +90 -71
- package/dist/agent/schemas.d.ts +5911 -96
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +87 -66
- package/dist/approval/manager.cjs +165 -1
- package/dist/approval/manager.d.ts +91 -2
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +155 -1
- package/dist/approval/schemas.cjs +39 -3
- package/dist/approval/schemas.d.ts +238 -1
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +35 -3
- package/dist/approval/types.cjs +1 -0
- package/dist/approval/types.d.ts +26 -1
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +1 -0
- package/dist/context/compaction/factory.cjs +57 -0
- package/dist/context/compaction/factory.d.ts +17 -0
- package/dist/context/compaction/factory.d.ts.map +1 -0
- package/dist/context/compaction/factory.js +34 -0
- package/dist/context/compaction/index.cjs +49 -0
- package/dist/context/compaction/index.d.ts +11 -0
- package/dist/context/compaction/index.d.ts.map +1 -0
- package/dist/context/compaction/index.js +19 -0
- package/dist/context/{compression → compaction}/overflow.cjs +3 -3
- package/dist/context/{compression → compaction}/overflow.d.ts +4 -4
- package/dist/context/compaction/overflow.d.ts.map +1 -0
- package/dist/context/{compression → compaction}/overflow.js +2 -2
- package/dist/context/compaction/provider.cjs +16 -0
- package/dist/context/compaction/provider.d.ts +48 -0
- package/dist/context/compaction/provider.d.ts.map +1 -0
- package/dist/context/compaction/providers/noop-provider.cjs +48 -0
- package/dist/context/compaction/providers/noop-provider.d.ts +24 -0
- package/dist/context/compaction/providers/noop-provider.d.ts.map +1 -0
- package/dist/context/compaction/providers/noop-provider.js +24 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.cjs +61 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +36 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +1 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.js +37 -0
- package/dist/context/compaction/registry.cjs +39 -0
- package/dist/context/compaction/registry.d.ts +19 -0
- package/dist/context/compaction/registry.d.ts.map +1 -0
- package/dist/context/compaction/registry.js +16 -0
- package/dist/context/compaction/schemas.cjs +38 -0
- package/dist/context/compaction/schemas.d.ts +24 -0
- package/dist/context/compaction/schemas.d.ts.map +1 -0
- package/dist/context/compaction/schemas.js +14 -0
- package/dist/context/compaction/strategies/noop.cjs +36 -0
- package/dist/context/compaction/strategies/noop.d.ts +18 -0
- package/dist/context/compaction/strategies/noop.d.ts.map +1 -0
- package/dist/context/compaction/strategies/noop.js +13 -0
- package/dist/context/{compression → compaction/strategies}/reactive-overflow.cjs +3 -3
- package/dist/context/{compression → compaction/strategies}/reactive-overflow.d.ts +6 -6
- package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +1 -0
- package/dist/context/{compression → compaction/strategies}/reactive-overflow.js +4 -4
- package/dist/context/{compression → compaction}/types.d.ts +4 -4
- package/dist/context/compaction/types.d.ts.map +1 -0
- package/dist/context/compaction/types.js +0 -0
- package/dist/context/error-codes.cjs +4 -0
- package/dist/context/error-codes.d.ts +4 -0
- package/dist/context/error-codes.d.ts.map +1 -1
- package/dist/context/error-codes.js +4 -0
- package/dist/context/errors.cjs +40 -0
- package/dist/context/errors.d.ts +14 -0
- package/dist/context/errors.d.ts.map +1 -1
- package/dist/context/errors.js +40 -0
- package/dist/context/index.cjs +3 -1
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/types.d.ts +6 -0
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/utils.cjs +27 -7
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +27 -7
- package/dist/errors/result-bridge.cjs +2 -3
- package/dist/errors/result-bridge.d.ts.map +1 -1
- package/dist/errors/result-bridge.js +2 -3
- package/dist/events/index.cjs +2 -2
- package/dist/events/index.d.ts +16 -16
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +2 -2
- package/dist/filesystem/filesystem-service.cjs +39 -0
- package/dist/filesystem/filesystem-service.d.ts +32 -0
- package/dist/filesystem/filesystem-service.d.ts.map +1 -1
- package/dist/filesystem/filesystem-service.js +39 -0
- package/dist/filesystem/index.d.ts +1 -1
- package/dist/filesystem/index.d.ts.map +1 -1
- package/dist/filesystem/path-validator.cjs +69 -1
- package/dist/filesystem/path-validator.d.ts +43 -2
- package/dist/filesystem/path-validator.d.ts.map +1 -1
- package/dist/filesystem/path-validator.js +69 -1
- package/dist/image/define-image.cjs +146 -0
- package/dist/image/define-image.d.ts +71 -0
- package/dist/image/define-image.d.ts.map +1 -0
- package/dist/image/define-image.js +121 -0
- package/dist/image/index.cjs +32 -0
- package/dist/image/index.d.ts +53 -0
- package/dist/image/index.d.ts.map +1 -0
- package/dist/image/index.js +7 -0
- package/dist/image/types.cjs +16 -0
- package/dist/image/types.d.ts +231 -0
- package/dist/image/types.d.ts.map +1 -0
- package/dist/image/types.js +0 -0
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/llm/error-codes.cjs +1 -0
- package/dist/llm/error-codes.d.ts +1 -0
- package/dist/llm/error-codes.d.ts.map +1 -1
- package/dist/llm/error-codes.js +1 -0
- package/dist/llm/errors.cjs +24 -0
- package/dist/llm/errors.d.ts +19 -6
- package/dist/llm/errors.d.ts.map +1 -1
- package/dist/llm/errors.js +24 -0
- package/dist/llm/executor/stream-processor.cjs +11 -3
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +11 -3
- package/dist/llm/executor/turn-executor.cjs +50 -23
- package/dist/llm/executor/turn-executor.d.ts +6 -5
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +50 -23
- package/dist/llm/formatters/vercel.cjs +6 -2
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +6 -2
- package/dist/llm/index.cjs +18 -1
- package/dist/llm/index.d.ts +2 -0
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +14 -0
- package/dist/llm/providers/local/ai-sdk-adapter.cjs +308 -0
- package/dist/llm/providers/local/ai-sdk-adapter.d.ts +29 -0
- package/dist/llm/providers/local/ai-sdk-adapter.d.ts.map +1 -0
- package/dist/llm/providers/local/ai-sdk-adapter.js +278 -0
- package/dist/llm/providers/local/downloader.cjs +291 -0
- package/dist/llm/providers/local/downloader.d.ts +82 -0
- package/dist/llm/providers/local/downloader.d.ts.map +1 -0
- package/dist/llm/providers/local/downloader.js +251 -0
- package/dist/llm/providers/local/error-codes.cjs +57 -0
- package/dist/llm/providers/local/error-codes.d.ts +66 -0
- package/dist/llm/providers/local/error-codes.d.ts.map +1 -0
- package/dist/llm/providers/local/error-codes.js +34 -0
- package/dist/llm/providers/local/errors.cjs +240 -0
- package/dist/llm/providers/local/errors.d.ts +31 -0
- package/dist/llm/providers/local/errors.d.ts.map +1 -0
- package/dist/llm/providers/local/errors.js +217 -0
- package/dist/llm/providers/local/gpu-detector.cjs +214 -0
- package/dist/llm/providers/local/gpu-detector.d.ts +28 -0
- package/dist/llm/providers/local/gpu-detector.d.ts.map +1 -0
- package/dist/llm/providers/local/gpu-detector.js +178 -0
- package/dist/llm/providers/local/index.cjs +147 -0
- package/dist/llm/providers/local/index.d.ts +21 -0
- package/dist/llm/providers/local/index.d.ts.map +1 -0
- package/dist/llm/providers/local/index.js +126 -0
- package/dist/llm/providers/local/node-llama-provider.cjs +216 -0
- package/dist/llm/providers/local/node-llama-provider.d.ts +90 -0
- package/dist/llm/providers/local/node-llama-provider.d.ts.map +1 -0
- package/dist/llm/providers/local/node-llama-provider.js +176 -0
- package/dist/llm/providers/local/ollama-provider.cjs +230 -0
- package/dist/llm/providers/local/ollama-provider.d.ts +70 -0
- package/dist/llm/providers/local/ollama-provider.d.ts.map +1 -0
- package/dist/llm/providers/local/ollama-provider.js +198 -0
- package/dist/llm/providers/local/registry.cjs +343 -0
- package/dist/llm/providers/local/registry.d.ts +51 -0
- package/dist/llm/providers/local/registry.d.ts.map +1 -0
- package/dist/llm/providers/local/registry.js +312 -0
- package/dist/llm/providers/local/schemas.cjs +169 -0
- package/dist/llm/providers/local/schemas.d.ts +395 -0
- package/dist/llm/providers/local/schemas.d.ts.map +1 -0
- package/dist/llm/providers/local/schemas.js +133 -0
- package/dist/llm/providers/local/types.cjs +16 -0
- package/dist/llm/providers/local/types.d.ts +219 -0
- package/dist/llm/providers/local/types.d.ts.map +1 -0
- package/dist/llm/providers/local/types.js +0 -0
- package/dist/llm/providers/openrouter-model-registry.cjs +350 -0
- package/dist/llm/providers/openrouter-model-registry.d.ts +120 -0
- package/dist/llm/providers/openrouter-model-registry.d.ts.map +1 -0
- package/dist/llm/providers/openrouter-model-registry.js +309 -0
- package/dist/llm/registry.cjs +535 -9
- package/dist/llm/registry.d.ts +26 -0
- package/dist/llm/registry.d.ts.map +1 -1
- package/dist/llm/registry.js +532 -9
- package/dist/llm/resolver.cjs +63 -5
- package/dist/llm/resolver.d.ts +3 -3
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +69 -6
- package/dist/llm/schemas.cjs +90 -80
- package/dist/llm/schemas.d.ts +158 -22
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +90 -80
- package/dist/llm/services/factory.cjs +87 -13
- package/dist/llm/services/factory.d.ts +4 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +85 -12
- package/dist/llm/services/test-utils.integration.cjs +22 -2
- package/dist/llm/services/test-utils.integration.d.ts +7 -1
- package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
- package/dist/llm/services/test-utils.integration.js +26 -3
- package/dist/llm/services/vercel.cjs +5 -2
- package/dist/llm/services/vercel.d.ts +3 -2
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +5 -2
- package/dist/llm/types.cjs +11 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +11 -1
- package/dist/mcp/manager.cjs +8 -0
- package/dist/mcp/manager.d.ts +17 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +8 -0
- package/dist/mcp/mcp-client.cjs +0 -3
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +0 -3
- package/dist/memory/schemas.d.ts +1 -1
- package/dist/plugins/error-codes.cjs +3 -0
- package/dist/plugins/error-codes.d.ts +7 -1
- package/dist/plugins/error-codes.d.ts.map +1 -1
- package/dist/plugins/error-codes.js +3 -0
- package/dist/plugins/index.cjs +7 -0
- package/dist/plugins/index.d.ts +4 -2
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +6 -1
- package/dist/plugins/manager.cjs +92 -7
- package/dist/plugins/manager.d.ts +10 -3
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/plugins/manager.js +92 -7
- package/dist/plugins/registry.cjs +63 -0
- package/dist/plugins/registry.d.ts +101 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +39 -0
- package/dist/plugins/schemas.cjs +17 -5
- package/dist/plugins/schemas.d.ts +62 -5
- package/dist/plugins/schemas.d.ts.map +1 -1
- package/dist/plugins/schemas.js +15 -4
- package/dist/providers/base-registry.cjs +147 -0
- package/dist/providers/base-registry.d.ts +147 -0
- package/dist/providers/base-registry.d.ts.map +1 -0
- package/dist/providers/base-registry.js +123 -0
- package/dist/providers/discovery.cjs +95 -0
- package/dist/providers/discovery.d.ts +94 -0
- package/dist/providers/discovery.d.ts.map +1 -0
- package/dist/providers/discovery.js +70 -0
- package/dist/providers/index.cjs +24 -0
- package/dist/providers/index.d.ts +32 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +2 -0
- package/dist/resources/reference-parser.cjs +3 -3
- package/dist/resources/reference-parser.d.ts.map +1 -1
- package/dist/resources/reference-parser.js +3 -3
- package/dist/session/chat-session.cjs +20 -3
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +21 -4
- package/dist/storage/blob/factory.cjs +8 -11
- package/dist/storage/blob/factory.d.ts +32 -6
- package/dist/storage/blob/factory.d.ts.map +1 -1
- package/dist/storage/blob/factory.js +8 -11
- package/dist/storage/blob/index.cjs +56 -0
- package/dist/storage/blob/index.d.ts +45 -0
- package/dist/storage/blob/index.d.ts.map +1 -0
- package/dist/storage/blob/index.js +30 -0
- package/dist/storage/blob/provider.cjs +16 -0
- package/dist/storage/blob/provider.d.ts +50 -0
- package/dist/storage/blob/provider.d.ts.map +1 -0
- package/dist/storage/blob/provider.js +0 -0
- package/dist/storage/blob/providers/index.cjs +31 -0
- package/dist/storage/blob/providers/index.d.ts +8 -0
- package/dist/storage/blob/providers/index.d.ts.map +1 -0
- package/dist/storage/blob/providers/index.js +7 -0
- package/dist/storage/blob/providers/local.cjs +39 -0
- package/dist/storage/blob/providers/local.d.ts +17 -0
- package/dist/storage/blob/providers/local.d.ts.map +1 -0
- package/dist/storage/blob/providers/local.js +16 -0
- package/dist/storage/blob/providers/memory.cjs +39 -0
- package/dist/storage/blob/providers/memory.d.ts +17 -0
- package/dist/storage/blob/providers/memory.d.ts.map +1 -0
- package/dist/storage/blob/providers/memory.js +16 -0
- package/dist/storage/blob/registry.cjs +50 -0
- package/dist/storage/blob/registry.d.ts +42 -0
- package/dist/storage/blob/registry.d.ts.map +1 -0
- package/dist/storage/blob/registry.js +26 -0
- package/dist/storage/blob/schemas.cjs +9 -12
- package/dist/storage/blob/schemas.d.ts +39 -34
- package/dist/storage/blob/schemas.d.ts.map +1 -1
- package/dist/storage/blob/schemas.js +6 -11
- package/dist/storage/cache/factory.cjs +8 -36
- package/dist/storage/cache/factory.d.ts +32 -7
- package/dist/storage/cache/factory.d.ts.map +1 -1
- package/dist/storage/cache/factory.js +8 -26
- package/dist/storage/cache/index.cjs +53 -0
- package/dist/storage/cache/index.d.ts +44 -0
- package/dist/storage/cache/index.d.ts.map +1 -0
- package/dist/storage/cache/index.js +28 -0
- package/dist/storage/cache/provider.cjs +16 -0
- package/dist/storage/cache/provider.d.ts +56 -0
- package/dist/storage/cache/provider.d.ts.map +1 -0
- package/dist/storage/cache/provider.js +0 -0
- package/dist/storage/cache/providers/index.cjs +31 -0
- package/dist/storage/cache/providers/index.d.ts +8 -0
- package/dist/storage/cache/providers/index.d.ts.map +1 -0
- package/dist/storage/cache/providers/index.js +7 -0
- package/dist/storage/cache/providers/memory.cjs +40 -0
- package/dist/storage/cache/providers/memory.d.ts +17 -0
- package/dist/storage/cache/providers/memory.d.ts.map +1 -0
- package/dist/storage/cache/providers/memory.js +17 -0
- package/dist/storage/cache/providers/redis.cjs +66 -0
- package/dist/storage/cache/providers/redis.d.ts +20 -0
- package/dist/storage/cache/providers/redis.d.ts.map +1 -0
- package/dist/storage/cache/providers/redis.js +33 -0
- package/dist/storage/cache/registry.cjs +50 -0
- package/dist/storage/cache/registry.d.ts +42 -0
- package/dist/storage/cache/registry.d.ts.map +1 -0
- package/dist/storage/cache/registry.js +26 -0
- package/dist/storage/cache/schemas.cjs +6 -2
- package/dist/storage/cache/schemas.d.ts +2 -3
- package/dist/storage/cache/schemas.d.ts.map +1 -1
- package/dist/storage/cache/schemas.js +3 -1
- package/dist/storage/database/factory.cjs +8 -47
- package/dist/storage/database/factory.d.ts +34 -8
- package/dist/storage/database/factory.d.ts.map +1 -1
- package/dist/storage/database/factory.js +8 -37
- package/dist/storage/database/index.cjs +58 -0
- package/dist/storage/database/index.d.ts +45 -0
- package/dist/storage/database/index.d.ts.map +1 -0
- package/dist/storage/database/index.js +37 -0
- package/dist/storage/database/provider.cjs +16 -0
- package/dist/storage/database/provider.d.ts +56 -0
- package/dist/storage/database/provider.d.ts.map +1 -0
- package/dist/storage/database/provider.js +0 -0
- package/dist/storage/database/providers/index.cjs +34 -0
- package/dist/storage/database/providers/index.d.ts +9 -0
- package/dist/storage/database/providers/index.d.ts.map +1 -0
- package/dist/storage/database/providers/index.js +9 -0
- package/dist/storage/database/providers/memory.cjs +40 -0
- package/dist/storage/database/providers/memory.d.ts +16 -0
- package/dist/storage/database/providers/memory.d.ts.map +1 -0
- package/dist/storage/database/providers/memory.js +17 -0
- package/dist/storage/database/providers/postgres.cjs +62 -0
- package/dist/storage/database/providers/postgres.d.ts +19 -0
- package/dist/storage/database/providers/postgres.d.ts.map +1 -0
- package/dist/storage/database/providers/postgres.js +29 -0
- package/dist/storage/database/providers/sqlite.cjs +66 -0
- package/dist/storage/database/providers/sqlite.d.ts +20 -0
- package/dist/storage/database/providers/sqlite.d.ts.map +1 -0
- package/dist/storage/database/providers/sqlite.js +33 -0
- package/dist/storage/database/registry.cjs +50 -0
- package/dist/storage/database/registry.d.ts +42 -0
- package/dist/storage/database/registry.d.ts.map +1 -0
- package/dist/storage/database/registry.js +26 -0
- package/dist/storage/database/schemas.cjs +8 -2
- package/dist/storage/database/schemas.d.ts +3 -4
- package/dist/storage/database/schemas.d.ts.map +1 -1
- package/dist/storage/database/schemas.js +4 -1
- package/dist/storage/error-codes.cjs +6 -0
- package/dist/storage/error-codes.d.ts +7 -1
- package/dist/storage/error-codes.d.ts.map +1 -1
- package/dist/storage/error-codes.js +6 -0
- package/dist/storage/errors.cjs +80 -0
- package/dist/storage/errors.d.ts +24 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +80 -0
- package/dist/storage/index.cjs +47 -4
- package/dist/storage/index.d.ts +34 -8
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +32 -3
- package/dist/storage/schemas.cjs +4 -0
- package/dist/storage/schemas.d.ts +17 -50
- package/dist/storage/schemas.d.ts.map +1 -1
- package/dist/storage/schemas.js +5 -1
- package/dist/storage/storage-manager.cjs +6 -6
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +3 -3
- package/dist/systemPrompt/in-built-prompts.cjs +7 -6
- package/dist/systemPrompt/in-built-prompts.d.ts +2 -2
- package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -1
- package/dist/systemPrompt/in-built-prompts.js +6 -5
- package/dist/systemPrompt/registry.cjs +2 -2
- package/dist/systemPrompt/registry.d.ts +1 -1
- package/dist/systemPrompt/registry.d.ts.map +1 -1
- package/dist/systemPrompt/registry.js +2 -2
- package/dist/systemPrompt/schemas.cjs +2 -2
- package/dist/systemPrompt/schemas.d.ts +13 -13
- package/dist/systemPrompt/schemas.js +2 -2
- package/dist/tools/custom-tool-registry.cjs +64 -0
- package/dist/tools/custom-tool-registry.d.ts +120 -0
- package/dist/tools/custom-tool-registry.d.ts.map +1 -0
- package/dist/tools/custom-tool-registry.js +40 -0
- package/dist/tools/custom-tool-schema-registry.cjs +164 -0
- package/dist/tools/custom-tool-schema-registry.d.ts +86 -0
- package/dist/tools/custom-tool-schema-registry.d.ts.map +1 -0
- package/dist/tools/custom-tool-schema-registry.js +140 -0
- package/dist/tools/error-codes.cjs +3 -0
- package/dist/tools/error-codes.d.ts +4 -1
- package/dist/tools/error-codes.d.ts.map +1 -1
- package/dist/tools/error-codes.js +3 -0
- package/dist/tools/errors.cjs +41 -0
- package/dist/tools/errors.d.ts +17 -0
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +41 -0
- package/dist/tools/index.cjs +13 -1
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +11 -1
- package/dist/tools/internal-tools/constants.cjs +3 -9
- package/dist/tools/internal-tools/constants.d.ts +1 -1
- package/dist/tools/internal-tools/constants.d.ts.map +1 -1
- package/dist/tools/internal-tools/constants.js +3 -9
- package/dist/tools/internal-tools/implementations/get-resource-tool.cjs +113 -0
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts +30 -0
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/get-resource-tool.js +90 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.cjs +91 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts +24 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.js +68 -0
- package/dist/tools/internal-tools/provider.cjs +150 -23
- package/dist/tools/internal-tools/provider.d.ts +55 -10
- package/dist/tools/internal-tools/provider.d.ts.map +1 -1
- package/dist/tools/internal-tools/provider.js +150 -23
- package/dist/tools/internal-tools/registry.cjs +18 -43
- package/dist/tools/internal-tools/registry.d.ts +4 -4
- package/dist/tools/internal-tools/registry.d.ts.map +1 -1
- package/dist/tools/internal-tools/registry.js +18 -43
- package/dist/tools/schemas.cjs +20 -0
- package/dist/tools/schemas.d.ts +43 -1
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +16 -0
- package/dist/tools/tool-manager.cjs +140 -13
- package/dist/tools/tool-manager.d.ts +22 -3
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +140 -13
- package/dist/tools/types.d.ts +43 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.cjs +19 -1
- package/dist/utils/api-key-resolver.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +19 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/redactor.cjs +18 -3
- package/dist/utils/redactor.d.ts +0 -7
- package/dist/utils/redactor.d.ts.map +1 -1
- package/dist/utils/redactor.js +18 -3
- package/dist/utils/service-initializer.cjs +9 -35
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +9 -35
- package/package.json +5 -2
- package/dist/context/compression/overflow.d.ts.map +0 -1
- package/dist/context/compression/reactive-overflow.d.ts.map +0 -1
- package/dist/context/compression/types.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.cjs +0 -130
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts +0 -13
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.js +0 -97
- package/dist/tools/internal-tools/implementations/bash-output-tool.cjs +0 -49
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/bash-output-tool.js +0 -26
- package/dist/tools/internal-tools/implementations/edit-file-tool.cjs +0 -127
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/edit-file-tool.js +0 -104
- package/dist/tools/internal-tools/implementations/glob-files-tool.cjs +0 -70
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/glob-files-tool.js +0 -47
- package/dist/tools/internal-tools/implementations/grep-content-tool.cjs +0 -86
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/grep-content-tool.js +0 -63
- package/dist/tools/internal-tools/implementations/kill-process-tool.cjs +0 -47
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/kill-process-tool.js +0 -24
- package/dist/tools/internal-tools/implementations/read-file-tool.cjs +0 -63
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/read-file-tool.js +0 -40
- package/dist/tools/internal-tools/implementations/write-file-tool.cjs +0 -124
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/write-file-tool.js +0 -103
- package/dist/utils/env-file.cjs +0 -118
- package/dist/utils/env-file.d.ts +0 -5
- package/dist/utils/env-file.d.ts.map +0 -1
- package/dist/utils/env-file.js +0 -85
- /package/dist/context/{compression/types.js → compaction/provider.js} +0 -0
- /package/dist/context/{compression → compaction}/types.cjs +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "../chunk-PTJYTZNU.js";
|
|
2
|
+
import { ToolError } from "./errors.js";
|
|
3
|
+
import { BaseRegistry } from "../providers/base-registry.js";
|
|
4
|
+
import { customToolSchemaRegistry } from "./custom-tool-schema-registry.js";
|
|
5
|
+
const customToolErrorFactory = {
|
|
6
|
+
alreadyRegistered: (type) => ToolError.customToolProviderAlreadyRegistered(type),
|
|
7
|
+
notFound: (type, availableTypes) => ToolError.unknownCustomToolProvider(type, availableTypes)
|
|
8
|
+
};
|
|
9
|
+
class CustomToolRegistry extends BaseRegistry {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(customToolErrorFactory);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register a custom tool provider.
|
|
15
|
+
* Also registers the provider's config schema for early validation.
|
|
16
|
+
*
|
|
17
|
+
* @param provider - The custom tool provider to register
|
|
18
|
+
* @throws Error if a provider with the same type is already registered
|
|
19
|
+
*/
|
|
20
|
+
register(provider) {
|
|
21
|
+
super.register(provider);
|
|
22
|
+
customToolSchemaRegistry.register(provider.type, provider.configSchema);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Unregister a custom tool provider.
|
|
26
|
+
* Note: This does NOT unregister the schema from customToolSchemaRegistry
|
|
27
|
+
* to avoid breaking active configs that reference the schema.
|
|
28
|
+
*
|
|
29
|
+
* @param type - The provider type to unregister
|
|
30
|
+
* @returns true if the provider was unregistered, false if it wasn't registered
|
|
31
|
+
*/
|
|
32
|
+
unregister(type) {
|
|
33
|
+
return super.unregister(type);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const customToolRegistry = new CustomToolRegistry();
|
|
37
|
+
export {
|
|
38
|
+
CustomToolRegistry,
|
|
39
|
+
customToolRegistry
|
|
40
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
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 custom_tool_schema_registry_exports = {};
|
|
20
|
+
__export(custom_tool_schema_registry_exports, {
|
|
21
|
+
customToolSchemaRegistry: () => customToolSchemaRegistry,
|
|
22
|
+
getCustomToolSchemaRegistry: () => getCustomToolSchemaRegistry
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(custom_tool_schema_registry_exports);
|
|
25
|
+
var import_zod = require("zod");
|
|
26
|
+
var import_types = require("../logger/v2/types.js");
|
|
27
|
+
const createNoOpLogger = () => {
|
|
28
|
+
const noOpLogger = {
|
|
29
|
+
debug: () => {
|
|
30
|
+
},
|
|
31
|
+
info: () => {
|
|
32
|
+
},
|
|
33
|
+
warn: () => {
|
|
34
|
+
},
|
|
35
|
+
error: () => {
|
|
36
|
+
},
|
|
37
|
+
silly: () => {
|
|
38
|
+
},
|
|
39
|
+
trackException: () => {
|
|
40
|
+
},
|
|
41
|
+
setLevel: () => {
|
|
42
|
+
},
|
|
43
|
+
getLevel: () => "info",
|
|
44
|
+
getLogFilePath: () => null,
|
|
45
|
+
destroy: () => Promise.resolve(),
|
|
46
|
+
createChild: () => noOpLogger
|
|
47
|
+
};
|
|
48
|
+
return noOpLogger;
|
|
49
|
+
};
|
|
50
|
+
class CustomToolSchemaRegistry {
|
|
51
|
+
schemas = /* @__PURE__ */ new Map();
|
|
52
|
+
logger;
|
|
53
|
+
constructor(logger) {
|
|
54
|
+
this.logger = logger;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Register a provider's config schema.
|
|
58
|
+
* Called automatically when a custom tool provider is registered.
|
|
59
|
+
*
|
|
60
|
+
* @param type Provider type (must match the 'type' field in config)
|
|
61
|
+
* @param schema Zod schema for the provider's configuration
|
|
62
|
+
*
|
|
63
|
+
* @throws Error if schema is already registered for this type
|
|
64
|
+
*/
|
|
65
|
+
register(type, schema) {
|
|
66
|
+
if (this.schemas.has(type)) {
|
|
67
|
+
throw new Error(`Config schema already registered for provider type: ${type}`);
|
|
68
|
+
}
|
|
69
|
+
this.schemas.set(type, schema);
|
|
70
|
+
this.logger.debug(`Registered config schema for provider: ${type}`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get a provider's config schema.
|
|
74
|
+
*
|
|
75
|
+
* @param type Provider type
|
|
76
|
+
* @returns The registered schema, or undefined if not found
|
|
77
|
+
*/
|
|
78
|
+
get(type) {
|
|
79
|
+
return this.schemas.get(type);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if a provider type has a registered schema.
|
|
83
|
+
*
|
|
84
|
+
* @param type Provider type
|
|
85
|
+
* @returns true if schema is registered
|
|
86
|
+
*/
|
|
87
|
+
has(type) {
|
|
88
|
+
return this.schemas.has(type);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get all registered provider types.
|
|
92
|
+
*
|
|
93
|
+
* @returns Array of provider type strings
|
|
94
|
+
*/
|
|
95
|
+
getRegisteredTypes() {
|
|
96
|
+
return Array.from(this.schemas.keys());
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create a discriminated union schema for all registered providers.
|
|
100
|
+
* This enables early validation of provider-specific fields at config load time.
|
|
101
|
+
*
|
|
102
|
+
* The union is discriminated by the 'type' field, which provides better error
|
|
103
|
+
* messages when validation fails.
|
|
104
|
+
*
|
|
105
|
+
* @returns Discriminated union schema if providers are registered,
|
|
106
|
+
* passthrough schema otherwise (for backward compatibility)
|
|
107
|
+
*/
|
|
108
|
+
createUnionSchema() {
|
|
109
|
+
const types = this.getRegisteredTypes();
|
|
110
|
+
if (types.length === 0) {
|
|
111
|
+
this.logger.debug(
|
|
112
|
+
"No provider schemas registered - using passthrough schema for custom tools"
|
|
113
|
+
);
|
|
114
|
+
return import_zod.z.object({
|
|
115
|
+
type: import_zod.z.string().describe("Custom tool provider type")
|
|
116
|
+
}).passthrough().describe(
|
|
117
|
+
"Custom tool provider configuration (no schemas registered - validation deferred to runtime)"
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
const schemas = [];
|
|
121
|
+
for (const type of types) {
|
|
122
|
+
const schema = this.get(type);
|
|
123
|
+
if (schema) {
|
|
124
|
+
schemas.push(schema);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (schemas.length === 0) {
|
|
128
|
+
this.logger.warn("No schemas found despite having registered types");
|
|
129
|
+
return import_zod.z.object({
|
|
130
|
+
type: import_zod.z.string()
|
|
131
|
+
}).passthrough();
|
|
132
|
+
}
|
|
133
|
+
if (schemas.length === 1) {
|
|
134
|
+
this.logger.debug(`Using single provider schema: ${types[0]}`);
|
|
135
|
+
return schemas[0];
|
|
136
|
+
}
|
|
137
|
+
this.logger.debug(
|
|
138
|
+
`Creating union schema for ${schemas.length} providers: ${types.join(", ")}`
|
|
139
|
+
);
|
|
140
|
+
return import_zod.z.union(schemas);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Clear all registered schemas.
|
|
144
|
+
* Primarily used for testing.
|
|
145
|
+
*/
|
|
146
|
+
clear() {
|
|
147
|
+
this.schemas.clear();
|
|
148
|
+
this.logger.debug("Cleared all registered provider schemas");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
let globalInstance;
|
|
152
|
+
function getCustomToolSchemaRegistry(logger) {
|
|
153
|
+
if (!globalInstance) {
|
|
154
|
+
const registryLogger = logger ? logger.createChild(import_types.DextoLogComponent.TOOLS) : createNoOpLogger();
|
|
155
|
+
globalInstance = new CustomToolSchemaRegistry(registryLogger);
|
|
156
|
+
}
|
|
157
|
+
return globalInstance;
|
|
158
|
+
}
|
|
159
|
+
const customToolSchemaRegistry = getCustomToolSchemaRegistry();
|
|
160
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
161
|
+
0 && (module.exports = {
|
|
162
|
+
customToolSchemaRegistry,
|
|
163
|
+
getCustomToolSchemaRegistry
|
|
164
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Tool Schema Registry
|
|
3
|
+
*
|
|
4
|
+
* Registry for custom tool provider configuration schemas.
|
|
5
|
+
* Allows core to validate provider-specific fields at config load time
|
|
6
|
+
* by building a discriminated union of all registered schemas.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* 1. Providers register their config schemas when they register with customToolRegistry
|
|
10
|
+
* 2. Core uses this registry to build a discriminated union schema at runtime
|
|
11
|
+
* 3. Agent config validation uses the union to validate provider-specific fields early
|
|
12
|
+
*
|
|
13
|
+
* Benefits:
|
|
14
|
+
* - Early validation (at config load time, not runtime)
|
|
15
|
+
* - Type safety (full Zod validation for all provider fields)
|
|
16
|
+
* - IDE support (TypeScript knows all provider fields)
|
|
17
|
+
* - Single source of truth (provider schema defines everything)
|
|
18
|
+
*/
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import type { IDextoLogger } from '../logger/v2/types.js';
|
|
21
|
+
declare class CustomToolSchemaRegistry {
|
|
22
|
+
private schemas;
|
|
23
|
+
private logger;
|
|
24
|
+
constructor(logger: IDextoLogger);
|
|
25
|
+
/**
|
|
26
|
+
* Register a provider's config schema.
|
|
27
|
+
* Called automatically when a custom tool provider is registered.
|
|
28
|
+
*
|
|
29
|
+
* @param type Provider type (must match the 'type' field in config)
|
|
30
|
+
* @param schema Zod schema for the provider's configuration
|
|
31
|
+
*
|
|
32
|
+
* @throws Error if schema is already registered for this type
|
|
33
|
+
*/
|
|
34
|
+
register<T extends z.ZodType<any>>(type: string, schema: T): void;
|
|
35
|
+
/**
|
|
36
|
+
* Get a provider's config schema.
|
|
37
|
+
*
|
|
38
|
+
* @param type Provider type
|
|
39
|
+
* @returns The registered schema, or undefined if not found
|
|
40
|
+
*/
|
|
41
|
+
get(type: string): z.ZodType<any> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a provider type has a registered schema.
|
|
44
|
+
*
|
|
45
|
+
* @param type Provider type
|
|
46
|
+
* @returns true if schema is registered
|
|
47
|
+
*/
|
|
48
|
+
has(type: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get all registered provider types.
|
|
51
|
+
*
|
|
52
|
+
* @returns Array of provider type strings
|
|
53
|
+
*/
|
|
54
|
+
getRegisteredTypes(): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Create a discriminated union schema for all registered providers.
|
|
57
|
+
* This enables early validation of provider-specific fields at config load time.
|
|
58
|
+
*
|
|
59
|
+
* The union is discriminated by the 'type' field, which provides better error
|
|
60
|
+
* messages when validation fails.
|
|
61
|
+
*
|
|
62
|
+
* @returns Discriminated union schema if providers are registered,
|
|
63
|
+
* passthrough schema otherwise (for backward compatibility)
|
|
64
|
+
*/
|
|
65
|
+
createUnionSchema(): z.ZodType<any>;
|
|
66
|
+
/**
|
|
67
|
+
* Clear all registered schemas.
|
|
68
|
+
* Primarily used for testing.
|
|
69
|
+
*/
|
|
70
|
+
clear(): void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get the global custom tool schema registry instance.
|
|
74
|
+
* Creates it on first access with the provided logger.
|
|
75
|
+
*
|
|
76
|
+
* @param logger Optional logger for the registry (only used on first access)
|
|
77
|
+
* @returns The global registry instance
|
|
78
|
+
*/
|
|
79
|
+
export declare function getCustomToolSchemaRegistry(logger?: IDextoLogger): CustomToolSchemaRegistry;
|
|
80
|
+
/**
|
|
81
|
+
* Global custom tool schema registry instance.
|
|
82
|
+
* Use this for registering and retrieving provider config schemas.
|
|
83
|
+
*/
|
|
84
|
+
export declare const customToolSchemaRegistry: CustomToolSchemaRegistry;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=custom-tool-schema-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-tool-schema-registry.d.ts","sourceRoot":"","sources":["../../src/tools/custom-tool-schema-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA8B1D,cAAM,wBAAwB;IAC1B,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,YAAY;IAIhC;;;;;;;;OAQG;IACH,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAQjE;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS;IAI7C;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;;;OAIG;IACH,kBAAkB,IAAI,MAAM,EAAE;IAI9B;;;;;;;;;OASG;IACH,iBAAiB,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAsDnC;;;OAGG;IACH,KAAK,IAAI,IAAI;CAIhB;AAMD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,wBAAwB,CAQ3F;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,0BAAgC,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import "../chunk-PTJYTZNU.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { DextoLogComponent } from "../logger/v2/types.js";
|
|
4
|
+
const createNoOpLogger = () => {
|
|
5
|
+
const noOpLogger = {
|
|
6
|
+
debug: () => {
|
|
7
|
+
},
|
|
8
|
+
info: () => {
|
|
9
|
+
},
|
|
10
|
+
warn: () => {
|
|
11
|
+
},
|
|
12
|
+
error: () => {
|
|
13
|
+
},
|
|
14
|
+
silly: () => {
|
|
15
|
+
},
|
|
16
|
+
trackException: () => {
|
|
17
|
+
},
|
|
18
|
+
setLevel: () => {
|
|
19
|
+
},
|
|
20
|
+
getLevel: () => "info",
|
|
21
|
+
getLogFilePath: () => null,
|
|
22
|
+
destroy: () => Promise.resolve(),
|
|
23
|
+
createChild: () => noOpLogger
|
|
24
|
+
};
|
|
25
|
+
return noOpLogger;
|
|
26
|
+
};
|
|
27
|
+
class CustomToolSchemaRegistry {
|
|
28
|
+
schemas = /* @__PURE__ */ new Map();
|
|
29
|
+
logger;
|
|
30
|
+
constructor(logger) {
|
|
31
|
+
this.logger = logger;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register a provider's config schema.
|
|
35
|
+
* Called automatically when a custom tool provider is registered.
|
|
36
|
+
*
|
|
37
|
+
* @param type Provider type (must match the 'type' field in config)
|
|
38
|
+
* @param schema Zod schema for the provider's configuration
|
|
39
|
+
*
|
|
40
|
+
* @throws Error if schema is already registered for this type
|
|
41
|
+
*/
|
|
42
|
+
register(type, schema) {
|
|
43
|
+
if (this.schemas.has(type)) {
|
|
44
|
+
throw new Error(`Config schema already registered for provider type: ${type}`);
|
|
45
|
+
}
|
|
46
|
+
this.schemas.set(type, schema);
|
|
47
|
+
this.logger.debug(`Registered config schema for provider: ${type}`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get a provider's config schema.
|
|
51
|
+
*
|
|
52
|
+
* @param type Provider type
|
|
53
|
+
* @returns The registered schema, or undefined if not found
|
|
54
|
+
*/
|
|
55
|
+
get(type) {
|
|
56
|
+
return this.schemas.get(type);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if a provider type has a registered schema.
|
|
60
|
+
*
|
|
61
|
+
* @param type Provider type
|
|
62
|
+
* @returns true if schema is registered
|
|
63
|
+
*/
|
|
64
|
+
has(type) {
|
|
65
|
+
return this.schemas.has(type);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get all registered provider types.
|
|
69
|
+
*
|
|
70
|
+
* @returns Array of provider type strings
|
|
71
|
+
*/
|
|
72
|
+
getRegisteredTypes() {
|
|
73
|
+
return Array.from(this.schemas.keys());
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a discriminated union schema for all registered providers.
|
|
77
|
+
* This enables early validation of provider-specific fields at config load time.
|
|
78
|
+
*
|
|
79
|
+
* The union is discriminated by the 'type' field, which provides better error
|
|
80
|
+
* messages when validation fails.
|
|
81
|
+
*
|
|
82
|
+
* @returns Discriminated union schema if providers are registered,
|
|
83
|
+
* passthrough schema otherwise (for backward compatibility)
|
|
84
|
+
*/
|
|
85
|
+
createUnionSchema() {
|
|
86
|
+
const types = this.getRegisteredTypes();
|
|
87
|
+
if (types.length === 0) {
|
|
88
|
+
this.logger.debug(
|
|
89
|
+
"No provider schemas registered - using passthrough schema for custom tools"
|
|
90
|
+
);
|
|
91
|
+
return z.object({
|
|
92
|
+
type: z.string().describe("Custom tool provider type")
|
|
93
|
+
}).passthrough().describe(
|
|
94
|
+
"Custom tool provider configuration (no schemas registered - validation deferred to runtime)"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
const schemas = [];
|
|
98
|
+
for (const type of types) {
|
|
99
|
+
const schema = this.get(type);
|
|
100
|
+
if (schema) {
|
|
101
|
+
schemas.push(schema);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (schemas.length === 0) {
|
|
105
|
+
this.logger.warn("No schemas found despite having registered types");
|
|
106
|
+
return z.object({
|
|
107
|
+
type: z.string()
|
|
108
|
+
}).passthrough();
|
|
109
|
+
}
|
|
110
|
+
if (schemas.length === 1) {
|
|
111
|
+
this.logger.debug(`Using single provider schema: ${types[0]}`);
|
|
112
|
+
return schemas[0];
|
|
113
|
+
}
|
|
114
|
+
this.logger.debug(
|
|
115
|
+
`Creating union schema for ${schemas.length} providers: ${types.join(", ")}`
|
|
116
|
+
);
|
|
117
|
+
return z.union(schemas);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Clear all registered schemas.
|
|
121
|
+
* Primarily used for testing.
|
|
122
|
+
*/
|
|
123
|
+
clear() {
|
|
124
|
+
this.schemas.clear();
|
|
125
|
+
this.logger.debug("Cleared all registered provider schemas");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
let globalInstance;
|
|
129
|
+
function getCustomToolSchemaRegistry(logger) {
|
|
130
|
+
if (!globalInstance) {
|
|
131
|
+
const registryLogger = logger ? logger.createChild(DextoLogComponent.TOOLS) : createNoOpLogger();
|
|
132
|
+
globalInstance = new CustomToolSchemaRegistry(registryLogger);
|
|
133
|
+
}
|
|
134
|
+
return globalInstance;
|
|
135
|
+
}
|
|
136
|
+
const customToolSchemaRegistry = getCustomToolSchemaRegistry();
|
|
137
|
+
export {
|
|
138
|
+
customToolSchemaRegistry,
|
|
139
|
+
getCustomToolSchemaRegistry
|
|
140
|
+
};
|
|
@@ -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["DIRECTORY_ACCESS_DENIED"] = "tools_directory_access_denied";
|
|
28
29
|
ToolErrorCode2["VALIDATION_FAILED"] = "tools_validation_failed";
|
|
29
30
|
ToolErrorCode2["CONFIRMATION_HANDLER_MISSING"] = "tools_confirmation_handler_missing";
|
|
30
31
|
ToolErrorCode2["CONFIRMATION_TIMEOUT"] = "tools_confirmation_timeout";
|
|
@@ -34,6 +35,8 @@ var ToolErrorCode = /* @__PURE__ */ ((ToolErrorCode2) => {
|
|
|
34
35
|
ToolErrorCode2["TOOL_UNAUTHORIZED"] = "tools_unauthorized";
|
|
35
36
|
ToolErrorCode2["CONFIG_INVALID"] = "tools_config_invalid";
|
|
36
37
|
ToolErrorCode2["FEATURE_DISABLED"] = "tools_feature_disabled";
|
|
38
|
+
ToolErrorCode2["CUSTOM_TOOL_PROVIDER_UNKNOWN"] = "tools_custom_provider_unknown";
|
|
39
|
+
ToolErrorCode2["CUSTOM_TOOL_PROVIDER_ALREADY_REGISTERED"] = "tools_custom_provider_already_registered";
|
|
37
40
|
return ToolErrorCode2;
|
|
38
41
|
})(ToolErrorCode || {});
|
|
39
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -6,6 +6,7 @@ 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
|
+
DIRECTORY_ACCESS_DENIED = "tools_directory_access_denied",
|
|
9
10
|
VALIDATION_FAILED = "tools_validation_failed",
|
|
10
11
|
CONFIRMATION_HANDLER_MISSING = "tools_confirmation_handler_missing",
|
|
11
12
|
CONFIRMATION_TIMEOUT = "tools_confirmation_timeout",
|
|
@@ -14,6 +15,8 @@ export declare enum ToolErrorCode {
|
|
|
14
15
|
TOOL_INVALID_ARGS = "tools_invalid_args",
|
|
15
16
|
TOOL_UNAUTHORIZED = "tools_unauthorized",
|
|
16
17
|
CONFIG_INVALID = "tools_config_invalid",
|
|
17
|
-
FEATURE_DISABLED = "tools_feature_disabled"
|
|
18
|
+
FEATURE_DISABLED = "tools_feature_disabled",
|
|
19
|
+
CUSTOM_TOOL_PROVIDER_UNKNOWN = "tools_custom_provider_unknown",
|
|
20
|
+
CUSTOM_TOOL_PROVIDER_ALREADY_REGISTERED = "tools_custom_provider_already_registered"
|
|
18
21
|
}
|
|
19
22
|
//# 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;
|
|
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;IAC3C,uBAAuB,kCAAkC;IAGzD,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;IAG3C,4BAA4B,kCAAkC;IAC9D,uCAAuC,6CAA6C;CACvF"}
|
|
@@ -3,6 +3,7 @@ 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["DIRECTORY_ACCESS_DENIED"] = "tools_directory_access_denied";
|
|
6
7
|
ToolErrorCode2["VALIDATION_FAILED"] = "tools_validation_failed";
|
|
7
8
|
ToolErrorCode2["CONFIRMATION_HANDLER_MISSING"] = "tools_confirmation_handler_missing";
|
|
8
9
|
ToolErrorCode2["CONFIRMATION_TIMEOUT"] = "tools_confirmation_timeout";
|
|
@@ -12,6 +13,8 @@ var ToolErrorCode = /* @__PURE__ */ ((ToolErrorCode2) => {
|
|
|
12
13
|
ToolErrorCode2["TOOL_UNAUTHORIZED"] = "tools_unauthorized";
|
|
13
14
|
ToolErrorCode2["CONFIG_INVALID"] = "tools_config_invalid";
|
|
14
15
|
ToolErrorCode2["FEATURE_DISABLED"] = "tools_feature_disabled";
|
|
16
|
+
ToolErrorCode2["CUSTOM_TOOL_PROVIDER_UNKNOWN"] = "tools_custom_provider_unknown";
|
|
17
|
+
ToolErrorCode2["CUSTOM_TOOL_PROVIDER_ALREADY_REGISTERED"] = "tools_custom_provider_already_registered";
|
|
15
18
|
return ToolErrorCode2;
|
|
16
19
|
})(ToolErrorCode || {});
|
|
17
20
|
export {
|
package/dist/tools/errors.cjs
CHANGED
|
@@ -61,6 +61,21 @@ class ToolError {
|
|
|
61
61
|
{ toolName, sessionId }
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Directory access denied by user
|
|
66
|
+
* Used when a file tool tries to access a path outside allowed directories
|
|
67
|
+
* and the user denies the directory access approval
|
|
68
|
+
*/
|
|
69
|
+
static directoryAccessDenied(directory, sessionId) {
|
|
70
|
+
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
71
|
+
import_error_codes.ToolErrorCode.DIRECTORY_ACCESS_DENIED,
|
|
72
|
+
import_types.ErrorScope.TOOLS,
|
|
73
|
+
import_types.ErrorType.FORBIDDEN,
|
|
74
|
+
`Access to directory '${directory}' was denied`,
|
|
75
|
+
{ directory, sessionId },
|
|
76
|
+
"Request access to the directory or work within the allowed working directory"
|
|
77
|
+
);
|
|
78
|
+
}
|
|
64
79
|
/**
|
|
65
80
|
* Tool execution timeout
|
|
66
81
|
*/
|
|
@@ -188,6 +203,32 @@ class ToolError {
|
|
|
188
203
|
]
|
|
189
204
|
);
|
|
190
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Unknown custom tool provider type
|
|
208
|
+
*/
|
|
209
|
+
static unknownCustomToolProvider(type, availableTypes) {
|
|
210
|
+
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
211
|
+
import_error_codes.ToolErrorCode.CUSTOM_TOOL_PROVIDER_UNKNOWN,
|
|
212
|
+
import_types.ErrorScope.TOOLS,
|
|
213
|
+
import_types.ErrorType.USER,
|
|
214
|
+
`Unknown custom tool provider: '${type}'`,
|
|
215
|
+
{ type, availableTypes },
|
|
216
|
+
`Available types: ${availableTypes.length > 0 ? availableTypes.join(", ") : "none"}`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Custom tool provider already registered
|
|
221
|
+
*/
|
|
222
|
+
static customToolProviderAlreadyRegistered(type) {
|
|
223
|
+
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
224
|
+
import_error_codes.ToolErrorCode.CUSTOM_TOOL_PROVIDER_ALREADY_REGISTERED,
|
|
225
|
+
import_types.ErrorScope.TOOLS,
|
|
226
|
+
import_types.ErrorType.USER,
|
|
227
|
+
`Custom tool provider '${type}' is already registered`,
|
|
228
|
+
{ type },
|
|
229
|
+
`Use unregister() first if you want to replace it`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
191
232
|
}
|
|
192
233
|
// Annotate the CommonJS export names for ESM import in node:
|
|
193
234
|
0 && (module.exports = {
|
package/dist/tools/errors.d.ts
CHANGED
|
@@ -25,6 +25,15 @@ export declare class ToolError {
|
|
|
25
25
|
toolName: string;
|
|
26
26
|
sessionId: string | undefined;
|
|
27
27
|
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Directory access denied by user
|
|
30
|
+
* Used when a file tool tries to access a path outside allowed directories
|
|
31
|
+
* and the user denies the directory access approval
|
|
32
|
+
*/
|
|
33
|
+
static directoryAccessDenied(directory: string, sessionId?: string): DextoRuntimeError<{
|
|
34
|
+
directory: string;
|
|
35
|
+
sessionId: string | undefined;
|
|
36
|
+
}>;
|
|
28
37
|
/**
|
|
29
38
|
* Tool execution timeout
|
|
30
39
|
*/
|
|
@@ -94,5 +103,13 @@ export declare class ToolError {
|
|
|
94
103
|
toolName: string;
|
|
95
104
|
missingFeatures: string[];
|
|
96
105
|
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Unknown custom tool provider type
|
|
108
|
+
*/
|
|
109
|
+
static unknownCustomToolProvider(type: string, availableTypes: string[]): DextoRuntimeError;
|
|
110
|
+
/**
|
|
111
|
+
* Custom tool provider already registered
|
|
112
|
+
*/
|
|
113
|
+
static customToolProviderAlreadyRegistered(type: string): DextoRuntimeError;
|
|
97
114
|
}
|
|
98
115
|
//# 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;;;;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;
|
|
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;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;;IAWlE;;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;IAcrE;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,iBAAiB;IAW3F;;OAEG;IACH,MAAM,CAAC,mCAAmC,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB;CAU9E"}
|
package/dist/tools/errors.js
CHANGED
|
@@ -39,6 +39,21 @@ class ToolError {
|
|
|
39
39
|
{ toolName, sessionId }
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Directory access denied by user
|
|
44
|
+
* Used when a file tool tries to access a path outside allowed directories
|
|
45
|
+
* and the user denies the directory access approval
|
|
46
|
+
*/
|
|
47
|
+
static directoryAccessDenied(directory, sessionId) {
|
|
48
|
+
return new DextoRuntimeError(
|
|
49
|
+
ToolErrorCode.DIRECTORY_ACCESS_DENIED,
|
|
50
|
+
ErrorScope.TOOLS,
|
|
51
|
+
ErrorType.FORBIDDEN,
|
|
52
|
+
`Access to directory '${directory}' was denied`,
|
|
53
|
+
{ directory, sessionId },
|
|
54
|
+
"Request access to the directory or work within the allowed working directory"
|
|
55
|
+
);
|
|
56
|
+
}
|
|
42
57
|
/**
|
|
43
58
|
* Tool execution timeout
|
|
44
59
|
*/
|
|
@@ -166,6 +181,32 @@ class ToolError {
|
|
|
166
181
|
]
|
|
167
182
|
);
|
|
168
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Unknown custom tool provider type
|
|
186
|
+
*/
|
|
187
|
+
static unknownCustomToolProvider(type, availableTypes) {
|
|
188
|
+
return new DextoRuntimeError(
|
|
189
|
+
ToolErrorCode.CUSTOM_TOOL_PROVIDER_UNKNOWN,
|
|
190
|
+
ErrorScope.TOOLS,
|
|
191
|
+
ErrorType.USER,
|
|
192
|
+
`Unknown custom tool provider: '${type}'`,
|
|
193
|
+
{ type, availableTypes },
|
|
194
|
+
`Available types: ${availableTypes.length > 0 ? availableTypes.join(", ") : "none"}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Custom tool provider already registered
|
|
199
|
+
*/
|
|
200
|
+
static customToolProviderAlreadyRegistered(type) {
|
|
201
|
+
return new DextoRuntimeError(
|
|
202
|
+
ToolErrorCode.CUSTOM_TOOL_PROVIDER_ALREADY_REGISTERED,
|
|
203
|
+
ErrorScope.TOOLS,
|
|
204
|
+
ErrorType.USER,
|
|
205
|
+
`Custom tool provider '${type}' is already registered`,
|
|
206
|
+
{ type },
|
|
207
|
+
`Use unregister() first if you want to replace it`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
169
210
|
}
|
|
170
211
|
export {
|
|
171
212
|
ToolError
|
package/dist/tools/index.cjs
CHANGED
|
@@ -19,17 +19,29 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var tools_exports = {};
|
|
21
21
|
__export(tools_exports, {
|
|
22
|
-
|
|
22
|
+
ToolError: () => import_errors.ToolError,
|
|
23
|
+
ToolErrorCode: () => import_error_codes.ToolErrorCode,
|
|
24
|
+
ToolManager: () => import_tool_manager.ToolManager,
|
|
25
|
+
customToolRegistry: () => import_custom_tool_registry.customToolRegistry,
|
|
26
|
+
customToolSchemaRegistry: () => import_custom_tool_schema_registry.customToolSchemaRegistry
|
|
23
27
|
});
|
|
24
28
|
module.exports = __toCommonJS(tools_exports);
|
|
25
29
|
__reExport(tools_exports, require("./types.js"), module.exports);
|
|
26
30
|
__reExport(tools_exports, require("./display-types.js"), module.exports);
|
|
27
31
|
__reExport(tools_exports, require("./internal-tools/index.js"), module.exports);
|
|
32
|
+
var import_custom_tool_registry = require("./custom-tool-registry.js");
|
|
33
|
+
var import_custom_tool_schema_registry = require("./custom-tool-schema-registry.js");
|
|
28
34
|
__reExport(tools_exports, require("./schemas.js"), module.exports);
|
|
35
|
+
var import_errors = require("./errors.js");
|
|
36
|
+
var import_error_codes = require("./error-codes.js");
|
|
29
37
|
var import_tool_manager = require("./tool-manager.js");
|
|
30
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
39
|
0 && (module.exports = {
|
|
40
|
+
ToolError,
|
|
41
|
+
ToolErrorCode,
|
|
32
42
|
ToolManager,
|
|
43
|
+
customToolRegistry,
|
|
44
|
+
customToolSchemaRegistry,
|
|
33
45
|
...require("./types.js"),
|
|
34
46
|
...require("./display-types.js"),
|
|
35
47
|
...require("./internal-tools/index.js"),
|