$ErrorActionPreference = "Stop" $root = Split-Path -Parent $MyInvocation.MyCommand.Path $hostUrl = "http://127.0.0.1:11435" Write-Host "[PhillSwarm] Setting persistent user OLLAMA_HOST=$hostUrl" [Environment]::SetEnvironmentVariable("OLLAMA_HOST", $hostUrl, "User") $env:OLLAMA_HOST = $hostUrl $existing = Get-CimInstance Win32_Process | Where-Object { ($_.Name -like "python*" -or $_.Name -eq "py.exe") -and $_.CommandLine -like "*launch_ollama_bridge.py*" -and $_.CommandLine -like "*11435*" } if (-not $existing) { Write-Host "[PhillSwarm] Starting bridge..." Start-Process -FilePath "py" -ArgumentList @("-3", "launch_ollama_bridge.py", "--model", ".", "--port", "11435") -WorkingDirectory $root -WindowStyle Minimized } Write-Host "[PhillSwarm] Waiting for bridge..." $ready = $false for ($i = 0; $i -lt 30; $i++) { try { Invoke-RestMethod -Uri "$hostUrl/api/tags" -TimeoutSec 2 | Out-Null $ready = $true break } catch { Start-Sleep -Seconds 1 } } if (-not $ready) { throw "Bridge did not become ready at $hostUrl" } Write-Host "[PhillSwarm] Bridge ready." Write-Host "[PhillSwarm] Testing Ollama CLI..." ollama list Write-Host "" Write-Host "[PhillSwarm] Setup complete. Open a new CMD/PowerShell, then use:" Write-Host " ollama run phillswarm-4b:full" Write-Host "" Write-Host "[PhillSwarm] In this PowerShell window you can use it now:" Write-Host " ollama run phillswarm-4b:full `"What is 2+2?`""