antechamber 2.0.7 → 2.0.9
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/CHANGELOG.md +14 -0
- package/dist/session-store.js +30 -2
- package/extensions/antechamber/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project uses [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.9] - 2026-11-19
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Two antechamber adapters starting at once on a new registry, or right after upgrading from `sessions.json`, no
|
|
15
|
+
longer fail with `Failed to persist session registry ... database is locked` or
|
|
16
|
+
`ENOENT ... sessions.json`. Switching a new registry to WAL now backs off and retries within the 5 s busy timeout,
|
|
17
|
+
a `sessions.json` another process already imported and renamed is no longer an error, and a process that opens
|
|
18
|
+
the registry while another imports `sessions.json` no longer finds it empty.
|
|
19
|
+
|
|
20
|
+
## [2.0.8] - 2026-11-19
|
|
21
|
+
|
|
22
|
+
- test(generation): watch for the release before logging the event a test waits on (#101)
|
|
23
|
+
|
|
10
24
|
## [2.0.7] - 2026-11-19
|
|
11
25
|
|
|
12
26
|
### Added
|
package/dist/session-store.js
CHANGED
|
@@ -533,6 +533,28 @@ function persistedEntry(entry) {
|
|
|
533
533
|
function errorCode(error) {
|
|
534
534
|
return error instanceof Error && "code" in error ? String(error.code) : undefined;
|
|
535
535
|
}
|
|
536
|
+
const REGISTRY_BUSY_TIMEOUT_MS = 5_000;
|
|
537
|
+
/**
|
|
538
|
+
* Connections switching a new file to WAL at the same time can deadlock, and SQLite then answers SQLITE_BUSY at once
|
|
539
|
+
* instead of running its busy handler (https://sqlite.org/c3ref/busy_handler.html). Do what that handler would: back
|
|
540
|
+
* off and try again within the same `busy_timeout`. Once one connection has switched the file, the rest find it in WAL.
|
|
541
|
+
*/
|
|
542
|
+
function enableWal(db) {
|
|
543
|
+
const deadline = Date.now() + REGISTRY_BUSY_TIMEOUT_MS;
|
|
544
|
+
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
545
|
+
for (;;) {
|
|
546
|
+
try {
|
|
547
|
+
db.exec("PRAGMA journal_mode = WAL;");
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
const busy = error instanceof Error && "errcode" in error && (Number(error.errcode) & 0xff) === 5;
|
|
552
|
+
if (!busy || Date.now() >= deadline)
|
|
553
|
+
throw error;
|
|
554
|
+
Atomics.wait(pause, 0, 0, 5 + Math.random() * 20);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
536
558
|
export class SessionStore {
|
|
537
559
|
stateDir;
|
|
538
560
|
file;
|
|
@@ -549,7 +571,9 @@ export class SessionStore {
|
|
|
549
571
|
if (this.db !== undefined)
|
|
550
572
|
return this.db;
|
|
551
573
|
const legacy = join(this.stateDir, "sessions.json");
|
|
552
|
-
|
|
574
|
+
// Legacy first: another process renames sessions.json away only after it has created the database, so whichever
|
|
575
|
+
// moment the second check runs, one of the two is there. The other order can miss both.
|
|
576
|
+
if (!write && !existsSync(legacy) && !existsSync(this.file))
|
|
553
577
|
return undefined;
|
|
554
578
|
let db;
|
|
555
579
|
try {
|
|
@@ -559,7 +583,8 @@ export class SessionStore {
|
|
|
559
583
|
closeSync(openSync(this.file, "a", REGISTRY_FILE_MODE));
|
|
560
584
|
chmodSync(this.file, REGISTRY_FILE_MODE);
|
|
561
585
|
db = new DatabaseSync(this.file);
|
|
562
|
-
db.exec(
|
|
586
|
+
db.exec(`PRAGMA busy_timeout = ${REGISTRY_BUSY_TIMEOUT_MS};`);
|
|
587
|
+
enableWal(db);
|
|
563
588
|
db.exec(`CREATE TABLE IF NOT EXISTS sessions (
|
|
564
589
|
id TEXT PRIMARY KEY, payload TEXT NOT NULL, pi_session_id TEXT NOT NULL,
|
|
565
590
|
directory TEXT NOT NULL, parent_id TEXT, has_task INTEGER NOT NULL
|
|
@@ -601,6 +626,9 @@ export class SessionStore {
|
|
|
601
626
|
return record(parsed) ? parsed : undefined;
|
|
602
627
|
}
|
|
603
628
|
catch (error) {
|
|
629
|
+
// Another process imported it and renamed it away after this one checked it was there.
|
|
630
|
+
if (errorCode(error) === "ENOENT")
|
|
631
|
+
return undefined;
|
|
604
632
|
if (!(error instanceof SyntaxError))
|
|
605
633
|
throw error;
|
|
606
634
|
// Preserve malformed JSON untouched; a later repair can still be imported.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antechamber-openchamber",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "OpenChamber extension for antechamber: installs and pins the antechamber server and OmO, draws the OmO Graph and the OmO Work section, and titles OmO tool cards",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|