instar 1.2.25 → 1.2.26
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/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +43 -5
- package/dist/commands/server.js.map +1 -1
- package/dist/utils/resolveNodeBinary.d.ts +71 -0
- package/dist/utils/resolveNodeBinary.d.ts.map +1 -0
- package/dist/utils/resolveNodeBinary.js +152 -0
- package/dist/utils/resolveNodeBinary.js.map +1 -0
- package/package.json +1 -1
- package/scripts/fix-better-sqlite3.cjs +24 -5
- package/scripts/resolve-node-binary.cjs +119 -0
- package/src/data/builtin-manifest.json +2 -2
- package/upgrades/1.2.26.md +51 -0
- package/upgrades/side-effects/fix-heal-execpath-staleness.md +92 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiqDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA68KtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -69,6 +69,7 @@ import { AutonomousEvolution } from '../core/AutonomousEvolution.js';
|
|
|
69
69
|
import { DispatchScopeEnforcer } from '../core/DispatchScopeEnforcer.js';
|
|
70
70
|
import { TrustRecovery } from '../core/TrustRecovery.js';
|
|
71
71
|
import { DegradationReporter } from '../monitoring/DegradationReporter.js';
|
|
72
|
+
import { resolveStableNodeBinary } from '../utils/resolveNodeBinary.js';
|
|
72
73
|
import { SelfKnowledgeTree } from '../knowledge/SelfKnowledgeTree.js';
|
|
73
74
|
import { CoverageAuditor } from '../knowledge/CoverageAuditor.js';
|
|
74
75
|
import { LiveConfig } from '../config/LiveConfig.js';
|
|
@@ -1549,12 +1550,37 @@ async function ensureSqliteBindings() {
|
|
|
1549
1550
|
if (!isBindingError)
|
|
1550
1551
|
return false; // Not a binding issue — let subsystems handle it.
|
|
1551
1552
|
console.log(pc.yellow(' better-sqlite3: native binding mismatch detected — auto-rebuilding for current Node.js version...'));
|
|
1553
|
+
// Heal-execpath-staleness fix: resolve a stable Node binary BEFORE spawning.
|
|
1554
|
+
// When Homebrew (or any package manager) updates Node mid-session, the
|
|
1555
|
+
// running process holds an FD to the original binary so it keeps executing,
|
|
1556
|
+
// but spawnSync(process.execPath, …) returns ENOENT because the file is
|
|
1557
|
+
// gone from disk. Observed live on luna 2026-05-21. See src/utils/resolveNodeBinary.ts.
|
|
1558
|
+
const resolved = resolveStableNodeBinary();
|
|
1559
|
+
if (!resolved) {
|
|
1560
|
+
const recoveryHint = 'No working Node.js binary found at process.execPath or any fallback ' +
|
|
1561
|
+
'(/opt/homebrew/bin/node, /usr/local/bin/node, /usr/bin/node, PATH). ' +
|
|
1562
|
+
'This typically means Node was uninstalled or moved while the server ' +
|
|
1563
|
+
'was running. Reinstall Node, then restart the agent.';
|
|
1564
|
+
console.log(pc.yellow(` better-sqlite3: ${recoveryHint}`));
|
|
1565
|
+
DegradationReporter.getInstance().report({
|
|
1566
|
+
feature: 'ensureSqliteBindings.nodeBinaryResolution',
|
|
1567
|
+
primary: 'Locate a working Node.js binary to run the better-sqlite3 rebuild',
|
|
1568
|
+
fallback: 'Rebuild skipped — SQLite subsystems will degrade until operator restores Node',
|
|
1569
|
+
reason: `Why: process.execPath (${process.execPath}) is ENOENT and no fallback resolved`,
|
|
1570
|
+
impact: recoveryHint,
|
|
1571
|
+
});
|
|
1572
|
+
return false;
|
|
1573
|
+
}
|
|
1574
|
+
const spawnNode = resolved.path;
|
|
1575
|
+
if (spawnNode !== process.execPath) {
|
|
1576
|
+
console.log(pc.dim(` better-sqlite3: process.execPath (${process.execPath}) unreachable; using ${resolved.source} fallback at ${spawnNode}`));
|
|
1577
|
+
}
|
|
1552
1578
|
try {
|
|
1553
1579
|
// Use the bundled fix script which downloads correct prebuilds from GitHub.
|
|
1554
1580
|
// This is more reliable than `npm rebuild` which fails with pnpm/asdf installs.
|
|
1555
1581
|
const fixScript = path.resolve(__dirname, '../../../scripts/fix-better-sqlite3.cjs');
|
|
1556
1582
|
if (fs.existsSync(fixScript)) {
|
|
1557
|
-
execFileSync(
|
|
1583
|
+
execFileSync(spawnNode, [fixScript], { encoding: 'utf-8', timeout: 60000, stdio: 'pipe' });
|
|
1558
1584
|
}
|
|
1559
1585
|
else {
|
|
1560
1586
|
// Fallback: npm rebuild in the directory containing better-sqlite3.
|
|
@@ -1565,7 +1591,7 @@ async function ensureSqliteBindings() {
|
|
|
1565
1591
|
const instarDir = path.resolve(__dirname, '../../..');
|
|
1566
1592
|
const shadowBs3 = path.join(instarDir, 'node_modules', 'better-sqlite3');
|
|
1567
1593
|
if (fs.existsSync(shadowBs3)) {
|
|
1568
|
-
execFileSync(
|
|
1594
|
+
execFileSync(spawnNode, [npmCli, 'rebuild', 'better-sqlite3'], {
|
|
1569
1595
|
cwd: instarDir,
|
|
1570
1596
|
encoding: 'utf-8',
|
|
1571
1597
|
timeout: 60000,
|
|
@@ -1573,8 +1599,8 @@ async function ensureSqliteBindings() {
|
|
|
1573
1599
|
});
|
|
1574
1600
|
}
|
|
1575
1601
|
else {
|
|
1576
|
-
const globalInstarDir = execFileSync(
|
|
1577
|
-
execFileSync(
|
|
1602
|
+
const globalInstarDir = execFileSync(spawnNode, [npmCli, 'root', '-g'], { encoding: 'utf-8', timeout: 10000 }).toString().trim() + '/instar';
|
|
1603
|
+
execFileSync(spawnNode, [npmCli, 'rebuild', 'better-sqlite3'], {
|
|
1578
1604
|
cwd: globalInstarDir,
|
|
1579
1605
|
encoding: 'utf-8',
|
|
1580
1606
|
timeout: 60000,
|
|
@@ -1586,7 +1612,19 @@ async function ensureSqliteBindings() {
|
|
|
1586
1612
|
return true; // Restart needed — ESM cache holds the stale failure
|
|
1587
1613
|
}
|
|
1588
1614
|
catch (rebuildErr) {
|
|
1589
|
-
|
|
1615
|
+
const rebuildMsg = rebuildErr instanceof Error ? rebuildErr.message : String(rebuildErr);
|
|
1616
|
+
console.log(pc.yellow(` better-sqlite3: rebuild failed (${rebuildMsg}). SQLite subsystems may degrade.`));
|
|
1617
|
+
DegradationReporter.getInstance().report({
|
|
1618
|
+
feature: 'ensureSqliteBindings.rebuildFailed',
|
|
1619
|
+
primary: 'Rebuild better-sqlite3 native bindings for the current Node.js version',
|
|
1620
|
+
fallback: 'SQLite subsystems (SemanticMemory, TopicMemory, FeatureRegistry) will degrade until rebuild succeeds',
|
|
1621
|
+
reason: `Why: ${rebuildMsg}`,
|
|
1622
|
+
impact: 'The agent is running but its knowledge graph, conversation summaries, and ' +
|
|
1623
|
+
'related sqlite-backed subsystems are offline. The most common cause is a ' +
|
|
1624
|
+
'Node upgrade landed after the server started. Restart the agent to pick up ' +
|
|
1625
|
+
'the rebuilt binding; if rebuild itself keeps failing, run `npx instar update` ' +
|
|
1626
|
+
'or reinstall the agent.',
|
|
1627
|
+
});
|
|
1590
1628
|
return false;
|
|
1591
1629
|
}
|
|
1592
1630
|
}
|