@agentvault/agentvault 0.23.9 → 0.23.11

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.11" : "0.0.0-dev";
64796
64796
  const agentName = this.config.agentName ?? "Agent";
64797
64797
  const resource = {
64798
64798
  "service.name": "agentvault-agent",
@@ -64826,7 +64826,16 @@ var init_channel = __esm({
64826
64826
  this._ws.send(
64827
64827
  JSON.stringify({
64828
64828
  event: "worker_heartbeat",
64829
- data: { worker_capable: h2.workerCapable, armed_rooms: h2.armedRooms }
64829
+ data: {
64830
+ worker_capable: h2.workerCapable,
64831
+ armed_rooms: h2.armedRooms,
64832
+ // #20: OPTIONAL on the way in so an older bridge against a newer
64833
+ // plugin still emits a shape the backend can read. `=== true` means
64834
+ // absent/malformed becomes false — the fail-closed direction, and it
64835
+ // never emits `undefined` (which would drop the key entirely).
64836
+ host_trusted: h2.hostTrusted === true,
64837
+ gates_effective: h2.gatesEffective === true
64838
+ }
64830
64839
  })
64831
64840
  );
64832
64841
  }
@@ -65103,6 +65112,50 @@ var init_channel = __esm({
65103
65112
  );
65104
65113
  this.emit("rooms_reconciled", { pruned: stale });
65105
65114
  }
65115
+ /**
65116
+ * Handle an in-band `{event:"error"}` frame from the server.
65117
+ *
65118
+ * This is an APPLICATION-level error about one resource — it is NOT a
65119
+ * transport fault, and must never be treated as one. When the error names a
65120
+ * dead resource, the correct response is to PRUNE that resource; recycling
65121
+ * the connection would just replay the same doomed write.
65122
+ *
65123
+ * `conversation deleted` (#460/#481) is the server refusing a write to a
65124
+ * shared 1:1 MLS group whose conversations are all closed/deleted. It carries
65125
+ * `group_id` for exactly this purpose. Without the prune, `_persisted.mlsGroups`
65126
+ * is append-only and the 1:1 send path fans out to every entry, so the dead
65127
+ * group takes a rejected write on every message for the life of the agent
65128
+ * (loopita: group c1b1e11a, closed 2026-07-22, still bouncing 3 days later).
65129
+ *
65130
+ * Deliberately NARROW — it prunes only on this exact detail AND only when
65131
+ * `group_id` matches a persisted shared 1:1 group. Unknown ids and other
65132
+ * details prune nothing, so a server-side wording change or a room/A2A group
65133
+ * can never cost us live MLS state. Safe because `closed`/`deleted` are
65134
+ * terminal server-side, and a genuinely new group re-arrives via Welcome.
65135
+ *
65136
+ * Mirrors the #629 room prune: MLS state file, in-memory group, persisted
65137
+ * entry, then persist.
65138
+ */
65139
+ async _handleServerError(payload) {
65140
+ if (payload?.detail !== "conversation deleted") return;
65141
+ const mlsGroupId = payload.group_id;
65142
+ if (!mlsGroupId) return;
65143
+ const groups = this._persisted?.mlsGroups;
65144
+ if (!groups) return;
65145
+ const gid = Object.keys(groups).find((k2) => groups[k2]?.mlsGroupId === mlsGroupId);
65146
+ if (!gid) return;
65147
+ try {
65148
+ await deleteMlsState(this.config.dataDir, mlsGroupId);
65149
+ } catch {
65150
+ }
65151
+ this._mlsGroups.delete(`1to1-group:${gid}`);
65152
+ delete groups[gid];
65153
+ await this._persistState();
65154
+ console.log(
65155
+ `[SecureChannel] Pruned dead shared 1:1 group ${gid.slice(0, 8)} (${mlsGroupId.slice(0, 8)}) \u2014 server reports its conversation deleted`
65156
+ );
65157
+ this.emit("dm_group_pruned", { conversationGroupId: gid, mlsGroupId });
65158
+ }
65106
65159
  /**
65107
65160
  * Return info for all joined rooms.
65108
65161
  */
@@ -66478,7 +66531,7 @@ var init_channel = __esm({
66478
66531
  agentVersion: this.config.agentVersion ?? "0.0.0",
66479
66532
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
66480
66533
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
66481
- pluginVersion: true ? "0.23.9" : "0.0.0-dev"
66534
+ pluginVersion: true ? "0.23.11" : "0.0.0-dev"
66482
66535
  });
66483
66536
  this._telemetryReporter.startAutoFlush(3e4);
66484
66537
  }
@@ -66796,7 +66849,7 @@ var init_channel = __esm({
66796
66849
  agentVersion: this.config.agentVersion ?? "0.0.0",
66797
66850
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
66798
66851
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
66799
- pluginVersion: true ? "0.23.9" : "0.0.0-dev"
66852
+ pluginVersion: true ? "0.23.11" : "0.0.0-dev"
66800
66853
  });
66801
66854
  this._telemetryReporter.startAutoFlush(3e4);
66802
66855
  }
@@ -67106,6 +67159,7 @@ var init_channel = __esm({
67106
67159
  if (data.event === "error") {
67107
67160
  const detail = data.data?.detail || data.detail || "Unknown server error";
67108
67161
  console.error(`[SecureChannel] Server error: ${detail}`);
67162
+ await this._handleServerError(data.data || data);
67109
67163
  this.emit("error", new Error(`Server: ${detail}`));
67110
67164
  }
67111
67165
  if (data.event === "a2a_message_mls") {
@@ -97010,7 +97064,7 @@ var init_index = __esm({
97010
97064
  init_skill_invoker();
97011
97065
  await init_skill_telemetry();
97012
97066
  await init_policy_enforcer();
97013
- VERSION = true ? "0.23.9" : "0.0.0-dev";
97067
+ VERSION = true ? "0.23.11" : "0.0.0-dev";
97014
97068
  }
97015
97069
  });
97016
97070
  await init_index();