@dexto/core 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/agent/DextoAgent.cjs +22 -3
- package/dist/agent/DextoAgent.d.ts +19 -2
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +23 -4
- package/dist/agent/index.cjs +4 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +5 -1
- package/dist/agent/schemas.cjs +90 -71
- package/dist/agent/schemas.d.ts +5911 -96
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +87 -66
- package/dist/approval/manager.cjs +165 -1
- package/dist/approval/manager.d.ts +91 -2
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +155 -1
- package/dist/approval/schemas.cjs +39 -3
- package/dist/approval/schemas.d.ts +238 -1
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +35 -3
- package/dist/approval/types.cjs +1 -0
- package/dist/approval/types.d.ts +26 -1
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +1 -0
- package/dist/context/compaction/factory.cjs +57 -0
- package/dist/context/compaction/factory.d.ts +17 -0
- package/dist/context/compaction/factory.d.ts.map +1 -0
- package/dist/context/compaction/factory.js +34 -0
- package/dist/context/compaction/index.cjs +49 -0
- package/dist/context/compaction/index.d.ts +11 -0
- package/dist/context/compaction/index.d.ts.map +1 -0
- package/dist/context/compaction/index.js +19 -0
- package/dist/context/{compression → compaction}/overflow.cjs +3 -3
- package/dist/context/{compression → compaction}/overflow.d.ts +4 -4
- package/dist/context/compaction/overflow.d.ts.map +1 -0
- package/dist/context/{compression → compaction}/overflow.js +2 -2
- package/dist/context/compaction/provider.cjs +16 -0
- package/dist/context/compaction/provider.d.ts +48 -0
- package/dist/context/compaction/provider.d.ts.map +1 -0
- package/dist/context/compaction/providers/noop-provider.cjs +48 -0
- package/dist/context/compaction/providers/noop-provider.d.ts +24 -0
- package/dist/context/compaction/providers/noop-provider.d.ts.map +1 -0
- package/dist/context/compaction/providers/noop-provider.js +24 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.cjs +61 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +36 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +1 -0
- package/dist/context/compaction/providers/reactive-overflow-provider.js +37 -0
- package/dist/context/compaction/registry.cjs +39 -0
- package/dist/context/compaction/registry.d.ts +19 -0
- package/dist/context/compaction/registry.d.ts.map +1 -0
- package/dist/context/compaction/registry.js +16 -0
- package/dist/context/compaction/schemas.cjs +38 -0
- package/dist/context/compaction/schemas.d.ts +24 -0
- package/dist/context/compaction/schemas.d.ts.map +1 -0
- package/dist/context/compaction/schemas.js +14 -0
- package/dist/context/compaction/strategies/noop.cjs +36 -0
- package/dist/context/compaction/strategies/noop.d.ts +18 -0
- package/dist/context/compaction/strategies/noop.d.ts.map +1 -0
- package/dist/context/compaction/strategies/noop.js +13 -0
- package/dist/context/{compression → compaction/strategies}/reactive-overflow.cjs +3 -3
- package/dist/context/{compression → compaction/strategies}/reactive-overflow.d.ts +6 -6
- package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +1 -0
- package/dist/context/{compression → compaction/strategies}/reactive-overflow.js +4 -4
- package/dist/context/{compression → compaction}/types.d.ts +4 -4
- package/dist/context/compaction/types.d.ts.map +1 -0
- package/dist/context/compaction/types.js +0 -0
- package/dist/context/error-codes.cjs +4 -0
- package/dist/context/error-codes.d.ts +4 -0
- package/dist/context/error-codes.d.ts.map +1 -1
- package/dist/context/error-codes.js +4 -0
- package/dist/context/errors.cjs +40 -0
- package/dist/context/errors.d.ts +14 -0
- package/dist/context/errors.d.ts.map +1 -1
- package/dist/context/errors.js +40 -0
- package/dist/context/index.cjs +3 -1
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/types.d.ts +6 -0
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/utils.cjs +27 -7
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +27 -7
- package/dist/errors/result-bridge.cjs +2 -3
- package/dist/errors/result-bridge.d.ts.map +1 -1
- package/dist/errors/result-bridge.js +2 -3
- package/dist/events/index.cjs +2 -2
- package/dist/events/index.d.ts +16 -16
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +2 -2
- package/dist/filesystem/filesystem-service.cjs +39 -0
- package/dist/filesystem/filesystem-service.d.ts +32 -0
- package/dist/filesystem/filesystem-service.d.ts.map +1 -1
- package/dist/filesystem/filesystem-service.js +39 -0
- package/dist/filesystem/index.d.ts +1 -1
- package/dist/filesystem/index.d.ts.map +1 -1
- package/dist/filesystem/path-validator.cjs +69 -1
- package/dist/filesystem/path-validator.d.ts +43 -2
- package/dist/filesystem/path-validator.d.ts.map +1 -1
- package/dist/filesystem/path-validator.js +69 -1
- package/dist/image/define-image.cjs +146 -0
- package/dist/image/define-image.d.ts +71 -0
- package/dist/image/define-image.d.ts.map +1 -0
- package/dist/image/define-image.js +121 -0
- package/dist/image/index.cjs +32 -0
- package/dist/image/index.d.ts +53 -0
- package/dist/image/index.d.ts.map +1 -0
- package/dist/image/index.js +7 -0
- package/dist/image/types.cjs +16 -0
- package/dist/image/types.d.ts +231 -0
- package/dist/image/types.d.ts.map +1 -0
- package/dist/image/types.js +0 -0
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/llm/error-codes.cjs +1 -0
- package/dist/llm/error-codes.d.ts +1 -0
- package/dist/llm/error-codes.d.ts.map +1 -1
- package/dist/llm/error-codes.js +1 -0
- package/dist/llm/errors.cjs +24 -0
- package/dist/llm/errors.d.ts +19 -6
- package/dist/llm/errors.d.ts.map +1 -1
- package/dist/llm/errors.js +24 -0
- package/dist/llm/executor/stream-processor.cjs +11 -3
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +11 -3
- package/dist/llm/executor/turn-executor.cjs +50 -23
- package/dist/llm/executor/turn-executor.d.ts +6 -5
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +50 -23
- package/dist/llm/formatters/vercel.cjs +6 -2
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +6 -2
- package/dist/llm/index.cjs +18 -1
- package/dist/llm/index.d.ts +2 -0
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +14 -0
- package/dist/llm/providers/local/ai-sdk-adapter.cjs +308 -0
- package/dist/llm/providers/local/ai-sdk-adapter.d.ts +29 -0
- package/dist/llm/providers/local/ai-sdk-adapter.d.ts.map +1 -0
- package/dist/llm/providers/local/ai-sdk-adapter.js +278 -0
- package/dist/llm/providers/local/downloader.cjs +291 -0
- package/dist/llm/providers/local/downloader.d.ts +82 -0
- package/dist/llm/providers/local/downloader.d.ts.map +1 -0
- package/dist/llm/providers/local/downloader.js +251 -0
- package/dist/llm/providers/local/error-codes.cjs +57 -0
- package/dist/llm/providers/local/error-codes.d.ts +66 -0
- package/dist/llm/providers/local/error-codes.d.ts.map +1 -0
- package/dist/llm/providers/local/error-codes.js +34 -0
- package/dist/llm/providers/local/errors.cjs +240 -0
- package/dist/llm/providers/local/errors.d.ts +31 -0
- package/dist/llm/providers/local/errors.d.ts.map +1 -0
- package/dist/llm/providers/local/errors.js +217 -0
- package/dist/llm/providers/local/gpu-detector.cjs +214 -0
- package/dist/llm/providers/local/gpu-detector.d.ts +28 -0
- package/dist/llm/providers/local/gpu-detector.d.ts.map +1 -0
- package/dist/llm/providers/local/gpu-detector.js +178 -0
- package/dist/llm/providers/local/index.cjs +147 -0
- package/dist/llm/providers/local/index.d.ts +21 -0
- package/dist/llm/providers/local/index.d.ts.map +1 -0
- package/dist/llm/providers/local/index.js +126 -0
- package/dist/llm/providers/local/node-llama-provider.cjs +216 -0
- package/dist/llm/providers/local/node-llama-provider.d.ts +90 -0
- package/dist/llm/providers/local/node-llama-provider.d.ts.map +1 -0
- package/dist/llm/providers/local/node-llama-provider.js +176 -0
- package/dist/llm/providers/local/ollama-provider.cjs +230 -0
- package/dist/llm/providers/local/ollama-provider.d.ts +70 -0
- package/dist/llm/providers/local/ollama-provider.d.ts.map +1 -0
- package/dist/llm/providers/local/ollama-provider.js +198 -0
- package/dist/llm/providers/local/registry.cjs +343 -0
- package/dist/llm/providers/local/registry.d.ts +51 -0
- package/dist/llm/providers/local/registry.d.ts.map +1 -0
- package/dist/llm/providers/local/registry.js +312 -0
- package/dist/llm/providers/local/schemas.cjs +169 -0
- package/dist/llm/providers/local/schemas.d.ts +395 -0
- package/dist/llm/providers/local/schemas.d.ts.map +1 -0
- package/dist/llm/providers/local/schemas.js +133 -0
- package/dist/llm/providers/local/types.cjs +16 -0
- package/dist/llm/providers/local/types.d.ts +219 -0
- package/dist/llm/providers/local/types.d.ts.map +1 -0
- package/dist/llm/providers/local/types.js +0 -0
- package/dist/llm/providers/openrouter-model-registry.cjs +350 -0
- package/dist/llm/providers/openrouter-model-registry.d.ts +120 -0
- package/dist/llm/providers/openrouter-model-registry.d.ts.map +1 -0
- package/dist/llm/providers/openrouter-model-registry.js +309 -0
- package/dist/llm/registry.cjs +535 -9
- package/dist/llm/registry.d.ts +26 -0
- package/dist/llm/registry.d.ts.map +1 -1
- package/dist/llm/registry.js +532 -9
- package/dist/llm/resolver.cjs +63 -5
- package/dist/llm/resolver.d.ts +3 -3
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +69 -6
- package/dist/llm/schemas.cjs +90 -80
- package/dist/llm/schemas.d.ts +158 -22
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +90 -80
- package/dist/llm/services/factory.cjs +87 -13
- package/dist/llm/services/factory.d.ts +4 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +85 -12
- package/dist/llm/services/test-utils.integration.cjs +22 -2
- package/dist/llm/services/test-utils.integration.d.ts +7 -1
- package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
- package/dist/llm/services/test-utils.integration.js +26 -3
- package/dist/llm/services/vercel.cjs +5 -2
- package/dist/llm/services/vercel.d.ts +3 -2
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +5 -2
- package/dist/llm/types.cjs +11 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +11 -1
- package/dist/mcp/manager.cjs +8 -0
- package/dist/mcp/manager.d.ts +17 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +8 -0
- package/dist/mcp/mcp-client.cjs +0 -3
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +0 -3
- package/dist/memory/schemas.d.ts +1 -1
- package/dist/plugins/error-codes.cjs +3 -0
- package/dist/plugins/error-codes.d.ts +7 -1
- package/dist/plugins/error-codes.d.ts.map +1 -1
- package/dist/plugins/error-codes.js +3 -0
- package/dist/plugins/index.cjs +7 -0
- package/dist/plugins/index.d.ts +4 -2
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +6 -1
- package/dist/plugins/manager.cjs +92 -7
- package/dist/plugins/manager.d.ts +10 -3
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/plugins/manager.js +92 -7
- package/dist/plugins/registry.cjs +63 -0
- package/dist/plugins/registry.d.ts +101 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +39 -0
- package/dist/plugins/schemas.cjs +17 -5
- package/dist/plugins/schemas.d.ts +62 -5
- package/dist/plugins/schemas.d.ts.map +1 -1
- package/dist/plugins/schemas.js +15 -4
- package/dist/providers/base-registry.cjs +147 -0
- package/dist/providers/base-registry.d.ts +147 -0
- package/dist/providers/base-registry.d.ts.map +1 -0
- package/dist/providers/base-registry.js +123 -0
- package/dist/providers/discovery.cjs +95 -0
- package/dist/providers/discovery.d.ts +94 -0
- package/dist/providers/discovery.d.ts.map +1 -0
- package/dist/providers/discovery.js +70 -0
- package/dist/providers/index.cjs +24 -0
- package/dist/providers/index.d.ts +32 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +2 -0
- package/dist/resources/reference-parser.cjs +3 -3
- package/dist/resources/reference-parser.d.ts.map +1 -1
- package/dist/resources/reference-parser.js +3 -3
- package/dist/session/chat-session.cjs +20 -3
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +21 -4
- package/dist/storage/blob/factory.cjs +8 -11
- package/dist/storage/blob/factory.d.ts +32 -6
- package/dist/storage/blob/factory.d.ts.map +1 -1
- package/dist/storage/blob/factory.js +8 -11
- package/dist/storage/blob/index.cjs +56 -0
- package/dist/storage/blob/index.d.ts +45 -0
- package/dist/storage/blob/index.d.ts.map +1 -0
- package/dist/storage/blob/index.js +30 -0
- package/dist/storage/blob/provider.cjs +16 -0
- package/dist/storage/blob/provider.d.ts +50 -0
- package/dist/storage/blob/provider.d.ts.map +1 -0
- package/dist/storage/blob/provider.js +0 -0
- package/dist/storage/blob/providers/index.cjs +31 -0
- package/dist/storage/blob/providers/index.d.ts +8 -0
- package/dist/storage/blob/providers/index.d.ts.map +1 -0
- package/dist/storage/blob/providers/index.js +7 -0
- package/dist/storage/blob/providers/local.cjs +39 -0
- package/dist/storage/blob/providers/local.d.ts +17 -0
- package/dist/storage/blob/providers/local.d.ts.map +1 -0
- package/dist/storage/blob/providers/local.js +16 -0
- package/dist/storage/blob/providers/memory.cjs +39 -0
- package/dist/storage/blob/providers/memory.d.ts +17 -0
- package/dist/storage/blob/providers/memory.d.ts.map +1 -0
- package/dist/storage/blob/providers/memory.js +16 -0
- package/dist/storage/blob/registry.cjs +50 -0
- package/dist/storage/blob/registry.d.ts +42 -0
- package/dist/storage/blob/registry.d.ts.map +1 -0
- package/dist/storage/blob/registry.js +26 -0
- package/dist/storage/blob/schemas.cjs +9 -12
- package/dist/storage/blob/schemas.d.ts +39 -34
- package/dist/storage/blob/schemas.d.ts.map +1 -1
- package/dist/storage/blob/schemas.js +6 -11
- package/dist/storage/cache/factory.cjs +8 -36
- package/dist/storage/cache/factory.d.ts +32 -7
- package/dist/storage/cache/factory.d.ts.map +1 -1
- package/dist/storage/cache/factory.js +8 -26
- package/dist/storage/cache/index.cjs +53 -0
- package/dist/storage/cache/index.d.ts +44 -0
- package/dist/storage/cache/index.d.ts.map +1 -0
- package/dist/storage/cache/index.js +28 -0
- package/dist/storage/cache/provider.cjs +16 -0
- package/dist/storage/cache/provider.d.ts +56 -0
- package/dist/storage/cache/provider.d.ts.map +1 -0
- package/dist/storage/cache/provider.js +0 -0
- package/dist/storage/cache/providers/index.cjs +31 -0
- package/dist/storage/cache/providers/index.d.ts +8 -0
- package/dist/storage/cache/providers/index.d.ts.map +1 -0
- package/dist/storage/cache/providers/index.js +7 -0
- package/dist/storage/cache/providers/memory.cjs +40 -0
- package/dist/storage/cache/providers/memory.d.ts +17 -0
- package/dist/storage/cache/providers/memory.d.ts.map +1 -0
- package/dist/storage/cache/providers/memory.js +17 -0
- package/dist/storage/cache/providers/redis.cjs +66 -0
- package/dist/storage/cache/providers/redis.d.ts +20 -0
- package/dist/storage/cache/providers/redis.d.ts.map +1 -0
- package/dist/storage/cache/providers/redis.js +33 -0
- package/dist/storage/cache/registry.cjs +50 -0
- package/dist/storage/cache/registry.d.ts +42 -0
- package/dist/storage/cache/registry.d.ts.map +1 -0
- package/dist/storage/cache/registry.js +26 -0
- package/dist/storage/cache/schemas.cjs +6 -2
- package/dist/storage/cache/schemas.d.ts +2 -3
- package/dist/storage/cache/schemas.d.ts.map +1 -1
- package/dist/storage/cache/schemas.js +3 -1
- package/dist/storage/database/factory.cjs +8 -47
- package/dist/storage/database/factory.d.ts +34 -8
- package/dist/storage/database/factory.d.ts.map +1 -1
- package/dist/storage/database/factory.js +8 -37
- package/dist/storage/database/index.cjs +58 -0
- package/dist/storage/database/index.d.ts +45 -0
- package/dist/storage/database/index.d.ts.map +1 -0
- package/dist/storage/database/index.js +37 -0
- package/dist/storage/database/provider.cjs +16 -0
- package/dist/storage/database/provider.d.ts +56 -0
- package/dist/storage/database/provider.d.ts.map +1 -0
- package/dist/storage/database/provider.js +0 -0
- package/dist/storage/database/providers/index.cjs +34 -0
- package/dist/storage/database/providers/index.d.ts +9 -0
- package/dist/storage/database/providers/index.d.ts.map +1 -0
- package/dist/storage/database/providers/index.js +9 -0
- package/dist/storage/database/providers/memory.cjs +40 -0
- package/dist/storage/database/providers/memory.d.ts +16 -0
- package/dist/storage/database/providers/memory.d.ts.map +1 -0
- package/dist/storage/database/providers/memory.js +17 -0
- package/dist/storage/database/providers/postgres.cjs +62 -0
- package/dist/storage/database/providers/postgres.d.ts +19 -0
- package/dist/storage/database/providers/postgres.d.ts.map +1 -0
- package/dist/storage/database/providers/postgres.js +29 -0
- package/dist/storage/database/providers/sqlite.cjs +66 -0
- package/dist/storage/database/providers/sqlite.d.ts +20 -0
- package/dist/storage/database/providers/sqlite.d.ts.map +1 -0
- package/dist/storage/database/providers/sqlite.js +33 -0
- package/dist/storage/database/registry.cjs +50 -0
- package/dist/storage/database/registry.d.ts +42 -0
- package/dist/storage/database/registry.d.ts.map +1 -0
- package/dist/storage/database/registry.js +26 -0
- package/dist/storage/database/schemas.cjs +8 -2
- package/dist/storage/database/schemas.d.ts +3 -4
- package/dist/storage/database/schemas.d.ts.map +1 -1
- package/dist/storage/database/schemas.js +4 -1
- package/dist/storage/error-codes.cjs +6 -0
- package/dist/storage/error-codes.d.ts +7 -1
- package/dist/storage/error-codes.d.ts.map +1 -1
- package/dist/storage/error-codes.js +6 -0
- package/dist/storage/errors.cjs +80 -0
- package/dist/storage/errors.d.ts +24 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +80 -0
- package/dist/storage/index.cjs +47 -4
- package/dist/storage/index.d.ts +34 -8
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +32 -3
- package/dist/storage/schemas.cjs +4 -0
- package/dist/storage/schemas.d.ts +17 -50
- package/dist/storage/schemas.d.ts.map +1 -1
- package/dist/storage/schemas.js +5 -1
- package/dist/storage/storage-manager.cjs +6 -6
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +3 -3
- package/dist/systemPrompt/in-built-prompts.cjs +7 -6
- package/dist/systemPrompt/in-built-prompts.d.ts +2 -2
- package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -1
- package/dist/systemPrompt/in-built-prompts.js +6 -5
- package/dist/systemPrompt/registry.cjs +2 -2
- package/dist/systemPrompt/registry.d.ts +1 -1
- package/dist/systemPrompt/registry.d.ts.map +1 -1
- package/dist/systemPrompt/registry.js +2 -2
- package/dist/systemPrompt/schemas.cjs +2 -2
- package/dist/systemPrompt/schemas.d.ts +13 -13
- package/dist/systemPrompt/schemas.js +2 -2
- package/dist/tools/custom-tool-registry.cjs +64 -0
- package/dist/tools/custom-tool-registry.d.ts +120 -0
- package/dist/tools/custom-tool-registry.d.ts.map +1 -0
- package/dist/tools/custom-tool-registry.js +40 -0
- package/dist/tools/custom-tool-schema-registry.cjs +164 -0
- package/dist/tools/custom-tool-schema-registry.d.ts +86 -0
- package/dist/tools/custom-tool-schema-registry.d.ts.map +1 -0
- package/dist/tools/custom-tool-schema-registry.js +140 -0
- package/dist/tools/error-codes.cjs +3 -0
- package/dist/tools/error-codes.d.ts +4 -1
- package/dist/tools/error-codes.d.ts.map +1 -1
- package/dist/tools/error-codes.js +3 -0
- package/dist/tools/errors.cjs +41 -0
- package/dist/tools/errors.d.ts +17 -0
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +41 -0
- package/dist/tools/index.cjs +13 -1
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +11 -1
- package/dist/tools/internal-tools/constants.cjs +3 -9
- package/dist/tools/internal-tools/constants.d.ts +1 -1
- package/dist/tools/internal-tools/constants.d.ts.map +1 -1
- package/dist/tools/internal-tools/constants.js +3 -9
- package/dist/tools/internal-tools/implementations/get-resource-tool.cjs +113 -0
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts +30 -0
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/get-resource-tool.js +90 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.cjs +91 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts +24 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/list-resources-tool.js +68 -0
- package/dist/tools/internal-tools/provider.cjs +150 -23
- package/dist/tools/internal-tools/provider.d.ts +55 -10
- package/dist/tools/internal-tools/provider.d.ts.map +1 -1
- package/dist/tools/internal-tools/provider.js +150 -23
- package/dist/tools/internal-tools/registry.cjs +18 -43
- package/dist/tools/internal-tools/registry.d.ts +4 -4
- package/dist/tools/internal-tools/registry.d.ts.map +1 -1
- package/dist/tools/internal-tools/registry.js +18 -43
- package/dist/tools/schemas.cjs +20 -0
- package/dist/tools/schemas.d.ts +43 -1
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +16 -0
- package/dist/tools/tool-manager.cjs +140 -13
- package/dist/tools/tool-manager.d.ts +22 -3
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +140 -13
- package/dist/tools/types.d.ts +43 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.cjs +19 -1
- package/dist/utils/api-key-resolver.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +19 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/redactor.cjs +18 -3
- package/dist/utils/redactor.d.ts +0 -7
- package/dist/utils/redactor.d.ts.map +1 -1
- package/dist/utils/redactor.js +18 -3
- package/dist/utils/service-initializer.cjs +9 -35
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +9 -35
- package/package.json +5 -2
- package/dist/context/compression/overflow.d.ts.map +0 -1
- package/dist/context/compression/reactive-overflow.d.ts.map +0 -1
- package/dist/context/compression/types.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.cjs +0 -130
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts +0 -13
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.js +0 -97
- package/dist/tools/internal-tools/implementations/bash-output-tool.cjs +0 -49
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/bash-output-tool.js +0 -26
- package/dist/tools/internal-tools/implementations/edit-file-tool.cjs +0 -127
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/edit-file-tool.js +0 -104
- package/dist/tools/internal-tools/implementations/glob-files-tool.cjs +0 -70
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/glob-files-tool.js +0 -47
- package/dist/tools/internal-tools/implementations/grep-content-tool.cjs +0 -86
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/grep-content-tool.js +0 -63
- package/dist/tools/internal-tools/implementations/kill-process-tool.cjs +0 -47
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/kill-process-tool.js +0 -24
- package/dist/tools/internal-tools/implementations/read-file-tool.cjs +0 -63
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/read-file-tool.js +0 -40
- package/dist/tools/internal-tools/implementations/write-file-tool.cjs +0 -124
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts +0 -12
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/write-file-tool.js +0 -103
- package/dist/utils/env-file.cjs +0 -118
- package/dist/utils/env-file.d.ts +0 -5
- package/dist/utils/env-file.d.ts.map +0 -1
- package/dist/utils/env-file.js +0 -85
- /package/dist/context/{compression/types.js → compaction/provider.js} +0 -0
- /package/dist/context/{compression → compaction}/types.cjs +0 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var downloader_exports = {};
|
|
30
|
+
__export(downloader_exports, {
|
|
31
|
+
calculateFileHash: () => calculateFileHash,
|
|
32
|
+
checkDiskSpace: () => checkDiskSpace,
|
|
33
|
+
cleanupPartialDownload: () => cleanupPartialDownload,
|
|
34
|
+
downloadModel: () => downloadModel,
|
|
35
|
+
downloadModelFromUrl: () => downloadModelFromUrl,
|
|
36
|
+
getPartialDownloadProgress: () => getPartialDownloadProgress,
|
|
37
|
+
isDownloadInProgress: () => isDownloadInProgress,
|
|
38
|
+
validateDiskSpace: () => validateDiskSpace
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(downloader_exports);
|
|
41
|
+
var import_fs = require("fs");
|
|
42
|
+
var import_crypto = require("crypto");
|
|
43
|
+
var path = __toESM(require("path"), 1);
|
|
44
|
+
var import_errors = require("./errors.js");
|
|
45
|
+
var import_registry = require("./registry.js");
|
|
46
|
+
function buildHuggingFaceUrl(huggingfaceId, filename) {
|
|
47
|
+
return `https://huggingface.co/${huggingfaceId}/resolve/main/${filename}`;
|
|
48
|
+
}
|
|
49
|
+
async function getPartialSize(filePath) {
|
|
50
|
+
try {
|
|
51
|
+
const stats = await import_fs.promises.stat(filePath);
|
|
52
|
+
return stats.size;
|
|
53
|
+
} catch {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function calculateFileHash(filePath) {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
const hash = (0, import_crypto.createHash)("sha256");
|
|
60
|
+
const stream = (0, import_fs.createReadStream)(filePath);
|
|
61
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
62
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
63
|
+
stream.on("error", reject);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function createProgressEvent(modelId, status, bytesDownloaded, totalBytes, speed, eta, error) {
|
|
67
|
+
const progress = {
|
|
68
|
+
modelId,
|
|
69
|
+
status,
|
|
70
|
+
bytesDownloaded,
|
|
71
|
+
totalBytes,
|
|
72
|
+
percentage: totalBytes > 0 ? bytesDownloaded / totalBytes * 100 : 0
|
|
73
|
+
};
|
|
74
|
+
if (speed !== void 0) {
|
|
75
|
+
progress.speed = speed;
|
|
76
|
+
}
|
|
77
|
+
if (eta !== void 0) {
|
|
78
|
+
progress.eta = eta;
|
|
79
|
+
}
|
|
80
|
+
if (error !== void 0) {
|
|
81
|
+
progress.error = error;
|
|
82
|
+
}
|
|
83
|
+
return progress;
|
|
84
|
+
}
|
|
85
|
+
async function downloadFromHuggingFace(url, targetPath, options, modelId, expectedSize) {
|
|
86
|
+
const { events, hfToken, signal } = options;
|
|
87
|
+
const tempPath = `${targetPath}.download`;
|
|
88
|
+
const partialSize = await getPartialSize(tempPath);
|
|
89
|
+
const resumed = partialSize > 0;
|
|
90
|
+
const headers = {
|
|
91
|
+
"User-Agent": "Dexto/1.0"
|
|
92
|
+
};
|
|
93
|
+
if (hfToken) {
|
|
94
|
+
headers["Authorization"] = `Bearer ${hfToken}`;
|
|
95
|
+
}
|
|
96
|
+
if (partialSize > 0) {
|
|
97
|
+
headers["Range"] = `bytes=${partialSize}-`;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const fetchOptions = { headers };
|
|
101
|
+
if (signal) {
|
|
102
|
+
fetchOptions.signal = signal;
|
|
103
|
+
}
|
|
104
|
+
const response = await fetch(url, fetchOptions);
|
|
105
|
+
if (response.status === 401 || response.status === 403) {
|
|
106
|
+
throw import_errors.LocalModelError.hfAuthRequired(modelId);
|
|
107
|
+
}
|
|
108
|
+
if (!response.ok && response.status !== 206) {
|
|
109
|
+
throw import_errors.LocalModelError.downloadFailed(
|
|
110
|
+
modelId,
|
|
111
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const contentLengthHeader = response.headers.get("content-length");
|
|
115
|
+
const contentLength = contentLengthHeader ? parseInt(contentLengthHeader, 10) : 0;
|
|
116
|
+
const totalSize = partialSize + contentLength;
|
|
117
|
+
await import_fs.promises.mkdir(path.dirname(tempPath), { recursive: true });
|
|
118
|
+
const writeStream = (0, import_fs.createWriteStream)(tempPath, {
|
|
119
|
+
flags: resumed ? "a" : "w"
|
|
120
|
+
});
|
|
121
|
+
let bytesDownloaded = partialSize;
|
|
122
|
+
const startTime = Date.now();
|
|
123
|
+
let lastProgressUpdate = startTime;
|
|
124
|
+
const reader = response.body?.getReader();
|
|
125
|
+
if (!reader) {
|
|
126
|
+
writeStream.destroy();
|
|
127
|
+
throw import_errors.LocalModelError.downloadFailed(modelId, "No response body");
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
while (true) {
|
|
131
|
+
const { done, value } = await reader.read();
|
|
132
|
+
if (done) break;
|
|
133
|
+
writeStream.write(value);
|
|
134
|
+
bytesDownloaded += value.length;
|
|
135
|
+
const now = Date.now();
|
|
136
|
+
if (now - lastProgressUpdate > 100 || done) {
|
|
137
|
+
lastProgressUpdate = now;
|
|
138
|
+
const elapsedSeconds = (now - startTime) / 1e3;
|
|
139
|
+
const speed = elapsedSeconds > 0 ? (bytesDownloaded - partialSize) / elapsedSeconds : 0;
|
|
140
|
+
const remainingBytes = totalSize - bytesDownloaded;
|
|
141
|
+
const eta = speed > 0 ? remainingBytes / speed : 0;
|
|
142
|
+
const progress = createProgressEvent(
|
|
143
|
+
modelId,
|
|
144
|
+
"downloading",
|
|
145
|
+
bytesDownloaded,
|
|
146
|
+
totalSize || expectedSize,
|
|
147
|
+
speed,
|
|
148
|
+
eta
|
|
149
|
+
);
|
|
150
|
+
events?.onProgress?.(progress);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
await new Promise((resolve, reject) => {
|
|
154
|
+
writeStream.end((err) => {
|
|
155
|
+
if (err) reject(err);
|
|
156
|
+
else resolve();
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
} catch (error) {
|
|
160
|
+
writeStream.destroy();
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
events?.onProgress?.(createProgressEvent(modelId, "verifying", bytesDownloaded, totalSize));
|
|
164
|
+
await import_fs.promises.rename(tempPath, targetPath);
|
|
165
|
+
const stats = await import_fs.promises.stat(targetPath);
|
|
166
|
+
events?.onProgress?.(createProgressEvent(modelId, "complete", stats.size, stats.size));
|
|
167
|
+
return {
|
|
168
|
+
success: true,
|
|
169
|
+
filePath: targetPath,
|
|
170
|
+
sizeBytes: stats.size,
|
|
171
|
+
resumed
|
|
172
|
+
};
|
|
173
|
+
} catch (error) {
|
|
174
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
175
|
+
throw import_errors.LocalModelError.downloadInterrupted(modelId);
|
|
176
|
+
}
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function downloadModel(modelId, options) {
|
|
181
|
+
const modelInfo = (0, import_registry.getLocalModelById)(modelId);
|
|
182
|
+
if (!modelInfo) {
|
|
183
|
+
throw import_errors.LocalModelError.modelNotFound(modelId);
|
|
184
|
+
}
|
|
185
|
+
const targetPath = path.join(options.targetDir, modelInfo.filename);
|
|
186
|
+
const url = buildHuggingFaceUrl(modelInfo.huggingfaceId, modelInfo.filename);
|
|
187
|
+
if ((0, import_fs.existsSync)(targetPath)) {
|
|
188
|
+
const stats = await import_fs.promises.stat(targetPath);
|
|
189
|
+
if (stats.size === modelInfo.sizeBytes) {
|
|
190
|
+
return {
|
|
191
|
+
success: true,
|
|
192
|
+
filePath: targetPath,
|
|
193
|
+
sizeBytes: stats.size,
|
|
194
|
+
resumed: false
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
await import_fs.promises.unlink(targetPath);
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
options.events?.onProgress?.(
|
|
201
|
+
createProgressEvent(modelId, "pending", 0, modelInfo.sizeBytes)
|
|
202
|
+
);
|
|
203
|
+
const result = await downloadFromHuggingFace(
|
|
204
|
+
url,
|
|
205
|
+
targetPath,
|
|
206
|
+
options,
|
|
207
|
+
modelId,
|
|
208
|
+
modelInfo.sizeBytes
|
|
209
|
+
);
|
|
210
|
+
if (options.verifyHash && options.expectedHash) {
|
|
211
|
+
const actualHash = await calculateFileHash(targetPath);
|
|
212
|
+
if (actualHash !== options.expectedHash) {
|
|
213
|
+
await import_fs.promises.unlink(targetPath);
|
|
214
|
+
throw import_errors.LocalModelError.hashMismatch(modelId, options.expectedHash, actualHash);
|
|
215
|
+
}
|
|
216
|
+
result.sha256 = actualHash;
|
|
217
|
+
}
|
|
218
|
+
options.events?.onComplete?.(modelId, targetPath);
|
|
219
|
+
return result;
|
|
220
|
+
} catch (error) {
|
|
221
|
+
options.events?.onError?.(modelId, error);
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async function downloadModelFromUrl(modelId, url, filename, options) {
|
|
226
|
+
const targetPath = path.join(options.targetDir, filename);
|
|
227
|
+
try {
|
|
228
|
+
options.events?.onProgress?.(createProgressEvent(modelId, "pending", 0, 0));
|
|
229
|
+
const result = await downloadFromHuggingFace(url, targetPath, options, modelId, 0);
|
|
230
|
+
options.events?.onComplete?.(modelId, targetPath);
|
|
231
|
+
return result;
|
|
232
|
+
} catch (error) {
|
|
233
|
+
options.events?.onError?.(modelId, error);
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async function checkDiskSpace(targetDir) {
|
|
238
|
+
try {
|
|
239
|
+
await import_fs.promises.access(targetDir);
|
|
240
|
+
return Number.MAX_SAFE_INTEGER;
|
|
241
|
+
} catch {
|
|
242
|
+
try {
|
|
243
|
+
await import_fs.promises.mkdir(targetDir, { recursive: true });
|
|
244
|
+
return Number.MAX_SAFE_INTEGER;
|
|
245
|
+
} catch {
|
|
246
|
+
return 0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async function validateDiskSpace(modelId, requiredBytes, targetDir) {
|
|
251
|
+
const available = await checkDiskSpace(targetDir);
|
|
252
|
+
if (available < requiredBytes) {
|
|
253
|
+
throw import_errors.LocalModelError.insufficientDiskSpace(modelId, requiredBytes, available);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
async function cleanupPartialDownload(targetDir, filename) {
|
|
257
|
+
const tempPath = path.join(targetDir, `${filename}.download`);
|
|
258
|
+
try {
|
|
259
|
+
await import_fs.promises.unlink(tempPath);
|
|
260
|
+
} catch {
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
async function isDownloadInProgress(targetDir, filename) {
|
|
264
|
+
const tempPath = path.join(targetDir, `${filename}.download`);
|
|
265
|
+
try {
|
|
266
|
+
await import_fs.promises.access(tempPath);
|
|
267
|
+
return true;
|
|
268
|
+
} catch {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
async function getPartialDownloadProgress(modelId, targetDir, filename, totalBytes) {
|
|
273
|
+
const tempPath = path.join(targetDir, `${filename}.download`);
|
|
274
|
+
try {
|
|
275
|
+
const stats = await import_fs.promises.stat(tempPath);
|
|
276
|
+
return createProgressEvent(modelId, "downloading", stats.size, totalBytes);
|
|
277
|
+
} catch {
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
282
|
+
0 && (module.exports = {
|
|
283
|
+
calculateFileHash,
|
|
284
|
+
checkDiskSpace,
|
|
285
|
+
cleanupPartialDownload,
|
|
286
|
+
downloadModel,
|
|
287
|
+
downloadModelFromUrl,
|
|
288
|
+
getPartialDownloadProgress,
|
|
289
|
+
isDownloadInProgress,
|
|
290
|
+
validateDiskSpace
|
|
291
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model downloader for local GGUF models.
|
|
3
|
+
*
|
|
4
|
+
* Downloads models from HuggingFace with:
|
|
5
|
+
* - Progress tracking via events
|
|
6
|
+
* - Resume support for interrupted downloads
|
|
7
|
+
* - Hash verification after download
|
|
8
|
+
*/
|
|
9
|
+
import type { ModelDownloadProgress } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Event emitter interface for download progress.
|
|
12
|
+
*/
|
|
13
|
+
export interface DownloadEvents {
|
|
14
|
+
onProgress?: (progress: ModelDownloadProgress) => void;
|
|
15
|
+
onComplete?: (modelId: string, filePath: string) => void;
|
|
16
|
+
onError?: (modelId: string, error: Error) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Download options.
|
|
20
|
+
*/
|
|
21
|
+
export interface DownloadOptions {
|
|
22
|
+
/** Directory to save the model */
|
|
23
|
+
targetDir: string;
|
|
24
|
+
/** Events for progress tracking */
|
|
25
|
+
events?: DownloadEvents;
|
|
26
|
+
/** HuggingFace token for gated models */
|
|
27
|
+
hfToken?: string;
|
|
28
|
+
/** Whether to verify hash after download */
|
|
29
|
+
verifyHash?: boolean;
|
|
30
|
+
/** Abort signal for cancellation */
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
/** Expected SHA-256 hash for verification */
|
|
33
|
+
expectedHash?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Download result.
|
|
37
|
+
*/
|
|
38
|
+
export interface DownloadResult {
|
|
39
|
+
/** Whether download succeeded */
|
|
40
|
+
success: boolean;
|
|
41
|
+
/** Full path to downloaded file */
|
|
42
|
+
filePath: string;
|
|
43
|
+
/** File size in bytes */
|
|
44
|
+
sizeBytes: number;
|
|
45
|
+
/** SHA-256 hash of the file */
|
|
46
|
+
sha256?: string;
|
|
47
|
+
/** Whether download was resumed from partial */
|
|
48
|
+
resumed: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Calculate SHA-256 hash of a file.
|
|
52
|
+
*/
|
|
53
|
+
export declare function calculateFileHash(filePath: string): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Download a local model by ID.
|
|
56
|
+
*/
|
|
57
|
+
export declare function downloadModel(modelId: string, options: DownloadOptions): Promise<DownloadResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Download a model directly from a URL (for custom models).
|
|
60
|
+
*/
|
|
61
|
+
export declare function downloadModelFromUrl(modelId: string, url: string, filename: string, options: DownloadOptions): Promise<DownloadResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Check available disk space at a path.
|
|
64
|
+
*/
|
|
65
|
+
export declare function checkDiskSpace(targetDir: string): Promise<number>;
|
|
66
|
+
/**
|
|
67
|
+
* Validate that there's enough disk space for a model.
|
|
68
|
+
*/
|
|
69
|
+
export declare function validateDiskSpace(modelId: string, requiredBytes: number, targetDir: string): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Clean up partial download files.
|
|
72
|
+
*/
|
|
73
|
+
export declare function cleanupPartialDownload(targetDir: string, filename: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Check if a download is in progress (partial file exists).
|
|
76
|
+
*/
|
|
77
|
+
export declare function isDownloadInProgress(targetDir: string, filename: string): Promise<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Get the progress of a partial download.
|
|
80
|
+
*/
|
|
81
|
+
export declare function getPartialDownloadProgress(modelId: string, targetDir: string, filename: string, totalBytes: number): Promise<ModelDownloadProgress | null>;
|
|
82
|
+
//# sourceMappingURL=downloader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloader.d.ts","sourceRoot":"","sources":["../../../../src/llm/providers/local/downloader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,YAAY,CAAC;AAI7E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;CACpB;AAsBD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASzE;AAqLD;;GAEG;AACH,wBAAsB,aAAa,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,GACzB,OAAO,CAAC,cAAc,CAAC,CAwDzB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,eAAe,GACzB,OAAO,CAAC,cAAc,CAAC,CAczB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAevE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO/F;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQhG;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC5C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACnB,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAQvC"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
+
import { createWriteStream, promises as fs, existsSync, createReadStream } from "fs";
|
|
3
|
+
import { createHash } from "crypto";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { LocalModelError } from "./errors.js";
|
|
6
|
+
import { getLocalModelById } from "./registry.js";
|
|
7
|
+
function buildHuggingFaceUrl(huggingfaceId, filename) {
|
|
8
|
+
return `https://huggingface.co/${huggingfaceId}/resolve/main/${filename}`;
|
|
9
|
+
}
|
|
10
|
+
async function getPartialSize(filePath) {
|
|
11
|
+
try {
|
|
12
|
+
const stats = await fs.stat(filePath);
|
|
13
|
+
return stats.size;
|
|
14
|
+
} catch {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function calculateFileHash(filePath) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
const hash = createHash("sha256");
|
|
21
|
+
const stream = createReadStream(filePath);
|
|
22
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
23
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
24
|
+
stream.on("error", reject);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function createProgressEvent(modelId, status, bytesDownloaded, totalBytes, speed, eta, error) {
|
|
28
|
+
const progress = {
|
|
29
|
+
modelId,
|
|
30
|
+
status,
|
|
31
|
+
bytesDownloaded,
|
|
32
|
+
totalBytes,
|
|
33
|
+
percentage: totalBytes > 0 ? bytesDownloaded / totalBytes * 100 : 0
|
|
34
|
+
};
|
|
35
|
+
if (speed !== void 0) {
|
|
36
|
+
progress.speed = speed;
|
|
37
|
+
}
|
|
38
|
+
if (eta !== void 0) {
|
|
39
|
+
progress.eta = eta;
|
|
40
|
+
}
|
|
41
|
+
if (error !== void 0) {
|
|
42
|
+
progress.error = error;
|
|
43
|
+
}
|
|
44
|
+
return progress;
|
|
45
|
+
}
|
|
46
|
+
async function downloadFromHuggingFace(url, targetPath, options, modelId, expectedSize) {
|
|
47
|
+
const { events, hfToken, signal } = options;
|
|
48
|
+
const tempPath = `${targetPath}.download`;
|
|
49
|
+
const partialSize = await getPartialSize(tempPath);
|
|
50
|
+
const resumed = partialSize > 0;
|
|
51
|
+
const headers = {
|
|
52
|
+
"User-Agent": "Dexto/1.0"
|
|
53
|
+
};
|
|
54
|
+
if (hfToken) {
|
|
55
|
+
headers["Authorization"] = `Bearer ${hfToken}`;
|
|
56
|
+
}
|
|
57
|
+
if (partialSize > 0) {
|
|
58
|
+
headers["Range"] = `bytes=${partialSize}-`;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const fetchOptions = { headers };
|
|
62
|
+
if (signal) {
|
|
63
|
+
fetchOptions.signal = signal;
|
|
64
|
+
}
|
|
65
|
+
const response = await fetch(url, fetchOptions);
|
|
66
|
+
if (response.status === 401 || response.status === 403) {
|
|
67
|
+
throw LocalModelError.hfAuthRequired(modelId);
|
|
68
|
+
}
|
|
69
|
+
if (!response.ok && response.status !== 206) {
|
|
70
|
+
throw LocalModelError.downloadFailed(
|
|
71
|
+
modelId,
|
|
72
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
const contentLengthHeader = response.headers.get("content-length");
|
|
76
|
+
const contentLength = contentLengthHeader ? parseInt(contentLengthHeader, 10) : 0;
|
|
77
|
+
const totalSize = partialSize + contentLength;
|
|
78
|
+
await fs.mkdir(path.dirname(tempPath), { recursive: true });
|
|
79
|
+
const writeStream = createWriteStream(tempPath, {
|
|
80
|
+
flags: resumed ? "a" : "w"
|
|
81
|
+
});
|
|
82
|
+
let bytesDownloaded = partialSize;
|
|
83
|
+
const startTime = Date.now();
|
|
84
|
+
let lastProgressUpdate = startTime;
|
|
85
|
+
const reader = response.body?.getReader();
|
|
86
|
+
if (!reader) {
|
|
87
|
+
writeStream.destroy();
|
|
88
|
+
throw LocalModelError.downloadFailed(modelId, "No response body");
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
while (true) {
|
|
92
|
+
const { done, value } = await reader.read();
|
|
93
|
+
if (done) break;
|
|
94
|
+
writeStream.write(value);
|
|
95
|
+
bytesDownloaded += value.length;
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
if (now - lastProgressUpdate > 100 || done) {
|
|
98
|
+
lastProgressUpdate = now;
|
|
99
|
+
const elapsedSeconds = (now - startTime) / 1e3;
|
|
100
|
+
const speed = elapsedSeconds > 0 ? (bytesDownloaded - partialSize) / elapsedSeconds : 0;
|
|
101
|
+
const remainingBytes = totalSize - bytesDownloaded;
|
|
102
|
+
const eta = speed > 0 ? remainingBytes / speed : 0;
|
|
103
|
+
const progress = createProgressEvent(
|
|
104
|
+
modelId,
|
|
105
|
+
"downloading",
|
|
106
|
+
bytesDownloaded,
|
|
107
|
+
totalSize || expectedSize,
|
|
108
|
+
speed,
|
|
109
|
+
eta
|
|
110
|
+
);
|
|
111
|
+
events?.onProgress?.(progress);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
await new Promise((resolve, reject) => {
|
|
115
|
+
writeStream.end((err) => {
|
|
116
|
+
if (err) reject(err);
|
|
117
|
+
else resolve();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
writeStream.destroy();
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
events?.onProgress?.(createProgressEvent(modelId, "verifying", bytesDownloaded, totalSize));
|
|
125
|
+
await fs.rename(tempPath, targetPath);
|
|
126
|
+
const stats = await fs.stat(targetPath);
|
|
127
|
+
events?.onProgress?.(createProgressEvent(modelId, "complete", stats.size, stats.size));
|
|
128
|
+
return {
|
|
129
|
+
success: true,
|
|
130
|
+
filePath: targetPath,
|
|
131
|
+
sizeBytes: stats.size,
|
|
132
|
+
resumed
|
|
133
|
+
};
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
136
|
+
throw LocalModelError.downloadInterrupted(modelId);
|
|
137
|
+
}
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function downloadModel(modelId, options) {
|
|
142
|
+
const modelInfo = getLocalModelById(modelId);
|
|
143
|
+
if (!modelInfo) {
|
|
144
|
+
throw LocalModelError.modelNotFound(modelId);
|
|
145
|
+
}
|
|
146
|
+
const targetPath = path.join(options.targetDir, modelInfo.filename);
|
|
147
|
+
const url = buildHuggingFaceUrl(modelInfo.huggingfaceId, modelInfo.filename);
|
|
148
|
+
if (existsSync(targetPath)) {
|
|
149
|
+
const stats = await fs.stat(targetPath);
|
|
150
|
+
if (stats.size === modelInfo.sizeBytes) {
|
|
151
|
+
return {
|
|
152
|
+
success: true,
|
|
153
|
+
filePath: targetPath,
|
|
154
|
+
sizeBytes: stats.size,
|
|
155
|
+
resumed: false
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
await fs.unlink(targetPath);
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
options.events?.onProgress?.(
|
|
162
|
+
createProgressEvent(modelId, "pending", 0, modelInfo.sizeBytes)
|
|
163
|
+
);
|
|
164
|
+
const result = await downloadFromHuggingFace(
|
|
165
|
+
url,
|
|
166
|
+
targetPath,
|
|
167
|
+
options,
|
|
168
|
+
modelId,
|
|
169
|
+
modelInfo.sizeBytes
|
|
170
|
+
);
|
|
171
|
+
if (options.verifyHash && options.expectedHash) {
|
|
172
|
+
const actualHash = await calculateFileHash(targetPath);
|
|
173
|
+
if (actualHash !== options.expectedHash) {
|
|
174
|
+
await fs.unlink(targetPath);
|
|
175
|
+
throw LocalModelError.hashMismatch(modelId, options.expectedHash, actualHash);
|
|
176
|
+
}
|
|
177
|
+
result.sha256 = actualHash;
|
|
178
|
+
}
|
|
179
|
+
options.events?.onComplete?.(modelId, targetPath);
|
|
180
|
+
return result;
|
|
181
|
+
} catch (error) {
|
|
182
|
+
options.events?.onError?.(modelId, error);
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async function downloadModelFromUrl(modelId, url, filename, options) {
|
|
187
|
+
const targetPath = path.join(options.targetDir, filename);
|
|
188
|
+
try {
|
|
189
|
+
options.events?.onProgress?.(createProgressEvent(modelId, "pending", 0, 0));
|
|
190
|
+
const result = await downloadFromHuggingFace(url, targetPath, options, modelId, 0);
|
|
191
|
+
options.events?.onComplete?.(modelId, targetPath);
|
|
192
|
+
return result;
|
|
193
|
+
} catch (error) {
|
|
194
|
+
options.events?.onError?.(modelId, error);
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function checkDiskSpace(targetDir) {
|
|
199
|
+
try {
|
|
200
|
+
await fs.access(targetDir);
|
|
201
|
+
return Number.MAX_SAFE_INTEGER;
|
|
202
|
+
} catch {
|
|
203
|
+
try {
|
|
204
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
205
|
+
return Number.MAX_SAFE_INTEGER;
|
|
206
|
+
} catch {
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function validateDiskSpace(modelId, requiredBytes, targetDir) {
|
|
212
|
+
const available = await checkDiskSpace(targetDir);
|
|
213
|
+
if (available < requiredBytes) {
|
|
214
|
+
throw LocalModelError.insufficientDiskSpace(modelId, requiredBytes, available);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async function cleanupPartialDownload(targetDir, filename) {
|
|
218
|
+
const tempPath = path.join(targetDir, `${filename}.download`);
|
|
219
|
+
try {
|
|
220
|
+
await fs.unlink(tempPath);
|
|
221
|
+
} catch {
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async function isDownloadInProgress(targetDir, filename) {
|
|
225
|
+
const tempPath = path.join(targetDir, `${filename}.download`);
|
|
226
|
+
try {
|
|
227
|
+
await fs.access(tempPath);
|
|
228
|
+
return true;
|
|
229
|
+
} catch {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async function getPartialDownloadProgress(modelId, targetDir, filename, totalBytes) {
|
|
234
|
+
const tempPath = path.join(targetDir, `${filename}.download`);
|
|
235
|
+
try {
|
|
236
|
+
const stats = await fs.stat(tempPath);
|
|
237
|
+
return createProgressEvent(modelId, "downloading", stats.size, totalBytes);
|
|
238
|
+
} catch {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
calculateFileHash,
|
|
244
|
+
checkDiskSpace,
|
|
245
|
+
cleanupPartialDownload,
|
|
246
|
+
downloadModel,
|
|
247
|
+
downloadModelFromUrl,
|
|
248
|
+
getPartialDownloadProgress,
|
|
249
|
+
isDownloadInProgress,
|
|
250
|
+
validateDiskSpace
|
|
251
|
+
};
|
|
@@ -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 error_codes_exports = {};
|
|
20
|
+
__export(error_codes_exports, {
|
|
21
|
+
LocalModelErrorCode: () => LocalModelErrorCode
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(error_codes_exports);
|
|
24
|
+
var LocalModelErrorCode = /* @__PURE__ */ ((LocalModelErrorCode2) => {
|
|
25
|
+
LocalModelErrorCode2["NODE_LLAMA_NOT_INSTALLED"] = "LOCAL_001";
|
|
26
|
+
LocalModelErrorCode2["NODE_LLAMA_INSTALL_FAILED"] = "LOCAL_002";
|
|
27
|
+
LocalModelErrorCode2["CMAKE_NOT_FOUND"] = "LOCAL_003";
|
|
28
|
+
LocalModelErrorCode2["BUILD_FAILED"] = "LOCAL_004";
|
|
29
|
+
LocalModelErrorCode2["DOWNLOAD_FAILED"] = "LOCAL_010";
|
|
30
|
+
LocalModelErrorCode2["DOWNLOAD_INTERRUPTED"] = "LOCAL_011";
|
|
31
|
+
LocalModelErrorCode2["DOWNLOAD_HASH_MISMATCH"] = "LOCAL_012";
|
|
32
|
+
LocalModelErrorCode2["INSUFFICIENT_DISK_SPACE"] = "LOCAL_013";
|
|
33
|
+
LocalModelErrorCode2["HF_AUTH_REQUIRED"] = "LOCAL_014";
|
|
34
|
+
LocalModelErrorCode2["NETWORK_ERROR"] = "LOCAL_015";
|
|
35
|
+
LocalModelErrorCode2["MODEL_NOT_FOUND"] = "LOCAL_020";
|
|
36
|
+
LocalModelErrorCode2["MODEL_NOT_DOWNLOADED"] = "LOCAL_021";
|
|
37
|
+
LocalModelErrorCode2["MODEL_LOAD_FAILED"] = "LOCAL_022";
|
|
38
|
+
LocalModelErrorCode2["MODEL_CORRUPT"] = "LOCAL_023";
|
|
39
|
+
LocalModelErrorCode2["INVALID_GGUF"] = "LOCAL_024";
|
|
40
|
+
LocalModelErrorCode2["CONTEXT_TOO_LARGE"] = "LOCAL_025";
|
|
41
|
+
LocalModelErrorCode2["GPU_NOT_AVAILABLE"] = "LOCAL_030";
|
|
42
|
+
LocalModelErrorCode2["INSUFFICIENT_VRAM"] = "LOCAL_031";
|
|
43
|
+
LocalModelErrorCode2["GPU_DRIVER_ERROR"] = "LOCAL_032";
|
|
44
|
+
LocalModelErrorCode2["METAL_NOT_AVAILABLE"] = "LOCAL_033";
|
|
45
|
+
LocalModelErrorCode2["CUDA_NOT_AVAILABLE"] = "LOCAL_034";
|
|
46
|
+
LocalModelErrorCode2["VULKAN_NOT_AVAILABLE"] = "LOCAL_035";
|
|
47
|
+
LocalModelErrorCode2["OLLAMA_NOT_RUNNING"] = "LOCAL_040";
|
|
48
|
+
LocalModelErrorCode2["OLLAMA_MODEL_NOT_FOUND"] = "LOCAL_041";
|
|
49
|
+
LocalModelErrorCode2["OLLAMA_PULL_FAILED"] = "LOCAL_042";
|
|
50
|
+
LocalModelErrorCode2["OLLAMA_API_ERROR"] = "LOCAL_043";
|
|
51
|
+
LocalModelErrorCode2["OLLAMA_VERSION_INCOMPATIBLE"] = "LOCAL_044";
|
|
52
|
+
return LocalModelErrorCode2;
|
|
53
|
+
})(LocalModelErrorCode || {});
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
LocalModelErrorCode
|
|
57
|
+
});
|