@agentvault/muse-bridge 0.1.17 → 0.1.18

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/bridge.d.ts CHANGED
@@ -9,6 +9,9 @@ export interface RoomMessage {
9
9
  roomId: string;
10
10
  senderName: string;
11
11
  plaintext: string;
12
+ /** #1223 — the text the sender typed, before any attachment was folded into
13
+ * `plaintext`. The @ gate reads this; absent on emitters < 0.23.42. */
14
+ caption?: string;
12
15
  senderIsAgent?: boolean;
13
16
  }
14
17
  export interface MessageMeta {
package/dist/index.js CHANGED
@@ -279,6 +279,7 @@ __export(dist_exports, {
279
279
  sendToRoom: () => sendToRoom,
280
280
  sendToTarget: () => sendToTarget,
281
281
  setOcRuntime: () => setOcRuntime,
282
+ stripCaptionMentions: () => stripCaptionMentions,
282
283
  stripMentions: () => stripMentions,
283
284
  wrapSkillExecution: () => wrapSkillExecution
284
285
  });
@@ -386,6 +387,19 @@ function stripMentions(text, agentName, accountId, roomDisplayName, ownDisplayNa
386
387
  return name.slice(matched.length);
387
388
  }).replace(/^\s+/, "").trim();
388
389
  }
390
+ function stripCaptionMentions(text, caption, agentName, accountId, roomDisplayName, ownDisplayName, roomId) {
391
+ if (typeof caption !== "string") {
392
+ return stripMentions(text, agentName, accountId, roomDisplayName, ownDisplayName);
393
+ }
394
+ const at = text.lastIndexOf(caption);
395
+ if (at < 0) {
396
+ console.warn(
397
+ `[AgentVault] caption not found in the folded text \u2014 left un-stripped rather than edit the fold (#1239) room=${(roomId ?? "").slice(0, 8)} caption_len=${caption.length} text_len=${text.length}`
398
+ );
399
+ return text;
400
+ }
401
+ return text.slice(0, at) + stripMentions(caption, agentName, accountId, roomDisplayName, ownDisplayName) + text.slice(at + caption.length);
402
+ }
389
403
  function _(e) {
390
404
  if ("function" == typeof TextEncoder) return new TextEncoder().encode(e);
391
405
  e = unescape(encodeURIComponent(e));
@@ -11517,11 +11531,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11517
11531
  return null;
11518
11532
  }
11519
11533
  function ownIdentity() {
11520
- const v2 = true ? "0.23.41" : FALLBACK;
11534
+ const v2 = true ? "0.23.42" : FALLBACK;
11521
11535
  return `${PACKAGE}@${v2}`;
11522
11536
  }
11523
11537
  function buildSha() {
11524
- const raw = true ? "916d6c5-dirty" : "";
11538
+ const raw = true ? "d9d53a0-dirty" : "";
11525
11539
  const cleaned = (raw ?? "").trim();
11526
11540
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11527
11541
  }
@@ -70226,7 +70240,7 @@ ${text}`;
70226
70240
  */
70227
70241
  sendActivitySpan(spanData) {
70228
70242
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70229
- const pluginVersion = true ? "0.23.41" : "0.0.0-dev";
70243
+ const pluginVersion = true ? "0.23.42" : "0.0.0-dev";
70230
70244
  const agentName = this.config.agentName ?? "Agent";
70231
70245
  const resource = {
70232
70246
  "service.name": "agentvault-agent",
@@ -72164,7 +72178,7 @@ ${text}`;
72164
72178
  agentVersion: this.config.agentVersion ?? "0.0.0",
72165
72179
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72166
72180
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72167
- pluginVersion: true ? "0.23.41" : "0.0.0-dev"
72181
+ pluginVersion: true ? "0.23.42" : "0.0.0-dev"
72168
72182
  });
72169
72183
  this._telemetryReporter.startAutoFlush(3e4);
72170
72184
  }
