export type Sensitivity = 'low' | 'medium' | 'high'; export type Visibility = 'public' | 'internal' | 'private'; export type MutationOp = 'insert' | 'update' | 'upsert' | 'delete'; export type AgentIdentity = { kind: 'iframe'; origin: string; bundle_sha256: string; } | { kind: 'inline'; id: string; }; export interface JsonSchema { type?: string | string[]; properties?: Record; items?: JsonSchema | JsonSchema[]; required?: string[]; additionalProperties?: boolean; enum?: any[]; const?: any; format?: string; description?: string; title?: string; minLength?: number; maxLength?: number; minimum?: number; maximum?: number; } export type MutationSpec = { pattern: string; sensitivity: Sensitivity; visibility: Visibility; jsonSchema?: JsonSchema; maxBytes?: number; allow?: (ctx: { agent: AgentIdentity; hostOrigin: string; }) => boolean; pre?: (input: { path: string; op: MutationOp; body: any; agent: AgentIdentity; }) => Promise<{ path?: string; body?: any; } | void>; post?: (input: { path: string; op: MutationOp; body: any; version?: number; }) => Promise; }; export type MutationRequest = { path: string; op: MutationOp; body?: unknown; agent: AgentIdentity; ifVersion?: number; }; export interface CoreAdapter { get(path: string, opts?: { visibility?: Visibility; version?: number; }): Promise; put(path: string, data: any, opts?: { visibility?: Visibility; meta?: any; version?: number; }): Promise; del(path: string, version?: number): Promise; } export declare class SDKError extends Error { code: 'ERR_INVALID_REQUEST' | 'ERR_FORBIDDEN' | 'ERR_LOCKED' | 'ERR_CONFLICT' | 'ERR_INTERNAL'; constructor(code: SDKError['code'], message?: string); } export type EnsureGrant = (input: { agent: AgentIdentity; path: string; }) => Promise; export type AuditFn = (e: any) => void; export declare class MutationRegistry { private specs; register(spec: MutationSpec): void; list(): MutationSpec[]; resolve(path: string, agent: AgentIdentity): MutationSpec | null; } export declare function mutate(req: MutationRequest, deps: { hostOrigin: string; core: CoreAdapter; ensureGrant: EnsureGrant; audit?: AuditFn; validate?: (schema: JsonSchema, data: any) => { ok: true; } | { ok: false; errors: string[]; }; }, registry: MutationRegistry): Promise<{ ok: true; }>; //# sourceMappingURL=mutate-index.d.ts.map