@agentvault/grok-bridge 0.4.23 → 0.4.25

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
@@ -38,12 +38,14 @@ import { homedir } from "node:os";
38
38
  import { dirname, join as join4, resolve } from "node:path";
39
39
  import { Writable } from "node:stream";
40
40
  import { createInterface } from "node:readline";
41
+ import { AsyncLocalStorage } from "node:async_hooks";
42
+ import { randomBytes as randomBytes3 } from "node:crypto";
41
43
  import { Readable } from "node:stream";
42
44
  import { readdir as readdir2, readFile as readFile4, writeFile as writeFile2, rename as rename4, stat, unlink, mkdir as mkdir3 } from "node:fs/promises";
43
45
  import { join as join5 } from "node:path";
44
46
  import { randomUUID as randomUUID3 } from "node:crypto";
45
47
  import { EventEmitter } from "node:events";
46
- import { AsyncLocalStorage } from "node:async_hooks";
48
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
47
49
  import { createServer } from "node:http";
48
50
  import { randomUUID as randomUUID4, createHash } from "node:crypto";
49
51
  import { readFileSync } from "node:fs";
@@ -53,7 +55,7 @@ import { join as join6 } from "node:path";
53
55
  import { readFile as readFile5 } from "node:fs/promises";
54
56
  import WebSocket from "ws";
55
57
  import { resolve as resolve2 } from "node:path";
56
- import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
58
+ import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
57
59
  import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
58
60
  import { Http2ServerRequest } from "http2";
59
61
  import { Readable as Readable2 } from "stream";
@@ -9219,7 +9221,7 @@ function eddsa(Point, cHash, eddsaOpts = {}) {
9219
9221
  });
9220
9222
  const { prehash } = eddsaOpts;
9221
9223
  const { BASE, Fp: Fp3, Fn: Fn3 } = Point;
9222
- const randomBytes32 = eddsaOpts.randomBytes || randomBytes2;
9224
+ const randomBytes42 = eddsaOpts.randomBytes || randomBytes2;
9223
9225
  const adjustScalarBytes3 = eddsaOpts.adjustScalarBytes || ((bytes) => bytes);
9224
9226
  const domain = eddsaOpts.domain || ((data, ctx, phflag) => {
9225
9227
  _abool2(phflag, "phflag");
@@ -9301,7 +9303,7 @@ function eddsa(Point, cHash, eddsaOpts = {}) {
9301
9303
  signature: 2 * _size2,
9302
9304
  seed: _size2
9303
9305
  };
9304
- function randomSecretKey(seed = randomBytes32(lengths.seed)) {
9306
+ function randomSecretKey(seed = randomBytes42(lengths.seed)) {
9305
9307
  return _abytes2(seed, lengths.seed, "seed");
9306
9308
  }
9307
9309
  function keygen(seed) {
@@ -10680,7 +10682,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
10680
10682
  bits2int: "function",
10681
10683
  bits2int_modN: "function"
10682
10684
  });
10683
- const randomBytes32 = ecdsaOpts.randomBytes || randomBytes2;
10685
+ const randomBytes42 = ecdsaOpts.randomBytes || randomBytes2;
10684
10686
  const hmac4 = ecdsaOpts.hmac || ((key, ...msgs) => hmac2(hash, key, concatBytes2(...msgs)));
10685
10687
  const { Fp: Fp3, Fn: Fn3 } = Point;
10686
10688
  const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn3;
@@ -10835,7 +10837,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
10835
10837
  const d2 = _normFnElement(Fn3, privateKey);
10836
10838
  const seedArgs = [int2octets(d2), int2octets(h1int)];
10837
10839
  if (extraEntropy != null && extraEntropy !== false) {
10838
- const e = extraEntropy === true ? randomBytes32(lengths.secretKey) : extraEntropy;
10840
+ const e = extraEntropy === true ? randomBytes42(lengths.secretKey) : extraEntropy;
10839
10841
  seedArgs.push(ensureBytes("extraEntropy", e));
10840
10842
  }
10841
10843
  const seed = concatBytes2(...seedArgs);
@@ -11713,11 +11715,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
11713
11715
  return null;
11714
11716
  }
11715
11717
  function ownIdentity() {
11716
- const v2 = true ? "0.23.52" : FALLBACK;
11718
+ const v2 = true ? "0.23.54" : FALLBACK;
11717
11719
  return `${PACKAGE}@${v2}`;
11718
11720
  }
11719
11721
  function buildSha() {
11720
- const raw = true ? "d7143c3" : "";
11722
+ const raw = true ? "429977f" : "";
11721
11723
  const cleaned = (raw ?? "").trim();
11722
11724
  return !cleaned || cleaned === "unknown" ? null : cleaned;
11723
11725
  }
@@ -11869,13 +11871,18 @@ async function enrollDevice(apiUrl, inviteToken, identityPkHex, ephemeralPkHex,
11869
11871
  return res.json();
11870
11872
  }
11871
11873
  async function pollDeviceStatus(apiUrl, deviceId) {
11872
- const res = await fetch(`${apiUrl}/api/v1/devices/${deviceId}/status`);
11874
+ const res = await fetch(`${apiUrl}/api/v1/devices/${deviceId}/status`, {
11875
+ signal: AbortSignal.timeout(1e4)
11876
+ });
11873
11877
  if (res.status === 429) {
11874
11878
  return { device_id: deviceId, status: "PENDING", fingerprint: "", rateLimited: true };
11875
11879
  }
11876
11880
  if (!res.ok) {
11877
11881
  const detail = await res.text();
11878
- throw new Error(`Status poll failed (${res.status}): ${detail}`);
11882
+ const err = new Error(`Status poll failed (${res.status}): ${detail}`);
11883
+ err.httpStatus = res.status;
11884
+ err.body = detail;
11885
+ throw err;
11879
11886
  }
11880
11887
  return res.json();
11881
11888
  }
@@ -11925,9 +11932,10 @@ function a2aChannelSignature(channels) {
11925
11932
  })).sort((a2, b2) => (a2.id ?? "").localeCompare(b2.id ?? ""))
11926
11933
  );
11927
11934
  }
