@agentvault/grok-bridge 0.4.8 → 0.4.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
@@ -52052,7 +52052,10 @@ async function applyProposals(state, proposals, committerLeafIndex, pskSearch, s
52052
52052
  const [mutatedTree, addedLeafNodes] = await applyTreeMutations(state.ratchetTree, grouped, state.groupContext, sentByClient, state.clientConfig.authService, state.clientConfig.lifetimeConfig, cs.signature);
52053
52053
  const [updatedPskSecret, pskIds] = await accumulatePskSecret(grouped.psk.map((p2) => p2.proposal.psk.preSharedKeyId), pskSearch, cs, zeroes);
52054
52054
  const selfRemoved = mutatedTree[leafToNodeIndex(toLeafIndex(state.privatePath.leafIndex))] === void 0;
52055
- const needsUpdatePath = allProposals.length === 0 || Object.values(grouped.update).length > 1 || Object.values(grouped.remove).length > 1;
52055
+ const needsUpdatePath = allProposals.length === 0 || allProposals.some(({ proposal }) => {
52056
+ const t2 = proposal.proposalType;
52057
+ return t2 !== "add" && t2 !== "psk" && t2 !== "reinit";
52058
+ });
52056
52059
  return {
52057
52060
  tree: mutatedTree,
52058
52061
  pskSecret: updatedPskSecret,
@@ -64600,11 +64603,11 @@ var init_mls_kp_pool = __esm2({
64600
64603
  }
64601
64604
  });
64602
64605
  function ownIdentity() {
64603
- const v2 = true ? "0.23.35" : FALLBACK;
64606
+ const v2 = true ? "0.23.37" : FALLBACK;
64604
64607
  return `${PACKAGE}@${v2}`;
64605
64608
  }
64606
64609
  function buildSha() {
64607
- const raw = true ? "bcb9297-dirty" : "";
64610
+ const raw = true ? "58c552f-dirty" : "";
64608
64611
  const cleaned = (raw ?? "").trim();
64609
64612
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64610
64613
  }
@@ -66802,7 +66805,7 @@ var init_channel = __esm2({
66802
66805
  */
66803
66806
  sendActivitySpan(spanData) {
66804
66807
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66805
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
66808
+ const pluginVersion = true ? "0.23.37" : "0.0.0-dev";
66806
66809
  const agentName = this.config.agentName ?? "Agent";
66807
66810
  const resource = {
66808
66811
  "service.name": "agentvault-agent",
@@ -68740,7 +68743,7 @@ var init_channel = __esm2({
68740
68743
  agentVersion: this.config.agentVersion ?? "0.0.0",
68741
68744
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68742
68745
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68743
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
68746
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
68744
68747
  });
68745
68748
  this._telemetryReporter.startAutoFlush(3e4);
68746
68749
  }
@@ -69064,7 +69067,7 @@ var init_channel = __esm2({
69064
69067
  agentVersion: this.config.agentVersion ?? "0.0.0",
69065
69068
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69066
69069
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69067
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
69070
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
69068
69071
  });
69069
69072
  this._telemetryReporter.startAutoFlush(3e4);
69070
69073
  }
@@ -70838,6 +70841,7 @@ ${baseText}`;
70838
70841
  return 0;
70839
70842
  }
70840
70843
  const snapshot = mlsGroup.exportState();
70844
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
70841
70845
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
70842
70846
  let sentCommits = 0;
70843
70847
  for (const c2 of commits) {
@@ -70849,12 +70853,14 @@ ${baseText}`;
70849
70853
  // The epoch this commit PRODUCED. After two commits the manager
70850
70854
  // only knows the last one, which is why the result carries them.
70851
70855
  epoch: Number(c2.epoch),
70852
- payload: Buffer.from(c2.commit).toString("hex")
70856
+ payload: Buffer.from(c2.commit).toString("hex"),
70857
+ ...parent2 ? { parent_digest: parent2 } : {}
70853
70858
  }
70854
70859
  },
70855
70860
  `${label} commit ${sentCommits + 1}/${commits.length}`
70856
70861
  );
70857
70862
  if (!ok) break;
70863
+ parent2 = this._commitDigest(c2.commit);
70858
70864
  sentCommits++;
70859
70865
  }
