@openclaw/mattermost 2026.8.1-beta.2 → 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,44 +1,22 @@
1
- import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core";
2
- import { normalizeLowercaseStringOrEmpty, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
1
+ import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.js";
2
+ import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
4
4
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
5
5
  import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
6
6
  import { createChannelMessageReplyPipeline } from "openclaw/plugin-sdk/channel-outbound";
7
7
  import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
8
8
  import { listSkillCommandsForAgents } from "openclaw/plugin-sdk/command-auth-native";
9
- import { buildModelsProviderData } from "openclaw/plugin-sdk/models-provider-runtime";
9
+ import { buildPreparedModelsProviderData } from "openclaw/plugin-sdk/models-provider-runtime";
10
10
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
11
11
  import { resolveAllowlistProviderRuntimeGroupPolicy as resolveAllowlistProviderRuntimeGroupPolicy$1, resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
12
- import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/media-runtime";
12
+ import { resolveChannelMediaMaxBytes as resolveChannelMediaMaxBytes$1 } from "openclaw/plugin-sdk/account-helpers";
13
13
  import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
14
14
  import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
15
15
  import { registerPluginHttpRoute } from "openclaw/plugin-sdk/webhook-targets";
16
16
  import { isRequestBodyLimitError, readRequestBodyWithLimit } from "openclaw/plugin-sdk/webhook-ingress";
17
- import { parseAccessGroupAllowFromEntry } from "openclaw/plugin-sdk/access-groups";
17
+ import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core";
18
18
  import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
19
19
  //#region extensions/mattermost/src/mattermost/monitor-auth.ts
20
- const mattermostIngressIdentity = {
21
- key: "sender-id",
22
- normalize: normalizeMattermostAllowEntry,
23
- aliases: [{
24
- key: "sender-name",
25
- kind: "plugin:mattermost-user-name",
26
- normalizeEntry: normalizeMattermostAllowEntry,
27
- normalizeSubject: normalizeMattermostAllowEntry,
28
- dangerous: true
29
- }],
30
- isWildcardEntry: (entry) => normalizeMattermostAllowEntry(entry) === "*",
31
- resolveEntryId: ({ entryIndex, fieldKey }) => `mattermost-entry-${entryIndex + 1}:${fieldKey === "sender-name" ? "name" : "user"}`
32
- };
33
- function normalizeMattermostAllowEntry(entry) {
34
- const trimmed = entry.trim();
35
- if (!trimmed) return "";
36
- if (trimmed === "*") return "*";
37
- const accessGroupName = parseAccessGroupAllowFromEntry(trimmed);
38
- if (accessGroupName) return `accessGroup:${accessGroupName}`;
39
- const normalized = trimmed.replace(/^(mattermost|user):/i, "").replace(/^@/, "").trim();
40
- return normalized ? normalizeLowercaseStringOrEmpty(normalized) : "";
41
- }
42
20
  function normalizeMattermostAllowList(entries) {
43
21
  return uniqueStrings(entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean));
44
22
  }
@@ -181,4 +159,4 @@ async function authorizeMattermostCommandInvocation(params) {
181
159
  };
182
160
  }
183
161
  //#endregion
184
- export { resolveClientIp as C, resolveChannelMediaMaxBytes as S, warnMissingProviderGroupPolicyFallbackOnce as T, logInboundDrop as _, normalizeMattermostAllowList as a, registerPluginHttpRoute as b, DEFAULT_GROUP_HISTORY_LIMIT 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, resolveMattermostTrustedChatKind as s, authorizeMattermostCommandInvocation as t, createChannelHistoryWindow as u, logTypingFailure as v, resolveDefaultGroupPolicy as w, resolveAllowlistProviderRuntimeGroupPolicy$1 as x, readRequestBodyWithLimit as y };
162
+ export { resolveDefaultGroupPolicy as C, resolveClientIp as S, logTypingFailure as _, resolveMattermostMonitorInboundAccess as a, resolveAllowlistProviderRuntimeGroupPolicy$1 as b, buildPreparedModelsProviderData as c, createChannelPairingController as d, isRequestBodyLimitError as f, logInboundDrop as g, loadOutboundMediaFromUrl as h, normalizeMattermostAllowList as i, createChannelHistoryWindow as l, listSkillCommandsForAgents as m, formatMattermostDirectMessageDropLog as n, resolveMattermostTrustedChatKind as o, isTrustedProxyAddress as p, isMattermostSenderAllowed as r, DEFAULT_GROUP_HISTORY_LIMIT as s, authorizeMattermostCommandInvocation as t, createChannelMessageReplyPipeline as u, readRequestBodyWithLimit as v, warnMissingProviderGroupPolicyFallbackOnce as w, resolveChannelMediaMaxBytes$1 as x, registerPluginHttpRoute as y };
@@ -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-DUowGLl4.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,32 +11,20 @@ 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
+ import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
20
21
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
21
22
  import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
