param(
    [Parameter(Mandatory = $true)][string]$BuiltBinary,
    [Parameter(Mandatory = $true)][string]$DestinationDirectory
)
$ErrorActionPreference = "Stop"
if (-not (Test-Path -LiteralPath $BuiltBinary -PathType Leaf)) {
    throw "BuiltBinary is not a regular file"
}
New-Item -ItemType Directory -Force -Path $DestinationDirectory | Out-Null
$temporary = Join-Path $DestinationDirectory ".metacrate-grid-agent.new.exe"
Copy-Item -LiteralPath $BuiltBinary -Destination $temporary -Force
Move-Item -LiteralPath $temporary -Destination (Join-Path $DestinationDirectory "metacrate-grid-agent.exe") -Force

# Configuration, secrets, conversations, landmarks, and journals live outside
# this directory and are deliberately never created, replaced, or removed.
