@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/llm/schemas.d.ts
CHANGED
|
@@ -1,102 +1,257 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Options for LLM config validation
|
|
4
|
+
*/
|
|
5
|
+
export interface LLMValidationOptions {
|
|
6
|
+
/**
|
|
7
|
+
* When true, enforces API key and baseURL requirements.
|
|
8
|
+
* When false (relaxed mode), allows missing API keys/baseURLs for interactive configuration.
|
|
9
|
+
*
|
|
10
|
+
* Use strict mode for:
|
|
11
|
+
* - Server/API mode (headless, needs full config)
|
|
12
|
+
* - MCP mode (headless)
|
|
13
|
+
*
|
|
14
|
+
* Use relaxed mode for:
|
|
15
|
+
* - Web UI (user can configure via settings)
|
|
16
|
+
* - CLI (user can configure interactively)
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
strict?: boolean;
|
|
21
|
+
}
|
|
2
22
|
/** Business rules + compatibility checks */
|
|
3
23
|
export declare const LLMConfigBaseSchema: z.ZodObject<{
|
|
4
|
-
provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere"]>;
|
|
24
|
+
provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
|
|
5
25
|
model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
6
|
-
apiKey: z.ZodEffects<z.ZodString, string, string
|
|
26
|
+
apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
7
27
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
8
28
|
baseURL: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string | undefined, string>>;
|
|
9
29
|
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
10
30
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
11
31
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
12
32
|
allowedMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
|
|
13
34
|
}, "strict", z.ZodTypeAny, {
|
|
14
35
|
model: string;
|
|
15
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
16
|
-
apiKey: string;
|
|
36
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
17
37
|
maxIterations: number;
|
|
38
|
+
apiKey?: string | undefined;
|
|
18
39
|
baseURL?: string | undefined;
|
|
19
40
|
maxInputTokens?: number | undefined;
|
|
20
41
|
maxOutputTokens?: number | undefined;
|
|
21
42
|
temperature?: number | undefined;
|
|
22
43
|
allowedMediaTypes?: string[] | undefined;
|
|
44
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
23
45
|
}, {
|
|
24
46
|
model: string;
|
|
25
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
26
|
-
apiKey
|
|
47
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
48
|
+
apiKey?: string | undefined;
|
|
27
49
|
maxIterations?: number | undefined;
|
|
28
50
|
baseURL?: string | undefined;
|
|
29
51
|
maxInputTokens?: number | undefined;
|
|
30
52
|
maxOutputTokens?: number | undefined;
|
|
31
53
|
temperature?: number | undefined;
|
|
32
54
|
allowedMediaTypes?: string[] | undefined;
|
|
55
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
33
56
|
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Creates an LLM config schema with configurable validation strictness.
|
|
59
|
+
*
|
|
60
|
+
* @param options.strict - When true (default), enforces API key and baseURL requirements.
|
|
61
|
+
* When false, allows missing credentials for interactive configuration.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createLLMConfigSchema(options?: LLMValidationOptions): z.ZodBranded<z.ZodEffects<z.ZodObject<{
|
|
64
|
+
provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
|
|
65
|
+
model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
66
|
+
apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
67
|
+
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
68
|
+
baseURL: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string | undefined, string>>;
|
|
69
|
+
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
allowedMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
73
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
|
|
74
|
+
}, "strict", z.ZodTypeAny, {
|
|
75
|
+
model: string;
|
|
76
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
77
|
+
maxIterations: number;
|
|
78
|
+
apiKey?: string | undefined;
|
|
79
|
+
baseURL?: string | undefined;
|
|
80
|
+
maxInputTokens?: number | undefined;
|
|
81
|
+
maxOutputTokens?: number | undefined;
|
|
82
|
+
temperature?: number | undefined;
|
|
83
|
+
allowedMediaTypes?: string[] | undefined;
|
|
84
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
model: string;
|
|
87
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
88
|
+
apiKey?: string | undefined;
|
|
89
|
+
maxIterations?: number | undefined;
|
|
90
|
+
baseURL?: string | undefined;
|
|
91
|
+
maxInputTokens?: number | undefined;
|
|
92
|
+
maxOutputTokens?: number | undefined;
|
|
93
|
+
temperature?: number | undefined;
|
|
94
|
+
allowedMediaTypes?: string[] | undefined;
|
|
95
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
96
|
+
}>, {
|
|
97
|
+
model: string;
|
|
98
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
99
|
+
maxIterations: number;
|
|
100
|
+
apiKey?: string | undefined;
|
|
101
|
+
baseURL?: string | undefined;
|
|
102
|
+
maxInputTokens?: number | undefined;
|
|
103
|
+
maxOutputTokens?: number | undefined;
|
|
104
|
+
temperature?: number | undefined;
|
|
105
|
+
allowedMediaTypes?: string[] | undefined;
|
|
106
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
model: string;
|
|
109
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
110
|
+
apiKey?: string | undefined;
|
|
111
|
+
maxIterations?: number | undefined;
|
|
112
|
+
baseURL?: string | undefined;
|
|
113
|
+
maxInputTokens?: number | undefined;
|
|
114
|
+
maxOutputTokens?: number | undefined;
|
|
115
|
+
temperature?: number | undefined;
|
|
116
|
+
allowedMediaTypes?: string[] | undefined;
|
|
117
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
118
|
+
}>, "ValidatedLLMConfig">;
|
|
119
|
+
/**
|
|
120
|
+
* Default LLM config schema with strict validation (backwards compatible).
|
|
121
|
+
* Use createLLMConfigSchema({ strict: false }) for relaxed validation.
|
|
122
|
+
*/
|
|
34
123
|
export declare const LLMConfigSchema: z.ZodBranded<z.ZodEffects<z.ZodObject<{
|
|
35
|
-
provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere"]>;
|
|
124
|
+
provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
|
|
36
125
|
model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
37
|
-
apiKey: z.ZodEffects<z.ZodString, string, string
|
|
126
|
+
apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
38
127
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
39
128
|
baseURL: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string | undefined, string>>;
|
|
40
129
|
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
41
130
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
42
131
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
43
132
|
allowedMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
133
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
|
|
44
134
|
}, "strict", z.ZodTypeAny, {
|
|
45
135
|
model: string;
|
|
46
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
47
|
-
apiKey: string;
|
|
136
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
48
137
|
maxIterations: number;
|
|
138
|
+
apiKey?: string | undefined;
|
|
49
139
|
baseURL?: string | undefined;
|
|
50
140
|
maxInputTokens?: number | undefined;
|
|
51
141
|
maxOutputTokens?: number | undefined;
|
|
52
142
|
temperature?: number | undefined;
|
|
53
143
|
allowedMediaTypes?: string[] | undefined;
|
|
144
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
54
145
|
}, {
|
|
55
146
|
model: string;
|
|
56
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
57
|
-
apiKey
|
|
147
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
148
|
+
apiKey?: string | undefined;
|
|
58
149
|
maxIterations?: number | undefined;
|
|
59
150
|
baseURL?: string | undefined;
|
|
60
151
|
maxInputTokens?: number | undefined;
|
|
61
152
|
maxOutputTokens?: number | undefined;
|
|
62
153
|
temperature?: number | undefined;
|
|
63
154
|
allowedMediaTypes?: string[] | undefined;
|
|
155
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
64
156
|
}>, {
|
|
65
157
|
model: string;
|
|
66
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
67
|
-
apiKey: string;
|
|
158
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
68
159
|
maxIterations: number;
|
|
160
|
+
apiKey?: string | undefined;
|
|
69
161
|
baseURL?: string | undefined;
|
|
70
162
|
maxInputTokens?: number | undefined;
|
|
71
163
|
maxOutputTokens?: number | undefined;
|
|
72
164
|
temperature?: number | undefined;
|
|
73
165
|
allowedMediaTypes?: string[] | undefined;
|
|
166
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
74
167
|
}, {
|
|
75
168
|
model: string;
|
|
76
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
77
|
-
apiKey
|
|
169
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
170
|
+
apiKey?: string | undefined;
|
|
78
171
|
maxIterations?: number | undefined;
|
|
79
172
|
baseURL?: string | undefined;
|
|
80
173
|
maxInputTokens?: number | undefined;
|
|
81
174
|
maxOutputTokens?: number | undefined;
|
|
82
175
|
temperature?: number | undefined;
|
|
83
176
|
allowedMediaTypes?: string[] | undefined;
|
|
177
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
178
|
+
}>, "ValidatedLLMConfig">;
|
|
179
|
+
/**
|
|
180
|
+
* Relaxed LLM config schema that allows missing API keys and baseURLs.
|
|
181
|
+
* Use this for interactive modes (CLI, WebUI) where users can configure later.
|
|
182
|
+
*/
|
|
183
|
+
export declare const LLMConfigSchemaRelaxed: z.ZodBranded<z.ZodEffects<z.ZodObject<{
|
|
184
|
+
provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
|
|
185
|
+
model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
186
|
+
apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
187
|
+
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
188
|
+
baseURL: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string | undefined, string>>;
|
|
189
|
+
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
allowedMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
193
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
|
|
194
|
+
}, "strict", z.ZodTypeAny, {
|
|
195
|
+
model: string;
|
|
196
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
197
|
+
maxIterations: number;
|
|
198
|
+
apiKey?: string | undefined;
|
|
199
|
+
baseURL?: string | undefined;
|
|
200
|
+
maxInputTokens?: number | undefined;
|
|
201
|
+
maxOutputTokens?: number | undefined;
|
|
202
|
+
temperature?: number | undefined;
|
|
203
|
+
allowedMediaTypes?: string[] | undefined;
|
|
204
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
205
|
+
}, {
|
|
206
|
+
model: string;
|
|
207
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
208
|
+
apiKey?: string | undefined;
|
|
209
|
+
maxIterations?: number | undefined;
|
|
210
|
+
baseURL?: string | undefined;
|
|
211
|
+
maxInputTokens?: number | undefined;
|
|
212
|
+
maxOutputTokens?: number | undefined;
|
|
213
|
+
temperature?: number | undefined;
|
|
214
|
+
allowedMediaTypes?: string[] | undefined;
|
|
215
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
216
|
+
}>, {
|
|
217
|
+
model: string;
|
|
218
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
219
|
+
maxIterations: number;
|
|
220
|
+
apiKey?: string | undefined;
|
|
221
|
+
baseURL?: string | undefined;
|
|
222
|
+
maxInputTokens?: number | undefined;
|
|
223
|
+
maxOutputTokens?: number | undefined;
|
|
224
|
+
temperature?: number | undefined;
|
|
225
|
+
allowedMediaTypes?: string[] | undefined;
|
|
226
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
227
|
+
}, {
|
|
228
|
+
model: string;
|
|
229
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
|
|
230
|
+
apiKey?: string | undefined;
|
|
231
|
+
maxIterations?: number | undefined;
|
|
232
|
+
baseURL?: string | undefined;
|
|
233
|
+
maxInputTokens?: number | undefined;
|
|
234
|
+
maxOutputTokens?: number | undefined;
|
|
235
|
+
temperature?: number | undefined;
|
|
236
|
+
allowedMediaTypes?: string[] | undefined;
|
|
237
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
84
238
|
}>, "ValidatedLLMConfig">;
|
|
85
239
|
export type LLMConfig = z.input<typeof LLMConfigSchema>;
|
|
86
240
|
export type ValidatedLLMConfig = z.output<typeof LLMConfigSchema>;
|
|
87
241
|
export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
88
|
-
provider: z.ZodOptional<z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere"]>>;
|
|
242
|
+
provider: z.ZodOptional<z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>>;
|
|
89
243
|
model: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
90
|
-
apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string
|
|
244
|
+
apiKey: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
|
|
91
245
|
maxIterations: z.ZodOptional<z.ZodNumber>;
|
|
92
246
|
baseURL: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string | undefined, string>>>;
|
|
93
247
|
maxInputTokens: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
94
248
|
maxOutputTokens: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
95
249
|
temperature: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
96
250
|
allowedMediaTypes: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
251
|
+
reasoningEffort: z.ZodOptional<z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>>;
|
|
97
252
|
}, "strip", z.ZodTypeAny, {
|
|
98
253
|
model?: string | undefined;
|
|
99
|
-
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
254
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
|
|
100
255
|
apiKey?: string | undefined;
|
|
101
256
|
maxIterations?: number | undefined;
|
|
102
257
|
baseURL?: string | undefined;
|
|
@@ -104,9 +259,10 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
|
104
259
|
maxOutputTokens?: number | undefined;
|
|
105
260
|
temperature?: number | undefined;
|
|
106
261
|
allowedMediaTypes?: string[] | undefined;
|
|
262
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
107
263
|
}, {
|
|
108
264
|
model?: string | undefined;
|
|
109
|
-
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
265
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
|
|
110
266
|
apiKey?: string | undefined;
|
|
111
267
|
maxIterations?: number | undefined;
|
|
112
268
|
baseURL?: string | undefined;
|
|
@@ -114,9 +270,10 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
|
114
270
|
maxOutputTokens?: number | undefined;
|
|
115
271
|
temperature?: number | undefined;
|
|
116
272
|
allowedMediaTypes?: string[] | undefined;
|
|
273
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
117
274
|
}>, {
|
|
118
275
|
model?: string | undefined;
|
|
119
|
-
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
276
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
|
|
120
277
|
apiKey?: string | undefined;
|
|
121
278
|
maxIterations?: number | undefined;
|
|
122
279
|
baseURL?: string | undefined;
|
|
@@ -124,9 +281,10 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
|
124
281
|
maxOutputTokens?: number | undefined;
|
|
125
282
|
temperature?: number | undefined;
|
|
126
283
|
allowedMediaTypes?: string[] | undefined;
|
|
284
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
127
285
|
}, {
|
|
128
286
|
model?: string | undefined;
|
|
129
|
-
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
287
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
|
|
130
288
|
apiKey?: string | undefined;
|
|
131
289
|
maxIterations?: number | undefined;
|
|
132
290
|
baseURL?: string | undefined;
|
|
@@ -134,6 +292,7 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
|
134
292
|
maxOutputTokens?: number | undefined;
|
|
135
293
|
temperature?: number | undefined;
|
|
136
294
|
allowedMediaTypes?: string[] | undefined;
|
|
295
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
137
296
|
}>;
|
|
138
297
|
export type LLMUpdates = z.input<typeof LLMUpdatesSchema>;
|
|
139
298
|
export type { LLMUpdateContext } from '../llm/types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/llm/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/llm/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AA0ED,4CAA4C;AAG5C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBnB,CAAC;AAEd;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,oBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA4IvE;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA0C,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA2C,CAAC;AAG/E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAIlE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYvB,CAAC;AACP,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/llm/schemas.js
CHANGED
|
@@ -9,18 +9,19 @@ import {
|
|
|
9
9
|
supportsBaseURL,
|
|
10
10
|
requiresBaseURL,
|
|
11
11
|
acceptsAnyModel,
|
|
12
|
+
supportsCustomModels,
|
|
12
13
|
getSupportedModels,
|
|
13
14
|
isValidProviderModel,
|
|
14
|
-
getMaxInputTokensForModel
|
|
15
|
+
getMaxInputTokensForModel,
|
|
16
|
+
requiresApiKey
|
|
15
17
|
} from "./registry.js";
|
|
16
18
|
import { LLM_PROVIDERS } from "./types.js";
|
|
17
19
|
const LLMConfigFields = {
|
|
18
20
|
provider: z.enum(LLM_PROVIDERS).describe("LLM provider (e.g., 'openai', 'anthropic', 'google', 'groq')"),
|
|
19
21
|
model: NonEmptyTrimmed.describe("Specific model name for the selected provider"),
|
|
20
22
|
// Expand $ENV refs and trim; final validation happens with provider context
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
),
|
|
23
|
+
// Optional for providers that don't need API keys (Ollama, vLLM, etc.)
|
|
24
|
+
apiKey: EnvExpandedString().optional().describe("API key for provider; can be given directly or via $ENV reference"),
|
|
24
25
|
maxIterations: z.coerce.number().int().positive().describe("Max iterations for agentic loops"),
|
|
25
26
|
baseURL: OptionalURL.describe(
|
|
26
27
|
"Base URL for provider (e.g., https://api.openai.com/v1). Only certain providers support this."
|
|
@@ -30,11 +31,26 @@ const LLMConfigFields = {
|
|
|
30
31
|
temperature: z.coerce.number().min(0).max(1).optional().describe("Randomness: 0 deterministic, 1 creative"),
|
|
31
32
|
allowedMediaTypes: z.array(z.string()).optional().describe(
|
|
32
33
|
'MIME type patterns for media expansion (e.g., "image/*", "application/pdf"). If omitted, uses model capabilities from registry. Supports wildcards.'
|
|
34
|
+
),
|
|
35
|
+
// Provider-specific options
|
|
36
|
+
/**
|
|
37
|
+
* OpenAI reasoning effort level for reasoning-capable models (o1, o3, codex, gpt-5.x).
|
|
38
|
+
* Controls how many reasoning tokens the model generates before producing a response.
|
|
39
|
+
* - 'none': No reasoning, fastest responses
|
|
40
|
+
* - 'minimal': Barely any reasoning, very fast responses
|
|
41
|
+
* - 'low': Light reasoning, fast responses
|
|
42
|
+
* - 'medium': Balanced reasoning (OpenAI's recommended daily driver)
|
|
43
|
+
* - 'high': Thorough reasoning for complex tasks
|
|
44
|
+
* - 'xhigh': Extra high reasoning for quality-critical, non-latency-sensitive tasks
|
|
45
|
+
*/
|
|
46
|
+
reasoningEffort: z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional().describe(
|
|
47
|
+
"OpenAI reasoning effort level for reasoning models (o1, o3, codex). Options: 'none', 'minimal', 'low', 'medium' (recommended), 'high', 'xhigh'"
|
|
33
48
|
)
|
|
34
49
|
};
|
|
35
50
|
const LLMConfigBaseSchema = z.object({
|
|
36
51
|
provider: LLMConfigFields.provider,
|
|
37
52
|
model: LLMConfigFields.model,
|
|
53
|
+
// apiKey is optional at schema level - validated based on provider in superRefine
|
|
38
54
|
apiKey: LLMConfigFields.apiKey,
|
|
39
55
|
// Apply defaults only for complete config validation
|
|
40
56
|
maxIterations: z.coerce.number().int().positive().default(50),
|
|
@@ -42,110 +58,118 @@ const LLMConfigBaseSchema = z.object({
|
|
|
42
58
|
maxInputTokens: LLMConfigFields.maxInputTokens,
|
|
43
59
|
maxOutputTokens: LLMConfigFields.maxOutputTokens,
|
|
44
60
|
temperature: LLMConfigFields.temperature,
|
|
45
|
-
allowedMediaTypes: LLMConfigFields.allowedMediaTypes
|
|
61
|
+
allowedMediaTypes: LLMConfigFields.allowedMediaTypes,
|
|
62
|
+
// Provider-specific options
|
|
63
|
+
reasoningEffort: LLMConfigFields.reasoningEffort
|
|
46
64
|
}).strict();
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
path: ["apiKey"],
|
|
55
|
-
message: `Missing API key for provider '${data.provider}' \u2013 set $${primaryVar}`,
|
|
56
|
-
params: {
|
|
57
|
-
code: LLMErrorCode.API_KEY_MISSING,
|
|
58
|
-
scope: ErrorScope.LLM,
|
|
59
|
-
type: ErrorType.USER,
|
|
60
|
-
provider: data.provider,
|
|
61
|
-
envVar: primaryVar
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (baseURLIsSet) {
|
|
66
|
-
if (!supportsBaseURL(data.provider)) {
|
|
65
|
+
function createLLMConfigSchema(options = {}) {
|
|
66
|
+
const { strict = true } = options;
|
|
67
|
+
return LLMConfigBaseSchema.superRefine((data, ctx) => {
|
|
68
|
+
const baseURLIsSet = data.baseURL != null && data.baseURL.trim() !== "";
|
|
69
|
+
const maxInputTokensIsSet = data.maxInputTokens != null;
|
|
70
|
+
if (strict && requiresApiKey(data.provider) && !data.apiKey?.trim()) {
|
|
71
|
+
const primaryVar = getPrimaryApiKeyEnvVar(data.provider);
|
|
67
72
|
ctx.addIssue({
|
|
68
73
|
code: z.ZodIssueCode.custom,
|
|
69
|
-
path: ["
|
|
70
|
-
message: `
|
|
74
|
+
path: ["apiKey"],
|
|
75
|
+
message: `Missing API key for provider '${data.provider}' \u2013 set $${primaryVar}`,
|
|
71
76
|
params: {
|
|
72
|
-
code: LLMErrorCode.
|
|
77
|
+
code: LLMErrorCode.API_KEY_MISSING,
|
|
73
78
|
scope: ErrorScope.LLM,
|
|
74
|
-
type: ErrorType.USER
|
|
79
|
+
type: ErrorType.USER,
|
|
80
|
+
provider: data.provider,
|
|
81
|
+
envVar: primaryVar
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
code: z.ZodIssueCode.custom,
|
|
81
|
-
path: ["baseURL"],
|
|
82
|
-
message: `Provider '${data.provider}' requires a 'baseURL'.`,
|
|
83
|
-
params: {
|
|
84
|
-
code: LLMErrorCode.BASE_URL_MISSING,
|
|
85
|
-
scope: ErrorScope.LLM,
|
|
86
|
-
type: ErrorType.USER
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
if (!acceptsAnyModel(data.provider)) {
|
|
91
|
-
const supportedModelsList = getSupportedModels(data.provider);
|
|
92
|
-
if (!isValidProviderModel(data.provider, data.model)) {
|
|
85
|
+
if (baseURLIsSet) {
|
|
86
|
+
if (!supportsBaseURL(data.provider)) {
|
|
93
87
|
ctx.addIssue({
|
|
94
88
|
code: z.ZodIssueCode.custom,
|
|
95
|
-
path: ["
|
|
96
|
-
message: `
|
|
89
|
+
path: ["provider"],
|
|
90
|
+
message: `Provider '${data.provider}' does not support baseURL. Use an 'openai-compatible' provider if you need a custom base URL.`,
|
|
97
91
|
params: {
|
|
98
|
-
code: LLMErrorCode.
|
|
92
|
+
code: LLMErrorCode.BASE_URL_INVALID,
|
|
99
93
|
scope: ErrorScope.LLM,
|
|
100
94
|
type: ErrorType.USER
|
|
101
95
|
}
|
|
102
96
|
});
|
|
103
97
|
}
|
|
98
|
+
} else if (strict && requiresBaseURL(data.provider)) {
|
|
99
|
+
ctx.addIssue({
|
|
100
|
+
code: z.ZodIssueCode.custom,
|
|
101
|
+
path: ["baseURL"],
|
|
102
|
+
message: `Provider '${data.provider}' requires a 'baseURL'.`,
|
|
103
|
+
params: {
|
|
104
|
+
code: LLMErrorCode.BASE_URL_MISSING,
|
|
105
|
+
scope: ErrorScope.LLM,
|
|
106
|
+
type: ErrorType.USER
|
|
107
|
+
}
|
|
108
|
+
});
|
|
104
109
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
if (data.
|
|
110
|
+
if (!baseURLIsSet || supportsBaseURL(data.provider)) {
|
|
111
|
+
if (!acceptsAnyModel(data.provider) && !supportsCustomModels(data.provider)) {
|
|
112
|
+
const supportedModelsList = getSupportedModels(data.provider);
|
|
113
|
+
if (!isValidProviderModel(data.provider, data.model)) {
|
|
109
114
|
ctx.addIssue({
|
|
110
115
|
code: z.ZodIssueCode.custom,
|
|
111
|
-
path: ["
|
|
112
|
-
message: `
|
|
116
|
+
path: ["model"],
|
|
117
|
+
message: `Model '${data.model}' is not supported for provider '${data.provider}'. Supported: ${supportedModelsList.join(", ")}`,
|
|
113
118
|
params: {
|
|
114
|
-
code: LLMErrorCode.
|
|
119
|
+
code: LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
115
120
|
scope: ErrorScope.LLM,
|
|
116
121
|
type: ErrorType.USER
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
124
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
code:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
}
|
|
126
|
+
if (maxInputTokensIsSet && !acceptsAnyModel(data.provider) && !supportsCustomModels(data.provider)) {
|
|
127
|
+
try {
|
|
128
|
+
const cap = getMaxInputTokensForModel(data.provider, data.model);
|
|
129
|
+
if (data.maxInputTokens > cap) {
|
|
130
|
+
ctx.addIssue({
|
|
131
|
+
code: z.ZodIssueCode.custom,
|
|
132
|
+
path: ["maxInputTokens"],
|
|
133
|
+
message: `Max input tokens for model '${data.model}' is ${cap}. You provided ${data.maxInputTokens}`,
|
|
134
|
+
params: {
|
|
135
|
+
code: LLMErrorCode.TOKENS_EXCEEDED,
|
|
136
|
+
scope: ErrorScope.LLM,
|
|
137
|
+
type: ErrorType.USER
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
} catch (error) {
|
|
142
|
+
if (error instanceof DextoRuntimeError && error.code === LLMErrorCode.MODEL_UNKNOWN) {
|
|
143
|
+
ctx.addIssue({
|
|
144
|
+
code: z.ZodIssueCode.custom,
|
|
145
|
+
path: ["model"],
|
|
146
|
+
message: error.message,
|
|
147
|
+
params: {
|
|
148
|
+
code: error.code,
|
|
149
|
+
scope: error.scope,
|
|
150
|
+
type: error.type
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
155
|
+
ctx.addIssue({
|
|
156
|
+
code: z.ZodIssueCode.custom,
|
|
157
|
+
path: ["model"],
|
|
158
|
+
message,
|
|
159
|
+
params: {
|
|
160
|
+
code: LLMErrorCode.REQUEST_INVALID_SCHEMA,
|
|
161
|
+
scope: ErrorScope.LLM,
|
|
162
|
+
type: ErrorType.SYSTEM
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
144
166
|
}
|
|
145
167
|
}
|
|
146
168
|
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
169
|
+
}).brand();
|
|
170
|
+
}
|
|
171
|
+
const LLMConfigSchema = createLLMConfigSchema({ strict: true });
|
|
172
|
+
const LLMConfigSchemaRelaxed = createLLMConfigSchema({ strict: false });
|
|
149
173
|
const LLMUpdatesSchema = z.object({ ...LLMConfigFields }).partial().superRefine((data, ctx) => {
|
|
150
174
|
if (!data.model && !data.provider) {
|
|
151
175
|
ctx.addIssue({
|
|
@@ -158,5 +182,7 @@ const LLMUpdatesSchema = z.object({ ...LLMConfigFields }).partial().superRefine(
|
|
|
158
182
|
export {
|
|
159
183
|
LLMConfigBaseSchema,
|
|
160
184
|
LLMConfigSchema,
|
|
161
|
-
|
|
185
|
+
LLMConfigSchemaRelaxed,
|
|
186
|
+
LLMUpdatesSchema,
|
|
187
|
+
createLLMConfigSchema
|
|
162
188
|
};
|