@agentvault/muse-bridge 0.1.10 → 0.1.12

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 +53 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6149,7 +6149,10 @@ async function applyProposals(state, proposals, committerLeafIndex, pskSearch, s
6149
6149
  const [mutatedTree, addedLeafNodes] = await applyTreeMutations(state.ratchetTree, grouped, state.groupContext, sentByClient, state.clientConfig.authService, state.clientConfig.lifetimeConfig, cs.signature);
6150
6150
  const [updatedPskSecret, pskIds] = await accumulatePskSecret(grouped.psk.map((p2) => p2.proposal.psk.preSharedKeyId), pskSearch, cs, zeroes);
6151
6151
  const selfRemoved = mutatedTree[leafToNodeIndex(toLeafIndex(state.privatePath.leafIndex))] === void 0;
6152
- const needsUpdatePath = allProposals.length === 0 || Object.values(grouped.update).length > 1 || Object.values(grouped.remove).length > 1;
6152
+ const needsUpdatePath = allProposals.length === 0 || allProposals.some(({ proposal }) => {
6153
+ const t2 = proposal.proposalType;
6154
+ return t2 !== "add" && t2 !== "psk" && t2 !== "reinit";
6155
+ });
6153
6156
  return {
6154
6157
  tree: mutatedTree,
6155
6158
  pskSecret: updatedPskSecret,
@@ -11460,11 +11463,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11460
11463
  return null;
11461
11464
  }
11462
11465
  function ownIdentity() {
11463
- const v2 = true ? "0.23.35" : FALLBACK;
11466
+ const v2 = true ? "0.23.37" : FALLBACK;
11464
11467
  return `${PACKAGE}@${v2}`;
11465
11468
  }
11466
11469
  function buildSha() {
11467
- const raw = true ? "bcb9297-dirty" : "";
11470
+ const raw = true ? "58c552f-dirty" : "";
11468
11471
  const cleaned = (raw ?? "").trim();
11469
11472
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11470
11473
  }
@@ -70162,7 +70165,7 @@ var init_dist = __esm({
70162
70165
  */
70163
70166
  sendActivitySpan(spanData) {
70164
70167
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70165
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
70168
+ const pluginVersion = true ? "0.23.37" : "0.0.0-dev";
70166
70169
  const agentName = this.config.agentName ?? "Agent";
70167
70170
  const resource = {
70168
70171
  "service.name": "agentvault-agent",
@@ -72100,7 +72103,7 @@ var init_dist = __esm({
72100
72103
  agentVersion: this.config.agentVersion ?? "0.0.0",
72101
72104
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72102
72105
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72103
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
72106
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
72104
72107
  });
72105
72108
  this._telemetryReporter.startAutoFlush(3e4);
72106
72109
  }
@@ -72424,7 +72427,7 @@ var init_dist = __esm({
72424
72427
  agentVersion: this.config.agentVersion ?? "0.0.0",
72425
72428
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72426
72429
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72427
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
72430
+ pluginVersion: true ? "0.23.37" : "0.0.0-dev"
72428
72431
  });
72429
72432
  this._telemetryReporter.startAutoFlush(3e4);
72430
72433
  }
@@ -74198,6 +74201,7 @@ ${baseText}`;
74198
74201
  return 0;
74199
74202
  }
74200
74203
  const snapshot = mlsGroup.exportState();
74204
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
74201
74205
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
74202
74206
  let sentCommits = 0;
74203
74207
  for (const c2 of commits) {
@@ -74209,12 +74213,14 @@ ${baseText}`;
74209
74213
  // The epoch this commit PRODUCED. After two commits the manager
74210
74214
  // only knows the last one, which is why the result carries them.
74211
74215
  epoch: Number(c2.epoch),
74212
- payload: Buffer.from(c2.commit).toString("hex")
74216
+ payload: Buffer.from(c2.commit).toString("hex"),
74217
+ ...parent2 ? { parent_digest: parent2 } : {}
74213
74218
  }
74214
74219
  },
74215
74220
  `${label} commit ${sentCommits + 1}/${commits.length}`
74216
74221
  );
74217
74222
  if (!ok) break;
74223
+ parent2 = this._commitDigest(c2.commit);
74218
74224
  sentCommits++;
74219
74225
  }
