Add AI entry points, conf schema, and folder docs

ai_index.sh and ai_query.sh follow the usual conventions — fail-closed gate,
root check, lock, dry-run, status — with Node doing only the vector maths and
SQLite blobs, the same split api_cache_writer.sh uses for PHP.

AI_* and HOST*_OLLAMA_* land in both confs and both templates in this pass.
Everything ships off: AI_ENABLED false, every AI_ASSIST_* false, conf writes
disabled with an empty whitelist. Nothing in the ecosystem consults it.
This commit is contained in:
Gmer4Lfe
2026-08-02 01:21:24 -04:00
parent b00688bad1
commit 6a959fb5e4
7 changed files with 785 additions and 9 deletions
+9 -7
View File
@@ -122,13 +122,9 @@ async function buildIndex(opts) {
let chunks = [];
try { chunks = chunkFile(abs, rel); } catch (e) { continue; }
if (!chunks.length) {
if (db) {
db.prepare('DELETE FROM vv_chunks WHERE path = ?').run(rel);
db.prepare('INSERT OR REPLACE INTO vv_files VALUES (?,?,?,?)').run(rel, mtime, 0, now);
}
continue;
}
// A file that yields no chunks still gets a vv_files row so it is not re-chunked every
// run. Queued rather than written here, so every database change lands in the single
// commit below — a run interrupted mid-embed must leave the index exactly as it was.
pending.push({ rel, mtime, chunks });
}
@@ -166,6 +162,12 @@ async function buildIndex(opts) {
db.exec('BEGIN');
try {
for (const f of pending) {
// Nothing to index in this file at all — record it so it is not re-chunked next run.
if (!f.chunks.length) {
db.prepare('DELETE FROM vv_chunks WHERE path = ?').run(f.rel);
insF.run(f.rel, f.mtime, 0, now);
continue;
}
const embedded = f.chunks.filter(c => c.__vec);
// A file whose chunks all failed to embed keeps its previous rows and its old mtime,
// so the next run retries it rather than recording a half-indexed file as current.