From c2118c28c92406c10c829aecc9d70ceeb293174a Mon Sep 17 00:00:00 2001 From: Finessse Date: Thu, 18 Dec 2025 17:20:25 +0700 Subject: [PATCH] proxypilot: prefer proxypilot-engine + renamed launcher logs --- docs/desktop-ui-spec.md | 3 +-- docs/proxypilot.md | 4 ++-- docs/windows-ui-spec.md | 3 +-- internal/api/handlers/management/proxypilot.go | 8 ++++---- internal/desktopctl/desktopctl.go | 4 ++-- internal/desktopctl/exe.go | 12 ++++++++++++ scripts/macos/README.md | 4 ++-- scripts/macos/install-cliproxyapi-launchagent.sh | 5 ++--- scripts/macos/start-cliproxy.sh | 5 ++--- scripts/windows/README.md | 4 ++-- scripts/windows/build-cliproxyapi.ps1 | 5 ++++- scripts/windows/start-cliproxy.ps1 | 13 +++++++------ scripts/windows/stop-cliproxy.ps1 | 2 +- 13 files changed, 42 insertions(+), 30 deletions(-) diff --git a/docs/desktop-ui-spec.md b/docs/desktop-ui-spec.md index 5a93ec46..5f79b06c 100644 --- a/docs/desktop-ui-spec.md +++ b/docs/desktop-ui-spec.md @@ -75,7 +75,7 @@ Wails can call `internal/desktopctl` directly; Tauri can call `cliproxyctl`. ### Logs / request diagnostics - Open logs folder. -- Tail last N lines of `cliproxyapi.out.log` and `cliproxyapi.err.log`. +- Tail last N lines of `proxypilot-engine.out.log` and `proxypilot-engine.err.log`. - “Copy diagnostics” button that includes: - app version, proxy version - config path, port, pid @@ -126,4 +126,3 @@ Windows and macOS implementations can live in separate files via Go build tags: - Should the desktop app bundle the engine binary, or manage an existing install? - Do we want a dedicated “desktop control” HTTP endpoint in the proxy (vs local process control only)? - diff --git a/docs/proxypilot.md b/docs/proxypilot.md index affa460c..850026c3 100644 --- a/docs/proxypilot.md +++ b/docs/proxypilot.md @@ -65,6 +65,6 @@ ProxyPilot tray app includes: Useful paths: -- `logs/cliproxyapi.out.log` -- `logs/cliproxyapi.err.log` +- `logs/proxypilot-engine.out.log` +- `logs/proxypilot-engine.err.log` - `logs/v1-responses-*.log` / `logs/v1-chat-completions-*.log` (request logs, if enabled) diff --git a/docs/windows-ui-spec.md b/docs/windows-ui-spec.md index 5f0aeff3..b0444cb4 100644 --- a/docs/windows-ui-spec.md +++ b/docs/windows-ui-spec.md @@ -46,7 +46,7 @@ This is the Windows-specific portion of the desktop UI plan. Shared (cross-platf - Build (optional): build `cmd/server` into `bin/cliproxyapi-latest.exe`. - Start: - Uses a selectable config path (default: repo `config.yaml` if present). - - Writes logs to `logs/cliproxyapi.out.log` and `logs/cliproxyapi.err.log`. +- Writes logs to `logs/proxypilot-engine.out.log` and `logs/proxypilot-engine.err.log`. - Stop: - Prefer graceful stop; fallback to kill process if needed. - Restart. @@ -169,4 +169,3 @@ Windows-specific notes: - endpoint reachable with `GET /v1/models` returning 200 - Open logs opens the correct folder. - Copy base URL copies `http://127.0.0.1:` (and optionally `/v1`). - diff --git a/internal/api/handlers/management/proxypilot.go b/internal/api/handlers/management/proxypilot.go index 1d60fd7f..ccad3d3d 100644 --- a/internal/api/handlers/management/proxypilot.go +++ b/internal/api/handlers/management/proxypilot.go @@ -33,9 +33,9 @@ func (h *Handler) GetProxyPilotLogTail(c *gin.Context) { var name string switch kind { case "stdout", "out": - name = "cliproxyapi.out.log" + name = "proxypilot-engine.out.log" case "stderr", "err": - name = "cliproxyapi.err.log" + name = "proxypilot-engine.err.log" default: c.JSON(http.StatusBadRequest, gin.H{"error": "invalid file (use stdout|stderr)"}) return @@ -110,8 +110,8 @@ func (h *Handler) GetProxyPilotDiagnostics(c *gin.Context) { b.WriteString("\n") } - addTail("Launcher Stdout", "cliproxyapi.out.log") - addTail("Launcher Stderr", "cliproxyapi.err.log") + addTail("Launcher Stdout", "proxypilot-engine.out.log") + addTail("Launcher Stderr", "proxypilot-engine.err.log") c.JSON(http.StatusOK, gin.H{"text": b.String()}) } diff --git a/internal/desktopctl/desktopctl.go b/internal/desktopctl/desktopctl.go index a19fbefc..7fe64004 100644 --- a/internal/desktopctl/desktopctl.go +++ b/internal/desktopctl/desktopctl.go @@ -103,8 +103,8 @@ func Start(opts StartOptions) (Status, error) { return Status{}, err } - stdoutLog := filepath.Join(logDir, "cliproxyapi.out.log") - stderrLog := filepath.Join(logDir, "cliproxyapi.err.log") + stdoutLog := filepath.Join(logDir, "proxypilot-engine.out.log") + stderrLog := filepath.Join(logDir, "proxypilot-engine.err.log") stdoutFile, err := os.OpenFile(stdoutLog, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644) if err != nil { diff --git a/internal/desktopctl/exe.go b/internal/desktopctl/exe.go index 3a07d372..e5359ea0 100644 --- a/internal/desktopctl/exe.go +++ b/internal/desktopctl/exe.go @@ -11,12 +11,24 @@ func pickDefaultExePath(repoRoot string) string { return "" } if runtime.GOOS == "windows" { + // New preferred engine name (ProxyPilot branding). + preferred := filepath.Join(repoRoot, "bin", "proxypilot-engine.exe") + if _, err := os.Stat(preferred); err == nil { + return preferred + } + // Back-compat fallbacks. latest := filepath.Join(repoRoot, "bin", "cliproxyapi-latest.exe") if _, err := os.Stat(latest); err == nil { return latest } return filepath.Join(repoRoot, "bin", "cliproxyapi.exe") } + // New preferred engine name (ProxyPilot branding). + preferred := filepath.Join(repoRoot, "bin", "proxypilot-engine") + if _, err := os.Stat(preferred); err == nil { + return preferred + } + // Back-compat fallbacks. latest := filepath.Join(repoRoot, "bin", "cliproxyapi-latest") if _, err := os.Stat(latest); err == nil { return latest diff --git a/scripts/macos/README.md b/scripts/macos/README.md index a6d3bb7d..95923baf 100644 --- a/scripts/macos/README.md +++ b/scripts/macos/README.md @@ -17,8 +17,8 @@ This builds `bin/cliproxyapi-latest`. - Restart: `./scripts/restart.sh` Logs: -- `logs/cliproxyapi.out.log` -- `logs/cliproxyapi.err.log` +- `logs/proxypilot-engine.out.log` +- `logs/proxypilot-engine.err.log` ## Auto-start at login (launchd) diff --git a/scripts/macos/install-cliproxyapi-launchagent.sh b/scripts/macos/install-cliproxyapi-launchagent.sh index f2e141ee..c4f508f0 100644 --- a/scripts/macos/install-cliproxyapi-launchagent.sh +++ b/scripts/macos/install-cliproxyapi-launchagent.sh @@ -55,9 +55,9 @@ cat >"$plist_path" < StandardOutPath - ${logs_dir}/cliproxyapi.out.log + ${logs_dir}/proxypilot-engine.out.log StandardErrorPath - ${logs_dir}/cliproxyapi.err.log + ${logs_dir}/proxypilot-engine.err.log EOF @@ -68,4 +68,3 @@ launchctl bootstrap "gui/${uid}" "$plist_path" launchctl kickstart -k "gui/${uid}/${label}" >/dev/null 2>&1 || true echo "Installed LaunchAgent: $plist_path" - diff --git a/scripts/macos/start-cliproxy.sh b/scripts/macos/start-cliproxy.sh index 77b1d753..d8f73e5c 100644 --- a/scripts/macos/start-cliproxy.sh +++ b/scripts/macos/start-cliproxy.sh @@ -9,8 +9,8 @@ if [[ -f "$latest_exe" ]]; then exe="$latest_exe"; fi config_path="$repo_root/config.yaml" logs_dir="$repo_root/logs" -stdout_log="$logs_dir/cliproxyapi.out.log" -stderr_log="$logs_dir/cliproxyapi.err.log" +stdout_log="$logs_dir/proxypilot-engine.out.log" +stderr_log="$logs_dir/proxypilot-engine.err.log" pid_file="$logs_dir/cliproxyapi.pid" mkdir -p "$logs_dir" @@ -61,4 +61,3 @@ echo "$pid" >"$pid_file" echo "Started (PID $pid). Tail logs:" echo " tail -f \"$stdout_log\"" - diff --git a/scripts/windows/README.md b/scripts/windows/README.md index 7b9582f8..02415e9c 100644 --- a/scripts/windows/README.md +++ b/scripts/windows/README.md @@ -19,8 +19,8 @@ This will: - Restart: `powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\restart-cliproxy.ps1` Logs: -- `logs\cliproxyapi.out.log` -- `logs\cliproxyapi.err.log` +- `logs\proxypilot-engine.out.log` +- `logs\proxypilot-engine.err.log` ## Auto-start at logon (Windows) diff --git a/scripts/windows/build-cliproxyapi.ps1 b/scripts/windows/build-cliproxyapi.ps1 index 420158a8..daea902f 100644 --- a/scripts/windows/build-cliproxyapi.ps1 +++ b/scripts/windows/build-cliproxyapi.ps1 @@ -7,7 +7,8 @@ function Get-RepoRoot { $repoRoot = Get-RepoRoot $outDir = Join-Path $repoRoot "bin" -$outPath = Join-Path $outDir "cliproxyapi-latest.exe" +$outPath = Join-Path $outDir "proxypilot-engine.exe" +$compatPath = Join-Path $outDir "cliproxyapi-latest.exe" if (-not (Test-Path -LiteralPath $outDir)) { New-Item -ItemType Directory -Path $outDir | Out-Null @@ -15,10 +16,12 @@ if (-not (Test-Path -LiteralPath $outDir)) { Write-Host "Building CLIProxyAPI..." Write-Host " out: $outPath" +Write-Host " compat: $compatPath" Push-Location $repoRoot try { go build -o $outPath .\cmd\server + Copy-Item -Force -LiteralPath $outPath -Destination $compatPath } finally { Pop-Location } diff --git a/scripts/windows/start-cliproxy.ps1 b/scripts/windows/start-cliproxy.ps1 index f832b70a..039a2ea8 100644 --- a/scripts/windows/start-cliproxy.ps1 +++ b/scripts/windows/start-cliproxy.ps1 @@ -12,18 +12,19 @@ function Ensure-Dir([string]$Path) { } $repoRoot = Get-RepoRoot -$defaultExePath = Join-Path $repoRoot "bin\\cliproxyapi.exe" +$preferredExePath = Join-Path $repoRoot "bin\\proxypilot-engine.exe" $latestExePath = Join-Path $repoRoot "bin\\cliproxyapi-latest.exe" -$exePath = if (Test-Path -LiteralPath $latestExePath) { $latestExePath } else { $defaultExePath } +$defaultExePath = Join-Path $repoRoot "bin\\cliproxyapi.exe" +$exePath = if (Test-Path -LiteralPath $preferredExePath) { $preferredExePath } elseif (Test-Path -LiteralPath $latestExePath) { $latestExePath } else { $defaultExePath } $configPath = Join-Path $repoRoot "config.yaml" $logsDir = Join-Path $repoRoot "logs" Ensure-Dir $logsDir -$stdoutLog = Join-Path $logsDir "cliproxyapi.out.log" -$stderrLog = Join-Path $logsDir "cliproxyapi.err.log" +$stdoutLog = Join-Path $logsDir "proxypilot-engine.out.log" +$stderrLog = Join-Path $logsDir "proxypilot-engine.err.log" if (-not (Test-Path -LiteralPath $exePath)) { - throw "Binary not found: $exePath. Build it with: go build -o bin\\cliproxyapi.exe .\\cmd\\server (or: scripts\\build-cliproxyapi.ps1)." + throw "Binary not found: $exePath. Build it with: scripts\\windows\\build-cliproxyapi.ps1" } if (-not (Test-Path -LiteralPath $configPath)) { throw "Config not found: $configPath" @@ -45,7 +46,7 @@ if ($existing) { return } -Write-Host "Starting CLIProxyAPI..." +Write-Host "Starting ProxyPilot Engine..." Write-Host " exe: $exePath" Write-Host " config: $configPath" Write-Host " logs: $logsDir" diff --git a/scripts/windows/stop-cliproxy.ps1 b/scripts/windows/stop-cliproxy.ps1 index 5b5f19d5..e331d6e0 100644 --- a/scripts/windows/stop-cliproxy.ps1 +++ b/scripts/windows/stop-cliproxy.ps1 @@ -1,7 +1,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" -$procNames = @("cliproxyapi", "cliproxyapi-latest") +$procNames = @("proxypilot-engine", "cliproxyapi", "cliproxyapi-latest") $procs = @() foreach ($name in $procNames) { $procs += @(Get-Process -Name $name -ErrorAction SilentlyContinue)