@agentvault/agentvault 0.23.35 → 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
@@ -63261,11 +63261,11 @@ var init_mls_kp_pool = __esm({
63261
63261
 
63262
63262
  // src/client-version.ts
63263
63263
  function ownIdentity() {
63264
- const v2 = true ? "0.23.35" : FALLBACK;
63264
+ const v2 = true ? "0.23.36" : FALLBACK;
63265
63265
  return `${PACKAGE}@${v2}`;
63266
63266
  }
63267
63267
  function buildSha() {
63268
- const raw = true ? "0160bbb-dirty" : "";
63268
+ const raw = true ? "56c615c-dirty" : "";
63269
63269
  const cleaned = (raw ?? "").trim();
63270
63270
  return !cleaned || cleaned === "unknown" ? null : cleaned;
63271
63271
  }
@@ -65476,7 +65476,7 @@ var init_channel = __esm({
65476
65476
  */
65477
65477
  sendActivitySpan(spanData) {
65478
65478
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
65479
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
65479
+ const pluginVersion = true ? "0.23.36" : "0.0.0-dev";
65480
65480
  const agentName = this.config.agentName ?? "Agent";
65481
65481
  const resource = {
65482
65482
  "service.name": "agentvault-agent",
@@ -67414,7 +67414,7 @@ var init_channel = __esm({
67414
67414
  agentVersion: this.config.agentVersion ?? "0.0.0",
67415
67415
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67416
67416
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67417
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
67417
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
67418
67418
  });
67419
67419
  this._telemetryReporter.startAutoFlush(3e4);
67420
67420
  }
@@ -67738,7 +67738,7 @@ var init_channel = __esm({
67738
67738
  agentVersion: this.config.agentVersion ?? "0.0.0",
67739
67739
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67740
67740
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67741
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
67741
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
67742
67742
  });
67743
67743
  this._telemetryReporter.startAutoFlush(3e4);
67744
67744
  }
@@ -69512,6 +69512,7 @@ ${baseText}`;
69512
69512
  return 0;
69513
69513
  }
69514
69514
  const snapshot = mlsGroup.exportState();
69515
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
69515
69516
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
69516
69517
  let sentCommits = 0;
69517
69518
  for (const c2 of commits) {
@@ -69523,12 +69524,14 @@ ${baseText}`;
69523
69524
  // The epoch this commit PRODUCED. After two commits the manager
69524
69525
  // only knows the last one, which is why the result carries them.
69525
69526
  epoch: Number(c2.epoch),
69526
- payload: Buffer.from(c2.commit).toString("hex")
69527
+ payload: Buffer.from(c2.commit).toString("hex"),
69528
+ ...parent2 ? { parent_digest: parent2 } : {}
69527
69529
  }
69528
69530
  },
69529
69531
  `${label} commit ${sentCommits + 1}/${commits.length}`
69530
69532
  );
69531
69533
  if (!ok) break;
69534
+ parent2 = this._commitDigest(c2.commit);
69532
69535
  sentCommits++;
69533
69536
  }
69534
69537
  if (sentCommits === 0) {
@@ -69615,6 +69618,32 @@ ${baseText}`;
69615
69618
  _wsIsOpen() {
69616
69619
  return this._ws?.readyState === 1;
69617
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
+ }
69618
69647
  /**
69619
69648
  * #1015: write one frame and report whether the socket took it.
69620
69649
  *
@@ -70511,6 +70540,7 @@ ${baseText}`;
70511
70540
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
70512
70541
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
70513
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);
70514
70544
  let commit;
70515
70545
  let welcome;
70516
70546
  try {
@@ -70541,12 +70571,14 @@ ${baseText}`;
70541
70571
  group_id: chState.mlsGroupId,
70542
70572
  device_id: this._deviceId,
70543
70573
  commit: Buffer.from(removeResult.commit).toString("hex"),
70544
- commit_epoch: Number(mlsGroup.epoch)
70574
+ commit_epoch: Number(mlsGroup.epoch),
70575
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70545
70576
  })
70546
70577
  }
70547
70578
  );
70548
70579
  if (removeResp.ok) {
70549
70580
  removeCommitPublished = true;
70581
+ parentDigest = this._commitDigest(removeResult.commit);
70550
70582
  } else {
70551
70583
  const detail = await removeResp.text().catch(() => "");
70552
70584
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -70614,7 +70646,8 @@ ${baseText}`;
70614
70646
  commit: commitHex,
70615
70647
  commit_epoch: Number(mlsGroup.epoch),
70616
70648
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
70617
- member_device_ids: updatedMembers
70649
+ member_device_ids: updatedMembers,
70650
+ ...parentDigest ? { parent_digest: parentDigest } : {}
70618
70651
  })
70619
70652
  }
70620
70653
  );
@@ -70631,7 +70664,12 @@ ${baseText}`;
70631
70664
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
70632
70665
  const commitSent = await this._sendFrameConfirmed({
70633
70666
  event: "mls_commit",
70634
- 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
+ }
70635
70673
  }, `${a2aLabel} commit`);
70636
70674
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
70637
70675
  event: "mls_welcome",
@@ -98600,7 +98638,7 @@ var init_index = __esm({
98600
98638
  await init_skill_telemetry();
98601
98639
  await init_policy_enforcer();
98602
98640
  init_room_protocol();
98603
- VERSION = true ? "0.23.35" : "0.0.0-dev";
98641
+ VERSION = true ? "0.23.36" : "0.0.0-dev";
98604
98642
  }
98605
98643
  });
98606
98644
  await init_index();