@agent-deck/cli 1.11.3 → 1.11.5
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/node-runtime.d.ts +13 -4
- package/dist/node-runtime.d.ts.map +1 -1
- package/dist/node-runtime.js +83 -7
- package/dist/node-runtime.js.map +1 -1
- package/package.json +3 -3
package/dist/node-runtime.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
export declare function getNodeMajor(): number;
|
|
2
2
|
export declare function formatNodeVersionError(): string;
|
|
3
3
|
export declare function isSupportedNodeMajor(major?: number): boolean;
|
|
4
|
-
|
|
5
|
-
export declare function verifySqliteNative(): {
|
|
6
|
-
ok: true;
|
|
7
|
-
} | {
|
|
4
|
+
interface SqliteFailure {
|
|
8
5
|
ok: false;
|
|
9
6
|
reason: string;
|
|
10
7
|
message: string;
|
|
8
|
+
}
|
|
9
|
+
type DatabaseCtor = new (filename: string) => {
|
|
10
|
+
close(): void;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Same probe as `probeSqliteNative`, but an ABI mismatch gets one automatic
|
|
14
|
+
* `npm rebuild` before being reported as a failure — see `attemptSqliteRebuild`.
|
|
15
|
+
* `loadDatabaseCtor` is a test seam; production callers never pass it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function verifySqliteNative(loadDatabaseCtor?: () => DatabaseCtor): {
|
|
18
|
+
ok: true;
|
|
19
|
+
} | SqliteFailure;
|
|
12
20
|
export interface PreflightFailure {
|
|
13
21
|
/** One line, for supervisor.log and `agent-deck status`. */
|
|
14
22
|
reason: string;
|
|
@@ -21,4 +29,5 @@ export interface PreflightFailure {
|
|
|
21
29
|
* and `agent-deck status` too, not only on the terminal that invoked it.
|
|
22
30
|
*/
|
|
23
31
|
export declare function checkStartPreflight(): PreflightFailure | null;
|
|
32
|
+
export {};
|
|
24
33
|
//# sourceMappingURL=node-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-runtime.d.ts","sourceRoot":"","sources":["../src/node-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-runtime.d.ts","sourceRoot":"","sources":["../src/node-runtime.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAc/C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,SAAiB,GAAG,OAAO,CAEpE;AAgDD,UAAU,aAAa;IACrB,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,YAAY,GAAG,KAAK,QAAQ,EAAE,MAAM,KAAK;IAAE,KAAK,IAAI,IAAI,CAAA;CAAE,CAAC;AA4DhE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,GAAE,MAAM,YAAqC,GAC5D;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,aAAa,CAM9B;AAMD,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,GAAG,IAAI,CAe7D"}
|
package/dist/node-runtime.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getNodeMajor = getNodeMajor;
|
|
4
7
|
exports.formatNodeVersionError = formatNodeVersionError;
|
|
5
8
|
exports.isSupportedNodeMajor = isSupportedNodeMajor;
|
|
6
9
|
exports.verifySqliteNative = verifySqliteNative;
|
|
7
10
|
exports.checkStartPreflight = checkStartPreflight;
|
|
11
|
+
const node_child_process_1 = require("node:child_process");
|
|
12
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
13
|
const paths_1 = require("./paths");
|
|
9
14
|
/** Node majors we test against. 24 is the default target; 20+ remains supported. */
|
|
10
15
|
const SUPPORTED_NODE_MAJORS = [20, 22, 23, 24, 25, 26];
|
|
@@ -30,14 +35,67 @@ function formatNodeVersionError() {
|
|
|
30
35
|
function isSupportedNodeMajor(major = getNodeMajor()) {
|
|
31
36
|
return SUPPORTED_NODE_MAJORS.includes(major);
|
|
32
37
|
}
|
|
33
|
-
/**
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Directory to run `npm rebuild` from: the ancestor of wherever npm actually
|
|
40
|
+
* hoisted better-sqlite3's node_modules entry. That differs by install kind
|
|
41
|
+
* (global npm/Homebrew, the managed installer, or a monorepo workspace), so
|
|
42
|
+
* `-w @agent-deck/backend` — correct only inside this monorepo — used to be
|
|
43
|
+
* hardcoded into the operator-facing hint and failed for every other install.
|
|
44
|
+
*/
|
|
45
|
+
function resolveSqliteRebuildCwd() {
|
|
35
46
|
try {
|
|
36
|
-
const
|
|
47
|
+
const pkgJsonPath = require.resolve('better-sqlite3/package.json', {
|
|
37
48
|
paths: [(0, paths_1.resolveBackendRoot)(), (0, paths_1.getCliPackageRoot)()],
|
|
38
49
|
});
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
const nodeModulesDir = node_path_1.default.dirname(node_path_1.default.dirname(pkgJsonPath));
|
|
51
|
+
return node_path_1.default.dirname(nodeModulesDir);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function sqliteRebuildHint() {
|
|
58
|
+
const cwd = resolveSqliteRebuildCwd();
|
|
59
|
+
return cwd ? ` (cd "${cwd}" && npm rebuild better-sqlite3)` : ' npm rebuild better-sqlite3';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A stale prebuild (installed under one Node major, then run under another
|
|
63
|
+
* after an upgrade) is self-inflicted, not a real Node-version limitation —
|
|
64
|
+
* try to fix it in place before telling the operator to. `npm rebuild` reruns
|
|
65
|
+
* better-sqlite3's own install step (`prebuild-install`), which fetches a
|
|
66
|
+
* precompiled binary matching the running Node's ABI and only falls back to
|
|
67
|
+
* a from-source node-gyp build when no prebuild matches.
|
|
68
|
+
*/
|
|
69
|
+
function attemptSqliteRebuild() {
|
|
70
|
+
const cwd = resolveSqliteRebuildCwd();
|
|
71
|
+
if (!cwd)
|
|
72
|
+
return false;
|
|
73
|
+
try {
|
|
74
|
+
console.error(`[agent-deck] better-sqlite3 native module is stale for node ${process.version} — rebuilding...`);
|
|
75
|
+
(0, node_child_process_1.execSync)('npm rebuild better-sqlite3', { cwd, stdio: 'ignore', timeout: 120_000 });
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Resolved from the CLI's backend dependency tree — real callers never override this. */
|
|
83
|
+
function loadSqliteDatabaseCtor() {
|
|
84
|
+
const sqlitePath = require.resolve('better-sqlite3', {
|
|
85
|
+
paths: [(0, paths_1.resolveBackendRoot)(), (0, paths_1.getCliPackageRoot)()],
|
|
86
|
+
});
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
88
|
+
return require(sqlitePath);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Catches ABI / cache mismatches in better-sqlite3. `loadDatabaseCtor` is a
|
|
92
|
+
* test seam (real resolution goes through `require.resolve` with custom
|
|
93
|
+
* search paths, which module-mocking tools can't intercept); production
|
|
94
|
+
* always uses the default.
|
|
95
|
+
*/
|
|
96
|
+
function probeSqliteNative(loadDatabaseCtor = loadSqliteDatabaseCtor) {
|
|
97
|
+
try {
|
|
98
|
+
const Database = loadDatabaseCtor();
|
|
41
99
|
// `require` alone proves nothing: better-sqlite3 dlopens its .node binding
|
|
42
100
|
// lazily, on first Database construction. Without this probe an ABI
|
|
43
101
|
// mismatch passes preflight and only surfaces as the backend exiting 1.
|
|
@@ -53,12 +111,13 @@ function verifySqliteNative() {
|
|
|
53
111
|
if (detail.includes('NODE_MODULE_VERSION') || code === 'ERR_DLOPEN_FAILED') {
|
|
54
112
|
return {
|
|
55
113
|
ok: false,
|
|
114
|
+
abiMismatch: true,
|
|
56
115
|
reason: `better-sqlite3 native module does not match node ${process.version} ` +
|
|
57
116
|
`(NODE_MODULE_VERSION ${process.versions.modules}): ${firstLine(detail)}`,
|
|
58
117
|
message: [
|
|
59
118
|
'better-sqlite3 native module does not match this Node.js version.',
|
|
60
119
|
'',
|
|
61
|
-
|
|
120
|
+
sqliteRebuildHint(),
|
|
62
121
|
' rm -rf ~/.npm/_npx',
|
|
63
122
|
' npx @agent-deck/cli@latest doctor',
|
|
64
123
|
'',
|
|
@@ -66,8 +125,25 @@ function verifySqliteNative() {
|
|
|
66
125
|
].join('\n'),
|
|
67
126
|
};
|
|
68
127
|
}
|
|
69
|
-
return {
|
|
128
|
+
return {
|
|
129
|
+
ok: false,
|
|
130
|
+
abiMismatch: false,
|
|
131
|
+
reason: `better-sqlite3 could not be loaded: ${firstLine(detail)}`,
|
|
132
|
+
message: detail,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Same probe as `probeSqliteNative`, but an ABI mismatch gets one automatic
|
|
138
|
+
* `npm rebuild` before being reported as a failure — see `attemptSqliteRebuild`.
|
|
139
|
+
* `loadDatabaseCtor` is a test seam; production callers never pass it.
|
|
140
|
+
*/
|
|
141
|
+
function verifySqliteNative(loadDatabaseCtor = loadSqliteDatabaseCtor) {
|
|
142
|
+
const first = probeSqliteNative(loadDatabaseCtor);
|
|
143
|
+
if (first.ok || !first.abiMismatch || !attemptSqliteRebuild()) {
|
|
144
|
+
return first;
|
|
70
145
|
}
|
|
146
|
+
return probeSqliteNative(loadDatabaseCtor);
|
|
71
147
|
}
|
|
72
148
|
function firstLine(text) {
|
|
73
149
|
return text.split('\n')[0].trim();
|
package/dist/node-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-runtime.js","sourceRoot":"","sources":["../src/node-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-runtime.js","sourceRoot":"","sources":["../src/node-runtime.ts"],"names":[],"mappings":";;;;;AAQA,oCAEC;AAED,wDAcC;AAED,oDAEC;AAuHD,gDAQC;AAkBD,kDAeC;AA9LD,2DAA8C;AAC9C,0DAA6B;AAC7B,mCAAgE;AAEhE,oFAAoF;AACpF,MAAM,qBAAqB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAU,CAAC;AAChE,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAgB,YAAY;IAC1B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC;AAED,SAAgB,sBAAsB;IACpC,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,OAAO;QACL,+CAA+C,OAAO,CAAC,OAAO,IAAI;QAClE,+BAA+B,oBAAoB,yBAAyB;QAC5E,EAAE;QACF,WAAW;QACX,iBAAiB,oBAAoB,eAAe,oBAAoB,eAAe;QACvF,wEAAwE;QACxE,qCAAqC;QACrC,oCAAoC;QACpC,EAAE;QACF,sBAAsB,KAAK,yEAAyE;KACrG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAK,GAAG,YAAY,EAAE;IACzD,OAAQ,qBAA2C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;GAM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E,MAAM;SAChB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,mBAAuC,sBAAsB;IAE7D,MAAM,KAAK,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAClD,IAAI,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AASD;;;;GAIG;AACH,SAAgB,mBAAmB;IACjC,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO;YACL,MAAM,EAAE,6BAA6B,KAAK,KAAK,OAAO,CAAC,OAAO,GAAG;YACjE,OAAO,EAAE,sBAAsB,EAAE;SAClC,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-deck/cli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.5",
|
|
4
4
|
"description": "Local MCP proxy — decks of tools, keys, and self-improving playbooks",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prepublishOnly": "node ../../scripts/pre-publish-check.mjs && npm run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agent-deck/backend": "^1.11.
|
|
44
|
-
"@agent-deck/shared": "^1.11.
|
|
43
|
+
"@agent-deck/backend": "^1.11.5",
|
|
44
|
+
"@agent-deck/shared": "^1.11.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^20.11.5",
|