@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.
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-CVd_4FPD.js";
2
- import { t as buildButtonAttachments } from "./interactions-Du_EJMeN.js";
1
+ import { r as isMattermostSenderAllowed } from "./monitor-auth-CACk1Hos.js";
2
+ import { t as buildButtonAttachments } from "./interactions-LnudXdqD.js";
3
3
  export { buildButtonAttachments, isMattermostSenderAllowed };
@@ -1,4 +1,4 @@
1
- import { a as MattermostChannelConfigSchema, c as mattermostConfigAdapter, l as mattermostMeta, n as mattermostSetupWizard, o as describeMattermostAccount, r as mattermostSetupContract, s as isMattermostConfigured, t as mattermostPlugin } from "./channel-plugin-runtime-Dxt8Zv1j.js";
1
+ import { a as describeMattermostAccount, c as mattermostMeta, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as isMattermostConfigured, r as mattermostSetupContract, s as mattermostConfigAdapter, t as mattermostPlugin } from "./channel-plugin-runtime-DGrYW6mT.js";
2
2
  import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
3
3
  //#region extensions/mattermost/src/channel.setup.ts
4
4
  const mattermostSetupPlugin = {
@@ -1,9 +1,9 @@
1
- import { m as normalizeMattermostBaseUrl } from "./client-B_hd-kwM.js";
2
- import { a as resolveMattermostReplyToMode, i as resolveMattermostAccount, n as listMattermostAccountIds, o as buildSecretInputSchema, r as resolveDefaultMattermostAccountId, s as hasConfiguredSecretInput, t as inspectMattermostAccount } from "./accounts-DspH-NMT.js";
1
+ import { m as normalizeMattermostBaseUrl } from "./client-DAIry9-2.js";
2
+ import { t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.js";
3
+ import { a as inspectMattermostAccount, c as resolveMattermostAccount, d as hasConfiguredSecretInput, i as resolveMattermostPresentation, l as resolveMattermostReplyToMode, n as normalizeMattermostMessagingTarget, o as listMattermostAccountIds, r as requiresMattermostMediaUpload, s as resolveDefaultMattermostAccountId, t as looksLikeMattermostTargetId, u as buildSecretInputSchema } from "./normalize-DoleH0bY.js";
3
4
  import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
4
5
  import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.js";
5
6
  import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-qg3NXRlS.js";
6
- import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
7
7
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
9
9
  import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -11,21 +11,23 @@ import { z } from "zod";
11
11
  import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
12
12
  import { createLoggedPairingApprovalNotifier } from "openclaw/plugin-sdk/channel-pairing";
13
13
  import { createAccountStatusSink, createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
14
- import { jsonResult, readPositiveIntegerParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
14
+ import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
15
+ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
16
+ import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
17
+ import { jsonResult, readPositiveIntegerParam, readStringArrayParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
15
18
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
16
19
  import { createChannelConfigUiHints, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
17
20
  import { buildChannelGroupsScopeTree, buildMutableAllowEntryDetector, collectStandardAllowlistLists, createDangerousNameMatchingMutableAllowlistWarningCollector, createRestrictSendersChannelSecurity, resolveScopeRequireMention } from "openclaw/plugin-sdk/channel-policy";
18
21
  import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
19
22
  import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime";
20
- import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationButtonAction, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
23
+ import { resolveMessagePresentationButtonAction } from "openclaw/plugin-sdk/interactive-runtime";
21
24
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
22
25
  import { resolvePayloadMediaUrls, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
23
26
  import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
24
27
  import { chunkTextForOutbound, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
25
28
  import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
26
- import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
27
29
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
28
- import { BlockStreamingCoalesceSchema, ChannelImplicitMentionsSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
30
+ import { BlockStreamingCoalesceSchema, ChannelImplicitMentionsSchema, ContextVisibilityModeSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
29
31
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
30
32
  import { applyAccountNameToChannelSection, applySetupAccountConfigPatch, baseUrlTextInput, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, migrateBaseNameToDefaultAccount, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
31
33
  import { createSetupInputPresenceValidator } from "openclaw/plugin-sdk/setup-runtime";
@@ -198,6 +200,9 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
198
200
  markdown: MarkdownConfigSchema,
199
201
  enabled: z.boolean().optional(),
200
202
  configWrites: z.boolean().optional(),
203
+ contextVisibility: ContextVisibilityModeSchema.optional(),
204
+ historyLimit: z.number().int().min(0).optional(),
205
+ mediaMaxMb: z.number().positive().optional(),
201
206
  botToken: buildSecretInputSchema().optional(),
202
207
  baseUrl: z.string().optional(),
203
208
  chatmode: z.enum([
@@ -285,39 +290,59 @@ function resolveMattermostGroupRequireMention(params) {
285
290
  });
286
291
  }
287
292
  //#endregion
288
- //#region extensions/mattermost/src/normalize.ts
289
- function normalizeMattermostMessagingTarget(raw) {
290
- const trimmed = raw.trim();
291
- if (!trimmed) return;
292
- const lower = normalizeLowercaseStringOrEmpty(trimmed);
293
- if (lower.startsWith("channel:")) {
294
- const id = trimmed.slice(8).trim();
295
- return id ? `channel:${id}` : void 0;
296
- }
297
- if (lower.startsWith("group:")) {
298
- const id = trimmed.slice(6).trim();
299
- return id ? `channel:${id}` : void 0;
300
- }
301
- if (lower.startsWith("user:")) {
302
- const id = trimmed.slice(5).trim();
303
- return id ? `user:${id}` : void 0;
304
- }
305
- if (lower.startsWith("mattermost:")) {
306
- const id = trimmed.slice(11).trim();
307
- return id ? `user:${id}` : void 0;
308
- }
309
- if (trimmed.startsWith("@")) {
310
- const id = trimmed.slice(1).trim();
311
- return id ? `@${id}` : void 0;
312
- }
313
- if (trimmed.startsWith("#")) return;
314
- }
315
- function looksLikeMattermostTargetId(raw, _normalized) {
316
- const trimmed = raw.trim();
317
- if (!trimmed) return false;
318
- if (/^(user|channel|group|mattermost):/i.test(trimmed)) return true;
319
- if (trimmed.startsWith("@")) return true;
320
- return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
293
+ //#region extensions/mattermost/src/mattermost/emoji.ts
294
+ const MATTERMOST_EMOJI_SHORTNAME_BY_GLYPH = {
295
+ "✅": "white_check_mark",
296
+ "❌": "x",
297
+ "👍": "thumbsup",
298
+ "👎": "thumbsdown",
299
+ "🎉": "tada",
300
+ "❤": "heart",
301
+ "😄": "smile",
302
+ "😂": "joy",
303
+ "🚀": "rocket",
304
+ "👀": "eyes",
305
+ "🙏": "pray",
306
+ "🔥": "fire",
307
+ "💯": "100",
308
+ "⚠": "warning",
309
+ "➕": "heavy_plus_sign",
310
+ "➖": "heavy_minus_sign",
311
+ "🤔": "thinking_face",
312
+ "⚡": "zap",
313
+ "🌐": "globe_with_meridians",
314
+ "😱": "scream",
315
+ "🧠": "brain",
316
+ "💻": "computer",
317
+ "👋": "wave",
318
+ "🙌": "raised_hands"
319
+ };
320
+ const MATTERMOST_EMOJI_TONE_CAPABLE_NAMES = /* @__PURE__ */ new Set([
321
+ "thumbsup",
322
+ "thumbsdown",
323
+ "pray",
324
+ "wave",
325
+ "raised_hands"
326
+ ]);
327
+ const MATTERMOST_EMOJI_TONE_SUFFIX_BY_MODIFIER = /* @__PURE__ */ new Map([
328
+ ["🏻", "light_skin_tone"],
329
+ ["🏼", "medium_light_skin_tone"],
330
+ ["🏽", "medium_skin_tone"],
331
+ ["🏾", "medium_dark_skin_tone"],
332
+ ["🏿", "dark_skin_tone"]
333
+ ]);
334
+ const EMOJI_SKIN_TONE_MODIFIER_RE = /[\u{1F3FB}-\u{1F3FF}]/gu;
335
+ const EMOJI_VARIATION_SELECTOR_RE = /[\u{FE00}-\u{FE0F}]/gu;
336
+ function normalizeMattermostEmojiName(raw) {
337
+ const withoutColons = raw?.trim().replace(/^:+|:+$/g, "");
338
+ if (!withoutColons) return;
339
+ const toneModifier = withoutColons.match(EMOJI_SKIN_TONE_MODIFIER_RE)?.[0];
340
+ const glyphKey = withoutColons.replace(EMOJI_SKIN_TONE_MODIFIER_RE, "").replace(EMOJI_VARIATION_SELECTOR_RE, "");
341
+ const shortname = Object.hasOwn(MATTERMOST_EMOJI_SHORTNAME_BY_GLYPH, glyphKey) ? MATTERMOST_EMOJI_SHORTNAME_BY_GLYPH[glyphKey] : void 0;
342
+ if (shortname === void 0) return withoutColons;
343
+ const toneSuffix = toneModifier ? MATTERMOST_EMOJI_TONE_SUFFIX_BY_MODIFIER.get(toneModifier) : void 0;
344
+ if (!toneSuffix || !MATTERMOST_EMOJI_TONE_CAPABLE_NAMES.has(shortname)) return shortname;
345
+ return `${shortname}_${toneSuffix}`;
321
346
  }
322
347
  //#endregion
323
348
  //#region extensions/mattermost/src/session-route.ts
@@ -559,20 +584,7 @@ const mattermostSetupWizard = {
559
584
  };
560
585
  //#endregion
561
586
  //#region extensions/mattermost/src/channel.ts
562
- const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-FKnzxYBR.js"));
563
- function buildMattermostPresentationButtons(presentation) {
564
- return presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
565
- if (button.action) return [];
566
- const value = resolveMessagePresentationControlValue(button);
567
- return value ? [{
568
- id: value,
569
- text: button.label,
570
- callback_data: value,
571
- context: { callback_data: value },
572
- style: button.style
573
- }] : [];
574
- })).filter((row) => row.length > 0);
575
- }
587
+ const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-W-EkJlMp.js"));
576
588
  const MATTERMOST_PRESENTATION_CAPABILITIES = {
577
589
  supported: true,
578
590
  buttons: true,
@@ -604,7 +616,9 @@ const mattermostSecurityAdapter = createRestrictSendersChannelSecurity({
604
616
  openScope: "any member",
605
617
  groupPolicyPath: "channels.mattermost.groupPolicy",
606
618
  groupAllowFromPath: "channels.mattermost.groupAllowFrom",
619
+ findingTitle: "Mattermost security warning",
607
620
  policyPathSuffix: "dmPolicy",
621
+ classifyEntryAuthentication: identityEntryAuthenticationClassifier(mattermostIngressIdentity),
608
622
  normalizeDmEntry: (raw) => normalizeMattermostAllowEntry(raw)
609
623
  });
610
624
  function describeMattermostMessageTool({ cfg, accountId }) {
@@ -723,6 +737,7 @@ async function listMattermostDirectoryPeers(params) {
723
737
  return (await loadMattermostChannelRuntime()).listMattermostDirectoryPeers(params);
724
738
  }
725
739
  const mattermostMessageActions = {
740
+ providerOwnedReadGates: ["read"],
726
741
  describeMessageTool: describeMattermostMessageTool,
727
742
  extractToolSend: ({ args }) => extractMattermostToolSend(args),
728
743
  extractToolSendResult: ({ result, send }) => extractMattermostToolSendResult(result, send),
@@ -836,15 +851,13 @@ const mattermostMessageActions = {
836
851
  if (action !== "send") throw new Error(`Unsupported Mattermost action: ${action}`);
837
852
  const to = typeof params.to === "string" ? params.to.trim() : typeof params.target === "string" ? params.target.trim() : "";
838
853
  if (!to) throw new Error("Mattermost send requires a target (to).");
839
- const presentation = normalizeMessagePresentation(params.presentation);
840
- const message = presentation ? renderMessagePresentationFallbackText({
841
- text: typeof params.message === "string" ? params.message : "",
842
- presentation
843
- }) : typeof params.message === "string" ? params.message : "";
854
+ const { text: message, buttons } = resolveMattermostPresentation({
855
+ text: typeof params.message === "string" ? params.message : void 0,
856
+ presentation: params.presentation
857
+ });
844
858
  const replyToId = normalizeOptionalString(params.replyToId) ?? normalizeOptionalString(params.threadId) ?? normalizeOptionalString(params.replyTo);
845
859
  const resolvedAccountId = accountId || void 0;
846
860
  const mediaUrl = resolveMattermostSendAttachmentMedia(params);
847
- const buttons = presentation ? buildMattermostPresentationButtons(presentation) : [];
848
861
  const result = await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, message, {
849
862
  cfg,
850
863
  accountId: resolvedAccountId,
@@ -877,7 +890,7 @@ const mattermostMessageActions = {
877
890
  function parseMattermostReactActionParams(params) {
878
891
  const postId = normalizeOptionalString(params.messageId) ?? normalizeOptionalString(params.postId);
879
892
  if (!postId) throw new Error("Mattermost react requires messageId (post id)");
880
- const emojiName = normalizeOptionalString(params.emoji)?.replace(/^:+|:+$/g, "");
893
+ const emojiName = normalizeMattermostEmojiName(normalizeOptionalString(params.emoji));
881
894
  if (!emojiName) throw new Error("Mattermost react requires emoji");
882
895
  return {
883
896
  postId,
@@ -885,76 +898,42 @@ function parseMattermostReactActionParams(params) {
885
898
  remove: params.remove === true
886
899
  };
887
900
  }
888
- function collectNonBlankStrings(values) {
889
- const collected = [];
890
- const seen = /* @__PURE__ */ new Set();
891
- for (const value of values) {
892
- const trimmed = value?.trim();
893
- if (trimmed && !seen.has(trimmed)) {
894
- seen.add(trimmed);
895
- collected.push(trimmed);
896
- }
897
- }
898
- return collected;
899
- }
900
- function toSnakeCaseKey(key) {
901
- return key.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
902
- }
903
- function readMattermostParam(params, key) {
904
- if (Object.hasOwn(params, key)) return params[key];
905
- const snakeKey = toSnakeCaseKey(key);
906
- return snakeKey === key || !Object.hasOwn(params, snakeKey) ? void 0 : params[snakeKey];
907
- }
908
- function readMattermostStringParam(params, key) {
909
- const raw = readMattermostParam(params, key);
910
- return typeof raw === "string" ? normalizeOptionalString(raw) : void 0;
911
- }
912
- function readMattermostStringArrayParam(params, key) {
913
- const raw = readMattermostParam(params, key);
914
- if (Array.isArray(raw)) return raw.filter((entry) => typeof entry === "string").flatMap((entry) => {
915
- const normalized = normalizeOptionalString(entry);
916
- return normalized ? [normalized] : [];
917
- });
918
- if (typeof raw === "string") {
919
- const normalized = normalizeOptionalString(raw);
920
- return normalized ? [normalized] : [];
921
- }
922
- return [];
923
- }
924
- function requiresMattermostMediaUpload(mediaUrl) {
925
- const normalized = normalizeOptionalString(mediaUrl);
926
- return Boolean(normalized && !/^https?:\/\//i.test(normalized));
927
- }
928
- function collectMattermostAttachmentMedia(params) {
929
- const mediaUrlCandidates = [
930
- readMattermostStringParam(params, "media"),
931
- readMattermostStringParam(params, "mediaUrl"),
932
- readMattermostStringParam(params, "path"),
933
- readMattermostStringParam(params, "filePath"),
934
- readMattermostStringParam(params, "fileUrl")
901
+ function resolveMattermostSendAttachmentMedia(params) {
902
+ const sourceKeys = [
903
+ "media",
904
+ "mediaUrl",
905
+ "path",
906
+ "filePath",
907
+ "fileUrl"
935
908
  ];
936
- mediaUrlCandidates.push(...readMattermostStringArrayParam(params, "mediaUrls"));
937
- let hasUnsupportedAttachmentPayload = Boolean(readMattermostStringParam(params, "buffer") ?? readMattermostStringParam(params, "base64"));
909
+ const candidates = sourceKeys.map((key) => readStringParam(params, key));
910
+ candidates.push(...readStringArrayParam(params, "mediaUrls") ?? []);
911
+ let hasUnsupportedAttachmentPayload = Boolean(readStringParam(params, "buffer") ?? readStringParam(params, "base64"));
938
912
  if (Array.isArray(params.attachments)) for (const attachment of params.attachments) {
939
913
  if (!attachment || typeof attachment !== "object" || Array.isArray(attachment)) continue;
940
914
  const record = attachment;
941
- mediaUrlCandidates.push(readMattermostStringParam(record, "media"), readMattermostStringParam(record, "mediaUrl"), readMattermostStringParam(record, "path"), readMattermostStringParam(record, "filePath"), readMattermostStringParam(record, "fileUrl"), readMattermostStringParam(record, "url"));
942
- hasUnsupportedAttachmentPayload ||= Boolean(readMattermostStringParam(record, "buffer") ?? readMattermostStringParam(record, "base64"));
915
+ candidates.push(...sourceKeys.map((key) => readStringParam(record, key)));
916
+ candidates.push(readStringParam(record, "url"));
917
+ hasUnsupportedAttachmentPayload ||= Boolean(readStringParam(record, "buffer") ?? readStringParam(record, "base64"));
943
918
  }
919
+ if (hasUnsupportedAttachmentPayload) throw new Error("Mattermost send attachments require media, mediaUrl, path, filePath, fileUrl, mediaUrls, or attachments[] with one of those fields; buffer/base64 payloads are not supported.");
920
+ const mediaUrls = [...new Set(candidates.filter((candidate) => Boolean(candidate)))];
921
+ if (mediaUrls.length > 1) throw new Error("Mattermost send supports one attachment per message; split multiple mediaUrls or attachments[] entries into separate sends.");
922
+ return mediaUrls[0];
923
+ }
924
+ function toMattermostOutboundResult(result) {
925
+ const { channelId, ...delivery } = result;
944
926
  return {
945
- mediaUrls: collectNonBlankStrings(mediaUrlCandidates),
946
- hasUnsupportedAttachmentPayload
927
+ ...delivery,
928
+ target: {
929
+ kind: "channel",
930
+ id: channelId
931
+ }
947
932
  };
948
933
  }
949
- function resolveMattermostSendAttachmentMedia(params) {
950
- const attachmentMedia = collectMattermostAttachmentMedia(params);
951
- if (attachmentMedia.hasUnsupportedAttachmentPayload) throw new Error("Mattermost send attachments require media, mediaUrl, path, filePath, fileUrl, mediaUrls, or attachments[] with one of those fields; buffer/base64 payloads are not supported.");
952
- if (attachmentMedia.mediaUrls.length > 1) throw new Error("Mattermost send supports one attachment per message; split multiple mediaUrls or attachments[] entries into separate sends.");
953
- return attachmentMedia.mediaUrls[0];
954
- }
955
934
  function createMattermostDeliveryProgressReporter(onDeliveryResult) {
956
935
  return onDeliveryResult ? async (result) => {
957
- await onDeliveryResult(attachChannelToResult("mattermost", result));
936
+ await onDeliveryResult(attachChannelToResult("mattermost", toMattermostOutboundResult(result)));
958
937
  } : void 0;
959
938
  }
960
939
  const mattermostOutbound = {
@@ -974,16 +953,15 @@ const mattermostOutbound = {
974
953
  presentationCapabilities: MATTERMOST_PRESENTATION_CAPABILITIES,
975
954
  renderPresentation: ({ payload, presentation }) => {
976
955
  if (payload.mediaUrls && payload.mediaUrls.length > 1) return null;
977
- const buttons = buildMattermostPresentationButtons(presentation);
978
- const hasButtons = buttons.some((row) => row.length > 0);
979
- if (!hasButtons && !hasMattermostPresentationNavigation(presentation)) return null;
956
+ const { text, buttons } = resolveMattermostPresentation({
957
+ text: payload.text,
958
+ presentation
959
+ });
960
+ if (!buttons.length && !hasMattermostPresentationNavigation(presentation)) return null;
980
961
  return {
981
962
  ...payload,
982
- text: renderMessagePresentationFallbackText({
983
- text: payload.text,
984
- presentation
985
- }),
986
- ...hasButtons ? { channelData: {
963
+ text,
964
+ ...buttons.length ? { channelData: {
987
965
  ...payload.channelData,
988
966
  mattermost: {
989
967
  ...payload.channelData?.mattermost,
@@ -1001,7 +979,7 @@ const mattermostOutbound = {
1001
979
  ...ctx.payload,
1002
980
  mediaUrl: ctx.payload.mediaUrl ?? ctx.mediaUrl
1003
981
  }).map((url) => url.trim()).find(Boolean);
1004
- return attachChannelToResult("mattermost", await (await loadMattermostChannelRuntime()).sendMessageMattermost(ctx.to, ctx.payload.text ?? ctx.text, {
982
+ return attachChannelToResult("mattermost", toMattermostOutboundResult(await (await loadMattermostChannelRuntime()).sendMessageMattermost(ctx.to, ctx.payload.text ?? ctx.text, {
1005
983
  cfg: ctx.cfg,
1006
984
  accountId: ctx.accountId ?? void 0,
1007
985
  mediaUrl,
@@ -1013,7 +991,7 @@ const mattermostOutbound = {
1013
991
  buttons: buttons?.length ? buttons : void 0,
1014
992
  attachmentText,
1015
993
  onDeliveryResult: createMattermostDeliveryProgressReporter(ctx.onDeliveryResult)
1016
- }));
994
+ })));
1017
995
  }
1018
996
  return await sendTextMediaPayload({
1019
997
  channel: "mattermost",
@@ -1034,13 +1012,13 @@ const mattermostOutbound = {
1034
1012
  },
1035
1013
  ...createAttachedChannelResultAdapter({
1036
1014
  channel: "mattermost",
1037
- sendText: async ({ cfg, to, text, accountId, replyToId, threadId, onDeliveryResult }) => await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, text, {
1015
+ sendText: async ({ cfg, to, text, accountId, replyToId, threadId, onDeliveryResult }) => toMattermostOutboundResult(await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, text, {
1038
1016
  cfg,
1039
1017
  accountId: accountId ?? void 0,
1040
1018
  replyToId: replyToId ?? (threadId != null ? String(threadId) : void 0),
1041
1019
  onDeliveryResult: createMattermostDeliveryProgressReporter(onDeliveryResult)
1042
- }),
1043
- sendMedia: async ({ cfg, to, text, mediaUrl, mediaAccess, mediaLocalRoots, mediaReadFile, accountId, replyToId, threadId, onDeliveryResult }) => await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, text, {
1020
+ })),
1021
+ sendMedia: async ({ cfg, to, text, mediaUrl, mediaAccess, mediaLocalRoots, mediaReadFile, accountId, replyToId, threadId, onDeliveryResult }) => toMattermostOutboundResult(await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, text, {
1044
1022
  cfg,
1045
1023
  accountId: accountId ?? void 0,
1046
1024
  mediaUrl,
@@ -1050,7 +1028,7 @@ const mattermostOutbound = {
1050
1028
  requireMediaUpload: requiresMattermostMediaUpload(mediaUrl) ? true : void 0,
1051
1029
  replyToId: replyToId ?? (threadId != null ? String(threadId) : void 0),
1052
1030
  onDeliveryResult: createMattermostDeliveryProgressReporter(onDeliveryResult)
1053
- })
1031
+ }))
1054
1032
  })
1055
1033
  };
1056
1034
  const mattermostMessageAdapter = createChannelMessageAdapterFromOutbound({
@@ -1258,4 +1236,4 @@ const mattermostPlugin = createChatChannelPlugin({
1258
1236
  outbound: mattermostOutbound
1259
1237
  });
1260
1238
  //#endregion
1261
- export { MattermostChannelConfigSchema as a, mattermostConfigAdapter as c, normalizeMattermostMessagingTarget as i, mattermostMeta as l, mattermostSetupWizard as n, describeMattermostAccount as o, mattermostSetupContract as r, isMattermostConfigured$1 as s, mattermostPlugin as t };
1239
+ export { describeMattermostAccount as a, mattermostMeta as c, MattermostChannelConfigSchema as i, mattermostSetupWizard as n, isMattermostConfigured$1 as o, mattermostSetupContract as r, mattermostConfigAdapter as s, mattermostPlugin as t };
@@ -1,2 +1,2 @@
1
- import { t as mattermostPlugin } from "./channel-plugin-runtime-Dxt8Zv1j.js";
1
+ import { t as mattermostPlugin } from "./channel-plugin-runtime-DGrYW6mT.js";
2
2
  export { mattermostPlugin };