import type { Agent } from '@strands-agents/sdk' /** * Simple in-memory registry for multi-agent orchestration. * Allows tools to discover other agents in the current session (main + subagents). */ class AgentRegistry { private agents = new Map() private mainId: string | null = null register(id: string, agent: Agent, isMain: boolean = false) { this.agents.set(id, agent) if (isMain) this.mainId = id } unregister(id: string) { this.agents.delete(id); if (this.mainId === id) this.mainId = null } get(id: string): Agent | undefined { return this.agents.get(id) } main(): Agent | undefined { return this.mainId ? this.agents.get(this.mainId) : undefined } list(): { id: string; agent: Agent; main: boolean }[] { return Array.from(this.agents.entries()).map(([id, agent]) => ({ id, agent, main: id === this.mainId })) } count(): number { return this.agents.size } } export const agentRegistry = new AgentRegistry()