@openclaw/mattermost 2026.9.7 → 2026.10.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,13 @@
1
- import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-DMSZYnEx.mjs";
2
- import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
3
- import { a as createMattermostPost, b as uploadMattermostFile, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, g as parseMattermostApiStatus, h as normalizeMattermostBaseUrl, i as createMattermostDirectChannelWithRetry, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe } from "./client-CVeeTqCO.mjs";
1
+ import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-CfOLvzca.mjs";
2
+ import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
3
+ import { a as createMattermostPost, b as uploadMattermostFile, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, g as parseMattermostApiStatus, h as normalizeMattermostBaseUrl, i as createMattermostDirectChannelWithRetry, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe } from "./client-f2qstbX3.mjs";
4
4
  import { o as resolveMattermostTrustedChatKind, v as loadOutboundMediaFromUrl } from "./monitor-auth-aZ0b1gqx.mjs";
5
- import { u as resolveMattermostAccount } from "./normalize-BCjtmxtp.mjs";
5
+ import { u as resolveMattermostAccount } from "./normalize-DhF6_2lt.mjs";
6
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
8
- import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
9
8
  import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
10
9
  import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
11
- import { FormatCapabilityProfile, convertMarkdownTables } from "openclaw/plugin-sdk/text-chunking";
10
+ import { convertMarkdownTables } from "openclaw/plugin-sdk/text-chunking";
12
11
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
13
12
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
14
13
  import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
@@ -114,7 +113,7 @@ async function resolveMattermostOpaqueTarget(params) {
114
113
  client = createMattermostClient({
115
114
  baseUrl,
116
115
  botToken: token,
117
- allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
116
+ allowPrivateNetwork: account.config.network?.dangerouslyAllowPrivateNetwork === true
118
117
  });
119
118
  }
120
119
  const key = cacheKey$1(client.baseUrl, client.token, input);
