diff --git a/APP_LAUNCHER_INTEGRATION.md b/APP_LAUNCHER_INTEGRATION.md new file mode 100644 index 000000000..b4901c1a8 --- /dev/null +++ b/APP_LAUNCHER_INTEGRATION.md @@ -0,0 +1,194 @@ +# App Launcher Integration Guide + +## Overview + +The `apps-manifest.json` file provides a complete mapping between Cargo.toml features and user-friendly app descriptions for the botui app launcher. + +## File Location + +``` +botserver/apps-manifest.json +``` + +## Structure + +### Categories + +Apps are organized into 8 categories: + +1. **Communication** (💬) - Chat, Mail, Meet, WhatsApp, Telegram, etc. +2. **Productivity** (⚡) - Tasks, Calendar, Project, Goals, Workspaces, etc. +3. **Documents** (📄) - Drive, Docs, Sheet, Slides, Paper +4. **Media** (🎬) - Video, Player, Canvas +5. **Learning** (📚) - Learn, Research, Sources +6. **Analytics** (📈) - Analytics, Dashboards, Monitoring +7. **Development** (⚙️) - Automation, Designer, Editor +8. **Administration** (🔐) - Attendant, Security, Settings, Directory +9. **Core** (🏗️) - Cache, LLM, Vector DB + +### App Schema + +Each app includes: + +```json +{ + "id": "tasks", + "name": "Tasks", + "description": "Task management with scheduling", + "feature": "tasks", + "icon": "✅", + "enabled_by_default": true, + "dependencies": ["automation", "drive", "monitoring"] +} +``` + +### Bundles + +Pre-configured feature sets: + +- **minimal** - Essential infrastructure (chat, automation, drive, cache) +- **lightweight** - Basic productivity (chat, drive, tasks, people) +- **full** - Complete feature set +- **communications** - All communication apps +- **productivity** - Productivity suite +- **documents** - Document suite + +## Integration with botui + +### Reading the Manifest + +```javascript +// In botui/ui/suite/js/app-launcher.js +fetch('/api/apps/manifest') + .then(res => res.json()) + .then(manifest => { + renderAppLauncher(manifest); + }); +``` + +### Rendering Apps + +```javascript +function renderAppLauncher(manifest) { + const categories = manifest.categories; + + for (const [categoryId, category] of Object.entries(categories)) { + const categoryEl = createCategory(category); + + category.apps.forEach(app => { + const appCard = createAppCard(app); + categoryEl.appendChild(appCard); + }); + } +} +``` + +### App Card Template + +```html +
+
${app.icon}
+
${app.name}
+
${app.description}
+
+ +
+ ${app.dependencies.length > 0 ? + `
Requires: ${app.dependencies.join(', ')}
` + : ''} +
+``` + +## Backend API Endpoint + +Add to `botserver/src/main.rs`: + +```rust +async fn get_apps_manifest() -> Json { + let manifest = include_str!("../apps-manifest.json"); + let value: serde_json::Value = serde_json::from_str(manifest) + .expect("Invalid apps-manifest.json"); + Json(value) +} + +// In router configuration: +api_router = api_router.route("/api/apps/manifest", get(get_apps_manifest)); +``` + +## Compilation Testing + +Use the `test_apps.sh` script to verify all apps compile: + +```bash +cd /home/rodriguez/src/gb +./test_apps.sh +``` + +This will: +1. Test each app feature individually +2. Report which apps pass/fail compilation +3. Provide a summary of results + +## Core Dependencies + +These apps cannot be disabled (marked with `core_dependency: true`): + +- **automation** - Required for .gbot script execution +- **drive** - S3 storage used throughout +- **cache** - Redis integrated into sessions + +## Feature Bundling + +When a user enables an app, all its dependencies are automatically enabled: + +- Enable `tasks` → Automatically enables `automation`, `drive`, `monitoring` +- Enable `mail` → Automatically enables `mail_core`, `drive` +- Enable `research` → Automatically enables `llm`, `vectordb` + +## Syncing with Cargo.toml + +When adding new features to `Cargo.toml`: + +1. Add the feature definition in `Cargo.toml` +2. Add the app entry in `apps-manifest.json` +3. Update the app launcher UI in botui +4. Run `./test_apps.sh` to verify compilation +5. Commit both files together + +## Example: Adding a New App + +### 1. In Cargo.toml + +```toml +[features] +myapp = ["dep:myapp-crate", "drive"] +``` + +### 2. In apps-manifest.json + +```json +{ + "id": "myapp", + "name": "My App", + "description": "My awesome app", + "feature": "myapp", + "icon": "🚀", + "enabled_by_default": false, + "dependencies": ["drive"] +} +``` + +### 3. Test + +```bash +cargo check -p botserver --no-default-features --features myapp +``` + +## Notes + +- Icons use emoji for cross-platform compatibility +- Dependencies are automatically resolved by Cargo +- Core dependencies are shown but cannot be toggled off +- The manifest version matches botserver version diff --git a/Cargo.toml b/Cargo.toml index 1face59aa..717822337 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,112 +9,82 @@ workspace = true features = ["database", "i18n"] [features] -# ===== SINGLE DEFAULT FEATURE SET ===== -# Note: automation (Rhai scripting) is required for .gbot script execution +# ===== DEFAULT ===== default = ["chat", "automation", "drive", "tasks", "cache", "directory"] -# ===== CORE CAPABILITIES (Internal Bundles) ===== -storage_core = ["dep:aws-config", "dep:aws-sdk-s3", "dep:aws-smithy-async"] -automation_core = ["dep:rhai", "dep:cron"] -cache_core = ["dep:redis"] -mail_core = ["dep:lettre", "dep:mailparse", "dep:imap", "dep:native-tls"] -realtime_core = ["dep:livekit"] -pdf_core = ["dep:pdf-extract"] +# ===== CORE INFRASTRUCTURE (Always needed) ===== +automation = ["dep:rhai", "dep:cron"] +drive = ["dep:aws-config", "dep:aws-sdk-s3", "dep:aws-smithy-async", "dep:pdf-extract"] +cache = ["dep:redis"] +directory = [] -# ===== COMMUNICATION APPS ===== +# ===== APPS (Flat list - no dependencies between apps) ===== +# Communication chat = [] people = [] -mail = ["mail_core"] -meet = ["realtime_core"] +mail = ["dep:lettre", "dep:mailparse", "dep:imap", "dep:native-tls"] +meet = ["dep:livekit"] social = [] whatsapp = [] telegram = [] instagram = [] msteams = [] -communications = ["chat", "people", "mail", "meet", "social", "whatsapp", "telegram", "instagram", "msteams", "cache"] -# ===== PRODUCTIVITY APPS ===== +# Productivity calendar = [] -# Tasks requires automation (scripts) and drive (attachments) -tasks = ["automation", "drive", "monitoring"] +tasks = ["dep:cron"] project = ["quick-xml"] goals = [] -workspace = [] -workspaces = ["workspace"] +workspaces = [] tickets = [] billing = [] -productivity = ["calendar", "tasks", "project", "goals", "workspaces", "cache"] -# ===== DOCUMENT APPS ===== -paper = ["docs", "pdf"] +# Documents docs = ["docx-rs", "ooxmlsdk"] sheet = ["calamine", "spreadsheet-ods"] slides = ["ooxmlsdk"] -drive = ["storage_core", "pdf"] -documents = ["paper", "docs", "sheet", "slides", "drive"] +paper = [] -# ===== MEDIA APPS ===== +# Media video = [] player = [] canvas = [] -media = ["video", "player", "canvas"] -# ===== LEARNING & RESEARCH APPS ===== +# Learning learn = [] -research = ["llm", "vectordb"] +research = [] sources = [] -learning = ["learn", "research", "sources"] -# ===== ANALYTICS APPS ===== +# Analytics analytics = [] dashboards = [] monitoring = ["dep:sysinfo"] -analytics_suite = ["analytics", "dashboards", "monitoring"] -# ===== DEVELOPMENT TOOLS ===== +# Development designer = [] editor = [] -automation = ["automation_core"] -development = ["designer", "editor", "automation"] -# ===== ADMIN APPS ===== +# Admin attendant = [] security = [] settings = [] -admin = ["attendant", "security", "settings"] -# ===== COMPATIBILITY ALIASES ===== -# These ensure old feature names still work or map correctly -pdf = ["pdf_core"] -cache = ["cache_core"] - - - -# ===== CORE TECHNOLOGIES ===== +# Core Tech llm = [] vectordb = ["dep:qdrant-client"] nvidia = [] compliance = ["dep:csv"] timeseries = [] weba = [] -directory = [] progress-bars = ["dep:indicatif"] grpc = [] jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"] -console = ["dep:crossterm", "dep:ratatui", "monitoring"] +console = ["dep:crossterm", "dep:ratatui"] -# ===== BUNDLE FEATURES ===== -full = [ - "chat", "people", "mail", - "tasks", "calendar", - "drive", "docs", - "llm", "cache", "compliance" -] - -# Minimal build includes core infrastructure: automation (Rhai), drive (S3), cache (Redis) -# These are deeply integrated and used throughout the codebase +# ===== BUNDLES (Optional - for convenience) ===== minimal = ["chat", "automation", "drive", "cache"] -lightweight = ["chat", "drive", "tasks", "people"] +lightweight = ["chat", "automation", "drive", "cache", "tasks", "people"] +full = ["chat", "people", "mail", "tasks", "calendar", "drive", "docs", "llm", "cache", "compliance"] [dependencies] diesel_migrations = { workspace = true }