/** * StateInspectorProvider, enhanced runtime state inspector data provider. * * Extends the basic StateInspectorPanel from diagnostics with: * - Bounded transition history via BoundedTransitionLog * - Domain-filtered snapshots * - Subscription registry showing active consumers with notification metadata * * This is a DATA PROVIDER, no UI rendering logic. * State inspector provider implementation. */ import type { StateSnapshot, TransitionEntry, SubscriptionInfo, StateInspectorConfig, TimelineEvent, TimeTravelCursor } from './types.js'; import type { InspectableDomain } from '../../diagnostics/panels/state-inspector.js'; /** * StateInspectorProvider, full-featured state inspector data provider. * * ### Usage * ```ts * const inspector = createStateInspector({ * domains: [sessionDomainAdapter, conversationDomainAdapter], * maxTransitions: 500, * }); * * const snapshot = inspector.getSnapshot(); * const history = inspector.getTransitionHistory(); * const subs = inspector.getSubscriptions(); * ``` */ export declare class StateInspectorProvider { private readonly _domains; private readonly _transitionLog; private readonly _timeline; private readonly _observedDomains; private readonly _subscriptions; private readonly _domainCache; private _subIdCounter; /** * @param domains - Domain adapters to inspect. * @param config - Optional configuration. */ constructor(domains?: InspectableDomain[], config?: StateInspectorConfig); /** * Register an additional domain for inspection. * Triggers a notification to all subscribers. * * @param domain - Domain adapter to register. */ registerDomain(domain: InspectableDomain): void; /** Returns the names of all currently registered domains. */ registeredDomainNames(): string[]; /** * Capture a point-in-time snapshot of all (or filtered) domains. * * @param domainFilter - Optional list of domain names to include. * When undefined, all registered domains are captured. * @returns StateSnapshot. */ getSnapshot(domainFilter?: readonly string[]): StateSnapshot; /** * Poll for new transitions and record any detected domain revisions. * * Call this periodically (e.g. after state mutations) to keep the * transition log up to date. * * @returns Number of new transitions recorded. */ poll(): number; /** * Return all retained transition entries in chronological order. * * @returns Ordered array of TransitionEntry. */ getTransitionHistory(): TransitionEntry[]; /** * Return transition history filtered by domain. * * @param domain - Domain name to filter by. */ getTransitionsByDomain(domain: string): TransitionEntry[]; /** * Return transitions recorded at or after the given epoch ms timestamp. * * @param sinceMs - Inclusive lower bound (epoch ms). */ getTransitionsSince(sinceMs: number): TransitionEntry[]; /** * Return the N most recent transitions. * * @param n - Maximum number of entries. */ getLastTransitions(n: number): TransitionEntry[]; /** Total number of transitions ever recorded (not capped by maxTransitions). */ get totalTransitions(): number; /** * Clear all stored transitions and timeline events. * Does not reset subscription registry or domain cache. */ clearTransitionHistory(): void; /** * Return all retained timeline events in chronological order. * * @returns Ordered array of TimelineEvent. */ getTimeline(): TimelineEvent[]; /** * Return the event at the current time-travel cursor position. * Returns undefined when the cursor is at the live position. * * @returns TimelineEvent or undefined when live. */ getCurrentTimelineEvent(): TimelineEvent | undefined; /** * Current time-travel cursor state. */ get timeTravelCursor(): TimeTravelCursor; /** * Whether the inspector is currently in time-travel mode (cursor pinned). */ get isTimeTravel(): boolean; /** * Step the cursor one event backward (toward oldest). * * @returns true if the cursor moved. */ stepBack(): boolean; /** * Step the cursor one event forward (toward live). * * @returns true if the cursor moved. */ stepForward(): boolean; /** * Seek the cursor to an absolute logical index. * Pass `timeline.size` to return to live. * * @param index, Target index (size = live). */ seekTo(index: number): void; /** * Seek to the nearest event at or before a given epoch ms timestamp. * * @param epochMs, Target timestamp. */ seekToTime(epochMs: number): void; /** * Exit time-travel mode, returning the cursor to the live tail. */ exitTimeTravel(): void; /** * Get the snapshot at the current cursor position for display. * Returns undefined when live (callers should use getSnapshot() instead). * * @returns The pinned snapshot state or undefined when live. */ getTimeTravelSnapshot(): TimelineEvent | undefined; /** * Subscribe to state inspector change notifications. * * @param callback - Function invoked when a domain transition is detected. * @param label - Human-readable label for this subscriber. * @param domainFilter - Optional domain names to restrict notifications to. * @returns Object with `id` (subscription ID) and `unsubscribe` function. */ subscribe(callback: () => void, label: string, domainFilter?: readonly string[]): { id: string; unsubscribe: () => void; }; /** * Return metadata for all active subscriptions. * Callbacks are not exposed. * * @returns Array of SubscriptionInfo. */ getSubscriptions(): SubscriptionInfo[]; /** * Return the count of currently active subscriptions. */ get subscriptionCount(): number; /** Filter domains by the provided list, or return all if undefined. */ private _filterDomains; /** Notify all subscribers, tracking notification metadata. */ private _notifyAll; } //# sourceMappingURL=inspector.d.ts.map