@rizom/ops 0.2.0-alpha.476 → 0.2.0-alpha.478
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/dist/brains-ops.js +171 -171
- package/dist/index.js +174 -174
- package/package.json +1 -1
- package/templates/rover-pilot/deploy/scripts/create-predeploy-backup.ts +17 -5
package/package.json
CHANGED
|
@@ -210,11 +210,23 @@ function vectorDigestDatabase(database: Database): {
|
|
|
210
210
|
sha256: string;
|
|
211
211
|
} {
|
|
212
212
|
const hasher = new Bun.CryptoHasher("sha256");
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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`);
|