context-mode 1.0.134 → 1.0.136

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.
Files changed (50) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/hooks.json +65 -0
  4. package/.codex-plugin/mcp.json +9 -0
  5. package/.codex-plugin/plugin.json +31 -0
  6. package/.openclaw-plugin/openclaw.plugin.json +1 -1
  7. package/.openclaw-plugin/package.json +1 -1
  8. package/README.md +60 -12
  9. package/build/adapters/detect.d.ts +3 -1
  10. package/build/adapters/detect.js +7 -2
  11. package/build/adapters/pi/mcp-bridge.d.ts +44 -0
  12. package/build/adapters/pi/mcp-bridge.js +149 -3
  13. package/build/cli.js +17 -0
  14. package/build/lifecycle.d.ts +13 -13
  15. package/build/lifecycle.js +14 -14
  16. package/build/runtime.js +8 -5
  17. package/build/session/analytics.d.ts +0 -13
  18. package/build/session/analytics.js +50 -1
  19. package/build/session/extract.js +39 -1
  20. package/build/util/claude-config.d.ts +12 -6
  21. package/build/util/claude-config.js +16 -23
  22. package/cli.bundle.mjs +135 -133
  23. package/configs/kilo/kilo.json +9 -2
  24. package/configs/opencode/opencode.json +9 -2
  25. package/hooks/codex/platform.mjs +1 -0
  26. package/hooks/codex/posttooluse.mjs +1 -0
  27. package/hooks/codex/precompact.mjs +1 -0
  28. package/hooks/codex/pretooluse.mjs +1 -0
  29. package/hooks/codex/sessionstart.mjs +24 -1
  30. package/hooks/codex/stop.mjs +1 -0
  31. package/hooks/codex/userpromptsubmit.mjs +1 -0
  32. package/hooks/core/platform-detect.mjs +1 -1
  33. package/hooks/core/routing.mjs +112 -10
  34. package/hooks/ensure-deps.mjs +14 -3
  35. package/hooks/normalize-hooks.mjs +5 -2
  36. package/hooks/security.bundle.mjs +1 -1
  37. package/hooks/session-extract.bundle.mjs +2 -2
  38. package/openclaw.plugin.json +1 -1
  39. package/package.json +2 -1
  40. package/scripts/heal-installed-plugins.mjs +67 -0
  41. package/server.bundle.mjs +99 -99
  42. package/start.mjs +73 -11
  43. package/build/openclaw-plugin.d.ts +0 -130
  44. package/build/openclaw-plugin.js +0 -626
  45. package/build/opencode-plugin.d.ts +0 -122
  46. package/build/opencode-plugin.js +0 -372
  47. package/build/pi-extension.d.ts +0 -14
  48. package/build/pi-extension.js +0 -451
  49. package/build/util/db-lock.d.ts +0 -65
  50. package/build/util/db-lock.js +0 -166
@@ -394,3 +394,70 @@ export function healMcpJsonArgs({ pluginRoot, pluginCacheRoot, pluginKey }) {
394
394
 
395
395
  return { healed };
396
396
  }
397
+
398
+ /**
399
+ * Heal user-level ~/.claude.json MCP server registrations that point to an
400
+ * old context-mode version dir in the plugin cache.
401
+ *
402
+ * Users who work around the Claude Code plugin MCP tool-exposure bug
403
+ * (anthropics/claude-code#59310) by running `claude mcp add --scope user`
404
+ * end up with an absolute path to a specific version dir in ~/.claude.json.
405
+ * After /ctx-upgrade that path is stale — this heal detects and updates it.
406
+ *
407
+ * @param {{
408
+ * dotClaudeJsonPath: string,
409
+ * pluginCacheParent: string,
410
+ * newPluginRoot: string,
411
+ * }} opts
412
+ * @returns {HealResult}
413
+ */
414
+ export function healClaudeJsonMcpArgs({ dotClaudeJsonPath, pluginCacheParent, newPluginRoot }) {
415
+ if (!dotClaudeJsonPath || !existsSync(dotClaudeJsonPath)) {
416
+ return { healed: [], skipped: "no-claude-json" };
417
+ }
418
+
419
+ let raw;
420
+ try { raw = readFileSync(dotClaudeJsonPath, "utf-8"); }
421
+ catch (err) { return { healed: [], error: `read-failed: ${(err && err.message) || err}` }; }
422
+
423
+ let config;
424
+ try { config = JSON.parse(raw); }
425
+ catch (err) { return { healed: [], error: `parse-failed: ${(err && err.message) || err}` }; }
426
+
427
+ const servers = config && config.mcpServers;
428
+ if (!servers || typeof servers !== "object") {
429
+ return { healed: [], skipped: "no-mcp-servers" };
430
+ }
431
+
432
+ const cacheParentFwd = pluginCacheParent.replace(/\\/g, "/");
433
+
434
+ let mutated = false;
435
+ for (const srv of Object.values(servers)) {
436
+ if (!srv || typeof srv !== "object" || !Array.isArray(srv.args)) continue;
437
+ for (let i = 0; i < srv.args.length; i++) {
438
+ const arg = srv.args[i];
439
+ if (typeof arg !== "string") continue;
440
+ const argFwd = arg.replace(/\\/g, "/");
441
+ if (!argFwd.startsWith(cacheParentFwd + "/")) continue;
442
+ const rel = argFwd.slice(cacheParentFwd.length + 1);
443
+ const slashIdx = rel.indexOf("/");
444
+ if (slashIdx < 0) continue;
445
+ const suffix = rel.slice(slashIdx + 1);
446
+ const newArg = resolve(newPluginRoot, suffix);
447
+ if (newArg !== arg) {
448
+ srv.args[i] = newArg;
449
+ mutated = true;
450
+ }
451
+ }
452
+ }
453
+
454
+ if (!mutated) return { healed: [] };
455
+
456
+ try {
457
+ writeFileSync(dotClaudeJsonPath, JSON.stringify(config, null, 2), "utf-8");
458
+ } catch (err) {
459
+ return { healed: [], error: `write-failed: ${(err && err.message) || err}` };
460
+ }
461
+
462
+ return { healed: ["claude-json-mcp-args"] };
463
+ }