@agentvault/agentvault 0.23.35 → 0.23.37

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
@@ -50859,7 +50859,10 @@ async function applyProposals(state, proposals, committerLeafIndex, pskSearch, s
50859
50859
  const [mutatedTree, addedLeafNodes] = await applyTreeMutations(state.ratchetTree, grouped, state.groupContext, sentByClient, state.clientConfig.authService, state.clientConfig.lifetimeConfig, cs.signature);
50860
50860
  const [updatedPskSecret, pskIds] = await accumulatePskSecret(grouped.psk.map((p2) => p2.proposal.psk.preSharedKeyId), pskSearch, cs, zeroes);
50861
50861
  const selfRemoved = mutatedTree[leafToNodeIndex(toLeafIndex(state.privatePath.leafIndex))] === void 0;
50862
- const needsUpdatePath = allProposals.length === 0 || Object.values(grouped.update).length > 1 || Object.values(grouped.remove).length > 1;
50862
+ const needsUpdatePath = allProposals.length === 0 || allProposals.some(({ proposal }) => {
50863
+ const t2 = proposal.proposalType;
50864
+ return t2 !== "add" && t2 !== "psk" && t2 !== "reinit";
50865
+ });
50863
50866
  return {
50864
50867
  tree: mutatedTree,
50865
50868
  pskSecret: updatedPskSecret,
@@ -63261,11 +63264,11 @@ var init_mls_kp_pool = __esm({
63261
63264
 
63262
63265
  // src/client-version.ts
63263
63266
  function ownIdentity() {
63264
- const v2 = true ? "0.23.35" : FALLBACK;
63267
+ const v2 = true ? "0.23.37" : FALLBACK;
63265
63268
  return `${PACKAGE}@${v2}`;
63266
63269
  }
63267
63270
  function buildSha() {
63268
- const raw = true ? "0160bbb-dirty" : "";
63271
+ const raw = true ? "58c552f-dirty" : "";
63269
63272
  const cleaned = (raw ?? "").trim();
63270
63273
  return !cleaned || cleaned === "unknown" ? null : cleaned;
63271
63274
  }
@@ -65476,7 +65479,7 @@ var init_channel = __esm({
65476
65479
  */
65477
65480
  sendActivitySpan(spanData) {
65478
65481
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
65479
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
65482
+ const pluginVersion = true ? "0.23.37" : "0.0.0-dev";
65480
65483
  const agentName = this.config.agentName ?? "Agent";
65481
65484
  const resource = {
65482
65485
  "service.name": "agentvault-agent",
@@ -67414,7 +67417,7 @@ var init_channel = __esm({
67414
67417
  agentVersion: this.config.agentVersion ?? "0.0.0",
67415
67418
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67416
67419
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67417
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
67420
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
67418
67421
  });
67419
67422
  this._telemetryReporter.startAutoFlush(3e4);
67420
67423
  }
@@ -67738,7 +67741,7 @@ var init_channel = __esm({
67738
67741
  agentVersion: this.config.agentVersion ?? "0.0.0",
67739
67742
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67740
67743
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67741
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
67744
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
67742
67745
  });
67743
67746
  this._telemetryReporter.startAutoFlush(3e4);
67744
67747
  }
@@ -69512,6 +69515,7 @@ ${baseText}`;
69512
69515
  return 0;
69513
69516
  }
69514
69517
  const snapshot = mlsGroup.exportState();
69518
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
69515
69519
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
69516
69520
  let sentCommits = 0;
69517
69521
  for (const c2 of commits) {
@@ -69523,12 +69527,14 @@ ${baseText}`;
69523
69527
  // The epoch this commit PRODUCED. After two commits the manager
69524
69528
  // only knows the last one, which is why the result carries them.
69525
69529
  epoch: Number(c2.epoch),
69526
- payload: Buffer.from(c2.commit).toString("hex")
69530
+ payload: Buffer.from(c2.commit).toString("hex"),
69531
+ ...parent2 ? { parent_digest: parent2 } : {}
69527
69532
  }
69528
69533
  },
69529
69534
  `${label} commit ${sentCommits + 1}/${commits.length}`
69530
69535
  );
69531
69536
  if (!ok) break;
69537
+ parent2 = this._commitDigest(c2.commit);
69532
69538
  sentCommits++;
69533
69539
  }
69534
69540
  if (sentCommits === 0) {
@@ -69615,6 +69621,32 @@ ${baseText}`;
69615
69621
  _wsIsOpen() {
69616
69622
  return this._ws?.readyState === 1;
69617
69623
  }
69624
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
69625
+ _commitDigest(bytes) {
69626
+ return createHash("sha256").update(bytes).digest("hex");
69627
+ }
69628
+ /**
69629
+ * #1177: the digest of the commit at the server's head, or undefined.
69630
+ *
69631
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
69632
+ * deliberately the same value. The commit is sent either way: the server
69633
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
69634
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
69635
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
69636
+ */
69637
+ async _readGroupHeadDigest(groupId) {
69638
+ try {
69639
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
69640
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
69641
+ });
69642
+ if (!res.ok) return void 0;
69643
+ const head = await res.json();
69644
+ const d2 = head?.last_commit_digest;
69645
+ return typeof d2 === "string" && /^[0-9a-f]{64}$/.test(d2) ? d2 : void 0;
69646
+ } catch {
69647
+ return void 0;
69648
+ }
69649
+ }
69618
69650
  /**
69619
69651
  * #1015: write one frame and report whether the socket took it.
69620
69652
  *
@@ -70511,6 +70543,7 @@ ${baseText}`;
70511
70543
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
70512
70544
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
70513
70545
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
70546
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
70514
70547
  let commit;
70515
70548
  let welcome;
70516
70549
  try {
@@ -70541,12 +70574,14 @@ ${baseText}`;
70541
70574
  group_id: chState.mlsGroupId,
70542
70575
  device_id: this._deviceId,
70543
70576
  commit: Buffer.from(removeResult.commit).toString("hex"),
70544
- commit_epoch: Number(mlsGroup.epoch)
70577
+ commit_epoch: Number(mlsGroup.epoch),
70578
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70545
70579
  })
70546
70580
  }
70547
70581
  );
70548
70582
  if (removeResp.ok) {
70549
70583
  removeCommitPublished = true;
70584
+ parentDigest = this._commitDigest(removeResult.commit);
70550
70585
  } else {
70551
70586
  const detail = await removeResp.text().catch(() => "");
70552
70587
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -70614,7 +70649,8 @@ ${baseText}`;
70614
70649
  commit: commitHex,
70615
70650
  commit_epoch: Number(mlsGroup.epoch),
70616
70651
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
70617
- member_device_ids: updatedMembers
70652
+ member_device_ids: updatedMembers,
70653
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70618
70654
  })
70619
70655
  }
70620
70656
  );
@@ -70631,7 +70667,12 @@ ${baseText}`;
70631
70667
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
70632
70668
  const commitSent = await this._sendFrameConfirmed({
70633
70669
  event: "mls_commit",
70634
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
70670
+ data: {
70671
+ group_id: chState.mlsGroupId,
70672
+ epoch: Number(mlsGroup.epoch),
70673
+ payload: commitHex,
70674
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70675
+ }
70635
70676
  }, `${a2aLabel} commit`);
70636
70677
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
70637
70678
  event: "mls_welcome",
@@ -98600,7 +98641,7 @@ var init_index = __esm({
98600
98641
  await init_skill_telemetry();
98601
98642
  await init_policy_enforcer();
98602
98643
  init_room_protocol();
98603
- VERSION = true ? "0.23.35" : "0.0.0-dev";
98644
+ VERSION = true ? "0.23.37" : "0.0.0-dev";
98604
98645
  }
98605
98646
  });
98606
98647
  await init_index();