/** * @fileoverview Wire-shape types for the catalog JSON export consumed * by opensip's substrate ingestor (Phase 5). * * The wire format bridges the engine's per-run `Catalog` + edge output * to opensip's `tenant.code_symbols` + `tenant.code_edges` row shapes. * Field set on this wire matches opensip's Drizzle column declarations * verbatim, minus two derived fields: * * - `tenantId` — provenance-level (same for every row in a run); * carried in `CatalogExportProvenance.tenantId`. * - `indexedAt` — Postgres `DEFAULT NOW()` on the substrate side; * engine doesn't emit it. * * `id` is pre-computed by the engine using `deriveOpenSipSymbolId` / * `deriveOpenSipEdgeId` (Task 3.2) so re-ingestion via * `INSERT … ON CONFLICT DO UPDATE` collides byte-for-byte with rows * already in the substrate. * * Phase 3 Task 3.1 per DEC-498. */ /** * Single symbol row on the wire — maps 1:1 to a `tenant.code_symbols` * row in opensip's Drizzle schema * (`packages/db-schemas/src/code-graph/code-symbols.ts`). */ export interface CatalogExportSymbol { /** sha256 over `(repoId, modulePath, kind, qualifiedName, arity)`. */ readonly id: string; readonly repoId: string; readonly kind: string; readonly language: string; readonly qualifiedName: string; readonly modulePath: string; /** `null` for symbols without an arity concept (e.g., modules, classes). */ readonly arity: number | null; readonly filePath: string; readonly startLine: number; readonly endLine: number; readonly isExported: boolean; /** Optional — adapters that produce signatures populate; others omit. */ readonly signature?: string | null; /** Optional — JSDoc / docstring extraction (if adapter supports). */ readonly docSummary?: string | null; /** Commit SHA the symbol was extracted from. Same value across all * rows from one run (matches `provenance.runId` 1:1). */ readonly gitSha: string; } /** * Single edge row on the wire — maps 1:1 to a `tenant.code_edges` row * in opensip's Drizzle schema * (`packages/db-schemas/src/code-graph/code-edges.ts`). */ export interface CatalogExportEdge { /** sha256 over `(fromSymbolId, edgeKind, toSymbolId | unresolved-qname)`. */ readonly id: string; readonly repoId: string; /** One of: `calls`, `depends_on`, `creation`. Other kinds the * pre-consolidation indexer emitted (`contains`, `inherits_from`, * `implements`, `has_argument`) are implicitly narrowed away by * this consolidation per DEC-498. */ readonly edgeKind: string; readonly fromSymbolId: string; /** `null` when the call/dependency target couldn't be resolved to a * same-repo symbol; `toQualifiedNameUnresolved` carries the * best-effort qname in that case. */ readonly toSymbolId: string | null; /** `null` when `toSymbolId` is populated; non-null otherwise. */ readonly toQualifiedNameUnresolved: string | null; readonly sourceFile: string; readonly sourceLine: number | null; readonly gitSha: string; } /** * Per-run metadata. Carries the partial/complete completeness signal * required by Phase 5's ingestor to differentiate full re-index from * incremental delta passes that may have aborted mid-walk. */ export interface CatalogExportProvenance { /** UUID generated by the engine entry point; flows through every * log / span as `opensip.run_id`. */ readonly runId: string; /** `'complete'` when the engine pass walked the full input set AND the * catalog reflects every discovered file; `'partial'` when the pass was * cut short (memory pressure / abort) OR the completed pass dropped * discovered files (unparseable sources, malformed adapter paths — see * `Catalog.buildCoverage`). Phase 5 may filter on this. */ readonly completeness: 'partial' | 'complete'; /** Engine package version (e.g., `'1.0.0'`) — provenance for the * derivation algorithm. If a future engine release changes the * symbol-ID hashing, the version bump documents the substrate * cutover boundary. */ readonly engineVersion: string; /** ISO 8601 timestamp the engine pass started. */ readonly startedAt: string; /** ISO 8601 timestamp the engine pass completed. `null` only when the * pass itself was cut short — a completed pass with partial coverage * (dropped parse files) still carries its real completion time. */ readonly completedAt: string | null; /** Tenant scope for every row in this export. */ readonly tenantId: string; } /** * Top-level wire document. JSON-encoded; written to a file by the * engine CLI (`--render catalog-json --output `) because the * shape exceeds practical stdout buffer sizes on 100k-file repos. */ export interface CatalogExport { /** Wire-format version — bump on breaking changes; opensip ingestor * asserts. */ readonly version: '1.0'; readonly provenance: CatalogExportProvenance; readonly symbols: readonly CatalogExportSymbol[]; readonly edges: readonly CatalogExportEdge[]; } //# sourceMappingURL=catalog-json-types.d.ts.map