/**
 * Reactive state for the audit log viewer.
 *
 * Two fetch primitives (`fetch` for events, `fetch_role_grant_history` for the
 * grant/revoke shortcut) flow through an injected RPC adapter; the SSE
 * stream continues to use `EventSource` directly — streams aren't an RPC
 * concern.
 *
 * Holds two `AsyncSlot`s — `list` (the main event stream) and
 * `role_grant_history` (the dedicated role-grant history endpoint). Data
 * lives on the class so SSE pushes and gap-fill calls update it directly.
 *
 * @module
 */
import { AsyncSlot } from './async_slot.svelte.js';
import type { AuditLogEventWithUsernamesJson, RoleGrantHistoryEventJson } from '../auth/audit_log_schema.js';
import type { AuditLogListInput, AuditLogListOutput, AuditLogRoleGrantHistoryInput, AuditLogRoleGrantHistoryOutput } from '../auth/admin_action_specs.js';
/**
 * Narrow RPC surface consumed by `AuditLogState`. Consumers adapt their typed
 * RPC client to this shape. Mirrors `AdminAccountsRpc` / `AdminInvitesRpc`.
 * Method signatures track the wire spec inputs/outputs directly so the
 * adapter needs no casts.
 */
export interface AuditLogRpc {
    list: (input?: AuditLogListInput) => Promise<AuditLogListOutput>;
    role_grant_history: (input?: AuditLogRoleGrantHistoryInput) => Promise<AuditLogRoleGrantHistoryOutput>;
}
/**
 * Svelte context carrying the reactive `AuditLogRpc` accessor. Mirrors
 * `admin_accounts_rpc_context`. `get()` throws when no provisioner ran above
 * the component — the adapter is required.
 */
export declare const audit_log_rpc_context: {
    get: (error_message?: string) => () => AuditLogRpc;
    get_maybe: () => (() => AuditLogRpc) | undefined;
    set: (value: () => AuditLogRpc) => () => AuditLogRpc;
};
export interface AuditLogStateOptions {
    /**
     * Reactive accessor for the RPC adapter. Matches the `get_rpc` pattern on
     * `AdminAccountsState`. The SSE stream uses `EventSource` directly and is
     * independent of this adapter.
     */
    get_rpc: () => AuditLogRpc;
    /** SSE stream URL. Defaults to the shipped admin audit-log stream route. */
    stream_url?: string;
}
export declare class AuditLogState {
    #private;
    readonly list: AsyncSlot<void, string>;
    readonly role_grant_history: AsyncSlot<void, string>;
    events: Array<AuditLogEventWithUsernamesJson>;
    role_grant_history_events: Array<RoleGrantHistoryEventJson>;
    readonly count: number;
    /** Whether the SSE stream is currently connected. */
    connected: boolean;
    constructor(options: AuditLogStateOptions);
    fetch(options?: AuditLogListInput): Promise<void>;
    fetch_role_grant_history(limit?: number, offset?: number): Promise<void>;
    /**
     * Connect to the SSE stream for realtime audit events.
     *
     * New events are prepended to `events`. EventSource auto-reconnects on
     * transient errors; `since_seq` fills gaps on reconnection.
     *
     * @returns cleanup function that closes the connection
     * @mutates `this`
     */
    subscribe(): () => void;
    /**
     * Close the SSE connection.
     *
     * @mutates `this`
     */
    disconnect(): void;
}
//# sourceMappingURL=audit_log_state.svelte.d.ts.map