Developer Guide · 16

Extension Development

16.1 Adding a New Tool

  1. Define factory function with @tool decorator in app/services/tools.py
  2. Inject into Admin Agent toolset in agent.py::create_user_agent
  3. For Consumer support, conditionally inject by capability in consumer_agent.py
  4. For channel distinction (like send_message), inject based on channel param in consumer_agent.create_consumer_agent
  5. Add corresponding capability prompt in tools.py::CAPABILITY_PROMPTS
  6. For Subagent accessibility, add to subagents.py::SHARED_TOOL_NAMES or MEMORY_TOOL_NAMES

16.2 Adding a New Route

  1. Create new module in app/routes/ using APIRouter
  2. Register in app/main.py with app.include_router(...)
  3. Admin routes: Depends(get_current_user); Consumer routes: Depends(get_service_context)

16.3 Adding a New Frontend Page

  1. Create page component in frontend/src/pages/
  2. Add <Route> in frontend/src/router/index.tsx
  3. For sidebar nav item, add to settingsNav array in SettingsLayout
  4. Wrap with ErrorBoundary (reference: <ErrorBoundary scope="settings">)

16.4 Adding a New API Call

  1. Add typed function in frontend/src/services/api.ts
  2. Add type definitions in frontend/src/types/index.ts

16.5 Adding a New Subagent

  1. Modify app/services/subagents.py::DEFAULT_SUBAGENTS (default) or CRUD via /api/subagents API
  2. Select tools from SHARED_TOOL_NAMES + MEMORY_TOOL_NAMES
  3. Frontend SubagentManager.tsx adapts automatically (reads available_tools from GET /api/subagents)

16.6 Adding a New Theme

  1. Copy a [data-theme] block in frontend/src/styles/themes.css and adjust variables
  2. Add THEMES entry + Antd ThemeConfig in themeContext.tsx
  3. Add new theme to the theme toggle button at the bottom of the sidebar in AppLayout.tsx

16.7 Adding a New Tauri Command

  1. Define function with #[tauri::command] in tauri-launcher/src-tauri/src/lib.rs
  2. Register in invoke_handler! macro
  3. Call in dist/index.html via window.__TAURI__.invoke('cmd_name', { args })
  4. Re-run npx tauri build