70860
70866
  if (sentCommits === 0) {
@@ -70941,6 +70947,32 @@ ${baseText}`;
70941
70947
  _wsIsOpen() {
70942
70948
  return this._ws?.readyState === 1;
70943
70949
  }
70950
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
70951
+ _commitDigest(bytes) {
70952
+ return createHash("sha256").update(bytes).digest("hex");
70953
+ }
70954
+ /**
70955
+ * #1177: the digest of the commit at the server's head, or undefined.
70956
+ *
70957
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
70958
+ * deliberately the same value. The commit is sent either way: the server
70959
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
70960
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
70961
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
70962
+ */
70963
+ async _readGroupHeadDigest(groupId) {
70964
+ try {
70965
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
70966
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
70967
+ });
70968
+ if (!res.ok) return void 0;
70969
+ const head = await res.json();
70970
+ const d2 = head?.last_commit_digest;
70971
+ return typeof d2 === "string" && /^[0-9a-f]{64}$/.test(d2) ? d2 : void 0;
70972
+ } catch {
70973
+ return void 0;
70974
+ }
70975
+ }
70944
70976
  /**
70945
70977
  * #1015: write one frame and report whether the socket took it.
70946
70978
  *
@@ -71837,6 +71869,7 @@ ${baseText}`;
71837
71869
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
71838
71870
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
71839
71871
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
71872
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
71840
71873
  let commit;
71841
71874
  let welcome;
71842
71875
  try {
@@ -71867,12 +71900,14 @@ ${baseText}`;
71867
71900
  group_id: chState.mlsGroupId,
71868
71901
  device_id: this._deviceId,
71869
71902
  commit: Buffer.from(removeResult.commit).toString("hex"),
71870
- commit_epoch: Number(mlsGroup.epoch)
71903
+ commit_epoch: Number(mlsGroup.epoch),
71904
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71871
71905
  })
71872
71906
  }
71873
71907
  );
71874
71908
  if (removeResp.ok) {
71875
71909
  removeCommitPublished = true;
71910
+ parentDigest = this._commitDigest(removeResult.commit);
71876
71911
  } else {
71877
71912
  const detail = await removeResp.text().catch(() => "");
71878
71913
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -71940,7 +71975,8 @@ ${baseText}`;
71940
71975
  commit: commitHex,
71941
71976
  commit_epoch: Number(mlsGroup.epoch),
71942
71977
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
71943
- member_device_ids: updatedMembers
71978
+ member_device_ids: updatedMembers,
71979
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71944
71980
  })
71945
71981
  }
71946
71982
  );
@@ -71957,7 +71993,12 @@ ${baseText}`;
71957
71993
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
71958
71994
  const commitSent = await this._sendFrameConfirmed({
71959
71995
  event: "mls_commit",
71960
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
71996
+ data: {
71997
+ group_id: chState.mlsGroupId,
71998
+ epoch: Number(mlsGroup.epoch),
71999
+ payload: commitHex,
72000
+ ...parentDigest ? { parent_digest: parentDigest } : {}
72001
+ }
71961
72002
  }, `${a2aLabel} commit`);
71962
72003
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
71963
72004
  event: "mls_welcome",
@@ -99476,7 +99517,7 @@ var init_index = __esm2({
99476
99517
  await init_skill_telemetry();
99477
99518
  await init_policy_enforcer();
99478
99519
  init_room_protocol();
99479
- VERSION = true ? "0.23.35" : "0.0.0-dev";
99520
+ VERSION = true ? "0.23.37" : "0.0.0-dev";
99480
99521
  }
99481
99522
  });
99482
99523
  await init_index();
@@ -100402,7 +100443,7 @@ async function main() {
100402
100443
  const info = parseInfoFlags(process.argv.slice(2));
100403
100444
  if (info.showVersion || info.showHelp) {
100404
100445
  const version2 = buildClientVersion2(
100405
- true ? "0.4.8" : void 0
100446
+ true ? "0.4.10" : void 0
100406
100447
  );
100407
100448
  if (info.showVersion) printLine(version2);
100408
100449
  if (info.showHelp) {
@@ -100455,7 +100496,7 @@ async function main() {
100455
100496
  agentName: cfg.agentName,
100456
100497
  platform: "node",
100457
100498
  clientVersion: buildClientVersion2(
100458
- true ? "0.4.8" : void 0
100499
+ true ? "0.4.10" : void 0
100459
100500
  )
100460
100501
  });
100461
100502
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "type": "module",
5
5
  "description": "AgentVault Grok Bridge — daemon bridging a Grok agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",