@fanchao8609/agent_brain_sync 1.5.0 → 1.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/store.js +14 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanchao8609/agent_brain_sync",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "agent-brain-sync: 跨会话 AI 编码记忆 — hook 纯触发 + CLI/MCP 读写 .brain markdown 图谱, 防并发写保护。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/store.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { promises as fs } from 'node:fs';
4
4
  import { join, resolve, dirname } from 'node:path';
5
5
  import { homedir } from 'node:os';
6
- import { requireBrain, findBrainRoot, brainPath } from './index.js';
6
+ import { requireBrain, findBrainRoot, brainPath, BRAIN_DIR } from './index.js';
7
7
  import { addTask, upsertTask, boardText, readTodo, ensureTodo, todoTemplate, today, localStamp, setBreakpoint, moveBlocked, insertDoneGrouped, idOfTaskLine, archiveDoneInText, renderArchivePage, renderArchiveBody } from './todo.js';
8
8
  import { editFile, SKIP } from './lock.js';
9
9
  import { appendWrapup, strandedFor, wrapupLogPath } from './wrapup.js';
@@ -593,8 +593,8 @@ export async function cmdLint({ dir }) {
593
593
  issues.push(`UNRESOLVED-CONFLICT: ${pg.rel}`);
594
594
  }
595
595
  if (['concepts', 'entities', 'syntheses'].includes(pg.dir)) {
596
- if (pg.lines > 150 || pg.bytes > 5 * 1024) {
597
- issues.push(`OVER-SIZE: ${pg.rel} (${pg.lines}L/${pg.bytes}B > 150L/5120B; 拆或外链)`);
596
+ if (pg.lines > PAGE_MAX_LINES || pg.bytes > PAGE_MAX_BYTES) {
597
+ issues.push(`OVER-SIZE: ${pg.rel} (${pg.lines}L/${pg.bytes}B > ${PAGE_MAX_LINES}L/${PAGE_MAX_BYTES / 1024}KB; 拆或外链)`);
598
598
  }
599
599
  }
600
600
  if (pg.dir !== 'sources' && !pg.indexed) {
@@ -639,6 +639,14 @@ export async function cmdLint({ dir }) {
639
639
 
640
640
  const PAGE_DIRS = ['entities', 'concepts', 'sources', 'syntheses', 'sessions'];
641
641
 
642
+ // concept/entity/synthesis 页的容量上限,超出提示"拆或外链"。
643
+ // 曾为 150L/5120B —— 实测偏紧:跨 4 项目 68 页里仅 2 页超限,且都只超一点
644
+ // (5463B / 5440B);为满足它还把一页从 5319B 压到 4972B(内容受损、收益为零)。
645
+ // 放宽到 8KB:当前最大页 5463B,留约 50% 余量,但不至于失去"该拆了"的信号。
646
+ // 提成常量避免检查条件与提示文本各写一份而漂移。
647
+ const PAGE_MAX_LINES = 150;
648
+ const PAGE_MAX_BYTES = 8 * 1024;
649
+
642
650
  async function listPages(vault) {
643
651
  let indexText = '';
644
652
  try {
@@ -661,7 +669,9 @@ async function listPages(vault) {
661
669
  const links = [...new Set([...body.matchAll(/\[\[([^\]]+)\]\]/g)].map((m) => m[1].split('|')[0]))];
662
670
  pages.push({
663
671
  dir: d,
664
- rel: `${d}/${f}`,
672
+ // 带上 .brain/ 前缀:这串会原样出现在 lint 提示里,用户会拿它去找文件。
673
+ // 坑: 曾经只给 vault 相对路径(concepts/x.md),用户到项目根找 concepts/ 找不到。
674
+ rel: `${BRAIN_DIR}/${d}/${f}`,
665
675
  slug: f.replace(/\.md$/, ''),
666
676
  body,
667
677
  frontmatter: fm ? fm[1] : '',