74220
74226
  if (sentCommits === 0) {
@@ -74301,6 +74307,32 @@ ${baseText}`;
74301
74307
  _wsIsOpen() {
74302
74308
  return this._ws?.readyState === 1;
74303
74309
  }
74310
+ /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
74311
+ _commitDigest(bytes) {
74312
+ return createHash("sha256").update(bytes).digest("hex");
74313
+ }
74314
+ /**
74315
+ * #1177: the digest of the commit at the server's head, or undefined.
74316
+ *
74317
+ * Undefined covers "no head yet", "older backend", AND "could not read" —
74318
+ * deliberately the same value. The commit is sent either way: the server
74319
+ * skips the parent check for an ABSENT field and refuses a MALFORMED one,
74320
+ * so a read failure must degrade to "unchecked", never to "blocked" (a
74321
+ * rescue that cannot run is the 2026-09-04 lockout) and never to `null`.
74322
+ */
74323
+ async _readGroupHeadDigest(groupId) {
74324
+ try {
74325
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}`, {
74326
+ headers: { Authorization: `Bearer ${this._deviceJwt}` }
74327
+ });
74328
+ if (!res.ok) return void 0;
74329
+ const head = await res.json();
74330
+ const d2 = head?.last_commit_digest;
74331
+ return typeof d2 === "string" && /^[0-9a-f]{64}$/.test(d2) ? d2 : void 0;
74332
+ } catch {
74333
+ return void 0;
74334
+ }
74335
+ }
74304
74336
  /**
74305
74337
  * #1015: write one frame and report whether the socket took it.
74306
74338
  *
@@ -75197,6 +75229,7 @@ ${baseText}`;
75197
75229
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
75198
75230
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
75199
75231
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
75232
+ let parentDigest = await this._readGroupHeadDigest(chState.mlsGroupId);
75200
75233
  let commit;
75201
75234
  let welcome;
75202
75235
  try {
@@ -75227,12 +75260,14 @@ ${baseText}`;
75227
75260
  group_id: chState.mlsGroupId,
75228
75261
  device_id: this._deviceId,
75229
75262
  commit: Buffer.from(removeResult.commit).toString("hex"),
75230
- commit_epoch: Number(mlsGroup.epoch)
75263
+ commit_epoch: Number(mlsGroup.epoch),
75264
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75231
75265
  })
75232
75266
  }
75233
75267
  );
75234
75268
  if (removeResp.ok) {
75235
75269
  removeCommitPublished = true;
75270
+ parentDigest = this._commitDigest(removeResult.commit);
75236
75271
  } else {
75237
75272
  const detail = await removeResp.text().catch(() => "");
75238
75273
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -75300,7 +75335,8 @@ ${baseText}`;
75300
75335
  commit: commitHex,
75301
75336
  commit_epoch: Number(mlsGroup.epoch),
75302
75337
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
75303
- member_device_ids: updatedMembers
75338
+ member_device_ids: updatedMembers,
75339
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75304
75340
  })
75305
75341
  }
75306
75342
  );
@@ -75317,7 +75353,12 @@ ${baseText}`;
75317
75353
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
75318
75354
  const commitSent = await this._sendFrameConfirmed({
75319
75355
  event: "mls_commit",
75320
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
75356
+ data: {
75357
+ group_id: chState.mlsGroupId,
75358
+ epoch: Number(mlsGroup.epoch),
75359
+ payload: commitHex,
75360
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75361
+ }
75321
75362
  }, `${a2aLabel} commit`);
75322
75363
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
75323
75364
  event: "mls_welcome",
@@ -97789,7 +97830,7 @@ data:
97789
97830
  await init_skill_telemetry();
97790
97831
  await init_policy_enforcer();
97791
97832
  init_room_protocol();
97792
- VERSION = true ? "0.23.35" : "0.0.0-dev";
97833
+ VERSION = true ? "0.23.37" : "0.0.0-dev";
97793
97834
  }
97794
97835
  });
97795
97836
  await init_index();
@@ -99165,7 +99206,7 @@ function mkdir700(path2) {
99165
99206
  chmodSync5(path2, 448);
99166
99207
  }
99167
99208
  function packageVersion() {
99168
- return true ? "0.1.10" : void 0;
99209
+ return true ? "0.1.12" : void 0;
99169
99210
  }
99170
99211
  function helpText(version2) {
99171
99212
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/muse-bridge",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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",