@agentvault/agentvault 0.23.34 → 0.23.36

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.
package/dist/index.js CHANGED
@@ -50505,11 +50505,6 @@ var init_clientConfig = __esm({
50505
50505
  });
50506
50506
 
50507
50507
  // ../crypto/node_modules/ts-mls/dist/src/util/array.js
50508
- function arraysEqual(a2, b2) {
50509
- if (a2.length !== b2.length)
50510
- return false;
50511
- return a2.every((val, index) => val === b2[index]);
50512
- }
50513
50508
  var init_array = __esm({
50514
50509
  "../crypto/node_modules/ts-mls/dist/src/util/array.js"() {
50515
50510
  }
@@ -50698,7 +50693,7 @@ async function validateRatchetTree(tree, groupContext, config2, authService, tre
50698
50693
  if (dpNode !== void 0) {
50699
50694
  if (dpNode.nodeType !== "parent")
50700
50695
  return new InternalError("Expected parent node");
50701
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n2.parent.unmergedLeaves))
50696
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
50702
50697
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
50703
50698
  }
50704
50699
  }
@@ -63266,11 +63261,11 @@ var init_mls_kp_pool = __esm({
63266
63261
 
63267
63262
  // src/client-version.ts
63268
63263
  function ownIdentity() {
63269
- const v2 = true ? "0.23.34" : FALLBACK;
63264
+ const v2 = true ? "0.23.36" : FALLBACK;
63270
63265
  return `${PACKAGE}@${v2}`;
63271
63266
  }
63272
63267
  function buildSha() {
63273
- const raw = true ? "6b305ca-dirty" : "";
63268
+ const raw = true ? "56c615c-dirty" : "";
63274
63269
  const cleaned = (raw ?? "").trim();
63275
63270
  return !cleaned || cleaned === "unknown" ? null : cleaned;
63276
63271
  }
@@ -65481,7 +65476,7 @@ var init_channel = __esm({
65481
65476
  */
65482
65477
  sendActivitySpan(spanData) {
65483
65478
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
65484
- const pluginVersion = true ? "0.23.34" : "0.0.0-dev";
65479
+ const pluginVersion = true ? "0.23.36" : "0.0.0-dev";
65485
65480
  const agentName = this.config.agentName ?? "Agent";
65486
65481
  const resource = {
65487
65482
  "service.name": "agentvault-agent",
@@ -67419,7 +67414,7 @@ var init_channel = __esm({
67419
67414
  agentVersion: this.config.agentVersion ?? "0.0.0",
67420
67415
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67421
67416
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67422
- pluginVersion: true ? "0.23.34" : "0.0.0-dev"
67417
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
67423
67418
  });
67424
67419
  this._telemetryReporter.startAutoFlush(3e4);
67425
67420
  }
@@ -67743,7 +67738,7 @@ var init_channel = __esm({
67743
67738
  agentVersion: this.config.agentVersion ?? "0.0.0",
67744
67739
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67745
67740
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67746
- pluginVersion: true ? "0.23.34" : "0.0.0-dev"
67741
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
67747
67742
  });
67748
67743
  this._telemetryReporter.startAutoFlush(3e4);
67749
67744
  }
@@ -69517,6 +69512,7 @@ ${baseText}`;
69517
69512
  return 0;
69518
69513
  }
69519
69514
  const snapshot = mlsGroup.exportState();
69515
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
69520
69516
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
69521
69517
  let sentCommits = 0;
69522
69518
  for (const c2 of commits) {
@@ -69528,12 +69524,14 @@ ${baseText}`;
69528
69524
  // The epoch this commit PRODUCED. After two commits the manager
69529
69525
  // only knows the last one, which is why the result carries them.
69530
69526
  epoch: Number(c2.epoch),
69531
- payload: Buffer.from(c2.commit).toString("hex")
69527
+ payload: Buffer.from(c2.commit).toString("hex"),
69528
+ ...parent2 ? { parent_digest: parent2 } : {}
69532
69529
  }
69533
69530
  },
69534
69531
  `${label} commit ${sentCommits + 1}/${commits.length}`
69535
69532
  );
69536
69533
  if (!ok) break;
69534
+ parent2 = this._commitDigest(c2.commit);
69537
69535
  sentCommits++;
69538
69536
  }
