/** * Policy diagnostics panel data provider. * * Wraps a `PolicyRegistry` and optionally a `DivergencePanel` to expose * combined policy state (current bundle, candidate, simulation status, * divergence trends) for the diagnostics view. * * This panel is push-passive: it does not drive timers. Callers must * call `recordTrendEntry()` periodically if a divergence panel is attached. */ import type { PolicyBundleVersion, PolicyDiffResult } from '../../permissions/policy-registry.js'; import { PolicyRegistry } from '../../permissions/policy-registry.js'; import type { DivergenceDashboardSnapshot } from '../../permissions/divergence-dashboard.js'; import type { DivergencePanel } from './divergence.js'; import type { ComponentConfig } from '../types.js'; import type { PermissionAuditEntry } from '../../permissions/policy-runtime.js'; import type { PolicyLintFinding } from '../../permissions/lint.js'; import type { PolicySimulationSummary } from '../../permissions/simulation-scenarios.js'; import type { PolicyPreflightReview } from '../../permissions/preflight.js'; /** * A point-in-time snapshot of policy state for diagnostics rendering. */ export interface PolicyPanelSnapshot { /** The currently enforced bundle, or null if no policy is active. */ current: PolicyBundleVersion | null; /** The pending candidate bundle, or null if none loaded. */ candidate: PolicyBundleVersion | null; /** History of previous active bundles (most recent first). */ history: PolicyBundleVersion[]; /** Diff between current and candidate, or null if unavailable. */ diff: PolicyDiffResult | null; /** Divergence dashboard snapshot, or null if no panel attached. */ divergence: DivergenceDashboardSnapshot | null; /** Recent permission requests and decisions for operator audit review. */ recentPermissionAudit: readonly PermissionAuditEntry[]; /** Policy lint findings for current and candidate bundles. */ lintFindings: readonly PolicyLintFinding[]; /** Concrete scenario results from the most recent policy simulation run. */ lastSimulationSummary: PolicySimulationSummary | null; /** Most recent proactive policy preflight review. */ lastPreflightReview: PolicyPreflightReview | null; /** ISO 8601 timestamp of when this snapshot was captured. */ capturedAt: string; } /** * PolicyPanel, diagnostics data provider for the policy registry. * * Usage: * ```ts * const registry = new PolicyRegistry(); * const panel = new PolicyPanel(registry, divergencePanel); * * panel.subscribe(() => { * const snap = panel.getSnapshot(); * render(snap); * }); * * // Notify when the registry state changes: * panel.notify(); * * // On cleanup: * panel.dispose(); * ``` */ export declare class PolicyPanel { private readonly _registry; private readonly _divergencePanel; private readonly _config; private readonly _recentPermissionAudit; private readonly _lintFindings; private readonly _lastSimulationSummary; private readonly _lastPreflightReview; private readonly _subscribers; constructor(registry: PolicyRegistry, divergencePanel?: DivergencePanel | null, recentPermissionAudit?: readonly PermissionAuditEntry[], lintFindings?: readonly PolicyLintFinding[], lastSimulationSummary?: PolicySimulationSummary | null, lastPreflightReview?: PolicyPreflightReview | null, config?: ComponentConfig); /** * recordTrendEntry, Forwards to the attached DivergencePanel if present. * * Call periodically (e.g. every 30 seconds) while simulation is active. */ recordTrendEntry(): void; /** * notify, Trigger a subscriber notification. * * Call after registry state changes (load, promote, rollback) so the * diagnostics view can re-render. */ notify(): void; /** * getSnapshot, Returns the current combined policy + divergence snapshot. */ getSnapshot(): PolicyPanelSnapshot; /** * Register a callback invoked whenever the panel state changes. * @returns An unsubscribe function. */ subscribe(callback: () => void): () => void; /** * Release all subscriptions. */ dispose(): void; private _notify; } //# sourceMappingURL=policy.d.ts.map