Commit Graph
4 Commits
Author SHA1 Message Date
kaitranntt 0bcaf4bc68 feat(cliproxy): add variant port isolation for concurrent proxy instances
Enables running multiple CLIProxy variants simultaneously on different
ports. Each variant now gets a unique port in the 18100-18199 range,
allowing concurrent use of providers like Gemini + Codex + custom variants.

Key changes:
- Add port field to variant config schema
- Implement automatic port allocation (18100 + variant index)
- Support variant-specific settings paths in config generator
- Display port in dashboard UI for debugging
- Show all models in variant editor dropdown
- Add comprehensive tests for port allocation edge cases

Closes related variant isolation work.
2025-12-24 04:15:04 -05:00
kaitranntt a3b172cc43 fix(cliproxy): register session on dashboard start and add port-based stop fallback
Dashboard Stop/Update buttons failed with contradictory errors:
- Stop: "No active CLIProxy session found"
- Update: "CLIProxy was already running"

Root cause: service-manager spawned proxy but never called registerSession(),
so stopProxy() couldn't find the lock file.

Changes:
- service-manager.ts: Add registerSession() after spawn
- session-tracker.ts: Make stopProxy() async with port-based fallback
- routes.ts: Update proxy-stop endpoint to async
- cliproxy-command.ts: Update handleStop() to await async stopProxy()
- port-utils.ts: Fix double-escaped regex for Windows port detection
- session-tracker.test.js: Update tests for async stopProxy()
2025-12-19 03:57:06 -05:00
kaitranntt 81463eda65 test(cliproxy): add tests for stopProxy and getProxyStatus
Add unit tests for the new session tracker functions:
- stopProxy: error handling, stale lock cleanup, success structure
- getProxyStatus: not running, full status, dead proxy cleanup, session count
2025-12-18 01:04:33 -05:00
kaitranntt 3629e3e2fb fix(cliproxy): prevent shared proxy termination on multi-session exit
Add session tracking with reference counting for CLIProxy instances.
Multiple CCS sessions now safely share a single proxy on port 8317.
When any session exits, proxy only terminates if it was the last session.

Changes:
- Add session-tracker.ts: lock file based reference counting
- Modify cliproxy-executor.ts: reuse existing proxy, conditional cleanup
- Add 21 unit tests for session tracker functionality

Fixes #118
2025-12-17 01:36:34 -05:00