@openclaw/mattermost 2026.6.34 → 2026.6.35
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/{accounts-DnAHfb5f.js → accounts-BC4fy15g.js} +45 -11
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-plugin-runtime-DYAjBN0v.js → channel-plugin-runtime-Cp06qxah.js} +2 -2
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-W-pjr9zL.js → channel.runtime-DYb2bbQp.js} +9 -4
- package/dist/slash-route-api.js +1 -1
- package/dist/{slash-state-I1qleAHM.js → slash-state-BBj_Qz4Y.js} +13 -12
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockCoalesce, resolveChannelStreamingBlockEnabled, resolveChannelStreamingChunkMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
|
+
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
4
5
|
import { fetchWithSsrFGuard, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
5
6
|
import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
|
|
6
7
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
7
8
|
import { resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
|
|
8
9
|
import { buildSecretInputSchema, hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
9
|
-
import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
10
|
+
import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
11
|
+
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
10
12
|
import { sleep } from "openclaw/plugin-sdk/runtime-env";
|
|
11
13
|
import { z } from "zod";
|
|
12
14
|
//#region extensions/mattermost/src/mattermost/client.ts
|
|
13
15
|
const MATTERMOST_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
|
|
16
|
+
const MATTERMOST_REQUEST_TIMEOUT_MS = 3e4;
|
|
17
|
+
const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES = 64 * 1024;
|
|
14
18
|
const NULL_BODY_STATUSES = new Set([
|
|
15
19
|
101,
|
|
16
20
|
204,
|
|
@@ -38,6 +42,10 @@ function buildMattermostApiUrl(baseUrl, path) {
|
|
|
38
42
|
if (!normalized) throw new Error("Mattermost baseUrl is required");
|
|
39
43
|
return `${normalized}/api/v4${path.startsWith("/") ? path : `/${path}`}`;
|
|
40
44
|
}
|
|
45
|
+
async function readMattermostSuccessText(res, path) {
|
|
46
|
+
const bytes = await readResponseWithLimit(res, MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES, { onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Mattermost API ${path}: text response exceeds ${maxBytes} bytes`) });
|
|
47
|
+
return new TextDecoder().decode(bytes);
|
|
48
|
+
}
|
|
41
49
|
async function readMattermostError(res) {
|
|
42
50
|
const contentType = res.headers.get("content-type") ?? "";
|
|
43
51
|
if (!res.body) {
|
|
@@ -105,17 +113,42 @@ function createMattermostClient(params) {
|
|
|
105
113
|
if (!baseUrl) throw new Error("Mattermost baseUrl is required");
|
|
106
114
|
const apiBaseUrl = `${baseUrl}/api/v4`;
|
|
107
115
|
const token = params.botToken.trim();
|
|
116
|
+
const requestTimeoutMs = resolveTimerTimeoutMs(params.timeoutMs, MATTERMOST_REQUEST_TIMEOUT_MS);
|
|
108
117
|
const externalFetchImpl = params.fetchImpl;
|
|
109
118
|
const guardedFetchImpl = async (input, init) => {
|
|
119
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
120
|
+
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
121
|
+
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
110
122
|
const { response, release } = await fetchWithSsrFGuard({
|
|
111
|
-
url
|
|
112
|
-
init,
|
|
123
|
+
url,
|
|
124
|
+
init: requestInit,
|
|
113
125
|
auditContext: "mattermost-api",
|
|
114
|
-
policy: ssrfPolicyFromPrivateNetworkOptIn(params.allowPrivateNetwork)
|
|
126
|
+
policy: ssrfPolicyFromPrivateNetworkOptIn(params.allowPrivateNetwork),
|
|
127
|
+
signal: requestInit.signal ?? void 0,
|
|
128
|
+
timeoutMs
|
|
115
129
|
});
|
|
116
130
|
return responseWithRelease(response, release);
|
|
117
131
|
};
|
|
118
|
-
const fetchImpl = externalFetchImpl
|
|
132
|
+
const fetchImpl = (externalFetchImpl ? async (input, init) => {
|
|
133
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
134
|
+
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
135
|
+
const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
|
|
136
|
+
timeoutMs: resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs),
|
|
137
|
+
operation: "mattermost-api",
|
|
138
|
+
url
|
|
139
|
+
});
|
|
140
|
+
const callerSignal = requestInit.signal ?? void 0;
|
|
141
|
+
const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
|
|
142
|
+
try {
|
|
143
|
+
return responseWithRelease(await externalFetchImpl(input, {
|
|
144
|
+
...requestInit,
|
|
145
|
+
signal
|
|
146
|
+
}), async () => cleanup());
|
|
147
|
+
} catch (error) {
|
|
148
|
+
cleanup();
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
} : void 0) ?? guardedFetchImpl;
|
|
119
152
|
const request = async (path, init) => {
|
|
120
153
|
const url = buildMattermostApiUrl(baseUrl, path);
|
|
121
154
|
const headers = new Headers(init?.headers);
|
|
@@ -130,8 +163,8 @@ function createMattermostClient(params) {
|
|
|
130
163
|
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
131
164
|
}
|
|
132
165
|
if (res.status === 204) return;
|
|
133
|
-
if ((res.headers.get("content-type") ?? "").includes("application/json")) return await res
|
|
134
|
-
return await res
|
|
166
|
+
if ((res.headers.get("content-type") ?? "").includes("application/json")) return await readProviderJsonResponse(res, `Mattermost API ${path}`);
|
|
167
|
+
return await readMattermostSuccessText(res, path);
|
|
135
168
|
};
|
|
136
169
|
return {
|
|
137
170
|
baseUrl,
|
|
@@ -165,11 +198,12 @@ async function sendMattermostTyping(client, params) {
|
|
|
165
198
|
body: JSON.stringify(payload)
|
|
166
199
|
});
|
|
167
200
|
}
|
|
168
|
-
async function createMattermostDirectChannel(client, userIds, signal) {
|
|
201
|
+
async function createMattermostDirectChannel(client, userIds, signal, timeoutMs) {
|
|
169
202
|
return await client.request("/channels/direct", {
|
|
170
203
|
method: "POST",
|
|
171
204
|
body: JSON.stringify(userIds),
|
|
172
|
-
signal
|
|
205
|
+
signal,
|
|
206
|
+
timeoutMs
|
|
173
207
|
});
|
|
174
208
|
}
|
|
175
209
|
const DM_REPLY_DELIVERY_BARRIER_SLACK_MS = 6e4;
|
|
@@ -236,7 +270,7 @@ async function createMattermostDirectChannelWithRetry(client, userIds, options =
|
|
|
236
270
|
const controller = new AbortController();
|
|
237
271
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
238
272
|
try {
|
|
239
|
-
return await createMattermostDirectChannel(client, userIds, controller.signal);
|
|
273
|
+
return await createMattermostDirectChannel(client, userIds, controller.signal, timeoutMs);
|
|
240
274
|
} finally {
|
|
241
275
|
clearTimeout(timeoutId);
|
|
242
276
|
}
|
|
@@ -357,7 +391,7 @@ async function uploadMattermostFile(client, params) {
|
|
|
357
391
|
const detail = await readMattermostError(res);
|
|
358
392
|
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
359
393
|
}
|
|
360
|
-
const info = (await res
|
|
394
|
+
const info = (await readProviderJsonResponse(res, "Mattermost API /files")).file_infos?.[0];
|
|
361
395
|
if (!info?.id) throw new Error("Mattermost file upload failed");
|
|
362
396
|
return info;
|
|
363
397
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as describeMattermostAccount, c as mattermostMeta, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as isMattermostConfigured, r as mattermostSetupAdapter, s as mattermostConfigAdapter, t as mattermostPlugin } from "./channel-plugin-runtime-
|
|
1
|
+
import { a as describeMattermostAccount, c as mattermostMeta, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as isMattermostConfigured, r as mattermostSetupAdapter, s as mattermostConfigAdapter, t as mattermostPlugin } from "./channel-plugin-runtime-Cp06qxah.js";
|
|
2
2
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-BHgOAkk8.js";
|
|
3
3
|
//#region extensions/mattermost/src/channel.setup.ts
|
|
4
4
|
const mattermostSetupPlugin = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as hasConfiguredSecretInput, S as buildSecretInputSchema, g as normalizeMattermostBaseUrl, i as resolveMattermostReplyToMode, n as resolveDefaultMattermostAccountId, r as resolveMattermostAccount, t as listMattermostAccountIds } from "./accounts-
|
|
1
|
+
import { C as hasConfiguredSecretInput, S as buildSecretInputSchema, g as normalizeMattermostBaseUrl, i as resolveMattermostReplyToMode, n as resolveDefaultMattermostAccountId, r as resolveMattermostAccount, t as listMattermostAccountIds } from "./accounts-BC4fy15g.js";
|
|
2
2
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-BHgOAkk8.js";
|
|
3
3
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-ttH0DCuq.js";
|
|
4
4
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Cx0LUNXy.js";
|
|
@@ -565,7 +565,7 @@ const mattermostSetupWizard = {
|
|
|
565
565
|
};
|
|
566
566
|
//#endregion
|
|
567
567
|
//#region extensions/mattermost/src/channel.ts
|
|
568
|
-
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
568
|
+
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DYb2bbQp.js"));
|
|
569
569
|
function buildMattermostPresentationButtons(presentation) {
|
|
570
570
|
return presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
|
|
571
571
|
if (button.action) return [];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mattermostPlugin } from "./channel-plugin-runtime-
|
|
1
|
+
import { t as mattermostPlugin } from "./channel-plugin-runtime-Cp06qxah.js";
|
|
2
2
|
export { mattermostPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as resolveChannelMediaMaxBytes, E as warnMissingProviderGroupPolicyFallbackOnce, S as resolveAllowlistProviderRuntimeGroupPolicy, T as resolveDefaultGroupPolicy, _ as logInboundDrop, c as buildAgentMediaPayload, d as createChannelMessageReplyPipeline, f as createChannelPairingController, h as listSkillCommandsForAgents, i as normalizeMattermostAllowEntry, l as buildModelsProviderData, n as formatMattermostDirectMessageDropLog, o as resolveMattermostMonitorInboundAccess, s as DEFAULT_GROUP_HISTORY_LIMIT, t as authorizeMattermostCommandInvocation, u as createChannelHistoryWindow, v as logTypingFailure, x as registerPluginHttpRoute, y as parseTcpPort } from "./monitor-auth-BiDuyvOc.js";
|
|
2
|
-
import { _ as readMattermostError, a as MattermostPostSchema, b as updateMattermostPost, c as createMattermostPost, f as fetchMattermostMe, g as normalizeMattermostBaseUrl, h as fetchMattermostUserTeams, i as resolveMattermostReplyToMode, l as deleteMattermostPost, o as createMattermostClient, p as fetchMattermostUser, r as resolveMattermostAccount, t as listMattermostAccountIds, u as fetchMattermostChannel, y as sendMattermostTyping } from "./accounts-
|
|
2
|
+
import { _ as readMattermostError, a as MattermostPostSchema, b as updateMattermostPost, c as createMattermostPost, f as fetchMattermostMe, g as normalizeMattermostBaseUrl, h as fetchMattermostUserTeams, i as resolveMattermostReplyToMode, l as deleteMattermostPost, o as createMattermostClient, p as fetchMattermostUser, r as resolveMattermostAccount, t as listMattermostAccountIds, u as fetchMattermostChannel, y as sendMattermostTyping } from "./accounts-BC4fy15g.js";
|
|
3
3
|
import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
4
|
-
import { C as registerSlashCommands, S as isSlashCommandsEnabled, T as resolveSlashCommandConfig, _ as renderMattermostModelsPickerView, a as sendMessageMattermost, b as DEFAULT_COMMAND_SPECS, c as computeInteractionCallbackUrl, d as setInteractionCallbackUrl, f as setInteractionSecret, g as parseMattermostModelPickerContext, h as buildMattermostAllowedModelRefs, l as createMattermostInteractionHandler, m as deliverMattermostReplyPayload, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as createMattermostReplyDeliveryBarrier, r as getSlashCommandState, s as buildButtonProps, t as activateSlashCommands, u as resolveInteractionCallbackPath, v as renderMattermostProviderPickerView, w as resolveCallbackUrl, x as cleanupSlashCommands, y as resolveMattermostModelPickerCurrentModel } from "./slash-state-
|
|
4
|
+
import { C as registerSlashCommands, S as isSlashCommandsEnabled, T as resolveSlashCommandConfig, _ as renderMattermostModelsPickerView, a as sendMessageMattermost, b as DEFAULT_COMMAND_SPECS, c as computeInteractionCallbackUrl, d as setInteractionCallbackUrl, f as setInteractionSecret, g as parseMattermostModelPickerContext, h as buildMattermostAllowedModelRefs, l as createMattermostInteractionHandler, m as deliverMattermostReplyPayload, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as createMattermostReplyDeliveryBarrier, r as getSlashCommandState, s as buildButtonProps, t as activateSlashCommands, u as resolveInteractionCallbackPath, v as renderMattermostProviderPickerView, w as resolveCallbackUrl, x as cleanupSlashCommands, y as resolveMattermostModelPickerCurrentModel } from "./slash-state-BBj_Qz4Y.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { formatInboundFromLabel } from "openclaw/plugin-sdk/channel-inbound";
|
|
7
7
|
import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftCompositor, createFinalizableDraftLifecycle, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelStreamingPreviewToolProgress } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -10,6 +10,7 @@ import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveTimerTimeou
|
|
|
10
10
|
import { safeParseJsonWithSchema, safeParseWithSchema } from "openclaw/plugin-sdk/extension-shared";
|
|
11
11
|
import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsSupplement, isReasoningReplyPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
12
12
|
import { fetchWithSsrFGuard, isPrivateNetworkOptInEnabled, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
13
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
13
14
|
import { z } from "zod";
|
|
14
15
|
import { resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
15
16
|
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -328,6 +329,8 @@ function stripOncharPrefix(text, prefixes) {
|
|
|
328
329
|
//#region extensions/mattermost/src/mattermost/monitor-resources.ts
|
|
329
330
|
const CHANNEL_CACHE_TTL_MS = 5 * 6e4;
|
|
330
331
|
const USER_CACHE_TTL_MS = 10 * 6e4;
|
|
332
|
+
const MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS = 12e4;
|
|
333
|
+
const MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS = 3e4;
|
|
331
334
|
function createMattermostMonitorResources(params) {
|
|
332
335
|
const { accountId, callbackUrl, client, logger, mediaMaxBytes, saveRemoteMedia, mediaKindFromMime } = params;
|
|
333
336
|
const channelCache = /* @__PURE__ */ new Map();
|
|
@@ -355,7 +358,9 @@ function createMattermostMonitorResources(params) {
|
|
|
355
358
|
requestInit: { headers: { Authorization: `Bearer ${client.token}` } },
|
|
356
359
|
filePathHint: fileId,
|
|
357
360
|
maxBytes: mediaMaxBytes,
|
|
358
|
-
ssrfPolicy: { allowedHostnames: [new URL(client.baseUrl).hostname] }
|
|
361
|
+
ssrfPolicy: { allowedHostnames: [new URL(client.baseUrl).hostname] },
|
|
362
|
+
timeoutMs: MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS,
|
|
363
|
+
readIdleTimeoutMs: MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS
|
|
359
364
|
});
|
|
360
365
|
const contentType = saved.contentType ?? void 0;
|
|
361
366
|
out.push({
|
|
@@ -2563,7 +2568,7 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
|
|
|
2563
2568
|
elapsedMs
|
|
2564
2569
|
};
|
|
2565
2570
|
}
|
|
2566
|
-
const bot = await res
|
|
2571
|
+
const bot = await readProviderJsonResponse(res, "Mattermost probe /users/me");
|
|
2567
2572
|
return {
|
|
2568
2573
|
ok: true,
|
|
2569
2574
|
status: res.status,
|
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-BBj_Qz4Y.js";
|
|
2
2
|
export { registerSlashCommandRoute };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as normalizeMattermostAllowList, b as readRequestBodyWithLimit, d as createChannelMessageReplyPipeline, g as loadOutboundMediaFromUrl, l as buildModelsProviderData, m as isTrustedProxyAddress, p as isRequestBodyLimitError, t as authorizeMattermostCommandInvocation, v as logTypingFailure, w as resolveClientIp } from "./monitor-auth-BiDuyvOc.js";
|
|
2
|
-
import { b as updateMattermostPost, c as createMattermostPost, d as fetchMattermostChannelByName, f as fetchMattermostMe, g as normalizeMattermostBaseUrl, h as fetchMattermostUserTeams, m as fetchMattermostUserByUsername, o as createMattermostClient, p as fetchMattermostUser, r as resolveMattermostAccount, s as createMattermostDirectChannelWithRetry, u as fetchMattermostChannel, v as resolveMattermostReplyDeliveryBarrierTimeoutMs, x as uploadMattermostFile, y as sendMattermostTyping } from "./accounts-
|
|
2
|
+
import { b as updateMattermostPost, c as createMattermostPost, d as fetchMattermostChannelByName, f as fetchMattermostMe, g as normalizeMattermostBaseUrl, h as fetchMattermostUserTeams, m as fetchMattermostUserByUsername, o as createMattermostClient, p as fetchMattermostUser, r as resolveMattermostAccount, s as createMattermostDirectChannelWithRetry, u as fetchMattermostChannel, v as resolveMattermostReplyDeliveryBarrierTimeoutMs, x as uploadMattermostFile, y as sendMattermostTyping } from "./accounts-BC4fy15g.js";
|
|
3
3
|
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -16,6 +16,7 @@ import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
|
16
16
|
import { createHash, createHmac } from "node:crypto";
|
|
17
17
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
18
18
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
19
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
19
20
|
/**
|
|
20
21
|
* Built-in OpenClaw commands to register as native slash commands.
|
|
21
22
|
* These mirror the text-based commands already handled by the gateway.
|
|
@@ -1030,7 +1031,12 @@ function createMattermostInteractionHandler(params) {
|
|
|
1030
1031
|
}
|
|
1031
1032
|
//#endregion
|
|
1032
1033
|
//#region extensions/mattermost/src/mattermost/target-resolution.ts
|
|
1034
|
+
const MATTERMOST_OPAQUE_TARGET_CACHE_MAX_ENTRIES = 1024;
|
|
1033
1035
|
const mattermostOpaqueTargetCache = /* @__PURE__ */ new Map();
|
|
1036
|
+
function cacheMattermostOpaqueTarget(key, kind) {
|
|
1037
|
+
mattermostOpaqueTargetCache.set(key, kind);
|
|
1038
|
+
pruneMapToMaxSize(mattermostOpaqueTargetCache, MATTERMOST_OPAQUE_TARGET_CACHE_MAX_ENTRIES);
|
|
1039
|
+
}
|
|
1034
1040
|
function cacheKey$1(baseUrl, token, id) {
|
|
1035
1041
|
return `${baseUrl}::${token}::${id}`;
|
|
1036
1042
|
}
|
|
@@ -1062,16 +1068,11 @@ async function resolveMattermostOpaqueTarget(params) {
|
|
|
1062
1068
|
const baseUrl = normalizeMattermostBaseUrl(params.baseUrl ?? account?.baseUrl);
|
|
1063
1069
|
if (!token || !baseUrl) return null;
|
|
1064
1070
|
const key = cacheKey$1(baseUrl, token, input);
|
|
1065
|
-
const
|
|
1066
|
-
if (
|
|
1067
|
-
kind:
|
|
1068
|
-
id: input,
|
|
1069
|
-
to: `user:${input}`
|
|
1070
|
-
};
|
|
1071
|
-
if (cached === false) return {
|
|
1072
|
-
kind: "channel",
|
|
1071
|
+
const cachedKind = mattermostOpaqueTargetCache.get(key);
|
|
1072
|
+
if (cachedKind) return {
|
|
1073
|
+
kind: cachedKind,
|
|
1073
1074
|
id: input,
|
|
1074
|
-
to:
|
|
1075
|
+
to: `${cachedKind}:${input}`
|
|
1075
1076
|
};
|
|
1076
1077
|
const client = createMattermostClient({
|
|
1077
1078
|
baseUrl,
|
|
@@ -1080,14 +1081,14 @@ async function resolveMattermostOpaqueTarget(params) {
|
|
|
1080
1081
|
});
|
|
1081
1082
|
try {
|
|
1082
1083
|
await fetchMattermostUser(client, input);
|
|
1083
|
-
|
|
1084
|
+
cacheMattermostOpaqueTarget(key, "user");
|
|
1084
1085
|
return {
|
|
1085
1086
|
kind: "user",
|
|
1086
1087
|
id: input,
|
|
1087
1088
|
to: `user:${input}`
|
|
1088
1089
|
};
|
|
1089
1090
|
} catch (err) {
|
|
1090
|
-
if (parseMattermostApiStatus(err) === 404)
|
|
1091
|
+
if (parseMattermostApiStatus(err) === 404) cacheMattermostOpaqueTarget(key, "channel");
|
|
1091
1092
|
return {
|
|
1092
1093
|
kind: "channel",
|
|
1093
1094
|
id: input,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/mattermost",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.35",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/mattermost",
|
|
9
|
-
"version": "2026.6.
|
|
9
|
+
"version": "2026.6.35",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ws": "8.21.0",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.6.
|
|
15
|
+
"openclaw": ">=2026.6.35"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/mattermost",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.35",
|
|
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.6.
|
|
15
|
+
"openclaw": ">=2026.6.35"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"allowInvalidConfigRecovery": true
|
|
42
42
|
},
|
|
43
43
|
"compat": {
|
|
44
|
-
"pluginApi": ">=2026.6.
|
|
44
|
+
"pluginApi": ">=2026.6.35"
|
|
45
45
|
},
|
|
46
46
|
"build": {
|
|
47
|
-
"openclawVersion": "2026.6.
|
|
47
|
+
"openclawVersion": "2026.6.35",
|
|
48
48
|
"bundledDist": false
|
|
49
49
|
},
|
|
50
50
|
"release": {
|