24423b6802
Check Cross-Plugin Imports / check (push) Has been cancelled
Drittes Modul via Phase-Q-Manifest-Architektur: Registrierung komplett ueber das agent_memory-Plugin-Manifest (page_route /agent-memory + menu_item, Brain-Icon) — routes/index.tsx unangetastet. Komponenten-Map mit 40 Eintraegen. Zusaetzlicher Fix: Sidebar-ICON_MAP um Brain, Store, Tags erweitert — Marketplace (Store) und Tags zeigten bisher Fallback-Icons, weil die Manifest-Icons nicht in der kuratierten Map standen. Backend existierte vollstaendig (create mit Embedding, list mit agent_id-Pflichtfilter + Typ + Pagination, semantische Suche via pgvector, update mit Embedding-Regeneration, delete; agent_memory:read/write), Frontend hatte 0% Abdeckung. - api/agentMemory.ts: TanStack-Hooks (useAgentMemories mit enabled-Gating, useAgentMemorySearch, create/update/delete) - pages/AgentMemory.tsx: Agent-Picker (Pflichtfeld — Backend filtert zwingend nach agent_id), Pick-Agent-Prompt, semantische Suche mit Relevanz-Score-Badges und Clear, Memory-Karten mit Typ-Badges (fact/context/pattern/instruction), Create/Edit-Dialog, Delete mit Confirm — Aktionen hinter agent_memory:write - i18n agentMemory.* + nav.agentMemory de/en Verifikation: Vitest 11/11 (Agent-Picker-Pflicht, Pick-Prompt, Badges, Suche mit Score + Clear, Create/Edit prefilled, Delete mit+ohne Confirm, Gating, Empty/Error) · tsc exit 0 · production build exit 0 · Backend-Regressionen (route-order, m5-miniapps) 10/10 · compileall sauber · Manifest-Check OK.
71 lines
2.4 KiB
Python
71 lines
2.4 KiB
Python
"""Agent Memory plugin — persistent agent memory with pgvector semantic search."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.plugins.base import BasePlugin
|
|
from app.plugins.manifest import (
|
|
FrontendMenuItem,
|
|
FrontendPageRoute,
|
|
PluginManifest,
|
|
PluginRouteDef,
|
|
)
|
|
|
|
|
|
class AgentMemoryPlugin(BasePlugin):
|
|
"""Agent Memory plugin for persistent agent memory with semantic search."""
|
|
|
|
manifest = PluginManifest(
|
|
name="agent_memory",
|
|
version="1.0.0",
|
|
display_name="Agent Memory",
|
|
description="Persistent agent memory with pgvector semantic search. Stores facts, context, patterns, and instructions for AI agents.",
|
|
dependencies=["unified_search"],
|
|
routes=[
|
|
PluginRouteDef(
|
|
path="/api/v1/agent-memory",
|
|
module="app.plugins.builtins.agent_memory.routes",
|
|
router_attr="router",
|
|
),
|
|
],
|
|
events=[],
|
|
migrations=["0001_initial.sql"],
|
|
permissions=[
|
|
"agent_memory:read",
|
|
"agent_memory:write",
|
|
],
|
|
# UI-Backlog Modul 8 (2026-09-13): agent memory page, registered
|
|
# via the manifest (Phase Q pattern).
|
|
menu_items=[
|
|
FrontendMenuItem(
|
|
label_key="nav.agentMemory",
|
|
label="Agent Memory",
|
|
path="/agent-memory",
|
|
icon="Brain",
|
|
order=86,
|
|
permission="agent_memory:read",
|
|
),
|
|
],
|
|
page_routes=[
|
|
FrontendPageRoute(
|
|
path="/agent-memory",
|
|
component="@/pages/AgentMemory",
|
|
protected=True,
|
|
permission="agent_memory:read",
|
|
),
|
|
],
|
|
is_core=True,
|
|
author="LeoCRM Team",
|
|
min_app_version="1.0.0",
|
|
contract_version="1.0.0",
|
|
)
|
|
|
|
def get_entity_models(self) -> dict[str, type]:
|
|
from app.plugins.builtins.agent_memory.models import AgentMemory
|
|
return {"agent_memory": AgentMemory}
|
|
|
|
async def on_deactivate(self, db, service_container, event_bus) -> None:
|
|
"""Deactivate plugin: unregister contract and event listeners."""
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
|
get_contract_registry().unregister(self.manifest.name)
|
|
await super().on_deactivate(db, service_container, event_bus)
|