@agentvault/agentvault 0.19.39 → 0.19.41
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/channel.d.ts.map +1 -1
- package/dist/cli.js +25 -46
- package/dist/cli.js.map +3 -3
- package/dist/index.js +25 -46
- package/dist/index.js.map +3 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62887,30 +62887,6 @@ var init_channel = __esm({
|
|
|
62887
62887
|
if (roomConvIds.has(convId)) continue;
|
|
62888
62888
|
if (targetConvId && convId !== targetConvId) continue;
|
|
62889
62889
|
try {
|
|
62890
|
-
const mlsMgr = this._mlsGroups.get(`conv:${convId}`);
|
|
62891
|
-
if (mlsMgr && this._state === "ready" && this._ws) {
|
|
62892
|
-
const plainBytes = new TextEncoder().encode(plaintext);
|
|
62893
|
-
const ciphertext = await mlsMgr.encrypt(plainBytes);
|
|
62894
|
-
const mlsGroupId = this._persisted?.mlsConversations?.[convId]?.mlsGroupId;
|
|
62895
|
-
if (mlsGroupId) {
|
|
62896
|
-
const payloadHex = Buffer.from(ciphertext).toString("hex");
|
|
62897
|
-
pendingWsSends.push(
|
|
62898
|
-
JSON.stringify({
|
|
62899
|
-
event: "message_mls",
|
|
62900
|
-
data: {
|
|
62901
|
-
group_id: mlsGroupId,
|
|
62902
|
-
conversation_id: convId,
|
|
62903
|
-
epoch: Number(mlsMgr.epoch),
|
|
62904
|
-
payload: payloadHex,
|
|
62905
|
-
topic_id: topicId
|
|
62906
|
-
}
|
|
62907
|
-
})
|
|
62908
|
-
);
|
|
62909
|
-
await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mlsMgr.exportState()));
|
|
62910
|
-
sentCount++;
|
|
62911
|
-
continue;
|
|
62912
|
-
}
|
|
62913
|
-
}
|
|
62914
62890
|
const encrypted = session.ratchet.encrypt(plaintext);
|
|
62915
62891
|
const transport = encryptedMessageToTransport(encrypted);
|
|
62916
62892
|
const msg = {
|
|
@@ -63195,13 +63171,7 @@ var init_channel = __esm({
|
|
|
63195
63171
|
if (initRes.ok) {
|
|
63196
63172
|
const groupData = await initRes.json();
|
|
63197
63173
|
mlsRoom.mlsGroupId = groupData.group_id;
|
|
63198
|
-
|
|
63199
|
-
const identity2 = new TextEncoder().encode(this._deviceId);
|
|
63200
|
-
const kp = await mgr.generateKeyPackage(identity2);
|
|
63201
|
-
await mgr.createGroup(new TextEncoder().encode(groupData.group_id), kp);
|
|
63202
|
-
this._mlsGroups.set(roomData.roomId, mgr);
|
|
63203
|
-
await saveMlsState(this.config.dataDir, groupData.group_id, JSON.stringify(mgr.exportState()));
|
|
63204
|
-
console.log(`[SecureChannel] MLS group created for room ${roomData.roomId.slice(0, 8)} (groupId=${groupData.group_id.slice(0, 8)})`);
|
|
63174
|
+
console.log(`[SecureChannel] MLS room ${roomData.roomId.slice(0, 8)} registered (groupId=${groupData.group_id.slice(0, 8)}, awaiting Welcome from owner)`);
|
|
63205
63175
|
}
|
|
63206
63176
|
} catch (mlsInitErr) {
|
|
63207
63177
|
console.error(`[SecureChannel] MLS room init failed:`, mlsInitErr);
|
|
@@ -64733,22 +64703,9 @@ var init_channel = __esm({
|
|
|
64733
64703
|
const entry = this._persisted.a2aChannels?.[channelId];
|
|
64734
64704
|
if (entry) {
|
|
64735
64705
|
entry.mlsGroupId = mlsData.group_id;
|
|
64736
|
-
const mgr = new MLSGroupManager();
|
|
64737
|
-
const identity = new TextEncoder().encode(this._deviceId);
|
|
64738
|
-
const kp = await mgr.generateKeyPackage(identity);
|
|
64739
|
-
await mgr.createGroup(
|
|
64740
|
-
new TextEncoder().encode(mlsData.group_id),
|
|
64741
|
-
kp
|
|
64742
|
-
);
|
|
64743
|
-
this._mlsGroups.set(`a2a:${channelId}`, mgr);
|
|
64744
|
-
await saveMlsState(
|
|
64745
|
-
this.config.dataDir,
|
|
64746
|
-
mlsData.group_id,
|
|
64747
|
-
JSON.stringify(mgr.exportState())
|
|
64748
|
-
);
|
|
64749
64706
|
await this._persistState();
|
|
64750
64707
|
console.log(
|
|
64751
|
-
`[SecureChannel]
|
|
64708
|
+
`[SecureChannel] A2A ${channelId.slice(0, 8)} MLS registered (groupId=${mlsData.group_id.slice(0, 8)}, awaiting Welcome)`
|
|
64752
64709
|
);
|
|
64753
64710
|
}
|
|
64754
64711
|
}
|
|
@@ -65945,14 +65902,36 @@ ${messageText}`;
|
|
|
65945
65902
|
return;
|
|
65946
65903
|
}
|
|
65947
65904
|
}
|
|
65905
|
+
const a2aChannelId = data.a2a_channel_id;
|
|
65948
65906
|
for (const [channelId, entry] of Object.entries(this._persisted?.a2aChannels ?? {})) {
|
|
65949
|
-
if (entry.mlsGroupId === groupId) {
|
|
65907
|
+
if (entry.mlsGroupId === groupId || channelId === a2aChannelId) {
|
|
65908
|
+
entry.mlsGroupId = groupId;
|
|
65950
65909
|
this._mlsGroups.set(`a2a:${channelId}`, mgr);
|
|
65951
65910
|
await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mgr.exportState()));
|
|
65911
|
+
await this._persistState();
|
|
65952
65912
|
console.log(`[SecureChannel] Joined MLS group for A2A ${channelId.slice(0, 8)} via Welcome (epoch=${mgr.epoch})`);
|
|
65953
65913
|
return;
|
|
65954
65914
|
}
|
|
65955
65915
|
}
|
|
65916
|
+
if (a2aChannelId && this._persisted) {
|
|
65917
|
+
if (!this._persisted.a2aChannels) this._persisted.a2aChannels = {};
|
|
65918
|
+
if (!this._persisted.a2aChannels[a2aChannelId]) {
|
|
65919
|
+
this._persisted.a2aChannels[a2aChannelId] = {
|
|
65920
|
+
channelId: a2aChannelId,
|
|
65921
|
+
hubAddress: "",
|
|
65922
|
+
conversationId: "",
|
|
65923
|
+
mlsGroupId: groupId
|
|
65924
|
+
};
|
|
65925
|
+
} else {
|
|
65926
|
+
this._persisted.a2aChannels[a2aChannelId].mlsGroupId = groupId;
|
|
65927
|
+
}
|
|
65928
|
+
this._mlsGroups.set(`a2a:${a2aChannelId}`, mgr);
|
|
65929
|
+
await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mgr.exportState()));
|
|
65930
|
+
await this._persistState();
|
|
65931
|
+
console.log(`[SecureChannel] Joined MLS group for A2A ${a2aChannelId.slice(0, 8)} via Welcome (new channel, epoch=${mgr.epoch})`);
|
|
65932
|
+
return;
|
|
65933
|
+
}
|
|
65934
|
+
console.warn(`[SecureChannel] MLS welcome for unmatched group ${groupId?.slice(0, 8)} (no room/A2A/conv match)`);
|
|
65956
65935
|
} catch (err) {
|
|
65957
65936
|
console.error(`[SecureChannel] MLS welcome processing failed:`, err);
|
|
65958
65937
|
}
|