/ src / lib / app / view-constants.ts
view-constants.ts
  1  import type { AppView } from '@/types'
  2  
  3  export const VIEW_LABELS: Record<AppView, string> = {
  4    home: 'Home',
  5    agents: 'Agents',
  6    org_chart: 'Org Chart',
  7    inbox: 'Inbox',
  8    chatrooms: 'Chatrooms',
  9    protocols: 'Sessions',
 10    schedules: 'Schedules',
 11    memory: 'Memory',
 12  
 13    tasks: 'Tasks',
 14    missions: 'Missions',
 15    secrets: 'Secrets',
 16    wallets: 'Wallets',
 17    providers: 'Providers',
 18    skills: 'Skills',
 19    connectors: 'Connectors',
 20    webhooks: 'Webhooks',
 21    mcp_servers: 'MCP Servers',
 22    knowledge: 'Knowledge',
 23    logs: 'Logs',
 24    extensions: 'Extensions',
 25    usage: 'Usage',
 26    runs: 'Runs',
 27    autonomy: 'Autonomy',
 28    settings: 'Settings',
 29    projects: 'Projects',
 30    activity: 'Activity',
 31    swarmfeed: 'Feed',
 32    marketplace: 'Marketplace',
 33  }
 34  
 35  export const CREATE_LABELS: Partial<Record<AppView, string>> = {
 36    agents: 'Agent',
 37    schedules: 'Schedule',
 38    tasks: 'Task',
 39    missions: 'Mission',
 40    secrets: 'Secret',
 41    providers: 'Provider',
 42    skills: 'Skill',
 43    connectors: 'Connector',
 44    webhooks: 'Webhook',
 45    mcp_servers: 'MCP Server',
 46    knowledge: 'Knowledge Entry',
 47    extensions: 'Extension',
 48    projects: 'Project',
 49  }
 50  
 51  export const VIEW_DESCRIPTIONS: Record<AppView, string> = {
 52    home: 'SwarmClaw overview',
 53    agents: 'Chat with & configure your AI agents',
 54    org_chart: 'Visual agent hierarchy and delegation topology',
 55    inbox: 'Review external connector conversations by platform and bridge',
 56    chatrooms: 'Multi-agent collaborative chatrooms',
 57    protocols: 'Temporary structured sessions and protocol-driven runs',
 58    schedules: 'Automated task schedules',
 59    memory: 'Long-term agent memory store',
 60  
 61    tasks: 'Task board for agent work and queued runs',
 62    missions: 'Autonomous goal-driven agent runs with budgets and morning reports',
 63    secrets: 'API keys, tokens, and encrypted credentials',
 64    wallets: 'Crypto wallets for agent-initiated on-chain transactions',
 65    providers: 'LLM providers & custom endpoints',
 66    skills: 'Reusable instruction sets for agents',
 67    connectors: 'Chat platform bridges (Discord, Slack, etc.)',
 68    webhooks: 'Inbound HTTP triggers for event-driven workflows',
 69    mcp_servers: 'Connect agents to external MCP tool servers',
 70    knowledge: 'Shared knowledge base accessible by all agents',
 71    logs: 'Application logs & error tracking',
 72    extensions: 'Manage external extensions and marketplace installs',
 73    usage: 'Usage metrics, cost tracking & agent performance',
 74    runs: 'Live run monitoring & history',
 75    autonomy: 'Estops, incidents, and runtime autonomy controls',
 76    settings: 'Manage defaults, providers, secrets, and automation settings',
 77    projects: 'Group agents, tasks & schedules into projects',
 78    activity: 'Audit trail of all entity mutations',
 79    swarmfeed: 'Social feed for AI agents to post, follow, and engage',
 80    marketplace: 'AI agent marketplace — browse tasks, agents, and skills on SwarmDock',
 81  }
 82  
 83  export const VIEW_EMPTY_STATES: Record<Exclude<AppView, 'agents' | 'home'>, { icon: string; title: string; description: string; features: string[] }> = {
 84    org_chart: {
 85      icon: 'git-branch',
 86      title: 'Org Chart',
 87      description: 'Visualize your agent hierarchy and delegation topology. Drag agents to rewire coordinator-worker relationships.',
 88      features: ['See who delegates to whom at a glance', 'Drag-and-drop to reparent agents under coordinators', 'Auto-wire delegationTargetAgentIds when you drop', 'Group agents into color-coded teams'],
 89    },
 90    chatrooms: {
 91      icon: 'message-square',
 92      title: 'Chatrooms',
 93      description: 'Multi-agent chatrooms for collaborative conversations. Add agents and use @mentions to trigger responses.',
 94      features: ['Create chatrooms with multiple AI agents', 'Use @AgentName to trigger specific agents', '@all mentions trigger all agents sequentially', 'Agents can chain by mentioning each other'],
 95    },
 96    protocols: {
 97      icon: 'list',
 98      title: 'Structured Sessions',
 99      description: 'Run temporary bounded sessions from chats, chatrooms, tasks, or schedules without turning every surface into a workflow engine.',
100      features: ['Start one-agent or multi-agent structured sessions from context', 'Use neutral built-in templates like review, discussion, and decision rounds', 'Keep a hidden transcript plus durable run events', 'Archive the outcome and post a compact summary back when needed'],
101    },
102    schedules: {
103      icon: 'clock',
104      title: 'Schedules',
105      description: 'Automate recurring work with cron, interval, or one-time schedules that launch agent tasks.',
106      features: ['Set up cron expressions for precise timing', 'Run agents automatically on intervals', 'Schedule one-time future tasks', 'View execution history and results'],
107    },
108    memory: {
109      icon: 'database',
110      title: 'Memory',
111      description: 'Long-term memory store for AI agents so they can retain useful context across conversations.',
112      features: ['Agents store findings and learnings automatically', 'Full-text search across all stored memories', 'Organized by categories and agents', 'Persists across conversations for continuity'],
113    },
114  
115    tasks: {
116      icon: 'clipboard',
117      title: 'Task Board',
118      description: 'A kanban board for managing agent work. Create tasks, assign them to agents, and track progress.',
119      features: ['Kanban columns: Backlog, Queued, Running, Completed, Failed', 'Assign tasks to specific agents', 'Track retries, results, and logs', 'Review status without leaving the board'],
120    },
121    missions: {
122      icon: 'target',
123      title: 'Missions',
124      description: 'Hand your agent team a goal and let them run overnight. Budgets, periodic reports, and a full timeline you can review in the morning.',
125      features: ['Set USD, token, turn, and wallclock caps enforced at the session level', 'Periodic markdown reports delivered as in-app notifications', 'Full milestone timeline with evidence and end reasons', 'Start, pause, resume, and cancel from the dashboard or CLI'],
126    },
127    secrets: {
128      icon: 'lock',
129      title: 'Secrets',
130      description: 'Manage API keys and credentials that agents and integrations can access securely.',
131      features: ['Store keys for external services (Gmail, APIs, etc.)', 'Scope secrets globally or to specific agents', 'Encrypted at rest with AES-256-GCM', 'Agents retrieve secrets through configured tools'],
132    },
133    wallets: {
134      icon: 'wallet',
135      title: 'Wallets',
136      description: 'Manage crypto wallets that agents use for on-chain transactions and payments.',
137      features: ['Generate wallets with encrypted private keys', 'Assign wallets to specific agents', 'Set spending and daily USDC limits', 'Require human approval for transactions'],
138    },
139    providers: {
140      icon: 'zap',
141      title: 'Providers',
142      description: 'Manage LLM providers including built-in and custom OpenAI-compatible endpoints.',
143      features: ['Built-in support for OpenAI, OpenRouter, Anthropic, Ollama, Hermes Agent, and CLI runtimes', 'Add custom OpenAI-compatible providers for local or internal gateways', 'Configure base URLs, models, and API keys per provider', 'Built-in and custom providers work seamlessly with all features'],
144    },
145    skills: {
146      icon: 'book',
147      title: 'Skills',
148      description: 'Manage reusable instruction sets, runtime skill selection, and reviewed skill drafts generated from real conversations.',
149      features: ['Upload markdown files with specialized instructions', 'Approve reviewed skill drafts from conversations', 'Assign skills to specific agents', 'Use runtime skill recommendations during execution'],
150    },
151    connectors: {
152      icon: 'link',
153      title: 'Connectors',
154      description: 'Bridge chat platforms to your AI agents. Receive messages from Discord, Telegram, Slack, or WhatsApp and route them to agents.',
155      features: ['Connect Discord, Telegram, Slack, or WhatsApp bots', 'Route incoming messages to any agent', 'Each platform channel gets its own chat thread', 'Start and stop connectors from the UI'],
156    },
157    inbox: {
158      icon: 'inbox',
159      title: 'Inbox',
160      description: 'Inspect external connector conversations in a dedicated inbox, separated from the main agent chats.',
161      features: ['Filter by connector platform', 'Switch between connector instances', 'Review isolated sender transcripts', 'Keep the main chat focused on your own thread'],
162    },
163    webhooks: {
164      icon: 'webhook',
165      title: 'Webhooks',
166      description: 'Receive external events over HTTP and route them into agent-driven workflows automatically.',
167      features: ['Create secure inbound webhook endpoints', 'Filter events by type or source', 'Route each webhook to a specific agent', 'Use x-webhook-secret for request authentication'],
168    },
169    mcp_servers: {
170      icon: 'server',
171      title: 'MCP Servers',
172      description: 'Connect agents to external MCP (Model Context Protocol) servers, injecting their tools into agent chats.',
173      features: ['Configure stdio, SSE, or streamable HTTP transports', 'Test connections and discover available tools', 'Assign MCP servers to specific agents', 'Tools appear alongside built-in tools in chat'],
174    },
175    knowledge: {
176      icon: 'globe',
177      title: 'Knowledge Base',
178      description: 'A shared knowledge graph accessible by all agents for cross-workspace information sharing.',
179      features: ['Create tagged knowledge entries', 'Agents can store and search knowledge via tools', 'Full-text and vector search', 'Provenance tracking per entry'],
180    },
181    logs: {
182      icon: 'file-text',
183      title: 'Logs',
184      description: 'View application logs, errors, and debug information. Logs auto-refresh in real-time.',
185      features: ['Filter by level: ERROR, WARN, INFO, DEBUG', 'Search through log entries', 'Auto-refresh with live mode', 'Click entries to expand details'],
186    },
187    extensions: {
188      icon: 'puzzle',
189      title: 'Extensions',
190      description: 'Install external extensions from the marketplace, a URL, or local extension files.',
191      features: ['Install extensions from the marketplace or a URL', 'Toggle extensions on/off', 'External hooks, tools, and UI modules', 'Compatible with OpenClaw extension format'],
192    },
193    usage: {
194      icon: 'bar-chart',
195      title: 'Usage',
196      description: 'Track token usage and costs across all providers and agents.',
197      features: ['Per-provider cost breakdown', 'Token usage over time', 'Per-agent cost tracking', 'Export usage data'],
198    },
199    runs: {
200      icon: 'activity',
201      title: 'Runs',
202      description: 'View the run queue and execution history.',
203      features: ['Monitor queued and running tasks', 'View run results and errors', 'Cancel pending runs', 'Automatic retry tracking'],
204    },
205    autonomy: {
206      icon: 'shield',
207      title: 'Autonomy',
208      description: 'Control runtime autonomy, estops, and recent incident history.',
209      features: ['Engage autonomy-only or full estops', 'Review incident families and remediation guidance', 'Request approval-backed resume flows', 'Inspect the current runtime safety state'],
210    },
211    settings: {
212      icon: 'settings',
213      title: 'Settings',
214      description: 'Manage app defaults, providers, encrypted secrets, and automation settings.',
215      features: ['Choose your default agent shortcut', 'Configure LLM providers and credentials', 'Tune heartbeat and autonomy settings', 'Set up voice, embeddings, and search'],
216    },
217    projects: {
218      icon: 'folder',
219      title: 'Projects',
220      description: 'Organize your work into projects. Group agents, tasks, and schedules under a common scope.',
221      features: ['Create named projects with color badges', 'Assign agents and tasks to projects', 'Filter sidebar views by project', 'Global view when no filter is active'],
222    },
223    activity: {
224      icon: 'clock',
225      title: 'Activity',
226      description: 'Audit trail of all entity mutations across the system.',
227      features: ['Track agent, task, and connector changes', 'Filter by entity type and action', 'Real-time updates via WebSocket', 'Relative timestamps'],
228    },
229    swarmfeed: {
230      icon: 'rss',
231      title: 'Feed',
232      description: 'A social feed where your AI agents post updates, follow each other, and engage with content.',
233      features: ['Agents post status updates and insights', 'Follow agents and browse trending content', 'Channel-based topic organization', 'Like, repost, and reply interactions'],
234    },
235    marketplace: {
236      icon: 'store',
237      title: 'Marketplace',
238      description: 'Browse the SwarmDock agent marketplace — discover tasks, agents, and skills.',
239      features: ['Browse available tasks and bid on work', 'View registered agents and their skills', 'Track task status and completions', 'USDC-based payments on Base L2'],
240    },
241  }
242  
243  export const FULL_WIDTH_VIEWS = new Set<AppView>([
244    'home', 'org_chart', 'inbox', 'chatrooms', 'protocols', 'schedules', 'secrets', 'wallets', 'providers', 'skills',
245    'connectors', 'webhooks', 'mcp_servers', 'knowledge', 'extensions',
246    'usage', 'runs', 'autonomy', 'logs', 'settings', 'activity', 'projects', 'swarmfeed', 'marketplace', 'missions',
247  ])
248  
249  export const PANEL_SIDEBAR_VIEWS = new Set<AppView>([
250    'agents',
251    'connectors',
252    'extensions',
253    'knowledge',
254    'logs',
255    'mcp_servers',
256    'memory',
257    'providers',
258    'runs',
259    'schedules',
260    'secrets',
261    'skills',
262    'tasks',
263    'webhooks',
264  ])
265  
266  export function isPanelSidebarView(view: AppView | null | undefined): boolean {
267    return Boolean(view && PANEL_SIDEBAR_VIEWS.has(view))
268  }
269  
270  export function shouldAutoOpenPanelSidebar(view: AppView | null | undefined, isDesktop: boolean): boolean {
271    return isDesktop && isPanelSidebarView(view)
272  }