context-mode 1.0.141 → 1.0.142
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/.codex-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/build/adapters/opencode/plugin.js +5 -20
- package/build/adapters/opencode/zod3tov4.d.ts +1 -0
- package/build/adapters/opencode/zod3tov4.js +111 -0
- package/cli.bundle.mjs +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/server.bundle.mjs +2 -2
- package/start.mjs +40 -9
- package/build/openclaw-plugin.d.ts +0 -130
- package/build/openclaw-plugin.js +0 -626
- package/build/opencode-plugin.d.ts +0 -122
- package/build/opencode-plugin.js +0 -372
- package/build/pi-extension.d.ts +0 -14
- package/build/pi-extension.js +0 -451
- package/build/util/db-lock.d.ts +0 -65
- package/build/util/db-lock.js +0 -166
|
@@ -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.142"
|
|
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.142",
|
|
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.142",
|
|
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.
|
|
3
|
+
"version": "1.0.142",
|
|
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.142",
|
|
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.142",
|
|
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",
|
|
@@ -28,25 +28,7 @@ import { extractEvents, extractUserEvents } from "../../session/extract.js";
|
|
|
28
28
|
import { buildResumeSnapshot } from "../../session/snapshot.js";
|
|
29
29
|
import { OpenCodeAdapter } from "./index.js";
|
|
30
30
|
import { PLATFORM_ENV_VARS } from "../detect.js";
|
|
31
|
-
|
|
32
|
-
// Used in the resume-injection visible signal so users can confirm in
|
|
33
|
-
// OPENCODE_DEBUG logs which plugin version actually injected.
|
|
34
|
-
const VERSION = (() => {
|
|
35
|
-
try {
|
|
36
|
-
const pkgRoot = dirname(fileURLToPath(import.meta.url));
|
|
37
|
-
// Search both the legacy depths (when bundled flat under build/) and
|
|
38
|
-
// the post-refactor depths (when compiled to build/adapters/opencode/).
|
|
39
|
-
// `../../../package.json` is the canonical location after the
|
|
40
|
-
// `src/opencode-plugin.ts → src/adapters/opencode/plugin.ts` move.
|
|
41
|
-
for (const rel of ["../../../package.json", "../package.json", "./package.json"]) {
|
|
42
|
-
const p = resolve(pkgRoot, rel);
|
|
43
|
-
if (existsSync(p))
|
|
44
|
-
return JSON.parse(readFileSync(p, "utf8")).version ?? "unknown";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch { /* fall through */ }
|
|
48
|
-
return "unknown";
|
|
49
|
-
})();
|
|
31
|
+
import { zod3ShapeToV4 } from "./zod3tov4.js";
|
|
50
32
|
// Synthetic message tags emitted by harnesses (CCv2 inline filter). When the
|
|
51
33
|
// user "message" is actually a system-generated nudge (e.g. tool-result, system
|
|
52
34
|
// reminder), capturing it as user_prompt would flood the DB with noise.
|
|
@@ -264,9 +246,12 @@ async function createContextModePlugin(ctx) {
|
|
|
264
246
|
: typeof inputSchema?._def?.shape === "function"
|
|
265
247
|
? inputSchema._def.shape()
|
|
266
248
|
: {};
|
|
249
|
+
const argsForHost = platform === "kilo"
|
|
250
|
+
? zod3ShapeToV4(shape)
|
|
251
|
+
: shape;
|
|
267
252
|
tools[registered.name] = {
|
|
268
253
|
description: String(config.description ?? ""),
|
|
269
|
-
args:
|
|
254
|
+
args: argsForHost,
|
|
270
255
|
async execute(args, toolCtx) {
|
|
271
256
|
toolCtx.metadata?.({ title: String(config.title ?? registered.name) });
|
|
272
257
|
const project = toolCtx.directory || projectDir;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function zod3ShapeToV4(shape: Record<string, unknown>, depth?: number): Record<string, unknown>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod 3 → Zod 4 shape conversion (KiloCode only).
|
|
3
|
+
*
|
|
4
|
+
* KiloCode's runtime bundles Zod v4 internally. When it receives plugin tool
|
|
5
|
+
* definitions whose `args` contain Zod v3 schemas (with `_def` but no `_zod`),
|
|
6
|
+
* it crashes with `undefined is not an object (evaluating 'n._zod.def')`.
|
|
7
|
+
*
|
|
8
|
+
* This module converts Zod 3 schema shapes into Zod 4 equivalents so KiloCode
|
|
9
|
+
* can process them natively. Only called when `platform === "kilo"`.
|
|
10
|
+
* OpenCode uses Zod 3 natively and receives the original shapes unchanged.
|
|
11
|
+
*/
|
|
12
|
+
import z from 'zod/v4';
|
|
13
|
+
export function zod3ShapeToV4(shape, depth = 0) {
|
|
14
|
+
const result = {};
|
|
15
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
16
|
+
result[key] = zod3ToV4(value, depth);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
function zod3ToV4(v, depth = 0) {
|
|
21
|
+
if (depth > 10)
|
|
22
|
+
return z.unknown();
|
|
23
|
+
if (v == null || typeof v !== "object")
|
|
24
|
+
return z.unknown();
|
|
25
|
+
const obj = v;
|
|
26
|
+
if (!obj._def || typeof obj._def !== "object")
|
|
27
|
+
return z.unknown();
|
|
28
|
+
const def = obj._def;
|
|
29
|
+
let result;
|
|
30
|
+
switch (def.typeName) {
|
|
31
|
+
case "ZodString":
|
|
32
|
+
result = z.string();
|
|
33
|
+
break;
|
|
34
|
+
case "ZodNumber":
|
|
35
|
+
result = z.number();
|
|
36
|
+
break;
|
|
37
|
+
case "ZodBoolean":
|
|
38
|
+
result = z.boolean();
|
|
39
|
+
break;
|
|
40
|
+
case "ZodAny":
|
|
41
|
+
result = z.any();
|
|
42
|
+
break;
|
|
43
|
+
case "ZodUnknown":
|
|
44
|
+
result = z.unknown();
|
|
45
|
+
break;
|
|
46
|
+
case "ZodNever":
|
|
47
|
+
result = z.never();
|
|
48
|
+
break;
|
|
49
|
+
case "ZodNull":
|
|
50
|
+
result = z.null();
|
|
51
|
+
break;
|
|
52
|
+
case "ZodUndefined":
|
|
53
|
+
result = z.undefined();
|
|
54
|
+
break;
|
|
55
|
+
case "ZodLiteral":
|
|
56
|
+
result = z.literal(def.value);
|
|
57
|
+
break;
|
|
58
|
+
case "ZodArray":
|
|
59
|
+
result = z.array(zod3ToV4(def.type ?? def.elementType, depth + 1));
|
|
60
|
+
break;
|
|
61
|
+
case "ZodEnum": {
|
|
62
|
+
const values = def.values;
|
|
63
|
+
result = Array.isArray(values) && values.length > 0
|
|
64
|
+
? z.enum(values)
|
|
65
|
+
: z.never();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "ZodObject": {
|
|
69
|
+
const raw = def.shape;
|
|
70
|
+
const inner = typeof raw === "function" ? raw() : raw;
|
|
71
|
+
result = z.object(inner ? zod3ShapeToV4(inner, depth + 1) : {});
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case "ZodOptional":
|
|
75
|
+
result = z.optional(zod3ToV4(def.innerType ?? def.type, depth + 1));
|
|
76
|
+
break;
|
|
77
|
+
case "ZodNullable":
|
|
78
|
+
result = z.nullable(zod3ToV4(def.innerType ?? def.type, depth + 1));
|
|
79
|
+
break;
|
|
80
|
+
case "ZodDefault": {
|
|
81
|
+
const val = typeof def.defaultValue === "function"
|
|
82
|
+
? def.defaultValue()
|
|
83
|
+
: def.defaultValue;
|
|
84
|
+
result = zod3ToV4(def.innerType ?? def.type, depth + 1).default(val);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case "ZodRecord":
|
|
88
|
+
result = z.record(z.string(), zod3ToV4(def.valueType, depth + 1));
|
|
89
|
+
break;
|
|
90
|
+
case "ZodUnion": {
|
|
91
|
+
const opts = def.options;
|
|
92
|
+
if (!opts || opts.length === 0)
|
|
93
|
+
return z.never();
|
|
94
|
+
if (opts.length === 1)
|
|
95
|
+
return zod3ToV4(opts[0], depth + 1);
|
|
96
|
+
result = z.union(opts.map(o => zod3ToV4(o, depth + 1)));
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case "ZodEffects":
|
|
100
|
+
// Host schema only. Original Zod 3 schema still parses in execute().
|
|
101
|
+
result = zod3ToV4(def.schema, depth + 1);
|
|
102
|
+
break;
|
|
103
|
+
default:
|
|
104
|
+
// Never leak raw Zod 3 schemas back to KiloCode.
|
|
105
|
+
result = z.unknown();
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return def.description && typeof result.describe === "function"
|
|
109
|
+
? result.describe(String(def.description))
|
|
110
|
+
: result;
|
|
111
|
+
}
|