@agentvault/agentvault 0.23.33 → 0.23.35

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/index.js CHANGED
@@ -50505,11 +50505,6 @@ var init_clientConfig = __esm({
50505
50505
  });
50506
50506
 
50507
50507
  // ../crypto/node_modules/ts-mls/dist/src/util/array.js
50508
- function arraysEqual(a2, b2) {
50509
- if (a2.length !== b2.length)
50510
- return false;
50511
- return a2.every((val, index) => val === b2[index]);
50512
- }
50513
50508
  var init_array = __esm({
50514
50509
  "../crypto/node_modules/ts-mls/dist/src/util/array.js"() {
50515
50510
  }
@@ -50698,7 +50693,7 @@ async function validateRatchetTree(tree, groupContext, config2, authService, tre
50698
50693
  if (dpNode !== void 0) {
50699
50694
  if (dpNode.nodeType !== "parent")
50700
50695
  return new InternalError("Expected parent node");
50701
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n2.parent.unmergedLeaves))
50696
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
50702
50697
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
50703
50698
  }
50704
50699
  }
@@ -63266,11 +63261,11 @@ var init_mls_kp_pool = __esm({
63266
63261
 
63267
63262
  // src/client-version.ts
63268
63263
  function ownIdentity() {
63269
- const v2 = true ? "0.23.33" : FALLBACK;
63264
+ const v2 = true ? "0.23.35" : FALLBACK;
63270
63265
  return `${PACKAGE}@${v2}`;
63271
63266
  }
63272
63267
  function buildSha() {
63273
- const raw = true ? "7b91f2f-dirty" : "";
63268
+ const raw = true ? "0160bbb-dirty" : "";
63274
63269
  const cleaned = (raw ?? "").trim();
63275
63270
  return !cleaned || cleaned === "unknown" ? null : cleaned;
63276
63271
  }
@@ -65481,7 +65476,7 @@ var init_channel = __esm({
65481
65476
  */
65482
65477
  sendActivitySpan(spanData) {
65483
65478
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
65484
- const pluginVersion = true ? "0.23.33" : "0.0.0-dev";
65479
+ const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
65485
65480
  const agentName = this.config.agentName ?? "Agent";
65486
65481
  const resource = {
65487
65482
  "service.name": "agentvault-agent",
@@ -67419,7 +67414,7 @@ var init_channel = __esm({
67419
67414
  agentVersion: this.config.agentVersion ?? "0.0.0",
67420
67415
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67421
67416
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67422
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
67417
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
67423
67418
  });
67424
67419
  this._telemetryReporter.startAutoFlush(3e4);
67425
67420
  }
@@ -67743,7 +67738,7 @@ var init_channel = __esm({
67743
67738
  agentVersion: this.config.agentVersion ?? "0.0.0",
67744
67739
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67745
67740
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67746
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
67741
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
67747
67742
  });
67748
67743
  this._telemetryReporter.startAutoFlush(3e4);
67749
67744
  }
@@ -68147,6 +68142,7 @@ var init_channel = __esm({
68147
68142
  try {
68148
68143
  const cipherBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
68149
68144
  const result = await mgr.decrypt(cipherBytes);
68145
+ if (mgrKey) this._mlsDecryptFailCounts.delete(mgrKey);
68150
68146
  const mlsGroupId = (convGroupId ? this._persisted?.mlsGroups?.[convGroupId]?.mlsGroupId : null) ?? this._persisted?.mlsConversations?.[convId]?.mlsGroupId ?? groupId;
68151
68147
  if (mlsGroupId) {
68152
68148
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mgr.exportState()));
@@ -68251,6 +68247,10 @@ var init_channel = __esm({
68251
68247
  this.config.onMessage(text, metadata);
68252
68248
  }
68253
68249
  } catch (decryptErr) {
68250
+ if (classifyCommitFailure(data.epoch, mgr?.epoch) === "already-applied") {
68251
+ console.debug(`[SecureChannel] MLS 1:1 message at epoch ${String(data.epoch)} predates our epoch ${String(mgr?.epoch)} \u2014 cannot decrypt, ignoring`);
68252
+ return;
68253
+ }
68254
68254
  const failKey = mgrKey || `unknown:${groupId}`;
68255
68255
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
68256
68256
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -69092,6 +69092,7 @@ ${baseText}`;
69092
69092
  try {
69093
69093
  const ciphertext = Buffer.from(data.payload, "hex");
69094
69094
  const result = await mlsGroup.decrypt(new Uint8Array(ciphertext));
69095
+ this._mlsDecryptFailCounts.delete(resolvedRoomId);
69095
69096
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
69096
69097
  if (result.isHandshake || !result.plaintext) {
69097
69098
  return;
@@ -69181,6 +69182,10 @@ ${baseText}`;
69181
69182
  console.error("[SecureChannel] onMessage callback error (MLS):", err);
69182
69183
  });
69183
69184
  } catch (err) {
69185
+ if (classifyCommitFailure(data.epoch, mlsGroup.epoch) === "already-applied") {
69186
+ 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`);
69187
+ return;
69188
+ }
69184
69189
  const failKey = resolvedRoomId;
69185
69190
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
69186
69191
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -70220,6 +70225,11 @@ ${baseText}`;
70220
70225
  nackedIds.push(msg.queue_id);
70221
70226
  if (msg.group_id && (msg.message_type === "commit" || msg.message_type === "application")) {
70222
70227
  const failKey = msg.conversation_group_id ? `1to1-group:${msg.conversation_group_id}` : `group:${msg.group_id}`;
70228
+ const localMgr = msg.room_id && this._mlsGroups.get(msg.room_id) || this._mlsGroups.get(failKey);
70229
+ if (classifyCommitFailure(msg.epoch, localMgr?.epoch) === "already-applied") {
70230
+ console.debug(`[SecureChannel] Delivery ${msg.message_type} at epoch ${String(msg.epoch)} predates our epoch ${String(localMgr?.epoch)} \u2014 not counting toward recovery`);
70231
+ continue;
70232
+ }
70223
70233
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
70224
70234
  this._mlsDecryptFailCounts.set(failKey, count);
70225
70235
  if (count >= _SecureChannel.MAX_MLS_DECRYPT_FAILS) {
@@ -70897,6 +70907,7 @@ ${baseText}`;
70897
70907
  try {
70898
70908
  const ciphertext = new Uint8Array(Buffer.from(data.payload, "hex"));
70899
70909
  const result = await mlsGroup.decrypt(ciphertext);
70910
+ this._mlsDecryptFailCounts.delete(`a2a:${a2aChannelId}`);
70900
70911
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
70901
70912
  if (result.isHandshake || !result.plaintext) {
70902
70913
  return;
@@ -70917,6 +70928,10 @@ ${baseText}`;
70917
70928
  this.config.onA2AMessage(a2aMsg);
70918
70929
  }
70919
70930
  } catch (err) {
70931
+ if (classifyCommitFailure(data.epoch, mlsGroup?.epoch) === "already-applied") {
70932
+ 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`);
70933
+ return;
70934
+ }
70920
70935
  const failKey = `a2a:${a2aChannelId}`;
70921
70936
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
70922
70937
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -98585,7 +98600,7 @@ var init_index = __esm({
98585
98600
  await init_skill_telemetry();
98586
98601
  await init_policy_enforcer();
98587
98602
  init_room_protocol();
98588
- VERSION = true ? "0.23.33" : "0.0.0-dev";
98603
+ VERSION = true ? "0.23.35" : "0.0.0-dev";
98589
98604
  }
98590
98605
  });
98591
98606
  await init_index();