context-mode 1.0.47 → 1.0.49
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.
|
|
9
|
+
"version": "1.0.49"
|
|
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.
|
|
16
|
+
"version": "1.0.49",
|
|
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.
|
|
3
|
+
"version": "1.0.49",
|
|
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.
|
|
6
|
+
"version": "1.0.49",
|
|
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.
|
|
3
|
+
"version": "1.0.49",
|
|
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/hooks/core/routing.mjs
CHANGED
|
@@ -180,14 +180,52 @@ export function routePreToolUse(toolName, toolInput, projectDir, platform) {
|
|
|
180
180
|
// like `gh issue edit --body "text with curl in it"` (Issue #63).
|
|
181
181
|
const stripped = stripQuotedContent(command);
|
|
182
182
|
|
|
183
|
-
// curl/wget
|
|
183
|
+
// curl/wget — allow silent file-output downloads, block stdout floods (#166).
|
|
184
|
+
// Algorithm: split chained commands, evaluate each segment independently.
|
|
184
185
|
if (/(^|\s|&&|\||\;)(curl|wget)\s/i.test(stripped)) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
// Split on chain operators (&&, ||, ;) to evaluate each segment
|
|
187
|
+
const segments = stripped.split(/\s*(?:&&|\|\||;)\s*/);
|
|
188
|
+
const hasDangerousSegment = segments.some(seg => {
|
|
189
|
+
const s = seg.trim();
|
|
190
|
+
// Only evaluate segments that contain curl or wget
|
|
191
|
+
if (!/(^|\s)(curl|wget)\s/i.test(s)) return false;
|
|
192
|
+
|
|
193
|
+
const isCurl = /\bcurl\b/i.test(s);
|
|
194
|
+
const isWget = /\bwget\b/i.test(s);
|
|
195
|
+
|
|
196
|
+
// Check for file output flags
|
|
197
|
+
const hasFileOutput = isCurl
|
|
198
|
+
? /\s(-o|--output)\s/.test(s) || /\s*>\s*/.test(s) || /\s*>>\s*/.test(s)
|
|
199
|
+
: /\s(-O|--output-document)\s/.test(s) || /\s*>\s*/.test(s) || /\s*>>\s*/.test(s);
|
|
200
|
+
|
|
201
|
+
if (!hasFileOutput) return true; // no file output → dangerous
|
|
202
|
+
|
|
203
|
+
// Stdout aliases: -o -, -o /dev/stdout, -O -
|
|
204
|
+
if (isCurl && /\s(-o|--output)\s+(-|\/dev\/stdout)(\s|$)/.test(s)) return true;
|
|
205
|
+
if (isWget && /\s(-O|--output-document)\s+(-|\/dev\/stdout)(\s|$)/.test(s)) return true;
|
|
206
|
+
|
|
207
|
+
// Verbose/trace flags flood stderr → context
|
|
208
|
+
if (/\s(-v|--verbose|--trace|-D\s+-)\b/.test(s)) return true;
|
|
209
|
+
|
|
210
|
+
// Must be silent (curl: -s/--silent, wget: -q/--quiet) to prevent progress bar stderr flood
|
|
211
|
+
const isSilent = isCurl
|
|
212
|
+
? /\s-[a-zA-Z]*s|--silent/.test(s)
|
|
213
|
+
: /\s-[a-zA-Z]*q|--quiet/.test(s);
|
|
214
|
+
if (!isSilent) return true;
|
|
215
|
+
|
|
216
|
+
return false; // safe: silent + file output + no verbose + no stdout alias
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (hasDangerousSegment) {
|
|
220
|
+
return {
|
|
221
|
+
action: "modify",
|
|
222
|
+
updatedInput: {
|
|
223
|
+
command: `echo "context-mode: curl/wget blocked. You MUST use ${t("ctx_fetch_and_index")}(url, source) to fetch URLs, or ${t("ctx_execute")}(language, code) to run HTTP calls in sandbox. Do NOT retry with curl/wget."`,
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// All segments safe → allow through
|
|
228
|
+
return null;
|
|
191
229
|
}
|
|
192
230
|
|
|
193
231
|
// Inline HTTP detection: strip only heredocs (not quotes) so that
|
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.49",
|
|
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.49",
|
|
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",
|
|
@@ -79,15 +79,15 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@clack/prompts": "^1.0.1",
|
|
82
|
+
"@mixmark-io/domino": "^2.2.0",
|
|
82
83
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
83
84
|
"picocolors": "^1.1.1",
|
|
85
|
+
"turndown": "^7.2.0",
|
|
86
|
+
"turndown-plugin-gfm": "^1.0.2",
|
|
84
87
|
"zod": "^3.25.0"
|
|
85
88
|
},
|
|
86
89
|
"optionalDependencies": {
|
|
87
|
-
"better-sqlite3": "^12.6.2"
|
|
88
|
-
"turndown": "^7.2.0",
|
|
89
|
-
"turndown-plugin-gfm": "^1.0.2",
|
|
90
|
-
"@mixmark-io/domino": "^2.2.0"
|
|
90
|
+
"better-sqlite3": "^12.6.2"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@types/better-sqlite3": "^7.6.13",
|