pi-mega-compact 0.20.77 → 0.20.79
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/extensions/dashboard-server/setup-cortex-actions-vc2.js +5 -2
- package/dist/src/queryExpansion.js +1 -0
- package/dist/src/store/sqlite/utils.js +7 -0
- package/dist/src/store/turns/connection.js +1 -1
- package/dist/src/vector-cortex/ledger/sqlite.js +1 -0
- package/dist/vector-cortex/ledger/sqlite.js +1 -0
- package/extensions/dashboard-server/setup-cortex-actions-vc2.ts +5 -2
- package/package.json +1 -1
- package/src/queryExpansion.ts +1 -0
- package/src/store/sqlite/utils.ts +7 -0
- package/src/store/turns/connection.ts +1 -1
- package/src/vector-cortex/ledger/sqlite.ts +1 -0
|
@@ -69,8 +69,11 @@ function download(url) {
|
|
|
69
69
|
res.statusCode < 400 &&
|
|
70
70
|
res.headers.location) {
|
|
71
71
|
res.resume();
|
|
72
|
-
// Follow a single redirect (HuggingFace CDN redirects).
|
|
73
|
-
|
|
72
|
+
// Follow a single redirect (HuggingFace CDN redirects). The Location
|
|
73
|
+
// header may be a RELATIVE path (e.g. /api/resolve-cache/...) — resolve
|
|
74
|
+
// it against the original URL so httpsGet never receives a bare path.
|
|
75
|
+
const redirected = new URL(res.headers.location, url).toString();
|
|
76
|
+
download(redirected).then(resolve, reject);
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
79
|
if (res.statusCode !== 200) {
|
|
@@ -157,6 +157,7 @@ function loadDb(stateDir) {
|
|
|
157
157
|
const { DatabaseSync } = require("node:sqlite");
|
|
158
158
|
const { join } = require("node:path");
|
|
159
159
|
const db = new DatabaseSync(join(stateDir, "mega-compact.db"));
|
|
160
|
+
db.exec("PRAGMA busy_timeout = 5000"); // tolerate concurrent-opener WAL contention (see store/sqlite/utils.ts)
|
|
160
161
|
db.exec("PRAGMA journal_mode=WAL");
|
|
161
162
|
_dbCache.set(stateDir, { db });
|
|
162
163
|
return { db };
|
|
@@ -71,6 +71,13 @@ export function openStore(stateDir = getStateDir()) {
|
|
|
71
71
|
if (!existsSync(stateDir))
|
|
72
72
|
mkdirSync(stateDir, { recursive: true });
|
|
73
73
|
const db = new DatabaseSync(join(stateDir, "sqlite.db"));
|
|
74
|
+
// busy_timeout BEFORE journal_mode/schema writes: with the default 0ms a
|
|
75
|
+
// second process opening this global DB while a live session holds a WAL
|
|
76
|
+
// write/recovery lock fails instantly with SQLITE_BUSY — the "Failed to load
|
|
77
|
+
// extension: database is locked" abort that kills child pi runs (e.g. agent
|
|
78
|
+
// dispatches). 5s grace waits out transient contention; connections.ts and
|
|
79
|
+
// global-index.ts already follow this.
|
|
80
|
+
db.exec("PRAGMA busy_timeout = 5000");
|
|
74
81
|
db.exec("PRAGMA journal_mode = WAL");
|
|
75
82
|
db.exec("PRAGMA foreign_keys = ON");
|
|
76
83
|
initSchema(db);
|
|
@@ -56,9 +56,9 @@ export function openTurnDb(stateDir, options) {
|
|
|
56
56
|
mkdirSync(stateDir, { recursive: true });
|
|
57
57
|
}
|
|
58
58
|
const db = new DatabaseSync(resolvedPath);
|
|
59
|
+
db.exec("PRAGMA busy_timeout = 5000");
|
|
59
60
|
db.exec("PRAGMA journal_mode = WAL");
|
|
60
61
|
db.exec("PRAGMA foreign_keys = ON");
|
|
61
|
-
db.exec("PRAGMA busy_timeout = 5000");
|
|
62
62
|
initTurnSchema(db);
|
|
63
63
|
// S49B: one-time move of legacy main-db turn tables into turns.db (idempotent,
|
|
64
64
|
// non-fatal). File-backed only; never runs for the in-memory test backend.
|
|
@@ -56,6 +56,7 @@ export function openOccurrenceStore(dbPath) {
|
|
|
56
56
|
if (!existsSync(dir))
|
|
57
57
|
mkdirSync(dir, { recursive: true });
|
|
58
58
|
const db = new DatabaseSync(dbPath);
|
|
59
|
+
db.exec("PRAGMA busy_timeout = 5000"); // tolerate concurrent-opener WAL contention (see store/sqlite/utils.ts)
|
|
59
60
|
db.exec("PRAGMA journal_mode = WAL");
|
|
60
61
|
db.exec("PRAGMA foreign_keys = ON");
|
|
61
62
|
db.exec(SCHEMA);
|
|
@@ -56,6 +56,7 @@ export function openOccurrenceStore(dbPath) {
|
|
|
56
56
|
if (!existsSync(dir))
|
|
57
57
|
mkdirSync(dir, { recursive: true });
|
|
58
58
|
const db = new DatabaseSync(dbPath);
|
|
59
|
+
db.exec("PRAGMA busy_timeout = 5000"); // tolerate concurrent-opener WAL contention (see store/sqlite/utils.ts)
|
|
59
60
|
db.exec("PRAGMA journal_mode = WAL");
|
|
60
61
|
db.exec("PRAGMA foreign_keys = ON");
|
|
61
62
|
db.exec(SCHEMA);
|
|
@@ -95,8 +95,11 @@ function download(url: string): Promise<Buffer> {
|
|
|
95
95
|
res.headers.location
|
|
96
96
|
) {
|
|
97
97
|
res.resume();
|
|
98
|
-
// Follow a single redirect (HuggingFace CDN redirects).
|
|
99
|
-
|
|
98
|
+
// Follow a single redirect (HuggingFace CDN redirects). The Location
|
|
99
|
+
// header may be a RELATIVE path (e.g. /api/resolve-cache/...) — resolve
|
|
100
|
+
// it against the original URL so httpsGet never receives a bare path.
|
|
101
|
+
const redirected = new URL(res.headers.location, url).toString();
|
|
102
|
+
download(redirected).then(resolve, reject);
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
105
|
if (res.statusCode !== 200) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.79",
|
|
4
4
|
"description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
package/src/queryExpansion.ts
CHANGED
|
@@ -200,6 +200,7 @@ function loadDb(stateDir: string): { db: import("node:sqlite").DatabaseSync } {
|
|
|
200
200
|
const { DatabaseSync } = require("node:sqlite") as typeof import("node:sqlite");
|
|
201
201
|
const { join } = require("node:path") as typeof import("node:path");
|
|
202
202
|
const db = new DatabaseSync(join(stateDir, "mega-compact.db"));
|
|
203
|
+
db.exec("PRAGMA busy_timeout = 5000"); // tolerate concurrent-opener WAL contention (see store/sqlite/utils.ts)
|
|
203
204
|
db.exec("PRAGMA journal_mode=WAL");
|
|
204
205
|
_dbCache.set(stateDir, { db });
|
|
205
206
|
return { db };
|
|
@@ -73,6 +73,13 @@ export function openStore(stateDir: string = getStateDir()): DatabaseSync {
|
|
|
73
73
|
|
|
74
74
|
if (!existsSync(stateDir)) mkdirSync(stateDir, { recursive: true });
|
|
75
75
|
const db = new DatabaseSync(join(stateDir, "sqlite.db"));
|
|
76
|
+
// busy_timeout BEFORE journal_mode/schema writes: with the default 0ms a
|
|
77
|
+
// second process opening this global DB while a live session holds a WAL
|
|
78
|
+
// write/recovery lock fails instantly with SQLITE_BUSY — the "Failed to load
|
|
79
|
+
// extension: database is locked" abort that kills child pi runs (e.g. agent
|
|
80
|
+
// dispatches). 5s grace waits out transient contention; connections.ts and
|
|
81
|
+
// global-index.ts already follow this.
|
|
82
|
+
db.exec("PRAGMA busy_timeout = 5000");
|
|
76
83
|
db.exec("PRAGMA journal_mode = WAL");
|
|
77
84
|
db.exec("PRAGMA foreign_keys = ON");
|
|
78
85
|
initSchema(db);
|
|
@@ -64,9 +64,9 @@ export function openTurnDb(
|
|
|
64
64
|
mkdirSync(stateDir, { recursive: true });
|
|
65
65
|
}
|
|
66
66
|
const db = new DatabaseSync(resolvedPath);
|
|
67
|
+
db.exec("PRAGMA busy_timeout = 5000");
|
|
67
68
|
db.exec("PRAGMA journal_mode = WAL");
|
|
68
69
|
db.exec("PRAGMA foreign_keys = ON");
|
|
69
|
-
db.exec("PRAGMA busy_timeout = 5000");
|
|
70
70
|
initTurnSchema(db);
|
|
71
71
|
// S49B: one-time move of legacy main-db turn tables into turns.db (idempotent,
|
|
72
72
|
// non-fatal). File-backed only; never runs for the in-memory test backend.
|
|
@@ -74,6 +74,7 @@ export function openOccurrenceStore(dbPath: string): DatabaseSync {
|
|
|
74
74
|
const dir = dirname(dbPath);
|
|
75
75
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
76
76
|
const db = new DatabaseSync(dbPath);
|
|
77
|
+
db.exec("PRAGMA busy_timeout = 5000"); // tolerate concurrent-opener WAL contention (see store/sqlite/utils.ts)
|
|
77
78
|
db.exec("PRAGMA journal_mode = WAL");
|
|
78
79
|
db.exec("PRAGMA foreign_keys = ON");
|
|
79
80
|
db.exec(SCHEMA);
|