@agentunion/fastaun 0.3.4 → 0.3.6

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
@@ -1,106 +1,126 @@
1
- # Changelog
2
-
3
- 本文件记录 `@agentunion/fastaun` (Node.js) SDK 的版本变更。最新版本在最前面。
4
-
5
- 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
6
-
7
- ---
8
-
9
- ## 0.3.4 — 2026-05-28
10
-
11
- ### Breaking Changes
12
- - **`createAid()` 兼容别名移除**:仅保留 `registerAid()`,旧 `createAid` 已删除
13
- - **注册与认证分离**:`authenticate()` 不再隐式注册;身份不完整时抛 `StateError`
14
-
15
- ### Added
16
- - **`IdentityConflictError`**:新增错误类型(继承 `AuthError`),AID 注册冲突时抛出
17
-
18
- ### Changed
19
- - **`registerAid` 半成品恢复**:本地有 keypair cert 时,查服务端恢复;服务端无记录则用现有 keypair 注册(不再直接拒绝)
20
- - **agent.md 下载**:改为无条件 GET(移除条件头);304 时本地有缓存直接用,无缓存重试
21
- - **错误消息**:所有 `createAid` 引用更新为 `registerAid`
22
- - **`.seed` fallback 迁移**:`FileSecretStore` 启动时检测旧 `.seed` 文件,自动迁移到 `seed_password` 派生方式
23
- - **`ChangeSeed` API**:`FileKeyStore.ChangeSeed()` / `FileKeyStore.changeSeed()` 支持运行时更换 seed
24
-
25
- ### Removed
26
- - **`namespaces/auth.ts` 中 `createAid` 兼容别名**
27
-
28
- ---
29
-
30
- ## 0.3.3 2026-05-25
31
-
32
- ### Added
33
- - **V2 Thought 加解密**:`group.thought.get` / `message.thought.get` 返回值自动解密;发送端自动加密;`attachV2EnvelopeMetadata` 附加 E2EE 元数据
34
- - **V2 Sender IK 延迟解密**:`_v2SenderIKPending` / `_v2SenderIKFetching` 机制,对端 IK 未缓存时挂起消息、异步拉取后重试解密
35
- - **agent.md 本地缓存体系**:`setAgentMdPath` / `publishAgentMd()` / `fetchAgentMd(aid?)`;基于文件系统的 list.json 索引 + 按 AID 存储 + etag 比对 + 自动拉取缺失
36
- - **KeyStore agent_md_cache 持久化**:文件系统 + SQLite 双后端支持
37
- - **V2 辅助函数**:`getV2DeviceId` / `_v2B64ToBytesStrict` / `_v2BytesEqual` / `_v2ConcatBytes` / `_v2LengthPrefixedTextKey` / `_v2LengthPrefixedBytes`
38
- - **V2 envelope 元数据**:`attachV2EnvelopeMetadata` / `attachV2EnvelopeMetadataFromSource` / `extractV2EnvelopeFromSource` / `metadataWithoutAuth`
39
- - **签名跳过策略**:对内部方法和系统事件跳过签名验证
40
-
41
- ### Changed
42
- - **V2 消息处理路径重构**:统一 P2P/Group 解密入口,支持 sender IK pending 延迟模式
43
- - **V2 SPK rotation**:thought 解密失败时触发 group SPK rotation / registration after peer fallback
44
- - **消息调试日志增强**:thought.get 全链路 debug 日志
45
-
46
- ### Fixed
47
- - **service-plane envelope 解包**:修复 Kernel trace 字段传递丢失
48
- - **trace 树状展示**:enter/exit 配对 + 嵌套缩进
49
-
50
- ---
51
-
52
- ## 0.3.1 — 2026-05-22
53
-
54
- ### Added
55
- - **`auth.checkAid` handler**:本地证书自检(解析有效期、公钥)+ 远端注册状态查询;新增 `parseCertValidity` / `parseAsn1Time` ASN.1 时间解析
56
- - **RPC trace 增强**:`RPCTransport` 增加 `setTraceMode()` / `setTraceObserver()`;`sortTraceSpansForDisplay` / `formatTraceTree` / `traceDisplay` 树状展示按 ts 排序 + 嵌套缩进;`TraceObserver` 类型导出
57
- - **V2 群组 SPK 生命周期**:`V2KeyStore.saveGroupSPK` / `loadGroupSPK` / `loadCurrentGroupSPK`;`V2Session.ensureGroupRegistered` / `rotateGroupSPK` / `_publishGroupSPK`;`DESTROY_DELAY_MS = 7d`
58
- - **V2 P2P push 解密**:`AUNClient._onV2PushNotification` / `_decryptV2PushMessage` 实现带 payload 的就地解密 + 失败回退到 pull
59
-
60
- ### Changed
61
- - **`SeqTracker.forceContiguousSeq`**:原 `contiguousSeq = minSeq` 跳过空洞(会丢消息),改为 `contiguousSeq = minSeq - 1` 由连续前缀自然推进,避免误丢
62
-
63
- ### Fixed
64
- - **`client.ts:4026` 类型错误**:`_publishOrderedMessage` `decrypted` 实参补 `as EventPayload` 断言(`Record<string, unknown>` 与 `JsonValue | Error` 不兼容)
65
- - short RPC 请求增加 `debug` 完整报文日志,便于跨语言诊断
66
-
67
- ---
68
-
69
- ## 0.3.0 — 2026-05-21 ⚠️ BREAKING CHANGE
70
-
71
- > **V2-only 版本**:移除全部 V1 E2EE(含群组加密),新增 V2 加密原语,API 不向后兼容。
72
-
73
- ### BREAKING
74
- - **移除 V1 E2EE 全部实现**:`GroupE2EEManager`、V1 epoch key 逻辑全部删除
75
- - **移除 V1 群组加密测试**:`e2ee.test.ts`、`e2ee-group.test.ts`、`epoch-key-server.spec.ts`
76
- - **E2EE 接口简化**:`e2ee.ts` 仅保留 V2 路径,V1 加解密方法不再可用
77
- - **配置变更**:`AUNConfig` 移除 V1 相关配置项
78
- - **KeyStore 重构**:`keystore/` 目录结构调整,`aid-db.ts` / `file.ts` 接口变更
79
-
80
- ### Added
81
- - **agent.md API**:`AUNClient.publishAgentMd(path)` / `AUNClient.fetchAgentMd(aid?, savePath?)`
82
- - **V2 加密原语**(跨语言 golden vector 一致性):ECDH P-256、HKDF-SHA256、AES-256-GCM、ECDSA-SHA256 RAW (RFC 6979)、1DH/3DH wrap_key、Recipients Sort + Merkle Digest、State Commitment
83
-
84
- ### Removed
85
- - `AUNClient.setLocalAgentMdPath()` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()` — 由主 API 自动维护
86
-
87
- ### Deprecated
88
- - `client.auth.signAgentMd` / `verifyAgentMd` / `uploadAgentMd` / `downloadAgentMd` — 建议迁移到 `client.publishAgentMd` / `client.fetchAgentMd`
89
-
90
- ---
91
-
92
- ## 0.2.20 — 2026-05-18
93
-
94
- ### Added
95
- - **agent.md 版本一致性 API**:`AUNClient.setLocalAgentMdPath(path)` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()`。Node 用 `fs.readFileSync` + `crypto.createHash` 计算 etag,浏览器场景返回空串并 warn。SDK 自动从 RPC envelope `_meta.agent_md_etag` 提取服务端 etag,应用层订阅 `message.received` / `group.message_created` 等事件时 payload 多 `_agent_md.{local_etag, remote_etag}` 字段供版本比对。
96
- - **`downloadAgentMd` 条件请求缓存**:内部维护 ETag/Last-Modified,未变化时返回上次缓存内容;外部 API 形态不变。
97
- - **transport meta observer**:`RPCTransport.setMetaObserver(fn)` 透传 envelope `_meta`,observer 抛错被吞,不影响 RPC result。
98
-
99
- ### Changed
100
- - **RPC call 默认超时 10s → 35s**:与服务端 30s handler timeout 对齐,留 5s buffer。
101
- - **multi-device 架构**:对端无 prekey `_sendEncrypted` 直接抛错(`no registered device prekeys for ...`),不再降级到 `long_term_key`。
102
-
103
- ### Docs
104
- - 仓库根 `docs/`(agent.md 规范、protocol、SDK 手册)随 npm tarball 打包到 `_packed_docs/`,安装后可读。`.gitignore` 排除项(如内部测试指南)不进包。
105
-
106
- ---
1
+ # Changelog
2
+
3
+ 本文件记录 `@agentunion/fastaun` (Node.js) SDK 的版本变更。最新版本在最前面。
4
+
5
+ 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
6
+
7
+ ---
8
+
9
+ ## 0.3.6 — 2026-05-28
10
+
11
+ ### Added
12
+ - **Encrypted push 解密管线**:收到加密推送时即时尝试 V2 解密,成功则发 `message.received` / `group.message_created`(含明文 payload + e2ee 元数据),失败则发 `message.undecryptable` / `group.message_undecryptable`(含诊断字段 `_decrypt_error` / `_decrypt_stage` / `_envelope_type`)
13
+ - **`auth.fetchPeerCert(gatewayUrl, aid)`**:公开 API 实现落地(v0.3.5 声明,v0.3.6 实现独立方法体)
14
+ - **`storage.get_limits` RPC**:查询上传限制和配额使用情况
15
+ - **`storage.check_upload` RPC**:上传预检(秒传检测 + 超限检测)
16
+
17
+ ### Fixed
18
+ - **Identity cache 自愈**:V2 session init 时检测 `private_key_pem` 缺失,自动从 keystore 重新加载并清理脏 instance_state
19
+ - **`loadIdentity` 字段白名单**:只合并 `_INSTANCE_STATE_FIELDS` 定义的字段,防止 instance_state 表中的脏数据覆盖核心字段
20
+ - **`.seed.migrated` 兼容**:`FileSecretStore` 解密失败时自动尝试 `.seed.migrated.*` 文件作为 fallback(半迁移状态兼容)
21
+
22
+ ### Changed
23
+ - **Auth namespace gateway_url 持久化**:`registerAid` / `authenticate` 成功后自动持久化 gateway_url 到 instance_state
24
+
25
+ ---
26
+
27
+ ## 0.3.5 — 2026-05-28
28
+
29
+ ### Breaking Changes
30
+ - **`createAid()` 兼容别名移除**:仅保留 `registerAid()`,旧 `createAid` 已删除
31
+ - **注册与认证分离**:`authenticate()` 不再隐式注册;身份不完整时抛 `StateError`
32
+
33
+ ### Added
34
+ - **`IdentityConflictError`**:新增错误类型(继承 `AuthError`),AID 注册冲突时抛出
35
+ - **`auth.loadIdentityOrNull()`**:公开 API,只读加载本地已注册身份,不存在时返回 null(`auth.loadIdentity()` 已有)
36
+ - **`auth.fetchPeerCert()`**:公开 API,获取对端 AID 证书 PEM(本地缓存优先,未命中走 PKI HTTP + 链验证)(已有)
37
+
38
+ ### Changed
39
+ - **`registerAid` 半成品恢复**:本地有 keypair 无 cert 时,查服务端恢复;服务端无记录则用现有 keypair 注册(不再直接拒绝)
40
+ - **agent.md 下载**:改为无条件 GET(移除条件头);304 时本地有缓存直接用,无缓存重试
41
+ - **错误消息**:所有 `createAid` 引用更新为 `registerAid`
42
+ - **`.seed` fallback 迁移**:`FileSecretStore` 启动时检测旧 `.seed` 文件,自动迁移到 `seed_password` 派生方式
43
+ - **`ChangeSeed` API**:`FileKeyStore.ChangeSeed()` / `FileKeyStore.changeSeed()` 支持运行时更换 seed
44
+
45
+ ### Removed
46
+ - **`namespaces/auth.ts` 中 `createAid` 兼容别名**
47
+
48
+ ---
49
+
50
+ ## 0.3.3 — 2026-05-25
51
+
52
+ ### Added
53
+ - **V2 Thought 加解密**:`group.thought.get` / `message.thought.get` 返回值自动解密;发送端自动加密;`attachV2EnvelopeMetadata` 附加 E2EE 元数据
54
+ - **V2 Sender IK 延迟解密**:`_v2SenderIKPending` / `_v2SenderIKFetching` 机制,对端 IK 未缓存时挂起消息、异步拉取后重试解密
55
+ - **agent.md 本地缓存体系**:`setAgentMdPath` / `publishAgentMd()` / `fetchAgentMd(aid?)`;基于文件系统的 list.json 索引 + 按 AID 存储 + etag 比对 + 自动拉取缺失
56
+ - **KeyStore agent_md_cache 持久化**:文件系统 + SQLite 双后端支持
57
+ - **V2 辅助函数**:`getV2DeviceId` / `_v2B64ToBytesStrict` / `_v2BytesEqual` / `_v2ConcatBytes` / `_v2LengthPrefixedTextKey` / `_v2LengthPrefixedBytes`
58
+ - **V2 envelope 元数据**:`attachV2EnvelopeMetadata` / `attachV2EnvelopeMetadataFromSource` / `extractV2EnvelopeFromSource` / `metadataWithoutAuth`
59
+ - **签名跳过策略**:对内部方法和系统事件跳过签名验证
60
+
61
+ ### Changed
62
+ - **V2 消息处理路径重构**:统一 P2P/Group 解密入口,支持 sender IK pending 延迟模式
63
+ - **V2 SPK rotation**:thought 解密失败时触发 group SPK rotation / registration after peer fallback
64
+ - **消息调试日志增强**:thought.get 全链路 debug 日志
65
+
66
+ ### Fixed
67
+ - **service-plane envelope 解包**:修复 Kernel trace 字段传递丢失
68
+ - **trace 树状展示**:enter/exit 配对 + 嵌套缩进
69
+
70
+ ---
71
+
72
+ ## 0.3.1 — 2026-05-22
73
+
74
+ ### Added
75
+ - **`auth.checkAid` handler**:本地证书自检(解析有效期、公钥)+ 远端注册状态查询;新增 `parseCertValidity` / `parseAsn1Time` ASN.1 时间解析
76
+ - **RPC trace 增强**:`RPCTransport` 增加 `setTraceMode()` / `setTraceObserver()`;`sortTraceSpansForDisplay` / `formatTraceTree` / `traceDisplay` 树状展示按 ts 排序 + 嵌套缩进;`TraceObserver` 类型导出
77
+ - **V2 群组 SPK 生命周期**:`V2KeyStore.saveGroupSPK` / `loadGroupSPK` / `loadCurrentGroupSPK`;`V2Session.ensureGroupRegistered` / `rotateGroupSPK` / `_publishGroupSPK`;`DESTROY_DELAY_MS = 7d`
78
+ - **V2 P2P push 解密**:`AUNClient._onV2PushNotification` / `_decryptV2PushMessage` 实现带 payload 的就地解密 + 失败回退到 pull
79
+
80
+ ### Changed
81
+ - **`SeqTracker.forceContiguousSeq`**:原 `contiguousSeq = minSeq` 跳过空洞(会丢消息),改为 `contiguousSeq = minSeq - 1` 由连续前缀自然推进,避免误丢
82
+
83
+ ### Fixed
84
+ - **`client.ts:4026` 类型错误**:`_publishOrderedMessage` 的 `decrypted` 实参补 `as EventPayload` 断言(`Record<string, unknown>` 与 `JsonValue | Error` 不兼容)
85
+ - short RPC 请求增加 `debug` 完整报文日志,便于跨语言诊断
86
+
87
+ ---
88
+
89
+ ## 0.3.0 — 2026-05-21 ⚠️ BREAKING CHANGE
90
+
91
+ > **V2-only 版本**:移除全部 V1 E2EE(含群组加密),新增 V2 加密原语,API 不向后兼容。
92
+
93
+ ### BREAKING
94
+ - **移除 V1 E2EE 全部实现**:`GroupE2EEManager`、V1 epoch key 逻辑全部删除
95
+ - **移除 V1 群组加密测试**:`e2ee.test.ts`、`e2ee-group.test.ts`、`epoch-key-server.spec.ts`
96
+ - **E2EE 接口简化**:`e2ee.ts` 仅保留 V2 路径,V1 加解密方法不再可用
97
+ - **配置变更**:`AUNConfig` 移除 V1 相关配置项
98
+ - **KeyStore 重构**:`keystore/` 目录结构调整,`aid-db.ts` / `file.ts` 接口变更
99
+
100
+ ### Added
101
+ - **agent.md API**:`AUNClient.publishAgentMd(path)` / `AUNClient.fetchAgentMd(aid?, savePath?)`
102
+ - **V2 加密原语**(跨语言 golden vector 一致性):ECDH P-256、HKDF-SHA256、AES-256-GCM、ECDSA-SHA256 RAW (RFC 6979)、1DH/3DH wrap_key、Recipients Sort + Merkle Digest、State Commitment
103
+
104
+ ### Removed
105
+ - `AUNClient.setLocalAgentMdPath()` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()` — 由主 API 自动维护
106
+
107
+ ### Deprecated
108
+ - `client.auth.signAgentMd` / `verifyAgentMd` / `uploadAgentMd` / `downloadAgentMd` — 建议迁移到 `client.publishAgentMd` / `client.fetchAgentMd`
109
+
110
+ ---
111
+
112
+ ## 0.2.20 — 2026-05-18
113
+
114
+ ### Added
115
+ - **agent.md 版本一致性 API**:`AUNClient.setLocalAgentMdPath(path)` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()`。Node 用 `fs.readFileSync` + `crypto.createHash` 计算 etag,浏览器场景返回空串并 warn。SDK 自动从 RPC envelope `_meta.agent_md_etag` 提取服务端 etag,应用层订阅 `message.received` / `group.message_created` 等事件时 payload 多 `_agent_md.{local_etag, remote_etag}` 字段供版本比对。
116
+ - **`downloadAgentMd` 条件请求缓存**:内部维护 ETag/Last-Modified,未变化时返回上次缓存内容;外部 API 形态不变。
117
+ - **transport meta observer**:`RPCTransport.setMetaObserver(fn)` 透传 envelope `_meta`,observer 抛错被吞,不影响 RPC result。
118
+
119
+ ### Changed
120
+ - **RPC call 默认超时 10s → 35s**:与服务端 30s handler timeout 对齐,留 5s buffer。
121
+ - **multi-device 架构**:对端无 prekey 时 `_sendEncrypted` 直接抛错(`no registered device prekeys for ...`),不再降级到 `long_term_key`。
122
+
123
+ ### Docs
124
+ - 仓库根 `docs/`(agent.md 规范、protocol、SDK 手册)随 npm tarball 打包到 `_packed_docs/`,安装后可读。`.gitignore` 排除项(如内部测试指南)不进包。
125
+
126
+ ---
@@ -1,106 +1,126 @@
1
- # Changelog
2
-
3
- 本文件记录 `@agentunion/fastaun` (Node.js) SDK 的版本变更。最新版本在最前面。
4
-
5
- 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
6
-
7
- ---
8
-
9
- ## 0.3.4 — 2026-05-28
10
-
11
- ### Breaking Changes
12
- - **`createAid()` 兼容别名移除**:仅保留 `registerAid()`,旧 `createAid` 已删除
13
- - **注册与认证分离**:`authenticate()` 不再隐式注册;身份不完整时抛 `StateError`
14
-
15
- ### Added
16
- - **`IdentityConflictError`**:新增错误类型(继承 `AuthError`),AID 注册冲突时抛出
17
-
18
- ### Changed
19
- - **`registerAid` 半成品恢复**:本地有 keypair cert 时,查服务端恢复;服务端无记录则用现有 keypair 注册(不再直接拒绝)
20
- - **agent.md 下载**:改为无条件 GET(移除条件头);304 时本地有缓存直接用,无缓存重试
21
- - **错误消息**:所有 `createAid` 引用更新为 `registerAid`
22
- - **`.seed` fallback 迁移**:`FileSecretStore` 启动时检测旧 `.seed` 文件,自动迁移到 `seed_password` 派生方式
23
- - **`ChangeSeed` API**:`FileKeyStore.ChangeSeed()` / `FileKeyStore.changeSeed()` 支持运行时更换 seed
24
-
25
- ### Removed
26
- - **`namespaces/auth.ts` 中 `createAid` 兼容别名**
27
-
28
- ---
29
-
30
- ## 0.3.3 2026-05-25
31
-
32
- ### Added
33
- - **V2 Thought 加解密**:`group.thought.get` / `message.thought.get` 返回值自动解密;发送端自动加密;`attachV2EnvelopeMetadata` 附加 E2EE 元数据
34
- - **V2 Sender IK 延迟解密**:`_v2SenderIKPending` / `_v2SenderIKFetching` 机制,对端 IK 未缓存时挂起消息、异步拉取后重试解密
35
- - **agent.md 本地缓存体系**:`setAgentMdPath` / `publishAgentMd()` / `fetchAgentMd(aid?)`;基于文件系统的 list.json 索引 + 按 AID 存储 + etag 比对 + 自动拉取缺失
36
- - **KeyStore agent_md_cache 持久化**:文件系统 + SQLite 双后端支持
37
- - **V2 辅助函数**:`getV2DeviceId` / `_v2B64ToBytesStrict` / `_v2BytesEqual` / `_v2ConcatBytes` / `_v2LengthPrefixedTextKey` / `_v2LengthPrefixedBytes`
38
- - **V2 envelope 元数据**:`attachV2EnvelopeMetadata` / `attachV2EnvelopeMetadataFromSource` / `extractV2EnvelopeFromSource` / `metadataWithoutAuth`
39
- - **签名跳过策略**:对内部方法和系统事件跳过签名验证
40
-
41
- ### Changed
42
- - **V2 消息处理路径重构**:统一 P2P/Group 解密入口,支持 sender IK pending 延迟模式
43
- - **V2 SPK rotation**:thought 解密失败时触发 group SPK rotation / registration after peer fallback
44
- - **消息调试日志增强**:thought.get 全链路 debug 日志
45
-
46
- ### Fixed
47
- - **service-plane envelope 解包**:修复 Kernel trace 字段传递丢失
48
- - **trace 树状展示**:enter/exit 配对 + 嵌套缩进
49
-
50
- ---
51
-
52
- ## 0.3.1 — 2026-05-22
53
-
54
- ### Added
55
- - **`auth.checkAid` handler**:本地证书自检(解析有效期、公钥)+ 远端注册状态查询;新增 `parseCertValidity` / `parseAsn1Time` ASN.1 时间解析
56
- - **RPC trace 增强**:`RPCTransport` 增加 `setTraceMode()` / `setTraceObserver()`;`sortTraceSpansForDisplay` / `formatTraceTree` / `traceDisplay` 树状展示按 ts 排序 + 嵌套缩进;`TraceObserver` 类型导出
57
- - **V2 群组 SPK 生命周期**:`V2KeyStore.saveGroupSPK` / `loadGroupSPK` / `loadCurrentGroupSPK`;`V2Session.ensureGroupRegistered` / `rotateGroupSPK` / `_publishGroupSPK`;`DESTROY_DELAY_MS = 7d`
58
- - **V2 P2P push 解密**:`AUNClient._onV2PushNotification` / `_decryptV2PushMessage` 实现带 payload 的就地解密 + 失败回退到 pull
59
-
60
- ### Changed
61
- - **`SeqTracker.forceContiguousSeq`**:原 `contiguousSeq = minSeq` 跳过空洞(会丢消息),改为 `contiguousSeq = minSeq - 1` 由连续前缀自然推进,避免误丢
62
-
63
- ### Fixed
64
- - **`client.ts:4026` 类型错误**:`_publishOrderedMessage` `decrypted` 实参补 `as EventPayload` 断言(`Record<string, unknown>` 与 `JsonValue | Error` 不兼容)
65
- - short RPC 请求增加 `debug` 完整报文日志,便于跨语言诊断
66
-
67
- ---
68
-
69
- ## 0.3.0 — 2026-05-21 ⚠️ BREAKING CHANGE
70
-
71
- > **V2-only 版本**:移除全部 V1 E2EE(含群组加密),新增 V2 加密原语,API 不向后兼容。
72
-
73
- ### BREAKING
74
- - **移除 V1 E2EE 全部实现**:`GroupE2EEManager`、V1 epoch key 逻辑全部删除
75
- - **移除 V1 群组加密测试**:`e2ee.test.ts`、`e2ee-group.test.ts`、`epoch-key-server.spec.ts`
76
- - **E2EE 接口简化**:`e2ee.ts` 仅保留 V2 路径,V1 加解密方法不再可用
77
- - **配置变更**:`AUNConfig` 移除 V1 相关配置项
78
- - **KeyStore 重构**:`keystore/` 目录结构调整,`aid-db.ts` / `file.ts` 接口变更
79
-
80
- ### Added
81
- - **agent.md API**:`AUNClient.publishAgentMd(path)` / `AUNClient.fetchAgentMd(aid?, savePath?)`
82
- - **V2 加密原语**(跨语言 golden vector 一致性):ECDH P-256、HKDF-SHA256、AES-256-GCM、ECDSA-SHA256 RAW (RFC 6979)、1DH/3DH wrap_key、Recipients Sort + Merkle Digest、State Commitment
83
-
84
- ### Removed
85
- - `AUNClient.setLocalAgentMdPath()` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()` — 由主 API 自动维护
86
-
87
- ### Deprecated
88
- - `client.auth.signAgentMd` / `verifyAgentMd` / `uploadAgentMd` / `downloadAgentMd` — 建议迁移到 `client.publishAgentMd` / `client.fetchAgentMd`
89
-
90
- ---
91
-
92
- ## 0.2.20 — 2026-05-18
93
-
94
- ### Added
95
- - **agent.md 版本一致性 API**:`AUNClient.setLocalAgentMdPath(path)` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()`。Node 用 `fs.readFileSync` + `crypto.createHash` 计算 etag,浏览器场景返回空串并 warn。SDK 自动从 RPC envelope `_meta.agent_md_etag` 提取服务端 etag,应用层订阅 `message.received` / `group.message_created` 等事件时 payload 多 `_agent_md.{local_etag, remote_etag}` 字段供版本比对。
96
- - **`downloadAgentMd` 条件请求缓存**:内部维护 ETag/Last-Modified,未变化时返回上次缓存内容;外部 API 形态不变。
97
- - **transport meta observer**:`RPCTransport.setMetaObserver(fn)` 透传 envelope `_meta`,observer 抛错被吞,不影响 RPC result。
98
-
99
- ### Changed
100
- - **RPC call 默认超时 10s → 35s**:与服务端 30s handler timeout 对齐,留 5s buffer。
101
- - **multi-device 架构**:对端无 prekey `_sendEncrypted` 直接抛错(`no registered device prekeys for ...`),不再降级到 `long_term_key`。
102
-
103
- ### Docs
104
- - 仓库根 `docs/`(agent.md 规范、protocol、SDK 手册)随 npm tarball 打包到 `_packed_docs/`,安装后可读。`.gitignore` 排除项(如内部测试指南)不进包。
105
-
106
- ---
1
+ # Changelog
2
+
3
+ 本文件记录 `@agentunion/fastaun` (Node.js) SDK 的版本变更。最新版本在最前面。
4
+
5
+ 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
6
+
7
+ ---
8
+
9
+ ## 0.3.6 — 2026-05-28
10
+
11
+ ### Added
12
+ - **Encrypted push 解密管线**:收到加密推送时即时尝试 V2 解密,成功则发 `message.received` / `group.message_created`(含明文 payload + e2ee 元数据),失败则发 `message.undecryptable` / `group.message_undecryptable`(含诊断字段 `_decrypt_error` / `_decrypt_stage` / `_envelope_type`)
13
+ - **`auth.fetchPeerCert(gatewayUrl, aid)`**:公开 API 实现落地(v0.3.5 声明,v0.3.6 实现独立方法体)
14
+ - **`storage.get_limits` RPC**:查询上传限制和配额使用情况
15
+ - **`storage.check_upload` RPC**:上传预检(秒传检测 + 超限检测)
16
+
17
+ ### Fixed
18
+ - **Identity cache 自愈**:V2 session init 时检测 `private_key_pem` 缺失,自动从 keystore 重新加载并清理脏 instance_state
19
+ - **`loadIdentity` 字段白名单**:只合并 `_INSTANCE_STATE_FIELDS` 定义的字段,防止 instance_state 表中的脏数据覆盖核心字段
20
+ - **`.seed.migrated` 兼容**:`FileSecretStore` 解密失败时自动尝试 `.seed.migrated.*` 文件作为 fallback(半迁移状态兼容)
21
+
22
+ ### Changed
23
+ - **Auth namespace gateway_url 持久化**:`registerAid` / `authenticate` 成功后自动持久化 gateway_url 到 instance_state
24
+
25
+ ---
26
+
27
+ ## 0.3.5 — 2026-05-28
28
+
29
+ ### Breaking Changes
30
+ - **`createAid()` 兼容别名移除**:仅保留 `registerAid()`,旧 `createAid` 已删除
31
+ - **注册与认证分离**:`authenticate()` 不再隐式注册;身份不完整时抛 `StateError`
32
+
33
+ ### Added
34
+ - **`IdentityConflictError`**:新增错误类型(继承 `AuthError`),AID 注册冲突时抛出
35
+ - **`auth.loadIdentityOrNull()`**:公开 API,只读加载本地已注册身份,不存在时返回 null(`auth.loadIdentity()` 已有)
36
+ - **`auth.fetchPeerCert()`**:公开 API,获取对端 AID 证书 PEM(本地缓存优先,未命中走 PKI HTTP + 链验证)(已有)
37
+
38
+ ### Changed
39
+ - **`registerAid` 半成品恢复**:本地有 keypair 无 cert 时,查服务端恢复;服务端无记录则用现有 keypair 注册(不再直接拒绝)
40
+ - **agent.md 下载**:改为无条件 GET(移除条件头);304 时本地有缓存直接用,无缓存重试
41
+ - **错误消息**:所有 `createAid` 引用更新为 `registerAid`
42
+ - **`.seed` fallback 迁移**:`FileSecretStore` 启动时检测旧 `.seed` 文件,自动迁移到 `seed_password` 派生方式
43
+ - **`ChangeSeed` API**:`FileKeyStore.ChangeSeed()` / `FileKeyStore.changeSeed()` 支持运行时更换 seed
44
+
45
+ ### Removed
46
+ - **`namespaces/auth.ts` 中 `createAid` 兼容别名**
47
+
48
+ ---
49
+
50
+ ## 0.3.3 — 2026-05-25
51
+
52
+ ### Added
53
+ - **V2 Thought 加解密**:`group.thought.get` / `message.thought.get` 返回值自动解密;发送端自动加密;`attachV2EnvelopeMetadata` 附加 E2EE 元数据
54
+ - **V2 Sender IK 延迟解密**:`_v2SenderIKPending` / `_v2SenderIKFetching` 机制,对端 IK 未缓存时挂起消息、异步拉取后重试解密
55
+ - **agent.md 本地缓存体系**:`setAgentMdPath` / `publishAgentMd()` / `fetchAgentMd(aid?)`;基于文件系统的 list.json 索引 + 按 AID 存储 + etag 比对 + 自动拉取缺失
56
+ - **KeyStore agent_md_cache 持久化**:文件系统 + SQLite 双后端支持
57
+ - **V2 辅助函数**:`getV2DeviceId` / `_v2B64ToBytesStrict` / `_v2BytesEqual` / `_v2ConcatBytes` / `_v2LengthPrefixedTextKey` / `_v2LengthPrefixedBytes`
58
+ - **V2 envelope 元数据**:`attachV2EnvelopeMetadata` / `attachV2EnvelopeMetadataFromSource` / `extractV2EnvelopeFromSource` / `metadataWithoutAuth`
59
+ - **签名跳过策略**:对内部方法和系统事件跳过签名验证
60
+
61
+ ### Changed
62
+ - **V2 消息处理路径重构**:统一 P2P/Group 解密入口,支持 sender IK pending 延迟模式
63
+ - **V2 SPK rotation**:thought 解密失败时触发 group SPK rotation / registration after peer fallback
64
+ - **消息调试日志增强**:thought.get 全链路 debug 日志
65
+
66
+ ### Fixed
67
+ - **service-plane envelope 解包**:修复 Kernel trace 字段传递丢失
68
+ - **trace 树状展示**:enter/exit 配对 + 嵌套缩进
69
+
70
+ ---
71
+
72
+ ## 0.3.1 — 2026-05-22
73
+
74
+ ### Added
75
+ - **`auth.checkAid` handler**:本地证书自检(解析有效期、公钥)+ 远端注册状态查询;新增 `parseCertValidity` / `parseAsn1Time` ASN.1 时间解析
76
+ - **RPC trace 增强**:`RPCTransport` 增加 `setTraceMode()` / `setTraceObserver()`;`sortTraceSpansForDisplay` / `formatTraceTree` / `traceDisplay` 树状展示按 ts 排序 + 嵌套缩进;`TraceObserver` 类型导出
77
+ - **V2 群组 SPK 生命周期**:`V2KeyStore.saveGroupSPK` / `loadGroupSPK` / `loadCurrentGroupSPK`;`V2Session.ensureGroupRegistered` / `rotateGroupSPK` / `_publishGroupSPK`;`DESTROY_DELAY_MS = 7d`
78
+ - **V2 P2P push 解密**:`AUNClient._onV2PushNotification` / `_decryptV2PushMessage` 实现带 payload 的就地解密 + 失败回退到 pull
79
+
80
+ ### Changed
81
+ - **`SeqTracker.forceContiguousSeq`**:原 `contiguousSeq = minSeq` 跳过空洞(会丢消息),改为 `contiguousSeq = minSeq - 1` 由连续前缀自然推进,避免误丢
82
+
83
+ ### Fixed
84
+ - **`client.ts:4026` 类型错误**:`_publishOrderedMessage` 的 `decrypted` 实参补 `as EventPayload` 断言(`Record<string, unknown>` 与 `JsonValue | Error` 不兼容)
85
+ - short RPC 请求增加 `debug` 完整报文日志,便于跨语言诊断
86
+
87
+ ---
88
+
89
+ ## 0.3.0 — 2026-05-21 ⚠️ BREAKING CHANGE
90
+
91
+ > **V2-only 版本**:移除全部 V1 E2EE(含群组加密),新增 V2 加密原语,API 不向后兼容。
92
+
93
+ ### BREAKING
94
+ - **移除 V1 E2EE 全部实现**:`GroupE2EEManager`、V1 epoch key 逻辑全部删除
95
+ - **移除 V1 群组加密测试**:`e2ee.test.ts`、`e2ee-group.test.ts`、`epoch-key-server.spec.ts`
96
+ - **E2EE 接口简化**:`e2ee.ts` 仅保留 V2 路径,V1 加解密方法不再可用
97
+ - **配置变更**:`AUNConfig` 移除 V1 相关配置项
98
+ - **KeyStore 重构**:`keystore/` 目录结构调整,`aid-db.ts` / `file.ts` 接口变更
99
+
100
+ ### Added
101
+ - **agent.md API**:`AUNClient.publishAgentMd(path)` / `AUNClient.fetchAgentMd(aid?, savePath?)`
102
+ - **V2 加密原语**(跨语言 golden vector 一致性):ECDH P-256、HKDF-SHA256、AES-256-GCM、ECDSA-SHA256 RAW (RFC 6979)、1DH/3DH wrap_key、Recipients Sort + Merkle Digest、State Commitment
103
+
104
+ ### Removed
105
+ - `AUNClient.setLocalAgentMdPath()` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()` — 由主 API 自动维护
106
+
107
+ ### Deprecated
108
+ - `client.auth.signAgentMd` / `verifyAgentMd` / `uploadAgentMd` / `downloadAgentMd` — 建议迁移到 `client.publishAgentMd` / `client.fetchAgentMd`
109
+
110
+ ---
111
+
112
+ ## 0.2.20 — 2026-05-18
113
+
114
+ ### Added
115
+ - **agent.md 版本一致性 API**:`AUNClient.setLocalAgentMdPath(path)` / `getLocalAgentMdEtag()` / `getRemoteAgentMdEtag()`。Node 用 `fs.readFileSync` + `crypto.createHash` 计算 etag,浏览器场景返回空串并 warn。SDK 自动从 RPC envelope `_meta.agent_md_etag` 提取服务端 etag,应用层订阅 `message.received` / `group.message_created` 等事件时 payload 多 `_agent_md.{local_etag, remote_etag}` 字段供版本比对。
116
+ - **`downloadAgentMd` 条件请求缓存**:内部维护 ETag/Last-Modified,未变化时返回上次缓存内容;外部 API 形态不变。
117
+ - **transport meta observer**:`RPCTransport.setMetaObserver(fn)` 透传 envelope `_meta`,observer 抛错被吞,不影响 RPC result。
118
+
119
+ ### Changed
120
+ - **RPC call 默认超时 10s → 35s**:与服务端 30s handler timeout 对齐,留 5s buffer。
121
+ - **multi-device 架构**:对端无 prekey 时 `_sendEncrypted` 直接抛错(`no registered device prekeys for ...`),不再降级到 `long_term_key`。
122
+
123
+ ### Docs
124
+ - 仓库根 `docs/`(agent.md 规范、protocol、SDK 手册)随 npm tarball 打包到 `_packed_docs/`,安装后可读。`.gitignore` 排除项(如内部测试指南)不进包。
125
+
126
+ ---
@@ -9,9 +9,9 @@
9
9
  | 文档 | 定位 |
10
10
  | --- | --- |
11
11
  | [aun测试运行指南](aun测试运行指南.md) | 当前 Docker 单域、双域、多语言 SDK 测试运行命令 |
12
- | [跨语言容器E2E测试方案](design/跨语言容器E2E测试方案.md) | 多语言 SDK 同网同服、test-runner 控制面的跨语言 E2E 方案 |
13
- | [E2EE V2 简化为 1DH + Per-AID Wrap 方案](design/E2EE_V2简化为1DH加Per-AID_Wrap方案.md) | SDK bootstrap 能力声明 + 服务端 policy 控制 1DH/per-AID wrap 的兼容方案 |
14
- | [AUN RPC Trace 增强设计](design/2026-05-22-aun-rpc-trace-enhancement.md) | RPC trace 诊断字段与 enter/exit span 设计 |
12
+ | [跨语言容器E2E测试方案](design/跨语言容器E2E测试方案.md) | 多语言 SDK 同网同服、test-runner 控制面的跨语言 E2E 方案 |
13
+ | [E2EE V2 简化为 1DH + Per-AID Wrap 方案](design/E2EE_V2简化为1DH加Per-AID_Wrap方案.md) | SDK bootstrap 能力声明 + 服务端 policy 控制 1DH/per-AID wrap 的兼容方案 |
14
+ | [AUN RPC Trace 增强设计](design/2026-05-22-aun-rpc-trace-enhancement.md) | RPC trace 诊断字段与 enter/exit span 设计 |
15
15
  | [远程 agent.md 缓存与 ETag 透传方案](agent.md/远程agent.md缓存与etag透传方案.md) | 远程 agent.md per-AID 缓存、SQLite 表、消息信封与 RPC 响应 ETag 透传方案 |
16
16
  | [SDK 文档索引](sdk/INDEX.md) | SDK 使用手册、RPC 手册、E2EE 手册的子索引 |
17
17
  | [SDK 查阅指南](sdk/AUN_DOCS_GUIDE.md) | SDK 文档按行区间渐进式查阅方法 |
@@ -44,9 +44,9 @@
44
44
 
45
45
  ### E2EE 与跨语言一致性
46
46
 
47
- - SDK E2EE API、会话管理、ProtectedHeaders → [SDK 文档索引](sdk/INDEX.md)
48
- - E2EE V2 1DH/per-AID wrap、bootstrap 能力声明、服务端 fanout → [E2EE V2 简化为 1DH + Per-AID Wrap 方案](design/E2EE_V2简化为1DH加Per-AID_Wrap方案.md)
49
- - 共享测试向量、transcript 回放、Python / TS / Go / C++ E2EE 互通 → [aun测试运行指南](aun测试运行指南.md)、[跨语言容器E2E测试方案](design/跨语言容器E2E测试方案.md)
47
+ - SDK E2EE API、会话管理、ProtectedHeaders → [SDK 文档索引](sdk/INDEX.md)
48
+ - E2EE V2 1DH/per-AID wrap、bootstrap 能力声明、服务端 fanout → [E2EE V2 简化为 1DH + Per-AID Wrap 方案](design/E2EE_V2简化为1DH加Per-AID_Wrap方案.md)
49
+ - 共享测试向量、transcript 回放、Python / TS / Go / C++ E2EE 互通 → [aun测试运行指南](aun测试运行指南.md)、[跨语言容器E2E测试方案](design/跨语言容器E2E测试方案.md)
50
50
 
51
51
  ---
52
52
 
@@ -56,15 +56,15 @@
56
56
 
57
57
  记录当前 AUN 服务与 SDK 在 Docker 单域、双域环境中的实际测试入口。包含 Python、TypeScript、Go、JavaScript、C++ 五语言测试矩阵,Python / TypeScript / Go / C++ 跨语言容器 E2E 的 69 用例矩阵,覆盖 P2P 明文/E2EE、群聊 pairwise 明文/E2EE,以及四语言 agent 同群的明文/E2EE 矩阵,另包含固定身份目录、容器名、典型命令、浏览器 E2E、C++ Docker 测试、双域 federation 测试和数据保护规则。
58
58
 
59
- ### 跨语言容器E2E测试方案
60
-
61
- 定义多语言 SDK 同时作为真实客户端运行的目标测试体系。核心模型是每个语言一个客户端容器,全连接同一 AUN server / gateway;业务消息走 AUN,test-runner 通过每个客户端暴露的 test-control HTTP API 编排动作和断言结果。当前单域落地覆盖 Python / TypeScript / Go / C++,浏览器 JavaScript 仍按宿主机 Playwright 运行。
62
-
63
- ### E2EE V2 简化为 1DH + Per-AID Wrap 方案
64
-
65
- 定义新 SDK 通过 bootstrap 入参声明 `e2ee_wrap_capabilities`,服务端再返回实际 `e2ee_wrap_policy`;旧 SDK 未声明时保留 legacy `3DH/device`。policy 不进入 envelope 或 AAD。方案规定 per-AID row 使用现有 8 字段结构并以 `device_id=""` 标识,服务端按真实 device fanout 但保存 `recipient_row_json` 原始 row,pull 时用原始 row 重建 recipient,确保 Merkle proof 和历史消息兼容。
66
-
67
- ### AUN RPC Trace 增强设计
59
+ ### 跨语言容器E2E测试方案
60
+
61
+ 定义多语言 SDK 同时作为真实客户端运行的目标测试体系。核心模型是每个语言一个客户端容器,全连接同一 AUN server / gateway;业务消息走 AUN,test-runner 通过每个客户端暴露的 test-control HTTP API 编排动作和断言结果。当前单域落地覆盖 Python / TypeScript / Go / C++,浏览器 JavaScript 仍按宿主机 Playwright 运行。
62
+
63
+ ### E2EE V2 简化为 1DH + Per-AID Wrap 方案
64
+
65
+ 定义新 SDK 通过 bootstrap 入参声明 `e2ee_wrap_capabilities`,服务端再返回实际 `e2ee_wrap_policy`;旧 SDK 未声明时保留 legacy `3DH/device`。policy 不进入 envelope 或 AAD。方案规定 per-AID row 使用现有 8 字段结构并以 `device_id=""` 标识,服务端按真实 device fanout 但保存 `recipient_row_json` 原始 row,pull 时用原始 row 重建 recipient,确保 Merkle proof 和历史消息兼容。
66
+
67
+ ### AUN RPC Trace 增强设计
68
68
 
69
69
  设计 RPC trace 的 enter/exit span 结构,补充方法、AID、route、错误码、业务结果等诊断字段,并定义安全字段白名单。目标是在跨模块 RPC 失败时能定位到具体业务原因,而不是只看到模块路径和耗时。
70
70
 
@@ -78,4 +78,4 @@
78
78
 
79
79
  ### SDK 查阅指南
80
80
 
81
- `docs/sdk/AUN_DOCS_GUIDE.md` 说明如何按行区间渐进式读取 SDK 文档,避免一次性加载过多文档内容。
81
+ `docs/sdk/AUN_DOCS_GUIDE.md` 说明如何按行区间渐进式读取 SDK 文档,避免一次性加载过多文档内容。
@@ -8,18 +8,18 @@ AUN SDK Core 文档在 `docs/` 下。根级索引为 `docs/INDEX.md`,SDK API
8
8
 
9
9
  ### Step 1:先读根级 Layer 1
10
10
 
11
- - `docs/INDEX.md` L7-20:根级文档地图。
11
+ - `docs/INDEX.md` L7-20:根级文档地图。
12
12
 
13
13
  ### Step 2:按主题读根级 Layer 2
14
14
 
15
15
  - 测试与 E2E:`docs/INDEX.md` L25-29。
16
16
  - SDK 使用与协议:`docs/INDEX.md` L31-36。
17
17
  - 诊断与可观测性:`docs/INDEX.md` L38-42。
18
- - E2EE 与跨语言一致性:`docs/INDEX.md` L45-49。
18
+ - E2EE 与跨语言一致性:`docs/INDEX.md` L45-49。
19
19
 
20
20
  ### Step 3:需要判断文档价值时读 Layer 3 摘要
21
21
 
22
- - `docs/INDEX.md` L53-81:重点文档摘要。
22
+ - `docs/INDEX.md` L53-81:重点文档摘要。
23
23
 
24
24
  ### Step 4:再读目标文档章节
25
25
 
@@ -36,9 +36,9 @@ AUN SDK Core 文档在 `docs/` 下。根级索引为 `docs/INDEX.md`,SDK API
36
36
  | 双域 federation 测试容器和命令 | `docs/aun测试运行指南.md` L534-714 |
37
37
  | 何时 rebuild / restart | `docs/aun测试运行指南.md` L715-762 |
38
38
  | 测试故障排查 | `docs/aun测试运行指南.md` L763-782 |
39
- | 跨语言容器 E2E 背景与目标 | `docs/design/跨语言容器E2E测试方案.md` L5-35 |
40
- | E2EE V2 1DH/per-AID wrap 方案 | `docs/design/E2EE_V2简化为1DH加Per-AID_Wrap方案.md` |
41
- | 跨语言 Docker 拓扑 | `docs/design/跨语言容器E2E测试方案.md` L37-76 |
39
+ | 跨语言容器 E2E 背景与目标 | `docs/design/跨语言容器E2E测试方案.md` L5-35 |
40
+ | E2EE V2 1DH/per-AID wrap 方案 | `docs/design/E2EE_V2简化为1DH加Per-AID_Wrap方案.md` |
41
+ | 跨语言 Docker 拓扑 | `docs/design/跨语言容器E2E测试方案.md` L37-76 |
42
42
  | 共享测试向量、CLI transcript、单域/双域分层 | `docs/design/跨语言容器E2E测试方案.md` L78-147 |
43
43
  | test-runner 如何控制不同语言 client | `docs/design/跨语言容器E2E测试方案.md` L149-158 |
44
44
  | test-control HTTP API | `docs/design/跨语言容器E2E测试方案.md` L160-305 |
@@ -52,4 +52,4 @@ AUN SDK Core 文档在 `docs/` 下。根级索引为 `docs/INDEX.md`,SDK API
52
52
  | agent.md ETag 透传时序图 | `docs/agent.md/远程agent.md缓存与etag透传方案.md` L88-185 |
53
53
  | agent.md 服务端与 SDK 实现流程 | `docs/agent.md/远程agent.md缓存与etag透传方案.md` L187-268 |
54
54
  | agent.md SQLite 表结构、竞态和测试点 | `docs/agent.md/远程agent.md缓存与etag透传方案.md` L270-328 |
55
- | SDK API、RPC、E2EE 使用细节 | `docs/sdk/AUN_DOCS_GUIDE.md` |
55
+ | SDK API、RPC、E2EE 使用细节 | `docs/sdk/AUN_DOCS_GUIDE.md` |