refactor: clean bundled channel bootstrap boundaries

This commit is contained in:
Peter Steinberger
2026-04-05 18:18:47 +01:00
parent cb76e5c899
commit 3126809cb0
88 changed files with 1107 additions and 472 deletions

View File

@@ -1,4 +1,15 @@
export { feishuPlugin } from "./src/channel.js";
export { registerFeishuDocTools } from "./src/docx.js";
export { registerFeishuChatTools } from "./src/chat.js";
export { registerFeishuWikiTools } from "./src/wiki.js";
export { registerFeishuDriveTools } from "./src/drive.js";
export { registerFeishuPermTools } from "./src/perm.js";
export { registerFeishuBitableTools } from "./src/bitable.js";
export {
handleFeishuSubagentDeliveryTarget,
handleFeishuSubagentEnded,
handleFeishuSubagentSpawning,
} from "./src/subagent-hooks.js";
export * from "./src/conversation-id.js";
export * from "./src/setup-core.js";
export * from "./src/setup-surface.js";

View File

@@ -1,14 +1,16 @@
import { defineChannelPluginEntry } from "openclaw/plugin-sdk/channel-core";
import { feishuPlugin } from "./src/channel.js";
import { setFeishuRuntime } from "./src/runtime.js";
import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
export { feishuPlugin } from "./src/channel.js";
export { setFeishuRuntime } from "./src/runtime.js";
export default defineChannelPluginEntry({
export default defineBundledChannelEntry({
id: "feishu",
name: "Feishu",
description: "Feishu/Lark channel plugin",
plugin: feishuPlugin,
setRuntime: setFeishuRuntime,
importMetaUrl: import.meta.url,
plugin: {
specifier: "./api.js",
exportName: "feishuPlugin",
},
runtime: {
specifier: "./runtime-api.js",
exportName: "setFeishuRuntime",
},
});

View File

@@ -1,78 +1,79 @@
import { defineChannelPluginEntry } from "openclaw/plugin-sdk/channel-core";
import { registerFeishuBitableTools } from "./src/bitable.js";
import { feishuPlugin } from "./src/channel.js";
import { registerFeishuChatTools } from "./src/chat.js";
import { registerFeishuDocTools } from "./src/docx.js";
import { registerFeishuDriveTools } from "./src/drive.js";
import { registerFeishuPermTools } from "./src/perm.js";
import { setFeishuRuntime } from "./src/runtime.js";
import { registerFeishuWikiTools } from "./src/wiki.js";
import {
defineBundledChannelEntry,
loadBundledEntryExportSync,
} from "openclaw/plugin-sdk/channel-entry-contract";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/channel-entry-contract";
export { feishuPlugin } from "./src/channel.js";
export { setFeishuRuntime } from "./src/runtime.js";
export {
sendMessageFeishu,
sendCardFeishu,
updateCardFeishu,
editMessageFeishu,
getMessageFeishu,
} from "./src/send.js";
export {
uploadImageFeishu,
uploadFileFeishu,
sendImageFeishu,
sendFileFeishu,
sendMediaFeishu,
} from "./src/media.js";
export { probeFeishu } from "./src/probe.js";
export {
addReactionFeishu,
removeReactionFeishu,
listReactionsFeishu,
FeishuEmoji,
} from "./src/reactions.js";
export {
extractMentionTargets,
extractMessageBody,
isMentionForwardRequest,
formatMentionForText,
formatMentionForCard,
formatMentionAllForText,
formatMentionAllForCard,
buildMentionedMessage,
buildMentionedCardContent,
type MentionTarget,
} from "./src/mention.js";
type FeishuSubagentHooksModule = typeof import("./api.js");
type MonitorFeishuProvider = typeof import("./src/monitor.js").monitorFeishuProvider;
type FeishuSubagentHooksModule = typeof import("./src/subagent-hooks.js");
let feishuMonitorPromise: Promise<typeof import("./src/monitor.js")> | null = null;
let feishuSubagentHooksPromise: Promise<FeishuSubagentHooksModule> | null = null;
function loadFeishuMonitorModule() {
feishuMonitorPromise ??= import("./src/monitor.js");
return feishuMonitorPromise;
}
function loadFeishuSubagentHooksModule() {
feishuSubagentHooksPromise ??= import("./src/subagent-hooks.js");
feishuSubagentHooksPromise ??= import("./api.js");
return feishuSubagentHooksPromise;
}
export async function monitorFeishuProvider(
...args: Parameters<MonitorFeishuProvider>
): ReturnType<MonitorFeishuProvider> {
const { monitorFeishuProvider } = await loadFeishuMonitorModule();
return await monitorFeishuProvider(...args);
function registerFeishuDocTools(api: OpenClawPluginApi) {
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
specifier: "./api.js",
exportName: "registerFeishuDocTools",
});
register(api);
}
export default defineChannelPluginEntry({
function registerFeishuChatTools(api: OpenClawPluginApi) {
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
specifier: "./api.js",
exportName: "registerFeishuChatTools",
});
register(api);
}
function registerFeishuWikiTools(api: OpenClawPluginApi) {
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
specifier: "./api.js",
exportName: "registerFeishuWikiTools",
});
register(api);
}
function registerFeishuDriveTools(api: OpenClawPluginApi) {
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
specifier: "./api.js",
exportName: "registerFeishuDriveTools",
});
register(api);
}
function registerFeishuPermTools(api: OpenClawPluginApi) {
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
specifier: "./api.js",
exportName: "registerFeishuPermTools",
});
register(api);
}
function registerFeishuBitableTools(api: OpenClawPluginApi) {
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
specifier: "./api.js",
exportName: "registerFeishuBitableTools",
});
register(api);
}
export default defineBundledChannelEntry({
id: "feishu",
name: "Feishu",
description: "Feishu/Lark channel plugin",
plugin: feishuPlugin,
setRuntime: setFeishuRuntime,
importMetaUrl: import.meta.url,
plugin: {
specifier: "./api.js",
exportName: "feishuPlugin",
},
runtime: {
specifier: "./runtime-api.js",
exportName: "setFeishuRuntime",
},
registerFull(api) {
api.on("subagent_spawning", async (event, ctx) => {
const { handleFeishuSubagentSpawning } = await loadFeishuSubagentHooksModule();

View File

@@ -49,3 +49,4 @@ export {
readRequestBodyWithLimit,
requestBodyErrorToText,
} from "openclaw/plugin-sdk/webhook-ingress";
export { setFeishuRuntime } from "./src/runtime.js";

View File

@@ -1,4 +1,9 @@
import { defineSetupPluginEntry } from "openclaw/plugin-sdk/channel-core";
import { feishuPlugin } from "./src/channel.js";
import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
export default defineSetupPluginEntry(feishuPlugin);
export default defineBundledChannelSetupEntry({
importMetaUrl: import.meta.url,
plugin: {
specifier: "./api.js",
exportName: "feishuPlugin",
},
});