/** * AgentRegistry - Process-global registry of live AgentSession instances. * * Tracks every alive agent (the main session plus every subagent) so the * `irc` tool can address peers by id. Sessions are registered explicitly at * creation and removed when the owner releases them. */ import type { AgentSession } from "../session/agent-session"; export declare const MAIN_AGENT_ID = "0-Main"; export type AgentStatus = "running" | "idle" | "completed" | "aborted"; export type AgentKind = "main" | "sub"; export interface AgentRef { id: string; displayName: string; kind: AgentKind; parentId?: string; status: AgentStatus; session: AgentSession | null; sessionFile: string | null; createdAt: number; lastActivity: number; } export type RegistryEvent = { type: "registered"; ref: AgentRef; } | { type: "status_changed"; ref: AgentRef; } | { type: "removed"; ref: AgentRef; }; type RegistryListener = (event: RegistryEvent) => void; export interface RegisterInput { id: string; displayName: string; kind: AgentKind; parentId?: string; session: AgentSession | null; sessionFile?: string | null; status?: AgentStatus; } export declare class AgentRegistry { #private; static global(): AgentRegistry; /** Reset the global registry. Test-only. */ static resetGlobalForTests(): void; register(input: RegisterInput): AgentRef; setStatus(id: string, status: AgentStatus): void; attachSession(id: string, session: AgentSession, sessionFile?: string | null): void; detachSession(id: string): void; unregister(id: string): void; get(id: string): AgentRef | undefined; list(): AgentRef[]; /** * Returns every alive agent (running | idle) except the caller. * Flat namespace: every agent can see every other agent. */ listVisibleTo(id: string): AgentRef[]; onChange(listener: RegistryListener): () => void; } export {};