@openclaw/mattermost 2026.9.1-beta.1 → 2026.9.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 +3 -1
- package/dist/{channel-plugin-runtime-Bh8hcegp.js → channel-plugin-runtime-Bq86sS1N.js} +107 -141
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-DLTjcasQ.js → channel.runtime-B454n78J.js} +80 -32
- package/dist/{client-DAIry9-2.js → client-Dt7Q-j5B.js} +9 -7
- package/dist/ingress-identity-DNl4yQSc.js +27 -0
- package/dist/{interactions-k47k-7SP.js → interactions-DF1FH27_.js} +28 -15
- package/dist/{monitor-auth-CVd_4FPD.js → monitor-auth-C6RGYyn-.js} +12 -31
- package/dist/{normalize-bBDFEiyJ.js → normalize-R-ATEEHC.js} +12 -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-CfsJU7WW.js → slash-state-njvQCdwt.js} +49 -52
- package/openclaw.plugin.json +27 -2
- package/package.json +4 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-DF1FH27_.js";
|
|
3
|
+
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-Dt7Q-j5B.js";
|
|
4
|
+
import { C as resolveDefaultGroupPolicy, T as warnMissingProviderGroupPolicyFallbackOnce, _ 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, x as resolveChannelMediaMaxBytes, y as registerPluginHttpRoute } from "./monitor-auth-C6RGYyn-.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-R-ATEEHC.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-njvQCdwt.js";
|
|
7
8
|
import { randomUUID } from "node:crypto";
|
|
8
|
-
import { resolveGatewayPort } from "openclaw/plugin-sdk/
|
|
9
|
+
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
9
10
|
import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
|
|
10
11
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
12
|
import { buildChannelInboundMediaPayload, createChannelPartialDeliveryError, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, implicitMentionKindWhen, isChannelPartialDeliveryError, resolveInboundMentionDecision, resolveInboundSessionEnvelopeContext, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
@@ -18,7 +19,9 @@ import { z } from "zod";
|
|
|
18
19
|
import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLineForEntry, createChannelIngressError, createChannelIngressMonitor, createChannelProgressDraftCompositor, createFinalizableDraftLifecycle, createMessageReceiptFromOutboundResults, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, listMessageReceiptPlatformIds, resolveChannelStreamingPreviewToolProgress } from "openclaw/plugin-sdk/channel-outbound";
|
|
19
20
|
import { resolveAllowlistProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
20
21
|
import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
|
|
22
|
+
import { runDetachedWebhookWork } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
21
23
|
import { fanInChannelIngressLifecycles, resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
24
|
+
import { resolveChannelGroups, resolveChannelGroupsConfigPath } from "openclaw/plugin-sdk/channel-policy";
|
|
22
25
|
import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsSupplement, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
23
26
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
24
27
|
import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
@@ -28,9 +31,9 @@ import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
|
28
31
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
|
|
29
32
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
30
33
|
import { channelReadyPatch, isLoopbackHost } from "openclaw/plugin-sdk/gateway-runtime";
|
|
34
|
+
import { createRuntimeConfigReader } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
31
35
|
import { captureWsEvent, createDebugProxyWebSocketAgent, resolveDebugProxySettings } from "openclaw/plugin-sdk/proxy-capture";
|
|
32
36
|
import WebSocket from "ws";
|
|
33
|
-
import { runDetachedWebhookWork } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
34
37
|
import { resolveChannelContextVisibilityMode, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
35
38
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
36
39
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
@@ -214,8 +217,9 @@ function shouldDropEmptyMattermostBody(params) {
|
|
|
214
217
|
}
|
|
215
218
|
//#endregion
|
|
216
219
|
//#region extensions/mattermost/src/mattermost/monitor-websocket.ts
|
|
217
|
-
const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES =
|
|
220
|
+
const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16777216;
|
|
218
221
|
const MATTERMOST_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
222
|
+
const MATTERMOST_WEBSOCKET_AUTH_TIMEOUT_MS = 3e4;
|
|
219
223
|
const MattermostEventPayloadSchema = z.object({
|
|
220
224
|
event: z.string().optional(),
|
|
221
225
|
status: z.string().optional(),
|
|
@@ -251,6 +255,14 @@ var WebSocketClosedBeforeOpenError = class extends Error {
|
|
|
251
255
|
this.name = "WebSocketClosedBeforeOpenError";
|
|
252
256
|
}
|
|
253
257
|
};
|
|
258
|
+
var WebSocketClosedBeforeAuthenticationError = class extends Error {
|
|
259
|
+
constructor(code, reason) {
|
|
260
|
+
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`);
|
|
261
|
+
this.code = code;
|
|
262
|
+
this.reason = reason;
|
|
263
|
+
this.name = "WebSocketClosedBeforeAuthenticationError";
|
|
264
|
+
}
|
|
265
|
+
};
|
|
254
266
|
const defaultMattermostWebSocketFactory = (url, options) => {
|
|
255
267
|
const agent = createDebugProxyWebSocketAgent(resolveDebugProxySettings());
|
|
256
268
|
return new WebSocket(url, {
|
|
@@ -275,6 +287,7 @@ function createMattermostConnectOnce(opts) {
|
|
|
275
287
|
try {
|
|
276
288
|
return await new Promise((resolve, reject) => {
|
|
277
289
|
let opened = false;
|
|
290
|
+
let authenticated = false;
|
|
278
291
|
let settled = false;
|
|
279
292
|
let healthCheckEnabled = getBotUpdateAt != null;
|
|
280
293
|
let healthCheckInFlight = false;
|
|
@@ -284,11 +297,16 @@ function createMattermostConnectOnce(opts) {
|
|
|
284
297
|
let protocolPongTimer;
|
|
285
298
|
let initialUpdateAt;
|
|
286
299
|
let authenticationSeq;
|
|
300
|
+
let authTimer;
|
|
287
301
|
const clearTimers = () => {
|
|
288
302
|
if (healthCheckTimer !== void 0) {
|
|
289
303
|
clearTimeout(healthCheckTimer);
|
|
290
304
|
healthCheckTimer = void 0;
|
|
291
305
|
}
|
|
306
|
+
if (authTimer !== void 0) {
|
|
307
|
+
clearTimeout(authTimer);
|
|
308
|
+
authTimer = void 0;
|
|
309
|
+
}
|
|
292
310
|
if (protocolPingTimer !== void 0) {
|
|
293
311
|
clearTimeout(protocolPingTimer);
|
|
294
312
|
protocolPingTimer = void 0;
|
|
@@ -403,6 +421,13 @@ function createMattermostConnectOnce(opts) {
|
|
|
403
421
|
}
|
|
404
422
|
});
|
|
405
423
|
ws.send(authPayload);
|
|
424
|
+
authTimer = setTimeout(() => {
|
|
425
|
+
authTimer = void 0;
|
|
426
|
+
if (settled) return;
|
|
427
|
+
opts.runtime.error?.("mattermost websocket authentication timed out — reconnecting");
|
|
428
|
+
stopHealthChecks();
|
|
429
|
+
ws.terminate();
|
|
430
|
+
}, MATTERMOST_WEBSOCKET_AUTH_TIMEOUT_MS);
|
|
406
431
|
scheduleProtocolPing();
|
|
407
432
|
if (getBotUpdateAt) runHealthCheck();
|
|
408
433
|
});
|
|
@@ -426,6 +451,11 @@ function createMattermostConnectOnce(opts) {
|
|
|
426
451
|
const payload = parseMattermostEventPayload(raw);
|
|
427
452
|
if (!payload) return;
|
|
428
453
|
if (payload.status === "OK" && payload.seq_reply === authenticationSeq) {
|
|
454
|
+
authenticated = true;
|
|
455
|
+
if (authTimer !== void 0) {
|
|
456
|
+
clearTimeout(authTimer);
|
|
457
|
+
authTimer = void 0;
|
|
458
|
+
}
|
|
429
459
|
opts.statusSink?.(channelReadyPatch());
|
|
430
460
|
return;
|
|
431
461
|
}
|
|
@@ -467,10 +497,14 @@ function createMattermostConnectOnce(opts) {
|
|
|
467
497
|
error: message || void 0
|
|
468
498
|
}
|
|
469
499
|
});
|
|
470
|
-
if (opened) {
|
|
500
|
+
if (opened && authenticated) {
|
|
471
501
|
resolveOnce();
|
|
472
502
|
return;
|
|
473
503
|
}
|
|
504
|
+
if (opened) {
|
|
505
|
+
rejectOnce(new WebSocketClosedBeforeAuthenticationError(code, message || void 0));
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
474
508
|
rejectOnce(new WebSocketClosedBeforeOpenError(code, message || void 0));
|
|
475
509
|
});
|
|
476
510
|
ws.on("error", (err) => {
|
|
@@ -654,7 +688,7 @@ function formatMattermostNoVisibleReplyLog(params) {
|
|
|
654
688
|
//#endregion
|
|
655
689
|
//#region extensions/mattermost/src/mattermost/monitor-context.ts
|
|
656
690
|
function shouldUpdateMattermostDraftToolProgress(account) {
|
|
657
|
-
return account.streamingMode !== "off" && resolveChannelStreamingPreviewToolProgress(account.config,
|
|
691
|
+
return account.streamingMode !== "off" && resolveChannelStreamingPreviewToolProgress(account.config, account.streamingMode !== "progress", account.streamingMode);
|
|
658
692
|
}
|
|
659
693
|
function shouldSuppressMattermostDefaultToolProgressMessages(account) {
|
|
660
694
|
return account.streamingMode !== "off";
|
|
@@ -1088,7 +1122,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1088
1122
|
agentId: eventPlan.route.agentId,
|
|
1089
1123
|
sessionKey: eventPlan.thread.sessionKey
|
|
1090
1124
|
};
|
|
1091
|
-
const data = await
|
|
1125
|
+
const data = await buildPreparedModelsProviderData(cfg, eventPlan.route.agentId);
|
|
1092
1126
|
if (data.providers.length === 0) return await updatePickerPost("No models available.");
|
|
1093
1127
|
if (pickerState.action === "providers" || pickerState.action === "back") {
|
|
1094
1128
|
const currentModel = resolveMattermostModelPickerCurrentModel({
|
|
@@ -1222,8 +1256,8 @@ function formatMattermostInboundMediaText(params) {
|
|
|
1222
1256
|
notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]${fileNameNotice}`
|
|
1223
1257
|
});
|
|
1224
1258
|
}
|
|
1225
|
-
const CHANNEL_CACHE_TTL_MS =
|
|
1226
|
-
const USER_CACHE_TTL_MS =
|
|
1259
|
+
const CHANNEL_CACHE_TTL_MS = 3e5;
|
|
1260
|
+
const USER_CACHE_TTL_MS = 6e5;
|
|
1227
1261
|
const MONITOR_RESOURCE_CACHE_MAX_ENTRIES = 1e3;
|
|
1228
1262
|
const MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS = 12e4;
|
|
1229
1263
|
const MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS = 3e4;
|
|
@@ -1313,7 +1347,6 @@ function createMattermostMonitorResources(params) {
|
|
|
1313
1347
|
return info;
|
|
1314
1348
|
} catch (err) {
|
|
1315
1349
|
logger.debug?.(`mattermost: channel lookup failed: ${String(err)}`);
|
|
1316
|
-
setCachedValue(channelCache, channelId, null, CHANNEL_CACHE_TTL_MS, rawNow);
|
|
1317
1350
|
return null;
|
|
1318
1351
|
}
|
|
1319
1352
|
};
|
|
@@ -1327,7 +1360,6 @@ function createMattermostMonitorResources(params) {
|
|
|
1327
1360
|
return info;
|
|
1328
1361
|
} catch (err) {
|
|
1329
1362
|
logger.debug?.(`mattermost: user lookup failed: ${String(err)}`);
|
|
1330
|
-
setCachedValue(userCache, userId, null, USER_CACHE_TTL_MS, rawNow);
|
|
1331
1363
|
return null;
|
|
1332
1364
|
}
|
|
1333
1365
|
};
|
|
@@ -1813,7 +1845,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1813
1845
|
//#region extensions/mattermost/src/mattermost/thread-participation.ts
|
|
1814
1846
|
const threadParticipation = createPersistentDedupeCache({
|
|
1815
1847
|
globalKey: Symbol.for("openclaw.mattermostThreadParticipation"),
|
|
1816
|
-
ttlMs:
|
|
1848
|
+
ttlMs: 6048e5,
|
|
1817
1849
|
maxSize: 5e3,
|
|
1818
1850
|
persistent: {
|
|
1819
1851
|
namespace: "mattermost.thread-participation",
|
|
@@ -1875,7 +1907,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1875
1907
|
});
|
|
1876
1908
|
const hookRunner = getGlobalHookRunner();
|
|
1877
1909
|
const draftPreviewEnabled = !((hookRunner?.hasHooks("reply_payload_sending") ?? false) || (hookRunner?.hasHooks("message_sending") ?? false)) && account.streamingMode !== "off";
|
|
1878
|
-
const
|
|
1910
|
+
const draftProgressEnabled = draftPreviewEnabled && (account.streamingMode === "progress" || shouldUpdateMattermostDraftToolProgress(account));
|
|
1879
1911
|
const suppressDefaultToolProgressMessages = draftPreviewEnabled && shouldSuppressMattermostDefaultToolProgressMessages(account);
|
|
1880
1912
|
const draftStream = draftPreviewEnabled ? createMattermostDraftStream({
|
|
1881
1913
|
client,
|
|
@@ -2123,9 +2155,9 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2123
2155
|
delivery,
|
|
2124
2156
|
replyOptions: {
|
|
2125
2157
|
...turnAdoptionLifecycle ? bindIngressLifecycleToReplyOptions(turnAdoptionLifecycle) : {},
|
|
2126
|
-
allowProgressCallbacksWhenSourceDeliverySuppressed:
|
|
2158
|
+
allowProgressCallbacksWhenSourceDeliverySuppressed: draftProgressEnabled ? true : void 0,
|
|
2127
2159
|
preserveProgressCallbackStartOrder: draftPreviewEnabled ? true : void 0,
|
|
2128
|
-
onObservedReplyDelivery:
|
|
2160
|
+
onObservedReplyDelivery: draftProgressEnabled ? () => draftStream.clear() : void 0,
|
|
2129
2161
|
disableBlockStreaming: draftPreviewEnabled ? true : replyOptions.disableBlockStreaming,
|
|
2130
2162
|
...suppressDefaultToolProgressMessages ? { suppressDefaultToolProgressMessages: true } : {},
|
|
2131
2163
|
onModelSelected,
|
|
@@ -2157,7 +2189,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2157
2189
|
return false;
|
|
2158
2190
|
},
|
|
2159
2191
|
onToolStart: async (payloadValue) => {
|
|
2160
|
-
if (!
|
|
2192
|
+
if (!draftProgressEnabled) return false;
|
|
2161
2193
|
const boundarySettled = enterBlockPreviewActivity("tool");
|
|
2162
2194
|
const progressSettled = progressDraft.pushToolProgress(buildChannelProgressDraftLineForEntry(account.config, {
|
|
2163
2195
|
event: "tool",
|
|
@@ -2172,7 +2204,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2172
2204
|
return visible;
|
|
2173
2205
|
},
|
|
2174
2206
|
onItemEvent: async (payloadLocal) => {
|
|
2175
|
-
if (!
|
|
2207
|
+
if (!draftProgressEnabled) return false;
|
|
2176
2208
|
const boundarySettled = enterBlockPreviewActivity("tool");
|
|
2177
2209
|
const progressSettled = progressDraft.pushToolProgress(buildChannelProgressDraftLineForEntry(account.config, {
|
|
2178
2210
|
event: "item",
|
|
@@ -2206,6 +2238,12 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2206
2238
|
//#region extensions/mattermost/src/mattermost/monitor-posts.ts
|
|
2207
2239
|
function createMattermostPostHandler(monitor) {
|
|
2208
2240
|
const { account, botUserId, botUsername, cfg, core, groupPolicy, pairing, resources } = monitor;
|
|
2241
|
+
const groupsConfigPath = resolveChannelGroupsConfigPath({
|
|
2242
|
+
cfg,
|
|
2243
|
+
channel: "mattermost",
|
|
2244
|
+
accountId: account.accountId,
|
|
2245
|
+
groups: resolveChannelGroups(cfg, "mattermost", account.accountId)
|
|
2246
|
+
});
|
|
2209
2247
|
const { resolveMattermostMedia, resolveUserInfo } = resources;
|
|
2210
2248
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
2211
2249
|
const historyLimit = Math.max(0, account.config.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
@@ -2245,6 +2283,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2245
2283
|
const senderName = normalizeOptionalString(payload.data?.sender_name) ?? normalizeOptionalString((await resolveUserInfo(senderId))?.username) ?? senderId;
|
|
2246
2284
|
const rawPostText = typeof post.message === "string" ? post.message : "";
|
|
2247
2285
|
const rawText = normalizeOptionalString(rawPostText) ?? "";
|
|
2286
|
+
const commandBody = normalizeMention(rawText, botUsername).trim();
|
|
2248
2287
|
const { effectiveReplyToId, sessionKey } = thread;
|
|
2249
2288
|
const { envelopeOptions, previousTimestamp } = resolveInboundSessionEnvelopeContext({
|
|
2250
2289
|
cfg,
|
|
@@ -2278,7 +2317,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2278
2317
|
cfg,
|
|
2279
2318
|
surface: "mattermost"
|
|
2280
2319
|
});
|
|
2281
|
-
const isControlCommand = allowTextCommands && core.channel.commands.isControlCommandMessage(
|
|
2320
|
+
const isControlCommand = allowTextCommands && core.channel.commands.isControlCommandMessage(commandBody, cfg);
|
|
2282
2321
|
const accessDecision = await resolveMattermostMonitorInboundAccess({
|
|
2283
2322
|
account,
|
|
2284
2323
|
cfg,
|
|
@@ -2402,7 +2441,14 @@ function createMattermostPostHandler(monitor) {
|
|
|
2402
2441
|
return;
|
|
2403
2442
|
}
|
|
2404
2443
|
if (mentionDecision.shouldSkip) {
|
|
2405
|
-
|
|
2444
|
+
logInboundDrop({
|
|
2445
|
+
log: monitor.runtime.log,
|
|
2446
|
+
channel: "mattermost",
|
|
2447
|
+
reason: "no mention",
|
|
2448
|
+
target: channelId,
|
|
2449
|
+
onceKey: JSON.stringify([account.accountId, channelId]),
|
|
2450
|
+
hint: `Mention patterns can be derived from the agent identity name. Set ${groupsConfigPath}[${JSON.stringify(channelId)}].requireMention=false to process messages without a mention. Preserve existing groups entries; when adding the first groups map, include "*": {} to keep other chats admitted.`
|
|
2451
|
+
});
|
|
2406
2452
|
recordPendingHistory();
|
|
2407
2453
|
return;
|
|
2408
2454
|
}
|
|
@@ -2462,7 +2508,6 @@ function createMattermostPostHandler(monitor) {
|
|
|
2462
2508
|
envelope: envelopeOptions
|
|
2463
2509
|
})
|
|
2464
2510
|
});
|
|
2465
|
-
const commandBody = rawText.trim();
|
|
2466
2511
|
const inboundHistory = historyKey && historyLimit > 0 ? createChannelHistoryWindow({ historyMap: channelHistories }).buildInboundHistory({
|
|
2467
2512
|
historyKey,
|
|
2468
2513
|
limit: historyLimit
|
|
@@ -2779,6 +2824,11 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2779
2824
|
}
|
|
2780
2825
|
};
|
|
2781
2826
|
const cfg = opts.config ?? core.config.current();
|
|
2827
|
+
const readConfig = createRuntimeConfigReader(cfg);
|
|
2828
|
+
const resolveDebounceMs = () => core.channel.debounce.resolveInboundDebounceMs({
|
|
2829
|
+
cfg: readConfig(),
|
|
2830
|
+
channel: "mattermost"
|
|
2831
|
+
});
|
|
2782
2832
|
const account = resolveMattermostAccount({
|
|
2783
2833
|
cfg,
|
|
2784
2834
|
accountId: opts.accountId
|
|
@@ -2836,9 +2886,9 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2836
2886
|
};
|
|
2837
2887
|
const mediaMaxBytes = resolveChannelMediaMaxBytes({
|
|
2838
2888
|
cfg,
|
|
2839
|
-
resolveChannelLimitMb: () =>
|
|
2889
|
+
resolveChannelLimitMb: () => account.config.mediaMaxMb,
|
|
2840
2890
|
accountId: account.accountId
|
|
2841
|
-
}) ??
|
|
2891
|
+
}) ?? 8388608;
|
|
2842
2892
|
const { groupPolicy, providerMissingFallbackApplied } = resolveAllowlistProviderRuntimeGroupPolicy$1({
|
|
2843
2893
|
providerConfigPresent: cfg.channels?.mattermost !== void 0,
|
|
2844
2894
|
groupPolicy: account.config.groupPolicy,
|
|
@@ -2896,10 +2946,8 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2896
2946
|
const handlePost = createMattermostPostHandler(monitor);
|
|
2897
2947
|
const handleReactionEvent = createMattermostReactionHandler(monitor);
|
|
2898
2948
|
const debouncer = core.channel.debounce.createInboundDebouncer({
|
|
2899
|
-
debounceMs:
|
|
2900
|
-
|
|
2901
|
-
channel: "mattermost"
|
|
2902
|
-
}),
|
|
2949
|
+
debounceMs: resolveDebounceMs(),
|
|
2950
|
+
resolveDebounceMs,
|
|
2903
2951
|
buildKey: (entry) => {
|
|
2904
2952
|
const channelId = entry.post.channel_id ?? entry.payload.data?.channel_id ?? entry.payload.broadcast?.channel_id;
|
|
2905
2953
|
if (!channelId || !entry.post.user_id) return null;
|
|
@@ -2909,7 +2957,7 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2909
2957
|
shouldDebounce: (entry) => {
|
|
2910
2958
|
if (normalizeOptionalString(entry.post.type) !== void 0 || entry.post.file_ids?.length) return false;
|
|
2911
2959
|
const text = normalizeOptionalString(entry.post.message) ?? "";
|
|
2912
|
-
return Boolean(text) && !core.channel.commands.isControlCommandMessage(text, cfg);
|
|
2960
|
+
return Boolean(text) && !core.channel.commands.isControlCommandMessage(normalizeMention(text, botUsername), cfg);
|
|
2913
2961
|
},
|
|
2914
2962
|
onFlush: (entries, createFlush) => {
|
|
2915
2963
|
const last = entries.at(-1);
|
|
@@ -3053,7 +3101,7 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
|
|
|
3053
3101
|
}
|
|
3054
3102
|
//#endregion
|
|
3055
3103
|
//#region extensions/mattermost/src/mattermost/reactions.ts
|
|
3056
|
-
const BOT_USER_CACHE_TTL_MS =
|
|
3104
|
+
const BOT_USER_CACHE_TTL_MS = 6e5;
|
|
3057
3105
|
const botUserIdCache = /* @__PURE__ */ new Map();
|
|
3058
3106
|
async function resolveBotUserId(client, cacheKey) {
|
|
3059
3107
|
const rawNow = Date.now();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
|
|
2
3
|
import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
3
4
|
import { collectErrorGraphCandidates } from "openclaw/plugin-sdk/error-runtime";
|
|
4
5
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
@@ -10,9 +11,9 @@ import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
|
10
11
|
import { fetchWithSsrFGuard, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
12
|
import { z } from "zod";
|
|
12
13
|
//#region extensions/mattermost/src/mattermost/client.ts
|
|
13
|
-
const MATTERMOST_ERROR_BODY_LIMIT_BYTES =
|
|
14
|
+
const MATTERMOST_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
14
15
|
const MATTERMOST_REQUEST_TIMEOUT_MS = 3e4;
|
|
15
|
-
const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES =
|
|
16
|
+
const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES = 65536;
|
|
16
17
|
const MattermostPostSchema = z.object({
|
|
17
18
|
id: z.string(),
|
|
18
19
|
user_id: z.string().nullable().optional(),
|
|
@@ -98,18 +99,20 @@ function createMattermostClient(params) {
|
|
|
98
99
|
const fetchImpl = (externalFetchImpl ? async (input, init) => {
|
|
99
100
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
100
101
|
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
102
|
+
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
101
103
|
const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
|
|
102
|
-
timeoutMs
|
|
104
|
+
timeoutMs,
|
|
103
105
|
operation: "mattermost-api",
|
|
104
106
|
url
|
|
105
107
|
});
|
|
106
108
|
const callerSignal = requestInit.signal ?? void 0;
|
|
107
109
|
const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
|
|
108
110
|
try {
|
|
109
|
-
|
|
111
|
+
const response = await externalFetchImpl(input, {
|
|
110
112
|
...requestInit,
|
|
111
113
|
signal
|
|
112
|
-
})
|
|
114
|
+
});
|
|
115
|
+
return responseWithRelease(response, async () => cleanup());
|
|
113
116
|
} catch (error) {
|
|
114
117
|
cleanup();
|
|
115
118
|
throw error;
|
|
@@ -351,8 +354,7 @@ async function deleteMattermostPost(client, postId) {
|
|
|
351
354
|
async function uploadMattermostFile(client, params) {
|
|
352
355
|
const form = new FormData();
|
|
353
356
|
const fileName = normalizeOptionalString(params.fileName) ?? "upload";
|
|
354
|
-
const
|
|
355
|
-
const blob = params.contentType ? new Blob([bytes], { type: params.contentType }) : new Blob([bytes]);
|
|
357
|
+
const blob = new Blob([bufferToBlobPart(params.buffer)], { type: params.contentType });
|
|
356
358
|
form.append("files", blob, fileName);
|
|
357
359
|
form.append("channel_id", params.channelId);
|
|
358
360
|
const res = await client.fetchImpl(`${client.apiBaseUrl}/files`, {
|
|
@@ -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,20 @@
|
|
|
1
1
|
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import { v as updateMattermostPost } from "./client-
|
|
3
|
-
import {
|
|
2
|
+
import { v as updateMattermostPost } from "./client-Dt7Q-j5B.js";
|
|
3
|
+
import { S as resolveClientIp, f as isRequestBodyLimitError, p as isTrustedProxyAddress, v as readRequestBodyWithLimit, w as sendHttpRequestRejection } from "./monitor-auth-C6RGYyn-.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
|
+
//#region extensions/mattermost/src/mattermost/callback-host.ts
|
|
9
|
+
function isWildcardBindHost(rawHost) {
|
|
10
|
+
const trimmed = rawHost.trim();
|
|
11
|
+
if (!trimmed) return false;
|
|
12
|
+
const host = trimmed.startsWith("[") && trimmed.endsWith("]") ? trimmed.slice(1, -1) : trimmed;
|
|
13
|
+
return host === "0.0.0.0" || host === "::" || host === "0:0:0:0:0:0:0:0" || host === "::0";
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
8
16
|
//#region extensions/mattermost/src/mattermost/interactions.ts
|
|
9
|
-
const INTERACTION_MAX_BODY_BYTES =
|
|
17
|
+
const INTERACTION_MAX_BODY_BYTES = 65536;
|
|
10
18
|
const INTERACTION_BODY_TIMEOUT_MS = 1e4;
|
|
11
19
|
const SIGNED_CHANNEL_ID_CONTEXT_KEY = "__openclaw_channel_id";
|
|
12
20
|
const callbackUrls = /* @__PURE__ */ new Map();
|
|
@@ -16,12 +24,6 @@ function setInteractionCallbackUrl(accountId, url) {
|
|
|
16
24
|
function resolveInteractionCallbackPath(accountId) {
|
|
17
25
|
return `/mattermost/interactions/${accountId}`;
|
|
18
26
|
}
|
|
19
|
-
function isWildcardBindHost(rawHost) {
|
|
20
|
-
const trimmed = rawHost.trim();
|
|
21
|
-
if (!trimmed) return false;
|
|
22
|
-
const host = trimmed.startsWith("[") && trimmed.endsWith("]") ? trimmed.slice(1, -1) : trimmed;
|
|
23
|
-
return host === "0.0.0.0" || host === "::" || host === "0:0:0:0:0:0:0:0" || host === "::0";
|
|
24
|
-
}
|
|
25
27
|
function normalizeCallbackBaseUrl(baseUrl) {
|
|
26
28
|
return baseUrl.trim().replace(/\/+$/, "");
|
|
27
29
|
}
|
|
@@ -32,13 +34,14 @@ function headerValue(value) {
|
|
|
32
34
|
function isAllowedInteractionSource(params) {
|
|
33
35
|
const { allowedSourceIps } = params;
|
|
34
36
|
if (!allowedSourceIps?.length) return true;
|
|
35
|
-
|
|
37
|
+
const clientIp = resolveClientIp({
|
|
36
38
|
remoteAddr: params.req.socket?.remoteAddress,
|
|
37
39
|
forwardedFor: headerValue(params.req.headers["x-forwarded-for"]),
|
|
38
40
|
realIp: headerValue(params.req.headers["x-real-ip"]),
|
|
39
41
|
trustedProxies: params.trustedProxies,
|
|
40
42
|
allowRealIpFallback: params.allowRealIpFallback
|
|
41
|
-
})
|
|
43
|
+
});
|
|
44
|
+
return isTrustedProxyAddress(clientIp, allowedSourceIps);
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Resolve the interaction callback URL for an account.
|
|
@@ -99,7 +102,8 @@ function generateInteractionToken(context, accountId) {
|
|
|
99
102
|
return createHmac("sha256", secret).update(payload).digest("hex");
|
|
100
103
|
}
|
|
101
104
|
function verifyInteractionToken(context, token, accountId) {
|
|
102
|
-
|
|
105
|
+
const expected = generateInteractionToken(context, accountId);
|
|
106
|
+
return safeEqualSecret(expected, token);
|
|
103
107
|
}
|
|
104
108
|
/**
|
|
105
109
|
* Build Mattermost `props.attachments` with interactive buttons.
|
|
@@ -165,7 +169,8 @@ function buildButtonProps(params) {
|
|
|
165
169
|
function readInteractionBody(req) {
|
|
166
170
|
return readRequestBodyWithLimit(req, {
|
|
167
171
|
maxBytes: INTERACTION_MAX_BODY_BYTES,
|
|
168
|
-
timeoutMs: INTERACTION_BODY_TIMEOUT_MS
|
|
172
|
+
timeoutMs: INTERACTION_BODY_TIMEOUT_MS,
|
|
173
|
+
destroyOnLimit: false
|
|
169
174
|
});
|
|
170
175
|
}
|
|
171
176
|
function createMattermostInteractionHandler(params) {
|
|
@@ -203,6 +208,14 @@ function createMattermostInteractionHandler(params) {
|
|
|
203
208
|
payload = parseInteractionPayload(await readInteractionBody(req));
|
|
204
209
|
} catch (err) {
|
|
205
210
|
log?.(`mattermost interaction: failed to parse body: ${String(err)}`);
|
|
211
|
+
if (isRequestBodyLimitError(err, "PAYLOAD_TOO_LARGE")) {
|
|
212
|
+
await sendHttpRequestRejection(req, res, 413, JSON.stringify({ error: "Payload too large" }), "application/json");
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (isRequestBodyLimitError(err, "REQUEST_BODY_TIMEOUT")) {
|
|
216
|
+
await sendHttpRequestRejection(req, res, 408, JSON.stringify({ error: "Request body timeout" }), "application/json");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
206
219
|
res.statusCode = 400;
|
|
207
220
|
res.setHeader("Content-Type", "application/json");
|
|
208
221
|
res.end(JSON.stringify({ error: "Invalid request body" }));
|
|
@@ -373,4 +386,4 @@ function createMattermostInteractionHandler(params) {
|
|
|
373
386
|
};
|
|
374
387
|
}
|
|
375
388
|
//#endregion
|
|
376
|
-
export { resolveInteractionCallbackPath as a, setInteractionSecret as c, createMattermostInteractionHandler as i, buildButtonProps as n, resolveInteractionCallbackUrl as o, computeInteractionCallbackUrl as r, setInteractionCallbackUrl as s, buildButtonAttachments as t };
|
|
389
|
+
export { resolveInteractionCallbackPath as a, setInteractionSecret as c, createMattermostInteractionHandler as i, isWildcardBindHost as l, buildButtonProps as n, resolveInteractionCallbackUrl as o, computeInteractionCallbackUrl as r, setInteractionCallbackUrl as s, buildButtonAttachments as t };
|
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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 {
|
|
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/
|
|
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
|
-
import { isRequestBodyLimitError
|
|
17
|
-
import {
|
|
16
|
+
import { isRequestBodyLimitError } from "openclaw/plugin-sdk/webhook-ingress";
|
|
17
|
+
import { readRequestBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
18
|
+
import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core";
|
|
18
19
|
import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
19
20
|
//#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
21
|
function normalizeMattermostAllowList(entries) {
|
|
43
|
-
|
|
22
|
+
const normalized = entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean);
|
|
23
|
+
return uniqueStrings(normalized);
|
|
44
24
|
}
|
|
45
25
|
function formatMattermostDirectMessageDropLog(params) {
|
|
46
26
|
const reason = params.reasonCode ? ` reason=${params.reasonCode}` : "";
|
|
@@ -48,8 +28,9 @@ function formatMattermostDirectMessageDropLog(params) {
|
|
|
48
28
|
return `mattermost: drop dm sender=${params.senderId} (dmPolicy=${params.dmPolicy}${reason}${hint})`;
|
|
49
29
|
}
|
|
50
30
|
function isMattermostSenderAllowed(params) {
|
|
31
|
+
const allowFrom = normalizeMattermostAllowList(params.allowFrom);
|
|
51
32
|
return resolveAllowlistMatchSimple({
|
|
52
|
-
allowFrom
|
|
33
|
+
allowFrom,
|
|
53
34
|
senderId: normalizeMattermostAllowEntry(params.senderId),
|
|
54
35
|
senderName: params.senderName ? normalizeMattermostAllowEntry(params.senderName) : void 0,
|
|
55
36
|
allowNameMatching: params.allowNameMatching
|
|
@@ -181,4 +162,4 @@ async function authorizeMattermostCommandInvocation(params) {
|
|
|
181
162
|
};
|
|
182
163
|
}
|
|
183
164
|
//#endregion
|
|
184
|
-
export {
|
|
165
|
+
export { resolveDefaultGroupPolicy as C, resolveClientIp as S, warnMissingProviderGroupPolicyFallbackOnce as T, 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, sendHttpRequestRejection as w, resolveChannelMediaMaxBytes$1 as x, registerPluginHttpRoute as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { m as normalizeMattermostBaseUrl } from "./client-
|
|
1
|
+
import { m as normalizeMattermostBaseUrl } from "./client-Dt7Q-j5B.js";
|
|
2
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
|
-
import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
|
|
5
4
|
import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
|
|
5
|
+
import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
7
7
|
import { buildSecretInputSchema, hasConfiguredSecretInput, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
8
8
|
//#region extensions/mattermost/src/mattermost/accounts.ts
|
|
@@ -68,10 +68,18 @@ function resolveMattermostAccount(params) {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
function inspectMattermostAccount(params) {
|
|
71
|
-
|
|
71
|
+
const account = resolveMattermostAccountWithMode({
|
|
72
72
|
...params,
|
|
73
73
|
mode: "inspect"
|
|
74
74
|
});
|
|
75
|
+
return {
|
|
76
|
+
...account,
|
|
77
|
+
configured: isMattermostConfigured(account),
|
|
78
|
+
dmPolicy: account.config.dmPolicy ?? "pairing"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function isMattermostConfigured(account) {
|
|
82
|
+
return (account.botTokenStatus ? account.botTokenStatus !== "missing" : Boolean(account.botToken)) && Boolean(account.baseUrl);
|
|
75
83
|
}
|
|
76
84
|
/**
|
|
77
85
|
* Resolve the effective replyToMode for a given chat type.
|
|
@@ -148,4 +156,4 @@ function looksLikeMattermostTargetId(raw, _normalized) {
|
|
|
148
156
|
return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
|
|
149
157
|
}
|
|
150
158
|
//#endregion
|
|
151
|
-
export { inspectMattermostAccount as a,
|
|
159
|
+
export { inspectMattermostAccount as a, resolveDefaultMattermostAccountId as c, buildSecretInputSchema as d, hasConfiguredSecretInput as f, resolveMattermostPresentation as i, resolveMattermostAccount as l, normalizeMattermostMessagingTarget as n, isMattermostConfigured as o, requiresMattermostMediaUpload as r, listMattermostAccountIds as s, looksLikeMattermostTargetId as t, resolveMattermostReplyToMode as u };
|
package/dist/policy-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as isMattermostSenderAllowed } from "./monitor-auth-
|
|
1
|
+
import { r as isMattermostSenderAllowed } from "./monitor-auth-C6RGYyn-.js";
|
|
2
2
|
export { isMattermostSenderAllowed };
|