@openclaw/mattermost 2026.8.1-beta.3 → 2026.8.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.
@@ -1,7 +1,8 @@
1
- import { m as normalizeMattermostBaseUrl } from "./client-B_hd-kwM.js";
2
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
1
+ import { m as normalizeMattermostBaseUrl } from "./client-DAIry9-2.js";
2
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockCoalesce, resolveChannelStreamingBlockEnabled, resolveChannelStreamingChunkMode } from "openclaw/plugin-sdk/channel-outbound";
4
4
  import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
5
+ import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
5
6
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
6
7
  import { buildSecretInputSchema, hasConfiguredSecretInput, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
7
8
  //#region extensions/mattermost/src/mattermost/accounts.ts
@@ -83,4 +84,68 @@ function resolveMattermostReplyToMode(account, kind) {
83
84
  return account.config.replyToMode ?? "off";
84
85
  }
85
86
  //#endregion
86
- export { resolveMattermostReplyToMode as a, resolveMattermostAccount as i, listMattermostAccountIds as n, buildSecretInputSchema as o, resolveDefaultMattermostAccountId as r, hasConfiguredSecretInput as s, inspectMattermostAccount as t };
87
+ //#region extensions/mattermost/src/normalize.ts
88
+ function resolveMattermostPresentation(params) {
89
+ const presentation = normalizeMessagePresentation(params.presentation);
90
+ return {
91
+ text: !presentation || params.presentationTextMode === "fallback" && params.text !== void 0 ? params.text ?? "" : renderMessagePresentationFallbackText({
92
+ text: params.text,
93
+ presentation
94
+ }),
95
+ buttons: presentation ? presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
96
+ if (button.action) return [];
97
+ const value = resolveMessagePresentationControlValue(button);
98
+ return value ? [{
99
+ id: value,
100
+ text: button.label,
101
+ callback_data: value,
102
+ context: { callback_data: value },
103
+ style: button.style
104
+ }] : [];
105
+ })).filter((row) => row.length > 0) : []
106
+ };
107
+ }
108
+ function normalizeMattermostMessagingTarget(raw) {
109
+ const trimmed = raw.trim();
110
+ if (!trimmed) return;
111
+ const lower = normalizeLowercaseStringOrEmpty(trimmed);
112
+ if (lower.startsWith("channel:")) {
113
+ const id = trimmed.slice(8).trim();
114
+ return id ? `channel:${id}` : void 0;
115
+ }
116
+ if (lower.startsWith("group:")) {
117
+ const id = trimmed.slice(6).trim();
118
+ return id ? `channel:${id}` : void 0;
119
+ }
120
+ if (lower.startsWith("user:")) {
121
+ const id = trimmed.slice(5).trim();
122
+ return id ? `user:${id}` : void 0;
123
+ }
124
+ if (lower.startsWith("mattermost:")) {
125
+ const id = trimmed.slice(11).trim();
126
+ return id ? `user:${id}` : void 0;
127
+ }
128
+ if (trimmed.startsWith("@")) {
129
+ const id = trimmed.slice(1).trim();
130
+ return id ? `@${id}` : void 0;
131
+ }
132
+ if (trimmed.startsWith("#")) return;
133
+ }
134
+ /**
135
+ * True when media must be uploaded as a file: any non-empty, non-http(s) value
136
+ * (e.g. a local workspace path) has no address the server can fetch, so the
137
+ * send must require a successful upload rather than degrade to caption text.
138
+ */
139
+ function requiresMattermostMediaUpload(mediaUrl) {
140
+ const trimmed = mediaUrl?.trim();
141
+ return Boolean(trimmed && !/^https?:\/\//i.test(trimmed));
142
+ }
143
+ function looksLikeMattermostTargetId(raw, _normalized) {
144
+ const trimmed = raw.trim();
145
+ if (!trimmed) return false;
146
+ if (/^(user|channel|group|mattermost):/i.test(trimmed)) return true;
147
+ if (trimmed.startsWith("@")) return true;
148
+ return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
149
+ }
150
+ //#endregion
151
+ export { inspectMattermostAccount as a, resolveMattermostAccount as c, hasConfiguredSecretInput as d, resolveMattermostPresentation as i, resolveMattermostReplyToMode as l, normalizeMattermostMessagingTarget as n, listMattermostAccountIds as o, requiresMattermostMediaUpload as r, resolveDefaultMattermostAccountId as s, looksLikeMattermostTargetId as t, buildSecretInputSchema as u };
@@ -1,2 +1,2 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-CVd_4FPD.js";
1
+ import { r as isMattermostSenderAllowed } from "./monitor-auth-CACk1Hos.js";
2
2
  export { isMattermostSenderAllowed };
@@ -1,23 +1,24 @@
1
1
  import { r as setMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, createDedupeCache, isTrustedProxyAddress, parseStrictPositiveInteger, resolveClientIp } from "openclaw/plugin-sdk/core";
3
2
  import { formatInboundFromLabel, logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
4
3
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
5
4
  import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
6
5
  import { createAccountStatusSink, createChannelMessageReplyPipeline } from "openclaw/plugin-sdk/channel-outbound";
7
6
  import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
8
7
  import { listSkillCommandsForAgents, resolveControlCommandGate, resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth-native";
9
- import { buildModelsProviderData } from "openclaw/plugin-sdk/models-provider-runtime";
8
+ import { buildPreparedModelsProviderData } from "openclaw/plugin-sdk/models-provider-runtime";
10
9
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
11
10
  import { GROUP_POLICY_BLOCKED_LABEL, resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
12
- import { getAgentScopedMediaLocalRoots, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/media-runtime";
11
+ import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
13
12
  import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
14
13
  import { DEFAULT_GROUP_HISTORY_LIMIT, buildPendingHistoryContextFromMap, clearHistoryEntriesIfEnabled, createChannelHistoryWindow, recordPendingHistoryEntryIfEnabled } from "openclaw/plugin-sdk/reply-history";
15
14
  import { registerPluginHttpRoute } from "openclaw/plugin-sdk/webhook-targets";
16
15
  import { isRequestBodyLimitError, rawDataToString, readRequestBodyWithLimit } from "openclaw/plugin-sdk/webhook-ingress";
16
+ import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, createDedupeCache, isTrustedProxyAddress, parseStrictPositiveInteger, resolveClientIp } from "openclaw/plugin-sdk/core";
17
17
  import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
18
18
  import { applyAccountNameToChannelSection, applySetupAccountConfigPatch, migrateBaseNameToDefaultAccount } from "openclaw/plugin-sdk/setup";
19
19
  import { buildComputedAccountStatusSnapshot } from "openclaw/plugin-sdk/channel-status";
20
20
  import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
21
21
  import { normalizeAccountId, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
22
+ import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
22
23
  import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
23
- export { DEFAULT_ACCOUNT_ID, DEFAULT_GROUP_HISTORY_LIMIT, GROUP_POLICY_BLOCKED_LABEL, applyAccountNameToChannelSection, applySetupAccountConfigPatch, buildChannelConfigSchema, buildComputedAccountStatusSnapshot, buildModelsProviderData, buildPendingHistoryContextFromMap, chunkTextForOutbound, clearHistoryEntriesIfEnabled, createAccountStatusSink, createChannelHistoryWindow, createChannelMessageReplyPipeline, createChannelPairingController, createDedupeCache, formatInboundFromLabel, getAgentScopedMediaLocalRoots, isDangerousNameMatchingEnabled, isRequestBodyLimitError, isTrustedProxyAddress, listSkillCommandsForAgents, loadOutboundMediaFromUrl, logInboundDrop, logTypingFailure, migrateBaseNameToDefaultAccount, normalizeAccountId, normalizeProviderId, parseStrictPositiveInteger, rawDataToString, readRequestBodyWithLimit, recordPendingHistoryEntryIfEnabled, registerPluginHttpRoute, resolveAllowlistMatchSimple, resolveAllowlistProviderRuntimeGroupPolicy, resolveChannelMediaMaxBytes, resolveClientIp, resolveControlCommandGate, resolveDefaultGroupPolicy, resolveStorePath, resolveStoredModelOverride, resolveThreadSessionKeys, setMattermostRuntime, warnMissingProviderGroupPolicyFallbackOnce };
24
+ export { DEFAULT_ACCOUNT_ID, DEFAULT_GROUP_HISTORY_LIMIT, GROUP_POLICY_BLOCKED_LABEL, applyAccountNameToChannelSection, applySetupAccountConfigPatch, buildChannelConfigSchema, buildComputedAccountStatusSnapshot, buildPendingHistoryContextFromMap, buildPreparedModelsProviderData, chunkTextForOutbound, clearHistoryEntriesIfEnabled, createAccountStatusSink, createChannelHistoryWindow, createChannelMessageReplyPipeline, createChannelPairingController, createDedupeCache, formatInboundFromLabel, getAgentScopedMediaLocalRoots, isDangerousNameMatchingEnabled, isRequestBodyLimitError, isTrustedProxyAddress, listSkillCommandsForAgents, loadOutboundMediaFromUrl, logInboundDrop, logTypingFailure, migrateBaseNameToDefaultAccount, normalizeAccountId, normalizeProviderId, parseStrictPositiveInteger, rawDataToString, readRequestBodyWithLimit, recordPendingHistoryEntryIfEnabled, registerPluginHttpRoute, resolveAllowlistMatchSimple, resolveAllowlistProviderRuntimeGroupPolicy, resolveChannelMediaMaxBytes, resolveClientIp, resolveControlCommandGate, resolveDefaultGroupPolicy, resolveStorePath, resolveStoredModelOverride, resolveThreadSessionKeys, setMattermostRuntime, warnMissingProviderGroupPolicyFallbackOnce };
@@ -1,2 +1,2 @@
1
- import { i as registerSlashCommandRoute } from "./slash-state-BakgoSSL.js";
1
+ import { i as registerSlashCommandRoute } from "./slash-state-CPIuJQj2.js";
2
2
  export { registerSlashCommandRoute };
@@ -1,8 +1,8 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { _ as resolveMattermostReplyDeliveryBarrierTimeoutMs, a as createMattermostPost, b as uploadMattermostFile, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, h as parseMattermostApiStatus, i as createMattermostDirectChannelWithRetry, m as normalizeMattermostBaseUrl, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe, v as sendMattermostTyping } from "./client-B_hd-kwM.js";
3
- import { a as normalizeMattermostAllowList, g as loadOutboundMediaFromUrl, l as buildModelsProviderData, p as isRequestBodyLimitError, s as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, v as logTypingFailure, y as readRequestBodyWithLimit } from "./monitor-auth-CVd_4FPD.js";
4
- import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-Du_EJMeN.js";
5
- import { i as resolveMattermostAccount } from "./accounts-DspH-NMT.js";
2
+ import { _ as sendMattermostTyping, a as createMattermostPost, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, h as parseMattermostApiStatus, i as createMattermostDirectChannelWithRetry, m as normalizeMattermostBaseUrl, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe, y as uploadMattermostFile } from "./client-DAIry9-2.js";
3
+ import { _ as logTypingFailure, c as buildPreparedModelsProviderData, f as isRequestBodyLimitError, h as loadOutboundMediaFromUrl, i as normalizeMattermostAllowList, o as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, v as readRequestBodyWithLimit } from "./monitor-auth-CACk1Hos.js";
4
+ import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-LnudXdqD.js";
5
+ import { c as resolveMattermostAccount, i as resolveMattermostPresentation, r as requiresMattermostMediaUpload } from "./normalize-DoleH0bY.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
8
8
  import { asFiniteNumber, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -11,12 +11,12 @@ import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs
11
11
  import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
12
12
  import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
13
13
  import { resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth-native";
14
- import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
14
+ import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
15
15
  import { deliverTextOrMediaReply, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
16
16
  import { FormatCapabilityProfile, convertMarkdownTables } from "openclaw/plugin-sdk/text-chunking";
17
17
  import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
18
+ import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
18
19
  import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
19
- import { Readable } from "node:stream";
20
20
  import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
21
21
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
22
22
  import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
@@ -613,42 +613,6 @@ function renderMattermostModelsPickerView(params) {
613
613
  }
614
614
  //#endregion
615
615
  //#region extensions/mattermost/src/mattermost/reply-delivery.ts
616
- function createMattermostReplyDeliveryBarrier(params) {
617
- let activeDmChannelResolutions = 0;
618
- let queuedDeliveryCount = 0;
619
- let settledDeliveryCount = 0;
620
- const trackDmChannelResolution = (resolution) => {
621
- activeDmChannelResolutions += 1;
622
- Promise.resolve(resolution).then(() => {
623
- activeDmChannelResolutions -= 1;
624
- }, () => {
625
- activeDmChannelResolutions -= 1;
626
- });
627
- };
628
- const markDeliverySettled = () => {
629
- settledDeliveryCount += 1;
630
- };
631
- const resolveTimeoutPolicy = (context) => {
632
- const { queuedCounts } = context;
633
- queuedDeliveryCount = Object.values(queuedCounts).reduce((sum, count) => sum + count, 0);
634
- const maxTimeoutMs = resolveMattermostReplyDeliveryBarrierTimeoutMs({
635
- isDirect: params.isDirect,
636
- dmRetryOptions: params.dmRetryOptions,
637
- queuedCounts,
638
- humanDelayBudgetMs: context.humanDelayBudgetMs
639
- });
640
- if (maxTimeoutMs === void 0) return;
641
- return {
642
- maxTimeoutMs,
643
- shouldExtend: () => activeDmChannelResolutions > 0 || settledDeliveryCount < queuedDeliveryCount
644
- };
645
- };
646
- return {
647
- trackDmChannelResolution,
648
- markDeliverySettled,
649
- resolveTimeoutPolicy
650
- };
651
- }
652
616
  /** Represents distinct provider posts without collapsing their visible boundary. */
653
617
  function joinMattermostVisibleContent(contents) {
654
618
  return contents.filter((content) => Boolean(content)).join("\n");
@@ -659,39 +623,35 @@ async function deliverMattermostReplyPayload(params) {
659
623
  visibleReplySent: false,
660
624
  suppression: { reason: "no_visible_result" }
661
625
  };
662
- const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.core.channel.text.convertMarkdownTables(params.payload.text ?? "", params.tableMode) });
626
+ const presentation = resolveMattermostPresentation(params.payload);
627
+ const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.core.channel.text.convertMarkdownTables(presentation.text, params.tableMode) });
663
628
  const mediaLocalRoots = getAgentScopedMediaLocalRoots(params.cfg, params.agentId);
664
629
  const chunkMode = params.core.channel.text.resolveChunkMode(params.cfg, "mattermost", params.accountId);
665
630
  const results = [];
666
631
  const acceptedContents = [];
632
+ const sendAccepted = async (text, mediaUrl) => {
633
+ const result = await params.sendMessage(`channel:${params.channelId}`, text, {
634
+ cfg: params.cfg,
635
+ accountId: params.accountId,
636
+ ...mediaUrl ? {
637
+ mediaUrl,
638
+ mediaLocalRoots
639
+ } : {},
640
+ ...requiresMattermostMediaUpload(mediaUrl) ? { requireMediaUpload: true } : {},
641
+ ...results.length === 0 && reply.mediaUrls.length < 2 && presentation.buttons.length ? { buttons: presentation.buttons } : {},
642
+ replyToId: params.replyToId
643
+ });
644
+ results.push(result);
645
+ acceptedContents.push(result.content);
646
+ };
667
647
  let outcome;
668
648
  try {
669
649
  outcome = await deliverTextOrMediaReply({
670
650
  payload: params.payload,
671
651
  text: reply.text,
672
652
  chunkText: (value) => params.core.channel.text.chunkMarkdownTextWithMode(value, params.textLimit, chunkMode),
673
- sendText: async (chunk) => {
674
- const result = await params.sendMessage(params.to, chunk, {
675
- cfg: params.cfg,
676
- accountId: params.accountId,
677
- replyToId: params.replyToId,
678
- ...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
679
- });
680
- results.push(result);
681
- acceptedContents.push(result.content);
682
- },
683
- sendMedia: async ({ mediaUrl, caption }) => {
684
- const result = await params.sendMessage(params.to, caption ?? "", {
685
- cfg: params.cfg,
686
- accountId: params.accountId,
687
- mediaUrl,
688
- mediaLocalRoots,
689
- replyToId: params.replyToId,
690
- ...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
691
- });
692
- results.push(result);
693
- acceptedContents.push(result.content);
694
- }
653
+ sendText: sendAccepted,
654
+ sendMedia: ({ mediaUrl, caption }) => sendAccepted(caption ?? "", mediaUrl)
695
655
  });
696
656
  } catch (error) {
697
657
  const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
@@ -1014,7 +974,7 @@ async function resolveTargetChannelId(params) {
1014
974
  const cachedDm = dmChannelCache.get(dmKey);
1015
975
  if (cachedDm) return cachedDm;
1016
976
  const botUser = await resolveBotUser(params.baseUrl, params.token, params.allowPrivateNetwork);
1017
- const resolution = createMattermostDirectChannelWithRetry(createMattermostClient({
977
+ const channel = await createMattermostDirectChannelWithRetry(createMattermostClient({
1018
978
  baseUrl: params.baseUrl,
1019
979
  botToken: params.token,
1020
980
  allowPrivateNetwork: params.allowPrivateNetwork
@@ -1025,8 +985,6 @@ async function resolveTargetChannelId(params) {
1025
985
  if (params.logger) params.logger.warn?.(`DM channel creation retry ${attempt} after ${delayMs}ms: ${error.message}`);
1026
986
  }
1027
987
  });
1028
- params.onDmChannelResolution?.(resolution);
1029
- const channel = await resolution;
1030
988
  cacheOutboundEntry(dmChannelCache, dmKey, channel.id, MATTERMOST_TARGET_CACHE_MAX_ENTRIES);
1031
989
  return channel.id;
1032
990
  }
@@ -1069,7 +1027,6 @@ async function resolveMattermostSendContext(to, opts) {
1069
1027
  token,
1070
1028
  allowPrivateNetwork,
1071
1029
  dmRetryOptions,
1072
- onDmChannelResolution: opts.onDmChannelResolution,
1073
1030
  logger: core.logging.shouldLogVerbose() ? logger : void 0
1074
1031
  });
1075
1032
  return {
@@ -1078,13 +1035,18 @@ async function resolveMattermostSendContext(to, opts) {
1078
1035
  token,
1079
1036
  baseUrl,
1080
1037
  channelId,
1081
- allowPrivateNetwork
1038
+ allowPrivateNetwork,
1039
+ mediaMaxBytes: resolveChannelMediaMaxBytes({
1040
+ cfg,
1041
+ accountId: account.accountId,
1042
+ resolveChannelLimitMb: () => account.config.mediaMaxMb
1043
+ })
1082
1044
  };
1083
1045
  }
1084
1046
  async function sendMessageMattermost(to, text, opts) {
1085
1047
  const core = getCore();
1086
1048
  const logger = core.logging.getChildLogger({ module: "mattermost" });
1087
- const { cfg, accountId, token, baseUrl, channelId, allowPrivateNetwork } = await resolveMattermostSendContext(to, opts);
1049
+ const { cfg, accountId, token, baseUrl, channelId, allowPrivateNetwork, mediaMaxBytes } = await resolveMattermostSendContext(to, opts);
1088
1050
  const client = createMattermostClient({
1089
1051
  baseUrl,
1090
1052
  botToken: token,
@@ -1113,6 +1075,7 @@ async function sendMessageMattermost(to, text, opts) {
1113
1075
  const mediaUrl = opts.mediaUrl?.trim();
1114
1076
  if (mediaUrl) try {
1115
1077
  const media = await loadOutboundMediaFromUrl(mediaUrl, {
1078
+ maxBytes: mediaMaxBytes,
1116
1079
  mediaLocalRoots: opts.mediaLocalRoots,
1117
1080
  mediaReadFile: opts.mediaReadFile,
1118
1081
  workspaceDir: opts.workspaceDir
@@ -1125,7 +1088,7 @@ async function sendMessageMattermost(to, text, opts) {
1125
1088
  })).id];
1126
1089
  } catch (err) {
1127
1090
  uploadError = err instanceof Error ? err : new Error(String(err));
1128
- if (opts.requireMediaUpload) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: err });
1091
+ if (opts.requireMediaUpload || mediaMaxBytes !== void 0) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: err });
1129
1092
  if (core.logging.shouldLogVerbose()) logger.debug?.(`mattermost send: media upload failed, falling back to URL text: ${String(err)}`);
1130
1093
  message = normalizeMessage(message, isHttpUrl(mediaUrl) ? mediaUrl : "");
1131
1094
  }
@@ -1500,7 +1463,7 @@ async function authorizeSlashInvocation(params) {
1500
1463
  */
1501
1464
  function createSlashCommandHttpHandler(params) {
1502
1465
  const { account, cfg, runtime, registeredCommands, triggerMap, log, bodyTimeoutMs } = params;
1503
- return async (req, res) => {
1466
+ return async (req, res, bufferedBody) => {
1504
1467
  if (req.method !== "POST") {
1505
1468
  res.statusCode = 405;
1506
1469
  res.setHeader("Allow", "POST");
@@ -1509,7 +1472,7 @@ function createSlashCommandHttpHandler(params) {
1509
1472
  }
1510
1473
  let body;
1511
1474
  try {
1512
- body = await readBody(req, MAX_BODY_BYTES, bodyTimeoutMs);
1475
+ body = bufferedBody ?? await readBody(req, MAX_BODY_BYTES, bodyTimeoutMs);
1513
1476
  } catch (error) {
1514
1477
  if (isRequestBodyLimitError(error, "REQUEST_BODY_TIMEOUT")) {
1515
1478
  res.statusCode = 408;
@@ -1633,9 +1596,9 @@ async function handleSlashCommandAsync(params) {
1633
1596
  const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
1634
1597
  const pickerEntry = resolveMattermostModelPickerEntry(commandText);
1635
1598
  if (pickerEntry) {
1636
- const data = await buildModelsProviderData(cfg, route.agentId);
1599
+ const data = await buildPreparedModelsProviderData(cfg, route.agentId);
1637
1600
  if (data.providers.length === 0) {
1638
- await sendMessageMattermost(to, "No models available.", {
1601
+ await sendMessageMattermost(`channel:${channelId}`, "No models available.", {
1639
1602
  cfg,
1640
1603
  accountId: account.accountId
1641
1604
  });
@@ -1660,7 +1623,7 @@ async function handleSlashCommandAsync(params) {
1660
1623
  page: 1,
1661
1624
  currentModel
1662
1625
  });
1663
- await sendMessageMattermost(to, view.text, {
1626
+ await sendMessageMattermost(`channel:${channelId}`, view.text, {
1664
1627
  cfg,
1665
1628
  accountId: account.accountId,
1666
1629
  buttons: view.buttons
@@ -1703,10 +1666,6 @@ async function handleSlashCommandAsync(params) {
1703
1666
  accountId: account.accountId
1704
1667
  });
1705
1668
  const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
1706
- const deliveryBarrier = createMattermostReplyDeliveryBarrier({
1707
- isDirect: kind === "direct",
1708
- dmRetryOptions: account.config.dmChannelRetry
1709
- });
1710
1669
  await core.channel.inbound.dispatch({
1711
1670
  cfg,
1712
1671
  channel: "mattermost",
@@ -1724,13 +1683,12 @@ async function handleSlashCommandAsync(params) {
1724
1683
  core,
1725
1684
  cfg,
1726
1685
  payload,
1727
- to,
1686
+ channelId,
1728
1687
  accountId: account.accountId,
1729
1688
  agentId: route.agentId,
1730
1689
  textLimit,
1731
1690
  tableMode,
1732
- sendMessage: sendMessageMattermost,
1733
- onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
1691
+ sendMessage: sendMessageMattermost
1734
1692
  });
1735
1693
  if (result.visibleReplySent) runtime.log?.(`delivered slash reply to ${to}`);
1736
1694
  return result;
@@ -1750,11 +1708,7 @@ async function handleSlashCommandAsync(params) {
1750
1708
  });
1751
1709
  }
1752
1710
  } },
1753
- dispatcherOptions: {
1754
- resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
1755
- onDeliverySettled: deliveryBarrier.markDeliverySettled,
1756
- humanDelay
1757
- },
1711
+ dispatcherOptions: { humanDelay },
1758
1712
  replyOptions: { disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0 }
1759
1713
  });
1760
1714
  }
@@ -1984,15 +1938,7 @@ function registerSlashCommandRoute(api) {
1984
1938
  }));
1985
1939
  return;
1986
1940
  }
1987
- const matchedHandler = match.handler;
1988
- const syntheticReq = new Readable({ read() {
1989
- this.push(Buffer.from(bodyStr, "utf8"));
1990
- this.push(null);
1991
- } });
1992
- syntheticReq.method = req.method;
1993
- syntheticReq.url = req.url;
1994
- syntheticReq.headers = req.headers;
1995
- await matchedHandler(syntheticReq, res);
1941
+ await match.handler(req, res, bodyStr);
1996
1942
  };
1997
1943
  for (const callbackPath of callbackPaths) api.registerHttpRoute({
1998
1944
  path: callbackPath,
@@ -2001,4 +1947,4 @@ function registerSlashCommandRoute(api) {
2001
1947
  });
2002
1948
  }
2003
1949
  //#endregion
2004
- export { isSlashCommandsEnabled as _, sendMessageMattermost as a, resolveSlashCommandConfig as b, deliverMattermostReplyPayload as c, parseMattermostModelPickerContext as d, renderMattermostModelsPickerView as f, cleanupSlashCommands as g, DEFAULT_COMMAND_SPECS as h, registerSlashCommandRoute as i, joinMattermostVisibleContent as l, resolveMattermostModelPickerCurrentModel as m, deactivateSlashCommands as n, resolveMattermostOpaqueTarget as o, renderMattermostProviderPickerView as p, getSlashCommandState as r, createMattermostReplyDeliveryBarrier as s, activateSlashCommands as t, buildMattermostAllowedModelRefs as u, registerSlashCommands as v, resolveCallbackUrl as y };
1950
+ export { registerSlashCommands as _, sendMessageMattermost as a, joinMattermostVisibleContent as c, renderMattermostModelsPickerView as d, renderMattermostProviderPickerView as f, isSlashCommandsEnabled as g, cleanupSlashCommands as h, registerSlashCommandRoute as i, buildMattermostAllowedModelRefs as l, DEFAULT_COMMAND_SPECS as m, deactivateSlashCommands as n, resolveMattermostOpaqueTarget as o, resolveMattermostModelPickerCurrentModel as p, getSlashCommandState as r, deliverMattermostReplyPayload as s, activateSlashCommands as t, parseMattermostModelPickerContext as u, resolveCallbackUrl as v, resolveSlashCommandConfig as y };
@@ -167,7 +167,9 @@ class PerMessageDeflate {
167
167
  (typeof opts.serverMaxWindowBits === 'number' &&
168
168
  opts.serverMaxWindowBits > params.server_max_window_bits))) ||
169
169
  (typeof opts.clientMaxWindowBits === 'number' &&
170
- !params.client_max_window_bits)
170
+ (typeof params.client_max_window_bits === 'number'
171
+ ? opts.clientMaxWindowBits > params.client_max_window_bits
172
+ : !params.client_max_window_bits))
171
173
  ) {
172
174
  return false;
173
175
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws",
3
- "version": "8.21.1",
3
+ "version": "8.21.3",
4
4
  "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
5
5
  "keywords": [
6
6
  "HyBi",
@@ -54,6 +54,23 @@
54
54
  "configWrites": {
55
55
  "type": "boolean"
56
56
  },
57
+ "contextVisibility": {
58
+ "type": "string",
59
+ "enum": [
60
+ "all",
61
+ "allowlist",
62
+ "allowlist_quote"
63
+ ]
64
+ },
65
+ "historyLimit": {
66
+ "type": "integer",
67
+ "minimum": 0,
68
+ "maximum": 9007199254740991
69
+ },
70
+ "mediaMaxMb": {
71
+ "type": "number",
72
+ "exclusiveMinimum": 0
73
+ },
57
74
  "botToken": {
58
75
  "anyOf": [
59
76
  {
@@ -548,6 +565,23 @@
548
565
  "configWrites": {
549
566
  "type": "boolean"
550
567
  },
568
+ "contextVisibility": {
569
+ "type": "string",
570
+ "enum": [
571
+ "all",
572
+ "allowlist",
573
+ "allowlist_quote"
574
+ ]
575
+ },
576
+ "historyLimit": {
577
+ "type": "integer",
578
+ "minimum": 0,
579
+ "maximum": 9007199254740991
580
+ },
581
+ "mediaMaxMb": {
582
+ "type": "number",
583
+ "exclusiveMinimum": 0
584
+ },
551
585
  "botToken": {
552
586
  "anyOf": [
553
587
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.8.1-beta.3",
3
+ "version": "2026.8.1",
4
4
  "description": "OpenClaw Mattermost channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,11 +8,11 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "ws": "8.21.1",
11
+ "ws": "8.21.3",
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.8.1-beta.3"
15
+ "openclaw": ">=2026.8.1"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "openclaw": {
@@ -91,10 +91,10 @@
91
91
  "allowInvalidConfigRecovery": true
92
92
  },
93
93
  "compat": {
94
- "pluginApi": ">=2026.8.1-beta.3"
94
+ "pluginApi": ">=2026.8.1"
95
95
  },
96
96
  "build": {
97
- "openclawVersion": "2026.8.1-beta.3",
97
+ "openclawVersion": "2026.8.1",
98
98
  "bundledDist": false
99
99
  },
100
100
  "release": {