All files / src/store index.ts

0% Statements 0/13
0% Branches 0/1
0% Functions 0/1
0% Lines 0/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91                                                                                                                                                                                     
/**
 * Store Coordinator
 *
 * This module provides a unified interface to all specialized stores,
 * maintaining backward compatibility with components that import useGatewayStore.
 *
 * The coordinator:
 * 1. Injects the shared client into all stores
 * 2. Re-exports all individual stores for direct access
 */
 
// === Re-export Individual Stores ===
export { useConnectionStore, getConnectionState, getClient, getConnectionError, getGatewayVersion } from './connectionStore';
export type { ConnectionStore, ConnectionStateSlice, ConnectionActionsSlice, GatewayLog } from './connectionStore';
 
export { useAgentStore, setAgentStoreClient } from './agentStore';
export type { AgentStore, AgentStateSlice, AgentActionsSlice, Clone, UsageStats, PluginStatus, CloneCreateOptions } from './agentStore';
 
export { useHandStore, setHandStoreClient } from './handStore';
export type { HandStore, HandStateSlice, HandActionsSlice, Hand, HandRun, Trigger, Approval, TriggerCreateOptions } from './handStore';
 
export { useWorkflowStore, setWorkflowStoreClient } from './workflowStore';
export type { WorkflowStore, WorkflowStateSlice, WorkflowActionsSlice, Workflow, WorkflowRun, WorkflowCreateOptions } from './workflowStore';
 
export { useConfigStore, setConfigStoreClient } from './configStore';
export type { ConfigStore, ConfigStateSlice, ConfigActionsSlice, QuickConfig, WorkspaceInfo, ChannelInfo, ScheduledTask, SkillInfo } from './configStore';
 
export { useSecurityStore, setSecurityStoreClient } from './securityStore';
export type { SecurityStore, SecurityStateSlice, SecurityActionsSlice, SecurityLayer, SecurityStatus, AuditLogEntry } from './securityStore';
 
export { useSessionStore, setSessionStoreClient } from './sessionStore';
export type { SessionStore, SessionStateSlice, SessionActionsSlice, Session, SessionMessage } from './sessionStore';
 
// === New Stores ===
export { useMemoryGraphStore } from './memoryGraphStore';
export type { MemoryGraphStore, GraphNode, GraphEdge, GraphFilter, GraphLayout } from './memoryGraphStore';
 
export { useActiveLearningStore } from './activeLearningStore';
export type { ActiveLearningStore } from './activeLearningStore';
 
// === Browser Hand Store ===
export { useBrowserHandStore } from './browserHandStore';
export type {
  BrowserHandState,
  BrowserHandActions,
  ExecutionState,
  ExecutionStatus,
  BrowserSession,
  SessionStatus,
  BrowserLog,
  LogLevel,
  RecentTask,
  TaskResultStatus,
  SessionOptions,
} from '../components/BrowserHand/templates/types';
 
// === Store Initialization ===
 
import { getClient } from './connectionStore';
import { setAgentStoreClient } from './agentStore';
import { setHandStoreClient } from './handStore';
import { setWorkflowStoreClient } from './workflowStore';
import { setConfigStoreClient } from './configStore';
import { setSecurityStoreClient } from './securityStore';
import { setSessionStoreClient } from './sessionStore';
 
/**
 * Initialize all stores with the shared client.
 * Called once when the application mounts.
 */
export function initializeStores(): void {
  const client = getClient();
 
  // Inject client into all stores
  setAgentStoreClient(client);
  setHandStoreClient(client);
  setWorkflowStoreClient(client);
  setConfigStoreClient(client);
  setSecurityStoreClient(client);
  setSessionStoreClient(client);
}
 
/**
 * Initialize stores on module load.
 * This ensures all stores have access to the shared client.
 */
if (typeof window !== 'undefined') {
  // Defer initialization to next tick to ensure all modules are loaded
  setTimeout(initializeStores, 0);
}