@devness/useai 0.5.19 → 0.5.20
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 +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2681,7 +2681,7 @@ var VERSION;
|
|
|
2681
2681
|
var init_version = __esm({
|
|
2682
2682
|
"../shared/dist/constants/version.js"() {
|
|
2683
2683
|
"use strict";
|
|
2684
|
-
VERSION = "0.5.
|
|
2684
|
+
VERSION = "0.5.20";
|
|
2685
2685
|
}
|
|
2686
2686
|
});
|
|
2687
2687
|
|
|
@@ -36950,7 +36950,7 @@ __export(daemon_exports, {
|
|
|
36950
36950
|
});
|
|
36951
36951
|
import { createServer } from "http";
|
|
36952
36952
|
import { createHash as createHash4, randomUUID as randomUUID4 } from "crypto";
|
|
36953
|
-
import { existsSync as existsSync11, readdirSync, readFileSync as readFileSync5, appendFileSync as appendFileSync2, renameSync as renameSync3, writeFileSync as writeFileSync5, unlinkSync as unlinkSync6 } from "fs";
|
|
36953
|
+
import { existsSync as existsSync11, readdirSync, readFileSync as readFileSync5, appendFileSync as appendFileSync2, renameSync as renameSync3, writeFileSync as writeFileSync5, unlinkSync as unlinkSync6, statSync } from "fs";
|
|
36954
36954
|
import { join as join10 } from "path";
|
|
36955
36955
|
function getActiveUseaiSessionIds() {
|
|
36956
36956
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -37060,12 +37060,22 @@ function sealOrphanFile(sessionId) {
|
|
|
37060
37060
|
function sealOrphanedSessions() {
|
|
37061
37061
|
if (!existsSync11(ACTIVE_DIR)) return;
|
|
37062
37062
|
const activeIds = getActiveUseaiSessionIds();
|
|
37063
|
+
const mcpMap = readMcpMap();
|
|
37064
|
+
const mappedUseaiIds = new Set(Object.values(mcpMap));
|
|
37063
37065
|
let sealed = 0;
|
|
37064
37066
|
try {
|
|
37065
37067
|
const files = readdirSync(ACTIVE_DIR).filter((f) => f.endsWith(".jsonl"));
|
|
37066
37068
|
for (const file of files) {
|
|
37067
37069
|
const sessionId = file.replace(".jsonl", "");
|
|
37068
37070
|
if (activeIds.has(sessionId)) continue;
|
|
37071
|
+
if (mappedUseaiIds.has(sessionId)) {
|
|
37072
|
+
try {
|
|
37073
|
+
const mtime = statSync(join10(ACTIVE_DIR, file)).mtimeMs;
|
|
37074
|
+
if (Date.now() - mtime < IDLE_TIMEOUT_MS) continue;
|
|
37075
|
+
} catch {
|
|
37076
|
+
continue;
|
|
37077
|
+
}
|
|
37078
|
+
}
|
|
37069
37079
|
sealOrphanFile(sessionId);
|
|
37070
37080
|
sealed++;
|
|
37071
37081
|
}
|