dsh-zdiary-kit 3.14.2 → 3.16.0

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 记忆注入(M1):读 vault 根目录的 AGENTS.md / USER.md / MEMORY.md,
2
+ * 记忆注入:读 vault 根目录的 AGENTS.md / USER.md / MEMORY.md,
3
3
  * 按 `memoryBudgetWords` 截断,渲染成一段可注入系统提示的文本。
4
4
  * 另读 DREAMS.md 的「上次做梦」一行(不进正文、不计预算),给周节奏一句机械提醒。
5
5
  * 人格层(PERSONA.md)单独一段注入、永远在记忆段之前、不参与截断,
@@ -8,7 +8,7 @@
8
8
  * 硬约定:
9
9
  * · 预算按**总载荷**算,不是只卡 MEMORY.md;
10
10
  * · 切分按三级降级:`##` 小节 → 顶层列表项 → 空行段落。只有 `##` 一级时,
11
- * `# 记忆` + 要点列表(最常见的写法)一个小节都切不出来,预算会整个失效 —— 见 P0-1;
11
+ * `# 记忆` + 要点列表(最常见的写法)一个小节都切不出来,预算会整个失效;
12
12
  * · 截断顺序纯机械:先丢 MEMORY 里**日期最旧**的一条(都没有日期才退回尾部整条),
13
13
  * 再丢 USER 的尾部整段,最后各自只留首段;AGENTS.md 是硬规则,永不截断(单独超预算时只告警);
14
14
  * · 退役条目(`- [superseded …]`)磁盘保留、注入省略 —— 它们按约定退役,不该继续占预算;
@@ -16,7 +16,7 @@
16
16
  * 选哪段是 agent 按当前任务判断,插件只搬运目录,不猜相关性;
17
17
  * · 中文按「1 词 / 2 字」计 —— 空白切分在中文上严重低估,预算会变成装饰。
18
18
  *
19
- * 另有一条可观测性约定(D6 的补完):截断不只回显「截了多少」,还要能解释「谁吃掉的」——
19
+ * 另有一条可观测性约定:截断不只回显「截了多少」,还要能解释「谁吃掉的」——
20
20
  * 否则用户只看到 MEMORY 常年不生效,排查会跑去怀疑注入没挂载(见 notice 里的 AGENTS 归因)。
21
21
  *
22
22
  * 读文件失败一律当作「没有这份文件」:老 vault 没有这些文件也能照常工作。
@@ -99,7 +99,7 @@ function splitItems(lines) {
99
99
  return { head, items };
100
100
  }
101
101
  /**
102
- * 单节再切一层(P0-2):小节标题并进 head(永不丢),正文按顶层列表项切;
102
+ * 单节再切一层:小节标题并进 head(永不丢),正文按顶层列表项切;
103
103
  * 不足两条就保持原样 —— 只有一条时没有可丢的粒度,交给「预算不足」照旧点名。
104
104
  * 初次切分与「丢到只剩一节」都走这一个函数,保证两条路径同形。
105
105
  */
@@ -114,7 +114,7 @@ function degradeSingleSection(split) {
114
114
  return finishSplit([head], inner.items, 'items');
115
115
  }
