relay: app-state-grab writes into the app's data root for a collect job (send.ps1 is not on every PC)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-06 22:32:50 +00:00
parent 5e3e6a1664
commit 6dd3c3686b

View file

@ -2,14 +2,17 @@
# of the dashboard can be rendered elsewhere from this machine's real numbers. Read-only: never pauses, resumes or
# quits anything (the standing rule of 5 October 2026).
# Queue: packaging/ota/publish-jobs.sh add --kind run --target 1ccfe586 --script relay/playbooks/app-state-grab.ps1 --title "app state grab"
# then packaging/ota/publish-jobs.sh add --kind collect --target 1ccfe586 --glob "state-grab/*.json"
$ErrorActionPreference = 'Continue'
$urlFile = Join-Path $env:LOCALAPPDATA 'igneum\app\app.url'
if (-not (Test-Path $urlFile)) { Write-Host "ERROR: $urlFile missing (is the app running?)"; exit 2 }
$url = (Get-Content $urlFile -Raw).Trim()
$out = Join-Path $env:TEMP 'igneum-state'; New-Item -ItemType Directory -Force -Path $out | Out-Null
# into the app's data root, where a collect job's glob "state-grab/*.json" picks the files up (the relay's send.ps1 is
# not installed on every PC: PC 2, 6 October 2026)
$out = Join-Path $env:LOCALAPPDATA 'igneum\state-grab'; New-Item -ItemType Directory -Force -Path $out | Out-Null
foreach ($pair in @(@('api/state', 'state.json'), @('api/live?window=120', 'live.json'))) {
$dest = Join-Path $out $pair[1]
try { Invoke-WebRequest -UseBasicParsing -Uri ($url + $pair[0]) -TimeoutSec 15 -OutFile $dest; Write-Host "RESULT file=$($pair[1]) bytes=$((Get-Item $dest).Length)"; & $env:RELAY_SEND -TaskId ([long]$env:RELAY_TASK_ID) -Title ("app " + $pair[1]) $dest }
try { Invoke-WebRequest -UseBasicParsing -Uri ($url + $pair[0]) -TimeoutSec 15 -OutFile $dest; Write-Host "RESULT file=$($pair[1]) bytes=$((Get-Item $dest).Length)"; if ($env:RELAY_SEND -and (Test-Path $env:RELAY_SEND)) { & $env:RELAY_SEND -TaskId ([long]$env:RELAY_TASK_ID) -Title ("app " + $pair[1]) $dest } }
catch { Write-Host "RESULT file=$($pair[1]) failed: $($_.Exception.Message)" }
}
exit 0