@agentvault/claude-bridge 0.8.45 → 0.8.46

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 +62 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13074,11 +13074,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
13074
13074
  return null;
13075
13075
  }
13076
13076
  function ownIdentity() {
13077
- const v22 = true ? "0.23.74" : FALLBACK;
13077
+ const v22 = true ? "0.23.75" : FALLBACK;
13078
13078
  return `${PACKAGE}@${v22}`;
13079
13079
  }
13080
13080
  function buildSha() {
13081
- const raw = true ? "91424d1" : "";
13081
+ const raw = true ? "c389222" : "";
13082
13082
  const cleaned = (raw ?? "").trim();
13083
13083
  return !cleaned || cleaned === "unknown" ? null : cleaned;
13084
13084
  }
@@ -13342,6 +13342,21 @@ function FILE_SEND_RULE(tool) {
13342
13342
  const t22 = clean6(tool, 60) || "send_file";
13343
13343
  return `You can send a file only by calling \`${t22}\`. Each conversation has its own staging folder, and the turn tells you which one. Put files for this chat there. In a room, only files in that room's own folder can be shared, and only when your owner asked you in that room. Files over 5 MB, hidden files and credential files cannot be sent. A file has been sent only when \`${t22}\` answers "File sent". Never say a file is attached, sent or shared otherwise. If it returns an error, tell the person the file was not sent and why.`;
13344
13344
  }
13345
+ function safeLineName(name) {
13346
+ return neutralizeSystemPrefix(clean6(name, 200)).replace(/[[\]\uff3b\uff3d]/g, "").replace(/agentvault-system \(quoted\):/gi, "AgentVault-system (quoted)");
13347
+ }
13348
+ function renderHistoryFiles(files) {
13349
+ const parts = files.map((f22) => `${safeLineName(f22.filename)} (${sizeLabel(f22.size)})`);
13350
+ const line = parts.length === 1 ? `[AgentVault system: you sent the file ${parts[0]}]` : `[AgentVault system: you sent the files ${parts.join(", ")}]`;
13351
+ RENDERED_LINES.delete(line);
13352
+ RENDERED_LINES.add(line);
13353
+ while (RENDERED_LINES.size > RENDERED_MAX) {
13354
+ const oldest = RENDERED_LINES.values().next().value;
13355
+ if (oldest === void 0) break;
13356
+ RENDERED_LINES.delete(oldest);
13357
+ }
13358
+ return line;
13359
+ }
13345
13360
  function normalizeForMatch(text) {
13346
13361
  return text.normalize("NFKC").replace(new RegExp("\\p{Cf}", "gu"), "").replace(/\s+/g, " ").toLowerCase();
13347
13362
  }
