From ba887e012ac29b9764806232b30f311c2f597cf8 Mon Sep 17 00:00:00 2001 From: "Kai (Tam Nhu) Tran" <61256810+kaitranntt@users.noreply.github.com> Date: Sat, 23 May 2026 22:09:53 -0400 Subject: [PATCH] fix(cursor-daemon): widen safeResolve type for daemonToken (#1385) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(cursor-daemon): auto-generate token + expose for callers PRs #1373/#1377 gated cursor daemon endpoints behind a token check, but startDaemon() did not generate or expose a token. Health-check probing during startup then 401'd against the new auth, so startDaemon waited 30s then reported failure. Same for tests asserting /404 and validation behavior — they couldn't reach the downstream logic past the 401 gate. - Auto-generate a 32-byte hex token in startDaemon when caller did not provide one - Return daemonToken in startDaemon result so callers/tests can attach it - Update integration tests to include x-ccs-cursor-token header * fix(cursor-daemon): widen safeResolve type for daemonToken field --- src/cursor/cursor-daemon.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cursor/cursor-daemon.ts b/src/cursor/cursor-daemon.ts index 30e68817..9c5a5047 100644 --- a/src/cursor/cursor-daemon.ts +++ b/src/cursor/cursor-daemon.ts @@ -173,7 +173,12 @@ export async function startDaemon( let proc: ChildProcess; let resolved = false; - const safeResolve = (result: { success: boolean; pid?: number; error?: string }) => { + const safeResolve = (result: { + success: boolean; + pid?: number; + error?: string; + daemonToken?: string; + }) => { if (resolved) return; resolved = true; if (checkTimeout) clearTimeout(checkTimeout);