adhdev 1.0.82-rc.24 → 1.0.82-rc.25
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/cli/adhdev-mcp.js +5 -5
- package/dist/cli/index.js +5 -5
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +1 -1
- package/vendor/session-host-daemon/index.d.mts +34 -1
- package/vendor/session-host-daemon/index.d.ts +34 -1
- package/vendor/session-host-daemon/index.js +91 -22
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +89 -21
- package/vendor/session-host-daemon/index.mjs.map +1 -1
package/dist/cli/adhdev-mcp.js
CHANGED
|
@@ -9244,10 +9244,10 @@ function readInjected(value) {
|
|
|
9244
9244
|
}
|
|
9245
9245
|
function getDaemonBuildInfo() {
|
|
9246
9246
|
if (cached) return cached;
|
|
9247
|
-
const commit2 = readInjected(true ? "
|
|
9248
|
-
const commitShort = readInjected(true ? "
|
|
9249
|
-
const version2 = readInjected(true ? "1.0.82-rc.
|
|
9250
|
-
const builtAt = readInjected(true ? "2026-10-
|
|
9247
|
+
const commit2 = readInjected(true ? "cfb3a94bf41a1ec819f3fc314b991c0039cd6897" : void 0) ?? "unknown";
|
|
9248
|
+
const commitShort = readInjected(true ? "cfb3a94bf" : void 0) ?? (commit2 !== "unknown" ? commit2.slice(0, 7) : "unknown");
|
|
9249
|
+
const version2 = readInjected(true ? "1.0.82-rc.25" : void 0) ?? readInjected(typeof process !== "undefined" ? "1.0.82-rc.25" : void 0) ?? "unknown";
|
|
9250
|
+
const builtAt = readInjected(true ? "2026-10-21T04:23:23.322Z" : void 0);
|
|
9251
9251
|
cached = builtAt ? { commit: commit2, commitShort, version: version2, builtAt } : { commit: commit2, commitShort, version: version2 };
|
|
9252
9252
|
return cached;
|
|
9253
9253
|
}
|
|
@@ -231707,7 +231707,7 @@ var init_adhdev_daemon = __esm({
|
|
|
231707
231707
|
init_daemon_mandatory_update();
|
|
231708
231708
|
init_daemon_local_ipc_http();
|
|
231709
231709
|
init_daemon_pid();
|
|
231710
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "1.0.82-rc.
|
|
231710
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "1.0.82-rc.25" });
|
|
231711
231711
|
ARGV_STANDALONE_PATH_SEGMENT2 = /[\\/]daemon-standalone[\\/]/;
|
|
231712
231712
|
AdhdevDaemon = class {
|
|
231713
231713
|
serverConn = null;
|
package/dist/cli/index.js
CHANGED
|
@@ -9244,10 +9244,10 @@ function readInjected(value) {
|
|
|
9244
9244
|
}
|
|
9245
9245
|
function getDaemonBuildInfo() {
|
|
9246
9246
|
if (cached) return cached;
|
|
9247
|
-
const commit2 = readInjected(true ? "
|
|
9248
|
-
const commitShort = readInjected(true ? "
|
|
9249
|
-
const version2 = readInjected(true ? "1.0.82-rc.
|
|
9250
|
-
const builtAt = readInjected(true ? "2026-10-
|
|
9247
|
+
const commit2 = readInjected(true ? "cfb3a94bf41a1ec819f3fc314b991c0039cd6897" : void 0) ?? "unknown";
|
|
9248
|
+
const commitShort = readInjected(true ? "cfb3a94bf" : void 0) ?? (commit2 !== "unknown" ? commit2.slice(0, 7) : "unknown");
|
|
9249
|
+
const version2 = readInjected(true ? "1.0.82-rc.25" : void 0) ?? readInjected(typeof process !== "undefined" ? "1.0.82-rc.25" : void 0) ?? "unknown";
|
|
9250
|
+
const builtAt = readInjected(true ? "2026-10-21T04:23:23.322Z" : void 0);
|
|
9251
9251
|
cached = builtAt ? { commit: commit2, commitShort, version: version2, builtAt } : { commit: commit2, commitShort, version: version2 };
|
|
9252
9252
|
return cached;
|
|
9253
9253
|
}
|
|
@@ -231349,7 +231349,7 @@ var init_adhdev_daemon = __esm({
|
|
|
231349
231349
|
init_daemon_mandatory_update();
|
|
231350
231350
|
init_daemon_local_ipc_http();
|
|
231351
231351
|
init_daemon_pid();
|
|
231352
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "1.0.82-rc.
|
|
231352
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "1.0.82-rc.25" });
|
|
231353
231353
|
ARGV_STANDALONE_PATH_SEGMENT2 = /[\\/]daemon-standalone[\\/]/;
|
|
231354
231354
|
AdhdevDaemon = class {
|
|
231355
231355
|
serverConn = null;
|
package/dist/index.js
CHANGED
|
@@ -8790,10 +8790,10 @@ function readInjected(value) {
|
|
|
8790
8790
|
}
|
|
8791
8791
|
function getDaemonBuildInfo() {
|
|
8792
8792
|
if (cached) return cached;
|
|
8793
|
-
const commit2 = readInjected(true ? "
|
|
8794
|
-
const commitShort = readInjected(true ? "
|
|
8795
|
-
const version2 = readInjected(true ? "1.0.82-rc.
|
|
8796
|
-
const builtAt = readInjected(true ? "2026-10-
|
|
8793
|
+
const commit2 = readInjected(true ? "cfb3a94bf41a1ec819f3fc314b991c0039cd6897" : void 0) ?? "unknown";
|
|
8794
|
+
const commitShort = readInjected(true ? "cfb3a94bf" : void 0) ?? (commit2 !== "unknown" ? commit2.slice(0, 7) : "unknown");
|
|
8795
|
+
const version2 = readInjected(true ? "1.0.82-rc.25" : void 0) ?? readInjected(typeof process !== "undefined" ? "1.0.82-rc.25" : void 0) ?? "unknown";
|
|
8796
|
+
const builtAt = readInjected(true ? "2026-10-21T04:23:23.322Z" : void 0);
|
|
8797
8797
|
cached = builtAt ? { commit: commit2, commitShort, version: version2, builtAt } : { commit: commit2, commitShort, version: version2 };
|
|
8798
8798
|
return cached;
|
|
8799
8799
|
}
|
|
@@ -198775,7 +198775,7 @@ var init_adhdev_daemon = __esm({
|
|
|
198775
198775
|
init_daemon_mandatory_update();
|
|
198776
198776
|
init_daemon_local_ipc_http();
|
|
198777
198777
|
init_daemon_pid();
|
|
198778
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "1.0.82-rc.
|
|
198778
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "1.0.82-rc.25" });
|
|
198779
198779
|
ARGV_STANDALONE_PATH_SEGMENT2 = /[\\/]daemon-standalone[\\/]/;
|
|
198780
198780
|
AdhdevDaemon = class {
|
|
198781
198781
|
serverConn = null;
|
package/package.json
CHANGED
|
@@ -28676,7 +28676,7 @@ ${renderWorkerProtocolFooter2(input)}`;
|
|
|
28676
28676
|
if (cached) return cached;
|
|
28677
28677
|
const commit2 = readInjected(true ? "unknown" : void 0) ?? "unknown";
|
|
28678
28678
|
const commitShort = readInjected(true ? "unknown" : void 0) ?? (commit2 !== "unknown" ? commit2.slice(0, 7) : "unknown");
|
|
28679
|
-
const version2 = readInjected(true ? "1.0.82-rc.
|
|
28679
|
+
const version2 = readInjected(true ? "1.0.82-rc.25" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
28680
28680
|
const builtAt = readInjected(true ? "unknown" : void 0);
|
|
28681
28681
|
cached = builtAt ? { commit: commit2, commitShort, version: version2, builtAt } : { commit: commit2, commitShort, version: version2 };
|
|
28682
28682
|
return cached;
|
|
@@ -81,6 +81,39 @@ declare class SessionHostServer extends EventEmitter {
|
|
|
81
81
|
private handleRuntimeExit;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Detects a wedged libuv thread pool and reports it once.
|
|
86
|
+
*
|
|
87
|
+
* node-pty writes to the PTY with `fs.write`, which runs on the libuv thread
|
|
88
|
+
* pool. On 2026-10-21 a preview host was found with every pool request
|
|
89
|
+
* (`fs.*`, `crypto.pbkdf2`, `dns.lookup`) never completing while the main loop
|
|
90
|
+
* still served IPC: the host acknowledged every `send_input`, the PTY write
|
|
91
|
+
* queue grew without draining, and no hosted session could receive input for
|
|
92
|
+
* hours. Nothing in that state recovers on its own, and a host that answers
|
|
93
|
+
* IPC never looks dead to the daemon, so the host has to notice it itself.
|
|
94
|
+
*
|
|
95
|
+
* One probe is in flight at a time. A probe that does not complete within
|
|
96
|
+
* `stallMs` means the pool is not making progress; `onStall` fires once and
|
|
97
|
+
* the watchdog stops. Timers are unref'd so the watchdog never keeps the
|
|
98
|
+
* process alive.
|
|
99
|
+
*/
|
|
100
|
+
interface ThreadpoolWatchdogOptions {
|
|
101
|
+
/** How often to start a probe when none is in flight. */
|
|
102
|
+
intervalMs?: number;
|
|
103
|
+
/** How long one probe may stay in flight before the pool counts as wedged. */
|
|
104
|
+
stallMs?: number;
|
|
105
|
+
/** A thread-pool operation that calls `done` when it completes. */
|
|
106
|
+
probe?: (done: () => void) => void;
|
|
107
|
+
onStall: (stalledForMs: number) => void;
|
|
108
|
+
now?: () => number;
|
|
109
|
+
}
|
|
110
|
+
interface ThreadpoolWatchdog {
|
|
111
|
+
stop(): void;
|
|
112
|
+
/** Runs one check immediately; exposed for tests. */
|
|
113
|
+
tick(): void;
|
|
114
|
+
}
|
|
115
|
+
declare function startThreadpoolWatchdog(options: ThreadpoolWatchdogOptions): ThreadpoolWatchdog;
|
|
116
|
+
|
|
84
117
|
interface GuardianArtifactPins {
|
|
85
118
|
packageRoot: string;
|
|
86
119
|
manifestPath: string;
|
|
@@ -101,4 +134,4 @@ declare function createUncaughtExceptionLimiter(windowMs?: number, limit?: numbe
|
|
|
101
134
|
countInWindow: number;
|
|
102
135
|
};
|
|
103
136
|
|
|
104
|
-
export { type GuardianArtifactPins, type HostUpgradeBinding, SessionHostServer, type SessionHostServerOptions, createUncaughtExceptionLimiter, resolveGuardianArtifact };
|
|
137
|
+
export { type GuardianArtifactPins, type HostUpgradeBinding, SessionHostServer, type SessionHostServerOptions, createUncaughtExceptionLimiter, resolveGuardianArtifact, startThreadpoolWatchdog };
|
|
@@ -81,6 +81,39 @@ declare class SessionHostServer extends EventEmitter {
|
|
|
81
81
|
private handleRuntimeExit;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Detects a wedged libuv thread pool and reports it once.
|
|
86
|
+
*
|
|
87
|
+
* node-pty writes to the PTY with `fs.write`, which runs on the libuv thread
|
|
88
|
+
* pool. On 2026-10-21 a preview host was found with every pool request
|
|
89
|
+
* (`fs.*`, `crypto.pbkdf2`, `dns.lookup`) never completing while the main loop
|
|
90
|
+
* still served IPC: the host acknowledged every `send_input`, the PTY write
|
|
91
|
+
* queue grew without draining, and no hosted session could receive input for
|
|
92
|
+
* hours. Nothing in that state recovers on its own, and a host that answers
|
|
93
|
+
* IPC never looks dead to the daemon, so the host has to notice it itself.
|
|
94
|
+
*
|
|
95
|
+
* One probe is in flight at a time. A probe that does not complete within
|
|
96
|
+
* `stallMs` means the pool is not making progress; `onStall` fires once and
|
|
97
|
+
* the watchdog stops. Timers are unref'd so the watchdog never keeps the
|
|
98
|
+
* process alive.
|
|
99
|
+
*/
|
|
100
|
+
interface ThreadpoolWatchdogOptions {
|
|
101
|
+
/** How often to start a probe when none is in flight. */
|
|
102
|
+
intervalMs?: number;
|
|
103
|
+
/** How long one probe may stay in flight before the pool counts as wedged. */
|
|
104
|
+
stallMs?: number;
|
|
105
|
+
/** A thread-pool operation that calls `done` when it completes. */
|
|
106
|
+
probe?: (done: () => void) => void;
|
|
107
|
+
onStall: (stalledForMs: number) => void;
|
|
108
|
+
now?: () => number;
|
|
109
|
+
}
|
|
110
|
+
interface ThreadpoolWatchdog {
|
|
111
|
+
stop(): void;
|
|
112
|
+
/** Runs one check immediately; exposed for tests. */
|
|
113
|
+
tick(): void;
|
|
114
|
+
}
|
|
115
|
+
declare function startThreadpoolWatchdog(options: ThreadpoolWatchdogOptions): ThreadpoolWatchdog;
|
|
116
|
+
|
|
84
117
|
interface GuardianArtifactPins {
|
|
85
118
|
packageRoot: string;
|
|
86
119
|
manifestPath: string;
|
|
@@ -101,4 +134,4 @@ declare function createUncaughtExceptionLimiter(windowMs?: number, limit?: numbe
|
|
|
101
134
|
countInWindow: number;
|
|
102
135
|
};
|
|
103
136
|
|
|
104
|
-
export { type GuardianArtifactPins, type HostUpgradeBinding, SessionHostServer, type SessionHostServerOptions, createUncaughtExceptionLimiter, resolveGuardianArtifact };
|
|
137
|
+
export { type GuardianArtifactPins, type HostUpgradeBinding, SessionHostServer, type SessionHostServerOptions, createUncaughtExceptionLimiter, resolveGuardianArtifact, startThreadpoolWatchdog };
|
|
@@ -33,11 +33,12 @@ var index_exports = {};
|
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
SessionHostServer: () => SessionHostServer,
|
|
35
35
|
createUncaughtExceptionLimiter: () => createUncaughtExceptionLimiter,
|
|
36
|
-
resolveGuardianArtifact: () => resolveGuardianArtifact
|
|
36
|
+
resolveGuardianArtifact: () => resolveGuardianArtifact,
|
|
37
|
+
startThreadpoolWatchdog: () => startThreadpoolWatchdog
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(index_exports);
|
|
39
40
|
var import_crypto = require("crypto");
|
|
40
|
-
var
|
|
41
|
+
var fs7 = __toESM(require("fs"));
|
|
41
42
|
var path6 = __toESM(require("path"));
|
|
42
43
|
var import_session_host_core6 = require("@adhdev/session-host-core");
|
|
43
44
|
|
|
@@ -297,8 +298,8 @@ var PtySessionRuntime = class {
|
|
|
297
298
|
let cwd = this.payload.workspace || process.cwd();
|
|
298
299
|
if (cwd) {
|
|
299
300
|
try {
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
301
|
+
const stat2 = fs2.statSync(cwd);
|
|
302
|
+
if (!stat2.isDirectory()) cwd = os.homedir();
|
|
302
303
|
} catch {
|
|
303
304
|
cwd = os.homedir();
|
|
304
305
|
}
|
|
@@ -550,8 +551,8 @@ var HostUpgradeLease = class {
|
|
|
550
551
|
try {
|
|
551
552
|
if (this.binding.helperFileIdentity && (this.fileIdentity() !== this.binding.helperFileIdentity || digest(fs3.readFileSync(this.binding.helperPath)) !== this.binding.helperSha256)) throw new Error("native_host_helper_file_identity_changed");
|
|
552
553
|
if (fs3.existsSync(this.journal)) {
|
|
553
|
-
const
|
|
554
|
-
if (!
|
|
554
|
+
const stat2 = fs3.lstatSync(this.journal);
|
|
555
|
+
if (!stat2.isFile() || stat2.isSymbolicLink() || stat2.uid !== process.getuid?.() || stat2.mode & 63) throw new Error("native_host_lease_untrusted");
|
|
555
556
|
const value = JSON.parse(fs3.readFileSync(this.journal, "utf8"));
|
|
556
557
|
if (value.schema !== 1 || value.endpoint !== this.endpoint || !Number.isSafeInteger(value.epoch) || value.epoch < 0 || typeof value.held !== "boolean" || (value.held ? typeof value.owner !== "string" || typeof value.tokenHash !== "string" || !/^[a-f0-9]{64}$/.test(value.tokenHash) : value.owner !== null || value.tokenHash !== null)) throw new Error("native_host_lease_corrupt");
|
|
557
558
|
this.state = value;
|
|
@@ -652,8 +653,8 @@ var SessionHostStorage = class {
|
|
|
652
653
|
/** Unknown/corrupt recovery files also veto idle admission; reads names only. */
|
|
653
654
|
hasRuntimeEntries() {
|
|
654
655
|
if (!fs4.existsSync(this.runtimesDir)) return false;
|
|
655
|
-
const
|
|
656
|
-
if (!
|
|
656
|
+
const stat2 = fs4.lstatSync(this.runtimesDir);
|
|
657
|
+
if (!stat2.isDirectory() || stat2.isSymbolicLink()) throw new Error("native_host_runtime_storage_untrusted");
|
|
657
658
|
return fs4.readdirSync(this.runtimesDir).length > 0;
|
|
658
659
|
}
|
|
659
660
|
loadAll() {
|
|
@@ -1779,8 +1780,59 @@ var SessionHostServer = class extends import_events.EventEmitter {
|
|
|
1779
1780
|
}
|
|
1780
1781
|
};
|
|
1781
1782
|
|
|
1783
|
+
// src/threadpool-watchdog.ts
|
|
1784
|
+
var fs6 = __toESM(require("fs"));
|
|
1785
|
+
var os2 = __toESM(require("os"));
|
|
1786
|
+
var THREADPOOL_WATCHDOG_INTERVAL_MS = 15e3;
|
|
1787
|
+
var THREADPOOL_WATCHDOG_STALL_MS = 12e4;
|
|
1788
|
+
function defaultProbe(done) {
|
|
1789
|
+
fs6.stat(os2.tmpdir(), () => done());
|
|
1790
|
+
}
|
|
1791
|
+
function startThreadpoolWatchdog(options) {
|
|
1792
|
+
const intervalMs = options.intervalMs ?? THREADPOOL_WATCHDOG_INTERVAL_MS;
|
|
1793
|
+
const stallMs = options.stallMs ?? THREADPOOL_WATCHDOG_STALL_MS;
|
|
1794
|
+
const probe = options.probe ?? defaultProbe;
|
|
1795
|
+
const now = options.now ?? Date.now;
|
|
1796
|
+
let inFlightSince = null;
|
|
1797
|
+
let stopped = false;
|
|
1798
|
+
const tick = () => {
|
|
1799
|
+
if (stopped) return;
|
|
1800
|
+
if (inFlightSince !== null) {
|
|
1801
|
+
const stalledForMs = now() - inFlightSince;
|
|
1802
|
+
if (stalledForMs >= stallMs) {
|
|
1803
|
+
stopped = true;
|
|
1804
|
+
clearInterval(timer);
|
|
1805
|
+
options.onStall(stalledForMs);
|
|
1806
|
+
}
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
const startedAt = now();
|
|
1810
|
+
inFlightSince = startedAt;
|
|
1811
|
+
probe(() => {
|
|
1812
|
+
if (inFlightSince === startedAt) inFlightSince = null;
|
|
1813
|
+
});
|
|
1814
|
+
};
|
|
1815
|
+
const timer = setInterval(tick, intervalMs);
|
|
1816
|
+
timer.unref?.();
|
|
1817
|
+
return {
|
|
1818
|
+
stop() {
|
|
1819
|
+
stopped = true;
|
|
1820
|
+
clearInterval(timer);
|
|
1821
|
+
},
|
|
1822
|
+
tick
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
function writeStderrLineSync(line) {
|
|
1826
|
+
try {
|
|
1827
|
+
fs6.writeSync(2, `${line}
|
|
1828
|
+
`);
|
|
1829
|
+
} catch {
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1782
1833
|
// src/index.ts
|
|
1783
1834
|
var SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
|
|
1835
|
+
var SHUTDOWN_DEADLINE_MS = 1e4;
|
|
1784
1836
|
var INSTANCE_CONFIG_DIR = (0, import_session_host_core6.resolveInstanceConfigDir)(process.env);
|
|
1785
1837
|
var INSTANCE_IPC_KEY = (0, import_session_host_core6.resolveSessionHostIpcKey)(INSTANCE_CONFIG_DIR);
|
|
1786
1838
|
function getSessionHostEndpoint() {
|
|
@@ -1791,15 +1843,15 @@ function getSessionHostStorageRoot() {
|
|
|
1791
1843
|
}
|
|
1792
1844
|
function getSessionHostPidFile(appName) {
|
|
1793
1845
|
const dir = INSTANCE_CONFIG_DIR;
|
|
1794
|
-
if (!
|
|
1846
|
+
if (!fs7.existsSync(dir)) fs7.mkdirSync(dir, { recursive: true });
|
|
1795
1847
|
return path6.join(dir, `${appName}-session-host.pid`);
|
|
1796
1848
|
}
|
|
1797
1849
|
function writeSessionHostPid(appName) {
|
|
1798
|
-
|
|
1850
|
+
fs7.writeFileSync(getSessionHostPidFile(appName), String(process.pid), "utf8");
|
|
1799
1851
|
}
|
|
1800
1852
|
function removeSessionHostPid(appName) {
|
|
1801
1853
|
try {
|
|
1802
|
-
|
|
1854
|
+
fs7.unlinkSync(getSessionHostPidFile(appName));
|
|
1803
1855
|
} catch {
|
|
1804
1856
|
}
|
|
1805
1857
|
}
|
|
@@ -1821,10 +1873,10 @@ async function runServer() {
|
|
|
1821
1873
|
let upgradeBinding;
|
|
1822
1874
|
const pinFile = process.env.ADHDEV_WORKER_GUARDIAN_PINS_FILE;
|
|
1823
1875
|
if (pinFile) {
|
|
1824
|
-
const
|
|
1825
|
-
if (process.platform !== "darwin" ||
|
|
1826
|
-
const pins = JSON.parse(
|
|
1827
|
-
if (pins.nodePath !==
|
|
1876
|
+
const stat2 = fs7.lstatSync(pinFile);
|
|
1877
|
+
if (process.platform !== "darwin" || fs7.realpathSync(pinFile) !== pinFile || !stat2.isFile() || stat2.uid !== process.getuid?.() || stat2.mode & 63) throw new Error("guardian_launch_pins_untrusted");
|
|
1878
|
+
const pins = JSON.parse(fs7.readFileSync(pinFile, "utf8"));
|
|
1879
|
+
if (pins.nodePath !== fs7.realpathSync(process.execPath) || pins.hostEntryPath !== fs7.realpathSync(process.argv[1]) || pins.stateDir !== path6.join(INSTANCE_CONFIG_DIR, "session-host")) throw new Error("guardian_launch_executable_or_instance_mismatch");
|
|
1828
1880
|
upgradeBinding = resolveGuardianArtifact(pins);
|
|
1829
1881
|
}
|
|
1830
1882
|
const server = new SessionHostServer({
|
|
@@ -1836,15 +1888,31 @@ async function runServer() {
|
|
|
1836
1888
|
if (!upgradeBinding) writeSessionHostPid(SESSION_HOST_APP_NAME);
|
|
1837
1889
|
await server.start();
|
|
1838
1890
|
if (upgradeBinding) writeSessionHostPid(SESSION_HOST_APP_NAME);
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1891
|
+
const shutdown = async () => {
|
|
1892
|
+
const deadline = setTimeout(() => {
|
|
1893
|
+
writeStderrLineSync(`[session-host] stop() did not finish within ${SHUTDOWN_DEADLINE_MS / 1e3}s; exiting anyway.`);
|
|
1894
|
+
removeSessionHostPid(SESSION_HOST_APP_NAME);
|
|
1895
|
+
process.exit(1);
|
|
1896
|
+
}, SHUTDOWN_DEADLINE_MS);
|
|
1897
|
+
deadline.unref?.();
|
|
1845
1898
|
await server.stop();
|
|
1846
1899
|
removeSessionHostPid(SESSION_HOST_APP_NAME);
|
|
1847
1900
|
process.exit(0);
|
|
1901
|
+
};
|
|
1902
|
+
process.on("SIGINT", shutdown);
|
|
1903
|
+
process.on("SIGTERM", shutdown);
|
|
1904
|
+
startThreadpoolWatchdog({
|
|
1905
|
+
onStall: (stalledForMs) => {
|
|
1906
|
+
writeStderrLineSync(
|
|
1907
|
+
`[session-host] libuv thread pool made no progress for ${Math.round(stalledForMs / 1e3)}s (PTY writes cannot complete); exiting so the daemon respawns the host.`
|
|
1908
|
+
);
|
|
1909
|
+
try {
|
|
1910
|
+
server.flushAllPersistence();
|
|
1911
|
+
} catch {
|
|
1912
|
+
}
|
|
1913
|
+
removeSessionHostPid(SESSION_HOST_APP_NAME);
|
|
1914
|
+
process.exit(1);
|
|
1915
|
+
}
|
|
1848
1916
|
});
|
|
1849
1917
|
process.on("exit", () => {
|
|
1850
1918
|
server.flushAllPersistence();
|
|
@@ -2187,6 +2255,7 @@ ${err?.stack || ""}`);
|
|
|
2187
2255
|
0 && (module.exports = {
|
|
2188
2256
|
SessionHostServer,
|
|
2189
2257
|
createUncaughtExceptionLimiter,
|
|
2190
|
-
resolveGuardianArtifact
|
|
2258
|
+
resolveGuardianArtifact,
|
|
2259
|
+
startThreadpoolWatchdog
|
|
2191
2260
|
});
|
|
2192
2261
|
//# sourceMappingURL=index.js.map
|