@agentvault/grok-bridge 0.4.20 → 0.4.21

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 +43 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11712,11 +11712,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11712
11712
  return null;
11713
11713
  }
11714
11714
  function ownIdentity() {
11715
- const v2 = true ? "0.23.49" : FALLBACK;
11715
+ const v2 = true ? "0.23.50" : FALLBACK;
11716
11716
  return `${PACKAGE}@${v2}`;
11717
11717
  }
11718
11718
  function buildSha() {
11719
- const raw = true ? "c98737d" : "";
11719
+ const raw = true ? "c8f1371" : "";
11720
11720
  const cleaned = (raw ?? "").trim();
11721
11721
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11722
11722
  }
@@ -69611,6 +69611,34 @@ var init_dist = __esm({
69611
69611
  }
69612
69612
  return null;
69613
69613
  }
69614
+ /**
69615
+ * Every occupied leaf of the ratchet tree, with its basic-credential
69616
+ * identity — READ-ONLY (#470 phase 1).
69617
+ *
69618
+ * Stale-leaf detection compares the tree with the server's eligible set, so
69619
+ * it must see EVERY leaf. `memberLeafIndex` cannot: it stops at the first
69620
+ * match, so a device holding two leaves (the duplicate-add shape observed
69621
+ * live 2026-06-18) would show one. Blank leaves (removed members) are
69622
+ * skipped; duplicates are returned once per leaf. Leaves whose credential is
69623
+ * not `basic` carry no comparable identity and are skipped too — the web
69624
+ * client only ever mints basic credentials.
69625
+ *
69626
+ * Identities are COPIES: a caller mutating one cannot reach the tree.
69627
+ */
69628
+ leafIdentities() {
69629
+ const tree = this._requireState().ratchetTree;
69630
+ const out = [];
69631
+ for (let nodeIndex = 0; nodeIndex < tree.length; nodeIndex += 2) {
69632
+ const node2 = tree[nodeIndex];
69633
+ if (node2 && node2.nodeType === "leaf") {
69634
+ const cred = node2.leaf.credential;
69635
+ if (cred.credentialType === "basic") {
69636
+ out.push({ leafIndex: nodeIndex / 2, identity: new Uint8Array(cred.identity) });
69637
+ }
69638
+ }
69639
+ }
69640
+ return out;
69641
+ }
69614
69642
  // -------------------------------------------------------------------------
69615
69643
  // Encrypt / Decrypt
69616
69644
  // -------------------------------------------------------------------------
