@fanchao8609/agent_brain_sync 1.5.2 → 1.5.3

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/install.js +17 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanchao8609/agent_brain_sync",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "agent-brain-sync: 跨会话 AI 编码记忆 — hook 纯触发 + CLI/MCP 读写 .brain markdown 图谱, 防并发写保护。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/install.js CHANGED
@@ -598,8 +598,17 @@ async function installPi({ withMcp, withSkill, log }) {
598
598
  const p = join(dir, 'abs.ts');
599
599
  await atomicWrite(p, piPluginSource()); // Pi 用专用模板, 语法与 OpenCode 不同构
600
600
  steps.push(`✓ hook(ts extension) → ${p}`);
601
+ // MCP → ~/.pi/agent/mcp.json 的 mcpServers (stdio)
602
+ // 曾经只打印「走 extension 内桥接」而没有任何桥接代码 —— 靠 mcp-adapter 的
603
+ // hostConfigDiscovery 间接读到 cl​aude 注册才"看起来能用"; 没有 cl​aude 宿主的机器上直接缺失。
601
604
  if (withMcp) {
602
- steps.push(`• MCP → Pi 走 extension 内桥接(见 ${p}), 未单独注册`);
605
+ const mcpP = join(hostConfigRoot('pi'), 'agent', 'mcp.json');
606
+ await backup(mcpP);
607
+ const cfg = await readJson(mcpP);
608
+ cfg.mcpServers = cfg.mcpServers || {};
609
+ cfg.mcpServers['abs'] = { type: 'stdio', command: process.execPath, args: [mcpEntryPath()] };
610
+ await atomicWrite(mcpP, JSON.stringify(cfg, null, 2));
611
+ steps.push(`✓ MCP → ${mcpP} (mcpServers.abs, stdio)`);
603
612
  }
604
613
  if (withSkill) {
605
614
  const target = join(hostSkillDir('pi'), 'SKILL.md');
@@ -615,6 +624,13 @@ async function uninstallPi() {
615
624
  steps.push(`✓ extension 已删除`);
616
625
  await fs.rm(hostSkillDir('pi'), { recursive: true, force: true });
617
626
  steps.push(`✓ skill 已删除`);
627
+ const mcpP = join(hostConfigRoot('pi'), 'agent', 'mcp.json');
628
+ const cfg = await readJson(mcpP);
629
+ if (cfg.mcpServers && cfg.mcpServers.abs) {
630
+ delete cfg.mcpServers.abs;
631
+ await atomicWrite(mcpP, JSON.stringify(cfg, null, 2));
632
+ steps.push(`✓ MCP 已从 ${mcpP} 移除`);
633
+ }
618
634
  return steps;
619
635
  }
620
636