@agentvault/agentvault 0.19.2 → 0.19.4
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 +6 -1
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +53 -0
- package/dist/cli.js.map +2 -2
- package/dist/index.js +53 -0
- package/dist/index.js.map +2 -2
- package/dist/openclaw-entry.d.ts.map +1 -1
- package/dist/openclaw-entry.js +20 -1
- package/dist/openclaw-entry.js.map +3 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47330,6 +47330,15 @@ var init_channel = __esm({
|
|
|
47330
47330
|
this._persisted.messageHistory = this._persisted.messageHistory.slice(-maxSize);
|
|
47331
47331
|
}
|
|
47332
47332
|
}
|
|
47333
|
+
/**
|
|
47334
|
+
* Get recent message history for a specific room, for LLM context injection.
|
|
47335
|
+
* Returns the last N messages tagged with `room:{roomId}`.
|
|
47336
|
+
*/
|
|
47337
|
+
getRoomHistory(roomId, maxMessages = 20) {
|
|
47338
|
+
const history = this._persisted?.messageHistory ?? [];
|
|
47339
|
+
const tag = `room:${roomId}`;
|
|
47340
|
+
return history.filter((e) => e.topicId === tag).slice(-maxMessages);
|
|
47341
|
+
}
|
|
47333
47342
|
/**
|
|
47334
47343
|
* Encrypt and send a message to ALL owner devices (fanout).
|
|
47335
47344
|
* Each session gets the same plaintext encrypted independently.
|
|
@@ -47654,6 +47663,10 @@ var init_channel = __esm({
|
|
|
47654
47663
|
if (!this._persisted?.rooms?.[roomId]) {
|
|
47655
47664
|
throw new Error(`Room ${roomId} not found`);
|
|
47656
47665
|
}
|
|
47666
|
+
const msgType = opts?.messageType ?? "text";
|
|
47667
|
+
if (msgType === "text" && plaintext) {
|
|
47668
|
+
this._appendHistory("agent", plaintext, `room:${roomId}`);
|
|
47669
|
+
}
|
|
47657
47670
|
Promise.resolve().then(() => (init_openclaw_compat(), openclaw_compat_exports)).then(({ requestHeartbeatNow: requestHeartbeatNow2 }) => requestHeartbeatNow2({ reason: "channel-sendToRoom" })).catch(() => {
|
|
47658
47671
|
});
|
|
47659
47672
|
const room = this._persisted.rooms[roomId];
|
|
@@ -49164,6 +49177,38 @@ var init_channel = __esm({
|
|
|
49164
49177
|
console.log(
|
|
49165
49178
|
`[SecureChannel] Observer ratchet initialized for channel ${obsAccChannelId.slice(0, 8)}... (side=${obsAccSide})`
|
|
49166
49179
|
);
|
|
49180
|
+
try {
|
|
49181
|
+
const seedText = JSON.stringify({ type: "observer_seed", text: "" });
|
|
49182
|
+
const seedEncrypted = obsRatchet.encrypt(seedText);
|
|
49183
|
+
const seedHeaderObj = {
|
|
49184
|
+
dhPublicKey: bytesToHex(seedEncrypted.header.dhPublicKey),
|
|
49185
|
+
previousChainLength: seedEncrypted.header.previousChainLength,
|
|
49186
|
+
messageNumber: seedEncrypted.header.messageNumber
|
|
49187
|
+
};
|
|
49188
|
+
obsAccEntry.observerSession.ratchetState = obsRatchet.serialize();
|
|
49189
|
+
await this._persistState();
|
|
49190
|
+
if (this._ws && obsAccEntry.conversationId) {
|
|
49191
|
+
this._ws.send(JSON.stringify({
|
|
49192
|
+
event: "a2a_message",
|
|
49193
|
+
data: {
|
|
49194
|
+
conversation_id: obsAccEntry.conversationId,
|
|
49195
|
+
channel_id: obsAccChannelId,
|
|
49196
|
+
// Dummy A2A payload (plaintext, won't relay to peer)
|
|
49197
|
+
text: "",
|
|
49198
|
+
message_type: "observer_seed",
|
|
49199
|
+
// Observer copy is the real payload
|
|
49200
|
+
observer_header_blob: Buffer.from(JSON.stringify(seedHeaderObj)).toString("hex"),
|
|
49201
|
+
observer_ciphertext: bytesToHex(seedEncrypted.ciphertext),
|
|
49202
|
+
observer_nonce: bytesToHex(seedEncrypted.nonce)
|
|
49203
|
+
}
|
|
49204
|
+
}));
|
|
49205
|
+
console.log(
|
|
49206
|
+
`[SecureChannel] Observer seed message sent for channel ${obsAccChannelId.slice(0, 8)}...`
|
|
49207
|
+
);
|
|
49208
|
+
}
|
|
49209
|
+
} catch (seedErr) {
|
|
49210
|
+
console.error("[SecureChannel] Observer seed message failed:", seedErr);
|
|
49211
|
+
}
|
|
49167
49212
|
} catch (err) {
|
|
49168
49213
|
console.error("[SecureChannel] Observer ratchet init failed:", err);
|
|
49169
49214
|
}
|
|
@@ -50048,6 +50093,7 @@ ${messageText}`;
|
|
|
50048
50093
|
senderDeviceId: msgData.sender_device_id,
|
|
50049
50094
|
roomName: this._persisted?.rooms?.[msgData.room_id]?.name
|
|
50050
50095
|
};
|
|
50096
|
+
this._appendHistory("owner", messageText, `room:${msgData.room_id}`);
|
|
50051
50097
|
this.emit("room_message", {
|
|
50052
50098
|
roomId: msgData.room_id,
|
|
50053
50099
|
senderDeviceId: msgData.sender_device_id,
|
|
@@ -50336,6 +50382,7 @@ ${messageText}`;
|
|
|
50336
50382
|
senderDeviceId: msgData.sender_device_id,
|
|
50337
50383
|
roomName: this._persisted?.rooms?.[msgData.room_id]?.name
|
|
50338
50384
|
};
|
|
50385
|
+
this._appendHistory("owner", messageText, `room:${msgData.room_id}`);
|
|
50339
50386
|
this.emit("room_message", {
|
|
50340
50387
|
roomId: msgData.room_id,
|
|
50341
50388
|
senderDeviceId: msgData.sender_device_id,
|
|
@@ -50374,7 +50421,13 @@ ${messageText}`;
|
|
|
50374
50421
|
for (const msg of messages) {
|
|
50375
50422
|
if (msg.sender_device_id === this._deviceId) continue;
|
|
50376
50423
|
if (this._syncMessageIds.has(msg.id)) continue;
|
|
50424
|
+
if (this._seenMessageIds.has(msg.id)) continue;
|
|
50377
50425
|
this._syncMessageIds.add(msg.id);
|
|
50426
|
+
if (this._seenMessageIds.size >= _SecureChannel.SEEN_MSG_MAX) {
|
|
50427
|
+
const first = this._seenMessageIds.values().next().value;
|
|
50428
|
+
if (first) this._seenMessageIds.delete(first);
|
|
50429
|
+
}
|
|
50430
|
+
this._seenMessageIds.add(msg.id);
|
|
50378
50431
|
let roomId = msg.room_id;
|
|
50379
50432
|
if (!roomId && this._persisted?.rooms) {
|
|
50380
50433
|
for (const room of Object.values(this._persisted.rooms)) {
|