@@ -70617,6 +70645,7 @@ var init_dist = __esm({
70617
70645
  _trustTier = null;
70618
70646
  _trustTokenExpiresAt = null;
70619
70647
  _trustTokenInterval = null;
70648
+ _trustTokenUnavailableUntil = 0;
70620
70649
  _pendingPollTimer = null;
70621
70650
  _syncMessageIds = null;
70622
70651
  _deliveryHeartbeat = null;
@@ -70832,6 +70861,7 @@ ${text}`;
70832
70861
  static SILENCE_TIMEOUT_MS = 9e4;
70833
70862
  static POLL_FALLBACK_INTERVAL_MS = 3e4;
70834
70863
  // 30s when messages found
70864
+ static TRUST_TOKEN_UNAVAILABLE_BACKOFF_MS = 6 * 60 * 60 * 1e3;
70835
70865
  static POLL_FALLBACK_IDLE_MS = 6e4;
70836
70866
  // 60s when idle
70837
70867
  /**
@@ -72229,7 +72259,7 @@ ${text}`;
72229
72259
  */
72230
72260
  sendActivitySpan(spanData) {
72231
72261
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
72232
- const pluginVersion = true ? "0.23.49" : "0.0.0-dev";
72262
+ const pluginVersion = true ? "0.23.50" : "0.0.0-dev";
72233
72263
  const agentName = this.config.agentName ?? "Agent";
72234
72264
  const resource = {
72235
72265
  "service.name": "agentvault-agent",
@@ -73262,6 +73292,7 @@ ${text}`;
73262
73292
  return this._trustTokenExpiresAt;
73263
73293
  }
73264
73294
  async refreshTrustToken() {
73295
+ if (Date.now() < this._trustTokenUnavailableUntil) return;
73265
73296
  try {
73266
73297
  const res = await fetch(`${this.config.apiUrl}/api/v1/gate/token`, {
73267
73298
  method: "POST",
@@ -73275,12 +73306,15 @@ ${text}`;
73275
73306
  this._trustToken = data.token;
73276
73307
  this._trustTier = data.tier;
73277
73308
  this._trustTokenExpiresAt = data.expires_at;
73309
+ } else if (res.status === 503 || res.status === 404 || res.status === 403) {
73310
+ this._trustTokenUnavailableUntil = Date.now() + _SecureChannel.TRUST_TOKEN_UNAVAILABLE_BACKOFF_MS;
73278
73311
  }
73279
73312
  } catch (err) {
73280
73313
  console.warn("[AgentVault] Trust token refresh failed:", err);
73281
73314
  }
73282
73315
  }
73283
73316
  startTrustTokenRefresh() {
73317
+ this.stopTrustTokenRefresh();
73284
73318
  this.refreshTrustToken();
73285
73319
  this._trustTokenInterval = setInterval(
73286
73320
  () => this.refreshTrustToken(),
@@ -74225,7 +74259,7 @@ ${text}`;
74225
74259
  agentVersion: this.config.agentVersion ?? "0.0.0",
74226
74260
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
74227
74261
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
74228
- pluginVersion: true ? "0.23.49" : "0.0.0-dev"
74262
+ pluginVersion: true ? "0.23.50" : "0.0.0-dev"
74229
74263
  });
74230
74264
  this._telemetryReporter.startAutoFlush(3e4);
74231
74265
  }
@@ -74553,7 +74587,7 @@ ${text}`;
74553
74587
  agentVersion: this.config.agentVersion ?? "0.0.0",
74554
74588
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
74555
74589
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
74556
- pluginVersion: true ? "0.23.49" : "0.0.0-dev"
74590
+ pluginVersion: true ? "0.23.50" : "0.0.0-dev"
74557
74591
  });
74558
74592
  this._telemetryReporter.startAutoFlush(3e4);
74559
74593
  }
@@ -100709,7 +100743,7 @@ data:
100709
100743
  await init_skill_telemetry();
100710
100744
  await init_policy_enforcer();
100711
100745
  init_room_protocol();
100712
- VERSION = true ? "0.23.49" : "0.0.0-dev";
100746
+ VERSION = true ? "0.23.50" : "0.0.0-dev";
100713
100747
  }
100714
100748
  });
100715
100749
  await init_index();
@@ -102810,7 +102844,7 @@ async function main() {
102810
102844
  const info = parseInfoFlags(process.argv.slice(2));
102811
102845
  if (info.showVersion || info.showHelp) {
102812
102846
  const version2 = buildClientVersion2(
102813
- true ? "0.4.20" : void 0
102847
+ true ? "0.4.21" : void 0
102814
102848
  );
102815
102849
  if (info.showVersion) printLine(version2);
102816
102850
  if (info.showHelp) {
@@ -102849,7 +102883,7 @@ async function main() {
102849
102883
  process.exit(0);
102850
102884
  }
102851
102885
  const cfg = loadConfig(process.env, process.argv.slice(2));
102852
- logLine(`[grok-bridge] version: ${true ? "0.4.20" : "dev"}`);
102886
+ logLine(`[grok-bridge] version: ${true ? "0.4.21" : "dev"}`);
102853
102887
  mkdirSync7(cfg.workspaceDir, { recursive: true });
102854
102888
  mkdirSync7(cfg.fenceHome, { recursive: true });
102855
102889
  seedFenceCredential({
@@ -102864,7 +102898,7 @@ async function main() {
102864
102898
  agentName: cfg.agentName,
102865
102899
  platform: "node",
102866
102900
  clientVersion: buildClientVersion2(
102867
- true ? "0.4.20" : void 0
102901
+ true ? "0.4.21" : void 0
102868
102902
  )
102869
102903
  });
102870
102904
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "type": "module",
5
5
  "description": "AgentVault Grok Bridge — daemon bridging a Grok agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",