context-mode 1.0.138 → 1.0.139

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.138"
9
+ "version": "1.0.139"
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.138",
16
+ "version": "1.0.139",
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.138",
3
+ "version": "1.0.139",
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",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.138",
3
+ "version": "1.0.139",
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.138",
6
+ "version": "1.0.139",
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.138",
3
+ "version": "1.0.139",
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",
@@ -251,11 +251,18 @@ async function createContextModePlugin(ctx) {
251
251
  const tools = {};
252
252
  for (const registered of mod.REGISTERED_CTX_TOOLS) {
253
253
  const config = registered.config;
254
- const schema = config.inputSchema;
255
- const shape = typeof schema?.shape === "object" && schema.shape !== null
256
- ? schema.shape
257
- : typeof schema?._def?.shape === "function"
258
- ? schema._def.shape()
254
+ // Zod schema object that the MCP framework normally calls
255
+ // safeParseAsync() on before invoking the handler. The native
256
+ // OpenCode plugin path bypasses MCP's transport layer entirely
257
+ // (refs/platforms/opencode/packages/opencode/src/tool/registry.ts:127),
258
+ // so we must parse args here too — otherwise z.preprocess() coercions
259
+ // (coerceCommandsArray / coerceJsonArray in server.ts) and defaults
260
+ // never fire. Fixes #621.
261
+ const inputSchema = config.inputSchema;
262
+ const shape = typeof inputSchema?.shape === "object" && inputSchema.shape !== null
263
+ ? inputSchema.shape
264
+ : typeof inputSchema?._def?.shape === "function"
265
+ ? inputSchema._def.shape()
259
266
  : {};
260
267
  tools[registered.name] = {
261
268
  description: String(config.description ?? ""),
@@ -263,7 +270,24 @@ async function createContextModePlugin(ctx) {
263
270
  async execute(args, toolCtx) {
264
271
  toolCtx.metadata?.({ title: String(config.title ?? registered.name) });
265
272
  const project = toolCtx.directory || projectDir;
266
- const result = await mod.withProjectDirOverride({ projectDir: project, sessionId: toolCtx.sessionID }, async () => registered.handler(args ?? {}));
273
+ // Run the registered Zod schema BEFORE the handler same contract
274
+ // as the MCP SDK (server/mcp.js safeParseAsync at line 174). This
275
+ // applies z.preprocess() coercions, populates .default() values,
276
+ // and produces the validation error the handler expects (#621).
277
+ let parsedArgs = args ?? {};
278
+ if (typeof inputSchema?.parse === "function") {
279
+ try {
280
+ parsedArgs = inputSchema.parse(args ?? {});
281
+ }
282
+ catch (err) {
283
+ // Surface validation failures with a clear, actionable message
284
+ // (mirrors MCP SDK error format) instead of a downstream
285
+ // "x.map is not a function" crash.
286
+ const message = err instanceof Error ? err.message : String(err);
287
+ throw new Error(`Invalid arguments for ${registered.name}: ${message}`);
288
+ }
289
+ }
290
+ const result = await mod.withProjectDirOverride({ projectDir: project, sessionId: toolCtx.sessionID }, async () => registered.handler(parsedArgs));
267
291
  const r = result;
268
292
  const text = Array.isArray(r?.content)
269
293
  ? r.content
@@ -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.138",
6
+ "version": "1.0.139",
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.138",
3
+ "version": "1.0.139",
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",