import { AgentVisibility } from '../utils/agentVisibility'; import { VibeControlsInitialDataQuery } from '../generated/wspace-operations'; /** * Return type for cached initial data */ interface CachedInitialData { /** The full cached query result */ data?: VibeControlsInitialDataQuery; /** Whether the data is still loading (should be false if cached) */ loading: boolean; /** Whether there was an error (cached data might still be available) */ error?: Error; /** All agents from cache */ agents: Array<{ id: string; name: string; hostname: string; platform: string; architecture?: string; isActive: boolean; tunnelUrl?: string | null; tunnelStatus?: string | null; lastHeartbeat?: string | null; version?: string; createdAt?: string; updatedAt?: string; /** jsonb metadata; carries the canonical CLI `profile` field. */ metadata?: Record | null; /** Owner of the agent; null for a legacy ownerless (shared) agent. */ ownerUserId: string | null; /** Who can see and use the agent — the authority for private/shared UI. */ visibility: AgentVisibility | null; }>; /** All vibes from cache. Multi-agent: vibes carry an `agents` list now. */ vibes: Array<{ id: string; name: string; description?: string; path?: string; status: string; /** * Agents currently attached to this vibe. Empty when none — agent-dependent * features (sessions, tunnels, gitops, plugins) are disabled in the UI. * Each entry carries `ownerUserId` so the picker can partition usable vs * locked agents (personal agents only the owner can use). */ agents: Array<{ id: string; name: string; isActive: boolean; ownerUserId?: string | null; }>; type?: string; tags?: string[]; gitBranch?: string | null; createdAt?: string; updatedAt?: string; }>; /** All sessions from cache */ sessions: Array<{ id: string; name: string; status: string; agentId?: string | null; vibeId?: string | null; type?: string; startedAt?: string | null; metadata?: Record | null; createdAt?: string; updatedAt?: string; }>; /** All targets from cache */ targets: Array<{ id: string; workspaceId?: string; name: string; type?: string; status: string; host?: string | null; port?: number | null; username?: string | null; connectionId?: string | null; label?: string | null; tags?: string[]; metadata?: Record | null; createdAt?: string; updatedAt?: string; agents?: Array<{ id: string; name: string; version?: string | null; isActive: boolean; tunnelUrl?: string | null; }>; }>; /** All notes from cache */ notes: Array<{ id: string; title: string; isPinned: boolean; }>; /** Totals for stats */ totals: { agents: number; vibes: number; sessions: number; targets: number; notes: number; }; /** Refetch all initial data from network */ refetch: () => void; } /** * Hook to access cached initial data. * Returns data from Apollo cache with cache-only policy. * If data is not yet in cache, returns empty arrays. * * Usage: * ```tsx * function MyComponent() { * const { agents, vibes, sessions, loading } = useCachedInitialData(); * * if (loading) return ; * * return ( * * ); * } * ``` */ export declare function useCachedInitialData(): CachedInitialData; export default useCachedInitialData;