opencode-fractal-memory 0.6.13 → 0.6.14
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/plugin/hooks.js +6 -1
- package/package.json +1 -1
package/dist/plugin/hooks.js
CHANGED
|
@@ -2,6 +2,7 @@ import { memLog, memLogSimple, setSessionId } from "../logging";
|
|
|
2
2
|
import { generateFileSummary, generateFileLabel, SOURCE_FILE_EXTENSIONS } from "../file-summary";
|
|
3
3
|
import { distillRules, predictiveRateToolCall, applyScoreDecay } from "../hooks";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
|
+
let activeSessionCount = 0;
|
|
5
6
|
export function createHookHandlers(store, client, memConfig, ruleCache, ruleCacheDirty, sessionInjectionLock, latestUserMessage, managementServer) {
|
|
6
7
|
return {
|
|
7
8
|
"experimental.chat.system.transform": async (input, output) => {
|
|
@@ -155,6 +156,7 @@ export function createHookHandlers(store, client, memConfig, ruleCache, ruleCach
|
|
|
155
156
|
const sessionId = properties.info?.id ?? "unknown";
|
|
156
157
|
await store.createSessionMetrics(sessionId);
|
|
157
158
|
setSessionId(sessionId);
|
|
159
|
+
activeSessionCount++;
|
|
158
160
|
managementServer.start();
|
|
159
161
|
}
|
|
160
162
|
else if (type === "session.idle") {
|
|
@@ -168,7 +170,10 @@ export function createHookHandlers(store, client, memConfig, ruleCache, ruleCach
|
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
else if (type === "session.deleted") {
|
|
171
|
-
|
|
173
|
+
activeSessionCount = Math.max(0, activeSessionCount - 1);
|
|
174
|
+
if (activeSessionCount === 0) {
|
|
175
|
+
managementServer.stop();
|
|
176
|
+
}
|
|
172
177
|
}
|
|
173
178
|
},
|
|
174
179
|
};
|