@agentvault/grok-bridge 0.4.6 → 0.4.8

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51699,11 +51699,6 @@ var init_clientConfig = __esm2({
51699
51699
  };
51700
51700
  }
51701
51701
  });
51702
- function arraysEqual(a2, b2) {
51703
- if (a2.length !== b2.length)
51704
- return false;
51705
- return a2.every((val, index) => val === b2[index]);
51706
- }
51707
51702
  var init_array = __esm2({
51708
51703
  "../crypto/node_modules/ts-mls/dist/src/util/array.js"() {
51709
51704
  }
@@ -51891,7 +51886,7 @@ async function validateRatchetTree(tree, groupContext, config2, authService, tre
51891
51886
  if (dpNode !== void 0) {
51892
51887
  if (dpNode.nodeType !== "parent")
51893
51888
  return new InternalError("Expected parent node");
51894
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n2.parent.unmergedLeaves))
51889
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
51895
51890
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
51896
51891
  }
51897
51892
  }
@@ -64605,11 +64600,11 @@ var init_mls_kp_pool = __esm2({
64605
64600
  }
64606
64601
  });
64607
64602
  function ownIdentity() {
64608
- const v2 = true ? "0.23.33" : FALLBACK;
64603
+ const v2 = true ? "0.23.35" : FALLBACK;
64609
64604
  return `${PACKAGE}@${v2}`;
64610
64605
  }
64611
64606
  function buildSha() {
64612
- const raw = true ? "7b91f2f-dirty" : "";
64607
+ const raw = true ? "bcb9297-dirty" : "";
64613
64608
  const cleaned = (raw ?? "").trim();
64614
64609
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64615
64610
  }
