context-mode 1.0.56 → 1.0.57
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/build/server.js +48 -2
- package/cli.bundle.mjs +96 -96
- package/hooks/routing-block.mjs +2 -0
- package/hooks/session-helpers.mjs +13 -0
- package/hooks/sessionstart.mjs +5 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/server.bundle.mjs +68 -68
package/hooks/routing-block.mjs
CHANGED
|
@@ -70,6 +70,8 @@ export function createRoutingBlock(t) {
|
|
|
70
70
|
|
|
71
71
|
When the user says "ctx upgrade", "ctx-upgrade", "/ctx-upgrade", or asks to update context-mode:
|
|
72
72
|
→ Call the upgrade MCP tool, execute the returned shell command, display results as a checklist.
|
|
73
|
+
|
|
74
|
+
After /clear: call ${t("ctx_stats")}(reset: true) to reset session stats and search index.
|
|
73
75
|
</ctx_commands>
|
|
74
76
|
</context_window_protection>`;
|
|
75
77
|
}
|
|
@@ -170,3 +170,16 @@ export function getCleanupFlagPath(opts = CLAUDE_OPTS) {
|
|
|
170
170
|
mkdirSync(dir, { recursive: true });
|
|
171
171
|
return join(dir, `${hash}${getWorktreeSuffix()}.cleanup`);
|
|
172
172
|
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Return the per-project clear-stats flag path.
|
|
176
|
+
* Written by SessionStart hook on /clear, read by MCP server to reset stats.
|
|
177
|
+
* Path: ~/<configDir>/context-mode/sessions/<SHA256(projectDir)[:16]>.clear-stats
|
|
178
|
+
*/
|
|
179
|
+
export function getClearStatsFlagPath(opts = CLAUDE_OPTS) {
|
|
180
|
+
const projectDir = getProjectDir(opts);
|
|
181
|
+
const hash = createHash("sha256").update(projectDir).digest("hex").slice(0, 16);
|
|
182
|
+
const dir = join(homedir(), opts.configDir, "context-mode", "sessions");
|
|
183
|
+
mkdirSync(dir, { recursive: true });
|
|
184
|
+
return join(dir, `${hash}${getWorktreeSuffix()}.clear-stats`);
|
|
185
|
+
}
|
package/hooks/sessionstart.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { createRoutingBlock } from "./routing-block.mjs";
|
|
|
19
19
|
import { createToolNamer } from "./core/tool-naming.mjs";
|
|
20
20
|
|
|
21
21
|
const ROUTING_BLOCK = createRoutingBlock(createToolNamer("claude-code"));
|
|
22
|
-
import { readStdin, getSessionId, getSessionDBPath, getSessionEventsPath, getCleanupFlagPath } from "./session-helpers.mjs";
|
|
22
|
+
import { readStdin, getSessionId, getSessionDBPath, getSessionEventsPath, getCleanupFlagPath, getClearStatsFlagPath } from "./session-helpers.mjs";
|
|
23
23
|
import { writeSessionEventsFile, buildSessionDirective, getSessionEvents, getLatestSessionEvents } from "./session-directive.mjs";
|
|
24
24
|
import { createSessionLoaders } from "./session-loaders.mjs";
|
|
25
25
|
import { join, dirname } from "node:path";
|
|
@@ -145,7 +145,10 @@ try {
|
|
|
145
145
|
}
|
|
146
146
|
} catch { /* best effort — never block session start */ }
|
|
147
147
|
}
|
|
148
|
-
// "clear" —
|
|
148
|
+
// "clear" — signal MCP server to reset session stats
|
|
149
|
+
if (source === "clear") {
|
|
150
|
+
try { writeFileSync(getClearStatsFlagPath(), String(Date.now())); } catch { /* best effort */ }
|
|
151
|
+
}
|
|
149
152
|
} catch (err) {
|
|
150
153
|
// Session continuity is best-effort — never block session start
|
|
151
154
|
try {
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "Context Mode",
|
|
4
4
|
"kind": "tool",
|
|
5
5
|
"description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.57",
|
|
7
7
|
"sandbox": {
|
|
8
8
|
"mode": "permissive",
|
|
9
9
|
"filesystem_access": "full",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP plugin that saves 98% of your context window. Works with Claude Code, Gemini CLI, VS Code Copilot, OpenCode, and Codex CLI. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
|
|
6
6
|
"author": "Mert Koseoğlu",
|