@@ -160,16 +159,6 @@ async function resolveMattermostOpaqueTarget(params) {
160
159
  //#region extensions/mattermost/src/mattermost/send.ts
161
160
  const MATTERMOST_BOT_USER_CACHE_MAX_ENTRIES = 64;
162
161
  const MATTERMOST_TARGET_CACHE_MAX_ENTRIES = 1024;
163
- const MATTERMOST_FORMAT_PROFILE = FormatCapabilityProfile.define({
164
- mechanism: "markdown",
165
- chunk: {
166
- limit: 16383,
167
- unit: "chars"
168
- }
169
- });
170
- function renderMattermostMarkdown(markdown, tableMode) {
171
- return tableMode === "off" && MATTERMOST_FORMAT_PROFILE.constructs.table === "native" ? markdown : convertMarkdownTables(markdown, tableMode);
172
- }
173
162
  const botUserCache = /* @__PURE__ */ new Map();
174
163
  const userByNameCache = /* @__PURE__ */ new Map();
175
164
  const channelByNameCache = /* @__PURE__ */ new Map();
@@ -179,42 +168,14 @@ function cacheOutboundEntry(cache, key, value, maxEntries) {
179
168
  cache.set(key, value);
180
169
  pruneMapToMaxSize(cache, maxEntries);
181
170
  }
182
- function createMattermostSendReceipt(params) {
183
- return createMessageReceiptFromOutboundResults({
184
- kind: params.kind,
185
- ...params.replyToId ? { replyToId: params.replyToId } : {},
186
- results: [{
187
- channel: "mattermost",
188
- messageId: params.messageId,
189
- channelId: params.channelId
190
- }]
191
- });
192
- }
193
171
  function resolveMattermostReceiptKind(params) {
194
172
  if (params.fileIds?.length) return "media";
195
173
  if (params.buttons?.length || params.props) return "card";
196
174
  return "text";
197
175
  }
198
- function recordMattermostOutboundActivity(accountId) {
199
- try {
200
- getMattermostRuntime().channel.activity.record({
201
- channel: "mattermost",
202
- accountId,
203
- direction: "outbound"
204
- });
205
- } catch (error) {
206
- if (!(error instanceof Error) || error.message !== "Mattermost runtime not initialized") throw error;
207
- }
208
- }
209
176
  function cacheKey(baseUrl, token) {
210
177
  return `${baseUrl}::${token}`;
211
178
  }
212
- function normalizeMessage(text, mediaUrl) {
213
- return [normalizeOptionalString(text) ?? "", normalizeOptionalString(mediaUrl)].filter(Boolean).join("\n");
214
- }
215
- function isHttpUrl(value) {
216
- return /^https?:\/\//i.test(value);
217
- }
218
179
  async function resolveBotUser(client) {
219
180
  const key = cacheKey(client.baseUrl, client.token);
220
181
  const cached = botUserCache.get(key);
@@ -300,7 +261,7 @@ async function resolveMattermostSendContext(to, opts) {
300
261
  const client = createMattermostClient({
301
262
  baseUrl,
302
263
  botToken: token,
303
- allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config),
264
+ allowPrivateNetwork: account.config.network?.dangerouslyAllowPrivateNetwork === true,
304
265
  assertRequestCurrent: opts.assertDirectAdapterHandoff
305
266
  });
306
267
  const dmRetryOptions = mergeDmRetryOptions(account.config.dmChannelRetry, opts.dmRetryOptions);
@@ -376,7 +337,7 @@ async function sendMessageMattermost(to, text, opts) {
376
337
  uploadError = err instanceof Error ? err : new Error(String(err));
377
338
  if (opts.requireMediaUpload || mediaMaxBytes !== void 0) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: err });
378
339
  if (core.logging.shouldLogVerbose()) logger.debug?.(`mattermost send: media upload failed, falling back to URL text: ${String(err)}`);
379
- message = normalizeMessage(message, isHttpUrl(mediaUrl) ? mediaUrl : "");
340
+ message = [message, /^https?:\/\//i.test(mediaUrl) ? mediaUrl : ""].filter(Boolean).join("\n");
380
341
  }
381
342
  if (message) {
382
343
  const tableMode = resolveMarkdownTableMode({
@@ -384,7 +345,7 @@ async function sendMessageMattermost(to, text, opts) {
384
345
  channel: "mattermost",
385
346
  accountId
386
347
  });
387
- message = renderMattermostMarkdown(message, tableMode);
348
+ message = convertMarkdownTables(message, tableMode);
388
349
  }
389
350
  if (!message && (!fileIds || fileIds.length === 0)) {
390
351
  if (uploadError) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: uploadError });
@@ -405,15 +366,18 @@ async function sendMessageMattermost(to, text, opts) {
405
366
  props
406
367
  });
407
368
  const messageId = post.id;
