Frontend (items 1-10):
- WebSocket streaming integration with useWebSocket hook
- Admin Dashboard UI (status, voices, agents, governance tabs)
- Voice playback UI (TTS/STT integration)
- Settings/Preferences page (conversation style, sliders)
- Responsive/mobile layout (breakpoints at 480px, 768px)
- Dark/light theme with CSS variables and localStorage
- Error handling & loading states (retry, empty state, disabled input)
- Authentication UI (login page, Bearer token, logout)
- Head visualization improvements (active/speaking states, animations)
- Consequence/Ethics dashboard (lessons, consequences, insights tabs)
Backend stubs (items 11-21):
- Tool connectors: DocsConnector (text/md/PDF), DBConnector (SQLite/Postgres), CodeRunnerConnector (Python/JS/Bash/Ruby sandboxed)
- STT adapter: WhisperSTTAdapter, AzureSTTAdapter
- Multi-modal interface adapters: Visual, Haptic, Gesture, Biometric
- SSE streaming endpoint (/v1/sessions/{id}/stream/sse)
- Multi-tenant support (X-Tenant-ID header, tenant CRUD)
- Plugin marketplace/registry (register, install, list)
- Backup/restore endpoints
- Versioned API negotiation (Accept-Version header, deprecation)
Infrastructure (items 22-26):
- docker-compose.yml (API + Postgres + Redis + frontend)
- .env.example with all configurable vars
- gunicorn.conf.py production ASGI config
- Prometheus metrics collector and /metrics endpoint
- Structured JSON logging configuration
Documentation (items 27-29):
- Architecture docs with module layout and subsystem descriptions
- Quickstart guide with setup, API tour, and test instructions
Tests (items 30-32):
- Integration tests: 25 end-to-end API tests
- Frontend tests: 10 Vitest tests for hooks (useTheme, useAuth)
- Load/performance tests: latency and throughput benchmarks
- Connector tests: 16 tests for Docs, DB, CodeRunner
- Multi-modal adapter tests: 9 tests
- Metrics collector tests: 5 tests
- STT adapter tests: 2 tests
511 Python tests passing, 10 frontend tests passing, 0 ruff errors.
Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
75 lines
2.4 KiB
Python
75 lines
2.4 KiB
Python
"""Plugin marketplace/registry: discover, install, and manage custom heads."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from fusionagi._logger import logger
|
|
|
|
router = APIRouter()
|
|
|
|
# In-memory plugin registry (in production, back with DB)
|
|
_registry: dict[str, dict[str, Any]] = {}
|
|
|
|
|
|
@router.get("/plugins")
|
|
def list_plugins(category: str | None = None) -> dict[str, Any]:
|
|
"""List available and installed plugins (custom heads)."""
|
|
from fusionagi.agents.head_registry import HeadRegistry
|
|
|
|
registry = HeadRegistry()
|
|
installed = registry.list_heads()
|
|
|
|
plugins = list(_registry.values())
|
|
if category:
|
|
plugins = [p for p in plugins if p.get("category") == category]
|
|
|
|
return {
|
|
"available": plugins,
|
|
"installed": [{"name": name, "status": "active"} for name in installed],
|
|
"categories": ["reasoning", "creativity", "research", "safety", "custom"],
|
|
}
|
|
|
|
|
|
@router.post("/plugins")
|
|
def register_plugin(body: dict[str, Any]) -> dict[str, Any]:
|
|
"""Register a plugin in the marketplace."""
|
|
plugin_id = body.get("id", "")
|
|
if not plugin_id:
|
|
return {"error": "Plugin ID required"}
|
|
|
|
entry = {
|
|
"id": plugin_id,
|
|
"name": body.get("name", plugin_id),
|
|
"description": body.get("description", ""),
|
|
"version": body.get("version", "0.1.0"),
|
|
"author": body.get("author", ""),
|
|
"category": body.get("category", "custom"),
|
|
"entry_point": body.get("entry_point", ""),
|
|
"status": "available",
|
|
}
|
|
_registry[plugin_id] = entry
|
|
logger.info("Plugin registered", extra={"plugin_id": plugin_id})
|
|
return entry
|
|
|
|
|
|
@router.post("/plugins/{plugin_id}/install")
|
|
def install_plugin(plugin_id: str) -> dict[str, Any]:
|
|
"""Install a plugin from the registry."""
|
|
if plugin_id not in _registry:
|
|
return {"error": f"Plugin not found: {plugin_id}"}
|
|
_registry[plugin_id]["status"] = "installed"
|
|
logger.info("Plugin installed", extra={"plugin_id": plugin_id})
|
|
return {"plugin_id": plugin_id, "status": "installed"}
|
|
|
|
|
|
@router.delete("/plugins/{plugin_id}")
|
|
def uninstall_plugin(plugin_id: str) -> dict[str, Any]:
|
|
"""Uninstall a plugin."""
|
|
if plugin_id in _registry:
|
|
_registry[plugin_id]["status"] = "available"
|
|
logger.info("Plugin uninstalled", extra={"plugin_id": plugin_id})
|
|
return {"plugin_id": plugin_id, "status": "uninstalled"}
|