| [CmdletBinding()] | |
| param( | |
| [string]$BackendCache = "", | |
| [switch]$AllowDownload | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| $Root = Resolve-Path (Join-Path $PSScriptRoot "..\..") | |
| $ollamaDest = Join-Path $Root "backends\ollama\windows\ollama.exe" | |
| $llamaDest = Join-Path $Root "backends\llama.cpp\windows\llama-server.exe" | |
| New-Item -ItemType Directory -Force -Path (Split-Path $ollamaDest),(Split-Path $llamaDest) | Out-Null | |
| if ($BackendCache) { | |
| if (Test-Path "$BackendCache\ollama.exe") { Copy-Item "$BackendCache\ollama.exe" $ollamaDest -Force } | |
| if (Test-Path "$BackendCache\llama-server.exe") { Copy-Item "$BackendCache\llama-server.exe" $llamaDest -Force } | |
| } | |
| if (!(Test-Path $ollamaDest)) { Write-Warning "Missing ollama.exe. Put it in $ollamaDest or pass -BackendCache." } | |
| if (!(Test-Path $llamaDest)) { Write-Warning "Missing llama-server.exe. Put it in $llamaDest or pass -BackendCache." } | |
| # Production rule: pin backend versions and verify checksums in manifest/backend-sources.json. | |