agent-bridge-aun 1.0.18 → 1.0.19

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.
@@ -10,7 +10,7 @@ const node_url_1 = require("node:url");
10
10
  const messages_1 = require("./messages");
11
11
  const evolcore_1 = require("./evolcore");
12
12
  const manifest = {
13
- id: "aun", version: "1.0.18", type: "channel", displayName: "AUN 通道",
13
+ id: "aun", version: "1.0.19", type: "channel", displayName: "AUN 通道",
14
14
  entry: "dist/src-ts/plugins/aun/index.js", apiVersion: "1", process: "in-process",
15
15
  capabilities: ["channel", "channel.identity.create", "channel.receive", "channel.send", "health"],
16
16
  configSchema: "config.schema.json",
@@ -73,10 +73,10 @@ class AunPlugin {
73
73
  try {
74
74
  if (!this.identities.has(aid)) {
75
75
  // Owner AID 是本地归属配置;身份签发沿用 EvolCore 的兼容注册流程。
76
+ await this.prepareTrustRoots(aid);
76
77
  const result = await this.store.register(aid);
77
78
  if (!result.ok)
78
79
  throw new Error(redact(result.error?.message ?? result.error?.code ?? "AID 注册失败"));
79
- await this.prepareTrustRoots(aid);
80
80
  const loaded = this.store.load(aid);
81
81
  if (!loaded.ok || !loaded.data)
82
82
  throw new Error(loaded.error?.message ?? "注册后未能加载本地身份");
@@ -285,13 +285,15 @@ class AunPlugin {
285
285
  const rootCaPath = this.rootCaPath();
286
286
  if ((0, node_fs_1.existsSync)(rootCaPath))
287
287
  return;
288
+ if (!this.sdk?.GatewayDiscovery) {
289
+ this.context?.logger.warn("AUN SDK 未提供 GatewayDiscovery,无法预先下载信任根", { aid });
290
+ return;
291
+ }
288
292
  try {
289
- if (!this.sdk?.GatewayDiscovery)
290
- throw new Error("AUN SDK 未提供 GatewayDiscovery");
291
293
  const discovery = new this.sdk.GatewayDiscovery({ verifySsl: typeof this.config.verify_ssl === "boolean" ? this.config.verify_ssl : true });
292
294
  const gatewayUrl = await discovery.discover(`https://${aid}/.well-known/aun-gateway`);
293
295
  const gatewayHttpUrl = gatewayUrl.replace(/^wss?:/i, "https:").replace(/\/aun\/?$/i, "");
294
- const response = await fetch(`${gatewayHttpUrl}/pki/chain`, { redirect: "follow" });
296
+ const response = await fetch(`${gatewayHttpUrl}/pki/chain`, { redirect: "follow", signal: AbortSignal.timeout(10_000) });
295
297
  if (!response.ok)
296
298
  throw new Error(`下载 Gateway CA 链失败:HTTP ${response.status}`);
297
299
  const chain = await response.text();
@@ -312,6 +314,7 @@ class AunPlugin {
312
314
  }
313
315
  catch (error) {
314
316
  this.context?.logger.warn("AUN Gateway 信任根证书初始化失败", { aid, error: safeError(error) });
317
+ throw new Error(`AUN Gateway 信任根证书初始化失败:${safeError(error)}`);
315
318
  }
316
319
  }
317
320
  createAid = async (request, response) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-bridge-aun",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "mu-agent-bridge 的 AUN 通道插件。",
5
5
  "keywords": [
6
6
  "mu-agent-bridge-plugin",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "aun",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "type": "channel",
5
5
  "displayName": "AUN 通道",
6
6
  "entry": "dist/src-ts/plugins/aun/index.js",