$ErrorActionPreference = "Stop" $Hub = if ($env:TEMP_REMOTE_TOOL_HUB) { $env:TEMP_REMOTE_TOOL_HUB } else { "https://down.luckyfound.info" } $Token = $env:TEMP_REMOTE_TOOL_AGENT_TOKEN if (-not $Token) { throw "TEMP_REMOTE_TOOL_AGENT_TOKEN required" } $Work = if ($env:TEMP_REMOTE_TOOL_HOME) { $env:TEMP_REMOTE_TOOL_HOME } else { Join-Path $HOME ".temporary_remote_tool\app" } $Zip = Join-Path $env:TEMP "temporary_remote_tool_python.zip" Invoke-WebRequest -Uri ($Hub.TrimEnd("/") + "/install/archive/python.zip") -OutFile $Zip if (Test-Path $Work) { Remove-Item -Recurse -Force $Work } New-Item -ItemType Directory -Force -Path $Work | Out-Null Expand-Archive -Path $Zip -DestinationPath $Work -Force Set-Location $Work python -m temporary_remote_tool.cli agent --hub $Hub --token $Token