agent-bridge-aun 1.0.39 → 1.0.40

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.
@@ -13,7 +13,7 @@ const evolcore_1 = require("./evolcore");
13
13
  const messages_1 = require("./messages");
14
14
  const attachments_1 = require("./attachments");
15
15
  const manifest = {
16
- id: "aun", version: "1.0.39", type: "channel", displayName: "AUN 通道",
16
+ id: "aun", version: "1.0.40", type: "channel", displayName: "AUN 通道",
17
17
  entry: "dist/src-ts/plugins/aun/index.js", apiVersion: "1", process: "in-process",
18
18
  capabilities: ["channel", "channel.identity.create", "channel.receive", "channel.send", "health", "cli"],
19
19
  configSchema: "config.schema.json",
@@ -959,7 +959,8 @@ class AunPlugin {
959
959
  channel: "aun", recipientId: aid, peerId: message.peerId, messageId: message.messageId, text: message.text, threadId: message.threadId,
960
960
  ...(attachments.length ? { attachments } : {}),
961
961
  agentPlugin,
962
- reply: async (text) => {
962
+ reply: async (text, signal) => {
963
+ signal?.throwIfAborted();
963
964
  if (!text.trim())
964
965
  return;
965
966
  try {
@@ -971,7 +972,8 @@ class AunPlugin {
971
972
  throw new agent_1.AgentOperationError("AUN_TEXT_SEND_FAILED", "发送 AUN 文本消息(结果未确认,不自动重发)", error);
972
973
  }
973
974
  },
974
- replyAttachments: async (items, text) => {
975
+ replyAttachments: async (items, text, signal) => {
976
+ signal?.throwIfAborted();
975
977
  if (!items.length)
976
978
  return;
977
979
  let sent = 0;
@@ -983,6 +985,7 @@ class AunPlugin {
983
985
  if (!client?.storage)
984
986
  throw new Error("AUN SDK 不支持附件存储接口");
985
987
  const refs = uploadedRefs && uploadedItems === items ? uploadedRefs : await (0, attachments_1.uploadAunAttachments)({ storage: client.storage }, aid, message.peerId, items);
988
+ signal?.throwIfAborted();
986
989
  this.context?.logger.info("AUN FS 标准附件上传完成", { ...trace, stage: "上传附件", files: items.map(item => ({ filename: item.filename, sizeBytes: item.data.byteLength })) });
987
990
  if (!uploadedRefs || uploadedItems !== items) {
988
991
  uploadedItems = items;
@@ -997,6 +1000,7 @@ class AunPlugin {
997
1000
  }
998
1001
  groupsCount = groups.size;
999
1002
  for (const [kind, group] of groups) {
1003
+ signal?.throwIfAborted();
1000
1004
  const payloadText = withAttachmentDownloadLinks(text || (kind === "image" ? "图片已生成。" : kind === "video" ? "视频已生成。" : "文件已生成。"), kind, group);
1001
1005
  // AUN 网页会隐藏带普通正文的单图卡片,图片说明需另发文本。
1002
1006
  const payload = { type: kind, ...(kind === "image" ? {} : { text: payloadText }), attachments: group };
@@ -1016,6 +1020,7 @@ class AunPlugin {
1016
1020
  sent++;
1017
1021
  if (kind === "image" && payloadText) {
1018
1022
  try {
1023
+ signal?.throwIfAborted();
1019
1024
  const { attachments: _attachments, ...caption } = payload;
1020
1025
  const result = await this.callAunWithRecovery(aid, { to: message.peerId, payload: { ...caption, type: "text", text: payloadText }, encrypt: true });
1021
1026
  if (typeof result?.status !== "string" || !successfulSendStatuses.has(result.status))
@@ -1029,6 +1034,7 @@ class AunPlugin {
1029
1034
  }
1030
1035
  }
1031
1036
  catch (error) {
1037
+ signal?.throwIfAborted();
1032
1038
  deliveryFailed = true;
1033
1039
  const failure = sending ? new agent_1.AgentOperationError("AUN_ATTACHMENT_SEND_FAILED", "发送 AUN 附件消息(FS 上传已完成)", error) : error;
1034
1040
  const progress = sending ? `(已确认发送 ${sent}/${groupsCount} 组,当前组结果未确认,请勿重复发送)` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-bridge-aun",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
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.39",
3
+ "version": "1.0.40",
4
4
  "type": "channel",
5
5
  "displayName": "AUN 通道",
6
6
  "entry": "dist/src-ts/plugins/aun/index.js",