@agent-deck/cli 1.11.4 → 1.11.6
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/dist/open.d.ts +11 -1
- package/dist/open.d.ts.map +1 -1
- package/dist/open.js +63 -6
- package/dist/open.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;I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EAAE,KAAK;YAClB,MAAM,EAAE,uCAAuC,SAAS,CAAC,MAAM,CAAC,EAAE;YAClE,OAAO,EAAE,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/dist/open.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import { openDashboardInBrowser } from './dashboard-open';
|
|
2
|
+
import { probeAgentDeck } from './ports';
|
|
1
3
|
export declare function parseOpenArgs(args: string[]): {
|
|
2
4
|
path: string;
|
|
3
5
|
} | {
|
|
4
6
|
error: string;
|
|
5
7
|
};
|
|
6
|
-
export
|
|
8
|
+
export type OpenCommandDeps = {
|
|
9
|
+
probeBackend?: typeof probeAgentDeck;
|
|
10
|
+
startBackend?: (options: {
|
|
11
|
+
backendPort: number;
|
|
12
|
+
mcpPort: number;
|
|
13
|
+
}) => Promise<number>;
|
|
14
|
+
openDashboard?: typeof openDashboardInBrowser;
|
|
15
|
+
};
|
|
16
|
+
export declare function runOpenCommand(args: string[], deps?: OpenCommandDeps): Promise<number>;
|
|
7
17
|
//# sourceMappingURL=open.d.ts.map
|
package/dist/open.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAuBlF;AAYD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,OAAO,cAAc,CAAC;IACrC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtF,aAAa,CAAC,EAAE,OAAO,sBAAsB,CAAC;CAC/C,CAAC;AAcF,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ChG"}
|
package/dist/open.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.parseOpenArgs = parseOpenArgs;
|
|
4
37
|
exports.runOpenCommand = runOpenCommand;
|
|
@@ -37,11 +70,23 @@ function printOpenUsage() {
|
|
|
37
70
|
console.log(`Usage:
|
|
38
71
|
agent-deck open [--path /admin/approve?...]
|
|
39
72
|
|
|
40
|
-
|
|
73
|
+
Starts the local backend when it is stopped, then mints a short-lived
|
|
74
|
+
dashboard bootstrap URL and opens the system browser.
|
|
41
75
|
The bare dashboard origin remains unauthorized without an existing session;
|
|
42
76
|
run agent-deck open whenever access needs to be restored.`);
|
|
43
77
|
}
|
|
44
|
-
|
|
78
|
+
/**
|
|
79
|
+
* NOT-286: cold-open starter. Reuses the existing `runStart` daemon path so
|
|
80
|
+
* `agent-deck open` never grows its own supervisor — it just asks for a
|
|
81
|
+
* background deck without opening a second browser tab (`openBrowser: false`;
|
|
82
|
+
* this command mints and opens its own bootstrap URL below). Lazily imported
|
|
83
|
+
* so `open --help` and unit tests stay light.
|
|
84
|
+
*/
|
|
85
|
+
async function defaultStartBackend(options) {
|
|
86
|
+
const { runStart } = await Promise.resolve().then(() => __importStar(require('./start')));
|
|
87
|
+
return runStart({ daemon: true, openBrowser: false, ...options });
|
|
88
|
+
}
|
|
89
|
+
async function runOpenCommand(args, deps = {}) {
|
|
45
90
|
const parsed = parseOpenArgs(args);
|
|
46
91
|
if ('error' in parsed) {
|
|
47
92
|
if (parsed.error === 'help') {
|
|
@@ -55,12 +100,24 @@ async function runOpenCommand(args) {
|
|
|
55
100
|
const host = process.env.AGENT_DECK_HOST ?? '127.0.0.1';
|
|
56
101
|
const backendPort = (0, defaults_1.readCliBackendPort)();
|
|
57
102
|
const mcpPort = Number.parseInt(process.env.AGENT_DECK_MCP_PORT ?? '1110', 10) || 1110;
|
|
58
|
-
const
|
|
103
|
+
const probeBackend = deps.probeBackend ?? ports_1.probeAgentDeck;
|
|
104
|
+
const startBackend = deps.startBackend ?? defaultStartBackend;
|
|
105
|
+
const openDashboard = deps.openDashboard ?? dashboard_open_1.openDashboardInBrowser;
|
|
106
|
+
let probe = await probeBackend(host, backendPort, mcpPort);
|
|
59
107
|
if (!probe.backendUp) {
|
|
60
|
-
console.
|
|
61
|
-
|
|
108
|
+
console.log('[agent-deck] Backend is not running. Starting it now ...');
|
|
109
|
+
const startCode = await startBackend({ backendPort, mcpPort });
|
|
110
|
+
if (startCode !== 0) {
|
|
111
|
+
console.error('[agent-deck] Could not start the backend. Run `agent-deck status` for the cause, then retry `agent-deck open`.');
|
|
112
|
+
return startCode;
|
|
113
|
+
}
|
|
114
|
+
probe = await probeBackend(host, backendPort, mcpPort);
|
|
115
|
+
if (!probe.backendUp) {
|
|
116
|
+
console.error('[agent-deck] The backend started but is not answering yet. Run `agent-deck status`, then retry `agent-deck open`.');
|
|
117
|
+
return 1;
|
|
118
|
+
}
|
|
62
119
|
}
|
|
63
|
-
const result = await (
|
|
120
|
+
const result = await openDashboard(probe.backendUrl, parsed.path);
|
|
64
121
|
if (result.code !== 0) {
|
|
65
122
|
console.error(`[agent-deck] ${result.message ?? 'Failed to open dashboard'}`);
|
|
66
123
|
return result.code;
|
package/dist/open.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,sCAuBC;AA8BD,wCA6CC;AAtGD,yCAAgD;AAChD,qDAA0D;AAC1D,mCAAyC;AAEzC,SAAgB,aAAa,CAAC,IAAc;IAC1C,IAAI,YAAY,GAAG,GAAG,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrB,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,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;IAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAClE,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,OAAO,IAAI,0BAA0B,EAAE,CAAC,CAAC;QAC9E,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACjD,OAAO,CAAC,CAAC;AACX,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.6",
|
|
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.6",
|
|
44
|
+
"@agent-deck/shared": "^1.11.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^20.11.5",
|