import type { PluginConfig } from './config/schema'; /** Shared state for plugin sessions and cache tracking. */ export interface DelegationEntry { from: string; to: string; timestamp: number; } export interface CacheStats { cacheHits: number; cacheMisses: number; cacheSizeBytes: number; } /** Guardrail tracking state per session */ export interface GuardrailSession { toolCalls: number; firstToolAt: number | null; repetitionCount: number; consecutiveErrors: number; lastTool: string | null; } /** Maximum number of sessions to track before pruning */ export declare const MAX_SESSIONS = 1000; export declare const swarmState: { /** Active agent per session — keyed by sessionID */ activeAgent: Map; /** Delegation chains per session — keyed by sessionID */ delegationChains: Map; /** Number of events since last flush */ pendingEvents: number; /** Cache statistics for markdown AST parsing */ cacheStats: CacheStats; /** Last successfully loaded config document */ lastValidConfig: PluginConfig | null; /** Guardrail tracking per session — keyed by sessionID */ guardrails: Map; }; /** * Prune the oldest sessions from both Maps. * Map iteration order is insertion order, so the first entries are oldest. * @param count - Number of sessions to prune */ export declare function pruneOldestSessions(count: number): void; /** * Enforce the session limit by pruning if Maps exceed MAX_SESSIONS. * Prunes 10% of sessions when the limit is hit. */ export declare function enforceSessionLimit(): void; /** Clear all session tracking, events, and cache stats. Used between tests and for plugin reinitialization. */ export declare function resetSwarmState(): void; /** * Finalize and clear all swarm state. * Alias for resetSwarmState, signaling end-of-lifecycle cleanup. */ export declare function disposeSwarmState(): void; /** * Get or initialize guardrail session state for a given sessionID. * @param sessionID - The session identifier * @returns The guardrail session state (initializes if missing) */ export declare function getGuardrailSession(sessionID: string): GuardrailSession; /** * Reset guardrail state for a specific session. * @param sessionID - The session identifier to clear */ export declare function resetGuardrailState(sessionID: string): void;