@@ -16028,12 +16043,15 @@ function dmSenderIdentity(metadata) {
16028
16043
  async function _handleInbound(params) {
16029
16044
  const { plaintext, metadata, channel, account, cfg, fileTurn } = params;
16030
16045
  const core = _ocRuntime;
16031
- if (metadata.roomId && metadata.senderBinding !== "bound") {
16032
- const ownDisplayName = channel.ownDisplayName ?? "";
16046
+ if (metadata.roomId) {
16033
16047
  const agentName = account.agentName ?? "";
16034
- const selfResolved = !!ownDisplayName || !!agentName && agentName.toLowerCase() !== "default";
16035
- if (!owesRoomReply(metadata.caption ?? plaintext, agentName, account.accountId ?? "", true, void 0, ownDisplayName, selfResolved, metadata.roomAudience, metadata.senderBinding)) {
16036
- 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)}`);
16048
+ const roomSelfName = _roomSelfName(channel, metadata.roomId);
16049
+ const ownDisplayName = channel.ownDisplayName ?? "";
16050
+ const selfResolved = !!ownDisplayName || !!roomSelfName && roomSelfName !== agentName || !!agentName && agentName.toLowerCase() !== "default";
16051
+ const gateText = metadata.caption ?? plaintext;
16052
+ const gateSenderIsAgent = metadata.senderBinding === "bound" ? metadata.senderIsAgent : true;
16053
+ if (!owesRoomReply(gateText, agentName, account.accountId ?? "", gateSenderIsAgent, roomSelfName || agentName, ownDisplayName, selfResolved, metadata.roomAudience, metadata.senderBinding)) {
16054
+ console.log(`[AgentVault] room message read, not answered \u2014 no @mention for this agent (#1107/#1859) room=${String(metadata.roomId).slice(0, 8)}`);
16037
16055
  return;
16038
16056
  }
16039
16057
  }
@@ -16062,9 +16080,16 @@ async function _handleInbound(params) {
16062
16080
  replyHost = { ...limitRoots !== void 0 ? { limitRoots } : {}, ...sandboxed ? { sandboxed: true } : {} };
16063
16081
  }
16064
16082
  noteTurnSandbox(fileTurn?.token, replyHost.sandboxed === true);
16065
- const modelBody = fileSendOn ? `${neutralizeForeignLine(plaintext)}
16083
+ const currentBody = neutralizeForeignLine(plaintext);
16084
+ const roomHistory = metadata.roomId ? _roomHistoryBlock(channel, metadata.roomId) : "";
16085
+ const contextBody = roomHistory ? `[Recent room conversation]
16086
+ ${roomHistory}
16087
+
16088
+ [Current message]
16089
+ ${currentBody}` : currentBody;
16090
+ const modelBody = fileSendOn ? `${contextBody}
16066
16091
 
16067
- ${openclawFileLines(channel, fileTarget, { roomsAllowed: false })}` : neutralizeForeignLine(plaintext);
16092
+ ${openclawFileLines(channel, fileTarget, { roomsAllowed: false })}` : contextBody;
16068
16093
  const body = core.channel.reply.formatAgentEnvelope({
16069
16094
  channel: "AgentVault",
16070
16095
  from: identity.name,
@@ -16146,6 +16171,27 @@ ${openclawFileLines(channel, fileTarget, { roomsAllowed: false })}` : neutralize
16146
16171
  const result = await trackedRun;
16147
16172
  await _legacyTurnRuns.afterDispatch(channel, runKey, fileTurn, result, trackedRun);
16148
16173
  }
16174
+ function _roomSelfName(channel, roomId) {
16175
+ try {
16176
+ const room = channel.getRooms().find((r22) => r22.roomId === roomId);
16177
+ const self2 = room?.members?.find((m22) => m22.deviceId === channel.deviceId);
16178
+ return typeof self2?.displayName === "string" ? self2.displayName : "";
16179
+ } catch {
16180
+ return "";
16181
+ }
16182
+ }
16183
+ function _roomHistoryBlock(channel, roomId) {
16184
+ const prior = channel.getRoomHistory(roomId, 20).slice(0, -1);
16185
+ return prior.map((h22) => {
16186
+ if (h22.sender === "agent") {
16187
+ const files = Array.isArray(h22.files) && h22.files.length > 0 ? `
16188
+ ${renderHistoryFiles(h22.files)}` : "";
16189
+ return `[You]: ${h22.text}${files}`;
16190
+ }
16191
+ const who = h22.sender === "unverified" ? "Unverified sender" : "Room Member";
16192
+ return `[${who}]: ${neutralizeForeignLine(String(h22.text ?? ""))}`;
16193
+ }).join("\n");
16194
+ }
16149
16195
  function getErrorMap() {
16150
16196
  return overrideErrorMap;
16151
16197
  }
@@ -20880,7 +20926,7 @@ var init_dist = __esm({
20880
20926
  MENTION_RE = /@([\w-]+)/gi;
20881
20927
  BROADCAST_NAMES = /* @__PURE__ */ new Set(["all", "everyone"]);
20882
20928
  PRIVATE_ROOM_TURN_NOTE = "(private room: just you and your person \u2014 every message here is for you; answer it)";
20883
- GENERIC_AGENT_NAMES = /* @__PURE__ */ new Set(["default", "agent", "assistant", "bot", "main"]);
20929
+ GENERIC_AGENT_NAMES = /* @__PURE__ */ new Set(["default", "agent", "assistant", "bot", "main", "unnamed", "unnamed agent"]);
20884
20930
  }
20885
20931
  });
20886
20932
  init_safe_attachment_name = __esm2({
@@ -37829,7 +37875,7 @@ ${text}`,
37829
37875
  */
37830
37876
  sendActivitySpan(spanData) {
37831
37877
  if (!this._ws || this._ws.readyState !== WebSocket2.OPEN) return;
37832
- const pluginVersion = true ? "0.23.74" : "0.0.0-dev";
37878
+ const pluginVersion = true ? "0.23.75" : "0.0.0-dev";
37833
37879
  const agentName = this.config.agentName ?? "Agent";
37834
37880
  const resource = {
37835
37881
  "service.name": "agentvault-agent",
@@ -44614,7 +44660,7 @@ ${baseText}`;
44614
44660
  agentVersion: this.config.agentVersion ?? "0.0.0",
44615
44661
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
44616
44662
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
44617
- pluginVersion: true ? "0.23.74" : "0.0.0-dev"
44663
+ pluginVersion: true ? "0.23.75" : "0.0.0-dev"
44618
44664
  });
44619
44665
  this._telemetryReporter.startAutoFlush(3e4);
44620
44666
  }
@@ -68939,7 +68985,7 @@ data:
68939
68985
  init_tool_telemetry();
68940
68986
  init_turn_failure();
68941
68987
  init_shell_word();
68942
- VERSION = true ? "0.23.74" : "0.0.0-dev";
68988
+ VERSION = true ? "0.23.75" : "0.0.0-dev";
68943
68989
  }
68944
68990
  });
68945
68991
  init_index();
@@ -113967,7 +114013,7 @@ function makeShutdown(deps) {
113967
114013
 
113968
114014
  // src/index.ts
113969
114015
  async function main() {
113970
- if (answerInfoFlags(process.argv, true ? "0.8.45" : void 0, printLine)) {
114016
+ if (answerInfoFlags(process.argv, true ? "0.8.46" : void 0, printLine)) {
113971
114017
  process.exit(0);
113972
114018
  }
113973
114019
  if (process.argv[2] === "recovery" && await (await Promise.resolve().then(() => (init_recovery(), recovery_exports))).maybeRunRecoverySubcommand()) {
@@ -113995,7 +114041,7 @@ async function main() {
113995
114041
  "[bridge] warning: passing the invite token on the command line is visible to other local users via 'ps'. Prefer: AV_INVITE_TOKEN=\u2026 npx @agentvault/claude-bridge"
113996
114042
  );
113997
114043
  }
113998
- logLine(`[bridge] version: ${true ? "0.8.45" : "dev"}`);
114044
+ logLine(`[bridge] version: ${true ? "0.8.46" : "dev"}`);
113999
114045
  logLine(`[bridge] data dir: ${cfg.dataDir} (${cfg.dataDirSource})`);
114000
114046
  logLine(`[bridge] workspace: ${cfg.workspaceDir} \xB7 permissions: ${cfg.permissionMode} \xB7 enclave dir fenced`);
114001
114047
  if (cfg.armRoom) {
@@ -114028,7 +114074,7 @@ async function main() {
114028
114074
  // its default would render "@agentvault/agentvault@0.7.x" — the wrong
114029
114075
  // package name attached to the bridge's version number, which is worse
114030
114076
  // than either alone.
114031
- clientVersion: `@agentvault/claude-bridge@${true ? "0.8.45" : "dev"}`
114077
+ clientVersion: `@agentvault/claude-bridge@${true ? "0.8.46" : "dev"}`
114032
114078
  }, inbox));
114033
114079
  inbox.bindChannel(channel);
114034
114080
  const agentSystemPrompt = withFileSendRule(cfg.systemPrompt ?? identityPrompt(cfg.agentName));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.8.45",
3
+ "version": "0.8.46",
4
4
  "type": "module",
5
5
  "description": "AgentVault Claude Bridge — daemon for bridging a Claude agent into secure E2E-encrypted AgentVault 1:1 direct messages and rooms.",
6
6
  "main": "dist/index.js",