@agentvault/muse-bridge 0.1.9 → 0.1.11

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 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5871,11 +5871,6 @@ function addToMap(map2, k2, v2) {
5871
5871
  copy.set(k2, v2);
5872
5872
  return copy;
5873
5873
  }
5874
- function arraysEqual(a2, b2) {
5875
- if (a2.length !== b2.length)
5876
- return false;
5877
- return a2.every((val, index) => val === b2[index]);
5878
- }
5879
5874
  function checkCanSendApplicationMessages(state) {
5880
5875
  if (Object.keys(state.unappliedProposals).length !== 0)
5881
5876
  throw new UsageError("Cannot send application message with unapplied proposals");
@@ -5988,7 +5983,7 @@ async function validateRatchetTree(tree, groupContext, config2, authService, tre
5988
5983
  if (dpNode !== void 0) {
5989
5984
  if (dpNode.nodeType !== "parent")
5990
5985
  return new InternalError("Expected parent node");
5991
- if (!arraysEqual(dpNode.parent.unmergedLeaves, n2.parent.unmergedLeaves))
5986
+ if (!dpNode.parent.unmergedLeaves.includes(unmergedLeaf))
5992
5987
  return new ValidationError("non-blank intermediate node must list leaf node in its unmerged_leaves");
5993
5988
  }
5994
5989
  }
@@ -11465,11 +11460,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11465
11460
  return null;
11466
11461
  }
11467
11462
  function ownIdentity() {
11468
- const v2 = true ? "0.23.34" : FALLBACK;
11463
+ const v2 = true ? "0.23.36" : FALLBACK;
11469
11464
  return `${PACKAGE}@${v2}`;
11470
11465
  }
11471
11466
  function buildSha() {
11472
- const raw = true ? "6b305ca-dirty" : "";
11467
+ const raw = true ? "56c615c-dirty" : "";
11473
11468
  const cleaned = (raw ?? "").trim();
11474
11469
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11475
11470
  }
@@ -70167,7 +70162,7 @@ var init_dist = __esm({
70167
70162
  */
70168
70163
  sendActivitySpan(spanData) {
70169
70164
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70170
- const pluginVersion = true ? "0.23.34" : "0.0.0-dev";
70165
+ const pluginVersion = true ? "0.23.36" : "0.0.0-dev";
70171
70166
  const agentName = this.config.agentName ?? "Agent";
70172
70167
  const resource = {
70173
70168
  "service.name": "agentvault-agent",
@@ -72105,7 +72100,7 @@ var init_dist = __esm({
72105
72100
  agentVersion: this.config.agentVersion ?? "0.0.0",
72106
72101
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72107
72102
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72108
- pluginVersion: true ? "0.23.34" : "0.0.0-dev"
72103
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
72109
72104
  });
72110
72105
  this._telemetryReporter.startAutoFlush(3e4);
72111
72106
  }
@@ -72429,7 +72424,7 @@ var init_dist = __esm({
72429
72424
  agentVersion: this.config.agentVersion ?? "0.0.0",
72430
72425
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72431
72426
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72432
- pluginVersion: true ? "0.23.34" : "0.0.0-dev"
72427
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
72433
72428
  });
72434
72429
  this._telemetryReporter.startAutoFlush(3e4);
72435
72430
  }
@@ -74203,6 +74198,7 @@ ${baseText}`;
74203
74198
  return 0;
74204
74199
  }
74205
74200
  const snapshot = mlsGroup.exportState();
74201
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
74206
74202
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
74207
74203
  let sentCommits = 0;
74208
74204
  for (const c2 of commits) {
@@ -74214,12 +74210,14 @@ ${baseText}`;
74214
74210
  // The epoch this commit PRODUCED. After two commits the manager
74215
74211
  // only knows the last one, which is why the result carries them.
74216
74212
  epoch: Number(c2.epoch),
74217
- payload: Buffer.from(c2.commit).toString("hex")
74213
+ payload: Buffer.from(c2.commit).toString("hex"),
74214
+ ...parent2 ? { parent_digest: parent2 } : {}
74218
74215
  }
74219
74216
  },
74220
74217
  `${label} commit ${sentCommits + 1}/${commits.length}`
