diff --git a/skills b/skills index f8bbde775..0bb1cef55 160000 --- a/skills +++ b/skills @@ -1 +1 @@ -Subproject commit f8bbde7755cf7ca681a90b6691bc5fa8f37f3e34 +Subproject commit 0bb1cef5573e568c2c122a03e8fbc382abd58ffb diff --git a/src/components/daemon/DaemonHealthPanel.tsx b/src/components/daemon/DaemonHealthPanel.tsx index b8c70499f..ffa5f7c5f 100644 --- a/src/components/daemon/DaemonHealthPanel.tsx +++ b/src/components/daemon/DaemonHealthPanel.tsx @@ -17,6 +17,7 @@ import { useState } from 'react'; import { formatRelativeTime, useDaemonHealth } from '../../hooks/useDaemonHealth'; import type { ComponentHealth, DaemonStatus } from '../../store/daemonSlice'; +import { IS_DEV } from '../../utils/config'; interface Props { userId?: string; @@ -246,7 +247,7 @@ const DaemonHealthPanel = ({ userId, onClose, className = '' }: Props) => { )} {/* Debug Info (development only) */} - {process.env.NODE_ENV === 'development' && daemonHealth.healthSnapshot && ( + {IS_DEV && daemonHealth.healthSnapshot && (
Debug Info
diff --git a/src/providers/SocketProvider.tsx b/src/providers/SocketProvider.tsx
index fb4bd55a5..95cf54c4a 100644
--- a/src/providers/SocketProvider.tsx
+++ b/src/providers/SocketProvider.tsx
@@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react';
 import { useDaemonLifecycle } from '../hooks/useDaemonLifecycle';
 import { socketService } from '../services/socketService';
 import { store } from '../store';
+import { IS_DEV } from '../utils/config';
 import { useAppSelector } from '../store/hooks';
 import { selectSocketStatus } from '../store/socketSelectors';
 import {
@@ -39,7 +40,7 @@ const SocketProvider = ({ children }: { children: React.ReactNode }) => {
 
   // Log daemon lifecycle state for debugging
   useEffect(() => {
-    if (usesRustSocket && process.env.NODE_ENV === 'development') {
+    if (usesRustSocket && IS_DEV) {
       console.log('[SocketProvider] Daemon lifecycle state:', {
         isAutoStartEnabled: daemonLifecycle.isAutoStartEnabled,
         connectionAttempts: daemonLifecycle.connectionAttempts,
diff --git a/src/services/analytics.ts b/src/services/analytics.ts
index eaed4eb99..480ed9986 100644
--- a/src/services/analytics.ts
+++ b/src/services/analytics.ts
@@ -21,10 +21,10 @@
 import * as Sentry from '@sentry/react';
 
 import { store } from '../store';
+import { IS_DEV } from '../utils/config';
 import { enqueueError, registerSentrySender, type SanitizedSentryEvent } from './errorReportQueue';
 
 const SENTRY_DSN = import.meta.env.VITE_SENTRY_DSN as string | undefined;
-const IS_DEV = Boolean(import.meta.env.DEV) || import.meta.env.MODE === 'development';
 
 // ---------------------------------------------------------------------------
 // Helpers
diff --git a/src/services/errorReportQueue.ts b/src/services/errorReportQueue.ts
index 47cb39c83..0526fff65 100644
--- a/src/services/errorReportQueue.ts
+++ b/src/services/errorReportQueue.ts
@@ -7,6 +7,8 @@
  */
 import * as Sentry from '@sentry/react';
 
+import { IS_DEV } from '../utils/config';
+
 // ---------------------------------------------------------------------------
 // Types
 // ---------------------------------------------------------------------------
@@ -191,7 +193,7 @@ export function buildManualSentryEvent(
     platform: 'javascript',
     exception: { values: [{ type: error.type, value: error.value }] },
     tags,
-    environment: import.meta.env.DEV ? 'development' : 'production',
+    environment: IS_DEV ? 'development' : 'production',
   };
 }
 
diff --git a/src/services/socketService.ts b/src/services/socketService.ts
index 4030d489d..aa8cd6dd4 100644
--- a/src/services/socketService.ts
+++ b/src/services/socketService.ts
@@ -6,7 +6,7 @@ import { MCPTool, MCPToolCall, SocketIOMCPTransportImpl } from '../lib/mcp';
 import { skillManager, syncToolsToBackend } from '../lib/skills';
 import { store } from '../store';
 import { resetForUser, setSocketIdForUser, setStatusForUser } from '../store/socketSlice';
-import { BACKEND_URL } from '../utils/config';
+import { BACKEND_URL, IS_DEV } from '../utils/config';
 import { createSafeLogData, sanitizeError } from '../utils/sanitize';
 
 // Socket service logger using debug package
@@ -16,7 +16,7 @@ const socketWarn = debug('socket:warn');
 const socketError = debug('socket:error');
 
 // Enable socket logging in development by default
-if (import.meta.env.DEV || import.meta.env.MODE === 'development') {
+if (IS_DEV) {
   debug.enable('socket*');
 }
 
diff --git a/src/utils/config.ts b/src/utils/config.ts
index 1ab599a6e..69c73ddab 100644
--- a/src/utils/config.ts
+++ b/src/utils/config.ts
@@ -5,7 +5,7 @@ export const TELEGRAM_BOT_USERNAME =
 
 export const TELEGRAM_BOT_ID = import.meta.env.VITE_TELEGRAM_BOT_ID || '8043922470';
 
-export const IS_DEV = Boolean(import.meta.env.DEV) || import.meta.env.MODE === 'development';
+export const IS_DEV = import.meta.env.DEV;
 
 export const SKILLS_GITHUB_REPO = import.meta.env.VITE_SKILLS_GITHUB_REPO || 'alphahumanxyz/skills';
 
diff --git a/src/utils/sanitize.ts b/src/utils/sanitize.ts
index 449e8e1d0..d3d8967c9 100644
--- a/src/utils/sanitize.ts
+++ b/src/utils/sanitize.ts
@@ -1,6 +1,7 @@
 /**
  * Utilities for sanitizing sensitive data before logging
  */
+import { IS_DEV } from './config';
 
 const SENSITIVE_KEYS = [
   'token',
@@ -75,8 +76,7 @@ function sanitizeObject(obj: unknown, depth = 0): unknown {
  */
 export function sanitizeError(error: unknown): unknown {
   if (error instanceof Error) {
-    const isDev = import.meta.env.DEV || import.meta.env.MODE === 'development';
-    return { name: error.name, message: error.message, stack: isDev ? error.stack : undefined };
+    return { name: error.name, message: error.message, stack: IS_DEV ? error.stack : undefined };
   }
   if (typeof error === 'object' && error !== null) {
     return sanitizeObject(error);