sync: SHANGHAI-U9 2026-10-20

This commit is contained in:
bowei
2026-10-20 23:10:24 +08:00
parent 4c60916d4c
commit 007376f8fd
2 changed files with 13 additions and 4 deletions
+2 -1
View File
@@ -855,7 +855,8 @@ def cmd_bmem(a):
line = "A2A-NODE %s %s" % (cfg["node_id"], " ".join(urls)) line = "A2A-NODE %s %s" % (cfg["node_id"], " ".join(urls))
print("bmem add --global", line) print("bmem add --global", line)
if not a.dry_run: if not a.dry_run:
subprocess.run(["bmem", "add", "--global", line]) # which() honours PATHEXT, so a bmem.cmd shim is found too (CreateProcess alone is not)
subprocess.run([shutil.which("bmem") or "bmem", "add", "--global", line], check=True)
def main(): def main():
+11 -3
View File
@@ -54,13 +54,20 @@ switch ($Action) {
Copy-Item (Join-Path $PSScriptRoot 'claude-a2a.cmd') $dst -Force Copy-Item (Join-Path $PSScriptRoot 'claude-a2a.cmd') $dst -Force
$mcp = (Get-Content (Join-Path $ch 'mcp.json') -Raw) -replace 'C:/Users/bowei', $env:USERPROFILE.Replace('\', '/') $mcp = (Get-Content (Join-Path $ch 'mcp.json') -Raw) -replace 'C:/Users/bowei', $env:USERPROFILE.Replace('\', '/')
Set-Content (Join-Path $ch 'mcp.json') $mcp -Encoding ascii Set-Content (Join-Path $ch 'mcp.json') $mcp -Encoding ascii
Push-Location $ch; npm install --no-audit --no-fund 2>&1 | Out-Null; Pop-Location # via cmd: under PS 5.1 + ErrorActionPreference=Stop, npm.ps1's stderr "npm notice" lines abort the install
Push-Location $ch; cmd /c "npm install --no-audit --no-fund >nul 2>&1"; $npmRc = $LASTEXITCODE; Pop-Location
if ($npmRc -ne 0) { throw "npm install failed in $ch (exit $npmRc)" }
# cmd shim so sessions can just call `a2a` # cmd shim so sessions can just call `a2a`
"@python `"$script`" %*" | Set-Content (Join-Path $dst 'a2a.cmd') -Encoding ascii "@python `"$script`" %*" | Set-Content (Join-Path $dst 'a2a.cmd') -Encoding ascii
$act = New-ScheduledTaskAction -Execute $py -Argument "`"$script`" serve" $act = New-ScheduledTaskAction -Execute $py -Argument "`"$script`" serve"
$trg = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME $trg = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
$set = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) -ExecutionTimeLimit ([TimeSpan]::Zero) $set = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) -ExecutionTimeLimit ([TimeSpan]::Zero)
Register-ScheduledTask -TaskName $task -Action $act -Trigger $trg -Settings $set -Force | Out-Null # AtLogOn tasks need admin on some machines; fall back to the per-user Run key (no admin, no auto-restart)
try { Register-ScheduledTask -TaskName $task -Action $act -Trigger $trg -Settings $set -Force -ErrorAction Stop | Out-Null; "autostart: scheduled task '$task'" }
catch {
Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run' -Name $task -Value "`"$py`" `"$script`" serve"
"autostart: scheduled task denied ($($_.Exception.Message.Trim())); registered HKCU Run '$task' instead"
}
Ensure-Firewall Ensure-Firewall
Start-Node Start-Node
Start-Sleep 2 Start-Sleep 2
@@ -69,5 +76,6 @@ switch ($Action) {
'start' { Start-Node; Start-Sleep 2; & python.exe $script status } 'start' { Start-Node; Start-Sleep 2; & python.exe $script status }
'stop' { Stop-Node; 'stopped' } 'stop' { Stop-Node; 'stopped' }
'status' { & python.exe $script status; & python.exe $script ls; & python.exe $script peers } 'status' { & python.exe $script status; & python.exe $script ls; & python.exe $script peers }
'uninstall' { Stop-Node; Unregister-ScheduledTask -TaskName $task -Confirm:$false -ErrorAction SilentlyContinue; 'removed (config kept in ~/.a2a)' } 'uninstall' { Stop-Node; Unregister-ScheduledTask -TaskName $task -Confirm:$false -ErrorAction SilentlyContinue
Remove-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run' -Name $task -ErrorAction SilentlyContinue; 'removed (config kept in ~/.a2a)' }
} }