@openclaw/mattermost 2026.7.2-beta.2 → 2026.7.2-beta.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.
@@ -35,6 +35,16 @@ function normalizeMattermostBaseUrl(raw) {
35
35
  function buildMattermostApiUrl(baseUrl, path) {
36
36
  const normalized = normalizeMattermostBaseUrl(baseUrl);
37
37
  if (!normalized) throw new Error("Mattermost baseUrl is required");
38
+ const pathname = (path.split(/[?#]/, 1)[0] ?? "").replace(/[\t\r\n]/g, "").replace(/\\/g, "/");
39
+ for (const segment of pathname.split("/")) {
40
+ let decoded;
41
+ try {
42
+ decoded = decodeURIComponent(segment).replace(/[\t\r\n]/g, "");
43
+ } catch {
44
+ throw new Error("Mattermost API path must not contain unsafe path segments");
45
+ }
46
+ if (decoded.split(/[\\/]/).some((part) => part === "." || part === "..")) throw new Error("Mattermost API path must not contain unsafe path segments");
47
+ }
38
48
  return `${normalized}/api/v4${path.startsWith("/") ? path : `/${path}`}`;
39
49
  }
40
50
  async function readMattermostSuccessText(res, path) {
@@ -383,4 +393,4 @@ async function uploadMattermostFile(client, params) {
383
393
  return info;
384
394
  }
385
395
  //#endregion
386
- export { uploadMattermostFile as _, deleteMattermostPost as a, fetchMattermostMe as c, fetchMattermostUserTeams as d, normalizeMattermostBaseUrl as f, updateMattermostPost as g, sendMattermostTyping as h, createMattermostPost as i, fetchMattermostUser as l, resolveMattermostReplyDeliveryBarrierTimeoutMs as m, createMattermostClient as n, fetchMattermostChannel as o, readMattermostError as p, createMattermostDirectChannelWithRetry as r, fetchMattermostChannelByName as s, MattermostPostSchema as t, fetchMattermostUserByUsername as u };
396
+ export { updateMattermostPost as _, createMattermostPost as a, fetchMattermostChannelByName as c, fetchMattermostUserByUsername as d, fetchMattermostUserTeams as f, sendMattermostTyping as g, resolveMattermostReplyDeliveryBarrierTimeoutMs as h, createMattermostDirectChannelWithRetry as i, fetchMattermostMe as l, readMattermostError as m, buildMattermostApiUrl as n, deleteMattermostPost as o, normalizeMattermostBaseUrl as p, createMattermostClient as r, fetchMattermostChannel as s, MattermostPostSchema as t, fetchMattermostUser as u, uploadMattermostFile as v };
@@ -1,6 +1,6 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { g as updateMattermostPost } from "./client-BzLj4dyf.js";
3
- import { b as readRequestBodyWithLimit, m as isTrustedProxyAddress, w as resolveClientIp } from "./monitor-auth-dEHa1_On.js";
2
+ import { _ as updateMattermostPost } from "./client-w0lkxuKh.js";
3
+ import { E as resolveClientIp, S as readRequestBodyWithLimit, g as isTrustedProxyAddress } from "./monitor-auth-ynw9EnGC.js";
4
4
  import { createHmac } from "node:crypto";
5
5
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
6
6
  import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -50,21 +50,24 @@ function formatMattermostDirectMessageDropLog(params) {
50
50
  return `mattermost: drop dm sender=${params.senderId} (dmPolicy=${params.dmPolicy}${reason}${hint})`;
51
51
  }
52
52
  function isMattermostSenderAllowed(params) {
53
- const allowFrom = normalizeMattermostAllowList(params.allowFrom);
54
- if (allowFrom.length === 0) return false;
55
53
  return resolveAllowlistMatchSimple({
56
- allowFrom,
54
+ allowFrom: normalizeMattermostAllowList(params.allowFrom),
57
55
  senderId: normalizeMattermostAllowEntry(params.senderId),
58
56
  senderName: params.senderName ? normalizeMattermostAllowEntry(params.senderName) : void 0,
59
57
  allowNameMatching: params.allowNameMatching
60
58
  }).allowed;
61
59
  }
62
- function mapMattermostChannelKind(channelType) {
60
+ function mapMattermostChannelTypeToChatType(channelType) {
63
61
  const normalized = channelType?.trim().toUpperCase();
62
+ if (!normalized) return "direct";
64
63
  if (normalized === "D") return "direct";
65
64
  if (normalized === "G" || normalized === "P") return "group";
66
65
  return "channel";
67
66
  }
67
+ function resolveMattermostTrustedChatKind(params) {
68
+ const channelType = params.channelType?.trim();
69
+ return channelType ? mapMattermostChannelTypeToChatType(channelType) : params.fallback ?? "direct";
70
+ }
68
71
  async function resolveMattermostMonitorInboundAccess(params) {
69
72
  const { account, cfg, senderId, senderName, channelId, kind, groupPolicy, storeAllowFrom, allowTextCommands, hasControlCommand } = params;
70
73
  const dmPolicy = account.config.dmPolicy ?? "pairing";
@@ -131,7 +134,7 @@ async function authorizeMattermostCommandInvocation(params) {
131
134
  channelDisplay: "",
132
135
  roomLabel: `#${channelId}`
133
136
  };
134
- const kind = mapMattermostChannelKind(channelInfo.type);
137
+ const kind = mapMattermostChannelTypeToChatType(channelInfo.type);
135
138
  const chatType = kind;
136
139
  const channelName = channelInfo.name ?? "";
137
140
  const channelDisplay = channelInfo.display_name ?? channelName;
@@ -180,4 +183,4 @@ async function authorizeMattermostCommandInvocation(params) {
180
183
  };
181
184
  }
182
185
  //#endregion
183
- export { resolveChannelMediaMaxBytes as C, warnMissingProviderGroupPolicyFallbackOnce as E, resolveAllowlistProviderRuntimeGroupPolicy as S, resolveDefaultGroupPolicy as T, logInboundDrop as _, normalizeMattermostAllowList as a, readRequestBodyWithLimit as b, buildAgentMediaPayload as c, createChannelMessageReplyPipeline as d, createChannelPairingController as f, loadOutboundMediaFromUrl as g, listSkillCommandsForAgents as h, normalizeMattermostAllowEntry as i, buildModelsProviderData as l, isTrustedProxyAddress as m, formatMattermostDirectMessageDropLog as n, resolveMattermostMonitorInboundAccess as o, isRequestBodyLimitError as p, isMattermostSenderAllowed as r, DEFAULT_GROUP_HISTORY_LIMIT as s, authorizeMattermostCommandInvocation as t, createChannelHistoryWindow as u, logTypingFailure as v, resolveClientIp as w, registerPluginHttpRoute as x, parseTcpPort as y };
186
+ export { registerPluginHttpRoute as C, resolveDefaultGroupPolicy as D, resolveClientIp as E, warnMissingProviderGroupPolicyFallbackOnce as O, readRequestBodyWithLimit as S, resolveChannelMediaMaxBytes as T, listSkillCommandsForAgents as _, normalizeMattermostAllowEntry as a, logTypingFailure as b, resolveMattermostTrustedChatKind as c, buildModelsProviderData as d, createChannelHistoryWindow as f, isTrustedProxyAddress as g, isRequestBodyLimitError as h, mapMattermostChannelTypeToChatType as i, DEFAULT_GROUP_HISTORY_LIMIT as l, createChannelPairingController as m, formatMattermostDirectMessageDropLog as n, normalizeMattermostAllowList as o, createChannelMessageReplyPipeline as p, isMattermostSenderAllowed as r, resolveMattermostMonitorInboundAccess as s, authorizeMattermostCommandInvocation as t, buildAgentMediaPayload as u, loadOutboundMediaFromUrl as v, resolveAllowlistProviderRuntimeGroupPolicy as w, parseTcpPort as x, logInboundDrop as y };
@@ -1,2 +1,2 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-dEHa1_On.js";
1
+ import { r as isMattermostSenderAllowed } from "./monitor-auth-ynw9EnGC.js";
2
2
  export { isMattermostSenderAllowed };
@@ -1,2 +1,2 @@
1
- import { i as registerSlashCommandRoute } from "./slash-state-C9bpBN40.js";
1
+ import { i as registerSlashCommandRoute } from "./slash-state-N-zfDDSz.js";
2
2
  export { registerSlashCommandRoute };
@@ -1,8 +1,8 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { _ as uploadMattermostFile, c as fetchMattermostMe, d as fetchMattermostUserTeams, f as normalizeMattermostBaseUrl, h as sendMattermostTyping, i as createMattermostPost, l as fetchMattermostUser, m as resolveMattermostReplyDeliveryBarrierTimeoutMs, n as createMattermostClient, o as fetchMattermostChannel, r as createMattermostDirectChannelWithRetry, s as fetchMattermostChannelByName, u as fetchMattermostUserByUsername } from "./client-BzLj4dyf.js";
3
- import { a as normalizeMattermostAllowList, b as readRequestBodyWithLimit, d as createChannelMessageReplyPipeline, g as loadOutboundMediaFromUrl, l as buildModelsProviderData, p as isRequestBodyLimitError, t as authorizeMattermostCommandInvocation, v as logTypingFailure } from "./monitor-auth-dEHa1_On.js";
4
- import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-DO7J-ND1.js";
5
- import { r as resolveMattermostAccount } from "./accounts-C4Azn6rA.js";
2
+ import { a as createMattermostPost, c as fetchMattermostChannelByName, d as fetchMattermostUserByUsername, f as fetchMattermostUserTeams, g as sendMattermostTyping, h as resolveMattermostReplyDeliveryBarrierTimeoutMs, i as createMattermostDirectChannelWithRetry, l as fetchMattermostMe, p as normalizeMattermostBaseUrl, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostUser, v as uploadMattermostFile } from "./client-w0lkxuKh.js";
3
+ import { S as readRequestBodyWithLimit, b as logTypingFailure, d as buildModelsProviderData, h as isRequestBodyLimitError, o as normalizeMattermostAllowList, p as createChannelMessageReplyPipeline, t as authorizeMattermostCommandInvocation, v as loadOutboundMediaFromUrl } from "./monitor-auth-ynw9EnGC.js";
4
+ import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-BIb5iJjA.js";
5
+ import { r as resolveMattermostAccount } from "./accounts-B-GrNVwP.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
8
8
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -16,6 +16,8 @@ import { convertMarkdownTables } from "openclaw/plugin-sdk/text-chunking";
16
16
  import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
17
17
  import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
18
18
  import { Readable } from "node:stream";
19
+ import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
20
+ import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
19
21
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
20
22
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
21
23
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
@@ -1587,7 +1589,7 @@ async function handleSlashCommandAsync(params) {
1587
1589
  runtime.log?.(`delivered model picker to ${to}`);
1588
1590
  return;
1589
1591
  }
1590
- const ctxPayload = core.channel.reply.finalizeInboundContext({
1592
+ const ctxPayload = finalizeInboundContext({
1591
1593
  Body: commandText,
1592
1594
  BodyForAgent: commandText,
1593
1595
  RawBody: commandText,
@@ -1634,51 +1636,43 @@ async function handleSlashCommandAsync(params) {
1634
1636
  }
1635
1637
  }
1636
1638
  });
1637
- const humanDelay = core.channel.reply.resolveHumanDelayConfig(cfg, route.agentId);
1639
+ const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
1638
1640
  const deliveryBarrier = createMattermostReplyDeliveryBarrier({
1639
1641
  isDirect: kind === "direct",
1640
1642
  dmRetryOptions: account.config.dmChannelRetry
1641
1643
  });
1642
- const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
1643
- ...replyPipeline,
1644
- resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
1645
- onDeliverySettled: deliveryBarrier.markDeliverySettled,
1646
- humanDelay,
1647
- deliver: async (payload) => {
1648
- await deliverMattermostReplyPayload({
1649
- core,
1650
- cfg,
1651
- payload,
1652
- to,
1653
- accountId: account.accountId,
1654
- agentId: route.agentId,
1655
- textLimit,
1656
- tableMode,
1657
- sendMessage: sendMessageMattermost,
1658
- onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
1659
- });
1660
- runtime.log?.(`delivered slash reply to ${to}`);
1661
- },
1662
- onError: (err, info) => {
1663
- runtime.error?.(`mattermost slash ${info.kind} reply failed: ${sanitizeCommandLookupError(err)}`);
1664
- },
1665
- onReplyStart: typingCallbacks?.onReplyStart
1666
- });
1667
- await core.channel.reply.withReplyDispatcher({
1668
- dispatcher,
1669
- onSettled: () => {
1670
- markDispatchIdle();
1644
+ await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
1645
+ ctx: ctxPayload,
1646
+ cfg,
1647
+ dispatcherOptions: {
1648
+ ...replyPipeline,
1649
+ resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
1650
+ onDeliverySettled: deliveryBarrier.markDeliverySettled,
1651
+ humanDelay,
1652
+ deliver: async (payload) => {
1653
+ await deliverMattermostReplyPayload({
1654
+ core,
1655
+ cfg,
1656
+ payload,
1657
+ to,
1658
+ accountId: account.accountId,
1659
+ agentId: route.agentId,
1660
+ textLimit,
1661
+ tableMode,
1662
+ sendMessage: sendMessageMattermost,
1663
+ onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
1664
+ });
1665
+ runtime.log?.(`delivered slash reply to ${to}`);
1666
+ },
1667
+ onError: (err, info) => {
1668
+ runtime.error?.(`mattermost slash ${info.kind} reply failed: ${sanitizeCommandLookupError(err)}`);
1669
+ },
1670
+ typingCallbacks
1671
1671
  },
1672
- run: () => core.channel.reply.dispatchReplyFromConfig({
1673
- ctx: ctxPayload,
1674
- cfg,
1675
- dispatcher,
1676
- replyOptions: {
1677
- ...replyOptions,
1678
- disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0,
1679
- onModelSelected
1680
- }
1681
- })
1672
+ replyOptions: {
1673
+ disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0,
1674
+ onModelSelected
1675
+ }
1682
1676
  });
1683
1677
  }
1684
1678
  //#endregion
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.7.2-beta.2",
3
+ "version": "2026.7.2-beta.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/mattermost",
9
- "version": "2026.7.2-beta.2",
9
+ "version": "2026.7.2-beta.3",
10
10
  "dependencies": {
11
11
  "ws": "8.21.0",
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.7.2-beta.2"
15
+ "openclaw": ">=2026.7.2-beta.3"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "openclaw": {
@@ -155,6 +155,21 @@
155
155
  "requireMention": {
156
156
  "type": "boolean"
157
157
  },
158
+ "implicitMentions": {
159
+ "type": "object",
160
+ "properties": {
161
+ "replyToBot": {
162
+ "type": "boolean"
163
+ },
164
+ "quotedBot": {
165
+ "type": "boolean"
166
+ },
167
+ "threadParticipation": {
168
+ "type": "boolean"
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ },
158
173
  "dmPolicy": {
159
174
  "default": "pairing",
160
175
  "type": "string",
@@ -608,6 +623,21 @@
608
623
  "requireMention": {
609
624
  "type": "boolean"
610
625
  },
626
+ "implicitMentions": {
627
+ "type": "object",
628
+ "properties": {
629
+ "replyToBot": {
630
+ "type": "boolean"
631
+ },
632
+ "quotedBot": {
633
+ "type": "boolean"
634
+ },
635
+ "threadParticipation": {
636
+ "type": "boolean"
637
+ }
638
+ },
639
+ "additionalProperties": false
640
+ },
611
641
  "dmPolicy": {
612
642
  "default": "pairing",
613
643
  "type": "string",
@@ -951,6 +981,22 @@
951
981
  "label": "Mattermost DM Policy",
952
982
  "help": "Direct message access control (\"pairing\" recommended). \"open\" requires channels.mattermost.allowFrom=[\"*\"]."
953
983
  },
984
+ "implicitMentions": {
985
+ "label": "Mattermost Implicit Mentions",
986
+ "help": "Control which Mattermost reply, quote, and thread-participation signals count as mentions. Unset flags preserve the channel defaults."
987
+ },
988
+ "implicitMentions.replyToBot": {
989
+ "label": "Mattermost Replies to Bot",
990
+ "help": "Treat replies to the bot's own messages as implicit mentions when the channel reports that signal."
991
+ },
992
+ "implicitMentions.quotedBot": {
993
+ "label": "Mattermost Quoted Bot Messages",
994
+ "help": "Treat messages quoting the bot as implicit mentions when the channel reports that signal."
995
+ },
996
+ "implicitMentions.threadParticipation": {
997
+ "label": "Mattermost Thread Participation",
998
+ "help": "Treat follow-ups in threads where the bot participated as implicit mentions when the channel reports that signal."
999
+ },
954
1000
  "streaming": {
955
1001
  "label": "Mattermost Streaming Mode",
956
1002
  "help": "Unified Mattermost stream preview mode: \"off\" | \"partial\" | \"block\" | \"progress\". \"progress\" keeps a single editable progress draft until final delivery."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.7.2-beta.2",
3
+ "version": "2026.7.2-beta.3",
4
4
  "description": "OpenClaw Mattermost channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.7.2-beta.2"
15
+ "openclaw": ">=2026.7.2-beta.3"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "openclaw": {
@@ -41,10 +41,10 @@
41
41
  "allowInvalidConfigRecovery": true
42
42
  },
43
43
  "compat": {
44
- "pluginApi": ">=2026.7.2-beta.2"
44
+ "pluginApi": ">=2026.7.2-beta.3"
45
45
  },
46
46
  "build": {
47
- "openclawVersion": "2026.7.2-beta.2",
47
+ "openclawVersion": "2026.7.2-beta.3",
48
48
  "bundledDist": false
49
49
  },
50
50
  "release": {