@isarai/maestro 0.1.3 → 0.1.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/README.md +4 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +3 -3
- package/dist/server.js +273 -167
- package/dist/server.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Standalone CLI for running Maestro without Docker Compose.
|
|
4
4
|
|
|
5
|
+
The Maestro server runs directly on the host. Docker is optional and only needed if you enable Docker sandboxing for agents or terminals.
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -13,6 +15,8 @@ npm i -g @isarai/maestro
|
|
|
13
15
|
```bash
|
|
14
16
|
maestro start
|
|
15
17
|
maestro status
|
|
18
|
+
maestro logs
|
|
19
|
+
maestro logs -f
|
|
16
20
|
maestro auth
|
|
17
21
|
maestro version
|
|
18
22
|
maestro update --check
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var MAESTRO_DIR = path.join(os.homedir(), ".maestro");
|
|
|
10
10
|
var PID_PATH = path.join(MAESTRO_DIR, "server.pid");
|
|
11
11
|
var META_PATH = path.join(MAESTRO_DIR, "server-meta.json");
|
|
12
12
|
var LOG_PATH = path.join(MAESTRO_DIR, "server.log");
|
|
13
|
+
var UPDATE_STATE_PATH = path.join(MAESTRO_DIR, "maestro-update-state.json");
|
|
13
14
|
var TOKEN_PATH = path.join(MAESTRO_DIR, "token");
|
|
14
15
|
var LEGACY_TOKEN_PATH = path.join(MAESTRO_DIR, "api-token");
|
|
15
16
|
var SERVER_PATH = path.join(PACKAGE_ROOT, "dist", "server.js");
|
|
@@ -75,6 +76,24 @@ function writeMeta(meta) {
|
|
|
75
76
|
ensureMaestroDir();
|
|
76
77
|
fs.writeFileSync(META_PATH, JSON.stringify(meta, null, 2) + "\n", "utf8");
|
|
77
78
|
}
|
|
79
|
+
function readUpdateState() {
|
|
80
|
+
try {
|
|
81
|
+
return JSON.parse(fs.readFileSync(UPDATE_STATE_PATH, "utf8"));
|
|
82
|
+
} catch {
|
|
83
|
+
return {
|
|
84
|
+
updating: false,
|
|
85
|
+
lastCheckedAt: null,
|
|
86
|
+
lastUpdatedAt: null,
|
|
87
|
+
latestVersion: null,
|
|
88
|
+
lastError: null
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function writeUpdateState(patch) {
|
|
93
|
+
ensureMaestroDir();
|
|
94
|
+
const next = { ...readUpdateState(), ...patch };
|
|
95
|
+
fs.writeFileSync(UPDATE_STATE_PATH, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
96
|
+
}
|
|
78
97
|
function cleanupState() {
|
|
79
98
|
try {
|
|
80
99
|
fs.unlinkSync(PID_PATH);
|
|
@@ -261,10 +280,62 @@ function auth() {
|
|
|
261
280
|
console.log(`API token: ${token}`);
|
|
262
281
|
console.log(`Token path: ${tokenPath}`);
|
|
263
282
|
}
|
|
283
|
+
function logs(args) {
|
|
284
|
+
const follow = args.includes("-f") || args.includes("--follow");
|
|
285
|
+
if (!fs.existsSync(LOG_PATH)) {
|
|
286
|
+
fail(`Maestro log file not found at ${LOG_PATH}. Start Maestro first.`);
|
|
287
|
+
}
|
|
288
|
+
let position = 0;
|
|
289
|
+
const printChunk = (start2, end) => {
|
|
290
|
+
if (end <= start2) return;
|
|
291
|
+
const fd = fs.openSync(LOG_PATH, "r");
|
|
292
|
+
try {
|
|
293
|
+
const length = end - start2;
|
|
294
|
+
const buffer = Buffer.alloc(length);
|
|
295
|
+
fs.readSync(fd, buffer, 0, length, start2);
|
|
296
|
+
process.stdout.write(buffer);
|
|
297
|
+
} finally {
|
|
298
|
+
fs.closeSync(fd);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const stat = fs.statSync(LOG_PATH);
|
|
302
|
+
printChunk(0, stat.size);
|
|
303
|
+
position = stat.size;
|
|
304
|
+
if (!follow) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const stopWatching = () => {
|
|
308
|
+
fs.unwatchFile(LOG_PATH, onChange);
|
|
309
|
+
};
|
|
310
|
+
const onChange = (curr, prev) => {
|
|
311
|
+
if (curr.size < position) {
|
|
312
|
+
position = 0;
|
|
313
|
+
}
|
|
314
|
+
if (curr.size > position) {
|
|
315
|
+
printChunk(position, curr.size);
|
|
316
|
+
position = curr.size;
|
|
317
|
+
} else if (prev.size > curr.size) {
|
|
318
|
+
position = curr.size;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
process.on("SIGINT", () => {
|
|
322
|
+
stopWatching();
|
|
323
|
+
process.exit(0);
|
|
324
|
+
});
|
|
325
|
+
process.on("SIGTERM", () => {
|
|
326
|
+
stopWatching();
|
|
327
|
+
process.exit(0);
|
|
328
|
+
});
|
|
329
|
+
fs.watchFile(LOG_PATH, { interval: 500 }, onChange);
|
|
330
|
+
}
|
|
264
331
|
async function update(args) {
|
|
265
332
|
if (isContainerManagedInstall()) {
|
|
266
333
|
fail("maestro update is only supported for bare-metal npm installs. Redeploy the container image instead.");
|
|
267
334
|
}
|
|
335
|
+
const delayMs = Number(process.env.MAESTRO_SELF_UPDATE_DELAY_MS || "0");
|
|
336
|
+
if (Number.isFinite(delayMs) && delayMs > 0) {
|
|
337
|
+
await sleep(delayMs);
|
|
338
|
+
}
|
|
268
339
|
const meta = readPackageMeta();
|
|
269
340
|
const npmCommand = getNpmCommand();
|
|
270
341
|
ensureGlobalNpmInstall(npmCommand, meta.name);
|
|
@@ -291,12 +362,22 @@ async function update(args) {
|
|
|
291
362
|
try {
|
|
292
363
|
runNpmInstallGlobal(npmCommand, meta.name, "latest");
|
|
293
364
|
} catch (error) {
|
|
365
|
+
writeUpdateState({
|
|
366
|
+
updating: false,
|
|
367
|
+
lastError: error instanceof Error ? error.message : "Maestro update failed."
|
|
368
|
+
});
|
|
294
369
|
if (wasRunning) {
|
|
295
370
|
console.log("Update failed; attempting to restart the previous Maestro process...");
|
|
296
371
|
start();
|
|
297
372
|
}
|
|
298
373
|
fail(error instanceof Error ? error.message : "Maestro update failed.");
|
|
299
374
|
}
|
|
375
|
+
writeUpdateState({
|
|
376
|
+
updating: false,
|
|
377
|
+
lastUpdatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
378
|
+
latestVersion,
|
|
379
|
+
lastError: null
|
|
380
|
+
});
|
|
300
381
|
if (wasRunning) {
|
|
301
382
|
console.log("Starting Maestro after update...");
|
|
302
383
|
start();
|
|
@@ -312,10 +393,12 @@ function help() {
|
|
|
312
393
|
console.log(" stop Stop the background Maestro server");
|
|
313
394
|
console.log(" status Show whether the Maestro server is running");
|
|
314
395
|
console.log(" auth Print the local Maestro API token");
|
|
396
|
+
console.log(" logs Print the Maestro server log");
|
|
315
397
|
console.log(" version Print the installed Maestro CLI version");
|
|
316
398
|
console.log(" update Update the globally installed Maestro CLI");
|
|
317
399
|
console.log("");
|
|
318
400
|
console.log("Options:");
|
|
401
|
+
console.log(" maestro logs -f Follow the Maestro server log");
|
|
319
402
|
console.log(" maestro update --check Check whether an update is available");
|
|
320
403
|
}
|
|
321
404
|
async function main() {
|
|
@@ -334,6 +417,9 @@ async function main() {
|
|
|
334
417
|
case "auth":
|
|
335
418
|
auth();
|
|
336
419
|
break;
|
|
420
|
+
case "logs":
|
|
421
|
+
logs(args);
|
|
422
|
+
break;
|
|
337
423
|
case "version":
|
|
338
424
|
version();
|
|
339
425
|
break;
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { execFileSync, spawn } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\nconst PACKAGE_JSON_PATH = path.join(PACKAGE_ROOT, \"package.json\");\nconst MAESTRO_DIR = path.join(os.homedir(), \".maestro\");\nconst PID_PATH = path.join(MAESTRO_DIR, \"server.pid\");\nconst META_PATH = path.join(MAESTRO_DIR, \"server-meta.json\");\nconst LOG_PATH = path.join(MAESTRO_DIR, \"server.log\");\nconst TOKEN_PATH = path.join(MAESTRO_DIR, \"token\");\nconst LEGACY_TOKEN_PATH = path.join(MAESTRO_DIR, \"api-token\");\nconst SERVER_PATH = path.join(PACKAGE_ROOT, \"dist\", \"server.js\");\nconst DEFAULT_HOST = process.env.HOST || \"0.0.0.0\";\nconst DEFAULT_PORT = process.env.PORT || \"4800\";\n\ninterface ServerMeta {\n pid: number;\n host: string;\n port: string;\n logPath: string;\n startedAt: string;\n cwd: string;\n}\n\ninterface PackageMeta {\n name: string;\n version: string;\n}\n\nfunction ensureMaestroDir(): void {\n fs.mkdirSync(MAESTRO_DIR, { recursive: true });\n}\n\nfunction fail(message: string): never {\n console.error(message);\n process.exit(1);\n}\n\nfunction readPackageMeta(): PackageMeta {\n try {\n return JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, \"utf8\")) as PackageMeta;\n } catch {\n fail(`Maestro package metadata not found at ${PACKAGE_JSON_PATH}`);\n }\n}\n\nfunction preflight(): void {\n if (!fs.existsSync(SERVER_PATH)) {\n fail(`Maestro server bundle not found at ${SERVER_PATH}`);\n }\n}\n\nfunction readPid(): number | null {\n try {\n const raw = fs.readFileSync(PID_PATH, \"utf8\").trim();\n if (!raw) return null;\n const pid = Number(raw);\n return Number.isInteger(pid) && pid > 0 ? pid : null;\n } catch {\n return null;\n }\n}\n\nfunction isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n if (process.platform === \"linux\") {\n try {\n const stat = fs.readFileSync(`/proc/${pid}/stat`, \"utf8\");\n const fields = stat.trim().split(\" \");\n if (fields[2] === \"Z\") {\n return false;\n }\n } catch {\n // Ignore /proc read failures and fall back to kill(0).\n }\n }\n return true;\n } catch (error) {\n return Boolean(\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n (error as NodeJS.ErrnoException).code === \"EPERM\"\n );\n }\n}\n\nfunction readMeta(): ServerMeta | null {\n try {\n return JSON.parse(fs.readFileSync(META_PATH, \"utf8\")) as ServerMeta;\n } catch {\n return null;\n }\n}\n\nfunction writeMeta(meta: ServerMeta): void {\n ensureMaestroDir();\n fs.writeFileSync(META_PATH, JSON.stringify(meta, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction cleanupState(): void {\n try {\n fs.unlinkSync(PID_PATH);\n } catch {}\n try {\n fs.unlinkSync(META_PATH);\n } catch {}\n}\n\nfunction resolveTokenPath(): string | null {\n if (fs.existsSync(TOKEN_PATH)) {\n return TOKEN_PATH;\n }\n if (fs.existsSync(LEGACY_TOKEN_PATH)) {\n return LEGACY_TOKEN_PATH;\n }\n return null;\n}\n\nfunction displayHost(host: string | undefined): string {\n if (!host || host === \"0.0.0.0\" || host === \"::\") {\n return \"127.0.0.1\";\n }\n return host;\n}\n\nfunction isContainerManagedInstall(): boolean {\n return fs.existsSync(\"/.dockerenv\") || Boolean(process.env.KUBERNETES_SERVICE_HOST);\n}\n\nfunction getNpmCommand(): string {\n const npmCommand = process.platform === \"win32\" ? \"npm.cmd\" : \"npm\";\n try {\n execFileSync(npmCommand, [\"--version\"], { stdio: [\"ignore\", \"ignore\", \"ignore\"] });\n return npmCommand;\n } catch {\n fail(\"npm is required for `maestro update`, but it was not found in PATH.\");\n }\n}\n\nfunction getGlobalNpmRoot(npmCommand: string): string {\n try {\n return execFileSync(npmCommand, [\"root\", \"-g\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n fail(\"Failed to determine the global npm install directory.\");\n }\n}\n\nfunction ensureGlobalNpmInstall(npmCommand: string, packageName: string): void {\n const globalRoot = path.resolve(getGlobalNpmRoot(npmCommand));\n const expectedRoot = path.resolve(globalRoot, packageName);\n const installedRoot = path.resolve(PACKAGE_ROOT);\n\n if (installedRoot !== expectedRoot) {\n fail(\n `maestro update only supports global npm installs. Expected package path ${expectedRoot}, found ${installedRoot}.`\n );\n }\n}\n\nfunction getLatestPublishedVersion(npmCommand: string, packageName: string): string {\n try {\n const raw = execFileSync(npmCommand, [\"view\", `${packageName}@latest`, \"version\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"inherit\"],\n }).trim();\n if (!raw) {\n throw new Error(\"empty version response\");\n }\n return raw;\n } catch {\n fail(`Failed to query the latest published version for ${packageName}.`);\n }\n}\n\nfunction version(): void {\n const meta = readPackageMeta();\n console.log(meta.version);\n}\n\nfunction runNpmInstallGlobal(npmCommand: string, packageName: string, versionSpec: string): void {\n try {\n execFileSync(\n npmCommand,\n [\"install\", \"-g\", `${packageName}@${versionSpec}`],\n { stdio: \"inherit\" }\n );\n } catch {\n throw new Error(`Failed to update ${packageName}@${versionSpec}.`);\n }\n}\n\nfunction getStatus(): { running: boolean; pid: number | null; meta: ServerMeta | null } {\n const pid = readPid();\n const meta = readMeta();\n\n if (!pid) {\n return { running: false, pid: null, meta };\n }\n\n if (!isProcessAlive(pid)) {\n cleanupState();\n return { running: false, pid: null, meta };\n }\n\n return { running: true, pid, meta };\n}\n\nfunction start(): void {\n preflight();\n ensureMaestroDir();\n\n const current = getStatus();\n if (current.running) {\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is already running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n return;\n }\n\n const out = fs.openSync(LOG_PATH, \"a\");\n const env = {\n ...process.env,\n NODE_ENV: process.env.NODE_ENV || \"production\",\n HOST: DEFAULT_HOST,\n PORT: DEFAULT_PORT,\n MAESTRO_INSTALL_ROOT: PACKAGE_ROOT,\n };\n\n const child = spawn(process.execPath, [SERVER_PATH], {\n cwd: process.cwd(),\n detached: true,\n stdio: [\"ignore\", out, out],\n env,\n });\n\n child.unref();\n\n fs.writeFileSync(PID_PATH, `${child.pid}\\n`, \"utf8\");\n writeMeta({\n pid: child.pid ?? 0,\n host: env.HOST,\n port: env.PORT,\n logPath: LOG_PATH,\n startedAt: new Date().toISOString(),\n cwd: process.cwd(),\n });\n\n console.log(`Started Maestro (pid ${child.pid})`);\n console.log(`URL: http://${displayHost(env.HOST)}:${env.PORT}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function stop(): Promise<void> {\n const status = getStatus();\n if (!status.running || !status.pid) {\n console.log(\"Maestro is not running\");\n cleanupState();\n return;\n }\n\n process.kill(status.pid, \"SIGTERM\");\n\n const deadline = Date.now() + 10_000;\n while (Date.now() < deadline) {\n if (!isProcessAlive(status.pid)) {\n cleanupState();\n console.log(`Stopped Maestro (pid ${status.pid})`);\n return;\n }\n await sleep(200);\n }\n\n fail(`Timed out waiting for Maestro (pid ${status.pid}) to stop`);\n}\n\nfunction status(): void {\n const current = getStatus();\n if (!current.running) {\n console.log(\"Maestro is not running\");\n return;\n }\n\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction auth(): void {\n const tokenPath = resolveTokenPath();\n if (!tokenPath) {\n fail(`Maestro API token not found at ${TOKEN_PATH}. Start Maestro first.`);\n }\n\n const token = fs.readFileSync(tokenPath, \"utf8\").trim();\n const current = getStatus();\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n\n console.log(`Server URL: http://${host}:${port}`);\n console.log(`API token: ${token}`);\n console.log(`Token path: ${tokenPath}`);\n}\n\nasync function update(args: string[]): Promise<void> {\n if (isContainerManagedInstall()) {\n fail(\"maestro update is only supported for bare-metal npm installs. Redeploy the container image instead.\");\n }\n\n const meta = readPackageMeta();\n const npmCommand = getNpmCommand();\n ensureGlobalNpmInstall(npmCommand, meta.name);\n\n const latestVersion = getLatestPublishedVersion(npmCommand, meta.name);\n const currentVersion = meta.version;\n const checkOnly = args.includes(\"--check\");\n\n console.log(`Installed: ${currentVersion}`);\n console.log(`Latest: ${latestVersion}`);\n\n if (currentVersion === latestVersion) {\n console.log(\"Maestro is already up to date.\");\n return;\n }\n\n if (checkOnly) {\n console.log(`Update available: ${currentVersion} -> ${latestVersion}`);\n return;\n }\n\n const current = getStatus();\n const wasRunning = current.running;\n\n if (wasRunning) {\n console.log(\"Stopping Maestro before update...\");\n await stop();\n }\n\n console.log(`Updating ${meta.name} to ${latestVersion}...`);\n try {\n runNpmInstallGlobal(npmCommand, meta.name, \"latest\");\n } catch (error) {\n if (wasRunning) {\n console.log(\"Update failed; attempting to restart the previous Maestro process...\");\n start();\n }\n fail(error instanceof Error ? error.message : \"Maestro update failed.\");\n }\n\n if (wasRunning) {\n console.log(\"Starting Maestro after update...\");\n start();\n } else {\n console.log(\"Update complete.\");\n }\n}\n\nfunction help(): void {\n console.log(\"Usage: maestro <command>\");\n console.log(\"\");\n console.log(\"Commands:\");\n console.log(\" start Start the Maestro server in the background\");\n console.log(\" stop Stop the background Maestro server\");\n console.log(\" status Show whether the Maestro server is running\");\n console.log(\" auth Print the local Maestro API token\");\n console.log(\" version Print the installed Maestro CLI version\");\n console.log(\" update Update the globally installed Maestro CLI\");\n console.log(\"\");\n console.log(\"Options:\");\n console.log(\" maestro update --check Check whether an update is available\");\n}\n\nasync function main(): Promise<void> {\n const cmd = process.argv[2];\n const args = process.argv.slice(3);\n\n switch (cmd) {\n case \"start\":\n start();\n break;\n case \"stop\":\n await stop();\n break;\n case \"status\":\n status();\n break;\n case \"auth\":\n auth();\n break;\n case \"version\":\n version();\n break;\n case \"update\":\n await update(args);\n break;\n case \"help\":\n case \"--help\":\n case \"-h\":\n case undefined:\n help();\n break;\n default:\n fail(`Unknown command: ${cmd}`);\n }\n}\n\nvoid main();\n"],
|
|
5
|
-
"mappings": ";AAAA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,cAAc,aAAa;AACpC,SAAS,qBAAqB;AAE9B,IAAM,eAAoB,aAAa,aAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,IAAI;AACpF,IAAM,oBAAyB,UAAK,cAAc,cAAc;AAChE,IAAM,cAAmB,UAAQ,WAAQ,GAAG,UAAU;AACtD,IAAM,WAAgB,UAAK,aAAa,YAAY;AACpD,IAAM,YAAiB,UAAK,aAAa,kBAAkB;AAC3D,IAAM,WAAgB,UAAK,aAAa,YAAY;AACpD,IAAM,aAAkB,UAAK,aAAa,OAAO;AACjD,IAAM,oBAAyB,UAAK,aAAa,WAAW;AAC5D,IAAM,cAAmB,UAAK,cAAc,QAAQ,WAAW;AAC/D,IAAM,eAAe,QAAQ,IAAI,QAAQ;AACzC,IAAM,eAAe,QAAQ,IAAI,QAAQ;
|
|
6
|
-
"names": ["resolve", "status"]
|
|
4
|
+
"sourcesContent": ["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { execFileSync, spawn } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\nconst PACKAGE_JSON_PATH = path.join(PACKAGE_ROOT, \"package.json\");\nconst MAESTRO_DIR = path.join(os.homedir(), \".maestro\");\nconst PID_PATH = path.join(MAESTRO_DIR, \"server.pid\");\nconst META_PATH = path.join(MAESTRO_DIR, \"server-meta.json\");\nconst LOG_PATH = path.join(MAESTRO_DIR, \"server.log\");\nconst UPDATE_STATE_PATH = path.join(MAESTRO_DIR, \"maestro-update-state.json\");\nconst TOKEN_PATH = path.join(MAESTRO_DIR, \"token\");\nconst LEGACY_TOKEN_PATH = path.join(MAESTRO_DIR, \"api-token\");\nconst SERVER_PATH = path.join(PACKAGE_ROOT, \"dist\", \"server.js\");\nconst DEFAULT_HOST = process.env.HOST || \"0.0.0.0\";\nconst DEFAULT_PORT = process.env.PORT || \"4800\";\n\ninterface ServerMeta {\n pid: number;\n host: string;\n port: string;\n logPath: string;\n startedAt: string;\n cwd: string;\n}\n\ninterface PackageMeta {\n name: string;\n version: string;\n}\n\ninterface MaestroUpdateState {\n updating: boolean;\n lastCheckedAt: string | null;\n lastUpdatedAt: string | null;\n latestVersion: string | null;\n lastError: string | null;\n}\n\nfunction ensureMaestroDir(): void {\n fs.mkdirSync(MAESTRO_DIR, { recursive: true });\n}\n\nfunction fail(message: string): never {\n console.error(message);\n process.exit(1);\n}\n\nfunction readPackageMeta(): PackageMeta {\n try {\n return JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, \"utf8\")) as PackageMeta;\n } catch {\n fail(`Maestro package metadata not found at ${PACKAGE_JSON_PATH}`);\n }\n}\n\nfunction preflight(): void {\n if (!fs.existsSync(SERVER_PATH)) {\n fail(`Maestro server bundle not found at ${SERVER_PATH}`);\n }\n}\n\nfunction readPid(): number | null {\n try {\n const raw = fs.readFileSync(PID_PATH, \"utf8\").trim();\n if (!raw) return null;\n const pid = Number(raw);\n return Number.isInteger(pid) && pid > 0 ? pid : null;\n } catch {\n return null;\n }\n}\n\nfunction isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n if (process.platform === \"linux\") {\n try {\n const stat = fs.readFileSync(`/proc/${pid}/stat`, \"utf8\");\n const fields = stat.trim().split(\" \");\n if (fields[2] === \"Z\") {\n return false;\n }\n } catch {\n // Ignore /proc read failures and fall back to kill(0).\n }\n }\n return true;\n } catch (error) {\n return Boolean(\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n (error as NodeJS.ErrnoException).code === \"EPERM\"\n );\n }\n}\n\nfunction readMeta(): ServerMeta | null {\n try {\n return JSON.parse(fs.readFileSync(META_PATH, \"utf8\")) as ServerMeta;\n } catch {\n return null;\n }\n}\n\nfunction writeMeta(meta: ServerMeta): void {\n ensureMaestroDir();\n fs.writeFileSync(META_PATH, JSON.stringify(meta, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction readUpdateState(): MaestroUpdateState {\n try {\n return JSON.parse(fs.readFileSync(UPDATE_STATE_PATH, \"utf8\")) as MaestroUpdateState;\n } catch {\n return {\n updating: false,\n lastCheckedAt: null,\n lastUpdatedAt: null,\n latestVersion: null,\n lastError: null,\n };\n }\n}\n\nfunction writeUpdateState(patch: Partial<MaestroUpdateState>): void {\n ensureMaestroDir();\n const next = { ...readUpdateState(), ...patch };\n fs.writeFileSync(UPDATE_STATE_PATH, JSON.stringify(next, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction cleanupState(): void {\n try {\n fs.unlinkSync(PID_PATH);\n } catch {}\n try {\n fs.unlinkSync(META_PATH);\n } catch {}\n}\n\nfunction resolveTokenPath(): string | null {\n if (fs.existsSync(TOKEN_PATH)) {\n return TOKEN_PATH;\n }\n if (fs.existsSync(LEGACY_TOKEN_PATH)) {\n return LEGACY_TOKEN_PATH;\n }\n return null;\n}\n\nfunction displayHost(host: string | undefined): string {\n if (!host || host === \"0.0.0.0\" || host === \"::\") {\n return \"127.0.0.1\";\n }\n return host;\n}\n\nfunction isContainerManagedInstall(): boolean {\n return fs.existsSync(\"/.dockerenv\") || Boolean(process.env.KUBERNETES_SERVICE_HOST);\n}\n\nfunction getNpmCommand(): string {\n const npmCommand = process.platform === \"win32\" ? \"npm.cmd\" : \"npm\";\n try {\n execFileSync(npmCommand, [\"--version\"], { stdio: [\"ignore\", \"ignore\", \"ignore\"] });\n return npmCommand;\n } catch {\n fail(\"npm is required for `maestro update`, but it was not found in PATH.\");\n }\n}\n\nfunction getGlobalNpmRoot(npmCommand: string): string {\n try {\n return execFileSync(npmCommand, [\"root\", \"-g\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n fail(\"Failed to determine the global npm install directory.\");\n }\n}\n\nfunction ensureGlobalNpmInstall(npmCommand: string, packageName: string): void {\n const globalRoot = path.resolve(getGlobalNpmRoot(npmCommand));\n const expectedRoot = path.resolve(globalRoot, packageName);\n const installedRoot = path.resolve(PACKAGE_ROOT);\n\n if (installedRoot !== expectedRoot) {\n fail(\n `maestro update only supports global npm installs. Expected package path ${expectedRoot}, found ${installedRoot}.`\n );\n }\n}\n\nfunction getLatestPublishedVersion(npmCommand: string, packageName: string): string {\n try {\n const raw = execFileSync(npmCommand, [\"view\", `${packageName}@latest`, \"version\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"inherit\"],\n }).trim();\n if (!raw) {\n throw new Error(\"empty version response\");\n }\n return raw;\n } catch {\n fail(`Failed to query the latest published version for ${packageName}.`);\n }\n}\n\nfunction version(): void {\n const meta = readPackageMeta();\n console.log(meta.version);\n}\n\nfunction runNpmInstallGlobal(npmCommand: string, packageName: string, versionSpec: string): void {\n try {\n execFileSync(\n npmCommand,\n [\"install\", \"-g\", `${packageName}@${versionSpec}`],\n { stdio: \"inherit\" }\n );\n } catch {\n throw new Error(`Failed to update ${packageName}@${versionSpec}.`);\n }\n}\n\nfunction getStatus(): { running: boolean; pid: number | null; meta: ServerMeta | null } {\n const pid = readPid();\n const meta = readMeta();\n\n if (!pid) {\n return { running: false, pid: null, meta };\n }\n\n if (!isProcessAlive(pid)) {\n cleanupState();\n return { running: false, pid: null, meta };\n }\n\n return { running: true, pid, meta };\n}\n\nfunction start(): void {\n preflight();\n ensureMaestroDir();\n\n const current = getStatus();\n if (current.running) {\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is already running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n return;\n }\n\n const out = fs.openSync(LOG_PATH, \"a\");\n const env = {\n ...process.env,\n NODE_ENV: process.env.NODE_ENV || \"production\",\n HOST: DEFAULT_HOST,\n PORT: DEFAULT_PORT,\n MAESTRO_INSTALL_ROOT: PACKAGE_ROOT,\n };\n\n const child = spawn(process.execPath, [SERVER_PATH], {\n cwd: process.cwd(),\n detached: true,\n stdio: [\"ignore\", out, out],\n env,\n });\n\n child.unref();\n\n fs.writeFileSync(PID_PATH, `${child.pid}\\n`, \"utf8\");\n writeMeta({\n pid: child.pid ?? 0,\n host: env.HOST,\n port: env.PORT,\n logPath: LOG_PATH,\n startedAt: new Date().toISOString(),\n cwd: process.cwd(),\n });\n\n console.log(`Started Maestro (pid ${child.pid})`);\n console.log(`URL: http://${displayHost(env.HOST)}:${env.PORT}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function stop(): Promise<void> {\n const status = getStatus();\n if (!status.running || !status.pid) {\n console.log(\"Maestro is not running\");\n cleanupState();\n return;\n }\n\n process.kill(status.pid, \"SIGTERM\");\n\n const deadline = Date.now() + 10_000;\n while (Date.now() < deadline) {\n if (!isProcessAlive(status.pid)) {\n cleanupState();\n console.log(`Stopped Maestro (pid ${status.pid})`);\n return;\n }\n await sleep(200);\n }\n\n fail(`Timed out waiting for Maestro (pid ${status.pid}) to stop`);\n}\n\nfunction status(): void {\n const current = getStatus();\n if (!current.running) {\n console.log(\"Maestro is not running\");\n return;\n }\n\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction auth(): void {\n const tokenPath = resolveTokenPath();\n if (!tokenPath) {\n fail(`Maestro API token not found at ${TOKEN_PATH}. Start Maestro first.`);\n }\n\n const token = fs.readFileSync(tokenPath, \"utf8\").trim();\n const current = getStatus();\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n\n console.log(`Server URL: http://${host}:${port}`);\n console.log(`API token: ${token}`);\n console.log(`Token path: ${tokenPath}`);\n}\n\nfunction logs(args: string[]): void {\n const follow = args.includes(\"-f\") || args.includes(\"--follow\");\n\n if (!fs.existsSync(LOG_PATH)) {\n fail(`Maestro log file not found at ${LOG_PATH}. Start Maestro first.`);\n }\n\n let position = 0;\n\n const printChunk = (start: number, end: number) => {\n if (end <= start) return;\n\n const fd = fs.openSync(LOG_PATH, \"r\");\n try {\n const length = end - start;\n const buffer = Buffer.alloc(length);\n fs.readSync(fd, buffer, 0, length, start);\n process.stdout.write(buffer);\n } finally {\n fs.closeSync(fd);\n }\n };\n\n const stat = fs.statSync(LOG_PATH);\n printChunk(0, stat.size);\n position = stat.size;\n\n if (!follow) {\n return;\n }\n\n const stopWatching = () => {\n fs.unwatchFile(LOG_PATH, onChange);\n };\n\n const onChange = (curr: fs.Stats, prev: fs.Stats) => {\n if (curr.size < position) {\n position = 0;\n }\n if (curr.size > position) {\n printChunk(position, curr.size);\n position = curr.size;\n } else if (prev.size > curr.size) {\n position = curr.size;\n }\n };\n\n process.on(\"SIGINT\", () => {\n stopWatching();\n process.exit(0);\n });\n\n process.on(\"SIGTERM\", () => {\n stopWatching();\n process.exit(0);\n });\n\n fs.watchFile(LOG_PATH, { interval: 500 }, onChange);\n}\n\nasync function update(args: string[]): Promise<void> {\n if (isContainerManagedInstall()) {\n fail(\"maestro update is only supported for bare-metal npm installs. Redeploy the container image instead.\");\n }\n\n const delayMs = Number(process.env.MAESTRO_SELF_UPDATE_DELAY_MS || \"0\");\n if (Number.isFinite(delayMs) && delayMs > 0) {\n await sleep(delayMs);\n }\n\n const meta = readPackageMeta();\n const npmCommand = getNpmCommand();\n ensureGlobalNpmInstall(npmCommand, meta.name);\n\n const latestVersion = getLatestPublishedVersion(npmCommand, meta.name);\n const currentVersion = meta.version;\n const checkOnly = args.includes(\"--check\");\n\n console.log(`Installed: ${currentVersion}`);\n console.log(`Latest: ${latestVersion}`);\n\n if (currentVersion === latestVersion) {\n console.log(\"Maestro is already up to date.\");\n return;\n }\n\n if (checkOnly) {\n console.log(`Update available: ${currentVersion} -> ${latestVersion}`);\n return;\n }\n\n const current = getStatus();\n const wasRunning = current.running;\n\n if (wasRunning) {\n console.log(\"Stopping Maestro before update...\");\n await stop();\n }\n\n console.log(`Updating ${meta.name} to ${latestVersion}...`);\n try {\n runNpmInstallGlobal(npmCommand, meta.name, \"latest\");\n } catch (error) {\n writeUpdateState({\n updating: false,\n lastError: error instanceof Error ? error.message : \"Maestro update failed.\",\n });\n if (wasRunning) {\n console.log(\"Update failed; attempting to restart the previous Maestro process...\");\n start();\n }\n fail(error instanceof Error ? error.message : \"Maestro update failed.\");\n }\n\n writeUpdateState({\n updating: false,\n lastUpdatedAt: new Date().toISOString(),\n latestVersion,\n lastError: null,\n });\n\n if (wasRunning) {\n console.log(\"Starting Maestro after update...\");\n start();\n } else {\n console.log(\"Update complete.\");\n }\n}\n\nfunction help(): void {\n console.log(\"Usage: maestro <command>\");\n console.log(\"\");\n console.log(\"Commands:\");\n console.log(\" start Start the Maestro server in the background\");\n console.log(\" stop Stop the background Maestro server\");\n console.log(\" status Show whether the Maestro server is running\");\n console.log(\" auth Print the local Maestro API token\");\n console.log(\" logs Print the Maestro server log\");\n console.log(\" version Print the installed Maestro CLI version\");\n console.log(\" update Update the globally installed Maestro CLI\");\n console.log(\"\");\n console.log(\"Options:\");\n console.log(\" maestro logs -f Follow the Maestro server log\");\n console.log(\" maestro update --check Check whether an update is available\");\n}\n\nasync function main(): Promise<void> {\n const cmd = process.argv[2];\n const args = process.argv.slice(3);\n\n switch (cmd) {\n case \"start\":\n start();\n break;\n case \"stop\":\n await stop();\n break;\n case \"status\":\n status();\n break;\n case \"auth\":\n auth();\n break;\n case \"logs\":\n logs(args);\n break;\n case \"version\":\n version();\n break;\n case \"update\":\n await update(args);\n break;\n case \"help\":\n case \"--help\":\n case \"-h\":\n case undefined:\n help();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