import type { CollectionSelectionResult } from './collection-selection.js'; import { type CollectionBoundary, type CollectionSource, type Operation, type Owner, type Source, type StateStore } from './types.js'; /** Each method is owner-bound. Reconciliation never mutates the service. */ export interface DeliveryTransport { readonly owner: Owner; createSession(id: string): Promise; sessionExists(id: string): Promise; append(operation: Readonly): Promise; hasSource(operation: Readonly): Promise; commit(id: string): Promise<{ taskId: string; archiveId?: string; }>; findCommit(id: string): Promise<{ taskId: string; archiveId?: string; } | null>; inspect(operation: Readonly): Promise<{ status: 'processing'; } | { status: 'failed'; code: string; } | { status: 'ready'; archiveId: string; memoryUris: string[]; }>; } export type CollectionHandoffResult = { status: 'recorded'; operationIds: string[]; } | { status: 'blocked'; errorCode: string; }; export declare class MemoryDelivery { #private; constructor(options: { store: StateStore; transport: DeliveryTransport; maxPayloadBytes: number; }); get owner(): Owner; enable(policyVersion: string, boundaries?: CollectionBoundary[]): Promise; pause(): Promise; /** Only trusted, authenticated management code may grant collection consent. */ authorizeCollection(options: { policyVersion: string; scope: string | null; boundaries: CollectionBoundary[]; }): Promise; revokeCollection(): Promise; save(source: Source, content: string, scope?: string | null, expectedEpoch?: number): Promise; /** Collect only against the policy captured for this source, never latest consent. */ collect(source: CollectionSource, content: string, policy: { epoch: number; collectionRevision: number; }, scope?: string | null): Promise; /** Trusted selector output only. One durable commit covers results, sources and outbox. */ collectSelection(selection: Extract, leaseId?: string, signal?: AbortSignal): Promise; /** Advances at most one remote mutation. The caller owns scheduling/lifetime. */ advance(id: string): Promise; /** A bounded retry limit stops mutations, but a later release can safely * reconcile an already accepted commit through its read-only task receipt. */ reconcileExhaustedProcessing(id: string): Promise; /** Only a trusted coordinator can drain a pre-barrier writer while recall stays suppressed. */ advanceGovernance(id: string, jobId: string): Promise; }