408
- const receipt = createMattermostSendReceipt({
409
- messageId,
410
- channelId,
369
+ const receipt = createMessageReceiptFromOutboundResults({
370
+ results: [{
371
+ channel: "mattermost",
372
+ messageId,
373
+ channelId
374
+ }],
411
375
  kind: resolveMattermostReceiptKind({
412
376
  fileIds,
413
377
  buttons: opts.buttons,
414
378
  props
415
379
  }),
416
- replyToId: opts.replyToId
380
+ ...opts.replyToId ? { replyToId: opts.replyToId } : {}
417
381
  });
418
382
  const result = {
419
383
  messageId,
@@ -423,7 +387,11 @@ async function sendMessageMattermost(to, text, opts) {
423
387
  };
424
388
  try {
425
389
  await opts.onDeliveryResult?.(result);
426
- recordMattermostOutboundActivity(accountId);
390
+ getOptionalMattermostRuntime()?.channel.activity.record({
391
+ channel: "mattermost",
392
+ accountId,
393
+ direction: "outbound"
394
+ });
427
395
  } catch (error) {
428
396
  throw createChannelPartialDeliveryError(error, {
429
397
  messageIds: listMessageReceiptPlatformIds(receipt),
@@ -1,18 +1,18 @@
1
- import { l as isWildcardBindHost } from "./interactions-DMSZYnEx.mjs";
2
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
3
- import { r as createMattermostClient, s as fetchMattermostChannel, v as sendMattermostTyping } from "./client-CVeeTqCO.mjs";
2
+ import { n as normalizeCallbackPath, r as resolveCallbackHost, t as collectMattermostCallbackPaths } from "./callback-host-CBsPjVAZ.mjs";
3
+ import { r as createMattermostClient, s as fetchMattermostChannel, v as sendMattermostTyping } from "./client-f2qstbX3.mjs";
4
4
  import { D as sendHttpRequestRejection, b as logTypingFailure, h as isRequestBodyLimitError, i as normalizeMattermostAllowList, l as buildPreparedModelsProviderData, p as createWebhookInFlightLimiter, t as authorizeMattermostCommandInvocation, x as readRequestBodyWithLimit } from "./monitor-auth-aZ0b1gqx.mjs";
5
- import { a as resolveMattermostPresentation, i as requiresMattermostMediaUpload } from "./normalize-BCjtmxtp.mjs";
6
- import { t as sendMessageMattermost } from "./send-ClgX-usq.mjs";
5
+ import { a as resolveMattermostPresentation, i as requiresMattermostMediaUpload } from "./normalize-DhF6_2lt.mjs";
6
+ import { t as sendMessageMattermost } from "./send-BI4525Fd.mjs";
7
7
  import { createHash } from "node:crypto";
8
8
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
9
9
  import { asFiniteNumber, normalizeOptionalString, normalizeStringifiedOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
10
+ import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
10
11
  import { createAcceptedChannelDeliveryResult, createChannelPartialDeliveryError, isChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
11
12
  import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
12
- import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
13
13
  import { resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth-native";
14
14
  import { deliverTextOrMediaReply, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
15
- import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
15
+ import { resolveGlobalMap } from "openclaw/plugin-sdk/global-singleton";
16
16
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
17
17
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
18
18
  import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
@@ -229,21 +229,11 @@ function resolveCommandText(trigger, text, triggerMap) {
229
229
  function normalizeSlashCommandTrigger(command) {
230
230
  return command.replace(/^\//, "").trim();
231
231
  }
232
- const DEFAULT_CALLBACK_PATH = "/api/channels/mattermost/command";
233
- /**
234
- * Ensure the callback path starts with a leading `/` to prevent
235
- * malformed URLs like `http://host:portapi/...`.
236
- */
237
- function normalizeCallbackPath(path) {
238
- const trimmed = path.trim();
239
- if (!trimmed) return DEFAULT_CALLBACK_PATH;
240
- return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
241
- }
242
232
  function resolveSlashCommandConfig(raw) {
243
233
  return {
244
234
  native: raw?.native ?? "auto",
245
235
  nativeSkills: raw?.nativeSkills ?? "auto",
246
- callbackPath: normalizeCallbackPath(raw?.callbackPath ?? DEFAULT_CALLBACK_PATH),
236
+ callbackPath: normalizeCallbackPath(raw?.callbackPath),
247
237
  callbackUrl: normalizeOptionalString(raw?.callbackUrl)
248
238
  };
249
239
  }
@@ -252,9 +242,8 @@ function isSlashCommandsEnabled(config) {
252
242
  }
253
243
  function resolveCallbackUrl(params) {
254
244
  if (params.config.callbackUrl) return params.config.callbackUrl;
255
- let host = params.gatewayHost && !isWildcardBindHost(params.gatewayHost) ? params.gatewayHost : "localhost";
245
+ const host = resolveCallbackHost(params.gatewayHost);
256
246
  const path = normalizeCallbackPath(params.config.callbackPath);
257
- if (host.includes(":") && !(host.startsWith("[") && host.endsWith("]"))) host = `[${host}]`;
258
247
  return `http://${host}:${params.gatewayPort}${path}`;
259
248
  }
260
249
  //#endregion
@@ -297,20 +286,14 @@ function paginateItems(items, page, pageSize = MODELS_PAGE_SIZE) {
297
286
  };
298
287
  }
299
288
  function buildButton(params) {
300
- const baseState = params.action === "providers" || params.action === "back" ? {
289
+ const baseState = {
301
290
  action: params.action,
302
- ownerUserId: params.ownerUserId
303
- } : params.action === "list" ? {
304
- action: "list",
305
- ownerUserId: params.ownerUserId,
306
- provider: normalizeProviderId(params.provider ?? ""),
307
- page: normalizePage(params.page)
308
- } : {
309
- action: "select",
310
291
  ownerUserId: params.ownerUserId,
311
- provider: normalizeProviderId(params.provider ?? ""),
312
- page: normalizePage(params.page),
313
- model: normalizeStringifiedOptionalString(params.model) ?? ""
292
+ ...params.action === "list" || params.action === "select" ? {
293
+ provider: normalizeProviderId(params.provider ?? ""),
294
+ page: normalizePage(params.page)
295
+ } : {},
296
+ ...params.action === "select" ? { model: normalizeStringifiedOptionalString(params.model) ?? "" } : {}
314
297
  };
315
298
  const digest = createHash("sha256").update(JSON.stringify(baseState)).digest("hex").slice(0, 12);
316
299
  return {
@@ -798,14 +781,7 @@ async function authorizeSlashInvocation(params) {
798
781
  denyResponse: {
799
782
  response_type: "ephemeral",
800
783
  text: "Temporary error: unable to determine channel type. Please try again."
801
- },
802
- commandAuthorized: false,
803
- channelInfo: null,
804
- kind: "channel",
805
- chatType: "channel",
806
- channelName: "",
807
- channelDisplay: "",
808
- roomLabel: `#${channelId}`
784
+ }
809
785
  };
810
786
  const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
811
787
  cfg,
@@ -836,7 +812,7 @@ async function authorizeSlashInvocation(params) {
836
812
  meta: { name: senderName }
837
813
  });
838
814
  return {
839
- ...decision,
815
+ ok: false,
840
816
  denyResponse: {
841
817
  response_type: "ephemeral",
842
818
  text: core.channel.pairing.buildPairingReply({
@@ -847,19 +823,15 @@ async function authorizeSlashInvocation(params) {
847
823
  }
848
824
  };
849
825
  }
850
- const denyText = decision.denyReason === "unknown-channel" ? "Temporary error: unable to determine channel type. Please try again." : decision.denyReason === "dm-disabled" ? "This bot is not accepting direct messages." : decision.denyReason === "channels-disabled" ? "Slash commands are disabled in channels." : decision.denyReason === "channel-no-allowlist" ? "Slash commands are not configured for this channel (no allowlist)." : "Unauthorized.";
851
826
  return {
852
- ...decision,
827
+ ok: false,
853
828
  denyResponse: {
854
829
  response_type: "ephemeral",
855
- text: denyText
830
+ text: decision.denyReason === "unknown-channel" ? "Temporary error: unable to determine channel type. Please try again." : decision.denyReason === "dm-disabled" ? "This bot is not accepting direct messages." : decision.denyReason === "channels-disabled" ? "Slash commands are disabled in channels." : decision.denyReason === "channel-no-allowlist" ? "Slash commands are not configured for this channel (no allowlist)." : "Unauthorized."
856
831
  }
857
832
  };
858
833
  }
859
- return {
860
- ...decision,
861
- denyResponse: void 0
862
- };
834
+ return decision;
863
835
  }
864
836
  function createSlashCommandHttpHandler(params) {
865
837
  const { account, cfg, runtime, registeredCommands, triggerMap, log, bodyTimeoutMs } = params;
@@ -908,7 +880,7 @@ function createSlashCommandHttpHandler(params) {
908
880
  const client = createMattermostClient({
909
881
  baseUrl: account.baseUrl ?? "",
910
882
  botToken: account.botToken ?? "",
911
- allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
883
+ allowPrivateNetwork: account.config.network?.dangerouslyAllowPrivateNetwork === true
912
884
  });
913
885
  if (!await validateMattermostSlashCommandToken({
914
886
  accountId: account.accountId,
@@ -940,10 +912,7 @@ function createSlashCommandHttpHandler(params) {
940
912
  log
941
913
  });
942
914
  if (!auth.ok) {
943
- sendSlashCommandResponse(res, 200, auth.denyResponse ?? {
944
- response_type: "ephemeral",
945
- text: "Unauthorized."
946
- });
915
+ sendSlashCommandResponse(res, 200, auth.denyResponse);
947
916
  return;
948
917
  }
949
918
  log?.(`mattermost: slash command /${sanitizeMattermostLogValue(trigger)} from ${sanitizeMattermostLogValue(senderName)} in ${sanitizeMattermostLogValue(channelId)}`);
@@ -1121,25 +1090,7 @@ const MULTI_ACCOUNT_BODY_TIMEOUT_MS = 5e3;
1121
1090
  const slashRouteInFlightLimiter = createWebhookInFlightLimiter();
1122
1091
  const SLASH_ROUTE_IN_FLIGHT_KEY = "mattermost:slash";
1123
1092
  const SLASH_AUTHENTICATED_IN_FLIGHT_KEY = `${SLASH_ROUTE_IN_FLIGHT_KEY}:authenticated`;
1124
- /**
1125
- * Map from accountId → per-account slash command state.
1126
- *
1127
- * Anchored to globalThis so that jiti-loaded (route registration) and
1128
- * native-ESM-loaded (monitor/activation) module instances share the
1129
- * same Map. Without this, each module loader creates its own copy of
1130
- * the module-level variable and the HTTP handler never sees the tokens
1131
- * populated by the monitor.
1132
- */
1133
- const ACCOUNT_STATES_KEY = Symbol.for("openclaw.mattermost.slash-account-states");
1134
- function getSlashAccountStates() {
1135
- const globalStore = globalThis;
1136
- const existing = globalStore[ACCOUNT_STATES_KEY];
1137
- if (existing instanceof Map) return existing;
1138
- const accountStates = /* @__PURE__ */ new Map();
1139
- globalStore[ACCOUNT_STATES_KEY] = accountStates;
1140
- return accountStates;
1141
- }
1142
- const accountStates = getSlashAccountStates();
1093
+ const accountStates = resolveGlobalMap(Symbol.for("openclaw.mattermost.slash-account-states"));
1143
1094
  function resolveSlashRouteInFlightKey(authorization) {
1144
1095
  const token = authorization?.match(/^Token ([^,\s]+)$/iu)?.[1];
1145
1096
  if (!token) return SLASH_ROUTE_IN_FLIGHT_KEY;
@@ -1220,23 +1171,6 @@ function deactivateSlashCommands(accountId) {
1220
1171
  * rotated Mattermost token.
1221
1172
  */
1222
1173
  function registerSlashCommandRoute(api) {
1223
- const mmConfig = api.config.channels?.mattermost;
1224
- const callbackPaths = /* @__PURE__ */ new Set();
1225
- const addCallbackPaths = (raw) => {
1226
- const resolved = resolveSlashCommandConfig(raw);
1227
- callbackPaths.add(resolved.callbackPath);
1228
- if (resolved.callbackUrl) try {
1229
- const urlPath = new URL(resolved.callbackUrl).pathname;
1230
- if (urlPath && urlPath !== resolved.callbackPath) callbackPaths.add(urlPath);
1231
- } catch {}
1232
- };
1233
- const commandsRaw = mmConfig?.commands;
1234
- addCallbackPaths(commandsRaw);
1235
- const accountsRaw = mmConfig?.accounts ?? {};
1236
- for (const accountId of Object.keys(accountsRaw)) {
1237
- const accountCommandsRaw = accountsRaw[accountId]?.commands;
1238
- addCallbackPaths(accountCommandsRaw);
1239
- }
1240
1174
  const dispatchRoute = async (req, res, onRequestAuthenticated) => {
1241
1175
  if (accountStates.size === 0) {
1242
1176
  sendSlashCommandResponse(res, 503, {
@@ -1321,7 +1255,7 @@ function registerSlashCommandRoute(api) {
1321
1255
  release();
1322
1256
  }
1323
1257
  };
1324
- for (const callbackPath of callbackPaths) api.registerHttpRoute({
1258
+ for (const callbackPath of collectMattermostCallbackPaths(api.config.channels?.mattermost)) api.registerHttpRoute({
1325
1259
  path: callbackPath,
1326
1260
  auth: "plugin",
1327
1261
  handler: routeHandler
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as buildButtonAttachments } from "./.setup/interactions-DMSZYnEx.mjs";
1
+ import { t as buildButtonAttachments } from "./.setup/interactions-CfOLvzca.mjs";
2
2
  import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-aZ0b1gqx.mjs";
3
3
  export { buildButtonAttachments, isMattermostSenderAllowed };
@@ -1,3 +1,2 @@
1
- import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-B0CAMiHe.mjs";
2
- import { t as mattermostSetupPlugin } from "./.setup/channel-plugin-api-DXqHarCt.mjs";
1
+ import { n as mattermostSetupPlugin, t as mattermostPlugin } from "./.setup/channel-plugin-runtime-BsHE7a2R.mjs";
3
2
  export { mattermostPlugin, mattermostSetupPlugin };
@@ -1,2 +1,2 @@
1
- import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-B0CAMiHe.mjs";
1
+ import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-BsHE7a2R.mjs";
2
2
  export { mattermostPlugin };
@@ -1,2 +1,2 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-BI6SB2cd.mjs";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-CjgZkyPm.mjs";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,2 +1,2 @@
1
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-B93t91oq.mjs";
1
+ import { t as resolveMattermostGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-CfqoieHq.mjs";
2
2
  export { resolveMattermostGatewayAuthBypassPaths as resolveGatewayAuthBypassPaths };
@@ -1,3 +1,2 @@
1
1
  import { r as setMattermostRuntime } from "./.setup/runtime-CNB4YGqJ.mjs";
2
- import { createChannelMessageReplyPipeline } from "openclaw/plugin-sdk/channel-outbound";
3
- export { createChannelMessageReplyPipeline, setMattermostRuntime };
2
+ export { setMattermostRuntime };
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
4
4
  var setup_entry_default = defineBundledChannelSetupEntry({
5
5
  importMetaUrl: import.meta.url,
6
6
  plugin: {
7
- specifier: fileURLToPath(new URL(".setup/channel-plugin-api-Bc8Qc1-t.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/channel-plugin-api-Cg4FPSIP.mjs", import.meta.url).href),
8
8
  exportName: "mattermostSetupPlugin"
9
9
  },
10
10
  secrets: {
@@ -1,2 +1,2 @@
1
- import { i as registerSlashCommandRoute } from "./.setup/slash-state-Dni1XNc1.mjs";
1
+ import { i as registerSlashCommandRoute } from "./.setup/slash-state-BtvU3GNd.mjs";
2
2
  export { registerSlashCommandRoute };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.9.7",
3
+ "version": "2026.10.1-beta.1",
4
4
  "description": "OpenClaw Mattermost channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,7 @@
11
11
  "zod": "4.6.5"
12
12
  },
13
13
  "peerDependencies": {
14
- "openclaw": ">=2026.9.7"
14
+ "openclaw": ">=2026.10.1-beta.1"
15
15
  },
16
16
  "peerDependenciesMeta": {
17
17
  "openclaw": {
@@ -93,10 +93,10 @@
93
93
  "allowInvalidConfigRecovery": true
94
94
  },
95
95
  "compat": {
96
- "pluginApi": ">=2026.9.7"
96
+ "pluginApi": ">=2026.10.1-beta.1"
97
97
  },
98
98
  "build": {
99
- "openclawVersion": "2026.9.7",
99
+ "openclawVersion": "2026.10.1-beta.1",
100
100
  "bundledDist": false
101
101
  },
102
102
  "release": {
@@ -1,3 +0,0 @@
1
- import { t as mattermostPlugin } from "./channel-plugin-runtime-B0CAMiHe.mjs";
2
- import { t as mattermostSetupPlugin } from "./channel-plugin-api-DXqHarCt.mjs";
3
- export { mattermostPlugin, mattermostSetupPlugin };
@@ -1,40 +0,0 @@
1
- import { s as isMattermostConfigured } from "./normalize-BCjtmxtp.mjs";
2
- import { a as describeMattermostAccount, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as mattermostConfigAdapter, r as mattermostSetupContract, s as mattermostMeta } from "./channel-plugin-runtime-B0CAMiHe.mjs";
3
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.mjs";
4
- //#region extensions/mattermost/src/channel.setup.ts
5
- const mattermostSetupPlugin = {
6
- id: "mattermost",
7
- meta: { ...mattermostMeta },
8
- capabilities: {
9
- chatTypes: [
10
- "direct",
11
- "channel",
12
- "group",
13
- "thread"
14
- ],
15
- reactions: true,
16
- threads: true,
17
- media: true,
18
- nativeCommands: true
19
- },
20
- reload: {
21
- configPrefixes: ["channels.mattermost"],
22
- noopPrefixes: ["messages.inbound"],
23
- /**
24
- * accounts.default is promoted; named resolution merges only channel-wide fields
25
- * plus the selected account. Runtime monitor, debounce, and ingress use accountId.
26
- */
27
- accountScopedRestart: true
28
- },
29
- configSchema: MattermostChannelConfigSchema,
30
- config: {
31
- ...mattermostConfigAdapter,
32
- isConfigured: isMattermostConfigured,
33
- describeAccount: describeMattermostAccount
34
- },
35
- gateway: { resolveGatewayAuthBypassPaths: resolveMattermostGatewayAuthBypassPaths },
36
- setupContract: mattermostSetupContract,
37
- setupWizard: mattermostSetupWizard
38
- };
39
- //#endregion
40
- export { mattermostSetupPlugin as t };
@@ -1,36 +0,0 @@
1
- import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
- //#region extensions/mattermost/src/gateway-auth-bypass.ts
3
- const DEFAULT_SLASH_CALLBACK_PATH = "/api/channels/mattermost/command";
4
- function normalizeCallbackPath(value) {
5
- const trimmed = normalizeOptionalString(value);
6
- if (!trimmed) return DEFAULT_SLASH_CALLBACK_PATH;
7
- return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
8
- }
9
- function readMattermostCommands(value) {
10
- return asOptionalRecord(value);
11
- }
12
- function isMattermostBypassPath(path) {
13
- return path === DEFAULT_SLASH_CALLBACK_PATH || path.startsWith("/api/channels/mattermost/");
14
- }
15
- function collectMattermostSlashCallbackPaths(raw) {
16
- const paths = /* @__PURE__ */ new Set([normalizeCallbackPath(raw?.callbackPath)]);
17
- const callbackUrl = normalizeOptionalString(raw?.callbackUrl);
18
- if (callbackUrl) try {
19
- const pathname = new URL(callbackUrl).pathname;
20
- if (pathname) paths.add(pathname);
21
- } catch {}
22
- return [...paths];
23
- }
24
- function resolveMattermostGatewayAuthBypassPaths(params) {
25
- const channels = params.cfg.channels;
26
- const base = channels?.mattermost && typeof channels.mattermost === "object" ? channels.mattermost : void 0;
27
- const callbackPaths = new Set(collectMattermostSlashCallbackPaths(readMattermostCommands(base?.commands)).filter(isMattermostBypassPath));
28
- const accounts = base?.accounts ?? {};
29
- for (const account of Object.values(accounts)) {
30
- const accountConfig = account && typeof account === "object" && !Array.isArray(account) ? account : void 0;
31
- for (const path of collectMattermostSlashCallbackPaths(readMattermostCommands(accountConfig?.commands))) if (isMattermostBypassPath(path)) callbackPaths.add(path);
32
- }
33
- return [...callbackPaths];
34
- }
35
- //#endregion
36
- export { resolveMattermostGatewayAuthBypassPaths as t };