From 319aa2f1fe67299976de80e5ce91bc3b3aa1df4b Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 3 Apr 2026 21:37:25 +0900 Subject: [PATCH] refactor(feishu): split runtime helper seams --- .../feishu/src/monitor-transport-runtime-api.ts | 9 +++++++++ extensions/feishu/src/monitor.transport.ts | 6 +++--- .../feishu/src/reply-dispatcher-runtime-api.ts | 2 ++ extensions/feishu/src/reply-dispatcher.ts | 12 ++++++------ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 extensions/feishu/src/monitor-transport-runtime-api.ts create mode 100644 extensions/feishu/src/reply-dispatcher-runtime-api.ts diff --git a/extensions/feishu/src/monitor-transport-runtime-api.ts b/extensions/feishu/src/monitor-transport-runtime-api.ts new file mode 100644 index 00000000000..33788de8155 --- /dev/null +++ b/extensions/feishu/src/monitor-transport-runtime-api.ts @@ -0,0 +1,9 @@ +export type { RuntimeEnv } from "../runtime-api.js"; +export { safeEqualSecret } from "openclaw/plugin-sdk/browser-support"; +export { + applyBasicWebhookRequestGuards, + isRequestBodyLimitError, + readRequestBodyWithLimit, + requestBodyErrorToText, +} from "openclaw/plugin-sdk/webhook-ingress"; +export { installRequestBodyLimitGuard } from "openclaw/plugin-sdk/webhook-request-guards"; diff --git a/extensions/feishu/src/monitor.transport.ts b/extensions/feishu/src/monitor.transport.ts index 22b3d221887..93ba507528b 100644 --- a/extensions/feishu/src/monitor.transport.ts +++ b/extensions/feishu/src/monitor.transport.ts @@ -1,7 +1,7 @@ import * as http from "http"; import crypto from "node:crypto"; import * as Lark from "@larksuiteoapi/node-sdk"; -import { safeEqualSecret } from "openclaw/plugin-sdk/browser-support"; +import { createFeishuWSClient } from "./client.js"; import { applyBasicWebhookRequestGuards, isRequestBodyLimitError, @@ -9,8 +9,8 @@ import { installRequestBodyLimitGuard, readRequestBodyWithLimit, requestBodyErrorToText, -} from "../runtime-api.js"; -import { createFeishuWSClient } from "./client.js"; + safeEqualSecret, +} from "./monitor-transport-runtime-api.js"; import { botNames, botOpenIds, diff --git a/extensions/feishu/src/reply-dispatcher-runtime-api.ts b/extensions/feishu/src/reply-dispatcher-runtime-api.ts new file mode 100644 index 00000000000..7a26b9b6406 --- /dev/null +++ b/extensions/feishu/src/reply-dispatcher-runtime-api.ts @@ -0,0 +1,2 @@ +export type { ClawdbotConfig, OutboundIdentity, ReplyPayload, RuntimeEnv } from "../runtime-api.js"; +export { createReplyPrefixContext } from "openclaw/plugin-sdk/feishu"; diff --git a/extensions/feishu/src/reply-dispatcher.ts b/extensions/feishu/src/reply-dispatcher.ts index 03818052f70..d86dc1ac6fa 100644 --- a/extensions/feishu/src/reply-dispatcher.ts +++ b/extensions/feishu/src/reply-dispatcher.ts @@ -5,18 +5,18 @@ import { resolveTextChunksWithFallback, sendMediaWithLeadingCaption, } from "openclaw/plugin-sdk/reply-payload"; +import { resolveFeishuRuntimeAccount } from "./accounts.js"; +import { createFeishuClient } from "./client.js"; +import { sendMediaFeishu } from "./media.js"; +import type { MentionTarget } from "./mention.js"; +import { buildMentionedCardContent } from "./mention.js"; import { createReplyPrefixContext, type ClawdbotConfig, type OutboundIdentity, type ReplyPayload, type RuntimeEnv, -} from "../runtime-api.js"; -import { resolveFeishuRuntimeAccount } from "./accounts.js"; -import { createFeishuClient } from "./client.js"; -import { sendMediaFeishu } from "./media.js"; -import type { MentionTarget } from "./mention.js"; -import { buildMentionedCardContent } from "./mention.js"; +} from "./reply-dispatcher-runtime-api.js"; import { getFeishuRuntime } from "./runtime.js"; import { sendMessageFeishu, sendStructuredCardFeishu, type CardHeaderConfig } from "./send.js"; import { FeishuStreamingSession, mergeStreamingText } from "./streaming-card.js";