@openclaw/matrix 2026.5.28 → 2026.5.31-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/api.js +7 -7
  2. package/dist/{approval-handler.runtime-Cso-m9Q7.js → approval-handler.runtime-Dzh_2MS1.js} +5 -5
  3. package/dist/{approval-ids-IrHynnHK.js → approval-ids-CXPPSyAr.js} +1 -1
  4. package/dist/{approval-reaction-auth-D0nZ_4ik.js → approval-reaction-auth-m-11_ajL.js} +2 -2
  5. package/dist/auth-presence.js +1 -1
  6. package/dist/{channel-D7FK_lEY.js → channel-BwpVY2Ne.js} +23 -18
  7. package/dist/channel-plugin-api.js +1 -1
  8. package/dist/{channel.runtime-CBrW2dLp.js → channel.runtime-CUBxoFwA.js} +8 -8
  9. package/dist/{cli-C1xFg7Q-.js → cli-CaF5tlL-.js} +14 -13
  10. package/dist/{cli-metadata-zz9Cmwcs.js → cli-metadata-gFTG9oJL.js} +1 -1
  11. package/dist/cli-metadata.js +1 -1
  12. package/dist/{client-BIBY50VG.js → client-D-t6CdHz.js} +2 -2
  13. package/dist/{client-bootstrap-Chmkqhy7.js → client-bootstrap-DOlQb7Jx.js} +1 -1
  14. package/dist/{client-BMoZSA2L.js → client-spaouc7I.js} +2 -2
  15. package/dist/{config-schema-wK02TzmZ.js → config-schema-DfjBrYch.js} +21 -4
  16. package/dist/contract-api.js +4 -4
  17. package/dist/{create-client-B1a3Am-I.js → create-client-B4CPKa5P.js} +3 -3
  18. package/dist/{credentials-CDjQjIds.js → credentials-Bi0pTJDK.js} +1 -1
  19. package/dist/{credentials-read-DySnJlLx.js → credentials-read-DpxFOhx0.js} +2 -2
  20. package/dist/{credentials-write.runtime-Ca2MN99y.js → credentials-write.runtime-BB5QuM4Z.js} +1 -1
  21. package/dist/{crypto-runtime-oweQ3RiB.js → crypto-runtime-3hgwY-d6.js} +7 -6
  22. package/dist/{directory-live-M-3KeudM.js → directory-live-DgjzYeC_.js} +2 -2
  23. package/dist/{doctor-CENc9ks0.js → doctor-BKjr6uua.js} +17 -4
  24. package/dist/{draft-stream-r49dgIZc.js → draft-stream-eaBWrjVK.js} +1 -1
  25. package/dist/{encryption-guidance-CU-OAPMg.js → encryption-guidance-aEUzD940.js} +1 -1
  26. package/dist/helper-api.js +2 -2
  27. package/dist/index.js +2 -2
  28. package/dist/{legacy-crypto-restore-BgW3I87R.js → legacy-crypto-restore--9Wu5rsx.js} +1 -1
  29. package/dist/{logging-yEwXx4Hm.js → logging-C7wjdKK5.js} +1 -1
  30. package/dist/{matrix-migration.runtime-CZOep_JX.js → matrix-migration.runtime-RzIEp7RP.js} +3 -3
  31. package/dist/{media-text-C4IBQI5B.js → media-text-C2Wor3Gj.js} +1 -1
  32. package/dist/{messages-CMx2qIs1.js → messages-D0sumPNx.js} +3 -3
  33. package/dist/{monitor-COOR-Ksj.js → monitor-gDaABWfA.js} +140 -108
  34. package/dist/plugin-entry.handlers.runtime.js +1 -1
  35. package/dist/probe.runtime-BegszwhP.js +3 -0
  36. package/dist/{profile-update-Cl7wAFCq.js → profile-update-Defy1W90.js} +2 -2
  37. package/dist/{reaction-events-D3jtYqTp.js → reaction-events-Bh2u-_9j.js} +1 -1
  38. package/dist/{recovery-key-store-DfQ_9s6u.js → recovery-key-store-BRnvY8XS.js} +1 -1
  39. package/dist/{resolve-targets-D-K3tTPe.js → resolve-targets-CLuzv_Jl.js} +1 -1
  40. package/dist/{resolver.runtime-BRG9o8iL.js → resolver.runtime-VywXDAZv.js} +1 -1
  41. package/dist/runtime-api.js +3 -3
  42. package/dist/runtime-heavy-api.js +1 -1
  43. package/dist/{sdk-ymjYByhr.js → sdk-C2iC7PJZ.js} +6 -6
  44. package/dist/{send-peVVVL75.js → send-DHj1E9ji.js} +6 -4
  45. package/dist/{setup-bootstrap-CiX7Pd07.js → setup-bootstrap-kTPKb7jR.js} +2 -2
  46. package/dist/{setup-core-DOhHYRrZ.js → setup-core-DRg3cgB8.js} +4 -4
  47. package/dist/setup-plugin-api.js +3 -3
  48. package/dist/{setup-surface-CrUp7oeN.js → setup-surface-soZQLgfu.js} +6 -6
  49. package/dist/{shared-CmsjJY4i.js → shared-DjJds8e0.js} +6 -6
  50. package/dist/startup-verification-CWLSyFen.js +233 -0
  51. package/dist/{storage-onzulLbU.js → storage-Ds-2Iur5.js} +18 -6
  52. package/dist/subagent-hooks-api.js +18 -2
  53. package/dist/{subagent-hooks-api-bedE4GYl.js → subagent-hooks-dkPAF6Et.js} +3 -30
  54. package/dist/{thread-bindings-DAg6grT8.js → thread-bindings-DehFUArg.js} +142 -39
  55. package/dist/{tool-actions.runtime-DwbLBrRr.js → tool-actions.runtime-CU79qJ3e.js} +7 -7
  56. package/dist/{verification-BM7g0BeT.js → verification-BJfjKMr8.js} +2 -2
  57. package/node_modules/@babel/runtime/package.json +1 -1
  58. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/.node-version +1 -1
  59. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +32 -1
  60. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +3 -3
  61. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.d.ts +195 -15
  62. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js +6 -1
  63. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +3 -3
  64. package/node_modules/typebox/build/type/script/mapping.d.mts +5 -2
  65. package/node_modules/typebox/build/type/script/mapping.mjs +15 -8
  66. package/node_modules/typebox/build/type/script/parser.d.mts +3 -1
  67. package/node_modules/typebox/build/type/script/parser.mjs +2 -1
  68. package/node_modules/typebox/package.json +29 -29
  69. package/npm-shrinkwrap.json +15 -15
  70. package/openclaw.plugin.json +46 -0
  71. package/package.json +6 -6
  72. package/dist/probe.runtime-DgSABMiF.js +0 -3
  73. package/dist/startup-verification-BmTEngvU.js +0 -132
  74. package/dist/{account-selection-C3arLOhC.js → account-selection-DEMtY2cn.js} +1 -1
  75. package/dist/{runtime-api-CsF7Kokd.js → runtime-api-CsBoesCU.js} +2 -2
  76. package/dist/{storage-paths-BV2Z7bns.js → storage-paths-BWo_ZEMC.js} +1 -1
