mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Plugins/mattermost: migrate to scoped plugin-sdk imports
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/mattermost";
|
||||||
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core";
|
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/mattermost";
|
||||||
import { mattermostPlugin } from "./src/channel.js";
|
import { mattermostPlugin } from "./src/channel.js";
|
||||||
import { getSlashCommandState, registerSlashCommandRoute } from "./src/mattermost/slash-state.js";
|
import { getSlashCommandState, registerSlashCommandRoute } from "./src/mattermost/slash-state.js";
|
||||||
import { setMattermostRuntime } from "./src/runtime.js";
|
import { setMattermostRuntime } from "./src/runtime.js";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
|
||||||
import { createReplyPrefixOptions } from "openclaw/plugin-sdk/compat";
|
import { createReplyPrefixOptions } from "openclaw/plugin-sdk/mattermost";
|
||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
const { sendMessageMattermostMock } = vi.hoisted(() => ({
|
const { sendMessageMattermostMock } = vi.hoisted(() => ({
|
||||||
sendMessageMattermostMock: vi.fn(),
|
sendMessageMattermostMock: vi.fn(),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
type ChannelMessageActionAdapter,
|
type ChannelMessageActionAdapter,
|
||||||
type ChannelMessageActionName,
|
type ChannelMessageActionName,
|
||||||
type ChannelPlugin,
|
type ChannelPlugin,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import { MattermostConfigSchema } from "./config-schema.js";
|
import { MattermostConfigSchema } from "./config-schema.js";
|
||||||
import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
|
import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
GroupPolicySchema,
|
GroupPolicySchema,
|
||||||
MarkdownConfigSchema,
|
MarkdownConfigSchema,
|
||||||
requireOpenAllowFrom,
|
requireOpenAllowFrom,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { buildSecretInputSchema } from "./secret-input.js";
|
import { buildSecretInputSchema } from "./secret-input.js";
|
||||||
|
|
||||||
|
|||||||
@@ -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";
|
import { resolveMattermostAccount } from "./mattermost/accounts.js";
|
||||||
|
|
||||||
export function resolveMattermostGroupRequireMention(
|
export function resolveMattermostGroupRequireMention(
|
||||||
|
|||||||
@@ -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 { describe, expect, it } from "vitest";
|
||||||
import { resolveDefaultMattermostAccountId } from "./accounts.js";
|
import { resolveDefaultMattermostAccountId } from "./accounts.js";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
normalizeAccountId,
|
normalizeAccountId,
|
||||||
normalizeOptionalAccountId,
|
normalizeOptionalAccountId,
|
||||||
} from "openclaw/plugin-sdk/account-id";
|
} 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 { normalizeResolvedSecretInputString, normalizeSecretInputString } from "../secret-input.js";
|
||||||
import type { MattermostAccountConfig, MattermostChatMode } from "../types.js";
|
import type { MattermostAccountConfig, MattermostChatMode } from "../types.js";
|
||||||
import { normalizeMattermostBaseUrl } from "./client.js";
|
import { normalizeMattermostBaseUrl } from "./client.js";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
resolveAllowlistMatchSimple,
|
resolveAllowlistMatchSimple,
|
||||||
resolveEffectiveAllowFromLists,
|
resolveEffectiveAllowFromLists,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
|
|
||||||
export function normalizeMattermostAllowEntry(entry: string): string {
|
export function normalizeMattermostAllowEntry(entry: string): string {
|
||||||
const trimmed = entry.trim();
|
const trimmed = entry.trim();
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import {
|
|||||||
formatInboundFromLabel as formatInboundFromLabelShared,
|
formatInboundFromLabel as formatInboundFromLabelShared,
|
||||||
resolveThreadSessionKeys as resolveThreadSessionKeysShared,
|
resolveThreadSessionKeys as resolveThreadSessionKeysShared,
|
||||||
type OpenClawConfig,
|
type OpenClawConfig,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk/compat";
|
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk/mattermost";
|
||||||
|
|
||||||
export type ResponsePrefixContext = {
|
export type ResponsePrefixContext = {
|
||||||
model?: string;
|
model?: string;
|
||||||
|
|||||||
@@ -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 { describe, expect, it, vi } from "vitest";
|
||||||
import {
|
import {
|
||||||
createMattermostConnectOnce,
|
createMattermostConnectOnce,
|
||||||
|
|||||||
@@ -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 WebSocket from "ws";
|
||||||
import type { MattermostPost } from "./client.js";
|
import type { MattermostPost } from "./client.js";
|
||||||
import { rawDataToString } from "./monitor-helpers.js";
|
import { rawDataToString } from "./monitor-helpers.js";
|
||||||
|
|||||||
@@ -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 { describe, expect, it } from "vitest";
|
||||||
import { resolveMattermostEffectiveAllowFromLists } from "./monitor-auth.js";
|
import { resolveMattermostEffectiveAllowFromLists } from "./monitor-auth.js";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type {
|
|||||||
OpenClawConfig,
|
OpenClawConfig,
|
||||||
ReplyPayload,
|
ReplyPayload,
|
||||||
RuntimeEnv,
|
RuntimeEnv,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import {
|
import {
|
||||||
buildAgentMediaPayload,
|
buildAgentMediaPayload,
|
||||||
DM_GROUP_ACCESS_REASON,
|
DM_GROUP_ACCESS_REASON,
|
||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
warnMissingProviderGroupPolicyFallbackOnce,
|
warnMissingProviderGroupPolicyFallbackOnce,
|
||||||
listSkillCommandsForAgents,
|
listSkillCommandsForAgents,
|
||||||
type HistoryEntry,
|
type HistoryEntry,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import { getMattermostRuntime } from "../runtime.js";
|
import { getMattermostRuntime } from "../runtime.js";
|
||||||
import { resolveMattermostAccount } from "./accounts.js";
|
import { resolveMattermostAccount } from "./accounts.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -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";
|
import { normalizeMattermostBaseUrl, readMattermostError, type MattermostUser } from "./client.js";
|
||||||
|
|
||||||
export type MattermostProbe = BaseProbeResult & {
|
export type MattermostProbe = BaseProbeResult & {
|
||||||
|
|||||||
@@ -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";
|
import { expect, vi } from "vitest";
|
||||||
|
|
||||||
export function createMattermostTestConfig(): OpenClawConfig {
|
export function createMattermostTestConfig(): OpenClawConfig {
|
||||||
|
|||||||
@@ -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 { resolveMattermostAccount } from "./accounts.js";
|
||||||
import { createMattermostClient, fetchMattermostMe, type MattermostClient } from "./client.js";
|
import { createMattermostClient, fetchMattermostMe, type MattermostClient } from "./client.js";
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const mockState = vi.hoisted(() => ({
|
|||||||
uploadMattermostFile: vi.fn(),
|
uploadMattermostFile: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("openclaw/plugin-sdk", () => ({
|
vi.mock("openclaw/plugin-sdk/mattermost", () => ({
|
||||||
loadOutboundMediaFromUrl: mockState.loadOutboundMediaFromUrl,
|
loadOutboundMediaFromUrl: mockState.loadOutboundMediaFromUrl,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -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 { getMattermostRuntime } from "../runtime.js";
|
||||||
import { resolveMattermostAccount } from "./accounts.js";
|
import { resolveMattermostAccount } from "./accounts.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { PassThrough } from "node:stream";
|
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 { describe, expect, it } from "vitest";
|
||||||
import type { ResolvedMattermostAccount } from "./accounts.js";
|
import type { ResolvedMattermostAccount } from "./accounts.js";
|
||||||
import { createSlashCommandHttpHandler } from "./slash-http.js";
|
import { createSlashCommandHttpHandler } from "./slash-http.js";
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
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 {
|
import {
|
||||||
createReplyPrefixOptions,
|
createReplyPrefixOptions,
|
||||||
createTypingCallbacks,
|
createTypingCallbacks,
|
||||||
isDangerousNameMatchingEnabled,
|
isDangerousNameMatchingEnabled,
|
||||||
logTypingFailure,
|
logTypingFailure,
|
||||||
resolveControlCommandGate,
|
resolveControlCommandGate,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import type { ResolvedMattermostAccount } from "../mattermost/accounts.js";
|
import type { ResolvedMattermostAccount } from "../mattermost/accounts.js";
|
||||||
import { getMattermostRuntime } from "../runtime.js";
|
import { getMattermostRuntime } from "../runtime.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
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 type { ResolvedMattermostAccount } from "./accounts.js";
|
||||||
import { resolveSlashCommandConfig, type MattermostRegisteredCommand } from "./slash-commands.js";
|
import { resolveSlashCommandConfig, type MattermostRegisteredCommand } from "./slash-commands.js";
|
||||||
import { createSlashCommandHttpHandler } from "./slash-http.js";
|
import { createSlashCommandHttpHandler } from "./slash-http.js";
|
||||||
@@ -86,8 +86,8 @@ export function activateSlashCommands(params: {
|
|||||||
registeredCommands: MattermostRegisteredCommand[];
|
registeredCommands: MattermostRegisteredCommand[];
|
||||||
triggerMap?: Map<string, string>;
|
triggerMap?: Map<string, string>;
|
||||||
api: {
|
api: {
|
||||||
cfg: import("openclaw/plugin-sdk/compat").OpenClawConfig;
|
cfg: import("openclaw/plugin-sdk/mattermost").OpenClawConfig;
|
||||||
runtime: import("openclaw/plugin-sdk/compat").RuntimeEnv;
|
runtime: import("openclaw/plugin-sdk/mattermost").RuntimeEnv;
|
||||||
};
|
};
|
||||||
log?: (msg: string) => void;
|
log?: (msg: string) => void;
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export { promptAccountId } from "openclaw/plugin-sdk/compat";
|
export { promptAccountId } from "openclaw/plugin-sdk/mattermost";
|
||||||
|
|||||||
@@ -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 { describe, expect, it } from "vitest";
|
||||||
import { mattermostOnboardingAdapter } from "./onboarding.js";
|
import { mattermostOnboardingAdapter } from "./onboarding.js";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
type OpenClawConfig,
|
type OpenClawConfig,
|
||||||
type SecretInput,
|
type SecretInput,
|
||||||
type WizardPrompter,
|
type WizardPrompter,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import {
|
import {
|
||||||
listMattermostAccountIds,
|
listMattermostAccountIds,
|
||||||
resolveDefaultMattermostAccountId,
|
resolveDefaultMattermostAccountId,
|
||||||
|
|||||||
@@ -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;
|
let runtime: PluginRuntime | null = null;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
hasConfiguredSecretInput,
|
hasConfiguredSecretInput,
|
||||||
normalizeResolvedSecretInputString,
|
normalizeResolvedSecretInputString,
|
||||||
normalizeSecretInputString,
|
normalizeSecretInputString,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString };
|
export { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString };
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type {
|
|||||||
DmPolicy,
|
DmPolicy,
|
||||||
GroupPolicy,
|
GroupPolicy,
|
||||||
SecretInput,
|
SecretInput,
|
||||||
} from "openclaw/plugin-sdk/compat";
|
} from "openclaw/plugin-sdk/mattermost";
|
||||||
|
|
||||||
export type MattermostChatMode = "oncall" | "onmessage" | "onchar";
|
export type MattermostChatMode = "oncall" | "onmessage" | "onchar";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user