/** * DiagnosticsProvider, aggregates all diagnostic panel data providers * into a single unified interface. * * Implements the provider contract for diagnostics and the state inspector. * Wire this up once during runtime initialization and pass it to all * panels that need diagnostic data. * * Usage: * ```ts * import { createDiagnosticsProvider } from './diagnostics/index.js'; * * const provider = createDiagnosticsProvider({ * eventBus, * healthAggregator, * domains: [...], * }); * * const toolCalls = provider.getToolCalls({ limit: 50 }); * const unsubscribe = provider.subscribe('tool-calls', () => render()); * ``` */ import type { RuntimeEventBus } from '../events/index.js'; import type { RuntimeHealthAggregator } from '../health/aggregator.js'; import type { ToolCallEntry, AgentEntry, TaskEntry, EventEntry, RuntimeStateSnapshot, HealthDashboardData, DiagnosticFilter, ComponentConfig, ToolContractEntry } from './types.js'; import { type InspectableDomain } from './panels/state-inspector.js'; import { ToolContractsPanel } from './panels/tool-contracts.js'; import type { ContractVerificationResult } from '../tools/contract-verifier.js'; /** Configuration for creating a DiagnosticsProvider. */ export interface DiagnosticsProviderConfig { /** The runtime event bus to subscribe to. */ readonly eventBus: RuntimeEventBus; /** The runtime health aggregator to monitor. */ readonly healthAggregator: RuntimeHealthAggregator; /** * Domain adapters to expose in the state inspector. * Pass one adapter per runtime store domain. */ readonly domains?: readonly InspectableDomain[] | undefined; /** Optional per-panel buffer configuration. */ readonly panelConfig?: ComponentConfig | undefined; } /** Panel name literals for use with subscribe(). */ export type DiagnosticPanelName = 'tool-calls' | 'agents' | 'tasks' | 'events' | 'state-inspector' | 'health' | 'tool-contracts'; /** * DiagnosticsProvider, unified data access layer for all diagnostic panels. * * Each panel is self-contained and subscribes to its own event sources. * The provider exposes a stable interface for retrieving snapshots and * registering change listeners. */ export declare class DiagnosticsProvider { private readonly _toolCalls; private readonly _agents; private readonly _tasks; private readonly _events; private readonly _stateInspector; private readonly _health; private readonly _toolContracts; constructor(config: DiagnosticsProviderConfig); /** * Retrieve tool call diagnostic entries. * * @param filter - Optional filter for domain, time range, trace/session/turn/task IDs, and limit. * @returns Filtered tool call entries, most recent first. */ getToolCalls(filter?: DiagnosticFilter): ToolCallEntry[]; /** * Retrieve agent diagnostic entries. * * @param filter - Optional filter. * @returns Filtered agent entries, most recent first. */ getAgents(filter?: DiagnosticFilter): AgentEntry[]; /** * Retrieve task diagnostic entries. * * @param filter - Optional filter. * @returns Filtered task entries, most recent first. */ getTasks(filter?: DiagnosticFilter): TaskEntry[]; /** * Retrieve event timeline entries. * * @param filter - Optional filter. The `domains` field filters by domain name. * @returns Filtered event entries, most recent first. */ getEvents(filter?: DiagnosticFilter): EventEntry[]; /** * Capture a point-in-time snapshot of all registered runtime domain states. * * @returns A RuntimeStateSnapshot with all domain states serialized. */ getStateSnapshot(): RuntimeStateSnapshot; /** * Retrieve the current health dashboard data. * * @returns Aggregated health data sorted by severity. */ getHealthDashboard(): HealthDashboardData; /** * Register a domain adapter for inclusion in state inspector snapshots. * * @param domain - Domain adapter implementing InspectableDomain. */ registerDomain(domain: InspectableDomain): void; /** * Load (or reload) all tool contract verification results. * Replaces any previously loaded results. * * @param results - Map of tool name → ContractVerificationResult from ToolContractVerifier. */ loadToolContracts(results: Map): void; /** * Upsert a single tool contract verification result. * Use this for live updates when a single tool is re-verified. * * @param result - The ContractVerificationResult to upsert. */ upsertToolContract(result: ContractVerificationResult): void; /** * Get the contract entry for a specific tool by name. * * @param toolName - Tool name to look up. * @returns The entry or undefined if not verified. */ getToolContract(toolName: string): ToolContractEntry | undefined; /** * Get all tool contract entries, sorted by tool name. */ getToolContracts(): ToolContractEntry[]; /** * Get only tools that failed their contract checks. */ getToolContractFailures(): ToolContractEntry[]; /** * Get summary counts across all tool contract results. */ getToolContractSummary(): ReturnType; /** * Subscribe to change notifications for a specific panel. * * The callback is invoked whenever the panel's data changes. Call the * corresponding `get*` method inside the callback to retrieve the latest data. * * @param panel - The panel to subscribe to. * @param callback - Called whenever the panel's data updates. * @returns An unsubscribe function; call it to stop receiving notifications. */ subscribe(panel: DiagnosticPanelName, callback: () => void): () => void; /** * Dispose all panel data providers, releasing event bus subscriptions * and clearing all internal buffers. * * Call this when the diagnostics system is shut down. */ dispose(): void; } //# sourceMappingURL=provider.d.ts.map