mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
refactor: trim mattermost helper exports
This commit is contained in:
@@ -17,8 +17,8 @@ import type {
|
||||
import { normalizeMattermostBaseUrl } from "./client.js";
|
||||
import type { OpenClawConfig } from "./runtime-api.js";
|
||||
|
||||
export type MattermostTokenSource = "env" | "config" | "none";
|
||||
export type MattermostBaseUrlSource = "env" | "config" | "none";
|
||||
type MattermostTokenSource = "env" | "config" | "none";
|
||||
type MattermostBaseUrlSource = "env" | "config" | "none";
|
||||
|
||||
export type ResolvedMattermostAccount = {
|
||||
accountId: string;
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
const MATTERMOST_STREAM_MAX_CHARS = 4000;
|
||||
const DEFAULT_THROTTLE_MS = 1000;
|
||||
|
||||
export type MattermostDraftStream = {
|
||||
type MattermostDraftStream = {
|
||||
update: (text: string) => void;
|
||||
flush: () => Promise<void>;
|
||||
postId: () => string | undefined;
|
||||
@@ -20,7 +20,7 @@ export type MattermostDraftStream = {
|
||||
forceNewMessage: () => void;
|
||||
};
|
||||
|
||||
export function normalizeMattermostDraftText(text: string, maxChars: number): string {
|
||||
function normalizeMattermostDraftText(text: string, maxChars: number): string {
|
||||
const trimmed = text.trim();
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
|
||||
@@ -18,7 +18,7 @@ const SIGNED_CHANNEL_ID_CONTEXT_KEY = "__openclaw_channel_id";
|
||||
* Sent by Mattermost when a user clicks an action button.
|
||||
* See: https://developers.mattermost.com/integrate/plugins/interactive-messages/
|
||||
*/
|
||||
export type MattermostInteractionPayload = {
|
||||
type MattermostInteractionPayload = {
|
||||
user_id: string;
|
||||
user_name?: string;
|
||||
channel_id: string;
|
||||
@@ -38,7 +38,7 @@ export type MattermostInteractionResponse = {
|
||||
ephemeral_text?: string;
|
||||
};
|
||||
|
||||
export type MattermostInteractionAuthorizationResult =
|
||||
type MattermostInteractionAuthorizationResult =
|
||||
| { ok: true }
|
||||
| { ok: false; statusCode?: number; response?: MattermostInteractionResponse };
|
||||
|
||||
@@ -235,7 +235,7 @@ export function verifyInteractionToken(
|
||||
|
||||
// ── Button builder helpers ─────────────────────────────────────────────
|
||||
|
||||
export type MattermostButton = {
|
||||
type MattermostButton = {
|
||||
id: string;
|
||||
type: "button" | "select";
|
||||
name: string;
|
||||
@@ -246,7 +246,7 @@ export type MattermostButton = {
|
||||
};
|
||||
};
|
||||
|
||||
export type MattermostAttachment = {
|
||||
type MattermostAttachment = {
|
||||
text?: string;
|
||||
actions?: MattermostButton[];
|
||||
[key: string]: unknown;
|
||||
|
||||
@@ -19,18 +19,18 @@ const ACTION_IDS = {
|
||||
back: "mdlback",
|
||||
} as const;
|
||||
|
||||
export type MattermostModelPickerEntry =
|
||||
type MattermostModelPickerEntry =
|
||||
| { kind: "summary" }
|
||||
| { kind: "providers" }
|
||||
| { kind: "models"; provider: string };
|
||||
|
||||
export type MattermostModelPickerState =
|
||||
type MattermostModelPickerState =
|
||||
| { action: "providers"; ownerUserId: string }
|
||||
| { action: "back"; ownerUserId: string }
|
||||
| { action: "list"; ownerUserId: string; provider: string; page: number }
|
||||
| { action: "select"; ownerUserId: string; provider: string; page: number; model: string };
|
||||
|
||||
export type MattermostModelPickerRenderedView = {
|
||||
type MattermostModelPickerRenderedView = {
|
||||
text: string;
|
||||
buttons: MattermostInteractiveButtonInput[][];
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import { normalizeMattermostBaseUrl, readMattermostError, type MattermostUser } from "./client.js";
|
||||
import type { BaseProbeResult } from "./runtime-api.js";
|
||||
|
||||
export type MattermostProbe = BaseProbeResult & {
|
||||
type MattermostProbe = BaseProbeResult & {
|
||||
status?: number | null;
|
||||
elapsedMs?: number | null;
|
||||
bot?: MattermostUser;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
export type ReconnectOutcome = "resolved" | "rejected";
|
||||
type ReconnectOutcome = "resolved" | "rejected";
|
||||
|
||||
export type ShouldReconnectParams = {
|
||||
type ShouldReconnectParams = {
|
||||
attempt: number;
|
||||
delayMs: number;
|
||||
outcome: ReconnectOutcome;
|
||||
error?: unknown;
|
||||
};
|
||||
|
||||
export type RunWithReconnectOpts = {
|
||||
type RunWithReconnectOpts = {
|
||||
abortSignal?: AbortSignal;
|
||||
onError?: (err: unknown) => void;
|
||||
onReconnect?: (delayMs: number) => void;
|
||||
|
||||
@@ -49,7 +49,7 @@ type SlashHandlerMatch =
|
||||
|
||||
// ─── Per-account state ───────────────────────────────────────────────────────
|
||||
|
||||
export type SlashCommandAccountState = {
|
||||
type SlashCommandAccountState = {
|
||||
/** Tokens from registered/current commands, used for fast-path routing. */
|
||||
commandTokens: Set<string>;
|
||||
/** Registered command IDs for cleanup on shutdown. */
|
||||
|
||||
@@ -5,7 +5,7 @@ export type MattermostReplyToMode = "off" | "first" | "all" | "batched";
|
||||
export type MattermostChatTypeKey = "direct" | "channel" | "group";
|
||||
|
||||
export type MattermostChatMode = "oncall" | "onmessage" | "onchar";
|
||||
export type MattermostNetworkConfig = {
|
||||
type MattermostNetworkConfig = {
|
||||
/** Dangerous opt-in for self-hosted Mattermost on trusted private/internal hosts. */
|
||||
dangerouslyAllowPrivateNetwork?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user