@openclaw/matrix 2026.11.2 → 2026.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -155,7 +155,7 @@ const matrixMessageActions = {
155
155
  return account.enabled && account.configured && createActionGate(account.config.actions)("messages") ? payload : null;
156
156
  },
157
157
  handleAction: async (ctx) => {
158
- const { handleMatrixAction } = await import("./tool-actions-CFX8h2Vm.mjs");
158
+ const { handleMatrixAction } = await import("./tool-actions-CFC7ZpIt.mjs");
159
159
  return await handleMatrixAction(ctx);
160
160
  }
161
161
  };
@@ -747,8 +747,8 @@ async function resolveMatrixOutboundSessionRoute(params) {
747
747
  }
748
748
  //#endregion
749
749
  //#region extensions/matrix/src/channel.ts
750
- const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BbPbs1Hp.mjs"), "matrixChannelRuntime");
751
- const loadMatrixMonitorModule = createLazyRuntimeModule(() => import("./monitor-B7aj9WSD.mjs").catch((error) => {
750
+ const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-DyX4mM8d.mjs"), "matrixChannelRuntime");
751
+ const loadMatrixMonitorModule = createLazyRuntimeModule(() => import("./monitor-B86Ll4B8.mjs").catch((error) => {
752
752
  loadMatrixMonitorModule.clear();
753
753
  throw error;
754
754
  }));
@@ -1,7 +1,7 @@
1
1
  import { S as reconcileMatrixUnknownSend, o as sendTypingMatrix, r as sendMessageMatrix, x as cleanupMatrixDeliveryPlans } from "./send-BGgwE5pV.mjs";
2
2
  import { u as resolveMatrixAuth } from "./client-BEl7PU1_.mjs";
3
3
  import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-_yaRaktv.mjs";
4
- import { t as matrixOutbound } from "./outbound-SIW3NaJ2.mjs";
4
+ import { t as matrixOutbound } from "./outbound-BWsyqwt1.mjs";
5
5
  import { t as resolveMatrixTargets } from "./resolve-targets-Dd70hGcM.mjs";
6
6
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
7
7
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
@@ -1,7 +1,7 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
2
2
  import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-CRsKoMqJ.mjs";
3
3
  import { h as resolveConfiguredMatrixBotUserIds } from "./setup-core-Di6NtQ_J.mjs";
4
- import { a as resolveMatrixThreadRouting, i as resolveMatrixInboundRouteAsync, n as resolveMatrixStoredSessionMeta, o as resolveMatrixRoomConfig } from "./channel-OgoZc4uR.mjs";
4
+ import { a as resolveMatrixThreadRouting, i as resolveMatrixInboundRouteAsync, n as resolveMatrixStoredSessionMeta, o as resolveMatrixRoomConfig } from "./channel-BBvOdxTc.mjs";
5
5
  import { a as resolveMatrixAllowListMatch, i as normalizeMatrixUserId, r as normalizeMatrixAllowList } from "./channel.setup-p6oll48W.mjs";
6
6
  import { n as isMatrixQualifiedUserId, r as isMatrixRoomId, t as isMatrixInviteAutoJoinTarget } from "./target-ids-HhcaKX1n.mjs";
7
7
  import { a as MATRIX_REACTION_EVENT_TYPE } from "./send-currentness-C2rMVVIQ.mjs";
@@ -11,7 +11,7 @@ import { t as createMatrixThreadBindingManager } from "./thread-bindings-pNgPVdo
11
11
  import { a as isMatrixStartupAbortError, c as getMatrixMonitorTaskSignal, d as resolveMatrixAuthContext, l as backfillMatrixAuthDeviceIdAfterStartup, n as acquireSharedMatrixClient, o as throwIfMatrixStartupAborted, s as createMatrixMonitorTaskRunner, u as resolveMatrixAuth } from "./client-BEl7PU1_.mjs";
12
12
  import { i as readMatrixMessages, l as fetchMatrixPollSnapshot } from "./messages-TuEa_BPZ.mjs";
13
13
  import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-ByR4STVQ.mjs";
14
- import { n as prepareMatrixReplyPayload, r as resolveMatrixExtraContent } from "./outbound-SIW3NaJ2.mjs";
14
+ import { n as prepareMatrixReplyPayload, r as resolveMatrixExtraContent } from "./outbound-BWsyqwt1.mjs";
15
15
  import { t as resolveMatrixTargets } from "./resolve-targets-Dd70hGcM.mjs";
16
16
  import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-BLUoN4aV.mjs";
17
17
  import { createMatrixInboundEventDeduper } from "./inbound-dedupe-sW_gaR44.mjs";
@@ -1577,7 +1577,7 @@ function formatMatrixToolProgressMarkdownCode(text) {
1577
1577
  const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-BGgwE5pV.mjs").then((n) => n.s));
1578
1578
  const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
1579
1579
  const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
1580
- const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-C3DvaS9B.mjs"));
1580
+ const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-CuUeYcBC.mjs"));
1581
1581
  const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-vO_qjwJb.mjs"));
1582
1582
  async function matrixTextWouldActivateMentions(client, text) {
1583
1583
  const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
@@ -2374,8 +2374,69 @@ function decodeVisibleHtmlEntities(value) {
2374
2374
  return decoded === "\xA0" ? " " : decoded;
2375
2375
  });
2376
2376
  }
2377
+ /**
2378
+ * Replaces each `<[^>]+>` with a space. No tag can end after the last `>`, so the
2379
+ * regex only runs on that prefix and an unterminated `<` run stays linear.
2380
+ */
2381
+ function stripHtmlTags(value) {
2382
+ const end = value.lastIndexOf(">") + 1;
2383
+ return value.slice(0, end).replace(/<[^>]+>/g, " ") + value.slice(end);
2384
+ }
2385
+ /**
2386
+ * `href` and label of each anchor, matching the captures of
2387
+ * `/<a\b[^>]*href=(["'])(https:\/\/matrix\.to\/#[^"']+)\1[^>]*>(.*?)<\/a>/gis`: the last
2388
+ * usable `href=` inside the opening tag wins, the quoted value may contain `>`, and the
2389
+ * label ends at the first `</a>`. Each `<a` start is resolved from precomputed next-`>`,
2390
+ * next-quote and next-`</a>` positions plus a forward-only candidate cursor, so the scan
2391
+ * is linear in the length of sender-controlled HTML.
2392
+ */
2393
+ function* matrixToAnchors(html) {
2394
+ const length = html.length;
2395
+ const nextGt = new Int32Array(length + 1).fill(length);
2396
+ const nextQuote = new Int32Array(length + 1).fill(length);
2397
+ for (let index = length - 1; index >= 0; index -= 1) {
2398
+ const char = html[index];
2399
+ nextGt[index] = char === ">" ? index : nextGt[index + 1];
2400
+ nextQuote[index] = char === "\"" || char === "'" ? index : nextQuote[index + 1];
2401
+ }
2402
+ const closes = Array.from(html.matchAll(/<\/a>/gi), (match) => match.index);
2403
+ let nextClose = 0;
2404
+ const candidates = [];
2405
+ for (const match of html.matchAll(/href=(["'])https:\/\/matrix\.to\/#/gi)) {
2406
+ const valueStart = match.index + 5 + 1;
2407
+ const restStart = match.index + match[0].length;
2408
+ const valueEnd = nextQuote[restStart];
2409
+ if (valueEnd === restStart || valueEnd === length || html[valueEnd] !== match[1]) continue;
2410
+ const tagEnd = nextGt[valueEnd + 1];
2411
+ if (tagEnd === length) continue;
2412
+ while (nextClose < closes.length && closes[nextClose] <= tagEnd) nextClose += 1;
2413
+ if (nextClose === closes.length) break;
2414
+ candidates.push({
2415
+ start: match.index,
2416
+ href: html.slice(valueStart, valueEnd),
2417
+ labelStart: tagEnd + 1,
2418
+ labelEnd: closes[nextClose]
2419
+ });
2420
+ }
2421
+ let resumeAt = 0;
2422
+ let candidatesBefore = 0;
2423
+ for (const open of html.matchAll(/<a\b/gi)) {
2424
+ if (open.index < resumeAt) continue;
2425
+ const firstStart = open.index + open[0].length;
2426
+ const lastStart = nextGt[firstStart] - 1;
2427
+ while (candidatesBefore < candidates.length && candidates[candidatesBefore].start <= lastStart) candidatesBefore += 1;
2428
+ const candidate = candidates[candidatesBefore - 1];
2429
+ if (candidate && candidate.start >= firstStart) {
2430
+ yield {
2431
+ href: candidate.href,
2432
+ label: html.slice(candidate.labelStart, candidate.labelEnd)
2433
+ };
2434
+ resumeAt = candidate.labelEnd + 4;
2435
+ }
2436
+ }
2437
+ }
2377
2438
  function extractVisibleMentionText(value) {
2378
- return normalizeLowercaseStringOrEmpty(decodeVisibleHtmlEntities((value ?? "").replace(/<[^>]+>/g, " ").replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g, "")).replace(/\s+/g, " "));
2439
+ return normalizeLowercaseStringOrEmpty(decodeVisibleHtmlEntities(stripHtmlTags(value ?? "").replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g, "")).replace(/\s+/g, " "));
2379
2440
  }
2380
2441
  function resolveMatrixUserLocalpart(userId) {
2381
2442
  const trimmed = userId.trim();
@@ -2453,22 +2514,17 @@ function hasVisibleRoomMention(value) {
2453
2514
  */
2454
2515
  function checkFormattedBodyMention(params) {
2455
2516
  if (!params.formattedBody || !params.userId) return false;
2456
- for (const match of params.formattedBody.matchAll(/<a\b[^>]*href=(["'])(https:\/\/matrix\.to\/#[^"']+)\1[^>]*>(.*?)<\/a>/gis)) {
2457
- const href = match[2];
2458
- const visibleLabel = match[3] ?? "";
2459
- if (!href) continue;
2460
- try {
2461
- const parsed = new URL(href);
2462
- if (decodeURIComponent(parsed.hash.replace(/^#\/?/, "").trim()) !== params.userId.trim()) continue;
2463
- if (isVisibleMentionLabel({
2464
- text: visibleLabel,
2465
- userId: params.userId,
2466
- mentionRegexes: params.mentionRegexes,
2467
- displayName: params.displayName
2468
- })) return true;
2469
- } catch {
2470
- continue;
2471
- }
2517
+ for (const { href, label: visibleLabel } of matrixToAnchors(params.formattedBody)) try {
2518
+ const parsed = new URL(href);
2519
+ if (decodeURIComponent(parsed.hash.replace(/^#\/?/, "").trim()) !== params.userId.trim()) continue;
2520
+ if (isVisibleMentionLabel({
2521
+ text: visibleLabel,
2522
+ userId: params.userId,
2523
+ mentionRegexes: params.mentionRegexes,
2524
+ displayName: params.displayName
2525
+ })) return true;
2526
+ } catch {
2527
+ continue;
2472
2528
  }
2473
2529
  return false;
2474
2530
  }
@@ -1,4 +1,4 @@
1
- import { r as matrixPresentationCapabilities } from "./channel-OgoZc4uR.mjs";
1
+ import { r as matrixPresentationCapabilities } from "./channel-BBvOdxTc.mjs";
2
2
  import { i as sendPollMatrix, r as sendMessageMatrix } from "./send-BGgwE5pV.mjs";
3
3
  import { createMessageReceiptFromOutboundResults, createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
4
4
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,5 +1,5 @@
1
1
  import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
2
- import { a as resolveMatrixThreadRouting, i as resolveMatrixInboundRouteAsync } from "./channel-OgoZc4uR.mjs";
2
+ import { a as resolveMatrixThreadRouting, i as resolveMatrixInboundRouteAsync } from "./channel-BBvOdxTc.mjs";
3
3
  import { c as extractMatrixReactionAnnotation } from "./send-currentness-C2rMVVIQ.mjs";
4
4
  import { p as resolveMatrixThreadRootId } from "./direct-management-ZcjZgYEl.mjs";
5
5
  import { i as resolveMatrixApprovalReactionTargetWithPersistence, o as unregisterMatrixApprovalReactionTargetsForApproval } from "./approval-reactions-D2pEUrFS.mjs";
@@ -8,7 +8,7 @@ import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
8
8
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
9
9
  import { getSessionBindingService } from "openclaw/plugin-sdk/session-binding-runtime";
10
10
  //#region extensions/matrix/src/matrix/monitor/reaction-events.ts
11
- const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./channel-OgoZc4uR.mjs").then((n) => n.s));
11
+ const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./channel-BBvOdxTc.mjs").then((n) => n.s));
12
12
  const loadExecApprovalResolver = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/approval-gateway-runtime"));
13
13
  const loadMatrixSend = createLazyRuntimeModule(() => import("./send-BGgwE5pV.mjs").then((n) => n.s));
14
14
  function buildMatrixApprovalTerminalText(result) {
@@ -1,6 +1,6 @@
1
1
  import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-CRsKoMqJ.mjs";
2
2
  import { g as resolveDefaultMatrixAccountId } from "./setup-core-Di6NtQ_J.mjs";
3
- import { o as resolveMatrixRoomConfig } from "./channel-OgoZc4uR.mjs";
3
+ import { o as resolveMatrixRoomConfig } from "./channel-BBvOdxTc.mjs";
4
4
  import { a as normalizeMatrixResolvableTarget } from "./target-ids-HhcaKX1n.mjs";
5
5
  import { l as selectOwnMatrixReactionEventIds, s as buildMatrixReactionRelationsPath, u as summarizeMatrixReactionEvents } from "./send-currentness-C2rMVVIQ.mjs";
6
6
  import { c as isStrictDirectMembership, s as hasDirectMatrixMemberFlag, u as readJoinedMatrixMembers } from "./direct-management-ZcjZgYEl.mjs";
package/dist/api.js CHANGED
@@ -2,7 +2,7 @@ import { a as resolveConfiguredMatrixAccountIds, i as requiresExplicitMatrixDefa
2
2
  import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./.setup/env-vars-aEBngJPa.mjs";
3
3
  import { a as resolveMatrixCredentialsFilename, i as resolveMatrixCredentialsDir, l as sanitizeMatrixPathSegment, o as resolveMatrixCredentialsPath, r as resolveMatrixAccountStorageRoot, s as resolveMatrixHomeserverKey, t as hashMatrixAccessToken } from "./.setup/storage-paths-B51JM-pC.mjs";
4
4
  import { r as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./.setup/setup-core-Di6NtQ_J.mjs";
5
- import { t as matrixPlugin } from "./.setup/channel-OgoZc4uR.mjs";
5
+ import { t as matrixPlugin } from "./.setup/channel-BBvOdxTc.mjs";
6
6
  import { f as setMatrixThreadBindingMaxAgeBySessionKey, l as setMatrixThreadBindingIdleTimeoutBySessionKey, n as getMatrixThreadBindingManager, p as setMatrixThreadBindingMaxAgeBySessionKeyAsync, u as setMatrixThreadBindingIdleTimeoutBySessionKeyAsync } from "./.setup/thread-bindings-shared-CPjUA0Ib.mjs";
7
7
  import { t as matrixOnboardingAdapter } from "./.setup/onboarding-DOLEjkg2.mjs";
8
8
  import { t as createMatrixThreadBindingManager } from "./.setup/thread-bindings-pNgPVdof.mjs";
@@ -1,2 +1,2 @@
1
- import { t as matrixPlugin } from "./.setup/channel-OgoZc4uR.mjs";
1
+ import { t as matrixPlugin } from "./.setup/channel-BBvOdxTc.mjs";
2
2
  export { matrixPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/matrix",
3
- "version": "2026.11.2",
3
+ "version": "2026.11.3",
4
4
  "description": "OpenClaw Matrix channel plugin for rooms and direct messages.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "zod": "4.6.5"
20
20
  },
21
21
  "peerDependencies": {
22
- "openclaw": ">=2026.11.2"
22
+ "openclaw": ">=2026.11.3"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "openclaw": {
@@ -170,11 +170,11 @@
170
170
  "allowInvalidConfigRecovery": true
171
171
  },
172
172
  "compat": {
173
- "pluginApi": ">=2026.11.2"
173
+ "pluginApi": ">=2026.11.3"
174
174
  },
175
175
  "build": {
176
176
  "bundledDist": false,
177
- "openclawVersion": "2026.11.2"
177
+ "openclawVersion": "2026.11.3"
178
178
  },
179
179
  "release": {
180
180
  "publishToClawHub": true,