22
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
23
23
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
24
24
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
25
25
  import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
26
26
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
27
27
  const MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES = 128;
28
- function truncateMattermostCommandDescription(description) {
29
- if (Buffer.byteLength(description, "utf8") <= MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES) return description;
30
- let bytes = 0;
31
- let end = 0;
32
- for (const char of description) {
33
- const charBytes = Buffer.byteLength(char, "utf8");
34
- if (bytes + charBytes > MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES) break;
35
- bytes += charBytes;
36
- end += char.length;
37
- }
38
- return description.slice(0, end);
39
- }
40
28
  /**
41
29
  * Built-in OpenClaw commands to register as native slash commands.
42
30
  * These mirror the text-based commands already handled by the gateway.
@@ -163,7 +151,7 @@ async function registerSlashCommands(params) {
163
151
  }
164
152
  const registered = [];
165
153
  for (const spec of commands) {
166
- const description = truncateMattermostCommandDescription(spec.description);
154
+ const description = truncateUtf8Prefix(spec.description, MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES);
167
155
  const existingForTrigger = existingByTrigger.get(spec.trigger) ?? [];
168
156
  const ownedCommands = existingForTrigger.filter((cmd) => cmd.creator_id?.trim() === normalizedCreatorUserId);
169
157
  const foreignCommands = existingForTrigger.filter((cmd) => cmd.creator_id?.trim() !== normalizedCreatorUserId);
@@ -625,42 +613,6 @@ function renderMattermostModelsPickerView(params) {
625
613
  }
626
614
  //#endregion
627
615
  //#region extensions/mattermost/src/mattermost/reply-delivery.ts
628
- function createMattermostReplyDeliveryBarrier(params) {
629
- let activeDmChannelResolutions = 0;
630
- let queuedDeliveryCount = 0;
631
- let settledDeliveryCount = 0;
632
- const trackDmChannelResolution = (resolution) => {
633
- activeDmChannelResolutions += 1;
634
- Promise.resolve(resolution).then(() => {
635
- activeDmChannelResolutions -= 1;
636
- }, () => {
637
- activeDmChannelResolutions -= 1;
638
- });
639
- };
640
- const markDeliverySettled = () => {
641
- settledDeliveryCount += 1;
642
- };
643
- const resolveTimeoutPolicy = (context) => {
644
- const { queuedCounts } = context;
645
- queuedDeliveryCount = Object.values(queuedCounts).reduce((sum, count) => sum + count, 0);
646
- const maxTimeoutMs = resolveMattermostReplyDeliveryBarrierTimeoutMs({
647
- isDirect: params.isDirect,
648
- dmRetryOptions: params.dmRetryOptions,
649
- queuedCounts,
650
- humanDelayBudgetMs: context.humanDelayBudgetMs
651
- });
652
- if (maxTimeoutMs === void 0) return;
653
- return {
654
- maxTimeoutMs,
655
- shouldExtend: () => activeDmChannelResolutions > 0 || settledDeliveryCount < queuedDeliveryCount
656
- };
657
- };
658
- return {
659
- trackDmChannelResolution,
660
- markDeliverySettled,
661
- resolveTimeoutPolicy
662
- };
663
- }
664
616
  /** Represents distinct provider posts without collapsing their visible boundary. */
