refactor: flatten Cargo.toml features to simple app list
- Removed complex nested feature dependencies
- Each app now lists only its direct crate dependencies
- Apps can be tested independently without inter-dependencies
- Simplified structure: Core Infrastructure + Flat App List + Bundles
- Core: automation, drive, cache, directory (always needed)
- Apps: chat, mail, tasks, docs, etc. (independent)
- Bundles: minimal, lightweight, full (convenience)
This makes it easy to test each app individually and matches
the app launcher menu structure.
Verified: cargo check with chat+automation+drive+cache ✅
This commit is contained in:
parent
4e3542e356
commit
bba0efdb55
2 changed files with 220 additions and 56 deletions
194
APP_LAUNCHER_INTEGRATION.md
Normal file
194
APP_LAUNCHER_INTEGRATION.md
Normal file
|
|
@ -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
|
||||||
|
<div class="app-card" data-feature="${app.feature}">
|
||||||
|
<div class="app-icon">${app.icon}</div>
|
||||||
|
<div class="app-name">${app.name}</div>
|
||||||
|
<div class="app-description">${app.description}</div>
|
||||||
|
<div class="app-toggle">
|
||||||
|
<input type="checkbox"
|
||||||
|
${app.enabled_by_default ? 'checked' : ''}
|
||||||
|
${app.core_dependency ? 'disabled' : ''}>
|
||||||
|
</div>
|
||||||
|
${app.dependencies.length > 0 ?
|
||||||
|
`<div class="app-deps">Requires: ${app.dependencies.join(', ')}</div>`
|
||||||
|
: ''}
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Backend API Endpoint
|
||||||
|
|
||||||
|
Add to `botserver/src/main.rs`:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
async fn get_apps_manifest() -> Json<serde_json::Value> {
|
||||||
|
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
|
||||||
82
Cargo.toml
82
Cargo.toml
|
|
@ -9,112 +9,82 @@ workspace = true
|
||||||
features = ["database", "i18n"]
|
features = ["database", "i18n"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# ===== SINGLE DEFAULT FEATURE SET =====
|
# ===== DEFAULT =====
|
||||||
# Note: automation (Rhai scripting) is required for .gbot script execution
|
|
||||||
default = ["chat", "automation", "drive", "tasks", "cache", "directory"]
|
default = ["chat", "automation", "drive", "tasks", "cache", "directory"]
|
||||||
|
|
||||||
# ===== CORE CAPABILITIES (Internal Bundles) =====
|
# ===== CORE INFRASTRUCTURE (Always needed) =====
|
||||||
storage_core = ["dep:aws-config", "dep:aws-sdk-s3", "dep:aws-smithy-async"]
|
automation = ["dep:rhai", "dep:cron"]
|
||||||
automation_core = ["dep:rhai", "dep:cron"]
|
drive = ["dep:aws-config", "dep:aws-sdk-s3", "dep:aws-smithy-async", "dep:pdf-extract"]
|
||||||
cache_core = ["dep:redis"]
|
cache = ["dep:redis"]
|
||||||
mail_core = ["dep:lettre", "dep:mailparse", "dep:imap", "dep:native-tls"]
|
directory = []
|
||||||
realtime_core = ["dep:livekit"]
|
|
||||||
pdf_core = ["dep:pdf-extract"]
|
|
||||||
|
|
||||||
# ===== COMMUNICATION APPS =====
|
# ===== APPS (Flat list - no dependencies between apps) =====
|
||||||
|
# Communication
|
||||||
chat = []
|
chat = []
|
||||||
people = []
|
people = []
|
||||||
mail = ["mail_core"]
|
mail = ["dep:lettre", "dep:mailparse", "dep:imap", "dep:native-tls"]
|
||||||
meet = ["realtime_core"]
|
meet = ["dep:livekit"]
|
||||||
social = []
|
social = []
|
||||||
whatsapp = []
|
whatsapp = []
|
||||||
telegram = []
|
telegram = []
|
||||||
instagram = []
|
instagram = []
|
||||||
msteams = []
|
msteams = []
|
||||||
communications = ["chat", "people", "mail", "meet", "social", "whatsapp", "telegram", "instagram", "msteams", "cache"]
|
|
||||||
|
|
||||||
# ===== PRODUCTIVITY APPS =====
|
# Productivity
|
||||||
calendar = []
|
calendar = []
|
||||||
# Tasks requires automation (scripts) and drive (attachments)
|
tasks = ["dep:cron"]
|
||||||
tasks = ["automation", "drive", "monitoring"]
|
|
||||||
project = ["quick-xml"]
|
project = ["quick-xml"]
|
||||||
goals = []
|
goals = []
|
||||||
workspace = []
|
workspaces = []
|
||||||
workspaces = ["workspace"]
|
|
||||||
tickets = []
|
tickets = []
|
||||||
billing = []
|
billing = []
|
||||||
productivity = ["calendar", "tasks", "project", "goals", "workspaces", "cache"]
|
|
||||||
|
|
||||||
# ===== DOCUMENT APPS =====
|
# Documents
|
||||||
paper = ["docs", "pdf"]
|
|
||||||
docs = ["docx-rs", "ooxmlsdk"]
|
docs = ["docx-rs", "ooxmlsdk"]
|
||||||
sheet = ["calamine", "spreadsheet-ods"]
|
sheet = ["calamine", "spreadsheet-ods"]
|
||||||
slides = ["ooxmlsdk"]
|
slides = ["ooxmlsdk"]
|
||||||
drive = ["storage_core", "pdf"]
|
paper = []
|
||||||
documents = ["paper", "docs", "sheet", "slides", "drive"]
|
|
||||||
|
|
||||||
# ===== MEDIA APPS =====
|
# Media
|
||||||
video = []
|
video = []
|
||||||
player = []
|
player = []
|
||||||
canvas = []
|
canvas = []
|
||||||
media = ["video", "player", "canvas"]
|
|
||||||
|
|
||||||
# ===== LEARNING & RESEARCH APPS =====
|
# Learning
|
||||||
learn = []
|
learn = []
|
||||||
research = ["llm", "vectordb"]
|
research = []
|
||||||
sources = []
|
sources = []
|
||||||
learning = ["learn", "research", "sources"]
|
|
||||||
|
|
||||||
# ===== ANALYTICS APPS =====
|
# Analytics
|
||||||
analytics = []
|
analytics = []
|
||||||
dashboards = []
|
dashboards = []
|
||||||
monitoring = ["dep:sysinfo"]
|
monitoring = ["dep:sysinfo"]
|
||||||
analytics_suite = ["analytics", "dashboards", "monitoring"]
|
|
||||||
|
|
||||||
# ===== DEVELOPMENT TOOLS =====
|
# Development
|
||||||
designer = []
|
designer = []
|
||||||
editor = []
|
editor = []
|
||||||
automation = ["automation_core"]
|
|
||||||
development = ["designer", "editor", "automation"]
|
|
||||||
|
|
||||||
# ===== ADMIN APPS =====
|
# Admin
|
||||||
attendant = []
|
attendant = []
|
||||||
security = []
|
security = []
|
||||||
settings = []
|
settings = []
|
||||||
admin = ["attendant", "security", "settings"]
|
|
||||||
|
|
||||||
# ===== COMPATIBILITY ALIASES =====
|
# Core Tech
|
||||||
# These ensure old feature names still work or map correctly
|
|
||||||
pdf = ["pdf_core"]
|
|
||||||
cache = ["cache_core"]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ===== CORE TECHNOLOGIES =====
|
|
||||||
llm = []
|
llm = []
|
||||||
vectordb = ["dep:qdrant-client"]
|
vectordb = ["dep:qdrant-client"]
|
||||||
nvidia = []
|
nvidia = []
|
||||||
compliance = ["dep:csv"]
|
compliance = ["dep:csv"]
|
||||||
timeseries = []
|
timeseries = []
|
||||||
weba = []
|
weba = []
|
||||||
directory = []
|
|
||||||
progress-bars = ["dep:indicatif"]
|
progress-bars = ["dep:indicatif"]
|
||||||
grpc = []
|
grpc = []
|
||||||
jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]
|
jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]
|
||||||
console = ["dep:crossterm", "dep:ratatui", "monitoring"]
|
console = ["dep:crossterm", "dep:ratatui"]
|
||||||
|
|
||||||
# ===== BUNDLE FEATURES =====
|
# ===== BUNDLES (Optional - for convenience) =====
|
||||||
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
|
|
||||||
minimal = ["chat", "automation", "drive", "cache"]
|
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]
|
[dependencies]
|
||||||
diesel_migrations = { workspace = true }
|
diesel_migrations = { workspace = true }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue