@agentvault/muse-bridge 0.1.8 → 0.1.10

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 +28 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5871,11 +5871,6 @@ function addToMap(map2, k2, v2) {
5871
5871
  copy.set(k2, v2);
5872
5872
  return copy;
5873
5873
  }
5874
- function arraysEqual(a2, b2) {
5875
- if (a2.length !== b2.length)
5876
- return false;
5877
- return a2.every((val, index) => val === b2[index]);
5878
- }
5879
5874
  function checkCanSendApplicationMessages(state) {
5880
5875
  if (Object.keys(state.unappliedProposals).length !== 0)
5881
5876
  throw new UsageError("Cannot send application message with unapplied proposals");
@@ -5988,7 +5983,7 @@ async function validateRatchetTree(tree, groupContext, config2, authService, tre
5988
5983
  if (dpNode !== void 0) {
5989
5984
  if (dpNode.nodeType !== "parent")
5990
5985
  return new InternalError("Expected parent node");
5991
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n2.parent.unmergedLeaves))
5986
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
5992
5987
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
5993
5988
  }
5994
5989
  }
@@ -11465,11 +11460,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11465
11460
  return null;
11466
11461
  }
11467
11462
  function ownIdentity() {
11468
- const v2 = true ? "0.23.33" : FALLBACK;
11463
+ const v2 = true ? "0.23.35" : FALLBACK;
11469
11464
  return `${PACKAGE}@${v2}`;
11470
11465
  }
11471
11466
  function buildSha() {
11472
- const raw = true ? "7b91f2f-dirty" : "";
11467
+ const raw = true ? "bcb9297-dirty" : "";
11473
11468
  const cleaned = (raw ?? "").trim();
11474
11469
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11475
11470
  }
