@openclaw/mattermost 2026.9.1 → 2026.9.3
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/channel-plugin-api.js +2 -1
- package/dist/{channel-plugin-runtime-C6tfh14W.js → channel-plugin-runtime-C4u91PKh.js} +5 -1
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-CdT1mcEl.js → channel.runtime-CGEfnc2y.js} +80 -59
- package/dist/slash-route-api.js +1 -1
- package/dist/{slash-state-njvQCdwt.js → slash-state-BjBTvP7u.js} +62 -104
- package/openclaw.plugin.json +3 -2
- package/package.json +7 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as isMattermostConfigured } from "./normalize-R-ATEEHC.js";
|
|
2
|
-
import { a as describeMattermostAccount, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as mattermostConfigAdapter, r as mattermostSetupContract, s as mattermostMeta, t as mattermostPlugin } from "./channel-plugin-runtime-
|
|
2
|
+
import { a as describeMattermostAccount, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as mattermostConfigAdapter, r as mattermostSetupContract, s as mattermostMeta, t as mattermostPlugin } from "./channel-plugin-runtime-C4u91PKh.js";
|
|
3
3
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
|
|
4
4
|
//#region extensions/mattermost/src/channel.setup.ts
|
|
5
5
|
const mattermostSetupPlugin = {
|
|
@@ -19,6 +19,7 @@ const mattermostSetupPlugin = {
|
|
|
19
19
|
},
|
|
20
20
|
reload: {
|
|
21
21
|
configPrefixes: ["channels.mattermost"],
|
|
22
|
+
noopPrefixes: ["messages.inbound"],
|
|
22
23
|
/**
|
|
23
24
|
* accounts.default is promoted; named resolution merges only channel-wide fields
|
|
24
25
|
* plus the selected account. Runtime monitor, debounce, and ingress use accountId.
|
|
@@ -431,7 +431,10 @@ function applyMattermostSetupConfigPatch(params) {
|
|
|
431
431
|
patch: params.patch
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
+
const accountCredentialKeys = ["botToken", "baseUrl"];
|
|
434
435
|
const mattermostSetupAdapter = {
|
|
436
|
+
singleAccountKeysToMove: accountCredentialKeys,
|
|
437
|
+
namedAccountPromotionKeys: accountCredentialKeys,
|
|
435
438
|
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
436
439
|
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
437
440
|
cfg,
|
|
@@ -594,7 +597,7 @@ const mattermostSetupWizard = {
|
|
|
594
597
|
};
|
|
595
598
|
//#endregion
|
|
596
599
|
//#region extensions/mattermost/src/channel.ts
|
|
597
|
-
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
600
|
+
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-CGEfnc2y.js"));
|
|
598
601
|
const MATTERMOST_PRESENTATION_CAPABILITIES = {
|
|
599
602
|
supported: true,
|
|
600
603
|
buttons: true,
|
|
@@ -1031,6 +1034,7 @@ const mattermostPlugin = createChatChannelPlugin({
|
|
|
1031
1034
|
} },
|
|
1032
1035
|
reload: {
|
|
1033
1036
|
configPrefixes: ["channels.mattermost"],
|
|
1037
|
+
noopPrefixes: ["messages.inbound"],
|
|
1034
1038
|
/**
|
|
1035
1039
|
* accounts.default is promoted; named resolution merges only channel-wide fields
|
|
1036
1040
|
* plus the selected account. Monitor debounce and durable ingress use accountId.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mattermostPlugin } from "./channel-plugin-runtime-
|
|
1
|
+
import { t as mattermostPlugin } from "./channel-plugin-runtime-C4u91PKh.js";
|
|
2
2
|
export { mattermostPlugin };
|
|
@@ -4,12 +4,13 @@ import { _ as sendMattermostTyping, a as createMattermostPost, d as fetchMatterm
|
|
|
4
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
5
|
import { n as normalizeMattermostAllowEntry } from "./ingress-identity-DNl4yQSc.js";
|
|
6
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-
|
|
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-BjBTvP7u.js";
|
|
8
|
+
import { createRequire } from "node:module";
|
|
8
9
|
import { randomUUID } from "node:crypto";
|
|
9
10
|
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
10
11
|
import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
|
|
11
12
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
|
-
import { buildChannelInboundMediaPayload, createChannelPartialDeliveryError, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, implicitMentionKindWhen, isChannelPartialDeliveryError, resolveInboundMentionDecision, resolveInboundSessionEnvelopeContext, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
13
|
+
import { buildChannelInboundMediaPayload, createAcceptedChannelDeliveryResult, createChannelPartialDeliveryError, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, implicitMentionKindWhen, isChannelPartialDeliveryError, resolveInboundMentionDecision, resolveInboundSessionEnvelopeContext, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
13
14
|
import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
14
15
|
import { safeParseJsonWithSchema, safeParseWithSchema } from "openclaw/plugin-sdk/extension-shared";
|
|
15
16
|
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -21,6 +22,7 @@ import { resolveAllowlistProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/
|
|
|
21
22
|
import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
|
|
22
23
|
import { runDetachedWebhookWork } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
23
24
|
import { fanInChannelIngressLifecycles, resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
25
|
+
import { resolveChannelGroups, resolveChannelGroupsConfigPath } from "openclaw/plugin-sdk/channel-policy";
|
|
24
26
|
import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsSupplement, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
25
27
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
26
28
|
import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
@@ -30,8 +32,9 @@ import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
|
30
32
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
|
|
31
33
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
32
34
|
import { channelReadyPatch, isLoopbackHost } from "openclaw/plugin-sdk/gateway-runtime";
|
|
35
|
+
import { createRuntimeConfigReader } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
33
36
|
import { captureWsEvent, createDebugProxyWebSocketAgent, resolveDebugProxySettings } from "openclaw/plugin-sdk/proxy-capture";
|
|
34
|
-
import
|
|
37
|
+
import path from "node:path";
|
|
35
38
|
import { resolveChannelContextVisibilityMode, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
36
39
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
37
40
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
@@ -214,6 +217,10 @@ function shouldDropEmptyMattermostBody(params) {
|
|
|
214
217
|
return !botUsername || normalizeLowercaseStringOrEmpty(bareMention ?? "") !== `@${botUsername}`;
|
|
215
218
|
}
|
|
216
219
|
//#endregion
|
|
220
|
+
//#region extensions/mattermost/src/mattermost/ws-runtime.ts
|
|
221
|
+
const require = createRequire(import.meta.url);
|
|
222
|
+
const WebSocket = require(path.join(path.dirname(require.resolve("ws/package.json")), "index.js"));
|
|
223
|
+
//#endregion
|
|
217
224
|
//#region extensions/mattermost/src/mattermost/monitor-websocket.ts
|
|
218
225
|
const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16777216;
|
|
219
226
|
const MATTERMOST_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
@@ -686,7 +693,7 @@ function formatMattermostNoVisibleReplyLog(params) {
|
|
|
686
693
|
//#endregion
|
|
687
694
|
//#region extensions/mattermost/src/mattermost/monitor-context.ts
|
|
688
695
|
function shouldUpdateMattermostDraftToolProgress(account) {
|
|
689
|
-
return account.streamingMode !== "off" && resolveChannelStreamingPreviewToolProgress(account.config,
|
|
696
|
+
return account.streamingMode !== "off" && resolveChannelStreamingPreviewToolProgress(account.config, account.streamingMode !== "progress", account.streamingMode);
|
|
690
697
|
}
|
|
691
698
|
function shouldSuppressMattermostDefaultToolProgressMessages(account) {
|
|
692
699
|
return account.streamingMode !== "off";
|
|
@@ -1345,7 +1352,6 @@ function createMattermostMonitorResources(params) {
|
|
|
1345
1352
|
return info;
|
|
1346
1353
|
} catch (err) {
|
|
1347
1354
|
logger.debug?.(`mattermost: channel lookup failed: ${String(err)}`);
|
|
1348
|
-
setCachedValue(channelCache, channelId, null, CHANNEL_CACHE_TTL_MS, rawNow);
|
|
1349
1355
|
return null;
|
|
1350
1356
|
}
|
|
1351
1357
|
};
|
|
@@ -1359,7 +1365,6 @@ function createMattermostMonitorResources(params) {
|
|
|
1359
1365
|
return info;
|
|
1360
1366
|
} catch (err) {
|
|
1361
1367
|
logger.debug?.(`mattermost: user lookup failed: ${String(err)}`);
|
|
1362
|
-
setCachedValue(userCache, userId, null, USER_CACHE_TTL_MS, rawNow);
|
|
1363
1368
|
return null;
|
|
1364
1369
|
}
|
|
1365
1370
|
};
|
|
@@ -1616,6 +1621,20 @@ function createMattermostDraftStream(params) {
|
|
|
1616
1621
|
await clearWithStop(discardPending);
|
|
1617
1622
|
assertNoAcceptedDeliveryFailure();
|
|
1618
1623
|
};
|
|
1624
|
+
const deleteCurrentMessage = async () => {
|
|
1625
|
+
assertNoAcceptedDeliveryFailure();
|
|
1626
|
+
await clearWithStop(async () => {
|
|
1627
|
+
loop.resetPending();
|
|
1628
|
+
await loop.waitForInFlight();
|
|
1629
|
+
await currentGeneration.ready;
|
|
1630
|
+
assertNoAcceptedDeliveryFailure();
|
|
1631
|
+
currentGeneration.lastSentText = "";
|
|
1632
|
+
currentGeneration.latestSourceText = "";
|
|
1633
|
+
currentGeneration.latestAssistantText = void 0;
|
|
1634
|
+
loop.resetThrottleWindow();
|
|
1635
|
+
});
|
|
1636
|
+
assertNoAcceptedDeliveryFailure();
|
|
1637
|
+
};
|
|
1619
1638
|
const seal = async () => {
|
|
1620
1639
|
assertNoAcceptedDeliveryFailure();
|
|
1621
1640
|
await sealLifecycle();
|
|
@@ -1689,6 +1708,7 @@ function createMattermostDraftStream(params) {
|
|
|
1689
1708
|
flush,
|
|
1690
1709
|
postId: () => currentGeneration.postId,
|
|
1691
1710
|
clear,
|
|
1711
|
+
deleteCurrentMessage,
|
|
1692
1712
|
discardPending,
|
|
1693
1713
|
seal,
|
|
1694
1714
|
stop,
|
|
@@ -1702,16 +1722,12 @@ function createMattermostDraftStream(params) {
|
|
|
1702
1722
|
function combineMattermostVisibleDeliveryResults(results) {
|
|
1703
1723
|
const visibleResults = results.filter((result) => result?.visibleReplySent === true);
|
|
1704
1724
|
if (visibleResults.length === 0) return;
|
|
1705
|
-
const receiptResults = [];
|
|
1706
|
-
for (const result of visibleResults) if (result.receipt) receiptResults.push({ receipt: result.receipt });
|
|
1707
|
-
else receiptResults.push(...(result.messageIds ?? []).map((messageId) => ({ messageId })));
|
|
1708
|
-
const receipt = createMessageReceiptFromOutboundResults({ results: receiptResults });
|
|
1709
1725
|
return {
|
|
1710
1726
|
outcome: visibleResults.some((result) => result.outcome === "media") ? "media" : "text",
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1727
|
+
...createAcceptedChannelDeliveryResult({
|
|
1728
|
+
deliveryResults: visibleResults,
|
|
1729
|
+
content: joinMattermostVisibleContent(visibleResults.map((result) => result.content))
|
|
1730
|
+
})
|
|
1715
1731
|
};
|
|
1716
1732
|
}
|
|
1717
1733
|
async function deliverMattermostReplyWithDraftPreview(params) {
|
|
@@ -1811,26 +1827,16 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1811
1827
|
normalDeliveryResult
|
|
1812
1828
|
]) ?? previewDeliveryResult;
|
|
1813
1829
|
} catch (error) {
|
|
1814
|
-
const completedVisibleResults = [
|
|
1815
|
-
const completedReceiptResults = [];
|
|
1816
|
-
for (const result of [
|
|
1830
|
+
const completedVisibleResults = [
|
|
1817
1831
|
confirmedPreviewDelivery,
|
|
1818
1832
|
previewDeliveryResult,
|
|
1819
1833
|
normalDeliveryResult,
|
|
1820
1834
|
supplementalDeliveryResult
|
|
1821
|
-
])
|
|
1822
|
-
if (result?.visibleReplySent !== true) continue;
|
|
1823
|
-
completedVisibleResults.push(result);
|
|
1824
|
-
if (result.receipt) completedReceiptResults.push({ receipt: result.receipt });
|
|
1825
|
-
else completedReceiptResults.push(...(result.messageIds ?? []).map((messageId) => ({ messageId })));
|
|
1826
|
-
}
|
|
1835
|
+
].filter((result) => result?.visibleReplySent === true);
|
|
1827
1836
|
if (completedVisibleResults.length === 0) throw error;
|
|
1828
1837
|
const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
1832
|
-
receipt,
|
|
1833
|
-
visibleReplySent: true,
|
|
1838
|
+
throw createChannelPartialDeliveryError(error, createAcceptedChannelDeliveryResult({
|
|
1839
|
+
deliveryResults: [...completedVisibleResults, ...failedPartial ? [failedPartial] : []],
|
|
1834
1840
|
content: joinMattermostVisibleContent([
|
|
1835
1841
|
confirmedPreviewDelivery?.content,
|
|
1836
1842
|
previewDeliveryResult?.content,
|
|
@@ -1838,7 +1844,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1838
1844
|
supplementalDeliveryResult?.content,
|
|
1839
1845
|
failedPartial?.content
|
|
1840
1846
|
])
|
|
1841
|
-
});
|
|
1847
|
+
}));
|
|
1842
1848
|
}
|
|
1843
1849
|
}
|
|
1844
1850
|
//#endregion
|
|
@@ -1879,6 +1885,7 @@ function createDisabledMattermostDraftStream() {
|
|
|
1879
1885
|
flush: noopAsync,
|
|
1880
1886
|
postId: () => void 0,
|
|
1881
1887
|
clear: noopAsync,
|
|
1888
|
+
deleteCurrentMessage: noopAsync,
|
|
1882
1889
|
discardPending: noopAsync,
|
|
1883
1890
|
seal: noopAsync,
|
|
1884
1891
|
stop: noopAsync,
|
|
@@ -1907,7 +1914,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1907
1914
|
});
|
|
1908
1915
|
const hookRunner = getGlobalHookRunner();
|
|
1909
1916
|
const draftPreviewEnabled = !((hookRunner?.hasHooks("reply_payload_sending") ?? false) || (hookRunner?.hasHooks("message_sending") ?? false)) && account.streamingMode !== "off";
|
|
1910
|
-
const
|
|
1917
|
+
const draftProgressEnabled = draftPreviewEnabled && (account.streamingMode === "progress" || shouldUpdateMattermostDraftToolProgress(account));
|
|
1911
1918
|
const suppressDefaultToolProgressMessages = draftPreviewEnabled && shouldSuppressMattermostDefaultToolProgressMessages(account);
|
|
1912
1919
|
const draftStream = draftPreviewEnabled ? createMattermostDraftStream({
|
|
1913
1920
|
client,
|
|
@@ -1935,10 +1942,12 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1935
1942
|
mode: account.streamingMode,
|
|
1936
1943
|
active: draftPreviewEnabled,
|
|
1937
1944
|
seed: `${account.accountId}:${channelId}`,
|
|
1945
|
+
shouldStartNow: (line) => typeof line === "object" && line.kind === "item",
|
|
1938
1946
|
update: async (previewText, options) => {
|
|
1939
1947
|
draftStream.update(previewText);
|
|
1940
1948
|
if (options?.flush) await draftStream.flush();
|
|
1941
|
-
}
|
|
1949
|
+
},
|
|
1950
|
+
deleteCurrent: () => draftStream.deleteCurrentMessage()
|
|
1942
1951
|
});
|
|
1943
1952
|
const enterBlockPreviewActivity = (activity) => {
|
|
1944
1953
|
if (account.streamingMode !== "block") return;
|
|
@@ -1946,7 +1955,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1946
1955
|
const startsNewGeneration = !continuesCurrentActivity && blockPreviewActivity !== "reasoning";
|
|
1947
1956
|
if (startsNewGeneration) currentAssistantPreviewUsesPrefix = false;
|
|
1948
1957
|
const boundarySettled = startsNewGeneration ? previewBoundaryController.noteBoundary() : void 0;
|
|
1949
|
-
if (!continuesCurrentActivity) progressDraft.
|
|
1958
|
+
if (!continuesCurrentActivity) progressDraft.resetActivity();
|
|
1950
1959
|
blockPreviewActivity = activity;
|
|
1951
1960
|
blockPreviewAssistantMessagePending = false;
|
|
1952
1961
|
if (activity === "tool") lastPartialText = "";
|
|
@@ -2005,6 +2014,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2005
2014
|
if (!cleaned || cleaned === lastPartialText) return;
|
|
2006
2015
|
if (lastPartialText && lastPartialText.startsWith(cleaned) && cleaned.length < lastPartialText.length) return;
|
|
2007
2016
|
const boundarySettled = enterBlockPreviewActivity("text");
|
|
2017
|
+
progressDraft.resetActivity({ suppressed: true });
|
|
2008
2018
|
lastPartialText = cleaned;
|
|
2009
2019
|
if (firstAssistantPreviewPrefixPending) {
|
|
2010
2020
|
firstAssistantPreviewPrefix = resolveResponsePrefix?.();
|
|
@@ -2155,27 +2165,25 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2155
2165
|
delivery,
|
|
2156
2166
|
replyOptions: {
|
|
2157
2167
|
...turnAdoptionLifecycle ? bindIngressLifecycleToReplyOptions(turnAdoptionLifecycle) : {},
|
|
2158
|
-
allowProgressCallbacksWhenSourceDeliverySuppressed:
|
|
2168
|
+
allowProgressCallbacksWhenSourceDeliverySuppressed: draftProgressEnabled ? true : void 0,
|
|
2159
2169
|
preserveProgressCallbackStartOrder: draftPreviewEnabled ? true : void 0,
|
|
2160
|
-
onObservedReplyDelivery:
|
|
2170
|
+
onObservedReplyDelivery: draftProgressEnabled ? () => draftStream.clear() : void 0,
|
|
2161
2171
|
disableBlockStreaming: draftPreviewEnabled ? true : replyOptions.disableBlockStreaming,
|
|
2162
2172
|
...suppressDefaultToolProgressMessages ? { suppressDefaultToolProgressMessages: true } : {},
|
|
2163
2173
|
onModelSelected,
|
|
2164
2174
|
onPartialReply: (payloadResult) => account.streamingMode === "progress" ? false : updateDraftFromPartial(payloadResult.text),
|
|
2165
2175
|
onAssistantMessageStart: () => {
|
|
2166
2176
|
lastPartialText = "";
|
|
2167
|
-
progressDraft.
|
|
2177
|
+
progressDraft.beginAssistantMessage();
|
|
2168
2178
|
if (account.streamingMode === "block") {
|
|
2169
2179
|
blockPreviewAssistantMessagePending = true;
|
|
2170
2180
|
return false;
|
|
2171
2181
|
}
|
|
2172
|
-
if (account.streamingMode !== "progress") progressDraft.reset();
|
|
2173
2182
|
return false;
|
|
2174
2183
|
},
|
|
2175
2184
|
onReasoningEnd: () => {
|
|
2176
2185
|
lastPartialText = "";
|
|
2177
2186
|
progressDraft.resetReasoningProgress();
|
|
2178
|
-
if (account.streamingMode !== "block" && account.streamingMode !== "progress") progressDraft.reset();
|
|
2179
2187
|
return false;
|
|
2180
2188
|
},
|
|
2181
2189
|
onReasoningStream: async (payloadResult) => {
|
|
@@ -2188,8 +2196,16 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2188
2196
|
}
|
|
2189
2197
|
return false;
|
|
2190
2198
|
},
|
|
2199
|
+
onPlanUpdate: async (payloadValue) => {
|
|
2200
|
+
if (!draftProgressEnabled || payloadValue.phase !== "update") return false;
|
|
2201
|
+
const boundarySettled = enterBlockPreviewActivity("tool");
|
|
2202
|
+
const progressSettled = progressDraft.pushPlanProgress(payloadValue.steps, { explanation: payloadValue.explanation });
|
|
2203
|
+
previewBoundaryController.noteUpdate();
|
|
2204
|
+
const [, visible] = await Promise.all([boundarySettled, progressSettled]);
|
|
2205
|
+
return visible;
|
|
2206
|
+
},
|
|
2191
2207
|
onToolStart: async (payloadValue) => {
|
|
2192
|
-
if (!
|
|
2208
|
+
if (!draftProgressEnabled) return false;
|
|
2193
2209
|
const boundarySettled = enterBlockPreviewActivity("tool");
|
|
2194
2210
|
const progressSettled = progressDraft.pushToolProgress(buildChannelProgressDraftLineForEntry(account.config, {
|
|
2195
2211
|
event: "tool",
|
|
@@ -2204,20 +2220,9 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2204
2220
|
return visible;
|
|
2205
2221
|
},
|
|
2206
2222
|
onItemEvent: async (payloadLocal) => {
|
|
2207
|
-
if (!
|
|
2223
|
+
if (!draftProgressEnabled) return false;
|
|
2208
2224
|
const boundarySettled = enterBlockPreviewActivity("tool");
|
|
2209
|
-
const progressSettled = progressDraft.
|
|
2210
|
-
event: "item",
|
|
2211
|
-
itemId: payloadLocal.itemId,
|
|
2212
|
-
itemKind: payloadLocal.kind,
|
|
2213
|
-
title: payloadLocal.title,
|
|
2214
|
-
name: payloadLocal.name,
|
|
2215
|
-
phase: payloadLocal.phase,
|
|
2216
|
-
status: payloadLocal.status,
|
|
2217
|
-
summary: payloadLocal.summary,
|
|
2218
|
-
progressText: payloadLocal.progressText,
|
|
2219
|
-
meta: payloadLocal.meta
|
|
2220
|
-
}), { startImmediately: true });
|
|
2225
|
+
const progressSettled = progressDraft.pushItemEvent(payloadLocal);
|
|
2221
2226
|
previewBoundaryController.noteUpdate();
|
|
2222
2227
|
const [, visible] = await Promise.all([boundarySettled, progressSettled]);
|
|
2223
2228
|
return visible;
|
|
@@ -2238,6 +2243,12 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2238
2243
|
//#region extensions/mattermost/src/mattermost/monitor-posts.ts
|
|
2239
2244
|
function createMattermostPostHandler(monitor) {
|
|
2240
2245
|
const { account, botUserId, botUsername, cfg, core, groupPolicy, pairing, resources } = monitor;
|
|
2246
|
+
const groupsConfigPath = resolveChannelGroupsConfigPath({
|
|
2247
|
+
cfg,
|
|
2248
|
+
channel: "mattermost",
|
|
2249
|
+
accountId: account.accountId,
|
|
2250
|
+
groups: resolveChannelGroups(cfg, "mattermost", account.accountId)
|
|
2251
|
+
});
|
|
2241
2252
|
const { resolveMattermostMedia, resolveUserInfo } = resources;
|
|
2242
2253
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
2243
2254
|
const historyLimit = Math.max(0, account.config.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
@@ -2277,6 +2288,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2277
2288
|
const senderName = normalizeOptionalString(payload.data?.sender_name) ?? normalizeOptionalString((await resolveUserInfo(senderId))?.username) ?? senderId;
|
|
2278
2289
|
const rawPostText = typeof post.message === "string" ? post.message : "";
|
|
2279
2290
|
const rawText = normalizeOptionalString(rawPostText) ?? "";
|
|
2291
|
+
const commandBody = normalizeMention(rawText, botUsername).trim();
|
|
2280
2292
|
const { effectiveReplyToId, sessionKey } = thread;
|
|
2281
2293
|
const { envelopeOptions, previousTimestamp } = resolveInboundSessionEnvelopeContext({
|
|
2282
2294
|
cfg,
|
|
@@ -2310,7 +2322,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2310
2322
|
cfg,
|
|
2311
2323
|
surface: "mattermost"
|
|
2312
2324
|
});
|
|
2313
|
-
const isControlCommand = allowTextCommands && core.channel.commands.isControlCommandMessage(
|
|
2325
|
+
const isControlCommand = allowTextCommands && core.channel.commands.isControlCommandMessage(commandBody, cfg);
|
|
2314
2326
|
const accessDecision = await resolveMattermostMonitorInboundAccess({
|
|
2315
2327
|
account,
|
|
2316
2328
|
cfg,
|
|
@@ -2434,7 +2446,14 @@ function createMattermostPostHandler(monitor) {
|
|
|
2434
2446
|
return;
|
|
2435
2447
|
}
|
|
2436
2448
|
if (mentionDecision.shouldSkip) {
|
|
2437
|
-
|
|
2449
|
+
logInboundDrop({
|
|
2450
|
+
log: monitor.runtime.log,
|
|
2451
|
+
channel: "mattermost",
|
|
2452
|
+
reason: "no mention",
|
|
2453
|
+
target: channelId,
|
|
2454
|
+
onceKey: JSON.stringify([account.accountId, channelId]),
|
|
2455
|
+
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.`
|
|
2456
|
+
});
|
|
2438
2457
|
recordPendingHistory();
|
|
2439
2458
|
return;
|
|
2440
2459
|
}
|
|
@@ -2494,7 +2513,6 @@ function createMattermostPostHandler(monitor) {
|
|
|
2494
2513
|
envelope: envelopeOptions
|
|
2495
2514
|
})
|
|
2496
2515
|
});
|
|
2497
|
-
const commandBody = rawText.trim();
|
|
2498
2516
|
const inboundHistory = historyKey && historyLimit > 0 ? createChannelHistoryWindow({ historyMap: channelHistories }).buildInboundHistory({
|
|
2499
2517
|
historyKey,
|
|
2500
2518
|
limit: historyLimit
|
|
@@ -2811,6 +2829,11 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2811
2829
|
}
|
|
2812
2830
|
};
|
|
2813
2831
|
const cfg = opts.config ?? core.config.current();
|
|
2832
|
+
const readConfig = createRuntimeConfigReader(cfg);
|
|
2833
|
+
const resolveDebounceMs = () => core.channel.debounce.resolveInboundDebounceMs({
|
|
2834
|
+
cfg: readConfig(),
|
|
2835
|
+
channel: "mattermost"
|
|
2836
|
+
});
|
|
2814
2837
|
const account = resolveMattermostAccount({
|
|
2815
2838
|
cfg,
|
|
2816
2839
|
accountId: opts.accountId
|
|
@@ -2928,10 +2951,8 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2928
2951
|
const handlePost = createMattermostPostHandler(monitor);
|
|
2929
2952
|
const handleReactionEvent = createMattermostReactionHandler(monitor);
|
|
2930
2953
|
const debouncer = core.channel.debounce.createInboundDebouncer({
|
|
2931
|
-
debounceMs:
|
|
2932
|
-
|
|
2933
|
-
channel: "mattermost"
|
|
2934
|
-
}),
|
|
2954
|
+
debounceMs: resolveDebounceMs(),
|
|
2955
|
+
resolveDebounceMs,
|
|
2935
2956
|
buildKey: (entry) => {
|
|
2936
2957
|
const channelId = entry.post.channel_id ?? entry.payload.data?.channel_id ?? entry.payload.broadcast?.channel_id;
|
|
2937
2958
|
if (!channelId || !entry.post.user_id) return null;
|
|
@@ -2941,7 +2962,7 @@ async function monitorMattermostProvider(opts = {}) {
|
|
|
2941
2962
|
shouldDebounce: (entry) => {
|
|
2942
2963
|
if (normalizeOptionalString(entry.post.type) !== void 0 || entry.post.file_ids?.length) return false;
|
|
2943
2964
|
const text = normalizeOptionalString(entry.post.message) ?? "";
|
|
2944
|
-
return Boolean(text) && !core.channel.commands.isControlCommandMessage(text, cfg);
|
|
2965
|
+
return Boolean(text) && !core.channel.commands.isControlCommandMessage(normalizeMention(text, botUsername), cfg);
|
|
2945
2966
|
},
|
|
2946
2967
|
onFlush: (entries, createFlush) => {
|
|
2947
2968
|
const last = entries.at(-1);
|
package/dist/slash-route-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as registerSlashCommandRoute } from "./slash-state-
|
|
1
|
+
import { i as registerSlashCommandRoute } from "./slash-state-BjBTvP7u.js";
|
|
2
2
|
export { registerSlashCommandRoute };
|
|
@@ -6,7 +6,7 @@ import { i as resolveMattermostPresentation, l as resolveMattermostAccount, r as
|
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
8
8
|
import { asFiniteNumber, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import { createChannelPartialDeliveryError, isChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
9
|
+
import { createAcceptedChannelDeliveryResult, createChannelPartialDeliveryError, isChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
10
10
|
import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
11
11
|
import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
12
12
|
import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -650,34 +650,27 @@ async function deliverMattermostReplyPayload(params) {
|
|
|
650
650
|
} catch (error) {
|
|
651
651
|
const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
|
|
652
652
|
if (results.length === 0 && failedPartial?.visibleReplySent !== true) throw error;
|
|
653
|
-
|
|
654
|
-
results:
|
|
653
|
+
throw createChannelPartialDeliveryError(error, createAcceptedChannelDeliveryResult({
|
|
654
|
+
results: results.map((result) => ({ receipt: result.receipt })),
|
|
655
|
+
deliveryResults: failedPartial ? [failedPartial] : [],
|
|
655
656
|
kind: reply.mediaUrls.length > 0 ? "media" : "text",
|
|
656
|
-
...params.replyToId ? { replyToId: params.replyToId } : {}
|
|
657
|
-
});
|
|
658
|
-
throw createChannelPartialDeliveryError(error, {
|
|
659
|
-
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
660
|
-
receipt,
|
|
661
|
-
visibleReplySent: true,
|
|
657
|
+
...params.replyToId ? { replyToId: params.replyToId } : {},
|
|
662
658
|
content: joinMattermostVisibleContent([...acceptedContents, failedPartial?.content])
|
|
663
|
-
});
|
|
659
|
+
}));
|
|
664
660
|
}
|
|
665
661
|
if (outcome === "empty") return {
|
|
666
662
|
outcome,
|
|
667
663
|
visibleReplySent: false,
|
|
668
664
|
suppression: { reason: "no_visible_result" }
|
|
669
665
|
};
|
|
670
|
-
const receipt = createMessageReceiptFromOutboundResults({
|
|
671
|
-
results: results.map((result) => ({ receipt: result.receipt })),
|
|
672
|
-
kind: outcome,
|
|
673
|
-
...params.replyToId ? { replyToId: params.replyToId } : {}
|
|
674
|
-
});
|
|
675
666
|
return {
|
|
676
667
|
outcome,
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
668
|
+
...createAcceptedChannelDeliveryResult({
|
|
669
|
+
results: results.map((result) => ({ receipt: result.receipt })),
|
|
670
|
+
kind: outcome,
|
|
671
|
+
...params.replyToId ? { replyToId: params.replyToId } : {},
|
|
672
|
+
content: joinMattermostVisibleContent(acceptedContents)
|
|
673
|
+
})
|
|
681
674
|
};
|
|
682
675
|
}
|
|
683
676
|
//#endregion
|
|
@@ -781,26 +774,30 @@ function isExplicitMattermostTarget(raw) {
|
|
|
781
774
|
async function resolveMattermostOpaqueTarget(params) {
|
|
782
775
|
const input = params.input.trim();
|
|
783
776
|
if (!input || isExplicitMattermostTarget(input) || !isMattermostId(input)) return null;
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
777
|
+
let client;
|
|
778
|
+
if ("client" in params) client = params.client;
|
|
779
|
+
else {
|
|
780
|
+
const account = resolveMattermostAccount({
|
|
781
|
+
cfg: params.cfg,
|
|
782
|
+
accountId: params.accountId
|
|
783
|
+
});
|
|
784
|
+
if (!account.enabled) throw new Error(`Mattermost account "${account.accountId}" is disabled`);
|
|
785
|
+
const token = normalizeOptionalString(account.botToken);
|
|
786
|
+
const baseUrl = normalizeMattermostBaseUrl(account.baseUrl);
|
|
787
|
+
if (!token || !baseUrl) return null;
|
|
788
|
+
client = createMattermostClient({
|
|
789
|
+
baseUrl,
|
|
790
|
+
botToken: token,
|
|
791
|
+
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
const key = cacheKey$1(client.baseUrl, client.token, input);
|
|
793
795
|
const cachedKind = getCachedMattermostOpaqueTargetKind(key);
|
|
794
796
|
if (cachedKind) return {
|
|
795
797
|
kind: cachedKind,
|
|
796
798
|
id: input,
|
|
797
799
|
to: cachedKind === "user" ? `user:${input}` : `channel:${input}`
|
|
798
800
|
};
|
|
799
|
-
const client = createMattermostClient({
|
|
800
|
-
baseUrl,
|
|
801
|
-
botToken: token,
|
|
802
|
-
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account?.config)
|
|
803
|
-
});
|
|
804
801
|
try {
|
|
805
802
|
await fetchMattermostUser(client, input);
|
|
806
803
|
cacheMattermostOpaqueTarget(key, "user");
|
|
@@ -893,43 +890,28 @@ function normalizeMessage(text, mediaUrl) {
|
|
|
893
890
|
function isHttpUrl(value) {
|
|
894
891
|
return /^https?:\/\//i.test(value);
|
|
895
892
|
}
|
|
896
|
-
async function resolveBotUser(
|
|
897
|
-
const key = cacheKey(baseUrl, token);
|
|
893
|
+
async function resolveBotUser(client) {
|
|
894
|
+
const key = cacheKey(client.baseUrl, client.token);
|
|
898
895
|
const cached = botUserCache.get(key);
|
|
899
896
|
if (cached) return cached;
|
|
900
|
-
const client = createMattermostClient({
|
|
901
|
-
baseUrl,
|
|
902
|
-
botToken: token,
|
|
903
|
-
allowPrivateNetwork
|
|
904
|
-
});
|
|
905
897
|
const user = await fetchMattermostMe(client);
|
|
906
898
|
cacheOutboundEntry(botUserCache, key, user, MATTERMOST_BOT_USER_CACHE_MAX_ENTRIES);
|
|
907
899
|
return user;
|
|
908
900
|
}
|
|
909
901
|
async function resolveUserIdByUsername(params) {
|
|
910
|
-
const {
|
|
911
|
-
const key = `${cacheKey(baseUrl, token)}::${normalizeLowercaseStringOrEmpty(username)}`;
|
|
902
|
+
const { client, username } = params;
|
|
903
|
+
const key = `${cacheKey(client.baseUrl, client.token)}::${normalizeLowercaseStringOrEmpty(username)}`;
|
|
912
904
|
const cached = userByNameCache.get(key);
|
|
913
905
|
if (cached?.id) return cached.id;
|
|
914
|
-
const client = createMattermostClient({
|
|
915
|
-
baseUrl,
|
|
916
|
-
botToken: token,
|
|
917
|
-
allowPrivateNetwork: params.allowPrivateNetwork
|
|
918
|
-
});
|
|
919
906
|
const user = await fetchMattermostUserByUsername(client, username);
|
|
920
907
|
cacheOutboundEntry(userByNameCache, key, user, MATTERMOST_TARGET_CACHE_MAX_ENTRIES);
|
|
921
908
|
return user.id;
|
|
922
909
|
}
|
|
923
910
|
async function resolveChannelIdByName(params) {
|
|
924
|
-
const {
|
|
925
|
-
const key = `${cacheKey(baseUrl, token)}::channel::${normalizeLowercaseStringOrEmpty(name)}`;
|
|
911
|
+
const { client, name } = params;
|
|
912
|
+
const key = `${cacheKey(client.baseUrl, client.token)}::channel::${normalizeLowercaseStringOrEmpty(name)}`;
|
|
926
913
|
const cached = channelByNameCache.get(key);
|
|
927
914
|
if (cached) return cached;
|
|
928
|
-
const client = createMattermostClient({
|
|
929
|
-
baseUrl,
|
|
930
|
-
botToken: token,
|
|
931
|
-
allowPrivateNetwork: params.allowPrivateNetwork
|
|
932
|
-
});
|
|
933
915
|
const me = await fetchMattermostMe(client);
|
|
934
916
|
const teams = await fetchMattermostUserTeams(client, me.id);
|
|
935
917
|
for (const team of teams) try {
|
|
@@ -957,27 +939,18 @@ function mergeDmRetryOptions(base, override) {
|
|
|
957
939
|
async function resolveTargetChannelId(params) {
|
|
958
940
|
if (params.target.kind === "channel") return params.target.id;
|
|
959
941
|
if (params.target.kind === "channel-name") return await resolveChannelIdByName({
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
name: params.target.name,
|
|
963
|
-
allowPrivateNetwork: params.allowPrivateNetwork
|
|
942
|
+
client: params.client,
|
|
943
|
+
name: params.target.name
|
|
964
944
|
});
|
|
965
945
|
const userId = params.target.id ? params.target.id : await resolveUserIdByUsername({
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
username: params.target.username ?? "",
|
|
969
|
-
allowPrivateNetwork: params.allowPrivateNetwork
|
|
946
|
+
client: params.client,
|
|
947
|
+
username: params.target.username ?? ""
|
|
970
948
|
});
|
|
971
|
-
const dmKey = `${cacheKey(params.baseUrl, params.token)}::dm::${userId}`;
|
|
949
|
+
const dmKey = `${cacheKey(params.client.baseUrl, params.client.token)}::dm::${userId}`;
|
|
972
950
|
const cachedDm = dmChannelCache.get(dmKey);
|
|
973
951
|
if (cachedDm) return cachedDm;
|
|
974
|
-
const botUser = await resolveBotUser(params.
|
|
975
|
-
const
|
|
976
|
-
baseUrl: params.baseUrl,
|
|
977
|
-
botToken: params.token,
|
|
978
|
-
allowPrivateNetwork: params.allowPrivateNetwork
|
|
979
|
-
});
|
|
980
|
-
const channel = await createMattermostDirectChannelWithRetry(client, [botUser.id, userId], {
|
|
952
|
+
const botUser = await resolveBotUser(params.client);
|
|
953
|
+
const channel = await createMattermostDirectChannelWithRetry(params.client, [botUser.id, userId], {
|
|
981
954
|
...params.dmRetryOptions,
|
|
982
955
|
onRetry: (attempt, delayMs, error) => {
|
|
983
956
|
params.dmRetryOptions?.onRetry?.(attempt, delayMs, error);
|
|
@@ -1000,41 +973,31 @@ async function resolveMattermostSendContext(to, opts) {
|
|
|
1000
973
|
if (!token) throw new Error(`Mattermost bot token missing for account "${account.accountId}" (set channels.mattermost.accounts.${account.accountId}.botToken or MATTERMOST_BOT_TOKEN for default).`);
|
|
1001
974
|
const baseUrl = normalizeMattermostBaseUrl(opts.baseUrl ?? account.baseUrl);
|
|
1002
975
|
if (!baseUrl) throw new Error(`Mattermost baseUrl missing for account "${account.accountId}" (set channels.mattermost.accounts.${account.accountId}.baseUrl or MATTERMOST_URL for default).`);
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
baseUrl
|
|
976
|
+
const client = createMattermostClient({
|
|
977
|
+
baseUrl,
|
|
978
|
+
botToken: token,
|
|
979
|
+
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
|
|
1008
980
|
});
|
|
1009
|
-
const
|
|
1010
|
-
kind: "user",
|
|
1011
|
-
id: opaqueTarget.id
|
|
1012
|
-
} : opaqueTarget?.kind === "channel" ? {
|
|
1013
|
-
kind: "channel",
|
|
1014
|
-
id: opaqueTarget.id
|
|
1015
|
-
} : parseMattermostTarget(trimmedTo);
|
|
1016
|
-
const dmRetryOptions = mergeDmRetryOptions(account.config.dmChannelRetry ? {
|
|
1017
|
-
maxRetries: account.config.dmChannelRetry.maxRetries,
|
|
1018
|
-
initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
|
|
1019
|
-
maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
|
|
1020
|
-
timeoutMs: account.config.dmChannelRetry.timeoutMs
|
|
1021
|
-
} : void 0, opts.dmRetryOptions);
|
|
1022
|
-
const allowPrivateNetwork = isPrivateNetworkOptInEnabled(account.config);
|
|
981
|
+
const trimmedTo = normalizeOptionalString(to) ?? "";
|
|
1023
982
|
const channelId = await resolveTargetChannelId({
|
|
1024
|
-
target
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
983
|
+
target: parseMattermostTarget((await resolveMattermostOpaqueTarget({
|
|
984
|
+
input: trimmedTo,
|
|
985
|
+
client
|
|
986
|
+
}))?.to ?? trimmedTo),
|
|
987
|
+
client,
|
|
988
|
+
dmRetryOptions: mergeDmRetryOptions(account.config.dmChannelRetry ? {
|
|
989
|
+
maxRetries: account.config.dmChannelRetry.maxRetries,
|
|
990
|
+
initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
|
|
991
|
+
maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
|
|
992
|
+
timeoutMs: account.config.dmChannelRetry.timeoutMs
|
|
993
|
+
} : void 0, opts.dmRetryOptions),
|
|
1029
994
|
logger: core.logging.shouldLogVerbose() ? logger : void 0
|
|
1030
995
|
});
|
|
1031
996
|
return {
|
|
1032
997
|
cfg,
|
|
1033
998
|
accountId: account.accountId,
|
|
1034
|
-
|
|
1035
|
-
baseUrl,
|
|
999
|
+
client,
|
|
1036
1000
|
channelId,
|
|
1037
|
-
allowPrivateNetwork,
|
|
1038
1001
|
mediaMaxBytes: resolveChannelMediaMaxBytes({
|
|
1039
1002
|
cfg,
|
|
1040
1003
|
accountId: account.accountId,
|
|
@@ -1045,15 +1008,10 @@ async function resolveMattermostSendContext(to, opts) {
|
|
|
1045
1008
|
async function sendMessageMattermost(to, text, opts) {
|
|
1046
1009
|
const core = getCore();
|
|
1047
1010
|
const logger = core.logging.getChildLogger({ module: "mattermost" });
|
|
1048
|
-
const { cfg, accountId,
|
|
1049
|
-
const client = createMattermostClient({
|
|
1050
|
-
baseUrl,
|
|
1051
|
-
botToken: token,
|
|
1052
|
-
allowPrivateNetwork
|
|
1053
|
-
});
|
|
1011
|
+
const { cfg, accountId, client, channelId, mediaMaxBytes } = await resolveMattermostSendContext(to, opts);
|
|
1054
1012
|
let props = opts.props;
|
|
1055
1013
|
if (!props && Array.isArray(opts.buttons) && opts.buttons.length > 0) {
|
|
1056
|
-
setInteractionSecret(accountId, token);
|
|
1014
|
+
setInteractionSecret(accountId, client.token);
|
|
1057
1015
|
props = buildButtonProps({
|
|
1058
1016
|
callbackUrl: resolveInteractionCallbackUrl(accountId, {
|
|
1059
1017
|
gateway: cfg.gateway,
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "mattermost",
|
|
3
|
+
"name": "Mattermost",
|
|
4
|
+
"description": "OpenClaw Mattermost channel plugin.",
|
|
3
5
|
"doctorContract": {
|
|
4
6
|
"configRepair": true
|
|
5
7
|
},
|
|
6
|
-
"icon": "https://cdn.simpleicons.org/mattermost",
|
|
7
8
|
"activation": {
|
|
8
9
|
"onStartup": false
|
|
9
10
|
},
|
|
@@ -1122,7 +1123,7 @@
|
|
|
1122
1123
|
},
|
|
1123
1124
|
"streaming.progress.toolProgress": {
|
|
1124
1125
|
"label": "Mattermost Progress Tool Lines",
|
|
1125
|
-
"help": "Show
|
|
1126
|
+
"help": "Show individual tool activity in progress drafts (default: false). Quiet drafts retain plans, approval requests, failures, and authored progress text."
|
|
1126
1127
|
},
|
|
1127
1128
|
"streaming.progress.commandText": {
|
|
1128
1129
|
"label": "Mattermost Progress Command Text",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/mattermost",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.3",
|
|
4
4
|
"description": "OpenClaw Mattermost channel plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.9.
|
|
15
|
+
"openclaw": ">=2026.9.3"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
"./index.ts"
|
|
25
25
|
],
|
|
26
26
|
"setupEntry": "./dist/setup-entry.js",
|
|
27
|
+
"setupFeatures": {
|
|
28
|
+
"configPromotion": true
|
|
29
|
+
},
|
|
27
30
|
"channel": {
|
|
28
31
|
"id": "mattermost",
|
|
29
32
|
"configuredState": {
|
|
@@ -91,10 +94,10 @@
|
|
|
91
94
|
"allowInvalidConfigRecovery": true
|
|
92
95
|
},
|
|
93
96
|
"compat": {
|
|
94
|
-
"pluginApi": ">=2026.9.
|
|
97
|
+
"pluginApi": ">=2026.9.3"
|
|
95
98
|
},
|
|
96
99
|
"build": {
|
|
97
|
-
"openclawVersion": "2026.9.
|
|
100
|
+
"openclawVersion": "2026.9.3",
|
|
98
101
|
"bundledDist": false
|
|
99
102
|
},
|
|
100
103
|
"release": {
|