export declare const METADATA_TABLE_SQL = "\n CREATE TABLE IF NOT EXISTS metadata (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n );\n"; export declare const CORE_TABLES_SQL = "\n CREATE TABLE IF NOT EXISTS files (\n file TEXT PRIMARY KEY,\n lang TEXT NOT NULL,\n mtime_ms INTEGER NOT NULL,\n -- Phase 2: xxHash64 of the file's UTF-8 bytes. Empty string when the\n -- indexer hasn't populated it yet (legacy rows, schema repaired by\n -- repairMissingColumns). Compared on incremental re-index so that a\n -- touch or branch-switch that leaves content byte-identical skips the\n -- expensive parse phase entirely (refactoring proposal Phase 2).\n content_hash TEXT NOT NULL DEFAULT '',\n symbol_count INTEGER NOT NULL DEFAULT 0,\n last_indexed INTEGER NOT NULL,\n -- Code Atlas grouping label, computed at index time from the ecosystem's\n -- own manifests (package.json, go.mod, Cargo.toml, \u2026). Stored rather than\n -- re-derived per query because the evidence lives on disk, not in the DB.\n package TEXT NOT NULL DEFAULT ''\n );\n CREATE TABLE IF NOT EXISTS symbols (\n id INTEGER PRIMARY KEY,\n lang TEXT NOT NULL,\n kind TEXT NOT NULL,\n name TEXT NOT NULL,\n file TEXT NOT NULL,\n line INTEGER NOT NULL,\n col INTEGER NOT NULL,\n signature TEXT NOT NULL DEFAULT '',\n doc_comment TEXT NOT NULL DEFAULT '',\n scope TEXT NOT NULL DEFAULT ''\n );\n"; export declare const FILE_INDEX_SQL: readonly ['CREATE INDEX IF NOT EXISTS idx_f_package ON files(package)']; export declare const SYMBOL_INDEX_SQL: readonly ['CREATE INDEX IF NOT EXISTS idx_s_name ON symbols(name)', 'CREATE INDEX IF NOT EXISTS idx_s_kind ON symbols(kind)', 'CREATE INDEX IF NOT EXISTS idx_s_lang ON symbols(lang)', 'CREATE INDEX IF NOT EXISTS idx_s_file ON symbols(file)', 'CREATE INDEX IF NOT EXISTS idx_s_lang_kind ON symbols(lang, kind)', 'CREATE INDEX IF NOT EXISTS idx_s_name_id ON symbols(name, id)']; export declare const REFS_TABLE_SQL = "\n CREATE TABLE IF NOT EXISTS refs (\n id INTEGER PRIMARY KEY,\n from_id INTEGER NOT NULL,\n to_name TEXT NOT NULL,\n to_id INTEGER,\n call_type TEXT NOT NULL,\n line INTEGER NOT NULL,\n lang TEXT NOT NULL DEFAULT '',\n module TEXT,\n to_file TEXT\n );\n"; export declare const REFS_INDEX_SQL: readonly ['CREATE INDEX IF NOT EXISTS idx_r_from ON refs(from_id)', 'CREATE INDEX IF NOT EXISTS idx_r_to_id ON refs(to_id)', 'CREATE INDEX IF NOT EXISTS idx_r_to_name ON refs(to_name)', 'CREATE INDEX IF NOT EXISTS idx_r_call_type ON refs(call_type)', 'CREATE INDEX IF NOT EXISTS idx_r_to_name_lang ON refs(to_name, lang)', 'CREATE INDEX IF NOT EXISTS idx_r_module ON refs(module)', 'CREATE INDEX IF NOT EXISTS idx_r_to_file ON refs(to_file)']; /** * Static `lang → family` mirror of {@link LANG_FAMILY_ENTRIES}, so ref * resolution can scope a match to one language family with a join rather than * binding a per-family IN-list into every statement. * * Row `('', '*')` is the wildcard for refs written without a language (older * rows, and tests that construct refs by hand): they keep resolving globally. */ export declare const LANG_FAMILY_TABLE_SQL = "\n CREATE TABLE IF NOT EXISTS lang_family (\n lang TEXT PRIMARY KEY,\n family TEXT NOT NULL\n );\n"; /** Family value that matches every symbol family, used by language-less refs. */ export declare const LANG_FAMILY_WILDCARD = "*"; export declare const SYMBOLS_FTS_SQL = "CREATE VIRTUAL TABLE IF NOT EXISTS symbols_fts USING fts5(text, tokenize = 'trigram')"; /** * Graph centrality, computed at index time by `graph-rank.ts` once every ref * has its final `to_id` / `to_file`. Two tables rather than columns on * `symbols` / `files` so the whole layer is additive: an index written by an * older build simply has empty rank tables, and `SCHEMA_VERSION` stays put * (a bump drops and rebuilds the entire index — see `initIndexSchema`). * * `rank` is max-normalised to 1.0 across the run, so scores are comparable * within one index but never across two. */ export declare const RANK_TABLES_SQL = "\n CREATE TABLE IF NOT EXISTS symbol_rank (\n symbol_id INTEGER PRIMARY KEY,\n rank REAL NOT NULL,\n in_deg INTEGER NOT NULL DEFAULT 0,\n out_deg INTEGER NOT NULL DEFAULT 0\n );\n CREATE TABLE IF NOT EXISTS file_rank (\n file TEXT PRIMARY KEY,\n rank REAL NOT NULL,\n in_deg INTEGER NOT NULL DEFAULT 0,\n out_deg INTEGER NOT NULL DEFAULT 0\n );\n"; export declare const RANK_INDEX_SQL: readonly ['CREATE INDEX IF NOT EXISTS idx_sr_rank ON symbol_rank(rank DESC)', 'CREATE INDEX IF NOT EXISTS idx_fr_rank ON file_rank(rank DESC)']; /** * Concept layer — plain-English descriptions of what code is *for*, which the * structural index cannot express. Symbol names and signatures answer "what is * declared"; they cannot answer "where do we back off after a 429". * * Populated by an optional, explicitly enabled LLM pass. Additive like the rank * tables: an index without the pass simply has empty concept tables, and every * consumer treats a missing summary as "not described yet" rather than an error. * * `content_hash` mirrors `files.content_hash`, and is the cache key that keeps * the pass affordable — a file whose bytes have not changed is never re-sent to * a model. `state` distinguishes a summary that matches the current bytes * (`ready`) from one describing an older version (`stale`, still useful as a * hint) and one not yet produced (`pending`). * * `crux_start`/`crux_end` point at the few lines that actually carry the file's * meaning. A summary can drift from the truth; a pointer into the source cannot. */ export declare const CONCEPT_TABLES_SQL = "\n CREATE TABLE IF NOT EXISTS file_concepts (\n file TEXT PRIMARY KEY,\n content_hash TEXT NOT NULL DEFAULT '',\n summary TEXT NOT NULL DEFAULT '',\n crux_start INTEGER,\n crux_end INTEGER,\n state TEXT NOT NULL DEFAULT 'pending',\n model TEXT NOT NULL DEFAULT '',\n updated_at INTEGER NOT NULL DEFAULT 0\n );\n CREATE TABLE IF NOT EXISTS subsystems (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n summary TEXT NOT NULL DEFAULT '',\n member_files TEXT NOT NULL DEFAULT '[]',\n model TEXT NOT NULL DEFAULT '',\n updated_at INTEGER NOT NULL DEFAULT 0\n );\n CREATE TABLE IF NOT EXISTS concept_edges (\n from_id TEXT NOT NULL,\n to_id TEXT NOT NULL,\n relation TEXT NOT NULL,\n PRIMARY KEY (from_id, to_id, relation)\n );\n"; /** * Semantic embeddings, one per file. * * **Per file, not per symbol.** Embedding a bare signature — `function * resolve(id: string): Widget` — captures almost nothing a lexical index does * not already have. What carries meaning is the concept layer's description of * what the file is *for*, so that is what gets embedded. It is also eight * times cheaper on this repository: 8k files against 66k symbols. * * `source_hash` is a hash of the exact text that was embedded, so a changed * summary re-embeds and an unchanged one never does. `provider` records which * model produced the vector; vectors from a different model are not comparable, * so a provider change invalidates the whole table rather than silently mixing * two vector spaces. * * Separate from `symbol_vectors`, which stores the older synchronous * char-trigram vectors and stays behind its own gate. */ export declare const FILE_VECTORS_TABLE_SQL = "\n CREATE TABLE IF NOT EXISTS file_vectors (\n file TEXT PRIMARY KEY,\n vector BLOB NOT NULL,\n source_hash TEXT NOT NULL DEFAULT '',\n provider TEXT NOT NULL DEFAULT ''\n );\n"; export declare const CONCEPT_INDEX_SQL: readonly ['CREATE INDEX IF NOT EXISTS idx_fc_state ON file_concepts(state)', 'CREATE INDEX IF NOT EXISTS idx_ce_from ON concept_edges(from_id)']; /** * Phase 3: stores 384-dimensional float32 embedding vectors for each symbol. * Vectors are computed from the symbol's indexable text (name + signature + * doc_comment) via the character n-gram hashing embedding in vector-search.ts. * One row per symbol, kept in sync via insertSymbols, delete, and clearAll. */ export declare const SYMBOL_VECTORS_TABLE_SQL = "\n CREATE TABLE IF NOT EXISTS symbol_vectors (\n symbol_id INTEGER PRIMARY KEY,\n vector BLOB NOT NULL,\n FOREIGN KEY (symbol_id) REFERENCES symbols(id) ON DELETE CASCADE\n );\n"; //# sourceMappingURL=writer-schema.d.ts.map