@openclaw/matrix 2026.9.1-beta.1 → 2026.9.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 (81) hide show
  1. package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
  2. package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
  3. package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
  4. package/dist/api.js +5 -5
  5. package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-B_6ytY5I.js} +34 -11
  6. package/dist/{approval-ids-C6FD3pVY.js → approval-ids-CfHtZ9d1.js} +1 -1
  7. package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-BpDvJqfy.js} +2 -2
  8. package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
  9. package/dist/{channel-CBEvelTE.js → channel-b-jES-oi.js} +63 -58
  10. package/dist/channel-plugin-api.js +1 -1
  11. package/dist/channel.runtime-BkqjwEDU.js +76 -0
  12. package/dist/{channel.setup-sWPOGyQG.js → channel.setup-BY42QaL7.js} +28 -21
  13. package/dist/{cli-DrTD2a_q.js → cli-CtYeU7ol.js} +42 -32
  14. package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-B7MQjR5S.js} +1 -1
  15. package/dist/cli-metadata.js +1 -1
  16. package/dist/{client-BUtHbzib.js → client-D2utPQ1E.js} +2 -2
  17. package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
  18. package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
  19. package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
  20. package/dist/contract-api.js +2 -2
  21. package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
  22. package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
  23. package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
  24. package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
  25. package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
  26. package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
  27. package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
  28. package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
  29. package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
  30. package/dist/doctor-contract-api.js +89 -109
  31. package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DPYdv4fE.js} +1 -1
  32. package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
  33. package/dist/helper-api.js +1 -1
  34. package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
  35. package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
  36. package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
  37. package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/{messages-Dow9EOoJ.js → messages-C1U3b1oN.js} +154 -5
  40. package/dist/{monitor-DBB47wTy.js → monitor-SNnu-0bp.js} +177 -130
  41. package/dist/outbound-CeCEtF_q.js +220 -0
  42. package/dist/plugin-entry.handlers.runtime.js +1 -1
  43. package/dist/probe.runtime-B1YPxG9x.js +2 -0
  44. package/dist/{profile-update-C61NR24_.js → profile-update-Cd1p8ABr.js} +5 -4
  45. package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
  46. package/dist/{reaction-events-BZUgLIZI.js → reaction-events-DveJRUaX.js} +9 -7
  47. package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
  48. package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
  49. package/dist/{room-info-BXQA7y10.js → room-info-DVkKDscD.js} +55 -1
  50. package/dist/runtime-api.js +2 -2
  51. package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
  52. package/dist/{send-BKu9Ghi4.js → send-DG7Bnj7_.js} +26 -24
  53. package/dist/session-binding-contract-api.js +1 -1
  54. package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-Co985F63.js} +3 -3
  55. package/dist/{setup-core-CyvaCOOr.js → setup-core-CEF6exLW.js} +8 -7
  56. package/dist/setup-plugin-api.js +1 -1
  57. package/dist/{setup-surface-DtRvRcCT.js → setup-surface-BSlj1vnL.js} +84 -79
  58. package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
  59. package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
  60. package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
  61. package/dist/subagent-hooks-api.js +1 -1
  62. package/dist/sync-cache-state-d-A_OhbU.js +234 -0
  63. package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-DgxQEB99.js} +4 -4
  64. package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-vbkQgU7D.js} +226 -215
  65. package/dist/{verification-BP-3-XYn.js → verification-D-iOebn4.js} +2 -2
  66. package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
  67. package/node_modules/matrix-js-sdk/lib/client.js +6 -2
  68. package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
  69. package/node_modules/matrix-js-sdk/src/client.ts +7 -3
  70. package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
  71. package/node_modules/typebox/build/format/email.mjs +1 -1
  72. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  73. package/node_modules/typebox/package.json +1 -1
  74. package/openclaw.plugin.json +16 -1
  75. package/package.json +7 -6
  76. package/dist/channel.runtime-CiDl9deX.js +0 -276
  77. package/dist/env-auth-MVS-Vv41.js +0 -64
  78. package/dist/file-sync-store-DjskBX2o.js +0 -436
  79. package/dist/media-text-OR9uoC4W.js +0 -153
  80. package/dist/probe.runtime-CRM7RIrB.js +0 -2
  81. package/dist/recovery-key-store-CognuDys.js +0 -276
