@rizom/ops 0.2.0-alpha.475 → 0.2.0-alpha.477

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rizom/ops",
3
- "version": "0.2.0-alpha.475",
3
+ "version": "0.2.0-alpha.477",
4
4
  "description": "Operator CLI for managing private brain fleet registry repos",
5
5
  "keywords": [
6
6
  "brains",
@@ -210,11 +210,23 @@ function vectorDigestDatabase(database: Database): {
210
210
  sha256: string;
211
211
  } {
212
212
  const hasher = new Bun.CryptoHasher("sha256");
213
- const tables = [
214
- ["embeddings", "entity_id, entity_type"],
215
- ["embeddings_embedding_idx_shadow", "index_key"],
216
- ["libsql_vector_meta_shadow", "name"],
217
- ] as const;
213
+ // A vector index keeps its entries in libSQL shadow tables. They exist only
214
+ // while an index does: a retired index drops its own shadow table, and a
215
+ // database that never had one has neither. The embeddings rows always count.
216
+ const existing = new Set(
217
+ database
218
+ .query("SELECT name FROM sqlite_master WHERE type = 'table'")
219
+ .all()
220
+ .filter(isPlainRecord)
221
+ .map((row) => String(row["name"])),
222
+ );
223
+ const tables = (
224
+ [
225
+ ["embeddings", "entity_id, entity_type"],
226
+ ["embeddings_embedding_idx_shadow", "index_key"],
227
+ ["libsql_vector_meta_shadow", "name"],
228
+ ] as const
229
+ ).filter(([table]) => table === "embeddings" || existing.has(table));
218
230
  const counts: Record<string, number> = {};
219
231
  for (const [table, order] of tables) {
220
232
  hasher.update(`table:${table}\n`);