import type { ComponentType } from "react"; import type { WorkspaceTabTarget } from "@/workspace-tabs/model"; import type { SidebarStateBucket } from "@/utils/sidebar-agent-state"; export interface PanelIconProps { size: number; color: string; } export interface PanelDescriptor { label: string; subtitle: string; tooltip: string; titleState: "ready" | "loading"; icon: ComponentType; statusBucket: SidebarStateBucket | null; } export interface PanelDescriptorContext { serverId: string; workspaceId: string; tabId: string; } export interface PanelRegistration< K extends WorkspaceTabTarget["kind"] = WorkspaceTabTarget["kind"], > { kind: K; component: ComponentType; useDescriptor( target: Extract, context: PanelDescriptorContext, ): PanelDescriptor; } const panelRegistry = new Map(); export function registerPanel( registration: PanelRegistration, ): void { panelRegistry.set(registration.kind, registration as unknown as PanelRegistration); } export function getPanelRegistration( kind: WorkspaceTabTarget["kind"], ): PanelRegistration | undefined { return panelRegistry.get(kind); }