@openclaw/mattermost 2026.10.5-beta.3 → 2026.10.10-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,4 +1,4 @@
1
- import { h as normalizeMattermostBaseUrl } from "./client-tv20cXIL.mjs";
1
+ import { h as normalizeMattermostBaseUrl } from "./client-CW26CnSc.mjs";
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
4
  import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
@@ -0,0 +1,2 @@
1
+ export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-qg3NXRlS.mjs";
2
+ import "../secret-contract-api.js";
@@ -1,8 +1,8 @@
1
- import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-AdorvrsQ.mjs";
1
+ import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-D2MJ2Tnp.mjs";
2
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-tv20cXIL.mjs";
4
- import { o as resolveMattermostTrustedChatKind, v as loadOutboundMediaFromUrl } from "./monitor-auth-ChM45AzT.mjs";
5
- import { u as resolveMattermostAccount } from "./normalize-B0VHjEFE.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-CW26CnSc.mjs";
4
+ import { _ as loadOutboundMediaFromUrl, o as resolveMattermostTrustedChatKind } from "./monitor-auth-C5XBx6E0.mjs";
5
+ import { u as resolveMattermostAccount } from "./normalize-ttaISanW.mjs";
6
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
8
8
  import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
@@ -237,8 +237,7 @@ async function resolveTargetChannelId(params) {
237
237
  async function resolveMattermostSendContext(to, opts) {
238
238
  const core = getMattermostRuntime();
239
239
  const logger = core.logging.getChildLogger({ module: "mattermost" });
240
- if (!opts?.cfg) throw new Error("Mattermost send requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
241
- const cfg = requireRuntimeConfig(opts.cfg, "Mattermost send");
240
+ const cfg = requireRuntimeConfig(opts?.cfg, "Mattermost send");
242
241
  const account = resolveMattermostAccount({
243
242
  cfg,
244
243
  accountId: opts.accountId
@@ -1,24 +1,25 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
2
  import { n as normalizeCallbackPath, r as resolveCallbackHost, t as collectMattermostCallbackPaths } from "./callback-host-Bu2cmtfI.mjs";
3
- import { r as createMattermostClient, s as fetchMattermostChannel, v as sendMattermostTyping } from "./client-tv20cXIL.mjs";
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-ChM45AzT.mjs";
5
- import { a as resolveMattermostPresentation, i as requiresMattermostMediaUpload } from "./normalize-B0VHjEFE.mjs";
6
- import { t as sendMessageMattermost } from "./send-BAUVI-1U.mjs";
3
+ import { r as createMattermostClient, s as fetchMattermostChannel, v as sendMattermostTyping } from "./client-CW26CnSc.mjs";
4
+ import { D as sendHttpRequestRejection, h as isRequestBodyLimitError, i as normalizeMattermostAllowList, l as buildPreparedModelsProviderData, p as createWebhookInFlightLimiter, t as authorizeMattermostCommandInvocation, x as readRequestBodyWithLimit, y as logTypingFailure } from "./monitor-auth-C5XBx6E0.mjs";
5
+ import { a as resolveMattermostPresentation, i as requiresMattermostMediaUpload } from "./normalize-ttaISanW.mjs";
6
+ import { t as sendMessageMattermost } from "./send-BLBZqBzq.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
10
  import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
11
11
  import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
12
12
  import { createChannelDeliveryAccumulator } from "openclaw/plugin-sdk/channel-outbound";
13
- import { resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth-native";
13
+ import { resolveStoredModelOverrideAsync } from "openclaw/plugin-sdk/command-auth-native";
14
14
  import { deliverTextOrMediaReply, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
15
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";
19
- import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
20
19
  import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
20
+ import { getSessionEntryAsync, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
21
21
  import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
22
+ import { recordDeliveredCommandExchange } from "openclaw/plugin-sdk/session-transcript-runtime";
22
23
  const MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES = 128;
23
24
  /**
24
25
  * Built-in OpenClaw commands to register as native slash commands.
@@ -345,22 +346,22 @@ function buildMattermostAllowedModelRefs(data) {
345
346
  for (const provider of data.providers) for (const model of data.byProvider.get(provider) ?? []) refs.add(`${provider}/${model}`);
346
347
  return refs;
347
348
  }
348
- function resolveMattermostModelPickerCurrentModel(params) {
349
+ async function resolveMattermostModelPickerCurrentModel(params) {
349
350
  const fallback = `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
350
351
  try {
351
352
  const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
352
- const loadSessionEntry = (sessionKey) => getSessionEntry({
353
+ const loadSessionEntry = (sessionKey) => getSessionEntryAsync({
354
+ agentId: params.route.agentId,
353
355
  storePath,
354
- sessionKey,
355
- ...params.readConsistency === "latest" ? { readConsistency: "latest" } : {}
356
+ sessionKey
356
357
  });
357
- const sessionEntry = loadSessionEntry(params.route.sessionKey);
358
- const override = resolveStoredModelOverride({
358
+ const sessionEntry = params.sessionEntry;
359
+ const override = await resolveStoredModelOverrideAsync({
359
360
  sessionEntry,
360
- loadSessionEntry,
361
361
  sessionKey: params.route.sessionKey,
362
362
  parentSessionKey: sessionEntry?.parentSessionKey,
363
- defaultProvider: params.data.resolvedDefault.provider
363
+ defaultProvider: params.data.resolvedDefault.provider,
364
+ loadSessionEntry
364
365
  });
365
366
  if (!override?.model) return fallback;
366
367
  const provider = (override.provider || params.data.resolvedDefault.provider).trim();
@@ -520,6 +521,67 @@ async function deliverMattermostReplyPayload(params) {
520
521
  };
521
522
  }
522
523
  //#endregion
524
+ //#region extensions/mattermost/src/mattermost/slash-model-picker.ts
525
+ /** Returns whether the reply contains models, rather than an empty-catalog notice. */
526
+ async function deliverMattermostSlashModelPicker(params) {
527
+ const { cfg, route, accountId, channelId, senderId, commandText, messageSid, entry } = params;
528
+ const sessionEntry = await getSessionEntryAsync({
529
+ agentId: route.agentId,
530
+ storePath: resolveStorePath(cfg.session?.store, { agentId: route.agentId }),
531
+ sessionKey: route.sessionKey,
532
+ readConsistency: "latest"
533
+ });
534
+ const data = await buildPreparedModelsProviderData(cfg, route.agentId, { sessionEntry });
535
+ if (data.providers.length === 0) {
536
+ const delivered = await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, "No models available."].filter(Boolean).join("\n\n"), {
537
+ cfg,
538
+ accountId
539
+ });
540
+ await recordDeliveredCommandExchange({
541
+ config: cfg,
542
+ agentId: route.agentId,
543
+ sessionKey: route.sessionKey,
544
+ expectedSessionId: sessionEntry?.sessionId,
545
+ commandText,
546
+ commandId: `mattermost:${accountId}:${channelId}:${messageSid}`,
547
+ replyId: "model-picker",
548
+ replyText: delivered.content
549
+ });
550
+ return false;
551
+ }
552
+ const viewParams = {
553
+ ownerUserId: senderId,
554
+ data,
555
+ currentModel: await resolveMattermostModelPickerCurrentModel({
556
+ cfg,
557
+ route,
558
+ data,
559
+ sessionEntry
560
+ })
561
+ };
562
+ const view = entry.kind === "summary" ? renderMattermostModelSummaryView(viewParams) : entry.kind === "providers" ? renderMattermostProviderPickerView(viewParams) : renderMattermostModelsPickerView({
563
+ ...viewParams,
564
+ provider: entry.provider,
565
+ page: 1
566
+ });
567
+ const delivered = await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, view.text].filter(Boolean).join("\n\n"), {
568
+ cfg,
569
+ accountId,
570
+ buttons: view.buttons
571
+ });
572
+ await recordDeliveredCommandExchange({
573
+ config: cfg,
574
+ agentId: route.agentId,
575
+ sessionKey: route.sessionKey,
576
+ expectedSessionId: sessionEntry?.sessionId,
577
+ commandText,
578
+ commandId: `mattermost:${accountId}:${channelId}:${messageSid}`,
579
+ replyId: "model-picker",
580
+ replyText: [delivered.content, ...view.buttons.map((row) => row.map((button) => button.text).join(", "))].join("\n")
581
+ });
582
+ return true;
583
+ }
584
+ //#endregion
523
585
  //#region extensions/mattermost/src/mattermost/slash-http.ts
524
586
  const MAX_BODY_BYTES = 65536;
525
587
  const BODY_READ_TIMEOUT_MS = 5e3;
@@ -541,10 +603,26 @@ const SECRET_LOG_KEYS = /* @__PURE__ */ new Set([
541
603
  "refresh_token",
542
604
  "token"
543
605
  ]);
544
- function sendSlashCommandResponse(res, status, body) {
606
+ function sendSlashCommandResponse(res, status, text) {
545
607
  res.statusCode = status;
546
608
  res.setHeader("Content-Type", "application/json; charset=utf-8");
547
- res.end(JSON.stringify(body));
609
+ res.end(JSON.stringify({
610
+ response_type: "ephemeral",
611
+ text
612
+ }));
613
+ }
614
+ async function readSlashCommandBody(req, res, timeoutMs = BODY_READ_TIMEOUT_MS) {
615
+ try {
616
+ return await readRequestBodyWithLimit(req, {
617
+ maxBytes: MAX_BODY_BYTES,
618
+ timeoutMs,
619
+ destroyOnLimit: false
620
+ });
621
+ } catch (error) {
622
+ if (isRequestBodyLimitError(error, "REQUEST_BODY_TIMEOUT")) await sendHttpRequestRejection(req, res, 408, "Request body timeout");
623
+ else await sendHttpRequestRejection(req, res, 413, "Payload Too Large");
624
+ return;
625
+ }
548
626
  }
549
627
  function findRegisteredCommandForPayload(params) {
550
628
  const trigger = normalizeSlashCommandTrigger(params.payload.command);
@@ -747,10 +825,7 @@ async function authorizeSlashInvocation(params) {
747
825
  }
748
826
  if (!channelInfo) return {
749
827
  ok: false,
750
- denyResponse: {
751
- response_type: "ephemeral",
752
- text: "Temporary error: unable to determine channel type. Please try again."
753
- }
828
+ denyText: "Temporary error: unable to determine channel type. Please try again."
754
829
  };
755
830
  const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
756
831
  cfg,
@@ -782,22 +857,16 @@ async function authorizeSlashInvocation(params) {
782
857
  });
783
858
  return {
784
859
  ok: false,
785
- denyResponse: {
786
- response_type: "ephemeral",
787
- text: core.channel.pairing.buildPairingReply({
788
- channel: "mattermost",
789
- idLine: `Your Mattermost user id: ${senderId}`,
790
- code
791
- })
792
- }
860
+ denyText: core.channel.pairing.buildPairingReply({
861
+ channel: "mattermost",
862
+ idLine: `Your Mattermost user id: ${senderId}`,
863
+ code
864
+ })
793
865
  };
794
866
  }
795
867
  return {
796
868
  ok: false,
797
- denyResponse: {
798
- response_type: "ephemeral",
799
- 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."
800
- }
869
+ 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."
801
870
  };
802
871
  }
803
872
  return decision;
@@ -811,28 +880,11 @@ function createSlashCommandHttpHandler(params) {
811
880
  res.end("Method Not Allowed");
812
881
  return;
813
882
  }
814
- let body;
815
- try {
816
- body = bufferedBody ?? await readRequestBodyWithLimit(req, {
817
- maxBytes: MAX_BODY_BYTES,
818
- timeoutMs: bodyTimeoutMs ?? BODY_READ_TIMEOUT_MS,
819
- destroyOnLimit: false
820
- });
821
- } catch (error) {
822
- if (isRequestBodyLimitError(error, "REQUEST_BODY_TIMEOUT")) {
823
- await sendHttpRequestRejection(req, res, 408, "Request body timeout");
824
- return;
825
- }
826
- await sendHttpRequestRejection(req, res, 413, "Payload Too Large");
827
- return;
828
- }
829
- const contentType = req.headers["content-type"] ?? "";
830
- const payload = parseSlashCommandPayload(body, contentType);
883
+ const body = bufferedBody ?? await readSlashCommandBody(req, res, bodyTimeoutMs);
884
+ if (body === void 0) return;
885
+ const payload = parseSlashCommandPayload(body, req.headers["content-type"] ?? "");
831
886
  if (!payload) {
832
- sendSlashCommandResponse(res, 400, {
833
- response_type: "ephemeral",
834
- text: "Invalid slash command payload."
835
- });
887
+ sendSlashCommandResponse(res, 400, "Invalid slash command payload.");
836
888
  return;
837
889
  }
838
890
  const registeredCommand = findRegisteredCommandForPayload({
@@ -840,10 +892,7 @@ function createSlashCommandHttpHandler(params) {
840
892
  payload
841
893
  });
842
894
  if (!registeredCommand || !safeEqualSecret(payload.token, registeredCommand.token)) {
843
- sendSlashCommandResponse(res, 401, {
844
- response_type: "ephemeral",
845
- text: "Unauthorized: invalid command token."
846
- });
895
+ sendSlashCommandResponse(res, 401, "Unauthorized: invalid command token.");
847
896
  return;
848
897
  }
849
898
  const client = createMattermostClient({
@@ -858,10 +907,7 @@ function createSlashCommandHttpHandler(params) {
858
907
  payload,
859
908
  log
860
909
  })) {
861
- sendSlashCommandResponse(res, 401, {
862
- response_type: "ephemeral",
863
- text: "Unauthorized: invalid command token."
864
- });
910
+ sendSlashCommandResponse(res, 401, "Unauthorized: invalid command token.");
865
911
  return;
866
912
  }
867
913
  onRequestAuthenticated?.();
@@ -881,14 +927,11 @@ function createSlashCommandHttpHandler(params) {
881
927
  log
882
928
  });
883
929
  if (!auth.ok) {
884
- sendSlashCommandResponse(res, 200, auth.denyResponse);
930
+ sendSlashCommandResponse(res, 200, auth.denyText);
885
931
  return;
886
932
  }
887
933
  log?.(`mattermost: slash command /${sanitizeMattermostLogValue(trigger)} from ${sanitizeMattermostLogValue(senderName)} in ${sanitizeMattermostLogValue(channelId)}`);
888
- sendSlashCommandResponse(res, 200, {
889
- response_type: "ephemeral",
890
- text: "Processing..."
891
- });
934
+ sendSlashCommandResponse(res, 200, "Processing...");
892
935
  try {
893
936
  await handleSlashCommandAsync({
894
937
  account,
@@ -935,41 +978,19 @@ async function handleSlashCommandAsync(params) {
935
978
  });
936
979
  const fromLabel = kind === "direct" ? `Mattermost DM from ${senderName}` : `Mattermost message in ${roomLabel} from ${senderName}`;
937
980
  const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
981
+ const messageSid = triggerId ?? `slash-${Date.now()}`;
938
982
  const pickerEntry = resolveMattermostModelPickerEntry(commandText);
939
983
  if (pickerEntry) {
940
- const sessionEntry = getSessionEntry({
941
- storePath: resolveStorePath(cfg.session?.store, { agentId: route.agentId }),
942
- sessionKey: route.sessionKey,
943
- readConsistency: "latest"
944
- });
945
- const data = await buildPreparedModelsProviderData(cfg, route.agentId, { sessionEntry });
946
- if (data.providers.length === 0) {
947
- await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, "No models available."].filter(Boolean).join("\n\n"), {
948
- cfg,
949
- accountId: account.accountId
950
- });
951
- return;
952
- }
953
- const viewParams = {
954
- ownerUserId: senderId,
955
- data,
956
- currentModel: resolveMattermostModelPickerCurrentModel({
957
- cfg,
958
- route,
959
- data
960
- })
961
- };
962
- const view = pickerEntry.kind === "summary" ? renderMattermostModelSummaryView(viewParams) : pickerEntry.kind === "providers" ? renderMattermostProviderPickerView(viewParams) : renderMattermostModelsPickerView({
963
- ...viewParams,
964
- provider: pickerEntry.provider,
965
- page: 1
966
- });
967
- await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, view.text].filter(Boolean).join("\n\n"), {
984
+ if (await deliverMattermostSlashModelPicker({
968
985
  cfg,
986
+ route,
969
987
  accountId: account.accountId,
970
- buttons: view.buttons
971
- });
972
- runtime.log?.(`delivered model picker to ${to}`);
988
+ channelId,
989
+ senderId,
990
+ commandText,
991
+ messageSid,
992
+ entry: pickerEntry
993
+ })) runtime.log?.(`delivered model picker to ${to}`);
973
994
  return;
974
995
  }
975
996
  const ctxPayload = finalizeInboundContext({
@@ -991,7 +1012,7 @@ async function handleSlashCommandAsync(params) {
991
1012
  SenderId: senderId,
992
1013
  Provider: "mattermost",
993
1014
  Surface: "mattermost",
994
- MessageSid: triggerId ?? `slash-${Date.now()}`,
1015
+ MessageSid: messageSid,
995
1016
  Timestamp: Date.now(),
996
1017
  WasMentioned: true,
997
1018
  CommandAuthorized: commandAuthorized,
@@ -1054,8 +1075,6 @@ async function handleSlashCommandAsync(params) {
1054
1075
  }
1055
1076
  //#endregion
1056
1077
  //#region extensions/mattermost/src/mattermost/slash-state.ts
1057
- const MULTI_ACCOUNT_BODY_MAX_BYTES = 65536;
1058
- const MULTI_ACCOUNT_BODY_TIMEOUT_MS = 5e3;
1059
1078
  const slashRouteInFlightLimiter = createWebhookInFlightLimiter();
1060
1079
  const SLASH_ROUTE_IN_FLIGHT_KEY = "mattermost:slash";
1061
1080
  const SLASH_AUTHENTICATED_IN_FLIGHT_KEY = `${SLASH_ROUTE_IN_FLIGHT_KEY}:authenticated`;
@@ -1142,39 +1161,20 @@ function deactivateSlashCommands(accountId) {
1142
1161
  function registerSlashCommandRoute(api) {
1143
1162
  const dispatchRoute = async (req, res, onRequestAuthenticated) => {
1144
1163
  if (accountStates.size === 0) {
1145
- sendSlashCommandResponse(res, 503, {
1146
- response_type: "ephemeral",
1147
- text: "Slash commands are not yet initialized. Please try again in a moment."
1148
- });
1164
+ sendSlashCommandResponse(res, 503, "Slash commands are not yet initialized. Please try again in a moment.");
1149
1165
  return;
1150
1166
  }
1151
1167
  if (accountStates.size === 1) {
1152
1168
  const state = accountStates.values().next().value;
1153
1169
  if (!state?.handler) {
1154
- sendSlashCommandResponse(res, 503, {
1155
- response_type: "ephemeral",
1156
- text: "Slash commands are not yet initialized. Please try again in a moment."
1157
- });
1170
+ sendSlashCommandResponse(res, 503, "Slash commands are not yet initialized. Please try again in a moment.");
1158
1171
  return;
1159
1172
  }
1160
1173
  await state.handler(req, res, void 0, onRequestAuthenticated);
1161
1174
  return;
1162
1175
  }
1163
- let bodyStr;
1164
- try {
1165
- bodyStr = await readRequestBodyWithLimit(req, {
1166
- maxBytes: MULTI_ACCOUNT_BODY_MAX_BYTES,
1167
- timeoutMs: MULTI_ACCOUNT_BODY_TIMEOUT_MS,
1168
- destroyOnLimit: false
1169
- });
1170
- } catch (error) {
1171
- if (isRequestBodyLimitError(error, "REQUEST_BODY_TIMEOUT")) {
1172
- await sendHttpRequestRejection(req, res, 408, "Request body timeout");
1173
- return;
1174
- }
1175
- await sendHttpRequestRejection(req, res, 413, "Payload Too Large");
1176
- return;
1177
- }
1176
+ const bodyStr = await readSlashCommandBody(req, res);
1177
+ if (bodyStr === void 0) return;
1178
1178
  let token = null;
1179
1179
  const ct = req.headers["content-type"] ?? "";
1180
1180
  try {
@@ -1190,18 +1190,12 @@ function registerSlashCommandRoute(api) {
1190
1190
  });
1191
1191
  }
1192
1192
  if (match.kind === "none") {
1193
- sendSlashCommandResponse(res, 401, {
1194
- response_type: "ephemeral",
1195
- text: "Unauthorized: invalid command token."
1196
- });
1193
+ sendSlashCommandResponse(res, 401, "Unauthorized: invalid command token.");
1197
1194
  return;
1198
1195
  }
1199
1196
  if (match.kind === "ambiguous") {
1200
1197
  api.logger.warn?.(`mattermost: slash callback matched multiple accounts via ${match.source} (${match.accountIds.join(", ")})`);
1201
- sendSlashCommandResponse(res, 409, {
1202
- response_type: "ephemeral",
1203
- text: match.source === "token" ? "Conflict: command token is not unique across accounts." : "Conflict: slash command is not unique across accounts."
1204
- });
1198
+ sendSlashCommandResponse(res, 409, match.source === "token" ? "Conflict: command token is not unique across accounts." : "Conflict: slash command is not unique across accounts.");
1205
1199
  return;
1206
1200
  }
1207
1201
  await match.handler(req, res, bodyStr, onRequestAuthenticated);
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as buildButtonAttachments } from "./.setup/interactions-AdorvrsQ.mjs";
2
- import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-ChM45AzT.mjs";
1
+ import { t as buildButtonAttachments } from "./.setup/interactions-D2MJ2Tnp.mjs";
2
+ import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-C5XBx6E0.mjs";
3
3
  export { buildButtonAttachments, isMattermostSenderAllowed };
@@ -1,2 +1 @@
1
- import { n as mattermostSetupPlugin, t as mattermostPlugin } from "./.setup/channel-plugin-runtime-D-I6TTe4.mjs";
2
- export { mattermostPlugin, mattermostSetupPlugin };
1
+ export { t as mattermostPlugin, n as mattermostSetupPlugin } from "./.setup/channel-plugin-runtime-DQaQ8YVa.mjs";
@@ -1,2 +1 @@
1
- import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-D-I6TTe4.mjs";
2
- export { mattermostPlugin };
1
+ export { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-DQaQ8YVa.mjs";
@@ -1,2 +1 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-CjgZkyPm.mjs";
2
- export { legacyConfigRules, normalizeCompatibilityConfig };
1
+ export { t as legacyConfigRules, n as normalizeCompatibilityConfig } from "./.setup/doctor-contract-CjgZkyPm.mjs";
@@ -1,2 +1 @@
1
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-Lf99Gilr.mjs";
2
- export { resolveMattermostGatewayAuthBypassPaths as resolveGatewayAuthBypassPaths };
1
+ export { t as resolveGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-Lf99Gilr.mjs";
@@ -1,2 +1 @@
1
- import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-ChM45AzT.mjs";
2
- export { isMattermostSenderAllowed };
1
+ export { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-C5XBx6E0.mjs";
@@ -1,2 +1 @@
1
- import { r as setMattermostRuntime } from "./.setup/runtime-CNB4YGqJ.mjs";
2
- export { setMattermostRuntime };
1
+ export { r as setMattermostRuntime } from "./.setup/runtime-CNB4YGqJ.mjs";
@@ -1,2 +1 @@
1
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-qg3NXRlS.mjs";
2
- export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
1
+ export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./.setup/secret-contract-qg3NXRlS.mjs";
@@ -4,11 +4,11 @@ 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-DHjqj_yu.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/channel-plugin-api-wZzJEr0h.mjs", import.meta.url).href),
8
8
  exportName: "mattermostSetupPlugin"
9
9
  },
10
10
  secrets: {
11
- specifier: fileURLToPath(new URL(".setup/secret-contract-api-Drab0Nqx.mjs", import.meta.url).href),
11
+ specifier: fileURLToPath(new URL(".setup/secret-contract-api-ChqAE2v-.mjs", import.meta.url).href),
12
12
  exportName: "channelSecrets"
13
13
  }
14
14
  });
@@ -1,2 +1 @@
1
- import { i as registerSlashCommandRoute } from "./.setup/slash-state-CaHXPR0j.mjs";
2
- export { registerSlashCommandRoute };
1
+ export { i as registerSlashCommandRoute } from "./.setup/slash-state-D55i54L4.mjs";
@@ -1094,7 +1094,7 @@
1094
1094
  },
1095
1095
  "streaming.mode": {
1096
1096
  "label": "Mattermost Streaming Mode",
1097
- "help": "Canonical Mattermost preview mode: \"off\" | \"partial\" | \"block\" | \"progress\"."
1097
+ "help": "Mattermost preview mode: \"off\" | \"partial\" | \"block\" | \"progress\"."
1098
1098
  },
1099
1099
  "streaming.block.enabled": {
1100
1100
  "label": "Mattermost Block Streaming Enabled",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.10.5-beta.3",
3
+ "version": "2026.10.10-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.10.5-beta.3"
14
+ "openclaw": ">=2026.10.10-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.10.5-beta.3"
96
+ "pluginApi": ">=2026.10.10-beta.1"
97
97
  },
98
98
  "build": {
99
- "openclawVersion": "2026.10.5-beta.3",
99
+ "openclawVersion": "2026.10.10-beta.1",
100
100
  "bundledDist": false
101
101
  },
102
102
  "release": {
@@ -1,3 +0,0 @@
1
- import { n as mattermostSetupPlugin, t as mattermostPlugin } from "./channel-plugin-runtime-D-I6TTe4.mjs";
2
- import "../channel-plugin-api.js";
3
- export { mattermostPlugin, mattermostSetupPlugin };
@@ -1,3 +0,0 @@
1
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-qg3NXRlS.mjs";
2
- import "../secret-contract-api.js";
3
- export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };