mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-22 15:31:07 +00:00
175 lines
7.5 KiB
TypeScript
175 lines
7.5 KiB
TypeScript
import * as extensionApi from "openclaw/extension-api";
|
|
import * as compatSdk from "openclaw/plugin-sdk/compat";
|
|
import * as discordSdk from "openclaw/plugin-sdk/discord";
|
|
import * as imessageSdk from "openclaw/plugin-sdk/imessage";
|
|
import * as lineSdk from "openclaw/plugin-sdk/line";
|
|
import * as msteamsSdk from "openclaw/plugin-sdk/msteams";
|
|
import * as nostrSdk from "openclaw/plugin-sdk/nostr";
|
|
import * as signalSdk from "openclaw/plugin-sdk/signal";
|
|
import * as slackSdk from "openclaw/plugin-sdk/slack";
|
|
import * as telegramSdk from "openclaw/plugin-sdk/telegram";
|
|
import * as whatsappSdk from "openclaw/plugin-sdk/whatsapp";
|
|
import { describe, expect, it } from "vitest";
|
|
import { pluginSdkSubpaths } from "./entrypoints.js";
|
|
|
|
const importPluginSdkSubpath = (specifier: string) => import(/* @vite-ignore */ specifier);
|
|
|
|
const bundledExtensionSubpathLoaders = pluginSdkSubpaths.map((id: string) => ({
|
|
id,
|
|
load: () => importPluginSdkSubpath(`openclaw/plugin-sdk/${id}`),
|
|
}));
|
|
|
|
describe("plugin-sdk subpath exports", () => {
|
|
it("exports compat helpers", () => {
|
|
expect(typeof compatSdk.emptyPluginConfigSchema).toBe("function");
|
|
expect(typeof compatSdk.resolveControlCommandGate).toBe("function");
|
|
});
|
|
|
|
it("exports Discord helpers", () => {
|
|
expect(typeof discordSdk.resolveDiscordAccount).toBe("function");
|
|
expect(typeof discordSdk.inspectDiscordAccount).toBe("function");
|
|
expect(typeof discordSdk.discordSetupWizard).toBe("object");
|
|
expect(typeof discordSdk.discordSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Slack helpers", () => {
|
|
expect(typeof slackSdk.resolveSlackAccount).toBe("function");
|
|
expect(typeof slackSdk.inspectSlackAccount).toBe("function");
|
|
expect(typeof slackSdk.handleSlackMessageAction).toBe("function");
|
|
expect(typeof slackSdk.slackSetupWizard).toBe("object");
|
|
expect(typeof slackSdk.slackSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Telegram helpers", () => {
|
|
expect(typeof telegramSdk.resolveTelegramAccount).toBe("function");
|
|
expect(typeof telegramSdk.inspectTelegramAccount).toBe("function");
|
|
expect(typeof telegramSdk.telegramSetupWizard).toBe("object");
|
|
expect(typeof telegramSdk.telegramSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Signal helpers", () => {
|
|
expect(typeof signalSdk.resolveSignalAccount).toBe("function");
|
|
expect(typeof signalSdk.signalSetupWizard).toBe("object");
|
|
expect(typeof signalSdk.signalSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports iMessage helpers", () => {
|
|
expect(typeof imessageSdk.resolveIMessageAccount).toBe("function");
|
|
expect(typeof imessageSdk.imessageSetupWizard).toBe("object");
|
|
expect(typeof imessageSdk.imessageSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports IRC helpers", async () => {
|
|
const ircSdk = await import("openclaw/plugin-sdk/irc");
|
|
expect(typeof ircSdk.resolveIrcAccount).toBe("function");
|
|
expect(typeof ircSdk.ircSetupWizard).toBe("object");
|
|
expect(typeof ircSdk.ircSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports WhatsApp helpers", () => {
|
|
// WhatsApp-specific functions (resolveWhatsAppAccount, whatsappOnboardingAdapter) moved to extensions/whatsapp/src/
|
|
expect(typeof whatsappSdk.WhatsAppConfigSchema).toBe("object");
|
|
expect(typeof whatsappSdk.resolveWhatsAppOutboundTarget).toBe("function");
|
|
expect(typeof whatsappSdk.resolveWhatsAppMentionStripRegexes).toBe("function");
|
|
expect("resolveWhatsAppMentionStripPatterns" in whatsappSdk).toBe(false);
|
|
});
|
|
|
|
it("exports Feishu helpers", async () => {
|
|
const feishuSdk = await import("openclaw/plugin-sdk/feishu");
|
|
expect(typeof feishuSdk.feishuSetupWizard).toBe("object");
|
|
expect(typeof feishuSdk.feishuSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports LINE helpers", () => {
|
|
expect(typeof lineSdk.processLineMessage).toBe("function");
|
|
expect(typeof lineSdk.createInfoCard).toBe("function");
|
|
expect(typeof lineSdk.lineSetupWizard).toBe("object");
|
|
expect(typeof lineSdk.lineSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Microsoft Teams helpers", () => {
|
|
expect(typeof msteamsSdk.resolveControlCommandGate).toBe("function");
|
|
expect(typeof msteamsSdk.loadOutboundMediaFromUrl).toBe("function");
|
|
expect(typeof msteamsSdk.msteamsSetupWizard).toBe("object");
|
|
expect(typeof msteamsSdk.msteamsSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Nostr helpers", () => {
|
|
expect(typeof nostrSdk.nostrSetupWizard).toBe("object");
|
|
expect(typeof nostrSdk.nostrSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Google Chat helpers", async () => {
|
|
const googlechatSdk = await import("openclaw/plugin-sdk/googlechat");
|
|
expect(typeof googlechatSdk.googlechatSetupWizard).toBe("object");
|
|
expect(typeof googlechatSdk.googlechatSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Zalo helpers", async () => {
|
|
const zaloSdk = await import("openclaw/plugin-sdk/zalo");
|
|
expect(typeof zaloSdk.zaloSetupWizard).toBe("object");
|
|
expect(typeof zaloSdk.zaloSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Synology Chat helpers", async () => {
|
|
const synologyChatSdk = await import("openclaw/plugin-sdk/synology-chat");
|
|
expect(typeof synologyChatSdk.synologyChatSetupWizard).toBe("object");
|
|
expect(typeof synologyChatSdk.synologyChatSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Zalouser helpers", async () => {
|
|
const zalouserSdk = await import("openclaw/plugin-sdk/zalouser");
|
|
expect(typeof zalouserSdk.zalouserSetupWizard).toBe("object");
|
|
expect(typeof zalouserSdk.zalouserSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports Tlon helpers", async () => {
|
|
const tlonSdk = await import("openclaw/plugin-sdk/tlon");
|
|
expect(typeof tlonSdk.fetchWithSsrFGuard).toBe("function");
|
|
expect(typeof tlonSdk.tlonSetupWizard).toBe("object");
|
|
expect(typeof tlonSdk.tlonSetupAdapter).toBe("object");
|
|
});
|
|
|
|
it("exports acpx helpers", async () => {
|
|
const acpxSdk = await import("openclaw/plugin-sdk/acpx");
|
|
expect(typeof acpxSdk.listKnownProviderAuthEnvVarNames).toBe("function");
|
|
expect(typeof acpxSdk.omitEnvKeysCaseInsensitive).toBe("function");
|
|
});
|
|
|
|
it("resolves bundled extension subpaths", async () => {
|
|
for (const { id, load } of bundledExtensionSubpathLoaders) {
|
|
const mod = await load();
|
|
expect(typeof mod).toBe("object");
|
|
expect(mod, `subpath ${id} should resolve`).toBeTruthy();
|
|
}
|
|
});
|
|
|
|
it("keeps the newly added bundled plugin-sdk contracts available", async () => {
|
|
const bluebubbles = await import("openclaw/plugin-sdk/bluebubbles");
|
|
expect(typeof bluebubbles.parseFiniteNumber).toBe("function");
|
|
|
|
const matrix = await import("openclaw/plugin-sdk/matrix");
|
|
expect(typeof matrix.matrixSetupWizard).toBe("object");
|
|
expect(typeof matrix.matrixSetupAdapter).toBe("object");
|
|
|
|
const mattermost = await import("openclaw/plugin-sdk/mattermost");
|
|
expect(typeof mattermost.parseStrictPositiveInteger).toBe("function");
|
|
|
|
const nextcloudTalk = await import("openclaw/plugin-sdk/nextcloud-talk");
|
|
expect(typeof nextcloudTalk.waitForAbortSignal).toBe("function");
|
|
|
|
const twitch = await import("openclaw/plugin-sdk/twitch");
|
|
expect(typeof twitch.DEFAULT_ACCOUNT_ID).toBe("string");
|
|
expect(typeof twitch.normalizeAccountId).toBe("function");
|
|
expect(typeof twitch.twitchSetupWizard).toBe("object");
|
|
expect(typeof twitch.twitchSetupAdapter).toBe("object");
|
|
|
|
const zalo = await import("openclaw/plugin-sdk/zalo");
|
|
expect(typeof zalo.resolveClientIp).toBe("function");
|
|
});
|
|
|
|
it("exports the extension api bridge", () => {
|
|
expect(typeof extensionApi.runEmbeddedPiAgent).toBe("function");
|
|
});
|
|
});
|