cursor-mcp-feedback 2.0.1 → 2.0.2
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/hooks/session-utils.js +14 -3
- package/package.json +1 -1
package/hooks/session-utils.js
CHANGED
|
@@ -64,7 +64,7 @@ function ensureSession(convId, meta) {
|
|
|
64
64
|
createSession(convId, { ...meta, _lazy: true });
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const STALE_MS =
|
|
67
|
+
const STALE_MS = 72 * 60 * 60 * 1000; // 72 hours
|
|
68
68
|
|
|
69
69
|
function cleanupStaleSessions() {
|
|
70
70
|
const list = readJson(ACTIVE_FILE, []);
|
|
@@ -118,7 +118,17 @@ function endSession(convId, reason) {
|
|
|
118
118
|
conversation_id: convId,
|
|
119
119
|
reason,
|
|
120
120
|
});
|
|
121
|
-
|
|
121
|
+
markSessionInactive(convId);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function markSessionInactive(convId) {
|
|
125
|
+
const list = readJson(ACTIVE_FILE, []);
|
|
126
|
+
const idx = list.findIndex((s) => s.id === convId);
|
|
127
|
+
if (idx >= 0) {
|
|
128
|
+
list[idx].is_active = false;
|
|
129
|
+
list[idx].ended_at = Date.now();
|
|
130
|
+
writeJson(ACTIVE_FILE, list);
|
|
131
|
+
}
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
function updateActiveList(convId, meta, active) {
|
|
@@ -132,6 +142,7 @@ function updateActiveList(convId, meta, active) {
|
|
|
132
142
|
model: meta?.model || "",
|
|
133
143
|
started_at: meta?.created_at || Date.now(),
|
|
134
144
|
last_activity: Date.now(),
|
|
145
|
+
is_active: true,
|
|
135
146
|
};
|
|
136
147
|
if (idx >= 0) list[idx] = { ...list[idx], ...entry };
|
|
137
148
|
else list.push(entry);
|
|
@@ -245,7 +256,7 @@ module.exports = {
|
|
|
245
256
|
BASE_DIR, SESSIONS_DIR, ACTIVE_FILE, SUBAGENT_FILE, GLOBAL_PENDING,
|
|
246
257
|
ensureDir, sessionDir, readJson, writeJson, appendJsonl,
|
|
247
258
|
createSession, ensureSession, endSession, cleanupStaleSessions, maybeCleanup,
|
|
248
|
-
updateActiveList, touchSessionActivity,
|
|
259
|
+
updateActiveList, markSessionInactive, touchSessionActivity,
|
|
249
260
|
readSessionPending, writeSessionPending, addSessionPending, consumeSessionPending,
|
|
250
261
|
recordSubagent, removeSubagent, isSubagent,
|
|
251
262
|
getMostRecentSession, readGlobalPending, writeGlobalPending,
|
package/package.json
CHANGED