/** * Plugin quarantine engine. * * Quarantine removes a plugin's unsafe contribution effects without fully * unloading it. This allows the operator to isolate a suspicious plugin, * inspect it, then either restore or permanently disable it. * * Quarantine effects: * - All high-risk capabilities are revoked in the resolved manifest. * - The plugin is moved to a `quarantined` lifecycle bucket in the store. * - A quarantine record is created with a timestamp and reason. * * Restore path: * - `lift()`, Restores previously revoked capabilities (if trust was upgraded). * - The caller is responsible for reloading the plugin after lifting. */ import type { PluginCapability, PluginCapabilityManifest } from './types.js'; /** * A record describing a plugin currently in quarantine. */ export interface QuarantineRecord { /** Plugin name. */ readonly pluginName: string; /** Unix epoch ms when quarantine was applied. */ readonly quarantinedAt: number; /** Human-readable reason for quarantine. */ readonly reason: string; /** The capabilities that were revoked when quarantine was applied. */ readonly revokedCapabilities: ReadonlyArray; /** Whether the quarantine has been lifted. */ lifted: boolean; /** Unix epoch ms when quarantine was lifted, if applicable. */ liftedAt?: number | undefined; } /** * PluginQuarantineEngine, Tracks quarantined plugins and applies/revokes * capability restrictions. * * This is intentionally separate from the PluginLifecycleManager so that * quarantine can be applied without triggering a full state machine transition. * The lifecycle manager delegates to this engine when quarantine is requested. */ export declare class PluginQuarantineEngine { private readonly records; /** * quarantine, Apply quarantine to a plugin. * * Revokes all high-risk capabilities from the plugin's resolved manifest * and creates a quarantine record. The plugin remains in memory but its * unsafe contributions are neutralised. * * @param pluginName - Plugin identifier. * @param capabilityManifest - The plugin's live capability manifest (mutated in place). * @param reason - Human-readable reason for quarantine. * @returns The quarantine record, or null if already quarantined. */ quarantine(pluginName: string, capabilityManifest: PluginCapabilityManifest, reason: string): QuarantineRecord | null; /** * lift, Lift quarantine for a plugin. * * Previously revoked capabilities are NOT automatically restored here; * the caller should trigger a re-resolve of the capability manifest * (e.g. by reloading the plugin) after lifting so that trust-tier * constraints are re-evaluated with the new tier. * * @returns true if quarantine was successfully lifted; false if not found. */ lift(pluginName: string): boolean; /** Returns whether a plugin is currently quarantined (and not lifted). */ isQuarantined(pluginName: string): boolean; /** Returns the quarantine record for a plugin, or undefined. */ getRecord(pluginName: string): Readonly | undefined; /** Returns all quarantine records (including lifted ones). */ getAllRecords(): ReadonlyArray>; /** Returns only active (not-lifted) quarantine records. */ getActiveQuarantines(): ReadonlyArray>; /** * applyToNewManifest, Apply quarantine constraints to a freshly-resolved * capability manifest. Used when a plugin is reloaded while under quarantine. * * Unlike `quarantine()`, this does not create a new record, it reuses the * existing one. Call this during manifest re-resolution if `isQuarantined()` * is true. */ applyToNewManifest(pluginName: string, capabilityManifest: PluginCapabilityManifest): void; } //# sourceMappingURL=quarantine.d.ts.map