@agentvault/agentvault 0.23.37 → 0.23.39

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
@@ -50859,10 +50859,12 @@ async function applyProposals(state, proposals, committerLeafIndex, pskSearch, s
50859
50859
  const [mutatedTree, addedLeafNodes] = await applyTreeMutations(state.ratchetTree, grouped, state.groupContext, sentByClient, state.clientConfig.authService, state.clientConfig.lifetimeConfig, cs.signature);
50860
50860
  const [updatedPskSecret, pskIds] = await accumulatePskSecret(grouped.psk.map((p2) => p2.proposal.psk.preSharedKeyId), pskSearch, cs, zeroes);
50861
50861
  const selfRemoved = mutatedTree[leafToNodeIndex(toLeafIndex(state.privatePath.leafIndex))] === void 0;
50862
- const needsUpdatePath = allProposals.length === 0 || allProposals.some(({ proposal }) => {
50862
+ const pathRequiredByRfc = allProposals.length === 0 || allProposals.some(({ proposal }) => {
50863
50863
  const t2 = proposal.proposalType;
50864
50864
  return t2 !== "add" && t2 !== "psk" && t2 !== "reinit";
50865
50865
  });
50866
+ const pathRequiredLegacy = allProposals.length === 0 || Object.values(grouped.update).length > 1 || Object.values(grouped.remove).length > 1;
50867
+ const needsUpdatePath = sentByClient ? pathRequiredByRfc : pathRequiredLegacy;
50866
50868
  return {
50867
50869
  tree: mutatedTree,
50868
50870
  pskSecret: updatedPskSecret,
@@ -63264,11 +63266,11 @@ var init_mls_kp_pool = __esm({
63264
63266
 
63265
63267
  // src/client-version.ts
63266
63268
  function ownIdentity() {
63267
- const v2 = true ? "0.23.37" : FALLBACK;
63269
+ const v2 = true ? "0.23.39" : FALLBACK;
63268
63270
  return `${PACKAGE}@${v2}`;
63269
63271
  }
63270
63272
  function buildSha() {
63271
- const raw = true ? "58c552f-dirty" : "";
63273
+ const raw = true ? "9982fc8-dirty" : "";
63272
63274
  const cleaned = (raw ?? "").trim();
63273
63275
  return !cleaned || cleaned === "unknown" ? null : cleaned;
63274
63276
  }
@@ -64384,6 +64386,27 @@ var init_channel = __esm({
64384
64386
  * this process (GH #366). Cleared on (re)join so the next first message
64385
64387
  * re-fetches the authoritative roster. Prevents per-message refetch storms. */
64386
64388
  _roomRosterRefreshed = /* @__PURE__ */ new Set();
64389
+ /**
64390
+ * #1181: the last attachment saved per room, so the NEXT room turn can name
64391
+ * it. wren saved an un-mentioned file (no reply, #1107), was asked "@wren can
64392
+ * you read this file?" 14 s later, and answered "I don't see a file
64393
+ * attached" — the note lived only in the prior history line. Hermes defers
64394
+ * un-mentioned attachments and fetches on the next addressed turn (#1162);
64395
+ * this is the plugin's equivalent surface. In-memory: a restart forgets it,
64396
+ * which is the right default for "this file".
64397
+ */
64398
+ _recentRoomAttachments = /* @__PURE__ */ new Map();
64399
+ static RECENT_ROOM_ATTACHMENT_MS = 10 * 60 * 1e3;
64400
+ /** #1181: prefix a room turn that carries no attachment with the one saved in this room recently. */
64401
+ _withRecentRoomAttachmentNote(roomId, text) {
64402
+ const recent = this._recentRoomAttachments.get(roomId);
64403
+ if (!recent) return text;
64404
+ const ageMs = Date.now() - recent.at;
64405
+ if (ageMs > _SecureChannel.RECENT_ROOM_ATTACHMENT_MS) return text;
64406
+ return `[Most recent file in this room: ${recent.filePath} (${recent.name}, received ${Math.round(ageMs / 1e3)}s ago). If this message refers to "the file" or "this file", it means that one \u2014 use your Read tool on it.]
64407
+
64408
+ ${text}`;
64409
+ }
64387
64410
  /** In-flight roster-refresh promises (per room) — dedup concurrent refreshes. */
64388
64411
  _roomRosterRefreshInFlight = /* @__PURE__ */ new Map();
64389
64412
  /** Dedup buffer for A2A message IDs (prevents double-delivery via direct + Redis) */
@@ -65479,7 +65502,7 @@ var init_channel = __esm({
65479
65502
  */
65480
65503
  sendActivitySpan(spanData) {
65481
65504
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
65482
- const pluginVersion = true ? "0.23.37" : "0.0.0-dev";
65505
+ const pluginVersion = true ? "0.23.39" : "0.0.0-dev";
65483
65506
  const agentName = this.config.agentName ?? "Agent";
65484
65507
  const resource = {
65485
65508
  "service.name": "agentvault-agent",
@@ -67417,7 +67440,7 @@ var init_channel = __esm({
67417
67440
  agentVersion: this.config.agentVersion ?? "0.0.0",
67418
67441
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67419
67442
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67420
- pluginVersion: true ? "0.23.37" : "0.0.0-dev"
67443
+ pluginVersion: true ? "0.23.39" : "0.0.0-dev"
67421
67444
  });
67422
67445
  this._telemetryReporter.startAutoFlush(3e4);
67423
67446
  }
@@ -67741,7 +67764,7 @@ var init_channel = __esm({
67741
67764
  agentVersion: this.config.agentVersion ?? "0.0.0",
67742
67765
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67743
67766
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67744
- pluginVersion: true ? "0.23.37" : "0.0.0-dev"
67767
+ pluginVersion: true ? "0.23.39" : "0.0.0-dev"
67745
67768
  });
67746
67769
  this._telemetryReporter.startAutoFlush(3e4);
67747
67770
  }
@@ -68514,12 +68537,13 @@ ${messageText}`;
68514
68537
  * Returns the text unchanged when there is no attachment or the fetch fails —
68515
68538
  * but a failure is LOGGED and announced in the text, never silent.
68516
68539
  */
68517
- async _augmentWithAttachment(attachmentInfo, baseText) {
68540
+ async _augmentWithAttachment(attachmentInfo, baseText, roomId) {
68518
68541
  if (!attachmentInfo) return baseText;
68519
68542
  try {
68520
68543
  const { filePath, decrypted } = await this._downloadAndDecryptAttachment(attachmentInfo);
68521
68544
  const mime = String(attachmentInfo.mime ?? "application/octet-stream");
68522
68545
  const name = String(attachmentInfo.filename ?? "attachment");
68546
+ if (roomId) this._recentRoomAttachments.set(roomId, { filePath, name, at: Date.now() });
68523
68547
  const textMimes = ["text/", "application/json", "application/xml", "application/csv"];
68524
68548
  if (textMimes.some((m2) => mime.startsWith(m2))) {
68525
68549
  const content = new TextDecoder().decode(decrypted);
@@ -69149,7 +69173,9 @@ ${baseText}`;
69149
69173
  }
69150
69174
  }
69151
69175
  if (roomAttachment) {
69152
- messageText = await this._augmentWithAttachment(roomAttachment, messageText);
69176
+ messageText = await this._augmentWithAttachment(roomAttachment, messageText, resolvedRoomId);
69177
+ } else {
69178
+ messageText = this._withRecentRoomAttachmentNote(resolvedRoomId, messageText);
69153
69179
  }
69154
69180
  const roomMembers = this._persisted?.rooms?.[resolvedRoomId]?.members ?? [];
69155
69181
  const senderMember = roomMembers.find((m2) => m2.deviceId === senderDeviceId);
@@ -98641,7 +98667,7 @@ var init_index = __esm({
98641
98667
  await init_skill_telemetry();
98642
98668
  await init_policy_enforcer();
98643
98669
  init_room_protocol();
98644
- VERSION = true ? "0.23.37" : "0.0.0-dev";
98670
+ VERSION = true ? "0.23.39" : "0.0.0-dev";
98645
98671
  }
98646
98672
  });
98647
98673
  await init_index();