@agentvault/claude-bridge 0.8.6 → 0.8.8

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 +29 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51706,11 +51706,6 @@ var init_clientConfig = __esm2({
51706
51706
  };
51707
51707
  }
51708
51708
  });
51709
- function arraysEqual(a2, b22) {
51710
- if (a2.length !== b22.length)
51711
- return false;
51712
- return a2.every((val, index) => val === b22[index]);
51713
- }
51714
51709
  var init_array = __esm2({
51715
51710
  "../crypto/node_modules/ts-mls/dist/src/util/array.js"() {
51716
51711
  }
@@ -51898,7 +51893,7 @@ async function validateRatchetTree(tree, groupContext, config22, authService, tr
51898
51893
  if (dpNode !== void 0) {
51899
51894
  if (dpNode.nodeType !== "parent")
51900
51895
  return new InternalError("Expected parent node");
51901
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n22.parent.unmergedLeaves))
51896
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
51902
51897
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
51903
51898
  }
51904
51899
  }
@@ -64612,11 +64607,11 @@ var init_mls_kp_pool = __esm2({
64612
64607
  }
64613
64608
  });
64614
64609
  function ownIdentity() {
64615
- const v22 = true ? "0.23.33" : FALLBACK;
64610
+ const v22 = true ? "0.23.35" : FALLBACK;
64616
64611
  return `${PACKAGE}@${v22}`;
64617
64612
  }
64618
64613
  function buildSha() {
64619
- const raw = true ? "7b91f2f-dirty" : "";
64614
+ const raw = true ? "bcb9297-dirty" : "";
64620
64615
  const cleaned = (raw ?? "").trim();
64621
64616
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64622
64617
  }
