/** * Summary of a segment stored in the collection head. * Enables targeted queries without downloading all segments. */ export interface SegmentSummary { id: string; ipfsCid?: string; pieceCid?: string; sourceTypes: string[]; timeRange?: { from: string; to: string; }; repoIds?: string[]; chunkCount: number; } /** * Record of a single CAR bundle upload to FOC. * Links one PieceCID to the segment IDs it contains. */ export interface BatchRecord { pieceCid: string; carRootCid: string; segmentIds: string[]; createdAt: string; } /** Artifact role classification for collection publication */ export type ArtifactRole = "source" | "segment" | "revision" | "descriptor"; /** Compact artifact index entry stored inside a CollectionRevision */ export interface ArtifactSummaryEntry { artifactId: string; artifactRole: ArtifactRole; sourceScope: string; /** IPFS CID for FOC-backed artifacts, SHA-256 hex for local */ contentIdentity: string; storageId: string; ipfsCid?: string; pieceCid?: string; } /** Minimal metadata stored on FOC datasets — routing only */ export interface DatasetRoutingMetadata { collectionId: string; artifactKind: string; sourceNamespace: string; indexingFlags: Record; } /** PROV-inspired provenance record for collection publication */ export interface ProvenanceRecord { artifactId: string; artifactKind: string; derivedFrom: string[]; primarySource?: string; activityId: string; activityType: string; actorId: string; actorType: string; revisionOf?: string; derivationChain: string[]; } /** * Stable identity record for a collection. * Created once, referenced by all heads and revisions. */ export interface CollectionDescriptor { schemaVersion: number; collectionId: string; name: string; storageNamespace: string; datasetId?: string; createdAt: string; createdBy: string; routingMetadata: DatasetRoutingMetadata; } /** A noise category from LLM summarization of unclustered chunks. */ export interface NoiseCategory { name: string; count: number; description: string; } /** Persisted theme clustering results. Travels with the manifest CID. */ export interface ThemeSnapshot { /** Cosine similarity threshold used */ threshold: number; /** Cluster data (id, label, exemplarIds, memberIds, size) */ clusters: Array<{ id: string; label: string; exemplarIds: string[]; memberIds: string[]; size: number; }>; /** Chunk IDs that didn't fit any cluster */ noise: string[]; /** LLM-generated noise breakdown (empty if no LLM was used) */ noiseCategories: NoiseCategory[]; /** Total chunks processed (after filtering) */ totalProcessed: number; /** How many config/boilerplate chunks were filtered out */ filteredConfigChunks: number; /** Whether LLM was used for labeling */ llmLabeled: boolean; /** LLM model used for labeling (undefined if heuristic-only) */ llmModel?: string; /** LLM endpoint base URL used (undefined if heuristic-only) */ llmBaseUrl?: string; /** When this snapshot was computed */ computedAt: string; } /** * Collection Head — the single mutable pointer for a collection. * Evolved from HeadManifest. Carries both ingest summary data * and a pointer to the current immutable CollectionRevision. * * Schema v1 redefined in place — no external consumers to break. */ /** * Summary of an immutable derived-edge layer stored alongside segments. * Each extract-edges run produces one layer. Mount merges all layers with * base segment edges. Layers survive reindex/reingest. */ export interface DerivedEdgeLayerSummary { /** Storage ID of the layer blob */ id: string; /** IPFS CID when the layer blob has been published to a CID-capable backend (FOC). */ ipfsCid?: string; /** Identifier of the extractor(s) that produced this layer (e.g. "regex", "tree-sitter", "llm-") */ extractorId: string; /** Number of edges in this layer */ edgeCount: number; /** When this layer was created */ createdAt: string; /** Contexts processed in this extraction run */ contextsProcessed: number; } /** * Every publishable artifact that must travel with a collection for full-fidelity * pull. This is the canonical publication index — once populated, pull can fully * reconstruct the collection by walking this list. Adding a new collection artifact * type without extending this union breaks `switch`+`assertNever` handlers in * promote and pull. * * Design notes: * - `storageId` is the local content-addressed id (reproducible from bytes). * - `ipfsCid` is the CID returned by the target storage backend's upload. * - Sidecars are JSON documents that live in `manifestDir`, not in storage — * modelled by role + the content-addressed `sha256` of their bytes. * - `byteLength` is recorded for integrity checks on pull. */ export type PublishedArtifactRef = { kind: "segment"; storageId: string; ipfsCid: string; byteLength: number; } | { kind: "derived-edge-layer"; storageId: string; ipfsCid: string; extractorId: string; edgeCount: number; byteLength: number; } | { kind: "raw-source-blob"; storageId: string; ipfsCid: string; documentId: string; documentVersionId: string; byteLength: number; sha256: string; } | { kind: "sidecar"; role: PublishedSidecarRole; ipfsCid: string; byteLength: number; sha256: string; }; export type PublishedArtifactKind = PublishedArtifactRef["kind"]; export type PublishedSidecarRole = "raw-source-index" | "document-catalog"; export interface CollectionHead { schemaVersion: number; collectionId: string; name: string; /** Human-readable summary of what this collection contains, surfaced to AI agents for discoverability */ description?: string; currentRevisionId: string | null; prevHeadId: string | null; segments: SegmentSummary[]; totalChunks: number; embeddingModel: string; embeddingDimensions: number; createdAt: string; updatedAt: string; batches?: BatchRecord[]; /** Persisted theme clustering results */ themes?: ThemeSnapshot; /** Immutable derived-edge layers from extract-edges runs. Each layer is a stored blob of Edge[]. */ derivedEdgeLayers?: DerivedEdgeLayerSummary[]; /** * Complete index of every artifact published alongside this manifest. Present * on collections that have been promoted to a CID-capable backend. Pull uses * this to retrieve every artifact required for a full-fidelity local copy * (segments, derived edge layers, raw-source blobs, raw-source index sidecar, * document-catalog sidecar). Absent on never-promoted local collections and * on collections promoted by older (pre-self-containment) code paths — pull * falls back to segments-only retrieval in that case. */ artifactRefs?: PublishedArtifactRef[]; } /** * @deprecated Use CollectionHead instead. Alias kept for migration. */ export type HeadManifest = CollectionHead; /** * Immutable record of one published state of a collection. * Each revision references the segments and bundles it covers * and carries compact artifact summaries for diff workflows. */ export interface CollectionRevision { schemaVersion: number; revisionId: string; collectionId: string; prevRevisionId: string | null; artifactSummaries: ArtifactSummaryEntry[]; /** SegmentSummary.id values from the merged spec 010 schema */ segmentRefs: string[]; /** BatchRecord.carRootCid values when batch records exist */ bundleRefs: string[]; provenance: ProvenanceRecord[]; createdAt: string; publishedBy: string; } /** * A segment blob — immutable, write-once batch of chunks with * embeddings and edges. Uploaded to storage once, referenced * by the collection head. */ export interface Segment { schemaVersion: number; embeddingModel: string; embeddingDimensions: number; chunks: Array<{ id: string; storageId: string; content: string; embedding: number[]; terms: string[]; source: string; sourceType: string; sourceUrl?: string; timestamp?: string; /** Semantic of `timestamp` — see `TimestampKind` in schemas/chunk.ts (#280). */ timestampKind?: import("./chunk.js").TimestampKind; metadata: Record; signalScores?: Record; /** Stable logical key for the source document */ documentId?: string; /** Version token for this version of the document */ documentVersionId?: string; /** SHA-256 of content — for compute dedup across versions */ contentFingerprint?: string; }>; edges: Array<{ type: string; sourceId: string; targetType: string; targetId: string; evidence: string; confidence: number; provenance?: string[]; structuredEvidence?: import("./chunk.js").StructuredEvidence; }>; } //# sourceMappingURL=manifest.d.ts.map