import { ComponentType, ReactNode } from 'react'; import { DiscoveredContribution, MountTunnel, usePluginContributions } from '@burdenoff/fe-libs/shared/plugins'; export interface BuiltinTab { /** Stable id for ordering + activeTab matching. */ id: string; /** Display label. */ label: string; /** Optional lucide icon component. */ icon?: ComponentType<{ className?: string; }>; /** Sort key used when no user-stored order applies. */ order?: number; /** Optional badge text. */ badge?: string | number; /** Optional gate state — computed by the caller. */ visible?: boolean; /** Hide entirely while no agent is attached. */ requiresAgent?: boolean; /** Renders the active-tab body. */ render: () => ReactNode; } export interface MergedTab { id: string; label: string; icon?: ComponentType<{ className?: string; }>; order: number; badge?: string | number; source: 'builtin' | 'plugin'; builtin?: BuiltinTab; contribution?: DiscoveredContribution; } export interface UseMountTabStripOptions { /** e.g. `'vibe.detailTab'`. */ mountPoint: string; /** e.g. the Vibe id or Agent id. */ contextKey: string; /** Inline tabs the host page already implements. */ builtins: BuiltinTab[]; /** Tunnels to query for iframe contributions. Empty when no agent attached. */ tunnels: MountTunnel[]; /** Default tab id when none is selected. Falls back to first visible. */ defaultTab: TabId; /** Switch to a no-op default when the active tab is hidden. */ hasAttachedAgent: boolean; /** Master gate: `false` → discovery + iframe tabs hidden entirely. */ enableIframeHost: boolean; } export interface UseMountTabStripResult { /** Merged, ordered, gated tab list. */ tabs: MergedTab[]; /** Current active tab id (URL-backed). */ activeTab: TabId; /** Switch tab. */ setActiveTab: (tabId: TabId) => void; /** Move a tab to a new index (0-based). Persists via store. */ reorder: (tabId: string, toIndex: number) => void; /** Reset the per-context tab order. */ resetOrder: () => void; /** True while contributions are still loading (initial fetch). */ isLoading: boolean; /** Discovery errors for surfacing in the UI. */ errors: ReturnType['errors']; /** Iframe contributions that survived the merge — for ``. */ contributions: DiscoveredContribution[]; /** Refetch contributions (e.g. from a manual refresh button). */ refetch: () => void; } /** * Generic merge-and-reorder hook for any tab strip that needs to mix * inline (host-implemented) tabs with iframe-served plugin contributions * from one or more tunnels. * * - Pulls contributions via `usePluginContributions` (React Query) only * when `enableIframeHost` is true (feature flag). * - Merges with `builtins` into a single ordered list. * - Applies the user's stored order via `vibeControlsStore.tabOrder`, * reconciling against the live id set (drop stale, append new). * - Persists `activeTab` to `?tab=` via `useQueryBackedTab` so deep * links / page reloads survive. */ export declare function useMountTabStrip(opts: UseMountTabStripOptions): UseMountTabStripResult;