@agentvault/grok-bridge 0.4.11 → 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 +46 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -64605,11 +64605,11 @@ var init_mls_kp_pool = __esm2({
64605
64605
  }
64606
64606
  });
64607
64607
  function ownIdentity() {
64608
- const v2 = true ? "0.23.38" : FALLBACK;
64608
+ const v2 = true ? "0.23.39" : FALLBACK;
64609
64609
  return `${PACKAGE}@${v2}`;
64610
64610
  }
64611
64611
  function buildSha() {
64612
- const raw = true ? "a6ce360-dirty" : "";
64612
+ const raw = true ? "9982fc8-dirty" : "";
64613
64613
  const cleaned = (raw ?? "").trim();
64614
64614
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64615
64615
  }
@@ -65712,6 +65712,27 @@ var init_channel = __esm2({
65712
65712
  * this process (GH #366). Cleared on (re)join so the next first message
65713
65713
  * re-fetches the authoritative roster. Prevents per-message refetch storms. */
65714
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
+ }
65715
65736
  /** In-flight roster-refresh promises (per room) — dedup concurrent refreshes. */
65716
65737
  _roomRosterRefreshInFlight = /* @__PURE__ */ new Map();
65717
65738
  /** Dedup buffer for A2A message IDs (prevents double-delivery via direct + Redis) */
@@ -66807,7 +66828,7 @@ var init_channel = __esm2({
66807
66828
  */
66808
66829
  sendActivitySpan(spanData) {
66809
66830
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66810
- const pluginVersion = true ? "0.23.38" : "0.0.0-dev";
66831
+ const pluginVersion = true ? "0.23.39" : "0.0.0-dev";
66811
66832
  const agentName = this.config.agentName ?? "Agent";
66812
66833
  const resource = {
66813
66834
  "service.name": "agentvault-agent",
@@ -68745,7 +68766,7 @@ var init_channel = __esm2({
68745
68766
  agentVersion: this.config.agentVersion ?? "0.0.0",
68746
68767
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68747
68768
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68748
- pluginVersion: true ? "0.23.38" : "0.0.0-dev"
68769
+ pluginVersion: true ? "0.23.39" : "0.0.0-dev"
68749
68770
  });
68750
68771
  this._telemetryReporter.startAutoFlush(3e4);
68751
68772
  }
@@ -69069,7 +69090,7 @@ var init_channel = __esm2({
69069
69090
  agentVersion: this.config.agentVersion ?? "0.0.0",
69070
69091
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69071
69092
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69072
- pluginVersion: true ? "0.23.38" : "0.0.0-dev"
69093
+ pluginVersion: true ? "0.23.39" : "0.0.0-dev"
69073
69094
  });
69074
69095
  this._telemetryReporter.startAutoFlush(3e4);
69075
69096
  }
@@ -69842,12 +69863,13 @@ ${messageText}`;
69842
69863
  * Returns the text unchanged when there is no attachment or the fetch fails —
69843
69864
  * but a failure is LOGGED and announced in the text, never silent.
69844
69865
  */
69845
- async _augmentWithAttachment(attachmentInfo, baseText) {
69866
+ async _augmentWithAttachment(attachmentInfo, baseText, roomId) {
69846
69867
  if (!attachmentInfo) return baseText;
69847
69868
  try {
69848
69869
  const { filePath, decrypted } = await this._downloadAndDecryptAttachment(attachmentInfo);
69849
69870
  const mime = String(attachmentInfo.mime ?? "application/octet-stream");
69850
69871
  const name = String(attachmentInfo.filename ?? "attachment");
69872
+ if (roomId) this._recentRoomAttachments.set(roomId, { filePath, name, at: Date.now() });
69851
69873
  const textMimes = ["text/", "application/json", "application/xml", "application/csv"];
69852
69874
  if (textMimes.some((m2) => mime.startsWith(m2))) {
69853
69875
  const content = new TextDecoder().decode(decrypted);
@@ -70477,7 +70499,9 @@ ${baseText}`;
70477
70499
  }
70478
70500
  }
70479
70501
  if (roomAttachment) {
70480
- messageText = await this._augmentWithAttachment(roomAttachment, messageText);
70502
+ messageText = await this._augmentWithAttachment(roomAttachment, messageText, resolvedRoomId);
70503
+ } else {
70504
+ messageText = this._withRecentRoomAttachmentNote(resolvedRoomId, messageText);
70481
70505
  }
70482
70506
  const roomMembers = this._persisted?.rooms?.[resolvedRoomId]?.members ?? [];
70483
70507
  const senderMember = roomMembers.find((m2) => m2.deviceId === senderDeviceId);
@@ -99519,7 +99543,7 @@ var init_index = __esm2({
99519
99543
  await init_skill_telemetry();
99520
99544
  await init_policy_enforcer();
99521
99545
  init_room_protocol();
99522
- VERSION = true ? "0.23.38" : "0.0.0-dev";
99546
+ VERSION = true ? "0.23.39" : "0.0.0-dev";
99523
99547
  }
99524
99548
  });
99525
99549
  await init_index();
@@ -99570,7 +99594,12 @@ var GrokSession = class {
99570
99594
  saidThisTurn = false;
99571
99595
  drain = Promise.resolve();
99572
99596
  push(text, reply, opts) {
99573
- 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
+ });
99574
99603
  if (!this.running) this.drain = this.run();
99575
99604
  }
99576
99605
  /** Hand this to startRoomMcpServer({ onSay }). The behaviour is stable for
@@ -99584,6 +99613,12 @@ var GrokSession = class {
99584
99613
  this.log(`say arrived with no turn in flight; DROPPED: ${JSON.stringify(text.slice(0, 80))}`);
99585
99614
  return;
99586
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
+ }
99587
99622
  this.saidThisTurn = true;
99588
99623
  const sink = this.current.reply ?? this.opts.onSay;
99589
99624
  if (!sink) {
@@ -100445,7 +100480,7 @@ async function main() {
100445
100480
  const info = parseInfoFlags(process.argv.slice(2));
100446
100481
  if (info.showVersion || info.showHelp) {
100447
100482
  const version2 = buildClientVersion2(
100448
- true ? "0.4.11" : void 0
100483
+ true ? "0.4.12" : void 0
100449
100484
  );
100450
100485
  if (info.showVersion) printLine(version2);
100451
100486
  if (info.showHelp) {
@@ -100498,7 +100533,7 @@ async function main() {
100498
100533
  agentName: cfg.agentName,
100499
100534
  platform: "node",
100500
100535
  clientVersion: buildClientVersion2(
100501
- true ? "0.4.11" : void 0
100536
+ true ? "0.4.12" : void 0
100502
100537
  )
100503
100538
  });
100504
100539
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.11",
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",