@agentvault/agentvault 0.23.9 → 0.23.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.
package/dist/index.js CHANGED
@@ -64792,7 +64792,7 @@ var init_channel = __esm({
64792
64792
  */
64793
64793
  sendActivitySpan(spanData) {
64794
64794
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
64795
- const pluginVersion = true ? "0.23.9" : "0.0.0-dev";
64795
+ const pluginVersion = true ? "0.23.10" : "0.0.0-dev";
64796
64796
  const agentName = this.config.agentName ?? "Agent";
64797
64797
  const resource = {
64798
64798
  "service.name": "agentvault-agent",
@@ -65103,6 +65103,50 @@ var init_channel = __esm({
65103
65103
  );
65104
65104
  this.emit("rooms_reconciled", { pruned: stale });
65105
65105
  }
65106
+ /**
65107
+ * Handle an in-band `{event:"error"}` frame from the server.
65108
+ *
65109
+ * This is an APPLICATION-level error about one resource — it is NOT a
65110
+ * transport fault, and must never be treated as one. When the error names a
65111
+ * dead resource, the correct response is to PRUNE that resource; recycling
65112
+ * the connection would just replay the same doomed write.
65113
+ *
65114
+ * `conversation deleted` (#460/#481) is the server refusing a write to a
65115
+ * shared 1:1 MLS group whose conversations are all closed/deleted. It carries
65116
+ * `group_id` for exactly this purpose. Without the prune, `_persisted.mlsGroups`
65117
+ * is append-only and the 1:1 send path fans out to every entry, so the dead
65118
+ * group takes a rejected write on every message for the life of the agent
65119
+ * (loopita: group c1b1e11a, closed 2026-07-22, still bouncing 3 days later).
65120
+ *
65121
+ * Deliberately NARROW — it prunes only on this exact detail AND only when
65122
+ * `group_id` matches a persisted shared 1:1 group. Unknown ids and other
65123
+ * details prune nothing, so a server-side wording change or a room/A2A group
65124
+ * can never cost us live MLS state. Safe because `closed`/`deleted` are
65125
+ * terminal server-side, and a genuinely new group re-arrives via Welcome.
65126
+ *
65127
+ * Mirrors the #629 room prune: MLS state file, in-memory group, persisted
65128
+ * entry, then persist.
65129
+ */
65130
+ async _handleServerError(payload) {
65131
+ if (payload?.detail !== "conversation deleted") return;
65132
+ const mlsGroupId = payload.group_id;
65133
+ if (!mlsGroupId) return;
65134
+ const groups = this._persisted?.mlsGroups;
65135
+ if (!groups) return;
65136
+ const gid = Object.keys(groups).find((k2) => groups[k2]?.mlsGroupId === mlsGroupId);
65137
+ if (!gid) return;
65138
+ try {
65139
+ await deleteMlsState(this.config.dataDir, mlsGroupId);
65140
+ } catch {
65141
+ }
65142
+ this._mlsGroups.delete(`1to1-group:${gid}`);
65143
+ delete groups[gid];
65144
+ await this._persistState();
65145
+ console.log(
65146
+ `[SecureChannel] Pruned dead shared 1:1 group ${gid.slice(0, 8)} (${mlsGroupId.slice(0, 8)}) \u2014 server reports its conversation deleted`
65147
+ );
65148
+ this.emit("dm_group_pruned", { conversationGroupId: gid, mlsGroupId });
65149
+ }
65106
65150
  /**
65107
65151
  * Return info for all joined rooms.
65108
65152
  */
@@ -66478,7 +66522,7 @@ var init_channel = __esm({
66478
66522
  agentVersion: this.config.agentVersion ?? "0.0.0",
66479
66523
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
66480
66524
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
66481
- pluginVersion: true ? "0.23.9" : "0.0.0-dev"
66525
+ pluginVersion: true ? "0.23.10" : "0.0.0-dev"
66482
66526
  });
66483
66527
  this._telemetryReporter.startAutoFlush(3e4);
66484
66528
  }
@@ -66796,7 +66840,7 @@ var init_channel = __esm({
66796
66840
  agentVersion: this.config.agentVersion ?? "0.0.0",
66797
66841
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
66798
66842
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
66799
- pluginVersion: true ? "0.23.9" : "0.0.0-dev"
66843
+ pluginVersion: true ? "0.23.10" : "0.0.0-dev"
66800
66844
  });
66801
66845
  this._telemetryReporter.startAutoFlush(3e4);
66802
66846
  }
@@ -67106,6 +67150,7 @@ var init_channel = __esm({
67106
67150
  if (data.event === "error") {
67107
67151
  const detail = data.data?.detail || data.detail || "Unknown server error";
67108
67152
  console.error(`[SecureChannel] Server error: ${detail}`);
67153
+ await this._handleServerError(data.data || data);
67109
67154
  this.emit("error", new Error(`Server: ${detail}`));
67110
67155
  }
67111
67156
  if (data.event === "a2a_message_mls") {
@@ -97010,7 +97055,7 @@ var init_index = __esm({
97010
97055
  init_skill_invoker();
97011
97056
  await init_skill_telemetry();
97012
97057
  await init_policy_enforcer();
97013
- VERSION = true ? "0.23.9" : "0.0.0-dev";
97058
+ VERSION = true ? "0.23.10" : "0.0.0-dev";
97014
97059
  }
97015
97060
  });
97016
97061
  await init_index();