trading-platform/orchestration/tareas/_archive/2026-01/TASK-2026-01-26-OQI-007-LLM-ASSISTANT-PANELS/02-ANALISIS.md
Adrian Flores Cortes df43dd90cb [F0-F2] feat: Coherence analysis baseline + entity types + frontend stores
FASE 0 - Preparación y Purga:
- Archived 21 completed tasks to _archive/2026-01/
- Marked 4 docs as DEPRECATED
- Created 3 baseline coherence reports

FASE 1 - DDL-Backend Coherence:
- audit.types.ts: +4 types (SystemEvent, TradingAudit, ApiRequestLog, DataAccessLog)
- investment.types.ts: +4 types (RiskQuestionnaire, WithdrawalRequest, DailyPerformance, DistributionHistory)
- entity.types.ts: +5 types (Symbol, TradingBot, TradingSignal, TradingMetrics, PaperBalance)

FASE 2 - Backend-Frontend Coherence:
- investmentStore.ts: New Zustand store with 20+ actions
- mlStore.ts: New Zustand store with signal caching
- alerts.service.ts: New service with 15 functions

FASE 3 - Documentation:
- OQI-009: Updated to 100% coverage, added ET-MKT-004-productos.md
- OQI-010: Created full structure (STATUS.md, ROADMAP-MT4.md, ET-MT4-001-gateway.md)

Coherence Baseline Established:
- DDL-Backend: 31% (target 95%)
- Backend-Frontend: 72% (target 85%)
- Global: 39.6% (target 90%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:08:04 -06:00

2.9 KiB

02 - ANALISIS

Componentes a Crear

1. ErrorBoundary.tsx

Proposito: Capturar errores de React y mostrar UI de fallback

Comportamiento:

  • Clase React (requirement de error boundaries)
  • Captura errores en componentDidCatch
  • Muestra stack trace en modo desarrollo
  • Botones: Reintentar, Refrescar, Ir a inicio
  • Copia stack trace al clipboard

Interfaces:

interface ErrorBoundaryProps {
  children: React.ReactNode;
  fallback?: React.ReactNode;
  onError?: (error: Error, errorInfo: ErrorInfo) => void;
  showDetails?: boolean;
}

interface ErrorBoundaryState {
  hasError: boolean;
  error: Error | null;
  errorInfo: ErrorInfo | null;
}

2. ConnectionStatus.tsx

Proposito: Mostrar estado de conexion WebSocket/API

Variantes:

  • badge: Compacto con icono y texto
  • indicator: Solo icono con tooltip
  • detailed: Panel con metricas

Estados:

  • connected (verde)
  • connecting (amarillo)
  • disconnected (rojo)
  • error (rojo pulsante)

Interfaces:

interface ConnectionState {
  status: 'connected' | 'connecting' | 'disconnected' | 'error';
  lastConnected?: string;
  reconnectAttempts?: number;
  error?: string;
}

interface ConnectionMetrics {
  latency?: number;
  uptime?: number;
  messagesReceived?: number;
  messagesSent?: number;
}

3. TokenUsageDisplay.tsx

Proposito: Visualizar consumo de tokens y costos

Variantes:

  • inline: Minimo para header
  • compact: Badge con metricas
  • detailed: Panel completo

Funcionalidades:

  • Barra de progreso de contexto
  • Warnings al 75%/90% de contexto
  • Desglose input/output tokens
  • Estimacion de costos
  • Estadisticas de sesion

Interfaces:

interface TokenUsage {
  inputTokens: number;
  outputTokens: number;
  totalTokens: number;
  contextWindowSize: number;
  contextUsedTokens: number;
}

interface TokenCosts {
  inputCostPer1k: number;
  outputCostPer1k: number;
  currency?: string;
}

4. PromptLibrary.tsx

Proposito: Biblioteca de templates de prompts

Funcionalidades:

  • Busqueda por titulo/descripcion/tags
  • Filtro por categoria
  • Favoritos
  • Copiar prompt
  • Vista compacta/normal

Categorias:

  • analysis: Analisis de mercado
  • strategy: Estrategias de trading
  • education: Contenido educativo
  • trading: Operaciones de trading
  • risk: Gestion de riesgo
  • custom: Personalizados

Interfaces:

interface Prompt {
  id: string;
  title: string;
  description: string;
  template: string;
  category: PromptCategory;
  tags: string[];
  variables?: string[];
  isFavorite?: boolean;
  usageCount?: number;
}

Dependencias

  • React 18 (class components para error boundary)
  • lucide-react icons
  • Tailwind CSS
  • Patron de dark theme existente

Riesgos

Riesgo Mitigacion
Error boundary require clase Usar class component solo para este caso
Metricas de tokens sin backend Props opcionales, UI mock