74221
74218
  );
74222
74219
  if (!ok) break;
74220
+ parent2 = this._commitDigest(c2.commit);
74223
74221
  sentCommits++;
74224
74222
  }
74225
74223
  if (sentCommits === 0) {
@@ -74306,6 +74304,32 @@ ${baseText}`;
74306
74304
  _wsIsOpen() {
74307
74305
  return this._ws?.readyState === 1;
74308
74306
  }
74307
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
74308
+ _commitDigest(bytes) {
74309
+ return createHash("sha256").update(bytes).digest("hex");
74310
+ }
74311
+ /**
74312
+ * #1177: the digest of the commit at the server's head, or undefined.
74313
+ *
74314
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
74315
+ * deliberately the same value. The commit is sent either way: the server
74316
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
74317
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
74318
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
74319
+ */
74320
+ async _readGroupHeadDigest(groupId) {
74321
+ try {
74322
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
74323
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
74324
+ });
74325
+ if (!res.ok) return void 0;
74326
+ const head = await res.json();
74327
+ const d2 = head?.last_commit_digest;
74328
+ return typeof d2 === "string" && /^[0-9a-f]{64}$/.test(d2) ? d2 : void 0;
74329
+ } catch {
74330
+ return void 0;
74331
+ }
74332
+ }
74309
74333
  /**
74310
74334
  * #1015: write one frame and report whether the socket took it.
74311
74335
  *
@@ -75202,6 +75226,7 @@ ${baseText}`;
75202
75226
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
75203
75227
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
75204
75228
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
75229
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
75205
75230
  let commit;
75206
75231
  let welcome;
75207
75232
  try {
@@ -75232,12 +75257,14 @@ ${baseText}`;
75232
75257
  group_id: chState.mlsGroupId,
75233
75258
  device_id: this._deviceId,
75234
75259
  commit: Buffer.from(removeResult.commit).toString("hex"),
75235
- commit_epoch: Number(mlsGroup.epoch)
75260
+ commit_epoch: Number(mlsGroup.epoch),
75261
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75236
75262
  })
75237
75263
  }
75238
75264
  );
75239
75265
  if (removeResp.ok) {
75240
75266
  removeCommitPublished = true;
75267
+ parentDigest = this._commitDigest(removeResult.commit);
75241
75268
  } else {
75242
75269
  const detail = await removeResp.text().catch(() => "");
75243
75270
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -75305,7 +75332,8 @@ ${baseText}`;
75305
75332
  commit: commitHex,
75306
75333
  commit_epoch: Number(mlsGroup.epoch),
75307
75334
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
75308
- member_device_ids: updatedMembers
75335
+ member_device_ids: updatedMembers,
75336
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75309
75337
  })
75310
75338
  }
75311
75339
  );
@@ -75322,7 +75350,12 @@ ${baseText}`;
75322
75350
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
75323
75351
  const commitSent = await this._sendFrameConfirmed({
75324
75352
  event: "mls_commit",
75325
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
75353
+ data: {
75354
+ group_id: chState.mlsGroupId,
75355
+ epoch: Number(mlsGroup.epoch),
75356
+ payload: commitHex,
75357
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75358
+ }
75326
75359
  }, `${a2aLabel} commit`);
75327
75360
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
75328
75361
  event: "mls_welcome",
@@ -97794,7 +97827,7 @@ data:
97794
97827
  await init_skill_telemetry();
97795
97828
  await init_policy_enforcer();
97796
97829
  init_room_protocol();
97797
- VERSION = true ? "0.23.34" : "0.0.0-dev";
97830
+ VERSION = true ? "0.23.36" : "0.0.0-dev";
97798
97831
  }
97799
97832
  });
97800
97833
  await init_index();
@@ -99170,7 +99203,7 @@ function mkdir700(path2) {
99170
99203
  chmodSync5(path2, 448);
99171
99204
  }
99172
99205
  function packageVersion() {
99173
- return true ? "0.1.9" : void 0;
99206
+ return true ? "0.1.11" : void 0;
99174
99207
  }
99175
99208
  function helpText(version2) {
99176
99209
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/muse-bridge",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "description": "AgentVault Muse Bridge — daemon bridging a Muse agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",