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 type { OpenClawPluginApi } from "openclaw/plugin-sdk/msteams";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/msteams";
import { msteamsPlugin } from "./src/channel.js"; import { msteamsPlugin } from "./src/channel.js";
import { setMSTeamsRuntime } from "./src/runtime.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 { beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js"; import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js";
import { 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 { getMSTeamsRuntime } from "../runtime.js";
import { downloadMSTeamsAttachments } from "./download.js"; import { downloadMSTeamsAttachments } from "./download.js";
import { downloadAndStoreMSTeamsRemoteMedia } from "./remote-media.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( export function buildMSTeamsMediaPayload(
mediaList: Array<{ path: string; contentType?: string }>, 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 { getMSTeamsRuntime } from "../runtime.js";
import { inferPlaceholder } from "./shared.js"; import { inferPlaceholder } from "./shared.js";
import type { MSTeamsInboundMedia } from "./types.js"; import type { MSTeamsInboundMedia } from "./types.js";

View File

@@ -4,8 +4,8 @@ import {
isHttpsUrlAllowedByHostnameSuffixAllowlist, isHttpsUrlAllowedByHostnameSuffixAllowlist,
isPrivateIpAddress, isPrivateIpAddress,
normalizeHostnameSuffixAllowlist, normalizeHostnameSuffixAllowlist,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import type { SsrFPolicy } from "openclaw/plugin-sdk/compat"; import type { SsrFPolicy } from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAttachmentLike } from "./types.js"; import type { MSTeamsAttachmentLike } from "./types.js";
type InlineImageCandidate = 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 { describe, expect, it } from "vitest";
import { msteamsPlugin } from "./channel.js"; import { msteamsPlugin } from "./channel.js";

View File

@@ -2,7 +2,7 @@ import type {
ChannelMessageActionName, ChannelMessageActionName,
ChannelPlugin, ChannelPlugin,
OpenClawConfig, OpenClawConfig,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import { import {
buildBaseChannelStatusSummary, buildBaseChannelStatusSummary,
buildChannelConfigSchema, buildChannelConfigSchema,
@@ -12,7 +12,7 @@ import {
PAIRING_APPROVED_MESSAGE, PAIRING_APPROVED_MESSAGE,
resolveAllowlistProviderRuntimeGroupPolicy, resolveAllowlistProviderRuntimeGroupPolicy,
resolveDefaultGroupPolicy, resolveDefaultGroupPolicy,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import { listMSTeamsDirectoryGroupsLive, listMSTeamsDirectoryPeersLive } from "./directory-live.js"; import { listMSTeamsDirectoryGroupsLive, listMSTeamsDirectoryPeersLive } from "./directory-live.js";
import { msteamsOnboardingAdapter } from "./onboarding.js"; import { msteamsOnboardingAdapter } from "./onboarding.js";
import { msteamsOutbound } from "./outbound.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 { searchGraphUsers } from "./graph-users.js";
import { import {
type GraphChannel, 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 { GRAPH_ROOT } from "./attachments/shared.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js"; import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { readAccessToken } from "./token-response.js"; import { readAccessToken } from "./token-response.js";

View File

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

View File

@@ -1,7 +1,7 @@
import { mkdtemp, rm, writeFile } from "node:fs/promises"; import { mkdtemp, rm, writeFile } from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; 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 { beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js"; import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";

View File

@@ -7,7 +7,7 @@ import {
type ReplyPayload, type ReplyPayload,
SILENT_REPLY_TOKEN, SILENT_REPLY_TOKEN,
sleep, sleep,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js"; import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";
import { classifyMSTeamsSendError } from "./errors.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 { beforeEach, describe, expect, it, vi } from "vitest";
import type { MSTeamsConversationStore } from "./conversation-store.js"; import type { MSTeamsConversationStore } from "./conversation-store.js";
import type { MSTeamsAdapter } from "./messenger.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 type { MSTeamsConversationStore } from "./conversation-store.js";
import { buildFileInfoCard, parseFileConsentInvoke, uploadToConsentUrl } from "./file-consent.js"; import { buildFileInfoCard, parseFileConsentInvoke, uploadToConsentUrl } from "./file-consent.js";
import { normalizeMSTeamsConversationId } from "./inbound.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 { describe, expect, it, vi } from "vitest";
import type { MSTeamsMessageHandlerDeps } from "../monitor-handler.js"; import type { MSTeamsMessageHandlerDeps } from "../monitor-handler.js";
import { setMSTeamsRuntime } from "../runtime.js"; import { setMSTeamsRuntime } from "../runtime.js";

View File

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

View File

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

View File

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

View File

@@ -5,14 +5,14 @@ import type {
DmPolicy, DmPolicy,
WizardPrompter, WizardPrompter,
MSTeamsTeamConfig, MSTeamsTeamConfig,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import { import {
addWildcardAllowFrom, addWildcardAllowFrom,
DEFAULT_ACCOUNT_ID, DEFAULT_ACCOUNT_ID,
formatDocsLink, formatDocsLink,
mergeAllowFromEntries, mergeAllowFromEntries,
promptChannelAccessConfig, promptChannelAccessConfig,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import { import {
parseMSTeamsTeamEntry, parseMSTeamsTeamEntry,
resolveMSTeamsChannelAllowlist, 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"; import { beforeEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({ 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 { createMSTeamsPollStoreFs } from "./polls.js";
import { getMSTeamsRuntime } from "./runtime.js"; import { getMSTeamsRuntime } from "./runtime.js";
import { sendMessageMSTeams, sendPollMSTeams } from "./send.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 { describe, expect, it } from "vitest";
import { import {
isMSTeamsGroupAllowed, isMSTeamsGroupAllowed,

View File

@@ -7,7 +7,7 @@ import type {
MSTeamsConfig, MSTeamsConfig,
MSTeamsReplyStyle, MSTeamsReplyStyle,
MSTeamsTeamConfig, MSTeamsTeamConfig,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import { import {
buildChannelKeyCandidates, buildChannelKeyCandidates,
normalizeChannelSlug, normalizeChannelSlug,
@@ -15,7 +15,7 @@ import {
resolveToolsBySender, resolveToolsBySender,
resolveChannelEntryMatchWithFallback, resolveChannelEntryMatchWithFallback,
resolveNestedAllowlistDecision, resolveNestedAllowlistDecision,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
export type MSTeamsResolvedRouteConfig = { export type MSTeamsResolvedRouteConfig = {
teamConfig?: MSTeamsTeamConfig; 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"; import { describe, expect, it, vi } from "vitest";
const hostMockState = vi.hoisted(() => ({ 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 { formatUnknownError } from "./errors.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js"; import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { readAccessToken } from "./token-response.js"; import { readAccessToken } from "./token-response.js";

View File

@@ -6,7 +6,7 @@ import {
type OpenClawConfig, type OpenClawConfig,
type MSTeamsReplyStyle, type MSTeamsReplyStyle,
type RuntimeEnv, type RuntimeEnv,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js"; import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";
import { 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; let runtime: PluginRuntime | null = null;

View File

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

View File

@@ -2,7 +2,7 @@ import {
resolveChannelMediaMaxBytes, resolveChannelMediaMaxBytes,
type OpenClawConfig, type OpenClawConfig,
type PluginRuntime, type PluginRuntime,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/msteams";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js"; import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js"; import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import type { 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 { beforeEach, describe, expect, it, vi } from "vitest";
import { sendMessageMSTeams } from "./send.js"; import { sendMessageMSTeams } from "./send.js";
@@ -11,7 +11,7 @@ const mockState = vi.hoisted(() => ({
sendMSTeamsMessages: vi.fn(), sendMSTeamsMessages: vi.fn(),
})); }));
vi.mock("openclaw/plugin-sdk", () => ({ vi.mock("openclaw/plugin-sdk/msteams", () => ({
loadOutboundMediaFromUrl: mockState.loadOutboundMediaFromUrl, loadOutboundMediaFromUrl: mockState.loadOutboundMediaFromUrl,
})); }));

View File

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

View File

@@ -1,5 +1,5 @@
import fs from "node:fs"; 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"; import { withFileLock as withPathLock } from "./file-lock.js";
const STORE_LOCK_OPTIONS = { const STORE_LOCK_OPTIONS = {

View File

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

View File

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