# AMerc TinyBox consumer installer 0.5.203-portable [CmdletBinding()] param([string]$AMercBase = 'https://amerc.ai') $ErrorActionPreference = 'Stop' $AccountUser = Read-Host 'AMerc account username' $AccountSecure = Read-Host 'AMerc account password' -AsSecureString $AccountPassword = [Net.NetworkCredential]::new('', $AccountSecure).Password $Session = New-Object Microsoft.PowerShell.Commands.WebRequestSession $InstallRoot = Join-Path $env:LOCALAPPDATA 'AMerc\TinyBox' $Commands = Join-Path $InstallRoot 'commands' $Archive = Join-Path $env:TEMP 'amerc-tinybox-waypoint.zip' try { Invoke-WebRequest -UseBasicParsing -WebSession $Session -Method Post -Uri ($AMercBase.TrimEnd('/') + '/login') ` -ContentType 'application/x-www-form-urlencoded' -Body @{ username = $AccountUser; password = $AccountPassword } | Out-Null Invoke-WebRequest -UseBasicParsing -WebSession $Session -Uri ($AMercBase.TrimEnd('/') + '/downloads/consumer.zip') -OutFile $Archive New-Item -ItemType Directory -Path $InstallRoot,$Commands -Force | Out-Null Expand-Archive -LiteralPath $Archive -DestinationPath $InstallRoot -Force $Command = "@echo off`r`n`"$InstallRoot\tinybox-consumer.exe`" --config `"$InstallRoot\consumer.json`" %*`r`n" [IO.File]::WriteAllText((Join-Path $Commands 'tinybox_consumer.cmd'), $Command, [Text.Encoding]::ASCII) [IO.File]::WriteAllText((Join-Path $Commands 'tinybox-consumer.cmd'), $Command, [Text.Encoding]::ASCII) $UserPath = [string][Environment]::GetEnvironmentVariable('Path', 'User') if (-not (($UserPath -split ';') -contains $Commands)) { [Environment]::SetEnvironmentVariable('Path', (($UserPath.TrimEnd(';') + ';' + $Commands).Trim(';')), 'User') } $Shortcut = (New-Object -ComObject WScript.Shell).CreateShortcut((Join-Path ([Environment]::GetFolderPath('Desktop')) 'AMerc TinyBox.lnk')) $Shortcut.TargetPath = (Join-Path $Commands 'tinybox_consumer.cmd') $Shortcut.Arguments = '--pool claude' $Shortcut.WorkingDirectory = $InstallRoot $Shortcut.Save() Write-Host 'Installed. Open a new terminal and run: tinybox_consumer --pool claude' Write-Host ('Manual: ' + $AMercBase.TrimEnd('/') + '/downloads/tinybox-manual.md') } finally { $AccountPassword = $null }