Plugins/msteams: migrate to scoped plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 02:33:07 -05:00
parent e42d345aee
commit adb400f9b1
36 changed files with 44 additions and 44 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/msteams";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/msteams";
import { msteamsPlugin } from "./src/channel.js";
import { setMSTeamsRuntime } from "./src/runtime.js";

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime, SsrFPolicy } from "openclaw/plugin-sdk/compat";
import type { PluginRuntime, SsrFPolicy } from "openclaw/plugin-sdk/msteams";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js";
import {

View File

@@ -1,4 +1,4 @@
import { fetchWithSsrFGuard, type SsrFPolicy } from "openclaw/plugin-sdk/compat";
import { fetchWithSsrFGuard, type SsrFPolicy } from "openclaw/plugin-sdk/msteams";
import { getMSTeamsRuntime } from "../runtime.js";
import { downloadMSTeamsAttachments } from "./download.js";
import { downloadAndStoreMSTeamsRemoteMedia } from "./remote-media.js";

View File

@@ -1,4 +1,4 @@
import { buildMediaPayload } from "openclaw/plugin-sdk/compat";
import { buildMediaPayload } from "openclaw/plugin-sdk/msteams";
export function buildMSTeamsMediaPayload(
mediaList: Array<{ path: string; contentType?: string }>,

View File

@@ -1,4 +1,4 @@
import type { SsrFPolicy } from "openclaw/plugin-sdk/compat";
import type { SsrFPolicy } from "openclaw/plugin-sdk/msteams";
import { getMSTeamsRuntime } from "../runtime.js";
import { inferPlaceholder } from "./shared.js";
import type { MSTeamsInboundMedia } from "./types.js";

View File

@@ -4,8 +4,8 @@ import {
isHttpsUrlAllowedByHostnameSuffixAllowlist,
isPrivateIpAddress,
normalizeHostnameSuffixAllowlist,
} from "openclaw/plugin-sdk/compat";
import type { SsrFPolicy } from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import type { SsrFPolicy } from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAttachmentLike } from "./types.js";
type InlineImageCandidate =

View File

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

View File

@@ -2,7 +2,7 @@ import type {
ChannelMessageActionName,
ChannelPlugin,
OpenClawConfig,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import {
buildBaseChannelStatusSummary,
buildChannelConfigSchema,
@@ -12,7 +12,7 @@ import {
PAIRING_APPROVED_MESSAGE,
resolveAllowlistProviderRuntimeGroupPolicy,
resolveDefaultGroupPolicy,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import { listMSTeamsDirectoryGroupsLive, listMSTeamsDirectoryPeersLive } from "./directory-live.js";
import { msteamsOnboardingAdapter } from "./onboarding.js";
import { msteamsOutbound } from "./outbound.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/compat";
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/msteams";
import { searchGraphUsers } from "./graph-users.js";
import {
type GraphChannel,

View File

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

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
import { GRAPH_ROOT } from "./attachments/shared.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { readAccessToken } from "./token-response.js";

View File

@@ -8,7 +8,7 @@ import {
extensionForMime,
extractOriginalFilename,
getFileExtension,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
/**
* Detect MIME type from URL extension or data URL.

View File

@@ -1,7 +1,7 @@
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { SILENT_REPLY_TOKEN, type PluginRuntime } from "openclaw/plugin-sdk/compat";
import { SILENT_REPLY_TOKEN, type PluginRuntime } from "openclaw/plugin-sdk/msteams";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js";
import type { StoredConversationReference } from "./conversation-store.js";

View File

@@ -7,7 +7,7 @@ import {
type ReplyPayload,
SILENT_REPLY_TOKEN,
sleep,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type { StoredConversationReference } from "./conversation-store.js";
import { classifyMSTeamsSendError } from "./errors.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/msteams";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import type { MSTeamsAdapter } from "./messenger.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/msteams";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import { buildFileInfoCard, parseFileConsentInvoke, uploadToConsentUrl } from "./file-consent.js";
import { normalizeMSTeamsConversationId } from "./inbound.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/msteams";
import { describe, expect, it, vi } from "vitest";
import type { MSTeamsMessageHandlerDeps } from "../monitor-handler.js";
import { setMSTeamsRuntime } from "../runtime.js";

View File

@@ -15,7 +15,7 @@ import {
resolveEffectiveAllowFromLists,
resolveDmGroupAccessWithLists,
type HistoryEntry,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import {
buildMSTeamsAttachmentPlaceholder,
buildMSTeamsMediaPayload,

View File

@@ -1,5 +1,5 @@
import { EventEmitter } from "node:events";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/msteams";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import type { MSTeamsPollStore } from "./polls.js";
@@ -15,7 +15,7 @@ const expressControl = vi.hoisted(() => ({
mode: { value: "listening" as "listening" | "error" },
}));
vi.mock("openclaw/plugin-sdk", () => ({
vi.mock("openclaw/plugin-sdk/msteams", () => ({
DEFAULT_WEBHOOK_MAX_BODY_BYTES: 1024 * 1024,
normalizeSecretInputString: (value: unknown) =>
typeof value === "string" && value.trim() ? value.trim() : undefined,

View File

@@ -7,7 +7,7 @@ import {
summarizeMapping,
type OpenClawConfig,
type RuntimeEnv,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import { formatUnknownError } from "./errors.js";

View File

@@ -5,14 +5,14 @@ import type {
DmPolicy,
WizardPrompter,
MSTeamsTeamConfig,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import {
addWildcardAllowFrom,
DEFAULT_ACCOUNT_ID,
formatDocsLink,
mergeAllowFromEntries,
promptChannelAccessConfig,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import {
parseMSTeamsTeamEntry,
resolveMSTeamsChannelAllowlist,

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk/msteams";
import { beforeEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({

View File

@@ -1,4 +1,4 @@
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/compat";
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/msteams";
import { createMSTeamsPollStoreFs } from "./polls.js";
import { getMSTeamsRuntime } from "./runtime.js";
import { sendMessageMSTeams, sendPollMSTeams } from "./send.js";

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
import { describe, expect, it } from "vitest";
import {
isMSTeamsGroupAllowed,

View File

@@ -7,7 +7,7 @@ import type {
MSTeamsConfig,
MSTeamsReplyStyle,
MSTeamsTeamConfig,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import {
buildChannelKeyCandidates,
normalizeChannelSlug,
@@ -15,7 +15,7 @@ import {
resolveToolsBySender,
resolveChannelEntryMatchWithFallback,
resolveNestedAllowlistDecision,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
export type MSTeamsResolvedRouteConfig = {
teamConfig?: MSTeamsTeamConfig;

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
import { describe, expect, it, vi } from "vitest";
const hostMockState = vi.hoisted(() => ({

View File

@@ -1,4 +1,4 @@
import type { BaseProbeResult, MSTeamsConfig } from "openclaw/plugin-sdk/compat";
import type { BaseProbeResult, MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
import { formatUnknownError } from "./errors.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { readAccessToken } from "./token-response.js";

View File

@@ -6,7 +6,7 @@ import {
type OpenClawConfig,
type MSTeamsReplyStyle,
type RuntimeEnv,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type { StoredConversationReference } from "./conversation-store.js";
import {

View File

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

View File

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

View File

@@ -2,7 +2,7 @@ import {
resolveChannelMediaMaxBytes,
type OpenClawConfig,
type PluginRuntime,
} from "openclaw/plugin-sdk/compat";
} from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import type {

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/msteams";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { sendMessageMSTeams } from "./send.js";
@@ -11,7 +11,7 @@ const mockState = vi.hoisted(() => ({
sendMSTeamsMessages: vi.fn(),
}));
vi.mock("openclaw/plugin-sdk", () => ({
vi.mock("openclaw/plugin-sdk/msteams", () => ({
loadOutboundMediaFromUrl: mockState.loadOutboundMediaFromUrl,
}));

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/compat";
import type { OpenClawConfig } from "openclaw/plugin-sdk/msteams";
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/msteams";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import {
classifyMSTeamsSendError,

View File

@@ -1,5 +1,5 @@
import fs from "node:fs";
import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/compat";
import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/msteams";
import { withFileLock as withPathLock } from "./file-lock.js";
const STORE_LOCK_OPTIONS = {

View File

@@ -1,6 +1,6 @@
import os from "node:os";
import path from "node:path";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
import type { PluginRuntime } from "openclaw/plugin-sdk/msteams";
export const msteamsRuntimeStub = {
state: {

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
import {
hasConfiguredSecretInput,
normalizeResolvedSecretInputString,