context-mode 1.0.90 → 1.0.92

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.90"
9
+ "version": "1.0.92"
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.90",
16
+ "version": "1.0.92",
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.90",
3
+ "version": "1.0.92",
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.90",
6
+ "version": "1.0.92",
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.90",
3
+ "version": "1.0.92",
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/server.js CHANGED
@@ -231,10 +231,21 @@ function getUpgradeHint() {
231
231
  return "npm run build";
232
232
  return "npm update -g context-mode";
233
233
  }
234
+ function semverNewer(a, b) {
235
+ const pa = a.split(".").map(Number);
236
+ const pb = b.split(".").map(Number);
237
+ for (let i = 0; i < 3; i++) {
238
+ if ((pa[i] ?? 0) > (pb[i] ?? 0))
239
+ return true;
240
+ if ((pa[i] ?? 0) < (pb[i] ?? 0))
241
+ return false;
242
+ }
243
+ return false;
244
+ }
234
245
  function isOutdated() {
235
246
  if (!_latestVersion || _latestVersion === "unknown")
236
247
  return false;
237
- return _latestVersion !== VERSION;
248
+ return semverNewer(_latestVersion, VERSION);
238
249
  }
239
250
  function shouldShowVersionWarning() {
240
251
  if (!isOutdated())
@@ -8,6 +8,17 @@
8
8
  * const engine = new AnalyticsEngine(sessionDb);
9
9
  * const report = engine.queryAll(runtimeStats);
10
10
  */
11
+ function semverNewer(a, b) {
12
+ const pa = a.split(".").map(Number);
13
+ const pb = b.split(".").map(Number);
14
+ for (let i = 0; i < 3; i++) {
15
+ if ((pa[i] ?? 0) > (pb[i] ?? 0))
16
+ return true;
17
+ if ((pa[i] ?? 0) < (pb[i] ?? 0))
18
+ return false;
19
+ }
20
+ return false;
21
+ }
11
22
  // ─────────────────────────────────────────────────────────
12
23
  // Category labels and hints for session continuity display
13
24
  // ─────────────────────────────────────────────────────────
@@ -152,15 +163,15 @@ export class AnalyticsEngine {
152
163
  total_savings_ratio: totalSavingsRatio,
153
164
  };
154
165
  }
155
- // ── Continuity data ──
156
- const eventTotal = this.db.prepare("SELECT COUNT(*) as cnt FROM session_events").get().cnt;
157
- const byCategory = this.db.prepare("SELECT category, COUNT(*) as cnt FROM session_events GROUP BY category ORDER BY cnt DESC").all();
158
- const meta = this.db.prepare("SELECT compact_count FROM session_meta ORDER BY started_at DESC LIMIT 1").get();
166
+ // ── Continuity data (scoped to current session) ──
167
+ const eventTotal = this.db.prepare("SELECT COUNT(*) as cnt FROM session_events WHERE session_id = ?").get(sid).cnt;
168
+ const byCategory = this.db.prepare("SELECT category, COUNT(*) as cnt FROM session_events WHERE session_id = ? GROUP BY category ORDER BY cnt DESC").all(sid);
169
+ const meta = this.db.prepare("SELECT compact_count FROM session_meta WHERE session_id = ?").get(sid);
159
170
  const compactCount = meta?.compact_count ?? 0;
160
- const resume = this.db.prepare("SELECT event_count, consumed FROM session_resume ORDER BY created_at DESC LIMIT 1").get();
171
+ const resume = this.db.prepare("SELECT event_count, consumed FROM session_resume WHERE session_id = ? ORDER BY created_at DESC LIMIT 1").get(sid);
161
172
  const resumeReady = resume ? !resume.consumed : false;
162
- // Build category previews
163
- const previewRows = this.db.prepare("SELECT category, type, data FROM session_events ORDER BY id DESC").all();
173
+ // Build category previews (current session only)
174
+ const previewRows = this.db.prepare("SELECT category, type, data FROM session_events WHERE session_id = ? ORDER BY id DESC").all(sid);
164
175
  const previews = new Map();
165
176
  for (const row of previewRows) {
166
177
  if (!previews.has(row.category))
@@ -290,7 +301,7 @@ export function formatReport(report, version, latestVersion) {
290
301
  lines.push("");
291
302
  const versionStr = version ? `v${version}` : "context-mode";
292
303
  lines.push(versionStr);
293
- if (version && latestVersion && latestVersion !== "unknown" && latestVersion !== version) {
304
+ if (version && latestVersion && latestVersion !== "unknown" && semverNewer(latestVersion, version)) {
294
305
  lines.push(`Update available: v${version} -> v${latestVersion} | ctx_upgrade`);
295
306
  }
296
307
  return lines.join("\n");