@@ -1,8 +1,8 @@
1
1
  import { r as isMatrixNotFoundError } from "./errors-C47hvAF8.js";
2
- import { a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-peVVVL75.js";
2
+ import { a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-DHj1E9ji.js";
3
3
  import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
4
- import { a as resolveMatrixMessageBody, c as resolveMatrixPollRootEventId, i as resolveMatrixMessageAttachment, o as fetchMatrixPollMessageSummary } from "./media-text-C4IBQI5B.js";
5
- import { r as withResolvedRoomAction } from "./client-BIBY50VG.js";
4
+ import { a as resolveMatrixMessageBody, c as resolveMatrixPollRootEventId, i as resolveMatrixMessageAttachment, o as fetchMatrixPollMessageSummary } from "./media-text-C2Wor3Gj.js";
5
+ import { r as withResolvedRoomAction } from "./client-D-t6CdHz.js";
6
6
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
8
8
  //#region extensions/matrix/src/matrix/actions/limits.ts
@@ -1,33 +1,35 @@
1
- import { t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
2
1
  import { c as resolveMatrixAccountConfig, s as resolveMatrixAccountAllowlistConfig } from "./config-paths-ZBCMwSos.js";
3
2
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
4
- import { m as resolveConfiguredMatrixBotUserIds } from "./setup-core-DOhHYRrZ.js";
5
- import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-D7FK_lEY.js";
6
- import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-wK02TzmZ.js";
3
+ import { m as resolveConfiguredMatrixBotUserIds } from "./setup-core-DRg3cgB8.js";
4
+ import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-BwpVY2Ne.js";
5
+ import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-DfjBrYch.js";
6
+ import { t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
7
7
  import { r as isMatrixNotFoundError, t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
8
- import { i as resolveMatrixStateFilePath } from "./storage-onzulLbU.js";
9
- import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, _ as readJoinedMatrixMembers, a as sendMessageMatrix, f as promoteMatrixDirectRoomCandidate, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, t as chunkMatrixText, v as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, w as isPollEventType } from "./send-peVVVL75.js";
10
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-DAg6grT8.js";
11
- import { a as resolveMatrixMessageBody, i as resolveMatrixMessageAttachment, n as formatMatrixMediaUnavailableText, r as formatMatrixMessageText, s as fetchMatrixPollSnapshot, t as formatMatrixMediaTooLargeText } from "./media-text-C4IBQI5B.js";
8
+ import { a as resolveMatrixStateFilePath } from "./storage-Ds-2Iur5.js";
9
+ import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, _ as readJoinedMatrixMembers, a as sendMessageMatrix, f as promoteMatrixDirectRoomCandidate, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, t as chunkMatrixText, v as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, w as isPollEventType } from "./send-DHj1E9ji.js";
10
+ import { n as resolveMatrixSqliteStateEnv, t as createMatrixThreadBindingManager } from "./thread-bindings-DehFUArg.js";
11
+ import { a as resolveMatrixMessageBody, i as resolveMatrixMessageAttachment, n as formatMatrixMediaUnavailableText, r as formatMatrixMessageText, s as fetchMatrixPollSnapshot, t as formatMatrixMediaTooLargeText } from "./media-text-C2Wor3Gj.js";
12
12
  import { n as setActiveMatrixClient } from "./active-client-DXvz2gCo.js";
13
13
  import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
14
- import { _ as resolveMatrixAuthContext, f as LogService, g as resolveMatrixAuth, h as backfillMatrixAuthDeviceIdAfterStartup, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, u as throwIfMatrixStartupAborted } from "./shared-CmsjJY4i.js";
15
- import "./client-BMoZSA2L.js";
14
+ import { _ as resolveMatrixAuthContext, f as LogService, g as resolveMatrixAuth, h as backfillMatrixAuthDeviceIdAfterStartup, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, u as throwIfMatrixStartupAborted } from "./shared-DjJds8e0.js";
15
+ import "./client-spaouc7I.js";
16
16
  import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-KTzUzlpv.js";
17
- import { d as resolveDefaultGroupPolicy, h as warnMissingProviderGroupPolicyFallbackOnce, m as resolveThreadBindingMaxAgeMsForChannel, p as resolveThreadBindingIdleTimeoutMsForChannel, t as GROUP_POLICY_BLOCKED_LABEL, u as resolveAllowlistProviderRuntimeGroupPolicy } from "./runtime-api-CsF7Kokd.js";
18
- import { t as resolveMatrixTargets } from "./resolve-targets-D-K3tTPe.js";
19
- import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-CU-OAPMg.js";
20
- import { t as createAsyncLock } from "./async-lock-BcLS4KOc.js";
17
+ import { d as resolveDefaultGroupPolicy, h as warnMissingProviderGroupPolicyFallbackOnce, m as resolveThreadBindingMaxAgeMsForChannel, p as resolveThreadBindingIdleTimeoutMsForChannel, t as GROUP_POLICY_BLOCKED_LABEL, u as resolveAllowlistProviderRuntimeGroupPolicy } from "./runtime-api-CsBoesCU.js";
18
+ import { t as resolveMatrixTargets } from "./resolve-targets-CLuzv_Jl.js";
19
+ import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-aEUzD940.js";
21
20
  import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState, t as isMatrixDisconnectedSyncState } from "./sync-state-CWbp0QSY.js";
22
21
  import { a as EventType, i as resolveMatrixThreadRouting, n as resolveMatrixReplyToEventId, o as RelationType, r as resolveMatrixThreadRootId, t as resolveMatrixInboundRoute } from "./route-DY6at4qJ.js";
23
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
24
22
  import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate, createPreviewMessageReceipt, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftLine, formatChannelProgressDraftLineForEntry, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, mergeChannelProgressDraftLine, normalizeChannelProgressDraftLineIdentity, resolveChannelProgressDraftMaxLines, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
23
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
24
+ import path from "node:path";
25
+ import { createHash } from "node:crypto";
25
26
  import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
26
27
  import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
27
28
  import { buildChannelInboundEventContext, hasFinalInboundReplyDispatch, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
28
29
  import { loadSessionStore, resolveSessionStoreEntry } from "openclaw/plugin-sdk/session-store-runtime";
29
- import { parseStrictFiniteNumber, resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
30
- import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
30
+ import { isFutureDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
31
+ import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
32
+ import fs from "node:fs/promises";
31
33
  import { format } from "node:util";
32
34
  import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement } from "openclaw/plugin-sdk/reply-payload";
33
35
  import { resolveAckReaction } from "openclaw/plugin-sdk/channel-feedback";
@@ -809,7 +811,7 @@ const SAS_NOTICE_RETRY_DELAY_MS = 750;
809
811
  const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
810
812
  let matrixDirectRoomDepsPromise;
811
813
  async function loadMatrixDirectRoomDeps() {
812
- matrixDirectRoomDepsPromise ??= Promise.all([import("./send-peVVVL75.js").then((n) => n.d), import("./send-peVVVL75.js").then((n) => n.m)]).then(([directManagementModule, directRoomModule]) => ({
814
+ matrixDirectRoomDepsPromise ??= Promise.all([import("./send-DHj1E9ji.js").then((n) => n.d), import("./send-DHj1E9ji.js").then((n) => n.m)]).then(([directManagementModule, directRoomModule]) => ({
813
815
  inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
814
816
  isStrictDirectRoom: directRoomModule.isStrictDirectRoom
815
817
  }));
@@ -2017,7 +2019,7 @@ let sessionBindingRuntimePromise;
2017
2019
  let matrixReactionEventsPromise;
2018
2020
  let matrixDraftStreamPromise;
2019
2021
  function loadMatrixSendModule() {
2020
- matrixSendModulePromise ??= import("./send-peVVVL75.js").then((n) => n.l);
2022
+ matrixSendModulePromise ??= import("./send-DHj1E9ji.js").then((n) => n.l);
2021
2023
  return matrixSendModulePromise;
2022
2024
  }
2023
2025
  function loadAcpBindingRuntime() {
@@ -2029,11 +2031,11 @@ function loadSessionBindingRuntime() {
2029
2031
  return sessionBindingRuntimePromise;
2030
2032
  }
2031
2033
  function loadMatrixReactionEvents() {
2032
- matrixReactionEventsPromise ??= import("./reaction-events-D3jtYqTp.js");
2034
+ matrixReactionEventsPromise ??= import("./reaction-events-Bh2u-_9j.js");
2033
2035
  return matrixReactionEventsPromise;
2034
2036
  }
2035
2037
  function loadMatrixDraftStream() {
2036
- matrixDraftStreamPromise ??= import("./draft-stream-r49dgIZc.js");
2038
+ matrixDraftStreamPromise ??= import("./draft-stream-eaBWrjVK.js");
2037
2039
  return matrixDraftStreamPromise;
2038
2040
  }
2039
2041
  async function matrixTextWouldActivateMentions(client, text) {
@@ -2197,15 +2199,17 @@ function createMatrixRoomMessageHandler(params) {
2197
2199
  const sharedDmContextNoticeRooms = /* @__PURE__ */ new Set();
2198
2200
  const readStoreAllowFrom = async () => {
2199
2201
  const now = Date.now();
2200
- if (cachedStoreAllowFrom && now < cachedStoreAllowFrom.expiresAtMs) return cachedStoreAllowFrom.value;
2202
+ if (cachedStoreAllowFrom && isFutureDateTimestampMs(cachedStoreAllowFrom.expiresAtMs, { nowMs: now })) return cachedStoreAllowFrom.value;
2203
+ cachedStoreAllowFrom = null;
2201
2204
  const value = await core.channel.pairing.readAllowFromStore({
2202
2205
  channel: "matrix",
2203
2206
  env: process.env,
2204
2207
  accountId
2205
2208
  }).catch(() => []);
2206
- cachedStoreAllowFrom = {
2209
+ const expiresAtMs = resolveExpiresAtMsFromDurationMs(ALLOW_FROM_STORE_CACHE_TTL_MS, { nowMs: now });
2210
+ cachedStoreAllowFrom = expiresAtMs === void 0 ? null : {
2207
2211
  value,
2208
- expiresAtMs: now + ALLOW_FROM_STORE_CACHE_TTL_MS
2212
+ expiresAtMs
2209
2213
  };
2210
2214
  return value;
2211
2215
  };
@@ -2274,7 +2278,7 @@ function createMatrixRoomMessageHandler(params) {
2274
2278
  if (typeof eventTs === "number" && eventTs < startupMs - startupGraceMs) return;
2275
2279
  if (typeof eventTs !== "number" && typeof eventAge === "number" && eventAge > startupGraceMs) return;
2276
2280
  }
2277
- let content = event.content;
2281
+ const content = event.content;
2278
2282
  if (eventType === EventType.RoomMessage && isMatrixVerificationRoomMessage({
2279
2283
  msgtype: content.msgtype,
2280
2284
  body: content.body
@@ -2527,7 +2531,11 @@ function createMatrixRoomMessageHandler(params) {
2527
2531
  resolveAgentRoute: core.channel.routing.resolveAgentRoute
2528
2532
  });
2529
2533
  const hasExplicitSessionBinding = _configuredBinding !== null || _runtimeBindingId !== null;
2530
- const agentMentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, _route.agentId);
2534
+ const agentMentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, _route.agentId, {
2535
+ provider: "matrix",
2536
+ conversationId: roomId,
2537
+ providerPolicy: accountConfig?.mentionPatterns
2538
+ });
2531
2539
  const selfDisplayName = content.formatted_body ? await getMemberDisplayName(roomId, selfUserId).catch(() => void 0) : void 0;
2532
2540
  const { wasMentioned, hasExplicitMention } = resolveMentions({
2533
2541
  content,
@@ -3476,17 +3484,20 @@ function createMatrixRoomMessageHandler(params) {
3476
3484
  //#endregion
3477
3485
  //#region extensions/matrix/src/matrix/monitor/inbound-dedupe.ts
3478
3486
  const INBOUND_DEDUPE_FILENAME = "inbound-dedupe.json";
3487
+ const INBOUND_DEDUPE_NAMESPACE = "inbound-dedupe";
3488
+ const INBOUND_DEDUPE_MIGRATIONS_NAMESPACE = "inbound-dedupe-migrations";
3479
3489
  const STORE_VERSION = 1;
3480
3490
  const DEFAULT_MAX_ENTRIES = 2e4;
3481
3491
  const DEFAULT_TTL_MS = 720 * 60 * 60 * 1e3;
3482
- const PERSIST_DEBOUNCE_MS = 250;
3483
3492
  function normalizeEventPart(value) {
3484
3493
  return value.trim();
3485
3494
  }
3486
3495
  function buildEventKey(params) {
3496
+ const accountId = normalizeEventPart(params.auth.accountId) || "default";
3487
3497
  const roomId = normalizeEventPart(params.roomId);
3488
3498
  const eventId = normalizeEventPart(params.eventId);
3489
- return roomId && eventId ? `${roomId}|${eventId}` : "";
3499
+ if (!roomId || !eventId) return "";
3500
+ return `${accountId}:${createHash("sha256").update(accountId).update("\0").update(roomId).update("\0").update(eventId).digest("hex")}`;
3490
3501
  }
3491
3502
  function resolveInboundDedupeStatePath(params) {
3492
3503
  return resolveMatrixStateFilePath({
@@ -3512,25 +3523,48 @@ function pruneSeenEvents(params) {
3512
3523
  return;
3513
3524
  }
3514
3525
  while (seen.size > max) {
3515
- const oldestKey = seen.keys().next().value;
3526
+ const oldestKey = [...seen.entries()].toSorted((a, b) => a[1] - b[1] || a[0].localeCompare(b[0]))[0]?.[0];
3516
3527
  if (typeof oldestKey !== "string") break;
3517
3528
  seen.delete(oldestKey);
3518
3529
  }
3519
3530
  }
3520
- function toStoredState(params) {
3521
- pruneSeenEvents(params);
3522
- return {
3523
- version: STORE_VERSION,
3524
- entries: Array.from(params.seen.entries()).map(([key, ts]) => ({
3525
- key,
3526
- ts
3527
- }))
3528
- };
3531
+ function createInboundDedupeStore(params) {
3532
+ return getMatrixRuntime().state.openKeyedStore({
3533
+ namespace: INBOUND_DEDUPE_NAMESPACE,
3534
+ maxEntries: DEFAULT_MAX_ENTRIES,
3535
+ env: resolveMatrixSqliteStateEnv(params)
3536
+ });
3537
+ }
3538
+ function createInboundDedupeMigrationStore(params) {
3539
+ return getMatrixRuntime().state.openKeyedStore({
3540
+ namespace: INBOUND_DEDUPE_MIGRATIONS_NAMESPACE,
3541
+ maxEntries: 1e3,
3542
+ env: resolveMatrixSqliteStateEnv(params)
3543
+ });
3544
+ }
3545
+ function buildLegacyImportKey(params) {
3546
+ const accountId = normalizeEventPart(params.auth.accountId) || "default";
3547
+ return `${accountId}:${createHash("sha256").update(accountId).update("\0").update(params.storagePath).digest("hex")}`;
3529
3548
  }
3530
- async function readStoredState(storagePath) {
3549
+ async function loadLegacyEntries(storagePath) {
3531
3550
  const { value } = await readJsonFileWithFallback(storagePath, null);
3532
- if (value?.version !== STORE_VERSION || !Array.isArray(value.entries)) return null;
3533
- return value;
3551
+ if (value?.version !== STORE_VERSION || !Array.isArray(value.entries)) return [];
3552
+ const entries = [];
3553
+ for (const entry of value.entries) {
3554
+ if (!entry || typeof entry.key !== "string") continue;
3555
+ const separatorIndex = entry.key.indexOf("|");
3556
+ if (separatorIndex <= 0) continue;
3557
+ const roomId = entry.key.slice(0, separatorIndex).trim();
3558
+ const eventId = entry.key.slice(separatorIndex + 1).trim();
3559
+ const ts = normalizeTimestamp(entry.ts);
3560
+ if (!roomId || !eventId || ts === null) continue;
3561
+ entries.push({
3562
+ roomId,
3563
+ eventId,
3564
+ ts
3565
+ });
3566
+ }
3567
+ return entries;
3534
3568
  }
3535
3569
  async function createMatrixInboundEventDeduper(params) {
3536
3570
  const nowMs = params.nowMs ?? (() => Date.now());
@@ -3541,17 +3575,57 @@ async function createMatrixInboundEventDeduper(params) {
3541
3575
  env: params.env,
3542
3576
  stateDir: params.stateDir
3543
3577
  });
3578
+ const stateDir = params.stateDir ?? path.dirname(storagePath);
3579
+ const store = createInboundDedupeStore({
3580
+ env: params.env,
3581
+ stateDir
3582
+ });
3583
+ const migrationStore = createInboundDedupeMigrationStore({
3584
+ env: params.env,
3585
+ stateDir
3586
+ });
3544
3587
  const seen = /* @__PURE__ */ new Map();
3545
3588
  const pending = /* @__PURE__ */ new Set();
3546
- const persistLock = createAsyncLock();
3547
3589
  try {
3548
- const stored = await readStoredState(storagePath);
3549
- for (const entry of stored?.entries ?? []) {
3550
- if (!entry || typeof entry.key !== "string") continue;
3551
- const key = entry.key.trim();
3552
- const ts = normalizeTimestamp(entry.ts);
3553
- if (!key || ts === null) continue;
3554
- seen.set(key, ts);
3590
+ for (const entry of await store.entries()) {
3591
+ const value = entry.value;
3592
+ const roomId = typeof value?.roomId === "string" ? value.roomId.trim() : "";
3593
+ const eventId = typeof value?.eventId === "string" ? value.eventId.trim() : "";
3594
+ const ts = normalizeTimestamp(value?.ts);
3595
+ const expectedKey = buildEventKey({
3596
+ auth: params.auth,
3597
+ roomId,
3598
+ eventId
3599
+ });
3600
+ if (expectedKey && expectedKey === entry.key && ts !== null) seen.set(entry.key, ts);
3601
+ }
3602
+ const legacyImportKey = buildLegacyImportKey({
3603
+ auth: params.auth,
3604
+ storagePath
3605
+ });
3606
+ if (!await migrationStore.lookup(legacyImportKey)) {
3607
+ const legacyEntries = await loadLegacyEntries(storagePath);
3608
+ let migratedLegacyEntries = 0;
3609
+ for (const entry of legacyEntries) {
3610
+ const key = buildEventKey({
3611
+ auth: params.auth,
3612
+ roomId: entry.roomId,
3613
+ eventId: entry.eventId
3614
+ });
3615
+ if (!key) continue;
3616
+ if (seen.has(key)) {
3617
+ migratedLegacyEntries += 1;
3618
+ continue;
3619
+ }
3620
+ seen.set(key, entry.ts);
3621
+ await store.register(key, entry, ttlMs > 0 ? { ttlMs } : void 0).then(() => {
3622
+ migratedLegacyEntries += 1;
3623
+ }).catch(() => {});
3624
+ }
3625
+ if (legacyEntries.length > 0 && migratedLegacyEntries === legacyEntries.length) {
3626
+ await migrationStore.register(legacyImportKey, { importedAt: nowMs() });
3627
+ await fs.rm(storagePath, { force: true }).catch(() => {});
3628
+ }
3555
3629
  }
3556
3630
  pruneSeenEvents({
3557
3631
  seen,
@@ -3562,53 +3636,10 @@ async function createMatrixInboundEventDeduper(params) {
3562
3636
  } catch (err) {
3563
3637
  LogService.warn("MatrixInboundDedupe", "Failed loading Matrix inbound dedupe store:", err);
3564
3638
  }
3565
- let dirty = false;
3566
- let persistTimer = null;
3567
- let persistPromise = null;
3568
- const persist = async () => {
3569
- dirty = false;
3570
- const payload = toStoredState({
3571
- seen,
3572
- ttlMs,
3573
- maxEntries,
3574
- nowMs: nowMs()
3575
- });
3576
- try {
3577
- await persistLock(async () => {
3578
- await writeJsonFileAtomically(storagePath, payload);
3579
- });
3580
- } catch (err) {
3581
- dirty = true;
3582
- throw err;
3583
- }
3584
- };
3585
- const flush = async () => {
3586
- if (persistTimer) {
3587
- clearTimeout(persistTimer);
3588
- persistTimer = null;
3589
- }
3590
- for (;;) {
3591
- if (!dirty && !persistPromise) break;
3592
- if (dirty && !persistPromise) persistPromise = persist().finally(() => {
3593
- persistPromise = null;
3594
- });
3595
- await persistPromise;
3596
- }
3597
- };
3598
- const schedulePersist = () => {
3599
- dirty = true;
3600
- if (persistTimer) return;
3601
- persistTimer = setTimeout(() => {
3602
- persistTimer = null;
3603
- flush().catch((err) => {
3604
- LogService.warn("MatrixInboundDedupe", "Failed persisting Matrix inbound dedupe store:", err);
3605
- });
3606
- }, PERSIST_DEBOUNCE_MS);
3607
- persistTimer.unref?.();
3608
- };
3609
3639
  return {
3610
3640
  claimEvent: ({ roomId, eventId }) => {
3611
3641
  const key = buildEventKey({
3642
+ auth: params.auth,
3612
3643
  roomId,
3613
3644
  eventId
3614
3645
  });
@@ -3625,6 +3656,7 @@ async function createMatrixInboundEventDeduper(params) {
3625
3656
  },
3626
3657
  commitEvent: async ({ roomId, eventId }) => {
3627
3658
  const key = buildEventKey({
3659
+ auth: params.auth,
3628
3660
  roomId,
3629
3661
  eventId
3630
3662
  });
@@ -3639,24 +3671,25 @@ async function createMatrixInboundEventDeduper(params) {
3639
3671
  maxEntries,
3640
3672
  nowMs: nowMs()
3641
3673
  });
3642
- schedulePersist();
3674
+ await store.register(key, {
3675
+ roomId: normalizeEventPart(roomId),
3676
+ eventId: normalizeEventPart(eventId),
3677
+ ts
3678
+ }, ttlMs > 0 ? { ttlMs } : void 0).catch((err) => {
3679
+ LogService.warn("MatrixInboundDedupe", "Failed persisting Matrix inbound dedupe entry:", err);
3680
+ });
3643
3681
  },
3644
3682
  releaseEvent: ({ roomId, eventId }) => {
3645
3683
  const key = buildEventKey({
3684
+ auth: params.auth,
3646
3685
  roomId,
3647
3686
  eventId
3648
3687
  });
3649
3688
  if (!key) return;
3650
3689
  pending.delete(key);
3651
3690
  },
3652
- flush,
3653
- stop: async () => {
3654
- try {
3655
- await flush();
3656
- } catch (err) {
3657
- LogService.warn("MatrixInboundDedupe", "Failed to flush Matrix inbound dedupe store during stop():", err);
3658
- }
3659
- }
3691
+ flush: async () => {},
3692
+ stop: async () => {}
3660
3693
  };
3661
3694
  }
3662
3695
  //#endregion
@@ -3759,11 +3792,11 @@ function createMatrixRoomInfoResolver(client) {
3759
3792
  let matrixStartupMaintenanceDepsPromise;
3760
3793
  async function loadMatrixStartupMaintenanceDeps() {
3761
3794
  matrixStartupMaintenanceDepsPromise ??= Promise.all([
3762
- import("./setup-core-DOhHYRrZ.js").then((n) => n.s),
3795
+ import("./setup-core-DRg3cgB8.js").then((n) => n.s),
3763
3796
  import("./device-health-D4LBxuPq.js"),
3764
- import("./setup-core-DOhHYRrZ.js").then((n) => n.a),
3765
- import("./legacy-crypto-restore-BgW3I87R.js"),
3766
- import("./startup-verification-BmTEngvU.js")
3797
+ import("./setup-core-DRg3cgB8.js").then((n) => n.a),
3798
+ import("./legacy-crypto-restore--9Wu5rsx.js"),
3799
+ import("./startup-verification-CWLSyFen.js")
3767
3800
  ]).then(([configUpdateModule, deviceHealthModule, profileModule, legacyCryptoRestoreModule, startupVerificationModule]) => ({
3768
3801
  updateMatrixAccountConfig: configUpdateModule.updateMatrixAccountConfig,
3769
3802
  summarizeMatrixDeviceHealth: deviceHealthModule.summarizeMatrixDeviceHealth,
@@ -3991,8 +4024,7 @@ function createMatrixMonitorSyncLifecycle(params) {
3991
4024
  function createMatrixMonitorTaskRunner(params) {
3992
4025
  const inFlight = /* @__PURE__ */ new Set();
3993
4026
  const runDetachedTask = (label, task) => {
3994
- let trackedTask;
3995
- trackedTask = Promise.resolve().then(task).catch((error) => {
4027
+ const trackedTask = Promise.resolve().then(task).catch((error) => {
3996
4028
  const message = String(error);
3997
4029
  params.logVerboseMessage(`matrix: ${label} failed (${message})`);
3998
4030
  params.logger.warn("matrix background task failed", {
@@ -3,7 +3,7 @@ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runti
3
3
  //#region extensions/matrix/src/plugin-entry.runtime.ts
4
4
  let matrixVerificationRuntimePromise;
5
5
  function loadMatrixVerificationRuntime() {
6
- matrixVerificationRuntimePromise ??= import("./verification-BM7g0BeT.js").then((n) => n.y);
6
+ matrixVerificationRuntimePromise ??= import("./verification-BJfjKMr8.js").then((n) => n.y);
7
7
  return matrixVerificationRuntimePromise;
8
8
  }
9
9
  function sendError(respond, err) {
@@ -0,0 +1,3 @@
1
+ import { t as createMatrixClient } from "./create-client-B4CPKa5P.js";
2
+ import "./client-spaouc7I.js";
3
+ export { createMatrixClient };
@@ -1,6 +1,6 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
2
- import { c as resolveMatrixConfigPath, l as updateMatrixAccountConfig, o as syncMatrixOwnProfile } from "./setup-core-DOhHYRrZ.js";
3
- import { n as withResolvedActionClient } from "./client-BIBY50VG.js";
2
+ import { c as resolveMatrixConfigPath, l as updateMatrixAccountConfig, o as syncMatrixOwnProfile } from "./setup-core-DRg3cgB8.js";
3
+ import { n as withResolvedActionClient } from "./client-D-t6CdHz.js";
4
4
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
5
  //#region extensions/matrix/src/matrix/actions/profile.ts
6
6
  async function updateMatrixOwnProfile(opts = {}) {
@@ -7,7 +7,7 @@ import { getSessionBindingService } from "openclaw/plugin-sdk/session-binding-ru
7
7
  let approvalReactionAuthPromise;
8
8
  let execApprovalResolverPromise;
9
9
  function loadApprovalReactionAuth() {
10
- approvalReactionAuthPromise ??= import("./approval-reaction-auth-D0nZ_4ik.js");
10
+ approvalReactionAuthPromise ??= import("./approval-reaction-auth-m-11_ajL.js");
11
11
  return approvalReactionAuthPromise;
12
12
  }
13
13
  function loadExecApprovalResolver() {
@@ -1,5 +1,5 @@
1
1
  import { n as formatMatrixErrorReason, t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
2
- import { f as LogService } from "./shared-CmsjJY4i.js";
2
+ import { f as LogService } from "./shared-DjJds8e0.js";
3
3
  import { loadJsonFile, saveJsonFile } from "openclaw/plugin-sdk/json-store";
4
4
  import { decodeRecoveryKey } from "matrix-js-sdk/lib/crypto-api/recovery-key.js";
5
5
  //#region extensions/matrix/src/matrix/sdk/idb-persistence-lock.ts
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { n as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
3
- import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-M-3KeudM.js";
3
+ import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DgjzYeC_.js";
4
4
  import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/matrix/src/resolve-targets.ts
6
6
  var resolve_targets_exports = /* @__PURE__ */ __exportAll({ resolveMatrixTargets: () => resolveMatrixTargets });
@@ -1,4 +1,4 @@
1
- import { t as resolveMatrixTargets } from "./resolve-targets-D-K3tTPe.js";
1
+ import { t as resolveMatrixTargets } from "./resolve-targets-CLuzv_Jl.js";
2
2
  //#region extensions/matrix/src/resolver.runtime.ts
3
3
  const matrixResolverRuntime = { resolveMatrixTargets };
4
4
  //#endregion
@@ -1,8 +1,8 @@
1
- import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, p as setMatrixThreadBindingMaxAgeBySessionKey } from "./thread-bindings-shared-CKnY4LSd.js";
2
- import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, o as resolveMatrixAccountStringValues, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-C3arLOhC.js";
1
+ import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, o as resolveMatrixAccountStringValues, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-DEMtY2cn.js";
3
2
  import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-KzaYveuy.js";
4
3
  import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
5
- import { a as resolveMatrixCredentialsPath, c as resolveMatrixLegacyFlatStoreRoot, i as resolveMatrixCredentialsFilename, l as sanitizeMatrixPathSegment, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as resolveMatrixLegacyFlatStoragePaths, t as hashMatrixAccessToken } from "./storage-paths-BV2Z7bns.js";
4
+ import { a as resolveMatrixCredentialsPath, c as resolveMatrixLegacyFlatStoreRoot, i as resolveMatrixCredentialsFilename, l as sanitizeMatrixPathSegment, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as resolveMatrixLegacyFlatStoragePaths, t as hashMatrixAccessToken } from "./storage-paths-BWo_ZEMC.js";
5
+ import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, p as setMatrixThreadBindingMaxAgeBySessionKey } from "./thread-bindings-shared-CKnY4LSd.js";
6
6
  import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-BVWGd2XS.js";
7
7
  import { assertHttpUrlTargetsPrivateNetwork, closeDispatcher, createPinnedDispatcher, resolvePinnedHostnameWithPolicy, ssrfPolicyFromAllowPrivateNetwork, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
8
8
  import { writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
@@ -1,3 +1,3 @@
1
- import { a as detectLegacyMatrixCrypto, i as autoPrepareLegacyMatrixCrypto, n as hasPendingMatrixMigration, o as autoMigrateLegacyMatrixState, r as resolveMatrixMigrationStatus, s as detectLegacyMatrixState, t as hasActionableMatrixMigration } from "./matrix-migration.runtime-CZOep_JX.js";
1
+ import { a as detectLegacyMatrixCrypto, i as autoPrepareLegacyMatrixCrypto, n as hasPendingMatrixMigration, o as autoMigrateLegacyMatrixState, r as resolveMatrixMigrationStatus, s as detectLegacyMatrixState, t as hasActionableMatrixMigration } from "./matrix-migration.runtime-RzIEp7RP.js";
2
2
  import { t as maybeCreateMatrixMigrationSnapshot } from "./migration-snapshot-backup-YcCrSjbE.js";
3
3
  export { autoMigrateLegacyMatrixState, autoPrepareLegacyMatrixCrypto, detectLegacyMatrixCrypto, detectLegacyMatrixState, hasActionableMatrixMigration, hasPendingMatrixMigration, maybeCreateMatrixMigrationSnapshot, resolveMatrixMigrationStatus };
@@ -1,19 +1,19 @@
1
1
  import { t as isRecord } from "./record-shared-CvzjvHRn.js";
2
2
  import { n as formatMatrixErrorReason, r as isMatrixNotFoundError, t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
3
- import { t as claimCurrentTokenStorageState } from "./storage-onzulLbU.js";
4
- import { c as createMatrixStartupAbortError, d as ConsoleLogger, f as LogService, p as noop, u as throwIfMatrixStartupAborted } from "./shared-CmsjJY4i.js";
3
+ import { t as claimCurrentTokenStorageState } from "./storage-Ds-2Iur5.js";
4
+ import { c as createMatrixStartupAbortError, d as ConsoleLogger, f as LogService, p as noop, u as throwIfMatrixStartupAborted } from "./shared-DjJds8e0.js";
5
5
  import { a as matrixEventToRaw, n as createMatrixGuardedFetch, o as parseMxc, t as MatrixAuthedHttpClient } from "./http-client-KTzUzlpv.js";
6
6
  import { n as resolveMatrixRoomKeyBackupReadinessError } from "./backup-health-Dm_YMVFT.js";
7
- import { createMatrixJsSdkClientLogger } from "./logging-yEwXx4Hm.js";
7
+ import { createMatrixJsSdkClientLogger } from "./logging-C7wjdKK5.js";
8
8
  import { t as createAsyncLock } from "./async-lock-BcLS4KOc.js";
9
9
  import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState } from "./sync-state-CWbp0QSY.js";
10
- import { n as isRepairableSecretStorageAccessError, r as MATRIX_IDB_PERSIST_INTERVAL_MS, t as MatrixRecoveryKeyStore } from "./recovery-key-store-DfQ_9s6u.js";
10
+ import { n as isRepairableSecretStorageAccessError, r as MATRIX_IDB_PERSIST_INTERVAL_MS, t as MatrixRecoveryKeyStore } from "./recovery-key-store-BRnvY8XS.js";
11
11
  import { normalizeNullableString, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
12
12
  import { readFileSync } from "node:fs";
13
13
  import path from "node:path";
14
14
  import { writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
15
- import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
16
15
  import fs$1 from "node:fs/promises";
16
+ import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
17
17
  import { EventEmitter } from "node:events";
18
18
  import { Category, ClientEvent, Filter, MatrixEventEvent, MemoryStore, Preset, SyncAccumulator, createClient } from "matrix-js-sdk/lib/matrix.js";
19
19
  import { VerificationMethod } from "matrix-js-sdk/lib/types.js";
@@ -288,7 +288,7 @@ function createMatrixExplicitBootstrapOptions(params) {
288
288
  let loadedMatrixCryptoRuntime = null;
289
289
  let matrixCryptoRuntimePromise = null;
290
290
  async function loadMatrixCryptoRuntime() {
291
- matrixCryptoRuntimePromise ??= import("./crypto-runtime-oweQ3RiB.js").then((runtime) => {
291
+ matrixCryptoRuntimePromise ??= import("./crypto-runtime-3hgwY-d6.js").then((runtime) => {
292
292
  loadedMatrixCryptoRuntime = runtime;
293
293
  return runtime;
294
294
  });
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { r as normalizeMatrixResolvableTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
3
2
  import { c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
4
3
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
4
+ import { r as normalizeMatrixResolvableTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
5
5
  import { n as MATRIX_REACTION_EVENT_TYPE, r as buildMatrixReactionContent, t as MATRIX_ANNOTATION_RELATION_TYPE } from "./reaction-common-DkrQdBSZ.js";
6
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
7
6
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
7
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
9
9
  import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
10
10
  import { normalizePollInput } from "openclaw/plugin-sdk/poll-runtime";
@@ -229,7 +229,7 @@ function buildPollResponseContent(pollEventId, answerIds) {
229
229
  //#region extensions/matrix/src/matrix/send/client.ts
230
230
  let matrixSendClientRuntimePromise = null;
231
231
  async function loadMatrixSendClientRuntime() {
232
- matrixSendClientRuntimePromise ??= import("./client-bootstrap-Chmkqhy7.js").then((n) => n.t);
232
+ matrixSendClientRuntimePromise ??= import("./client-bootstrap-DOlQb7Jx.js").then((n) => n.t);
233
233
  return await matrixSendClientRuntimePromise;
234
234
  }
235
235
  function resolveMediaMaxBytes(accountId, cfg) {
@@ -333,7 +333,9 @@ function restoreEscapedMentionsInBlockTokens(tokens) {
333
333
  function isMentionStartBoundary(charBefore) {
334
334
  return !charBefore || !/[A-Za-z0-9_]/.test(charBefore);
335
335
  }
336
- function trimMentionSuffix(raw, end) {
336
+ function trimMentionSuffix(rawInput, endInput) {
337
+ let raw = rawInput;
338
+ let end = endInput;
337
339
  while (raw.length > 1 && TRIMMABLE_MENTION_SUFFIX.test(raw.at(-1) ?? "")) {
338
340
  if (raw.at(-1) === "]" && /\[[0-9A-Fa-f:.]+\](?::\d+)?$/i.test(raw)) break;
339
341
  raw = raw.slice(0, -1);
@@ -1,7 +1,7 @@
1
1
  import { a as hasExplicitMatrixAccountConfig, c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
2
- import "./setup-core-DOhHYRrZ.js";
2
+ import "./setup-core-DRg3cgB8.js";
3
3
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
4
- import { n as bootstrapMatrixVerification } from "./verification-BM7g0BeT.js";
4
+ import { n as bootstrapMatrixVerification } from "./verification-BJfjKMr8.js";
5
5
  //#region extensions/matrix/src/setup-bootstrap.ts
6
6
  async function maybeBootstrapNewEncryptedMatrixAccount(params) {
7
7
  const accountConfig = resolveMatrixAccountConfig({
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as resolveMatrixDefaultOrOnlyAccountId, o as resolveMatrixAccountStringValues, r as resolveConfiguredMatrixAccountIds } from "./account-selection-C3arLOhC.js";
2
+ import { a as resolveMatrixDefaultOrOnlyAccountId, o as resolveMatrixAccountStringValues, r as resolveConfiguredMatrixAccountIds } from "./account-selection-DEMtY2cn.js";
3
3
  import { c as resolveMatrixAccountConfig, i as findMatrixAccountConfig, l as resolveMatrixBaseConfig, n as resolveMatrixConfigPath$1, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-ZBCMwSos.js";
4
4
  import { i as resolveScopedMatrixEnvConfig, n as resolveGlobalMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness } from "./env-auth-DIzOApj0.js";
5
- import { i as loadMatrixCredentials, n as credentialsMatchConfig } from "./credentials-read-DySnJlLx.js";
6
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
+ import { i as loadMatrixCredentials, n as credentialsMatchConfig } from "./credentials-read-DpxFOhx0.js";
7
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
8
8
  import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input-runtime";
9
9
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/routing";
10
10
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2, addWildcardAllowFrom, applyAccountNameToChannelSection, normalizeAccountId as normalizeAccountId$2, normalizeAllowFromEntries, normalizeSecretInputString, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
@@ -669,7 +669,7 @@ const matrixSetupAdapter = {
669
669
  input
670
670
  }),
671
671
  afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
672
- const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-CiX7Pd07.js");
672
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-kTPKb7jR.js");
673
673
  await runMatrixSetupBootstrapAfterConfigWrite({
674
674
  previousCfg,
675
675
  cfg,
@@ -1,5 +1,5 @@
1
- import { g as resolveMatrixAccount, n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-DOhHYRrZ.js";
2
- import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-wK02TzmZ.js";
1
+ import { g as resolveMatrixAccount, n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-DRg3cgB8.js";
2
+ import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-DfjBrYch.js";
3
3
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
4
4
  const matrixSetupPlugin = {
5
5
  id: "matrix",
@@ -13,7 +13,7 @@ const matrixSetupPlugin = {
13
13
  order: 70,
14
14
  quickstartAllowFrom: true
15
15
  },
16
- setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-CrUp7oeN.js").then((n) => n.t)).matrixSetupWizard })),
16
+ setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-soZQLgfu.js").then((n) => n.t)).matrixSetupWizard })),
17
17
  setup: matrixSetupAdapter,
18
18
  capabilities: {
19
19
  chatTypes: [