@agentvault/claude-bridge 0.8.8 → 0.8.10

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 +54 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -52059,7 +52059,10 @@ async function applyProposals(state, proposals, committerLeafIndex, pskSearch, s
52059
52059
  const [mutatedTree, addedLeafNodes] = await applyTreeMutations(state.ratchetTree, grouped, state.groupContext, sentByClient, state.clientConfig.authService, state.clientConfig.lifetimeConfig, cs.signature);
52060
52060
  const [updatedPskSecret, pskIds] = await accumulatePskSecret(grouped.psk.map((p2) => p2.proposal.psk.preSharedKeyId), pskSearch, cs, zeroes);
52061
52061
  const selfRemoved = mutatedTree[leafToNodeIndex(toLeafIndex(state.privatePath.leafIndex))] === void 0;
52062
- const needsUpdatePath = allProposals.length === 0 || Object.values(grouped.update).length > 1 || Object.values(grouped.remove).length > 1;
52062
+ const needsUpdatePath = allProposals.length === 0 || allProposals.some(({ proposal }) => {
52063
+ const t22 = proposal.proposalType;
52064
+ return t22 !== "add" && t22 !== "psk" && t22 !== "reinit";
52065
+ });
52063
52066
  return {
52064
52067
  tree: mutatedTree,
52065
52068
  pskSecret: updatedPskSecret,
@@ -64607,11 +64610,11 @@ var init_mls_kp_pool = __esm2({
64607
64610
  }
64608
64611
  });
64609
64612
  function ownIdentity() {
64610
- const v22 = true ? "0.23.35" : FALLBACK;
64613
+ const v22 = true ? "0.23.37" : FALLBACK;
64611
64614
  return `${PACKAGE}@${v22}`;
64612
64615
  }
64613
64616
  function buildSha() {
64614
- const raw = true ? "bcb9297-dirty" : "";
64617
+ const raw = true ? "58c552f-dirty" : "";
64615
64618
  const cleaned = (raw ?? "").trim();
64616
64619
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64617
64620
  }
@@ -66809,7 +66812,7 @@ var init_channel = __esm2({
66809
66812
  */
66810
66813
  sendActivitySpan(spanData) {
66811
66814
  if (!this._ws || this._ws.readyState !== WebSocket2.OPEN) return;
66812
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
66815
+ const pluginVersion = true ? "0.23.37" : "0.0.0-dev";
66813
66816
  const agentName = this.config.agentName ?? "Agent";
66814
66817
  const resource = {
66815
66818
  "service.name": "agentvault-agent",
@@ -68747,7 +68750,7 @@ var init_channel = __esm2({
68747
68750
  agentVersion: this.config.agentVersion ?? "0.0.0",
68748
68751
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68749
68752
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68750
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
68753
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
68751
68754
  });
68752
68755
  this._telemetryReporter.startAutoFlush(3e4);
68753
68756
  }
@@ -69071,7 +69074,7 @@ var init_channel = __esm2({
69071
69074
  agentVersion: this.config.agentVersion ?? "0.0.0",
69072
69075
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69073
69076
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69074
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
69077
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
69075
69078
  });
69076
69079
  this._telemetryReporter.startAutoFlush(3e4);
69077
69080
  }
@@ -70845,6 +70848,7 @@ ${baseText}`;
70845
70848
  return 0;
70846
70849
  }
70847
70850
  const snapshot = mlsGroup.exportState();
70851
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
70848
70852
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t22) => t22.keyPackage));
70849
70853
  let sentCommits = 0;
70850
70854
  for (const c22 of commits) {
@@ -70856,12 +70860,14 @@ ${baseText}`;
70856
70860
  // The epoch this commit PRODUCED. After two commits the manager
70857
70861
  // only knows the last one, which is why the result carries them.
70858
70862
  epoch: Number(c22.epoch),
70859
- payload: Buffer.from(c22.commit).toString("hex")
70863
+ payload: Buffer.from(c22.commit).toString("hex"),
70864
+ ...parent2 ? { parent_digest: parent2 } : {}
70860
70865
  }
70861
70866
  },
70862
70867
  `${label} commit ${sentCommits + 1}/${commits.length}`
70863
70868
  );
70864
70869
  if (!ok2) break;
70870
+ parent2 = this._commitDigest(c22.commit);
70865
70871
  sentCommits++;
70866
70872
  }
