Phase 7: Agent Selector — per-agent soul.md + ChromaDB memory filtering

- Agent dropdown UI (chip button + hidden select) in composer header
- Session.agent field persists agent selection across refresh
- soul.md loaded per-agent via ephemeral_system_prompt injection
- ChromaDB memory filtered by agent topic (lotus/, sunflower/, etc.)
- Fixed streaming.py: agent→_ai_agent variable shadowing (lines 1161, 1163)
- New API endpoints: /api/agents/topology, /api/agents/memory/search
- Agent metadata registry with emoji, name, description per Tier-2 agent
This commit is contained in:
Rose
2026-04-20 17:34:58 +02:00
parent 00045314f8
commit c705fad626
14 changed files with 2578 additions and 320 deletions

View File

@@ -1067,3 +1067,40 @@ def _search_all_agents_memory(query: str, limit: int = 20) -> list:
return matches
except Exception:
return []
# ── Topology Graph ───────────────────────────────────────────────────────────
def _get_topology() -> dict:
"""
Build a network graph of all agents and their connections.
Returns {nodes: [...], edges: [...]} for D3.js visualization.
"""
# Nodes: Rose + all Tier-2 agents
nodes = [
{"id": "rose", "name": "Rose 🌹", "type": "orchestrator",
"color": "#f44336", "domain": "Orchestrator"},
]
for agent_id, meta in TIER2_AGENTS.items():
nodes.append({
"id": agent_id,
"name": f"{meta['emoji']} {meta['name']}",
"type": "tier2",
"color": meta["color"],
"domain": meta["domain"],
})
# Edges: Rose connects to all Tier-2 agents
edges = []
for agent_id in TIER2_AGENTS:
edges.append({
"source": "rose", "target": agent_id,
"type": "orchestrates", "strength": 1,
})
return {"nodes": nodes, "edges": edges}
def get_topology() -> dict:
"""API: GET /api/agents/topology — return agent network graph."""
return _get_topology()