Extensions: migrate mattermost plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 01:20:11 -05:00
parent 15f7e329c2
commit 009d4d115a
25 changed files with 35 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { createReplyPrefixOptions } from "openclaw/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { createReplyPrefixOptions } from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
import { z } from "zod";
import { buildSecretInputSchema } from "./secret-input.js";

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,7 @@
import { resolveAllowlistMatchSimple, resolveEffectiveAllowFromLists } from "openclaw/plugin-sdk";
import {
resolveAllowlistMatchSimple,
resolveEffectiveAllowFromLists,
} from "openclaw/plugin-sdk/compat";
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";
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk/compat";
export type ResponsePrefixContext = {
model?: string;

View File

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

View File

@@ -1,4 +1,4 @@
import type { ChannelAccountSnapshot, RuntimeEnv } from "openclaw/plugin-sdk";
import type { ChannelAccountSnapshot, RuntimeEnv } from "openclaw/plugin-sdk/compat";
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";
import { resolveControlCommandGate } from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
import {
buildAgentMediaPayload,
DM_GROUP_ACCESS_REASON,
@@ -27,7 +27,7 @@ import {
warnMissingProviderGroupPolicyFallbackOnce,
listSkillCommandsForAgents,
type HistoryEntry,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { getMattermostRuntime } from "../runtime.js";
import { resolveMattermostAccount } from "./accounts.js";
import {

View File

@@ -1,4 +1,4 @@
import type { BaseProbeResult } from "openclaw/plugin-sdk";
import type { BaseProbeResult } from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { expect, vi } from "vitest";
export function createMattermostTestConfig(): OpenClawConfig {

View File

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

View File

@@ -1,4 +1,4 @@
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "openclaw/plugin-sdk";
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import {
createReplyPrefixOptions,
createTypingCallbacks,
isDangerousNameMatchingEnabled,
logTypingFailure,
resolveControlCommandGate,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/compat";
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").OpenClawConfig;
runtime: import("openclaw/plugin-sdk").RuntimeEnv;
cfg: import("openclaw/plugin-sdk/compat").OpenClawConfig;
runtime: import("openclaw/plugin-sdk/compat").RuntimeEnv;
};
log?: (msg: string) => void;
}) {

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
import {
hasConfiguredSecretInput,
promptSingleChannelSecretInput,
@@ -5,8 +6,7 @@ import {
type OpenClawConfig,
type SecretInput,
type WizardPrompter,
} from "openclaw/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
} from "openclaw/plugin-sdk/compat";
import {
listMattermostAccountIds,
resolveDefaultMattermostAccountId,

View File

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

View File

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

View File

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