context-mode 1.0.45 → 1.0.47

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.45"
9
+ "version": "1.0.47"
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.45",
16
+ "version": "1.0.47",
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.45",
3
+ "version": "1.0.47",
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.45",
6
+ "version": "1.0.47",
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.45",
3
+ "version": "1.0.47",
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",
@@ -35,8 +35,9 @@ export declare class BunSQLiteAdapter {
35
35
  close(): void;
36
36
  }
37
37
  /**
38
- * Lazy-load better-sqlite3. Falls back to bun:sqlite via BunSQLiteAdapter
39
- * when better-sqlite3 is unavailable (Bun runtime, issue #45).
38
+ * Lazy-load the SQLite driver for the current runtime.
39
+ * Bun bun:sqlite via BunSQLiteAdapter (issue #45).
40
+ * Node → better-sqlite3 (native addon).
40
41
  */
41
42
  export declare function loadDatabase(): typeof DatabaseConstructor;
42
43
  /**
package/build/db-base.js CHANGED
@@ -88,32 +88,17 @@ export class BunSQLiteAdapter {
88
88
  // ─────────────────────────────────────────────────────────
89
89
  let _Database = null;
90
90
  /**
91
- * Lazy-load better-sqlite3. Falls back to bun:sqlite via BunSQLiteAdapter
92
- * when better-sqlite3 is unavailable (Bun runtime, issue #45).
91
+ * Lazy-load the SQLite driver for the current runtime.
92
+ * Bun bun:sqlite via BunSQLiteAdapter (issue #45).
93
+ * Node → better-sqlite3 (native addon).
93
94
  */
94
95
  export function loadDatabase() {
95
96
  if (!_Database) {
96
97
  const require = createRequire(import.meta.url);
97
- try {
98
- const mod = require("better-sqlite3");
99
- // Bun's require("better-sqlite3") may return undefined, false, or a stub function
100
- // that crashes on use (#163). Validate by actually instantiating a test database.
101
- if (!mod || typeof mod !== "function") {
102
- throw new Error("better-sqlite3 loaded but not usable");
103
- }
104
- const testDb = new mod(":memory:");
105
- testDb.close();
106
- _Database = mod;
107
- }
108
- catch {
109
- // better-sqlite3 unavailable (Bun runtime) — wrap bun:sqlite
110
- if (!globalThis.Bun) {
111
- throw new Error("better-sqlite3 failed to load and Bun runtime not detected");
112
- }
113
- // Compute module name at runtime to prevent esbuild from resolving at bundle time.
114
- // esbuild constant-folds string concat but NOT Array.join().
115
- const bunSqliteMod = ["bun", "sqlite"].join(":");
116
- const BunDB = require(bunSqliteMod).Database;
98
+ if (globalThis.Bun) {
99
+ // Bun runtime — use bun:sqlite directly.
100
+ // Array.join() prevents esbuild from resolving the specifier at bundle time.
101
+ const BunDB = require(["bun", "sqlite"].join(":")).Database;
117
102
  _Database = function BunDatabaseFactory(path, opts) {
118
103
  const raw = new BunDB(path, {
119
104
  readonly: opts?.readonly,
@@ -122,6 +107,10 @@ export function loadDatabase() {
122
107
  return new BunSQLiteAdapter(raw);
123
108
  };
124
109
  }
110
+ else {
111
+ // Node.js — use better-sqlite3.
112
+ _Database = require("better-sqlite3");
113
+ }
125
114
  }
126
115
  return _Database;
127
116
  }