@adhdev/daemon-standalone 1.0.42 → 1.0.43
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/index.js +791 -707
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-B0peupbj.js → index-CM5X3KcB.js} +37 -37
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +3 -2
- package/vendor/mcp-server/index.js.map +1 -1
- package/vendor/mcp-server/package.json +3 -44
- package/vendor/session-host-daemon/index.js +21 -8
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +21 -8
- package/vendor/session-host-daemon/index.mjs.map +1 -1
|
@@ -9,7 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
import { randomUUID } from "crypto";
|
|
11
11
|
import * as fs4 from "fs";
|
|
12
|
-
import * as
|
|
12
|
+
import * as path3 from "path";
|
|
13
13
|
import {
|
|
14
14
|
SessionHostClient,
|
|
15
15
|
formatRuntimeOwner,
|
|
@@ -482,10 +482,20 @@ var SessionHostStorage = class {
|
|
|
482
482
|
};
|
|
483
483
|
|
|
484
484
|
// src/session-diagnostics.ts
|
|
485
|
+
import * as path2 from "path";
|
|
485
486
|
import {
|
|
486
487
|
SESSION_HOST_SUPPORTED_REQUEST_TYPES
|
|
487
488
|
} from "@adhdev/session-host-core";
|
|
488
489
|
var MAX_RECENT_DIAGNOSTICS = 200;
|
|
490
|
+
function resolveHostEntryPath() {
|
|
491
|
+
const entry = process.argv[1];
|
|
492
|
+
if (typeof entry !== "string" || !entry.trim()) return void 0;
|
|
493
|
+
try {
|
|
494
|
+
return path2.resolve(entry);
|
|
495
|
+
} catch {
|
|
496
|
+
return entry;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
489
499
|
function pushRecent(bucket, entry, max = MAX_RECENT_DIAGNOSTICS) {
|
|
490
500
|
bucket.push(entry);
|
|
491
501
|
if (bucket.length > max) {
|
|
@@ -539,6 +549,9 @@ function buildHostDiagnostics(params) {
|
|
|
539
549
|
return {
|
|
540
550
|
hostStartedAt: params.hostStartedAt,
|
|
541
551
|
endpoint: params.endpointPath,
|
|
552
|
+
// Self-reported so a client can tell WHICH install this host runs from
|
|
553
|
+
// without needing process-inspection privileges. See SessionHostDiagnostics.
|
|
554
|
+
hostEntryPath: resolveHostEntryPath(),
|
|
542
555
|
runtimeCount: params.runtimeCount,
|
|
543
556
|
supportedRequestTypes: [...SESSION_HOST_SUPPORTED_REQUEST_TYPES],
|
|
544
557
|
sessions,
|
|
@@ -732,8 +745,8 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
732
745
|
void this.handleIncomingRequest(socket, envelope);
|
|
733
746
|
}));
|
|
734
747
|
});
|
|
735
|
-
await new Promise((
|
|
736
|
-
this.ipcServer?.once("listening", () =>
|
|
748
|
+
await new Promise((resolve2, reject) => {
|
|
749
|
+
this.ipcServer?.once("listening", () => resolve2());
|
|
737
750
|
this.ipcServer?.once("error", reject);
|
|
738
751
|
this.ipcServer?.listen(this.endpoint.path);
|
|
739
752
|
});
|
|
@@ -767,7 +780,7 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
767
780
|
if (this.ipcServer) {
|
|
768
781
|
const server = this.ipcServer;
|
|
769
782
|
this.ipcServer = null;
|
|
770
|
-
await new Promise((
|
|
783
|
+
await new Promise((resolve2) => server.close(() => resolve2()));
|
|
771
784
|
}
|
|
772
785
|
if (this.endpoint.kind === "unix") {
|
|
773
786
|
try {
|
|
@@ -1191,7 +1204,7 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
1191
1204
|
if (!this.runtimes.has(sessionId)) {
|
|
1192
1205
|
return Promise.resolve(this.registry.getSession(sessionId)?.lifecycle === "failed" ? 1 : 0);
|
|
1193
1206
|
}
|
|
1194
|
-
return new Promise((
|
|
1207
|
+
return new Promise((resolve2, reject) => {
|
|
1195
1208
|
const timeout = setTimeout(() => {
|
|
1196
1209
|
const waiters2 = this.exitWaiters.get(sessionId) || [];
|
|
1197
1210
|
this.exitWaiters.set(sessionId, waiters2.filter((waiter) => waiter !== onExit));
|
|
@@ -1199,7 +1212,7 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
1199
1212
|
}, timeoutMs);
|
|
1200
1213
|
const onExit = (exitCode) => {
|
|
1201
1214
|
clearTimeout(timeout);
|
|
1202
|
-
|
|
1215
|
+
resolve2(exitCode);
|
|
1203
1216
|
};
|
|
1204
1217
|
const waiters = this.exitWaiters.get(sessionId) || [];
|
|
1205
1218
|
waiters.push(onExit);
|
|
@@ -1418,12 +1431,12 @@ function getSessionHostEndpoint() {
|
|
|
1418
1431
|
return getDefaultSessionHostEndpoint2(SESSION_HOST_APP_NAME, { ipcKey: INSTANCE_IPC_KEY });
|
|
1419
1432
|
}
|
|
1420
1433
|
function getSessionHostStorageRoot() {
|
|
1421
|
-
return
|
|
1434
|
+
return path3.join(INSTANCE_CONFIG_DIR, "session-host", SESSION_HOST_APP_NAME);
|
|
1422
1435
|
}
|
|
1423
1436
|
function getSessionHostPidFile(appName) {
|
|
1424
1437
|
const dir = INSTANCE_CONFIG_DIR;
|
|
1425
1438
|
if (!fs4.existsSync(dir)) fs4.mkdirSync(dir, { recursive: true });
|
|
1426
|
-
return
|
|
1439
|
+
return path3.join(dir, `${appName}-session-host.pid`);
|
|
1427
1440
|
}
|
|
1428
1441
|
function writeSessionHostPid(appName) {
|
|
1429
1442
|
fs4.writeFileSync(getSessionHostPidFile(appName), String(process.pid), "utf8");
|