11928
- function mlsMembershipFromStatus(status) {
11935
+ function mlsMembershipFromStatus(status, detail) {
11929
11936
  if (status === 200) return true;
11930
- if (status === 403 || status === 404) return false;
11937
+ if (status === 404) return false;
11938
+ if (status === 403 && detail === NOT_A_MEMBER_DETAIL) return false;
11931
11939
  return null;
11932
11940
  }
11933
11941
  function sanitizeError(error2) {
@@ -12495,6 +12503,91 @@ function _resetCompatCacheForTest() {
12495
12503
  _agentEventFn = null;
12496
12504
  _transcriptFn = null;
12497
12505
  }
12506
+ function safeErrorKind(value) {
12507
+ if (typeof value !== "string") return UNCLASSIFIED_ERROR;
12508
+ if (KNOWN_CODES.has(value)) return value;
12509
+ if (!CLASS_NAME_RE.test(value)) return UNCLASSIFIED_ERROR;
12510
+ if ((value.match(/[0-9]/g) ?? []).length > 3) return UNCLASSIFIED_ERROR;
12511
+ return value;
12512
+ }
12513
+ function codeForText(text) {
12514
+ const t2 = text.replace(/^[A-Za-z]*Error: /, "");
12515
+ for (const [re2, code] of ERROR_TEXT_CODES) if (re2.test(t2)) return code;
12516
+ return void 0;
12517
+ }
12518
+ function classifyToolError(err) {
12519
+ try {
12520
+ if (err instanceof Error) {
12521
+ return codeForText(err.message) ?? safeErrorKind(err.constructor?.name);
12522
+ }
12523
+ if (typeof err === "string") return codeForText(err) ?? UNCLASSIFIED_ERROR;
12524
+ } catch {
12525
+ }
12526
+ return UNCLASSIFIED_ERROR;
12527
+ }
12528
+ function classifyDeliveryReceipt(receipt) {
12529
+ if (!receipt) return "no_receipt";
12530
+ if (receipt.ambiguous) return "ambiguous_target";
12531
+ if (typeof receipt.error === "string") return codeForText(receipt.error) ?? "delivery_failed";
12532
+ return "delivery_failed";
12533
+ }
12534
+ function currentToolConversation() {
12535
+ const store = _conversation.getStore();
12536
+ if (!store || store.ended) return { kind: "unknown" };
12537
+ return store.conversation;
12538
+ }
12539
+ function conversationForTarget(target, opts = {}) {
12540
+ if (typeof opts.conversationId === "string" && opts.conversationId) {
12541
+ return { kind: "direct", id: opts.conversationId };
12542
+ }
12543
+ const turn = currentToolConversation();
12544
+ if (!target || target.kind === "context") return turn;
12545
+ switch (target.kind) {
12546
+ case "room":
12547
+ return target.roomId ? { kind: "room", id: target.roomId } : { kind: "unknown" };
12548
+ case "owner":
12549
+ return turn.kind === "direct" ? turn : { kind: "unknown" };
12550
+ default:
12551
+ return { kind: "unknown" };
12552
+ }
12553
+ }
12554
+ function buildToolInvokeSpan(report) {
12555
+ const isError = report.outcome === "error";
12556
+ const outcome = isError ? "error" : report.outcome === "cancelled" ? "cancelled" : "success";
12557
+ const durationMs = Math.max(0, Math.round(Number(report.durationMs) || 0));
12558
+ const endTime = report.endTime ?? Date.now();
12559
+ const conv = report.conversation ?? currentToolConversation();
12560
+ const kind = conv.kind === "room" || conv.kind === "direct" ? conv.kind : "unknown";
12561
+ const attributes = {
12562
+ "tool.name": TOOL_NAME_RE.test(report.toolName) ? report.toolName : "unknown",
12563
+ "tool.outcome": outcome,
12564
+ "av.conversation_kind": kind,
12565
+ "tool.duration_ms": durationMs
12566
+ };
12567
+ if (isError) attributes["tool.error_kind"] = safeErrorKind(report.errorKind);
12568
+ if (kind !== "unknown" && typeof conv.id === "string" && conv.id) {
12569
+ attributes["av.conversation_id"] = conv.id.slice(0, 64);
12570
+ }
12571
+ return {
12572
+ traceId: randomBytes3(16).toString("hex"),
12573
+ spanId: randomBytes3(8).toString("hex"),
12574
+ name: TOOL_INVOKE_SPAN_NAME,
12575
+ kind: "internal",
12576
+ startTime: endTime - durationMs,
12577
+ endTime,
12578
+ attributes,
12579
+ // OTLP codes: 1 = ok, 2 = error (the backend stores "ok" / "error").
12580
+ // A cancellation is not a problem: OK status, outcome "cancelled".
12581
+ status: { code: isError ? 2 : 1 }
12582
+ };
12583
+ }
12584
+ function reportToolInvoke(sink, report) {
12585
+ try {
12586
+ if (!sink || typeof sink.reportCustomSpan !== "function") return;
12587
+ sink.reportCustomSpan(buildToolInvokeSpan(report));
12588
+ } catch {
12589
+ }
12590
+ }
12498
12591
  function ownerRoutingFrom(parsed) {
12499
12592
  const out = {};
12500
12593
  if (parsed.conversation_id !== void 0) {
@@ -12519,6 +12612,34 @@ function statusOf(receipt) {
12519
12612
  return receipt.ok ? 200 : 500;
12520
12613
  }
12521
12614
  async function handleSendRequest(parsed, channel) {
12615
+ const startedAt = Date.now();
12616
+ const result = await _handleSendRequest(parsed, channel);
12617
+ try {
12618
+ const body = result.body;
12619
+ const failed = body?.ok !== true;
12620
+ reportToolInvoke(channel.telemetry, {
12621
+ toolName: "agentvault_send",
12622
+ outcome: failed ? "error" : "success",
12623
+ errorKind: !failed ? void 0 : result.status === 400 ? "invalid_request" : result.status === 409 ? "ambiguous_target" : classifyDeliveryReceipt(body),
12624
+ durationMs: Date.now() - startedAt,
12625
+ conversation: sendConversation(parsed)
12626
+ });
12627
+ } catch {
12628
+ }
12629
+ return result;
12630
+ }
12631
+ function sendConversation(parsed) {
12632
+ const str = (v2) => typeof v2 === "string" && v2 ? v2 : void 0;
12633
+ if (str(parsed.hub_address) ?? str(parsed.a2a_address) ?? str(parsed.a2aAddress) ?? str(parsed.channel_id)) {
12634
+ return { kind: "unknown" };
12635
+ }
12636
+ const roomId = str(parsed.room_id);
12637
+ if (roomId) return conversationForTarget({ kind: "room", roomId });
12638
+ if (parsed.target === "context") return conversationForTarget({ kind: "context" });
12639
+ if (parsed.audience === "everyone") return { kind: "unknown" };
12640
+ return conversationForTarget({ kind: "owner" }, { conversationId: str(parsed.conversation_id) });
12641
+ }
12642
+ async function _handleSendRequest(parsed, channel) {
12522
12643
  const text = parsed.text;
12523
12644
  if (!text || typeof text !== "string") {
12524
12645
  return { status: 400, body: { ok: false, error: "Missing 'text' field" } };
@@ -17681,7 +17802,7 @@ function armSseKeepAlive(intervalMs, onTick) {
17681
17802
  timer.unref?.();
17682
17803
  return timer;
17683
17804
  }
17684
- var __create, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf, __hasOwnProp, __esm2, __commonJS, __export2, __copyProps, __toESM, SENTINEL, WRAPPERS, INSTRUCTION, init_abstention, AMBIGUOUS_OWNER_ERROR, init_owner_routing, init_envelope_text, init_mls_commit_classify, MENTION_RE, BROADCAST_NAMES, init_room_protocol, __filename, __dirname, url, path, Module, Module, root, window_, crypto_, randomValuesStandard, crypto2, 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, atitle, aobject, aopts, isLE, swap8IfBE, swap32IfBE, hasHexBuiltin, hexes, oidNist, init_utils, BSIGMA, init_blake, U32_MASK64, _32n, fromNumH, fromNumL, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add3L, add3H, add4L, add4H, add5L, add5H, init_u64, HashMD, SHA256_IV, SHA384_IV, SHA512_IV, init_md, B2B_IV, BBUF, _BLAKE2, _BLAKE2b, blake2b, init_blake2, CROCKFORD2, SALT_BYTES2, NONCE_BYTES2, KEY_BYTES2, TAG_BYTES, ENVELOPE_OVERHEAD, AAD_PREFIX, UUID_RE, UUID_V4_RE, DIGEST_ID_RE, TIMESTAMP_RE, encoder, decoder, HISTORY_MAGIC, HISTORY_ARCHIVE_VERSION, HISTORY_MAX_ENTRIES, HISTORY_MAX_BLOB_BYTES, HISTORY_KDF_OPSLIMIT, HISTORY_KDF_MEMLIMIT, HistoryEntryTooLargeError, init_history_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, isLE2, init_noble, init_hash2, _HMAC, hmac, init_hmac, init_md2, U32_MASK642, _32n2, init_u642, 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, isLE3, wrapCipher, init_utils2, 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, crypto3, init_cryptoNode, isLE4, swap32IfBE3, hasHexBuiltin2, hexes2, asciis, Hash, init_utils3, HashMD3, SHA256_IV3, SHA384_IV3, SHA512_IV3, init_md3, U32_MASK643, _32n3, shrSH3, shrSL3, rotrSH3, rotrSL3, rotrBH3, rotrBL3, rotlSH2, rotlSL2, rotlBH2, rotlBL2, add3L3, add3H3, add4L3, add4H3, add5L3, add5H3, init_u643, 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_utils4, _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, 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_BYTES3, init_owner_sync, init_mls_delivery_order, init_mls_presend_epoch, dist_exports, 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, ACTIVATION_DOMAIN, UUID_RE2, init_transport2, A2ALogGate, init_a2a_log_gate, init_mls_membership_probe, FIRST_DIRTY_DELAY_MS, RETRY_BASE_DELAYS_MS, MAX_RETRY_DELAY_MS, JITTER_FRACTION, HistoryBackupScheduler, init_history_backup_scheduler, FILE_MODE2, init_history_recovery_file, TENANT_ID_PATTERN, DIR_MODE2, FILE_MODE3, HISTORY_RECOVERY_VERIFY_TIMEOUT_MS, VERIFY_TIMEOUT_MESSAGE, HistoryRecoveryVerificationTimeoutError, init_history_recovery_code, ACTIONS, init_decision_reply, history_backup_client_exports, HISTORY_RESTORE_TIMEOUT_MS, HISTORY_RESTORE_RESPONSE_MAX_BYTES, HISTORY_ENVELOPE_MIN_BYTES, HISTORY_AAD_PREFIX, UUID_RE3, GENERATION_RESPONSE_KEYS, utf8Encoder, utf8Decoder, HistoryBackupClient, init_history_backup_client, 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, UUID_RE4, RECONNECT_MAX_MS, PENDING_POLL_INTERVAL_MS, HISTORY_RESTORE_TIMEOUT_MS2, HISTORY_UPLOAD_TIMEOUT_MS, CANONICAL_TIMESTAMP_RE, OUTBOUND_DEDUPE_WINDOW_MS, OUTBOUND_DEDUPE_MAX_SUPPRESS_MS, OUTBOUND_DEDUPE_MAX, OUTBOUND_DEDUPE_TYPES, RETRY_CANDIDATE_TTL_MS, RETRY_CANDIDATE_MAX, _turnConversation, PERSON_INVOLVED_WINDOW_MS, ATTESTED_INBOUND_MAX, UNMAPPED_RECONCILE_COOLDOWN_MS, TOPIC_ID_RE, ROOM_FULFIL_COOLDOWN_MS, 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, OPENROUTER_PRICING, init_llm_pricing_openrouter, LEGACY_PRICING, PRICING, init_llm_cost, traceStore, init_fetch_interceptor, init_tool_audit, init_harness_compat, managedRoutesRequested, 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, util_exports, Cached, EVALUATING, captureStackTrace, allowsEval, getParsedType2, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES, highSurrogate, Class, installing, broke, breaker, CONSTANT_CATCH, init_util2, _a2, _zodDesc, _E, $ZodAsyncError, $ZodEncodeError, globalConfig, init_core, _messageDesc, _issuesDesc, _installedToString, initializer, $ZodError, $ZodRealError, init_errors3, _parse, parse, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, COMPILE_INVALID, COMPILE_FALLBACK, validate, validateAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync, init_parse, cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, httpProtocol, e164, dateSource, date, anyString, integer, number, boolean, _null, lowercase, uppercase, init_regexes, $ZodCheck, _whenHasLength, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckOverwrite, init_checks, Doc, init_doc, version, init_versions, $ZodType, toStandardResult, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT, URL_UNPARSEABLE, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodUnknown, $ZodNever, arraySize, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodCustom, init_schemas, $ZodCyclicError, STATE, NO_ISSUES, recursive, NONE, ASSUMED, PROVEN, handoff, open4, memo, init_memoizer, error, init_en2, init_locales, _a3, $ZodRegistry, globalRegistry, init_registries, init_compile, init_api, FOLDABLE_KEYS, UNION_KEYS, createToJSONSchemaMethod, createStandardJSONSchemaMethod, init_to_json_schema, narrowMin, narrowMax, narrowBoth, addDivisor, addPattern, intersectMime, setFormat, minContributor, maxContributor, formatContributor, contributors, formatMap, exactPatterns, exactPattern, 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, pendingRecords, recordProcessor, nullableProcessor, nonoptionalProcessor, UNREPRESENTABLE_DEFAULT, defaultProcessor, prefaultProcessor, catchProcessor, pipeProcessor, readonlyProcessor, promiseProcessor, optionalProcessor, lazyProcessor, allProcessors, init_json_schema_processors, 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, init_checks3, _installedErrorProtos, initializer2, ZodRealError, init_errors4, parse2, parseAsync2, safeParse3, safeParseAsync3, encode3, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2, init_parse3, ZodType2, _ZodString, ZodString2, ZodStringFormat, ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber2, ZodNumberFormat, ZodBoolean2, ZodNull2, ZodUnknown2, ZodNever2, ZodArray2, ZodObject2, ZodUnion2, ZodDiscriminatedUnion2, ZodIntersection2, ZodRecord2, ZodEnum2, ZodLiteral2, ZodTransform, ZodOptional2, ZodExactOptional, ZodNullable2, ZodDefault2, ZodPrefault, ZodNonOptional, ZodCatch2, ZodPipe, ZodPreprocess, ZodReadonly2, ZodCustom, init_schemas3, ZodFirstPartyTypeKind2, init_compat, iso_exports2, init_iso2, 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, require_content_type, import_content_type, init_mediaType, DEFAULT_MAX_REQUEST_BODY_SIZE, MAX_BATCH_SIZE, init_requestBody, DEFAULT_SSE_KEEP_ALIVE_MS, MAX_TIMER_DELAY_MS, init_sseKeepAlive, 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;
17805
+ var __create, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf, __hasOwnProp, __esm2, __commonJS, __export2, __copyProps, __toESM, SENTINEL, WRAPPERS, INSTRUCTION, init_abstention, AMBIGUOUS_OWNER_ERROR, init_owner_routing, init_envelope_text, init_mls_commit_classify, MENTION_RE, BROADCAST_NAMES, init_room_protocol, __filename, __dirname, url, path, Module, Module, root, window_, crypto_, randomValuesStandard, crypto2, 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, atitle, aobject, aopts, isLE, swap8IfBE, swap32IfBE, hasHexBuiltin, hexes, oidNist, init_utils, BSIGMA, init_blake, U32_MASK64, _32n, fromNumH, fromNumL, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add3L, add3H, add4L, add4H, add5L, add5H, init_u64, HashMD, SHA256_IV, SHA384_IV, SHA512_IV, init_md, B2B_IV, BBUF, _BLAKE2, _BLAKE2b, blake2b, init_blake2, CROCKFORD2, SALT_BYTES2, NONCE_BYTES2, KEY_BYTES2, TAG_BYTES, ENVELOPE_OVERHEAD, AAD_PREFIX, UUID_RE, UUID_V4_RE, DIGEST_ID_RE, TIMESTAMP_RE, encoder, decoder, HISTORY_MAGIC, HISTORY_ARCHIVE_VERSION, HISTORY_MAX_ENTRIES, HISTORY_MAX_BLOB_BYTES, HISTORY_KDF_OPSLIMIT, HISTORY_KDF_MEMLIMIT, HistoryEntryTooLargeError, init_history_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, isLE2, init_noble, init_hash2, _HMAC, hmac, init_hmac, init_md2, U32_MASK642, _32n2, init_u642, 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, isLE3, wrapCipher, init_utils2, 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, crypto3, init_cryptoNode, isLE4, swap32IfBE3, hasHexBuiltin2, hexes2, asciis, Hash, init_utils3, HashMD3, SHA256_IV3, SHA384_IV3, SHA512_IV3, init_md3, U32_MASK643, _32n3, shrSH3, shrSL3, rotrSH3, rotrSL3, rotrBH3, rotrBL3, rotlSH2, rotlSL2, rotlBH2, rotlBL2, add3L3, add3H3, add4L3, add4H3, add5L3, add5H3, init_u643, 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_utils4, _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, 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_BYTES3, init_owner_sync, init_mls_delivery_order, init_mls_presend_epoch, dist_exports, 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, ACTIVATION_DOMAIN, UUID_RE2, init_transport2, A2ALogGate, init_a2a_log_gate, NOT_A_MEMBER_DETAIL, init_mls_membership_probe, FIRST_DIRTY_DELAY_MS, RETRY_BASE_DELAYS_MS, MAX_RETRY_DELAY_MS, JITTER_FRACTION, HistoryBackupScheduler, init_history_backup_scheduler, FILE_MODE2, init_history_recovery_file, TENANT_ID_PATTERN, DIR_MODE2, FILE_MODE3, HISTORY_RECOVERY_VERIFY_TIMEOUT_MS, VERIFY_TIMEOUT_MESSAGE, HistoryRecoveryVerificationTimeoutError, init_history_recovery_code, ACTIONS, init_decision_reply, KP_BACKOFF_INITIAL_MS, KP_BACKOFF_MAX_MS, KP_RACE_RETRY_MS, KP_RACE_RETRY_LIMIT, consoleLogger, short, WelcomeKeyPackageBackoff, init_welcome_kp_backoff, history_backup_client_exports, HISTORY_RESTORE_TIMEOUT_MS, HISTORY_RESTORE_RESPONSE_MAX_BYTES, HISTORY_ENVELOPE_MIN_BYTES, HISTORY_AAD_PREFIX, UUID_RE3, GENERATION_RESPONSE_KEYS, utf8Encoder, utf8Decoder, HistoryBackupClient, init_history_backup_client, openclaw_compat_exports, defaultImporter, HEARTBEAT_CANDIDATES, AGENT_EVENT_CANDIDATES, TRANSCRIPT_CANDIDATES, _heartbeatFn, _agentEventFn, _transcriptFn, init_openclaw_compat, TOOL_INVOKE_SPAN_NAME, UNCLASSIFIED_ERROR, KNOWN_TOOL_ERROR_CODES, KNOWN_CODES, CLASS_NAME_RE, TOOL_NAME_RE, ERROR_TEXT_CODES, _conversation, init_tool_telemetry, 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, UUID_RE4, RECONNECT_MAX_MS, PENDING_POLL_INTERVAL_MS, HISTORY_RESTORE_TIMEOUT_MS2, HISTORY_UPLOAD_TIMEOUT_MS, CANONICAL_TIMESTAMP_RE, OUTBOUND_DEDUPE_WINDOW_MS, OUTBOUND_DEDUPE_MAX_SUPPRESS_MS, OUTBOUND_DEDUPE_MAX, OUTBOUND_DEDUPE_TYPES, RETRY_CANDIDATE_TTL_MS, RETRY_CANDIDATE_MAX, _turnConversation, PERSON_INVOLVED_WINDOW_MS, ATTESTED_INBOUND_MAX, UNMAPPED_RECONCILE_COOLDOWN_MS, TOPIC_ID_RE, ROOM_FULFIL_COOLDOWN_MS, 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, OPENROUTER_PRICING, init_llm_pricing_openrouter, LEGACY_PRICING, PRICING, init_llm_cost, traceStore, init_fetch_interceptor, init_tool_audit, init_harness_compat, managedRoutesRequested, 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, util_exports, Cached, EVALUATING, captureStackTrace, allowsEval, getParsedType2, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES, highSurrogate, Class, installing, broke, breaker, CONSTANT_CATCH, init_util2, _a2, _zodDesc, _E, $ZodAsyncError, $ZodEncodeError, globalConfig, init_core, _messageDesc, _issuesDesc, _installedToString, initializer, $ZodError, $ZodRealError, init_errors3, _parse, parse, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, COMPILE_INVALID, COMPILE_FALLBACK, validate, validateAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync, init_parse, cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, httpProtocol, e164, dateSource, date, anyString, integer, number, boolean, _null, lowercase, uppercase, init_regexes, $ZodCheck, _whenHasLength, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckOverwrite, init_checks, Doc, init_doc, version, init_versions, $ZodType, toStandardResult, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT, URL_UNPARSEABLE, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodUnknown, $ZodNever, arraySize, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodCustom, init_schemas, $ZodCyclicError, STATE, NO_ISSUES, recursive, NONE, ASSUMED, PROVEN, handoff, open4, memo, init_memoizer, error, init_en2, init_locales, _a3, $ZodRegistry, globalRegistry, init_registries, init_compile, init_api, FOLDABLE_KEYS, UNION_KEYS, createToJSONSchemaMethod, createStandardJSONSchemaMethod, init_to_json_schema, narrowMin, narrowMax, narrowBoth, addDivisor, addPattern, intersectMime, setFormat, minContributor, maxContributor, formatContributor, contributors, formatMap, exactPatterns, exactPattern, 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, pendingRecords, recordProcessor, nullableProcessor, nonoptionalProcessor, UNREPRESENTABLE_DEFAULT, defaultProcessor, prefaultProcessor, catchProcessor, pipeProcessor, readonlyProcessor, promiseProcessor, optionalProcessor, lazyProcessor, allProcessors, init_json_schema_processors, 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, init_checks3, _installedErrorProtos, initializer2, ZodRealError, init_errors4, parse2, parseAsync2, safeParse3, safeParseAsync3, encode3, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2, init_parse3, ZodType2, _ZodString, ZodString2, ZodStringFormat, ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber2, ZodNumberFormat, ZodBoolean2, ZodNull2, ZodUnknown2, ZodNever2, ZodArray2, ZodObject2, ZodUnion2, ZodDiscriminatedUnion2, ZodIntersection2, ZodRecord2, ZodEnum2, ZodLiteral2, ZodTransform, ZodOptional2, ZodExactOptional, ZodNullable2, ZodDefault2, ZodPrefault, ZodNonOptional, ZodCatch2, ZodPipe, ZodPreprocess, ZodReadonly2, ZodCustom, init_schemas3, ZodFirstPartyTypeKind2, init_compat, iso_exports2, init_iso2, 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, require_content_type, import_content_type, init_mediaType, DEFAULT_MAX_REQUEST_BODY_SIZE, MAX_BATCH_SIZE, init_requestBody, DEFAULT_SSE_KEEP_ALIVE_MS, MAX_TIMER_DELAY_MS, init_sseKeepAlive, 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;
17685
17806
  var init_dist = __esm({
17686
17807
  async "../plugin/dist/index.js"() {
17687
17808
  "use strict";
@@ -70153,6 +70274,7 @@ var init_dist = __esm({
70153
70274
  init_mls_membership_probe = __esm2({
70154
70275
  "src/mls-membership-probe.ts"() {
70155
70276
  "use strict";
70277
+ NOT_A_MEMBER_DETAIL = "Not authorized for this MLS group";
70156
70278
  }
70157
70279
  });
70158
70280
  init_history_backup_scheduler = __esm2({
@@ -70271,6 +70393,119 @@ var init_dist = __esm({
70271
70393
  ACTIONS = /* @__PURE__ */ new Set(["approve", "deny", "defer", "cancel"]);
70272
70394
  }
70273
70395
  });
70396
+ init_welcome_kp_backoff = __esm2({
70397
+ "src/welcome-kp-backoff.ts"() {
70398
+ "use strict";
70399
+ KP_BACKOFF_INITIAL_MS = 10 * 6e4;
70400
+ KP_BACKOFF_MAX_MS = 60 * 6e4;
70401
+ KP_RACE_RETRY_MS = 6e4;
70402
+ KP_RACE_RETRY_LIMIT = 3;
70403
+ consoleLogger = {
70404
+ warn: (m2) => console.warn(m2),
70405
+ info: (m2) => console.log(m2)
70406
+ };
70407
+ short = (id) => id.slice(0, 8);
70408
+ WelcomeKeyPackageBackoff = class {
70409
+ constructor(log = consoleLogger) {
70410
+ this.log = log;
70411
+ }
70412
+ log;
70413
+ entries = /* @__PURE__ */ new Map();
70414
+ pendingSig = /* @__PURE__ */ new Map();
70415
+ failing = /* @__PURE__ */ new Set();
70416
+ key(groupId, deviceId) {
70417
+ return `${groupId}:${deviceId}`;
70418
+ }
70419
+ /**
70420
+ * Record this pull's pending list for a group. Returns true when the set of
70421
+ * requests differs from the previous pull's — the caller logs its "N pending"
70422
+ * line only then. Backoffs for devices whose request is gone are dropped.
70423
+ */
70424
+ observePending(groupId, pending) {
70425
+ const sig = pending.map((r2) => r2.id).sort().join(",");
70426
+ const changed = this.pendingSig.get(groupId) !== sig;
70427
+ if (pending.length === 0) this.pendingSig.delete(groupId);
70428
+ else this.pendingSig.set(groupId, sig);
70429
+ const live = new Set(pending.map((r2) => r2.requesting_device_id));
70430
+ const prefix = `${groupId}:`;
70431
+ for (const k2 of [...this.entries.keys()]) {
70432
+ if (k2.startsWith(prefix) && !live.has(k2.slice(prefix.length))) this.entries.delete(k2);
70433
+ }
70434
+ return changed && pending.length > 0;
70435
+ }
70436
+ /** Should this pull ask the batch for this device's KeyPackage? */
70437
+ shouldAsk(groupId, deviceId, available, label, now = Date.now()) {
70438
+ const k2 = this.key(groupId, deviceId);
70439
+ const entry = this.entries.get(k2);
70440
+ if (available === false) {
70441
+ if (!entry) {
70442
+ this.entries.set(k2, { untilMs: now + KP_BACKOFF_INITIAL_MS, delayMs: KP_BACKOFF_INITIAL_MS, lastAvailable: false, raceRetries: 0 });
70443
+ this.log.warn(
70444
+ `[SecureChannel] No KeyPackage for ${short(deviceId)} in ${label} \u2014 waiting for the device to come back online; not asking again until it publishes one`
70445
+ );
70446
+ } else {
70447
+ entry.lastAvailable = false;
70448
+ }
70449
+ return false;
70450
+ }
70451
+ if (!entry) return true;
70452
+ if (available === true && entry.lastAvailable === false) return true;
70453
+ return now >= entry.untilMs;
70454
+ }
70455
+ /** The outcome of an ask. `found` = the batch returned a KeyPackage. */
70456
+ recordKeyPackage(groupId, deviceId, found, available, label, now = Date.now()) {
70457
+ const k2 = this.key(groupId, deviceId);
70458
+ const entry = this.entries.get(k2);
70459
+ if (found) {
70460
+ if (entry) {
70461
+ this.entries.delete(k2);
70462
+ this.log.info(`[SecureChannel] KeyPackage for ${short(deviceId)} is available again in ${label} \u2014 admitting`);
70463
+ }
70464
+ return;
70465
+ }
70466
+ const raced = available === true && (entry?.raceRetries ?? 0) < KP_RACE_RETRY_LIMIT;
70467
+ if (!entry) {
70468
+ if (raced) {
70469
+ this.entries.set(k2, { untilMs: now + KP_RACE_RETRY_MS, delayMs: 0, lastAvailable: available, raceRetries: 1 });
70470
+ this.log.warn(
70471
+ `[SecureChannel] No KeyPackage for ${short(deviceId)} in ${label} although the server listed one (claimed elsewhere?) \u2014 retrying in ${KP_RACE_RETRY_MS / 1e3} s`
70472
+ );
70473
+ return;
70474
+ }
70475
+ this.entries.set(k2, { untilMs: now + KP_BACKOFF_INITIAL_MS, delayMs: KP_BACKOFF_INITIAL_MS, lastAvailable: available, raceRetries: 0 });
70476
+ this.log.warn(
70477
+ `[SecureChannel] No KeyPackage for ${short(deviceId)} in ${label}, skipping \u2014 not asking again for ${KP_BACKOFF_INITIAL_MS / 6e4} min (the device has to come back online)`
70478
+ );
70479
+ return;
70480
+ }
70481
+ entry.lastAvailable = available;
70482
+ if (raced) {
70483
+ entry.raceRetries += 1;
70484
+ entry.untilMs = now + KP_RACE_RETRY_MS;
70485
+ return;
70486
+ }
70487
+ entry.raceRetries = available === true ? entry.raceRetries : 0;
70488
+ entry.delayMs = entry.delayMs === 0 ? KP_BACKOFF_INITIAL_MS : Math.min(entry.delayMs * 2, KP_BACKOFF_MAX_MS);
70489
+ entry.untilMs = now + entry.delayMs;
70490
+ }
70491
+ /** A non-OK response for `scope`: warn once until it recovers. */
70492
+ noteFetchFailure(scope, status) {
70493
+ if (this.failing.has(scope)) return;
70494
+ this.failing.add(scope);
70495
+ this.log.warn(`[SecureChannel] ${scope} failed (${status}) \u2014 will retry each pull; logging once until it recovers`);
70496
+ }
70497
+ noteFetchOk(scope) {
70498
+ if (!this.failing.delete(scope)) return;
70499
+ this.log.info(`[SecureChannel] ${scope} recovered`);
70500
+ }
70501
+ /** Test/diagnostic view. */
70502
+ backoffFor(groupId, deviceId) {
70503
+ const e = this.entries.get(this.key(groupId, deviceId));
70504
+ return e ? { untilMs: e.untilMs, delayMs: e.delayMs } : void 0;
70505
+ }
70506
+ };
70507
+ }
70508
+ });
70274
70509
  history_backup_client_exports = {};
70275
70510
  __export2(history_backup_client_exports, {
70276
70511
  HISTORY_RESTORE_RESPONSE_MAX_BYTES: () => HISTORY_RESTORE_RESPONSE_MAX_BYTES,
@@ -70558,6 +70793,55 @@ var init_dist = __esm({
70558
70793
  _transcriptFn = null;
70559
70794
  }
70560
70795
  });
70796
+ init_tool_telemetry = __esm2({
70797
+ "src/tool-telemetry.ts"() {
70798
+ "use strict";
70799
+ TOOL_INVOKE_SPAN_NAME = "ai.agent.tool.invoke";
70800
+ UNCLASSIFIED_ERROR = "unclassified";
70801
+ KNOWN_TOOL_ERROR_CODES = [
70802
+ "relay_not_connected",
70803
+ "mls_group_not_initialized",
70804
+ "mls_encrypt_failed",
70805
+ "room_not_found",
70806
+ "a2a_channel_not_found",
70807
+ "channel_not_ready",
70808
+ "channel_not_started",
70809
+ "no_active_sessions",
70810
+ "no_conversation_ready",
70811
+ "blocked_by_policy",
70812
+ "unknown_target",
70813
+ "unsupported_destination",
70814
+ "delivery_timeout",
70815
+ "delivery_cancelled",
70816
+ "delivery_failed",
70817
+ "ambiguous_target",
70818
+ "no_receipt",
70819
+ "invalid_request",
70820
+ UNCLASSIFIED_ERROR
70821
+ ];
70822
+ KNOWN_CODES = new Set(KNOWN_TOOL_ERROR_CODES);
70823
+ CLASS_NAME_RE = /^(?:[A-Za-z][A-Za-z0-9_]{0,47})?(?:Error|Exception)$/;
70824
+ TOOL_NAME_RE = /^[A-Za-z0-9_.:-]{1,64}$/;
70825
+ ERROR_TEXT_CODES = [
70826
+ [/relay socket is not open/, "relay_not_connected"],
70827
+ [/has no initialized MLS group/, "mls_group_not_initialized"],
70828
+ [/^MLS encrypt failed/, "mls_encrypt_failed"],
70829
+ [/^Room .+ not found$/, "room_not_found"],
70830
+ [/^No A2A channel found|^A2A channel .+ not found$/, "a2a_channel_not_found"],
70831
+ [/^Channel is not ready$|^Channel is in \w+ state$/, "channel_not_ready"],
70832
+ [/^AgentVault channel not connected$|^Channel not started$/, "channel_not_started"],
70833
+ [/^No active sessions$/, "no_active_sessions"],
70834
+ [/^No conversation is ready to receive/, "no_conversation_ready"],
70835
+ [/^Message blocked by scan rule/, "blocked_by_policy"],
70836
+ [/^Unknown target kind$/, "unknown_target"],
70837
+ [/can only be sent to owner|cannot be sent to A2A targets/, "unsupported_destination"],
70838
+ [/^Delivery timed out$/, "delivery_timeout"],
70839
+ [/^Delivery cancelled$/, "delivery_cancelled"],
70840
+ [/^Delivery failed$/, "delivery_failed"]
70841
+ ];
70842
+ _conversation = new AsyncLocalStorage();
70843
+ }
70844
+ });
70561
70845
  http_handlers_exports = {};
70562
70846
  __export2(http_handlers_exports, {
70563
70847
  handleActionRequest: () => handleActionRequest,
@@ -70572,6 +70856,7 @@ var init_dist = __esm({
70572
70856
  "src/http-handlers.ts"() {
70573
70857
  "use strict";
70574
70858
  init_owner_routing();
70859
+ init_tool_telemetry();
70575
70860
  }
70576
70861
  });
70577
70862
  mcp_proxy_helpers_exports = {};
@@ -70621,6 +70906,7 @@ var init_dist = __esm({
70621
70906
  init_history_backup_scheduler();
70622
70907
  await init_history_recovery_code();
70623
70908
  init_decision_reply();
70909
+ init_welcome_kp_backoff();
70624
70910
  ROOM_AGENT_TYPES = /* @__PURE__ */ new Set([
70625
70911
  "message",
70626
70912
  "text",
@@ -70651,7 +70937,7 @@ var init_dist = __esm({
70651
70937
  OUTBOUND_DEDUPE_TYPES = /* @__PURE__ */ new Set(["text", "status_alert", "artifact", "attachment"]);
70652
70938
  RETRY_CANDIDATE_TTL_MS = 6e4;
70653
70939
  RETRY_CANDIDATE_MAX = 32;
70654
- _turnConversation = new AsyncLocalStorage();
70940
+ _turnConversation = new AsyncLocalStorage2();
70655
70941
  PERSON_INVOLVED_WINDOW_MS = 5 * 6e4;
70656
70942
  ATTESTED_INBOUND_MAX = 64;
70657
70943
  UNMAPPED_RECONCILE_COOLDOWN_MS = 6e4;
@@ -70731,6 +71017,8 @@ var init_dist = __esm({
70731
71017
  _mlsGroups = /* @__PURE__ */ new Map();
70732
71018
  /** `${mlsGroupId}:${deviceId}` -> last re-admit ms (#1171). */
70733
71019
  _roomFulfilCooldown = /* @__PURE__ */ new Map();
71020
+ /** #1428: per (group, device) KeyPackage backoff for the pending-Welcome pulls. */
71021
+ _welcomeKpBackoff = new WelcomeKeyPackageBackoff();
70734
71022
  /** Maps conversationId -> conversation_group_id for shared 1:1 MLS groups */
70735
71023
  _sessionGroupIds = /* @__PURE__ */ new Map();
70736
71024
  /** Consecutive MLS decrypt failure count per group key for epoch recovery. */
@@ -71016,6 +71304,119 @@ ${text}`;
71016
71304
  console.warn("[SecureChannel] failed to post auth_failed:", err);
71017
71305
  }
71018
71306
  }
71307
+ /**
71308
+ * Ask the PUBLIC status endpoint what this device is right now. Used to
71309
+ * CONFIRM a credential rejection before acting on it — a 403 on its own
71310
+ * cannot tell "revoked" from "paused by its owner" (both are non-ACTIVE to
71311
+ * get_device_auth), and treating a pause as a revoke is what removed
71312
+ * loopita's launchd service on 2026-10-25.
71313
+ *
71314
+ * Only two answers are terminal: REVOKED, and a deleted row (404 whose
71315
+ * JSON `detail` is exactly get_device_or_404's "Device not found" — any
71316
+ * other 404 is something in the way, not proof). Everything unreadable or inconclusive (network, 5xx, 429,
71317
+ * PENDING, an ACTIVE device answering 403) is `unknown`, which callers MUST
71318
+ * treat as transient: never terminal, never an uninstall, never a banner.
71319
+ */
71320
+ async _readDeviceStanding() {
71321
+ const deviceId = this._deviceId ?? this._persisted?.deviceId;
71322
+ if (!deviceId) return { kind: "unknown", why: "no device id" };
71323
+ try {
71324
+ const st = await pollDeviceStatus(this.config.apiUrl, deviceId);
71325
+ if (!st || st.rateLimited) return { kind: "unknown", why: "rate limited" };
71326
+ if (st.status === "SUSPENDED") return { kind: "suspended" };
71327
+ if (st.status === "REVOKED") return { kind: "gone", reason: "device_revoked" };
71328
+ if (st.status === "ACTIVE" || st.status === "APPROVED") return { kind: "active" };
71329
+ return { kind: "unknown", why: `status ${String(st.status)}` };
71330
+ } catch (err) {
71331
+ const e = err;
71332
+ if (e?.httpStatus === 404) {
71333
+ try {
71334
+ const parsed = JSON.parse(e.body ?? "");
71335
+ if (parsed?.detail === _SecureChannel.DEVICE_DELETED_DETAIL) {
71336
+ return { kind: "gone", reason: "device_deleted" };
71337
+ }
71338
+ } catch {
71339
+ }
71340
+ }
71341
+ return { kind: "unknown", why: err instanceof Error ? err.message : String(err) };
71342
+ }
71343
+ }
71344
+ /**
71345
+ * A credential path answered 403 (today: /auth/reissue). Confirm before
71346
+ * concluding anything:
71347
+ * - REVOKED / deleted -> terminal: re_enroll health report + `auth_failed`
71348
+ * carrying `deviceGone: true` (the ONLY verdict the
71349
+ * bridges' self-uninstall acts on).
71350
+ * - SUSPENDED -> suspended-wait (idle, keep polling, resume).
71351
+ * - anything else -> transient; nothing is emitted or reported.
71352
+ * Already paused => stay paused without another status read: the
71353
+ * suspended-wait poll owns that question and will see a later revoke.
71354
+ */
71355
+ async _confirmForbidden(source) {
71356
+ if (this._suspended) return "suspended";
71357
+ const standing = await this._readDeviceStanding();
71358
+ if (standing.kind === "gone") {
71359
+ console.warn(
71360
+ `[SecureChannel] ${source}: 403 confirmed by the status endpoint (${standing.reason}) \u2014 terminal`
71361
+ );
71362
+ this._authFailedThisSession = true;
71363
+ await this._postAuthFailedToBackend(standing.reason);
71364
+ this.emit("auth_failed", { reason: standing.reason, deviceGone: true });
71365
+ return "gone";
71366
+ }
71367
+ if (standing.kind === "suspended") {
71368
+ this._enterSuspendedWait(source);
71369
+ return "suspended";
71370
+ }
71371
+ console.warn(
71372
+ `[SecureChannel] ${source}: 403 but the device is not confirmed revoked (${standing.kind === "unknown" ? standing.why : standing.kind}) \u2014 treating as transient`
71373
+ );
71374
+ return "transient";
71375
+ }
71376
+ /** The backend's exact detail for an inactive (paused/revoked/deleted) device. */
71377
+ static INACTIVE_DEVICE_DETAIL = "Device not found or not active";
71378
+ /** get_device_or_404's exact detail — the only 404 that means "row deleted". */
71379
+ static DEVICE_DELETED_DETAIL = "Device not found";
71380
+ /**
71381
+ * After a TRANSIENT inactive-403 verdict, how long before another 403 may
71382
+ * re-read the status endpoint. Long enough that a burst cannot trip the
71383
+ * 1-per-5s limiter (which would itself read as "unknown"); short enough that
71384
+ * a revoke behind an outage is still noticed within the session (dr-evil Q1).
71385
+ */
71386
+ static INACTIVE_403_RECHECK_MS = 3e4;
71387
+ /** Read a FastAPI error `detail` without consuming the caller's body. */
71388
+ async _errorDetail(resp) {
71389
+ try {
71390
+ const body = await resp.clone().json();
71391
+ return typeof body?.detail === "string" ? body.detail : null;
71392
+ } catch {
71393
+ return null;
71394
+ }
71395
+ }
71396
+ // One confirmation per WS session, shared by every caller: a burst of 403s
71397
+ // (the open handler fires several REST calls at once) must not turn into a
71398
+ // burst of status reads against a 1-per-5s rate limit. Reset in _connect.
71399
+ _inactive403Check = null;
71400
+ _inactive403RetryAt = 0;
71401
+ /**
71402
+ * A REST call answered 403 "Device not found or not active". With the
71403
+ * companion backend change this is how EVERY inactive-device auth failure
71404
+ * arrives (401 now means a bad token only, so `_authedFetch`'s reissue never
71405
+ * runs for it). Same rule as the reissue path: confirm, then act.
71406
+ */
71407
+ _confirmInactive403(source) {
71408
+ if (this._inactive403Check) return this._inactive403Check;
71409
+ if (Date.now() < this._inactive403RetryAt) return Promise.resolve("transient");
71410
+ const check = this._confirmForbidden(source).then((verdict) => {
71411
+ if (verdict === "transient" && this._inactive403Check === check) {
71412
+ this._inactive403Check = null;
71413
+ this._inactive403RetryAt = Date.now() + _SecureChannel.INACTIVE_403_RECHECK_MS;
71414
+ }
71415
+ return verdict;
71416
+ });
71417
+ this._inactive403Check = check;
71418
+ return check;
71419
+ }
71019
71420
  /**
71020
71421
  * Proactively reissue the persisted device JWT when its remaining lifetime
71021
71422
  * is under 30 days. Called before each WebSocket connect attempt so the
@@ -71034,6 +71435,9 @@ ${text}`;
71034
71435
  * than read back off `_authFailedThisSession`, whose lifetime is reset per
71035
71436
  * connect and is easy to get subtly wrong.
71036
71437
  */
71438
+ //
71439
+ // 2026-10-25: a TRUE return now also covers "paused by its owner" (a 403
71440
+ // confirmed SUSPENDED). The caller tells the two apart by `_suspended`.
71037
71441
  async _maybeReissueDeviceJwt() {
71038
71442
  const jwt = this._persisted?.deviceJwt ?? this._deviceJwt;
71039
71443
  if (!jwt) return false;
@@ -71061,12 +71465,16 @@ ${text}`;
71061
71465
  }
71062
71466
  return false;
71063
71467
  }
71064
- if (resp.status === 401 || resp.status === 403) {
71468
+ if (resp.status === 403) {
71469
+ console.warn("[SecureChannel] reissue rejected (403); confirming device status");
71470
+ const verdict = await this._confirmForbidden("reissue_forbidden");
71471
+ return verdict !== "transient";
71472
+ }
71473
+ if (resp.status === 401) {
71065
71474
  console.warn(`[SecureChannel] reissue rejected (${resp.status}); credentials need attention`);
71066
71475
  this._authFailedThisSession = true;
71067
- const reason = resp.status === 401 ? "device_jwt_expired" : "device_revoked";
71068
- await this._postAuthFailedToBackend(reason);
71069
- this.emit("auth_failed", { reason });
71476
+ await this._postAuthFailedToBackend("device_jwt_expired");
71477
+ this.emit("auth_failed", { reason: "device_jwt_expired", deviceGone: false });
71070
71478
  return true;
71071
71479
  }
71072
71480
  console.warn(`[SecureChannel] reissue ${resp.status}; keeping current jwt`);
@@ -71125,13 +71533,17 @@ ${text}`;
71125
71533
  };
71126
71534
  resp = await fetch(url2, { ...init, headers: retryHeaders });
71127
71535
  }
71128
- } else if (reissueResp.status === 401 || reissueResp.status === 403) {
71536
+ } else if (reissueResp.status === 403) {
71537
+ await this._confirmForbidden("reissue_forbidden");
71538
+ } else if (reissueResp.status === 401) {
71129
71539
  this._authFailedThisSession = true;
71130
- const reason = reissueResp.status === 401 ? "device_jwt_expired" : "device_revoked";
71131
- await this._postAuthFailedToBackend(reason);
71132
- this.emit("auth_failed", { reason });
71540
+ await this._postAuthFailedToBackend("device_jwt_expired");
71541
+ this.emit("auth_failed", { reason: "device_jwt_expired", deviceGone: false });
71133
71542
  }
71134
71543
  }
71544
+ if (resp.status === 403 && await this._errorDetail(resp) === _SecureChannel.INACTIVE_DEVICE_DETAIL) {
71545
+ await this._confirmInactive403("rest_forbidden");
71546
+ }
71135
71547
  return resp;
71136
71548
  }
71137
71549
  get state() {
@@ -72817,7 +73229,7 @@ ${text}`;
72817
73229
  */
72818
73230
  sendActivitySpan(spanData) {
72819
73231
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
72820
- const pluginVersion = true ? "0.23.52" : "0.0.0-dev";
73232
+ const pluginVersion = true ? "0.23.54" : "0.0.0-dev";
72821
73233
  const agentName = this.config.agentName ?? "Agent";
72822
73234
  const resource = {
72823
73235
  "service.name": "agentvault-agent",
@@ -73185,15 +73597,27 @@ ${text}`;
73185
73597
  */
73186
73598
  async _quarantineOrphanedMlsGroups() {
73187
73599
  if (!this._deviceJwt) return;
73600
+ let deviceActive = null;
73601
+ const confirmDeviceActive = () => deviceActive ??= this._readDeviceStanding().then((st) => st.kind === "active");
73188
73602
  const quarantined = await quarantineOrphanedMlsState(
73189
73603
  this.config.dataDir,
73190
73604
  async (groupId) => {
73191
73605
  try {
73606
+ if (this._suspended) return null;
73192
73607
  const res = await fetch(
73193
73608
  `${this.config.apiUrl}/api/v1/mls/groups/${encodeURIComponent(groupId)}`,
73194
73609
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
73195
73610
  );
73196
- return mlsMembershipFromStatus(res.status);
73611
+ const detail = res.status === 403 ? await this._errorDetail(res) : null;
73612
+ if (detail === _SecureChannel.INACTIVE_DEVICE_DETAIL) {
73613
+ await this._confirmInactive403("mls_probe");
73614
+ return null;
73615
+ }
73616
+ const verdict = mlsMembershipFromStatus(res.status, detail);
73617
+ if (verdict === false && res.status === 403) {
73618
+ if (!await confirmDeviceActive() || this._suspended) return null;
73619
+ }
73620
+ return verdict;
73197
73621
  } catch {
73198
73622
  return null;
73199
73623
  }
@@ -74928,6 +75352,8 @@ ${text}`;
74928
75352
  async _connect() {
74929
75353
  if (this._stopped) return;
74930
75354
  this._reissueAttempted = false;
75355
+ this._inactive403Check = null;
75356
+ this._inactive403RetryAt = 0;
74931
75357
  this._authFailedThisSession = false;
74932
75358
  if (this._reconnectTimer) {
74933
75359
  clearTimeout(this._reconnectTimer);
@@ -74943,6 +75369,10 @@ ${text}`;
74943
75369
  }
74944
75370
  this._setState("connecting");
74945
75371
  if (await this._maybeReissueDeviceJwt()) {
75372
+ if (this._suspended) {
75373
+ console.log("[SecureChannel] device is paused \u2014 not connecting until it is resumed");
75374
+ return;
75375
+ }
74946
75376
  console.warn(
74947
75377
  "[SecureChannel] credentials are terminally dead \u2014 aborting connect (no WS attempt)"
74948
75378
  );
@@ -74953,16 +75383,26 @@ ${text}`;
74953
75383
  const url2 = `${wsUrl}/api/v1/ws?token=${encodeURIComponent(this._deviceJwt)}&device_id=${this._deviceId}&client_version=${encodeURIComponent(buildClientVersion(this.config.clientVersion))}`;
74954
75384
  const ws = new WebSocket(url2);
74955
75385
  this._ws = ws;
75386
+ const served = this._createServedGate();
74956
75387
  ws.on("open", async () => {
74957
75388
  try {
74958
- this._reconnectAttempt = 0;
74959
75389
  this._lastWsOpenTime = Date.now();
74960
75390
  this._startPing(ws);
74961
75391
  this._startWakeDetector();
75392
+ if (!await served.wait()) {
75393
+ console.log("[SecureChannel] connection rejected before it was served \u2014 skipping connect-time work");
75394
+ return;
75395
+ }
75396
+ const aborted2 = () => this._stopped || this._suspended || this._ws !== ws || served.rejected;
75397
+ if (aborted2()) return;
75398
+ this._reconnectAttempt = 0;
74962
75399
  this._startPendingPoll();
74963
75400
  await this._syncMissedMessages();
75401
+ if (aborted2()) return;
74964
75402
  await this._pullDrDeliveryQueue();
75403
+ if (aborted2()) return;
74965
75404
  await this._flushOutboundQueue();
75405
+ if (aborted2()) return;
74966
75406
  this._setState("ready");
74967
75407
  void this._reconcileConversationGroups().catch((err) => {
74968
75408
  console.warn("[SecureChannel] Conversation-group reconcile failed:", err);
@@ -74994,7 +75434,7 @@ ${text}`;
74994
75434
  agentVersion: this.config.agentVersion ?? "0.0.0",
74995
75435
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
74996
75436
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
74997
- pluginVersion: true ? "0.23.52" : "0.0.0-dev"
75437
+ pluginVersion: true ? "0.23.54" : "0.0.0-dev"
74998
75438
  });
74999
75439
  this._telemetryReporter.startAutoFlush(3e4);
75000
75440
  }
@@ -75002,6 +75442,7 @@ ${text}`;
75002
75442
  await this.listA2AChannels().catch((err) => {
75003
75443
  console.warn("[SecureChannel] A2A channel sync on connect failed:", err);
75004
75444
  });
75445
+ if (aborted2()) return;
75005
75446
  await this._ensureKpPoolPublished();
75006
75447
  this._startKpReplenishTimer();
75007
75448
  this._pullDeliveryQueue().catch((err) => {
@@ -75063,6 +75504,8 @@ ${text}`;
75063
75504
  this._lastWakeTick = Date.now();
75064
75505
  try {
75065
75506
  const data = JSON.parse(raw.toString());
75507
+ if (data?.event === "connection_rejected") served.markRejected();
75508
+ else served.markServed();
75066
75509
  if (data.event && data.event !== "ping" && data.event !== "typing") {
75067
75510
  const d2 = data.data ?? {};
75068
75511
  const conv = (data.conversation_id || d2.conversation_id || "").toString();
@@ -75322,7 +75765,7 @@ ${text}`;
75322
75765
  agentVersion: this.config.agentVersion ?? "0.0.0",
75323
75766
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
75324
75767
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
75325
- pluginVersion: true ? "0.23.52" : "0.0.0-dev"
75768
+ pluginVersion: true ? "0.23.54" : "0.0.0-dev"
75326
75769
  });
75327
75770
  this._telemetryReporter.startAutoFlush(3e4);
75328
75771
  }
@@ -75691,6 +76134,7 @@ ${text}`;
75691
76134
  });
75692
76135
  ws.on("close", (code) => {
75693
76136
  this._lastCloseCode = typeof code === "number" ? code : null;
76137
+ served.markRejected();
75694
76138
  this._stopPing();
75695
76139
  this._stopWakeDetector();
75696
76140
  this._stopPendingPoll();
@@ -77258,7 +77702,7 @@ ${baseText}`;
77258
77702
  return 0;
77259
77703
  }
77260
77704
  const snapshot = mlsGroup.exportState();
77261
- const preHead = await this._readGroupHead(mlsGroupId);
77705
+ const preHead = opts.preHead ?? await this._readGroupHead(mlsGroupId);
77262
77706
  if (preHead.ok && preHead.epoch !== Number(mlsGroup.epoch)) {
77263
77707
  console.warn(
77264
77708
  `[SecureChannel] ${label}: server head is at epoch ${preHead.epoch}, we are at ${Number(mlsGroup.epoch)} \u2014 NOT committing (it would be refused, #1184); ${targets.length} request(s) stay pending`
@@ -77445,6 +77889,40 @@ ${baseText}`;
77445
77889
  _wsIsOpen() {
77446
77890
  return this._ws?.readyState === 1;
77447
77891
  }
77892
+ /**
77893
+ * #1429 review: the cheap checks `_fulfilWelcomeRequests` makes, run BEFORE a
77894
+ * pending-Welcome site claims KeyPackages — the order #1225 S4 gave the A2A
77895
+ * path. `GET /key-packages/batch` CONSUMES; the room, shared-1:1 and conv
77896
+ * sites used to claim one per pending device and only then find the socket
77897
+ * closed, another commit in flight, or the server head elsewhere — burning a
77898
+ * package per device per failed pull (and the shared/conv sites have no
77899
+ * cooldown). `_fulfilWelcomeRequests` keeps its own checks: this is a gate on
77900
+ * spending, not a replacement for the guard at the point of commit.
77901
+ */
77902
+ /**
77903
+ * Returns the head it read (handed on to `_fulfilWelcomeRequests` as its
77904
+ * pre-flight, so a pull still reads the head once before committing), or
77905
+ * `null` when nothing should be claimed this pull.
77906
+ */
77907
+ async _welcomeCommitPreflight(mlsGroupId, mlsGroup, label) {
77908
+ if (!this._wsIsOpen()) {
77909
+ console.warn(`[SecureChannel] ${label}: socket is not OPEN \u2014 not claiming KeyPackages; requests stay pending for the next pull`);
77910
+ return null;
77911
+ }
77912
+ if (this._commitInFlight.has(mlsGroupId)) {
77913
+ console.warn(`[SecureChannel] ${label}: another commit for this group is in flight \u2014 not claiming KeyPackages this pull`);
77914
+ return null;
77915
+ }
77916
+ const head = await this._readGroupHead(mlsGroupId);
77917
+ if (head.ok && head.epoch !== Number(mlsGroup.epoch)) {
77918
+ console.warn(
77919
+ `[SecureChannel] ${label}: server head is at epoch ${head.epoch}, we are at ${Number(mlsGroup.epoch)} \u2014 not claiming KeyPackages (the commit would be refused, #1184); requests stay pending`
77920
+ );
77921
+ await this._catchUpAfterPreflightSkip(mlsGroupId, head.epoch, Number(mlsGroup.epoch), label);
77922
+ return null;
77923
+ }
77924
+ return head;
77925
+ }
77448
77926
  /** SHA-256 hex of a commit's bytes — its identity on the server (#1175/#1177). */
77449
77927
  /**
77450
77928
  * #1225: send ONE commit over the socket and wait for the server's verdict,
@@ -78470,14 +78948,27 @@ ${baseText}`;
78470
78948
  const roomState = this._persisted?.rooms?.[roomId];
78471
78949
  if (!roomState?.mlsGroupId) continue;
78472
78950
  try {
78951
+ const roomLabel = `room ${roomId.slice(0, 8)}`;
78473
78952
  const pendingRes = await fetch(
78474
78953
  `${this.config.apiUrl}/api/v1/mls/groups/${roomState.mlsGroupId}/pending-welcomes`,
78475
78954
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78476
78955
  );
78477
- if (!pendingRes.ok) continue;
78956
+ if (!pendingRes.ok) {
78957
+ this._welcomeKpBackoff.noteFetchFailure(`pending-welcomes for ${roomLabel}`, pendingRes.status);
78958
+ continue;
78959
+ }
78960
+ this._welcomeKpBackoff.noteFetchOk(`pending-welcomes for ${roomLabel}`);
78478
78961
  let pending = await pendingRes.json();
78962
+ if (this._welcomeKpBackoff.observePending(roomState.mlsGroupId, pending)) {
78963
+ console.log(`[SecureChannel] ${pending.length} pending Welcome requests for room ${roomId.slice(0, 8)}`);
78964
+ }
78965
+ if (pending.length === 0) continue;
78966
+ const nowKp = Date.now();
78967
+ const roomMlsGroupId = roomState.mlsGroupId;
78968
+ pending = pending.filter(
78969
+ (r2) => this._welcomeKpBackoff.shouldAsk(roomMlsGroupId, r2.requesting_device_id, r2.key_package_available, roomLabel, nowKp)
78970
+ );
78479
78971
  if (pending.length === 0) continue;
78480
- console.log(`[SecureChannel] ${pending.length} pending Welcome requests for room ${roomId.slice(0, 8)}`);
78481
78972
  const nowMs = Date.now();
78482
78973
  const fresh = pending.filter((r2) => {
78483
78974
  const key = `${roomState.mlsGroupId}:${r2.requesting_device_id}`;
@@ -78491,6 +78982,8 @@ ${baseText}`;
78491
78982
  return true;
78492
78983
  });
78493
78984
  if (fresh.length === 0) continue;
78985
+ const roomPreHead = await this._welcomeCommitPreflight(roomState.mlsGroupId, mlsGroup, roomLabel);
78986
+ if (!roomPreHead) continue;
78494
78987
  for (const r2 of fresh) {
78495
78988
  this._roomFulfilCooldown.set(`${roomState.mlsGroupId}:${r2.requesting_device_id}`, nowMs);
78496
78989
  }
@@ -78500,13 +78993,23 @@ ${baseText}`;
78500
78993
  `${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${deviceIds.join(",")}`,
78501
78994
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78502
78995
  );
78503
- if (!kpRes.ok) continue;
78996
+ if (!kpRes.ok) {
78997
+ this._welcomeKpBackoff.noteFetchFailure(`KeyPackage batch for ${roomLabel}`, kpRes.status);
78998
+ continue;
78999
+ }
79000
+ this._welcomeKpBackoff.noteFetchOk(`KeyPackage batch for ${roomLabel}`);
78504
79001
  const kpData = await kpRes.json();
78505
79002
  const roomTargets = [];
78506
79003
  for (const req of pending) {
78507
79004
  const kpHex = kpData[req.requesting_device_id];
79005
+ this._welcomeKpBackoff.recordKeyPackage(
79006
+ roomState.mlsGroupId,
79007
+ req.requesting_device_id,
79008
+ Boolean(kpHex),
79009
+ req.key_package_available,
79010
+ roomLabel
79011
+ );
78508
79012
  if (!kpHex) {
78509
- console.warn(`[SecureChannel] No KeyPackage for ${req.requesting_device_id.slice(0, 8)}, skipping`);
78510
79013
  continue;
78511
79014
  }
78512
79015
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
@@ -78524,8 +79027,10 @@ ${baseText}`;
78524
79027
  label: `room ${roomId.slice(0, 8)}`,
78525
79028
  welcomeFields: { room_id: roomId },
78526
79029
  targets: roomTargets,
78527
- memberDeviceIds: (roomState.members ?? []).map((m2) => m2.deviceId)
79030
+ memberDeviceIds: (roomState.members ?? []).map((m2) => m2.deviceId),
78528
79031
  // #1226
79032
+ preHead: roomPreHead
79033
+ // #1429
78529
79034
  });
78530
79035
  if (done > 0) {
78531
79036
  console.log(
@@ -78543,28 +79048,49 @@ ${baseText}`;
78543
79048
  const mlsGroup = this._mlsGroups.get(`1to1-group:${gid}`);
78544
79049
  if (!mlsGroup?.isInitialized) continue;
78545
79050
  try {
79051
+ const sharedLabel = `shared group ${gid.slice(0, 8)}`;
78546
79052
  const pendingRes = await fetch(
78547
79053
  `${this.config.apiUrl}/api/v1/mls/groups/${entry.mlsGroupId}/pending-welcomes`,
78548
79054
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78549
79055
  );
78550
- if (!pendingRes.ok) continue;
78551
- const pending = await pendingRes.json();
79056
+ if (!pendingRes.ok) {
79057
+ this._welcomeKpBackoff.noteFetchFailure(`pending-welcomes for ${sharedLabel}`, pendingRes.status);
79058
+ continue;
79059
+ }
79060
+ this._welcomeKpBackoff.noteFetchOk(`pending-welcomes for ${sharedLabel}`);
79061
+ const allPending = await pendingRes.json();
79062
+ if (this._welcomeKpBackoff.observePending(entry.mlsGroupId, allPending)) {
79063
+ console.log(`[SecureChannel] ${allPending.length} pending Welcome requests for shared group ${gid.slice(0, 8)}`);
79064
+ }
79065
+ const nowKp = Date.now();
79066
+ const pending = allPending.filter(
79067
+ (r2) => this._welcomeKpBackoff.shouldAsk(entry.mlsGroupId, r2.requesting_device_id, r2.key_package_available, sharedLabel, nowKp)
79068
+ );
78552
79069
  if (pending.length === 0) continue;
78553
- console.log(`[SecureChannel] ${pending.length} pending Welcome requests for shared group ${gid.slice(0, 8)}`);
79070
+ const sharedPreHead = await this._welcomeCommitPreflight(entry.mlsGroupId, mlsGroup, sharedLabel);
79071
+ if (!sharedPreHead) continue;
78554
79072
  const deviceIds = pending.map((r2) => r2.requesting_device_id);
78555
79073
  const kpRes = await fetch(
78556
79074
  `${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${deviceIds.join(",")}`,
78557
79075
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78558
79076
  );
78559
- if (!kpRes.ok) continue;
79077
+ if (!kpRes.ok) {
79078
+ this._welcomeKpBackoff.noteFetchFailure(`KeyPackage batch for ${sharedLabel}`, kpRes.status);
79079
+ continue;
79080
+ }
79081
+ this._welcomeKpBackoff.noteFetchOk(`KeyPackage batch for ${sharedLabel}`);
78560
79082
  const kpData = await kpRes.json();
78561
79083
  const validReqs = [];
78562
79084
  for (const req of pending) {
78563
79085
  const kpHex = kpData[req.requesting_device_id];
78564
- if (!kpHex) {
78565
- console.warn(`[SecureChannel] No KeyPackage for ${req.requesting_device_id.slice(0, 8)}, skipping`);
78566
- continue;
78567
- }
79086
+ this._welcomeKpBackoff.recordKeyPackage(
79087
+ entry.mlsGroupId,
79088
+ req.requesting_device_id,
79089
+ Boolean(kpHex),
79090
+ req.key_package_available,
79091
+ sharedLabel
79092
+ );
79093
+ if (!kpHex) continue;
78568
79094
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
78569
79095
  validReqs.push({ req, kp: MLSGroupManager.deserializeKeyPackage(kpBytes) });
78570
79096
  }
@@ -78581,8 +79107,10 @@ ${baseText}`;
78581
79107
  label: `shared group ${gid.slice(0, 8)}`,
78582
79108
  welcomeFields: { conversation_group_id: gid },
78583
79109
  targets: sharedTargets,
78584
- memberDeviceIds: entry.memberDeviceIds ?? []
79110
+ memberDeviceIds: entry.memberDeviceIds ?? [],
78585
79111
  // #1226
79112
+ preHead: sharedPreHead
79113
+ // #1429
78586
79114
  });
78587
79115
  if (done > 0) {
78588
79116
  console.log(`[SecureChannel] Batched Welcome for ${done}/${validReqs.length} devices in shared group ${gid.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
@@ -78616,23 +79144,49 @@ ${baseText}`;
78616
79144
  const mlsGroup = this._mlsGroups.get(`conv:${convId}`);
78617
79145
  if (!mlsGroup?.isInitialized) continue;
78618
79146
  try {
79147
+ const convLabel = `conv ${convId.slice(0, 8)}`;
78619
79148
  const pendingRes = await fetch(
78620
79149
  `${this.config.apiUrl}/api/v1/mls/groups/${convEntry.mlsGroupId}/pending-welcomes`,
78621
79150
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78622
79151
  );
78623
- if (!pendingRes.ok) continue;
79152
+ if (!pendingRes.ok) {
79153
+ this._welcomeKpBackoff.noteFetchFailure(`pending-welcomes for ${convLabel}`, pendingRes.status);
79154
+ continue;
79155
+ }
79156
+ this._welcomeKpBackoff.noteFetchOk(`pending-welcomes for ${convLabel}`);
78624
79157
  const pending = await pendingRes.json();
79158
+ if (this._welcomeKpBackoff.observePending(convEntry.mlsGroupId, pending)) {
79159
+ console.log(`[SecureChannel] ${pending.length} pending Welcome requests for conv ${convId.slice(0, 8)}`);
79160
+ }
78625
79161
  if (pending.length === 0) continue;
78626
- console.log(`[SecureChannel] ${pending.length} pending Welcome requests for conv ${convId.slice(0, 8)}`);
78627
79162
  for (const req of pending) {
78628
79163
  try {
79164
+ if (!this._welcomeKpBackoff.shouldAsk(
79165
+ convEntry.mlsGroupId,
79166
+ req.requesting_device_id,
79167
+ req.key_package_available,
79168
+ convLabel
79169
+ )) continue;
79170
+ const convPreHead = await this._welcomeCommitPreflight(convEntry.mlsGroupId, mlsGroup, convLabel);
79171
+ if (!convPreHead) break;
78629
79172
  const kpRes = await fetch(
78630
79173
  `${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${req.requesting_device_id}`,
78631
79174
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78632
79175
  );
78633
- if (!kpRes.ok) continue;
79176
+ if (!kpRes.ok) {
79177
+ this._welcomeKpBackoff.noteFetchFailure(`KeyPackage batch for ${convLabel}`, kpRes.status);
79178
+ continue;
79179
+ }
79180
+ this._welcomeKpBackoff.noteFetchOk(`KeyPackage batch for ${convLabel}`);
78634
79181
  const kpData = await kpRes.json();
78635
79182
  const kpHex = kpData[req.requesting_device_id];
79183
+ this._welcomeKpBackoff.recordKeyPackage(
79184
+ convEntry.mlsGroupId,
79185
+ req.requesting_device_id,
79186
+ Boolean(kpHex),
79187
+ req.key_package_available,
79188
+ convLabel
79189
+ );
78636
79190
  if (!kpHex) continue;
78637
79191
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
78638
79192
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
@@ -78649,7 +79203,9 @@ ${baseText}`;
78649
79203
  // #1226: a 1:1 roster is [self, owner] — the web's shape too.
78650
79204
  memberDeviceIds: [this._persisted?.sessions?.[convId]?.ownerDeviceId].filter(
78651
79205
  (d2) => typeof d2 === "string"
78652
- )
79206
+ ),
79207
+ preHead: convPreHead
79208
+ // #1429
78653
79209
  });
78654
79210
  if (done > 0) {
78655
79211
  console.log(`[SecureChannel] Fulfilled Welcome for ${req.requesting_device_id.slice(0, 8)} in conv ${convId.slice(0, 8)}`);
@@ -78697,15 +79253,28 @@ ${baseText}`;
78697
79253
  if (!mlsGroup?.isInitialized) continue;
78698
79254
  if (chState.role !== "creator") continue;
78699
79255
  try {
79256
+ const a2aPendingLabel = `A2A ${chId.slice(0, 8)}`;
78700
79257
  const pendingRes = await fetch(
78701
79258
  `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/pending-welcomes`,
78702
79259
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
78703
79260
  );
78704
- if (!pendingRes.ok) continue;
79261
+ if (!pendingRes.ok) {
79262
+ this._welcomeKpBackoff.noteFetchFailure(`pending-welcomes for ${a2aPendingLabel}`, pendingRes.status);
79263
+ continue;
79264
+ }
79265
+ this._welcomeKpBackoff.noteFetchOk(`pending-welcomes for ${a2aPendingLabel}`);
78705
79266
  const pending = await pendingRes.json();
79267
+ if (this._welcomeKpBackoff.observePending(chState.mlsGroupId, pending)) {
79268
+ console.log(`[SecureChannel] ${pending.length} pending A2A Welcome requests for channel ${chId.slice(0, 8)}`);
79269
+ }
78706
79270
  if (pending.length === 0) continue;
78707
- console.log(`[SecureChannel] ${pending.length} pending A2A Welcome requests for channel ${chId.slice(0, 8)}`);
78708
79271
  for (const req of pending) {
79272
+ if (!this._welcomeKpBackoff.shouldAsk(
79273
+ chState.mlsGroupId,
79274
+ req.requesting_device_id,
79275
+ req.key_package_available,
79276
+ a2aPendingLabel
79277
+ )) continue;
78709
79278
  try {
78710
79279
  const next = await this._fulfilA2AWelcome(chId, chState, mlsGroup, req);
78711
79280
  if (next === "stop") break;
@@ -79017,9 +79586,20 @@ ${baseText}`;
79017
79586
  `${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${req.requesting_device_id}`,
79018
79587
  { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
79019
79588
  );
79020
- if (!kpRes.ok) return "next";
79589
+ if (!kpRes.ok) {
79590
+ this._welcomeKpBackoff.noteFetchFailure(`KeyPackage batch for ${a2aLabel}`, kpRes.status);
79591
+ return "next";
79592
+ }
79593
+ this._welcomeKpBackoff.noteFetchOk(`KeyPackage batch for ${a2aLabel}`);
79021
79594
  const kpData = await kpRes.json();
79022
79595
  const kpHex = kpData[req.requesting_device_id];
79596
+ this._welcomeKpBackoff.recordKeyPackage(
79597
+ chState.mlsGroupId,
79598
+ req.requesting_device_id,
79599
+ Boolean(kpHex),
79600
+ req.key_package_available,
79601
+ a2aLabel
79602
+ );
79023
79603
  if (!kpHex) return "next";
79024
79604
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
79025
79605
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
@@ -79644,7 +80224,7 @@ ${baseText}`;
79644
80224
  );
79645
80225
  this._authFailedThisSession = true;
79646
80226
  this._setState("error");
79647
- this.emit("auth_failed", { reason: "ws_auth_rejected" });
80227
+ this.emit("auth_failed", { reason: "ws_auth_rejected", deviceGone: false });
79648
80228
  return;
79649
80229
  }
79650
80230
  if (lastCode === 4e3) {
@@ -79683,7 +80263,7 @@ ${baseText}`;
79683
80263
  this._state = newState;
79684
80264
  this.emit("state", newState);
79685
80265
  this.config.onStateChange?.(newState);
79686
- if (newState === "disconnected" && !this._pollFallbackTimer && this._deviceJwt) {
80266
+ if (newState === "disconnected" && !this._pollFallbackTimer && this._deviceJwt && !this._suspended) {
79687
80267
  this._startPollFallback();
79688
80268
  }
79689
80269
  if (newState === "ready" || newState === "error" || this._stopped) {
@@ -79820,8 +80400,10 @@ ${baseText}`;
79820
80400
  * blindly. We ask the PUBLIC /devices/{id}/status endpoint (no JWT needed, so
79821
80401
  * it answers even when our device JWT is being rejected):
79822
80402
  * - ACTIVE -> reconnect in place (transient); stay online.
79823
- * - non-ACTIVE -> terminal (genuinely revoked; operator must re-enroll).
79824
- * - unreachable/429 -> reconnect (inconclusive; a network blip shouldn't
80403
+ * - SUSPENDED -> suspended-wait (owner paused it; resume later).
80404
+ * - REVOKED/deleted -> terminal via `_terminalDeviceGone` (auth_failed with
80405
+ * deviceGone: the bridges exit and remove their service).
80406
+ * - anything else / unreachable / 429 -> reconnect (inconclusive; a network blip shouldn't
79825
80407
  * permanently kill a healthy agent — the WS is down too,
79826
80408
  * so normal backoff handles it, and the war cap bounds
79827
80409
  * thrash if the device really is dead).
@@ -79861,10 +80443,58 @@ ${baseText}`;
79861
80443
  }
79862
80444
  this._authFailedThisSession = true;
79863
80445
  const authReason = data?.reason ?? "unknown";
80446
+ const standing = await this._readDeviceStanding();
80447
+ if (standing.kind === "suspended") {
80448
+ this._authFailedThisSession = false;
80449
+ this._enterSuspendedWait("connection_rejected");
80450
+ return;
80451
+ }
80452
+ const deviceGone = standing.kind === "gone";
79864
80453
  console.warn(
79865
- `[SecureChannel] connection_rejected (reason=${data?.reason ?? "unknown"}, retryable=false) \u2014 terminal; surfacing auth_failed`
80454
+ `[SecureChannel] connection_rejected (reason=${data?.reason ?? "unknown"}, retryable=false) \u2014 terminal; surfacing auth_failed (deviceGone=${deviceGone})`
79866
80455
  );
79867
- this.emit("auth_failed", { reason: authReason });
80456
+ this.emit("auth_failed", { reason: authReason, deviceGone });
80457
+ }
80458
+ /**
80459
+ * How long an opened socket may stay silent before we treat it as served.
80460
+ * The backend's reject_connection sends `connection_rejected` immediately
80461
+ * after the accept, so a refused socket's first frame lands well inside
80462
+ * this; a served agent with a hub gets `hub_identity_sync` sooner still.
80463
+ */
80464
+ static OPEN_SETTLE_MS = 1500;
80465
+ /**
80466
+ * Per-socket "has the server agreed to serve this session?" latch. Settles
80467
+ * once: served on the first non-rejection frame or when the settle window
80468
+ * passes quietly; rejected on `connection_rejected` or a close first.
80469
+ * `rejected` stays readable afterwards so long open-handler work can bail.
80470
+ */
80471
+ _createServedGate() {
80472
+ let verdict = null;
80473
+ let rejected = false;
80474
+ let timer = null;
80475
+ const waiters = [];
80476
+ const settle2 = (ok) => {
80477
+ if (!ok) rejected = true;
80478
+ if (verdict !== null) return;
80479
+ verdict = ok;
80480
+ if (timer) {
80481
+ clearTimeout(timer);
80482
+ timer = null;
80483
+ }
80484
+ for (const w2 of waiters.splice(0)) w2(ok);
80485
+ };
80486
+ return {
80487
+ wait: () => {
80488
+ if (verdict !== null) return Promise.resolve(verdict && !rejected);
80489
+ if (!timer) timer = setTimeout(() => settle2(true), _SecureChannel.OPEN_SETTLE_MS);
80490
+ return new Promise((resolve4) => waiters.push(resolve4));
80491
+ },
80492
+ markServed: () => settle2(true),
80493
+ markRejected: () => settle2(false),
80494
+ get rejected() {
80495
+ return rejected;
80496
+ }
80497
+ };
79868
80498
  }
79869
80499
  // --- Owner pause (device SUSPENDED) — NON-final ---------------------------
79870
80500
  //
@@ -79889,6 +80519,7 @@ ${baseText}`;
79889
80519
  this._reconnectTimer = null;
79890
80520
  }
79891
80521
  this._rapidDisconnects = 0;
80522
+ this._stopPollFallback();
79892
80523
  if (!this._suspended) {
79893
80524
  this._suspended = true;
79894
80525
  console.log(
@@ -79915,30 +80546,40 @@ ${baseText}`;
79915
80546
  }
79916
80547
  async _pollWhileSuspended() {
79917
80548
  if (this._stopped || !this._suspended) return;
79918
- const deviceId = this._deviceId ?? this._persisted?.deviceId;
79919
- if (deviceId) {
79920
- try {
79921
- const st = await pollDeviceStatus(this.config.apiUrl, deviceId);
79922
- if (this._stopped || !this._suspended) return;
79923
- if (!st.rateLimited && (st.status === "ACTIVE" || st.status === "APPROVED")) {
79924
- this._clearSuspendedWait();
79925
- this._reconnectAttempt = 0;
79926
- console.log("[SecureChannel] Agent resumed by its owner \u2014 reconnecting");
79927
- this.emit("resumed");
79928
- this._connect();
79929
- return;
79930
- }
79931
- if (!st.rateLimited && st.status === "REVOKED") {
79932
- this._clearSuspendedWait();
79933
- this._handleError(new Error("Device was revoked"));
79934
- return;
79935
- }
79936
- } catch (err) {
79937
- console.warn("[SecureChannel] status check while paused failed; still waiting:", err);
79938
- }
80549
+ const standing = await this._readDeviceStanding();
80550
+ if (this._stopped || !this._suspended) return;
80551
+ if (standing.kind === "active") {
80552
+ this._clearSuspendedWait();
80553
+ this._reconnectAttempt = 0;
80554
+ console.log("[SecureChannel] Agent resumed by its owner \u2014 reconnecting");
80555
+ this.emit("resumed");
80556
+ this._connect();
80557
+ return;
80558
+ }
80559
+ if (standing.kind === "gone") {
80560
+ await this._terminalDeviceGone(standing.reason, "suspended_wait");
80561
+ return;
80562
+ }
80563
+ if (standing.kind === "unknown") {
80564
+ console.warn(`[SecureChannel] status check while paused inconclusive (${standing.why}); still waiting`);
79939
80565
  }
79940
80566
  this._scheduleSuspendedPoll();
79941
80567
  }
80568
+ /**
80569
+ * The device is CONFIRMED gone (status endpoint: REVOKED, or the row is
80570
+ * deleted). Stop for good through the documented terminal surface:
80571
+ * re_enroll report, `auth_failed{deviceGone:true}` (bridges exit and remove
80572
+ * their service), then the legacy `error("Device was revoked")` the OpenClaw
80573
+ * lifecycle and older listeners key on.
80574
+ */
80575
+ async _terminalDeviceGone(reason, source) {
80576
+ this._clearSuspendedWait();
80577
+ this._authFailedThisSession = true;
80578
+ console.warn(`[SecureChannel] ${source}: device confirmed gone (${reason}) \u2014 terminal`);
80579
+ await this._postAuthFailedToBackend(reason);
80580
+ this.emit("auth_failed", { reason, deviceGone: true });
80581
+ this._handleError(new Error("Device was revoked"));
80582
+ }
79942
80583
  async _handleDeviceRevoked() {
79943
80584
  const now = Date.now();
79944
80585
  this._revokeRecoveries = this._revokeRecoveries.filter(
@@ -79956,35 +80597,25 @@ ${baseText}`;
79956
80597
  this._handleError(new Error("Device was revoked"));
79957
80598
  return;
79958
80599
  }
79959
- let reconnect;
79960
- try {
79961
- const status = await pollDeviceStatus(this.config.apiUrl, deviceId);
79962
- if (status.status === "SUSPENDED") {
79963
- this._enterSuspendedWait("device_revoked");
79964
- return;
79965
- }
79966
- reconnect = status.rateLimited === true || status.status === "ACTIVE";
79967
- if (!reconnect) {
79968
- console.warn(
79969
- `[SecureChannel] device_revoked confirmed by server (status=${status.status}) \u2014 terminal`
79970
- );
79971
- }
79972
- } catch (err) {
79973
- console.warn(
79974
- "[SecureChannel] device_revoked status check failed; reconnecting (inconclusive):",
79975
- err
79976
- );
79977
- reconnect = true;
80600
+ const standing = await this._readDeviceStanding();
80601
+ if (standing.kind === "suspended") {
80602
+ this._enterSuspendedWait("device_revoked");
80603
+ return;
79978
80604
  }
79979
- if (reconnect) {
79980
- this._revokeRecoveries.push(now);
79981
- console.log(
79982
- "[SecureChannel] device_revoked but device not confirmed dead \u2014 reconnecting (self-heal)"
79983
- );
79984
- this._scheduleReconnect();
80605
+ if (standing.kind === "gone") {
80606
+ await this._terminalDeviceGone(standing.reason, "device_revoked");
79985
80607
  return;
79986
80608
  }
79987
- this._handleError(new Error("Device was revoked"));
80609
+ if (standing.kind === "unknown") {
80610
+ console.warn(
80611
+ `[SecureChannel] device_revoked status check inconclusive (${standing.why}); reconnecting`
80612
+ );
80613
+ }
80614
+ this._revokeRecoveries.push(now);
80615
+ console.log(
80616
+ "[SecureChannel] device_revoked but device not confirmed dead \u2014 reconnecting (self-heal)"
80617
+ );
80618
+ this._scheduleReconnect();
79988
80619
  }
79989
80620
  /**
79990
80621
  * Persist all ratchet session states to disk.
@@ -80784,7 +81415,7 @@ ${actionsText}`);
80784
81415
  "use strict";
80785
81416
  init_llm_response_parser();
80786
81417
  init_llm_cost();
80787
- traceStore = new AsyncLocalStorage2();
81418
+ traceStore = new AsyncLocalStorage3();
80788
81419
  }
80789
81420
  });
80790
81421
  init_tool_audit = __esm2({
@@ -80807,6 +81438,7 @@ ${actionsText}`);
80807
81438
  init_openclaw_compat();
80808
81439
  init_lifecycle();
80809
81440
  init_tool_audit();
81441
+ init_tool_telemetry();
80810
81442
  init_harness_compat();
80811
81443
  init_types();
80812
81444
  managedRoutesRequested = false;
@@ -101532,7 +102164,8 @@ data:
101532
102164
  await init_skill_telemetry();
101533
102165
  await init_policy_enforcer();
101534
102166
  init_room_protocol();
101535
- VERSION = true ? "0.23.52" : "0.0.0-dev";
102167
+ init_tool_telemetry();
102168
+ VERSION = true ? "0.23.54" : "0.0.0-dev";
101536
102169
  }
101537
102170
  });
101538
102171
  await init_index();
@@ -103213,7 +103846,7 @@ function describeChildExit(shuttingDown2, code, signal) {
103213
103846
 
103214
103847
  // src/grok-room-http.ts
103215
103848
  import { createServer as createServer2 } from "node:http";
103216
- import { randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
103849
+ import { randomBytes as randomBytes4, timingSafeEqual } from "node:crypto";
103217
103850
 
103218
103851
  // src/grok-room-mcp.ts
103219
103852
  var TOOL = {
@@ -103268,7 +103901,7 @@ function redactCredential(text, secret) {
103268
103901
  }
103269
103902
  async function startRoomMcpServer(opts) {
103270
103903
  const seen = [];
103271
- const token = randomBytes3(24).toString("base64url");
103904
+ const token = randomBytes4(24).toString("base64url");
103272
103905
  const path2 = `/mcp/${token}`;
103273
103906
  const log = opts.log ?? (() => {
103274
103907
  });
@@ -103345,16 +103978,15 @@ await init_dist();
103345
103978
  init_subcommand();
103346
103979
  init_backend();
103347
103980
  init_log();
103348
- var DEVICE_IS_GONE = "device_revoked";
103349
- function selfUninstallOnTerminal(reason, env, deps = {}) {
103350
- if (reason !== DEVICE_IS_GONE) return false;
103981
+ function selfUninstallOnTerminal(verdict, env, deps = {}) {
103982
+ if (verdict?.deviceGone !== true) return false;
103351
103983
  const log = deps.log ?? ((m2) => logLine("[grok-bridge] " + m2));
103352
103984
  let label;
103353
103985
  try {
103354
103986
  label = labelFor(env);
103355
103987
  } catch (e) {
103356
103988
  log(
103357
- `device was revoked, but ${e.message} \u2014 cannot tell which service to remove. Remove it by hand with: AV_AGENT_NAME=<agent-name> agentvault-grok-bridge uninstall`
103989
+ `device is gone (${verdict.reason}), but ${e.message} \u2014 cannot tell which service to remove. Remove it by hand with: AV_AGENT_NAME=<agent-name> agentvault-grok-bridge uninstall`
103358
103990
  );
103359
103991
  return false;
103360
103992
  }
@@ -103364,12 +103996,12 @@ function selfUninstallOnTerminal(reason, env, deps = {}) {
103364
103996
  if (!backend.status(label).loaded) return false;
103365
103997
  backend.uninstall(label);
103366
103998
  log(
103367
- `device was revoked \u2014 removed the supervised service ${label} so it does not sit installed on this machine pointing at an agent that no longer exists. Your credentials are still on disk and were NOT touched; re-install with a fresh invite token from AgentVault to reconnect.`
103999
+ `device is gone (${verdict.reason}) \u2014 removed the supervised service ${label} so it does not sit installed on this machine pointing at an agent that no longer exists. Your credentials are still on disk and were NOT touched; re-install with a fresh invite token from AgentVault to reconnect.`
103368
104000
  );
103369
104001
  return true;
103370
104002
  } catch (e) {
103371
104003
  log(
103372
- `device was revoked, but removing the service ${label} failed: ${e.message}. Remove it by hand with: AV_AGENT_NAME=<agent-name> agentvault-grok-bridge uninstall`
104004
+ `device is gone (${verdict.reason}), but removing the service ${label} failed: ${e.message}. Remove it by hand with: AV_AGENT_NAME=<agent-name> agentvault-grok-bridge uninstall`
103373
104005
  );
103374
104006
  return false;
103375
104007
  }
@@ -103393,6 +104025,18 @@ var RoomHushState = class {
103393
104025
  return t2 !== void 0 && now < t2;
103394
104026
  }
103395
104027
  };
104028
+ function reportSay(channel, t2, startedAt, failure2) {
104029
+ try {
104030
+ reportToolInvoke(channel.telemetry, {
104031
+ toolName: "say",
104032
+ outcome: failure2 ? "error" : "success",
104033
+ errorKind: failure2 ? classifyToolError(failure2.err) : void 0,
104034
+ durationMs: Date.now() - startedAt,
104035
+ conversation: t2.kind === "room" ? { kind: "room", id: t2.roomId } : t2.conversationId ? { kind: "direct", id: t2.conversationId } : { kind: "unknown" }
104036
+ });
104037
+ } catch {
104038
+ }
104039
+ }
103396
104040
  async function sendDm(channel, t2, text) {
103397
104041
  if ((t2.conversationId || t2.groupId) && typeof channel.runForConversation === "function") {
103398
104042
  await channel.runForConversation(
@@ -103432,13 +104076,17 @@ var ActiveTarget = class {
103432
104076
  const where = !t2 ? "nowhere" : t2.kind === "room" ? `room ${t2.roomId.slice(0, 8)}` : "1:1 owner";
103433
104077
  return async (text) => {
103434
104078
  if (!t2) return;
104079
+ const startedAt = Date.now();
103435
104080
  try {
103436
104081
  if (t2.kind === "room") await channel.sendToRoom(t2.roomId, text);
103437
104082
  else await sendDm(channel, t2, text);
103438
104083
  log(`said to ${where}`);
103439
104084
  } catch (err) {
103440
104085
  log(`send failed to ${where}: ${err instanceof Error ? err.message : String(err)}`);
104086
+ reportSay(channel, t2, startedAt, { err });
104087
+ return;
103441
104088
  }
104089
+ reportSay(channel, t2, startedAt);
103442
104090
  };
103443
104091
  }
103444
104092
  };
@@ -103447,14 +104095,17 @@ function attachLifecycle2(channel, opts = {}) {
103447
104095
  });
103448
104096
  const selfUninstall = opts.selfUninstall ?? selfUninstallOnTerminal;
103449
104097
  const onTerminal = opts.onTerminal ?? ((_reason, o2) => process.exit(o2.restart ? 1 : 0));
103450
- const terminal = (reason, restart) => {
104098
+ const terminal = (reason, restart, deviceGone = false) => {
103451
104099
  log(
103452
104100
  `terminal condition (${reason}) \u2014 ${restart ? "gave up reconnecting; supervisor may respawn" : "this device must re-enroll or another session has taken over"}. Re-run/re-install with a fresh invite token from AgentVault if this persists.`
103453
104101
  );
103454
- selfUninstall(reason, process.env);
104102
+ selfUninstall({ reason, deviceGone }, process.env);
103455
104103
  onTerminal(reason, { restart });
103456
104104
  };
103457
- channel.on("auth_failed", (e) => terminal(e.reason, false));
104105
+ channel.on(
104106
+ "auth_failed",
104107
+ (e) => terminal(e.reason, false, e?.deviceGone === true)
104108
+ );
103458
104109
  channel.on(
103459
104110
  "session_replaced",
103460
104111
  (e) => terminal(e?.code ? `session_replaced (${e.code})` : "session_replaced", false)
@@ -103648,7 +104299,7 @@ async function main() {
103648
104299
  const info = parseInfoFlags(process.argv.slice(2));
103649
104300
  if (info.showVersion || info.showHelp) {
103650
104301
  const version2 = buildClientVersion2(
103651
- true ? "0.4.23" : void 0
104302
+ true ? "0.4.25" : void 0
103652
104303
  );
103653
104304
  if (info.showVersion) printLine(version2);
103654
104305
  if (info.showHelp) {
@@ -103687,7 +104338,7 @@ async function main() {
103687
104338
  process.exit(0);
103688
104339
  }
103689
104340
  const cfg = loadConfig(process.env, process.argv.slice(2));
103690
- logLine(`[grok-bridge] version: ${true ? "0.4.23" : "dev"}`);
104341
+ logLine(`[grok-bridge] version: ${true ? "0.4.25" : "dev"}`);
103691
104342
  mkdirSync7(cfg.workspaceDir, { recursive: true });
103692
104343
  mkdirSync7(cfg.fenceHome, { recursive: true });
103693
104344
  seedFenceCredential({
@@ -103702,7 +104353,7 @@ async function main() {
103702
104353
  agentName: cfg.agentName,
103703
104354
  platform: "node",
103704
104355
  clientVersion: buildClientVersion2(
103705
- true ? "0.4.23" : void 0
104356
+ true ? "0.4.25" : void 0
103706
104357
  )
103707
104358
  });
103708
104359
  channelRef = channel;