@agentvault/agentvault 0.20.35 → 0.20.37
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/cli.js +98 -1
- package/dist/cli.js.map +2 -2
- package/dist/index.js +98 -1
- package/dist/index.js.map +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64140,6 +64140,39 @@ var init_channel = __esm({
|
|
|
64140
64140
|
console.error(`[SecureChannel] send() failed for conv ${convId.slice(0, 8)}...:`, err);
|
|
64141
64141
|
}
|
|
64142
64142
|
}
|
|
64143
|
+
if (this._persisted?.mlsConversations && this._state === "ready" && this._ws) {
|
|
64144
|
+
for (const [mlsConvId, entry] of Object.entries(this._persisted.mlsConversations)) {
|
|
64145
|
+
if (targetConvId && mlsConvId !== targetConvId) continue;
|
|
64146
|
+
if (this._sessions.has(mlsConvId)) continue;
|
|
64147
|
+
if (roomConvIds.has(mlsConvId)) continue;
|
|
64148
|
+
const mlsGroup = this._mlsGroups.get(`conv:${mlsConvId}`);
|
|
64149
|
+
if (!mlsGroup?.isInitialized || !entry.mlsGroupId || Number(mlsGroup.epoch) <= 0) continue;
|
|
64150
|
+
try {
|
|
64151
|
+
const plaintextBytes = new TextEncoder().encode(plaintext);
|
|
64152
|
+
const cipherBytes = await mlsGroup.encrypt(plaintextBytes);
|
|
64153
|
+
await saveMlsState(this.config.dataDir, entry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
|
|
64154
|
+
const payload = {
|
|
64155
|
+
conversation_id: mlsConvId,
|
|
64156
|
+
group_id: entry.mlsGroupId,
|
|
64157
|
+
epoch: Number(mlsGroup.epoch),
|
|
64158
|
+
payload: Buffer.from(cipherBytes).toString("hex"),
|
|
64159
|
+
topic_id: topicId,
|
|
64160
|
+
client_message_id: clientMessageId,
|
|
64161
|
+
message_type: messageType,
|
|
64162
|
+
priority,
|
|
64163
|
+
parent_span_id: parentSpanId,
|
|
64164
|
+
metadata: envelopeMetadata
|
|
64165
|
+
};
|
|
64166
|
+
if (this._persisted?.hubAddress) payload.hub_address = this._persisted.hubAddress;
|
|
64167
|
+
if (this._persisted?.hubId) payload.sender_hub_id = this._persisted.hubId;
|
|
64168
|
+
pendingWsSends.push(JSON.stringify({ event: "message_mls", data: payload }));
|
|
64169
|
+
sentCount++;
|
|
64170
|
+
console.log(`[SecureChannel] MLS-only send for conv ${mlsConvId.slice(0, 8)} (no DR session)`);
|
|
64171
|
+
} catch (err) {
|
|
64172
|
+
console.error(`[SecureChannel] MLS-only send failed for conv ${mlsConvId.slice(0, 8)}:`, err);
|
|
64173
|
+
}
|
|
64174
|
+
}
|
|
64175
|
+
}
|
|
64143
64176
|
if (sentCount === 0 && this._sessions.size > 0) {
|
|
64144
64177
|
console.warn("[SecureChannel] send() delivered to 0 sessions (all skipped or failed)");
|
|
64145
64178
|
}
|
|
@@ -67588,6 +67621,70 @@ ${messageText}`;
|
|
|
67588
67621
|
} catch {
|
|
67589
67622
|
}
|
|
67590
67623
|
}
|
|
67624
|
+
for (const [convId, convEntry] of Object.entries(this._persisted?.mlsConversations ?? {})) {
|
|
67625
|
+
if (!convEntry.mlsGroupId) continue;
|
|
67626
|
+
const mlsGroup = this._mlsGroups.get(`conv:${convId}`);
|
|
67627
|
+
if (!mlsGroup?.isInitialized) continue;
|
|
67628
|
+
try {
|
|
67629
|
+
const pendingRes = await fetch(
|
|
67630
|
+
`${this.config.apiUrl}/api/v1/mls/groups/${convEntry.mlsGroupId}/pending-welcomes`,
|
|
67631
|
+
{ headers: { Authorization: `Bearer ${this._deviceJwt}` } }
|
|
67632
|
+
);
|
|
67633
|
+
if (!pendingRes.ok) continue;
|
|
67634
|
+
const pending = await pendingRes.json();
|
|
67635
|
+
if (pending.length === 0) continue;
|
|
67636
|
+
console.log(`[SecureChannel] ${pending.length} pending Welcome requests for conv ${convId.slice(0, 8)}`);
|
|
67637
|
+
for (const req of pending) {
|
|
67638
|
+
try {
|
|
67639
|
+
const kpRes = await fetch(
|
|
67640
|
+
`${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${req.requesting_device_id}`,
|
|
67641
|
+
{ headers: { Authorization: `Bearer ${this._deviceJwt}` } }
|
|
67642
|
+
);
|
|
67643
|
+
if (!kpRes.ok) continue;
|
|
67644
|
+
const kpData = await kpRes.json();
|
|
67645
|
+
const kpHex = kpData[req.requesting_device_id];
|
|
67646
|
+
if (!kpHex) continue;
|
|
67647
|
+
const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
|
|
67648
|
+
const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
|
|
67649
|
+
const { commit, welcome } = await mlsGroup.addMembers([memberKp]);
|
|
67650
|
+
if (this._ws) {
|
|
67651
|
+
this._ws.send(JSON.stringify({
|
|
67652
|
+
event: "mls_commit",
|
|
67653
|
+
data: {
|
|
67654
|
+
group_id: convEntry.mlsGroupId,
|
|
67655
|
+
epoch: Number(mlsGroup.epoch),
|
|
67656
|
+
payload: Buffer.from(commit).toString("hex")
|
|
67657
|
+
}
|
|
67658
|
+
}));
|
|
67659
|
+
}
|
|
67660
|
+
if (welcome && this._ws) {
|
|
67661
|
+
this._ws.send(JSON.stringify({
|
|
67662
|
+
event: "mls_welcome",
|
|
67663
|
+
data: {
|
|
67664
|
+
target_device_id: req.requesting_device_id,
|
|
67665
|
+
group_id: convEntry.mlsGroupId,
|
|
67666
|
+
conversation_id: convId,
|
|
67667
|
+
payload: Buffer.from(welcome).toString("hex")
|
|
67668
|
+
}
|
|
67669
|
+
}));
|
|
67670
|
+
}
|
|
67671
|
+
await fetch(
|
|
67672
|
+
`${this.config.apiUrl}/api/v1/mls/groups/${convEntry.mlsGroupId}/fulfill-welcome`,
|
|
67673
|
+
{
|
|
67674
|
+
method: "POST",
|
|
67675
|
+
headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
|
|
67676
|
+
body: JSON.stringify({ request_id: req.id })
|
|
67677
|
+
}
|
|
67678
|
+
);
|
|
67679
|
+
await saveMlsState(this.config.dataDir, convEntry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
|
|
67680
|
+
console.log(`[SecureChannel] Fulfilled Welcome for ${req.requesting_device_id.slice(0, 8)} in conv ${convId.slice(0, 8)}`);
|
|
67681
|
+
} catch (fulfillErr) {
|
|
67682
|
+
console.warn(`[SecureChannel] Conv Welcome fulfill failed for ${req.requesting_device_id.slice(0, 8)}:`, fulfillErr);
|
|
67683
|
+
}
|
|
67684
|
+
}
|
|
67685
|
+
} catch {
|
|
67686
|
+
}
|
|
67687
|
+
}
|
|
67591
67688
|
for (const [chId, chState] of Object.entries(this._persisted?.a2aChannels ?? {})) {
|
|
67592
67689
|
if (!chState.mlsGroupId && chState.role === "creator") {
|
|
67593
67690
|
try {
|
|
@@ -95196,7 +95293,7 @@ var init_index = __esm({
|
|
|
95196
95293
|
init_skill_invoker();
|
|
95197
95294
|
await init_skill_telemetry();
|
|
95198
95295
|
await init_policy_enforcer();
|
|
95199
|
-
VERSION = true ? "0.20.
|
|
95296
|
+
VERSION = true ? "0.20.37" : "0.0.0-dev";
|
|
95200
95297
|
}
|
|
95201
95298
|
});
|
|
95202
95299
|
await init_index();
|