agent-bridge-aun 1.0.26 → 1.0.28
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/README.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
该插件依赖 `@agentunion/fastaun`,要求 Node.js 22.16 或更高版本。
|
|
12
12
|
|
|
13
|
+
附件回复按图片、视频和普通文件分组发送。MIME 类型为 `video/*` 的附件使用 EvolCore 标准 `type: "video"` 消息,使支持视频预览的 Peer 客户端显示播放器;保留原话题和请求引用。附件仍使用仅原 Peer 可访问的限时分享,不改变各 Agent 插件的产物回传策略。
|
|
14
|
+
|
|
13
15
|
ABWeb 的 AUN 设置只展示已连接 AID,并按来源分组。成功注册并记录在插件 `created_aids` 中的 AID 属于本工程;共享密钥库中其余 AID 属于 EvolCore。旧版 `created-aids.json` 记录继续兼容。来源只用于展示,连接和关联由 AUN 插件直接管理。列表先显示已关联 Agent 的身份,各组按最近成功关联的时间倒序排列,时间相同或旧记录没有时间时按 AID 名称排序。关联时间保存在插件配置的 `binding_times` 中,刷新或重启后保留;旧记录不补造时间,再次关联成功后开始记录。
|
|
14
16
|
|
|
15
17
|
AUN 独立包支持核心后台每五分钟检测更新;可信提供者在自动安装策略下会下载新副本并重载通道。
|
|
@@ -237,9 +237,21 @@ async function uploadAunAttachments(client, ownerAid, peerAid, items) {
|
|
|
237
237
|
const objectKey = `shared/${(0, node_crypto_1.randomUUID)()}/${filename.replace(/[^A-Za-z0-9._-]/g, "_")}`;
|
|
238
238
|
const sha256 = digest(item.data);
|
|
239
239
|
const ref = { ownerAid, bucket: "default", objectKey, filename, contentType: item.contentType.toLowerCase(), sizeBytes: item.data.byteLength, sha256 };
|
|
240
|
-
const uploaded = await client.storage.writeBytes(`/${objectKey}`, item.data, { contentType: item.contentType, public:
|
|
240
|
+
const uploaded = await client.storage.writeBytes(`/${objectKey}`, item.data, { contentType: item.contentType, public: false, overwrite: false });
|
|
241
241
|
checkedMetadata({ ...uploaded, size: uploaded.size ?? uploaded.size_bytes ?? item.data.byteLength }, ref);
|
|
242
|
-
|
|
242
|
+
const share = await client.storage.lowlevel.createShareLink({ owner: ownerAid, bucket: "default", objectKey, allowedAids: [peerAid], expireInSeconds: 86400 });
|
|
243
|
+
if (share.owner_aid && share.owner_aid !== ownerAid || share.bucket && share.bucket !== "default" || share.object_key && share.object_key !== objectKey)
|
|
244
|
+
throw new Error("AUN 附件分享对象不一致");
|
|
245
|
+
if (share.allowed_aids !== undefined && (!Array.isArray(share.allowed_aids) || share.allowed_aids.length !== 1 || share.allowed_aids[0] !== peerAid))
|
|
246
|
+
throw new Error("AUN 附件分享授权不一致");
|
|
247
|
+
const shareId = typeof share.share_id === "string" && /^[A-Za-z0-9]{10}$/.test(share.share_id) ? share.share_id : undefined;
|
|
248
|
+
if (share.share_id !== undefined && !shareId)
|
|
249
|
+
throw new Error("AUN 附件分享标识无效");
|
|
250
|
+
const url = typeof share.path_url === "string" && share.path_url ? share.path_url : shareId ? `https://${ownerAid}/${objectKey}?t=${shareId}` : "";
|
|
251
|
+
const token = url ? pathToken(url, ownerAid, objectKey) : undefined;
|
|
252
|
+
if (!token || shareId && shareId !== token)
|
|
253
|
+
throw new Error("AUN 附件分享链接无效");
|
|
254
|
+
result.push({ owner_aid: ownerAid, bucket: "default", object_key: objectKey, url, filename, content_type: item.contentType, size_bytes: item.data.byteLength, sha256 });
|
|
243
255
|
}
|
|
244
256
|
return result;
|
|
245
257
|
}
|
|
@@ -11,7 +11,7 @@ const node_url_1 = require("node:url");
|
|
|
11
11
|
const messages_1 = require("./messages");
|
|
12
12
|
const attachments_1 = require("./attachments");
|
|
13
13
|
const manifest = {
|
|
14
|
-
id: "aun", version: "1.0.
|
|
14
|
+
id: "aun", version: "1.0.28", type: "channel", displayName: "AUN 通道",
|
|
15
15
|
entry: "dist/src-ts/plugins/aun/index.js", apiVersion: "1", process: "in-process",
|
|
16
16
|
capabilities: ["channel", "channel.identity.create", "channel.receive", "channel.send", "health", "cli"],
|
|
17
17
|
configSchema: "config.schema.json",
|
|
@@ -817,15 +817,14 @@ class AunPlugin {
|
|
|
817
817
|
}
|
|
818
818
|
const groups = new Map();
|
|
819
819
|
for (const [index, item] of items.entries()) {
|
|
820
|
-
const kind = item.kind;
|
|
821
|
-
const ref = refs[index];
|
|
820
|
+
const kind = item.kind === "file" && item.contentType.toLowerCase().startsWith("video/") ? "video" : item.kind;
|
|
822
821
|
const group = groups.get(kind) ?? [];
|
|
823
|
-
group.push(
|
|
822
|
+
group.push(refs[index]);
|
|
824
823
|
groups.set(kind, group);
|
|
825
824
|
}
|
|
826
825
|
groupsCount = groups.size;
|
|
827
826
|
for (const [kind, group] of groups) {
|
|
828
|
-
const payload = { type: kind, text: text || (kind === "image" ? "图片已生成。" : "文件已生成。"), attachments: group };
|
|
827
|
+
const payload = { type: kind, text: text || (kind === "image" ? "图片已生成。" : kind === "video" ? "视频已生成。" : "文件已生成。"), attachments: group };
|
|
829
828
|
if (message.threadId)
|
|
830
829
|
payload.thread_id = message.threadId;
|
|
831
830
|
if (message.messageId)
|
package/package.json
CHANGED