@agentvault/muse-bridge 0.1.8 → 0.1.9

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 +27 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11465,11 +11465,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11465
11465
  return null;
11466
11466
  }
11467
11467
  function ownIdentity() {
11468
- const v2 = true ? "0.23.33" : FALLBACK;
11468
+ const v2 = true ? "0.23.34" : FALLBACK;
11469
11469
  return `${PACKAGE}@${v2}`;
11470
11470
  }
11471
11471
  function buildSha() {
11472
- const raw = true ? "7b91f2f-dirty" : "";
11472
+ const raw = true ? "6b305ca-dirty" : "";
11473
11473
  const cleaned = (raw ?? "").trim();
11474
11474
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11475
11475
  }
@@ -70167,7 +70167,7 @@ var init_dist = __esm({
70167
70167
  */
70168
70168
  sendActivitySpan(spanData) {
70169
70169
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70170
- const pluginVersion = true ? "0.23.33" : "0.0.0-dev";
70170
+ const pluginVersion = true ? "0.23.34" : "0.0.0-dev";
70171
70171
  const agentName = this.config.agentName ?? "Agent";
70172
70172
  const resource = {
70173
70173
  "service.name": "agentvault-agent",
@@ -72105,7 +72105,7 @@ var init_dist = __esm({
72105
72105
  agentVersion: this.config.agentVersion ?? "0.0.0",
72106
72106
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72107
72107
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72108
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
72108
+ pluginVersion: true ? "0.23.34" : "0.0.0-dev"
72109
72109
  });
72110
72110
  this._telemetryReporter.startAutoFlush(3e4);
72111
72111
  }
@@ -72429,7 +72429,7 @@ var init_dist = __esm({
72429
72429
  agentVersion: this.config.agentVersion ?? "0.0.0",
72430
72430
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72431
72431
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72432
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
72432
+ pluginVersion: true ? "0.23.34" : "0.0.0-dev"
72433
72433
  });
72434
72434
  this._telemetryReporter.startAutoFlush(3e4);
72435
72435
  }
@@ -72833,6 +72833,7 @@ var init_dist = __esm({
72833
72833
  try {
72834
72834
  const cipherBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
72835
72835
  const result = await mgr.decrypt(cipherBytes);
72836
+ if (mgrKey) this._mlsDecryptFailCounts.delete(mgrKey);
72836
72837
  const mlsGroupId = (convGroupId ? this._persisted?.mlsGroups?.[convGroupId]?.mlsGroupId : null) ?? this._persisted?.mlsConversations?.[convId]?.mlsGroupId ?? groupId;
72837
72838
  if (mlsGroupId) {
72838
72839
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mgr.exportState()));
@@ -72937,6 +72938,10 @@ var init_dist = __esm({
72937
72938
  this.config.onMessage(text, metadata);
72938
72939
  }
72939
72940
  } catch (decryptErr) {
72941
+ if (classifyCommitFailure(data.epoch, mgr?.epoch) === "already-applied") {
72942
+ console.debug(`[SecureChannel] MLS 1:1 message at epoch ${String(data.epoch)} predates our epoch ${String(mgr?.epoch)} \u2014 cannot decrypt, ignoring`);
72943
+ return;
72944
+ }
72940
72945
  const failKey = mgrKey || `unknown:${groupId}`;
72941
72946
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
72942
72947
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -73778,6 +73783,7 @@ ${baseText}`;
73778
73783
  try {
73779
73784
  const ciphertext = Buffer.from(data.payload, "hex");
73780
73785
  const result = await mlsGroup.decrypt(new Uint8Array(ciphertext));
73786
+ this._mlsDecryptFailCounts.delete(resolvedRoomId);
73781
73787
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
73782
73788
  if (result.isHandshake || !result.plaintext) {
73783
73789
  return;
@@ -73867,6 +73873,10 @@ ${baseText}`;
73867
73873
  console.error("[SecureChannel] onMessage callback error (MLS):", err);
73868
73874
  });
73869
73875
  } catch (err) {
73876
+ if (classifyCommitFailure(data.epoch, mlsGroup.epoch) === "already-applied") {
73877
+ 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`);
73878
+ return;
73879
+ }
73870
73880
  const failKey = resolvedRoomId;
73871
73881
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
73872
73882
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -74906,6 +74916,11 @@ ${baseText}`;
74906
74916
  nackedIds.push(msg.queue_id);
74907
74917
  if (msg.group_id && (msg.message_type === "commit" || msg.message_type === "application")) {
74908
74918
  const failKey = msg.conversation_group_id ? `1to1-group:${msg.conversation_group_id}` : `group:${msg.group_id}`;
74919
+ const localMgr = msg.room_id && this._mlsGroups.get(msg.room_id) || this._mlsGroups.get(failKey);
74920
+ if (classifyCommitFailure(msg.epoch, localMgr?.epoch) === "already-applied") {
74921
+ console.debug(`[SecureChannel] Delivery ${msg.message_type} at epoch ${String(msg.epoch)} predates our epoch ${String(localMgr?.epoch)} \u2014 not counting toward recovery`);
74922
+ continue;
74923
+ }
74909
74924
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
74910
74925
  this._mlsDecryptFailCounts.set(failKey, count);
74911
74926
  if (count >= _SecureChannel.MAX_MLS_DECRYPT_FAILS) {
@@ -75583,6 +75598,7 @@ ${baseText}`;
75583
75598
  try {
75584
75599
  const ciphertext = new Uint8Array(Buffer.from(data.payload, "hex"));
75585
75600
  const result = await mlsGroup.decrypt(ciphertext);
75601
+ this._mlsDecryptFailCounts.delete(`a2a:${a2aChannelId}`);
75586
75602
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
75587
75603
  if (result.isHandshake || !result.plaintext) {
75588
75604
  return;
@@ -75603,6 +75619,10 @@ ${baseText}`;
75603
75619
  this.config.onA2AMessage(a2aMsg);
75604
75620
  }
75605
75621
  } catch (err) {
75622
+ if (classifyCommitFailure(data.epoch, mlsGroup?.epoch) === "already-applied") {
75623
+ 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`);
75624
+ return;
75625
+ }
75606
75626
  const failKey = `a2a:${a2aChannelId}`;
75607
75627
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
75608
75628
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -97774,7 +97794,7 @@ data:
97774
97794
  await init_skill_telemetry();
97775
97795
  await init_policy_enforcer();
97776
97796
  init_room_protocol();
97777
- VERSION = true ? "0.23.33" : "0.0.0-dev";
97797
+ VERSION = true ? "0.23.34" : "0.0.0-dev";
97778
97798
  }
97779
97799
  });
97780
97800
  await init_index();
@@ -99150,7 +99170,7 @@ function mkdir700(path2) {
99150
99170
  chmodSync5(path2, 448);
99151
99171
  }
99152
99172
  function packageVersion() {
99153
- return true ? "0.1.8" : void 0;
99173
+ return true ? "0.1.9" : void 0;
99154
99174
  }
99155
99175
  function helpText(version2) {
99156
99176
  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.9",
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",