@fanchao8609/agent_brain_sync 1.25.0 → 1.25.1

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.
@@ -18,7 +18,7 @@
18
18
  * 注意:自动补全菜单行排在底边之下、且自带内容宽度,不套竖线(否则菜单被框住会错位)。
19
19
  */
20
20
  import { CustomEditor } from '@earendil-works/pi-coding-agent'
21
- import { buildStatus, roundBorder, shortenModel } from './pi-rounded-format.ts'
21
+ import { buildStatus, roundBorder, shortenModel } from './format.ts'
22
22
 
23
23
  const SIDE = '│'
24
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanchao8609/agent_brain_sync",
3
- "version": "1.25.0",
3
+ "version": "1.25.1",
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
@@ -819,14 +819,17 @@ async function installPi({ withMcp, withSkill }) {
819
819
  await atomicWrite(p, piPluginSource()); // Pi 用专用模板, 语法与 OpenCode 不同构
820
820
  steps.push(`✓ hook(ts extension) → ${p}`);
821
821
  // 圆角四边框输入框(纯 UI,与记忆功能无关,pi 专属)。
822
- // 为什么要独立成第二个扩展文件:它是可选样式,用户不想要时删掉这一个文件即可,
823
- // 不必动 abs.ts 这个核心 hook。模板无占位符,直接拷。
824
- // 两个文件必须一起装:editor 里 import 了 format 的纯函数(抽出来是为了能单测)。
825
- const roundedFiles = ['pi-rounded-editor.ts', 'pi-rounded-format.ts'];
826
- for (const f of roundedFiles) {
827
- await atomicWrite(join(dir, f), renderPluginTemplate(f, {}));
828
- }
829
- steps.push(`✓ editor(rounded box) → ${join(dir, 'pi-rounded-editor.ts')}`);
822
+ // 为什么独立成一个扩展:它是可选样式,不想要时删掉这个目录即可,不必动 abs.ts。
823
+ // 为什么用「目录 + index.ts」而不是两个平铺的 .ts:
824
+ // pi 会把 extensions/ 下**每个顶层 .ts 都当独立扩展**并强制要求默认导出工厂函数 ——
825
+ // 平铺一个纯函数文件会让 pi 启动直接报错(2026-11-04 实报:
826
+ // "Failed to load extension pi-rounded-format.ts: does not export a valid factory function")。
827
+ // 子目录只为入口 index.ts 加载,helper 文件不参与扫描(官方多文件扩展写法)。
828
+ const roundedDir = join(dir, 'abs-rounded-editor');
829
+ for (const f of ['index.ts', 'format.ts']) {
830
+ await atomicWrite(join(roundedDir, f), renderPluginTemplate(`abs-rounded-editor/${f}`, {}));
831
+ }
832
+ steps.push(`✓ editor(rounded box) → ${join(roundedDir, 'index.ts')}`);
830
833
  // MCP → ~/.pi/agent/mcp-adapter.json 的 mcpServers (stdio)
831
834
  // 坑(2026-09-30 用户实报):曾写 mcp.json,但 pi-mcp-adapter 已不再读它
832
835
  // (pi 自有 mcp.json 被 adapter 忽略,adapter 改读 mcp-adapter.json)→ 写了等于没写。
@@ -848,8 +851,10 @@ async function installPi({ withMcp, withSkill }) {
848
851
  async function uninstallPi() {
849
852
  const steps = [];
850
853
  await fs.rm(join(hostConfigRoot('pi'), 'agent', 'extensions', 'abs.ts'), { force: true });
851
- for (const f of ['pi-rounded-editor.ts', 'pi-rounded-format.ts']) {
852
- await fs.rm(join(hostConfigRoot('pi'), 'agent', 'extensions', f), { force: true });
854
+ // 目录形式:整个删掉。顺带清掉旧版本平铺的两个文件(1.25.0 装过那种布局)。
855
+ await fs.rm(join(hostConfigRoot('pi'), 'agent', 'extensions', 'abs-rounded-editor'), { recursive: true, force: true });
856
+ for (const legacy of ['pi-rounded-editor.ts', 'pi-rounded-format.ts']) {
857
+ await fs.rm(join(hostConfigRoot('pi'), 'agent', 'extensions', legacy), { force: true });
853
858
  }
854
859
  steps.push(`✓ extension 已删除`);
855
860
  steps.push(...await uninstallSkills('pi'));