@agentvault/muse-bridge 0.1.10 → 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 +49 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11460,11 +11460,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11460
11460
  return null;
11461
11461
  }
11462
11462
  function ownIdentity() {
11463
- const v2 = true ? "0.23.35" : FALLBACK;
11463
+ const v2 = true ? "0.23.36" : FALLBACK;
11464
11464
  return `${PACKAGE}@${v2}`;
11465
11465
  }
11466
11466
  function buildSha() {
11467
- const raw = true ? "bcb9297-dirty" : "";
11467
+ const raw = true ? "56c615c-dirty" : "";
11468
11468
  const cleaned = (raw ?? "").trim();
11469
11469
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11470
11470
  }
@@ -70162,7 +70162,7 @@ var init_dist = __esm({
70162
70162
  */
70163
70163
  sendActivitySpan(spanData) {
70164
70164
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70165
- const pluginVersion = true ? "0.23.35" : "0.0.0-dev";
70165
+ const pluginVersion = true ? "0.23.36" : "0.0.0-dev";
70166
70166
  const agentName = this.config.agentName ?? "Agent";
70167
70167
  const resource = {
70168
70168
  "service.name": "agentvault-agent",
@@ -72100,7 +72100,7 @@ var init_dist = __esm({
72100
72100
  agentVersion: this.config.agentVersion ?? "0.0.0",
72101
72101
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72102
72102
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72103
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
72103
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
72104
72104
  });
72105
72105
  this._telemetryReporter.startAutoFlush(3e4);
72106
72106
  }
@@ -72424,7 +72424,7 @@ var init_dist = __esm({
72424
72424
  agentVersion: this.config.agentVersion ?? "0.0.0",
72425
72425
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72426
72426
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72427
- pluginVersion: true ? "0.23.35" : "0.0.0-dev"
72427
+ pluginVersion: true ? "0.23.36" : "0.0.0-dev"
72428
72428
  });
72429
72429
  this._telemetryReporter.startAutoFlush(3e4);
72430
72430
  }
@@ -74198,6 +74198,7 @@ ${baseText}`;
74198
74198
  return 0;
74199
74199
  }
74200
74200
  const snapshot = mlsGroup.exportState();
74201
+ let parent2 = await this._readGroupHeadDigest(mlsGroupId);
74201
74202
  const { commits, welcome } = await mlsGroup.reAdmitMembers(targets.map((t2) => t2.keyPackage));
74202
74203
  let sentCommits = 0;
74203
74204
  for (const c2 of commits) {
@@ -74209,12 +74210,14 @@ ${baseText}`;
74209
74210
  // The epoch this commit PRODUCED. After two commits the manager
74210
74211
  // only knows the last one, which is why the result carries them.
74211
74212
  epoch: Number(c2.epoch),
74212
- payload: Buffer.from(c2.commit).toString("hex")
74213
+ payload: Buffer.from(c2.commit).toString("hex"),
74214
+ ...parent2 ? { parent_digest: parent2 } : {}
74213
74215
  }
74214
74216
  },
74215
74217
  `${label} commit ${sentCommits + 1}/${commits.length}`
74216
74218
  );
74217
74219
  if (!ok) break;
74220
+ parent2 = this._commitDigest(c2.commit);
74218
74221
  sentCommits++;
74219
74222
  }
74220
74223
  if (sentCommits === 0) {
@@ -74301,6 +74304,32 @@ ${baseText}`;
74301
74304
  _wsIsOpen() {
74302
74305
  return this._ws?.readyState === 1;
74303
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
+ }
74304
74333
  /**
74305
74334
  * #1015: write one frame and report whether the socket took it.
74306
74335
  *
@@ -75197,6 +75226,7 @@ ${baseText}`;
75197
75226
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
75198
75227
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
75199
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);
75200
75230
  let commit;
75201
75231
  let welcome;
75202
75232
  try {
@@ -75227,12 +75257,14 @@ ${baseText}`;
75227
75257
  group_id: chState.mlsGroupId,
75228
75258
  device_id: this._deviceId,
75229
75259
  commit: Buffer.from(removeResult.commit).toString("hex"),
75230
- commit_epoch: Number(mlsGroup.epoch)
75260
+ commit_epoch: Number(mlsGroup.epoch),
75261
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75231
75262
  })
75232
75263
  }
75233
75264
  );
75234
75265
  if (removeResp.ok) {
75235
75266
  removeCommitPublished = true;
75267
+ parentDigest = this._commitDigest(removeResult.commit);
75236
75268
  } else {
75237
75269
  const detail = await removeResp.text().catch(() => "");
75238
75270
  console.warn(`[SecureChannel] A2A remove-commit distribute failed (${removeResp.status}): ${detail}`);
@@ -75300,7 +75332,8 @@ ${baseText}`;
75300
75332
  commit: commitHex,
75301
75333
  commit_epoch: Number(mlsGroup.epoch),
75302
75334
  welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
75303
- member_device_ids: updatedMembers
75335
+ member_device_ids: updatedMembers,
75336
+ ...parentDigest ? { parent_digest: parentDigest } : {}
75304
75337
  })
75305
75338
  }
75306
75339
  );
@@ -75317,7 +75350,12 @@ ${baseText}`;
75317
75350
  const a2aLabel = `A2A ${chId.slice(0, 8)}`;
75318
75351
  const commitSent = await this._sendFrameConfirmed({
75319
75352
  event: "mls_commit",
75320
- 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
+ }
75321
75359
  }, `${a2aLabel} commit`);
75322
75360
  const welcomeSent = commitSent && await this._sendFrameConfirmed({
75323
75361
  event: "mls_welcome",
@@ -97789,7 +97827,7 @@ data:
97789
97827
  await init_skill_telemetry();
97790
97828
  await init_policy_enforcer();
97791
97829
  init_room_protocol();
97792
- VERSION = true ? "0.23.35" : "0.0.0-dev";
97830
+ VERSION = true ? "0.23.36" : "0.0.0-dev";
97793
97831
  }
97794
97832
  });
97795
97833
  await init_index();
@@ -99165,7 +99203,7 @@ function mkdir700(path2) {
99165
99203
  chmodSync5(path2, 448);
99166
99204
  }
99167
99205
  function packageVersion() {
99168
- return true ? "0.1.10" : void 0;
99206
+ return true ? "0.1.11" : void 0;
99169
99207
  }
99170
99208
  function helpText(version2) {
99171
99209
  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.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",