context-mode 1.0.151 → 1.0.152
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/mcp.json +5 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +16 -1
- package/.openclaw-plugin/package.json +1 -1
- package/README.md +89 -3
- package/build/adapters/claude-code/hooks.js +2 -2
- package/build/adapters/claude-code/index.js +14 -13
- package/build/adapters/client-map.js +3 -0
- package/build/adapters/detect.js +13 -1
- package/build/adapters/gemini-cli/hooks.d.ts +10 -0
- package/build/adapters/gemini-cli/hooks.js +12 -2
- package/build/adapters/gemini-cli/index.d.ts +21 -1
- package/build/adapters/gemini-cli/index.js +37 -1
- package/build/adapters/kimi/config.d.ts +8 -0
- package/build/adapters/kimi/config.js +8 -0
- package/build/adapters/kimi/hooks.d.ts +28 -0
- package/build/adapters/kimi/hooks.js +34 -0
- package/build/adapters/kimi/index.d.ts +66 -0
- package/build/adapters/kimi/index.js +537 -0
- package/build/adapters/kimi/paths.d.ts +1 -0
- package/build/adapters/kimi/paths.js +12 -0
- package/build/adapters/kiro/hooks.js +2 -2
- package/build/adapters/openclaw/plugin.d.ts +14 -13
- package/build/adapters/openclaw/plugin.js +140 -40
- package/build/adapters/opencode/plugin.js +4 -3
- package/build/adapters/opencode/zod3tov4.js +8 -8
- package/build/adapters/pi/extension.js +9 -24
- package/build/adapters/pi/mcp-bridge.js +37 -0
- package/build/adapters/qwen-code/index.js +7 -7
- package/build/adapters/types.d.ts +39 -2
- package/build/adapters/types.js +55 -2
- package/build/cli.js +433 -25
- package/build/executor.js +6 -3
- package/build/runtime.d.ts +81 -1
- package/build/runtime.js +195 -9
- package/build/search/ctx-search-schema.d.ts +90 -0
- package/build/search/ctx-search-schema.js +135 -0
- package/build/search/unified.d.ts +12 -0
- package/build/search/unified.js +17 -2
- package/build/server.d.ts +2 -1
- package/build/server.js +378 -97
- package/build/session/analytics.d.ts +36 -13
- package/build/session/analytics.js +123 -26
- package/build/session/db.d.ts +24 -0
- package/build/session/db.js +41 -0
- package/build/session/extract.js +30 -0
- package/build/session/snapshot.js +24 -0
- package/build/store.d.ts +12 -1
- package/build/store.js +72 -20
- package/build/types.d.ts +7 -0
- package/build/util/project-dir.d.ts +19 -16
- package/build/util/project-dir.js +80 -45
- package/cli.bundle.mjs +371 -320
- package/configs/kimi/hooks.json +54 -0
- package/configs/pi/AGENTS.md +3 -85
- package/hooks/cache-heal-utils.mjs +148 -0
- package/hooks/core/formatters.mjs +26 -0
- package/hooks/core/routing.mjs +9 -1
- package/hooks/core/stdin.mjs +74 -3
- package/hooks/core/tool-naming.mjs +1 -0
- package/hooks/heal-partial-install.mjs +712 -0
- package/hooks/kimi/platform.mjs +1 -0
- package/hooks/kimi/posttooluse.mjs +72 -0
- package/hooks/kimi/precompact.mjs +80 -0
- package/hooks/kimi/pretooluse.mjs +42 -0
- package/hooks/kimi/sessionend.mjs +61 -0
- package/hooks/kimi/sessionstart.mjs +113 -0
- package/hooks/kimi/stop.mjs +61 -0
- package/hooks/kimi/userpromptsubmit.mjs +90 -0
- package/hooks/normalize-hooks.mjs +66 -12
- package/hooks/routing-block.mjs +8 -2
- package/hooks/security.bundle.mjs +1 -1
- package/hooks/session-db.bundle.mjs +6 -4
- package/hooks/session-extract.bundle.mjs +2 -2
- package/hooks/session-helpers.mjs +93 -3
- package/hooks/session-snapshot.bundle.mjs +20 -19
- package/hooks/sessionstart.mjs +64 -0
- package/insight/server.mjs +15 -3
- package/openclaw.plugin.json +16 -1
- package/package.json +1 -1
- package/scripts/heal-installed-plugins.mjs +31 -10
- package/scripts/postinstall.mjs +10 -0
- package/server.bundle.mjs +206 -157
- package/skills/ctx-index/SKILL.md +46 -0
- package/skills/ctx-search/SKILL.md +35 -0
- package/start.mjs +84 -11
- package/build/cache-heal.d.ts +0 -48
- package/build/cache-heal.js +0 -150
- package/build/concurrency/runPool.d.ts +0 -36
- package/build/concurrency/runPool.js +0 -51
- package/build/openclaw/mcp-tools.d.ts +0 -54
- package/build/openclaw/mcp-tools.js +0 -198
- package/build/openclaw/workspace-router.d.ts +0 -29
- package/build/openclaw/workspace-router.js +0 -64
- 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 -375
- package/build/pi-extension.d.ts +0 -14
- package/build/pi-extension.js +0 -451
- package/build/routing-block.d.ts +0 -8
- package/build/routing-block.js +0 -86
- package/build/tool-naming.d.ts +0 -4
- package/build/tool-naming.js +0 -24
|
@@ -205,8 +205,6 @@ export function healSettingsEnabledPlugins({ settingsPath, pluginKey }) {
|
|
|
205
205
|
// - `src/cli.ts` upgrade() (post-bump)
|
|
206
206
|
// ─────────────────────────────────────────────────────────────────────────
|
|
207
207
|
|
|
208
|
-
/** Matches `<sep>context-mode-upgrade-<digits><sep>`. OS-agnostic. */
|
|
209
|
-
const TMPDIR_UPGRADE_RE = /[/\\]context-mode-upgrade-\d+[/\\]/;
|
|
210
208
|
const PLACEHOLDER_ARG = "${CLAUDE_PLUGIN_ROOT}/start.mjs";
|
|
211
209
|
|
|
212
210
|
/**
|
|
@@ -262,10 +260,13 @@ export function healPluginJsonMcpServers({ pluginRoot, pluginCacheRoot, pluginKe
|
|
|
262
260
|
const before = ours.args;
|
|
263
261
|
const after = before.map((a) => {
|
|
264
262
|
if (typeof a !== "string") return a;
|
|
265
|
-
//
|
|
266
|
-
|
|
267
|
-
//
|
|
268
|
-
|
|
263
|
+
// Already the placeholder — nothing to heal.
|
|
264
|
+
if (a === PLACEHOLDER_ARG) return a;
|
|
265
|
+
// Issue #711: any absolute path ending in start.mjs should be the
|
|
266
|
+
// placeholder. Catches tmpdir paths (context-mode-upgrade-<digits>)
|
|
267
|
+
// AND stale versioned cache-dir paths (.../1.0.103/start.mjs) that
|
|
268
|
+
// normalizeHooksOnStartup baked in during a prior upgrade.
|
|
269
|
+
if (/[/\\]start\.mjs$/.test(a)) {
|
|
269
270
|
return PLACEHOLDER_ARG;
|
|
270
271
|
}
|
|
271
272
|
return a;
|
|
@@ -369,14 +370,16 @@ export function healMcpJsonArgs({ pluginRoot, pluginCacheRoot, pluginKey }) {
|
|
|
369
370
|
const before = ours.args;
|
|
370
371
|
const after = before.map((a) => {
|
|
371
372
|
if (typeof a !== "string") return a;
|
|
373
|
+
// Already the placeholder — nothing to heal.
|
|
374
|
+
if (a === PLACEHOLDER_ARG) return a;
|
|
372
375
|
// Drift shape #1 (issue #531 / commit aea633c): bare relative `./start.mjs`.
|
|
373
|
-
// Resolved against session CWD (not pluginRoot) → MODULE_NOT_FOUND.
|
|
374
376
|
if (a === "./start.mjs" || a === "start.mjs") {
|
|
375
377
|
return PLACEHOLDER_ARG;
|
|
376
378
|
}
|
|
377
|
-
//
|
|
378
|
-
// tmpdir
|
|
379
|
-
|
|
379
|
+
// Issue #711: any absolute path ending in start.mjs should be the
|
|
380
|
+
// placeholder. Catches tmpdir paths AND stale versioned cache-dir
|
|
381
|
+
// paths (.../1.0.103/start.mjs) from prior upgrades.
|
|
382
|
+
if (/[/\\]start\.mjs$/.test(a)) {
|
|
380
383
|
return PLACEHOLDER_ARG;
|
|
381
384
|
}
|
|
382
385
|
return a;
|
|
@@ -430,6 +433,18 @@ export function healClaudeJsonMcpArgs({ dotClaudeJsonPath, pluginCacheParent, ne
|
|
|
430
433
|
}
|
|
431
434
|
|
|
432
435
|
const cacheParentFwd = pluginCacheParent.replace(/\\/g, "/");
|
|
436
|
+
// Post-resolve containment on newArg. ~/.claude.json is locally user-
|
|
437
|
+
// writable (same trust boundary as installed_plugins.json), and the
|
|
438
|
+
// `suffix` slice is derived from arg strings inside the existing config.
|
|
439
|
+
// A crafted arg like
|
|
440
|
+
// .../cache/<owner>/<plugin>/1.0.0/../../../evil/start.mjs
|
|
441
|
+
// slices to suffix="../../../evil/start.mjs", and resolve(newPluginRoot,
|
|
442
|
+
// suffix) normalizes to an attacker-chosen .mjs path outside the plugin
|
|
443
|
+
// cache. Writing that path back into ~/.claude.json mutates the mcpServers
|
|
444
|
+
// args so the next MCP boot spawns from the attacker path. Reject any
|
|
445
|
+
// suffix that escapes newPluginRoot.
|
|
446
|
+
const newPluginRootResolved = resolve(newPluginRoot);
|
|
447
|
+
const newPluginRootWithSep = newPluginRootResolved + sep;
|
|
433
448
|
|
|
434
449
|
let mutated = false;
|
|
435
450
|
for (const srv of Object.values(servers)) {
|
|
@@ -444,6 +459,12 @@ export function healClaudeJsonMcpArgs({ dotClaudeJsonPath, pluginCacheParent, ne
|
|
|
444
459
|
if (slashIdx < 0) continue;
|
|
445
460
|
const suffix = rel.slice(slashIdx + 1);
|
|
446
461
|
const newArg = resolve(newPluginRoot, suffix);
|
|
462
|
+
if (
|
|
463
|
+
newArg !== newPluginRootResolved &&
|
|
464
|
+
!(newArg + sep).startsWith(newPluginRootWithSep)
|
|
465
|
+
) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
447
468
|
if (newArg !== arg) {
|
|
448
469
|
srv.args[i] = newArg;
|
|
449
470
|
mutated = true;
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -364,10 +364,20 @@ try { healBetterSqlite3Binding(pkgRoot); } catch { /* best effort — don't bloc
|
|
|
364
364
|
const TMPDIR_UPGRADE_RE = /[/\\]context-mode-upgrade-\d+[/\\]?$/;
|
|
365
365
|
if (isGlobalInstall() && !TMPDIR_UPGRADE_RE.test(pkgRoot)) {
|
|
366
366
|
try {
|
|
367
|
+
// #738: probe for Bun ≥1.0 so the post-install hooks.json rewrite picks
|
|
368
|
+
// the faster runtime where available. Probe failures (e.g. build not
|
|
369
|
+
// present yet during `npm install` itself) fall through to nodePath.
|
|
370
|
+
let jsRuntimePath;
|
|
371
|
+
try {
|
|
372
|
+
const { resolveHookRuntime } = await import("../build/runtime.js");
|
|
373
|
+
const r = resolveHookRuntime();
|
|
374
|
+
if (r.isBun) jsRuntimePath = r.path;
|
|
375
|
+
} catch { /* best effort — fall through */ }
|
|
367
376
|
const { normalizeHooksOnStartup } = await import("../hooks/normalize-hooks.mjs");
|
|
368
377
|
normalizeHooksOnStartup({
|
|
369
378
|
pluginRoot: pkgRoot,
|
|
370
379
|
nodePath: process.execPath,
|
|
380
|
+
jsRuntimePath,
|
|
371
381
|
platform: process.platform,
|
|
372
382
|
});
|
|
373
383
|
} catch { /* best effort — never block install */ }
|