diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index c13d472d4b4e..6d92ba44ccd3 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -770,7 +770,7 @@ const createTray = () => { // If tray already exists, destroy it first destroyTray(); - const isDev = process.env.NODE_ENV === 'development'; + const isDev = !app.isPackaged; let iconPath: string; if (isDev) { diff --git a/ui/desktop/src/utils/autoUpdater.ts b/ui/desktop/src/utils/autoUpdater.ts index 6753cc0e8f05..9495c9d19092 100644 --- a/ui/desktop/src/utils/autoUpdater.ts +++ b/ui/desktop/src/utils/autoUpdater.ts @@ -248,7 +248,6 @@ export function setupAutoUpdater(tray?: Tray) { log.info('Setting up auto-updater...'); log.info(`Current app version: ${app.getVersion()}`); log.info(`Platform: ${process.platform}, Arch: ${process.arch}`); - log.info(`NODE_ENV: ${process.env.NODE_ENV}`); log.info(`ENABLE_DEV_UPDATES: ${process.env.ENABLE_DEV_UPDATES}`); log.info(`App is packaged: ${app.isPackaged}`); log.info(`App path: ${app.getAppPath()}`); @@ -470,7 +469,7 @@ function sendStatusToWindow(event: string, data?: unknown) { function updateTrayIcon(hasUpdate: boolean) { if (!trayRef) return; - const isDev = process.env.NODE_ENV === 'development'; + const isDev = !app.isPackaged; let iconPath: string; if (hasUpdate) { diff --git a/ui/desktop/src/utils/costDatabase.ts b/ui/desktop/src/utils/costDatabase.ts index a2e8e5cbd213..5b3bde1de0fe 100644 --- a/ui/desktop/src/utils/costDatabase.ts +++ b/ui/desktop/src/utils/costDatabase.ts @@ -1,4 +1,3 @@ -// Import the proper type from ConfigContext import { getApiUrl } from '../config'; import { safeJsonParse } from './conversionUtils'; @@ -206,49 +205,3 @@ export async function fetchAndCachePricing( return null; } } - -/** - * Refresh pricing data from backend - */ -export async function refreshPricing(): Promise { - try { - // Clear session cache to force re-fetch - sessionPricingCache.clear(); - - // The actual refresh happens on the backend when we call with configured_only: false - const apiUrl = getApiUrl('/config/pricing'); - const secretKey = await window.electron.getSecretKey(); - - const headers: HeadersInit = { 'Content-Type': 'application/json' }; - if (secretKey) { - headers['X-Secret-Key'] = secretKey; - } - - const response = await fetch(apiUrl, { - method: 'POST', - headers, - body: JSON.stringify({ configured_only: false }), - }); - - return response.ok; - } catch { - return false; - } -} - -// Expose functions for testing in development mode -declare global { - interface Window { - getCostForModel?: typeof getCostForModel; - fetchAndCachePricing?: typeof fetchAndCachePricing; - refreshPricing?: typeof refreshPricing; - sessionPricingCache?: typeof sessionPricingCache; - } -} - -if (process.env.NODE_ENV === 'development' || typeof window !== 'undefined') { - window.getCostForModel = getCostForModel; - window.fetchAndCachePricing = fetchAndCachePricing; - window.refreshPricing = refreshPricing; - window.sessionPricingCache = sessionPricingCache; -} diff --git a/ui/desktop/src/utils/logger.ts b/ui/desktop/src/utils/logger.ts index f11e8b2543e4..4a088ad32cd9 100644 --- a/ui/desktop/src/utils/logger.ts +++ b/ui/desktop/src/utils/logger.ts @@ -2,21 +2,11 @@ import log from 'electron-log'; import path from 'node:path'; import { app } from 'electron'; -// Configure electron-log -// In development: ~/Library/Logs/goose/main.log -// In production: ~/Library/Application Support/goose/logs/main.log log.transports.file.resolvePathFn = () => { - const isDev = process.env.NODE_ENV === 'development'; - if (isDev) { - return path.join(app.getPath('home'), 'Library/Logs/goose/main.log'); - } - return path.join(app.getPath('userData'), 'logs/main.log'); + return path.join(app.getPath('userData'), 'logs', 'main.log'); }; -// Configure log level based on environment -log.transports.file.level = process.env.NODE_ENV === 'development' ? 'debug' : 'info'; - -// Also log to console in development -log.transports.console.level = process.env.NODE_ENV === 'development' ? 'debug' : false; +log.transports.file.level = app.isPackaged ? 'info' : 'debug'; +log.transports.console.level = app.isPackaged ? false : 'debug'; export default log; diff --git a/ui/desktop/src/utils/pathUtils.ts b/ui/desktop/src/utils/pathUtils.ts index cfa2677d09f4..f2865227a80f 100644 --- a/ui/desktop/src/utils/pathUtils.ts +++ b/ui/desktop/src/utils/pathUtils.ts @@ -71,9 +71,7 @@ const addPaths = ( executableName: string, app: Electron.App ): void => { - const isDev = process.env.NODE_ENV === 'development'; - const isPackaged = app.isPackaged; - if (isDev && !isPackaged) { + if (!app.isPackaged) { possiblePaths.push( path.join(process.cwd(), 'src', 'bin', executableName), path.join(process.cwd(), 'bin', executableName),