const { execFileSync } = require("child_process") module.exports = { requires: { bundle: "ai" }, run: [ { method: "log", params: { raw: "Hardware: {{gpu_model}} · {{vram}} GB VRAM · {{ram}} GB RAM" } }, { // highest CUDA the driver supports ("CUDA Version: 13.0", newer drivers "CUDA UMD Version: 13.4" in nvidia-smi) -> llama.cpp build; no NVIDIA/driver -> CPU build // CUDA 13 also needs compute capability >= 7.5 (Maxwell/Pascal/Volta dropped, even on R580+ drivers) method: async (req, ondata, kernel) => { let m = null, cc = 0 try { m = execFileSync("nvidia-smi", { encoding: "utf8" }).match(/CUDA (?:UMD )?Version:\s*(\d+)\.(\d+)/) } catch (e) {} // lowest GPU wins try { cc = Math.min(...execFileSync("nvidia-smi", ["--query-gpu=compute_cap", "--format=csv,noheader"], { encoding: "utf8" }).trim().split(/\r?\n/).map(Number)) } catch (e) {} const v = m ? +m[1] * 100 + +m[2] : 0 const build = v >= 1300 && cc >= 7.5 ? "cuda-13.4" : v >= 1204 ? "cuda-12.4" : "cpu" ondata({ raw: `CUDA: ${m ? m[1] + "." + m[2] : "none"}, compute ${cc || "?"} -> llama.cpp ${build}\r\n` }) return { build } } }, { method: "local.set", params: { build: "{{input.build}}" } }, // on-prem LLM choice (35B needs 48+ GB RAM); transcription, diarization and embeddings always stay local { when: "{{local.build !== 'cpu' && vram >= 4 && ram >= 48}}", method: "input", params: { title: "Local LLM", description: "Transcription, speakers and search always run locally. Cloud models (GitHub Copilot / Anthropic via omp) stay selectable in the Web UI either way.", form: [{ type: "select", key: "onprem", title: "On-prem models", default: "35b", items: [ { text: "Cloud only (no LLM download)", value: "none" }, { text: "Qwen3.5 4B on-prem (~3.3 GB, all in VRAM)", value: "4b" }, { text: "Qwen3.5 4B + Qwen3.6 35B on-prem (~26 GB, experts in RAM)", value: "35b" } ] }] } }, { when: "{{local.build !== 'cpu' && vram >= 4 && ram >= 48}}", method: "local.set", params: { onprem: "{{input.onprem}}" } }, { when: "{{local.build !== 'cpu' && vram >= 4 && ram < 48}}", method: "input", params: { title: "Local LLM", description: "Transcription, speakers and search always run locally. Cloud models (GitHub Copilot / Anthropic via omp) stay selectable in the Web UI either way.", form: [{ type: "select", key: "onprem", title: "On-prem models", default: "4b", items: [ { text: "Cloud only (no LLM download)", value: "none" }, { text: "Qwen3.5 4B on-prem (~3.3 GB, all in VRAM)", value: "4b" } ] }] } }, { when: "{{local.build !== 'cpu' && vram >= 4 && ram < 48}}", method: "local.set", params: { onprem: "{{input.onprem}}" } }, { when: "{{local.build === 'cpu' || vram < 4}}", method: "log", params: { raw: "No CUDA GPU with 4+ GB VRAM: cloud models only; transcription, diarization and embeddings run on CPU." } }, { method: "shell.run", params: { message: "conda install -y -c conda-forge ffmpeg 7zip" } }, // evaluated once, before the extract creates llama-server.exe (re-running Install must not re-download ~700 MB) { method: "local.set", params: { have: "{{exists('app/bin/llama-server.exe') ? 'yes' : 'no'}}" } }, // llama.cpp server (CUDA 13.4 / 12.4 / CPU build, per detection above) for the Qwen VLM + bge-m3 embeddings { when: "{{local.have !== 'yes'}}", method: "shell.run", params: { path: "app", message: "uv run --script llama.py download https://github.com/ggml-org/llama.cpp/releases/download/b11889/llama-b11889-bin-win-{{local.build}}-x64.zip bin/llama-b11889-bin-win-{{local.build}}-x64.zip" } }, { when: "{{local.build !== 'cpu' && local.have !== 'yes'}}", method: "shell.run", params: { path: "app", message: "uv run --script llama.py download https://github.com/ggml-org/llama.cpp/releases/download/b11889/cudart-llama-bin-win-{{local.build}}-x64.zip bin/cudart-llama-bin-win-{{local.build}}-x64.zip" } }, { when: "{{local.have !== 'yes'}}", method: "shell.run", params: { path: "app/bin", message: "7z x -y llama-b11889-bin-win-{{local.build}}-x64.zip" } }, { when: "{{local.build !== 'cpu' && local.have !== 'yes'}}", method: "shell.run", params: { path: "app/bin", message: "7z x -y cudart-llama-bin-win-{{local.build}}-x64.zip" } }, { when: "{{local.have !== 'yes'}}", method: "fs.rm", params: { path: "app/bin/llama-b11889-bin-win-{{local.build}}-x64.zip" } }, { when: "{{local.build !== 'cpu' && local.have !== 'yes'}}", method: "fs.rm", params: { path: "app/bin/cudart-llama-bin-win-{{local.build}}-x64.zip" } }, // speaker diarization (sherpa-onnx) { method: "shell.run", params: { path: "app", message: "uv run --script llama.py download https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/3dspeaker_speech_eres2net_base_sv_zh-cn_3dspeaker_16k.onnx models/emb.onnx" } }, { method: "shell.run", params: { path: "app", message: "uv run --script llama.py download https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-segmentation-models/sherpa-onnx-pyannote-segmentation-3-0.tar.bz2 models/seg.tar.bz2" } }, { method: "shell.run", params: { path: "app/models", message: "tar -xjf seg.tar.bz2" } }, // embeddings for cross-meeting memory { method: "shell.run", params: { path: "app", message: "uv run --script llama.py download https://huggingface.co/gpustack/bge-m3-GGUF/resolve/main/bge-m3-Q8_0.gguf models/bge-m3-Q8_0.gguf" } }, // small VLM (Qwen3.5 4B, ~3.3 GB), all layers in 4 GB VRAM: chosen at install { when: "{{local.onprem === '4b' || local.onprem === '35b'}}", method: "shell.run", params: { path: "app", message: [ "uv run --script llama.py download https://huggingface.co/unsloth/Qwen3.5-4B-GGUF/resolve/main/mmproj-BF16.gguf models/qwen3.5-4b/mmproj-BF16.gguf", "uv run --script llama.py download https://huggingface.co/unsloth/Qwen3.5-4B-GGUF/resolve/main/Qwen3.5-4B-Q4_K_S.gguf models/qwen3.5-4b/Qwen3.5-4B-Q4_K_S.gguf" ] } }, // big MoE LLM + vision projector (~23 GB, experts in RAM): only when chosen at install { when: "{{local.onprem === '35b'}}", method: "shell.run", params: { path: "app", message: [ "uv run --script llama.py download https://huggingface.co/unsloth/Qwen3.6-35B-A3B-GGUF/resolve/main/mmproj-BF16.gguf models/mmproj-BF16.gguf", "uv run --script llama.py download https://huggingface.co/unsloth/Qwen3.6-35B-A3B-GGUF/resolve/main/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf models/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf" ] } }, // pre-build the uv script environments (whisper, prefect, sherpa-onnx, openvino, ...) { method: "shell.run", params: { path: "app", message: [ "uv sync --script flow.py", "uv sync --script server.py", "uv sync --script memory.py" ] } }, // omp (cloud auth): installed into app/bin unless already on PATH; seeds ~/.omp/agent/models.yml only if absent { method: "shell.run", params: { path: "app", message: "uv run --script llama.py install-omp" } }, { method: "notify", params: { html: "Installation finished ({{local.onprem === '35b' ? 'Qwen3.6 35B + Qwen3.5 4B' : local.onprem === '4b' ? 'Qwen3.5 4B' : 'cloud models only'}}; pick the model in the Web UI header). Log in to GitHub Copilot in this terminal now; Anthropic: menu 'Cloud login'." } }, // last: an aborted device flow cannot leave the install half done; skips itself when omp already has a valid login { method: "shell.run", params: { path: "app", input: true, message: "uv run --script llama.py login github-copilot --if-needed" } } ] }