@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
package/dist/approval/schemas.js
CHANGED
|
@@ -33,6 +33,12 @@ const ElicitationMetadataSchema = z.object({
|
|
|
33
33
|
context: z.record(z.unknown()).optional().describe("Additional context")
|
|
34
34
|
}).strict().describe("Elicitation metadata");
|
|
35
35
|
const CustomApprovalMetadataSchema = z.record(z.unknown()).describe("Custom metadata");
|
|
36
|
+
const DirectoryAccessMetadataSchema = z.object({
|
|
37
|
+
path: z.string().describe("Full path being accessed"),
|
|
38
|
+
parentDir: z.string().describe("Parent directory (what gets approved for session)"),
|
|
39
|
+
operation: z.enum(["read", "write", "edit"]).describe("Type of file operation"),
|
|
40
|
+
toolName: z.string().describe("Name of the tool requesting access")
|
|
41
|
+
}).strict().describe("Directory access metadata");
|
|
36
42
|
const BaseApprovalRequestSchema = z.object({
|
|
37
43
|
approvalId: z.string().uuid().describe("Unique approval identifier"),
|
|
38
44
|
type: ApprovalTypeSchema.describe("Type of approval"),
|
|
@@ -56,11 +62,16 @@ const CustomApprovalRequestSchema = BaseApprovalRequestSchema.extend({
|
|
|
56
62
|
type: z.literal(ApprovalType.CUSTOM),
|
|
57
63
|
metadata: CustomApprovalMetadataSchema
|
|
58
64
|
}).strict();
|
|
65
|
+
const DirectoryAccessRequestSchema = BaseApprovalRequestSchema.extend({
|
|
66
|
+
type: z.literal(ApprovalType.DIRECTORY_ACCESS),
|
|
67
|
+
metadata: DirectoryAccessMetadataSchema
|
|
68
|
+
}).strict();
|
|
59
69
|
const ApprovalRequestSchema = z.discriminatedUnion("type", [
|
|
60
70
|
ToolConfirmationRequestSchema,
|
|
61
71
|
CommandConfirmationRequestSchema,
|
|
62
72
|
ElicitationRequestSchema,
|
|
63
|
-
CustomApprovalRequestSchema
|
|
73
|
+
CustomApprovalRequestSchema,
|
|
74
|
+
DirectoryAccessRequestSchema
|
|
64
75
|
]);
|
|
65
76
|
const ToolConfirmationResponseDataSchema = z.object({
|
|
66
77
|
rememberChoice: z.boolean().optional().describe("Remember this tool for the session (approves ALL uses of this tool)"),
|
|
@@ -76,6 +87,9 @@ const ElicitationResponseDataSchema = z.object({
|
|
|
76
87
|
formData: z.record(z.unknown()).describe("Form data matching schema")
|
|
77
88
|
}).strict().describe("Elicitation response data");
|
|
78
89
|
const CustomApprovalResponseDataSchema = z.record(z.unknown()).describe("Custom response data");
|
|
90
|
+
const DirectoryAccessResponseDataSchema = z.object({
|
|
91
|
+
rememberDirectory: z.boolean().optional().describe("Remember this directory for the session (allows all file access within it)")
|
|
92
|
+
}).strict().describe("Directory access response data");
|
|
79
93
|
const BaseApprovalResponseSchema = z.object({
|
|
80
94
|
approvalId: z.string().uuid().describe("Must match request approvalId"),
|
|
81
95
|
status: ApprovalStatusSchema.describe("Approval status"),
|
|
@@ -98,11 +112,15 @@ const ElicitationResponseSchema = BaseApprovalResponseSchema.extend({
|
|
|
98
112
|
const CustomApprovalResponseSchema = BaseApprovalResponseSchema.extend({
|
|
99
113
|
data: CustomApprovalResponseDataSchema.optional()
|
|
100
114
|
}).strict();
|
|
115
|
+
const DirectoryAccessResponseSchema = BaseApprovalResponseSchema.extend({
|
|
116
|
+
data: DirectoryAccessResponseDataSchema.optional()
|
|
117
|
+
}).strict();
|
|
101
118
|
const ApprovalResponseSchema = z.union([
|
|
102
119
|
ToolConfirmationResponseSchema,
|
|
103
120
|
CommandConfirmationResponseSchema,
|
|
104
121
|
ElicitationResponseSchema,
|
|
105
|
-
CustomApprovalResponseSchema
|
|
122
|
+
CustomApprovalResponseSchema,
|
|
123
|
+
DirectoryAccessResponseSchema
|
|
106
124
|
]);
|
|
107
125
|
const ApprovalRequestDetailsSchema = z.object({
|
|
108
126
|
type: ApprovalTypeSchema,
|
|
@@ -112,7 +130,8 @@ const ApprovalRequestDetailsSchema = z.object({
|
|
|
112
130
|
ToolConfirmationMetadataSchema,
|
|
113
131
|
CommandConfirmationMetadataSchema,
|
|
114
132
|
ElicitationMetadataSchema,
|
|
115
|
-
CustomApprovalMetadataSchema
|
|
133
|
+
CustomApprovalMetadataSchema,
|
|
134
|
+
DirectoryAccessMetadataSchema
|
|
116
135
|
])
|
|
117
136
|
}).superRefine((data, ctx) => {
|
|
118
137
|
if (data.type === ApprovalType.TOOL_CONFIRMATION) {
|
|
@@ -142,6 +161,15 @@ const ApprovalRequestDetailsSchema = z.object({
|
|
|
142
161
|
path: ["metadata"]
|
|
143
162
|
});
|
|
144
163
|
}
|
|
164
|
+
} else if (data.type === ApprovalType.DIRECTORY_ACCESS) {
|
|
165
|
+
const result = DirectoryAccessMetadataSchema.safeParse(data.metadata);
|
|
166
|
+
if (!result.success) {
|
|
167
|
+
ctx.addIssue({
|
|
168
|
+
code: z.ZodIssueCode.custom,
|
|
169
|
+
message: "Metadata must match DirectoryAccessMetadataSchema for DIRECTORY_ACCESS type",
|
|
170
|
+
path: ["metadata"]
|
|
171
|
+
});
|
|
172
|
+
}
|
|
145
173
|
} else if (data.type === ApprovalType.CUSTOM) {
|
|
146
174
|
const result = CustomApprovalMetadataSchema.safeParse(data.metadata);
|
|
147
175
|
if (!result.success) {
|
|
@@ -170,6 +198,10 @@ export {
|
|
|
170
198
|
CustomApprovalResponseDataSchema,
|
|
171
199
|
CustomApprovalResponseSchema,
|
|
172
200
|
DenialReasonSchema,
|
|
201
|
+
DirectoryAccessMetadataSchema,
|
|
202
|
+
DirectoryAccessRequestSchema,
|
|
203
|
+
DirectoryAccessResponseDataSchema,
|
|
204
|
+
DirectoryAccessResponseSchema,
|
|
173
205
|
ElicitationMetadataSchema,
|
|
174
206
|
ElicitationRequestSchema,
|
|
175
207
|
ElicitationResponseDataSchema,
|
package/dist/approval/types.cjs
CHANGED
|
@@ -27,6 +27,7 @@ var ApprovalType = /* @__PURE__ */ ((ApprovalType2) => {
|
|
|
27
27
|
ApprovalType2["TOOL_CONFIRMATION"] = "tool_confirmation";
|
|
28
28
|
ApprovalType2["COMMAND_CONFIRMATION"] = "command_confirmation";
|
|
29
29
|
ApprovalType2["ELICITATION"] = "elicitation";
|
|
30
|
+
ApprovalType2["DIRECTORY_ACCESS"] = "directory_access";
|
|
30
31
|
ApprovalType2["CUSTOM"] = "custom";
|
|
31
32
|
return ApprovalType2;
|
|
32
33
|
})(ApprovalType || {});
|
package/dist/approval/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { ToolConfirmationMetadataSchema, CommandConfirmationMetadataSchema, ElicitationMetadataSchema, CustomApprovalMetadataSchema, BaseApprovalRequestSchema, ToolConfirmationRequestSchema, CommandConfirmationRequestSchema, ElicitationRequestSchema, CustomApprovalRequestSchema, ApprovalRequestSchema, ApprovalRequestDetailsSchema, ToolConfirmationResponseDataSchema, CommandConfirmationResponseDataSchema, ElicitationResponseDataSchema, CustomApprovalResponseDataSchema, BaseApprovalResponseSchema, ToolConfirmationResponseSchema, CommandConfirmationResponseSchema, ElicitationResponseSchema, CustomApprovalResponseSchema, ApprovalResponseSchema } from './schemas.js';
|
|
2
|
+
import type { ToolConfirmationMetadataSchema, CommandConfirmationMetadataSchema, ElicitationMetadataSchema, CustomApprovalMetadataSchema, DirectoryAccessMetadataSchema, BaseApprovalRequestSchema, ToolConfirmationRequestSchema, CommandConfirmationRequestSchema, ElicitationRequestSchema, CustomApprovalRequestSchema, DirectoryAccessRequestSchema, ApprovalRequestSchema, ApprovalRequestDetailsSchema, ToolConfirmationResponseDataSchema, CommandConfirmationResponseDataSchema, ElicitationResponseDataSchema, CustomApprovalResponseDataSchema, DirectoryAccessResponseDataSchema, BaseApprovalResponseSchema, ToolConfirmationResponseSchema, CommandConfirmationResponseSchema, ElicitationResponseSchema, CustomApprovalResponseSchema, DirectoryAccessResponseSchema, ApprovalResponseSchema } from './schemas.js';
|
|
3
3
|
/**
|
|
4
4
|
* Types of approval requests supported by the system
|
|
5
5
|
*/
|
|
@@ -20,6 +20,11 @@ export declare enum ApprovalType {
|
|
|
20
20
|
* Metadata contains: schema, prompt, serverName, context
|
|
21
21
|
*/
|
|
22
22
|
ELICITATION = "elicitation",
|
|
23
|
+
/**
|
|
24
|
+
* Approval for accessing files outside the working directory
|
|
25
|
+
* Metadata contains: path, parentDir, operation, toolName
|
|
26
|
+
*/
|
|
27
|
+
DIRECTORY_ACCESS = "directory_access",
|
|
23
28
|
/**
|
|
24
29
|
* Custom approval types for extensibility
|
|
25
30
|
* Metadata format defined by consumer
|
|
@@ -74,6 +79,11 @@ export type ElicitationMetadata = z.output<typeof ElicitationMetadataSchema>;
|
|
|
74
79
|
* Derived from CustomApprovalMetadataSchema
|
|
75
80
|
*/
|
|
76
81
|
export type CustomApprovalMetadata = z.output<typeof CustomApprovalMetadataSchema>;
|
|
82
|
+
/**
|
|
83
|
+
* Directory access metadata
|
|
84
|
+
* Derived from DirectoryAccessMetadataSchema
|
|
85
|
+
*/
|
|
86
|
+
export type DirectoryAccessMetadata = z.output<typeof DirectoryAccessMetadataSchema>;
|
|
77
87
|
/**
|
|
78
88
|
* Base approval request that all approvals extend
|
|
79
89
|
* Derived from BaseApprovalRequestSchema
|
|
@@ -99,6 +109,11 @@ export type ElicitationRequest = z.output<typeof ElicitationRequestSchema>;
|
|
|
99
109
|
* Derived from CustomApprovalRequestSchema
|
|
100
110
|
*/
|
|
101
111
|
export type CustomApprovalRequest = z.output<typeof CustomApprovalRequestSchema>;
|
|
112
|
+
/**
|
|
113
|
+
* Directory access request
|
|
114
|
+
* Derived from DirectoryAccessRequestSchema
|
|
115
|
+
*/
|
|
116
|
+
export type DirectoryAccessRequest = z.output<typeof DirectoryAccessRequestSchema>;
|
|
102
117
|
/**
|
|
103
118
|
* Union of all approval request types
|
|
104
119
|
* Derived from ApprovalRequestSchema
|
|
@@ -124,6 +139,11 @@ export type ElicitationResponseData = z.output<typeof ElicitationResponseDataSch
|
|
|
124
139
|
* Derived from CustomApprovalResponseDataSchema
|
|
125
140
|
*/
|
|
126
141
|
export type CustomApprovalResponseData = z.output<typeof CustomApprovalResponseDataSchema>;
|
|
142
|
+
/**
|
|
143
|
+
* Directory access response data
|
|
144
|
+
* Derived from DirectoryAccessResponseDataSchema
|
|
145
|
+
*/
|
|
146
|
+
export type DirectoryAccessResponseData = z.output<typeof DirectoryAccessResponseDataSchema>;
|
|
127
147
|
/**
|
|
128
148
|
* Base approval response
|
|
129
149
|
* Derived from BaseApprovalResponseSchema
|
|
@@ -149,6 +169,11 @@ export type ElicitationResponse = z.output<typeof ElicitationResponseSchema>;
|
|
|
149
169
|
* Derived from CustomApprovalResponseSchema
|
|
150
170
|
*/
|
|
151
171
|
export type CustomApprovalResponse = z.output<typeof CustomApprovalResponseSchema>;
|
|
172
|
+
/**
|
|
173
|
+
* Directory access response
|
|
174
|
+
* Derived from DirectoryAccessResponseSchema
|
|
175
|
+
*/
|
|
176
|
+
export type DirectoryAccessResponse = z.output<typeof DirectoryAccessResponseSchema>;
|
|
152
177
|
/**
|
|
153
178
|
* Union of all approval response types
|
|
154
179
|
* Derived from ApprovalResponseSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/approval/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACR,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,6BAA6B,EAC7B,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,EACzB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,oBAAY,YAAY;IACpB;;;OAGG;IACH,iBAAiB,sBAAsB;IAEvC;;;;OAIG;IACH,oBAAoB,yBAAyB;IAE7C;;;OAGG;IACH,WAAW,gBAAgB;IAE3B;;;OAGG;IACH,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,oBAAY,cAAc;IACtB,QAA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Type2["COMMAND_CONFIRMATION"] = "command_confirmation";
|
|
5
5
|
ApprovalType2["ELICITATION"] = "elicitation";
|
|
6
|
+
ApprovalType2["DIRECTORY_ACCESS"] = "directory_access";
|
|
6
7
|
ApprovalType2["CUSTOM"] = "custom";
|
|
7
8
|
return ApprovalType2;
|
|
8
9
|
})(ApprovalType || {});
|
|
@@ -0,0 +1,57 @@
|
|
|
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 factory_exports = {};
|
|
20
|
+
__export(factory_exports, {
|
|
21
|
+
createCompactionStrategy: () => createCompactionStrategy
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(factory_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
var import_registry = require("./registry.js");
|
|
26
|
+
var import_errors = require("../errors.js");
|
|
27
|
+
async function createCompactionStrategy(config, context) {
|
|
28
|
+
if (config.enabled === false) {
|
|
29
|
+
context.logger.info(`Compaction provider '${config.type}' is disabled`);
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const provider = import_registry.compactionRegistry.get(config.type);
|
|
33
|
+
if (!provider) {
|
|
34
|
+
const available = import_registry.compactionRegistry.getTypes();
|
|
35
|
+
throw import_errors.ContextError.compactionInvalidType(config.type, available);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const validatedConfig = provider.configSchema.parse(config);
|
|
39
|
+
if (provider.metadata?.requiresLLM && !context.model) {
|
|
40
|
+
throw import_errors.ContextError.compactionMissingLLM(config.type);
|
|
41
|
+
}
|
|
42
|
+
const strategy = await provider.create(validatedConfig, context);
|
|
43
|
+
context.logger.info(
|
|
44
|
+
`Created compaction strategy: ${provider.metadata?.displayName || config.type}`
|
|
45
|
+
);
|
|
46
|
+
return strategy;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (error instanceof import_zod.z.ZodError) {
|
|
49
|
+
throw import_errors.ContextError.compactionValidation(config.type, error.errors);
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
createCompactionStrategy
|
|
57
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ICompactionStrategy } from './types.js';
|
|
2
|
+
import type { CompactionContext, CompactionConfig } from './provider.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a compaction strategy from configuration.
|
|
5
|
+
*
|
|
6
|
+
* Follows the same pattern as blob storage and tools:
|
|
7
|
+
* - Validates provider exists
|
|
8
|
+
* - Validates configuration with Zod schema
|
|
9
|
+
* - Checks LLM requirements
|
|
10
|
+
* - Creates strategy instance
|
|
11
|
+
*
|
|
12
|
+
* @param config - Compaction configuration from agent config
|
|
13
|
+
* @param context - Context with logger and optional LanguageModel
|
|
14
|
+
* @returns Strategy instance or null if disabled
|
|
15
|
+
*/
|
|
16
|
+
export declare function createCompactionStrategy(config: CompactionConfig, context: CompactionContext): Promise<ICompactionStrategy | null>;
|
|
17
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/context/compaction/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAIzE;;;;;;;;;;;;GAYG;AACH,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAqCrC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../../chunk-PTJYTZNU.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { compactionRegistry } from "./registry.js";
|
|
4
|
+
import { ContextError } from "../errors.js";
|
|
5
|
+
async function createCompactionStrategy(config, context) {
|
|
6
|
+
if (config.enabled === false) {
|
|
7
|
+
context.logger.info(`Compaction provider '${config.type}' is disabled`);
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const provider = compactionRegistry.get(config.type);
|
|
11
|
+
if (!provider) {
|
|
12
|
+
const available = compactionRegistry.getTypes();
|
|
13
|
+
throw ContextError.compactionInvalidType(config.type, available);
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const validatedConfig = provider.configSchema.parse(config);
|
|
17
|
+
if (provider.metadata?.requiresLLM && !context.model) {
|
|
18
|
+
throw ContextError.compactionMissingLLM(config.type);
|
|
19
|
+
}
|
|
20
|
+
const strategy = await provider.create(validatedConfig, context);
|
|
21
|
+
context.logger.info(
|
|
22
|
+
`Created compaction strategy: ${provider.metadata?.displayName || config.type}`
|
|
23
|
+
);
|
|
24
|
+
return strategy;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (error instanceof z.ZodError) {
|
|
27
|
+
throw ContextError.compactionValidation(config.type, error.errors);
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
createCompactionStrategy
|
|
34
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var compaction_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(compaction_exports);
|
|
18
|
+
__reExport(compaction_exports, require("./types.js"), module.exports);
|
|
19
|
+
__reExport(compaction_exports, require("./provider.js"), module.exports);
|
|
20
|
+
__reExport(compaction_exports, require("./registry.js"), module.exports);
|
|
21
|
+
__reExport(compaction_exports, require("./factory.js"), module.exports);
|
|
22
|
+
__reExport(compaction_exports, require("./schemas.js"), module.exports);
|
|
23
|
+
__reExport(compaction_exports, require("./strategies/reactive-overflow.js"), module.exports);
|
|
24
|
+
__reExport(compaction_exports, require("./strategies/noop.js"), module.exports);
|
|
25
|
+
__reExport(compaction_exports, require("./providers/reactive-overflow-provider.js"), module.exports);
|
|
26
|
+
__reExport(compaction_exports, require("./providers/noop-provider.js"), module.exports);
|
|
27
|
+
__reExport(compaction_exports, require("./overflow.js"), module.exports);
|
|
28
|
+
var import_registry = require("./registry.js");
|
|
29
|
+
var import_reactive_overflow_provider = require("./providers/reactive-overflow-provider.js");
|
|
30
|
+
var import_noop_provider = require("./providers/noop-provider.js");
|
|
31
|
+
if (!import_registry.compactionRegistry.has("reactive-overflow")) {
|
|
32
|
+
import_registry.compactionRegistry.register(import_reactive_overflow_provider.reactiveOverflowProvider);
|
|
33
|
+
}
|
|
34
|
+
if (!import_registry.compactionRegistry.has("noop")) {
|
|
35
|
+
import_registry.compactionRegistry.register(import_noop_provider.noopProvider);
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
...require("./types.js"),
|
|
40
|
+
...require("./provider.js"),
|
|
41
|
+
...require("./registry.js"),
|
|
42
|
+
...require("./factory.js"),
|
|
43
|
+
...require("./schemas.js"),
|
|
44
|
+
...require("./strategies/reactive-overflow.js"),
|
|
45
|
+
...require("./strategies/noop.js"),
|
|
46
|
+
...require("./providers/reactive-overflow-provider.js"),
|
|
47
|
+
...require("./providers/noop-provider.js"),
|
|
48
|
+
...require("./overflow.js")
|
|
49
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './provider.js';
|
|
3
|
+
export * from './registry.js';
|
|
4
|
+
export * from './factory.js';
|
|
5
|
+
export * from './schemas.js';
|
|
6
|
+
export * from './strategies/reactive-overflow.js';
|
|
7
|
+
export * from './strategies/noop.js';
|
|
8
|
+
export * from './providers/reactive-overflow-provider.js';
|
|
9
|
+
export * from './providers/noop-provider.js';
|
|
10
|
+
export * from './overflow.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/compaction/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAG7B,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AAGrC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8BAA8B,CAAC;AAG7C,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./provider.js";
|
|
3
|
+
export * from "./registry.js";
|
|
4
|
+
export * from "./factory.js";
|
|
5
|
+
export * from "./schemas.js";
|
|
6
|
+
export * from "./strategies/reactive-overflow.js";
|
|
7
|
+
export * from "./strategies/noop.js";
|
|
8
|
+
export * from "./providers/reactive-overflow-provider.js";
|
|
9
|
+
export * from "./providers/noop-provider.js";
|
|
10
|
+
export * from "./overflow.js";
|
|
11
|
+
import { compactionRegistry } from "./registry.js";
|
|
12
|
+
import { reactiveOverflowProvider } from "./providers/reactive-overflow-provider.js";
|
|
13
|
+
import { noopProvider } from "./providers/noop-provider.js";
|
|
14
|
+
if (!compactionRegistry.has("reactive-overflow")) {
|
|
15
|
+
compactionRegistry.register(reactiveOverflowProvider);
|
|
16
|
+
}
|
|
17
|
+
if (!compactionRegistry.has("noop")) {
|
|
18
|
+
compactionRegistry.register(noopProvider);
|
|
19
|
+
}
|
|
@@ -18,7 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var overflow_exports = {};
|
|
20
20
|
__export(overflow_exports, {
|
|
21
|
-
|
|
21
|
+
getCompactionTarget: () => getCompactionTarget,
|
|
22
22
|
isOverflow: () => isOverflow
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(overflow_exports);
|
|
@@ -30,7 +30,7 @@ function isOverflow(tokens, modelLimits) {
|
|
|
30
30
|
const inputTokens = tokens.inputTokens ?? 0;
|
|
31
31
|
return inputTokens > usableTokens;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function getCompactionTarget(modelLimits, targetPercentage = 0.7) {
|
|
34
34
|
const { contextWindow, maxOutput } = modelLimits;
|
|
35
35
|
const outputBuffer = Math.min(maxOutput, DEFAULT_OUTPUT_BUFFER);
|
|
36
36
|
const usableTokens = contextWindow - outputBuffer;
|
|
@@ -38,6 +38,6 @@ function getCompressionTarget(modelLimits, targetPercentage = 0.7) {
|
|
|
38
38
|
}
|
|
39
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
40
|
0 && (module.exports = {
|
|
41
|
-
|
|
41
|
+
getCompactionTarget,
|
|
42
42
|
isOverflow
|
|
43
43
|
});
|
|
@@ -19,15 +19,15 @@ export interface ModelLimits {
|
|
|
19
19
|
*
|
|
20
20
|
* @param tokens The actual token usage from the last LLM API call
|
|
21
21
|
* @param modelLimits The model's context window and output limits
|
|
22
|
-
* @returns true if context has overflowed and
|
|
22
|
+
* @returns true if context has overflowed and compaction is needed
|
|
23
23
|
*/
|
|
24
24
|
export declare function isOverflow(tokens: TokenUsage, modelLimits: ModelLimits): boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Calculate the
|
|
26
|
+
* Calculate the compaction target - how many tokens we need to reduce to.
|
|
27
27
|
*
|
|
28
28
|
* @param modelLimits The model's context window and output limits
|
|
29
29
|
* @param targetPercentage What percentage of usable context to target (default 70%)
|
|
30
|
-
* @returns The target token count after
|
|
30
|
+
* @returns The target token count after compaction
|
|
31
31
|
*/
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function getCompactionTarget(modelLimits: ModelLimits, targetPercentage?: number): number;
|
|
33
33
|
//# sourceMappingURL=overflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overflow.d.ts","sourceRoot":"","sources":["../../../src/context/compaction/overflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;CACrB;AAQD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAYhF;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,WAAW,EAAE,WAAW,EACxB,gBAAgB,GAAE,MAAY,GAC/B,MAAM,CAMR"}
|
|
@@ -7,13 +7,13 @@ function isOverflow(tokens, modelLimits) {
|
|
|
7
7
|
const inputTokens = tokens.inputTokens ?? 0;
|
|
8
8
|
return inputTokens > usableTokens;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function getCompactionTarget(modelLimits, targetPercentage = 0.7) {
|
|
11
11
|
const { contextWindow, maxOutput } = modelLimits;
|
|
12
12
|
const outputBuffer = Math.min(maxOutput, DEFAULT_OUTPUT_BUFFER);
|
|
13
13
|
const usableTokens = contextWindow - outputBuffer;
|
|
14
14
|
return Math.floor(usableTokens * targetPercentage);
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
getCompactionTarget,
|
|
18
18
|
isOverflow
|
|
19
19
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var provider_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(provider_exports);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { LanguageModel } from 'ai';
|
|
3
|
+
import type { ICompactionStrategy } from './types.js';
|
|
4
|
+
import type { IDextoLogger } from '../../logger/v2/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Context provided to compaction strategy creation
|
|
7
|
+
*/
|
|
8
|
+
export interface CompactionContext {
|
|
9
|
+
logger: IDextoLogger;
|
|
10
|
+
model?: LanguageModel;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Provider interface for compaction strategies.
|
|
14
|
+
*
|
|
15
|
+
* Follows the same pattern as blob storage and tools providers:
|
|
16
|
+
* - Type discriminator for config validation
|
|
17
|
+
* - Zod schema for runtime validation
|
|
18
|
+
* - Factory function to create instances
|
|
19
|
+
* - Metadata for discovery and UI
|
|
20
|
+
*
|
|
21
|
+
* TConfig should be the output type (z.output) with defaults applied
|
|
22
|
+
*/
|
|
23
|
+
export interface CompactionProvider<TType extends string = string, TConfig extends CompactionConfig = CompactionConfig> {
|
|
24
|
+
/** Unique identifier for this strategy type */
|
|
25
|
+
type: TType;
|
|
26
|
+
/** Zod schema for validating configuration - accepts input, produces TConfig output */
|
|
27
|
+
configSchema: z.ZodType<TConfig, z.ZodTypeDef, any>;
|
|
28
|
+
/** Metadata for discovery and UI */
|
|
29
|
+
metadata?: {
|
|
30
|
+
displayName: string;
|
|
31
|
+
description: string;
|
|
32
|
+
requiresLLM: boolean;
|
|
33
|
+
isProactive: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Create a compaction strategy instance
|
|
37
|
+
* @param config - Validated configuration with defaults applied (output type)
|
|
38
|
+
*/
|
|
39
|
+
create(config: TConfig, context: CompactionContext): ICompactionStrategy | Promise<ICompactionStrategy>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Base configuration for all compaction strategies
|
|
43
|
+
*/
|
|
44
|
+
export interface CompactionConfig {
|
|
45
|
+
type: string;
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/context/compaction/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB,CAC/B,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,OAAO,SAAS,gBAAgB,GAAG,gBAAgB;IAEnD,+CAA+C;IAC/C,IAAI,EAAE,KAAK,CAAC;IAEZ,uFAAuF;IACvF,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAEpD,oCAAoC;IACpC,QAAQ,CAAC,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,OAAO,CAAC;QACrB,WAAW,EAAE,OAAO,CAAC;KACxB,CAAC;IAEF;;;OAGG;IACH,MAAM,CACF,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,iBAAiB,GAC3B,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 noop_provider_exports = {};
|
|
20
|
+
__export(noop_provider_exports, {
|
|
21
|
+
NoOpConfigSchema: () => NoOpConfigSchema,
|
|
22
|
+
noopProvider: () => noopProvider
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(noop_provider_exports);
|
|
25
|
+
var import_zod = require("zod");
|
|
26
|
+
var import_noop = require("../strategies/noop.js");
|
|
27
|
+
const NoOpConfigSchema = import_zod.z.object({
|
|
28
|
+
type: import_zod.z.literal("noop"),
|
|
29
|
+
enabled: import_zod.z.boolean().default(true).describe("Enable or disable compaction")
|
|
30
|
+
}).strict();
|
|
31
|
+
const noopProvider = {
|
|
32
|
+
type: "noop",
|
|
33
|
+
configSchema: NoOpConfigSchema,
|
|
34
|
+
metadata: {
|
|
35
|
+
displayName: "No Compaction",
|
|
36
|
+
description: "Disables compaction entirely, keeping full conversation history",
|
|
37
|
+
requiresLLM: false,
|
|
38
|
+
isProactive: false
|
|
39
|
+
},
|
|
40
|
+
create(_config, _context) {
|
|
41
|
+
return new import_noop.NoOpCompactionStrategy();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
NoOpConfigSchema,
|
|
47
|
+
noopProvider
|
|
48
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CompactionProvider } from '../provider.js';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration schema for no-op compaction
|
|
5
|
+
*/
|
|
6
|
+
export declare const NoOpConfigSchema: z.ZodObject<{
|
|
7
|
+
type: z.ZodLiteral<"noop">;
|
|
8
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
}, "strict", z.ZodTypeAny, {
|
|
10
|
+
type: "noop";
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
}, {
|
|
13
|
+
type: "noop";
|
|
14
|
+
enabled?: boolean | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export type NoOpConfig = z.output<typeof NoOpConfigSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* Provider for no-op compaction strategy.
|
|
19
|
+
*
|
|
20
|
+
* This strategy disables compaction entirely, keeping full conversation history.
|
|
21
|
+
* Useful for testing, debugging, or contexts where full history is required.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noopProvider: CompactionProvider<'noop', NoOpConfig>;
|
|
24
|
+
//# sourceMappingURL=noop-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-provider.d.ts","sourceRoot":"","sources":["../../../../src/context/compaction/providers/noop-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAKhB,CAAC;AAEd,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAa/D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { NoOpCompactionStrategy } from "../strategies/noop.js";
|
|
4
|
+
const NoOpConfigSchema = z.object({
|
|
5
|
+
type: z.literal("noop"),
|
|
6
|
+
enabled: z.boolean().default(true).describe("Enable or disable compaction")
|
|
7
|
+
}).strict();
|
|
8
|
+
const noopProvider = {
|
|
9
|
+
type: "noop",
|
|
10
|
+
configSchema: NoOpConfigSchema,
|
|
11
|
+
metadata: {
|
|
12
|
+
displayName: "No Compaction",
|
|
13
|
+
description: "Disables compaction entirely, keeping full conversation history",
|
|
14
|
+
requiresLLM: false,
|
|
15
|
+
isProactive: false
|
|
16
|
+
},
|
|
17
|
+
create(_config, _context) {
|
|
18
|
+
return new NoOpCompactionStrategy();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
NoOpConfigSchema,
|
|
23
|
+
noopProvider
|
|
24
|
+
};
|