v2.0.5: Fix E2E flow - proxy, welcome screen, provider sync

Critical fixes:
- Translation proxy now uses system Node.js (not Electron binary)
- Removed duplicate proxy start causing port conflicts
- Added port availability check before spawning proxy
- Fixed welcome:choice double resolve()
- Fixed settings.html close using deprecated remote
- Fixed translationProxy /v1 for openai-compat backends
- Proxy no longer detached/unref - properly tracked as child
- SingletonLock cleanup on startup

Verified E2E:
- Welcome screen on first run ✓
- Provider selection works ✓
- Settings save + sync ✓
- Translation proxy starts correctly ✓
- LS connects to proxy ✓
- --ag-reset works ✓
This commit is contained in:
admin
2026-05-23 12:14:04 +04:00
Unverified
parent 0c4b0b9338
commit f7378eceb0
7 changed files with 80 additions and 68 deletions

View File

@@ -70,8 +70,11 @@ class ApiProxy {
console.log(`[ApiProxy] Starting built-in Node.js translation proxy on port ${this.port}`);
// Use Electron's Node.js binary to run our translation proxy
const proxyScript = path.join(__dirname, 'translationProxy.js');
const nodeBin = process.execPath;
this.proxyProcess = child_process.spawn(nodeBin, ['--no-sandbox', proxyScript], {
// Use system node (not Electron's process.execPath which starts a GUI)
const nodeBin = process.execPath.includes('electron') || process.execPath.includes('AG-X')
? child_process.execSync('which node 2>/dev/null || echo /usr/bin/node').toString().trim()
: process.execPath;
this.proxyProcess = child_process.spawn(nodeBin, [proxyScript], {
stdio: ['ignore', 'pipe', 'pipe'],
detached: false,
env: { ...process.env },

View File

@@ -78,6 +78,10 @@ function applyConfig(cfg) {
PORT = cfg.port || 48080;
BACKEND = cfg.backend_type || "openai-compat";
TARGET_URL = cfg.target_url || "http://localhost:11434/v1";
// Ensure /v1 suffix for openai-compat backends
if (BACKEND === "openai-compat" && !TARGET_URL.endsWith("/v1")) {
TARGET_URL = TARGET_URL.replace(/\/+$/, "") + "/v1";
}
API_KEY = cfg.api_key || "";
OAUTH_PROVIDER = cfg.oauth_provider || "";
REASONING_ENABLED = cfg.reasoning_enabled !== undefined ? cfg.reasoning_enabled : true;