@agentvault/muse-bridge 0.1.1 → 0.1.3

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
@@ -9,20 +9,132 @@ var __export = (target, all) => {
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
11
 
12
+ // src/fence-auth.ts
13
+ import {
14
+ copyFileSync,
15
+ chmodSync,
16
+ existsSync,
17
+ mkdirSync,
18
+ readFileSync,
19
+ unlinkSync,
20
+ writeFileSync
21
+ } from "node:fs";
22
+ import { join } from "node:path";
23
+ function parseAuthJson(path2) {
24
+ try {
25
+ if (!existsSync(path2)) return void 0;
26
+ return JSON.parse(readFileSync(path2, "utf8"));
27
+ } catch {
28
+ return void 0;
29
+ }
30
+ }
31
+ function metaApiKeyFromAuth(parsed) {
32
+ if (!parsed || typeof parsed !== "object") return void 0;
33
+ const providers = parsed.providers;
34
+ if (!providers || typeof providers !== "object") return void 0;
35
+ const meta3 = providers.meta;
36
+ if (!meta3 || typeof meta3 !== "object") return void 0;
37
+ const key = meta3.api_key;
38
+ if (typeof key !== "string") return void 0;
39
+ const trimmed = key.trim();
40
+ return trimmed.length > 0 ? trimmed : void 0;
41
+ }
42
+ function isKeychainOnlyAuth(parsed) {
43
+ if (!parsed || typeof parsed !== "object") return false;
44
+ const providers = parsed.providers;
45
+ if (!providers || typeof providers !== "object") return false;
46
+ const meta3 = providers.meta;
47
+ if (!meta3 || typeof meta3 !== "object") return false;
48
+ return meta3.storage === "keychain" && !metaApiKeyFromAuth(parsed);
49
+ }
50
+ function readFenceMetaApiKey(fenceHome) {
51
+ return metaApiKeyFromAuth(parseAuthJson(join(fenceHome, ".config", "muse", "auth.json")));
52
+ }
53
+ function sidecarMetaApiKeyPath(dataDir) {
54
+ return join(dataDir, "meta-api-key.json");
55
+ }
56
+ function apiKeyFromSidecar(parsed) {
57
+ if (!parsed || typeof parsed !== "object") return void 0;
58
+ const key = parsed.api_key;
59
+ if (typeof key !== "string") return void 0;
60
+ const trimmed = key.trim();
61
+ return trimmed.length > 0 ? trimmed : void 0;
62
+ }
63
+ function readSidecarMetaApiKey(dataDir) {
64
+ return apiKeyFromSidecar(parseAuthJson(sidecarMetaApiKeyPath(dataDir)));
65
+ }
66
+ function harvestFenceApiKeyToSidecar(opts) {
67
+ const log = opts.log ?? (() => {
68
+ });
69
+ const fenceAuth = join(opts.fenceHome, ".config", "muse", "auth.json");
70
+ const fenceKey = readFenceMetaApiKey(opts.fenceHome);
71
+ const sidecar = sidecarMetaApiKeyPath(opts.dataDir);
72
+ const hadSidecar = !!readSidecarMetaApiKey(opts.dataDir);
73
+ if (fenceKey && !hadSidecar) {
74
+ mkdirSync(opts.dataDir, { recursive: true, mode: 448 });
75
+ writeFileSync(sidecar, JSON.stringify({ api_key: fenceKey }) + "\n", { encoding: "utf8" });
76
+ chmodSync(sidecar, 384);
77
+ log("[muse-bridge] moved fence Meta key out of auth.json so Muse will not hit the Keychain");
78
+ }
79
+ if (fenceKey && existsSync(fenceAuth)) {
80
+ unlinkSync(fenceAuth);
81
+ }
82
+ if (fenceKey && !hadSidecar) return "harvested";
83
+ if (hadSidecar) return "already-sidecar";
84
+ return "none";
85
+ }
86
+ function seedFenceCredential(opts) {
87
+ const log = opts.log ?? (() => {
88
+ });
89
+ const fenceAuth = join(opts.fenceHome, ".config", "muse", "auth.json");
90
+ if (existsSync(fenceAuth)) {
91
+ if (isKeychainOnlyAuth(parseAuthJson(fenceAuth))) {
92
+ unlinkSync(fenceAuth);
93
+ log(
94
+ "[muse-bridge] fence credential is keychain-only; removing it so the child does not hit the Keychain"
95
+ );
96
+ } else {
97
+ log("[muse-bridge] fence credential already present; leaving it untouched");
98
+ return "already-present";
99
+ }
100
+ }
101
+ const hostAuth = join(opts.hostHome, ".config", "muse", "auth.json");
102
+ if (!existsSync(hostAuth)) {
103
+ log("[muse-bridge] no host credential to seed (run `muse login`, or set META_API_KEY)");
104
+ return "no-host-credential";
105
+ }
106
+ if (isKeychainOnlyAuth(parseAuthJson(hostAuth))) {
107
+ log(
108
+ "[muse-bridge] host muse login is keychain-only; not copying it into the fence. Set META_API_KEY."
109
+ );
110
+ return "host-credential-keychain-only";
111
+ }
112
+ mkdirSync(join(opts.fenceHome, ".config", "muse"), { recursive: true });
113
+ copyFileSync(hostAuth, fenceAuth);
114
+ chmodSync(fenceAuth, 384);
115
+ log("[muse-bridge] seeded fence credential from the host muse login");
116
+ return "seeded";
117
+ }
118
+ var init_fence_auth = __esm({
119
+ "src/fence-auth.ts"() {
120
+ "use strict";
121
+ }
122
+ });
123
+
12
124
  // src/config.ts
13
- import { existsSync, readFileSync, mkdirSync, chmodSync } from "node:fs";
14
- import { join, resolve, sep, dirname } from "node:path";
125
+ import { existsSync as existsSync2, readFileSync as readFileSync2, mkdirSync as mkdirSync2, chmodSync as chmodSync2 } from "node:fs";
126
+ import { join as join2, resolve, sep, dirname } from "node:path";
15
127
  import { tmpdir } from "node:os";
16
128
  function hasRecoverableBackup(dataDir) {
17
129
  try {
18
- const parsed = JSON.parse(readFileSync(join(dataDir, BACKUP_FILE), "utf-8"));
130
+ const parsed = JSON.parse(readFileSync2(join2(dataDir, BACKUP_FILE), "utf-8"));
19
131
  return !!(parsed && parsed.deviceId && parsed.deviceJwt && parsed.sessions && Object.keys(parsed.sessions).length > 0);
20
132
  } catch {
21
133
  return false;
22
134
  }
23
135
  }
24
136
  function hasPersistedCreds(dataDir) {
25
- if (CRED_FILES.some((f2) => existsSync(join(dataDir, f2)))) return true;
137
+ if (CRED_FILES.some((f2) => existsSync2(join2(dataDir, f2)))) return true;
26
138
  return hasRecoverableBackup(dataDir);
27
139
  }
28
140
  function slugify(name) {
@@ -54,8 +166,8 @@ function loadConfig(env, argv = []) {
54
166
  }
55
167
  const slug = slugify(agentName);
56
168
  const hostHome = env.HOME ?? "";
57
- const dataDir = env.AV_DATA_DIR || join(hostHome, ".agentvault", "muse-room-bridge", slug);
58
- const workspaceDir = env.AV_WORKSPACE_DIR || join(dirname(dataDir), "workspaces", slug);
169
+ const dataDir = env.AV_DATA_DIR || join2(hostHome, ".agentvault", "muse-room-bridge", slug);
170
+ const workspaceDir = env.AV_WORKSPACE_DIR || join2(dirname(dataDir), "workspaces", slug);
59
171
  const wsReal = resolve(workspaceDir);
60
172
  const ddReal = resolve(dataDir);
61
173
  if (wsReal === ddReal || wsReal.startsWith(ddReal + sep) || ddReal.startsWith(wsReal + sep)) {
@@ -64,8 +176,8 @@ function loadConfig(env, argv = []) {
64
176
  );
65
177
  }
66
178
  try {
67
- mkdirSync(workspaceDir, { recursive: true, mode: 448 });
68
- chmodSync(workspaceDir, 448);
179
+ mkdirSync2(workspaceDir, { recursive: true, mode: 448 });
180
+ chmodSync2(workspaceDir, 448);
69
181
  } catch (e) {
70
182
  throw new Error(
71
183
  `Failed to create/secure the agent workspace at ${workspaceDir} (override with AV_WORKSPACE_DIR): ${e.message}`
@@ -83,14 +195,15 @@ function loadConfig(env, argv = []) {
83
195
  "invite token required: pass it as the first argument or set AV_INVITE_TOKEN (or start from a data dir with existing credentials to reconnect)"
84
196
  );
85
197
  }
198
+ const fenceHome = env.AV_FENCE_HOME || join2(dataDir, "fence");
86
199
  return {
87
200
  inviteToken,
88
201
  dataDir,
89
202
  agentName,
90
203
  workspaceDir,
91
204
  musePath: env.AV_MUSE_PATH || "muse",
92
- fenceHome: env.AV_FENCE_HOME || join(dataDir, "fence"),
93
- apiKey: env.META_API_KEY || void 0,
205
+ fenceHome,
206
+ apiKey: env.META_API_KEY || readSidecarMetaApiKey(dataDir) || readFenceMetaApiKey(fenceHome) || void 0,
94
207
  hostHome,
95
208
  apiUrl: env.AV_API_URL ?? "https://api.agentvault.chat"
96
209
  };
@@ -99,6 +212,7 @@ var CRED_FILES, BACKUP_FILE, VERSION_FLAGS, HELP_FLAGS, KNOWN_FLAGS;
99
212
  var init_config = __esm({
100
213
  "src/config.ts"() {
101
214
  "use strict";
215
+ init_fence_auth();
102
216
  CRED_FILES = ["agentvault.json", "secure-channel.json"];
103
217
  BACKUP_FILE = "agentvault.json.bak";
104
218
  VERSION_FLAGS = ["--version", "-v"];
@@ -260,6 +374,7 @@ function parsePlistEnv(xml) {
260
374
  }
261
375
  i2 = m2.index;
262
376
  }
377
+ void i2;
263
378
  if (close < 0) return out;
264
379
  const body = xml.slice(open, close);
265
380
  const pair = /<key>([\s\S]*?)<\/key>\s*<string>([\s\S]*?)<\/string>/g;
@@ -279,6 +394,7 @@ var init_launchd = __esm({
279
394
  constructor(deps) {
280
395
  this.deps = deps;
281
396
  }
397
+ deps;
282
398
  plistPath(label) {
283
399
  return join7(this.deps.home, "Library", "LaunchAgents", `${label}.plist`);
284
400
  }
@@ -391,6 +507,7 @@ var init_systemd = __esm({
391
507
  constructor(deps) {
392
508
  this.deps = deps;
393
509
  }
510
+ deps;
394
511
  unitPath(label) {
395
512
  return join8(this.deps.home, ".config", "systemd", "user", `${label}.service`);
396
513
  }
@@ -439,7 +556,7 @@ var init_systemd = __esm({
439
556
 
440
557
  // src/service/backend.ts
441
558
  import { spawnSync } from "node:child_process";
442
- import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync3, rmSync, existsSync as existsSync4, chmodSync as chmodSync4, readdirSync, readFileSync as readFileSync3 } from "node:fs";
559
+ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync4, rmSync, existsSync as existsSync4, chmodSync as chmodSync4, readdirSync, readFileSync as readFileSync4 } from "node:fs";
443
560
  import { userInfo } from "node:os";
444
561
  function defaultDeps() {
445
562
  return {
@@ -450,7 +567,7 @@ function defaultDeps() {
450
567
  const r2 = spawnSync(cmd, args, { encoding: "utf8" });
451
568
  return { code: r2.status ?? 1, stdout: r2.stdout ?? "" };
452
569
  },
453
- writeFile: (p2, d2) => writeFileSync3(p2, d2),
570
+ writeFile: (p2, d2) => writeFileSync4(p2, d2),
454
571
  mkdir: (p2) => mkdirSync5(p2, { recursive: true }),
455
572
  chmod: (p2, m2) => chmodSync4(p2, m2),
456
573
  rm: (p2) => rmSync(p2, { force: true }),
@@ -464,7 +581,7 @@ function defaultDeps() {
464
581
  },
465
582
  readFile: (p2) => {
466
583
  try {
467
- return readFileSync3(p2, "utf8");
584
+ return readFileSync4(p2, "utf8");
468
585
  } catch {
469
586
  return "";
470
587
  }
@@ -633,7 +750,7 @@ import { randomUUID as randomUUID3 } from "node:crypto";
633
750
  import { EventEmitter } from "node:events";
634
751
  import { createServer as createServer2 } from "node:http";
635
752
  import { randomUUID as randomUUID22, createHash } from "node:crypto";
636
- import { readFileSync as readFileSync4 } from "node:fs";
753
+ import { readFileSync as readFileSync5 } from "node:fs";
637
754
  import { homedir as osHomedir } from "node:os";
638
755
  import { writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
639
756
  import { join as join42 } from "node:path";
@@ -11615,6 +11732,18 @@ function orderDeliveryBatch(messages) {
11615
11732
  return createdAtOf(a2) - createdAtOf(b2);
11616
11733
  });
11617
11734
  }
11735
+ function noteObservedEpoch(current, seen) {
11736
+ const n2 = Number(seen);
11737
+ if (!Number.isInteger(n2) || n2 < 0)
11738
+ return current;
11739
+ return n2 > current ? n2 : current;
11740
+ }
11741
+ function needsPreSendResync(localEpoch, observedEpoch) {
11742
+ if (!Number.isInteger(localEpoch) || !Number.isInteger(observedEpoch)) {
11743
+ return false;
11744
+ }
11745
+ return observedEpoch > localEpoch;
11746
+ }
11618
11747
  async function ensureSecureDir(dir) {
11619
11748
  await mkdir(dir, { recursive: true, mode: DIR_MODE });
11620
11749
  try {
@@ -11780,7 +11909,7 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11780
11909
  return null;
11781
11910
  }
11782
11911
  function ownIdentity() {
11783
- const v2 = true ? "0.23.26" : FALLBACK;
11912
+ const v2 = true ? "0.23.27" : FALLBACK;
11784
11913
  return `${PACKAGE}@${v2}`;
11785
11914
  }
11786
11915
  function buildClientVersion2(override) {
@@ -14754,7 +14883,7 @@ function _stringbool(Classes, _params) {
14754
14883
  type: "pipe",
14755
14884
  in: stringSchema,
14756
14885
  out: booleanSchema,
14757
- transform: (input, payload) => {
14886
+ transform: ((input, payload) => {
14758
14887
  let data = input;
14759
14888
  if (params.case !== "sensitive")
14760
14889
  data = data.toLowerCase();
@@ -14773,14 +14902,14 @@ function _stringbool(Classes, _params) {
14773
14902
  });
14774
14903
  return {};
14775
14904
  }
14776
- },
14777
- reverseTransform: (input, _payload) => {
14905
+ }),
14906
+ reverseTransform: ((input, _payload) => {
14778
14907
  if (input === true) {
14779
14908
  return truthyArray[0] || "true";
14780
14909
  } else {
14781
14910
  return falsyArray[0] || "false";
14782
14911
  }
14783
- },
14912
+ }),
14784
14913
  error: params.error
14785
14914
  });
14786
14915
  return codec2;
@@ -15794,11 +15923,13 @@ function assertCompleteRequestPrompt(request) {
15794
15923
  if (request.params.ref.type !== "ref/prompt") {
15795
15924
  throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
15796
15925
  }
15926
+ void request;
15797
15927
  }
15798
15928
  function assertCompleteRequestResourceTemplate(request) {
15799
15929
  if (request.params.ref.type !== "ref/resource") {
15800
15930
  throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`);
15801
15931
  }
15932
+ void request;
15802
15933
  }
15803
15934
  function isTerminal(status) {
15804
15935
  return status === "completed" || status === "failed" || status === "cancelled";
@@ -17306,7 +17437,7 @@ function reportSkillInvocation(opts) {
17306
17437
  spanBuffer.push(span);
17307
17438
  return span;
17308
17439
  }
17309
- var __create, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf, __hasOwnProp, __esm2, __commonJS, __export2, __copyProps, __toESM, init_mls_commit_classify, __filename, __dirname, url2, path, Module, Module, root, window_, crypto_, randomValuesStandard, crypto4, randomValueNodeJS, _Module, libsodium_sumo_default, init_libsodium_sumo, a, r, t, c, libsodium_wrappers_default, init_libsodium_wrappers, init_keys, init_x3dh, MAX_SKIP, CHAIN_KEY_SEED, MSG_KEY_SEED, HEADER_KEY_SEED, DoubleRatchet, init_ratchet, init_file_crypto, DOMAIN_DID_DOCUMENT, DOMAIN_TRANSFER_INTENT, DOMAIN_TRANSFER_ACCEPT, BASE58_ALPHABET, init_did, BUILTIN_PATTERNS, ScanEngine, init_scan_engine, init_merkle, VC_CONTEXT_V2, AV_CREDENTIAL_CONTEXT, CRYPTOSUITE, BASE58_ALPHABET2, init_vc, init_transport, init_telemetry, TelemetryReporter, init_telemetry_reporter, CROCKFORD, ARGON2_OPSLIMIT, ARGON2_MEMLIMIT, SALT_BYTES, NONCE_BYTES, KEY_BYTES, BACKUP_VERSION, MAX_BACKUP_SIZE, init_backup, init_approval, encVoid, init_tlsEncoder, uint8Encoder, encodeUint8, decodeUint8, uint16Encoder, encodeUint16, decodeUint16, uint32Encoder, encodeUint32, decodeUint32, uint64Encoder, encodeUint64, decodeUint64, init_number, init_tlsDecoder, init_enumHelpers, defaultProposalTypes, defaultProposalTypeEncoder, encodeDefaultProposalType, decodeDefaultProposalType, init_defaultProposalType, defaultExtensionTypes, defaultExtensionTypeEncoder, encodeDefaultExtensionType, decodeDefaultExtensionType, init_defaultExtensionType, acceptAll, init_incomingMessageAction, MlsError, ValidationError, CodecError, UsageError, DependencyError, CryptoVerificationError, CryptoError, InternalError, init_mlsError, init_byteArray, varLenDataEncoder, decodeVarLenData, init_variableLength, init_constantTimeCompare, extensionTypeEncoder, encodeExtensionType, decodeExtensionType, extensionEncoder, encodeExtension, decodeExtension, init_extension, credentialTypes, credentialTypeEncoder, encodeCredentialType, decodeCredentialType, init_credentialType, credentialBasicEncoder, encodeCredentialBasic, credentialX509Encoder, encodeCredentialX509, credentialCustomEncoder, encodeCredentialCustom, credentialEncoder, encodeCredential, decodeCredentialBasic, decodeCredentialX509, decodeCredential, init_credential, externalSenderEncoder, encodeExternalSender, decodeExternalSender, init_externalSender, init_hash, init_optional, ciphersuites, ciphersuiteEncoder, encodeCiphersuite, decodeCiphersuite, ciphersuiteValues, init_ciphersuite, init_signature, protocolVersions, protocolVersionEncoder, encodeProtocolVersion, decodeProtocolVersion, init_protocolVersion, capabilitiesEncoder, encodeCapabilities, decodeCapabilities, init_capabilities, leafNodeSources, leafNodeSourceEncoder, encodeLeafNodeSource, decodeLeafNodeSource, init_leafNodeSource, lifetimeEncoder, encodeLifetime, decodeLifetime, defaultLifetime, init_lifetime, leafNodeDataEncoder, encodeLeafNodeData, decodeLeafNodeData, leafNodeInfoKeyPackageEncoder, encodeLeafNodeInfoKeyPackage, leafNodeInfoUpdateOmittedEncoder, encodeLeafNodeInfoUpdateOmitted, leafNodeInfoCommitOmittedEncoder, encodeLeafNodeInfoCommitOmitted, leafNodeInfoOmittedEncoder, encodeLeafNodeInfoOmitted, decodeLeafNodeInfoKeyPackage, decodeLeafNodeInfoUpdateOmitted, decodeLeafNodeInfoCommitOmitted, decodeLeafNodeInfoOmitted, leafNodeInfoUpdateEncoder, encodeLeafNodeInfoUpdate, leafNodeInfoCommitEncoder, encodeLeafNodeInfoCommit, leafNodeInfoEncoder, encodeLeafNodeInfo, decodeLeafNodeInfoUpdate, decodeLeafNodeInfoCommit, decodeLeafNodeInfo, leafNodeTBSEncoder, encodeLeafNodeTBS, leafNodeEncoder, encodeLeafNode, decodeLeafNode, decodeLeafNodeKeyPackage, decodeLeafNodeCommit, decodeLeafNodeUpdate, init_leafNode, keyPackageTBSEncoder, encodeKeyPackageTBS, decodeKeyPackageTBS, keyPackageEncoder, encodeKeyPackage, decodeKeyPackage, init_keyPackage, init_kdf, pskTypes, pskTypeEncoder, encodePskType, decodePskType, resumptionPSKUsages, resumptionPSKUsageEncoder, encodeResumptionPSKUsage, decodeResumptionPSKUsage, encodePskInfoExternal, encodePskInfoResumption, decodePskInfoResumption, pskInfoEncoder, encodePskInfo, decodePskInfo, pskIdEncoder, encodePskId, decodePskId, pskLabelEncoder, encodePskLabel, decodePskLabel, init_presharedkey, addEncoder, encodeAdd, decodeAdd, updateEncoder, encodeUpdate, decodeUpdate, removeEncoder, encodeRemove, decodeRemove, pskEncoder, encodePSK, decodePSK, reinitEncoder, encodeReinit, decodeReinit, externalInitEncoder, encodeExternalInit, decodeExternalInit, groupContextExtensionsEncoder, encodeGroupContextExtensions, decodeGroupContextExtensions, proposalAddEncoder, encodeProposalAdd, proposalUpdateEncoder, encodeProposalUpdate, proposalRemoveEncoder, encodeProposalRemove, proposalPSKEncoder, encodeProposalPSK, proposalReinitEncoder, encodeProposalReinit, proposalExternalInitEncoder, encodeProposalExternalInit, proposalGroupContextExtensionsEncoder, encodeProposalGroupContextExtensions, proposalCustomEncoder, encodeProposalCustom, proposalEncoder, encodeProposal, decodeProposalAdd, decodeProposalUpdate, decodeProposalRemove, decodeProposalPSK, decodeProposalReinit, decodeProposalExternalInit, decodeProposalGroupContextExtensions, decodeProposal, init_proposal, proposalOrRefTypes, proposalOrRefTypeEncoder, encodeProposalOrRefType, decodeProposalOrRefType, proposalOrRefProposalEncoder, encodeProposalOrRefProposal, proposalOrRefProposalRefEncoder, encodeProposalOrRefProposalRef, proposalOrRefEncoder, encodeProposalOrRef, decodeProposalOrRef, init_proposalOrRefType, init_hpke, groupContextEncoder, encodeGroupContext, decodeGroupContext, init_groupContext, nodeTypes, nodeTypeEncoder, encodeNodeType, decodeNodeType, init_nodeType, parentNodeEncoder, encodeParentNode, decodeParentNode, init_parentNode, init_treemath, nodeEncoder, encodeNode, decodeNode, ratchetTreeEncoder, encodeRatchetTree, decodeRatchetTree, init_ratchetTree, leafNodeHashInputEncoder, encodeLeafNodeHashInput, decodeLeafNodeHashInput, parentNodeHashInputEncoder, encodeParentNodeHashInput, decodeParentNodeHashInput, treeHashInputEncoder, encodeTreeHashInput, decodeTreeHashInput, init_treeHash, parentHashInputEncoder, encodeParentHashInput, decodeParentHashInput, init_parentHash, hpkeCiphertextEncoder, encodeHpkeCiphertext, decodeHpkeCiphertext, init_hpkeCiphertext, updatePathNodeEncoder, encodeUpdatePathNode, decodeUpdatePathNode, updatePathEncoder, encodeUpdatePath, decodeUpdatePath, init_updatePath, commitEncoder, encodeCommit, decodeCommit, init_commit, contentTypes, contentTypeEncoder, encodeContentType, decodeContentType, init_contentType, wireformats, wireformatEncoder, encodeWireformat, decodeWireformat, init_wireformat, senderTypes, senderTypeEncoder, encodeSenderType, decodeSenderType, senderEncoder, encodeSender, decodeSender, reuseGuardEncoder, encodeReuseGuard, decodeReuseGuard, senderDataEncoder, encodeSenderData, decodeSenderData, senderDataAADEncoder, encodeSenderDataAAD, decodeSenderDataAAD, init_sender, framedContentApplicationDataEncoder, encodeFramedContentApplicationData, framedContentProposalDataEncoder, encodeFramedContentProposalData, framedContentCommitDataEncoder, encodeFramedContentCommitData, framedContentInfoEncoder, encodeFramedContentInfo, decodeFramedContentApplicationData, decodeFramedContentProposalData, decodeFramedContentCommitData, decodeFramedContentInfo, framedContentEncoder, encodeFramedContent, decodeFramedContent, senderInfoEncoder, encodeSenderInfo, framedContentTBSEncoder, encodeFramedContentTBS, encodeFramedContentAuthDataContent, encodeFramedContentAuthDataCommit, framedContentAuthDataEncoder, encodeFramedContentAuthData, decodeFramedContentAuthDataCommit, init_framedContent, authenticatedContentEncoder, encodeAuthenticatedContent, decodeAuthenticatedContent, authenticatedContentTBMEncoder, encodeAuthenticatedContentTBM, init_authenticatedContent, publicMessageInfoEncoder, encodePublicMessageInfo, publicMessageEncoder, encodePublicMessage, decodePublicMessage, init_publicMessage, init_messageProtectionPublic, init_externalProposal, requiredCapabilitiesEncoder, encodeRequiredCapabilities, decodeRequiredCapabilities, init_requiredCapabilities, defaultAuthenticationService, init_authenticationService, defaultPaddingConfig, init_paddingConfig, defaultKeyPackageEqualityConfig, init_keyPackageEqualityConfig, defaultLifetimeConfig, init_lifetimeConfig, defaultKeyRetentionConfig, init_keyRetentionConfig, groupInfoTBSEncoder, encodeGroupInfoTBS, decodeGroupInfoTBS, groupInfoEncoder, encodeGroupInfo, decodeGroupInfo, init_groupInfo, keyScheduleEncoder, encodeKeySchedule, decodeKeySchedule, init_keySchedule, generationSecretEncoder, decodeGenerationSecret, secretTreeNodeEncoder, decodeSecretTreeNode, secretTreeEncoder, decodeSecretTree, init_secretTree, confirmedTranscriptHashInputEncoder, encodeConfirmedTranscriptHashInput, decodeConfirmedTranscriptHashInput, init_transcriptHash, groupSecretsEncoder, encodeGroupSecrets, decodeGroupSecrets, init_groupSecrets, encryptedGroupSecretsEncoder, encodeEncryptedGroupSecrets, decodeEncryptedGroupSecrets, welcomeEncoder, encodeWelcome, decodeWelcome, init_welcome, init_pathSecrets, privateKeyPathEncoder, decodePrivateKeyPath, init_privateKeyPath, proposalWithSenderEncoder, decodeProposalWithSender, unappliedProposalsEncoder, decodeUnappliedProposals, init_unappliedProposals, emptyPskIndex, init_pskIndex, init_addToMap, defaultClientConfig, init_clientConfig, init_array, stringEncoder, encodeString, decodeString, init_string, activeEncoder, suspendedPendingReinitEncoder, removedFromGroupEncoder, groupActiveStateEncoder, decodeGroupActiveState, init_groupActiveState, epochReceiverDataEncoder, decodeEpochReceiverData, init_epochReceiverData, groupStateEncoder, encodeGroupState, decodeGroupState, groupStateEncoderWithoutTree, encodeGroupStateWithoutTree, emptyProposals, init_clientState, privateMessageEncoder, encodePrivateMessage, decodePrivateMessage, privateContentAADEncoder, encodePrivateContentAAD, decodePrivateContentAAD, init_privateMessage, init_messageProtection, init_createMessage, init_createCommit, init_processMessages, init_makeHashImpl, HpkeError, InvalidParamError, SerializeError, DeserializeError, EncapError, DecapError, ExportError, SealError, OpenError, MessageLimitReachedError, DeriveKeyPairError, NotSupportedError, init_errors, dntGlobals, dntGlobalThis, init_dnt_shims, NativeAlgorithm, init_algorithm, Mode, KemId, KdfId, AeadId, init_identifiers, INPUT_LENGTH_LIMIT, INFO_LENGTH_LIMIT, MINIMUM_PSK_LENGTH, EMPTY, BYTE_TO_BIGINT_256, init_consts, SUITE_ID_HEADER_KEM, init_kemInterface, HPKE_VERSION, HkdfNative, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, init_hkdf, isCryptoKeyPair, init_misc, LABEL_EAE_PRK, LABEL_SHARED_SECRET, Dhkem, init_dhkem, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, init_dhkemPrimitives, Bignum, init_bignum, LABEL_CANDIDATE, ORDER_P_256, ORDER_P_384, ORDER_P_521, PKCS8_ALG_ID_P_256, PKCS8_ALG_ID_P_384, PKCS8_ALG_ID_P_521, EC_P_256_PARAMS, EC_P_384_PARAMS, EC_P_521_PARAMS, Ec, init_ec, init_xCryptoKey, init_xCurve, init_hybridkem, AEAD_USAGES, init_aeadEncryptionContext, _endianTestBuffer, _endianTestBytes, isLE, init_noble, init_hash2, _HMAC, hmac, init_hmac, init_md, U32_MASK64, _32n, init_u64, init_sha2, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, init_sha3, init_modular, init_curve, init_montgomery, init_mod, AesGcmContext, Aes128Gcm, Aes256Gcm, init_aesGcm, init_exportOnly, init_emitNotSupported, LABEL_SEC, ExporterContextImpl, RecipientExporterContextImpl, SenderExporterContextImpl, init_exporterContext, EncryptionContextImpl, init_encryptionContext, __classPrivateFieldGet, __classPrivateFieldSet, _Mutex_locked, Mutex, init_mutex, __classPrivateFieldGet2, __classPrivateFieldSet2, _RecipientContextImpl_mutex, RecipientContextImpl, init_recipientContext, __classPrivateFieldGet3, __classPrivateFieldSet3, _SenderContextImpl_mutex, SenderContextImpl, init_senderContext, LABEL_BASE_NONCE, LABEL_EXP, LABEL_INFO_HASH, LABEL_KEY, LABEL_PSK_ID_HASH, LABEL_SECRET, SUITE_ID_HEADER_HPKE, CipherSuiteNative, init_cipherSuiteNative, DhkemP256HkdfSha256Native, DhkemP384HkdfSha384Native, DhkemP521HkdfSha512Native, init_dhkemNative, CipherSuite, DhkemP256HkdfSha256, DhkemP384HkdfSha384, DhkemP521HkdfSha512, HkdfSha256, HkdfSha384, HkdfSha512, init_native, ALG_NAME, PKCS8_ALG_ID_X25519, BASE_POINT_X25519, X25519, init_x25519, DhkemX25519HkdfSha256, init_dhkemX25519, PKCS8_ALG_ID_X448, init_x448, init_dhkemX448, init_mod2, init_hpke2, isLE2, wrapCipher, init_utils, encodeStr, sigma16, sigma32, sigma16_32, sigma32_32, BLOCK_LEN, BLOCK_LEN32, MAX_COUNTER, U32_EMPTY, _XorStreamPRG, createPRG, init_arx, Poly1305, poly1305, init_poly1305, chacha_exports, chacha20orig, chacha20, xchacha20, chacha8, chacha12, ZEROS16, updatePadded, ZEROS32, _poly1305_aead, chacha20poly1305, xchacha20poly1305, rngChacha20, rngChacha8, init_chacha, init_makeAead, init_makeKdfImpl, init_makeDhKem, init_makeHpke, defaultRng, init_rng, crypto2, init_cryptoNode, isLE3, swap32IfBE2, hasHexBuiltin, hexes, asciis, Hash, init_utils2, HashMD2, SHA256_IV2, SHA384_IV2, SHA512_IV2, init_md2, U32_MASK642, _32n2, shrSH2, shrSL2, rotrSH2, rotrSL2, rotrBH2, rotrBL2, rotlSH2, rotlSL2, rotlBH2, rotlBL2, add3L2, add3H2, add4L2, add4H2, add5L2, add5H2, init_u642, SHA256_K, SHA256_W, SHA256, K512, SHA512_Kh, SHA512_Kl, SHA512_W_H, SHA512_W_L, SHA512, SHA384, sha2563, sha5122, sha3842, init_sha22, _0n2, _1n2, isPosBig, bitMask, notImplemented, init_utils3, _0n3, _1n3, _2n2, _3n, _4n, _5n, _7n2, _8n, _9n, _16n, isNegativeLE, FIELD_FIELDS, init_modular2, _0n4, _1n4, pointPrecomputes, pointWindowSizes, wNAF, init_curve2, _0n5, _1n5, _2n3, _8n2, PrimeEdwardsPoint, init_edwards, os2ip, _DST_scalar, init_hash_to_curve, _0n6, _1n6, _2n4, init_montgomery2, ed25519_exports, _0n7, _1n7, _2n5, _3n2, _5n2, _8n3, ed25519_CURVE_p, ed25519_CURVE, ED25519_SQRT_M1, Fp, Fn, ed25519Defaults, ed25519, ed25519ctx, ed25519ph, x25519, ELL2_C1, ELL2_C2, ELL2_C3, ELL2_C1_EDWARDS, ed25519_hasher, SQRT_M1, SQRT_AD_MINUS_ONE, INVSQRT_A_MINUS_D, ONE_MINUS_D_SQ, D_MINUS_ONE_SQ, invertSqrt, MAX_255B, bytes255ToNumberLE, _RistrettoPoint, ristretto255, ristretto255_hasher, ED25519_TORSION_SUBGROUP, edwardsToMontgomery, RistrettoPoint, hashToCurve, encodeToCurve, hashToRistretto255, hash_to_ristretto255, init_ed25519, _0n8, _1n8, _2n6, _7n3, _256n2, _0x71n2, SHA3_PI2, SHA3_ROTL2, _SHA3_IOTA2, IOTAS2, SHA3_IOTA_H2, SHA3_IOTA_L2, rotlH, rotlL, Keccak, genShake, shake2562, init_sha32, ed448_exports, ed448_CURVE, E448_CURVE, shake256_114, shake256_64, _1n9, _2n7, _3n3, _4n2, _11n, _22n, _44n, _88n, _223n, Fp2, Fn2, Fp448, Fn448, ED448_DEF, ed448, ed448ph, E448, x448, ELL2_C12, ELL2_J, ed448_hasher, ONE_MINUS_D, ONE_MINUS_TWO_D, SQRT_MINUS_D, INVSQRT_MINUS_D, invertSqrt2, _DecafPoint, decaf448, decaf448_hasher, ED448_TORSION_SUBGROUP, DecafPoint, hashToCurve2, encodeToCurve2, hashToDecaf448, hash_to_decaf448, edwardsToMontgomery2, init_ed448, HMAC, hmac2, init_hmac2, divNearest, DERErr, DER, _0n9, _1n10, _2n8, _3n4, _4n3, init_weierstrass, init_shortw_utils, nist_exports, p256_CURVE, p384_CURVE, p521_CURVE, Fp256, Fp384, Fp521, p256, p256_hasher, p384, p384_hasher, p521, secp256r1, secp384r1, secp521r1, p521_hasher, init_nist, init_makeNobleSignatureImpl, defaultCryptoProvider, init_provider, init_getCiphersuiteImpl, init_resumption, oidNist2, init_utils4, HashMD3, SHA256_IV3, SHA384_IV3, SHA512_IV3, init_md3, U32_MASK643, _32n3, shrSH3, shrSL3, rotrSH3, rotrSL3, rotrBH3, rotrBL3, add3L3, add3H3, add4L3, add4H3, add5L3, add5H3, init_u643, SHA256_K2, SHA256_W2, SHA2_32B, _SHA256, K5122, SHA512_Kh2, SHA512_Kl2, SHA512_W_H2, SHA512_W_L2, SHA2_64B, _SHA512, _SHA384, sha2564, sha5123, sha3843, init_sha23, _HMAC2, hmac3, init_hmac3, init_makeHashImpl2, init_makeNobleSignatureImpl2, BLOCK_SIZE, ZEROS162, ZEROS322, POLY, mul2, swapLE, estimateWindow, GHASH, Polyval, ghash, polyval, init_polyval, BLOCK_SIZE2, BLOCK_SIZE32, EMPTY_BLOCK, POLY2, sbox, rotr32_8, rotl32_8, tableEncoding, xPowers, gcm, _CMAC, cmac, init_aes, init_makeAead2, init_makeKdfImpl2, init_makeDhKem2, init_makeHpke2, init_rng2, nobleCryptoProvider, init_provider2, mlsPublicMessageEncoder, encodeMlsPublicMessage, mlsWelcomeEncoder, encodeMlsWelcome, mlsPrivateMessageEncoder, encodeMlsPrivateMessage, mlsGroupInfoEncoder, encodeMlsGroupInfo, mlsKeyPackageEncoder, encodeMlsKeyPackage, mlsMessageContentEncoder, encodeMlsMessageContent, decodeMlsMessageContent, mlsMessageEncoder, encodeMlsMessage, decodeMlsMessage, init_message, greaseValues, defaultGreaseConfig, init_grease, init_defaultCapabilities, init_src, DEFAULT_CIPHERSUITE, MLSGroupManager, init_mls_group, DOMAIN, NONCE_BYTES2, init_owner_sync, init_mls_delivery_order, dist_exports2, init_dist2, DIR_MODE, FILE_MODE, init_secure_file, SYNC_LOCK_STALE_MS, pendingKpPath, init_mls_state, init_mls_kp_pool, PACKAGE, FALLBACK, MAX_LEN, DISALLOWED, init_client_version, CredentialStore, init_credential_store, init_crypto_helpers, STATE_FILE, LEGACY_STATE_FILE, init_state, init_transport2, A2ALogGate, init_a2a_log_gate, init_mls_membership_probe, openclaw_compat_exports, defaultImporter, HEARTBEAT_CANDIDATES, AGENT_EVENT_CANDIDATES, TRANSCRIPT_CANDIDATES, _heartbeatFn, _agentEventFn, _transcriptFn, init_openclaw_compat, http_handlers_exports, init_http_handlers, mcp_proxy_helpers_exports, init_mcp_proxy_helpers, workspace_handlers_exports, MAX_FILE_SIZE, init_workspace_handlers, ROOM_AGENT_TYPES, CREDENTIAL_MESSAGE_TYPES, CATCHUP_MESSAGE_TYPES, POLL_INTERVAL_MS, RECONNECT_BASE_MS, RECONNECT_MAX_MS, PENDING_POLL_INTERVAL_MS, OUTBOUND_DEDUPE_WINDOW_MS, OUTBOUND_DEDUPE_MAX_SUPPRESS_MS, OUTBOUND_DEDUPE_MAX, OUTBOUND_DEDUPE_TYPES, RETRY_CANDIDATE_TTL_MS, RETRY_CANDIDATE_MAX, SecureChannel, init_channel, init_types, DEFAULT_API_URL, DEFAULT_HTTP_PORT, init_account_config, init_lifecycle, _ocRuntime, _channels, agentVaultPlugin, init_openclaw_plugin, init_gateway_send, init_llm_response_parser, init_llm_cost, traceStore, init_fetch_interceptor, init_tool_audit, init_harness_compat, isUsingManagedRoutes, init_openclaw_entry, util, objectUtil, ZodParsedType, getParsedType, init_util, ZodIssueCode, ZodError, init_ZodError, errorMap, en_default, init_en, overrideErrorMap, init_errors2, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, init_parseUtil, init_typeAliases, errorUtil, init_errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, init_types2, init_external, init_v3, NEVER, $ZodAsyncError, $ZodEncodeError, globalConfig, init_core, util_exports, EVALUATING, captureStackTrace, allowsEval, getParsedType2, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES, Class, init_util2, initializer, $ZodError, $ZodRealError, init_errors3, _parse, parse, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync, init_parse, regexes_exports, cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url, hostname, domain, e164, dateSource, date, string, bigint, integer, number, boolean, _null, _undefined, lowercase, uppercase, hex, md5_hex, md5_base64, md5_base64url, sha1_hex, sha1_base64, sha1_base64url, sha256_hex, sha256_base64, sha256_base64url, sha384_hex, sha384_base64, sha384_base64url, sha512_hex, sha512_base64, sha512_base64url, init_regexes, $ZodCheck, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckBigIntFormat, $ZodCheckMaxSize, $ZodCheckMinSize, $ZodCheckSizeEquals, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckProperty, $ZodCheckMimeType, $ZodCheckOverwrite, init_checks, Doc, init_doc, version, init_versions, $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodMAC, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodCustomStringFormat, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodBigIntFormat, $ZodSymbol, $ZodUndefined, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodVoid, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodXor, $ZodDiscriminatedUnion, $ZodIntersection, $ZodTuple, $ZodRecord, $ZodMap, $ZodSet, $ZodEnum, $ZodLiteral, $ZodFile, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodSuccess, $ZodCatch, $ZodNaN, $ZodPipe, $ZodCodec, $ZodReadonly, $ZodTemplateLiteral, $ZodFunction, $ZodPromise, $ZodLazy, $ZodCustom, init_schemas, init_ar, init_az, init_be, init_bg, init_ca, init_cs, init_da, init_de, error, init_en2, init_eo, init_es, init_fa, init_fi, init_fr, init_fr_CA, init_he, init_hu, init_hy, init_id, init_is, init_it, init_ja, init_ka, init_km, init_kh, init_ko, init_lt, init_mk, init_ms, init_nl, init_no, init_ota, init_ps, init_pl, init_pt, init_ru, init_sl, init_sv, init_ta, init_th, init_tr, init_uk, init_ua, init_ur, init_uz, init_vi, init_zh_CN, init_zh_TW, init_yo, init_locales, _a2, $ZodRegistry, globalRegistry, init_registries, init_api, createToJSONSchemaMethod, createStandardJSONSchemaMethod, init_to_json_schema, formatMap, stringProcessor, numberProcessor, booleanProcessor, bigintProcessor, symbolProcessor, nullProcessor, undefinedProcessor, voidProcessor, neverProcessor, anyProcessor, unknownProcessor, dateProcessor, enumProcessor, literalProcessor, nanProcessor, templateLiteralProcessor, fileProcessor, successProcessor, customProcessor, functionProcessor, transformProcessor, mapProcessor, setProcessor, arrayProcessor, objectProcessor, unionProcessor, intersectionProcessor, tupleProcessor, recordProcessor, nullableProcessor, nonoptionalProcessor, defaultProcessor, prefaultProcessor, catchProcessor, pipeProcessor, readonlyProcessor, promiseProcessor, optionalProcessor, lazyProcessor, allProcessors, init_json_schema_processors, init_json_schema_generator, init_json_schema, init_core2, init_parse2, ZodMiniType, ZodMiniObject, init_schemas2, init_checks2, init_iso, init_coerce, init_external2, init_v4_mini, init_zod_compat, checks_exports2, init_checks3, iso_exports2, ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration, init_iso2, initializer2, ZodError2, ZodRealError, init_errors4, parse2, parseAsync2, safeParse3, safeParseAsync3, encode3, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2, init_parse3, schemas_exports3, ZodType2, _ZodString, ZodString2, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodMAC, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodCustomStringFormat, ZodNumber2, ZodNumberFormat, ZodBoolean2, ZodBigInt2, ZodBigIntFormat, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodDate2, ZodArray2, ZodObject2, ZodUnion2, ZodXor, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodEnum2, ZodLiteral2, ZodFile, ZodTransform, ZodOptional2, ZodExactOptional, ZodNullable2, ZodDefault2, ZodPrefault, ZodNonOptional, ZodSuccess, ZodCatch2, ZodNaN2, ZodPipe, ZodCodec, ZodReadonly2, ZodTemplateLiteral, ZodLazy2, ZodPromise2, ZodFunction2, ZodCustom, describe2, meta2, stringbool, init_schemas3, ZodFirstPartyTypeKind2, init_compat, z2, init_from_json_schema, init_coerce2, init_external3, init_classic, init_v4, LATEST_PROTOCOL_VERSION, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, RELATED_TASK_META_KEY, JSONRPC_VERSION, AssertObjectSchema, ProgressTokenSchema, CursorSchema, TaskCreationParamsSchema, TaskMetadataSchema, RelatedTaskMetadataSchema, RequestMetaSchema, BaseRequestParamsSchema, TaskAugmentedRequestParamsSchema, isTaskAugmentedRequestParams, RequestSchema, NotificationsParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, isJSONRPCRequest, JSONRPCNotificationSchema, isJSONRPCNotification, JSONRPCResultResponseSchema, isJSONRPCResultResponse, ErrorCode, JSONRPCErrorResponseSchema, isJSONRPCErrorResponse, JSONRPCMessageSchema, JSONRPCResponseSchema, EmptyResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, IconSchema, IconsSchema, BaseMetadataSchema, ImplementationSchema, FormElicitationCapabilitySchema, ElicitationCapabilitySchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema, ClientCapabilitiesSchema, InitializeRequestParamsSchema, InitializeRequestSchema, isInitializeRequest, ServerCapabilitiesSchema, InitializeResultSchema, InitializedNotificationSchema, PingRequestSchema, ProgressSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, TaskStatusSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ResourceContentsSchema, TextResourceContentsSchema, Base64Schema, BlobResourceContentsSchema, RoleSchema, AnnotationsSchema, ResourceSchema, ResourceTemplateSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ResourceRequestParamsSchema, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, ListPromptsResultSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, TextContentSchema, ImageContentSchema, AudioContentSchema, ToolUseContentSchema, EmbeddedResourceSchema, ResourceLinkSchema, ContentBlockSchema, PromptMessageSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ToolAnnotationsSchema, ToolExecutionSchema, ToolSchema, ListToolsRequestSchema, ListToolsResultSchema, CallToolResultSchema, CompatibilityCallToolResultSchema, CallToolRequestParamsSchema, CallToolRequestSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, LoggingLevelSchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, ToolChoiceSchema, ToolResultContentSchema, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema, EnumSchemaSchema, PrimitiveSchemaDefinitionSchema, ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, ElicitResultSchema, ResourceTemplateReferenceSchema, PromptReferenceSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema, ClientRequestSchema, ClientNotificationSchema, ClientResultSchema, ServerRequestSchema, ServerNotificationSchema, ServerResultSchema, McpError, UrlElicitationRequiredError, init_types3, init_interfaces, ignoreOverride, defaultOptions, getDefaultOptions, init_Options, getRefs, init_Refs, init_errorMessages, getRelativePath, init_getRelativePath, init_any, init_array2, init_bigint, init_boolean, init_branded, parseCatchDef, init_catch, integerDateParser, init_date, init_default, init_effects, init_enum, isJsonSchema7AllOfType, init_intersection, init_literal, emojiRegex2, zodPatterns, ALPHA_NUMERIC, init_string2, init_record, init_map, init_nativeEnum, init_never, init_null, primitiveMappings, asAnyOf, init_union, init_nullable, init_number2, init_object, parseOptionalDef, init_optional2, parsePipelineDef, init_pipeline, init_promise, init_set, init_tuple, init_undefined, init_unknown, parseReadonlyDef, init_readonly, selectParser, init_selectParser, get$ref, addMeta, init_parseDef, init_parseTypes, zodToJsonSchema, init_zodToJsonSchema, init_esm, init_zod_json_schema_compat, DEFAULT_REQUEST_TIMEOUT_MSEC, Protocol, init_protocol, require_code, require_scope, require_codegen, require_util, require_names, require_errors, require_boolSchema, require_rules, require_applicability, require_dataType, require_defaults, require_code2, require_keyword, require_subschema, require_fast_deep_equal, require_json_schema_traverse, require_resolve, require_validate, require_validation_error, require_ref_error, require_compile, require_data, require_utils, require_schemes, require_fast_uri, require_uri, require_core, require_id, require_ref, require_core2, require_limitNumber, require_multipleOf, require_ucs2length, require_limitLength, require_pattern, require_limitProperties, require_required, require_limitItems, require_equal, require_uniqueItems, require_const, require_enum, require_validation, require_additionalItems, require_items, require_prefixItems, require_items2020, require_contains, require_dependencies, require_propertyNames, require_additionalProperties, require_properties, require_patternProperties, require_not, require_anyOf, require_oneOf, require_allOf, require_if, require_thenElse, require_applicator, require_format, require_format2, require_metadata, require_draft7, require_types, require_discriminator, require_json_schema_draft_07, require_ajv, require_formats, require_limit, require_dist, import_ajv, import_ajv_formats, AjvJsonSchemaValidator, init_ajv_provider, ExperimentalServerTasks, init_server, init_helpers, Server, init_server2, COMPLETABLE_SYMBOL, McpZodTypeKind, init_completable, init_uriTemplate, TOOL_NAME_REGEX, init_toolNameValidation, ExperimentalMcpServerTasks, init_mcp_server, init_zod, McpServer, EMPTY_OBJECT_JSON_SCHEMA, EMPTY_COMPLETION_RESULT, init_mcp, RequestError, toRequestError, GlobalRequest, Request2, newHeadersFromIncoming, wrapBodyStream, newRequestFromIncoming, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders, X_ALREADY_SENT, outgoingEnded, handleRequestError, handleFetchError, handleResponseError, flushHeaders, responseViaCache, isPromise, responseViaResponseObject, getRequestListener, init_dist22, WebStandardStreamableHTTPServerTransport, init_webStandardStreamableHttp, StreamableHTTPServerTransport, init_streamableHttp, AgentVaultMcpServer, init_mcp_server2, init_mcp_handlers, init_skill_manifest, init_skill_invoker, spanBuffer, init_skill_telemetry, PolicyEnforcer, init_policy_enforcer, VERSION, init_index;
17440
+ var __create, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf, __hasOwnProp, __esm2, __commonJS, __export2, __copyProps, __toESM, init_mls_commit_classify, __filename, __dirname, url2, path, Module, Module, root, window_, crypto_, randomValuesStandard, crypto4, randomValueNodeJS, _Module, libsodium_sumo_default, init_libsodium_sumo, a, r, t, c, libsodium_wrappers_default, init_libsodium_wrappers, init_keys, init_x3dh, MAX_SKIP, CHAIN_KEY_SEED, MSG_KEY_SEED, HEADER_KEY_SEED, DoubleRatchet, init_ratchet, init_file_crypto, DOMAIN_DID_DOCUMENT, DOMAIN_TRANSFER_INTENT, DOMAIN_TRANSFER_ACCEPT, BASE58_ALPHABET, init_did, BUILTIN_PATTERNS, ScanEngine, init_scan_engine, init_merkle, VC_CONTEXT_V2, AV_CREDENTIAL_CONTEXT, CRYPTOSUITE, BASE58_ALPHABET2, init_vc, init_transport, init_telemetry, TelemetryReporter, init_telemetry_reporter, CROCKFORD, ARGON2_OPSLIMIT, ARGON2_MEMLIMIT, SALT_BYTES, NONCE_BYTES, KEY_BYTES, BACKUP_VERSION, MAX_BACKUP_SIZE, init_backup, init_approval, encVoid, init_tlsEncoder, uint8Encoder, encodeUint8, decodeUint8, uint16Encoder, encodeUint16, decodeUint16, uint32Encoder, encodeUint32, decodeUint32, uint64Encoder, encodeUint64, decodeUint64, init_number, init_tlsDecoder, init_enumHelpers, defaultProposalTypes, defaultProposalTypeEncoder, encodeDefaultProposalType, decodeDefaultProposalType, init_defaultProposalType, defaultExtensionTypes, defaultExtensionTypeEncoder, encodeDefaultExtensionType, decodeDefaultExtensionType, init_defaultExtensionType, acceptAll, init_incomingMessageAction, MlsError, ValidationError, CodecError, UsageError, DependencyError, CryptoVerificationError, CryptoError, InternalError, init_mlsError, init_byteArray, varLenDataEncoder, decodeVarLenData, init_variableLength, init_constantTimeCompare, extensionTypeEncoder, encodeExtensionType, decodeExtensionType, extensionEncoder, encodeExtension, decodeExtension, init_extension, credentialTypes, credentialTypeEncoder, encodeCredentialType, decodeCredentialType, init_credentialType, credentialBasicEncoder, encodeCredentialBasic, credentialX509Encoder, encodeCredentialX509, credentialCustomEncoder, encodeCredentialCustom, credentialEncoder, encodeCredential, decodeCredentialBasic, decodeCredentialX509, decodeCredential, init_credential, externalSenderEncoder, encodeExternalSender, decodeExternalSender, init_externalSender, init_hash, init_optional, ciphersuites, ciphersuiteEncoder, encodeCiphersuite, decodeCiphersuite, ciphersuiteValues, init_ciphersuite, init_signature, protocolVersions, protocolVersionEncoder, encodeProtocolVersion, decodeProtocolVersion, init_protocolVersion, capabilitiesEncoder, encodeCapabilities, decodeCapabilities, init_capabilities, leafNodeSources, leafNodeSourceEncoder, encodeLeafNodeSource, decodeLeafNodeSource, init_leafNodeSource, lifetimeEncoder, encodeLifetime, decodeLifetime, defaultLifetime, init_lifetime, leafNodeDataEncoder, encodeLeafNodeData, decodeLeafNodeData, leafNodeInfoKeyPackageEncoder, encodeLeafNodeInfoKeyPackage, leafNodeInfoUpdateOmittedEncoder, encodeLeafNodeInfoUpdateOmitted, leafNodeInfoCommitOmittedEncoder, encodeLeafNodeInfoCommitOmitted, leafNodeInfoOmittedEncoder, encodeLeafNodeInfoOmitted, decodeLeafNodeInfoKeyPackage, decodeLeafNodeInfoUpdateOmitted, decodeLeafNodeInfoCommitOmitted, decodeLeafNodeInfoOmitted, leafNodeInfoUpdateEncoder, encodeLeafNodeInfoUpdate, leafNodeInfoCommitEncoder, encodeLeafNodeInfoCommit, leafNodeInfoEncoder, encodeLeafNodeInfo, decodeLeafNodeInfoUpdate, decodeLeafNodeInfoCommit, decodeLeafNodeInfo, leafNodeTBSEncoder, encodeLeafNodeTBS, leafNodeEncoder, encodeLeafNode, decodeLeafNode, decodeLeafNodeKeyPackage, decodeLeafNodeCommit, decodeLeafNodeUpdate, init_leafNode, keyPackageTBSEncoder, encodeKeyPackageTBS, decodeKeyPackageTBS, keyPackageEncoder, encodeKeyPackage, decodeKeyPackage, init_keyPackage, init_kdf, pskTypes, pskTypeEncoder, encodePskType, decodePskType, resumptionPSKUsages, resumptionPSKUsageEncoder, encodeResumptionPSKUsage, decodeResumptionPSKUsage, encodePskInfoExternal, encodePskInfoResumption, decodePskInfoResumption, pskInfoEncoder, encodePskInfo, decodePskInfo, pskIdEncoder, encodePskId, decodePskId, pskLabelEncoder, encodePskLabel, decodePskLabel, init_presharedkey, addEncoder, encodeAdd, decodeAdd, updateEncoder, encodeUpdate, decodeUpdate, removeEncoder, encodeRemove, decodeRemove, pskEncoder, encodePSK, decodePSK, reinitEncoder, encodeReinit, decodeReinit, externalInitEncoder, encodeExternalInit, decodeExternalInit, groupContextExtensionsEncoder, encodeGroupContextExtensions, decodeGroupContextExtensions, proposalAddEncoder, encodeProposalAdd, proposalUpdateEncoder, encodeProposalUpdate, proposalRemoveEncoder, encodeProposalRemove, proposalPSKEncoder, encodeProposalPSK, proposalReinitEncoder, encodeProposalReinit, proposalExternalInitEncoder, encodeProposalExternalInit, proposalGroupContextExtensionsEncoder, encodeProposalGroupContextExtensions, proposalCustomEncoder, encodeProposalCustom, proposalEncoder, encodeProposal, decodeProposalAdd, decodeProposalUpdate, decodeProposalRemove, decodeProposalPSK, decodeProposalReinit, decodeProposalExternalInit, decodeProposalGroupContextExtensions, decodeProposal, init_proposal, proposalOrRefTypes, proposalOrRefTypeEncoder, encodeProposalOrRefType, decodeProposalOrRefType, proposalOrRefProposalEncoder, encodeProposalOrRefProposal, proposalOrRefProposalRefEncoder, encodeProposalOrRefProposalRef, proposalOrRefEncoder, encodeProposalOrRef, decodeProposalOrRef, init_proposalOrRefType, init_hpke, groupContextEncoder, encodeGroupContext, decodeGroupContext, init_groupContext, nodeTypes, nodeTypeEncoder, encodeNodeType, decodeNodeType, init_nodeType, parentNodeEncoder, encodeParentNode, decodeParentNode, init_parentNode, init_treemath, nodeEncoder, encodeNode, decodeNode, ratchetTreeEncoder, encodeRatchetTree, decodeRatchetTree, init_ratchetTree, leafNodeHashInputEncoder, encodeLeafNodeHashInput, decodeLeafNodeHashInput, parentNodeHashInputEncoder, encodeParentNodeHashInput, decodeParentNodeHashInput, treeHashInputEncoder, encodeTreeHashInput, decodeTreeHashInput, init_treeHash, parentHashInputEncoder, encodeParentHashInput, decodeParentHashInput, init_parentHash, hpkeCiphertextEncoder, encodeHpkeCiphertext, decodeHpkeCiphertext, init_hpkeCiphertext, updatePathNodeEncoder, encodeUpdatePathNode, decodeUpdatePathNode, updatePathEncoder, encodeUpdatePath, decodeUpdatePath, init_updatePath, commitEncoder, encodeCommit, decodeCommit, init_commit, contentTypes, contentTypeEncoder, encodeContentType, decodeContentType, init_contentType, wireformats, wireformatEncoder, encodeWireformat, decodeWireformat, init_wireformat, senderTypes, senderTypeEncoder, encodeSenderType, decodeSenderType, senderEncoder, encodeSender, decodeSender, reuseGuardEncoder, encodeReuseGuard, decodeReuseGuard, senderDataEncoder, encodeSenderData, decodeSenderData, senderDataAADEncoder, encodeSenderDataAAD, decodeSenderDataAAD, init_sender, framedContentApplicationDataEncoder, encodeFramedContentApplicationData, framedContentProposalDataEncoder, encodeFramedContentProposalData, framedContentCommitDataEncoder, encodeFramedContentCommitData, framedContentInfoEncoder, encodeFramedContentInfo, decodeFramedContentApplicationData, decodeFramedContentProposalData, decodeFramedContentCommitData, decodeFramedContentInfo, framedContentEncoder, encodeFramedContent, decodeFramedContent, senderInfoEncoder, encodeSenderInfo, framedContentTBSEncoder, encodeFramedContentTBS, encodeFramedContentAuthDataContent, encodeFramedContentAuthDataCommit, framedContentAuthDataEncoder, encodeFramedContentAuthData, decodeFramedContentAuthDataCommit, init_framedContent, authenticatedContentEncoder, encodeAuthenticatedContent, decodeAuthenticatedContent, authenticatedContentTBMEncoder, encodeAuthenticatedContentTBM, init_authenticatedContent, publicMessageInfoEncoder, encodePublicMessageInfo, publicMessageEncoder, encodePublicMessage, decodePublicMessage, init_publicMessage, init_messageProtectionPublic, init_externalProposal, requiredCapabilitiesEncoder, encodeRequiredCapabilities, decodeRequiredCapabilities, init_requiredCapabilities, defaultAuthenticationService, init_authenticationService, defaultPaddingConfig, init_paddingConfig, defaultKeyPackageEqualityConfig, init_keyPackageEqualityConfig, defaultLifetimeConfig, init_lifetimeConfig, defaultKeyRetentionConfig, init_keyRetentionConfig, groupInfoTBSEncoder, encodeGroupInfoTBS, decodeGroupInfoTBS, groupInfoEncoder, encodeGroupInfo, decodeGroupInfo, init_groupInfo, keyScheduleEncoder, encodeKeySchedule, decodeKeySchedule, init_keySchedule, generationSecretEncoder, decodeGenerationSecret, secretTreeNodeEncoder, decodeSecretTreeNode, secretTreeEncoder, decodeSecretTree, init_secretTree, confirmedTranscriptHashInputEncoder, encodeConfirmedTranscriptHashInput, decodeConfirmedTranscriptHashInput, init_transcriptHash, groupSecretsEncoder, encodeGroupSecrets, decodeGroupSecrets, init_groupSecrets, encryptedGroupSecretsEncoder, encodeEncryptedGroupSecrets, decodeEncryptedGroupSecrets, welcomeEncoder, encodeWelcome, decodeWelcome, init_welcome, init_pathSecrets, privateKeyPathEncoder, decodePrivateKeyPath, init_privateKeyPath, proposalWithSenderEncoder, decodeProposalWithSender, unappliedProposalsEncoder, decodeUnappliedProposals, init_unappliedProposals, emptyPskIndex, init_pskIndex, init_addToMap, defaultClientConfig, init_clientConfig, init_array, stringEncoder, encodeString, decodeString, init_string, activeEncoder, suspendedPendingReinitEncoder, removedFromGroupEncoder, groupActiveStateEncoder, decodeGroupActiveState, init_groupActiveState, epochReceiverDataEncoder, decodeEpochReceiverData, init_epochReceiverData, groupStateEncoder, encodeGroupState, decodeGroupState, groupStateEncoderWithoutTree, encodeGroupStateWithoutTree, emptyProposals, init_clientState, privateMessageEncoder, encodePrivateMessage, decodePrivateMessage, privateContentAADEncoder, encodePrivateContentAAD, decodePrivateContentAAD, init_privateMessage, init_messageProtection, init_createMessage, init_createCommit, init_processMessages, init_makeHashImpl, HpkeError, InvalidParamError, SerializeError, DeserializeError, EncapError, DecapError, ExportError, SealError, OpenError, MessageLimitReachedError, DeriveKeyPairError, NotSupportedError, init_errors, dntGlobals, dntGlobalThis, init_dnt_shims, NativeAlgorithm, init_algorithm, Mode, KemId, KdfId, AeadId, init_identifiers, INPUT_LENGTH_LIMIT, INFO_LENGTH_LIMIT, MINIMUM_PSK_LENGTH, EMPTY, BYTE_TO_BIGINT_256, init_consts, SUITE_ID_HEADER_KEM, init_kemInterface, HPKE_VERSION, HkdfNative, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, init_hkdf, isCryptoKeyPair, init_misc, LABEL_EAE_PRK, LABEL_SHARED_SECRET, Dhkem, init_dhkem, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, init_dhkemPrimitives, Bignum, init_bignum, LABEL_CANDIDATE, ORDER_P_256, ORDER_P_384, ORDER_P_521, PKCS8_ALG_ID_P_256, PKCS8_ALG_ID_P_384, PKCS8_ALG_ID_P_521, EC_P_256_PARAMS, EC_P_384_PARAMS, EC_P_521_PARAMS, Ec, init_ec, init_xCryptoKey, init_xCurve, init_hybridkem, AEAD_USAGES, init_aeadEncryptionContext, _endianTestBuffer, _endianTestBytes, isLE, init_noble, init_hash2, _HMAC, hmac, init_hmac, init_md, U32_MASK64, _32n, init_u64, init_sha2, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, init_sha3, init_modular, init_curve, init_montgomery, init_mod, AesGcmContext, Aes128Gcm, Aes256Gcm, init_aesGcm, init_exportOnly, init_emitNotSupported, LABEL_SEC, ExporterContextImpl, RecipientExporterContextImpl, SenderExporterContextImpl, init_exporterContext, EncryptionContextImpl, init_encryptionContext, __classPrivateFieldGet, __classPrivateFieldSet, _Mutex_locked, Mutex, init_mutex, __classPrivateFieldGet2, __classPrivateFieldSet2, _RecipientContextImpl_mutex, RecipientContextImpl, init_recipientContext, __classPrivateFieldGet3, __classPrivateFieldSet3, _SenderContextImpl_mutex, SenderContextImpl, init_senderContext, LABEL_BASE_NONCE, LABEL_EXP, LABEL_INFO_HASH, LABEL_KEY, LABEL_PSK_ID_HASH, LABEL_SECRET, SUITE_ID_HEADER_HPKE, CipherSuiteNative, init_cipherSuiteNative, DhkemP256HkdfSha256Native, DhkemP384HkdfSha384Native, DhkemP521HkdfSha512Native, init_dhkemNative, CipherSuite, DhkemP256HkdfSha256, DhkemP384HkdfSha384, DhkemP521HkdfSha512, HkdfSha256, HkdfSha384, HkdfSha512, init_native, ALG_NAME, PKCS8_ALG_ID_X25519, BASE_POINT_X25519, X25519, init_x25519, DhkemX25519HkdfSha256, init_dhkemX25519, PKCS8_ALG_ID_X448, init_x448, init_dhkemX448, init_mod2, init_hpke2, isLE2, wrapCipher, init_utils, encodeStr, sigma16, sigma32, sigma16_32, sigma32_32, BLOCK_LEN, BLOCK_LEN32, MAX_COUNTER, U32_EMPTY, _XorStreamPRG, createPRG, init_arx, Poly1305, poly1305, init_poly1305, chacha_exports, chacha20orig, chacha20, xchacha20, chacha8, chacha12, ZEROS16, updatePadded, ZEROS32, _poly1305_aead, chacha20poly1305, xchacha20poly1305, rngChacha20, rngChacha8, init_chacha, init_makeAead, init_makeKdfImpl, init_makeDhKem, init_makeHpke, defaultRng, init_rng, crypto2, init_cryptoNode, isLE3, swap32IfBE2, hasHexBuiltin, hexes, asciis, Hash, init_utils2, HashMD2, SHA256_IV2, SHA384_IV2, SHA512_IV2, init_md2, U32_MASK642, _32n2, shrSH2, shrSL2, rotrSH2, rotrSL2, rotrBH2, rotrBL2, rotlSH2, rotlSL2, rotlBH2, rotlBL2, add3L2, add3H2, add4L2, add4H2, add5L2, add5H2, init_u642, SHA256_K, SHA256_W, SHA256, K512, SHA512_Kh, SHA512_Kl, SHA512_W_H, SHA512_W_L, SHA512, SHA384, sha2563, sha5122, sha3842, init_sha22, _0n2, _1n2, isPosBig, bitMask, notImplemented, init_utils3, _0n3, _1n3, _2n2, _3n, _4n, _5n, _7n2, _8n, _9n, _16n, isNegativeLE, FIELD_FIELDS, init_modular2, _0n4, _1n4, pointPrecomputes, pointWindowSizes, wNAF, init_curve2, _0n5, _1n5, _2n3, _8n2, PrimeEdwardsPoint, init_edwards, os2ip, _DST_scalar, init_hash_to_curve, _0n6, _1n6, _2n4, init_montgomery2, ed25519_exports, _0n7, _1n7, _2n5, _3n2, _5n2, _8n3, ed25519_CURVE_p, ed25519_CURVE, ED25519_SQRT_M1, Fp, Fn, ed25519Defaults, ed25519, ed25519ctx, ed25519ph, x25519, ELL2_C1, ELL2_C2, ELL2_C3, ELL2_C1_EDWARDS, ed25519_hasher, SQRT_M1, SQRT_AD_MINUS_ONE, INVSQRT_A_MINUS_D, ONE_MINUS_D_SQ, D_MINUS_ONE_SQ, invertSqrt, MAX_255B, bytes255ToNumberLE, _RistrettoPoint, ristretto255, ristretto255_hasher, ED25519_TORSION_SUBGROUP, edwardsToMontgomery, RistrettoPoint, hashToCurve, encodeToCurve, hashToRistretto255, hash_to_ristretto255, init_ed25519, _0n8, _1n8, _2n6, _7n3, _256n2, _0x71n2, SHA3_PI2, SHA3_ROTL2, _SHA3_IOTA2, IOTAS2, SHA3_IOTA_H2, SHA3_IOTA_L2, rotlH, rotlL, Keccak, genShake, shake2562, init_sha32, ed448_exports, ed448_CURVE, E448_CURVE, shake256_114, shake256_64, _1n9, _2n7, _3n3, _4n2, _11n, _22n, _44n, _88n, _223n, Fp2, Fn2, Fp448, Fn448, ED448_DEF, ed448, ed448ph, E448, x448, ELL2_C12, ELL2_J, ed448_hasher, ONE_MINUS_D, ONE_MINUS_TWO_D, SQRT_MINUS_D, INVSQRT_MINUS_D, invertSqrt2, _DecafPoint, decaf448, decaf448_hasher, ED448_TORSION_SUBGROUP, DecafPoint, hashToCurve2, encodeToCurve2, hashToDecaf448, hash_to_decaf448, edwardsToMontgomery2, init_ed448, HMAC, hmac2, init_hmac2, divNearest, DERErr, DER, _0n9, _1n10, _2n8, _3n4, _4n3, init_weierstrass, init_shortw_utils, nist_exports, p256_CURVE, p384_CURVE, p521_CURVE, Fp256, Fp384, Fp521, p256, p256_hasher, p384, p384_hasher, p521, secp256r1, secp384r1, secp521r1, p521_hasher, init_nist, init_makeNobleSignatureImpl, defaultCryptoProvider, init_provider, init_getCiphersuiteImpl, init_resumption, oidNist2, init_utils4, HashMD3, SHA256_IV3, SHA384_IV3, SHA512_IV3, init_md3, U32_MASK643, _32n3, shrSH3, shrSL3, rotrSH3, rotrSL3, rotrBH3, rotrBL3, add3L3, add3H3, add4L3, add4H3, add5L3, add5H3, init_u643, SHA256_K2, SHA256_W2, SHA2_32B, _SHA256, K5122, SHA512_Kh2, SHA512_Kl2, SHA512_W_H2, SHA512_W_L2, SHA2_64B, _SHA512, _SHA384, sha2564, sha5123, sha3843, init_sha23, _HMAC2, hmac3, init_hmac3, init_makeHashImpl2, init_makeNobleSignatureImpl2, BLOCK_SIZE, ZEROS162, ZEROS322, POLY, mul2, swapLE, estimateWindow, GHASH, Polyval, ghash, polyval, init_polyval, BLOCK_SIZE2, BLOCK_SIZE32, EMPTY_BLOCK, POLY2, sbox, rotr32_8, rotl32_8, tableEncoding, xPowers, gcm, _CMAC, cmac, init_aes, init_makeAead2, init_makeKdfImpl2, init_makeDhKem2, init_makeHpke2, init_rng2, nobleCryptoProvider, init_provider2, mlsPublicMessageEncoder, encodeMlsPublicMessage, mlsWelcomeEncoder, encodeMlsWelcome, mlsPrivateMessageEncoder, encodeMlsPrivateMessage, mlsGroupInfoEncoder, encodeMlsGroupInfo, mlsKeyPackageEncoder, encodeMlsKeyPackage, mlsMessageContentEncoder, encodeMlsMessageContent, decodeMlsMessageContent, mlsMessageEncoder, encodeMlsMessage, decodeMlsMessage, init_message, greaseValues, defaultGreaseConfig, init_grease, init_defaultCapabilities, init_src, DEFAULT_CIPHERSUITE, MLSGroupManager, init_mls_group, DOMAIN, NONCE_BYTES2, init_owner_sync, init_mls_delivery_order, init_mls_presend_epoch, dist_exports2, init_dist2, DIR_MODE, FILE_MODE, init_secure_file, SYNC_LOCK_STALE_MS, pendingKpPath, init_mls_state, init_mls_kp_pool, PACKAGE, FALLBACK, MAX_LEN, DISALLOWED, init_client_version, CredentialStore, init_credential_store, init_crypto_helpers, STATE_FILE, LEGACY_STATE_FILE, init_state, init_transport2, A2ALogGate, init_a2a_log_gate, init_mls_membership_probe, openclaw_compat_exports, defaultImporter, HEARTBEAT_CANDIDATES, AGENT_EVENT_CANDIDATES, TRANSCRIPT_CANDIDATES, _heartbeatFn, _agentEventFn, _transcriptFn, init_openclaw_compat, http_handlers_exports, init_http_handlers, mcp_proxy_helpers_exports, init_mcp_proxy_helpers, workspace_handlers_exports, MAX_FILE_SIZE, init_workspace_handlers, ROOM_AGENT_TYPES, CREDENTIAL_MESSAGE_TYPES, CATCHUP_MESSAGE_TYPES, POLL_INTERVAL_MS, RECONNECT_BASE_MS, RECONNECT_MAX_MS, PENDING_POLL_INTERVAL_MS, OUTBOUND_DEDUPE_WINDOW_MS, OUTBOUND_DEDUPE_MAX_SUPPRESS_MS, OUTBOUND_DEDUPE_MAX, OUTBOUND_DEDUPE_TYPES, RETRY_CANDIDATE_TTL_MS, RETRY_CANDIDATE_MAX, SecureChannel, init_channel, init_types, DEFAULT_API_URL, DEFAULT_HTTP_PORT, init_account_config, init_lifecycle, _ocRuntime, _channels, agentVaultPlugin, init_openclaw_plugin, init_gateway_send, init_llm_response_parser, init_llm_cost, traceStore, init_fetch_interceptor, init_tool_audit, init_harness_compat, isUsingManagedRoutes, init_openclaw_entry, util, objectUtil, ZodParsedType, getParsedType, init_util, ZodIssueCode, ZodError, init_ZodError, errorMap, en_default, init_en, overrideErrorMap, init_errors2, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, init_parseUtil, init_typeAliases, errorUtil, init_errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, init_types2, init_external, init_v3, NEVER, $ZodAsyncError, $ZodEncodeError, globalConfig, init_core, util_exports, EVALUATING, captureStackTrace, allowsEval, getParsedType2, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES, Class, init_util2, initializer, $ZodError, $ZodRealError, init_errors3, _parse, parse, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync, init_parse, regexes_exports, cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url, hostname, domain, e164, dateSource, date, string, bigint, integer, number, boolean, _null, _undefined, lowercase, uppercase, hex, md5_hex, md5_base64, md5_base64url, sha1_hex, sha1_base64, sha1_base64url, sha256_hex, sha256_base64, sha256_base64url, sha384_hex, sha384_base64, sha384_base64url, sha512_hex, sha512_base64, sha512_base64url, init_regexes, $ZodCheck, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckBigIntFormat, $ZodCheckMaxSize, $ZodCheckMinSize, $ZodCheckSizeEquals, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckProperty, $ZodCheckMimeType, $ZodCheckOverwrite, init_checks, Doc, init_doc, version, init_versions, $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodMAC, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodCustomStringFormat, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodBigIntFormat, $ZodSymbol, $ZodUndefined, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodVoid, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodXor, $ZodDiscriminatedUnion, $ZodIntersection, $ZodTuple, $ZodRecord, $ZodMap, $ZodSet, $ZodEnum, $ZodLiteral, $ZodFile, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodSuccess, $ZodCatch, $ZodNaN, $ZodPipe, $ZodCodec, $ZodReadonly, $ZodTemplateLiteral, $ZodFunction, $ZodPromise, $ZodLazy, $ZodCustom, init_schemas, init_ar, init_az, init_be, init_bg, init_ca, init_cs, init_da, init_de, error, init_en2, init_eo, init_es, init_fa, init_fi, init_fr, init_fr_CA, init_he, init_hu, init_hy, init_id, init_is, init_it, init_ja, init_ka, init_km, init_kh, init_ko, init_lt, init_mk, init_ms, init_nl, init_no, init_ota, init_ps, init_pl, init_pt, init_ru, init_sl, init_sv, init_ta, init_th, init_tr, init_uk, init_ua, init_ur, init_uz, init_vi, init_zh_CN, init_zh_TW, init_yo, init_locales, _a2, $ZodRegistry, globalRegistry, init_registries, init_api, createToJSONSchemaMethod, createStandardJSONSchemaMethod, init_to_json_schema, formatMap, stringProcessor, numberProcessor, booleanProcessor, bigintProcessor, symbolProcessor, nullProcessor, undefinedProcessor, voidProcessor, neverProcessor, anyProcessor, unknownProcessor, dateProcessor, enumProcessor, literalProcessor, nanProcessor, templateLiteralProcessor, fileProcessor, successProcessor, customProcessor, functionProcessor, transformProcessor, mapProcessor, setProcessor, arrayProcessor, objectProcessor, unionProcessor, intersectionProcessor, tupleProcessor, recordProcessor, nullableProcessor, nonoptionalProcessor, defaultProcessor, prefaultProcessor, catchProcessor, pipeProcessor, readonlyProcessor, promiseProcessor, optionalProcessor, lazyProcessor, allProcessors, init_json_schema_processors, init_json_schema_generator, init_json_schema, init_core2, init_parse2, ZodMiniType, ZodMiniObject, init_schemas2, init_checks2, init_iso, init_coerce, init_external2, init_v4_mini, init_zod_compat, checks_exports2, init_checks3, iso_exports2, ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration, init_iso2, initializer2, ZodError2, ZodRealError, init_errors4, parse2, parseAsync2, safeParse3, safeParseAsync3, encode3, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2, init_parse3, schemas_exports3, ZodType2, _ZodString, ZodString2, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodMAC, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodCustomStringFormat, ZodNumber2, ZodNumberFormat, ZodBoolean2, ZodBigInt2, ZodBigIntFormat, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodDate2, ZodArray2, ZodObject2, ZodUnion2, ZodXor, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodEnum2, ZodLiteral2, ZodFile, ZodTransform, ZodOptional2, ZodExactOptional, ZodNullable2, ZodDefault2, ZodPrefault, ZodNonOptional, ZodSuccess, ZodCatch2, ZodNaN2, ZodPipe, ZodCodec, ZodReadonly2, ZodTemplateLiteral, ZodLazy2, ZodPromise2, ZodFunction2, ZodCustom, describe2, meta2, stringbool, init_schemas3, ZodFirstPartyTypeKind2, init_compat, z2, init_from_json_schema, init_coerce2, init_external3, init_classic, init_v4, LATEST_PROTOCOL_VERSION, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, RELATED_TASK_META_KEY, JSONRPC_VERSION, AssertObjectSchema, ProgressTokenSchema, CursorSchema, TaskCreationParamsSchema, TaskMetadataSchema, RelatedTaskMetadataSchema, RequestMetaSchema, BaseRequestParamsSchema, TaskAugmentedRequestParamsSchema, isTaskAugmentedRequestParams, RequestSchema, NotificationsParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, isJSONRPCRequest, JSONRPCNotificationSchema, isJSONRPCNotification, JSONRPCResultResponseSchema, isJSONRPCResultResponse, ErrorCode, JSONRPCErrorResponseSchema, isJSONRPCErrorResponse, JSONRPCMessageSchema, JSONRPCResponseSchema, EmptyResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, IconSchema, IconsSchema, BaseMetadataSchema, ImplementationSchema, FormElicitationCapabilitySchema, ElicitationCapabilitySchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema, ClientCapabilitiesSchema, InitializeRequestParamsSchema, InitializeRequestSchema, isInitializeRequest, ServerCapabilitiesSchema, InitializeResultSchema, InitializedNotificationSchema, PingRequestSchema, ProgressSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, TaskStatusSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ResourceContentsSchema, TextResourceContentsSchema, Base64Schema, BlobResourceContentsSchema, RoleSchema, AnnotationsSchema, ResourceSchema, ResourceTemplateSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ResourceRequestParamsSchema, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, ListPromptsResultSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, TextContentSchema, ImageContentSchema, AudioContentSchema, ToolUseContentSchema, EmbeddedResourceSchema, ResourceLinkSchema, ContentBlockSchema, PromptMessageSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ToolAnnotationsSchema, ToolExecutionSchema, ToolSchema, ListToolsRequestSchema, ListToolsResultSchema, CallToolResultSchema, CompatibilityCallToolResultSchema, CallToolRequestParamsSchema, CallToolRequestSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, LoggingLevelSchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, ToolChoiceSchema, ToolResultContentSchema, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema, EnumSchemaSchema, PrimitiveSchemaDefinitionSchema, ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, ElicitResultSchema, ResourceTemplateReferenceSchema, PromptReferenceSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema, ClientRequestSchema, ClientNotificationSchema, ClientResultSchema, ServerRequestSchema, ServerNotificationSchema, ServerResultSchema, McpError, UrlElicitationRequiredError, init_types3, init_interfaces, ignoreOverride, defaultOptions, getDefaultOptions, init_Options, getRefs, init_Refs, init_errorMessages, getRelativePath, init_getRelativePath, init_any, init_array2, init_bigint, init_boolean, init_branded, parseCatchDef, init_catch, integerDateParser, init_date, init_default, init_effects, init_enum, isJsonSchema7AllOfType, init_intersection, init_literal, emojiRegex2, zodPatterns, ALPHA_NUMERIC, init_string2, init_record, init_map, init_nativeEnum, init_never, init_null, primitiveMappings, asAnyOf, init_union, init_nullable, init_number2, init_object, parseOptionalDef, init_optional2, parsePipelineDef, init_pipeline, init_promise, init_set, init_tuple, init_undefined, init_unknown, parseReadonlyDef, init_readonly, selectParser, init_selectParser, get$ref, addMeta, init_parseDef, init_parseTypes, zodToJsonSchema, init_zodToJsonSchema, init_esm, init_zod_json_schema_compat, DEFAULT_REQUEST_TIMEOUT_MSEC, Protocol, init_protocol, require_code, require_scope, require_codegen, require_util, require_names, require_errors, require_boolSchema, require_rules, require_applicability, require_dataType, require_defaults, require_code2, require_keyword, require_subschema, require_fast_deep_equal, require_json_schema_traverse, require_resolve, require_validate, require_validation_error, require_ref_error, require_compile, require_data, require_utils, require_schemes, require_fast_uri, require_uri, require_core, require_id, require_ref, require_core2, require_limitNumber, require_multipleOf, require_ucs2length, require_limitLength, require_pattern, require_limitProperties, require_required, require_limitItems, require_equal, require_uniqueItems, require_const, require_enum, require_validation, require_additionalItems, require_items, require_prefixItems, require_items2020, require_contains, require_dependencies, require_propertyNames, require_additionalProperties, require_properties, require_patternProperties, require_not, require_anyOf, require_oneOf, require_allOf, require_if, require_thenElse, require_applicator, require_format, require_format2, require_metadata, require_draft7, require_types, require_discriminator, require_json_schema_draft_07, require_ajv, require_formats, require_limit, require_dist, import_ajv, import_ajv_formats, AjvJsonSchemaValidator, init_ajv_provider, ExperimentalServerTasks, init_server, init_helpers, Server, init_server2, COMPLETABLE_SYMBOL, McpZodTypeKind, init_completable, init_uriTemplate, TOOL_NAME_REGEX, init_toolNameValidation, ExperimentalMcpServerTasks, init_mcp_server, init_zod, McpServer, EMPTY_OBJECT_JSON_SCHEMA, EMPTY_COMPLETION_RESULT, init_mcp, RequestError, toRequestError, GlobalRequest, Request2, newHeadersFromIncoming, wrapBodyStream, newRequestFromIncoming, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders, X_ALREADY_SENT, outgoingEnded, handleRequestError, handleFetchError, handleResponseError, flushHeaders, responseViaCache, isPromise, responseViaResponseObject, getRequestListener, init_dist22, WebStandardStreamableHTTPServerTransport, init_webStandardStreamableHttp, StreamableHTTPServerTransport, init_streamableHttp, AgentVaultMcpServer, init_mcp_server2, init_mcp_handlers, init_skill_manifest, init_skill_invoker, spanBuffer, init_skill_telemetry, PolicyEnforcer, init_policy_enforcer, VERSION, init_index;
17310
17441
  var init_dist = __esm({
17311
17442
  async "../../../../packages/plugin/dist/index.js"() {
17312
17443
  "use strict";
@@ -17546,7 +17677,7 @@ var init_dist = __esm({
17546
17677
  }, Module: function(binary) {
17547
17678
  }, Instance: function(module2, info) {
17548
17679
  this.exports = // EMSCRIPTEN_START_ASM
17549
- function instantiate(ea2) {
17680
+ (function instantiate(ea2) {
17550
17681
  var a2;
17551
17682
  var b2 = new Uint8Array(123);
17552
17683
  for (var c2 = 25; c2 >= 0; --c2) {
@@ -57341,7 +57472,7 @@ var init_dist = __esm({
57341
57472
  } } }), f: yi, g: ma2, h: Ba2, i: ma2, j: ka2, k: Le2, l: Je2, m: zg, n: yg, o: xg, p: wg, q: ka2, r: Ba2, s: ka2, t: ka2, u: Le2, v: ra2, w: vg, x: ug, y: tg, z: sg, A: Ba2, B: rg, C: qg, D: pg, E: ng, F: mg, G: lg, H: kg, I: jg, J: ka2, K: Ce2, L: Ba2, M: ma2, N: Ta2, O: ra2, P: ka2, Q: Oa2, R: Ba2, S: ma2, T: Ta2, U: ra2, V: ig, W: hg, X: gg, Y: fg, Z: ka2, _: Ma2, $: Ba2, aa: ma2, ba: Ta2, ca: ra2, da: ka2, ea: ka2, fa: Kg, ga: wd, ha: vd, ia: ra2, ja: ka2, ka: ka2, la: Cb, ma: ra2, na: Xa2, oa: eg, pa: qb, qa: dg, ra: cg, sa: ua2, ta: ka2, ua: Dc, va: ra2, wa: Va2, xa: ud, ya: Ya2, za: bg, Aa: ag, Ba: ka2, Ca: ka2, Da: Dc, Ea: ra2, Fa: ze2, Ga: ud, Ha: Ng, Ia: wd, Ja: vd, Ka: ka2, La: ka2, Ma: ka2, Na: ka2, Oa: Ma2, Pa: ka2, Qa: ma2, Ra: ma2, Sa: Ta2, Ta: dh2, Ua: ch, Va: bh, Wa: ah, Xa: Lb, Ya: Kb, Za: td, _a: sd, $a: rd, ab: $f, bb: _f, cb: Zf, db: qd, eb: Yf, fb: pd, gb: Xf, hb: Wf, ib: Uf, jb: Md, kb: tc, lb: nb, mb, nb: Lb, ob: Kb, pb: td, qb: sd, rb: ka2, sb: ka2, tb: ka2, ub: ka2, vb: Ma2, wb: ka2, xb: ma2, yb: ma2, zb: Ta2, Ab: Aa2, Bb: ka2, Cb: ma2, Db: ka2, Eb: ma2, Fb: Sa2, Gb: ka2, Hb: ma2, Ib: ka2, Jb: ma2, Kb: vb, Lb: ua2, Mb: ma2, Nb: ka2, Ob: ma2, Pb: ub, Qb: ua2, Rb: ma2, Sb: ka2, Tb: ma2, Ub: tb, Vb: ua2, Wb: ma2, Xb: ka2, Yb: ma2, Zb: ma2, _b: ua2, $b: ka2, ac: ma2, bc: ua2, cc: ka2, dc: Nd, ec: pe2, fc: od, gc: fh, hc: nd, ic: eh, jc: ra2, kc: ma2, lc: ua2, mc: ka2, nc: ma2, oc: ua2, pc: ka2, qc: ma2, rc: ma2, sc: pe2, tc: ra2, uc: od, vc: Tf, wc: Ja2, xc: xh, yc: nd, zc: Ia2, Ac: ua2, Bc: md, Cc: Lg, Dc: ka2, Ec: Ag, Fc: Ub, Gc: Sf, Hc: Ua2, Ic: Rf, Jc: ua2, Kc: Cb, Lc: Za2, Mc: ic, Nc: Ca2, Oc: md, Pc: ma2, Qc: ua2, Rc: Oa2, Sc: ka2, Tc: ld, Uc: Nd, Vc: ma2, Wc: ua2, Xc: Oa2, Yc: ka2, Zc: ld, _c: ra2, $c: Gh, ad: Fh, bd: Eh, cd: Dh, dd: ra2, ed: Ch, fd: ka2, gd: Ba2, hd: Bh, id: Cb, jd: ze2, kd: hi, ld: gi, md: fi, nd: ei, od: di, pd: ua2, qd: Ba2, rd: ci, sd: Dc, td: Gg, ud: nb, vd: Fg, wd: Eg, xd: ka2, yd: ka2, zd: ka2, Ad: ka2, Bd: Dg, Cd: Rc, Dd: ma2, Ed: ka2, Fd: kd, Gd: jd, Hd: Sg, Id: id, Jd: Rg, Kd: Qg, Ld: ra2, Md: kd, Nd: jd, Od: Ga2, Pd: id, Qd: Fa2, Rd: ma2, Sd: ka2, Td: Rc, Ud: ra2, Vd: Db, Wd: ma2, Xd: wa2, Yd: Ba2, Zd: wa2, _d: ma2, $d: yc, ae: wh, be: Vb, ce: wa2, de: xc, ee: wc, fe: vc, ge: me2, he: vh, ie: uh, je: Oa2, ke: th, le: Pf, me: Of, ne: Nf, oe: Mf, pe: Lf, qe: fb, re: ma2, se: wa2, te: Ba2, ue: wa2, ve: ma2, we: yc, xe: fe2, ye: Db, ze: wa2, Ae: xc, Be: wc, Ce: fb, De: ee2, Ee: Vb, Fe: de2, Ge: vc, He: uc, Ie: Kf, Je: hd, Ke: Jf, Le: Db, Me: fb, Ne: fb, Oe: ma2, Pe: wa2, Qe: Ba2, Re: wa2, Se: ma2, Te: yc, Ue: fe2, Ve: Db, We: wa2, Xe: xc, Ye: wc, Ze: fb, _e: ee2, $e: Vb, af: de2, bf: vc, cf: uc, df: Hf, ef: hd, ff: Gf, gf: Ff, hf: Ef, jf: sh, kf: Jg, lf: Ig, mf: Hg, nf: ka2, of: ka2, pf: Ea2, qf: wb, rf: ka2, sf: ka2, tf: ka2, uf: Ma2, vf: ka2, wf: ma2, xf: ma2, yf: Ta2, zf: Mg, Af: Lb, Bf: Kb, Cf: ra2, Df: rd, Ef: Df, Ff: qd, Gf: pd, Hf: Lb, If: Kb, Jf: ka2, Kf: Ma2, Lf: ka2, Mf: ma2, Nf: ma2, Of: Ta2, Pf: ra2, Qf: ra2, Rf: Mh, Sf: Lh, Tf: Kh, Uf: Cf, Vf: Bf, Wf: Jh, Xf: Ih, Yf: Ma2, Zf: ka2, _f: Hh, $f: Ba2, ag: Db, bg: fb, cg: Vb, dg: Oa2, eg: ma2, fg: Tg, gg: gd, hg: Je2, ig: Oa2, jg: ma2, kg: gd, lg: Cb, mg: ua2, ng: ka2, og: ka2, pg: ua2, qg: Wd, rg: lh, sg: kh, tg: jh, ug: fd, vg: ed, wg: dd, xg: cd, yg: ih, zg: ic, Ag: hh, Bg: gh, Cg: Cb, Dg: ua2, Eg: ka2, Fg: ka2, Gg: ua2, Hg: Wd, Ig: nh, Jg: mh, Kg: Vd, Lg: ic, Mg: Ud, Ng: Td, Og: Yd, Pg: Xd, Qg: ph, Rg: oh, Sg: cd, Tg: ed, Ug: dd, Vg: fd, Wg: ka2, Xg: Oa2, Yg: wa2, Zg: ka2, _g: Ce2, $g: wa2, ah: zf, bh: yf, ch: xf, dh: wf, eh: vf, fh: uf, gh: ra2, hh: ra2, ih: ka2, jh: Ma2, kh: wa2, lh: qh, mh: bd, nh: ad, oh: ra2, ph: ka2, qh: Oa2, rh: wa2, sh: tf, th: sf, uh: rf, vh: ra2, wh: bd, xh: qf, yh: ad, zh: ka2, Ah: Ma2, Bh: wa2, Ch: ra2, Dh: ma2, Eh: ka2, Fh: ua2, Gh: db, Hh: kb, Ih: xd, Jh: oi, Kh: ni, Lh: Ae2, Mh: mi, Nh: za2, Oh: li, Ph: ka2, Qh: ki, Rh: pf, Sh: Ah, Th: zh, Uh: yh, Vh: Bc, Wh: Ac, Xh: ti, Yh: ji, Zh: ii, _h: Cg, $h: Bg, ai: fb, bi: Ba2, ci: tc, di: nb, ei: rh, fi: $c, gi: of, hi: nf, ii: mf, ji: _c, ki: lf, li: Yc, mi: kf, ni: ka2, oi: ka2, pi: ka2, qi: ka2, ri: Ma2, si: ma2, ti: Ta2, ui: jf, vi: hf, wi: Md, xi: bi, yi: ai, zi: $h, Ai: _h, Bi: Zh, Ci: ye2, Di: xe2, Ei: we2, Fi: ve2, Gi: ue2, Hi: te2, Ii: se2, Ji: re2, Ki: ka2, Li: ua2, Mi: ka2, Ni: ua2, Oi: ka2, Pi: Yh, Qi: Xh, Ri: Wh, Si: Vh, Ti: Uh, Ui: Th, Vi: Sh, Wi: Rh, Xi: Qh, Yi: Ph, Zi: Oh, _i: re2, $i: Nh, aj: ka2, bj: ua2, cj: ua2, dj: ka2, ej: gf, fj: ma2, gj: wa2, hj: Ba2, ij: wa2, jj: ka2, kj: $g, lj: _g, mj: Zg, nj: wa2, oj: Ed, pj: wa2, qj: Yg, rj: Ed, sj: me2, tj: uc, uj: ff, vj: ef, wj: df, xj: cf, yj: Xg, zj: Wg, Aj: Vg, Bj: Ug, Cj: ka2, Dj: ka2, Ej: Pg, Fj: Og, Gj: ka2, Hj: ka2, Ij: $c, Jj: bf, Kj: _c, Lj: Yc, Mj: ka2, Nj: Ma2, Oj: ma2, Pj: Ta2, Qj: ma2, Rj: ma2, Sj: af, Tj: $e2, Uj: _e2, Vj: ka2, Wj: Oa2, Xj: wa2, Yj: ra2, Zj: Ze2, _j: Ye2, $j: ka2, ak: Oa2, bk: wa2, ck: ra2, dk: ka2, ek: Ma2, fk: wa2, gk: Xe2, hk: We2, ik: Ve2, jk: ra2, kk: Da2, lk: ta2 };
57342
57473
  }
57343
57474
  return da2(ea2);
57344
- }(info);
57475
+ })(info);
57345
57476
  }, instantiate: function(binary, info) {
57346
57477
  return { then: function(ok) {
57347
57478
  var module2 = new WebAssembly2.Module(binary);
@@ -59523,6 +59654,11 @@ var init_dist = __esm({
59523
59654
  return { header: header2, headerSignature, ciphertext, nonce };
59524
59655
  }
59525
59656
  decrypt(message) {
59657
+ if (this.state.peerIdentityPublicKey) {
59658
+ if (!verifyHeaderSignature(message.header, message.headerSignature, this.state.peerIdentityPublicKey)) {
59659
+ throw new Error("Header signature verification failed");
59660
+ }
59661
+ }
59526
59662
  const isV2 = message.envelopeVersion === "2.0.0" && message.encryptedHeader != null && message.headerNonce != null;
59527
59663
  const skippedResult = this.trySkippedKeys(message, isV2);
59528
59664
  if (skippedResult !== null) {
@@ -59536,14 +59672,14 @@ var init_dist = __esm({
59536
59672
  if (message.header.messageNumber === 0) {
59537
59673
  try {
59538
59674
  const { messageKey: testKey, headerKey: testHeaderKey, nextChainKey: nextChainKey2 } = kdfChainKey(this.state.rootKey);
59539
- let ad2;
59675
+ let ad;
59540
59676
  if (isV2) {
59541
59677
  libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.encryptedHeader, null, message.headerNonce, testHeaderKey);
59542
- ad2 = message.encryptedHeader;
59678
+ ad = message.encryptedHeader;
59543
59679
  } else {
59544
- ad2 = serializeHeader(message.header);
59680
+ ad = serializeHeader(message.header);
59545
59681
  }
59546
- const ptBytes = libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.ciphertext, ad2, message.nonce, testKey);
59682
+ const ptBytes = libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.ciphertext, ad, message.nonce, testKey);
59547
59683
  this.state.dhReceivingPublicKey = message.header.dhPublicKey;
59548
59684
  this.state.receivingChain = {
59549
59685
  chainKey: nextChainKey2,
@@ -59563,13 +59699,7 @@ var init_dist = __esm({
59563
59699
  this.skipMessages(this.state.receivingChain, message.header.messageNumber, message.header.dhPublicKey, isV2);
59564
59700
  const chain = this.state.receivingChain;
59565
59701
  const { nextChainKey, messageKey, headerKey } = kdfChainKey(chain.chainKey);
59566
- chain.chainKey = nextChainKey;
59567
- chain.messageNumber++;
59568
- if (this.state.peerIdentityPublicKey) {
59569
- if (!verifyHeaderSignature(message.header, message.headerSignature, this.state.peerIdentityPublicKey)) {
59570
- throw new Error("Header signature verification failed");
59571
- }
59572
- }
59702
+ let plaintextBytes;
59573
59703
  if (isV2) {
59574
59704
  try {
59575
59705
  libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.encryptedHeader, null, message.headerNonce, headerKey);
@@ -59577,19 +59707,21 @@ var init_dist = __esm({
59577
59707
  throw new Error("V2 header decryption failed");
59578
59708
  }
59579
59709
  try {
59580
- const plaintextBytes = libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.ciphertext, message.encryptedHeader, message.nonce, messageKey);
59581
- return libsodium_wrappers_default.to_string(plaintextBytes);
59710
+ plaintextBytes = libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.ciphertext, message.encryptedHeader, message.nonce, messageKey);
59582
59711
  } catch {
59583
59712
  throw new Error("V2 decryption failed: ciphertext tampered or wrong key");
59584
59713
  }
59714
+ } else {
59715
+ const ad = serializeHeader(message.header);
59716
+ try {
59717
+ plaintextBytes = libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.ciphertext, ad, message.nonce, messageKey);
59718
+ } catch {
59719
+ throw new Error("Decryption failed: ciphertext tampered or wrong key");
59720
+ }
59585
59721
  }
59586
- const ad = serializeHeader(message.header);
59587
- try {
59588
- const plaintextBytes = libsodium_wrappers_default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message.ciphertext, ad, message.nonce, messageKey);
59589
- return libsodium_wrappers_default.to_string(plaintextBytes);
59590
- } catch {
59591
- throw new Error("Decryption failed: ciphertext tampered or wrong key");
59592
- }
59722
+ chain.chainKey = nextChainKey;
59723
+ chain.messageNumber++;
59724
+ return libsodium_wrappers_default.to_string(plaintextBytes);
59593
59725
  }
59594
59726
  dhRatchetReceive(theirDhPublic) {
59595
59727
  this.state.previousSendingChainLength = this.state.sendingChain?.messageNumber ?? 0;
@@ -68621,6 +68753,11 @@ var init_dist = __esm({
68621
68753
  "use strict";
68622
68754
  }
68623
68755
  });
68756
+ init_mls_presend_epoch = __esm2({
68757
+ "../crypto/dist/mls-presend-epoch.js"() {
68758
+ "use strict";
68759
+ }
68760
+ });
68624
68761
  dist_exports2 = {};
68625
68762
  __export2(dist_exports2, {
68626
68763
  AV_CREDENTIAL_CONTEXT: () => AV_CREDENTIAL_CONTEXT,
@@ -68690,7 +68827,9 @@ var init_dist = __esm({
68690
68827
  hexTransportToEncryptedMessage: () => hexTransportToEncryptedMessage,
68691
68828
  issueCredential: () => issueCredential,
68692
68829
  multibaseToPublicKey: () => multibaseToPublicKey,
68830
+ needsPreSendResync: () => needsPreSendResync,
68693
68831
  normalizeBackupCode: () => normalizeBackupCode,
68832
+ noteObservedEpoch: () => noteObservedEpoch,
68694
68833
  orderDeliveryBatch: () => orderDeliveryBatch,
68695
68834
  parseTraceparent: () => parseTraceparent,
68696
68835
  performX3DH: () => performX3DH,
@@ -68730,6 +68869,7 @@ var init_dist = __esm({
68730
68869
  init_mls_group();
68731
68870
  await init_owner_sync();
68732
68871
  init_mls_delivery_order();
68872
+ init_mls_presend_epoch();
68733
68873
  }
68734
68874
  });
68735
68875
  init_secure_file = __esm2({
@@ -69004,6 +69144,7 @@ var init_dist = __esm({
69004
69144
  await init_libsodium_wrappers();
69005
69145
  await init_dist2();
69006
69146
  await init_dist2();
69147
+ init_mls_presend_epoch();
69007
69148
  init_mls_state();
69008
69149
  await init_mls_kp_pool();
69009
69150
  init_client_version();
@@ -69117,6 +69258,17 @@ var init_dist = __esm({
69117
69258
  * self-heal rather than be logged and dropped. */
69118
69259
  _mlsCommitFailCounts = /* @__PURE__ */ new Map();
69119
69260
  static MAX_MLS_DECRYPT_FAILS = 3;
69261
+ /**
69262
+ * #1084: consecutive resyncs that found NOTHING to apply, per group.
69263
+ *
69264
+ * "No new commits" means the server holds no commit past our epoch — we are
69265
+ * NOT BEHIND. Treating that as corruption and re-keying is what drove the
69266
+ * epoch churn (see `_resyncOnDivergence`). But a state that is genuinely
69267
+ * broken while its epoch counter happens to match must still recover, so the
69268
+ * suppression is bounded rather than absolute.
69269
+ */
69270
+ _resyncNoOpStrikes = /* @__PURE__ */ new Map();
69271
+ static MAX_RESYNC_NOOPS = 3;
69120
69272
  /** Cached MLS KeyPackage bundle for this device (regenerated on each connect). */
69121
69273
  _mlsKeyPackage = null;
69122
69274
  /** Pending KeyPackage bundle from request-Welcome flow (used by _handleMlsWelcome). */
@@ -69154,6 +69306,13 @@ var init_dist = __esm({
69154
69306
  _kpPoolFilling = false;
69155
69307
  /** Buffer for MLS commits received before Welcome (keyed by groupId, sorted by epoch). */
69156
69308
  _pendingMlsCommits = /* @__PURE__ */ new Map();
69309
+ /**
69310
+ * #1013: the highest group epoch any inbound frame has reported, per MLS
69311
+ * group id. Every inbound frame carries the epoch the group was at when it
69312
+ * was produced, so each is a LOWER BOUND on the group's current epoch — the
69313
+ * hint is monotonic and only ever rises.
69314
+ */
69315
+ _observedGroupEpochs = /* @__PURE__ */ new Map();
69157
69316
  /** In-memory credential store for renter-provided credentials (never persisted). */
69158
69317
  _credentialStore = new CredentialStore();
69159
69318
  /** Rooms whose roster has been refreshed from the backend at least once in
@@ -69869,7 +70028,13 @@ var init_dist = __esm({
69869
70028
  }
69870
70029
  try {
69871
70030
  const plaintextBytes = new TextEncoder().encode(plaintext);
69872
- const cipherBytes = await mlsGroup.encrypt(plaintextBytes);
70031
+ const cipherBytes = await this._encryptWithCatchUp(
70032
+ mlsGroup,
70033
+ `1to1-group:${gid}`,
70034
+ entry.mlsGroupId,
70035
+ `1:1 group ${gid.slice(0, 8)}`,
70036
+ plaintextBytes
70037
+ );
69873
70038
  await saveMlsState(this.config.dataDir, entry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
69874
70039
  const payload = {
69875
70040
  group_id: entry.mlsGroupId,
@@ -69916,7 +70081,14 @@ var init_dist = __esm({
69916
70081
  }
69917
70082
  if (mlsGroup?.isInitialized && mlsGroupId && Number(mlsGroup.epoch) > 0 && this._state === "ready" && this._ws) {
69918
70083
  const plaintextBytes = new TextEncoder().encode(plaintext);
69919
- const cipherBytes = await mlsGroup.encrypt(plaintextBytes);
70084
+ const sessionGroupKey = convGroupId && this._mlsGroups.has(`1to1-group:${convGroupId}`) ? `1to1-group:${convGroupId}` : `conv:${convId}`;
70085
+ const cipherBytes = await this._encryptWithCatchUp(
70086
+ mlsGroup,
70087
+ sessionGroupKey,
70088
+ mlsGroupId,
70089
+ `conversation ${convId.slice(0, 8)}`,
70090
+ plaintextBytes
70091
+ );
69920
70092
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mlsGroup.exportState()));
69921
70093
  const payload = {
69922
70094
  conversation_id: convId,
@@ -70011,7 +70183,14 @@ var init_dist = __esm({
70011
70183
  }
70012
70184
  try {
70013
70185
  const plaintextBytes = new TextEncoder().encode(plaintext);
70014
- const cipherBytes = await mlsGroup.encrypt(plaintextBytes);
70186
+ const mlsOnlyGroupKey = mlsOnlyConvGroupId && this._mlsGroups.has(`1to1-group:${mlsOnlyConvGroupId}`) ? `1to1-group:${mlsOnlyConvGroupId}` : `conv:${mlsConvId}`;
70187
+ const cipherBytes = await this._encryptWithCatchUp(
70188
+ mlsGroup,
70189
+ mlsOnlyGroupKey,
70190
+ resolvedMlsGroupId,
70191
+ `conversation ${mlsConvId.slice(0, 8)}`,
70192
+ plaintextBytes
70193
+ );
70015
70194
  await saveMlsState(this.config.dataDir, resolvedMlsGroupId, JSON.stringify(mlsGroup.exportState()));
70016
70195
  const payload = {
70017
70196
  conversation_id: mlsConvId,
@@ -70106,7 +70285,7 @@ var init_dist = __esm({
70106
70285
  */
70107
70286
  sendActivitySpan(spanData) {
70108
70287
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
70109
- const pluginVersion = true ? "0.23.26" : "0.0.0-dev";
70288
+ const pluginVersion = true ? "0.23.27" : "0.0.0-dev";
70110
70289
  const agentName = this.config.agentName ?? "Agent";
70111
70290
  const resource = {
70112
70291
  "service.name": "agentvault-agent",
@@ -70316,7 +70495,13 @@ var init_dist = __esm({
70316
70495
  if (mlsGroup?.isInitialized) {
70317
70496
  try {
70318
70497
  const plaintextBytes = new TextEncoder().encode(plaintext);
70319
- const ciphertext = await mlsGroup.encrypt(plaintextBytes);
70498
+ const ciphertext = await this._encryptWithCatchUp(
70499
+ mlsGroup,
70500
+ roomId,
70501
+ room.mlsGroupId,
70502
+ `room ${roomId.slice(0, 8)}`,
70503
+ plaintextBytes
70504
+ );
70320
70505
  await saveMlsState(this.config.dataDir, room.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
70321
70506
  if (this._state === "ready" && this._ws) {
70322
70507
  this._ws.send(JSON.stringify({
@@ -71501,7 +71686,13 @@ var init_dist = __esm({
71501
71686
  const mlsGroup = this._mlsGroups.get(`a2a:${channelEntry.channelId}`);
71502
71687
  if (mlsGroup?.isInitialized) {
71503
71688
  const plaintextBytes = new TextEncoder().encode(text);
71504
- const ciphertext = await mlsGroup.encrypt(plaintextBytes);
71689
+ const ciphertext = await this._encryptWithCatchUp(
71690
+ mlsGroup,
71691
+ `a2a:${channelEntry.channelId}`,
71692
+ channelEntry.mlsGroupId,
71693
+ `A2A ${channelEntry.channelId.slice(0, 8)}`,
71694
+ plaintextBytes
71695
+ );
71505
71696
  await saveMlsState(
71506
71697
  this.config.dataDir,
71507
71698
  channelEntry.mlsGroupId,
@@ -71549,7 +71740,13 @@ var init_dist = __esm({
71549
71740
  const mlsGroup = this._mlsGroups.get(`a2a:${channelId}`);
71550
71741
  if (mlsGroup?.isInitialized) {
71551
71742
  const plaintextBytes = new TextEncoder().encode(text);
71552
- const ciphertext = await mlsGroup.encrypt(plaintextBytes);
71743
+ const ciphertext = await this._encryptWithCatchUp(
71744
+ mlsGroup,
71745
+ `a2a:${channelId}`,
71746
+ entry.mlsGroupId,
71747
+ `A2A ${channelId.slice(0, 8)}`,
71748
+ plaintextBytes
71749
+ );
71553
71750
  await saveMlsState(this.config.dataDir, entry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
71554
71751
  this._ws.send(JSON.stringify({
71555
71752
  event: "a2a_message_mls",
@@ -72025,7 +72222,7 @@ var init_dist = __esm({
72025
72222
  agentVersion: this.config.agentVersion ?? "0.0.0",
72026
72223
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72027
72224
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72028
- pluginVersion: true ? "0.23.26" : "0.0.0-dev"
72225
+ pluginVersion: true ? "0.23.27" : "0.0.0-dev"
72029
72226
  });
72030
72227
  this._telemetryReporter.startAutoFlush(3e4);
72031
72228
  }
@@ -72349,7 +72546,7 @@ var init_dist = __esm({
72349
72546
  agentVersion: this.config.agentVersion ?? "0.0.0",
72350
72547
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
72351
72548
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
72352
- pluginVersion: true ? "0.23.26" : "0.0.0-dev"
72549
+ pluginVersion: true ? "0.23.27" : "0.0.0-dev"
72353
72550
  });
72354
72551
  this._telemetryReporter.startAutoFlush(3e4);
72355
72552
  }
@@ -72715,6 +72912,7 @@ var init_dist = __esm({
72715
72912
  const convGroupId = data.conversation_group_id;
72716
72913
  const groupId = data.group_id;
72717
72914
  const senderDeviceId = data.sender_device_id;
72915
+ this._noteGroupEpoch(groupId, data.epoch);
72718
72916
  if (senderDeviceId === this._deviceId) return;
72719
72917
  let mgr;
72720
72918
  let mgrKey;
@@ -72792,9 +72990,15 @@ var init_dist = __esm({
72792
72990
  })),
72793
72991
  no_history: filtered.length === 0
72794
72992
  });
72795
- if (mgr && mlsGroupId) {
72993
+ if (mgr && mgrKey && mlsGroupId) {
72796
72994
  const responseBytes = new TextEncoder().encode(responsePayload);
72797
- const cipher = await mgr.encrypt(responseBytes);
72995
+ const cipher = await this._encryptWithCatchUp(
72996
+ mgr,
72997
+ mgrKey,
72998
+ mlsGroupId,
72999
+ `history catch-up ${mlsGroupId.slice(0, 8)}`,
73000
+ responseBytes
73001
+ );
72798
73002
  await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mgr.exportState()));
72799
73003
  if (this._ws) {
72800
73004
  this._ws.send(JSON.stringify({
@@ -73239,7 +73443,7 @@ ${messageText}`;
73239
73443
  }
73240
73444
  try {
73241
73445
  const configPath = join42(homedir, ".openclaw", "openclaw.json");
73242
- const raw = readFileSync4(configPath, "utf-8");
73446
+ const raw = readFileSync5(configPath, "utf-8");
73243
73447
  const config2 = JSON.parse(raw);
73244
73448
  const agents = config2?.agents?.list;
73245
73449
  if (Array.isArray(agents) && agentName) {
@@ -73537,9 +73741,36 @@ ${messageText}`;
73537
73741
  // ---------------------------------------------------------------------------
73538
73742
  // MLS room message handlers
73539
73743
  // ---------------------------------------------------------------------------
73744
+ /**
73745
+ * #1014: hand a room-framed frame to the handler that owns its group family.
73746
+ *
73747
+ * Returns true when the frame was routed. Routing means "give it to the right
73748
+ * handler" — NOT "decrypt it as a room message". Decrypting under the wrong
73749
+ * group is how MLS state gets corrupted, so an unplaceable group is left for
73750
+ * the caller to self-heal rather than guessed at.
73751
+ */
73752
+ async _routeNonRoomGroupMessage(data, groupId) {
73753
+ const target = this._resolveGroupFamily(groupId);
73754
+ if (!target || target.family === "room") return false;
73755
+ console.log(
73756
+ `[SecureChannel] Room-framed message belongs to ${target.label} \u2014 routing to the handler that owns it (#1014)`
73757
+ );
73758
+ switch (target.family) {
73759
+ case "shared1to1":
73760
+ await this._handleMessageMLS({ ...data, conversation_group_id: target.id });
73761
+ return true;
73762
+ case "conversation":
73763
+ await this._handleMessageMLS({ ...data, conversation_id: target.id });
73764
+ return true;
73765
+ case "a2a":
73766
+ await this._handleA2AMessageMLS({ ...data, a2a_channel_id: target.id });
73767
+ return true;
73768
+ }
73769
+ }
73540
73770
  async _handleRoomMessageMLS(data) {
73541
73771
  const groupId = data.group_id;
73542
73772
  const senderDeviceId = data.sender_device_id;
73773
+ this._noteGroupEpoch(groupId, data.epoch);
73543
73774
  if (senderDeviceId === this._deviceId) return;
73544
73775
  let roomId;
73545
73776
  for (const [rid, room] of Object.entries(this._persisted?.rooms ?? {})) {
@@ -73553,7 +73784,9 @@ ${messageText}`;
73553
73784
  roomId = data.room_id;
73554
73785
  console.log(`[SecureChannel] Room ${roomId.slice(0, 8)} matched by room_id (group_id ${groupId?.slice(0, 8)} mismatch)`);
73555
73786
  } else {
73787
+ if (await this._routeNonRoomGroupMessage(data, groupId)) return;
73556
73788
  console.warn(`[SecureChannel] No room found for MLS group ${groupId?.slice(0, 8)}`);
73789
+ if (groupId) void this._requestWelcomeSelfHeal(groupId);
73557
73790
  return;
73558
73791
  }
73559
73792
  }
@@ -73741,63 +73974,63 @@ ${messageText}`;
73741
73974
  console.warn(`[SecureChannel] Failed to send history catchup response:`, sendErr);
73742
73975
  }
73743
73976
  }
73977
+ /**
73978
+ * Apply an inbound MLS commit to whichever group it addresses.
73979
+ *
73980
+ * Returns TRUE when the commit was applied, buffered, or handed to the
73981
+ * failure ladder — i.e. when this agent has taken responsibility for it and
73982
+ * the delivery-queue row may safely be acked. Returns FALSE when the commit
73983
+ * names a group we hold no state for at all, so the caller must NACK and let
73984
+ * the row survive.
73985
+ *
73986
+ * #1012: this used to loop `rooms` then `a2aChannels` and then END. A shared
73987
+ * 1:1 commit (`mlsGroups`) and a legacy per-conversation commit
73988
+ * (`mlsConversations`) matched neither. The call fell off the bottom with no
73989
+ * log, no buffer and no error — and because it did not THROW,
73990
+ * `_pullDeliveryQueue` acked the row and the server deleted it. An MLS commit
73991
+ * cannot be regenerated, so the agent stayed at epoch N while the group moved
73992
+ * to N+1 and every later send() encrypted at an epoch nobody could decrypt.
73993
+ *
73994
+ * The families are enumerated in ONE list resolved by ONE loop, because two
73995
+ * hand-copied loops are exactly how the 1:1 path fell two families behind.
73996
+ */
73744
73997
  async _handleMlsCommit(data) {
73745
73998
  const groupId = data.group_id;
73746
73999
  const epoch = typeof data.epoch === "number" ? data.epoch : 0;
73747
- for (const [roomId, room] of Object.entries(this._persisted?.rooms ?? {})) {
73748
- if (room.mlsGroupId === groupId) {
73749
- const mlsGroup = this._mlsGroups.get(roomId);
73750
- if (mlsGroup?.isInitialized) {
73751
- try {
73752
- const commitBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
73753
- await mlsGroup.processCommit(commitBytes);
73754
- await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
73755
- console.log(`[SecureChannel] MLS commit processed for room ${roomId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
73756
- this._mlsCommitFailCounts.delete(roomId);
73757
- } catch (err) {
73758
- await this._onCommitFailure(
73759
- roomId,
73760
- groupId,
73761
- err,
73762
- `room ${roomId.slice(0, 8)}`,
73763
- data.epoch,
73764
- mlsGroup.epoch
73765
- );
73766
- }
73767
- } else {
73768
- this._bufferMlsCommit(groupId, epoch, data);
73769
- console.log(`[SecureChannel] Buffered MLS commit for room ${roomId.slice(0, 8)} (epoch=${epoch}, group not initialized)`);
73770
- }
73771
- return;
74000
+ this._noteGroupEpoch(groupId, data.epoch);
74001
+ const target = this._resolveGroupFamily(groupId);
74002
+ if (target) {
74003
+ const { managerKey: groupKey, label } = target;
74004
+ const mlsGroup = this._mlsGroups.get(groupKey);
74005
+ if (!mlsGroup?.isInitialized) {
74006
+ this._bufferMlsCommit(groupId, epoch, data);
74007
+ console.log(`[SecureChannel] Buffered MLS commit for ${label} (epoch=${epoch}, group not initialized)`);
74008
+ return true;
73772
74009
  }
73773
- }
73774
- for (const [chId, chState] of Object.entries(this._persisted?.a2aChannels ?? {})) {
73775
- if (chState.mlsGroupId === groupId) {
73776
- const mlsGroup = this._mlsGroups.get(`a2a:${chId}`);
73777
- if (mlsGroup?.isInitialized) {
73778
- try {
73779
- const commitBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
73780
- await mlsGroup.processCommit(commitBytes);
73781
- await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
73782
- console.log(`[SecureChannel] MLS commit processed for A2A ${chId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
73783
- this._mlsCommitFailCounts.delete(`a2a:${chId}`);
73784
- } catch (err) {
73785
- await this._onCommitFailure(
73786
- `a2a:${chId}`,
73787
- groupId,
73788
- err,
73789
- `A2A ${chId.slice(0, 8)}`,
73790
- data.epoch,
73791
- mlsGroup.epoch
73792
- );
73793
- }
73794
- } else {
73795
- this._bufferMlsCommit(groupId, epoch, data);
73796
- console.log(`[SecureChannel] Buffered MLS commit for A2A ${chId.slice(0, 8)} (epoch=${epoch}, group not initialized)`);
73797
- }
73798
- return;
74010
+ try {
74011
+ const commitBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
74012
+ await mlsGroup.processCommit(commitBytes);
74013
+ await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
74014
+ console.log(`[SecureChannel] MLS commit processed for ${label} (epoch=${mlsGroup.epoch})`);
74015
+ this._mlsCommitFailCounts.delete(groupKey);
74016
+ } catch (err) {
74017
+ await this._onCommitFailure(
74018
+ groupKey,
74019
+ groupId,
74020
+ err,
74021
+ label,
74022
+ data.epoch,
74023
+ mlsGroup.epoch
74024
+ );
73799
74025
  }
74026
+ return true;
73800
74027
  }
74028
+ this._bufferMlsCommit(groupId, epoch, data);
74029
+ console.warn(
74030
+ `[SecureChannel] MLS commit for UNKNOWN group ${String(groupId).slice(0, 8)} (epoch=${epoch}) \u2014 buffered, requesting a Welcome, NOT acked`
74031
+ );
74032
+ if (groupId) void this._requestWelcomeSelfHeal(groupId);
74033
+ return false;
73801
74034
  }
73802
74035
  /** Buffer an MLS commit for replay after Welcome join. Max 50 per group. */
73803
74036
  _bufferMlsCommit(groupId, epoch, data) {
@@ -73987,6 +74220,229 @@ ${messageText}`;
73987
74220
  * `1to1-group:<gid>`, `a2a:<channelId>`, …) — also the decrypt-fail-count key.
73988
74221
  * @param groupId the server-side MLS group id used in the /sync URL.
73989
74222
  */
74223
+ /**
74224
+ * #1015 — the ONLY place this package fulfils a Welcome request.
74225
+ *
74226
+ * Add the members, transmit, and record `fulfilled` **only for the targets
74227
+ * whose frames actually went out**. Every one of the five sites that used to
74228
+ * do this by hand followed the same sequence and had the same three holes:
74229
+ * `this._ws` null (both sends skipped by an `if`), a CLOSING socket (`send`
74230
+ * returns without throwing), and a fulfil POST wrapped in `.catch(() => {})`.
74231
+ *
74232
+ * A fulfilled request is never re-requested. So a Welcome that evaporated
74233
+ * left the requester locked out, the fulfiller at epoch N+1, everyone else at
74234
+ * N, and the bridging commit untransmitted and impossible to regenerate — a
74235
+ * permanently wedged group in which every signal read success.
74236
+ *
74237
+ * Returns the number of requests actually fulfilled.
74238
+ */
74239
+ async _fulfilWelcomeRequests(opts) {
74240
+ const { mlsGroup, mlsGroupId, label, welcomeFields, targets } = opts;
74241
+ if (targets.length === 0) return 0;
74242
+ if (!this._wsIsOpen()) {
74243
+ console.warn(
74244
+ `[SecureChannel] ${label}: socket is not OPEN \u2014 NOT advancing the group; ${targets.length} request(s) stay pending for the next pull`
74245
+ );
74246
+ return 0;
74247
+ }
74248
+ const snapshot = mlsGroup.exportState();
74249
+ const { commit, welcome } = await mlsGroup.addMembers(targets.map((t2) => t2.keyPackage));
74250
+ const commitSent = await this._sendFrameConfirmed(
74251
+ {
74252
+ event: "mls_commit",
74253
+ data: {
74254
+ group_id: mlsGroupId,
74255
+ epoch: Number(mlsGroup.epoch),
74256
+ payload: Buffer.from(commit).toString("hex")
74257
+ }
74258
+ },
74259
+ `${label} commit`
74260
+ );
74261
+ if (!commitSent) {
74262
+ mlsGroup.importState(snapshot);
74263
+ console.warn(
74264
+ `[SecureChannel] ${label}: commit was NOT written \u2014 rolled back to epoch ${Number(mlsGroup.epoch)}, nothing fulfilled, requests stay pending`
74265
+ );
74266
+ return 0;
74267
+ }
74268
+ await saveMlsState(this.config.dataDir, mlsGroupId, JSON.stringify(mlsGroup.exportState()));
74269
+ if (!welcome) {
74270
+ console.warn(
74271
+ `[SecureChannel] ${label}: addMembers produced NO Welcome \u2014 ${targets.length} request(s) left pending rather than marked fulfilled`
74272
+ );
74273
+ return 0;
74274
+ }
74275
+ let fulfilled = 0;
74276
+ for (const t2 of targets) {
74277
+ const sent = await this._sendFrameConfirmed(
74278
+ {
74279
+ event: "mls_welcome",
74280
+ data: {
74281
+ target_device_id: t2.deviceId,
74282
+ group_id: mlsGroupId,
74283
+ ...welcomeFields,
74284
+ payload: Buffer.from(welcome).toString("hex")
74285
+ }
74286
+ },
74287
+ `${label} welcome\u2192${t2.deviceId.slice(0, 8)}`
74288
+ );
74289
+ if (!sent) {
74290
+ console.warn(
74291
+ `[SecureChannel] ${label}: Welcome for ${t2.deviceId.slice(0, 8)} was NOT written \u2014 leaving the request PENDING so the next pull retries it`
74292
+ );
74293
+ continue;
74294
+ }
74295
+ if (await this._postFulfilWelcome(mlsGroupId, t2.requestId, `${label} ${t2.deviceId.slice(0, 8)}`)) {
74296
+ fulfilled++;
74297
+ }
74298
+ }
74299
+ return fulfilled;
74300
+ }
74301
+ /**
74302
+ * Resolve an MLS group id to the family that owns it.
74303
+ *
74304
+ * There are four: rooms, A2A channels, shared 1:1 groups, and the legacy
74305
+ * per-conversation groups. They all store the MLS group id under
74306
+ * `mlsGroupId`; they differ only in the key their live `MLSGroupManager` sits
74307
+ * under in `_mlsGroups`.
74308
+ *
74309
+ * ONE resolver, because hand-copying this enumeration is what produced
74310
+ * #1012 (`_handleMlsCommit` handled two families of four), #1014 (a
74311
+ * room-framed 1:1 replay matched nothing) and #1016 (a rejoin dropped only
74312
+ * the room manager). Three bugs, one missing abstraction.
74313
+ */
74314
+ _resolveGroupFamily(mlsGroupId) {
74315
+ if (!mlsGroupId) return null;
74316
+ const families = [
74317
+ { family: "room", entries: this._persisted?.rooms, managerKey: (id) => id, label: "room" },
74318
+ { family: "a2a", entries: this._persisted?.a2aChannels, managerKey: (id) => `a2a:${id}`, label: "A2A" },
74319
+ { family: "shared1to1", entries: this._persisted?.mlsGroups, managerKey: (id) => `1to1-group:${id}`, label: "1:1 group" },
74320
+ { family: "conversation", entries: this._persisted?.mlsConversations, managerKey: (id) => `conv:${id}`, label: "conversation" }
74321
+ ];
74322
+ for (const f2 of families) {
74323
+ for (const [id, entry] of Object.entries(f2.entries ?? {})) {
74324
+ if (entry?.mlsGroupId !== mlsGroupId) continue;
74325
+ return {
74326
+ family: f2.family,
74327
+ id,
74328
+ managerKey: f2.managerKey(id),
74329
+ label: `${f2.label} ${id.slice(0, 8)}`
74330
+ };
74331
+ }
74332
+ }
74333
+ return null;
74334
+ }
74335
+ /** #1015: is the socket in a state that can actually take a write? */
74336
+ _wsIsOpen() {
74337
+ return this._ws?.readyState === 1;
74338
+ }
74339
+ /**
74340
+ * #1015: write one frame and report whether the socket took it.
74341
+ *
74342
+ * `ws.send()` on a CLOSING or CLOSED socket returns WITHOUT throwing — the
74343
+ * error surfaces only through the callback, and every fulfilment site passed
74344
+ * none. So a Welcome could be "sent" into a dead socket and the requester
74345
+ * still marked `fulfilled`, which it never re-requests.
74346
+ */
74347
+ _sendFrameConfirmed(frame, label) {
74348
+ const ws = this._ws;
74349
+ if (!ws || ws.readyState !== 1) {
74350
+ console.warn(
74351
+ `[SecureChannel] ${label}: socket is not OPEN (readyState=${ws?.readyState ?? "null"}) \u2014 frame NOT written`
74352
+ );
74353
+ return Promise.resolve(false);
74354
+ }
74355
+ return new Promise((resolve3) => {
74356
+ try {
74357
+ ws.send(JSON.stringify(frame), (err) => {
74358
+ if (err) {
74359
+ console.error(`[SecureChannel] ${label}: socket refused the frame:`, err);
74360
+ resolve3(false);
74361
+ } else {
74362
+ resolve3(true);
74363
+ }
74364
+ });
74365
+ } catch (err) {
74366
+ console.error(`[SecureChannel] ${label}: send threw:`, err);
74367
+ resolve3(false);
74368
+ }
74369
+ });
74370
+ }
74371
+ /**
74372
+ * #1015: record a Welcome as fulfilled — and say so when it fails.
74373
+ *
74374
+ * The batched shared-1:1 site posted this with `.catch(() => {})`, so an HTTP
74375
+ * failure here was invisible on top of the sends being invisible.
74376
+ */
74377
+ async _postFulfilWelcome(mlsGroupId, requestId, label) {
74378
+ try {
74379
+ const res = await fetch(
74380
+ `${this.config.apiUrl}/api/v1/mls/groups/${mlsGroupId}/fulfill-welcome`,
74381
+ {
74382
+ method: "POST",
74383
+ headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
74384
+ body: JSON.stringify({ request_id: requestId })
74385
+ }
74386
+ );
74387
+ if (!res.ok) {
74388
+ console.warn(`[SecureChannel] ${label}: fulfill-welcome returned ${res.status}`);
74389
+ return false;
74390
+ }
74391
+ return true;
74392
+ } catch (err) {
74393
+ console.warn(`[SecureChannel] ${label}: fulfill-welcome failed:`, err);
74394
+ return false;
74395
+ }
74396
+ }
74397
+ /**
74398
+ * #1013: fold an epoch seen on an inbound frame into the running hint.
74399
+ *
74400
+ * Anything unusable (missing, non-numeric, negative, fractional) is ignored
74401
+ * rather than defaulted. A defaulted epoch here would be a guess, and a guess
74402
+ * that reads LOW silently disables the check it exists to drive.
74403
+ */
74404
+ _noteGroupEpoch(mlsGroupId, epoch) {
74405
+ if (typeof mlsGroupId !== "string" || !mlsGroupId) return;
74406
+ const current = this._observedGroupEpochs.get(mlsGroupId) ?? 0;
74407
+ const next = noteObservedEpoch(current, epoch);
74408
+ if (next > current) this._observedGroupEpochs.set(mlsGroupId, next);
74409
+ }
74410
+ /**
74411
+ * #1013 — the ONLY place this package encrypts an MLS application message.
74412
+ *
74413
+ * Catch up first when the group is known to have moved past us, then encrypt.
74414
+ * Hermes has done this since #440 and the browser since #996; the plugin —
74415
+ * the implementation that actually ships to customers — did not, so an agent
74416
+ * that missed one commit encrypted every later message at an epoch nobody
74417
+ * could read, while the server stored and relayed it and every signal read
74418
+ * 200.
74419
+ *
74420
+ * Funnelling every sender through one method is the point. A guard applied at
74421
+ * seven call sites decays to a guard applied at six: that is exactly how
74422
+ * `_handleMlsCommit` ended up handling two group families out of four (#1012).
74423
+ *
74424
+ * Best-effort by design. A catch-up that cannot replay — or that throws — must
74425
+ * NOT block the send; we fall through and encrypt at the local epoch, which is
74426
+ * precisely today's behaviour, so the worst case is no regression.
74427
+ */
74428
+ async _encryptWithCatchUp(mlsGroup, groupKey, mlsGroupId, label, plaintextBytes) {
74429
+ const observed = this._observedGroupEpochs.get(mlsGroupId);
74430
+ if (observed !== void 0 && needsPreSendResync(Number(mlsGroup.epoch), observed)) {
74431
+ console.warn(
74432
+ `[SecureChannel] ${label}: local epoch ${Number(mlsGroup.epoch)} is behind the observed group epoch ${observed} \u2014 catching up before encrypt (#1013)`
74433
+ );
74434
+ try {
74435
+ if (!await this._resyncOnDivergence(groupKey, mlsGroupId)) {
74436
+ console.warn(
74437
+ `[SecureChannel] ${label}: catch-up could not replay \u2014 sending at epoch ${Number(mlsGroup.epoch)}. Peers past this epoch will not read it.`
74438
+ );
74439
+ }
74440
+ } catch (err) {
74441
+ console.warn(`[SecureChannel] ${label}: catch-up failed:`, err);
74442
+ }
74443
+ }
74444
+ return await mlsGroup.encrypt(plaintextBytes);
74445
+ }
73990
74446
  async _resyncOnDivergence(groupKey, groupId) {
73991
74447
  const mgr = this._mlsGroups.get(groupKey);
73992
74448
  if (!mgr?.isInitialized) return false;
@@ -74013,11 +74469,24 @@ ${messageText}`;
74013
74469
  applied++;
74014
74470
  }
74015
74471
  if (applied === 0) {
74016
- console.log(`[SecureChannel] Resync for ${groupId.slice(0, 8)}: no new commits to apply (epoch=${mgr.epoch})`);
74472
+ const strikes = (this._resyncNoOpStrikes.get(groupKey) ?? 0) + 1;
74473
+ this._resyncNoOpStrikes.set(groupKey, strikes);
74474
+ if (strikes < _SecureChannel.MAX_RESYNC_NOOPS) {
74475
+ this._mlsDecryptFailCounts.delete(groupKey);
74476
+ console.log(
74477
+ `[SecureChannel] Resync for ${groupId.slice(0, 8)}: already current at epoch=${mgr.epoch} (strike ${strikes}/${_SecureChannel.MAX_RESYNC_NOOPS}) \u2014 NOT re-keying (#1084)`
74478
+ );
74479
+ return true;
74480
+ }
74481
+ this._resyncNoOpStrikes.delete(groupKey);
74482
+ console.warn(
74483
+ `[SecureChannel] Resync for ${groupId.slice(0, 8)}: still failing at epoch=${mgr.epoch} after ${_SecureChannel.MAX_RESYNC_NOOPS} no-op resyncs \u2014 escalating to re-key`
74484
+ );
74017
74485
  return false;
74018
74486
  }
74019
74487
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mgr.exportState()));
74020
74488
  this._mlsDecryptFailCounts.delete(groupKey);
74489
+ this._resyncNoOpStrikes.delete(groupKey);
74021
74490
  console.log(
74022
74491
  `[SecureChannel] Resync-on-divergence: applied ${applied} missed commit(s) for ${groupId.slice(0, 8)}, now epoch=${mgr.epoch}`
74023
74492
  );
@@ -74404,6 +74873,7 @@ ${messageText}`;
74404
74873
  const ackedIds = [];
74405
74874
  const nackedIds = [];
74406
74875
  for (const msg of messages) {
74876
+ let handled = true;
74407
74877
  try {
74408
74878
  if (msg.sender_device_id === this._deviceId) {
74409
74879
  ackedIds.push(msg.queue_id);
@@ -74420,7 +74890,7 @@ ${messageText}`;
74420
74890
  a2a_channel_id: msg.a2a_channel_id
74421
74891
  });
74422
74892
  } else if (msg.message_type === "commit") {
74423
- await this._handleMlsCommit({
74893
+ handled = await this._handleMlsCommit({
74424
74894
  group_id: msg.group_id,
74425
74895
  sender_device_id: msg.sender_device_id,
74426
74896
  epoch: msg.epoch,
@@ -74458,9 +74928,18 @@ ${messageText}`;
74458
74928
  conversation_group_id: msg.conversation_group_id,
74459
74929
  created_at: msg.created_at
74460
74930
  });
74931
+ } else {
74932
+ handled = false;
74933
+ console.warn(
74934
+ `[SecureChannel] Delivery application row ${String(msg.message_id).slice(0, 8)} names no room, A2A channel or conversation \u2014 NOT acked`
74935
+ );
74461
74936
  }
74462
74937
  }
74463
- ackedIds.push(msg.queue_id);
74938
+ if (handled) {
74939
+ ackedIds.push(msg.queue_id);
74940
+ } else {
74941
+ nackedIds.push(msg.queue_id);
74942
+ }
74464
74943
  } catch (err) {
74465
74944
  console.warn(`[SecureChannel] Delivery ${msg.message_type} processing failed:`, err);
74466
74945
  nackedIds.push(msg.queue_id);
@@ -74529,38 +75008,20 @@ ${messageText}`;
74529
75008
  if (!kpHex) continue;
74530
75009
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
74531
75010
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
74532
- const { commit, welcome } = await mlsGroup.addMembers([memberKp]);
74533
- if (this._ws) {
74534
- this._ws.send(JSON.stringify({
74535
- event: "mls_commit",
74536
- data: {
74537
- group_id: roomState.mlsGroupId,
74538
- epoch: Number(mlsGroup.epoch),
74539
- payload: Buffer.from(commit).toString("hex")
74540
- }
74541
- }));
74542
- }
74543
- if (welcome && this._ws) {
74544
- this._ws.send(JSON.stringify({
74545
- event: "mls_welcome",
74546
- data: {
74547
- target_device_id: req.requesting_device_id,
74548
- group_id: roomState.mlsGroupId,
74549
- room_id: roomId,
74550
- payload: Buffer.from(welcome).toString("hex")
74551
- }
74552
- }));
75011
+ const done = await this._fulfilWelcomeRequests({
75012
+ mlsGroup,
75013
+ mlsGroupId: roomState.mlsGroupId,
75014
+ label: `room ${roomId.slice(0, 8)}`,
75015
+ welcomeFields: { room_id: roomId },
75016
+ targets: [{
75017
+ requestId: req.id,
75018
+ deviceId: req.requesting_device_id,
75019
+ keyPackage: memberKp
75020
+ }]
75021
+ });
75022
+ if (done > 0) {
75023
+ console.log(`[SecureChannel] Fulfilled Welcome for ${req.requesting_device_id.slice(0, 8)} in room ${roomId.slice(0, 8)}`);
74553
75024
  }
74554
- await fetch(
74555
- `${this.config.apiUrl}/api/v1/mls/groups/${roomState.mlsGroupId}/fulfill-welcome`,
74556
- {
74557
- method: "POST",
74558
- headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
74559
- body: JSON.stringify({ request_id: req.id })
74560
- }
74561
- );
74562
- await saveMlsState(this.config.dataDir, roomState.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
74563
- console.log(`[SecureChannel] Fulfilled Welcome for ${req.requesting_device_id.slice(0, 8)} in room ${roomId.slice(0, 8)}`);
74564
75025
  } catch (fulfillErr) {
74565
75026
  console.warn(`[SecureChannel] Welcome fulfill failed for ${req.requesting_device_id.slice(0, 8)}:`, fulfillErr);
74566
75027
  }
@@ -74599,65 +75060,38 @@ ${messageText}`;
74599
75060
  validReqs.push({ req, kp: MLSGroupManager.deserializeKeyPackage(kpBytes) });
74600
75061
  }
74601
75062
  if (validReqs.length === 0) continue;
75063
+ const sharedTargets = validReqs.map((v2) => ({
75064
+ requestId: v2.req.id,
75065
+ deviceId: v2.req.requesting_device_id,
75066
+ keyPackage: v2.kp
75067
+ }));
74602
75068
  try {
74603
- const { commit, welcome } = await mlsGroup.addMembers(validReqs.map((v2) => v2.kp));
74604
- if (this._ws) {
74605
- this._ws.send(JSON.stringify({
74606
- event: "mls_commit",
74607
- data: {
74608
- group_id: entry.mlsGroupId,
74609
- epoch: Number(mlsGroup.epoch),
74610
- payload: Buffer.from(commit).toString("hex")
74611
- }
74612
- }));
74613
- }
74614
- if (welcome && this._ws) {
74615
- for (const { req } of validReqs) {
74616
- this._ws.send(JSON.stringify({
74617
- event: "mls_welcome",
74618
- data: {
74619
- target_device_id: req.requesting_device_id,
74620
- group_id: entry.mlsGroupId,
74621
- conversation_group_id: gid,
74622
- payload: Buffer.from(welcome).toString("hex")
74623
- }
74624
- }));
74625
- }
74626
- }
74627
- for (const { req } of validReqs) {
74628
- await fetch(
74629
- `${this.config.apiUrl}/api/v1/mls/groups/${entry.mlsGroupId}/fulfill-welcome`,
74630
- {
74631
- method: "POST",
74632
- headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
74633
- body: JSON.stringify({ request_id: req.id })
74634
- }
74635
- ).catch(() => {
74636
- });
75069
+ const done = await this._fulfilWelcomeRequests({
75070
+ mlsGroup,
75071
+ mlsGroupId: entry.mlsGroupId,
75072
+ label: `shared group ${gid.slice(0, 8)}`,
75073
+ welcomeFields: { conversation_group_id: gid },
75074
+ targets: sharedTargets
75075
+ });
75076
+ if (done > 0) {
75077
+ console.log(`[SecureChannel] Batched Welcome for ${done}/${validReqs.length} devices in shared group ${gid.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
74637
75078
  }
74638
- await saveMlsState(this.config.dataDir, entry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
74639
- console.log(`[SecureChannel] Batched Welcome for ${validReqs.length} devices in shared group ${gid.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
74640
75079
  } catch (batchErr) {
74641
75080
  console.warn(`[SecureChannel] Batched Welcome failed for shared group ${gid.slice(0, 8)}, falling back to individual:`, batchErr);
74642
- for (const { req, kp } of validReqs) {
75081
+ for (const target of sharedTargets) {
74643
75082
  try {
74644
- const { commit, welcome } = await mlsGroup.addMembers([kp]);
74645
- if (this._ws) {
74646
- this._ws.send(JSON.stringify({ event: "mls_commit", data: { group_id: entry.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: Buffer.from(commit).toString("hex") } }));
74647
- }
74648
- if (welcome && this._ws) {
74649
- this._ws.send(JSON.stringify({ event: "mls_welcome", data: { target_device_id: req.requesting_device_id, group_id: entry.mlsGroupId, conversation_group_id: gid, payload: Buffer.from(welcome).toString("hex") } }));
74650
- }
74651
- await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${entry.mlsGroupId}/fulfill-welcome`, {
74652
- method: "POST",
74653
- headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
74654
- body: JSON.stringify({ request_id: req.id })
74655
- }).catch(() => {
75083
+ const done = await this._fulfilWelcomeRequests({
75084
+ mlsGroup,
75085
+ mlsGroupId: entry.mlsGroupId,
75086
+ label: `shared group ${gid.slice(0, 8)}`,
75087
+ welcomeFields: { conversation_group_id: gid },
75088
+ targets: [target]
74656
75089
  });
74657
- await saveMlsState(this.config.dataDir, entry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
74658
- console.log(`[SecureChannel] Individual Welcome for ${req.requesting_device_id.slice(0, 8)} in shared group ${gid.slice(0, 8)}`);
75090
+ if (done > 0) {
75091
+ console.log(`[SecureChannel] Individual Welcome for ${target.deviceId.slice(0, 8)} in shared group ${gid.slice(0, 8)}`);
75092
+ }
74659
75093
  } catch (indivErr) {
74660
- console.warn(`[SecureChannel] Individual Welcome failed for ${req.requesting_device_id.slice(0, 8)}:`, indivErr);
75094
+ console.warn(`[SecureChannel] Individual Welcome failed for ${target.deviceId.slice(0, 8)}:`, indivErr);
74661
75095
  }
74662
75096
  }
74663
75097
  }
@@ -74689,38 +75123,20 @@ ${messageText}`;
74689
75123
  if (!kpHex) continue;
74690
75124
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
74691
75125
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
74692
- const { commit, welcome } = await mlsGroup.addMembers([memberKp]);
74693
- if (this._ws) {
74694
- this._ws.send(JSON.stringify({
74695
- event: "mls_commit",
74696
- data: {
74697
- group_id: convEntry.mlsGroupId,
74698
- epoch: Number(mlsGroup.epoch),
74699
- payload: Buffer.from(commit).toString("hex")
74700
- }
74701
- }));
74702
- }
74703
- if (welcome && this._ws) {
74704
- this._ws.send(JSON.stringify({
74705
- event: "mls_welcome",
74706
- data: {
74707
- target_device_id: req.requesting_device_id,
74708
- group_id: convEntry.mlsGroupId,
74709
- conversation_id: convId,
74710
- payload: Buffer.from(welcome).toString("hex")
74711
- }
74712
- }));
75126
+ const done = await this._fulfilWelcomeRequests({
75127
+ mlsGroup,
75128
+ mlsGroupId: convEntry.mlsGroupId,
75129
+ label: `conv ${convId.slice(0, 8)}`,
75130
+ welcomeFields: { conversation_id: convId },
75131
+ targets: [{
75132
+ requestId: req.id,
75133
+ deviceId: req.requesting_device_id,
75134
+ keyPackage: memberKp
75135
+ }]
75136
+ });
75137
+ if (done > 0) {
75138
+ console.log(`[SecureChannel] Fulfilled Welcome for ${req.requesting_device_id.slice(0, 8)} in conv ${convId.slice(0, 8)}`);
74713
75139
  }
74714
- await fetch(
74715
- `${this.config.apiUrl}/api/v1/mls/groups/${convEntry.mlsGroupId}/fulfill-welcome`,
74716
- {
74717
- method: "POST",
74718
- headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
74719
- body: JSON.stringify({ request_id: req.id })
74720
- }
74721
- );
74722
- await saveMlsState(this.config.dataDir, convEntry.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
74723
- console.log(`[SecureChannel] Fulfilled Welcome for ${req.requesting_device_id.slice(0, 8)} in conv ${convId.slice(0, 8)}`);
74724
75140
  } catch (fulfillErr) {
74725
75141
  console.warn(`[SecureChannel] Conv Welcome fulfill failed for ${req.requesting_device_id.slice(0, 8)}:`, fulfillErr);
74726
75142
  }
@@ -74901,12 +75317,13 @@ ${messageText}`;
74901
75317
  } catch (distErr) {
74902
75318
  console.warn(`[SecureChannel] A2A distribute network error:`, distErr);
74903
75319
  }
74904
- if (!distributed && this._ws) {
74905
- this._ws.send(JSON.stringify({
75320
+ if (!distributed && this._wsIsOpen()) {
75321
+ const a2aLabel = `A2A ${chId.slice(0, 8)}`;
75322
+ const commitSent = await this._sendFrameConfirmed({
74906
75323
  event: "mls_commit",
74907
75324
  data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
74908
- }));
74909
- this._ws.send(JSON.stringify({
75325
+ }, `${a2aLabel} commit`);
75326
+ const welcomeSent = commitSent && await this._sendFrameConfirmed({
74910
75327
  event: "mls_welcome",
74911
75328
  data: {
74912
75329
  target_device_id: req.requesting_device_id,
@@ -74914,7 +75331,11 @@ ${messageText}`;
74914
75331
  a2a_channel_id: chId,
74915
75332
  payload: welcomeHex
74916
75333
  }
74917
- }));
75334
+ }, `${a2aLabel} welcome`);
75335
+ if (!welcomeSent) {
75336
+ console.warn(`[SecureChannel] ${a2aLabel}: Welcome frames were NOT written \u2014 leaving the request pending`);
75337
+ continue;
75338
+ }
74918
75339
  try {
74919
75340
  await fetch(
74920
75341
  `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/distribute`,
@@ -74937,16 +75358,15 @@ ${messageText}`;
74937
75358
  console.warn(`[SecureChannel] Cannot deliver Welcome \u2014 HTTP distribute and WS both unavailable`);
74938
75359
  continue;
74939
75360
  }
74940
- await fetch(
74941
- `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/fulfill-welcome`,
74942
- {
74943
- method: "POST",
74944
- headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
74945
- body: JSON.stringify({ request_id: req.id })
74946
- }
75361
+ const a2aFulfilled = await this._postFulfilWelcome(
75362
+ chState.mlsGroupId,
75363
+ req.id,
75364
+ `A2A ${chId.slice(0, 8)}`
74947
75365
  );
74948
75366
  await saveMlsState(this.config.dataDir, chState.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
74949
- console.log(`[SecureChannel] Fulfilled A2A Welcome for ${req.requesting_device_id.slice(0, 8)} in channel ${chId.slice(0, 8)}`);
75367
+ if (a2aFulfilled) {
75368
+ console.log(`[SecureChannel] Fulfilled A2A Welcome for ${req.requesting_device_id.slice(0, 8)} in channel ${chId.slice(0, 8)}`);
75369
+ }
74950
75370
  } catch (fulfillErr) {
74951
75371
  console.log(`[SecureChannel] A2A Welcome fulfill failed: ${fulfillErr instanceof Error ? fulfillErr.message : String(fulfillErr)}`);
74952
75372
  }
@@ -75120,12 +75540,12 @@ ${messageText}`;
75120
75540
  console.log(`[SecureChannel] MLS sync: re-join needed for group ${groupId?.slice(0, 8)}`);
75121
75541
  if (groupId) {
75122
75542
  await deleteMlsState(this.config.dataDir, groupId);
75123
- for (const [roomId, room] of Object.entries(this._persisted?.rooms ?? {})) {
75124
- if (room.mlsGroupId === groupId) {
75125
- this._mlsGroups.delete(roomId);
75126
- break;
75127
- }
75543
+ const target = this._resolveGroupFamily(groupId);
75544
+ if (target) {
75545
+ this._mlsGroups.delete(target.managerKey);
75546
+ console.log(`[SecureChannel] MLS sync rejoin: dropped local state for ${target.label}`);
75128
75547
  }
75548
+ void this._requestWelcomeSelfHeal(groupId);
75129
75549
  }
75130
75550
  } else if (action === "replay_complete") {
75131
75551
  console.log(`[SecureChannel] MLS sync complete for group ${groupId?.slice(0, 8)} (${data.count} messages replayed)`);
@@ -75137,6 +75557,7 @@ ${messageText}`;
75137
75557
  */
75138
75558
  async _handleA2AMessageMLS(data) {
75139
75559
  const groupId = data.group_id;
75560
+ this._noteGroupEpoch(groupId, data.epoch);
75140
75561
  const channelId = data.channel_id ?? data.a2a_channel_id;
75141
75562
  let a2aChannelId = channelId;
75142
75563
  if (!a2aChannelId) {
@@ -83557,10 +83978,10 @@ ${actionsText}`);
83557
83978
  inst.with = inst.check;
83558
83979
  inst.clone = (_def, params) => clone(inst, _def, params);
83559
83980
  inst.brand = () => inst;
83560
- inst.register = (reg, meta3) => {
83981
+ inst.register = ((reg, meta3) => {
83561
83982
  reg.add(inst, meta3);
83562
83983
  return inst;
83563
- };
83984
+ });
83564
83985
  inst.apply = (fn) => fn(inst);
83565
83986
  });
83566
83987
  ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
@@ -83947,10 +84368,10 @@ ${actionsText}`);
83947
84368
  inst.with = inst.check;
83948
84369
  inst.clone = (def2, params) => clone(inst, def2, params);
83949
84370
  inst.brand = () => inst;
83950
- inst.register = (reg, meta3) => {
84371
+ inst.register = ((reg, meta3) => {
83951
84372
  reg.add(inst, meta3);
83952
84373
  return inst;
83953
- };
84374
+ });
83954
84375
  inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
83955
84376
  inst.safeParse = (data, params) => safeParse3(inst, data, params);
83956
84377
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
@@ -97358,7 +97779,7 @@ data:
97358
97779
  init_skill_invoker();
97359
97780
  await init_skill_telemetry();
97360
97781
  await init_policy_enforcer();
97361
- VERSION = true ? "0.23.26" : "0.0.0-dev";
97782
+ VERSION = true ? "0.23.27" : "0.0.0-dev";
97362
97783
  }
97363
97784
  });
97364
97785
  await init_index();
@@ -97368,37 +97789,17 @@ data:
97368
97789
  // src/index.ts
97369
97790
  init_config();
97370
97791
  init_log();
97792
+ init_fence_auth();
97371
97793
  import { chmodSync as chmodSync5, mkdirSync as mkdirSync6 } from "node:fs";
97372
97794
 
97373
- // src/fence-auth.ts
97374
- import { copyFileSync, chmodSync as chmodSync2, existsSync as existsSync2, mkdirSync as mkdirSync2 } from "node:fs";
97375
- import { join as join2 } from "node:path";
97376
- function seedFenceCredential(opts) {
97377
- const log = opts.log ?? (() => {
97378
- });
97379
- const fenceAuth = join2(opts.fenceHome, ".config", "muse", "auth.json");
97380
- if (existsSync2(fenceAuth)) {
97381
- log("[muse-bridge] fence credential already present; leaving it untouched");
97382
- return "already-present";
97383
- }
97384
- const hostAuth = join2(opts.hostHome, ".config", "muse", "auth.json");
97385
- if (!existsSync2(hostAuth)) {
97386
- log("[muse-bridge] no host credential to seed (run `muse login`, or set META_API_KEY)");
97387
- return "no-host-credential";
97388
- }
97389
- mkdirSync2(join2(opts.fenceHome, ".config", "muse"), { recursive: true });
97390
- copyFileSync(hostAuth, fenceAuth);
97391
- chmodSync2(fenceAuth, 384);
97392
- log("[muse-bridge] seeded fence credential from the host muse login");
97393
- return "seeded";
97394
- }
97395
-
97396
97795
  // src/muse-session.ts
97397
97796
  var MuseSession = class {
97398
97797
  constructor(driver, opts = {}) {
97399
97798
  this.driver = driver;
97400
97799
  this.opts = opts;
97401
97800
  }
97801
+ driver;
97802
+ opts;
97402
97803
  queue = [];
97403
97804
  running = false;
97404
97805
  current = null;
@@ -97503,7 +97904,7 @@ ${item.text}` : item.text;
97503
97904
  // src/muse-driver.ts
97504
97905
  import { spawn } from "node:child_process";
97505
97906
  import { randomUUID } from "node:crypto";
97506
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync } from "node:fs";
97907
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
97507
97908
  import { join as join4 } from "node:path";
97508
97909
 
97509
97910
  // src/muse-spawn.ts
@@ -97560,6 +97961,7 @@ var MuseDriver = class {
97560
97961
  this.spawnFn = opts.spawnFn ?? defaultSpawn;
97561
97962
  this.turnTimeoutMs = opts.turnTimeoutMs ?? DEFAULT_TURN_TIMEOUT_MS;
97562
97963
  }
97964
+ opts;
97563
97965
  spawnFn;
97564
97966
  turnTimeoutMs;
97565
97967
  persistedId = null;
@@ -97571,14 +97973,14 @@ var MuseDriver = class {
97571
97973
  mkdirSync3(this.opts.dataDir, { recursive: true });
97572
97974
  const file2 = join4(this.opts.dataDir, SESSION_FILE);
97573
97975
  if (existsSync3(file2)) {
97574
- const existing = readFileSync2(file2, "utf8").trim();
97976
+ const existing = readFileSync3(file2, "utf8").trim();
97575
97977
  if (existing) {
97576
97978
  this.persistedId = existing;
97577
97979
  return existing;
97578
97980
  }
97579
97981
  }
97580
97982
  this.persistedId = randomUUID();
97581
- writeFileSync(file2, this.persistedId + "\n", { encoding: "utf8" });
97983
+ writeFileSync2(file2, this.persistedId + "\n", { encoding: "utf8" });
97582
97984
  return this.persistedId;
97583
97985
  }
97584
97986
  sessionId() {
@@ -98092,7 +98494,7 @@ data: ${JSON.stringify(out)}
98092
98494
  }
98093
98495
 
98094
98496
  // src/settings-mcp.ts
98095
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync2, chmodSync as chmodSync3 } from "node:fs";
98497
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync3, chmodSync as chmodSync3 } from "node:fs";
98096
98498
  import { join as join5 } from "node:path";
98097
98499
  function writeFenceMcpSettings(fenceHome, opts) {
98098
98500
  const dir = join5(fenceHome, ".config", "muse");
@@ -98109,7 +98511,7 @@ function writeFenceMcpSettings(fenceHome, opts) {
98109
98511
  }
98110
98512
  }
98111
98513
  };
98112
- writeFileSync2(dest, JSON.stringify(body, null, 2) + "\n", { mode: 384 });
98514
+ writeFileSync3(dest, JSON.stringify(body, null, 2) + "\n", { mode: 384 });
98113
98515
  chmodSync3(dest, 384);
98114
98516
  }
98115
98517
 
@@ -98271,7 +98673,7 @@ function mkdir700(path2) {
98271
98673
  chmodSync5(path2, 448);
98272
98674
  }
98273
98675
  function packageVersion() {
98274
- return true ? "0.1.1" : void 0;
98676
+ return true ? "0.1.3" : void 0;
98275
98677
  }
98276
98678
  function helpText(version2) {
98277
98679
  return [
@@ -98332,6 +98734,14 @@ async function main(opts = {}) {
98332
98734
  hostHome: cfg.hostHome,
98333
98735
  log: (m2) => logLine(m2)
98334
98736
  });
98737
+ harvestFenceApiKeyToSidecar({
98738
+ dataDir: cfg.dataDir,
98739
+ fenceHome: cfg.fenceHome,
98740
+ log: (m2) => logLine(m2)
98741
+ });
98742
+ if (!cfg.apiKey) {
98743
+ cfg.apiKey = readSidecarMetaApiKey(cfg.dataDir) || readFenceMetaApiKey(cfg.fenceHome) || void 0;
98744
+ }
98335
98745
  let shuttingDown = false;
98336
98746
  let exiting = false;
98337
98747
  let driver;