context-mode 1.0.39 → 1.0.41
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/adapters/detect.d.ts +1 -1
- package/build/adapters/detect.js +3 -3
- package/build/adapters/openclaw/index.d.ts +1 -1
- package/build/adapters/openclaw/index.js +5 -5
- package/build/adapters/opencode/index.js +6 -6
- package/build/cli.js +2 -2
- package/build/openclaw-plugin.js +1 -1
- package/build/opencode-plugin.d.ts +34 -10
- package/build/opencode-plugin.js +13 -11
- package/build/server.js +111 -36
- package/cli.bundle.mjs +89 -88
- package/hooks/session-loaders.mjs +25 -9
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.mjs +19 -6
- package/server.bundle.mjs +71 -70
- package/skills/ctx-doctor/SKILL.md +4 -14
- package/skills/ctx-upgrade/SKILL.md +10 -11
- package/start.mjs +63 -38
|
@@ -1,28 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Session module loaders — bundle-
|
|
2
|
+
* Session module loaders — bundle-first with build/ fallback.
|
|
3
3
|
*
|
|
4
4
|
* All session modules are loaded from esbuild bundles (hooks/session-*.bundle.mjs).
|
|
5
5
|
* Bundles are built by CI (bundle.yml) and shipped with every release.
|
|
6
|
-
*
|
|
6
|
+
* Fallback: if bundles are missing (marketplace installs), try build/session/*.js.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { join
|
|
9
|
+
import { join } from "node:path";
|
|
10
10
|
import { pathToFileURL } from "node:url";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
11
12
|
|
|
12
13
|
export function createSessionLoaders(hookDir) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// Auto-detect bundle directory: bundles live in hooks/ root, not platform subdirs.
|
|
15
|
+
// If hookDir itself has bundles, use it; otherwise go up one level.
|
|
16
|
+
const bundleDir = existsSync(join(hookDir, "session-db.bundle.mjs"))
|
|
17
|
+
? hookDir
|
|
18
|
+
: join(hookDir, "..");
|
|
19
|
+
|
|
20
|
+
// Fallback: if bundles missing, try build/session/*.js (marketplace installs)
|
|
21
|
+
const pluginRoot = join(bundleDir, "..");
|
|
22
|
+
const buildSession = join(pluginRoot, "build", "session");
|
|
23
|
+
|
|
24
|
+
async function loadModule(bundleName, buildName) {
|
|
25
|
+
const bundlePath = join(bundleDir, bundleName);
|
|
26
|
+
if (existsSync(bundlePath)) {
|
|
27
|
+
return await import(pathToFileURL(bundlePath).href);
|
|
28
|
+
}
|
|
29
|
+
const buildPath = join(buildSession, buildName);
|
|
30
|
+
return await import(pathToFileURL(buildPath).href);
|
|
31
|
+
}
|
|
16
32
|
|
|
17
33
|
return {
|
|
18
34
|
async loadSessionDB() {
|
|
19
|
-
return await
|
|
35
|
+
return await loadModule("session-db.bundle.mjs", "db.js");
|
|
20
36
|
},
|
|
21
37
|
async loadExtract() {
|
|
22
|
-
return await
|
|
38
|
+
return await loadModule("session-extract.bundle.mjs", "extract.js");
|
|
23
39
|
},
|
|
24
40
|
async loadSnapshot() {
|
|
25
|
-
return await
|
|
41
|
+
return await loadModule("session-snapshot.bundle.mjs", "snapshot.js");
|
|
26
42
|
},
|
|
27
43
|
};
|
|
28
44
|
}
|
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.41",
|
|
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.41",
|
|
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",
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -16,6 +16,14 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
const pkgRoot = resolve(__dirname, "..");
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Validate that a path is safe to interpolate into a cmd.exe command.
|
|
21
|
+
* Rejects characters that could enable command injection via cmd.exe.
|
|
22
|
+
*/
|
|
23
|
+
function isSafeWindowsPath(p) {
|
|
24
|
+
return !/[&|<>"^%\r\n]/.test(p);
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
// ── 1. OpenClaw detection ────────────────────────────────────────────
|
|
20
28
|
if (process.env.OPENCLAW_STATE_DIR) {
|
|
21
29
|
console.log("\n OpenClaw detected. Run: npm run install:openclaw\n");
|
|
@@ -73,12 +81,17 @@ if (process.platform === "win32" && process.env.npm_config_global === "true") {
|
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
// Create directory junction (no admin privileges needed on Windows 10+)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
// Validate paths to prevent cmd.exe injection via shell metacharacters
|
|
85
|
+
if (!isSafeWindowsPath(expectedPkgDir) || !isSafeWindowsPath(actualPkgDir)) {
|
|
86
|
+
console.warn(` context-mode: skipping junction — path contains unsafe characters`);
|
|
87
|
+
} else {
|
|
88
|
+
execSync(`mklink /J "${expectedPkgDir}" "${actualPkgDir}"`, {
|
|
89
|
+
shell: "cmd.exe",
|
|
90
|
+
stdio: "pipe",
|
|
91
|
+
});
|
|
92
|
+
console.log(`\n context-mode: created junction for nvm4w compatibility`);
|
|
93
|
+
console.log(` ${expectedPkgDir} → ${actualPkgDir}\n`);
|
|
94
|
+
}
|
|
82
95
|
}
|
|
83
96
|
}
|
|
84
97
|
|