@openclaw/matrix 2026.2.13 → 2026.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.2.15
4
+
5
+ ### Changes
6
+
7
+ - Version alignment with core OpenClaw release numbers.
8
+
9
+ ## 2026.2.14
10
+
11
+ ### Changes
12
+
13
+ - Version alignment with core OpenClaw release numbers.
14
+
3
15
  ## 2026.2.13
4
16
 
5
17
  ### Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/matrix",
3
- "version": "2026.2.13",
3
+ "version": "2026.2.15",
4
4
  "description": "OpenClaw Matrix channel plugin",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -3,29 +3,33 @@ import type { CoreConfig } from "./types.js";
3
3
  import { resolveMatrixAccountConfig } from "./matrix/accounts.js";
4
4
  import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
5
5
 
6
- export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): boolean {
6
+ function stripLeadingPrefixCaseInsensitive(value: string, prefix: string): string {
7
+ return value.toLowerCase().startsWith(prefix.toLowerCase())
8
+ ? value.slice(prefix.length).trim()
9
+ : value;
10
+ }
11
+
12
+ function resolveMatrixRoomConfigForGroup(params: ChannelGroupContext) {
7
13
  const rawGroupId = params.groupId?.trim() ?? "";
8
14
  let roomId = rawGroupId;
9
- const lower = roomId.toLowerCase();
10
- if (lower.startsWith("matrix:")) {
11
- roomId = roomId.slice("matrix:".length).trim();
12
- }
13
- if (roomId.toLowerCase().startsWith("channel:")) {
14
- roomId = roomId.slice("channel:".length).trim();
15
- }
16
- if (roomId.toLowerCase().startsWith("room:")) {
17
- roomId = roomId.slice("room:".length).trim();
18
- }
15
+ roomId = stripLeadingPrefixCaseInsensitive(roomId, "matrix:");
16
+ roomId = stripLeadingPrefixCaseInsensitive(roomId, "channel:");
17
+ roomId = stripLeadingPrefixCaseInsensitive(roomId, "room:");
18
+
19
19
  const groupChannel = params.groupChannel?.trim() ?? "";
20
20
  const aliases = groupChannel ? [groupChannel] : [];
21
21
  const cfg = params.cfg as CoreConfig;
22
22
  const matrixConfig = resolveMatrixAccountConfig({ cfg, accountId: params.accountId });
23
- const resolved = resolveMatrixRoomConfig({
23
+ return resolveMatrixRoomConfig({
24
24
  rooms: matrixConfig.groups ?? matrixConfig.rooms,
25
25
  roomId,
26
26
  aliases,
27
27
  name: groupChannel || undefined,
28
28
  }).config;
29
+ }
30
+
31
+ export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): boolean {
32
+ const resolved = resolveMatrixRoomConfigForGroup(params);
29
33
  if (resolved) {
30
34
  if (resolved.autoReply === true) {
31
35
  return false;
@@ -43,27 +47,6 @@ export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): b
43
47
  export function resolveMatrixGroupToolPolicy(
44
48
  params: ChannelGroupContext,
45
49
  ): GroupToolPolicyConfig | undefined {
46
- const rawGroupId = params.groupId?.trim() ?? "";
47
- let roomId = rawGroupId;
48
- const lower = roomId.toLowerCase();
49
- if (lower.startsWith("matrix:")) {
50
- roomId = roomId.slice("matrix:".length).trim();
51
- }
52
- if (roomId.toLowerCase().startsWith("channel:")) {
53
- roomId = roomId.slice("channel:".length).trim();
54
- }
55
- if (roomId.toLowerCase().startsWith("room:")) {
56
- roomId = roomId.slice("room:".length).trim();
57
- }
58
- const groupChannel = params.groupChannel?.trim() ?? "";
59
- const aliases = groupChannel ? [groupChannel] : [];
60
- const cfg = params.cfg as CoreConfig;
61
- const matrixConfig = resolveMatrixAccountConfig({ cfg, accountId: params.accountId });
62
- const resolved = resolveMatrixRoomConfig({
63
- rooms: matrixConfig.groups ?? matrixConfig.rooms,
64
- roomId,
65
- aliases,
66
- name: groupChannel || undefined,
67
- }).config;
50
+ const resolved = resolveMatrixRoomConfigForGroup(params);
68
51
  return resolved?.tools;
69
52
  }
@@ -1,4 +1,4 @@
1
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
1
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
2
2
  import type { CoreConfig, MatrixConfig } from "../types.js";
3
3
  import { resolveMatrixConfigForAccount } from "./client.js";
4
4
  import { credentialsMatchConfig, loadMatrixCredentials } from "./credentials.js";
@@ -1,4 +1,4 @@
1
- import { normalizeAccountId } from "openclaw/plugin-sdk";
1
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
2
2
  import type { CoreConfig } from "../../types.js";
3
3
  import type { MatrixActionClient, MatrixActionClientOpts } from "./types.js";
4
4
  import { getMatrixRuntime } from "../../runtime.js";
@@ -1,5 +1,5 @@
1
1
  import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
2
- import { normalizeAccountId } from "openclaw/plugin-sdk";
2
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
3
 
4
4
  // Support multiple active clients for multi-account
5
5
  const activeClients = new Map<string, MatrixClient>();
@@ -1,5 +1,5 @@
1
1
  import { MatrixClient } from "@vector-im/matrix-bot-sdk";
2
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
2
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
3
  import type { CoreConfig } from "../../types.js";
4
4
  import type { MatrixAuth, MatrixResolvedConfig } from "./types.js";
5
5
  import { getMatrixRuntime } from "../../runtime.js";
@@ -1,6 +1,6 @@
1
1
  import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
2
2
  import { LogService } from "@vector-im/matrix-bot-sdk";
3
- import { normalizeAccountId } from "openclaw/plugin-sdk";
3
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
4
4
  import type { CoreConfig } from "../../types.js";
5
5
  import type { MatrixAuth } from "./types.js";
6
6
  import { resolveMatrixAuth } from "./config.js";
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
4
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
5
  import { getMatrixRuntime } from "../runtime.js";
6
6
 
7
7
  export type MatrixStoredCredentials = {
@@ -1,9 +1,8 @@
1
+ import type { BaseProbeResult } from "openclaw/plugin-sdk";
1
2
  import { createMatrixClient, isBunRuntime } from "./client.js";
2
3
 
3
- export type MatrixProbe = {
4
- ok: boolean;
4
+ export type MatrixProbe = BaseProbeResult & {
5
5
  status?: number | null;
6
- error?: string | null;
7
6
  elapsedMs: number;
8
7
  userId?: string | null;
9
8
  };
@@ -1,5 +1,5 @@
1
1
  import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
2
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
2
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
3
  import type { CoreConfig } from "../../types.js";
4
4
  import { getMatrixRuntime } from "../../runtime.js";
5
5
  import { getActiveMatrixClient, getAnyActiveMatrixClient } from "../active-client.js";
@@ -2,6 +2,12 @@ import type { PluginRuntime } from "openclaw/plugin-sdk";
2
2
  import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
3
3
  import { setMatrixRuntime } from "../runtime.js";
4
4
 
5
+ vi.mock("music-metadata", () => ({
6
+ // `resolveMediaDurationMs` lazily imports `music-metadata`; in tests we don't
7
+ // need real duration parsing and the real module is expensive to load.
8
+ parseBuffer: vi.fn().mockResolvedValue({ format: {} }),
9
+ }));
10
+
5
11
  vi.mock("@vector-im/matrix-bot-sdk", () => ({
6
12
  ConsoleLogger: class {
7
13
  trace = vi.fn();
@@ -65,12 +71,12 @@ const makeClient = () => {
65
71
  return { client, sendMessage, uploadContent };
66
72
  };
67
73
 
68
- describe("sendMessageMatrix media", () => {
69
- beforeAll(async () => {
70
- setMatrixRuntime(runtimeStub);
71
- ({ sendMessageMatrix } = await import("./send.js"));
72
- });
74
+ beforeAll(async () => {
75
+ setMatrixRuntime(runtimeStub);
76
+ ({ sendMessageMatrix } = await import("./send.js"));
77
+ });
73
78
 
79
+ describe("sendMessageMatrix media", () => {
74
80
  beforeEach(() => {
75
81
  vi.clearAllMocks();
76
82
  mediaKindFromMimeMock.mockReturnValue("image");
@@ -200,11 +206,6 @@ describe("sendMessageMatrix media", () => {
200
206
  });
201
207
 
202
208
  describe("sendMessageMatrix threads", () => {
203
- beforeAll(async () => {
204
- setMatrixRuntime(runtimeStub);
205
- ({ sendMessageMatrix } = await import("./send.js"));
206
- });
207
-
208
209
  beforeEach(() => {
209
210
  vi.clearAllMocks();
210
211
  setMatrixRuntime(runtimeStub);