@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,214 @@
|
|
|
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 gpu_detector_exports = {};
|
|
30
|
+
__export(gpu_detector_exports, {
|
|
31
|
+
detectGPU: () => detectGPU,
|
|
32
|
+
formatGPUInfo: () => formatGPUInfo,
|
|
33
|
+
getAvailableBackends: () => getAvailableBackends,
|
|
34
|
+
isBackendAvailable: () => isBackendAvailable
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(gpu_detector_exports);
|
|
37
|
+
var import_child_process = require("child_process");
|
|
38
|
+
var import_util = require("util");
|
|
39
|
+
var os = __toESM(require("os"), 1);
|
|
40
|
+
const execAsync = (0, import_util.promisify)(import_child_process.exec);
|
|
41
|
+
async function detectGPU() {
|
|
42
|
+
const platform = os.platform();
|
|
43
|
+
if (platform === "darwin") {
|
|
44
|
+
const metalInfo = await detectMetal();
|
|
45
|
+
if (metalInfo.available) {
|
|
46
|
+
return metalInfo;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (platform === "linux" || platform === "win32") {
|
|
50
|
+
const cudaInfo = await detectCUDA();
|
|
51
|
+
if (cudaInfo.available) {
|
|
52
|
+
return cudaInfo;
|
|
53
|
+
}
|
|
54
|
+
const vulkanInfo = await detectVulkan();
|
|
55
|
+
if (vulkanInfo.available) {
|
|
56
|
+
return vulkanInfo;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
backend: "cpu",
|
|
61
|
+
available: true,
|
|
62
|
+
deviceName: `${os.cpus()[0]?.model ?? "Unknown CPU"}`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async function detectMetal() {
|
|
66
|
+
try {
|
|
67
|
+
const { stdout } = await execAsync("system_profiler SPDisplaysDataType -json 2>/dev/null");
|
|
68
|
+
const data = JSON.parse(stdout);
|
|
69
|
+
const gpuData = data?.SPDisplaysDataType?.[0];
|
|
70
|
+
if (gpuData) {
|
|
71
|
+
const chipName = gpuData.sppci_model ?? gpuData._name ?? "Apple GPU";
|
|
72
|
+
const isAppleSilicon = chipName.toLowerCase().includes("apple") || chipName.toLowerCase().includes("m1") || chipName.toLowerCase().includes("m2") || chipName.toLowerCase().includes("m3") || chipName.toLowerCase().includes("m4");
|
|
73
|
+
const result = {
|
|
74
|
+
backend: "metal",
|
|
75
|
+
available: true,
|
|
76
|
+
deviceName: chipName
|
|
77
|
+
};
|
|
78
|
+
if (isAppleSilicon) {
|
|
79
|
+
result.vramMB = Math.round(os.totalmem() / (1024 * 1024));
|
|
80
|
+
} else if (gpuData.sppci_vram) {
|
|
81
|
+
const vramMatch = gpuData.sppci_vram.match(/(\d+)\s*(GB|MB)/i);
|
|
82
|
+
if (vramMatch) {
|
|
83
|
+
result.vramMB = parseInt(vramMatch[1]) * (vramMatch[2].toUpperCase() === "GB" ? 1024 : 1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
backend: "metal",
|
|
92
|
+
available: false
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async function detectCUDA() {
|
|
96
|
+
try {
|
|
97
|
+
const { stdout } = await execAsync(
|
|
98
|
+
"nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader,nounits 2>/dev/null"
|
|
99
|
+
);
|
|
100
|
+
const lines = stdout.trim().split("\n");
|
|
101
|
+
if (lines.length > 0 && lines[0]) {
|
|
102
|
+
const [name, memoryMB, driverVersion] = lines[0].split(", ").map((s) => s.trim());
|
|
103
|
+
const result = {
|
|
104
|
+
backend: "cuda",
|
|
105
|
+
available: true
|
|
106
|
+
};
|
|
107
|
+
if (name) {
|
|
108
|
+
result.deviceName = name;
|
|
109
|
+
}
|
|
110
|
+
if (memoryMB) {
|
|
111
|
+
result.vramMB = parseInt(memoryMB);
|
|
112
|
+
}
|
|
113
|
+
if (driverVersion) {
|
|
114
|
+
result.driverVersion = driverVersion;
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
backend: "cuda",
|
|
122
|
+
available: false
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async function detectVulkan() {
|
|
126
|
+
try {
|
|
127
|
+
const { stdout } = await execAsync("vulkaninfo --summary 2>/dev/null");
|
|
128
|
+
const deviceMatch = stdout.match(/deviceName\s*=\s*(.+)/);
|
|
129
|
+
const deviceName = deviceMatch?.[1]?.trim() ?? "Vulkan GPU";
|
|
130
|
+
const result = {
|
|
131
|
+
backend: "vulkan",
|
|
132
|
+
available: true,
|
|
133
|
+
deviceName
|
|
134
|
+
};
|
|
135
|
+
const heapMatch = stdout.match(/heapSize\s*=\s*(\d+)/);
|
|
136
|
+
if (heapMatch) {
|
|
137
|
+
result.vramMB = Math.round(parseInt(heapMatch[1]) / (1024 * 1024));
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
if (os.platform() === "linux") {
|
|
143
|
+
try {
|
|
144
|
+
const { stdout } = await execAsync('lspci | grep -i "vga\\|3d\\|display" 2>/dev/null');
|
|
145
|
+
if (stdout.includes("AMD") || stdout.includes("Intel") || stdout.includes("Radeon")) {
|
|
146
|
+
const deviceMatch = stdout.match(/: (.+)/);
|
|
147
|
+
return {
|
|
148
|
+
backend: "vulkan",
|
|
149
|
+
available: true,
|
|
150
|
+
deviceName: deviceMatch?.[1]?.trim() ?? "GPU (Vulkan)"
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
backend: "vulkan",
|
|
158
|
+
available: false
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function formatGPUInfo(info) {
|
|
162
|
+
if (!info.available) {
|
|
163
|
+
return `${info.backend.toUpperCase()} not available`;
|
|
164
|
+
}
|
|
165
|
+
const parts = [info.deviceName ?? info.backend.toUpperCase()];
|
|
166
|
+
if (info.vramMB) {
|
|
167
|
+
const vramGB = (info.vramMB / 1024).toFixed(1);
|
|
168
|
+
parts.push(`${vramGB}GB`);
|
|
169
|
+
}
|
|
170
|
+
if (info.driverVersion) {
|
|
171
|
+
parts.push(`Driver: ${info.driverVersion}`);
|
|
172
|
+
}
|
|
173
|
+
return parts.join(" \u2022 ");
|
|
174
|
+
}
|
|
175
|
+
async function isBackendAvailable(backend) {
|
|
176
|
+
switch (backend) {
|
|
177
|
+
case "metal":
|
|
178
|
+
return (await detectMetal()).available;
|
|
179
|
+
case "cuda":
|
|
180
|
+
return (await detectCUDA()).available;
|
|
181
|
+
case "vulkan":
|
|
182
|
+
return (await detectVulkan()).available;
|
|
183
|
+
case "cpu":
|
|
184
|
+
return true;
|
|
185
|
+
default:
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async function getAvailableBackends() {
|
|
190
|
+
const backends = [];
|
|
191
|
+
const platform = os.platform();
|
|
192
|
+
if (platform === "darwin") {
|
|
193
|
+
if ((await detectMetal()).available) {
|
|
194
|
+
backends.push("metal");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (platform === "linux" || platform === "win32") {
|
|
198
|
+
if ((await detectCUDA()).available) {
|
|
199
|
+
backends.push("cuda");
|
|
200
|
+
}
|
|
201
|
+
if ((await detectVulkan()).available) {
|
|
202
|
+
backends.push("vulkan");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
backends.push("cpu");
|
|
206
|
+
return backends;
|
|
207
|
+
}
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
detectGPU,
|
|
211
|
+
formatGPUInfo,
|
|
212
|
+
getAvailableBackends,
|
|
213
|
+
isBackendAvailable
|
|
214
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU detection for local model acceleration.
|
|
3
|
+
*
|
|
4
|
+
* Detects available GPU backends:
|
|
5
|
+
* - Metal: Apple Silicon (M1/M2/M3/M4 series)
|
|
6
|
+
* - CUDA: NVIDIA GPUs on Linux/Windows
|
|
7
|
+
* - Vulkan: Cross-platform fallback for AMD/Intel GPUs
|
|
8
|
+
* - CPU: Fallback when no GPU is available
|
|
9
|
+
*/
|
|
10
|
+
import type { GPUBackend, GPUInfo } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Detect available GPU backend for the current system.
|
|
13
|
+
* Returns the best available option.
|
|
14
|
+
*/
|
|
15
|
+
export declare function detectGPU(): Promise<GPUInfo>;
|
|
16
|
+
/**
|
|
17
|
+
* Get a human-readable summary of GPU detection results.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatGPUInfo(info: GPUInfo): string;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a specific backend is available.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isBackendAvailable(backend: GPUBackend): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Get all available backends on the current system.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getAvailableBackends(): Promise<GPUBackend[]>;
|
|
28
|
+
//# sourceMappingURL=gpu-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu-detector.d.ts","sourceRoot":"","sources":["../../../../src/llm/providers/local/gpu-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAItD;;;GAGG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CA+BlD;AAmJD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAiBnD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAa9E;AAED;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAuBlE"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
+
import { exec } from "child_process";
|
|
3
|
+
import { promisify } from "util";
|
|
4
|
+
import * as os from "os";
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
async function detectGPU() {
|
|
7
|
+
const platform = os.platform();
|
|
8
|
+
if (platform === "darwin") {
|
|
9
|
+
const metalInfo = await detectMetal();
|
|
10
|
+
if (metalInfo.available) {
|
|
11
|
+
return metalInfo;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (platform === "linux" || platform === "win32") {
|
|
15
|
+
const cudaInfo = await detectCUDA();
|
|
16
|
+
if (cudaInfo.available) {
|
|
17
|
+
return cudaInfo;
|
|
18
|
+
}
|
|
19
|
+
const vulkanInfo = await detectVulkan();
|
|
20
|
+
if (vulkanInfo.available) {
|
|
21
|
+
return vulkanInfo;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
backend: "cpu",
|
|
26
|
+
available: true,
|
|
27
|
+
deviceName: `${os.cpus()[0]?.model ?? "Unknown CPU"}`
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function detectMetal() {
|
|
31
|
+
try {
|
|
32
|
+
const { stdout } = await execAsync("system_profiler SPDisplaysDataType -json 2>/dev/null");
|
|
33
|
+
const data = JSON.parse(stdout);
|
|
34
|
+
const gpuData = data?.SPDisplaysDataType?.[0];
|
|
35
|
+
if (gpuData) {
|
|
36
|
+
const chipName = gpuData.sppci_model ?? gpuData._name ?? "Apple GPU";
|
|
37
|
+
const isAppleSilicon = chipName.toLowerCase().includes("apple") || chipName.toLowerCase().includes("m1") || chipName.toLowerCase().includes("m2") || chipName.toLowerCase().includes("m3") || chipName.toLowerCase().includes("m4");
|
|
38
|
+
const result = {
|
|
39
|
+
backend: "metal",
|
|
40
|
+
available: true,
|
|
41
|
+
deviceName: chipName
|
|
42
|
+
};
|
|
43
|
+
if (isAppleSilicon) {
|
|
44
|
+
result.vramMB = Math.round(os.totalmem() / (1024 * 1024));
|
|
45
|
+
} else if (gpuData.sppci_vram) {
|
|
46
|
+
const vramMatch = gpuData.sppci_vram.match(/(\d+)\s*(GB|MB)/i);
|
|
47
|
+
if (vramMatch) {
|
|
48
|
+
result.vramMB = parseInt(vramMatch[1]) * (vramMatch[2].toUpperCase() === "GB" ? 1024 : 1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
backend: "metal",
|
|
57
|
+
available: false
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function detectCUDA() {
|
|
61
|
+
try {
|
|
62
|
+
const { stdout } = await execAsync(
|
|
63
|
+
"nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader,nounits 2>/dev/null"
|
|
64
|
+
);
|
|
65
|
+
const lines = stdout.trim().split("\n");
|
|
66
|
+
if (lines.length > 0 && lines[0]) {
|
|
67
|
+
const [name, memoryMB, driverVersion] = lines[0].split(", ").map((s) => s.trim());
|
|
68
|
+
const result = {
|
|
69
|
+
backend: "cuda",
|
|
70
|
+
available: true
|
|
71
|
+
};
|
|
72
|
+
if (name) {
|
|
73
|
+
result.deviceName = name;
|
|
74
|
+
}
|
|
75
|
+
if (memoryMB) {
|
|
76
|
+
result.vramMB = parseInt(memoryMB);
|
|
77
|
+
}
|
|
78
|
+
if (driverVersion) {
|
|
79
|
+
result.driverVersion = driverVersion;
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
backend: "cuda",
|
|
87
|
+
available: false
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function detectVulkan() {
|
|
91
|
+
try {
|
|
92
|
+
const { stdout } = await execAsync("vulkaninfo --summary 2>/dev/null");
|
|
93
|
+
const deviceMatch = stdout.match(/deviceName\s*=\s*(.+)/);
|
|
94
|
+
const deviceName = deviceMatch?.[1]?.trim() ?? "Vulkan GPU";
|
|
95
|
+
const result = {
|
|
96
|
+
backend: "vulkan",
|
|
97
|
+
available: true,
|
|
98
|
+
deviceName
|
|
99
|
+
};
|
|
100
|
+
const heapMatch = stdout.match(/heapSize\s*=\s*(\d+)/);
|
|
101
|
+
if (heapMatch) {
|
|
102
|
+
result.vramMB = Math.round(parseInt(heapMatch[1]) / (1024 * 1024));
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
if (os.platform() === "linux") {
|
|
108
|
+
try {
|
|
109
|
+
const { stdout } = await execAsync('lspci | grep -i "vga\\|3d\\|display" 2>/dev/null');
|
|
110
|
+
if (stdout.includes("AMD") || stdout.includes("Intel") || stdout.includes("Radeon")) {
|
|
111
|
+
const deviceMatch = stdout.match(/: (.+)/);
|
|
112
|
+
return {
|
|
113
|
+
backend: "vulkan",
|
|
114
|
+
available: true,
|
|
115
|
+
deviceName: deviceMatch?.[1]?.trim() ?? "GPU (Vulkan)"
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
backend: "vulkan",
|
|
123
|
+
available: false
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function formatGPUInfo(info) {
|
|
127
|
+
if (!info.available) {
|
|
128
|
+
return `${info.backend.toUpperCase()} not available`;
|
|
129
|
+
}
|
|
130
|
+
const parts = [info.deviceName ?? info.backend.toUpperCase()];
|
|
131
|
+
if (info.vramMB) {
|
|
132
|
+
const vramGB = (info.vramMB / 1024).toFixed(1);
|
|
133
|
+
parts.push(`${vramGB}GB`);
|
|
134
|
+
}
|
|
135
|
+
if (info.driverVersion) {
|
|
136
|
+
parts.push(`Driver: ${info.driverVersion}`);
|
|
137
|
+
}
|
|
138
|
+
return parts.join(" \u2022 ");
|
|
139
|
+
}
|
|
140
|
+
async function isBackendAvailable(backend) {
|
|
141
|
+
switch (backend) {
|
|
142
|
+
case "metal":
|
|
143
|
+
return (await detectMetal()).available;
|
|
144
|
+
case "cuda":
|
|
145
|
+
return (await detectCUDA()).available;
|
|
146
|
+
case "vulkan":
|
|
147
|
+
return (await detectVulkan()).available;
|
|
148
|
+
case "cpu":
|
|
149
|
+
return true;
|
|
150
|
+
default:
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function getAvailableBackends() {
|
|
155
|
+
const backends = [];
|
|
156
|
+
const platform = os.platform();
|
|
157
|
+
if (platform === "darwin") {
|
|
158
|
+
if ((await detectMetal()).available) {
|
|
159
|
+
backends.push("metal");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (platform === "linux" || platform === "win32") {
|
|
163
|
+
if ((await detectCUDA()).available) {
|
|
164
|
+
backends.push("cuda");
|
|
165
|
+
}
|
|
166
|
+
if ((await detectVulkan()).available) {
|
|
167
|
+
backends.push("vulkan");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
backends.push("cpu");
|
|
171
|
+
return backends;
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
detectGPU,
|
|
175
|
+
formatGPUInfo,
|
|
176
|
+
getAvailableBackends,
|
|
177
|
+
isBackendAvailable
|
|
178
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var local_exports = {};
|
|
21
|
+
__export(local_exports, {
|
|
22
|
+
DEFAULT_OLLAMA_URL: () => import_ollama_provider.DEFAULT_OLLAMA_URL,
|
|
23
|
+
GPUBackendSchema: () => import_schemas.GPUBackendSchema,
|
|
24
|
+
GPUInfoSchema: () => import_schemas.GPUInfoSchema,
|
|
25
|
+
InstalledModelSchema: () => import_schemas.InstalledModelSchema,
|
|
26
|
+
LOCAL_MODEL_REGISTRY: () => import_registry.LOCAL_MODEL_REGISTRY,
|
|
27
|
+
LocalLLMConfigSchema: () => import_schemas.LocalLLMConfigSchema,
|
|
28
|
+
LocalModelCategorySchema: () => import_schemas.LocalModelCategorySchema,
|
|
29
|
+
LocalModelError: () => import_errors.LocalModelError,
|
|
30
|
+
LocalModelErrorCode: () => import_error_codes.LocalModelErrorCode,
|
|
31
|
+
LocalModelInfoSchema: () => import_schemas.LocalModelInfoSchema,
|
|
32
|
+
ModelDownloadOptionsSchema: () => import_schemas.ModelDownloadOptionsSchema,
|
|
33
|
+
ModelDownloadProgressSchema: () => import_schemas.ModelDownloadProgressSchema,
|
|
34
|
+
ModelDownloadStatusSchema: () => import_schemas.ModelDownloadStatusSchema,
|
|
35
|
+
ModelSourceSchema: () => import_schemas.ModelSourceSchema,
|
|
36
|
+
ModelStateSchema: () => import_schemas.ModelStateSchema,
|
|
37
|
+
OllamaModelInfoSchema: () => import_schemas.OllamaModelInfoSchema,
|
|
38
|
+
OllamaStatusSchema: () => import_schemas.OllamaStatusSchema,
|
|
39
|
+
QuantizationTypeSchema: () => import_schemas.QuantizationTypeSchema,
|
|
40
|
+
calculateFileHash: () => import_downloader.calculateFileHash,
|
|
41
|
+
checkDiskSpace: () => import_downloader.checkDiskSpace,
|
|
42
|
+
checkOllamaStatus: () => import_ollama_provider.checkOllamaStatus,
|
|
43
|
+
cleanupPartialDownload: () => import_downloader.cleanupPartialDownload,
|
|
44
|
+
createLocalLanguageModel: () => import_ai_sdk_adapter.createLocalLanguageModel,
|
|
45
|
+
createOllamaModel: () => import_ollama_provider.createOllamaModel,
|
|
46
|
+
createValidatedOllamaModel: () => import_ollama_provider.createValidatedOllamaModel,
|
|
47
|
+
deleteOllamaModel: () => import_ollama_provider.deleteOllamaModel,
|
|
48
|
+
detectGPU: () => import_gpu_detector.detectGPU,
|
|
49
|
+
downloadModel: () => import_downloader.downloadModel,
|
|
50
|
+
downloadModelFromUrl: () => import_downloader.downloadModelFromUrl,
|
|
51
|
+
formatGPUInfo: () => import_gpu_detector.formatGPUInfo,
|
|
52
|
+
generateOllamaEmbeddings: () => import_ollama_provider.generateOllamaEmbeddings,
|
|
53
|
+
getAllLocalModels: () => import_registry.getAllLocalModels,
|
|
54
|
+
getAvailableBackends: () => import_gpu_detector.getAvailableBackends,
|
|
55
|
+
getDefaultLocalModelId: () => import_registry.getDefaultLocalModelId,
|
|
56
|
+
getLoadedModelCount: () => import_node_llama_provider.getLoadedModelCount,
|
|
57
|
+
getLocalModelById: () => import_registry.getLocalModelById,
|
|
58
|
+
getLocalModelsByCategory: () => import_registry.getLocalModelsByCategory,
|
|
59
|
+
getModelsForRAM: () => import_registry.getModelsForRAM,
|
|
60
|
+
getModelsForVRAM: () => import_registry.getModelsForVRAM,
|
|
61
|
+
getOllamaModelInfo: () => import_ollama_provider.getOllamaModelInfo,
|
|
62
|
+
getPartialDownloadProgress: () => import_downloader.getPartialDownloadProgress,
|
|
63
|
+
getRecommendedLocalModels: () => import_registry.getRecommendedLocalModels,
|
|
64
|
+
isBackendAvailable: () => import_gpu_detector.isBackendAvailable,
|
|
65
|
+
isDownloadInProgress: () => import_downloader.isDownloadInProgress,
|
|
66
|
+
isModelLoaded: () => import_node_llama_provider.isModelLoaded,
|
|
67
|
+
isNodeLlamaCppInstalled: () => import_node_llama_provider.isNodeLlamaCppInstalled,
|
|
68
|
+
isOllamaModelAvailable: () => import_ollama_provider.isOllamaModelAvailable,
|
|
69
|
+
listOllamaModels: () => import_ollama_provider.listOllamaModels,
|
|
70
|
+
loadModel: () => import_node_llama_provider.loadModel,
|
|
71
|
+
pullOllamaModel: () => import_ollama_provider.pullOllamaModel,
|
|
72
|
+
requireNodeLlamaCpp: () => import_node_llama_provider.requireNodeLlamaCpp,
|
|
73
|
+
searchLocalModels: () => import_registry.searchLocalModels,
|
|
74
|
+
unloadAllModels: () => import_node_llama_provider.unloadAllModels,
|
|
75
|
+
unloadModel: () => import_node_llama_provider.unloadModel,
|
|
76
|
+
validateDiskSpace: () => import_downloader.validateDiskSpace
|
|
77
|
+
});
|
|
78
|
+
module.exports = __toCommonJS(local_exports);
|
|
79
|
+
__reExport(local_exports, require("./types.js"), module.exports);
|
|
80
|
+
var import_error_codes = require("./error-codes.js");
|
|
81
|
+
var import_errors = require("./errors.js");
|
|
82
|
+
var import_schemas = require("./schemas.js");
|
|
83
|
+
var import_registry = require("./registry.js");
|
|
84
|
+
var import_gpu_detector = require("./gpu-detector.js");
|
|
85
|
+
var import_downloader = require("./downloader.js");
|
|
86
|
+
var import_ollama_provider = require("./ollama-provider.js");
|
|
87
|
+
var import_node_llama_provider = require("./node-llama-provider.js");
|
|
88
|
+
var import_ai_sdk_adapter = require("./ai-sdk-adapter.js");
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
DEFAULT_OLLAMA_URL,
|
|
92
|
+
GPUBackendSchema,
|
|
93
|
+
GPUInfoSchema,
|
|
94
|
+
InstalledModelSchema,
|
|
95
|
+
LOCAL_MODEL_REGISTRY,
|
|
96
|
+
LocalLLMConfigSchema,
|
|
97
|
+
LocalModelCategorySchema,
|
|
98
|
+
LocalModelError,
|
|
99
|
+
LocalModelErrorCode,
|
|
100
|
+
LocalModelInfoSchema,
|
|
101
|
+
ModelDownloadOptionsSchema,
|
|
102
|
+
ModelDownloadProgressSchema,
|
|
103
|
+
ModelDownloadStatusSchema,
|
|
104
|
+
ModelSourceSchema,
|
|
105
|
+
ModelStateSchema,
|
|
106
|
+
OllamaModelInfoSchema,
|
|
107
|
+
OllamaStatusSchema,
|
|
108
|
+
QuantizationTypeSchema,
|
|
109
|
+
calculateFileHash,
|
|
110
|
+
checkDiskSpace,
|
|
111
|
+
checkOllamaStatus,
|
|
112
|
+
cleanupPartialDownload,
|
|
113
|
+
createLocalLanguageModel,
|
|
114
|
+
createOllamaModel,
|
|
115
|
+
createValidatedOllamaModel,
|
|
116
|
+
deleteOllamaModel,
|
|
117
|
+
detectGPU,
|
|
118
|
+
downloadModel,
|
|
119
|
+
downloadModelFromUrl,
|
|
120
|
+
formatGPUInfo,
|
|
121
|
+
generateOllamaEmbeddings,
|
|
122
|
+
getAllLocalModels,
|
|
123
|
+
getAvailableBackends,
|
|
124
|
+
getDefaultLocalModelId,
|
|
125
|
+
getLoadedModelCount,
|
|
126
|
+
getLocalModelById,
|
|
127
|
+
getLocalModelsByCategory,
|
|
128
|
+
getModelsForRAM,
|
|
129
|
+
getModelsForVRAM,
|
|
130
|
+
getOllamaModelInfo,
|
|
131
|
+
getPartialDownloadProgress,
|
|
132
|
+
getRecommendedLocalModels,
|
|
133
|
+
isBackendAvailable,
|
|
134
|
+
isDownloadInProgress,
|
|
135
|
+
isModelLoaded,
|
|
136
|
+
isNodeLlamaCppInstalled,
|
|
137
|
+
isOllamaModelAvailable,
|
|
138
|
+
listOllamaModels,
|
|
139
|
+
loadModel,
|
|
140
|
+
pullOllamaModel,
|
|
141
|
+
requireNodeLlamaCpp,
|
|
142
|
+
searchLocalModels,
|
|
143
|
+
unloadAllModels,
|
|
144
|
+
unloadModel,
|
|
145
|
+
validateDiskSpace,
|
|
146
|
+
...require("./types.js")
|
|
147
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native local model support via node-llama-cpp and Ollama.
|
|
3
|
+
*
|
|
4
|
+
* This module provides:
|
|
5
|
+
* - Local model registry with curated GGUF models
|
|
6
|
+
* - GPU detection (Metal/CUDA/Vulkan)
|
|
7
|
+
* - Model downloading with progress
|
|
8
|
+
* - node-llama-cpp provider for native GGUF execution
|
|
9
|
+
* - Ollama provider for Ollama server integration
|
|
10
|
+
*/
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
export { LocalModelErrorCode } from './error-codes.js';
|
|
13
|
+
export { LocalModelError } from './errors.js';
|
|
14
|
+
export { GPUBackendSchema, QuantizationTypeSchema, LocalModelCategorySchema, ModelSourceSchema, ModelDownloadStatusSchema, LocalModelInfoSchema, ModelDownloadProgressSchema, GPUInfoSchema, LocalLLMConfigSchema, InstalledModelSchema, ModelStateSchema, ModelDownloadOptionsSchema, OllamaModelInfoSchema, OllamaStatusSchema, } from './schemas.js';
|
|
15
|
+
export { LOCAL_MODEL_REGISTRY, getAllLocalModels, getLocalModelById, getLocalModelsByCategory, getRecommendedLocalModels, getModelsForVRAM, getModelsForRAM, searchLocalModels, getDefaultLocalModelId, } from './registry.js';
|
|
16
|
+
export { detectGPU, formatGPUInfo, isBackendAvailable, getAvailableBackends, } from './gpu-detector.js';
|
|
17
|
+
export { downloadModel, downloadModelFromUrl, calculateFileHash, checkDiskSpace, validateDiskSpace, cleanupPartialDownload, isDownloadInProgress, getPartialDownloadProgress, type DownloadEvents, type DownloadOptions, type DownloadResult, } from './downloader.js';
|
|
18
|
+
export { DEFAULT_OLLAMA_URL, checkOllamaStatus, listOllamaModels, isOllamaModelAvailable, pullOllamaModel, createOllamaModel, createValidatedOllamaModel, getOllamaModelInfo, deleteOllamaModel, generateOllamaEmbeddings, type OllamaConfig, } from './ollama-provider.js';
|
|
19
|
+
export { isNodeLlamaCppInstalled, requireNodeLlamaCpp, loadModel, unloadModel, unloadAllModels, isModelLoaded, getLoadedModelCount, type NodeLlamaConfig, type ModelSession, type LoadedModel, } from './node-llama-provider.js';
|
|
20
|
+
export { createLocalLanguageModel, type LocalModelAdapterConfig } from './ai-sdk-adapter.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/llm/providers/local/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC3B,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,GACzB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACH,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACH,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,GACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,YAAY,GACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,GACnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,wBAAwB,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|