665
617
  function joinMattermostVisibleContent(contents) {
666
618
  return contents.filter((content) => Boolean(content)).join("\n");
@@ -671,39 +623,35 @@ async function deliverMattermostReplyPayload(params) {
671
623
  visibleReplySent: false,
672
624
  suppression: { reason: "no_visible_result" }
673
625
  };
674
- 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) });
675
628
  const mediaLocalRoots = getAgentScopedMediaLocalRoots(params.cfg, params.agentId);
676
629
  const chunkMode = params.core.channel.text.resolveChunkMode(params.cfg, "mattermost", params.accountId);
677
630
  const results = [];
678
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
+ };
679
647
  let outcome;
680
648
  try {
681
649
  outcome = await deliverTextOrMediaReply({
682
650
  payload: params.payload,
683
651
  text: reply.text,
684
652
  chunkText: (value) => params.core.channel.text.chunkMarkdownTextWithMode(value, params.textLimit, chunkMode),
685
- sendText: async (chunk) => {
686
- const result = await params.sendMessage(params.to, chunk, {
687
- cfg: params.cfg,
688
- accountId: params.accountId,
689
- replyToId: params.replyToId,
690
- ...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
691
- });
692
- results.push(result);
693
- acceptedContents.push(result.content);
694
- },
695
- sendMedia: async ({ mediaUrl, caption }) => {
696
- const result = await params.sendMessage(params.to, caption ?? "", {
697
- cfg: params.cfg,
698
- accountId: params.accountId,
699
- mediaUrl,
700
- mediaLocalRoots,
701
- replyToId: params.replyToId,
702
- ...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
703
- });
704
- results.push(result);
705
- acceptedContents.push(result.content);
706
- }
653
+ sendText: sendAccepted,
654
+ sendMedia: ({ mediaUrl, caption }) => sendAccepted(caption ?? "", mediaUrl)
707
655
  });
708
656
  } catch (error) {
709
657
  const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
@@ -1026,7 +974,7 @@ async function resolveTargetChannelId(params) {
1026
974
  const cachedDm = dmChannelCache.get(dmKey);
1027
975
  if (cachedDm) return cachedDm;
1028
976
  const botUser = await resolveBotUser(params.baseUrl, params.token, params.allowPrivateNetwork);
1029
- const resolution = createMattermostDirectChannelWithRetry(createMattermostClient({
977
+ const channel = await createMattermostDirectChannelWithRetry(createMattermostClient({
1030
978
  baseUrl: params.baseUrl,
1031
979
  botToken: params.token,
1032
980
  allowPrivateNetwork: params.allowPrivateNetwork
@@ -1037,8 +985,6 @@ async function resolveTargetChannelId(params) {
1037
985
  if (params.logger) params.logger.warn?.(`DM channel creation retry ${attempt} after ${delayMs}ms: ${error.message}`);
1038
986
  }
1039
987
  });
1040
- params.onDmChannelResolution?.(resolution);
1041
- const channel = await resolution;
1042
988
  cacheOutboundEntry(dmChannelCache, dmKey, channel.id, MATTERMOST_TARGET_CACHE_MAX_ENTRIES);
1043
989
  return channel.id;
1044
990
  }
@@ -1081,7 +1027,6 @@ async function resolveMattermostSendContext(to, opts) {
1081
1027
  token,
1082
1028
  allowPrivateNetwork,
1083
1029
  dmRetryOptions,
1084
- onDmChannelResolution: opts.onDmChannelResolution,
1085
1030
  logger: core.logging.shouldLogVerbose() ? logger : void 0
1086
1031
  });
1087
1032
  return {
@@ -1090,13 +1035,18 @@ async function resolveMattermostSendContext(to, opts) {
1090
1035
  token,
1091
1036
  baseUrl,
1092
1037
  channelId,
1093
- allowPrivateNetwork
1038
+ allowPrivateNetwork,
1039
+ mediaMaxBytes: resolveChannelMediaMaxBytes({
1040
+ cfg,
1041
+ accountId: account.accountId,
1042
+ resolveChannelLimitMb: () => account.config.mediaMaxMb
1043
+ })
1094
1044
  };
1095
1045
  }
1096
1046
  async function sendMessageMattermost(to, text, opts) {
1097
1047
  const core = getCore();
1098
1048
  const logger = core.logging.getChildLogger({ module: "mattermost" });
1099
- const { cfg, accountId, token, baseUrl, channelId, allowPrivateNetwork } = await resolveMattermostSendContext(to, opts);
1049
+ const { cfg, accountId, token, baseUrl, channelId, allowPrivateNetwork, mediaMaxBytes } = await resolveMattermostSendContext(to, opts);
1100
1050
  const client = createMattermostClient({
1101
1051
  baseUrl,
1102
1052
  botToken: token,
@@ -1125,6 +1075,7 @@ async function sendMessageMattermost(to, text, opts) {
1125
1075
  const mediaUrl = opts.mediaUrl?.trim();
1126
1076
  if (mediaUrl) try {
1127
1077
  const media = await loadOutboundMediaFromUrl(mediaUrl, {
1078
+ maxBytes: mediaMaxBytes,
1128
1079
  mediaLocalRoots: opts.mediaLocalRoots,
1129
1080
  mediaReadFile: opts.mediaReadFile,
1130
1081
  workspaceDir: opts.workspaceDir
@@ -1137,7 +1088,7 @@ async function sendMessageMattermost(to, text, opts) {
1137
1088
  })).id];
1138
1089
  } catch (err) {
1139
1090
  uploadError = err instanceof Error ? err : new Error(String(err));
1140
- 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 });
1141
1092
  if (core.logging.shouldLogVerbose()) logger.debug?.(`mattermost send: media upload failed, falling back to URL text: ${String(err)}`);
1142
1093
  message = normalizeMessage(message, isHttpUrl(mediaUrl) ? mediaUrl : "");
1143
1094
  }
@@ -1512,7 +1463,7 @@ async function authorizeSlashInvocation(params) {
1512
1463
  */
1513
1464
  function createSlashCommandHttpHandler(params) {
1514
1465
  const { account, cfg, runtime, registeredCommands, triggerMap, log, bodyTimeoutMs } = params;
1515
- return async (req, res) => {
1466
+ return async (req, res, bufferedBody) => {
1516
1467
  if (req.method !== "POST") {
1517
1468
  res.statusCode = 405;
1518
1469
  res.setHeader("Allow", "POST");
@@ -1521,7 +1472,7 @@ function createSlashCommandHttpHandler(params) {
1521
1472
  }
1522
1473
  let body;
1523
1474
  try {
1524
- body = await readBody(req, MAX_BODY_BYTES, bodyTimeoutMs);
1475
+ body = bufferedBody ?? await readBody(req, MAX_BODY_BYTES, bodyTimeoutMs);
1525
1476
  } catch (error) {
1526
1477
  if (isRequestBodyLimitError(error, "REQUEST_BODY_TIMEOUT")) {
1527
1478
  res.statusCode = 408;
@@ -1645,9 +1596,9 @@ async function handleSlashCommandAsync(params) {
1645
1596
  const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
1646
1597
  const pickerEntry = resolveMattermostModelPickerEntry(commandText);
1647
1598
  if (pickerEntry) {
1648
- const data = await buildModelsProviderData(cfg, route.agentId);
1599
+ const data = await buildPreparedModelsProviderData(cfg, route.agentId);
1649
1600
  if (data.providers.length === 0) {
1650
- await sendMessageMattermost(to, "No models available.", {
1601
+ await sendMessageMattermost(`channel:${channelId}`, "No models available.", {
1651
1602
  cfg,
1652
1603
  accountId: account.accountId
1653
1604
  });
@@ -1672,7 +1623,7 @@ async function handleSlashCommandAsync(params) {
1672
1623
  page: 1,
1673
1624
  currentModel
1674
1625
  });
1675
- await sendMessageMattermost(to, view.text, {
1626
+ await sendMessageMattermost(`channel:${channelId}`, view.text, {
1676
1627
  cfg,
1677
1628
  accountId: account.accountId,
1678
1629
  buttons: view.buttons
@@ -1690,7 +1641,10 @@ async function handleSlashCommandAsync(params) {
1690
1641
  SessionKey: route.sessionKey,
1691
1642
  AccountId: route.accountId,
1692
1643
  ChatType: chatType,
1644
+ ConversationRouteContextObserved: true,
1645
+ ConversationRoutePeerId: kind === "direct" ? senderId : channelId,
1693
1646
  ConversationLabel: fromLabel,
1647
+ GroupSpace: teamId,
1694
1648
  GroupSubject: kind !== "direct" ? channelDisplay || roomLabel : void 0,
1695
1649
  SenderName: senderName,
1696
1650
  SenderId: senderId,
@@ -1700,6 +1654,7 @@ async function handleSlashCommandAsync(params) {
1700
1654
  Timestamp: Date.now(),
1701
1655
  WasMentioned: true,
1702
1656
  CommandAuthorized: commandAuthorized,
1657
+ InboundAccessAuthorized: true,
1703
1658
  CommandSource: "native",
1704
1659
  OriginatingChannel: "mattermost",
1705
1660
  OriginatingTo: to
@@ -1711,10 +1666,6 @@ async function handleSlashCommandAsync(params) {
1711
1666
  accountId: account.accountId
1712
1667
  });
1713
1668
  const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
1714
- const deliveryBarrier = createMattermostReplyDeliveryBarrier({
1715
- isDirect: kind === "direct",
1716
- dmRetryOptions: account.config.dmChannelRetry
1717
- });
1718
1669
  await core.channel.inbound.dispatch({
1719
1670
  cfg,
1720
1671
  channel: "mattermost",
@@ -1732,13 +1683,12 @@ async function handleSlashCommandAsync(params) {
1732
1683
  core,
1733
1684
  cfg,
1734
1685
  payload,
1735
- to,
1686
+ channelId,
1736
1687
  accountId: account.accountId,
1737
1688
  agentId: route.agentId,
1738
1689
  textLimit,
1739
1690
  tableMode,
1740
- sendMessage: sendMessageMattermost,
1741
- onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
1691
+ sendMessage: sendMessageMattermost
1742
1692
  });
1743
1693
  if (result.visibleReplySent) runtime.log?.(`delivered slash reply to ${to}`);
1744
1694
  return result;
@@ -1758,11 +1708,7 @@ async function handleSlashCommandAsync(params) {
1758
1708
  });
1759
1709
  }
1760
1710
  } },
1761
- dispatcherOptions: {
1762
- resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
1763
- onDeliverySettled: deliveryBarrier.markDeliverySettled,
1764
- humanDelay
1765
- },
1711
+ dispatcherOptions: { humanDelay },
1766
1712
  replyOptions: { disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0 }
1767
1713
  });
1768
1714
  }
@@ -1992,15 +1938,7 @@ function registerSlashCommandRoute(api) {
1992
1938
  }));
1993
1939
  return;
1994
1940
  }
1995
- const matchedHandler = match.handler;
1996
- const syntheticReq = new Readable({ read() {
1997
- this.push(Buffer.from(bodyStr, "utf8"));
1998
- this.push(null);
1999
- } });
2000
- syntheticReq.method = req.method;
2001
- syntheticReq.url = req.url;
2002
- syntheticReq.headers = req.headers;
2003
- await matchedHandler(syntheticReq, res);
1941
+ await match.handler(req, res, bodyStr);
2004
1942
  };
2005
1943
  for (const callbackPath of callbackPaths) api.registerHttpRoute({
2006
1944
  path: callbackPath,
@@ -2009,4 +1947,4 @@ function registerSlashCommandRoute(api) {
2009
1947
  });
2010
1948
  }
2011
1949
  //#endregion
2012
- 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.2",
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.2"
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.2"
94
+ "pluginApi": ">=2026.8.1"
95
95
  },
96
96
  "build": {
97
- "openclawVersion": "2026.8.1-beta.2",
97
+ "openclawVersion": "2026.8.1",
98
98
  "bundledDist": false
99
99
  },
100
100
  "release": {