@@ -66807,7 +66802,7 @@ var init_channel = __esm2({
66807
66802
  */
66808
66803
  sendActivitySpan(spanData) {
66809
66804
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66810
- const pluginVersion = true ? "0.23.33" : "0.0.0-dev";
66805
+ const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
66811
66806
  const agentName = this.config.agentName ?? "Agent";
66812
66807
  const resource = {
66813
66808
  "service.name": "agentvault-agent",
@@ -68745,7 +68740,7 @@ var init_channel = __esm2({
68745
68740
  agentVersion: this.config.agentVersion ?? "0.0.0",
68746
68741
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68747
68742
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68748
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
68743
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
68749
68744
  });
68750
68745
  this._telemetryReporter.startAutoFlush(3e4);
68751
68746
  }
@@ -69069,7 +69064,7 @@ var init_channel = __esm2({
69069
69064
  agentVersion: this.config.agentVersion ?? "0.0.0",
69070
69065
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69071
69066
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69072
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
69067
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
69073
69068
  });
69074
69069
  this._telemetryReporter.startAutoFlush(3e4);
69075
69070
  }
@@ -69473,6 +69468,7 @@ var init_channel = __esm2({
69473
69468
  try {
69474
69469
  const cipherBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
69475
69470
  const result = await mgr.decrypt(cipherBytes);
69471
+ if (mgrKey) this._mlsDecryptFailCounts.delete(mgrKey);
69476
69472
  const mlsGroupId = (convGroupId ? this._persisted?.mlsGroups?.[convGroupId]?.mlsGroupId : null) ?? this._persisted?.mlsConversations?.[convId]?.mlsGroupId ?? groupId;
69477
69473
  if (mlsGroupId) {
69478
69474
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mgr.exportState()));
@@ -69577,6 +69573,10 @@ var init_channel = __esm2({
69577
69573
  this.config.onMessage(text, metadata);
69578
69574
  }
69579
69575
  } catch (decryptErr) {
69576
+ if (classifyCommitFailure(data.epoch, mgr?.epoch) === "already-applied") {
69577
+ console.debug(`[SecureChannel] MLS 1:1 message at epoch ${String(data.epoch)} predates our epoch ${String(mgr?.epoch)} \u2014 cannot decrypt, ignoring`);
69578
+ return;
69579
+ }
69580
69580
  const failKey = mgrKey || `unknown:${groupId}`;
69581
69581
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
69582
69582
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -70418,6 +70418,7 @@ ${baseText}`;
70418
70418
  try {
70419
70419
  const ciphertext = Buffer.from(data.payload, "hex");
70420
70420
  const result = await mlsGroup.decrypt(new Uint8Array(ciphertext));
70421
+ this._mlsDecryptFailCounts.delete(resolvedRoomId);
70421
70422
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
70422
70423
  if (result.isHandshake || !result.plaintext) {
70423
70424
  return;
@@ -70507,6 +70508,10 @@ ${baseText}`;
70507
70508
  console.error("[SecureChannel] onMessage callback error (MLS):", err);
70508
70509
  });
70509
70510
  } catch (err) {
70511
+ if (classifyCommitFailure(data.epoch, mlsGroup.epoch) === "already-applied") {
70512
+ console.debug(`[SecureChannel] MLS room message at epoch ${String(data.epoch)} predates our epoch ${String(mlsGroup.epoch)} for ${resolvedRoomId.slice(0, 8)} \u2014 cannot decrypt, ignoring`);
70513
+ return;
70514
+ }
70510
70515
  const failKey = resolvedRoomId;
70511
70516
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
70512
70517
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -71546,6 +71551,11 @@ ${baseText}`;
71546
71551
  nackedIds.push(msg.queue_id);
71547
71552
  if (msg.group_id && (msg.message_type === "commit" || msg.message_type === "application")) {
71548
71553
  const failKey = msg.conversation_group_id ? `1to1-group:${msg.conversation_group_id}` : `group:${msg.group_id}`;
71554
+ const localMgr = msg.room_id && this._mlsGroups.get(msg.room_id) || this._mlsGroups.get(failKey);
71555
+ if (classifyCommitFailure(msg.epoch, localMgr?.epoch) === "already-applied") {
71556
+ console.debug(`[SecureChannel] Delivery ${msg.message_type} at epoch ${String(msg.epoch)} predates our epoch ${String(localMgr?.epoch)} \u2014 not counting toward recovery`);
71557
+ continue;
71558
+ }
71549
71559
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
71550
71560
  this._mlsDecryptFailCounts.set(failKey, count);
71551
71561
  if (count >= _SecureChannel.MAX_MLS_DECRYPT_FAILS) {
@@ -72223,6 +72233,7 @@ ${baseText}`;
72223
72233
  try {
72224
72234
  const ciphertext = new Uint8Array(Buffer.from(data.payload, "hex"));
72225
72235
  const result = await mlsGroup.decrypt(ciphertext);
72236
+ this._mlsDecryptFailCounts.delete(`a2a:${a2aChannelId}`);
72226
72237
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
72227
72238
  if (result.isHandshake || !result.plaintext) {
72228
72239
  return;
@@ -72243,6 +72254,10 @@ ${baseText}`;
72243
72254
  this.config.onA2AMessage(a2aMsg);
72244
72255
  }
72245
72256
  } catch (err) {
72257
+ if (classifyCommitFailure(data.epoch, mlsGroup?.epoch) === "already-applied") {
72258
+ console.debug(`[SecureChannel] MLS A2A message at epoch ${String(data.epoch)} predates our epoch ${String(mlsGroup?.epoch)} for ${a2aChannelId.slice(0, 8)} \u2014 cannot decrypt, ignoring`);
72259
+ return;
72260
+ }
72246
72261
  const failKey = `a2a:${a2aChannelId}`;
72247
72262
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
72248
72263
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -99461,7 +99476,7 @@ var init_index = __esm2({
99461
99476
  await init_skill_telemetry();
99462
99477
  await init_policy_enforcer();
99463
99478
  init_room_protocol();
99464
- VERSION = true ? "0.23.33" : "0.0.0-dev";
99479
+ VERSION = true ? "0.23.35" : "0.0.0-dev";
99465
99480
  }
99466
99481
  });
99467
99482
  await init_index();
@@ -100387,7 +100402,7 @@ async function main() {
100387
100402
  const info = parseInfoFlags(process.argv.slice(2));
100388
100403
  if (info.showVersion || info.showHelp) {
100389
100404
  const version2 = buildClientVersion2(
100390
- true ? "0.4.6" : void 0
100405
+ true ? "0.4.8" : void 0
100391
100406
  );
100392
100407
  if (info.showVersion) printLine(version2);
100393
100408
  if (info.showHelp) {
@@ -100440,7 +100455,7 @@ async function main() {
100440
100455
  agentName: cfg.agentName,
100441
100456
  platform: "node",
100442
100457
  clientVersion: buildClientVersion2(
100443
- true ? "0.4.6" : void 0
100458
+ true ? "0.4.8" : void 0
100444
100459
  )
100445
100460
  });
100446
100461
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "description": "AgentVault Grok Bridge — daemon bridging a Grok agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",