Extensions: migrate msteams plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 01:20:12 -05:00
parent b2188092a1
commit 10bd6ae3c8
34 changed files with 43 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime, SsrFPolicy } from "openclaw/plugin-sdk";
import type { PluginRuntime, SsrFPolicy } from "openclaw/plugin-sdk/compat";
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";
import { fetchWithSsrFGuard, type SsrFPolicy } from "openclaw/plugin-sdk/compat";
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";
import { buildMediaPayload } from "openclaw/plugin-sdk/compat";
export function buildMSTeamsMediaPayload(
mediaList: Array<{ path: string; contentType?: string }>,

View File

@@ -1,4 +1,4 @@
import type { SsrFPolicy } from "openclaw/plugin-sdk";
import type { SsrFPolicy } from "openclaw/plugin-sdk/compat";
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";
import type { SsrFPolicy } from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import type { SsrFPolicy } from "openclaw/plugin-sdk/compat";
import type { MSTeamsAttachmentLike } from "./types.js";
type InlineImageCandidate =

View File

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

View File

@@ -1,4 +1,8 @@
import type { ChannelMessageActionName, ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
import type {
ChannelMessageActionName,
ChannelPlugin,
OpenClawConfig,
} from "openclaw/plugin-sdk/compat";
import {
buildBaseChannelStatusSummary,
buildChannelConfigSchema,
@@ -8,7 +12,7 @@ import {
PAIRING_APPROVED_MESSAGE,
resolveAllowlistProviderRuntimeGroupPolicy,
resolveDefaultGroupPolicy,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
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";
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/compat";
import { searchGraphUsers } from "./graph-users.js";
import {
type GraphChannel,

View File

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

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
/**
* 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";
import { SILENT_REPLY_TOKEN, type PluginRuntime } from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
import {
buildMSTeamsAttachmentPlaceholder,
buildMSTeamsMediaPayload,

View File

@@ -1,5 +1,5 @@
import { EventEmitter } from "node:events";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import type { MSTeamsPollStore } from "./polls.js";

View File

@@ -7,7 +7,7 @@ import {
summarizeMapping,
type OpenClawConfig,
type RuntimeEnv,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
import {
addWildcardAllowFrom,
DEFAULT_ACCOUNT_ID,
formatDocsLink,
mergeAllowFromEntries,
promptChannelAccessConfig,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import {
parseMSTeamsTeamEntry,
resolveMSTeamsChannelAllowlist,

View File

@@ -1,4 +1,4 @@
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk";
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/compat";
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";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
import { describe, expect, it } from "vitest";
import {
isMSTeamsGroupAllowed,

View File

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

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
import type { MSTeamsConfig } from "openclaw/plugin-sdk/compat";
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";
import type { BaseProbeResult, MSTeamsConfig } from "openclaw/plugin-sdk/compat";
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";
} from "openclaw/plugin-sdk/compat";
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";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
let runtime: PluginRuntime | null = null;

View File

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

View File

@@ -2,7 +2,7 @@ import {
resolveChannelMediaMaxBytes,
type OpenClawConfig,
type PluginRuntime,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
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";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { sendMessageMSTeams } from "./send.js";

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/compat";
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";
import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/compat";
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";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
export const msteamsRuntimeStub = {
state: {

View File

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