@adhdev/daemon-standalone 1.0.30-rc.1 → 1.0.30
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 +980 -512
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/{index-CymiuPZJ.js → index-DxPMyJIl.js} +5 -5
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +278 -3
- package/vendor/mcp-server/index.js.map +1 -1
- package/vendor/mcp-server/package.json +1 -1
- package/vendor/session-host-daemon/index.d.mts +5 -0
- package/vendor/session-host-daemon/index.d.ts +5 -0
- package/vendor/session-host-daemon/index.js +24 -3
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +26 -4
- package/vendor/session-host-daemon/index.mjs.map +1 -1
|
@@ -29,7 +29,8 @@ import {
|
|
|
29
29
|
classifyTermination,
|
|
30
30
|
createLineParser,
|
|
31
31
|
createResponseEnvelope,
|
|
32
|
-
getDefaultSessionHostEndpoint
|
|
32
|
+
getDefaultSessionHostEndpoint,
|
|
33
|
+
isTerminalRecord
|
|
33
34
|
} from "@adhdev/session-host-core";
|
|
34
35
|
|
|
35
36
|
// src/runtime.ts
|
|
@@ -1071,9 +1072,15 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
1071
1072
|
this.persistNow(sessionId);
|
|
1072
1073
|
}, 200));
|
|
1073
1074
|
}
|
|
1074
|
-
|
|
1075
|
+
/**
|
|
1076
|
+
* @param allowTerminal - write even if the record is terminal. Only the exit
|
|
1077
|
+
* handler sets this, to stamp the final terminated record for the brief
|
|
1078
|
+
* post-mortem window before cleanup.
|
|
1079
|
+
*/
|
|
1080
|
+
persistNow(sessionId, allowTerminal = false) {
|
|
1075
1081
|
const record = this.registry.getSession(sessionId);
|
|
1076
1082
|
if (!record) return;
|
|
1083
|
+
if (!allowTerminal && isTerminalRecord(record)) return;
|
|
1077
1084
|
const snapshot = this.getSnapshot(sessionId);
|
|
1078
1085
|
try {
|
|
1079
1086
|
this.storage.save(record, snapshot);
|
|
@@ -1309,6 +1316,11 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
1309
1316
|
this.recordRuntimeTransition(record.sessionId, "prune_duplicate_timeout", "stopping", void 0, false, error?.message || String(error));
|
|
1310
1317
|
});
|
|
1311
1318
|
}
|
|
1319
|
+
const pendingPersistTimer = this.persistTimers.get(record.sessionId);
|
|
1320
|
+
if (pendingPersistTimer) {
|
|
1321
|
+
clearTimeout(pendingPersistTimer);
|
|
1322
|
+
this.persistTimers.delete(record.sessionId);
|
|
1323
|
+
}
|
|
1312
1324
|
this.registry.deleteSession(record.sessionId);
|
|
1313
1325
|
this.storage.remove(record.sessionId);
|
|
1314
1326
|
this.storage.removeTombstone(record.sessionId);
|
|
@@ -1354,7 +1366,12 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
1354
1366
|
this.registry.markStopped(record.sessionId, termination.lifecycle, termination);
|
|
1355
1367
|
this.runtimes.delete(record.sessionId);
|
|
1356
1368
|
this.resolveExitWaiters(record.sessionId, exitCode);
|
|
1357
|
-
this.
|
|
1369
|
+
const pendingPersistTimer = this.persistTimers.get(record.sessionId);
|
|
1370
|
+
if (pendingPersistTimer) {
|
|
1371
|
+
clearTimeout(pendingPersistTimer);
|
|
1372
|
+
this.persistTimers.delete(record.sessionId);
|
|
1373
|
+
}
|
|
1374
|
+
this.persistNow(record.sessionId, true);
|
|
1358
1375
|
this.storage.saveTombstone(record.sessionId, termination);
|
|
1359
1376
|
this.emitEvent({ type: "session_exit", sessionId: record.sessionId, exitCode, signal, termination });
|
|
1360
1377
|
const summary = `reason=${termination.reason} exitCode=${termination.exitCode === null ? "unknown" : termination.exitCode} signal=${termination.signal ?? "none"}`;
|
|
@@ -1383,7 +1400,12 @@ var SessionHostServer = class extends EventEmitter {
|
|
|
1383
1400
|
termination.lifecycle === "stopped",
|
|
1384
1401
|
termination.lifecycle === "stopped" ? void 0 : summary
|
|
1385
1402
|
);
|
|
1386
|
-
setTimeout(() =>
|
|
1403
|
+
setTimeout(() => {
|
|
1404
|
+
const current = this.registry.getSession(record.sessionId);
|
|
1405
|
+
if (current && !isTerminalRecord(current)) return;
|
|
1406
|
+
this.registry.deleteSession(record.sessionId);
|
|
1407
|
+
this.storage.remove(record.sessionId);
|
|
1408
|
+
}, 5e3).unref?.();
|
|
1387
1409
|
return termination;
|
|
1388
1410
|
}
|
|
1389
1411
|
};
|