/** Refresh callbacks a host wired per feature, fired when its modal opens. */ export type FeatureRefreshKey = 'automations' | 'files' | 'channels' | 'agentSettings' | 'collaborators'; type FeatureTab = { id: string; label: string; /** Refresh handlers to invoke when this feature's modal opens. */ refresh: readonly FeatureRefreshKey[]; }; /** * Single source of truth for the chat header's "more" (3-dot) menu — order here * IS the menu order. Each entry opens its own modal (the section-driven * `EditorDrawer`). `chat` is the conversation itself, not a menu feature, so it * lives only in `SuperagentEditorTab` below. `memory` is intentionally omitted * (a follow-up task). `agent_settings` (General) is intentionally the LAST item. */ export const FEATURE_TABS = [ { id: 'automations', label: 'Automations', refresh: ['automations'] }, { id: 'connectors', label: 'Connectors', refresh: [] }, { id: 'files', label: 'Files', refresh: ['files'] }, { id: 'channels', label: 'Channels', refresh: ['channels'] }, { id: 'security', label: 'Security', refresh: ['agentSettings'] }, { id: 'sharing', label: 'Sharing & access', refresh: ['collaborators'] }, { id: 'agent_settings', label: 'General', refresh: ['agentSettings'] }, ] as const satisfies readonly FeatureTab[]; /** A settings/feature tab id — one of `FEATURE_TABS`. */ export type SuperagentFeatureTab = typeof FEATURE_TABS[number]['id']; /** Any editor tab, including the conversation itself. */ export type SuperagentEditorTab = SuperagentFeatureTab | 'chat'; /** The feature ids in menu order. */ export const FEATURE_MENU_TABS = FEATURE_TABS.map((tab) => tab.id); export function featureRefreshKeys(tab: SuperagentEditorTab): readonly FeatureRefreshKey[] { return FEATURE_TABS.find((entry) => entry.id === tab)?.refresh ?? []; } export function getEditorTabLabel(tab: SuperagentEditorTab): string { return FEATURE_TABS.find((entry) => entry.id === tab)?.label ?? 'Chat'; }