sensorium-mcp 2.16.49 → 2.16.50
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.
|
@@ -14,6 +14,9 @@ export declare function saveFileToDisk(buffer: Buffer, filename: string): string
|
|
|
14
14
|
* Check if a maintenance/update is pending.
|
|
15
15
|
* The update watcher writes this file before restarting the server.
|
|
16
16
|
* Returns the flag file content (version info) or null if no maintenance pending.
|
|
17
|
+
*
|
|
18
|
+
* If the flag is older than 5 minutes it is assumed stale (the update watcher
|
|
19
|
+
* failed to clean it up) and is automatically deleted.
|
|
17
20
|
*/
|
|
18
21
|
export declare function checkMaintenanceFlag(): string | null;
|
|
19
22
|
//# sourceMappingURL=file-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../src/data/file-storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../src/data/file-storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,eAAO,MAAM,SAAS,QAAkD,CAAC;AAGzE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqBvE;AAUD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAuBpD"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { mkdirSync, existsSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { join } from "node:path";
|
|
10
|
+
import { log } from "../logger.js";
|
|
10
11
|
// ─── File storage ───────────────────────────────────────────────────────────
|
|
11
12
|
export const FILES_DIR = join(homedir(), ".remote-copilot-mcp", "files");
|
|
12
13
|
mkdirSync(FILES_DIR, { recursive: true });
|
|
@@ -41,15 +42,38 @@ export function saveFileToDisk(buffer, filename) {
|
|
|
41
42
|
// ─── Maintenance flag ───────────────────────────────────────────────────────
|
|
42
43
|
const DATA_DIR = join(homedir(), ".remote-copilot-mcp");
|
|
43
44
|
const MAINTENANCE_FLAG_PATH = join(DATA_DIR, "maintenance.flag");
|
|
45
|
+
/** Maximum age of a maintenance flag before it is considered stale (5 minutes). */
|
|
46
|
+
const MAINTENANCE_FLAG_MAX_AGE_MS = 5 * 60 * 1000;
|
|
44
47
|
/**
|
|
45
48
|
* Check if a maintenance/update is pending.
|
|
46
49
|
* The update watcher writes this file before restarting the server.
|
|
47
50
|
* Returns the flag file content (version info) or null if no maintenance pending.
|
|
51
|
+
*
|
|
52
|
+
* If the flag is older than 5 minutes it is assumed stale (the update watcher
|
|
53
|
+
* failed to clean it up) and is automatically deleted.
|
|
48
54
|
*/
|
|
49
55
|
export function checkMaintenanceFlag() {
|
|
50
56
|
try {
|
|
51
57
|
if (existsSync(MAINTENANCE_FLAG_PATH)) {
|
|
52
|
-
|
|
58
|
+
const raw = readFileSync(MAINTENANCE_FLAG_PATH, "utf-8").trim();
|
|
59
|
+
// The flag file is JSON with { version, timestamp (ISO-8601) }.
|
|
60
|
+
// Auto-clear if it has been sitting for too long.
|
|
61
|
+
try {
|
|
62
|
+
const parsed = JSON.parse(raw);
|
|
63
|
+
if (parsed.timestamp) {
|
|
64
|
+
const age = Date.now() - new Date(parsed.timestamp).getTime();
|
|
65
|
+
if (age > MAINTENANCE_FLAG_MAX_AGE_MS) {
|
|
66
|
+
log.warn(`Auto-clearing stale maintenance flag (age ${Math.round(age / 1000)}s): ${raw}`);
|
|
67
|
+
try {
|
|
68
|
+
unlinkSync(MAINTENANCE_FLAG_PATH);
|
|
69
|
+
}
|
|
70
|
+
catch { /* ignore */ }
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch { /* Not valid JSON — fall through and return raw content */ }
|
|
76
|
+
return raw;
|
|
53
77
|
}
|
|
54
78
|
}
|
|
55
79
|
catch { /* ignore read errors */ }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-storage.js","sourceRoot":"","sources":["../../src/data/file-storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"file-storage.js","sourceRoot":"","sources":["../../src/data/file-storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,+EAA+E;AAE/E,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;AACzE,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,QAAgB;IAC7D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;IACrC,MAAM,QAAQ,G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