@@ -66814,7 +66809,7 @@ var init_channel = __esm2({
66814
66809
  */
66815
66810
  sendActivitySpan(spanData) {
66816
66811
  if (!this._ws || this._ws.readyState !== WebSocket2.OPEN) return;
66817
- const pluginVersion = true ? "0.23.33" : "0.0.0-dev";
66812
+ const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
66818
66813
  const agentName = this.config.agentName ?? "Agent";
66819
66814
  const resource = {
66820
66815
  "service.name": "agentvault-agent",
@@ -68752,7 +68747,7 @@ var init_channel = __esm2({
68752
68747
  agentVersion: this.config.agentVersion ?? "0.0.0",
68753
68748
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68754
68749
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68755
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
68750
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
68756
68751
  });
68757
68752
  this._telemetryReporter.startAutoFlush(3e4);
68758
68753
  }
@@ -69076,7 +69071,7 @@ var init_channel = __esm2({
69076
69071
  agentVersion: this.config.agentVersion ?? "0.0.0",
69077
69072
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69078
69073
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69079
- pluginVersion: true ? "0.23.33" : "0.0.0-dev"
69074
+ pluginVersion: true ? "0.23.35" : "0.0.0-dev"
69080
69075
  });
69081
69076
  this._telemetryReporter.startAutoFlush(3e4);
69082
69077
  }
@@ -69480,6 +69475,7 @@ var init_channel = __esm2({
69480
69475
  try {
69481
69476
  const cipherBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
69482
69477
  const result = await mgr.decrypt(cipherBytes);
69478
+ if (mgrKey) this._mlsDecryptFailCounts.delete(mgrKey);
69483
69479
  const mlsGroupId = (convGroupId ? this._persisted?.mlsGroups?.[convGroupId]?.mlsGroupId : null) ?? this._persisted?.mlsConversations?.[convId]?.mlsGroupId ?? groupId;
69484
69480
  if (mlsGroupId) {
69485
69481
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mgr.exportState()));
@@ -69584,6 +69580,10 @@ var init_channel = __esm2({
69584
69580
  this.config.onMessage(text, metadata);
69585
69581
  }
69586
69582
  } catch (decryptErr) {
69583
+ if (classifyCommitFailure(data.epoch, mgr?.epoch) === "already-applied") {
69584
+ console.debug(`[SecureChannel] MLS 1:1 message at epoch ${String(data.epoch)} predates our epoch ${String(mgr?.epoch)} \u2014 cannot decrypt, ignoring`);
69585
+ return;
69586
+ }
69587
69587
  const failKey = mgrKey || `unknown:${groupId}`;
69588
69588
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
69589
69589
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -70425,6 +70425,7 @@ ${baseText}`;
70425
70425
  try {
70426
70426
  const ciphertext = Buffer.from(data.payload, "hex");
70427
70427
  const result = await mlsGroup.decrypt(new Uint8Array(ciphertext));
70428
+ this._mlsDecryptFailCounts.delete(resolvedRoomId);
70428
70429
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
70429
70430
  if (result.isHandshake || !result.plaintext) {
70430
70431
  return;
@@ -70514,6 +70515,10 @@ ${baseText}`;
70514
70515
  console.error("[SecureChannel] onMessage callback error (MLS):", err);
70515
70516
  });
70516
70517
  } catch (err) {
70518
+ if (classifyCommitFailure(data.epoch, mlsGroup.epoch) === "already-applied") {
70519
+ console.debug(`[SecureChannel] MLS room message at epoch ${String(data.epoch)} predates our epoch ${String(mlsGroup.epoch)} for ${resolvedRoomId.slice(0, 8)} \u2014 cannot decrypt, ignoring`);
70520
+ return;
70521
+ }
70517
70522
  const failKey = resolvedRoomId;
70518
70523
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
70519
70524
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -71553,6 +71558,11 @@ ${baseText}`;
71553
71558
  nackedIds.push(msg.queue_id);
71554
71559
  if (msg.group_id && (msg.message_type === "commit" || msg.message_type === "application")) {
71555
71560
  const failKey = msg.conversation_group_id ? `1to1-group:${msg.conversation_group_id}` : `group:${msg.group_id}`;
71561
+ const localMgr = msg.room_id && this._mlsGroups.get(msg.room_id) || this._mlsGroups.get(failKey);
71562
+ if (classifyCommitFailure(msg.epoch, localMgr?.epoch) === "already-applied") {
71563
+ console.debug(`[SecureChannel] Delivery ${msg.message_type} at epoch ${String(msg.epoch)} predates our epoch ${String(localMgr?.epoch)} \u2014 not counting toward recovery`);
71564
+ continue;
71565
+ }
71556
71566
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
71557
71567
  this._mlsDecryptFailCounts.set(failKey, count);
71558
71568
  if (count >= _SecureChannel.MAX_MLS_DECRYPT_FAILS) {
@@ -72230,6 +72240,7 @@ ${baseText}`;
72230
72240
  try {
72231
72241
  const ciphertext = new Uint8Array(Buffer.from(data.payload, "hex"));
72232
72242
  const result = await mlsGroup.decrypt(ciphertext);
72243
+ this._mlsDecryptFailCounts.delete(`a2a:${a2aChannelId}`);
72233
72244
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
72234
72245
  if (result.isHandshake || !result.plaintext) {
72235
72246
  return;
@@ -72250,6 +72261,10 @@ ${baseText}`;
72250
72261
  this.config.onA2AMessage(a2aMsg);
72251
72262
  }
72252
72263
  } catch (err) {
72264
+ if (classifyCommitFailure(data.epoch, mlsGroup?.epoch) === "already-applied") {
72265
+ console.debug(`[SecureChannel] MLS A2A message at epoch ${String(data.epoch)} predates our epoch ${String(mlsGroup?.epoch)} for ${a2aChannelId.slice(0, 8)} \u2014 cannot decrypt, ignoring`);
72266
+ return;
72267
+ }
72253
72268
  const failKey = `a2a:${a2aChannelId}`;
72254
72269
  const count = (this._mlsDecryptFailCounts.get(failKey) ?? 0) + 1;
72255
72270
  this._mlsDecryptFailCounts.set(failKey, count);
@@ -99468,7 +99483,7 @@ var init_index = __esm2({
99468
99483
  await init_skill_telemetry();
99469
99484
  await init_policy_enforcer();
99470
99485
  init_room_protocol();
99471
- VERSION = true ? "0.23.33" : "0.0.0-dev";
99486
+ VERSION = true ? "0.23.35" : "0.0.0-dev";
99472
99487
  }
99473
99488
  });
99474
99489
  await init_index();
@@ -135872,7 +135887,7 @@ async function main() {
135872
135887
  "[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"
135873
135888
  );
135874
135889
  }
135875
- logLine(`[bridge] version: ${true ? "0.8.6" : "dev"}`);
135890
+ logLine(`[bridge] version: ${true ? "0.8.8" : "dev"}`);
135876
135891
  logLine(`[bridge] data dir: ${cfg.dataDir} (${cfg.dataDirSource})`);
135877
135892
  logLine(`[bridge] workspace: ${cfg.workspaceDir} \xB7 permissions: ${cfg.permissionMode} \xB7 enclave dir fenced`);
135878
135893
  if (cfg.armRoom) {
@@ -135904,7 +135919,7 @@ async function main() {
135904
135919
  // its default would render "@agentvault/agentvault@0.7.x" — the wrong
135905
135920
  // package name attached to the bridge's version number, which is worse
135906
135921
  // than either alone.
135907
- clientVersion: `@agentvault/claude-bridge@${true ? "0.8.6" : "dev"}`
135922
+ clientVersion: `@agentvault/claude-bridge@${true ? "0.8.8" : "dev"}`
135908
135923
  });
135909
135924
  const agentSystemPrompt = cfg.systemPrompt ?? `You are ${cfg.agentName}, an AI agent on AgentVault. You talk with your owner in 1:1 direct messages and collaborate with other agents in shared rooms. That is your identity \u2014 introduce yourself by that name and do not claim to be any other agent. To speak, call the say tool. In a 1:1 with your owner, reply to what they say. In a room you see every message \u2014 call say only when you have something worth adding, and otherwise stay silent. Keep messages concise.`;
135910
135925
  const deviceJwt = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
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",