@agentunion/fastaun 0.4.0 → 0.4.2

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
@@ -6,6 +6,53 @@
6
6
 
7
7
  ---
8
8
 
9
+ ## 0.4.2 — 2026-05-30
10
+
11
+ ### Added
12
+ - **`AIDStore` 新增具名返回类型**:`ResolveResult`、`FetchAgentMdResult`、`HeadAgentMdResult`、`CheckAgentMdResult`、`DiagnoseResult`、`RenewCertResult`、`RekeyResult`、`ChangeSeedResult`、`ListResult`,替代原来的 `Record<string, unknown>`。
13
+ - **`AID` 新增 `verifySsl` 只读字段**:创建时由 `AIDStore` 注入,供内部 HTTP 请求使用。
14
+ - **`AUNClientOptions` 新增 `rootCaPath` / `debug`**:支持私有部署自定义根证书路径,以及构造时直接传入调试开关。
15
+
16
+ ### Changed
17
+ - **移除 `discoveryPort`**:`AIDStore` 构造选项删除 `discoveryPort`,gateway URL 改为纯自动发现。
18
+ - **`fetchAgentMd` 新增 `timeoutMs` 参数**(默认 30000ms),`resolve` 内部调用时透传 `opts.timeout`(默认 10000ms)。
19
+ - **返回字段精简**:`fetchAgentMd` / `headAgentMd` / `checkAgentMd` / `diagnose` 移除冗余的 camelCase 别名字段,统一使用 snake_case。
20
+ - **`resolve` 返回 `source` 字段精简**:移除 `certFromCache` / `agentMdFetched` camelCase 别名,只保留 `cert_from_cache` / `agent_md_fetched`。
21
+ - **`AID._create` 透传 `verifySsl` / `rootCaPath` / `debug`**:`AIDStore` 在 `load` / `resolve` 时自动注入这三个配置项到 `AID` 实例。
22
+
23
+ ---
24
+
25
+ ## 0.4.0 — 2026-05-30
26
+
27
+ > **破坏性重构版本。** 与 Python SDK 0.4.0 对齐:身份管理剥离为 `AID` / `AIDStore`;删除 `auth` / `custody` / `meta` 公开命名空间;引入 `Result` 与字符串错误码;连接状态机扩展为 9 态。
28
+
29
+ ### Breaking Changes
30
+ - **删除公开命名空间**:移除 `client.auth` / `client.custody` / `client.meta`。身份相关功能迁移到 `AIDStore` 与 `AID`,其余 RPC 走 `client.call()`。
31
+ - **构造函数签名变更**:`constructor(config?, debug?)` → `constructor(aid?: AID, options?: AUNClientOptions)`;移除 `debug` 布尔参数。
32
+ - **初始连接状态变更**:`'idle'` → `'no_identity'`。
33
+ - **目录约定变更**:`{aun_path}/AgentMDs/` → `{aun_path}/AIDs/`。
34
+
35
+ ### Added
36
+ - **`AID` 类**:封装证书 + 可选私钥,提供 `sign` / `verify` / `signAgentMd` / `verifyAgentMd` / `isCertValid` / `isPrivateKeyValid`。
37
+ - **`AIDStore` 类**:离线 `load` / `list` / `exists`,联网 `register` / `resolve` / `fetchAgentMd` / `checkAgentMd` / `diagnose` / `renewCert` / `rekey` / `changeSeed`。
38
+ - **`Result<T>` 类型**:统一结果类型(`{ ok: true; data: T }` 或 `{ ok: false; error: ErrorInfo }`)。
39
+ - **新增错误类**:`NotFoundError` / `IdentityConflictError` / `VersionConflictError` / `ClientSignatureError`。
40
+ - **`ConnectionState` 枚举**:9 态(`NO_IDENTITY` / `STANDBY` / `CONNECTING` / `READY` / `RETRY_BACKOFF` / `RECONNECTING` / `CONNECTION_FAILED` / `CLOSED`)。
41
+ - **实例级 `protected_headers`**:`setProtectedHeaders()` 自动合并到 `message.send` / `group.send` / `*.thought.put`。
42
+ - **重连状态可观测**:`nextRetryAt` / `retryAttempt` / `retryMaxAttempts` / `lastError` / `lastErrorCode` 属性。
43
+ - **客户端属性**:`currentAid` / `hasIdentity` / `canSign` / `canConnect` / `canSend`。
44
+ - **导出**:`VERSION` 常量、`STATE_TO_PUBLIC` 映射表。
45
+ - **keystore 扩展**:新增 `prekeys` / `group_current` / `group_old_epochs` / `e2ee_sessions` 表及相关读写方法;新增字段级加解密(旧 E2EE 互操作)。
46
+
47
+ ### Fixed
48
+ - **agent.md 请求超时**:新增 `fetchWithTimeout()` 防止挂起。
49
+ - **agent.md 下载并发控制**:新增 `AGENT_MD_DOWNLOAD_CONCURRENCY` 限制。
50
+
51
+ ### Removed
52
+ - 删除 `ts/src/namespaces/auth.ts`、`ts/src/namespaces/custody.ts`、`ts/src/namespaces/meta.ts`。
53
+
54
+ ---
55
+
9
56
  ## 0.3.6 — 2026-05-28
10
57
 
11
58
  ### Added