context-mode 1.0.69 → 1.0.70

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.69"
9
+ "version": "1.0.70"
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.69",
16
+ "version": "1.0.70",
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.69",
3
+ "version": "1.0.70",
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.69",
6
+ "version": "1.0.70",
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.69",
3
+ "version": "1.0.70",
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
@@ -7,6 +7,7 @@ import { existsSync, unlinkSync, readdirSync, readFileSync, rmSync, mkdirSync }
7
7
  import { join, dirname, resolve } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { homedir, tmpdir } from "node:os";
10
+ import { request as httpsRequest } from "node:https";
10
11
  import { z } from "zod";
11
12
  import { PolyglotExecutor } from "./executor.js";
12
13
  import { ContentStore, cleanupStaleDBs, cleanupStaleContentDBs } from "./store.js";
@@ -180,7 +181,72 @@ const sessionStats = {
180
181
  cacheBytesSaved: 0, // bytes avoided by TTL cache hits
181
182
  sessionStart: Date.now(),
182
183
  };
184
+ // ── Version outdated warning ──────────────────────────────────────────────
185
+ // Non-blocking npm check at startup. trackResponse prepends warning
186
+ // using a burst cadence: 3 warnings → 1h silent → 3 warnings → repeat.
187
+ let _latestVersion = null;
188
+ let _warningBurstCount = 0;
189
+ let _lastBurstStart = 0;
190
+ const VERSION_BURST_SIZE = 3;
191
+ const VERSION_SILENT_MS = 60 * 60 * 1000; // 1 hour
192
+ async function fetchLatestVersion() {
193
+ return new Promise((res) => {
194
+ const req = httpsRequest("https://registry.npmjs.org/context-mode/latest", { headers: { Connection: "close" } }, (resp) => {
195
+ let raw = "";
196
+ resp.on("data", (chunk) => { raw += chunk; });
197
+ resp.on("end", () => {
198
+ try {
199
+ const data = JSON.parse(raw);
200
+ res(data.version ?? "unknown");
201
+ }
202
+ catch {
203
+ res("unknown");
204
+ }
205
+ });
206
+ });
207
+ req.on("error", () => res("unknown"));
208
+ req.setTimeout(5000, () => { req.destroy(); res("unknown"); });
209
+ req.end();
210
+ });
211
+ }
212
+ function getUpgradeHint() {
213
+ const name = _detectedAdapter?.name;
214
+ if (name === "Claude Code")
215
+ return "/ctx-upgrade";
216
+ if (name === "OpenClaw")
217
+ return "npm run install:openclaw";
218
+ if (name === "Pi")
219
+ return "npm run build";
220
+ return "npm update -g context-mode";
221
+ }
222
+ function isOutdated() {
223
+ if (!_latestVersion || _latestVersion === "unknown")
224
+ return false;
225
+ return _latestVersion !== VERSION;
226
+ }
227
+ function shouldShowVersionWarning() {
228
+ if (!isOutdated())
229
+ return false;
230
+ const now = Date.now();
231
+ // Start of a new burst?
232
+ if (_warningBurstCount >= VERSION_BURST_SIZE) {
233
+ if (now - _lastBurstStart < VERSION_SILENT_MS)
234
+ return false; // still silent
235
+ _warningBurstCount = 0; // silence over, reset burst
236
+ }
237
+ if (_warningBurstCount === 0)
238
+ _lastBurstStart = now;
239
+ _warningBurstCount++;
240
+ return true;
241
+ }
183
242
  function trackResponse(toolName, response) {
243
+ // Prepend version outdated warning if needed
244
+ if (shouldShowVersionWarning() && response.content.length > 0) {
245
+ const hint = getUpgradeHint();
246
+ response.content[0].text =
247
+ `⚠️ context-mode v${VERSION} outdated → v${_latestVersion} available. Upgrade: ${hint}\n\n` +
248
+ response.content[0].text;
249
+ }
184
250
  const bytes = response.content.reduce((sum, c) => sum + Buffer.byteLength(c.text), 0);
185
251
  sessionStats.calls[toolName] = (sessionStats.calls[toolName] || 0) + 1;
186
252
  sessionStats.bytesReturned[toolName] =
@@ -1770,6 +1836,9 @@ async function main() {
1770
1836
  }
1771
1837
  }
1772
1838
  catch { /* best effort — _detectedAdapter stays null, falls back to .claude */ }
1839
+ // Non-blocking version check — result stored for trackResponse warnings
1840
+ fetchLatestVersion().then(v => { if (v !== "unknown")
1841
+ _latestVersion = v; });
1773
1842
  console.error(`Context Mode MCP server v${VERSION} running on stdio`);
1774
1843
  console.error(`Detected runtimes:\n${getRuntimeSummary(runtimes)}`);
1775
1844
  if (!hasBunRuntime()) {