/** * Builds and validates immutable UTF-8 document source segments, then * reconstructs one bounded byte, line, or fragment page from authorized rows. * Source is materialized only from rows a storage adapter already selected. */ import type { DocumentRangeReadParams, DocumentRangeReadResult } from "../types/database.js"; import type { DocumentMetadata } from "../types/memory.js"; import type { Memory } from "../types/memory.js"; import type { Content, UUID } from "../types/primitives.js"; interface DocumentSourceMetadata extends DocumentMetadata, Record { source: string; sourceSegmentVersion?: 1; sourceSegmentCount?: number; sourceByteLength?: number; sourceLineCount?: number; sourceFragmentCount?: number; sourceSha256?: string; sourceFingerprint?: string; sourceStorage?: "inline" | "segments"; } export declare const DOCUMENT_SOURCE_SEGMENT_VERSION: 1; export declare const DOCUMENT_SOURCE_SEGMENT_MAX_BYTES: number; export declare const DOCUMENT_SOURCE_READ_MAX_SEGMENTS = 4; export declare const DOCUMENT_SOURCE_READ_LOOKAHEAD_SEGMENTS: number; export declare const DOCUMENT_PARENT_INLINE_MAX_BYTES: number; export interface DocumentSourceReadMetadata { documentRevision: number; revisionAttemptId?: string; sourceByteLength: number; sourceLineCount: number; sourceFragmentCount: number; sourceFingerprint: string; } export interface DocumentSourceProjection { metadata: Required>; segments: Memory[]; } export declare function projectDocumentParentContent(args: { text: string; projection: Pick; }): Content; export declare function buildDocumentSourceProjection(args: { text: string; documentId: UUID; agentId: UUID; roomId: UUID; entityId: UUID; worldId?: UUID; documentMetadata: DocumentSourceMetadata; }): DocumentSourceProjection; export declare function requireDocumentSourceReadMetadata(metadata: Record, documentId: UUID): DocumentSourceReadMetadata; export declare function readDocumentSourceProjection(args: { segments: Memory[]; params: Pick; parent: DocumentSourceReadMetadata; documentId: UUID; examinedSourceSegments?: number; sourceQueryCount: number; }): DocumentRangeReadResult; export {};