Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/atlas-did_pdms-emissivity-svr.json

1 line
5.2 KiB
JSON

{"repo": "atlas-did/pdms-emissivity-svr", "files": {"tools/start-codex-relay.ps1": {"75f8ddc62b36743e7fd943b398ffaf26a479cfbf": {"t": 1785746430.4815884, "n": 2387, "h": "ba6e7186251226a2", "c": "# codex-relay watchdog ? auto-restart on crash, run as hidden background process\n# Usage:\n# powershell -WindowStyle Hidden -File start-codex-relay.ps1 -Daemon (background)\n# .\\start-codex-relay.ps1 (visible)\n\nparam([switch]$Daemon)\n\n$ErrorActionPreference = \"Stop\"\n$relay = Join-Path $env:USERPROFILE \".cargo\\bin\\codex-relay.exe\"\n\nif (-not (Test-Path $relay)) {\n Write-Host \"[FATAL] codex-relay not found at $relay\"\n exit 1\n}\n\n# Read API key from a local env file (never hardcode keys in scripts)\n# Look for config in script directory first, then user profile\n$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path\n$configFile = Join-Path $scriptDir \"..\\.codex-relay.env\"\nif (-not (Test-Path $configFile)) {\n $configFile = Join-Path $env:USERPROFILE \".codex-relay.env\"\n}\nif (-not (Test-Path $configFile)) {\n Write-Host \"[FATAL] Config not found: .codex-relay.env (looked in script dir and ~)\"\n Write-Host \"Create it with these 2 lines:\"\n Write-Host \" CODEX_RELAY_UPSTREAM=https://api.deepseek.com/v1\"\n Write-Host \" CODEX_RELAY_API_KEY=sk-xxxxxxxx\"\n exit 1\n}\nGet-Content $configFile | Where-Object { $_ -match '^\\s*[A-Z_]+\\s*=' -and $_ -notmatch '^\\s*#' } | ForEach-Object {\n $k, $v = $_ -split '=', 2\n [Environment]::SetEnvironmentVariable($k.Trim(), $v.Trim(), \"Process\")\n}\nWrite-Host \"[OK] Loaded $configFile\"\n\nif ($Daemon) {\n $pid | Out-File (Join-Path $env:TEMP \"codex-relay.pid\") -NoNewline\n Write-Host \"[DAEMON] PID=$pid, crash-log: $env:TEMP\\codex-relay-crash.log\"\n}\n\n$restartDelay = 3\n$maxCrashes = 10\n$crashWindowSec = 60\n$crashTimestamps = @()\n\nwhile ($true) {\n # Remove old crash records outside the window\n $now = Get-Date\n $crashTimestamps = @($crashTimestamps | Where-Object { $now - $_ | ForEach-Object TotalSeconds -lt $crashWindowSec })\n if ($crashTimestamps.Count -ge $maxCrashes) {\n Write-Host \"[FATAL] $maxCrashes crashes in ${crashWindowSec}s, giving up\"\n exit 1\n }\n\n $ts = Get-Date -Format \"yyyy-MM-dd HH:mm:ss\"\n Write-Host \"[START] $ts ? codex-relay :4444\"\n $proc = Start-Process -FilePath $relay -NoNewWindow -PassThru\n $proc.WaitForExit()\n $crashTimestamps += Get-Date\n $ts = Get-Date -Format \"HH:mm:ss\"\n Write-Host \"[CRASH] $ts (exit=$($proc.ExitCode)), restart in ${restartDelay}s\"\n Start-Sleep $restartDelay\n}\n"}, "a569b2c7bbe4f166b775219b173eabebef98238a": {"t": 1785764126.006631, "n": 2387, "h": "ba6e7186251226a2", "c": "# codex-relay watchdog ? auto-restart on crash, run as hidden background process\n# Usage:\n# powershell -WindowStyle Hidden -File start-codex-relay.ps1 -Daemon (background)\n# .\\start-codex-relay.ps1 (visible)\n\nparam([switch]$Daemon)\n\n$ErrorActionPreference = \"Stop\"\n$relay = Join-Path $env:USERPROFILE \".cargo\\bin\\codex-relay.exe\"\n\nif (-not (Test-Path $relay)) {\n Write-Host \"[FATAL] codex-relay not found at $relay\"\n exit 1\n}\n\n# Read API key from a local env file (never hardcode keys in scripts)\n# Look for config in script directory first, then user profile\n$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path\n$configFile = Join-Path $scriptDir \"..\\.codex-relay.env\"\nif (-not (Test-Path $configFile)) {\n $configFile = Join-Path $env:USERPROFILE \".codex-relay.env\"\n}\nif (-not (Test-Path $configFile)) {\n Write-Host \"[FATAL] Config not found: .codex-relay.env (looked in script dir and ~)\"\n Write-Host \"Create it with these 2 lines:\"\n Write-Host \" CODEX_RELAY_UPSTREAM=https://api.deepseek.com/v1\"\n Write-Host \" CODEX_RELAY_API_KEY=sk-xxxxxxxx\"\n exit 1\n}\nGet-Content $configFile | Where-Object { $_ -match '^\\s*[A-Z_]+\\s*=' -and $_ -notmatch '^\\s*#' } | ForEach-Object {\n $k, $v = $_ -split '=', 2\n [Environment]::SetEnvironmentVariable($k.Trim(), $v.Trim(), \"Process\")\n}\nWrite-Host \"[OK] Loaded $configFile\"\n\nif ($Daemon) {\n $pid | Out-File (Join-Path $env:TEMP \"codex-relay.pid\") -NoNewline\n Write-Host \"[DAEMON] PID=$pid, crash-log: $env:TEMP\\codex-relay-crash.log\"\n}\n\n$restartDelay = 3\n$maxCrashes = 10\n$crashWindowSec = 60\n$crashTimestamps = @()\n\nwhile ($true) {\n # Remove old crash records outside the window\n $now = Get-Date\n $crashTimestamps = @($crashTimestamps | Where-Object { $now - $_ | ForEach-Object TotalSeconds -lt $crashWindowSec })\n if ($crashTimestamps.Count -ge $maxCrashes) {\n Write-Host \"[FATAL] $maxCrashes crashes in ${crashWindowSec}s, giving up\"\n exit 1\n }\n\n $ts = Get-Date -Format \"yyyy-MM-dd HH:mm:ss\"\n Write-Host \"[START] $ts ? codex-relay :4444\"\n $proc = Start-Process -FilePath $relay -NoNewWindow -PassThru\n $proc.WaitForExit()\n $crashTimestamps += Get-Date\n $ts = Get-Date -Format \"HH:mm:ss\"\n Write-Host \"[CRASH] $ts (exit=$($proc.ExitCode)), restart in ${restartDelay}s\"\n Start-Sleep $restartDelay\n}\n"}}}}