@runtimescope/mcp-server 0.7.0 → 0.7.1
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 +31 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
SessionManager,
|
|
19
19
|
HttpServer,
|
|
20
20
|
SqliteStore,
|
|
21
|
+
isSqliteAvailable,
|
|
21
22
|
AuthManager,
|
|
22
23
|
Redactor,
|
|
23
24
|
resolveTlsConfig,
|
|
@@ -227,7 +228,7 @@ function registerIssueTools(server, store, apiDiscovery, processMonitor) {
|
|
|
227
228
|
const allIssues = [...detectIssues(events)];
|
|
228
229
|
if (apiDiscovery) {
|
|
229
230
|
try {
|
|
230
|
-
allIssues.push(...apiDiscovery.detectIssues(
|
|
231
|
+
allIssues.push(...apiDiscovery.detectIssues());
|
|
231
232
|
} catch {
|
|
232
233
|
}
|
|
233
234
|
}
|
|
@@ -4977,36 +4978,43 @@ async function main() {
|
|
|
4977
4978
|
}
|
|
4978
4979
|
}
|
|
4979
4980
|
}, AUTO_SNAPSHOT_INTERVAL_MS);
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
const
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4981
|
+
if (isSqliteAvailable()) {
|
|
4982
|
+
const RETENTION_DAYS = parseInt(process.env.RUNTIMESCOPE_RETENTION_DAYS ?? "30", 10);
|
|
4983
|
+
const cutoffMs = Date.now() - RETENTION_DAYS * 24 * 60 * 60 * 1e3;
|
|
4984
|
+
for (const projectName of projectManager.listProjects()) {
|
|
4985
|
+
const dbPath = projectManager.getProjectDbPath(projectName);
|
|
4986
|
+
if (existsSync2(dbPath)) {
|
|
4987
|
+
try {
|
|
4988
|
+
const tempStore = new SqliteStore({ dbPath });
|
|
4989
|
+
const deleted = tempStore.deleteOldEvents(cutoffMs);
|
|
4990
|
+
if (deleted > 0) {
|
|
4991
|
+
console.error(`[RuntimeScope] Pruned ${deleted} events older than ${RETENTION_DAYS}d from "${projectName}"`);
|
|
4992
|
+
}
|
|
4993
|
+
tempStore.close();
|
|
4994
|
+
} catch {
|
|
4990
4995
|
}
|
|
4991
|
-
tempStore.close();
|
|
4992
|
-
} catch {
|
|
4993
4996
|
}
|
|
4994
4997
|
}
|
|
4995
4998
|
}
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
4999
|
+
let pmStore;
|
|
5000
|
+
let discovery;
|
|
5001
|
+
if (isSqliteAvailable()) {
|
|
5002
|
+
const pmDbPath = join2(projectManager.rootDir, "pm.db");
|
|
5003
|
+
pmStore = new PmStore({ dbPath: pmDbPath });
|
|
5004
|
+
discovery = new ProjectDiscovery(pmStore, projectManager);
|
|
5005
|
+
discovery.discoverAll().then((result) => {
|
|
5006
|
+
console.error(`[RuntimeScope] PM: ${result.projectsDiscovered} projects, ${result.sessionsDiscovered} sessions discovered`);
|
|
5007
|
+
}).catch((err) => {
|
|
5008
|
+
console.error("[RuntimeScope] PM discovery error:", err.message);
|
|
5009
|
+
});
|
|
5010
|
+
}
|
|
5004
5011
|
const httpServer = new HttpServer(store, processMonitor, {
|
|
5005
5012
|
authManager,
|
|
5006
5013
|
allowedOrigins: corsOrigins,
|
|
5007
5014
|
rateLimiter: collector.getRateLimiter(),
|
|
5008
5015
|
pmStore,
|
|
5009
|
-
discovery
|
|
5016
|
+
discovery,
|
|
5017
|
+
getConnectedSessions: () => collector.getConnectedSessions()
|
|
5010
5018
|
});
|
|
5011
5019
|
try {
|
|
5012
5020
|
await httpServer.start({ port: HTTP_PORT2, tls: tlsConfig });
|
|
@@ -5068,7 +5076,7 @@ async function main() {
|
|
|
5068
5076
|
await connectionManager.closeAll();
|
|
5069
5077
|
await httpServer.stop();
|
|
5070
5078
|
collector.stop();
|
|
5071
|
-
pmStore
|
|
5079
|
+
pmStore?.close();
|
|
5072
5080
|
process.exit(0);
|
|
5073
5081
|
};
|
|
5074
5082
|
process.on("SIGINT", () => {
|