70867
70873
  if (sentCommits === 0) {
@@ -70948,6 +70954,32 @@ ${baseText}`;
70948
70954
  _wsIsOpen() {
70949
70955
  return this._ws?.readyState === 1;
70950
70956
  }
70957
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
70958
+ _commitDigest(bytes) {
70959
+ return createHash("sha256").update(bytes).digest("hex");
70960
+ }
70961
+ /**
70962
+ * #1177: the digest of the commit at the server's head, or undefined.
70963
+ *
70964
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
70965
+ * deliberately the same value. The commit is sent either way: the server
70966
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
70967
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
70968
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
70969
+ */
70970
+ async _readGroupHeadDigest(groupId) {
70971
+ try {
70972
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
70973
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
70974
+ });
70975
+ if (!res.ok) return void 0;
70976
+ const head = await res.json();
70977
+ const d22 = head?.last_commit_digest;
70978
+ return typeof d22 === "string" && /^[0-9a-f]{64}$/.test(d22) ? d22 : void 0;
70979
+ } catch {
70980
+ return void 0;
70981
+ }
70982
+ }
70951
70983
  /**
70952
70984
  * #1015: write one frame and report whether the socket took it.
70953
70985
  *
@@ -71844,6 +71876,7 @@ ${baseText}`;
71844
71876
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
71845
71877
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
71846
71878
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
71879
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
71847
71880
  let commit;
71848
71881
  let welcome;
71849
71882
  try {
@@ -71874,12 +71907,14 @@ ${baseText}`;
71874
71907
  group_id: chState.mlsGroupId,
71875
71908
  device_id: this._deviceId,
71876
71909
  commit: Buffer.from(removeResult.commit).toString("hex"),
71877
- commit_epoch: Number(mlsGroup.epoch)
71910
+ commit_epoch: Number(mlsGroup.epoch),
71911
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71878
71912
  })
71879
71913
  }
71880
71914
  );
71881
71915
  if (removeResp.ok) {
71882
71916
  removeCommitPublished = true;
71917
+ parentDigest = this._commitDigest(removeResult.commit);
71883
71918
  } else {
71884
71919
  const detail = await removeResp.text().catch(() => "");
71885
71920
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -71947,7 +71982,8 @@ ${baseText}`;
71947
71982
  commit: commitHex,
71948
71983
  commit_epoch: Number(mlsGroup.epoch),
71949
71984
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
71950
- member_device_ids: updatedMembers
71985
+ member_device_ids: updatedMembers,
71986
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71951
71987
  })
71952
71988
  }
71953
71989
  );
@@ -71964,7 +72000,12 @@ ${baseText}`;
71964
72000
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
71965
72001
  const commitSent = await this._sendFrameConfirmed({
71966
72002
  event: "mls_commit",
71967
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
72003
+ data: {
72004
+ group_id: chState.mlsGroupId,
72005
+ epoch: Number(mlsGroup.epoch),
72006
+ payload: commitHex,
72007
+ ...parentDigest ? { parent_digest: parentDigest } : {}
72008
+ }
71968
72009
  }, `${a2aLabel} commit`);
71969
72010
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
71970
72011
  event: "mls_welcome",
@@ -99483,7 +99524,7 @@ var init_index = __esm2({
99483
99524
  await init_skill_telemetry();
99484
99525
  await init_policy_enforcer();
99485
99526
  init_room_protocol();
99486
- VERSION = true ? "0.23.35" : "0.0.0-dev";
99527
+ VERSION = true ? "0.23.37" : "0.0.0-dev";
99487
99528
  }
99488
99529
  });
99489
99530
  await init_index();
@@ -135887,7 +135928,7 @@ async function main() {
135887
135928
  "[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"
135888
135929
  );
135889
135930
  }
135890
- logLine(`[bridge] version: ${true ? "0.8.8" : "dev"}`);
135931
+ logLine(`[bridge] version: ${true ? "0.8.10" : "dev"}`);
135891
135932
  logLine(`[bridge] data dir: ${cfg.dataDir} (${cfg.dataDirSource})`);
135892
135933
  logLine(`[bridge] workspace: ${cfg.workspaceDir} \xB7 permissions: ${cfg.permissionMode} \xB7 enclave dir fenced`);
135893
135934
  if (cfg.armRoom) {
@@ -135919,7 +135960,7 @@ async function main() {
135919
135960
  // its default would render "@agentvault/agentvault@0.7.x" — the wrong
135920
135961
  // package name attached to the bridge's version number, which is worse
135921
135962
  // than either alone.
135922
- clientVersion: `@agentvault/claude-bridge@${true ? "0.8.8" : "dev"}`
135963
+ clientVersion: `@agentvault/claude-bridge@${true ? "0.8.10" : "dev"}`
135923
135964
  });
135924
135965
  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.`;
135925
135966
  const deviceJwt = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
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",