import type { Vault } from '../../kernel/vault.js'; import type { TierMoveResult } from '../../with-audit/tiers/index.js'; /** * Reserved collection that holds the audit ledger of elevation * sessions. One envelope per `vault.elevate(...)` call. */ export declare const ELEVATION_AUDIT_COLLECTION = "_elevation_audit"; /** * Scoped handle returned by `vault.elevate(...)`. Writes through this * handle land at the elevated tier with `authorization: 'elevation'` * stamped on the audit event; reads stay on the original `Vault`. * * The handle lazily checks its TTL on every operation, so a * forgotten `release()` cannot keep elevated writes alive past * `expiresAt` — the next call simply throws * {@link ElevationExpiredError}. * * Naming note: the issue's spec text used `elevated.session` * for this field; we name the field `handle` to avoid conflicting * with the codebase's existing `SessionToken` value type. The * semantics are unchanged. */ export declare class ElevatedHandle { /** Target tier this handle writes at. */ readonly tier: number; /** Audit string stamped on every cross-tier event. */ readonly reason: string; /** Absolute expiration in ms (Date.now()). */ readonly expiresAt: number; private released; private readonly vault; private readonly onRelease; constructor(opts: { vault: Vault; tier: number; reason: string; expiresAt: number; onRelease: () => void; }); /** * Scoped collection accessor. Returns a thin wrapper exposing the * single elevated operation (`put`). Reads, deletes, queries — * everything else — should go through the original `vault`'s * `collection(...)`, which keeps "writes elevated, reads * unprivileged" trivially true. */ collection(name: string): { put(id: string, record: T): Promise; }; /** * Manually revert the elevation. Idempotent — calling twice (or * after the TTL expired) is a safe no-op. The vault's * active-elevation slot is cleared so a subsequent * `vault.elevate(...)` succeeds without throwing * {@link AlreadyElevatedError}. */ release(): Promise; private assertActive; }