@@ -72488,7 +72502,7 @@ ${text}`;
72488
72502
  agentVersion: this.config.agentVersion ?? "0.0.0",
72489
72503
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72490
72504
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72491
- pluginVersion: true ? "0.23.41" : "0.0.0-dev"
72505
+ pluginVersion: true ? "0.23.42" : "0.0.0-dev"
72492
72506
  });
72493
72507
  this._telemetryReporter.startAutoFlush(3e4);
72494
72508
  }
@@ -73251,7 +73265,13 @@ ${messageText}`;
73251
73265
  messageType: msgData.message_type ?? "text",
73252
73266
  priority: msgData.priority ?? "normal",
73253
73267
  envelopeVersion: msgData.envelope_version ?? "1.0.0",
73254
- roomId
73268
+ roomId,
73269
+ // #1223 — the pre-fold text. This DR `message` path also sets `roomId`
73270
+ // and folds an attachment into `emitText`, so without this a room
73271
+ // message that reaches the gate here would fall back to the folded
73272
+ // text (the same bug the MLS room path fixes). `messageText` is the
73273
+ // envelope text before the fold; `emitText` is the folded copy.
73274
+ caption: messageText
73255
73275
  };
73256
73276
  this.emit("message", emitText, metadata);
73257
73277
  Promise.resolve(this.config.onMessage?.(emitText, metadata)).catch((err) => {
@@ -73930,6 +73950,7 @@ ${baseText}`;
73930
73950
  await this._refreshRoomRoster(resolvedRoomId);
73931
73951
  }
73932
73952
  }
73953
+ const caption = messageText;
73933
73954
  const addressed = parseMentions(messageText).length > 0;
73934
73955
  if (roomAttachment && !addressed) {
73935
73956
  this._deferRoomAttachment(resolvedRoomId, roomAttachment);
@@ -73956,7 +73977,8 @@ ${baseText}`;
73956
73977
  senderDeviceId,
73957
73978
  senderIsAgent,
73958
73979
  senderName: senderMember?.displayName || "unknown",
73959
- roomName: this._persisted?.rooms?.[resolvedRoomId]?.name
73980
+ roomName: this._persisted?.rooms?.[resolvedRoomId]?.name,
73981
+ caption
73960
73982
  };
73961
73983
  const senderLabel = senderMember?.displayName || "someone";
73962
73984
  this._appendHistory("owner", messageText, `room:${resolvedRoomId}`);
@@ -73965,6 +73987,9 @@ ${baseText}`;
73965
73987
  senderDeviceId,
73966
73988
  senderName: senderLabel,
73967
73989
  plaintext: messageText,
73990
+ // #1223 — what the sender typed, before the attachment fold. The
73991
+ // bridges gate on this (falling back to `plaintext` when absent).
73992
+ caption,
73968
73993
  messageType,
73969
73994
  timestamp: data.created_at ?? (/* @__PURE__ */ new Date()).toISOString(),
73970
73995
  // Native bridge (claude-room-bridge) consumes this to decide reply
@@ -98459,7 +98484,7 @@ data:
98459
98484
  await init_skill_telemetry();
98460
98485
  await init_policy_enforcer();
98461
98486
  init_room_protocol();
98462
- VERSION = true ? "0.23.41" : "0.0.0-dev";
98487
+ VERSION = true ? "0.23.42" : "0.0.0-dev";
98463
98488
  }
98464
98489
  });
98465
98490
  await init_index();
@@ -99754,7 +99779,7 @@ function _makeOwesReply(agentName, channel, log) {
99754
99779
  );
99755
99780
  }
99756
99781
  return owesRoomReply(
99757
- e.plaintext,
99782
+ e.caption ?? e.plaintext,
99758
99783
  own,
99759
99784
  own,
99760
99785
  e.senderIsAgent,
@@ -99842,7 +99867,7 @@ function mkdir700(path2) {
99842
99867
  chmodSync5(path2, 448);
99843
99868
  }
99844
99869
  function packageVersion() {
99845
- return true ? "0.1.17" : void 0;
99870
+ return true ? "0.1.18" : void 0;
99846
99871
  }
99847
99872
  function helpText(version2) {
99848
99873
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/muse-bridge",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "type": "module",
5
5
  "description": "AgentVault Muse Bridge — daemon bridging a Muse agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",