import type { AtribRecord } from './types.js'; /** * Inclusion proof bundle returned by the log's submission API per spec §2.6.2. * * Field names are snake_case to match the on-wire JSON exactly. Earlier * versions of this interface used camelCase (`logIndex`, `inclusionProof`) * which did not match the spec; the cast was opaque so nothing crashed, * but `@atrib/verify`'s `GraphNode.log_index` already used snake_case, * leaving the two packages disagreeing with each other. Both now match * the spec. */ export interface ProofBundle { /** Zero-based index of the entry in the log (§2.6.2). */ log_index: number; /** Signed checkpoint at the time of submission (§2.4 signed note format). */ checkpoint: string; /** Sibling hashes from leaf to root, base64-encoded (§2.6.2). */ inclusion_proof: string[]; /** SHA-256(0x00 || entry_bytes), base64-encoded (§2.3.2). */ leaf_hash: string; } export interface SubmissionQueue { /** Submit a signed record to the log (non-blocking). */ submit(record: AtribRecord, priority: 'high' | 'normal', sidecar?: SubmissionSidecar): void; /** Get a cached proof bundle by record_hash. */ getProof(recordHash: string): ProofBundle | undefined; /** Flush all pending submissions (for testing/shutdown). */ flush(): Promise; } export interface SubmissionSidecar { authorizationEvidence?: unknown[]; resolvedFacts?: Record; args?: Record; result?: Record; } export interface ArchiveSubmissionOptions { /** Archive record-submission endpoint. Accepts either /v1 or /v1/records. */ endpoint: string; /** Per-request timeout for best-effort archive submission. Defaults to 5000. */ timeoutMs?: number; } export interface SubmissionQueueOptions { /** * Maximum number of records held in `pendingRecords` while the log is * unreachable. When this cap would be exceeded, the queue evicts the * oldest 'normal'-priority entry; if only 'high'-priority entries * remain, it evicts the oldest 'high'-priority entry. Eviction is * preferable to unbounded memory growth, the spec requires non-blocking * submission, and an OOM-killed wrapper drops EVERYTHING. * * Defaults to {@link DEFAULT_MAX_QUEUE_DEPTH}. Set to `Infinity` to * disable (only safe for tests and short-lived processes). */ maxQueueDepth?: number; /** * Optional record body archive submission. Disabled by default because it * sends the signed record body and selected verifier evidence outside the * producer's local mirror. When enabled, archive submission happens only * after the log accepts the record and returns an inclusion proof. */ archiveSubmission?: ArchiveSubmissionOptions; } export declare function createSubmissionQueue(logEndpoint?: string, options?: SubmissionQueueOptions): SubmissionQueue; //# sourceMappingURL=submission.d.ts.map