@befe/vault-system 0.1.12 → 0.1.13

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.
package/INSTALL.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  ```bash
17
17
  cd /path/to/your-wk
18
- bun add -d @befe/vault-system@0.1.12
18
+ bun add -d @befe/vault-system@0.1.13
19
19
  ```
20
20
 
21
21
  ## 登记(预置登记文件)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befe/vault-system",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "vault-system:本地化组织 Agent context——service + CLI(唯一写者、懒启动、动态端口)+ ctag/vault 约定",
5
5
  "type": "module",
6
6
  "files": [
package/src/core/ctag.ts CHANGED
@@ -55,9 +55,16 @@ export function parseAll(text: string): ParsedCtag[] {
55
55
  * - 裸键核心:260920_g0g8m
56
56
  * - 仅 5 位 hash:g0g8m(date 未知,按 hash 匹配)
57
57
  * 返回 { keyCore?, hash },keyCore 优先精确匹配,否则退化到 hash-only 匹配。
58
+ * 优先级:带 `_ctag` 尾巴的稳定键 > 任意「日期_5位」片段 > 纯 hash。
58
59
  */
59
60
  export function normalizeQuery(input: string): { keyCore?: string; hash?: string } {
60
61
  const trimmed = input.trim();
62
+ // 先认带 `_ctag` 尾巴的稳定键,且取最后一段:descr 里可能自带形如 260826_prize 的片段,
63
+ // 直接取第一个「日期_5位」会被 descr 抢先,拿一个不存在的 key 去查(见 log 261102 的 bug)。
64
+ let suffix: RegExpExecArray | null = null;
65
+ for (const m of trimmed.matchAll(/(\d{6})_([0-9a-z]{5})_ctag/g)) suffix = m;
66
+ if (suffix) return { keyCore: `${suffix[1]}_${suffix[2]}`, hash: suffix[2] };
67
+ // 没有任何 `_ctag` 尾巴时(裸核心键 / 省略了 ctag 的完整串)退回原来的宽松匹配
61
68
  const full = trimmed.match(/(\d{6})_([0-9a-z]{5})/);
62
69
  if (full) return { keyCore: `${full[1]}_${full[2]}`, hash: full[2] };
63
70
  const hashOnly = trimmed.match(/^([0-9a-z]{5})$/);