import { VibeControlsView, VibeControlsTab } from '../types'; import { SessionsGroupBy } from '../components/sessions'; /** Persisted terminal tab info (minimal data for restoration) */ export interface PersistedTerminalTab { sessionId: string; name: string; /** Pinned tabs sort to the front and survive "close others". */ pinned?: boolean; } interface VibeControlsState { currentView: VibeControlsView; currentTab: VibeControlsTab; activeAgentId: string | null; activeVibeId: string | null; activeSessionId: string | null; selectedAgentId: string | null; selectedSessionId: string | null; selectedVibeId: string | null; /** * Per-agent "connecting" overlay timestamps shown after Edit Tunnel save * while the backend pushes OAuth creds → agent finalize() → /health/ready * flips to ok. The value is the *earliest* wall-clock timestamp at which * the overlay is allowed to clear — used as a grace window so a stale * `healthy:true` cache delivered during the connecting window cannot * clear it prematurely (root cause of the historical CONNECTING → * DEGRADED → ACTIVE flicker after Edit Tunnel save). * * Lives in the global store (not in AgentsPage local React state) so the * overlay survives navigation to AgentDetailsPage and back — the * documented user recovery path navigates into AgentDetailsPage so the * `pushAgentGatewayAuth` auto-recovery fires, and unmounting AgentsPage * used to discard the set entirely. * * In-memory only — not persisted (a "connecting" state has no meaning * across full page reloads). */ connectingAgents: Record; /** * Active profile name keyed by agent id. Phase 5B (multi-profile-per-daemon) * — every aiApi call constructs the canonical * `/api/profiles//` path and so needs to know which profile * is currently selected for a given agent. The selector is exposed via * `useActiveAgentProfile(agentId)`. */ activeProfilePerAgent: Record; sidebarOpen: boolean; terminalTabs: PersistedTerminalTab[]; activeTerminalTabId: string | null; sessionsViewMode: 'terminal' | 'grid' | 'list'; /** How the Sessions grid/list views cluster sessions. */ sessionsGroupBy: SessionsGroupBy; /** Target id the Sessions list is filtered to ('all' = no filter). */ sessionsTargetFilter: string; /** Whether the per-session info side panel is open. */ sessionInfoPanelOpen: boolean; /** * Last-used "New Session" settings, remembered so the "+" button can * one-click quick-create a terminal without re-prompting the form. * `lastUsedSessionType` defaults to 'TMUX'; `lastUsedProfile` to 'default'. */ lastUsedAgentId: string | null; lastUsedVibeId: string | null; lastUsedSessionType: string; lastUsedProfile: string; setCurrentView: (view: VibeControlsView) => void; setCurrentTab: (tab: VibeControlsTab) => void; /** Set the active agent (also resets vibe and session if agent changes) */ setActiveAgentId: (id: string | null) => void; /** Set the active vibe (also resets session if vibe changes) */ setActiveVibeId: (id: string | null) => void; /** Set the active session */ setActiveSessionId: (id: string | null) => void; /** Clear all active context */ clearActiveContext: () => void; /** Set the active profile for a given agent (Phase 5B). */ setActiveProfile: (agentId: string, profile: string) => void; /** Read the currently-active profile for an agent (defaults to "default"). */ getActiveProfile: (agentId: string | null | undefined) => string; /** * Mark an agent as "connecting" (e.g. immediately after an Edit Tunnel * save). `graceMs` is a minimum wall-clock window during which the * overlay cannot be cleared by an incoming probe — defends against a * stale `healthy:true` Apollo-cache hit racing the in-flight refetch. */ markAgentConnecting: (agentId: string, graceMs?: number) => void; /** Clear the "connecting" overlay for a single agent. */ clearAgentConnecting: (agentId: string) => void; /** * Returns true while the connecting overlay is still active for the * agent (entry exists AND grace window has not elapsed OR a probe * hasn't yet flipped it healthy). */ isAgentConnecting: (agentId: string) => boolean; setSelectedAgentId: (id: string | null) => void; setSelectedSessionId: (id: string | null) => void; setSelectedVibeId: (id: string | null) => void; toggleSidebar: () => void; setSidebarOpen: (open: boolean) => void; setTerminalTabs: (tabs: PersistedTerminalTab[]) => void; addTerminalTab: (tab: PersistedTerminalTab) => void; removeTerminalTab: (sessionId: string) => void; setActiveTerminalTabId: (sessionId: string | null) => void; setSessionsViewMode: (mode: 'terminal' | 'grid' | 'list') => void; setSessionsGroupBy: (groupBy: SessionsGroupBy) => void; setSessionsTargetFilter: (targetId: string) => void; setSessionInfoPanelOpen: (open: boolean) => void; /** Remember the last-used New Session settings for one-click quick-create. */ setLastUsedSessionDefaults: (defaults: { agentId?: string | null; vibeId?: string | null; sessionType?: string; profile?: string; }) => void; activeCatalogId: string | null; activeComponentId: string | null; activeTemplateId: string | null; setActiveCatalogId: (id: string | null) => void; setActiveComponentId: (id: string | null) => void; setActiveTemplateId: (id: string | null) => void; activeVibeDeckId: string | null; setActiveVibeDeckId: (id: string | null) => void; vibeDeckMode: 'preview' | 'edit'; setVibeDeckMode: (mode: 'preview' | 'edit') => void; /** * Per-user, per-mountPoint, per-contextKey tab ordering. Backed by * the `wspace-vibecontrols-svc` UserPreferences slot — the local * store is a write-through cache. Reads merge against the live * registry on every consumer call (drop stale, append new at end). */ tabOrder: Record>; /** Replace the entire stored order for a (mountPoint, contextKey) pair. */ setTabOrder: (mountPoint: string, contextKey: string, order: string[]) => void; /** Clear the stored order so reads fall through to the registry default. */ resetTabOrder: (mountPoint: string, contextKey: string) => void; /** Bulk-replace the entire tabOrder map (used by backend hydration). */ hydrateTabOrder: (next: Record>) => void; /** * Per-Vibe default agent (per user). Consulted by `useEffectiveAgent` * before the multi-agent heuristic. Backed by the same UserPreferences * slot above; hydrate on app boot. */ defaultAgentForVibe: Record; setDefaultAgentForVibe: (vibeId: string, agentId: string) => void; clearDefaultAgentForVibe: (vibeId: string) => void; hydrateDefaultAgentForVibe: (next: Record) => void; /** * User's default IDE command for "Open in editor" actions. Token from * `IDE_PRESETS` (`code`, `cursor`, `idea`, ...). `null` falls back to * `code`. Backend mirror: `UserPreferences.preferredIdeCommand`. */ preferredIdeCommand: string | null; setPreferredIdeCommand: (cmd: string | null) => void; hydratePreferredIdeCommand: (cmd: string | null) => void; /** Per-Vibe IDE override. Precedence: override → user default → 'code'. */ vibeIdeOverrides: Record; setVibeIdeOverride: (vibeId: string, cmd: string) => void; clearVibeIdeOverride: (vibeId: string) => void; hydrateVibeIdeOverrides: (next: Record) => void; /** Reset all persisted state to defaults (used on logout / account switch) */ resetStore: () => void; } export declare const useVibeControlsStore: import('zustand').UseBoundStore, "setState" | "persist"> & { setState(partial: VibeControlsState | Partial | ((state: VibeControlsState) => VibeControlsState | Partial), replace?: false | undefined): unknown; setState(state: VibeControlsState | ((state: VibeControlsState) => VibeControlsState), replace: true): unknown; persist: { setOptions: (options: Partial>) => void; clearStorage: () => void; rehydrate: () => Promise; hasHydrated: () => boolean; onHydrate: (fn: (state: VibeControlsState) => void) => () => void; onFinishHydration: (fn: (state: VibeControlsState) => void) => () => void; getOptions: () => Partial>; }; }>; export {};