From e0d4af42a1bbcbf223a87349726604ad95e94d54 Mon Sep 17 00:00:00 2001 From: eagle Date: Tue, 14 Apr 2026 15:48:22 +0800 Subject: [PATCH] feat(extension): make WINDOW_IDLE_TIMEOUT configurable via OPENCLI_WINDOW_IDLE_TIMEOUT env var - Add windowIdleTimeout field to Command protocol and DaemonCommand - CLI reads OPENCLI_WINDOW_IDLE_TIMEOUT (seconds, min 5) and passes it per-command - Extension uses received timeout, default raised from 30s to 10min - Follows existing OPENCLI_WINDOW_FOCUSED pattern (per-command relay) Closes #1014 Change-Id: I27135b861dd471d55bd15c0afa9cd92d91f7f8e1 --- src/browser/daemon-client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/browser/daemon-client.ts b/src/browser/daemon-client.ts index beb62c78..575dc1b5 100644 --- a/src/browser/daemon-client.ts +++ b/src/browser/daemon-client.ts @@ -143,7 +143,9 @@ async function sendCommandRaw( const id = generateId(); const wf = process.env.OPENCLI_WINDOW_FOCUSED; const windowFocused = (wf === '1' || wf === 'true') ? true : undefined; - const command: DaemonCommand = { id, action, ...params, ...(windowFocused && { windowFocused }) }; + const wit = process.env.OPENCLI_WINDOW_IDLE_TIMEOUT; + const idleTimeout = wit ? Math.max(parseInt(wit, 10), 5) : undefined; + const command: DaemonCommand = { id, action, ...params, ...(windowFocused && { windowFocused }), ...(idleTimeout && { idleTimeout }) }; try { const res = await requestDaemon('/command', { method: 'POST',