@agentvault/grok-bridge 0.4.10 → 0.4.12

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 +49 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -52052,10 +52052,12 @@ async function applyProposals(state, proposals, committerLeafIndex, pskSearch, s
52052
52052
  const [mutatedTree, addedLeafNodes] = await applyTreeMutations(state.ratchetTree, grouped, state.groupContext, sentByClient, state.clientConfig.authService, state.clientConfig.lifetimeConfig, cs.signature);
52053
52053
  const [updatedPskSecret, pskIds] = await accumulatePskSecret(grouped.psk.map((p2) => p2.proposal.psk.preSharedKeyId), pskSearch, cs, zeroes);
52054
52054
  const selfRemoved = mutatedTree[leafToNodeIndex(toLeafIndex(state.privatePath.leafIndex))] === void 0;
52055
- const needsUpdatePath = allProposals.length === 0 || allProposals.some(({ proposal }) => {
52055
+ const pathRequiredByRfc = allProposals.length === 0 || allProposals.some(({ proposal }) => {
52056
52056
  const t2 = proposal.proposalType;
52057
52057
  return t2 !== "add" && t2 !== "psk" && t2 !== "reinit";
52058
52058
  });
52059
+ const pathRequiredLegacy = allProposals.length === 0 || Object.values(grouped.update).length > 1 || Object.values(grouped.remove).length > 1;
52060
+ const needsUpdatePath = sentByClient ? pathRequiredByRfc : pathRequiredLegacy;
52059
52061
  return {
52060
52062
  tree: mutatedTree,
52061
52063
  pskSecret: updatedPskSecret,
@@ -64603,11 +64605,11 @@ var init_mls_kp_pool = __esm2({
64603
64605
  }
64604
64606
  });
64605
64607
  function ownIdentity() {
64606
- const v2 = true ? "0.23.37" : FALLBACK;
64608
+ const v2 = true ? "0.23.39" : FALLBACK;
64607
64609
  return `${PACKAGE}@${v2}`;
64608
64610
  }
64609
64611
  function buildSha() {
64610
- const raw = true ? "58c552f-dirty" : "";
64612
+ const raw = true ? "9982fc8-dirty" : "";
64611
64613
  const cleaned = (raw ?? "").trim();
64612
64614
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64613
64615
  }
@@ -65710,6 +65712,27 @@ var init_channel = __esm2({
65710
65712
  * this process (GH #366). Cleared on (re)join so the next first message
65711
65713
  * re-fetches the authoritative roster. Prevents per-message refetch storms. */
65712
65714
  _roomRosterRefreshed = /* @__PURE__ */ new Set();
65715
+ /**
65716
+ * #1181: the last attachment saved per room, so the NEXT room turn can name
65717
+ * it. wren saved an un-mentioned file (no reply, #1107), was asked "@wren can
65718
+ * you read this file?" 14 s later, and answered "I don't see a file
65719
+ * attached" — the note lived only in the prior history line. Hermes defers
65720
+ * un-mentioned attachments and fetches on the next addressed turn (#1162);
65721
+ * this is the plugin's equivalent surface. In-memory: a restart forgets it,
65722
+ * which is the right default for "this file".
65723
+ */
65724
+ _recentRoomAttachments = /* @__PURE__ */ new Map();
65725
+ static RECENT_ROOM_ATTACHMENT_MS = 10 * 60 * 1e3;
65726
+ /** #1181: prefix a room turn that carries no attachment with the one saved in this room recently. */
65727
+ _withRecentRoomAttachmentNote(roomId, text) {
65728
+ const recent = this._recentRoomAttachments.get(roomId);
65729
+ if (!recent) return text;
65730
+ const ageMs = Date.now() - recent.at;
65731
+ if (ageMs > _SecureChannel.RECENT_ROOM_ATTACHMENT_MS) return text;
65732
+ 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.]
65733
+
65734
+ ${text}`;
65735
+ }
65713
65736
  /** In-flight roster-refresh promises (per room) — dedup concurrent refreshes. */
65714
65737
  _roomRosterRefreshInFlight = /* @__PURE__ */ new Map();
65715
65738
  /** Dedup buffer for A2A message IDs (prevents double-delivery via direct + Redis) */
@@ -66805,7 +66828,7 @@ var init_channel = __esm2({
66805
66828
  */
66806
66829
  sendActivitySpan(spanData) {
66807
66830
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66808
- const pluginVersion = true ? "0.23.37" : "0.0.0-dev";
66831
+ const pluginVersion = true ? "0.23.39" : "0.0.0-dev";
66809
66832
  const agentName = this.config.agentName ?? "Agent";
66810
66833
  const resource = {
66811
66834
  "service.name": "agentvault-agent",
@@ -68743,7 +68766,7 @@ var init_channel = __esm2({
68743
68766
  agentVersion: this.config.agentVersion ?? "0.0.0",
68744
68767
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68745
68768
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68746
- pluginVersion: true ? "0.23.37" : "0.0.0-dev"
68769
+ pluginVersion: true ? "0.23.39" : "0.0.0-dev"
68747
68770
  });
68748
68771
  this._telemetryReporter.startAutoFlush(3e4);
68749
68772
  }
@@ -69067,7 +69090,7 @@ var init_channel = __esm2({
69067
69090
  agentVersion: this.config.agentVersion ?? "0.0.0",
69068
69091
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69069
69092
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69070
- pluginVersion: true ? "0.23.37" : "0.0.0-dev"
69093
+ pluginVersion: true ? "0.23.39" : "0.0.0-dev"
69071
69094
  });
69072
69095
  this._telemetryReporter.startAutoFlush(3e4);
69073
69096
  }
@@ -69840,12 +69863,13 @@ ${messageText}`;
69840
69863
  * Returns the text unchanged when there is no attachment or the fetch fails —
69841
69864
  * but a failure is LOGGED and announced in the text, never silent.
69842
69865
  */
69843
- async _augmentWithAttachment(attachmentInfo, baseText) {
69866
+ async _augmentWithAttachment(attachmentInfo, baseText, roomId) {
69844
69867
  if (!attachmentInfo) return baseText;
69845
69868
  try {
69846
69869
  const { filePath, decrypted } = await this._downloadAndDecryptAttachment(attachmentInfo);
69847
69870
  const mime = String(attachmentInfo.mime ?? "application/octet-stream");
69848
69871
  const name = String(attachmentInfo.filename ?? "attachment");
69872
+ if (roomId) this._recentRoomAttachments.set(roomId, { filePath, name, at: Date.now() });
69849
69873
  const textMimes = ["text/", "application/json", "application/xml", "application/csv"];
69850
69874
  if (textMimes.some((m2) => mime.startsWith(m2))) {
69851
69875
  const content = new TextDecoder().decode(decrypted);
@@ -70475,7 +70499,9 @@ ${baseText}`;
70475
70499
  }
70476
70500
  }
70477
70501
  if (roomAttachment) {
70478
- messageText = await this._augmentWithAttachment(roomAttachment, messageText);
70502
+ messageText = await this._augmentWithAttachment(roomAttachment, messageText, resolvedRoomId);
70503
+ } else {
70504
+ messageText = this._withRecentRoomAttachmentNote(resolvedRoomId, messageText);
70479
70505
  }
70480
70506
  const roomMembers = this._persisted?.rooms?.[resolvedRoomId]?.members ?? [];
70481
70507
  const senderMember = roomMembers.find((m2) => m2.deviceId === senderDeviceId);
@@ -99517,7 +99543,7 @@ var init_index = __esm2({
99517
99543
  await init_skill_telemetry();
99518
99544
  await init_policy_enforcer();
99519
99545
  init_room_protocol();
99520
- VERSION = true ? "0.23.37" : "0.0.0-dev";
99546
+ VERSION = true ? "0.23.39" : "0.0.0-dev";
99521
99547
  }
99522
99548
  });
99523
99549
  await init_index();
@@ -99568,7 +99594,12 @@ var GrokSession = class {
99568
99594
  saidThisTurn = false;
99569
99595
  drain = Promise.resolve();
99570
99596
  push(text, reply, opts) {
99571
- this.queue.push({ text, reply, autoReplyOnText: opts?.replyExpected ?? opts?.autoReplyOnText });
99597
+ this.queue.push({
99598
+ text,
99599
+ reply,
99600
+ autoReplyOnText: opts?.replyExpected ?? opts?.autoReplyOnText,
99601
+ sayAllowed: opts?.replyExpected ?? true
99602
+ });
99572
99603
  if (!this.running) this.drain = this.run();
99573
99604
  }
99574
99605
  /** Hand this to startRoomMcpServer({ onSay }). The behaviour is stable for
@@ -99582,6 +99613,12 @@ var GrokSession = class {
99582
99613
  this.log(`say arrived with no turn in flight; DROPPED: ${JSON.stringify(text.slice(0, 80))}`);
99583
99614
  return;
99584
99615
  }
99616
+ if (!this.current.sayAllowed) {
99617
+ this.log(
99618
+ `say during a turn this agent does not owe (no @mention) \u2014 SUPPRESSED: ${JSON.stringify(text.slice(0, 80))}`
99619
+ );
99620
+ return;
99621
+ }
99585
99622
  this.saidThisTurn = true;
99586
99623
  const sink = this.current.reply ?? this.opts.onSay;
99587
99624
  if (!sink) {
@@ -100443,7 +100480,7 @@ async function main() {
100443
100480
  const info = parseInfoFlags(process.argv.slice(2));
100444
100481
  if (info.showVersion || info.showHelp) {
100445
100482
  const version2 = buildClientVersion2(
100446
- true ? "0.4.10" : void 0
100483
+ true ? "0.4.12" : void 0
100447
100484
  );
100448
100485
  if (info.showVersion) printLine(version2);
100449
100486
  if (info.showHelp) {
@@ -100496,7 +100533,7 @@ async function main() {
100496
100533
  agentName: cfg.agentName,
100497
100534
  platform: "node",
100498
100535
  clientVersion: buildClientVersion2(
100499
- true ? "0.4.10" : void 0
100536
+ true ? "0.4.12" : void 0
100500
100537
  )
100501
100538
  });
100502
100539
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "type": "module",
5
5
  "description": "AgentVault Grok Bridge — daemon bridging a Grok agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",