116
116
  /**
117
- * 三级降级切分(P0-1):`##` 小节 → 顶层列表项 → 空行段落。
117
+ * 三级降级切分:`##` 小节 → 顶层列表项 → 空行段落。
118
118
  * 只按 `##` 切时,「`# 记忆` + 要点列表」这种形状切不出任何小节,丢弃循环一次都不进,
119
119
  * 预算于是完全不生效(真机 880 / 449 / 895 词都是这个形状)。降级只影响超预算的库:
120
120
  * 预算内不调用这个函数的结果做任何改写。
@@ -138,7 +138,7 @@ function splitSections(body) {
138
138
  }
139
139
  if (sections.length > 0) {
140
140
  const split = finishSplit(head, sections, 'sections');
141
- // 只有一节时再降一层(P0-2):`## 结论` + 一串 `- 结论` 是最常见的形状,
141
+ // 只有一节时再降一层:`## 结论` + 一串 `- 结论` 是最常见的形状,
142
142
  // 不降级的话丢弃循环一次都不进,整篇绕过预算。
143
143
  return split.sections.length === 1 ? degradeSingleSection(split) ?? split : split;
144
144
  }
@@ -180,7 +180,7 @@ function firstSection(body) {
180
180
  }
181
181
  /**
182
182
  * 下一个该丢的条目:能解析出日期时选**最旧**的一条(同日期按位置靠后的先丢);
183
- * 一条日期都解析不出来返回 null —— 调用方退回尾部丢,老库行为不变(D2.6)。
183
+ * 一条日期都解析不出来返回 null —— 调用方退回尾部丢,老库行为不变。
184
184
  *
185
185
  * 为什么按日期而不是位置:条目约定是「新结论写顶部」,但没人能保证每次都守;
186
186
  * 按位置丢会把最新结论先删掉,而那正好是最该留的。
@@ -353,7 +353,7 @@ function computePayload(cfg) {
353
353
  // 磁盘原文:files[].originalWords 与记忆页的对齐点,退役条目也算在里面
354
354
  const diskWords = new Map(files.map((f) => [f.name, countWords(f.body)]));
355
355
  const original = new Map(files.map((f) => [f.name, f.body]));
356
- // 退役条目:磁盘保留、注入省略(D3)。先去掉,后面的截断只面对活条目。
356
+ // 退役条目:磁盘保留、注入省略。先去掉,后面的截断只面对活条目。
357
357
  const omitted = stripRetiredEntries(original.get('MEMORY.md') ?? '');
358
358
  if (omitted.count > 0)
359
359
  original.set('MEMORY.md', omitted.body);
@@ -447,12 +447,12 @@ function computePayload(cfg) {
447
447
  const keptWords = total();
448
448
  // 退役条目不算截断:它按约定退役,不是被预算挤掉的
449
449
  const omittedNote = omitted.count > 0 ? `已省略 ${omitted.count} 条退役条目(见 MEMORY.md)` : '';
450
- // 这条提示本身也要吃饭(D3.2):不把它算进 words,报出来的用量就会少一截
450
+ // 这条提示本身也要吃饭:不把它算进 words,报出来的用量就会少一截
451
451
  let finalWords = keptWords + countWords(toc) + countWords(omittedNote);
452
452
  const contentSum = files.reduce((sum, f) => sum + (contentWords.get(f.name) ?? 0), 0);
453
453
  // 报「正文被截掉多少」,不是净减少:目录也会占词,混在一起会让人以为没丢多少
454
454
  const truncatedWords = Math.max(0, contentSum - keptWords);
455
- // 退役条目的词数:磁盘保留、注入省略(D3)—— 与截断分开报,「原 X」从此只反映截断
455
+ // 退役条目的词数:磁盘保留、注入省略 —— 与截断分开报,「原 X」从此只反映截断
456
456
  const retiredWords = Math.max(0, (diskWords.get('MEMORY.md') ?? 0) - (contentWords.get('MEMORY.md') ?? 0));
457
457
  let memoryInner = '';
458
458
  if (bodies.length > 0) {
@@ -466,7 +466,7 @@ function computePayload(cfg) {
466
466
  }
467
467
  if (omittedNote)
468
468
  notes.push(omittedNote);
469
- // 一条日期都没有只能按位置丢:说出来,别让人以为是按日期挑的(D2.5)
469
+ // 一条日期都没有只能按位置丢:说出来,别让人以为是按日期挑的
470
470
  // 数字取内存里那份格式债,不在这里另数一遍(退役条目算不算会两边不一致)
471
471
  if (fellBack && truncatedWords > 0) {
472
472
  if (debt.undated > 0)
@@ -548,7 +548,7 @@ function computePayload(cfg) {
548
548
  if (memoryInner || personaText) {
549
549
  text = frameText((personaText ? personaText + '\n\n' : '') + memoryInner);
550
550
  }
551
- // 模型真正收到的总量与开销:口径与 memoryUsage / D9 的载荷预览同源
551
+ // 模型真正收到的总量与开销:口径与 memoryUsage 的载荷预览同源
552
552
  const totalWords = countWords(text);
553
553
  return {
554
554
  text,
@@ -585,7 +585,7 @@ function computePayload(cfg) {
585
585
  };
586
586
  }
587
587
  /**
588
- * 记忆用量(D4)。只是 `buildMemoryPayload` 的投影 —— 不重读、不重算,
588
+ * 记忆用量。只是 `buildMemoryPayload` 的投影 —— 不重读、不重算,
589
589
  * 否则就是第三个计数口径,doctor / 设置页 / dream 三处迟早对不上。
590
590
  */
