@agentvault/grok-bridge 0.4.8 → 0.4.9

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 +50 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -64600,11 +64600,11 @@ var init_mls_kp_pool = __esm2({
64600
64600
  }
64601
64601
  });
64602
64602
  function ownIdentity() {
64603
- const v2 = true ? "0.23.35" : FALLBACK;
64603
+ const v2 = true ? "0.23.36" : FALLBACK;
64604
64604
  return `${PACKAGE}@${v2}`;
64605
64605
  }
64606
64606
  function buildSha() {
64607
- const raw = true ? "bcb9297-dirty" : "";
64607
+ const raw = true ? "56c615c-dirty" : "";
64608
64608
  const cleaned = (raw ?? "").trim();
64609
64609
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64610
64610
  }
@@ -66802,7 +66802,7 @@ var init_channel = __esm2({
66802
66802
  */
66803
66803
  sendActivitySpan(spanData) {
66804
66804
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66805
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
66805
+ const pluginVersion = true ? "0.23.36" : "0.0.0-dev";
66806
66806
  const agentName = this.config.agentName ?? "Agent";
66807
66807
  const resource = {
66808
66808
  "service.name": "agentvault-agent",
@@ -68740,7 +68740,7 @@ var init_channel = __esm2({
68740
68740
  agentVersion: this.config.agentVersion ?? "0.0.0",
68741
68741
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68742
68742
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68743
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
68743
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
68744
68744
  });
68745
68745
  this._telemetryReporter.startAutoFlush(3e4);
68746
68746
  }
@@ -69064,7 +69064,7 @@ var init_channel = __esm2({
69064
69064
  agentVersion: this.config.agentVersion ?? "0.0.0",
69065
69065
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69066
69066
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69067
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
69067
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
69068
69068
  });
69069
69069
  this._telemetryReporter.startAutoFlush(3e4);
69070
69070
  }
@@ -70838,6 +70838,7 @@ ${baseText}`;
70838
70838
  return 0;
70839
70839
  }
70840
70840
  const snapshot = mlsGroup.exportState();
70841
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
70841
70842
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
70842
70843
  let sentCommits = 0;
70843
70844
  for (const c2 of commits) {
@@ -70849,12 +70850,14 @@ ${baseText}`;
70849
70850
  // The epoch this commit PRODUCED. After two commits the manager
70850
70851
  // only knows the last one, which is why the result carries them.
70851
70852
  epoch: Number(c2.epoch),
70852
- payload: Buffer.from(c2.commit).toString("hex")
70853
+ payload: Buffer.from(c2.commit).toString("hex"),
70854
+ ...parent2 ? { parent_digest: parent2 } : {}
70853
70855
  }
70854
70856
  },
70855
70857
  `${label} commit ${sentCommits + 1}/${commits.length}`
70856
70858
  );
70857
70859
  if (!ok) break;
70860
+ parent2 = this._commitDigest(c2.commit);
70858
70861
  sentCommits++;
70859
70862
  }
70860
70863
  if (sentCommits === 0) {
@@ -70941,6 +70944,32 @@ ${baseText}`;
70941
70944
  _wsIsOpen() {
70942
70945
  return this._ws?.readyState === 1;
70943
70946
  }
70947
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
70948
+ _commitDigest(bytes) {
70949
+ return createHash("sha256").update(bytes).digest("hex");
70950
+ }
70951
+ /**
70952
+ * #1177: the digest of the commit at the server's head, or undefined.
70953
+ *
70954
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
70955
+ * deliberately the same value. The commit is sent either way: the server
70956
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
70957
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
70958
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
70959
+ */
70960
+ async _readGroupHeadDigest(groupId) {
70961
+ try {
70962
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
70963
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
70964
+ });
70965
+ if (!res.ok) return void 0;
70966
+ const head = await res.json();
70967
+ const d2 = head?.last_commit_digest;
70968
+ return typeof d2 === "string" && /^[0-9a-f]{64}$/.test(d2) ? d2 : void 0;
70969
+ } catch {
70970
+ return void 0;
70971
+ }
70972
+ }
70944
70973
  /**
70945
70974
  * #1015: write one frame and report whether the socket took it.
70946
70975
  *
@@ -71837,6 +71866,7 @@ ${baseText}`;
71837
71866
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
71838
71867
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
71839
71868
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
71869
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
71840
71870
  let commit;
71841
71871
  let welcome;
71842
71872
  try {
@@ -71867,12 +71897,14 @@ ${baseText}`;
71867
71897
  group_id: chState.mlsGroupId,
71868
71898
  device_id: this._deviceId,
71869
71899
  commit: Buffer.from(removeResult.commit).toString("hex"),
71870
- commit_epoch: Number(mlsGroup.epoch)
71900
+ commit_epoch: Number(mlsGroup.epoch),
71901
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71871
71902
  })
71872
71903
  }
71873
71904
  );
71874
71905
  if (removeResp.ok) {
71875
71906
  removeCommitPublished = true;
71907
+ parentDigest = this._commitDigest(removeResult.commit);
71876
71908
  } else {
71877
71909
  const detail = await removeResp.text().catch(() => "");
71878
71910
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -71940,7 +71972,8 @@ ${baseText}`;
71940
71972
  commit: commitHex,
71941
71973
  commit_epoch: Number(mlsGroup.epoch),
71942
71974
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
71943
- member_device_ids: updatedMembers
71975
+ member_device_ids: updatedMembers,
71976
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71944
71977
  })
71945
71978
  }
71946
71979
  );
@@ -71957,7 +71990,12 @@ ${baseText}`;
71957
71990
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
71958
71991
  const commitSent = await this._sendFrameConfirmed({
71959
71992
  event: "mls_commit",
71960
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
71993
+ data: {
71994
+ group_id: chState.mlsGroupId,
71995
+ epoch: Number(mlsGroup.epoch),
71996
+ payload: commitHex,
71997
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71998
+ }
71961
71999
  }, `${a2aLabel} commit`);
71962
72000
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
71963
72001
  event: "mls_welcome",
@@ -99476,7 +99514,7 @@ var init_index = __esm2({
99476
99514
  await init_skill_telemetry();
99477
99515
  await init_policy_enforcer();
99478
99516
  init_room_protocol();
99479
- VERSION = true ? "0.23.35" : "0.0.0-dev";
99517
+ VERSION = true ? "0.23.36" : "0.0.0-dev";
99480
99518
  }
99481
99519
  });
99482
99520
  await init_index();
@@ -100402,7 +100440,7 @@ async function main() {
100402
100440
  const info = parseInfoFlags(process.argv.slice(2));
100403
100441
  if (info.showVersion || info.showHelp) {
100404
100442
  const version2 = buildClientVersion2(
100405
- true ? "0.4.8" : void 0
100443
+ true ? "0.4.9" : void 0
100406
100444
  );
100407
100445
  if (info.showVersion) printLine(version2);
100408
100446
  if (info.showHelp) {
@@ -100455,7 +100493,7 @@ async function main() {
100455
100493
  agentName: cfg.agentName,
100456
100494
  platform: "node",
100457
100495
  clientVersion: buildClientVersion2(
100458
- true ? "0.4.8" : void 0
100496
+ true ? "0.4.9" : void 0
100459
100497
  )
100460
100498
  });
100461
100499
  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.9",
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",