@agentvault/agentvault 0.9.3 → 0.9.5
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 +2 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +78 -21
- package/dist/cli.js.map +2 -2
- package/dist/index.js +78 -21
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/channel.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare class SecureChannel extends EventEmitter {
|
|
|
27
27
|
private _lastWakeTick;
|
|
28
28
|
private _pendingPollTimer;
|
|
29
29
|
private _syncMessageIds;
|
|
30
|
+
/** Recently handled message IDs via WS — survives reconnects so sync skips them. Max 500. */
|
|
31
|
+
private _recentlyHandledIds;
|
|
30
32
|
/** Queued A2A messages for responder channels not yet activated (no first initiator message received). */
|
|
31
33
|
private _a2aPendingQueue;
|
|
32
34
|
private _scanEngine;
|
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqB3C,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAMZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,QAAQ,EAER,UAAU,EAEX,MAAM,YAAY,CAAC;AAoDpB,qBAAa,aAAc,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqB3C,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAMZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,QAAQ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IAmH1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IAKpB;;;OAGG;YACW,aAAa;CAmB5B"}
|
package/dist/cli.js
CHANGED
|
@@ -45393,6 +45393,8 @@ var init_channel = __esm({
|
|
|
45393
45393
|
_lastWakeTick = Date.now();
|
|
45394
45394
|
_pendingPollTimer = null;
|
|
45395
45395
|
_syncMessageIds = null;
|
|
45396
|
+
/** Recently handled message IDs via WS — survives reconnects so sync skips them. Max 500. */
|
|
45397
|
+
_recentlyHandledIds = /* @__PURE__ */ new Set();
|
|
45396
45398
|
/** Queued A2A messages for responder channels not yet activated (no first initiator message received). */
|
|
45397
45399
|
_a2aPendingQueue = {};
|
|
45398
45400
|
_scanEngine = null;
|
|
@@ -46498,6 +46500,20 @@ var init_channel = __esm({
|
|
|
46498
46500
|
this.emit("error", openErr);
|
|
46499
46501
|
}
|
|
46500
46502
|
});
|
|
46503
|
+
const _onUnhandledRejection = (reason) => {
|
|
46504
|
+
console.error("[SecureChannel] UNHANDLED REJECTION (would crash process):", reason);
|
|
46505
|
+
};
|
|
46506
|
+
const _onUncaughtException = (err) => {
|
|
46507
|
+
console.error("[SecureChannel] UNCAUGHT EXCEPTION (would crash process):", err);
|
|
46508
|
+
};
|
|
46509
|
+
process.on("unhandledRejection", _onUnhandledRejection);
|
|
46510
|
+
process.on("uncaughtException", _onUncaughtException);
|
|
46511
|
+
ws.on("close", (code, reason) => {
|
|
46512
|
+
const reasonStr = reason?.toString() || "";
|
|
46513
|
+
console.log(`[SecureChannel] WS CLOSED: code=${code} reason=${JSON.stringify(reasonStr)}`);
|
|
46514
|
+
process.removeListener("unhandledRejection", _onUnhandledRejection);
|
|
46515
|
+
process.removeListener("uncaughtException", _onUncaughtException);
|
|
46516
|
+
});
|
|
46501
46517
|
ws.on("message", async (raw) => {
|
|
46502
46518
|
this._lastServerMessage = Date.now();
|
|
46503
46519
|
this._lastWakeTick = Date.now();
|
|
@@ -46517,8 +46533,10 @@ var init_channel = __esm({
|
|
|
46517
46533
|
return;
|
|
46518
46534
|
}
|
|
46519
46535
|
if (data.event === "message") {
|
|
46536
|
+
console.log(`[SecureChannel] \u2190 Direct message received: msg=${data.data?.message_id?.slice(0, 8) ?? "?"} conv=${data.data?.conversation_id?.slice(0, 8) ?? "?"}`);
|
|
46520
46537
|
try {
|
|
46521
46538
|
await this._handleIncomingMessage(data.data);
|
|
46539
|
+
console.log(`[SecureChannel] \u2190 Direct message processed OK: msg=${data.data?.message_id?.slice(0, 8) ?? "?"}`);
|
|
46522
46540
|
} catch (msgErr) {
|
|
46523
46541
|
console.error(
|
|
46524
46542
|
`[SecureChannel] Message handler failed for conv ${data.data?.conversation_id?.slice(0, 8) ?? "?"}...:`,
|
|
@@ -46850,7 +46868,9 @@ var init_channel = __esm({
|
|
|
46850
46868
|
this.emit("error", err);
|
|
46851
46869
|
}
|
|
46852
46870
|
});
|
|
46853
|
-
ws.on("close", () => {
|
|
46871
|
+
ws.on("close", (code, reason) => {
|
|
46872
|
+
const reasonStr = reason?.toString() || "";
|
|
46873
|
+
console.log(`[SecureChannel] WS close handler: code=${code} reason=${JSON.stringify(reasonStr)}`);
|
|
46854
46874
|
this._stopPing();
|
|
46855
46875
|
this._stopWakeDetector();
|
|
46856
46876
|
this._stopPendingPoll();
|
|
@@ -46872,6 +46892,11 @@ var init_channel = __esm({
|
|
|
46872
46892
|
if (this._syncMessageIds?.has(msgData.message_id)) {
|
|
46873
46893
|
return;
|
|
46874
46894
|
}
|
|
46895
|
+
this._recentlyHandledIds.add(msgData.message_id);
|
|
46896
|
+
if (this._recentlyHandledIds.size > 500) {
|
|
46897
|
+
const all = [...this._recentlyHandledIds];
|
|
46898
|
+
this._recentlyHandledIds = new Set(all.slice(all.length - 400));
|
|
46899
|
+
}
|
|
46875
46900
|
const convId = msgData.conversation_id;
|
|
46876
46901
|
const session = this._sessions.get(convId);
|
|
46877
46902
|
if (!session) {
|
|
@@ -46884,7 +46909,14 @@ var init_channel = __esm({
|
|
|
46884
46909
|
header_blob: msgData.header_blob,
|
|
46885
46910
|
ciphertext: msgData.ciphertext
|
|
46886
46911
|
});
|
|
46887
|
-
|
|
46912
|
+
let plaintext;
|
|
46913
|
+
try {
|
|
46914
|
+
plaintext = session.ratchet.decrypt(encrypted);
|
|
46915
|
+
} catch (decryptErr) {
|
|
46916
|
+
console.error(`[SecureChannel] Direct message decrypt FAILED for conv ${convId.slice(0, 8)}...: ${String(decryptErr)}`);
|
|
46917
|
+
throw decryptErr;
|
|
46918
|
+
}
|
|
46919
|
+
console.log(`[SecureChannel] Direct message decrypted OK for conv ${convId.slice(0, 8)}...`);
|
|
46888
46920
|
this._sendAck(msgData.message_id);
|
|
46889
46921
|
if (!session.activated) {
|
|
46890
46922
|
session.activated = true;
|
|
@@ -46977,7 +47009,13 @@ ${messageText}`;
|
|
|
46977
47009
|
Promise.resolve(this.config.onMessage?.(emitText, metadata)).catch((err) => {
|
|
46978
47010
|
console.error("[SecureChannel] onMessage callback error:", err);
|
|
46979
47011
|
});
|
|
46980
|
-
|
|
47012
|
+
console.log(`[SecureChannel] Relaying sync to ${this._sessions.size - 1} siblings for conv ${convId.slice(0, 8)}...`);
|
|
47013
|
+
try {
|
|
47014
|
+
await this._relaySyncToSiblings(convId, session.ownerDeviceId, messageText, topicId);
|
|
47015
|
+
console.log(`[SecureChannel] Sync relay complete for conv ${convId.slice(0, 8)}...`);
|
|
47016
|
+
} catch (relayErr) {
|
|
47017
|
+
console.error(`[SecureChannel] Sync relay FAILED: ${String(relayErr)}`);
|
|
47018
|
+
}
|
|
46981
47019
|
}
|
|
46982
47020
|
if (this._persisted) {
|
|
46983
47021
|
this._persisted.lastMessageTimestamp = msgData.created_at;
|
|
@@ -47102,22 +47140,29 @@ ${messageText}`;
|
|
|
47102
47140
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
47103
47141
|
topicId
|
|
47104
47142
|
});
|
|
47143
|
+
let relayed = 0;
|
|
47105
47144
|
for (const [siblingConvId, siblingSession] of this._sessions) {
|
|
47106
47145
|
if (siblingConvId === sourceConvId) continue;
|
|
47107
47146
|
if (!siblingSession.activated) continue;
|
|
47108
|
-
|
|
47109
|
-
|
|
47110
|
-
|
|
47111
|
-
|
|
47112
|
-
|
|
47113
|
-
|
|
47114
|
-
|
|
47115
|
-
|
|
47116
|
-
|
|
47117
|
-
|
|
47118
|
-
|
|
47119
|
-
|
|
47147
|
+
try {
|
|
47148
|
+
const syncEncrypted = siblingSession.ratchet.encrypt(syncPayload);
|
|
47149
|
+
const syncTransport = encryptedMessageToTransport(syncEncrypted);
|
|
47150
|
+
this._ws.send(
|
|
47151
|
+
JSON.stringify({
|
|
47152
|
+
event: "message",
|
|
47153
|
+
data: {
|
|
47154
|
+
conversation_id: siblingConvId,
|
|
47155
|
+
header_blob: syncTransport.header_blob,
|
|
47156
|
+
ciphertext: syncTransport.ciphertext
|
|
47157
|
+
}
|
|
47158
|
+
})
|
|
47159
|
+
);
|
|
47160
|
+
relayed++;
|
|
47161
|
+
} catch (err) {
|
|
47162
|
+
console.error(`[SecureChannel] Sync send failed for sibling ${siblingConvId.slice(0, 8)}...: ${String(err)}`);
|
|
47163
|
+
}
|
|
47120
47164
|
}
|
|
47165
|
+
console.log(`[SecureChannel] _relaySyncToSiblings: relayed to ${relayed}/${this._sessions.size - 1} siblings`);
|
|
47121
47166
|
}
|
|
47122
47167
|
/**
|
|
47123
47168
|
* Send stored message history to a newly-activated session.
|
|
@@ -47354,6 +47399,7 @@ ${messageText}`;
|
|
|
47354
47399
|
const PAGE_SIZE = 200;
|
|
47355
47400
|
let since = this._persisted.lastMessageTimestamp;
|
|
47356
47401
|
let totalProcessed = 0;
|
|
47402
|
+
let totalSkipped = 0;
|
|
47357
47403
|
try {
|
|
47358
47404
|
for (let page = 0; page < MAX_PAGES; page++) {
|
|
47359
47405
|
const url = `${this.config.apiUrl}/api/v1/devices/${this._deviceId}/messages?since=${encodeURIComponent(since)}&limit=${PAGE_SIZE}`;
|
|
@@ -47363,15 +47409,24 @@ ${messageText}`;
|
|
|
47363
47409
|
if (!res.ok) break;
|
|
47364
47410
|
const messages = await res.json();
|
|
47365
47411
|
if (messages.length === 0) break;
|
|
47412
|
+
console.log(`[SecureChannel] Sync page ${page}: ${messages.length} messages since ${since}`);
|
|
47366
47413
|
for (const msg of messages) {
|
|
47367
47414
|
if (msg.sender_device_id === this._deviceId) continue;
|
|
47368
47415
|
if (this._syncMessageIds.has(msg.id)) continue;
|
|
47369
47416
|
this._syncMessageIds.add(msg.id);
|
|
47417
|
+
if (this._recentlyHandledIds.has(msg.id)) {
|
|
47418
|
+
this._persisted.lastMessageTimestamp = msg.created_at;
|
|
47419
|
+
since = msg.created_at;
|
|
47420
|
+
totalSkipped++;
|
|
47421
|
+
continue;
|
|
47422
|
+
}
|
|
47370
47423
|
const session = this._sessions.get(msg.conversation_id);
|
|
47371
47424
|
if (!session) {
|
|
47372
47425
|
console.warn(
|
|
47373
47426
|
`[SecureChannel] No session for conversation ${msg.conversation_id} during sync, skipping`
|
|
47374
47427
|
);
|
|
47428
|
+
this._persisted.lastMessageTimestamp = msg.created_at;
|
|
47429
|
+
since = msg.created_at;
|
|
47375
47430
|
continue;
|
|
47376
47431
|
}
|
|
47377
47432
|
try {
|
|
@@ -47405,9 +47460,6 @@ ${messageText}`;
|
|
|
47405
47460
|
topicId
|
|
47406
47461
|
};
|
|
47407
47462
|
this.emit("message", messageText, metadata);
|
|
47408
|
-
Promise.resolve(this.config.onMessage?.(messageText, metadata)).catch((err) => {
|
|
47409
|
-
console.error("[SecureChannel] onMessage callback error:", err);
|
|
47410
|
-
});
|
|
47411
47463
|
}
|
|
47412
47464
|
this._persisted.lastMessageTimestamp = msg.created_at;
|
|
47413
47465
|
since = msg.created_at;
|
|
@@ -47424,10 +47476,15 @@ ${messageText}`;
|
|
|
47424
47476
|
await this._persistState();
|
|
47425
47477
|
if (messages.length < PAGE_SIZE) break;
|
|
47426
47478
|
}
|
|
47427
|
-
if (totalProcessed > 0) {
|
|
47428
|
-
console.log(`[SecureChannel]
|
|
47479
|
+
if (totalProcessed > 0 || totalSkipped > 0) {
|
|
47480
|
+
console.log(`[SecureChannel] Sync complete: ${totalProcessed} processed, ${totalSkipped} skipped (already handled via WS)`);
|
|
47481
|
+
}
|
|
47482
|
+
} catch (outerErr) {
|
|
47483
|
+
console.warn(`[SecureChannel] Sync interrupted: ${String(outerErr)}`);
|
|
47484
|
+
try {
|
|
47485
|
+
await this._persistState();
|
|
47486
|
+
} catch {
|
|
47429
47487
|
}
|
|
47430
|
-
} catch {
|
|
47431
47488
|
}
|
|
47432
47489
|
this._syncMessageIds = null;
|
|
47433
47490
|
}
|