@@ -1,29 +1,30 @@
1
- import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-BZWN9tGS.js";
1
+ import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-CRsKoMqJ.js";
2
2
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { n as resolveConfiguredMatrixBotUserIds } from "./accounts-BCzyubQt.js";
4
- import { _ as logInboundDrop, a as resolveMatrixThreadRootId, b as summarizeMapping, c as RelationType, d as buildAllowlistResolutionSummary, f as canonicalizeAllowlistWithResolvedIds, g as getAgentScopedMediaLocalRoots, h as formatLocationText, i as resolveMatrixReplyToEventId, l as resolveMatrixRoomConfig, m as createTypingCallbacks, n as resolveMatrixStoredSessionMeta, o as resolveMatrixThreadRouting, p as createReplyPrefixOptions, r as resolveMatrixInboundRoute, s as EventType, u as addAllowlistUserEntriesFromConfigEntry, v as logTypingFailure, x as toLocationContext, y as patchAllowlistUsersInConfigEntries } from "./channel-CBEvelTE.js";
5
- import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./channel.setup-sWPOGyQG.js";
3
+ import { n as resolveConfiguredMatrixBotUserIds } from "./accounts-DR1c4xF_.js";
4
+ import { _ as logInboundDrop, a as resolveMatrixThreadRootId, b as summarizeMapping, c as RelationType, d as buildAllowlistResolutionSummary, f as canonicalizeAllowlistWithResolvedIds, g as getAgentScopedMediaLocalRoots, h as formatLocationText, i as resolveMatrixReplyToEventId, l as resolveMatrixRoomConfig, m as createTypingCallbacks, n as resolveMatrixStoredSessionMeta, o as resolveMatrixThreadRouting, p as createReplyPrefixOptions, r as resolveMatrixInboundRoute, s as EventType, u as addAllowlistUserEntriesFromConfigEntry, v as logTypingFailure, x as toLocationContext, y as patchAllowlistUsersInConfigEntries } from "./channel-b-jES-oi.js";
5
+ import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./channel.setup-BY42QaL7.js";
6
6
  import { n as isMatrixRoomId, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
7
- import { C as promoteMatrixDirectRoomCandidate, T as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, _ as parsePollStartContent, c as chunkMatrixText, f as formatPollAsText, h as isPollStartType, m as isPollEventType, r as sendMessageMatrix } from "./send-BKu9Ghi4.js";
7
+ import { S as promoteMatrixDirectRoomCandidate, d as formatPollAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, w as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY } from "./send-DG7Bnj7_.js";
8
8
  import { i as isStrictDirectMembership, n as hasDirectMatrixMemberFlag, o as readJoinedMatrixMembers } from "./direct-room-RinHjtqX.js";
9
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-BvyU66kE.js";
10
- import { a as resolveBundledMatrixReplacementContent, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-OR9uoC4W.js";
9
+ import { t as createMatrixThreadBindingManager } from "./thread-bindings-DgxQEB99.js";
10
+ import { c as formatMatrixMediaTooLargeText, d as isLikelyBareFilename, f as resolveBundledMatrixReplacementContent, l as formatMatrixMediaUnavailableText, m as fetchMatrixPollSnapshot, r as readMatrixMessages, u as formatMatrixMessageText } from "./messages-C1U3b1oN.js";
11
11
  import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
12
- import { a as throwIfMatrixStartupAborted, c as resolveMatrixAuth, i as isMatrixStartupAbortError, l as resolveMatrixAuthContext, n as acquireSharedMatrixClient, s as backfillMatrixAuthDeviceIdAfterStartup } from "./client-hs1ePy2O.js";
13
- import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-D8o8b9u6.js";
14
- import { t as resolveMatrixTargets } from "./resolve-targets-DXzZwsIY.js";
15
- import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-DmLY8NiO.js";
16
- import { createMatrixInboundEventDeduper } from "./inbound-dedupe-RvSLqdsz.js";
12
+ import { a as throwIfMatrixStartupAborted, c as backfillMatrixAuthDeviceIdAfterStartup, i as isMatrixStartupAbortError, l as resolveMatrixAuth, n as acquireSharedMatrixClient, o as createMatrixMonitorTaskRunner, u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
13
+ import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-DOmFvKvB.js";
14
+ import { n as prepareMatrixReplyPayload, r as resolveMatrixExtraContent } from "./outbound-CeCEtF_q.js";
15
+ import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
16
+ import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-BNcZNQZI.js";
17
+ import { createMatrixInboundEventDeduper } from "./inbound-dedupe-Ch33GU06.js";
17
18
  import { a as isMatrixAccessTokenInvalidatedError, d as isMatrixDisconnectedSyncState, f as isMatrixReadySyncState, p as isMatrixTerminalSyncState } from "./client-support-DLj4vDeu.js";
18
- import { n as setBoundedMap, t as createMatrixRoomInfoResolver } from "./room-info-BXQA7y10.js";
19
+ import { i as setBoundedMap, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-DVkKDscD.js";
19
20
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
20
21
  import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftCompositor, createMessageReceiptFromOutboundResults, createPreviewMessageReceipt, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftLine, formatChannelProgressDraftText, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
21
22
  import { normalizeLowercaseStringOrEmpty, normalizeNullableString, normalizeOptionalString, normalizeStringifiedEntries, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
22
23
  import { stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
23
24
  import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
24
- import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
25
+ import { extractErrorCode, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
25
26
  import { isFutureDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
26
- import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
27
+ import { resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
27
28
  import { createChannelInboundEnvelopeBuilder, createChannelPartialDeliveryError, hasFinalInboundReplyDispatch, isChannelPartialDeliveryError, resolveInboundMentionDecision, resolveInboundReplyDispatchCounts, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
28
29
  import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
29
30
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
@@ -35,6 +36,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
35
36
  import { GROUP_POLICY_BLOCKED_LABEL, resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
36
37
  import { resolveThreadBindingIdleTimeoutMsForChannel, resolveThreadBindingMaxAgeMsForChannel } from "openclaw/plugin-sdk/thread-bindings-runtime";
37
38
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
39
+ import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
38
40
  import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
39
41
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
40
42
  import { evaluateSupplementalContextVisibility, resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
@@ -326,15 +328,16 @@ async function resolveMatrixMonitorLiveUserAllowlist(params) {
326
328
  });
327
329
  }
328
330
  if (pending.length === 0) return effective;
331
+ const resolution = await resolveMatrixMonitorUserEntries({
332
+ cfg: params.cfg,
333
+ accountId: params.accountId,
334
+ entries: pending,
335
+ runtime: params.runtime,
336
+ resolveTargets: params.resolveTargets ?? resolveMatrixTargets
337
+ });
329
338
  const canonicalized = canonicalizeAllowlistWithResolvedIds({
330
339
  existing: pending,
331
- resolvedMap: (await resolveMatrixMonitorUserEntries({
332
- cfg: params.cfg,
333
- accountId: params.accountId,
334
- entries: pending,
335
- runtime: params.runtime,
336
- resolveTargets: params.resolveTargets ?? resolveMatrixTargets
337
- })).resolvedMap,
340
+ resolvedMap: resolution.resolvedMap,
338
341
  entryKey: normalizeMatrixUserId
339
342
  });
340
343
  const resolvedEntries = params.failClosedOnUnresolved ? filterFailClosedMatrixAllowlistEntries(canonicalized) : filterResolvedMatrixAllowlistEntries(canonicalized);
@@ -604,7 +607,7 @@ function createDirectRoomTracker(client, opts = {}) {
604
607
  return false;
605
608
  }
606
609
  const selfUserId = params.selfUserId ?? await ensureSelfUserId();
607
- const joinedMembers = await resolveJoinedMembers(roomId);
610
+ const joinedMembers = params.joinedMembers ?? await resolveJoinedMembers(roomId);
608
611
  const strictDirectMembership = isStrictDirectMembership({
609
612
  selfUserId,
610
613
  remoteUserId: senderId,
@@ -820,7 +823,7 @@ const matrixVerificationConstants = {
820
823
  const MAX_TRACKED_VERIFICATION_EVENTS = 1024;
821
824
  const SAS_NOTICE_RETRY_DELAY_MS = 750;
822
825
  const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
823
- const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-BKu9Ghi4.js").then((n) => n.S), import("./direct-room-RinHjtqX.js").then((n) => n.t)]).then(([directManagementModule, directRoomModule]) => ({
826
+ const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-DG7Bnj7_.js").then((n) => n.x), import("./direct-room-RinHjtqX.js").then((n) => n.t)]).then(([directManagementModule, directRoomModule]) => ({
824
827
  inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
825
828
  isStrictDirectRoom: directRoomModule.isStrictDirectRoom
826
829
  })));
@@ -930,10 +933,11 @@ async function resolveVerificationSummaryForSignal(client, params) {
930
933
  const byTransactionId = list.find((entry) => candidates.some((candidate) => entry.transactionId === candidate));
931
934
  if (byTransactionId) return byTransactionId;
932
935
  const { inspectMatrixDirectRooms, isStrictDirectRoom } = await loadMatrixDirectRoomDeps();
933
- const activeRoomId = normalizeNullableString((await inspectMatrixDirectRooms({
936
+ const inspection = await inspectMatrixDirectRooms({
934
937
  client,
935
938
  remoteUserId: params.senderId
936
- }).catch(() => null))?.activeRoomId);
939
+ }).catch(() => null);
940
+ const activeRoomId = normalizeNullableString(inspection?.activeRoomId);
937
941
  if (activeRoomId) {
938
942
  if (activeRoomId !== params.roomId) return null;
939
943
  } else if (!await isStrictDirectRoom({
@@ -1013,10 +1017,11 @@ function createMatrixVerificationEventRouter(params) {
1013
1017
  const verificationUserRooms = /* @__PURE__ */ new Map();
1014
1018
  async function resolveActiveDirectRoomId(remoteUserId) {
1015
1019
  const { inspectMatrixDirectRooms } = await loadMatrixDirectRoomDeps();
1016
- return normalizeNullableString((await inspectMatrixDirectRooms({
1020
+ const inspection = await inspectMatrixDirectRooms({
1017
1021
  client: params.client,
1018
1022
  remoteUserId
1019
- }).catch(() => null))?.activeRoomId);
1023
+ }).catch(() => null);
1024
+ return normalizeNullableString(inspection?.activeRoomId);
1020
1025
  }
1021
1026
  function shouldEmitVerificationEventNotice(event) {
1022
1027
  const eventTs = typeof event.origin_server_ts === "number" && Number.isFinite(event.origin_server_ts) ? event.origin_server_ts : null;
@@ -1169,7 +1174,7 @@ function createMatrixVerificationEventRouter(params) {
1169
1174
  }
1170
1175
  //#endregion
1171
1176
  //#region extensions/matrix/src/matrix/monitor/events.ts
1172
- const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_WINDOW_MS = 2 * 6e4;
1177
+ const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_WINDOW_MS = 12e4;
1173
1178
  const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_THRESHOLD = 3;
1174
1179
  const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_SAMPLE_LIMIT = 3;
1175
1180
  function formatMatrixPostHealthySyncDecryptionHint(accountId) {
@@ -1357,6 +1362,67 @@ function registerMatrixMonitorEvents(params) {
1357
1362
  directTracker?.invalidateRoom(roomId);
1358
1363
  const eventId = event?.event_id ?? "unknown";
1359
1364
  logVerboseMessage(`matrix: join room=${roomId} id=${eventId}`);
1365
+ if (event.membershipProvenance !== "transition" || event.state_key !== auth.userId) return;
1366
+ runMonitorTask(`join introduction room=${roomId}`, async () => {
1367
+ const members = await readJoinedMatrixMembers(client, roomId);
1368
+ const remoteUserId = members?.find((member) => member !== auth.userId);
1369
+ if (!members?.includes(auth.userId) || !remoteUserId || await directTracker.isDirectMessage({
1370
+ roomId,
1371
+ senderId: remoteUserId,
1372
+ selfUserId: auth.userId,
1373
+ joinedMembers: members
1374
+ })) return;
1375
+ const roomInfo = await params.getRoomInfo(roomId, { includeAliases: params.needsRoomAliasesForConfig });
1376
+ const roomConfig = resolveMatrixRoomConfig({
1377
+ rooms: params.roomsConfig,
1378
+ roomId,
1379
+ aliases: [roomInfo.canonicalAlias ?? "", ...roomInfo.altAliases].filter(Boolean)
1380
+ });
1381
+ const roomAllowed = (!params.needsRoomAliasesForConfig || roomInfo.aliasesResolved) && params.groupPolicy !== "disabled" && (roomConfig.config ? roomConfig.allowed : params.groupPolicy === "open");
1382
+ const options = {
1383
+ cfg,
1384
+ accountId: auth.accountId,
1385
+ client
1386
+ };
1387
+ await reportChannelRoomJoin({
1388
+ cfg,
1389
+ channel: "matrix",
1390
+ accountId: auth.accountId,
1391
+ conversationId: roomId,
1392
+ deliverTo: `room:${roomId}`,
1393
+ route: resolveMatrixInboundRoute({
1394
+ cfg,
1395
+ accountId: auth.accountId,
1396
+ roomId,
1397
+ senderId: auth.userId,
1398
+ isDirectMessage: false,
1399
+ resolveAgentRoute
1400
+ }).route,
1401
+ roomAllowed,
1402
+ resolveRoomContext: async ({ messageLimit }) => {
1403
+ const info = await getMatrixRoomInfo(roomId, options);
1404
+ const context = {
1405
+ title: info.name ?? void 0,
1406
+ purpose: info.topic ?? void 0
1407
+ };
1408
+ try {
1409
+ const { messages } = await readMatrixMessages(roomId, {
1410
+ ...options,
1411
+ limit: messageLimit
1412
+ });
1413
+ return {
1414
+ ...context,
1415
+ recentMessages: messages.toReversed().flatMap(({ sender, body }) => body?.trim() ? [{
1416
+ sender,
1417
+ text: body
1418
+ }] : [])
1419
+ };
1420
+ } catch {
1421
+ return context;
1422
+ }
1423
+ }
1424
+ });
1425
+ });
1360
1426
  };
1361
1427
  const onRoomEvent = (roomId, event) => {
1362
1428
  const eventType = event?.type ?? "unknown";
@@ -1518,11 +1584,7 @@ function resolveMatrixSharedDmContextNotice(params) {
1518
1584
  if (currentSession.accountId && currentSession.accountId !== params.accountId) return null;
1519
1585
  if (!currentSession.directUserId) return null;
1520
1586
  if (!currentSession.roomId || currentSession.roomId === params.roomId) return null;
1521
- return [
1522
- "This Matrix DM is sharing a session with another Matrix DM room.",
1523
- "Use /focus here for a one-off isolated thread session when thread bindings are enabled, or set",
1524
- "channels.matrix.dm.sessionScope to per-room to isolate each Matrix DM room."
1525
- ].join(" ");
1587
+ return ["This Matrix DM is sharing a session with another Matrix DM room.", "Set channels.matrix.dm.sessionScope to per-room to isolate each Matrix DM room."].join(" ");
1526
1588
  } catch (err) {
1527
1589
  params.logVerboseMessage(`matrix: failed checking shared DM session notice room=${params.roomId} (${String(err)})`);
1528
1590
  return null;
@@ -1530,10 +1592,13 @@ function resolveMatrixSharedDmContextNotice(params) {
1530
1592
  }
1531
1593
  function resolveMatrixPendingHistoryText(params) {
1532
1594
  if (!params.mediaUrl) return params.mentionPrecheckText;
1595
+ const body = typeof params.content.body === "string" ? params.content.body : void 0;
1596
+ const filename = typeof params.content.filename === "string" ? params.content.filename : void 0;
1597
+ const msgtype = typeof params.content.msgtype === "string" ? params.content.msgtype : void 0;
1533
1598
  return formatMatrixMessageText({
1534
- body: typeof params.content.body === "string" ? params.content.body : void 0,
1535
- filename: typeof params.content.filename === "string" ? params.content.filename : void 0,
1536
- msgtype: typeof params.content.msgtype === "string" ? params.content.msgtype : void 0
1599
+ body,
1600
+ filename,
1601
+ msgtype
1537
1602
  }) ?? params.mentionPrecheckText;
1538
1603
  }
1539
1604
  function resolveMatrixInboundMediaContent(content) {
@@ -1566,7 +1631,7 @@ function resolveMatrixAllowBotsMode(value) {
1566
1631
  return "off";
1567
1632
  }
1568
1633
  function formatMatrixToolProgressMarkdownCode(text) {
1569
- return `\`${(text.length <= MATRIX_TOOL_PROGRESS_MAX_CHARS ? text : `${truncateUtf16Safe(text, MATRIX_TOOL_PROGRESS_MAX_CHARS - 1).trimEnd()}...`).replaceAll("`", "'")}\``;
1634
+ return `\`${(text.length <= MATRIX_TOOL_PROGRESS_MAX_CHARS ? text : `${truncateUtf16Safe(text, 299).trimEnd()}...`).replaceAll("`", "'")}\``;
1570
1635
  }
1571
1636
  //#endregion
1572
1637
  //#region extensions/matrix/src/matrix/monitor/handler-runtime.ts
@@ -1576,11 +1641,11 @@ async function redactMatrixDraftEvent(client, roomId, draftEventId) {
1576
1641
  function buildMatrixFinalizedPreviewContent() {
1577
1642
  return { [MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY]: true };
1578
1643
  }
1579
- const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-BKu9Ghi4.js").then((n) => n.s));
1644
+ const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-DG7Bnj7_.js").then((n) => n.s));
1580
1645
  const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
1581
1646
  const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
1582
- const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-BZUgLIZI.js"));
1583
- const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-B_m79Ynb.js"));
1647
+ const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-DveJRUaX.js"));
1648
+ const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-DPYdv4fE.js"));
1584
1649
  async function matrixTextWouldActivateMentions(client, text) {
1585
1650
  const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
1586
1651
  const mentions = await resolveMatrixMentionsForBody({
@@ -1609,7 +1674,7 @@ const MAX_CACHED_REPLY_CONTEXTS = 256;
1609
1674
  const MAX_REPLY_BODY_LENGTH = 500;
1610
1675
  function truncateReplyBody(value) {
1611
1676
  if (value.length <= MAX_REPLY_BODY_LENGTH) return value;
1612
- return `${sliceUtf16Safe(value, 0, MAX_REPLY_BODY_LENGTH - 3)}...`;
1677
+ return `${sliceUtf16Safe(value, 0, 497)}...`;
1613
1678
  }
1614
1679
  function summarizeMatrixReplyEvent(event) {
1615
1680
  const body = summarizeMatrixMessageContextEvent(event);
@@ -1662,7 +1727,7 @@ const MAX_TRACKED_THREAD_STARTERS = 256;
1662
1727
  const MAX_THREAD_STARTER_BODY_LENGTH = 500;
1663
1728
  function truncateThreadStarterBody(value) {
1664
1729
  if (value.length <= MAX_THREAD_STARTER_BODY_LENGTH) return value;
1665
- return `${sliceUtf16Safe(value, 0, MAX_THREAD_STARTER_BODY_LENGTH - 3)}...`;
1730
+ return `${sliceUtf16Safe(value, 0, 497)}...`;
1666
1731
  }
1667
1732
  function summarizeMatrixThreadStarterEvent(event) {
1668
1733
  const body = summarizeMatrixMessageContextEvent(event);
@@ -1847,7 +1912,8 @@ async function resolveMatrixInboundContext(config) {
1847
1912
  agentId: _route.agentId,
1848
1913
  dmScope: _route.dmScope,
1849
1914
  accountId: _route.accountId,
1850
- routeSessionKey: _route.sessionKey
1915
+ routeSessionKey: _route.sessionKey,
1916
+ parentSessionKey: threadTarget && _route.matchedBy !== "binding.channel" ? _route.mainSessionKey : void 0
1851
1917
  },
1852
1918
  reply: {
1853
1919
  to: `room:${roomId}`,
@@ -2773,7 +2839,6 @@ async function resolveMatrixIngressContent(config) {
2773
2839
  isDirectMessage,
2774
2840
  dmSessionScope,
2775
2841
  threadId: thread.threadId,
2776
- eventTs: eventTs ?? void 0,
2777
2842
  resolveAgentRoute: core.channel.routing.resolveAgentRoute
2778
2843
  });
2779
2844
  const hasExplicitSessionBinding = _configuredBinding !== null || _runtimeBindingId !== null;
@@ -2999,7 +3064,10 @@ async function resolveMatrixIngressContent(config) {
2999
3064
  }
3000
3065
  if (_runtimeBindingId) {
3001
3066
  const { getSessionBindingService } = await loadSessionBindingRuntime();
3002
- getSessionBindingService().touch(_runtimeBindingId, eventTs ?? void 0);
3067
+ getSessionBindingService().touch(_runtimeBindingId, eventTs ?? void 0, {
3068
+ channel: "matrix",
3069
+ accountId
3070
+ });
3003
3071
  }
3004
3072
  const preparedTrigger = isRoom && historyLimit > 0 ? reservedHistorySlot ? roomHistoryTracker.prepareReservedTrigger(_route.agentId, roomId, historyLimit, reservedHistorySlot, {
3005
3073
  sender: senderName,
@@ -3213,11 +3281,6 @@ function resolveVisibleMatrixReplyText(text) {
3213
3281
  }
3214
3282
  async function deliverMatrixReplies(params) {
3215
3283
  const core = getMatrixRuntime();
3216
- const tableMode = params.tableMode ?? core.channel.text.resolveMarkdownTableMode({
3217
- cfg: params.cfg,
3218
- channel: "matrix",
3219
- accountId: params.accountId
3220
- });
3221
3284
  const logVerbose = (message) => {
3222
3285
  if (core.logging.shouldLogVerbose()) params.runtime.log?.(message);
3223
3286
  };
@@ -3246,24 +3309,17 @@ async function deliverMatrixReplies(params) {
3246
3309
  acceptedResults.push(result);
3247
3310
  if (replyToIdForReply) hasRepliedRef.value = true;
3248
3311
  };
3312
+ const extraContent = resolveMatrixExtraContent(reply);
3249
3313
  if (mediaUrls.length === 0) {
3250
- const { chunks } = chunkMatrixText(rawText, {
3314
+ await sendMessageMatrix(params.roomId, rawText, {
3315
+ client: params.client,
3251
3316
  cfg: params.cfg,
3317
+ replyToId: replyToIdForReply,
3318
+ threadId: params.threadId,
3252
3319
  accountId: params.accountId,
3253
- tableMode,
3254
- preserveWhitespace: true
3320
+ extraContent,
3321
+ onDeliveryResult
3255
3322
  });
3256
- for (const chunk of chunks) {
3257
- if (!chunk.trim()) continue;
3258
- await sendMessageMatrix(params.roomId, chunk, {
3259
- client: params.client,
3260
- cfg: params.cfg,
3261
- replyToId: replyToIdForReply,
3262
- threadId: params.threadId,
3263
- accountId: params.accountId,
3264
- onDeliveryResult
3265
- });
3266
- }
3267
3323
  continue;
3268
3324
  }
3269
3325
  let first = true;
@@ -3278,6 +3334,7 @@ async function deliverMatrixReplies(params) {
3278
3334
  threadId: params.threadId,
3279
3335
  audioAsVoice: reply.audioAsVoice,
3280
3336
  accountId: params.accountId,
3337
+ extraContent: first ? extraContent : void 0,
3281
3338
  onDeliveryResult
3282
3339
  });
3283
3340
  first = false;
@@ -3291,7 +3348,7 @@ async function deliverMatrixReplies(params) {
3291
3348
  //#endregion
3292
3349
  //#region extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts
3293
3350
  function createMatrixReplyDispatcher(config) {
3294
- const { cfg, prefixOptions, humanDelay, typingCallbacks, streaming, draftStream, draftController, client, roomId, runtime, textLimit, replyToMode, threadTarget, replyToEventId, accountId, mediaLocalRoots, tableMode, logVerboseMessage } = config;
3351
+ const { cfg, prefixOptions, humanDelay, typingCallbacks, streaming, draftStream, draftController, client, roomId, runtime, replyToMode, threadTarget, replyToEventId, accountId, mediaLocalRoots, logVerboseMessage } = config;
3295
3352
  const quietDraftStreaming = streaming === "quiet" || streaming === "progress";
3296
3353
  const hasRepliedRef = { value: false };
3297
3354
  let finalReplyDeliveryFailed = false;
@@ -3363,14 +3420,12 @@ function createMatrixReplyDispatcher(config) {
3363
3420
  roomId,
3364
3421
  client,
3365
3422
  runtime,
3366
- textLimit,
3367
3423
  replyToMode,
3368
3424
  hasRepliedRef,
3369
3425
  threadId: threadTarget,
3370
3426
  replyToId: threadTarget ?? replyToEventId ?? void 0,
3371
3427
  accountId,
3372
- mediaLocalRoots,
3373
- tableMode
3428
+ mediaLocalRoots
3374
3429
  }));
3375
3430
  }
3376
3431
  const payloadReplyMismatch = !threadTarget && (replyToMode !== "off" || payload.replyToTag || payload.replyToCurrent) && normalizeOptionalString(payload.replyToId) !== draftController.currentReplyToId();
@@ -3401,11 +3456,18 @@ function createMatrixReplyDispatcher(config) {
3401
3456
  discardPending: async () => {},
3402
3457
  id: () => draftEventId
3403
3458
  },
3404
- buildFinalEdit: () => ({
3405
- text: finalPreviewText,
3406
- finalizeLive: !(quietDraftStreaming || !draftStream.matchesPreparedText(finalPreviewText)),
3407
- ...quietDraftStreaming ? { extraContent: buildMatrixFinalizedPreviewContent() } : {}
3408
- }),
3459
+ buildFinalEdit: () => {
3460
+ const presentationContent = resolveMatrixExtraContent(payload);
3461
+ const extraContent = {
3462
+ ...quietDraftStreaming ? buildMatrixFinalizedPreviewContent() : {},
3463
+ ...presentationContent
3464
+ };
3465
+ return {
3466
+ text: finalPreviewText,
3467
+ finalizeLive: !(quietDraftStreaming || Boolean(presentationContent) || !draftStream.matchesPreparedText(finalPreviewText)),
3468
+ ...Object.keys(extraContent).length > 0 ? { extraContent } : {}
3469
+ };
3470
+ },
3409
3471
  editFinal: async (_draftEventId, edit) => {
3410
3472
  if (edit.finalizeLive) {
3411
3473
  if (!await draftStream.finalizeLive()) throw new Error("Matrix draft live finalize failed");
@@ -3441,14 +3503,12 @@ function createMatrixReplyDispatcher(config) {
3441
3503
  roomId,
3442
3504
  client,
3443
3505
  runtime,
3444
- textLimit,
3445
3506
  replyToMode,
3446
3507
  hasRepliedRef,
3447
3508
  threadId: threadTarget,
3448
3509
  replyToId: threadTarget ?? replyToEventId ?? void 0,
3449
3510
  accountId,
3450
- mediaLocalRoots,
3451
- tableMode
3511
+ mediaLocalRoots
3452
3512
  })
3453
3513
  });
3454
3514
  return fallbackResult.visibleReplySent;
@@ -3504,14 +3564,12 @@ function createMatrixReplyDispatcher(config) {
3504
3564
  roomId,
3505
3565
  client,
3506
3566
  runtime,
3507
- textLimit,
3508
3567
  replyToMode,
3509
3568
  hasRepliedRef,
3510
3569
  threadId: threadTarget,
3511
3570
  replyToId: threadTarget ?? replyToEventId ?? void 0,
3512
3571
  accountId,
3513
- mediaLocalRoots,
3514
- tableMode
3572
+ mediaLocalRoots
3515
3573
  });
3516
3574
  if (reusesDraftAsFinalText) {
3517
3575
  draftController.markDraftConsumed();
@@ -3537,14 +3595,12 @@ function createMatrixReplyDispatcher(config) {
3537
3595
  roomId,
3538
3596
  client,
3539
3597
  runtime,
3540
- textLimit,
3541
3598
  replyToMode,
3542
3599
  hasRepliedRef,
3543
3600
  threadId: threadTarget,
3544
3601
  replyToId: threadTarget ?? replyToEventId ?? void 0,
3545
3602
  accountId,
3546
- mediaLocalRoots,
3547
- tableMode
3603
+ mediaLocalRoots
3548
3604
  });
3549
3605
  const draftContent = draftStream.content();
3550
3606
  if (shouldRedactDraft && draftEventId && draftContent) return await completeDelivery(await settleDraftReplacement({
@@ -3560,14 +3616,12 @@ function createMatrixReplyDispatcher(config) {
3560
3616
  roomId,
3561
3617
  client,
3562
3618
  runtime,
3563
- textLimit,
3564
3619
  replyToMode,
3565
3620
  hasRepliedRef,
3566
3621
  threadId: threadTarget,
3567
3622
  replyToId: threadTarget ?? replyToEventId ?? void 0,
3568
3623
  accountId,
3569
- mediaLocalRoots,
3570
- tableMode
3624
+ mediaLocalRoots
3571
3625
  }));
3572
3626
  },
3573
3627
  onError: (err, info) => {
@@ -3590,7 +3644,7 @@ function createMatrixReplyDispatcher(config) {
3590
3644
  //#endregion
3591
3645
  //#region extensions/matrix/src/matrix/monitor/handler-state.ts
3592
3646
  const ALLOW_FROM_STORE_CACHE_TTL_MS = 3e4;
3593
- const PAIRING_REPLY_COOLDOWN_MS = 5 * 6e4;
3647
+ const PAIRING_REPLY_COOLDOWN_MS = 3e5;
3594
3648
  const MAX_TRACKED_PAIRING_REPLY_SENDERS = 512;
3595
3649
  function createMatrixHandlerState(config) {
3596
3650
  const { core, accountId, runtime, allowFromResolvedEntries, groupAllowFromResolvedEntries, resolveLiveUserAllowlist } = config;
@@ -3692,8 +3746,10 @@ function createMatrixHandlerState(config) {
3692
3746
  }
3693
3747
  //#endregion
3694
3748
  //#region extensions/matrix/src/matrix/monitor/handler.ts
3749
+ const SESSION_RESTART_RECOVERY_TOMBSTONE_ERROR_CODE = "SESSION_RESTART_RECOVERY_TOMBSTONE";
3750
+ const RESTART_RECOVERY_TOMBSTONE_NOTICE = "This session ended during gateway restart recovery and cannot accept more messages. Send /new or /reset to start a replacement session.";
3695
3751
  function createMatrixRoomMessageHandler(params) {
3696
- const { client, core, cfg, accountId, runtime, logger, logVerboseMessage, allowFromResolvedEntries = [], groupAllowFromResolvedEntries = [], configuredBotUserIds = /* @__PURE__ */ new Set(), groupPolicy, replyToMode, dmSessionScope, streaming, previewToolProgressEnabled, blockStreamingEnabled, textLimit, historyLimit, startupMs, startupGraceMs, dropPreStartupMessages, inboundDeduper, directTracker, getRoomInfo, getMemberDisplayName, resolveLiveUserAllowlist = resolveMatrixMonitorLiveUserAllowlist, resolveStorePath: resolveStorePathImpl = resolveStorePath, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl = createChannelInboundEnvelopeBuilder, finalizeInboundContext, resolveHumanDelayConfig: resolveHumanDelayConfigImpl = resolveHumanDelayConfig } = params;
3752
+ const { client, core, cfg, accountId, runtime, logger, logVerboseMessage, allowFromResolvedEntries = [], groupAllowFromResolvedEntries = [], configuredBotUserIds = /* @__PURE__ */ new Set(), groupPolicy, replyToMode, dmSessionScope, streaming, previewToolProgressEnabled, blockStreamingEnabled, historyLimit, startupMs, startupGraceMs, dropPreStartupMessages, inboundDeduper, directTracker, getRoomInfo, getMemberDisplayName, resolveLiveUserAllowlist = resolveMatrixMonitorLiveUserAllowlist, resolveStorePath: resolveStorePathImpl = resolveStorePath, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl = createChannelInboundEnvelopeBuilder, finalizeInboundContext, resolveHumanDelayConfig: resolveHumanDelayConfigImpl = resolveHumanDelayConfig } = params;
3697
3753
  const handlerConfig = {
3698
3754
  ...params,
3699
3755
  allowFromResolvedEntries,
@@ -3876,11 +3932,6 @@ function createMatrixRoomMessageHandler(params) {
3876
3932
  });
3877
3933
  if (!inboundContext) return;
3878
3934
  const { replyToEventId, threadTarget, storePath, ctxPayload, replyTarget, sharedDmContextNotice } = inboundContext;
3879
- const tableMode = core.channel.text.resolveMarkdownTableMode({
3880
- cfg,
3881
- channel: "matrix",
3882
- accountId: _route.accountId
3883
- });
3884
3935
  const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, _route.agentId);
3885
3936
  const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
3886
3937
  cfg,
@@ -3944,13 +3995,11 @@ function createMatrixRoomMessageHandler(params) {
3944
3995
  client,
3945
3996
  roomId,
3946
3997
  runtime,
3947
- textLimit,
3948
3998
  replyToMode,
3949
3999
  threadTarget,
3950
4000
  replyToEventId: replyToEventId ?? void 0,
3951
4001
  accountId: _route.accountId,
3952
4002
  mediaLocalRoots,
3953
- tableMode,
3954
4003
  logVerboseMessage
3955
4004
  });
3956
4005
  const { deliverReply, onReplyError, turnDispatcherOptions } = replyDispatcher;
@@ -3982,7 +4031,7 @@ function createMatrixRoomMessageHandler(params) {
3982
4031
  replayClaimAtDispatch.release();
3983
4032
  }
3984
4033
  } : void 0;
3985
- const turnResult = await core.channel.inbound.run({
4034
+ const turnResultPromise = core.channel.inbound.run({
3986
4035
  channel: "matrix",
3987
4036
  accountId: _route.accountId,
3988
4037
  raw: event,
@@ -4039,6 +4088,7 @@ function createMatrixRoomMessageHandler(params) {
4039
4088
  },
4040
4089
  delivery: {
4041
4090
  observeMessageSent: true,
4091
+ preparePayload: prepareMatrixReplyPayload,
4042
4092
  deliver: deliverReply,
4043
4093
  onError: (err, info) => onReplyError(err, info)
4044
4094
  },
@@ -4067,6 +4117,30 @@ function createMatrixRoomMessageHandler(params) {
4067
4117
  })
4068
4118
  }
4069
4119
  });
4120
+ let turnResult;
4121
+ try {
4122
+ turnResult = await turnResultPromise;
4123
+ } catch (err) {
4124
+ if (extractErrorCode(err) !== SESSION_RESTART_RECOVERY_TOMBSTONE_ERROR_CODE) throw err;
4125
+ try {
4126
+ const { sendMessageMatrix } = await loadMatrixSendModule();
4127
+ await sendMessageMatrix(roomId, RESTART_RECOVERY_TOMBSTONE_NOTICE, {
4128
+ cfg,
4129
+ client,
4130
+ accountId: _route.accountId,
4131
+ replyToId: threadTarget ?? (replyToMode === "off" ? void 0 : messageId),
4132
+ threadId: threadTarget,
4133
+ deliveryQueueId: `matrix:restart-recovery-tombstone:${_route.accountId}:${roomId}:${eventId}`,
4134
+ deliveryPartIndex: 0,
4135
+ deliveryPartCount: 1,
4136
+ extraContent: { msgtype: "m.notice" }
4137
+ });
4138
+ await commitInboundEventIfClaimed();
4139
+ } catch (noticeError) {
4140
+ runtime.error?.(`matrix: failed completing restart-recovery tombstone notice room=${roomId} id=${eventId || "unknown"}: ${String(noticeError)}`);
4141
+ }
4142
+ return;
4143
+ }
4070
4144
  if (!turnResult.dispatched) {
4071
4145
  if (turnResult.admission.kind === "drop" && turnResult.admission.reason === "bot-loop-protection") await commitInboundEventIfClaimed();
4072
4146
  return;
@@ -4120,10 +4194,10 @@ function shouldPromoteRecentInviteRoom(params) {
4120
4194
  //#endregion
4121
4195
  //#region extensions/matrix/src/matrix/monitor/startup.ts
4122
4196
  const loadMatrixStartupMaintenanceDeps = createLazyRuntimeModule(() => Promise.all([
4123
- import("./config-update-Bor_Pjsv.js").then((n) => n.t),
4197
+ import("./config-update-BnX26jCO.js").then((n) => n.t),
4124
4198
  import("./device-health-B4-YXtJR.js").then((n) => n.t),
4125
- import("./profile-D-Wubo0A.js").then((n) => n.n),
4126
- import("./startup-verification-Cs08ca8u.js")
4199
+ import("./profile-vmjsmhh4.js").then((n) => n.n),
4200
+ import("./startup-verification-1Ney1mmI.js")
4127
4201
  ]).then(([configUpdateModule, deviceHealthModule, profileModule, startupVerificationModule]) => ({
4128
4202
  updateMatrixAccountConfig: configUpdateModule.updateMatrixAccountConfig,
4129
4203
  summarizeMatrixDeviceHealth: deviceHealthModule.summarizeMatrixDeviceHealth,
@@ -4345,35 +4419,6 @@ function createMatrixMonitorSyncLifecycle(params) {
4345
4419
  };
4346
4420
  }
4347
4421
  //#endregion
4348
- //#region extensions/matrix/src/matrix/monitor/task-runner.ts
4349
- function createMatrixMonitorTaskRunner(params) {
4350
- const inFlight = /* @__PURE__ */ new Set();
4351
- let closed = false;
4352
- const runDetachedTask = (label, task) => {
4353
- if (closed) return Promise.resolve();
4354
- const trackedTask = Promise.resolve().then(task).catch((error) => {
4355
- const message = String(error);
4356
- params.logVerboseMessage(`matrix: ${label} failed (${message})`);
4357
- params.logger.warn("matrix background task failed", {
4358
- task: label,
4359
- error: message
4360
- });
4361
- }).finally(() => {
4362
- inFlight.delete(trackedTask);
4363
- });
4364
- inFlight.add(trackedTask);
4365
- return trackedTask;
4366
- };
4367
- const waitForIdle = async () => {
4368
- while (inFlight.size > 0) await Promise.allSettled(Array.from(inFlight));
4369
- };
4370
- return {
4371
- close: () => closed = true,
4372
- runDetachedTask,
4373
- waitForIdle
4374
- };
4375
- }
4376
- //#endregion
4377
4422
  //#region extensions/matrix/src/matrix/monitor/index.ts
4378
4423
  function resolveMatrixStreamingMode(streaming) {
4379
4424
  const mode = streaming?.mode;
@@ -4527,7 +4572,6 @@ async function monitorMatrixProvider(opts = {}) {
4527
4572
  const dmPolicyRaw = dmConfig?.policy ?? "pairing";
4528
4573
  const dmPolicy = allowlistOnly && dmPolicyRaw !== "disabled" ? "allowlist" : dmPolicyRaw;
4529
4574
  const dmSessionScope = dmConfig?.sessionScope ?? "per-user";
4530
- const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "matrix", effectiveAccountId);
4531
4575
  const globalGroupChatHistoryLimit = cfg.messages?.groupChat?.historyLimit;
4532
4576
  const historyLimit = Math.max(0, accountConfig.historyLimit ?? globalGroupChatHistoryLimit ?? 0);
4533
4577
  const mediaMaxMb = opts.mediaMaxMb ?? accountConfig.mediaMaxMb ?? DEFAULT_MEDIA_MAX_MB;
@@ -4657,7 +4701,6 @@ async function monitorMatrixProvider(opts = {}) {
4657
4701
  blockStreamingEnabled,
4658
4702
  dmEnabled,
4659
4703
  dmPolicy,
4660
- textLimit,
4661
4704
  mediaMaxBytes,
4662
4705
  historyLimit,
4663
4706
  startupMs,
@@ -4699,6 +4742,10 @@ async function monitorMatrixProvider(opts = {}) {
4699
4742
  accountId: effectiveAccountId
4700
4743
  }).catch(() => []),
4701
4744
  directTracker,
4745
+ groupPolicy,
4746
+ roomsConfig,
4747
+ needsRoomAliasesForConfig,
4748
+ getRoomInfo,
4702
4749
  invalidateMemberDisplayName,
4703
4750
  logVerboseMessage,
4704
4751
  warnedEncryptedRooms,