@ainecto/mcp 0.15.3 → 0.15.4
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 +1 -1
- package/dist/bin/ainecto.js +40 -4
- package/dist/bin/ainecto.js.map +1 -1
- package/dist/bin/mcp.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/bin/ainecto.js
CHANGED
|
@@ -5699,8 +5699,8 @@ function legacyRoleInput(flag, envVars = process.env) {
|
|
|
5699
5699
|
|
|
5700
5700
|
// src/core/version.ts
|
|
5701
5701
|
var UNBUNDLED_VERSION = "dev";
|
|
5702
|
-
var CLI_VERSION = true ? "0.15.
|
|
5703
|
-
var CLI_BUILD = true ? "
|
|
5702
|
+
var CLI_VERSION = true ? "0.15.4" : UNBUNDLED_VERSION;
|
|
5703
|
+
var CLI_BUILD = true ? "9f799ad" : void 0;
|
|
5704
5704
|
function cliVersionLabel(version, build, release2) {
|
|
5705
5705
|
return release2 || build === void 0 ? version : `${version}-dev+${build}`;
|
|
5706
5706
|
}
|
|
@@ -11711,15 +11711,27 @@ function parseReadiness(line) {
|
|
|
11711
11711
|
}
|
|
11712
11712
|
return { status: "error", message: `unexpected readiness line: ${line}` };
|
|
11713
11713
|
}
|
|
11714
|
-
function
|
|
11714
|
+
function readDaemonInfo(paths) {
|
|
11715
11715
|
try {
|
|
11716
11716
|
const value = JSON.parse(readFileSync(paths.daemonInfo, "utf8"));
|
|
11717
11717
|
const pid = value && typeof value === "object" && "pid" in value ? value.pid : void 0;
|
|
11718
|
-
|
|
11718
|
+
const version = value && typeof value === "object" && "version" in value ? value.version : void 0;
|
|
11719
|
+
return typeof pid === "number" ? { pid, ...typeof version === "string" ? { version } : {} } : void 0;
|
|
11719
11720
|
} catch {
|
|
11720
11721
|
return void 0;
|
|
11721
11722
|
}
|
|
11722
11723
|
}
|
|
11724
|
+
function daemonPid(paths) {
|
|
11725
|
+
return readDaemonInfo(paths)?.pid;
|
|
11726
|
+
}
|
|
11727
|
+
async function waitForPidGone(pid, ms) {
|
|
11728
|
+
const until = Date.now() + ms;
|
|
11729
|
+
while (isAlive(pid)) {
|
|
11730
|
+
if (Date.now() >= until) return false;
|
|
11731
|
+
await new Promise((resolve4) => setTimeout(resolve4, 100));
|
|
11732
|
+
}
|
|
11733
|
+
return true;
|
|
11734
|
+
}
|
|
11723
11735
|
function notListening(paths) {
|
|
11724
11736
|
const pid = daemonPid(paths);
|
|
11725
11737
|
const holder = pid !== void 0 && isAlive(pid) ? `Daemon pid ${pid} holds the lock but is not listening on ${paths.socket} \u2014 it may be stopped or hung. ${stuckProcessHint(pid)}` : "No running daemon answered.";
|
|
@@ -16655,6 +16667,13 @@ function pcAction(running, cliVersion) {
|
|
|
16655
16667
|
}
|
|
16656
16668
|
return { kind: "replace", pcs: [...running] };
|
|
16657
16669
|
}
|
|
16670
|
+
function daemonUpgrade(daemonVersion, cliVersion, sessions, insideTermSession) {
|
|
16671
|
+
if (daemonVersion === void 0 || daemonVersion === cliVersion || insideTermSession) {
|
|
16672
|
+
return { kind: "keep" };
|
|
16673
|
+
}
|
|
16674
|
+
const user = sessions.filter((session) => !isPcCommand(session.command)).map((session) => session.name);
|
|
16675
|
+
return user.length === 0 ? { kind: "restart" } : { kind: "ask", sessions: user };
|
|
16676
|
+
}
|
|
16658
16677
|
function pcStopDeadlineMs() {
|
|
16659
16678
|
return AGENT_STOP_WAIT_MS * 4 + Math.max(AGENT_CALL_TIMEOUT_MS, CALL_TIMEOUT_MS);
|
|
16660
16679
|
}
|
|
@@ -16962,6 +16981,7 @@ async function executePcStart(deps) {
|
|
|
16962
16981
|
settings = withConsent(settings, key, remote, /* @__PURE__ */ new Date());
|
|
16963
16982
|
await savePcSettings(deps.settingsPath, settings);
|
|
16964
16983
|
}
|
|
16984
|
+
await upgradeDaemon(deps, note);
|
|
16965
16985
|
const action = pcAction(runningPcs(await listed2(deps)), deps.cliVersion);
|
|
16966
16986
|
if (action.kind === "already") {
|
|
16967
16987
|
if (!remoteOffByWeb(await screenLines2(deps, action.pc.session))) {
|
|
@@ -16984,6 +17004,22 @@ async function executePcStart(deps) {
|
|
|
16984
17004
|
}
|
|
16985
17005
|
return await withRegistration(deps, key, userId, withNotes(deps, later, await launchPc(deps)));
|
|
16986
17006
|
}
|
|
17007
|
+
async function upgradeDaemon(deps, note) {
|
|
17008
|
+
const info = readDaemonInfo(deps.paths);
|
|
17009
|
+
if (!info) return;
|
|
17010
|
+
const plan = daemonUpgrade(info.version, deps.cliVersion, await listed2(deps), deps.register?.insideTermSession ?? false);
|
|
17011
|
+
if (plan.kind === "keep") return;
|
|
17012
|
+
if (plan.kind === "ask") {
|
|
17013
|
+
if (!deps.interactive) return;
|
|
17014
|
+
note(`This PC's terminal service is from an older AiNecto (${info.version}). Updating it to ${deps.cliVersion} closes ${plan.sessions.length} open terminal session(s): ${plan.sessions.join(", ")}.`);
|
|
17015
|
+
if (!yes(await promptLine(deps.io, "Update it now? [y/N]: "), false)) return;
|
|
17016
|
+
}
|
|
17017
|
+
note("Updating the AiNecto terminal service on this PC\u2026");
|
|
17018
|
+
await termRequest(deps.paths, { op: "kill-server" }, { start: false });
|
|
17019
|
+
if (!await waitForPidGone(info.pid, deps.stopDeadlineMs)) {
|
|
17020
|
+
throw new CliCommandError("PC_START_FAILED", `The old terminal service (pid ${info.pid}) did not stop. Restart this PC, then run \`npx -y ainecto@latest\` again.`);
|
|
17021
|
+
}
|
|
17022
|
+
}
|
|
16987
17023
|
async function withRegistration(deps, key, userId, code) {
|
|
16988
17024
|
if (code === 0) await registerBrowserOnStart(deps, { key, userId });
|
|
16989
17025
|
return code;
|