attention-manifest-protocol 0.6.2 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
6
6
  project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.3] - 2026-11-03
9
+
10
+ ### Fixed
11
+
12
+ - Compute each immutable workspace input's SHA-256 once per scan instead of rehashing the entire file for every AST source location. Revision bytes and source locators remain unchanged; large compiler inputs no longer incur quadratic hashing work.
13
+
8
14
  ## [0.6.2] - 2026-11-03
9
15
 
10
16
  ### Added
@@ -1,5 +1,9 @@
1
1
  # 更新日志
2
2
 
3
+ ## [0.6.3] - 2026-11-03
4
+
5
+ - 工作区扫描对每个不可变输入只计算一次 SHA-256,避免为每个 AST 节点重新哈希整个文件。保持 revision 与定位摘要不变,消除大文件扫描中的平方级重复计算。
6
+
3
7
  ## [0.6.2] - 2026-11-03
4
8
 
5
9
  - 将既有工作区、Office 文档与 TeX 离线扫描器发布为 `attention-manifest-protocol/scan`;输入仍为显式文件内容,不扫描宿主目录、不执行项目代码。
@@ -27,13 +27,16 @@ export const scanWorkspace = (inputs, store) => {
27
27
  files.set(path, file.content);
28
28
  });
29
29
  const paths = [...files.keys()].sort();
30
- const revision = hash(JSON.stringify(paths.map((path) => [path, hash(files.get(path))])));
30
+ // Inputs are immutable during a scan. A source location is emitted for
31
+ // every AST node; hashing its entire file again makes large inputs quadratic.
32
+ const fingerprints = new Map(paths.map((path) => [path, hash(files.get(path))]));
33
+ const revision = hash(JSON.stringify(paths.map((path) => [path, fingerprints.get(path)])));
31
34
  const entities = new Map();
32
35
  const relations = [];
33
36
  const diagnostics = [];
34
37
  const source = (path, startLine, endLine) => ({
35
38
  uri: path,
36
- revision: hash(files.get(path) ?? ""),
39
+ revision: fingerprints.get(path) ?? hash(""),
37
40
  ...(startLine === (void 0) ? {} : { startLine }),
38
41
  ...(endLine === (void 0) ? {} : { endLine }),
39
42
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attention-manifest-protocol",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "files": [
5
5
  "lib",
6
6
  "docs/schemas",