UNPKG

@sethdouglasford/claude-flow

Version:

Claude Code Flow - Advanced AI-powered development workflows with SPARC methodology

133 lines 3.9 kB
/** * Agent Registry with Memory Integration * Provides persistent storage and coordination for agent management */ import { DistributedMemorySystem } from "../memory/distributed-memory.js"; import { AgentState, AgentType, AgentStatus } from "../swarm/types.js"; import { EventEmitter } from "node:events"; export interface AgentCoordinationData { agentId: string; data: { taskAssignments?: Record<string, unknown>; collaborations?: string[]; state?: Record<string, unknown>; capabilities?: Record<string, unknown>; [key: string]: unknown; }; timestamp: Date; } export interface AgentMetadata { registeredBy: string; version: string; lastSeen?: Date; platform?: string; environment?: string; [key: string]: unknown; } export interface AgentRegistryEntry { agent: AgentState; createdAt: Date; lastUpdated: Date; tags: string[]; metadata: AgentMetadata; } export interface AgentQuery { type?: AgentType; status?: AgentStatus; tags?: string[]; healthThreshold?: number; namePattern?: string; createdAfter?: Date; lastActiveAfter?: Date; } export interface AgentStatistics { totalAgents: number; byType: Record<AgentType, number>; byStatus: Record<AgentStatus, number>; averageHealth: number; activeAgents: number; totalUptime: number; tasksCompleted: number; successRate: number; } /** * Centralized agent registry with persistent storage */ export declare class AgentRegistry extends EventEmitter { private memory; private namespace; private cache; private cacheExpiry; private lastCacheUpdate; constructor(memory: DistributedMemorySystem, namespace?: string); initialize(): Promise<void>; /** * Register a new agent in the registry */ registerAgent(agent: AgentState, tags?: string[]): Promise<void>; /** * Update agent information in registry */ updateAgent(agentId: string, updates: Partial<AgentState>): Promise<void>; /** * Remove agent from registry */ unregisterAgent(agentId: string, preserveHistory?: boolean): Promise<void>; /** * Get agent by ID */ getAgent(agentId: string): Promise<AgentState | null>; /** * Get agent entry with metadata */ getAgentEntry(agentId: string): Promise<AgentRegistryEntry | null>; /** * Query agents by criteria */ queryAgents(query?: AgentQuery): Promise<AgentState[]>; /** * Get all registered agents */ getAllAgents(): Promise<AgentState[]>; /** * Get agents by type */ getAgentsByType(type: AgentType): Promise<AgentState[]>; /** * Get agents by status */ getAgentsByStatus(status: AgentStatus): Promise<AgentState[]>; /** * Get healthy agents */ getHealthyAgents(threshold?: number): Promise<AgentState[]>; /** * Get registry statistics */ getStatistics(): Promise<AgentStatistics>; /** * Search agents by capabilities */ searchByCapabilities(requiredCapabilities: string[]): Promise<AgentState[]>; /** * Find best agent for task */ findBestAgent(taskType: string, requiredCapabilities?: string[], preferredAgent?: string): Promise<AgentState | null>; /** * Store agent coordination data */ storeCoordinationData(agentId: string, data: AgentCoordinationData["data"]): Promise<void>; /** * Retrieve agent coordination data */ getCoordinationData(agentId: string): Promise<AgentCoordinationData | null>; private isValidAgentRegistryEntry; private isValidCoordinationData; private loadFromMemory; private refreshCacheIfNeeded; private isCacheValid; private getAgentKey; private getArchiveKey; private calculateAgentScore; } //# sourceMappingURL=agent-registry.d.ts.map