context-mode 1.0.109 → 1.0.111

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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Claude Code plugins by Mert Koseoğlu",
9
- "version": "1.0.109"
9
+ "version": "1.0.111"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "context-mode",
14
14
  "source": "./",
15
15
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
16
- "version": "1.0.109",
16
+ "version": "1.0.111",
17
17
  "author": {
18
18
  "name": "Mert Koseoğlu"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.109",
3
+ "version": "1.0.111",
4
4
  "description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
@@ -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.109",
6
+ "version": "1.0.111",
7
7
  "sandbox": {
8
8
  "mode": "permissive",
9
9
  "filesystem_access": "full",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.109",
3
+ "version": "1.0.111",
4
4
  "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.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
package/build/cli.js CHANGED
@@ -672,21 +672,45 @@ async function upgrade() {
672
672
  if (detection.platform !== 'opencode' && detection.platform !== 'kilo') {
673
673
  // Rebuild native addons for current Node.js ABI (fixes #131)
674
674
  s.start("Rebuilding native addons");
675
- try {
676
- npmExecFile(["rebuild", "better-sqlite3"], {
677
- cwd: pluginRoot,
678
- stdio: "pipe",
679
- timeout: 60000,
680
- });
681
- s.stop(color.green("Native addons rebuilt"));
682
- changes.push("Rebuilt better-sqlite3 for current Node.js");
675
+ const bsqBindingPath = resolve(pluginRoot, "node_modules", "better-sqlite3", "build", "Release", "better_sqlite3.node");
676
+ // Skip rebuild when the binding from `npm install --production` is
677
+ // already present. Earlier code ran `npm rebuild better-sqlite3`
678
+ // unconditionally — its internal prebuild-install spawn raced with
679
+ // the prior install's tree-prune, intermittently failing to resolve
680
+ // `rc/index.js` and printing a scary "rebuild warning" even though
681
+ // the binding was healthy. Pre-check eliminates the race for the
682
+ // 99% case (binding survived install).
683
+ if (existsSync(bsqBindingPath)) {
684
+ s.stop(color.green("Native addons OK") + color.dim(" — binding present"));
685
+ changes.push("better-sqlite3 binding already present (no rebuild needed)");
683
686
  }
684
- catch (err) {
685
- const message = err instanceof Error ? err.message : String(err);
686
- s.stop(color.yellow("Native addon rebuild warning"));
687
- p.log.warn(color.yellow("better-sqlite3 rebuild issue") +
688
- ` ${message}` +
689
- color.dim(`\n Try manually: cd "${pluginRoot}" && npm rebuild better-sqlite3`));
687
+ else {
688
+ // Binding actually missing delegate to the shared 3-layer heal
689
+ // (scripts/heal-better-sqlite3.mjs, PR #410) instead of raw
690
+ // `npm rebuild`. Single source of truth across postinstall +
691
+ // ensure-deps + cli upgrade. Layer A spawns prebuild-install
692
+ // directly via process.execPath, bypassing PATH/MSVC and the
693
+ // npm-internal rc-resolution race that bit `npm rebuild`.
694
+ try {
695
+ const healUrl = pathToFileURL(resolve(pluginRoot, "scripts", "heal-better-sqlite3.mjs")).href;
696
+ const { healBetterSqlite3Binding } = await import(healUrl);
697
+ const result = healBetterSqlite3Binding(pluginRoot);
698
+ if (result?.healed) {
699
+ s.stop(color.green("Native addons healed") + color.dim(` (${result.reason})`));
700
+ changes.push(`Healed better-sqlite3 binding via ${result.reason}`);
701
+ }
702
+ else {
703
+ s.stop(color.yellow("Native addon heal needs manual step"));
704
+ p.log.warn(color.dim(` Run: cd "${pluginRoot}" && npm install better-sqlite3`));
705
+ }
706
+ }
707
+ catch (err) {
708
+ const message = err instanceof Error ? err.message : String(err);
709
+ s.stop(color.yellow("Native addon heal unavailable"));
710
+ p.log.warn(color.yellow("better-sqlite3 heal helper missing") +
711
+ ` — ${message}` +
712
+ color.dim(`\n Try manually: cd "${pluginRoot}" && npm rebuild better-sqlite3`));
713
+ }
690
714
  }
691
715
  }
692
716
  // Update global npm
@@ -179,7 +179,7 @@ async function createContextModePlugin(ctx) {
179
179
  const toolInput = output.args ?? {};
180
180
  let decision;
181
181
  try {
182
- decision = routing.routePreToolUse(toolName, toolInput, projectDir, getPlatform());
182
+ decision = routing.routePreToolUse(toolName, toolInput, projectDir, platform);
183
183
  }
184
184
  catch {
185
185
  return; // Routing failure → allow passthrough
@@ -194,7 +194,10 @@ async function createContextModePlugin(ctx) {
194
194
  // Mutate output.args — OpenCode reads the mutated output object
195
195
  Object.assign(output.args, decision.updatedInput);
196
196
  }
197
- // "context" action no-op (OpenCode doesn't support context injection)
197
+ if (decision.action === "context" && decision.additionalContext) {
198
+ // Mutate output.args — OpenCode reads the mutated output object
199
+ output.args.additionalContext = decision.additionalContext;
200
+ }
198
201
  },
199
202
  // ── PostToolUse: Session event capture ──────────────
200
203
  "tool.execute.after": async (input, output) => {