@agentvault/muse-bridge 0.1.48 → 0.1.49

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 +45 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13188,11 +13188,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
13188
13188
  return null;
13189
13189
  }
13190
13190
  function ownIdentity() {
13191
- const v2 = true ? "0.23.74" : FALLBACK;
13191
+ const v2 = true ? "0.23.75" : FALLBACK;
13192
13192
  return `${PACKAGE}@${v2}`;
13193
13193
  }
13194
13194
  function buildSha() {
13195
- const raw = true ? "91424d1" : "";
13195
+ const raw = true ? "c389222" : "";
13196
13196
  const cleaned = (raw ?? "").trim();
13197
13197
  return !cleaned || cleaned === "unknown" ? null : cleaned;
13198
13198
  }
@@ -16256,12 +16256,15 @@ function getActiveChannel(accountId = "default") {
16256
16256
  async function _handleInbound(params) {
16257
16257
  const { plaintext, metadata, channel, account, cfg, fileTurn } = params;
16258
16258
  const core = _ocRuntime;
16259
- if (metadata.roomId && metadata.senderBinding !== "bound") {
16260
- const ownDisplayName = channel.ownDisplayName ?? "";
16259
+ if (metadata.roomId) {
16261
16260
  const agentName = account.agentName ?? "";
16262
- const selfResolved = !!ownDisplayName || !!agentName && agentName.toLowerCase() !== "default";
16263
- if (!owesRoomReply(metadata.caption ?? plaintext, agentName, account.accountId ?? "", true, void 0, ownDisplayName, selfResolved, metadata.roomAudience, metadata.senderBinding)) {
16264
- console.log(`[AgentVault] room message from an unverified sender not addressed to this agent \u2014 not dispatched (#1855) room=${String(metadata.roomId).slice(0, 8)}`);
16261
+ const roomSelfName = _roomSelfName(channel, metadata.roomId);
16262
+ const ownDisplayName = channel.ownDisplayName ?? "";
16263
+ const selfResolved = !!ownDisplayName || !!roomSelfName && roomSelfName !== agentName || !!agentName && agentName.toLowerCase() !== "default";
16264
+ const gateText = metadata.caption ?? plaintext;
16265
+ const gateSenderIsAgent = metadata.senderBinding === "bound" ? metadata.senderIsAgent : true;
16266
+ if (!owesRoomReply(gateText, agentName, account.accountId ?? "", gateSenderIsAgent, roomSelfName || agentName, ownDisplayName, selfResolved, metadata.roomAudience, metadata.senderBinding)) {
16267
+ console.log(`[AgentVault] room message read, not answered \u2014 no @mention for this agent (#1107/#1859) room=${String(metadata.roomId).slice(0, 8)}`);
16265
16268
  return;
16266
16269
  }
16267
16270
  }
@@ -16290,9 +16293,16 @@ async function _handleInbound(params) {
16290
16293
  replyHost = { ...limitRoots !== void 0 ? { limitRoots } : {}, ...sandboxed ? { sandboxed: true } : {} };
16291
16294
  }
16292
16295
  noteTurnSandbox(fileTurn?.token, replyHost.sandboxed === true);
16293
- const modelBody = fileSendOn ? `${neutralizeForeignLine(plaintext)}
16296
+ const currentBody = neutralizeForeignLine(plaintext);
16297
+ const roomHistory = metadata.roomId ? _roomHistoryBlock(channel, metadata.roomId) : "";
16298
+ const contextBody = roomHistory ? `[Recent room conversation]
16299
+ ${roomHistory}
16300
+
16301
+ [Current message]
16302
+ ${currentBody}` : currentBody;
16303
+ const modelBody = fileSendOn ? `${contextBody}
16294
16304
 
16295
- ${openclawFileLines(channel, fileTarget, { roomsAllowed: false })}` : neutralizeForeignLine(plaintext);
16305
+ ${openclawFileLines(channel, fileTarget, { roomsAllowed: false })}` : contextBody;
16296
16306
  const body = core.channel.reply.formatAgentEnvelope({
16297
16307
  channel: "AgentVault",
16298
16308
  from: identity.name,
@@ -16374,6 +16384,27 @@ ${openclawFileLines(channel, fileTarget, { roomsAllowed: false })}` : neutralize
16374
16384
  const result = await trackedRun;
16375
16385
  await _legacyTurnRuns.afterDispatch(channel, runKey, fileTurn, result, trackedRun);
16376
16386
  }
16387
+ function _roomSelfName(channel, roomId) {
16388
+ try {
16389
+ const room = channel.getRooms().find((r2) => r2.roomId === roomId);
16390
+ const self2 = room?.members?.find((m2) => m2.deviceId === channel.deviceId);
16391
+ return typeof self2?.displayName === "string" ? self2.displayName : "";
16392
+ } catch {
16393
+ return "";
16394
+ }
16395
+ }
16396
+ function _roomHistoryBlock(channel, roomId) {
16397
+ const prior = channel.getRoomHistory(roomId, 20).slice(0, -1);
16398
+ return prior.map((h2) => {
16399
+ if (h2.sender === "agent") {
16400
+ const files = Array.isArray(h2.files) && h2.files.length > 0 ? `
16401
+ ${renderHistoryFiles(h2.files)}` : "";
16402
+ return `[You]: ${h2.text}${files}`;
16403
+ }
16404
+ const who = h2.sender === "unverified" ? "Unverified sender" : "Room Member";
16405
+ return `[${who}]: ${neutralizeForeignLine(String(h2.text ?? ""))}`;
16406
+ }).join("\n");
16407
+ }
16377
16408
  function resolveBaseUrl(options) {
16378
16409
  const host = options?.host ?? "127.0.0.1";
16379
16410
  const port = options?.port ?? (process.env.GATEWAY_SEND_PORT ? Number(process.env.GATEWAY_SEND_PORT) : 18790);
@@ -21723,7 +21754,7 @@ var init_dist = __esm({
21723
21754
  MENTION_RE = /@([\w-]+)/gi;
21724
21755
  BROADCAST_NAMES = /* @__PURE__ */ new Set(["all", "everyone"]);
21725
21756
  PRIVATE_ROOM_TURN_NOTE = "(private room: just you and your person \u2014 every message here is for you; answer it)";
21726
- GENERIC_AGENT_NAMES = /* @__PURE__ */ new Set(["default", "agent", "assistant", "bot", "main"]);
21757
+ GENERIC_AGENT_NAMES = /* @__PURE__ */ new Set(["default", "agent", "assistant", "bot", "main", "unnamed", "unnamed agent"]);
21727
21758
  }
21728
21759
  });
21729
21760
  init_safe_attachment_name = __esm2({
@@ -38672,7 +38703,7 @@ ${text}`,
38672
38703
  */
38673
38704
  sendActivitySpan(spanData) {
38674
38705
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
38675
- const pluginVersion = true ? "0.23.74" : "0.0.0-dev";
38706
+ const pluginVersion = true ? "0.23.75" : "0.0.0-dev";
38676
38707
  const agentName = this.config.agentName ?? "Agent";
38677
38708
  const resource = {
38678
38709
  "service.name": "agentvault-agent",
@@ -45457,7 +45488,7 @@ ${baseText}`;
45457
45488
  agentVersion: this.config.agentVersion ?? "0.0.0",
45458
45489
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
45459
45490
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
45460
- pluginVersion: true ? "0.23.74" : "0.0.0-dev"
45491
+ pluginVersion: true ? "0.23.75" : "0.0.0-dev"
45461
45492
  });
45462
45493
  this._telemetryReporter.startAutoFlush(3e4);
45463
45494
  }
@@ -69782,7 +69813,7 @@ data:
69782
69813
  init_tool_telemetry();
69783
69814
  init_turn_failure();
69784
69815
  init_shell_word();
69785
- VERSION = true ? "0.23.74" : "0.0.0-dev";
69816
+ VERSION = true ? "0.23.75" : "0.0.0-dev";
69786
69817
  }
69787
69818
  });
69788
69819
  init_index();
@@ -73190,7 +73221,7 @@ function mkdir700(path) {
73190
73221
  chmodSync5(path, 448);
73191
73222
  }
73192
73223
  function packageVersion() {
73193
- return true ? "0.1.48" : void 0;
73224
+ return true ? "0.1.49" : void 0;
73194
73225
  }
73195
73226
  function helpText(version2) {
73196
73227
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/muse-bridge",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
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",