@velvetmonkey/vault-core 2.0.152 → 2.0.154

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.
@@ -47,6 +47,10 @@ export function getStateDbPath(vaultPath) {
47
47
  export function initSchema(db) {
48
48
  // Enable WAL mode for better concurrent read performance
49
49
  db.pragma('journal_mode = WAL');
50
+ // Incremental auto-vacuum — reclaims freed pages without full VACUUM blocking.
51
+ // Only takes effect on new DBs (before first table). Existing DBs need a one-time
52
+ // VACUUM in openStateDb() to activate.
53
+ db.pragma('auto_vacuum = INCREMENTAL');
50
54
  // Enable foreign keys
51
55
  db.pragma('foreign_keys = ON');
52
56
  // Performance tuning
package/dist/sqlite.js CHANGED
@@ -50,6 +50,17 @@ export function openStateDb(vaultPath) {
50
50
  try {
51
51
  db = new Database(dbPath);
52
52
  initSchema(db);
53
+ // Enable incremental auto_vacuum on existing databases (one-time cost).
54
+ // New DBs get it from initSchema before tables are created, but existing
55
+ // DBs need a VACUUM to switch the file format.
56
+ if (!isNewDb) {
57
+ const autoVacuum = db.pragma('auto_vacuum', { simple: true });
58
+ if (autoVacuum === 0) {
59
+ console.error('[vault-core] Enabling incremental auto_vacuum (one-time VACUUM)');
60
+ db.pragma('auto_vacuum = INCREMENTAL');
61
+ db.exec('VACUUM');
62
+ }
63
+ }
53
64
  // If we just created a fresh DB but backup files exist, salvage from them
54
65
  if (isNewDb) {
55
66
  attemptSalvage(db, dbPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velvetmonkey/vault-core",
3
- "version": "2.0.152",
3
+ "version": "2.0.154",
4
4
  "description": "Shared vault utilities for Flywheel ecosystem (entity scanning, wikilinks, protected zones)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "engines": {
57
57
  "node": ">=22.0.0"
58
58
  },
59
- "license": "AGPL-3.0-only",
59
+ "license": "Apache-2.0",
60
60
  "files": [
61
61
  "dist",
62
62
  "data",