@@ -70167,7 +70162,7 @@ var init_dist = __esm({
70167
70162
  */
70168
70163
  sendActivitySpan(spanData) {
70169
70164
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70170
- const pluginVersion = true ? "0.23.33" : "0.0.0-dev";
70165
+ const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
70171
70166
  const agentName = this.config.agentName ?? "Agent";
70172
70167
  const resource = {
70173
70168
  "service.name": "agentvault-agent",
@@ -72105,7 +72100,7 @@ var init_dist = __esm({
72105
72100
  agentVersion: this.config.agentVersion ?? "0.0.0",
72106
72101
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72107
72102
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72108
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
72103
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
72109
72104
  });
72110
72105
  this._telemetryReporter.startAutoFlush(3e4);
72111
72106
  }
@@ -72429,7 +72424,7 @@ var init_dist = __esm({
72429
72424
  agentVersion: this.config.agentVersion ?? "0.0.0",
72430
72425
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72431
72426
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72432
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
72427
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
72433
72428
  });
72434
72429
  this._telemetryReporter.startAutoFlush(3e4);
72435
72430
  }
@@ -72833,6 +72828,7 @@ var init_dist = __esm({
72833
72828
  try {
72834
72829
  const cipherBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
72835
72830
  const result = await mgr.decrypt(cipherBytes);
72831
+ if (mgrKey) this._mlsDecryptFailCounts.delete(mgrKey);
72836
72832
  const mlsGroupId = (convGroupId ? this._persisted?.mlsGroups?.[convGroupId]?.mlsGroupId : null) ?? this._persisted?.mlsConversations?.[convId]?.mlsGroupId ?? groupId;
72837
72833
  if (mlsGroupId) {
72838
72834
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mgr.exportState()));
@@ -72937,6 +72933,10 @@ var init_dist = __esm({
72937
72933
  this.config.onMessage(text, metadata);
72938
72934
  }
72939
72935
  } catch (decryptErr) {
72936
+ if (classifyCommitFailure(data.epoch, mgr?.epoch) === "already-applied") {
72937
+ console.debug(`[SecureChannel] MLS 1:1 message at epoch ${String(data.epoch)} predates our epoch ${String(mgr?.epoch)} \u2014 cannot decrypt, ignoring`);
72938
+ return;
72939
+ }
72940
72940
  const failKey = mgrKey || `unknown:${groupId}`;
72941
72941
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
72942
72942
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -73778,6 +73778,7 @@ ${baseText}`;
73778
73778
  try {
73779
73779
  const ciphertext = Buffer.from(data.payload, "hex");
73780
73780
  const result = await mlsGroup.decrypt(new Uint8Array(ciphertext));
73781
+ this._mlsDecryptFailCounts.delete(resolvedRoomId);
73781
73782
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
73782
73783
  if (result.isHandshake || !result.plaintext) {
73783
73784
  return;
@@ -73867,6 +73868,10 @@ ${baseText}`;
73867
73868
  console.error("[SecureChannel] onMessage callback error (MLS):", err);
73868
73869
  });
73869
73870
  } catch (err) {
73871
+ if (classifyCommitFailure(data.epoch, mlsGroup.epoch) === "already-applied") {
73872
+ 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`);
73873
+ return;
73874
+ }
73870
73875
  const failKey = resolvedRoomId;
73871
73876
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
73872
73877
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -74906,6 +74911,11 @@ ${baseText}`;
74906
74911
  nackedIds.push(msg.queue_id);
74907
74912
  if (msg.group_id && (msg.message_type === "commit" || msg.message_type === "application")) {
74908
74913
  const failKey = msg.conversation_group_id ? `1to1-group:${msg.conversation_group_id}` : `group:${msg.group_id}`;
74914
+ const localMgr = msg.room_id && this._mlsGroups.get(msg.room_id) || this._mlsGroups.get(failKey);
74915
+ if (classifyCommitFailure(msg.epoch, localMgr?.epoch) === "already-applied") {
74916
+ console.debug(`[SecureChannel] Delivery ${msg.message_type} at epoch ${String(msg.epoch)} predates our epoch ${String(localMgr?.epoch)} \u2014 not counting toward recovery`);
74917
+ continue;
74918
+ }
74909
74919
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
74910
74920
  this._mlsDecryptFailCounts.set(failKey, count);
74911
74921
  if (count >= _SecureChannel.MAX_MLS_DECRYPT_FAILS) {
@@ -75583,6 +75593,7 @@ ${baseText}`;
75583
75593
  try {
75584
75594
  const ciphertext = new Uint8Array(Buffer.from(data.payload, "hex"));
75585
75595
  const result = await mlsGroup.decrypt(ciphertext);
75596
+ this._mlsDecryptFailCounts.delete(`a2a:${a2aChannelId}`);
75586
75597
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
75587
75598
  if (result.isHandshake || !result.plaintext) {
75588
75599
  return;
@@ -75603,6 +75614,10 @@ ${baseText}`;
75603
75614
  this.config.onA2AMessage(a2aMsg);
75604
75615
  }
75605
75616
  } catch (err) {
75617
+ if (classifyCommitFailure(data.epoch, mlsGroup?.epoch) === "already-applied") {
75618
+ 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`);
75619
+ return;
75620
+ }
75606
75621
  const failKey = `a2a:${a2aChannelId}`;
75607
75622
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
75608
75623
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -97774,7 +97789,7 @@ data:
97774
97789
  await init_skill_telemetry();
97775
97790
  await init_policy_enforcer();
97776
97791
  init_room_protocol();
97777
- VERSION = true ? "0.23.33" : "0.0.0-dev";
97792
+ VERSION = true ? "0.23.35" : "0.0.0-dev";
97778
97793
  }
97779
97794
  });
97780
97795
  await init_index();
@@ -99150,7 +99165,7 @@ function mkdir700(path2) {
99150
99165
  chmodSync5(path2, 448);
99151
99166
  }
99152
99167
  function packageVersion() {
99153
- return true ? "0.1.8" : void 0;
99168
+ return true ? "0.1.10" : void 0;
99154
99169
  }
99155
99170
  function helpText(version2) {
99156
99171
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/muse-bridge",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "AgentVault Muse Bridge — daemon bridging a Muse agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",