refactor: consolidate plugin sdk surface

This commit is contained in:
Peter Steinberger
2026-03-20 18:50:25 +00:00
parent 46854a84a4
commit 62ddc9d9e0
294 changed files with 2071 additions and 1268 deletions

View File

@@ -23,7 +23,7 @@ afterEach(() => {
});
describe("plugin loader git path regression", () => {
it("loads git-style package extension entries when they import plugin-sdk channel-runtime (#49806)", async () => {
it("loads git-style package extension entries when they import plugin-sdk infra-runtime (#49806)", async () => {
const copiedExtensionRoot = path.join(makeTempDir(), "extensions", "imessage");
const copiedSourceDir = path.join(copiedExtensionRoot, "src");
const copiedPluginSdkDir = path.join(copiedExtensionRoot, "plugin-sdk");
@@ -33,7 +33,7 @@ describe("plugin loader git path regression", () => {
fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8");
fs.writeFileSync(
path.join(copiedSourceDir, "channel.runtime.ts"),
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime";
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime";
import { PAIRING_APPROVED_MESSAGE } from "../runtime-api.js";
export const copiedRuntimeMarker = {
@@ -49,7 +49,7 @@ export const copiedRuntimeMarker = {
`,
"utf-8",
);
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "channel-runtime.ts");
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts");
fs.writeFileSync(
copiedChannelRuntimeShim,
`export function resolveOutboundSendDep() {
@@ -77,7 +77,7 @@ export const copiedRuntimeMarker = {
tryNative: false,
extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
alias: {
"openclaw/plugin-sdk/channel-runtime": ${JSON.stringify(copiedChannelRuntimeShim)},
"openclaw/plugin-sdk/infra-runtime": ${JSON.stringify(copiedChannelRuntimeShim)},
},
});
const mod = withAlias(${JSON.stringify(copiedChannelRuntime)});

View File

@@ -3683,7 +3683,7 @@ module.exports = {
fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8");
fs.writeFileSync(
path.join(copiedSourceDir, "channel.runtime.ts"),
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime";
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime";
export const syntheticRuntimeMarker = {
resolveOutboundSendDep,
@@ -3691,7 +3691,7 @@ export const syntheticRuntimeMarker = {
`,
"utf-8",
);
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "channel-runtime.ts");
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts");
fs.writeFileSync(
copiedChannelRuntimeShim,
`export function resolveOutboundSendDep() {
@@ -3714,7 +3714,7 @@ export const syntheticRuntimeMarker = {
const withAlias = createJiti(jitiBaseUrl, {
...__testing.buildPluginLoaderJitiOptions({
"openclaw/plugin-sdk/channel-runtime": copiedChannelRuntimeShim,
"openclaw/plugin-sdk/infra-runtime": copiedChannelRuntimeShim,
}),
tryNative: false,
});

View File

@@ -1,12 +1,12 @@
import { auditDiscordChannelPermissions as auditDiscordChannelPermissionsImpl } from "openclaw/plugin-sdk/discord";
import {
auditDiscordChannelPermissions as auditDiscordChannelPermissionsImpl,
listDiscordDirectoryGroupsLive as listDiscordDirectoryGroupsLiveImpl,
listDiscordDirectoryPeersLive as listDiscordDirectoryPeersLiveImpl,
} from "openclaw/plugin-sdk/discord";
import { monitorDiscordProvider as monitorDiscordProviderImpl } from "openclaw/plugin-sdk/discord";
import { probeDiscord as probeDiscordImpl } from "openclaw/plugin-sdk/discord";
import { resolveDiscordChannelAllowlist as resolveDiscordChannelAllowlistImpl } from "openclaw/plugin-sdk/discord";
import { resolveDiscordUserAllowlist as resolveDiscordUserAllowlistImpl } from "openclaw/plugin-sdk/discord";
monitorDiscordProvider as monitorDiscordProviderImpl,
probeDiscord as probeDiscordImpl,
resolveDiscordChannelAllowlist as resolveDiscordChannelAllowlistImpl,
resolveDiscordUserAllowlist as resolveDiscordUserAllowlistImpl,
} from "../../../extensions/discord/runtime-api.js";
import {
createThreadDiscord as createThreadDiscordImpl,
deleteMessageDiscord as deleteMessageDiscordImpl,
@@ -18,7 +18,7 @@ import {
sendPollDiscord as sendPollDiscordImpl,
sendTypingDiscord as sendTypingDiscordImpl,
unpinMessageDiscord as unpinMessageDiscordImpl,
} from "openclaw/plugin-sdk/discord";
} from "../../../extensions/discord/runtime-api.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
type RuntimeDiscordOps = Pick<

View File

@@ -1,5 +1,5 @@
import { discordMessageActions } from "openclaw/plugin-sdk/discord";
import {
discordMessageActions,
getThreadBindingManager,
resolveThreadBindingIdleTimeoutMs,
resolveThreadBindingInactivityExpiresAt,
@@ -8,7 +8,7 @@ import {
setThreadBindingIdleTimeoutBySessionKey,
setThreadBindingMaxAgeBySessionKey,
unbindThreadBindingsBySessionKey,
} from "openclaw/plugin-sdk/discord";
} from "../../../extensions/discord/runtime-api.js";
import {
createLazyRuntimeMethodBinder,
createLazyRuntimeSurface,

View File

@@ -2,7 +2,7 @@ import {
monitorIMessageProvider,
probeIMessage,
sendMessageIMessage,
} from "openclaw/plugin-sdk/imessage";
} from "../../../extensions/imessage/runtime-api.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
export function createRuntimeIMessage(): PluginRuntimeChannel["imessage"] {

View File

@@ -1,7 +1,7 @@
import {
setMatrixThreadBindingIdleTimeoutBySessionKey,
setMatrixThreadBindingMaxAgeBySessionKey,
} from "openclaw/plugin-sdk/matrix";
} from "../../../extensions/matrix/runtime-api.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
export function createRuntimeMatrix(): PluginRuntimeChannel["matrix"] {

View File

@@ -1,13 +1,13 @@
import {
listSlackDirectoryGroupsLive as listSlackDirectoryGroupsLiveImpl,
listSlackDirectoryPeersLive as listSlackDirectoryPeersLiveImpl,
} from "openclaw/plugin-sdk/slack";
import { monitorSlackProvider as monitorSlackProviderImpl } from "openclaw/plugin-sdk/slack";
import { probeSlack as probeSlackImpl } from "openclaw/plugin-sdk/slack";
import { resolveSlackChannelAllowlist as resolveSlackChannelAllowlistImpl } from "openclaw/plugin-sdk/slack";
import { resolveSlackUserAllowlist as resolveSlackUserAllowlistImpl } from "openclaw/plugin-sdk/slack";
import { sendMessageSlack as sendMessageSlackImpl } from "openclaw/plugin-sdk/slack";
import { handleSlackAction as handleSlackActionImpl } from "openclaw/plugin-sdk/slack";
monitorSlackProvider as monitorSlackProviderImpl,
probeSlack as probeSlackImpl,
resolveSlackChannelAllowlist as resolveSlackChannelAllowlistImpl,
resolveSlackUserAllowlist as resolveSlackUserAllowlistImpl,
sendMessageSlack as sendMessageSlackImpl,
handleSlackAction as handleSlackActionImpl,
} from "../../../extensions/slack/runtime-api.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
type RuntimeSlackOps = Pick<

View File

@@ -1,6 +1,8 @@
import { auditTelegramGroupMembership as auditTelegramGroupMembershipImpl } from "openclaw/plugin-sdk/telegram";
import { monitorTelegramProvider as monitorTelegramProviderImpl } from "openclaw/plugin-sdk/telegram";
import { probeTelegram as probeTelegramImpl } from "openclaw/plugin-sdk/telegram";
import {
auditTelegramGroupMembership as auditTelegramGroupMembershipImpl,
monitorTelegramProvider as monitorTelegramProviderImpl,
probeTelegram as probeTelegramImpl,
} from "../../../extensions/telegram/runtime-api.js";
import {
deleteMessageTelegram as deleteMessageTelegramImpl,
editMessageReplyMarkupTelegram as editMessageReplyMarkupTelegramImpl,
@@ -11,7 +13,7 @@ import {
sendPollTelegram as sendPollTelegramImpl,
sendTypingTelegram as sendTypingTelegramImpl,
unpinMessageTelegram as unpinMessageTelegramImpl,
} from "openclaw/plugin-sdk/telegram";
} from "../../../extensions/telegram/runtime-api.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
type RuntimeTelegramOps = Pick<

View File

@@ -1,10 +1,10 @@
import { collectTelegramUnmentionedGroupIds } from "openclaw/plugin-sdk/telegram";
import { telegramMessageActions } from "openclaw/plugin-sdk/telegram";
import {
collectTelegramUnmentionedGroupIds,
resolveTelegramToken,
setTelegramThreadBindingIdleTimeoutBySessionKey,
setTelegramThreadBindingMaxAgeBySessionKey,
} from "openclaw/plugin-sdk/telegram";
import { resolveTelegramToken } from "openclaw/plugin-sdk/telegram";
telegramMessageActions,
} from "../../../extensions/telegram/runtime-api.js";
import {
createLazyRuntimeMethodBinder,
createLazyRuntimeSurface,