mu-agent-bridge 1.0.25 → 1.0.26
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/dist/src-ts/plugins/aun/index.js +3 -4
- package/dist/src-ts/plugins/aun/public/index.html +1 -1
- package/dist/tests-ts/aun-plugin.test.js +4 -3
- package/package.json +1 -1
- package/plugins/aun/dist/src-ts/plugins/aun/index.js +3 -4
- package/plugins/aun/dist/src-ts/plugins/aun/public/index.html +1 -1
|
@@ -72,12 +72,11 @@ class AunPlugin {
|
|
|
72
72
|
this.creating = true;
|
|
73
73
|
try {
|
|
74
74
|
if (!this.identities.has(aid)) {
|
|
75
|
-
|
|
75
|
+
// 创建身份沿用 EvolCore 的 legacy 注册流程。Owner AID 是本地归属配置,
|
|
76
|
+
// 只有明确执行 Owner 关系绑定时才进入 aid_register_* 双签流程。
|
|
77
|
+
const result = await this.store.register(aid);
|
|
76
78
|
if (!result.ok)
|
|
77
79
|
throw new Error(redact(result.error?.message ?? result.error?.code ?? "AID 注册失败"));
|
|
78
|
-
const ownership = result.data?.ownership_status ?? result.data?.state ?? result.data?.operation_state;
|
|
79
|
-
if (ownership && ownership !== "active")
|
|
80
|
-
return { aid, status: "等待 Owner 确认", operation_id: result.data?.operation_id };
|
|
81
80
|
const loaded = this.store.load(aid);
|
|
82
81
|
if (!loaded.ok || !loaded.data)
|
|
83
82
|
throw new Error(loaded.error?.message ?? "注册后未能加载本地身份");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<header><h1>AUN 身份</h1><button id="refresh" type="button">刷新</button></header>
|
|
7
7
|
<p id="status" role="status"></p>
|
|
8
8
|
<div class="table-scroll"><table><thead><tr><th>AID</th><th>来源</th><th>已关联 Agent</th><th>操作</th></tr></thead><tbody id="identities"></tbody></table></div>
|
|
9
|
-
<form id="create-form"><h2>创建 AID</h2><div class="fields"><label>新 AID<input name="aid" required placeholder="
|
|
9
|
+
<form id="create-form"><h2>创建 AID</h2><div class="fields"><label>新 AID<input name="aid" required placeholder="例如:example.agentid.cn"></label><label>Owner AID<input name="ownerAid" required placeholder="例如:owner.agentid.cn(本地归属配置)"><small class="hint">Owner AID 用于本地归属和 Agent 关联;创建身份本身沿用 AUN 的普通注册流程</small></label></div><button type="submit">创建</button></form>
|
|
10
10
|
<form id="config-form"><h2>通道配置</h2><div class="fields"><label>默认 Agent<select name="agent_plugin"></select></label><label>允许的来源<input name="allow_from"></label><label>AUN 存储路径<input name="aun_path"></label><label>加密种子<input name="encryption_seed" type="password" autocomplete="new-password" placeholder="留空则不修改"></label></div><button type="submit">保存配置</button></form>
|
|
11
11
|
</main>
|
|
12
12
|
<script src="/abweb/channels/aun/app.js"></script>
|
|
@@ -142,7 +142,7 @@ const aun_1 = require("../src-ts/plugins/aun");
|
|
|
142
142
|
const sdk = {
|
|
143
143
|
AIDStore: class {
|
|
144
144
|
registered = [];
|
|
145
|
-
async register(input) { calls.push(`register:${input
|
|
145
|
+
async register(input) { calls.push(`register:${input}`); this.registered.push(input); return registration; }
|
|
146
146
|
load(aid) { return !loadOk || aid === loadFailAid ? { ok: false, error: { message: "本地身份不存在" } } : { ok: true, data: { aid } }; }
|
|
147
147
|
list() { return { ok: true, data: { identities: this.registered.map((aid) => ({ aid })) } }; }
|
|
148
148
|
close() { calls.push("store.close"); }
|
|
@@ -199,8 +199,9 @@ const aun_1 = require("../src-ts/plugins/aun");
|
|
|
199
199
|
await strict_1.default.rejects(plugin.identity.bind("dsh", "bad", 26107), /AID 格式无效/);
|
|
200
200
|
await routes.find((entry) => entry.path === "/api/plugins/aun/identities").handler({}, response);
|
|
201
201
|
strict_1.default.equal(response.body.bindingTimes["bridge.agentid.pub"], boundAt);
|
|
202
|
-
registration = { ok: true, data: {
|
|
203
|
-
strict_1.default.deepEqual(await plugin.identity.create("pending.agentid.pub", "owner.agentid.pub"), { aid: "pending.agentid.pub", status: "
|
|
202
|
+
registration = { ok: true, data: {} };
|
|
203
|
+
strict_1.default.deepEqual(await plugin.identity.create("pending.agentid.pub", "owner.agentid.pub"), { aid: "pending.agentid.pub", status: "已创建", connection: "ready" });
|
|
204
|
+
strict_1.default.ok(calls.includes("register:pending.agentid.pub"));
|
|
204
205
|
strict_1.default.equal((await plugin.health()).details?.aids instanceof Array, true);
|
|
205
206
|
registration = { ok: false, error: { message: "注册失败" } };
|
|
206
207
|
await strict_1.default.rejects(plugin.identity.create("failed.agentid.pub", "owner.agentid.pub"), /注册失败/);
|
package/package.json
CHANGED
|
@@ -72,12 +72,11 @@ class AunPlugin {
|
|
|
72
72
|
this.creating = true;
|
|
73
73
|
try {
|
|
74
74
|
if (!this.identities.has(aid)) {
|
|
75
|
-
|
|
75
|
+
// 创建身份沿用 EvolCore 的 legacy 注册流程。Owner AID 是本地归属配置,
|
|
76
|
+
// 只有明确执行 Owner 关系绑定时才进入 aid_register_* 双签流程。
|
|
77
|
+
const result = await this.store.register(aid);
|
|
76
78
|
if (!result.ok)
|
|
77
79
|
throw new Error(redact(result.error?.message ?? result.error?.code ?? "AID 注册失败"));
|
|
78
|
-
const ownership = result.data?.ownership_status ?? result.data?.state ?? result.data?.operation_state;
|
|
79
|
-
if (ownership && ownership !== "active")
|
|
80
|
-
return { aid, status: "等待 Owner 确认", operation_id: result.data?.operation_id };
|
|
81
80
|
const loaded = this.store.load(aid);
|
|
82
81
|
if (!loaded.ok || !loaded.data)
|
|
83
82
|
throw new Error(loaded.error?.message ?? "注册后未能加载本地身份");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<header><h1>AUN 身份</h1><button id="refresh" type="button">刷新</button></header>
|
|
7
7
|
<p id="status" role="status"></p>
|
|
8
8
|
<div class="table-scroll"><table><thead><tr><th>AID</th><th>来源</th><th>已关联 Agent</th><th>操作</th></tr></thead><tbody id="identities"></tbody></table></div>
|
|
9
|
-
<form id="create-form"><h2>创建 AID</h2><div class="fields"><label>新 AID<input name="aid" required placeholder="
|
|
9
|
+
<form id="create-form"><h2>创建 AID</h2><div class="fields"><label>新 AID<input name="aid" required placeholder="例如:example.agentid.cn"></label><label>Owner AID<input name="ownerAid" required placeholder="例如:owner.agentid.cn(本地归属配置)"><small class="hint">Owner AID 用于本地归属和 Agent 关联;创建身份本身沿用 AUN 的普通注册流程</small></label></div><button type="submit">创建</button></form>
|
|
10
10
|
<form id="config-form"><h2>通道配置</h2><div class="fields"><label>默认 Agent<select name="agent_plugin"></select></label><label>允许的来源<input name="allow_from"></label><label>AUN 存储路径<input name="aun_path"></label><label>加密种子<input name="encryption_seed" type="password" autocomplete="new-password" placeholder="留空则不修改"></label></div><button type="submit">保存配置</button></form>
|
|
11
11
|
</main>
|
|
12
12
|
<script src="/abweb/channels/aun/app.js"></script>
|