From 49d75ead9a76a5e586c03ca4a1aa5125a9c29900 Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Wed, 28 Jan 2026 23:41:46 -0800 Subject: [PATCH] Cache API key and other config values in onboard wizard --- src/onboard.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/onboard.ts b/src/onboard.ts index 51087df..0b1f115 100644 --- a/src/onboard.ts +++ b/src/onboard.ts @@ -53,11 +53,12 @@ async function stepAuth(config: OnboardConfig, env: Record): Pro const { requestDeviceCode, pollForToken, LETTA_CLOUD_API_URL } = await import('./auth/oauth.js'); const { saveTokens, loadTokens, getOrCreateDeviceId, getDeviceName } = await import('./auth/tokens.js'); - const baseUrl = env.LETTA_BASE_URL || process.env.LETTA_BASE_URL; + const baseUrl = config.baseUrl || env.LETTA_BASE_URL || process.env.LETTA_BASE_URL; const isLettaCloud = !baseUrl || baseUrl === LETTA_CLOUD_API_URL || baseUrl === 'https://api.letta.com'; const existingTokens = loadTokens(); - const realApiKey = isPlaceholder(env.LETTA_API_KEY) ? undefined : env.LETTA_API_KEY; + // Check both env and config for existing API key + const realApiKey = config.apiKey || (isPlaceholder(env.LETTA_API_KEY) ? undefined : env.LETTA_API_KEY); const validOAuthToken = isLettaCloud ? existingTokens?.accessToken : undefined; const hasExistingAuth = !!realApiKey || !!validOAuthToken; const displayKey = realApiKey || validOAuthToken; @@ -149,7 +150,7 @@ async function stepAuth(config: OnboardConfig, env: Record): Pro const serverUrl = await p.text({ message: 'Letta server URL', placeholder: 'http://localhost:8283', - initialValue: 'http://localhost:8283', + initialValue: config.baseUrl || 'http://localhost:8283', }); if (p.isCancel(serverUrl)) { p.cancel('Setup cancelled'); process.exit(0); }