@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.
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-plugin-runtime-C_mWt_83.js → channel-plugin-runtime-DGrYW6mT.js} +97 -131
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-CpQzh8-1.js → channel.runtime-W-EkJlMp.js} +106 -80
- package/dist/{client-B_hd-kwM.js → client-DAIry9-2.js} +1 -14
- package/dist/ingress-identity-DNl4yQSc.js +27 -0
- package/dist/{interactions-Du_EJMeN.js → interactions-LnudXdqD.js} +3 -3
- package/dist/{monitor-auth-CVd_4FPD.js → monitor-auth-CACk1Hos.js} +6 -28
- package/dist/{accounts-DspH-NMT.js → normalize-DoleH0bY.js} +68 -3
- package/dist/policy-api.js +1 -1
- package/dist/runtime-api.js +5 -4
- package/dist/slash-route-api.js +1 -1
- package/dist/{slash-state-BakgoSSL.js → slash-state-CPIuJQj2.js} +45 -99
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +34 -0
- package/package.json +5 -5
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as isMattermostSenderAllowed } from "./monitor-auth-
|
|
2
|
-
import { t as buildButtonAttachments } from "./interactions-
|
|
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
|
|
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-
|
|
2
|
-
import {
|
|
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 {
|
|
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 {
|
|
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/
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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-
|
|
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,
|
|
@@ -606,6 +618,7 @@ const mattermostSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
|
606
618
|
groupAllowFromPath: "channels.mattermost.groupAllowFrom",
|
|
607
619
|
findingTitle: "Mattermost security warning",
|
|
608
620
|
policyPathSuffix: "dmPolicy",
|
|
621
|
+
classifyEntryAuthentication: identityEntryAuthenticationClassifier(mattermostIngressIdentity),
|
|
609
622
|
normalizeDmEntry: (raw) => normalizeMattermostAllowEntry(raw)
|
|
610
623
|
});
|
|
611
624
|
function describeMattermostMessageTool({ cfg, accountId }) {
|
|
@@ -838,15 +851,13 @@ const mattermostMessageActions = {
|
|
|
838
851
|
if (action !== "send") throw new Error(`Unsupported Mattermost action: ${action}`);
|
|
839
852
|
const to = typeof params.to === "string" ? params.to.trim() : typeof params.target === "string" ? params.target.trim() : "";
|
|
840
853
|
if (!to) throw new Error("Mattermost send requires a target (to).");
|
|
841
|
-
const
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}) : 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
|
+
});
|
|
846
858
|
const replyToId = normalizeOptionalString(params.replyToId) ?? normalizeOptionalString(params.threadId) ?? normalizeOptionalString(params.replyTo);
|
|
847
859
|
const resolvedAccountId = accountId || void 0;
|
|
848
860
|
const mediaUrl = resolveMattermostSendAttachmentMedia(params);
|
|
849
|
-
const buttons = presentation ? buildMattermostPresentationButtons(presentation) : [];
|
|
850
861
|
const result = await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, message, {
|
|
851
862
|
cfg,
|
|
852
863
|
accountId: resolvedAccountId,
|
|
@@ -879,7 +890,7 @@ const mattermostMessageActions = {
|
|
|
879
890
|
function parseMattermostReactActionParams(params) {
|
|
880
891
|
const postId = normalizeOptionalString(params.messageId) ?? normalizeOptionalString(params.postId);
|
|
881
892
|
if (!postId) throw new Error("Mattermost react requires messageId (post id)");
|
|
882
|
-
const emojiName = normalizeOptionalString(params.emoji)
|
|
893
|
+
const emojiName = normalizeMattermostEmojiName(normalizeOptionalString(params.emoji));
|
|
883
894
|
if (!emojiName) throw new Error("Mattermost react requires emoji");
|
|
884
895
|
return {
|
|
885
896
|
postId,
|
|
@@ -887,72 +898,28 @@ function parseMattermostReactActionParams(params) {
|
|
|
887
898
|
remove: params.remove === true
|
|
888
899
|
};
|
|
889
900
|
}
|
|
890
|
-
function
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
collected.push(trimmed);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
return collected;
|
|
901
|
-
}
|
|
902
|
-
function toSnakeCaseKey(key) {
|
|
903
|
-
return key.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
|
|
904
|
-
}
|
|
905
|
-
function readMattermostParam(params, key) {
|
|
906
|
-
if (Object.hasOwn(params, key)) return params[key];
|
|
907
|
-
const snakeKey = toSnakeCaseKey(key);
|
|
908
|
-
return snakeKey === key || !Object.hasOwn(params, snakeKey) ? void 0 : params[snakeKey];
|
|
909
|
-
}
|
|
910
|
-
function readMattermostStringParam(params, key) {
|
|
911
|
-
const raw = readMattermostParam(params, key);
|
|
912
|
-
return typeof raw === "string" ? normalizeOptionalString(raw) : void 0;
|
|
913
|
-
}
|
|
914
|
-
function readMattermostStringArrayParam(params, key) {
|
|
915
|
-
const raw = readMattermostParam(params, key);
|
|
916
|
-
if (Array.isArray(raw)) return raw.filter((entry) => typeof entry === "string").flatMap((entry) => {
|
|
917
|
-
const normalized = normalizeOptionalString(entry);
|
|
918
|
-
return normalized ? [normalized] : [];
|
|
919
|
-
});
|
|
920
|
-
if (typeof raw === "string") {
|
|
921
|
-
const normalized = normalizeOptionalString(raw);
|
|
922
|
-
return normalized ? [normalized] : [];
|
|
923
|
-
}
|
|
924
|
-
return [];
|
|
925
|
-
}
|
|
926
|
-
function requiresMattermostMediaUpload(mediaUrl) {
|
|
927
|
-
const normalized = normalizeOptionalString(mediaUrl);
|
|
928
|
-
return Boolean(normalized && !/^https?:\/\//i.test(normalized));
|
|
929
|
-
}
|
|
930
|
-
function collectMattermostAttachmentMedia(params) {
|
|
931
|
-
const mediaUrlCandidates = [
|
|
932
|
-
readMattermostStringParam(params, "media"),
|
|
933
|
-
readMattermostStringParam(params, "mediaUrl"),
|
|
934
|
-
readMattermostStringParam(params, "path"),
|
|
935
|
-
readMattermostStringParam(params, "filePath"),
|
|
936
|
-
readMattermostStringParam(params, "fileUrl")
|
|
901
|
+
function resolveMattermostSendAttachmentMedia(params) {
|
|
902
|
+
const sourceKeys = [
|
|
903
|
+
"media",
|
|
904
|
+
"mediaUrl",
|
|
905
|
+
"path",
|
|
906
|
+
"filePath",
|
|
907
|
+
"fileUrl"
|
|
937
908
|
];
|
|
938
|
-
|
|
939
|
-
|
|
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"));
|
|
940
912
|
if (Array.isArray(params.attachments)) for (const attachment of params.attachments) {
|
|
941
913
|
if (!attachment || typeof attachment !== "object" || Array.isArray(attachment)) continue;
|
|
942
914
|
const record = attachment;
|
|
943
|
-
|
|
944
|
-
|
|
915
|
+
candidates.push(...sourceKeys.map((key) => readStringParam(record, key)));
|
|
916
|
+
candidates.push(readStringParam(record, "url"));
|
|
917
|
+
hasUnsupportedAttachmentPayload ||= Boolean(readStringParam(record, "buffer") ?? readStringParam(record, "base64"));
|
|
945
918
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}
|
|
951
|
-
function resolveMattermostSendAttachmentMedia(params) {
|
|
952
|
-
const attachmentMedia = collectMattermostAttachmentMedia(params);
|
|
953
|
-
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.");
|
|
954
|
-
if (attachmentMedia.mediaUrls.length > 1) throw new Error("Mattermost send supports one attachment per message; split multiple mediaUrls or attachments[] entries into separate sends.");
|
|
955
|
-
return attachmentMedia.mediaUrls[0];
|
|
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];
|
|
956
923
|
}
|
|
957
924
|
function toMattermostOutboundResult(result) {
|
|
958
925
|
const { channelId, ...delivery } = result;
|
|
@@ -986,16 +953,15 @@ const mattermostOutbound = {
|
|
|
986
953
|
presentationCapabilities: MATTERMOST_PRESENTATION_CAPABILITIES,
|
|
987
954
|
renderPresentation: ({ payload, presentation }) => {
|
|
988
955
|
if (payload.mediaUrls && payload.mediaUrls.length > 1) return null;
|
|
989
|
-
const buttons =
|
|
990
|
-
|
|
991
|
-
|
|
956
|
+
const { text, buttons } = resolveMattermostPresentation({
|
|
957
|
+
text: payload.text,
|
|
958
|
+
presentation
|
|
959
|
+
});
|
|
960
|
+
if (!buttons.length && !hasMattermostPresentationNavigation(presentation)) return null;
|
|
992
961
|
return {
|
|
993
962
|
...payload,
|
|
994
|
-
text
|
|
995
|
-
|
|
996
|
-
presentation
|
|
997
|
-
}),
|
|
998
|
-
...hasButtons ? { channelData: {
|
|
963
|
+
text,
|
|
964
|
+
...buttons.length ? { channelData: {
|
|
999
965
|
...payload.channelData,
|
|
1000
966
|
mattermost: {
|
|
1001
967
|
...payload.channelData?.mattermost,
|
|
@@ -1270,4 +1236,4 @@ const mattermostPlugin = createChatChannelPlugin({
|
|
|
1270
1236
|
outbound: mattermostOutbound
|
|
1271
1237
|
});
|
|
1272
1238
|
//#endregion
|
|
1273
|
-
export {
|
|
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-
|
|
1
|
+
import { t as mattermostPlugin } from "./channel-plugin-runtime-DGrYW6mT.js";
|
|
2
2
|
export { mattermostPlugin };
|