Plugins/mattermost: migrate to scoped plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 02:33:03 -05:00
parent b69b2a7ae0
commit b192276283
27 changed files with 34 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/mattermost";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/mattermost";
import { mattermostPlugin } from "./src/channel.js";
import { getSlashCommandState, registerSlashCommandRoute } from "./src/mattermost/slash-state.js";
import { setMattermostRuntime } from "./src/runtime.js";

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { createReplyPrefixOptions } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { createReplyPrefixOptions } from "openclaw/plugin-sdk/mattermost";
import { beforeEach, describe, expect, it, vi } from "vitest";
const { sendMessageMattermostMock } = vi.hoisted(() => ({
sendMessageMattermostMock: vi.fn(),

View File

@@ -12,7 +12,7 @@ import {
type ChannelMessageActionAdapter,
type ChannelMessageActionName,
type ChannelPlugin,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import { MattermostConfigSchema } from "./config-schema.js";
import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
import {

View File

@@ -4,7 +4,7 @@ import {
GroupPolicySchema,
MarkdownConfigSchema,
requireOpenAllowFrom,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import { z } from "zod";
import { buildSecretInputSchema } from "./secret-input.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelGroupContext } from "openclaw/plugin-sdk/compat";
import type { ChannelGroupContext } from "openclaw/plugin-sdk/mattermost";
import { resolveMattermostAccount } from "./mattermost/accounts.js";
export function resolveMattermostGroupRequireMention(

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { describe, expect, it } from "vitest";
import { resolveDefaultMattermostAccountId } from "./accounts.js";

View File

@@ -3,7 +3,7 @@ import {
normalizeAccountId,
normalizeOptionalAccountId,
} from "openclaw/plugin-sdk/account-id";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { normalizeResolvedSecretInputString, normalizeSecretInputString } from "../secret-input.js";
import type { MattermostAccountConfig, MattermostChatMode } from "../types.js";
import { normalizeMattermostBaseUrl } from "./client.js";

View File

@@ -1,7 +1,7 @@
import {
resolveAllowlistMatchSimple,
resolveEffectiveAllowFromLists,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
export function normalizeMattermostAllowEntry(entry: string): string {
const trimmed = entry.trim();

View File

@@ -2,8 +2,8 @@ import {
formatInboundFromLabel as formatInboundFromLabelShared,
resolveThreadSessionKeys as resolveThreadSessionKeysShared,
type OpenClawConfig,
} from "openclaw/plugin-sdk/compat";
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk/mattermost";
export type ResponsePrefixContext = {
model?: string;

View File

@@ -1,4 +1,4 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { RuntimeEnv } from "openclaw/plugin-sdk/mattermost";
import { describe, expect, it, vi } from "vitest";
import {
createMattermostConnectOnce,

View File

@@ -1,4 +1,4 @@
import type { ChannelAccountSnapshot, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { ChannelAccountSnapshot, RuntimeEnv } from "openclaw/plugin-sdk/mattermost";
import WebSocket from "ws";
import type { MattermostPost } from "./client.js";
import { rawDataToString } from "./monitor-helpers.js";

View File

@@ -1,4 +1,4 @@
import { resolveControlCommandGate } from "openclaw/plugin-sdk/compat";
import { resolveControlCommandGate } from "openclaw/plugin-sdk/mattermost";
import { describe, expect, it } from "vitest";
import { resolveMattermostEffectiveAllowFromLists } from "./monitor-auth.js";

View File

@@ -4,7 +4,7 @@ import type {
OpenClawConfig,
ReplyPayload,
RuntimeEnv,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import {
buildAgentMediaPayload,
DM_GROUP_ACCESS_REASON,
@@ -27,7 +27,7 @@ import {
warnMissingProviderGroupPolicyFallbackOnce,
listSkillCommandsForAgents,
type HistoryEntry,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import { getMattermostRuntime } from "../runtime.js";
import { resolveMattermostAccount } from "./accounts.js";
import {

View File

@@ -1,4 +1,4 @@
import type { BaseProbeResult } from "openclaw/plugin-sdk/compat";
import type { BaseProbeResult } from "openclaw/plugin-sdk/mattermost";
import { normalizeMattermostBaseUrl, readMattermostError, type MattermostUser } from "./client.js";
export type MattermostProbe = BaseProbeResult & {

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { expect, vi } from "vitest";
export function createMattermostTestConfig(): OpenClawConfig {

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { resolveMattermostAccount } from "./accounts.js";
import { createMattermostClient, fetchMattermostMe, type MattermostClient } from "./client.js";

View File

@@ -18,7 +18,7 @@ const mockState = vi.hoisted(() => ({
uploadMattermostFile: vi.fn(),
}));
vi.mock("openclaw/plugin-sdk", () => ({
vi.mock("openclaw/plugin-sdk/mattermost", () => ({
loadOutboundMediaFromUrl: mockState.loadOutboundMediaFromUrl,
}));

View File

@@ -1,4 +1,4 @@
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { getMattermostRuntime } from "../runtime.js";
import { resolveMattermostAccount } from "./accounts.js";
import {

View File

@@ -1,6 +1,6 @@
import type { IncomingMessage, ServerResponse } from "node:http";
import { PassThrough } from "node:stream";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/mattermost";
import { describe, expect, it } from "vitest";
import type { ResolvedMattermostAccount } from "./accounts.js";
import { createSlashCommandHttpHandler } from "./slash-http.js";

View File

@@ -6,14 +6,14 @@
*/
import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk/mattermost";
import {
createReplyPrefixOptions,
createTypingCallbacks,
isDangerousNameMatchingEnabled,
logTypingFailure,
resolveControlCommandGate,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import type { ResolvedMattermostAccount } from "../mattermost/accounts.js";
import { getMattermostRuntime } from "../runtime.js";
import {

View File

@@ -10,7 +10,7 @@
*/
import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/compat";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/mattermost";
import type { ResolvedMattermostAccount } from "./accounts.js";
import { resolveSlashCommandConfig, type MattermostRegisteredCommand } from "./slash-commands.js";
import { createSlashCommandHttpHandler } from "./slash-http.js";
@@ -86,8 +86,8 @@ export function activateSlashCommands(params: {
registeredCommands: MattermostRegisteredCommand[];
triggerMap?: Map<string, string>;
api: {
cfg: import("openclaw/plugin-sdk/compat").OpenClawConfig;
runtime: import("openclaw/plugin-sdk/compat").RuntimeEnv;
cfg: import("openclaw/plugin-sdk/mattermost").OpenClawConfig;
runtime: import("openclaw/plugin-sdk/mattermost").RuntimeEnv;
};
log?: (msg: string) => void;
}) {

View File

@@ -1 +1 @@
export { promptAccountId } from "openclaw/plugin-sdk/compat";
export { promptAccountId } from "openclaw/plugin-sdk/mattermost";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
import { describe, expect, it } from "vitest";
import { mattermostOnboardingAdapter } from "./onboarding.js";

View File

@@ -6,7 +6,7 @@ import {
type OpenClawConfig,
type SecretInput,
type WizardPrompter,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import {
listMattermostAccountIds,
resolveDefaultMattermostAccountId,

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
import type { PluginRuntime } from "openclaw/plugin-sdk/mattermost";
let runtime: PluginRuntime | null = null;

View File

@@ -2,7 +2,7 @@ import {
hasConfiguredSecretInput,
normalizeResolvedSecretInputString,
normalizeSecretInputString,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
import { z } from "zod";
export { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString };

View File

@@ -3,7 +3,7 @@ import type {
DmPolicy,
GroupPolicy,
SecretInput,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/mattermost";
export type MattermostChatMode = "oncall" | "onmessage" | "onchar";