refactor: trim mattermost helper exports · openclaw/openclaw@51affb8
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
File tree
extensions/mattermost/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -17,8 +17,8 @@ import type {
|
17 | 17 | import { normalizeMattermostBaseUrl } from "./client.js"; |
18 | 18 | import type { OpenClawConfig } from "./runtime-api.js"; |
19 | 19 | |
20 | | -export type MattermostTokenSource = "env" | "config" | "none"; |
21 | | -export type MattermostBaseUrlSource = "env" | "config" | "none"; |
| 20 | +type MattermostTokenSource = "env" | "config" | "none"; |
| 21 | +type MattermostBaseUrlSource = "env" | "config" | "none"; |
22 | 22 | |
23 | 23 | export type ResolvedMattermostAccount = { |
24 | 24 | accountId: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ import {
|
9 | 9 | const MATTERMOST_STREAM_MAX_CHARS = 4000; |
10 | 10 | const DEFAULT_THROTTLE_MS = 1000; |
11 | 11 | |
12 | | -export type MattermostDraftStream = { |
| 12 | +type MattermostDraftStream = { |
13 | 13 | update: (text: string) => void; |
14 | 14 | flush: () => Promise<void>; |
15 | 15 | postId: () => string | undefined; |
@@ -20,7 +20,7 @@ export type MattermostDraftStream = {
|
20 | 20 | forceNewMessage: () => void; |
21 | 21 | }; |
22 | 22 | |
23 | | -export function normalizeMattermostDraftText(text: string, maxChars: number): string { |
| 23 | +function normalizeMattermostDraftText(text: string, maxChars: number): string { |
24 | 24 | const trimmed = text.trim(); |
25 | 25 | if (!trimmed) { |
26 | 26 | return ""; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ const SIGNED_CHANNEL_ID_CONTEXT_KEY = "__openclaw_channel_id";
|
18 | 18 | * Sent by Mattermost when a user clicks an action button. |
19 | 19 | * See: https://developers.mattermost.com/integrate/plugins/interactive-messages/ |
20 | 20 | */ |
21 | | -export type MattermostInteractionPayload = { |
| 21 | +type MattermostInteractionPayload = { |
22 | 22 | user_id: string; |
23 | 23 | user_name?: string; |
24 | 24 | channel_id: string; |
@@ -38,7 +38,7 @@ export type MattermostInteractionResponse = {
|
38 | 38 | ephemeral_text?: string; |
39 | 39 | }; |
40 | 40 | |
41 | | -export type MattermostInteractionAuthorizationResult = |
| 41 | +type MattermostInteractionAuthorizationResult = |
42 | 42 | | { ok: true } |
43 | 43 | | { ok: false; statusCode?: number; response?: MattermostInteractionResponse }; |
44 | 44 | |
@@ -235,7 +235,7 @@ export function verifyInteractionToken(
|
235 | 235 | |
236 | 236 | // ── Button builder helpers ───────────────────────────────────────────── |
237 | 237 | |
238 | | -export type MattermostButton = { |
| 238 | +type MattermostButton = { |
239 | 239 | id: string; |
240 | 240 | type: "button" | "select"; |
241 | 241 | name: string; |
@@ -246,7 +246,7 @@ export type MattermostButton = {
|
246 | 246 | }; |
247 | 247 | }; |
248 | 248 | |
249 | | -export type MattermostAttachment = { |
| 249 | +type MattermostAttachment = { |
250 | 250 | text?: string; |
251 | 251 | actions?: MattermostButton[]; |
252 | 252 | [key: string]: unknown; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -19,18 +19,18 @@ const ACTION_IDS = {
|
19 | 19 | back: "mdlback", |
20 | 20 | } as const; |
21 | 21 | |
22 | | -export type MattermostModelPickerEntry = |
| 22 | +type MattermostModelPickerEntry = |
23 | 23 | | { kind: "summary" } |
24 | 24 | | { kind: "providers" } |
25 | 25 | | { kind: "models"; provider: string }; |
26 | 26 | |
27 | | -export type MattermostModelPickerState = |
| 27 | +type MattermostModelPickerState = |
28 | 28 | | { action: "providers"; ownerUserId: string } |
29 | 29 | | { action: "back"; ownerUserId: string } |
30 | 30 | | { action: "list"; ownerUserId: string; provider: string; page: number } |
31 | 31 | | { action: "select"; ownerUserId: string; provider: string; page: number; model: string }; |
32 | 32 | |
33 | | -export type MattermostModelPickerRenderedView = { |
| 33 | +type MattermostModelPickerRenderedView = { |
34 | 34 | text: string; |
35 | 35 | buttons: MattermostInteractiveButtonInput[][]; |
36 | 36 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ import {
|
6 | 6 | import { normalizeMattermostBaseUrl, readMattermostError, type MattermostUser } from "./client.js"; |
7 | 7 | import type { BaseProbeResult } from "./runtime-api.js"; |
8 | 8 | |
9 | | -export type MattermostProbe = BaseProbeResult & { |
| 9 | +type MattermostProbe = BaseProbeResult & { |
10 | 10 | status?: number | null; |
11 | 11 | elapsedMs?: number | null; |
12 | 12 | bot?: MattermostUser; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export type ReconnectOutcome = "resolved" | "rejected"; |
| 1 | +type ReconnectOutcome = "resolved" | "rejected"; |
2 | 2 | |
3 | | -export type ShouldReconnectParams = { |
| 3 | +type ShouldReconnectParams = { |
4 | 4 | attempt: number; |
5 | 5 | delayMs: number; |
6 | 6 | outcome: ReconnectOutcome; |
7 | 7 | error?: unknown; |
8 | 8 | }; |
9 | 9 | |
10 | | -export type RunWithReconnectOpts = { |
| 10 | +type RunWithReconnectOpts = { |
11 | 11 | abortSignal?: AbortSignal; |
12 | 12 | onError?: (err: unknown) => void; |
13 | 13 | onReconnect?: (delayMs: number) => void; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -49,7 +49,7 @@ type SlashHandlerMatch =
|
49 | 49 | |
50 | 50 | // ─── Per-account state ─────────────────────────────────────────────────────── |
51 | 51 | |
52 | | -export type SlashCommandAccountState = { |
| 52 | +type SlashCommandAccountState = { |
53 | 53 | /** Tokens from registered/current commands, used for fast-path routing. */ |
54 | 54 | commandTokens: Set<string>; |
55 | 55 | /** Registered command IDs for cleanup on shutdown. */ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ export type MattermostReplyToMode = "off" | "first" | "all" | "batched";
|
5 | 5 | export type MattermostChatTypeKey = "direct" | "channel" | "group"; |
6 | 6 | |
7 | 7 | export type MattermostChatMode = "oncall" | "onmessage" | "onchar"; |
8 | | -export type MattermostNetworkConfig = { |
| 8 | +type MattermostNetworkConfig = { |
9 | 9 | /** Dangerous opt-in for self-hosted Mattermost on trusted private/internal hosts. */ |
10 | 10 | dangerouslyAllowPrivateNetwork?: boolean; |
11 | 11 | }; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。