$ErrorActionPreference = "Stop" Set-StrictMode -Version Latest $RootDir = Split-Path -Parent $PSScriptRoot $TokenFile = Join-Path $RootDir ".secrets/app-server-token" $EnvFile = Join-Path $RootDir ".env" if (-not (Test-Path $TokenFile) -or -not (Test-Path $EnvFile)) { throw "Run .\scripts\setup.ps1 first." } $Settings = @{} Get-Content $EnvFile | ForEach-Object { if ($_ -and -not $_.StartsWith("#") -and $_.Contains("=")) { $Parts = $_.Split("=", 2) $Settings[$Parts[0]] = $Parts[1] } } $Token = (Get-Content $TokenFile -Raw).Trim() $Headers = @{ Authorization = "Bearer $Token" } $Models = Invoke-RestMethod -Uri "http://127.0.0.1:4500/v1/models" -Headers $Headers -TimeoutSec 10 $AgentCount = @($Models.data).Count if ($AgentCount -eq 0) { throw "Letta App Server is running, but it reported no local agents." } $HostAddress = if ($Settings.OPENWEBUI_HOST) { $Settings.OPENWEBUI_HOST } else { "127.0.0.1" } $Port = if ($Settings.OPENWEBUI_PORT) { $Settings.OPENWEBUI_PORT } else { "3000" } $WebUI = Invoke-RestMethod -Uri "http://${HostAddress}:${Port}/api/version" -TimeoutSec 10 Write-Host "Letta App Server: ready ($AgentCount agents)" Write-Host "OpenWebUI: ready (v$($WebUI.version))" Write-Host "Open: http://${HostAddress}:${Port}"