@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,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Grep Content Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for searching file contents using regex patterns
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the grep_content internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createGrepContentTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=grep-content-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grep-content-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/grep-content-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAwCjE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAuDxF"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const GrepContentInputSchema = z.object({
|
|
4
|
-
pattern: z.string().describe("Regular expression pattern to search for"),
|
|
5
|
-
path: z.string().optional().describe("Directory to search in (defaults to working directory)"),
|
|
6
|
-
glob: z.string().optional().describe('Glob pattern to filter files (e.g., "*.ts", "**/*.js")'),
|
|
7
|
-
context_lines: z.number().int().min(0).optional().default(0).describe(
|
|
8
|
-
"Number of context lines to include before and after each match (default: 0)"
|
|
9
|
-
),
|
|
10
|
-
case_insensitive: z.boolean().optional().default(false).describe("Perform case-insensitive search (default: false)"),
|
|
11
|
-
max_results: z.number().int().positive().optional().default(100).describe("Maximum number of results to return (default: 100)")
|
|
12
|
-
}).strict();
|
|
13
|
-
function createGrepContentTool(fileSystemService) {
|
|
14
|
-
return {
|
|
15
|
-
id: "grep_content",
|
|
16
|
-
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.',
|
|
17
|
-
inputSchema: GrepContentInputSchema,
|
|
18
|
-
execute: async (input, _context) => {
|
|
19
|
-
const { pattern, path, glob, context_lines, case_insensitive, max_results } = input;
|
|
20
|
-
const result = await fileSystemService.searchContent(pattern, {
|
|
21
|
-
path,
|
|
22
|
-
glob,
|
|
23
|
-
contextLines: context_lines,
|
|
24
|
-
caseInsensitive: case_insensitive,
|
|
25
|
-
maxResults: max_results
|
|
26
|
-
});
|
|
27
|
-
const _display = {
|
|
28
|
-
type: "search",
|
|
29
|
-
pattern,
|
|
30
|
-
matches: result.matches.map((match) => ({
|
|
31
|
-
file: match.file,
|
|
32
|
-
line: match.lineNumber,
|
|
33
|
-
content: match.line,
|
|
34
|
-
...match.context && {
|
|
35
|
-
context: [...match.context.before, ...match.context.after]
|
|
36
|
-
}
|
|
37
|
-
})),
|
|
38
|
-
totalMatches: result.totalMatches,
|
|
39
|
-
truncated: result.truncated
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
matches: result.matches.map((match) => ({
|
|
43
|
-
file: match.file,
|
|
44
|
-
line_number: match.lineNumber,
|
|
45
|
-
line: match.line,
|
|
46
|
-
...match.context && {
|
|
47
|
-
context: {
|
|
48
|
-
before: match.context.before,
|
|
49
|
-
after: match.context.after
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
})),
|
|
53
|
-
total_matches: result.totalMatches,
|
|
54
|
-
files_searched: result.filesSearched,
|
|
55
|
-
truncated: result.truncated,
|
|
56
|
-
_display
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
createGrepContentTool
|
|
63
|
-
};
|
|
@@ -1,47 +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 kill_process_tool_exports = {};
|
|
20
|
-
__export(kill_process_tool_exports, {
|
|
21
|
-
createKillProcessTool: () => createKillProcessTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(kill_process_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
const KillProcessInputSchema = import_zod.z.object({
|
|
26
|
-
process_id: import_zod.z.string().describe("Process ID of the background process to terminate")
|
|
27
|
-
}).strict();
|
|
28
|
-
function createKillProcessTool(processService) {
|
|
29
|
-
return {
|
|
30
|
-
id: "kill_process",
|
|
31
|
-
description: "Terminate a background process started with bash_exec. Sends SIGTERM signal first, then SIGKILL if process doesn't terminate within 5 seconds. Only works on processes started by this agent. Returns success status and whether the process was running. Does not require additional approval (process was already approved when started).",
|
|
32
|
-
inputSchema: KillProcessInputSchema,
|
|
33
|
-
execute: async (input, _context) => {
|
|
34
|
-
const { process_id } = input;
|
|
35
|
-
await processService.killProcess(process_id);
|
|
36
|
-
return {
|
|
37
|
-
success: true,
|
|
38
|
-
process_id,
|
|
39
|
-
message: `Termination signal sent to process ${process_id}`
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
createKillProcessTool
|
|
47
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kill Process Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for terminating background processes
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { ProcessService } from '../../../process/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the kill_process internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createKillProcessTool(processService: ProcessService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=kill-process-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kill-process-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/kill-process-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,cAAc,GAAG,YAAY,CAqBlF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const KillProcessInputSchema = z.object({
|
|
4
|
-
process_id: z.string().describe("Process ID of the background process to terminate")
|
|
5
|
-
}).strict();
|
|
6
|
-
function createKillProcessTool(processService) {
|
|
7
|
-
return {
|
|
8
|
-
id: "kill_process",
|
|
9
|
-
description: "Terminate a background process started with bash_exec. Sends SIGTERM signal first, then SIGKILL if process doesn't terminate within 5 seconds. Only works on processes started by this agent. Returns success status and whether the process was running. Does not require additional approval (process was already approved when started).",
|
|
10
|
-
inputSchema: KillProcessInputSchema,
|
|
11
|
-
execute: async (input, _context) => {
|
|
12
|
-
const { process_id } = input;
|
|
13
|
-
await processService.killProcess(process_id);
|
|
14
|
-
return {
|
|
15
|
-
success: true,
|
|
16
|
-
process_id,
|
|
17
|
-
message: `Termination signal sent to process ${process_id}`
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
createKillProcessTool
|
|
24
|
-
};
|
|
@@ -1,63 +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 read_file_tool_exports = {};
|
|
20
|
-
__export(read_file_tool_exports, {
|
|
21
|
-
createReadFileTool: () => createReadFileTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(read_file_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
const ReadFileInputSchema = import_zod.z.object({
|
|
26
|
-
file_path: import_zod.z.string().describe("Absolute path to the file to read"),
|
|
27
|
-
limit: import_zod.z.number().int().positive().optional().describe("Maximum number of lines to read (optional)"),
|
|
28
|
-
offset: import_zod.z.number().int().min(1).optional().describe("Starting line number (1-based, optional)")
|
|
29
|
-
}).strict();
|
|
30
|
-
function createReadFileTool(fileSystemService) {
|
|
31
|
-
return {
|
|
32
|
-
id: "read_file",
|
|
33
|
-
description: "Read the contents of a file with optional pagination. Returns file content, line count, encoding, and whether the output was truncated. Use limit and offset parameters for large files to read specific sections. This tool is for reading files within allowed paths only.",
|
|
34
|
-
inputSchema: ReadFileInputSchema,
|
|
35
|
-
execute: async (input, _context) => {
|
|
36
|
-
const { file_path, limit, offset } = input;
|
|
37
|
-
const result = await fileSystemService.readFile(file_path, {
|
|
38
|
-
limit,
|
|
39
|
-
offset
|
|
40
|
-
});
|
|
41
|
-
const _display = {
|
|
42
|
-
type: "file",
|
|
43
|
-
path: file_path,
|
|
44
|
-
operation: "read",
|
|
45
|
-
size: result.size,
|
|
46
|
-
lineCount: result.lines
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
content: result.content,
|
|
50
|
-
lines: result.lines,
|
|
51
|
-
encoding: result.encoding,
|
|
52
|
-
truncated: result.truncated,
|
|
53
|
-
size: result.size,
|
|
54
|
-
...result.mimeType && { mimeType: result.mimeType },
|
|
55
|
-
_display
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
createReadFileTool
|
|
63
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read File Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for reading file contents with size limits and pagination
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the read_file internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createReadFileTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=read-file-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/read-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAuBjE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAoCrF"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const ReadFileInputSchema = z.object({
|
|
4
|
-
file_path: z.string().describe("Absolute path to the file to read"),
|
|
5
|
-
limit: z.number().int().positive().optional().describe("Maximum number of lines to read (optional)"),
|
|
6
|
-
offset: z.number().int().min(1).optional().describe("Starting line number (1-based, optional)")
|
|
7
|
-
}).strict();
|
|
8
|
-
function createReadFileTool(fileSystemService) {
|
|
9
|
-
return {
|
|
10
|
-
id: "read_file",
|
|
11
|
-
description: "Read the contents of a file with optional pagination. Returns file content, line count, encoding, and whether the output was truncated. Use limit and offset parameters for large files to read specific sections. This tool is for reading files within allowed paths only.",
|
|
12
|
-
inputSchema: ReadFileInputSchema,
|
|
13
|
-
execute: async (input, _context) => {
|
|
14
|
-
const { file_path, limit, offset } = input;
|
|
15
|
-
const result = await fileSystemService.readFile(file_path, {
|
|
16
|
-
limit,
|
|
17
|
-
offset
|
|
18
|
-
});
|
|
19
|
-
const _display = {
|
|
20
|
-
type: "file",
|
|
21
|
-
path: file_path,
|
|
22
|
-
operation: "read",
|
|
23
|
-
size: result.size,
|
|
24
|
-
lineCount: result.lines
|
|
25
|
-
};
|
|
26
|
-
return {
|
|
27
|
-
content: result.content,
|
|
28
|
-
lines: result.lines,
|
|
29
|
-
encoding: result.encoding,
|
|
30
|
-
truncated: result.truncated,
|
|
31
|
-
size: result.size,
|
|
32
|
-
...result.mimeType && { mimeType: result.mimeType },
|
|
33
|
-
_display
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
createReadFileTool
|
|
40
|
-
};
|
|
@@ -1,124 +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 write_file_tool_exports = {};
|
|
20
|
-
__export(write_file_tool_exports, {
|
|
21
|
-
createWriteFileTool: () => createWriteFileTool
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(write_file_tool_exports);
|
|
24
|
-
var import_zod = require("zod");
|
|
25
|
-
var import_diff = require("diff");
|
|
26
|
-
var import_filesystem = require("../../../filesystem/index.js");
|
|
27
|
-
var import_errors = require("../../../errors/index.js");
|
|
28
|
-
const WriteFileInputSchema = import_zod.z.object({
|
|
29
|
-
file_path: import_zod.z.string().describe("Absolute path where the file should be written"),
|
|
30
|
-
content: import_zod.z.string().describe("Content to write to the file"),
|
|
31
|
-
create_dirs: import_zod.z.boolean().optional().default(false).describe("Create parent directories if they don't exist (default: false)"),
|
|
32
|
-
encoding: import_zod.z.enum(["utf-8", "ascii", "latin1", "utf16le"]).optional().default("utf-8").describe("File encoding (default: utf-8)")
|
|
33
|
-
}).strict();
|
|
34
|
-
function generateDiffPreview(filePath, originalContent, newContent) {
|
|
35
|
-
const unified = (0, import_diff.createPatch)(filePath, originalContent, newContent, "before", "after", {
|
|
36
|
-
context: 3
|
|
37
|
-
});
|
|
38
|
-
const additions = (unified.match(/^\+[^+]/gm) || []).length;
|
|
39
|
-
const deletions = (unified.match(/^-[^-]/gm) || []).length;
|
|
40
|
-
return {
|
|
41
|
-
type: "diff",
|
|
42
|
-
unified,
|
|
43
|
-
filename: filePath,
|
|
44
|
-
additions,
|
|
45
|
-
deletions
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function createWriteFileTool(fileSystemService) {
|
|
49
|
-
return {
|
|
50
|
-
id: "write_file",
|
|
51
|
-
description: "Write content to a file. Creates a new file or overwrites existing file. Automatically creates backup of existing files before overwriting. Use create_dirs to create parent directories. Requires approval for all write operations. Returns success status, path, bytes written, and backup path if applicable.",
|
|
52
|
-
inputSchema: WriteFileInputSchema,
|
|
53
|
-
/**
|
|
54
|
-
* Generate preview for approval UI - shows diff or file creation info
|
|
55
|
-
*/
|
|
56
|
-
generatePreview: async (input, _context) => {
|
|
57
|
-
const { file_path, content } = input;
|
|
58
|
-
try {
|
|
59
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
60
|
-
const originalContent = originalFile.content;
|
|
61
|
-
return generateDiffPreview(file_path, originalContent, content);
|
|
62
|
-
} catch (error) {
|
|
63
|
-
if (error instanceof import_errors.DextoRuntimeError && error.code === import_filesystem.FileSystemErrorCode.FILE_NOT_FOUND) {
|
|
64
|
-
const lineCount = content.split("\n").length;
|
|
65
|
-
const preview = {
|
|
66
|
-
type: "file",
|
|
67
|
-
path: file_path,
|
|
68
|
-
operation: "create",
|
|
69
|
-
size: content.length,
|
|
70
|
-
lineCount,
|
|
71
|
-
content
|
|
72
|
-
// Include content for approval preview
|
|
73
|
-
};
|
|
74
|
-
return preview;
|
|
75
|
-
}
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
execute: async (input, _context) => {
|
|
80
|
-
const { file_path, content, create_dirs, encoding } = input;
|
|
81
|
-
let originalContent = null;
|
|
82
|
-
try {
|
|
83
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
84
|
-
originalContent = originalFile.content;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
if (error instanceof import_errors.DextoRuntimeError && error.code === import_filesystem.FileSystemErrorCode.FILE_NOT_FOUND) {
|
|
87
|
-
originalContent = null;
|
|
88
|
-
} else {
|
|
89
|
-
throw error;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const result = await fileSystemService.writeFile(file_path, content, {
|
|
93
|
-
createDirs: create_dirs,
|
|
94
|
-
encoding,
|
|
95
|
-
backup: true
|
|
96
|
-
// Always create backup for internal tools
|
|
97
|
-
});
|
|
98
|
-
let _display;
|
|
99
|
-
if (originalContent === null) {
|
|
100
|
-
const lineCount = content.split("\n").length;
|
|
101
|
-
_display = {
|
|
102
|
-
type: "file",
|
|
103
|
-
path: file_path,
|
|
104
|
-
operation: "create",
|
|
105
|
-
size: result.bytesWritten,
|
|
106
|
-
lineCount
|
|
107
|
-
};
|
|
108
|
-
} else {
|
|
109
|
-
_display = generateDiffPreview(file_path, originalContent, content);
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
success: result.success,
|
|
113
|
-
path: result.path,
|
|
114
|
-
bytes_written: result.bytesWritten,
|
|
115
|
-
...result.backupPath && { backup_path: result.backupPath },
|
|
116
|
-
_display
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
-
0 && (module.exports = {
|
|
123
|
-
createWriteFileTool
|
|
124
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Write File Tool
|
|
3
|
-
*
|
|
4
|
-
* Internal tool for writing content to files (requires approval)
|
|
5
|
-
*/
|
|
6
|
-
import { InternalTool } from '../../types.js';
|
|
7
|
-
import { FileSystemService } from '../../../filesystem/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create the write_file internal tool
|
|
10
|
-
*/
|
|
11
|
-
export declare function createWriteFileTool(fileSystemService: FileSystemService): InternalTool;
|
|
12
|
-
//# sourceMappingURL=write-file-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-file-tool.d.ts","sourceRoot":"","sources":["../../../../src/tools/internal-tools/implementations/write-file-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EACH,iBAAiB,EAGpB,MAAM,8BAA8B,CAAC;AA8CtC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,YAAY,CAoGtF"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { createPatch } from "diff";
|
|
4
|
-
import {
|
|
5
|
-
FileSystemErrorCode
|
|
6
|
-
} from "../../../filesystem/index.js";
|
|
7
|
-
import { DextoRuntimeError } from "../../../errors/index.js";
|
|
8
|
-
const WriteFileInputSchema = z.object({
|
|
9
|
-
file_path: z.string().describe("Absolute path where the file should be written"),
|
|
10
|
-
content: z.string().describe("Content to write to the file"),
|
|
11
|
-
create_dirs: z.boolean().optional().default(false).describe("Create parent directories if they don't exist (default: false)"),
|
|
12
|
-
encoding: z.enum(["utf-8", "ascii", "latin1", "utf16le"]).optional().default("utf-8").describe("File encoding (default: utf-8)")
|
|
13
|
-
}).strict();
|
|
14
|
-
function generateDiffPreview(filePath, originalContent, newContent) {
|
|
15
|
-
const unified = createPatch(filePath, originalContent, newContent, "before", "after", {
|
|
16
|
-
context: 3
|
|
17
|
-
});
|
|
18
|
-
const additions = (unified.match(/^\+[^+]/gm) || []).length;
|
|
19
|
-
const deletions = (unified.match(/^-[^-]/gm) || []).length;
|
|
20
|
-
return {
|
|
21
|
-
type: "diff",
|
|
22
|
-
unified,
|
|
23
|
-
filename: filePath,
|
|
24
|
-
additions,
|
|
25
|
-
deletions
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function createWriteFileTool(fileSystemService) {
|
|
29
|
-
return {
|
|
30
|
-
id: "write_file",
|
|
31
|
-
description: "Write content to a file. Creates a new file or overwrites existing file. Automatically creates backup of existing files before overwriting. Use create_dirs to create parent directories. Requires approval for all write operations. Returns success status, path, bytes written, and backup path if applicable.",
|
|
32
|
-
inputSchema: WriteFileInputSchema,
|
|
33
|
-
/**
|
|
34
|
-
* Generate preview for approval UI - shows diff or file creation info
|
|
35
|
-
*/
|
|
36
|
-
generatePreview: async (input, _context) => {
|
|
37
|
-
const { file_path, content } = input;
|
|
38
|
-
try {
|
|
39
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
40
|
-
const originalContent = originalFile.content;
|
|
41
|
-
return generateDiffPreview(file_path, originalContent, content);
|
|
42
|
-
} catch (error) {
|
|
43
|
-
if (error instanceof DextoRuntimeError && error.code === FileSystemErrorCode.FILE_NOT_FOUND) {
|
|
44
|
-
const lineCount = content.split("\n").length;
|
|
45
|
-
const preview = {
|
|
46
|
-
type: "file",
|
|
47
|
-
path: file_path,
|
|
48
|
-
operation: "create",
|
|
49
|
-
size: content.length,
|
|
50
|
-
lineCount,
|
|
51
|
-
content
|
|
52
|
-
// Include content for approval preview
|
|
53
|
-
};
|
|
54
|
-
return preview;
|
|
55
|
-
}
|
|
56
|
-
throw error;
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
execute: async (input, _context) => {
|
|
60
|
-
const { file_path, content, create_dirs, encoding } = input;
|
|
61
|
-
let originalContent = null;
|
|
62
|
-
try {
|
|
63
|
-
const originalFile = await fileSystemService.readFile(file_path);
|
|
64
|
-
originalContent = originalFile.content;
|
|
65
|
-
} catch (error) {
|
|
66
|
-
if (error instanceof DextoRuntimeError && error.code === FileSystemErrorCode.FILE_NOT_FOUND) {
|
|
67
|
-
originalContent = null;
|
|
68
|
-
} else {
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const result = await fileSystemService.writeFile(file_path, content, {
|
|
73
|
-
createDirs: create_dirs,
|
|
74
|
-
encoding,
|
|
75
|
-
backup: true
|
|
76
|
-
// Always create backup for internal tools
|
|
77
|
-
});
|
|
78
|
-
let _display;
|
|
79
|
-
if (originalContent === null) {
|
|
80
|
-
const lineCount = content.split("\n").length;
|
|
81
|
-
_display = {
|
|
82
|
-
type: "file",
|
|
83
|
-
path: file_path,
|
|
84
|
-
operation: "create",
|
|
85
|
-
size: result.bytesWritten,
|
|
86
|
-
lineCount
|
|
87
|
-
};
|
|
88
|
-
} else {
|
|
89
|
-
_display = generateDiffPreview(file_path, originalContent, content);
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
success: result.success,
|
|
93
|
-
path: result.path,
|
|
94
|
-
bytes_written: result.bytesWritten,
|
|
95
|
-
...result.backupPath && { backup_path: result.backupPath },
|
|
96
|
-
_display
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
export {
|
|
102
|
-
createWriteFileTool
|
|
103
|
-
};
|
package/dist/utils/env-file.cjs
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var env_file_exports = {};
|
|
30
|
-
__export(env_file_exports, {
|
|
31
|
-
updateEnvFile: () => updateEnvFile
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(env_file_exports);
|
|
34
|
-
var path = __toESM(require("node:path"), 1);
|
|
35
|
-
var import_node_fs = require("node:fs");
|
|
36
|
-
const DEXTO_ENV_KEYS = [
|
|
37
|
-
"OPENAI_API_KEY",
|
|
38
|
-
"ANTHROPIC_API_KEY",
|
|
39
|
-
"GOOGLE_GENERATIVE_AI_API_KEY",
|
|
40
|
-
"GROQ_API_KEY",
|
|
41
|
-
"COHERE_API_KEY",
|
|
42
|
-
"XAI_API_KEY",
|
|
43
|
-
"DEXTO_LOG_LEVEL"
|
|
44
|
-
];
|
|
45
|
-
function isDextoEnvKey(value) {
|
|
46
|
-
return DEXTO_ENV_KEYS.includes(value);
|
|
47
|
-
}
|
|
48
|
-
async function updateEnvFile(envFilePath, updates) {
|
|
49
|
-
await import_node_fs.promises.mkdir(path.dirname(envFilePath), { recursive: true });
|
|
50
|
-
let envLines = [];
|
|
51
|
-
try {
|
|
52
|
-
const existingEnv = await import_node_fs.promises.readFile(envFilePath, "utf8");
|
|
53
|
-
envLines = existingEnv.split("\n");
|
|
54
|
-
} catch {
|
|
55
|
-
}
|
|
56
|
-
const currentValues = {};
|
|
57
|
-
envLines.forEach((line) => {
|
|
58
|
-
const match = line.match(/^([A-Z0-9_]+)=(.*)$/);
|
|
59
|
-
if (match && match[1] && isDextoEnvKey(match[1])) {
|
|
60
|
-
const value = match[2] ?? "";
|
|
61
|
-
currentValues[match[1]] = value;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const updatedValues = Object.fromEntries(
|
|
65
|
-
DEXTO_ENV_KEYS.map((key) => {
|
|
66
|
-
const update = updates[key];
|
|
67
|
-
const current = currentValues[key];
|
|
68
|
-
const fallback = key === "DEXTO_LOG_LEVEL" ? "info" : "";
|
|
69
|
-
const value = update !== void 0 ? update : current ?? fallback;
|
|
70
|
-
return [key, value];
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
const sectionHeader = "## Dexto env variables";
|
|
74
|
-
const headerIndex = envLines.findIndex((line) => line.trim() === sectionHeader);
|
|
75
|
-
let contentLines;
|
|
76
|
-
if (headerIndex !== -1) {
|
|
77
|
-
const beforeSection = envLines.slice(0, headerIndex);
|
|
78
|
-
let sectionEnd = headerIndex + 1;
|
|
79
|
-
while (sectionEnd < envLines.length && envLines[sectionEnd]?.trim() !== "") {
|
|
80
|
-
sectionEnd++;
|
|
81
|
-
}
|
|
82
|
-
if (sectionEnd < envLines.length && envLines[sectionEnd]?.trim() === "") {
|
|
83
|
-
sectionEnd++;
|
|
84
|
-
}
|
|
85
|
-
const afterSection = envLines.slice(sectionEnd);
|
|
86
|
-
contentLines = [...beforeSection, ...afterSection];
|
|
87
|
-
} else {
|
|
88
|
-
contentLines = envLines;
|
|
89
|
-
}
|
|
90
|
-
const existingEnvVars = {};
|
|
91
|
-
contentLines.forEach((line) => {
|
|
92
|
-
const match = line.match(/^([A-Z0-9_]+)=(.*)$/);
|
|
93
|
-
if (match && match[1] && isDextoEnvKey(match[1])) {
|
|
94
|
-
const value = match[2] ?? "";
|
|
95
|
-
existingEnvVars[match[1]] = value;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
if (contentLines.length > 0) {
|
|
99
|
-
if (contentLines[contentLines.length - 1]?.trim() !== "") {
|
|
100
|
-
contentLines.push("");
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
contentLines.push("");
|
|
104
|
-
}
|
|
105
|
-
contentLines.push(sectionHeader);
|
|
106
|
-
for (const key of DEXTO_ENV_KEYS) {
|
|
107
|
-
if (key in existingEnvVars && !(key in updates)) {
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
contentLines.push(`${key}=${updatedValues[key]}`);
|
|
111
|
-
}
|
|
112
|
-
contentLines.push("");
|
|
113
|
-
await import_node_fs.promises.writeFile(envFilePath, contentLines.join("\n"), "utf8");
|
|
114
|
-
}
|
|
115
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
-
0 && (module.exports = {
|
|
117
|
-
updateEnvFile
|
|
118
|
-
});
|
package/dist/utils/env-file.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../../src/utils/env-file.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,wBAAsB,aAAa,CAC/B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAgFf"}
|