mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:30:57 +00:00
test(ci): reduce channel contract import cost
This commit is contained in:
1
extensions/feishu/channel-plugin-api.ts
Normal file
1
extensions/feishu/channel-plugin-api.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { feishuPlugin } from "./src/channel.js";
|
||||
@@ -67,7 +67,7 @@ export default defineBundledChannelEntry({
|
||||
description: "Feishu/Lark channel plugin",
|
||||
importMetaUrl: import.meta.url,
|
||||
plugin: {
|
||||
specifier: "./api.js",
|
||||
specifier: "./channel-plugin-api.js",
|
||||
exportName: "feishuPlugin",
|
||||
},
|
||||
secrets: {
|
||||
|
||||
@@ -49,7 +49,6 @@ import {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
PAIRING_APPROVED_MESSAGE,
|
||||
} from "./channel-runtime-api.js";
|
||||
import { createFeishuClient } from "./client.js";
|
||||
import { isRecord } from "./comment-shared.js";
|
||||
import { FeishuConfigSchema } from "./config-schema.js";
|
||||
import {
|
||||
@@ -119,6 +118,11 @@ const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(
|
||||
"feishuChannelRuntime",
|
||||
);
|
||||
|
||||
async function createFeishuActionClient(account: ResolvedFeishuAccount) {
|
||||
const { createFeishuClient } = await import("./client.js");
|
||||
return createFeishuClient(account);
|
||||
}
|
||||
|
||||
const collectFeishuSecurityWarnings = createAllowlistProviderGroupPolicyWarningCollector<{
|
||||
cfg: ClawdbotConfig;
|
||||
accountId?: string | null;
|
||||
@@ -841,7 +845,7 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
|
||||
throw new Error("Feishu channel-info requires chatId or channelId.");
|
||||
}
|
||||
const runtime = await loadFeishuChannelRuntime();
|
||||
const client = createFeishuClient(account);
|
||||
const client = await createFeishuActionClient(account);
|
||||
const channel = await runtime.getChatInfo(client, chatId);
|
||||
const includeMembers =
|
||||
ctx.params.includeMembers === true || ctx.params.members === true;
|
||||
@@ -871,7 +875,7 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
|
||||
|
||||
if (ctx.action === "member-info") {
|
||||
const runtime = await loadFeishuChannelRuntime();
|
||||
const client = createFeishuClient(account);
|
||||
const client = await createFeishuActionClient(account);
|
||||
const memberId = resolveFeishuMemberId(ctx.params);
|
||||
if (memberId) {
|
||||
const member = await runtime.getFeishuMemberInfo(
|
||||
|
||||
@@ -13,15 +13,7 @@ import {
|
||||
type SecretInput,
|
||||
} from "openclaw/plugin-sdk/setup";
|
||||
import { inspectFeishuCredentials, resolveDefaultFeishuAccountId } from "./accounts.js";
|
||||
import {
|
||||
beginAppRegistration,
|
||||
getAppOwnerOpenId,
|
||||
initAppRegistration,
|
||||
pollAppRegistration,
|
||||
printQrCode,
|
||||
type AppRegistrationResult,
|
||||
} from "./app-registration.js";
|
||||
import { probeFeishu } from "./probe.js";
|
||||
import type { AppRegistrationResult } from "./app-registration.js";
|
||||
import type { FeishuConfig, FeishuDomain } from "./types.js";
|
||||
|
||||
const channel = "feishu" as const;
|
||||
@@ -254,6 +246,8 @@ function applyNewAppSecurityPolicy(
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function runScanToCreate(prompter: WizardPrompter): Promise<AppRegistrationResult | null> {
|
||||
const { beginAppRegistration, initAppRegistration, pollAppRegistration, printQrCode } =
|
||||
await import("./app-registration.js");
|
||||
try {
|
||||
await initAppRegistration("feishu");
|
||||
} catch {
|
||||
@@ -371,6 +365,7 @@ async function runNewAppFlow(params: {
|
||||
|
||||
// Fetch openId via API for manual flow.
|
||||
if (appId && appSecretProbeValue) {
|
||||
const { getAppOwnerOpenId } = await import("./app-registration.js");
|
||||
scanOpenId = await getAppOwnerOpenId({
|
||||
appId,
|
||||
appSecret: appSecretProbeValue,
|
||||
@@ -528,6 +523,7 @@ export const feishuSetupWizard: ChannelSetupWizard = {
|
||||
let probeResult = null;
|
||||
if (configured && resolvedCredentials) {
|
||||
try {
|
||||
const { probeFeishu } = await import("./probe.js");
|
||||
probeResult = await probeFeishu(resolvedCredentials);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user