@cachly-dev/mcp-server 0.9.13 → 0.9.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/index.js +20 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cachly-dev/mcp-server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.14",
|
|
4
4
|
"mcpName": "io.github.cachly-dev/cachly-mcp",
|
|
5
5
|
"description": "Your AI forgets everything between sessions. cachly fixes that permanently. A causal brain that learns WHY things break — built from every bug fix, git commit, and CI run, without any explicit calls. Arrives pre-briefed each session. Predicts failures before they happen. Never re-researches the same problem. 63 MCP tools · Claude Code · Cursor · GitHub Copilot · Windsurf · Free tier · EU servers.",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -9861,6 +9861,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }))
|
|
|
9861
9861
|
|
|
9862
9862
|
let _autoSessionInstanceId: string | null = null;
|
|
9863
9863
|
let _autoSessionStarted = false;
|
|
9864
|
+
let _autoSessionStarting: Promise<void> | null = null; // guard against double-start race
|
|
9864
9865
|
let _autoSessionToolCount = 0;
|
|
9865
9866
|
|
|
9866
9867
|
// ── brain_from_git concurrency limiter ────────────────────────────────────────
|
|
@@ -9880,11 +9881,17 @@ function _gitSemRelease(): void {
|
|
|
9880
9881
|
|
|
9881
9882
|
async function autoStartSession(instanceId: string): Promise<void> {
|
|
9882
9883
|
if (_autoSessionStarted) return;
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9884
|
+
// If another call already started the session, await it instead of double-starting.
|
|
9885
|
+
if (_autoSessionStarting) { await _autoSessionStarting; return; }
|
|
9886
|
+
_autoSessionStarting = (async () => {
|
|
9887
|
+
_autoSessionStarted = true;
|
|
9888
|
+
_autoSessionInstanceId = instanceId;
|
|
9889
|
+
try {
|
|
9890
|
+
await handleTool('session_start', { instance_id: instanceId, focus: 'auto (MCP session)' });
|
|
9891
|
+
} catch { /* non-fatal — session tracking is a best-effort feature */ }
|
|
9892
|
+
_autoSessionStarting = null;
|
|
9893
|
+
})();
|
|
9894
|
+
await _autoSessionStarting;
|
|
9888
9895
|
|
|
9889
9896
|
// Auto-index the project if it hasn't been indexed in the last 24h.
|
|
9890
9897
|
// This is the main lever for growing token savings: more indexed code →
|
|
@@ -9930,11 +9937,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
9930
9937
|
// Auto-start brain session on first tool call that has an instance_id.
|
|
9931
9938
|
// Skip session management tools to avoid recursion.
|
|
9932
9939
|
const sessionTools = new Set(['session_start', 'session_end', 'auto_learn_session']);
|
|
9933
|
-
if (!sessionTools.has(name) && !_autoSessionStarted) {
|
|
9940
|
+
if (!sessionTools.has(name) && !_autoSessionStarted && !_autoSessionStarting) {
|
|
9934
9941
|
const instanceId = (args as Record<string, unknown>)?.instance_id as string | undefined;
|
|
9935
9942
|
if (instanceId) {
|
|
9936
9943
|
await autoStartSession(instanceId).catch(() => undefined);
|
|
9937
9944
|
}
|
|
9945
|
+
} else if (_autoSessionStarting) {
|
|
9946
|
+
// Another concurrent call is mid-start — wait for it before proceeding.
|
|
9947
|
+
await _autoSessionStarting.catch(() => undefined);
|
|
9938
9948
|
}
|
|
9939
9949
|
if (!sessionTools.has(name)) _autoSessionToolCount++;
|
|
9940
9950
|
|