591
591
  export function memoryUsage(cfg) {
@@ -606,7 +606,7 @@ export function memoryUsage(cfg) {
606
606
  /**
607
607
  * 「改 MEMORY 之前」的容量快照:复用 `buildMemoryPayload` / `memoryUsage` 的投影,不新增计数口径;
608
608
  * 条目解析复用 `splitMemoryEntries` / `entryDate` / `isRetiredEntry`,与截断、`zk_lint` 同一份。
609
- * 纯读:不跑 zk、不写文件。同日 tie 只做可见化(G4),不改变 `oldestIndex` 的淘汰行为。
609
+ * 纯读:不跑 zk、不写文件。同日 tie 只做可见化,不改变 `oldestIndex` 的淘汰行为。
610
610
  */
611
611
  export function memoryCapacity(cfg, opts = {}) {
612
612
  // 15.2:默认关 / 没有召回记录时不改变任何口径(suggestion 文本也保持「按位置决胜」)
@@ -677,7 +677,7 @@ export function memoryCapacity(cfg, opts = {}) {
677
677
  ? `再加 ${extraWords} 词会触发截断(余 ${usage.headroom} 词),先退役 / 精简 dropCandidates 里的条目`
678
678
  : `还能放 ${usage.headroom - extraWords} 词`)
679
679
  : (usage.headroom < 0 ? `已超预算 ${-usage.headroom} 词` : `余 ${usage.headroom} 词`)];
680
- // G4:同日不是「按日期挑的」;15.2 有召回信号时明说改用了最后召回时间,不假装有使用频率
680
+ // 同日不是「按日期挑的」;15.2 有召回信号时明说改用了最后召回时间,不假装有使用频率
681
681
  if (sameDateCount > 1)
682
682
  parts.push(`${sameDateCount} 条同日,${recallTie ? '按最后召回时间决胜(无信号回退位置)' : '按位置决胜'}`);
683
683
  if (format.length)
package/dist/lib/meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 笔记本根目录的 meta 文件:唯一定义处(计划 §7「工具层只放一个常量」)。
2
+ * 笔记本根目录的 meta 文件:唯一定义处。
3
3
  *
4
4
  * 三份被注入记忆段(MEMORY_META_FILES,按注入顺序),角色人格(PERSONA_META_FILES)单独注入、
5
5
  * 永远在记忆段之前;七份一律不进检索与统计(META_NAMES)。
@@ -15,12 +15,12 @@ import { assertNotArchiveCreate, indexPolicy, ZkError, zk } from './zk.js';
15
15
  import { AGENTS_TEMPLATE, AGENTS_TEMPLATE_FLAT, WORKFLOW_TEMPLATE } from './agents-template.js';
16
16
  import { PERSONA_TEMPLATE } from './persona-template.js';
17
17
  import { effectivePaths, isPluginOwned, normGroupPath, parseGroupBlocks, sameGroupPath, samePaths } from './notebook-config.js';
18
- export { AGENTS_TEMPLATE, AGENTS_TEMPLATE_FLAT, WORKFLOW_TEMPLATE } from './agents-template.js';
18
+ export { AGENTS_TEMPLATE, AGENTS_TEMPLATE_FLAT, WORKFLOW_TEMPLATE, WORKFLOW_VERSION } from './agents-template.js';
19
19
  export const DAILY_TEMPLATE = `# {{format-date now "%Y-%m-%d"}}
20
20
 
21
21
  {{content}}
22
22
  `;
23
- /** layered 的日记模板:多三节,`{{content}}` 必须在,否则 stdin 的正文被丢(Z9) */
23
+ /** layered 的日记模板:多三节,`{{content}}` 必须在,否则 stdin 的正文被丢 */
24
24
  export const DAILY_TEMPLATE_LAYERED = `# {{format-date now "%Y-%m-%d"}}
25
25
 
26
26
  ## Events
@@ -368,7 +368,7 @@ export async function ensureNotebook(cfg, signal, opts = {}) {
368
368
  let initialized = false;
369
369
  if (!fs.existsSync(configFile)) {
370
370
  // init 会把目录里已有的笔记一起索引进空库 —— 10k / 1 链实测 202 s,
371
- // 原来的 120 s 会把进程杀在写事务里,留下半库。这里直接给建库预算(M5.0a)。
371
+ // 原来的 120 s 会把进程杀在写事务里,留下半库。这里直接给建库预算。
372
372
  await zk(cfg, ['init', cfg.notebook], { signal, timeoutMs: indexPolicy.buildTimeoutMs });
373
373
  initialized = true;
374
374
  }
@@ -380,10 +380,10 @@ export async function ensureNotebook(cfg, signal, opts = {}) {
380
380
  })
381
381
  : ensureTemplates(cfg, { 'daily.md': DAILY_TEMPLATE });
382
382
  // AGENTS.md 是工作约定(写之前查重 / MEMORY 条目格式与截断方向)。
383
- // layered 自动写;flat 只有显式 withAgents 才写 —— 0.1.0 的 vault 升级过来必须一个文件都不多(M0)。
384
- // 不写的话,默认安装既没有约定、也没有周节奏提醒(P1-6),所以要有一个 opt-in 入口。
383
+ // layered 自动写;flat 只有显式 withAgents 才写 —— 0.1.0 的 vault 升级过来必须一个文件都不多。
384
+ // 不写的话,默认安装既没有约定、也没有周节奏提醒,所以要有一个 opt-in 入口。
385
385
  const agentsWritten = layered || opts.withAgents === true ? writeAgentsTemplate(cfg) : false;
386
- // 人格层(角色)只走显式 opt-in:两种结构都不自动多一个文件(D10)。
386
+ // 人格层(角色)只走显式 opt-in:两种结构都不自动多一个文件。
387
387
  const personaWritten = opts.withPersona === true
388
388
  ? writePersonaTemplate(cfg)
389
389
  : { personaWritten: false };
@@ -5,7 +5,7 @@
5
5
  * 给 MEMORY 的晋升(topCited)、退役保护(retireCandidates)、同日淘汰、周审审计流
6
6
  * 提供「其实被用过」的证据;否则没被召回过的笔记永远拿不到这类信号。
7
7
  *
8
- * 硬边界(§7.4 / §9.4 / §15.12):
8
+ * 硬边界:
9
9
  * · 不记查询词、不记正文、不上报;`title` 只是命中笔记的标题,用来关联 MEMORY 的标题式 `[[来源]]`;
10
10
  * · 默认关(`cfg.recallSignal`),关掉时不读不写,输出与改动前逐字节一致;
11
11
  * · 原子写(tmp + rename)+ 失败静默,计数不能把工具调用弄失败;
@@ -101,3 +101,47 @@ export function similarCandidates(notes, title, dir, max = 3) {
101
101
  out.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
102
102
  return out.slice(0, max);
103
103
  }
104
+ /** 标签的比较形态:NFKC → 小写 → 去首尾空白。不抹标点:`C++` 与 `C#` 是两件事 */
105
+ function tagKey(tag) {
106
+ return String(tag ?? '').normalize('NFKC').toLowerCase().trim();
107
+ }
108
+ /**
109
+ * 与 `tag` 近义的已有标签,最多 `max` 条:大小写变体优先,其次按使用篇数降序。
110
+ * `inventory` 由调用方给(写路径用建笔记前的全库快照,lint 用频次表),这里不读盘。
111
+ */
112
+ export function similarTags(tag, inventory, max = 3) {
113
+ const key = tagKey(tag);
114
+ if (!key)
115
+ return [];
116
+ const grams = bigrams(key);
117
+ const out = [];
118
+ for (const item of inventory) {
119
+ if (item.tag === tag)
120
+ continue;
121
+ const other = tagKey(item.tag);
122
+ if (!other)
123
+ continue;
124
+ let kind = null;
125
+ if (other === key)
126
+ kind = 'case';
127
+ else {
128
+ // 长度按码点算(不混用 UTF-16 length),与 similarKeyOf 同一口径
129
+ const keySize = [...key].length;
130
+ const otherSize = [...other].length;
131
+ const [short, long, shortSize] = keySize <= otherSize ? [key, other, keySize] : [other, key, otherSize];
132
+ if (shortSize >= 2 && long.includes(short))
133
+ kind = 'similar';
134
+ else if (keySize >= 2 && otherSize >= 2) {
135
+ const otherGrams = bigrams(other);
136
+ if (jaccard(grams, otherGrams) >= SIMILAR_RATIO)
137
+ kind = 'similar';
138
+ }
139
+ }
140
+ if (kind)
141
+ out.push({ tag: item.tag, count: item.count, kind });
142
+ }
143
+ out.sort((a, b) => (a.kind === b.kind ? 0 : a.kind === 'case' ? -1 : 1) ||
144
+ b.count - a.count ||
145
+ a.tag.localeCompare(b.tag));
146
+ return out.slice(0, max);
147
+ }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * `zk-kit tidy`:收掉旧笔记正文里与 frontmatter `tags` 重复的标签段。
3
+ *
4
+ * 为什么要有这一步:写路径从 v3.x 起只写 frontmatter(`placeTags`),新笔记不再产生第二份;
5
+ * 但**已存在的笔记**没有修复入口 —— 只清一本库治不了别的库。lint 负责让债可见,
6
+ * 这里负责把它收掉,两边共用 `body-tags.ts` 的同一份判据。
7
+ *
8
+ * 三条边界,都是为了「不改结论、不丢标签」:
9
+ * · 只删**整段只有 hashtag** 的段落;句子里的 `#tag` 不是目标;
10
+ * · 只删 frontmatter 已覆盖的(子集判据)—— 正文有、frontmatter 没有的标签是漂移,
11
+ * 删了会丢标签、并集会复活旧词,交人裁;
12
+ * · 没有 `tags` 格(flat / 自定义模板)的笔记一个字不碰:正文标签是 zk 唯一的索引来源。
13
+ * 默认预演,`--fix` 才落盘;跳过 raw / archive / journal 与根目录 meta。
14
+ */
15
+ import fs from 'node:fs';
16
+ import path from 'node:path';
17
+ import { markIndexDirty, scanNotes } from './zk.js';
18
+ import { isMetaPath } from './meta.js';
19
+ import { parseFrontmatter } from './frontmatter.js';
20
+ import { stripTagParagraphs, tagCleanup } from './body-tags.js';
21
+ import { isUnderDir } from './zk.js';
22
+ /** 与巡检同一个读盘上限:命令不该把一个大文件拉进内存 */
23
+ const TIDY_MAX_BYTES = 1024 * 1024;
24
+ /**
25
+ * 扫全库并按判据收标签段。幂等:清过的笔记下一次不再出现。
26
+ *
27
+ * 扫的是 zk 索引里的活笔记(`scanNotes` 已排除 raw / archive / meta),再按 dailyDir 跳过日记:
28
+ * 日记模板没有 `tags` 格,正文 hashtag 在日记里是自由写法,不是要收的债。
29
+ */
30
+ export async function tidyTags(cfg, opts = {}, signal) {
31
+ const dryRun = opts.dryRun !== false;
32
+ const scan = await scanNotes(cfg, {}, signal);
33
+ const notes = scan.notes;
34
+ const items = [];
35
+ const drift = [];
36
+ let scanned = 0;
37
+ let skipped = 0;
38
+ let paragraphs = 0;
39
+ let changed = 0;
40
+ for (const note of notes) {
41
+ if (isMetaPath(note.path) || isUnderDir(note.path, cfg.dailyDir))
42
+ continue;
43
+ const abs = note.absPath ? path.resolve(note.absPath) : path.resolve(cfg.notebook, note.path);
44
+ let content = '';
45
+ try {
46
+ if (fs.statSync(abs).size > TIDY_MAX_BYTES) {
47
+ skipped += 1;
48
+ continue;
49
+ }
50
+ content = fs.readFileSync(abs, 'utf8');
51
+ }
52
+ catch {
53
+ skipped += 1;
54
+ continue;
55
+ }
56
+ scanned += 1;
57
+ const cleanup = tagCleanup(content);
58
+ if (!cleanup)
59
+ continue;
60
+ if (!cleanup.removable) {
61
+ // 漂移只报:删段会丢标签,并集会把旧词复活 —— 两个动作都需要人裁
62
+ drift.push({ path: note.path, title: note.title, tags: cleanup.drift });
63
+ continue;
64
+ }
65
+ items.push({
66
+ path: note.path,
67
+ title: note.title,
68
+ paragraphs: cleanup.paragraphs.length,
69
+ tags: cleanup.tags,
70
+ });
71
+ paragraphs += cleanup.paragraphs.length;
72
+ if (dryRun)
73
+ continue;
74
+ const next = stripTagParagraphs(content, cleanup.paragraphs);
75
+ // 兜底:删完标签段必须还在 frontmatter 里;形状一变就放弃这一篇,别写坏文件
76
+ if (next === content || !('tags' in parseFrontmatter(next).fields))
77
+ continue;
78
+ try {
79
+ fs.writeFileSync(abs, next, 'utf8');
80
+ markIndexDirty(cfg);
81
+ changed += 1;
82
+ }
83
+ catch {
84
+ // 单篇写失败不该让整次清理看起来失败:计划里已经列出它,下一轮还会进来
85
+ skipped += 1;
86
+ }
87
+ }
88
+ return {
89
+ dryRun,
90
+ scanned,
91
+ truncated: scan.completeness !== 'complete',
92
+ skipped,
93
+ notes: items.length,
94
+ paragraphs,
95
+ changed,
96
+ items,
97
+ drift,
98
+ };
99
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 日记时间轴校验(v3.1 M0):只报告,不改文件(计划 §2 D1 / D2 / D5)。
2
+ * 日记时间轴校验:只报告,不改文件。
3
3
  *
4
4
  * 为什么单独一层:日记的 `## HH:MM` / `### HH:MM` 是人的工作面,空块、倒序、层级混用
5
5
  * 都不会让 zk 报错,也不会影响检索 —— 只会让时间轴慢慢读不出顺序。自动重排会改正文顺序,
package/dist/lib/usage.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 本地聚合计数(**不是** usage 日志):只数「哪个工具被调了几次」,不记查询词、不记路径、不上报。
3
3
  *
4
- * 为什么需要(plan §14.4):到 3.9.0 为止,入口 / 一跳的验收全是机械口径
4
+ * 为什么需要:到 3.9.0 为止,入口 / 一跳的验收全是机械口径
5
5
  * (子进程数、传输字节、schema、与 `graph` 对账),没有一条问「这条路有没有被真的用上」。
6
6
  * 于是「补入口 + 遍历」只能靠论证说它对。这里给出唯一可观测的代理:
7
7
  * `zk_stats` 里的 `usage`,发布后过一段时间看 `walk` / `entryPoints` / `counterEntries` 有没有涨。
@@ -18,7 +18,7 @@ export function normalizeTitle(title) {
18
18
  return String(title ?? '').replace(/\s+/g, ' ').trim().toLowerCase();
19
19
  }
20
20
  /**
21
- * 「同一篇」的身份键(§9.2):有稳定 id 就只看 id,老笔记 / 日记退回 path。
21
+ * 「同一篇」的身份键:有稳定 id 就只看 id,老笔记 / 日记退回 path。
22
22
  * 改名 / 移动 / 重建索引不会改 frontmatter 里的 id,所以这个键不随检索地址漂移。
23
23
  */
24
24
  export function noteKey(note) {
@@ -60,7 +60,7 @@ export function resolveWikiTarget(cfg, target, index) {
60
60
  const rel = String(target ?? '').replace(/\\/g, '/').replace(/^\.\//, '').trim();
61
61
  if (!rel)
62
62
  return { status: 'missing', path: '', explicit: false };
63
- // 稳定 ID 优先(§9.2):`[[<id>]]` 直接落到那篇笔记的当前路径,改名之后也不断链。
63
+ // 稳定 ID 优先:`[[<id>]]` 直接落到那篇笔记的当前路径,改名之后也不断链。
64
64
  // 老库没有 id,byId 为空,下面的路径 / 标题解析顺序逐字不变。
65
65
  const byId = index.byId.get(rel);
66
66
  if (byId)