@openclaw/mattermost 2026.8.1-beta.3 → 2026.8.2
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 +2 -1
- package/dist/{channel-plugin-runtime-C_mWt_83.js → channel-plugin-runtime-iEa9Cv5W.js} +188 -209
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-CpQzh8-1.js → channel.runtime-tEMiKAyb.js} +112 -86
- package/dist/{client-B_hd-kwM.js → client-D3Btt1WT.js} +8 -19
- package/dist/ingress-identity-DNl4yQSc.js +27 -0
- package/dist/{interactions-Du_EJMeN.js → interactions-DN1Dzzc_.js} +9 -7
- package/dist/{monitor-auth-CVd_4FPD.js → monitor-auth-DvyW7bpd.js} +10 -30
- package/dist/{accounts-DspH-NMT.js → normalize-BtFTWPoG.js} +77 -4
- 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-02qPUgGO.js} +66 -113
- 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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import { a as createMattermostPost, d as fetchMattermostUser, g as readMattermostError, l as fetchMattermostChannelPosts, m as normalizeMattermostBaseUrl, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as
|
|
3
|
-
import {
|
|
4
|
-
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { _ as
|
|
2
|
+
import { _ as sendMattermostTyping, a as createMattermostPost, d as fetchMattermostUser, g as readMattermostError, l as fetchMattermostChannelPosts, m as normalizeMattermostBaseUrl, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as updateMattermostPost } from "./client-D3Btt1WT.js";
|
|
3
|
+
import { C as resolveDefaultGroupPolicy, _ as logTypingFailure, a as resolveMattermostMonitorInboundAccess, b as resolveAllowlistProviderRuntimeGroupPolicy$1, c as buildPreparedModelsProviderData, d as createChannelPairingController, g as logInboundDrop, l as createChannelHistoryWindow, m as listSkillCommandsForAgents, n as formatMattermostDirectMessageDropLog, o as resolveMattermostTrustedChatKind, s as DEFAULT_GROUP_HISTORY_LIMIT, t as authorizeMattermostCommandInvocation, u as createChannelMessageReplyPipeline, w as warnMissingProviderGroupPolicyFallbackOnce, x as resolveChannelMediaMaxBytes, y as registerPluginHttpRoute } from "./monitor-auth-DvyW7bpd.js";
|
|
4
|
+
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-DN1Dzzc_.js";
|
|
5
|
+
import { n as normalizeMattermostAllowEntry } from "./ingress-identity-DNl4yQSc.js";
|
|
6
|
+
import { a as inspectMattermostAccount, l as resolveMattermostAccount, n as normalizeMattermostMessagingTarget, s as listMattermostAccountIds, u as resolveMattermostReplyToMode } from "./normalize-BtFTWPoG.js";
|
|
7
|
+
import { _ as registerSlashCommands, a as sendMessageMattermost, c as joinMattermostVisibleContent, d as renderMattermostModelsPickerView, f as renderMattermostProviderPickerView, g as isSlashCommandsEnabled, h as cleanupSlashCommands, l as buildMattermostAllowedModelRefs, m as DEFAULT_COMMAND_SPECS, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as resolveMattermostModelPickerCurrentModel, r as getSlashCommandState, s as deliverMattermostReplyPayload, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-02qPUgGO.js";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
|
-
import { resolveGatewayPort } from "openclaw/plugin-sdk/
|
|
10
|
-
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
9
|
+
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
10
|
+
import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
|
|
11
11
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { buildChannelInboundMediaPayload, createChannelPartialDeliveryError, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, implicitMentionKindWhen, isChannelPartialDeliveryError, resolveInboundMentionDecision, resolveInboundSessionEnvelopeContext, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
13
13
|
import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -24,7 +24,7 @@ import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsS
|
|
|
24
24
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
25
25
|
import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
26
26
|
import { resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
27
|
-
import { runChannelProbe, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
27
|
+
import { escapeRegExp, runChannelProbe, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
28
28
|
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
29
29
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
|
|
30
30
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
@@ -175,22 +175,32 @@ function resolveThreadSessionKeys$1(params) {
|
|
|
175
175
|
normalizeThreadId: (threadId) => threadId
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
+
function buildMattermostBotMentionPattern(username) {
|
|
179
|
+
return `(?<![a-z0-9_])@${escapeRegExp(username)}(?![a-z0-9_]|[.:-]+[a-z0-9_])`;
|
|
180
|
+
}
|
|
181
|
+
function matchesMattermostBotMention(text, botUsername) {
|
|
182
|
+
if (!botUsername) return false;
|
|
183
|
+
return new RegExp(buildMattermostBotMentionPattern(botUsername), "i").test(text);
|
|
184
|
+
}
|
|
178
185
|
/**
|
|
179
186
|
* Strip bot mention from message text while preserving newlines and
|
|
180
187
|
* block-level Markdown formatting (headings, lists, blockquotes).
|
|
181
188
|
*/
|
|
182
189
|
function normalizeMention(text, mention) {
|
|
183
190
|
if (!mention) return text.trim();
|
|
184
|
-
const
|
|
185
|
-
const hasMentionRe = new RegExp(
|
|
186
|
-
const leadingMentionRe = new RegExp(`^([\\t ]*)
|
|
187
|
-
const trailingMentionRe = new RegExp(`[\\t ]
|
|
191
|
+
const pattern = buildMattermostBotMentionPattern(mention);
|
|
192
|
+
const hasMentionRe = new RegExp(pattern, "i");
|
|
193
|
+
const leadingMentionRe = new RegExp(`^([\\t ]*)${pattern}[\\t ]*`, "i");
|
|
194
|
+
const trailingMentionRe = new RegExp(`[\\t ]*${pattern}[\\t ]*$`, "i");
|
|
188
195
|
const normalizedLines = text.split("\n").map((line) => {
|
|
189
|
-
|
|
190
|
-
|
|
196
|
+
if (!hasMentionRe.test(line)) return {
|
|
197
|
+
text: line,
|
|
198
|
+
mentionOnlyBlank: false
|
|
199
|
+
};
|
|
200
|
+
const normalizedLine = line.replace(leadingMentionRe, "$1").replace(trailingMentionRe, "").replace(new RegExp(pattern, "gi"), "").replace(/(\S)[ \t]{2,}/g, "$1 ");
|
|
191
201
|
return {
|
|
192
202
|
text: normalizedLine,
|
|
193
|
-
mentionOnlyBlank:
|
|
203
|
+
mentionOnlyBlank: normalizedLine.trim() === ""
|
|
194
204
|
};
|
|
195
205
|
});
|
|
196
206
|
while (normalizedLines[0]?.mentionOnlyBlank) normalizedLines.shift();
|
|
@@ -205,8 +215,9 @@ function shouldDropEmptyMattermostBody(params) {
|
|
|
205
215
|
}
|
|
206
216
|
//#endregion
|
|
207
217
|
//#region extensions/mattermost/src/mattermost/monitor-websocket.ts
|
|
208
|
-
const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES =
|
|
218
|
+
const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16777216;
|
|
209
219
|
const MATTERMOST_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
220
|
+
const MATTERMOST_WEBSOCKET_AUTH_TIMEOUT_MS = 3e4;
|
|
210
221
|
const MattermostEventPayloadSchema = z.object({
|
|
211
222
|
event: z.string().optional(),
|
|
212
223
|
status: z.string().optional(),
|
|
@@ -242,6 +253,14 @@ var WebSocketClosedBeforeOpenError = class extends Error {
|
|
|
242
253
|
this.name = "WebSocketClosedBeforeOpenError";
|
|
243
254
|
}
|
|
244
255
|
};
|
|
256
|
+
var WebSocketClosedBeforeAuthenticationError = class extends Error {
|
|
257
|
+
constructor(code, reason) {
|
|
258
|
+
super(`websocket closed before authentication completed (code ${code}) — either the bot token was rejected or the connection dropped (server restart, proxy reset); check the Mattermost bot token if this repeats`);
|
|
259
|
+
this.code = code;
|
|
260
|
+
this.reason = reason;
|
|
261
|
+
this.name = "WebSocketClosedBeforeAuthenticationError";
|
|
262
|
+
}
|
|
263
|
+
};
|
|
245
264
|
const defaultMattermostWebSocketFactory = (url, options) => {
|
|
246
265
|
const agent = createDebugProxyWebSocketAgent(resolveDebugProxySettings());
|
|
247
266
|
return new WebSocket(url, {
|
|
@@ -266,6 +285,7 @@ function createMattermostConnectOnce(opts) {
|
|
|
266
285
|
try {
|
|
267
286
|
return await new Promise((resolve, reject) => {
|
|
268
287
|
let opened = false;
|
|
288
|
+
let authenticated = false;
|
|
269
289
|
let settled = false;
|
|
270
290
|
let healthCheckEnabled = getBotUpdateAt != null;
|
|
271
291
|
let healthCheckInFlight = false;
|
|
@@ -275,11 +295,16 @@ function createMattermostConnectOnce(opts) {
|
|
|
275
295
|
let protocolPongTimer;
|
|
276
296
|
let initialUpdateAt;
|
|
277
297
|
let authenticationSeq;
|
|
298
|
+
let authTimer;
|
|
278
299
|
const clearTimers = () => {
|
|
279
300
|
if (healthCheckTimer !== void 0) {
|
|
280
301
|
clearTimeout(healthCheckTimer);
|
|
281
302
|
healthCheckTimer = void 0;
|
|
282
303
|
}
|
|
304
|
+
if (authTimer !== void 0) {
|
|
305
|
+
clearTimeout(authTimer);
|
|
306
|
+
authTimer = void 0;
|
|
307
|
+
}
|
|
283
308
|
if (protocolPingTimer !== void 0) {
|
|
284
309
|
clearTimeout(protocolPingTimer);
|
|
285
310
|
protocolPingTimer = void 0;
|
|
@@ -394,6 +419,13 @@ function createMattermostConnectOnce(opts) {
|
|
|
394
419
|
}
|
|
395
420
|
});
|
|
396
421
|
ws.send(authPayload);
|
|
422
|
+
authTimer = setTimeout(() => {
|
|
423
|
+
authTimer = void 0;
|
|
424
|
+
if (settled) return;
|
|
425
|
+
opts.runtime.error?.("mattermost websocket authentication timed out — reconnecting");
|
|
426
|
+
stopHealthChecks();
|
|
427
|
+
ws.terminate();
|
|
428
|
+
}, MATTERMOST_WEBSOCKET_AUTH_TIMEOUT_MS);
|
|
397
429
|
scheduleProtocolPing();
|
|
398
430
|
if (getBotUpdateAt) runHealthCheck();
|
|
399
431
|
});
|
|
@@ -417,6 +449,11 @@ function createMattermostConnectOnce(opts) {
|
|
|
417
449
|
const payload = parseMattermostEventPayload(raw);
|
|
418
450
|
if (!payload) return;
|
|
419
451
|
if (payload.status === "OK" && payload.seq_reply === authenticationSeq) {
|
|
452
|
+
authenticated = true;
|
|
453
|
+
if (authTimer !== void 0) {
|
|
454
|
+
clearTimeout(authTimer);
|
|
455
|
+
authTimer = void 0;
|
|
456
|
+
}
|
|
420
457
|
opts.statusSink?.(channelReadyPatch());
|
|
421
458
|
return;
|
|
422
459
|
}
|
|
@@ -458,10 +495,14 @@ function createMattermostConnectOnce(opts) {
|
|
|
458
495
|
error: message || void 0
|
|
459
496
|
}
|
|
460
497
|
});
|
|
461
|
-
if (opened) {
|
|
498
|
+
if (opened && authenticated) {
|
|
462
499
|
resolveOnce();
|
|
463
500
|
return;
|
|
464
501
|
}
|
|
502
|
+
if (opened) {
|
|
503
|
+
rejectOnce(new WebSocketClosedBeforeAuthenticationError(code, message || void 0));
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
465
506
|
rejectOnce(new WebSocketClosedBeforeOpenError(code, message || void 0));
|
|
466
507
|
});
|
|
467
508
|
ws.on("error", (err) => {
|
|
@@ -793,33 +834,26 @@ async function buildMattermostEventPlan(monitor, params) {
|
|
|
793
834
|
OriginatingChannel: "mattermost",
|
|
794
835
|
OriginatingTo: to
|
|
795
836
|
}),
|
|
796
|
-
createReplyPlan: () => {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
error
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
} },
|
|
820
|
-
replyOptions: { disableBlockStreaming: typeof monitor.account.blockStreaming === "boolean" ? !monitor.account.blockStreaming : void 0 }
|
|
821
|
-
};
|
|
822
|
-
}
|
|
837
|
+
createReplyPlan: () => ({
|
|
838
|
+
textLimit: monitor.core.channel.text.resolveTextChunkLimit(monitor.cfg, "mattermost", monitor.account.accountId, { fallbackLimit: monitor.account.textChunkLimit ?? 4e3 }),
|
|
839
|
+
tableMode: monitor.core.channel.text.resolveMarkdownTableMode({
|
|
840
|
+
cfg: monitor.cfg,
|
|
841
|
+
channel: "mattermost",
|
|
842
|
+
accountId: monitor.account.accountId
|
|
843
|
+
}),
|
|
844
|
+
replyPipeline: { typing: {
|
|
845
|
+
start: () => monitor.resources.sendTypingIndicator(params.channelId, thread.effectiveReplyToId),
|
|
846
|
+
onStartError: (error) => {
|
|
847
|
+
logTypingFailure({
|
|
848
|
+
log: monitor.logDebugMessage,
|
|
849
|
+
channel: "mattermost",
|
|
850
|
+
target: params.channelId,
|
|
851
|
+
error
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
} },
|
|
855
|
+
replyOptions: { disableBlockStreaming: typeof monitor.account.blockStreaming === "boolean" ? !monitor.account.blockStreaming : void 0 }
|
|
856
|
+
})
|
|
823
857
|
};
|
|
824
858
|
}
|
|
825
859
|
//#endregion
|
|
@@ -894,7 +928,7 @@ function registerMattermostInteractions(params) {
|
|
|
894
928
|
dropLabel: "interaction dispatch"
|
|
895
929
|
});
|
|
896
930
|
if (!eventPlan) return;
|
|
897
|
-
const { channelDisplay, kind, route, thread, to } = eventPlan;
|
|
931
|
+
const { channelDisplay, channelId, kind, route, thread, to } = eventPlan;
|
|
898
932
|
const bodyText = `[Button click: user @${button.userName} selected "${button.actionName}"]`;
|
|
899
933
|
const ctxPayload = eventPlan.finalizeContext({
|
|
900
934
|
Body: bodyText,
|
|
@@ -908,7 +942,7 @@ function registerMattermostInteractions(params) {
|
|
|
908
942
|
WasMentioned: true,
|
|
909
943
|
CommandAuthorized: false
|
|
910
944
|
});
|
|
911
|
-
const {
|
|
945
|
+
const { replyOptions, replyPipeline, tableMode, textLimit } = eventPlan.createReplyPlan();
|
|
912
946
|
await core.channel.inbound.dispatch({
|
|
913
947
|
cfg,
|
|
914
948
|
channel: "mattermost",
|
|
@@ -926,7 +960,7 @@ function registerMattermostInteractions(params) {
|
|
|
926
960
|
core,
|
|
927
961
|
cfg,
|
|
928
962
|
payload,
|
|
929
|
-
|
|
963
|
+
channelId,
|
|
930
964
|
accountId: account.accountId,
|
|
931
965
|
agentId: route.agentId,
|
|
932
966
|
replyToId: resolveMattermostInteractionReplyRootId({
|
|
@@ -938,8 +972,7 @@ function registerMattermostInteractions(params) {
|
|
|
938
972
|
}),
|
|
939
973
|
textLimit,
|
|
940
974
|
tableMode,
|
|
941
|
-
sendMessage: sendMessageMattermost
|
|
942
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
975
|
+
sendMessage: sendMessageMattermost
|
|
943
976
|
});
|
|
944
977
|
if (result.visibleReplySent) runtime.log?.(`delivered button-click reply to ${to}`);
|
|
945
978
|
return result;
|
|
@@ -949,11 +982,7 @@ function registerMattermostInteractions(params) {
|
|
|
949
982
|
}
|
|
950
983
|
},
|
|
951
984
|
replyPipeline,
|
|
952
|
-
dispatcherOptions: {
|
|
953
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
954
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled,
|
|
955
|
-
humanDelay: resolveHumanDelayConfig(cfg, route.agentId)
|
|
956
|
-
},
|
|
985
|
+
dispatcherOptions: { humanDelay: resolveHumanDelayConfig(cfg, route.agentId) },
|
|
957
986
|
replyOptions
|
|
958
987
|
});
|
|
959
988
|
},
|
|
@@ -963,7 +992,6 @@ function registerMattermostInteractions(params) {
|
|
|
963
992
|
source: "mattermost-interactions",
|
|
964
993
|
accountId: account.accountId,
|
|
965
994
|
log: (message) => runtime.log?.(message),
|
|
966
|
-
replaceExisting: true,
|
|
967
995
|
throwOnFailure: true
|
|
968
996
|
});
|
|
969
997
|
}
|
|
@@ -973,7 +1001,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
973
1001
|
const { account, cfg, core, pairing, resources, runtime } = monitor;
|
|
974
1002
|
const { resolveChannelInfo, updateModelPickerPost } = resources;
|
|
975
1003
|
const runModelPickerCommand = async (params) => {
|
|
976
|
-
const { channelDisplay, kind, roomLabel, route, thread
|
|
1004
|
+
const { channelDisplay, channelId, kind, roomLabel, route, thread } = params.eventPlan;
|
|
977
1005
|
const fromLabel = kind === "direct" ? `Mattermost DM from ${params.senderName}` : `Mattermost message in ${roomLabel} from ${params.senderName}`;
|
|
978
1006
|
const ctxPayload = params.eventPlan.finalizeContext({
|
|
979
1007
|
Body: params.commandText,
|
|
@@ -989,7 +1017,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
989
1017
|
CommandAuthorized: params.commandAuthorized,
|
|
990
1018
|
CommandSource: "native"
|
|
991
1019
|
});
|
|
992
|
-
const {
|
|
1020
|
+
const { replyOptions, replyPipeline, tableMode, textLimit } = params.eventPlan.createReplyPlan();
|
|
993
1021
|
await core.channel.inbound.dispatch({
|
|
994
1022
|
cfg,
|
|
995
1023
|
channel: "mattermost",
|
|
@@ -1011,7 +1039,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1011
1039
|
core,
|
|
1012
1040
|
cfg,
|
|
1013
1041
|
payload: trimmedPayload,
|
|
1014
|
-
|
|
1042
|
+
channelId,
|
|
1015
1043
|
accountId: account.accountId,
|
|
1016
1044
|
agentId: route.agentId,
|
|
1017
1045
|
replyToId: resolveMattermostInteractionReplyRootId({
|
|
@@ -1023,8 +1051,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1023
1051
|
}),
|
|
1024
1052
|
textLimit,
|
|
1025
1053
|
tableMode: "off",
|
|
1026
|
-
sendMessage: sendMessageMattermost
|
|
1027
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
1054
|
+
sendMessage: sendMessageMattermost
|
|
1028
1055
|
});
|
|
1029
1056
|
},
|
|
1030
1057
|
onError: (err, info) => {
|
|
@@ -1032,10 +1059,6 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1032
1059
|
}
|
|
1033
1060
|
},
|
|
1034
1061
|
replyPipeline,
|
|
1035
|
-
dispatcherOptions: {
|
|
1036
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
1037
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled
|
|
1038
|
-
},
|
|
1039
1062
|
replyOptions
|
|
1040
1063
|
});
|
|
1041
1064
|
};
|
|
@@ -1097,7 +1120,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1097
1120
|
agentId: eventPlan.route.agentId,
|
|
1098
1121
|
sessionKey: eventPlan.thread.sessionKey
|
|
1099
1122
|
};
|
|
1100
|
-
const data = await
|
|
1123
|
+
const data = await buildPreparedModelsProviderData(cfg, eventPlan.route.agentId);
|
|
1101
1124
|
if (data.providers.length === 0) return await updatePickerPost("No models available.");
|
|
1102
1125
|
if (pickerState.action === "providers" || pickerState.action === "back") {
|
|
1103
1126
|
const currentModel = resolveMattermostModelPickerCurrentModel({
|
|
@@ -1224,13 +1247,15 @@ function formatMattermostInboundMediaText(params) {
|
|
|
1224
1247
|
const materializedCount = params.materializedMedia.filter((media) => Boolean(media.path) || Boolean(media.url)).length;
|
|
1225
1248
|
const unavailableCount = Math.max(0, params.nativeMedia.length - materializedCount);
|
|
1226
1249
|
if (unavailableCount === 0) return params.body;
|
|
1250
|
+
const unavailableFileNames = params.materializedMedia.filter((media) => !media.path && !media.url && media.fileName).map((media) => sanitizeUntrustedFileName(media.fileName ?? "", "")).filter(Boolean).join(", ");
|
|
1251
|
+
const fileNameNotice = unavailableFileNames ? ` ${JSON.stringify(truncateUtf16Safe(unavailableFileNames, 512))}` : "";
|
|
1227
1252
|
return formatInboundMediaUnavailableText({
|
|
1228
1253
|
body: params.body,
|
|
1229
|
-
notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]`
|
|
1254
|
+
notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]${fileNameNotice}`
|
|
1230
1255
|
});
|
|
1231
1256
|
}
|
|
1232
|
-
const CHANNEL_CACHE_TTL_MS =
|
|
1233
|
-
const USER_CACHE_TTL_MS =
|
|
1257
|
+
const CHANNEL_CACHE_TTL_MS = 3e5;
|
|
1258
|
+
const USER_CACHE_TTL_MS = 6e5;
|
|
1234
1259
|
const MONITOR_RESOURCE_CACHE_MAX_ENTRIES = 1e3;
|
|
1235
1260
|
const MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS = 12e4;
|
|
1236
1261
|
const MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS = 3e4;
|
|
@@ -1282,18 +1307,22 @@ function createMattermostMonitorResources(params) {
|
|
|
1282
1307
|
out.push({
|
|
1283
1308
|
path: saved.path,
|
|
1284
1309
|
contentType,
|
|
1310
|
+
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
1285
1311
|
kind: mediaKindFromMime(contentType) ?? "unknown"
|
|
1286
1312
|
});
|
|
1287
1313
|
} catch (err) {
|
|
1288
1314
|
logger.debug?.(`mattermost: failed to download file ${fileId}: ${String(err)}`);
|
|
1289
|
-
let
|
|
1315
|
+
let info;
|
|
1290
1316
|
try {
|
|
1291
|
-
|
|
1317
|
+
info = await client.request(`/files/${fileId}/info`);
|
|
1292
1318
|
} catch (infoErr) {
|
|
1293
1319
|
logger.debug?.(`mattermost: failed to resolve metadata for file ${fileId}: ${String(infoErr)}`);
|
|
1294
1320
|
}
|
|
1321
|
+
const contentType = info?.mime_type?.trim() || void 0;
|
|
1322
|
+
const fileName = info?.name?.trim();
|
|
1295
1323
|
out.push({
|
|
1296
1324
|
contentType,
|
|
1325
|
+
...fileName ? { fileName } : {},
|
|
1297
1326
|
kind: mediaKindFromMime(contentType) ?? "unknown"
|
|
1298
1327
|
});
|
|
1299
1328
|
}
|
|
@@ -1719,9 +1748,9 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1719
1748
|
confirmedPreviewDelivery = previewFinalResolution?.confirmedDelivery;
|
|
1720
1749
|
previewFinalDeliveryText = previewFinalResolution?.deliveryText;
|
|
1721
1750
|
previewFinalTextAlreadyDelivered = previewFinalResolution?.alreadyDelivered === true && payload.isError !== true;
|
|
1722
|
-
useConfirmedPreviewAsWholeFinal = previewFinalTextAlreadyDelivered && !resolveSendableOutboundReplyParts(payload).hasMedia;
|
|
1751
|
+
useConfirmedPreviewAsWholeFinal = previewFinalTextAlreadyDelivered && !resolveSendableOutboundReplyParts(payload).hasMedia && !payload.presentation;
|
|
1723
1752
|
const previewFinalText = previewFinalResolution?.editText;
|
|
1724
|
-
if (hasMedia && !ttsSupplement || typeof previewFinalText !== "string" || payload.isError || !canFinalizeMattermostPreviewInPlace({
|
|
1753
|
+
if (hasMedia && !ttsSupplement || typeof previewFinalText !== "string" || payload.isError || payload.presentation || !canFinalizeMattermostPreviewInPlace({
|
|
1725
1754
|
kind: params.kind,
|
|
1726
1755
|
previewRootId: params.effectiveReplyToId,
|
|
1727
1756
|
threadRootId: params.effectiveReplyToId,
|
|
@@ -1816,7 +1845,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1816
1845
|
//#region extensions/mattermost/src/mattermost/thread-participation.ts
|
|
1817
1846
|
const threadParticipation = createPersistentDedupeCache({
|
|
1818
1847
|
globalKey: Symbol.for("openclaw.mattermostThreadParticipation"),
|
|
1819
|
-
ttlMs:
|
|
1848
|
+
ttlMs: 6048e5,
|
|
1820
1849
|
maxSize: 5e3,
|
|
1821
1850
|
persistent: {
|
|
1822
1851
|
namespace: "mattermost.thread-participation",
|
|
@@ -1867,7 +1896,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1867
1896
|
const { channelHistories, ctxPayload, eventPlan, historyKey, historyLimit, pinnedMainDmOwner, post, rawText, turnAdoptionLifecycle } = params;
|
|
1868
1897
|
const { channelId, kind, route, senderId, thread, to } = eventPlan;
|
|
1869
1898
|
const { effectiveReplyToId } = thread;
|
|
1870
|
-
const {
|
|
1899
|
+
const { replyOptions, replyPipeline: baseReplyPipeline, tableMode, textLimit } = eventPlan.createReplyPlan();
|
|
1871
1900
|
const chunkMode = core.channel.text.resolveChunkMode(cfg, "mattermost", account.accountId);
|
|
1872
1901
|
const { onModelSelected, typingCallbacks, resolveResponsePrefix, ...dispatcherPipeline } = createChannelMessageReplyPipeline({
|
|
1873
1902
|
cfg,
|
|
@@ -1989,8 +2018,6 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1989
2018
|
};
|
|
1990
2019
|
const dispatcherOptions = {
|
|
1991
2020
|
...dispatcherPipeline,
|
|
1992
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
1993
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled,
|
|
1994
2021
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
1995
2022
|
typingCallbacks
|
|
1996
2023
|
};
|
|
@@ -2030,7 +2057,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2030
2057
|
core,
|
|
2031
2058
|
cfg,
|
|
2032
2059
|
payload: resolvedPayload,
|
|
2033
|
-
|
|
2060
|
+
channelId,
|
|
2034
2061
|
accountId: account.accountId,
|
|
2035
2062
|
agentId: route.agentId,
|
|
2036
2063
|
replyToId: resolveMattermostReplyRootId({
|
|
@@ -2040,8 +2067,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2040
2067
|
}),
|
|
2041
2068
|
textLimit,
|
|
2042
2069
|
tableMode,
|
|
2043
|
-
sendMessage: sendMessageMattermost
|
|
2044
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
2070
|
+
sendMessage: sendMessageMattermost
|
|
2045
2071
|
}).catch((error) => {
|
|
2046
2072
|
if (isChannelPartialDeliveryError(error)) markThreadParticipation();
|
|
2047
2073
|
throw error;
|
|
@@ -2214,7 +2240,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2214
2240
|
const { account, botUserId, botUsername, cfg, core, groupPolicy, pairing, resources } = monitor;
|
|
2215
2241
|
const { resolveMattermostMedia, resolveUserInfo } = resources;
|
|
2216
2242
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
2217
|
-
const historyLimit = Math.max(0, cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
2243
|
+
const historyLimit = Math.max(0, account.config.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
2218
2244
|
return async (post, payload, turnAdoptionLifecycle, messageIds) => {
|
|
2219
2245
|
const channelId = post.channel_id ?? payload.data?.channel_id ?? payload.broadcast?.channel_id;
|
|
2220
2246
|
if (!channelId) {
|
|
@@ -2313,7 +2339,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2313
2339
|
});
|
|
2314
2340
|
monitor.logVerboseMessage(`mattermost: pairing request sender=${senderId} created=${created}`);
|
|
2315
2341
|
if (created) try {
|
|
2316
|
-
await sendMessageMattermost(`
|
|
2342
|
+
await sendMessageMattermost(`channel:${channelId}`, core.channel.pairing.buildPairingReply({
|
|
2317
2343
|
channel: "mattermost",
|
|
2318
2344
|
idLine: `Your Mattermost user id: ${senderId}`,
|
|
2319
2345
|
code
|
|
@@ -2368,7 +2394,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2368
2394
|
return;
|
|
2369
2395
|
}
|
|
2370
2396
|
const mentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, route.agentId);
|
|
2371
|
-
const wasMentioned = kind !== "direct" && ((
|
|
2397
|
+
const wasMentioned = kind !== "direct" && (matchesMattermostBotMention(rawText, botUsername) || core.channel.mentions.matchesMentionPatterns(rawText, mentionRegexes));
|
|
2372
2398
|
const oncharEnabled = account.chatmode === "onchar" && kind !== "direct";
|
|
2373
2399
|
const oncharPrefixes = oncharEnabled ? resolveOncharPrefixes(account.oncharPrefixes) : [];
|
|
2374
2400
|
const oncharResult = oncharEnabled ? stripOncharPrefix(rawText, oncharPrefixes) : {
|
|
@@ -2842,9 +2868,9 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2842
2868
|
};
|
|
2843
2869
|
const mediaMaxBytes = resolveChannelMediaMaxBytes({
|
|
2844
2870
|
cfg,
|
|
2845
|
-
resolveChannelLimitMb: () =>
|
|
2871
|
+
resolveChannelLimitMb: () => account.config.mediaMaxMb,
|
|
2846
2872
|
accountId: account.accountId
|
|
2847
|
-
}) ??
|
|
2873
|
+
}) ?? 8388608;
|
|
2848
2874
|
const { groupPolicy, providerMissingFallbackApplied } = resolveAllowlistProviderRuntimeGroupPolicy$1({
|
|
2849
2875
|
providerConfigPresent: cfg.channels?.mattermost !== void 0,
|
|
2850
2876
|
groupPolicy: account.config.groupPolicy,
|
|
@@ -3059,7 +3085,7 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
|
|
|
3059
3085
|
}
|
|
3060
3086
|
//#endregion
|
|
3061
3087
|
//#region extensions/mattermost/src/mattermost/reactions.ts
|
|
3062
|
-
const BOT_USER_CACHE_TTL_MS =
|
|
3088
|
+
const BOT_USER_CACHE_TTL_MS = 6e5;
|
|
3063
3089
|
const botUserIdCache = /* @__PURE__ */ new Map();
|
|
3064
3090
|
async function resolveBotUserId(client, cacheKey) {
|
|
3065
3091
|
const rawNow = Date.now();
|
|
@@ -10,9 +10,9 @@ import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
|
10
10
|
import { fetchWithSsrFGuard, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
//#region extensions/mattermost/src/mattermost/client.ts
|
|
13
|
-
const MATTERMOST_ERROR_BODY_LIMIT_BYTES =
|
|
13
|
+
const MATTERMOST_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
14
14
|
const MATTERMOST_REQUEST_TIMEOUT_MS = 3e4;
|
|
15
|
-
const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES =
|
|
15
|
+
const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES = 65536;
|
|
16
16
|
const MattermostPostSchema = z.object({
|
|
17
17
|
id: z.string(),
|
|
18
18
|
user_id: z.string().nullable().optional(),
|
|
@@ -98,18 +98,20 @@ function createMattermostClient(params) {
|
|
|
98
98
|
const fetchImpl = (externalFetchImpl ? async (input, init) => {
|
|
99
99
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
100
100
|
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
101
|
+
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
101
102
|
const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
|
|
102
|
-
timeoutMs
|
|
103
|
+
timeoutMs,
|
|
103
104
|
operation: "mattermost-api",
|
|
104
105
|
url
|
|
105
106
|
});
|
|
106
107
|
const callerSignal = requestInit.signal ?? void 0;
|
|
107
108
|
const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
|
|
108
109
|
try {
|
|
109
|
-
|
|
110
|
+
const response = await externalFetchImpl(input, {
|
|
110
111
|
...requestInit,
|
|
111
112
|
signal
|
|
112
|
-
})
|
|
113
|
+
});
|
|
114
|
+
return responseWithRelease(response, async () => cleanup());
|
|
113
115
|
} catch (error) {
|
|
114
116
|
cleanup();
|
|
115
117
|
throw error;
|
|
@@ -197,19 +199,6 @@ async function createMattermostDirectChannel(client, userIds, signal, timeoutMs)
|
|
|
197
199
|
timeoutMs
|
|
198
200
|
});
|
|
199
201
|
}
|
|
200
|
-
const DM_REPLY_DELIVERY_BARRIER_SLACK_MS = 6e4;
|
|
201
|
-
/** Covers DM creation retries without extending channel-delivery stalls. */
|
|
202
|
-
function resolveMattermostReplyDeliveryBarrierTimeoutMs(params) {
|
|
203
|
-
if (!params.isDirect) return;
|
|
204
|
-
const deliveryCount = Object.values(params.queuedCounts).reduce((sum, count) => sum + count, 0);
|
|
205
|
-
if (deliveryCount === 0) return;
|
|
206
|
-
const maxRetries = params.dmRetryOptions?.maxRetries ?? 3;
|
|
207
|
-
const maxDelayMs = params.dmRetryOptions?.maxDelayMs ?? 1e4;
|
|
208
|
-
const timeoutMs = params.dmRetryOptions?.timeoutMs ?? 3e4;
|
|
209
|
-
const perDeliveryTimeoutMs = (maxRetries + 1) * timeoutMs + maxRetries * maxDelayMs + DM_REPLY_DELIVERY_BARRIER_SLACK_MS;
|
|
210
|
-
const totalTimeoutMs = perDeliveryTimeoutMs * deliveryCount + Math.max(0, params.humanDelayBudgetMs ?? 0);
|
|
211
|
-
return resolveTimerTimeoutMs(Number.isFinite(totalTimeoutMs) ? totalTimeoutMs : Number.MAX_SAFE_INTEGER, perDeliveryTimeoutMs);
|
|
212
|
-
}
|
|
213
202
|
const RETRYABLE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
214
203
|
"ECONNRESET",
|
|
215
204
|
"ECONNREFUSED",
|
|
@@ -382,4 +371,4 @@ async function uploadMattermostFile(client, params) {
|
|
|
382
371
|
return info;
|
|
383
372
|
}
|
|
384
373
|
//#endregion
|
|
385
|
-
export {
|
|
374
|
+
export { sendMattermostTyping as _, createMattermostPost as a, fetchMattermostChannelByName as c, fetchMattermostUser as d, fetchMattermostUserByUsername as f, readMattermostError as g, parseMattermostApiStatus as h, createMattermostDirectChannelWithRetry as i, fetchMattermostChannelPosts as l, normalizeMattermostBaseUrl as m, buildMattermostApiUrl as n, deleteMattermostPost as o, fetchMattermostUserTeams as p, createMattermostClient as r, fetchMattermostChannel as s, MattermostPostSchema as t, fetchMattermostMe as u, updateMattermostPost as v, uploadMattermostFile as y };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { parseAccessGroupAllowFromEntry } from "openclaw/plugin-sdk/access-groups";
|
|
3
|
+
const mattermostIngressIdentity = {
|
|
4
|
+
key: "sender-id",
|
|
5
|
+
authentication: "verified",
|
|
6
|
+
normalize: normalizeMattermostAllowEntry,
|
|
7
|
+
aliases: [{
|
|
8
|
+
key: "sender-name",
|
|
9
|
+
kind: "plugin:mattermost-user-name",
|
|
10
|
+
normalizeEntry: normalizeMattermostAllowEntry,
|
|
11
|
+
normalizeSubject: normalizeMattermostAllowEntry,
|
|
12
|
+
authentication: "mutable"
|
|
13
|
+
}],
|
|
14
|
+
isWildcardEntry: (entry) => normalizeMattermostAllowEntry(entry) === "*",
|
|
15
|
+
resolveEntryId: ({ entryIndex, fieldKey }) => `mattermost-entry-${entryIndex + 1}:${fieldKey === "sender-name" ? "name" : "user"}`
|
|
16
|
+
};
|
|
17
|
+
function normalizeMattermostAllowEntry(entry) {
|
|
18
|
+
const trimmed = entry.trim();
|
|
19
|
+
if (!trimmed) return "";
|
|
20
|
+
if (trimmed === "*") return "*";
|
|
21
|
+
const accessGroupName = parseAccessGroupAllowFromEntry(trimmed);
|
|
22
|
+
if (accessGroupName) return `accessGroup:${accessGroupName}`;
|
|
23
|
+
const normalized = trimmed.replace(/^(mattermost|user):/i, "").replace(/^@/, "").trim();
|
|
24
|
+
return normalized ? normalizeLowercaseStringOrEmpty(normalized) : "";
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { normalizeMattermostAllowEntry as n, mattermostIngressIdentity as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { v as updateMattermostPost } from "./client-D3Btt1WT.js";
|
|
3
|
+
import { S as resolveClientIp, p as isTrustedProxyAddress, v as readRequestBodyWithLimit } from "./monitor-auth-DvyW7bpd.js";
|
|
4
4
|
import { createHmac } from "node:crypto";
|
|
5
|
-
import { resolveGatewayPort } from "openclaw/plugin-sdk/
|
|
5
|
+
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
6
6
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
7
7
|
import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
//#region extensions/mattermost/src/mattermost/interactions.ts
|
|
9
|
-
const INTERACTION_MAX_BODY_BYTES =
|
|
9
|
+
const INTERACTION_MAX_BODY_BYTES = 65536;
|
|
10
10
|
const INTERACTION_BODY_TIMEOUT_MS = 1e4;
|
|
11
11
|
const SIGNED_CHANNEL_ID_CONTEXT_KEY = "__openclaw_channel_id";
|
|
12
12
|
const callbackUrls = /* @__PURE__ */ new Map();
|
|
@@ -32,13 +32,14 @@ function headerValue(value) {
|
|
|
32
32
|
function isAllowedInteractionSource(params) {
|
|
33
33
|
const { allowedSourceIps } = params;
|
|
34
34
|
if (!allowedSourceIps?.length) return true;
|
|
35
|
-
|
|
35
|
+
const clientIp = resolveClientIp({
|
|
36
36
|
remoteAddr: params.req.socket?.remoteAddress,
|
|
37
37
|
forwardedFor: headerValue(params.req.headers["x-forwarded-for"]),
|
|
38
38
|
realIp: headerValue(params.req.headers["x-real-ip"]),
|
|
39
39
|
trustedProxies: params.trustedProxies,
|
|
40
40
|
allowRealIpFallback: params.allowRealIpFallback
|
|
41
|
-
})
|
|
41
|
+
});
|
|
42
|
+
return isTrustedProxyAddress(clientIp, allowedSourceIps);
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* Resolve the interaction callback URL for an account.
|
|
@@ -99,7 +100,8 @@ function generateInteractionToken(context, accountId) {
|
|
|
99
100
|
return createHmac("sha256", secret).update(payload).digest("hex");
|
|
100
101
|
}
|
|
101
102
|
function verifyInteractionToken(context, token, accountId) {
|
|
102
|
-
|
|
103
|
+
const expected = generateInteractionToken(context, accountId);
|
|
104
|
+
return safeEqualSecret(expected, token);
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* Build Mattermost `props.attachments` with interactive buttons.
|