import type { OwnershipScope, PersistencePage, PersistenceQuery, RetentionPolicy } from "./contracts.js"; /** Resource classes covered by holds, quotas, and retention sweeps. */ export type PersistenceResourceKind = "session" | "entry" | "run" | "event" | "tool_call" | "usage" | "checkpoint" | "feedback" | "audit" | "work_artifact" | "connector_operation"; export declare const DEFAULT_LIFECYCLE_PAGE_SIZE = 100; export declare const HARD_LIFECYCLE_PAGE_SIZE = 500; export declare const DEFAULT_MAX_HOLD_REASON_BYTES = 1024; export declare const HARD_MAX_HOLD_REASON_BYTES: number; export declare class PersistenceLifecycleError extends Error { readonly code: string; constructor(message: string, code?: string); } export interface LegalHoldRecord extends OwnershipScope { readonly id: string; readonly resourceKind: PersistenceResourceKind; readonly resourceId: string; readonly reason: string; readonly createdAt: string; readonly createdBy?: string; readonly metadata?: Readonly>; } export interface PutLegalHoldInput extends OwnershipScope { readonly resourceKind: PersistenceResourceKind; readonly resourceId: string; readonly reason: string; readonly id?: string; readonly createdBy?: string; readonly metadata?: Readonly>; readonly signal?: AbortSignal; } export interface ReleaseLegalHoldInput extends OwnershipScope { readonly id: string; readonly signal?: AbortSignal; } export interface LegalHoldQuery extends PersistenceQuery, OwnershipScope { readonly resourceKind?: PersistenceResourceKind; readonly resourceId?: string; readonly holdId?: string; readonly signal?: AbortSignal; } export interface ApplyRetentionInput extends OwnershipScope { readonly policy: RetentionPolicy; /** When omitted, adapters discover expired/over-limit session ids for this ownership page. */ readonly candidates?: readonly string[]; readonly cursor?: string; readonly limit?: number; readonly signal?: AbortSignal; } export interface ApplyRetentionResult { readonly deleted: readonly string[]; readonly skippedHeld: readonly string[]; readonly nextCursor?: string; } export interface LegalHoldExportItem { readonly holdId: string; readonly resourceKind: PersistenceResourceKind; readonly resourceId: string; readonly reason: string; readonly createdAt: string; readonly redacted: true; } export interface ExportUnderHoldInput extends OwnershipScope { readonly holdId?: string; readonly resourceKind?: PersistenceResourceKind; readonly cursor?: string; readonly limit?: number; readonly signal?: AbortSignal; } export interface TenantQuota extends OwnershipScope { readonly resourceKind: PersistenceResourceKind; readonly limit: number; readonly used: number; readonly updatedAt: string; } export interface SetTenantQuotaInput extends OwnershipScope { readonly resourceKind: PersistenceResourceKind; readonly limit: number; readonly signal?: AbortSignal; } export interface ConsumeTenantQuotaInput extends OwnershipScope { readonly resourceKind: PersistenceResourceKind; /** Units to consume. Default 1. */ readonly delta?: number; readonly signal?: AbortSignal; } /** Optional persistence lifecycle capability (retention / hold / export / quota). */ export interface PersistenceLifecycleStore { putLegalHold(input: PutLegalHoldInput): Promise; releaseLegalHold(input: ReleaseLegalHoldInput): Promise; listLegalHolds(query: LegalHoldQuery): Promise>; /** Deletes candidates not under legal hold. Hold always wins over retention. */ applyRetention(input: ApplyRetentionInput): Promise; exportUnderHold(input: ExportUnderHoldInput): Promise>; setTenantQuota(input: SetTenantQuotaInput): Promise; getTenantQuota(input: OwnershipScope & { readonly resourceKind: PersistenceResourceKind; readonly signal?: AbortSignal; }): Promise; /** Fails closed when used + delta would exceed limit. */ consumeTenantQuota(input: ConsumeTenantQuotaInput): Promise; } export declare function createMemoryPersistenceLifecycle(): PersistenceLifecycleStore; /** True when a session/resource id is under an active legal hold in the page of holds. */ export declare function isResourceHeld(holds: readonly Pick[], resourceKind: PersistenceResourceKind, resourceId: string): boolean;