69539
69537
  if (sentCommits === 0) {
@@ -69620,6 +69618,32 @@ ${baseText}`;
69620
69618
  _wsIsOpen() {
69621
69619
  return this._ws?.readyState === 1;
69622
69620
  }
69621
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
69622
+ _commitDigest(bytes) {
69623
+ return createHash("sha256").update(bytes).digest("hex");
69624
+ }
69625
+ /**
69626
+ * #1177: the digest of the commit at the server's head, or undefined.
69627
+ *
69628
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
69629
+ * deliberately the same value. The commit is sent either way: the server
69630
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
69631
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
69632
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
69633
+ */
69634
+ async _readGroupHeadDigest(groupId) {
69635
+ try {
69636
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
69637
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
69638
+ });
69639
+ if (!res.ok) return void 0;
69640
+ const head = await res.json();
69641
+ const d2 = head?.last_commit_digest;
69642
+ return typeof d2 === "string" && /^[0-9a-f]{64}$/.test(d2) ? d2 : void 0;
69643
+ } catch {
69644
+ return void 0;
69645
+ }
69646
+ }
69623
69647
  /**
69624
69648
  * #1015: write one frame and report whether the socket took it.
69625
69649
  *
@@ -70516,6 +70540,7 @@ ${baseText}`;
70516
70540
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
70517
70541
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
70518
70542
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
70543
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
70519
70544
  let commit;
70520
70545
  let welcome;
70521
70546
  try {
@@ -70546,12 +70571,14 @@ ${baseText}`;
70546
70571
  group_id: chState.mlsGroupId,
70547
70572
  device_id: this._deviceId,
70548
70573
  commit: Buffer.from(removeResult.commit).toString("hex"),
70549
- commit_epoch: Number(mlsGroup.epoch)
70574
+ commit_epoch: Number(mlsGroup.epoch),
70575
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70550
70576
  })
70551
70577
  }
70552
70578
  );
70553
70579
  if (removeResp.ok) {
70554
70580
  removeCommitPublished = true;
70581
+ parentDigest = this._commitDigest(removeResult.commit);
70555
70582
  } else {
70556
70583
  const detail = await removeResp.text().catch(() => "");
70557
70584
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -70619,7 +70646,8 @@ ${baseText}`;
70619
70646
  commit: commitHex,
70620
70647
  commit_epoch: Number(mlsGroup.epoch),
70621
70648
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
70622
- member_device_ids: updatedMembers
70649
+ member_device_ids: updatedMembers,
70650
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70623
70651
  })
70624
70652
  }
70625
70653
  );
@@ -70636,7 +70664,12 @@ ${baseText}`;
70636
70664
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
70637
70665
  const commitSent = await this._sendFrameConfirmed({
70638
70666
  event: "mls_commit",
70639
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
70667
+ data: {
70668
+ group_id: chState.mlsGroupId,
70669
+ epoch: Number(mlsGroup.epoch),
70670
+ payload: commitHex,
70671
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70672
+ }
70640
70673
  }, `${a2aLabel} commit`);
70641
70674
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
70642
70675
  event: "mls_welcome",
@@ -98605,7 +98638,7 @@ var init_index = __esm({
98605
98638
  await init_skill_telemetry();
98606
98639
  await init_policy_enforcer();
98607
98640
  init_room_protocol();
98608
- VERSION = true ? "0.23.34" : "0.0.0-dev";
98641
+ VERSION = true ? "0.23.36" : "0.0.0-dev";
98609
98642
  }
98610
98643
  });
98611
98644
  await init_index();