@dexto/core 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +5959 -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 +6 -3
- package/dist/events/index.d.ts +35 -19
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +5 -3
- 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/provider-options.cjs +87 -0
- package/dist/llm/executor/provider-options.d.ts +49 -0
- package/dist/llm/executor/provider-options.d.ts.map +1 -0
- package/dist/llm/executor/provider-options.js +63 -0
- package/dist/llm/executor/stream-processor.cjs +22 -11
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +22 -11
- package/dist/llm/executor/turn-executor.cjs +60 -23
- package/dist/llm/executor/turn-executor.d.ts +7 -5
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +60 -23
- package/dist/llm/formatters/vercel.cjs +15 -3
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +15 -3
- 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 +604 -9
- package/dist/llm/registry.d.ts +35 -0
- package/dist/llm/registry.d.ts.map +1 -1
- package/dist/llm/registry.js +600 -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 +107 -81
- package/dist/llm/schemas.d.ts +181 -22
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +107 -81
- 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 +8 -3
- 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 +8 -3
- 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/logger/logger.cjs +7 -3
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +7 -3
- 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 +3 -3
- 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 +109 -0
- package/dist/providers/discovery.d.ts +96 -0
- package/dist/providers/discovery.d.ts.map +1 -0
- package/dist/providers/discovery.js +84 -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/session/history/database.cjs +49 -15
- package/dist/session/history/database.d.ts.map +1 -1
- package/dist/session/history/database.js +49 -15
- package/dist/session/session-manager.cjs +2 -1
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +2 -1
- 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/postgres-store.cjs +174 -78
- package/dist/storage/database/postgres-store.d.ts +19 -0
- package/dist/storage/database/postgres-store.d.ts.map +1 -1
- package/dist/storage/database/postgres-store.js +174 -78
- 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 +12 -3
- package/dist/storage/database/schemas.d.ts +11 -4
- package/dist/storage/database/schemas.d.ts.map +1 -1
- package/dist/storage/database/schemas.js +8 -2
- 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 +24 -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 +126 -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 +153 -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 +153 -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
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { ProcessError } from "../../../process/errors.js";
|
|
5
|
-
const BashExecInputSchema = z.object({
|
|
6
|
-
command: z.string().describe("Shell command to execute"),
|
|
7
|
-
description: z.string().optional().describe("Human-readable description of what the command does (5-10 words)"),
|
|
8
|
-
timeout: z.number().int().positive().max(6e5).optional().default(12e4).describe(
|
|
9
|
-
"Timeout in milliseconds (max: 600000 = 10 minutes, default: 120000 = 2 minutes)"
|
|
10
|
-
),
|
|
11
|
-
run_in_background: z.boolean().optional().default(false).describe("Execute command in background (default: false)"),
|
|
12
|
-
cwd: z.string().optional().describe("Working directory for command execution (optional)")
|
|
13
|
-
}).strict();
|
|
14
|
-
function createBashExecTool(processService) {
|
|
15
|
-
return {
|
|
16
|
-
id: "bash_exec",
|
|
17
|
-
description: "Execute a shell command with 2-minute default timeout. Returns stdout, stderr, exit code, and duration. For long-running commands (servers, watchers, npm run dev), MUST use run_in_background=true (use bash_output to retrieve results later). Commands ending with & are blocked - use run_in_background instead. Requires approval (with pattern-based session memory). Always quote file paths with spaces. Security: dangerous commands are blocked, injection attempts are detected.",
|
|
18
|
-
inputSchema: BashExecInputSchema,
|
|
19
|
-
/**
|
|
20
|
-
* Generate preview for approval UI - shows the command to be executed
|
|
21
|
-
*/
|
|
22
|
-
generatePreview: async (input, _context) => {
|
|
23
|
-
const { command, run_in_background } = input;
|
|
24
|
-
const preview = {
|
|
25
|
-
type: "shell",
|
|
26
|
-
command,
|
|
27
|
-
exitCode: 0,
|
|
28
|
-
// Placeholder - not executed yet
|
|
29
|
-
duration: 0,
|
|
30
|
-
// Placeholder - not executed yet
|
|
31
|
-
...run_in_background !== void 0 && { isBackground: run_in_background }
|
|
32
|
-
};
|
|
33
|
-
return preview;
|
|
34
|
-
},
|
|
35
|
-
execute: async (input, context) => {
|
|
36
|
-
const { command, description, timeout, run_in_background, cwd } = input;
|
|
37
|
-
let validatedCwd = cwd;
|
|
38
|
-
if (cwd) {
|
|
39
|
-
const baseDir = processService.getConfig().workingDirectory || process.cwd();
|
|
40
|
-
const candidatePath = path.isAbsolute(cwd) ? path.resolve(cwd) : path.resolve(baseDir, cwd);
|
|
41
|
-
const relativePath = path.relative(baseDir, candidatePath);
|
|
42
|
-
const isOutsideBase = relativePath.startsWith("..") || path.isAbsolute(relativePath);
|
|
43
|
-
if (isOutsideBase) {
|
|
44
|
-
throw ProcessError.invalidWorkingDirectory(
|
|
45
|
-
cwd,
|
|
46
|
-
`Working directory must be within ${baseDir}`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
validatedCwd = candidatePath;
|
|
50
|
-
}
|
|
51
|
-
const result = await processService.executeCommand(command, {
|
|
52
|
-
description,
|
|
53
|
-
timeout,
|
|
54
|
-
runInBackground: run_in_background,
|
|
55
|
-
cwd: validatedCwd,
|
|
56
|
-
// Pass abort signal for cancellation support
|
|
57
|
-
abortSignal: context?.abortSignal
|
|
58
|
-
});
|
|
59
|
-
if ("stdout" in result) {
|
|
60
|
-
const _display = {
|
|
61
|
-
type: "shell",
|
|
62
|
-
command,
|
|
63
|
-
exitCode: result.exitCode,
|
|
64
|
-
duration: result.duration,
|
|
65
|
-
isBackground: false,
|
|
66
|
-
stdout: result.stdout,
|
|
67
|
-
stderr: result.stderr
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
stdout: result.stdout,
|
|
71
|
-
stderr: result.stderr,
|
|
72
|
-
exit_code: result.exitCode,
|
|
73
|
-
duration: result.duration,
|
|
74
|
-
_display
|
|
75
|
-
};
|
|
76
|
-
} else {
|
|
77
|
-
const _display = {
|
|
78
|
-
type: "shell",
|
|
79
|
-
command,
|
|
80
|
-
exitCode: 0,
|
|
81
|
-
// Background process hasn't exited yet
|
|
82
|
-
duration: 0,
|
|
83
|
-
// Still running
|
|
84
|
-
isBackground: true
|
|
85
|
-
};
|
|
86
|
-
return {
|
|
87
|
-
process_id: result.processId,
|
|
88
|
-
message: `Command started in background with ID: ${result.processId}. Use bash_output to retrieve output.`,
|
|
89
|
-
_display
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
export {
|
|
96
|
-
createBashExecTool
|
|
97
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var bash_output_tool_exports = {};
|
|
20
|
-
__export(bash_output_tool_exports, {
|
|
21
|
-
createBashOutputTool: () => createBashOutputTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(bash_output_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
const BashOutputInputSchema = import_zod.z.object({
|
|
26
|
-
process_id: import_zod.z.string().describe("Process ID from bash_exec (when run_in_background=true)")
|
|
27
|
-
}).strict();
|
|
28
|
-
function createBashOutputTool(processService) {
|
|
29
|
-
return {
|
|
30
|
-
id: "bash_output",
|
|
31
|
-
description: "Retrieve output from a background process started with bash_exec. Returns stdout, stderr, status (running/completed/failed), exit code, and duration. Each call returns only new output since last read. The output buffer is cleared after reading. Use this tool to monitor long-running commands.",
|
|
32
|
-
inputSchema: BashOutputInputSchema,
|
|
33
|
-
execute: async (input, _context) => {
|
|
34
|
-
const { process_id } = input;
|
|
35
|
-
const result = await processService.getProcessOutput(process_id);
|
|
36
|
-
return {
|
|
37
|
-
stdout: result.stdout,
|
|
38
|
-
stderr: result.stderr,
|
|
39
|
-
status: result.status,
|
|
40
|
-
...result.exitCode !== void 0 && { exit_code: result.exitCode },
|
|
41
|
-
...result.duration !== void 0 && { duration: result.duration }
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
createBashOutputTool
|
|
49
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bash Output Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for retrieving output from background processes
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { ProcessService } from '../../../process/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the bash_output internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createBashOutputTool(processService: ProcessService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=bash-output-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash-output-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/bash-output-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,cAAc,GAAG,YAAY,CAsBjF"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const BashOutputInputSchema = z.object({
|
|
4
|
-
process_id: z.string().describe("Process ID from bash_exec (when run_in_background=true)")
|
|
5
|
-
}).strict();
|
|
6
|
-
function createBashOutputTool(processService) {
|
|
7
|
-
return {
|
|
8
|
-
id: "bash_output",
|
|
9
|
-
description: "Retrieve output from a background process started with bash_exec. Returns stdout, stderr, status (running/completed/failed), exit code, and duration. Each call returns only new output since last read. The output buffer is cleared after reading. Use this tool to monitor long-running commands.",
|
|
10
|
-
inputSchema: BashOutputInputSchema,
|
|
11
|
-
execute: async (input, _context) => {
|
|
12
|
-
const { process_id } = input;
|
|
13
|
-
const result = await processService.getProcessOutput(process_id);
|
|
14
|
-
return {
|
|
15
|
-
stdout: result.stdout,
|
|
16
|
-
stderr: result.stderr,
|
|
17
|
-
status: result.status,
|
|
18
|
-
...result.exitCode !== void 0 && { exit_code: result.exitCode },
|
|
19
|
-
...result.duration !== void 0 && { duration: result.duration }
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
createBashOutputTool
|
|
26
|
-
};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var edit_file_tool_exports = {};
|
|
20
|
-
__export(edit_file_tool_exports, {
|
|
21
|
-
createEditFileTool: () => createEditFileTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(edit_file_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
var import_diff = require("diff");
|
|
26
|
-
var import_errors = require("../../errors.js");
|
|
27
|
-
var import_error_codes = require("../../error-codes.js");
|
|
28
|
-
var import_errors2 = require("../../../errors/index.js");
|
|
29
|
-
const EditFileInputSchema = import_zod.z.object({
|
|
30
|
-
file_path: import_zod.z.string().describe("Absolute path to the file to edit"),
|
|
31
|
-
old_string: import_zod.z.string().describe("Text to replace (must be unique unless replace_all is true)"),
|
|
32
|
-
new_string: import_zod.z.string().describe("Replacement text"),
|
|
33
|
-
replace_all: import_zod.z.boolean().optional().default(false).describe("Replace all occurrences (default: false, requires unique match)")
|
|
34
|
-
}).strict();
|
|
35
|
-
function generateDiffPreview(filePath, originalContent, newContent) {
|
|
36
|
-
const unified = (0, import_diff.createPatch)(filePath, originalContent, newContent, "before", "after", {
|
|
37
|
-
context: 3
|
|
38
|
-
});
|
|
39
|
-
const additions = (unified.match(/^\+[^+]/gm) || []).length;
|
|
40
|
-
const deletions = (unified.match(/^-[^-]/gm) || []).length;
|
|
41
|
-
return {
|
|
42
|
-
type: "diff",
|
|
43
|
-
unified,
|
|
44
|
-
filename: filePath,
|
|
45
|
-
additions,
|
|
46
|
-
deletions
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function createEditFileTool(fileSystemService) {
|
|
50
|
-
return {
|
|
51
|
-
id: "edit_file",
|
|
52
|
-
description: "Edit a file by replacing text. By default, old_string must be unique in the file (will error if found multiple times). Set replace_all=true to replace all occurrences. Automatically creates backup before editing. Requires approval. Returns success status, path, number of changes made, and backup path.",
|
|
53
|
-
inputSchema: EditFileInputSchema,
|
|
54
|
-
/**
|
|
55
|
-
* Generate preview for approval UI - shows diff without modifying file
|
|
56
|
-
* Throws ToolError.validationFailed() for validation errors (file not found, string not found)
|
|
57
|
-
*/
|
|
58
|
-
generatePreview: async (input, _context) => {
|
|
59
|
-
const { file_path, old_string, new_string, replace_all } = input;
|
|
60
|
-
try {
|
|
61
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
62
|
-
const originalContent = originalFile.content;
|
|
63
|
-
if (!replace_all) {
|
|
64
|
-
const occurrences = originalContent.split(old_string).length - 1;
|
|
65
|
-
if (occurrences > 1) {
|
|
66
|
-
throw import_errors.ToolError.validationFailed(
|
|
67
|
-
"edit_file",
|
|
68
|
-
`String found ${occurrences} times in file. Set replace_all=true to replace all, or provide more context to make old_string unique.`,
|
|
69
|
-
{ file_path, occurrences }
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const newContent = replace_all ? originalContent.split(old_string).join(new_string) : originalContent.replace(old_string, new_string);
|
|
74
|
-
if (originalContent === newContent) {
|
|
75
|
-
throw import_errors.ToolError.validationFailed(
|
|
76
|
-
"edit_file",
|
|
77
|
-
`String not found in file: "${old_string.slice(0, 50)}${old_string.length > 50 ? "..." : ""}"`,
|
|
78
|
-
{ file_path, old_string_preview: old_string.slice(0, 100) }
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
return generateDiffPreview(file_path, originalContent, newContent);
|
|
82
|
-
} catch (error) {
|
|
83
|
-
if (error instanceof import_errors2.DextoRuntimeError && error.code === import_error_codes.ToolErrorCode.VALIDATION_FAILED) {
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
if (error instanceof import_errors2.DextoRuntimeError) {
|
|
87
|
-
throw import_errors.ToolError.validationFailed("edit_file", error.message, {
|
|
88
|
-
file_path,
|
|
89
|
-
originalErrorCode: error.code
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
execute: async (input, _context) => {
|
|
96
|
-
const { file_path, old_string, new_string, replace_all } = input;
|
|
97
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
98
|
-
const originalContent = originalFile.content;
|
|
99
|
-
const result = await fileSystemService.editFile(
|
|
100
|
-
file_path,
|
|
101
|
-
{
|
|
102
|
-
oldString: old_string,
|
|
103
|
-
newString: new_string,
|
|
104
|
-
replaceAll: replace_all
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
backup: true
|
|
108
|
-
// Always create backup for internal tools
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
const newFile = await fileSystemService.readFile(file_path);
|
|
112
|
-
const newContent = newFile.content;
|
|
113
|
-
const _display = generateDiffPreview(file_path, originalContent, newContent);
|
|
114
|
-
return {
|
|
115
|
-
success: result.success,
|
|
116
|
-
path: result.path,
|
|
117
|
-
changes_count: result.changesCount,
|
|
118
|
-
...result.backupPath && { backup_path: result.backupPath },
|
|
119
|
-
_display
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
-
0 && (module.exports = {
|
|
126
|
-
createEditFileTool
|
|
127
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Edit File Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for editing files by replacing text (requires approval)
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the edit_file internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createEditFileTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=edit-file-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/edit-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA8CjE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAuGrF"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { createPatch } from "diff";
|
|
4
|
-
import { ToolError } from "../../errors.js";
|
|
5
|
-
import { ToolErrorCode } from "../../error-codes.js";
|
|
6
|
-
import { DextoRuntimeError } from "../../../errors/index.js";
|
|
7
|
-
const EditFileInputSchema = z.object({
|
|
8
|
-
file_path: z.string().describe("Absolute path to the file to edit"),
|
|
9
|
-
old_string: z.string().describe("Text to replace (must be unique unless replace_all is true)"),
|
|
10
|
-
new_string: z.string().describe("Replacement text"),
|
|
11
|
-
replace_all: z.boolean().optional().default(false).describe("Replace all occurrences (default: false, requires unique match)")
|
|
12
|
-
}).strict();
|
|
13
|
-
function generateDiffPreview(filePath, originalContent, newContent) {
|
|
14
|
-
const unified = createPatch(filePath, originalContent, newContent, "before", "after", {
|
|
15
|
-
context: 3
|
|
16
|
-
});
|
|
17
|
-
const additions = (unified.match(/^\+[^+]/gm) || []).length;
|
|
18
|
-
const deletions = (unified.match(/^-[^-]/gm) || []).length;
|
|
19
|
-
return {
|
|
20
|
-
type: "diff",
|
|
21
|
-
unified,
|
|
22
|
-
filename: filePath,
|
|
23
|
-
additions,
|
|
24
|
-
deletions
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function createEditFileTool(fileSystemService) {
|
|
28
|
-
return {
|
|
29
|
-
id: "edit_file",
|
|
30
|
-
description: "Edit a file by replacing text. By default, old_string must be unique in the file (will error if found multiple times). Set replace_all=true to replace all occurrences. Automatically creates backup before editing. Requires approval. Returns success status, path, number of changes made, and backup path.",
|
|
31
|
-
inputSchema: EditFileInputSchema,
|
|
32
|
-
/**
|
|
33
|
-
* Generate preview for approval UI - shows diff without modifying file
|
|
34
|
-
* Throws ToolError.validationFailed() for validation errors (file not found, string not found)
|
|
35
|
-
*/
|
|
36
|
-
generatePreview: async (input, _context) => {
|
|
37
|
-
const { file_path, old_string, new_string, replace_all } = input;
|
|
38
|
-
try {
|
|
39
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
40
|
-
const originalContent = originalFile.content;
|
|
41
|
-
if (!replace_all) {
|
|
42
|
-
const occurrences = originalContent.split(old_string).length - 1;
|
|
43
|
-
if (occurrences > 1) {
|
|
44
|
-
throw ToolError.validationFailed(
|
|
45
|
-
"edit_file",
|
|
46
|
-
`String found ${occurrences} times in file. Set replace_all=true to replace all, or provide more context to make old_string unique.`,
|
|
47
|
-
{ file_path, occurrences }
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const newContent = replace_all ? originalContent.split(old_string).join(new_string) : originalContent.replace(old_string, new_string);
|
|
52
|
-
if (originalContent === newContent) {
|
|
53
|
-
throw ToolError.validationFailed(
|
|
54
|
-
"edit_file",
|
|
55
|
-
`String not found in file: "${old_string.slice(0, 50)}${old_string.length > 50 ? "..." : ""}"`,
|
|
56
|
-
{ file_path, old_string_preview: old_string.slice(0, 100) }
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
return generateDiffPreview(file_path, originalContent, newContent);
|
|
60
|
-
} catch (error) {
|
|
61
|
-
if (error instanceof DextoRuntimeError && error.code === ToolErrorCode.VALIDATION_FAILED) {
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
if (error instanceof DextoRuntimeError) {
|
|
65
|
-
throw ToolError.validationFailed("edit_file", error.message, {
|
|
66
|
-
file_path,
|
|
67
|
-
originalErrorCode: error.code
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
execute: async (input, _context) => {
|
|
74
|
-
const { file_path, old_string, new_string, replace_all } = input;
|
|
75
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
76
|
-
const originalContent = originalFile.content;
|
|
77
|
-
const result = await fileSystemService.editFile(
|
|
78
|
-
file_path,
|
|
79
|
-
{
|
|
80
|
-
oldString: old_string,
|
|
81
|
-
newString: new_string,
|
|
82
|
-
replaceAll: replace_all
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
backup: true
|
|
86
|
-
// Always create backup for internal tools
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
const newFile = await fileSystemService.readFile(file_path);
|
|
90
|
-
const newContent = newFile.content;
|
|
91
|
-
const _display = generateDiffPreview(file_path, originalContent, newContent);
|
|
92
|
-
return {
|
|
93
|
-
success: result.success,
|
|
94
|
-
path: result.path,
|
|
95
|
-
changes_count: result.changesCount,
|
|
96
|
-
...result.backupPath && { backup_path: result.backupPath },
|
|
97
|
-
_display
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
export {
|
|
103
|
-
createEditFileTool
|
|
104
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var glob_files_tool_exports = {};
|
|
20
|
-
__export(glob_files_tool_exports, {
|
|
21
|
-
createGlobFilesTool: () => createGlobFilesTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(glob_files_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
const GlobFilesInputSchema = import_zod.z.object({
|
|
26
|
-
pattern: import_zod.z.string().describe('Glob pattern to match files (e.g., "**/*.ts", "src/**/*.js")'),
|
|
27
|
-
path: import_zod.z.string().optional().describe("Base directory to search from (defaults to working directory)"),
|
|
28
|
-
max_results: import_zod.z.number().int().positive().optional().default(1e3).describe("Maximum number of results to return (default: 1000)")
|
|
29
|
-
}).strict();
|
|
30
|
-
function createGlobFilesTool(fileSystemService) {
|
|
31
|
-
return {
|
|
32
|
-
id: "glob_files",
|
|
33
|
-
description: "Find files matching a glob pattern. Supports standard glob syntax like **/*.js for recursive matches, *.ts for files in current directory, and src/**/*.tsx for nested paths. Returns array of file paths with metadata (size, modified date). Results are limited to allowed paths only.",
|
|
34
|
-
inputSchema: GlobFilesInputSchema,
|
|
35
|
-
execute: async (input, _context) => {
|
|
36
|
-
const { pattern, path, max_results } = input;
|
|
37
|
-
const result = await fileSystemService.globFiles(pattern, {
|
|
38
|
-
cwd: path,
|
|
39
|
-
maxResults: max_results,
|
|
40
|
-
includeMetadata: true
|
|
41
|
-
});
|
|
42
|
-
const _display = {
|
|
43
|
-
type: "search",
|
|
44
|
-
pattern,
|
|
45
|
-
matches: result.files.map((file) => ({
|
|
46
|
-
file: file.path,
|
|
47
|
-
line: 0,
|
|
48
|
-
// No line number for glob
|
|
49
|
-
content: file.path
|
|
50
|
-
})),
|
|
51
|
-
totalMatches: result.totalFound,
|
|
52
|
-
truncated: result.truncated
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
files: result.files.map((file) => ({
|
|
56
|
-
path: file.path,
|
|
57
|
-
size: file.size,
|
|
58
|
-
modified: file.modified.toISOString()
|
|
59
|
-
})),
|
|
60
|
-
total_found: result.totalFound,
|
|
61
|
-
truncated: result.truncated,
|
|
62
|
-
_display
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
createGlobFilesTool
|
|
70
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Glob Files Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for finding files using glob patterns
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the glob_files internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createGlobFilesTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=glob-files-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob-files-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/glob-files-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAwBjE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CA0CtF"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const GlobFilesInputSchema = z.object({
|
|
4
|
-
pattern: z.string().describe('Glob pattern to match files (e.g., "**/*.ts", "src/**/*.js")'),
|
|
5
|
-
path: z.string().optional().describe("Base directory to search from (defaults to working directory)"),
|
|
6
|
-
max_results: z.number().int().positive().optional().default(1e3).describe("Maximum number of results to return (default: 1000)")
|
|
7
|
-
}).strict();
|
|
8
|
-
function createGlobFilesTool(fileSystemService) {
|
|
9
|
-
return {
|
|
10
|
-
id: "glob_files",
|
|
11
|
-
description: "Find files matching a glob pattern. Supports standard glob syntax like **/*.js for recursive matches, *.ts for files in current directory, and src/**/*.tsx for nested paths. Returns array of file paths with metadata (size, modified date). Results are limited to allowed paths only.",
|
|
12
|
-
inputSchema: GlobFilesInputSchema,
|
|
13
|
-
execute: async (input, _context) => {
|
|
14
|
-
const { pattern, path, max_results } = input;
|
|
15
|
-
const result = await fileSystemService.globFiles(pattern, {
|
|
16
|
-
cwd: path,
|
|
17
|
-
maxResults: max_results,
|
|
18
|
-
includeMetadata: true
|
|
19
|
-
});
|
|
20
|
-
const _display = {
|
|
21
|
-
type: "search",
|
|
22
|
-
pattern,
|
|
23
|
-
matches: result.files.map((file) => ({
|
|
24
|
-
file: file.path,
|
|
25
|
-
line: 0,
|
|
26
|
-
// No line number for glob
|
|
27
|
-
content: file.path
|
|
28
|
-
})),
|
|
29
|
-
totalMatches: result.totalFound,
|
|
30
|
-
truncated: result.truncated
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
files: result.files.map((file) => ({
|
|
34
|
-
path: file.path,
|
|
35
|
-
size: file.size,
|
|
36
|
-
modified: file.modified.toISOString()
|
|
37
|
-
})),
|
|
38
|
-
total_found: result.totalFound,
|
|
39
|
-
truncated: result.truncated,
|
|
40
|
-
_display
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
createGlobFilesTool
|
|
47
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var grep_content_tool_exports = {};
|
|
20
|
-
__export(grep_content_tool_exports, {
|
|
21
|
-
createGrepContentTool: () => createGrepContentTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(grep_content_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
const GrepContentInputSchema = import_zod.z.object({
|
|
26
|
-
pattern: import_zod.z.string().describe("Regular expression pattern to search for"),
|
|
27
|
-
path: import_zod.z.string().optional().describe("Directory to search in (defaults to working directory)"),
|
|
28
|
-
glob: import_zod.z.string().optional().describe('Glob pattern to filter files (e.g., "*.ts", "**/*.js")'),
|
|
29
|
-
context_lines: import_zod.z.number().int().min(0).optional().default(0).describe(
|
|
30
|
-
"Number of context lines to include before and after each match (default: 0)"
|
|
31
|
-
),
|
|
32
|
-
case_insensitive: import_zod.z.boolean().optional().default(false).describe("Perform case-insensitive search (default: false)"),
|
|
33
|
-
max_results: import_zod.z.number().int().positive().optional().default(100).describe("Maximum number of results to return (default: 100)")
|
|
34
|
-
}).strict();
|
|
35
|
-
function createGrepContentTool(fileSystemService) {
|
|
36
|
-
return {
|
|
37
|
-
id: "grep_content",
|
|
38
|
-
description: 'Search for text patterns in files using regular expressions. Returns matching lines with file path, line number, and optional context lines. Use glob parameter to filter specific file types (e.g., "*.ts"). Supports case-insensitive search. Great for finding code patterns, function definitions, or specific text across multiple files.',
|
|
39
|
-
inputSchema: GrepContentInputSchema,
|
|
40
|
-
execute: async (input, _context) => {
|
|
41
|
-
const { pattern, path, glob, context_lines, case_insensitive, max_results } = input;
|
|
42
|
-
const result = await fileSystemService.searchContent(pattern, {
|
|
43
|
-
path,
|
|
44
|
-
glob,
|
|
45
|
-
contextLines: context_lines,
|
|
46
|
-
caseInsensitive: case_insensitive,
|
|
47
|
-
maxResults: max_results
|
|
48
|
-
});
|
|
49
|
-
const _display = {
|
|
50
|
-
type: "search",
|
|
51
|
-
pattern,
|
|
52
|
-
matches: result.matches.map((match) => ({
|
|
53
|
-
file: match.file,
|
|
54
|
-
line: match.lineNumber,
|
|
55
|
-
content: match.line,
|
|
56
|
-
...match.context && {
|
|
57
|
-
context: [...match.context.before, ...match.context.after]
|
|
58
|
-
}
|
|
59
|
-
})),
|
|
60
|
-
totalMatches: result.totalMatches,
|
|
61
|
-
truncated: result.truncated
|
|
62
|
-
};
|
|
63
|
-
return {
|
|
64
|
-
matches: result.matches.map((match) => ({
|
|
65
|
-
file: match.file,
|
|
66
|
-
line_number: match.lineNumber,
|
|
67
|
-
line: match.line,
|
|
68
|
-
...match.context && {
|
|
69
|
-
context: {
|
|
70
|
-
before: match.context.before,
|
|
71
|
-
after: match.context.after
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
})),
|
|
75
|
-
total_matches: result.totalMatches,
|
|
76
|
-
files_searched: result.filesSearched,
|
|
77
|
-
truncated: result.truncated,
|
|
78
|
-
_display
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
-
0 && (module.exports = {
|
|
85
|
-
createGrepContentTool
|
|
86
|
-
});
|