@agentvault/grok-bridge 0.4.7 → 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 +51 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51699,11 +51699,6 @@ var init_clientConfig = __esm2({
51699
51699
  };
51700
51700
  }
51701
51701
  });
51702
- function arraysEqual(a2, b2) {
51703
- if (a2.length !== b2.length)
51704
- return false;
51705
- return a2.every((val, index) => val === b2[index]);
51706
- }
51707
51702
  var init_array = __esm2({
51708
51703
  "../crypto/node_modules/ts-mls/dist/src/util/array.js"() {
51709
51704
  }
@@ -51891,7 +51886,7 @@ async function validateRatchetTree(tree, groupContext, config2, authService, tre
51891
51886
  if (dpNode !== void 0) {
51892
51887
  if (dpNode.nodeType !== "parent")
51893
51888
  return new InternalError("Expected parent node");
51894
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n2.parent.unmergedLeaves))
51889
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
51895
51890
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
51896
51891
  }
51897
51892
  }
@@ -64605,11 +64600,11 @@ var init_mls_kp_pool = __esm2({
64605
64600
  }
64606
64601
  });
64607
64602
  function ownIdentity() {
64608
- const v2 = true ? "0.23.34" : FALLBACK;
64603
+ const v2 = true ? "0.23.36" : FALLBACK;
64609
64604
  return `${PACKAGE}@${v2}`;
64610
64605
  }
64611
64606
  function buildSha() {
64612
- const raw = true ? "6b305ca-dirty" : "";
64607
+ const raw = true ? "56c615c-dirty" : "";
64613
64608
  const cleaned = (raw ?? "").trim();
64614
64609
  return !cleaned || cleaned === "unknown" ? null : cleaned;
64615
64610
  }
@@ -66807,7 +66802,7 @@ var init_channel = __esm2({
66807
66802
  */
66808
66803
  sendActivitySpan(spanData) {
66809
66804
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66810
- const pluginVersion = true ? "0.23.34" : "0.0.0-dev";
66805
+ const pluginVersion = true ? "0.23.36" : "0.0.0-dev";
66811
66806
  const agentName = this.config.agentName ?? "Agent";
66812
66807
  const resource = {
66813
66808
  "service.name": "agentvault-agent",
@@ -68745,7 +68740,7 @@ var init_channel = __esm2({
68745
68740
  agentVersion: this.config.agentVersion ?? "0.0.0",
68746
68741
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68747
68742
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68748
- pluginVersion: true ? "0.23.34" : "0.0.0-dev"
68743
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
68749
68744
  });
68750
68745
  this._telemetryReporter.startAutoFlush(3e4);
68751
68746
  }
@@ -69069,7 +69064,7 @@ var init_channel = __esm2({
69069
69064
  agentVersion: this.config.agentVersion ?? "0.0.0",
69070
69065
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
69071
69066
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
69072
- pluginVersion: true ? "0.23.34" : "0.0.0-dev"
69067
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
69073
69068
  });
69074
69069
  this._telemetryReporter.startAutoFlush(3e4);
69075
69070
  }
@@ -70843,6 +70838,7 @@ ${baseText}`;
70843
70838
  return 0;
70844
70839
  }
70845
70840
  const snapshot = mlsGroup.exportState();
70841
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
70846
70842
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
70847
70843
  let sentCommits = 0;
70848
70844
  for (const c2 of commits) {
@@ -70854,12 +70850,14 @@ ${baseText}`;
70854
70850
  // The epoch this commit PRODUCED. After two commits the manager
70855
70851
  // only knows the last one, which is why the result carries them.
70856
70852
  epoch: Number(c2.epoch),
70857
- payload: Buffer.from(c2.commit).toString("hex")
70853
+ payload: Buffer.from(c2.commit).toString("hex"),
70854
+ ...parent2 ? { parent_digest: parent2 } : {}
70858
70855
  }
70859
70856
  },
70860
70857
  `${label} commit ${sentCommits + 1}/${commits.length}`
70861
70858
  );
70862
70859
  if (!ok) break;
70860
+ parent2 = this._commitDigest(c2.commit);
70863
70861
  sentCommits++;
70864
70862
  }
70865
70863
  if (sentCommits === 0) {
@@ -70946,6 +70944,32 @@ ${baseText}`;
70946
70944
  _wsIsOpen() {
70947
70945
  return this._ws?.readyState === 1;
70948
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
+ }
70949
70973
  /**
70950
70974
  * #1015: write one frame and report whether the socket took it.
70951
70975
  *
@@ -71842,6 +71866,7 @@ ${baseText}`;
71842
71866
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
71843
71867
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
71844
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);
71845
71870
  let commit;
71846
71871
  let welcome;
71847
71872
  try {
@@ -71872,12 +71897,14 @@ ${baseText}`;
71872
71897
  group_id: chState.mlsGroupId,
71873
71898
  device_id: this._deviceId,
71874
71899
  commit: Buffer.from(removeResult.commit).toString("hex"),
71875
- commit_epoch: Number(mlsGroup.epoch)
71900
+ commit_epoch: Number(mlsGroup.epoch),
71901
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71876
71902
  })
71877
71903
  }
71878
71904
  );
71879
71905
  if (removeResp.ok) {
71880
71906
  removeCommitPublished = true;
71907
+ parentDigest = this._commitDigest(removeResult.commit);
71881
71908
  } else {
71882
71909
  const detail = await removeResp.text().catch(() => "");
71883
71910
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -71945,7 +71972,8 @@ ${baseText}`;
71945
71972
  commit: commitHex,
71946
71973
  commit_epoch: Number(mlsGroup.epoch),
71947
71974
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
71948
- member_device_ids: updatedMembers
71975
+ member_device_ids: updatedMembers,
71976
+ ...parentDigest ? { parent_digest: parentDigest } : {}
71949
71977
  })
71950
71978
  }
71951
71979
  );
@@ -71962,7 +71990,12 @@ ${baseText}`;
71962
71990
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
71963
71991
  const commitSent = await this._sendFrameConfirmed({
71964
71992
  event: "mls_commit",
71965
- 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
+ }
71966
71999
  }, `${a2aLabel} commit`);
71967
72000
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
71968
72001
  event: "mls_welcome",
@@ -99481,7 +99514,7 @@ var init_index = __esm2({
99481
99514
  await init_skill_telemetry();
99482
99515
  await init_policy_enforcer();
99483
99516
  init_room_protocol();
99484
- VERSION = true ? "0.23.34" : "0.0.0-dev";
99517
+ VERSION = true ? "0.23.36" : "0.0.0-dev";
99485
99518
  }
99486
99519
  });
99487
99520
  await init_index();
@@ -100407,7 +100440,7 @@ async function main() {
100407
100440
  const info = parseInfoFlags(process.argv.slice(2));
100408
100441
  if (info.showVersion || info.showHelp) {
100409
100442
  const version2 = buildClientVersion2(
100410
- true ? "0.4.7" : void 0
100443
+ true ? "0.4.9" : void 0
100411
100444
  );
100412
100445
  if (info.showVersion) printLine(version2);
100413
100446
  if (info.showHelp) {
@@ -100460,7 +100493,7 @@ async function main() {
100460
100493
  agentName: cfg.agentName,
100461
100494
  platform: "node",
100462
100495
  clientVersion: buildClientVersion2(
100463
- true ? "0.4.7" : void 0
100496
+ true ? "0.4.9" : void 0
100464
100497
  )
100465
100498
  });
100466
100499
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.7",
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",