Files
leocrm/app/plugins/builtins/marketplace/plugin.py
T
Agent Zero 000c969b13
Check Cross-Plugin Imports / check (push) Has been cancelled
Phase 5.5-5.9: Plugin-Marketplace, Agent Memory, GraphRAG, Subagents, External Agent API
5.5 Plugin-Marketplace:
- New plugin: marketplace/ (models, routes, services, schemas, config)
- MarketplaceListing model (global, no tenant_id)
- Ed25519 signature verification via PluginSignature
- Endpoints: list, detail, install, verify, categories
- Config: MARKETPLACE_SERVER_URL setting

5.6 Agent Memory (persistent):
- New plugin: agent_memory/ (models, routes, services, schemas)
- AgentMemory model with embedding vector(768) + HNSW index
- store_memory() with auto-embedding
- retrieve_relevant_memories() with pgvector cosine similarity
- Semantic search endpoint

5.7 GraphRAG:
- New plugin: graph_rag/ (models, routes, services, provider, schemas)
- EntityRelationship model (source/target type+id, relationship_type, metadata)
- BFS graph traversal (bidirectional, configurable depth)
- GraphRAGSearchProvider registered in unified_search

5.8 Subagents / Multi-Agent:
- AgentCoordinator class (create_subtask, wait_for_subtask, aggregate, cancel)
- AgentSubtask model + migration 0002_agent_subtasks.sql
- 6 new API endpoints for subtask management
- Tools registered in AI tool registry

5.9 External Agent API:
- external_api.py: POST /run, GET /status, POST /stream (SSE)
- Bearer API token authentication
- Rate limiting: 10 req/min per token
- ExternalAgentRequest/Response schemas

3 new plugins registered in main.py and __init__.py
All files py_compile clean
2026-08-04 15:06:23 +02:00

56 lines
1.7 KiB
Python

"""Marketplace plugin — browse, search, verify, and install plugins from the marketplace."""
from __future__ import annotations
import logging
from typing import Any
from app.plugins.base import BasePlugin
from app.plugins.manifest import PluginManifest, PluginRouteDef
logger = logging.getLogger(__name__)
class MarketplacePlugin(BasePlugin):
"""Marketplace plugin for browsing, searching, verifying, and installing plugins."""
manifest = PluginManifest(
name="marketplace",
version="1.0.0",
display_name="Plugin Marketplace",
description="Browse, search, verify, and install plugins from the marketplace.",
dependencies=[],
routes=[
PluginRouteDef(
path="/api/v1/marketplace",
module="app.plugins.builtins.marketplace.routes",
router_attr="router",
),
],
events=[],
migrations=["0001_initial.sql"],
permissions=["marketplace:read", "marketplace:admin"],
menu_items=[],
page_routes=[],
settings_pages=[],
detail_tabs=[],
author="LeoCRM",
min_app_version="1.0.0",
hooks=[],
contract_version="1.0.0",
)
async def on_activate(
self, db, service_container, event_bus
) -> None:
"""Activate marketplace plugin."""
await super().on_activate(db, service_container, event_bus)
logger.info("Marketplace plugin activated")
async def on_deactivate(
self, db, service_container, event_bus
) -> None:
"""Deactivate marketplace plugin."""
await super().on_deactivate(db, service_container, event_bus)
logger.info("Marketplace plugin deactivated")