$ErrorActionPreference = "Continue" $data = Join-Path $env:ProgramData "GEO\WindowsWorker" Write-Host "GEO Windows H3 Worker 诊断" -ForegroundColor Cyan Write-Host ("系统: " + (Get-CimInstance Win32_OperatingSystem).Caption) $python = Get-Command python.exe -ErrorAction SilentlyContinue if ($python) { Write-Host "Python: OK ($($python.Source))" -ForegroundColor Green } else { Write-Host "Python: 缺失" -ForegroundColor Red } foreach ($name in @("windows_h3_pair.py","windows_h3_worker_daemon.py","mac_worker.py")) { $path = Join-Path $data $name if (Test-Path $path) { Write-Host "$name: OK" -ForegroundColor Green } else { Write-Host "$name: 缺失" -ForegroundColor Red } } foreach ($name in @("GEO_COMFY_GATEWAY_URL","GEO_COMFY_GATEWAY_TOKEN")) { $value = [Environment]::GetEnvironmentVariable($name, "Machine") if ([string]::IsNullOrWhiteSpace($value)) { Write-Host "$name: 未配置" -ForegroundColor Red } else { Write-Host "$name: 已配置(值不显示)" -ForegroundColor Green } } $url = [Environment]::GetEnvironmentVariable("GEO_COMFY_GATEWAY_URL", "Machine") if ($url) { try { $response = Invoke-WebRequest -UseBasicParsing -Uri ($url.TrimEnd('/') + "/readyz") -TimeoutSec 10 Write-Host ("办公室网关: HTTP " + $response.StatusCode) -ForegroundColor Green } catch { Write-Host ("办公室网关: 失败(" + $_.Exception.GetType().Name + ")") -ForegroundColor Red } } $tokenPath = Join-Path $data "worker.json" if (Test-Path $tokenPath) { Write-Host "Worker 配对文件: 存在" -ForegroundColor Green } else { Write-Host "Worker 配对文件: 不存在,尚未完成配对" -ForegroundColor Yellow } try { $task = Get-ScheduledTask -TaskName "GEO Windows H3 Worker" -ErrorAction Stop Write-Host ("计划任务: " + $task.State) -ForegroundColor Green } catch { Write-Host "计划任务: 未安装" -ForegroundColor Yellow } Write-Host "诊断完成。此脚本不会输出网关地址、Token 或配对码。"