authorgravatar for saiansh2525@gmail.comYash Singh <saiansh2525@gmail.com> 2026-09-25 15:17:22-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-25 15:17:22-05:00
logf5bd2fddbf00021b29c1dbe32210240886806718
tree5461162f3102c53fe27868d87ec755bf06e6fac2
parent1a0c915c41024ddb47e16befd9fc730c1173af02
signature Signed by PGP key B5690EEEBB952194

fix(server): load Cursor keyring with createRequire (#13678)


1 files changed, 5 insertions(+), 1 deletions(-)

apps/server/src/provider/cursorCredentialStore.ts+5-1
......@@ -1,5 +1,9 @@
1import * as NodeModule from "node:module";
2
13const CACHE_MS = 5 * 60_000;
24
5const requireForKeyring = NodeModule.createRequire(import.meta.url);
6
37/** Share one Keychain request across usage history and limits in this server process. */
48export function makeCachedCursorAccessTokenReader(
59 read: () => Promise<string | null>,
......@@ -24,6 +28,6 @@ export function makeCachedCursorAccessTokenReader(
2428
2529/** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */
2630export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => {
27 const { AsyncEntry } = await import("@napi-rs/keyring");
31 const { AsyncEntry } = requireForKeyring("@napi-rs/keyring") as typeof import("@napi-rs/keyring");
2832 return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null;
2933});