diff --git a/docs/plugins/sdk-subpaths.md b/docs/plugins/sdk-subpaths.md index 89b13f6f6c0..818776fc01e 100644 --- a/docs/plugins/sdk-subpaths.md +++ b/docs/plugins/sdk-subpaths.md @@ -66,6 +66,7 @@ For the plugin authoring guide, see [Plugin SDK overview](/plugins/sdk-overview) | `plugin-sdk/direct-dm` | Shared direct-DM auth/guard helpers | | `plugin-sdk/interactive-runtime` | Semantic message presentation, delivery, and legacy interactive reply helpers. See [Message Presentation](/plugins/message-presentation) | | `plugin-sdk/channel-inbound` | Compatibility barrel for inbound debounce, mention matching, mention-policy helpers, and envelope helpers | + | `plugin-sdk/channel-inbound-debounce` | Narrow inbound debounce helpers | | `plugin-sdk/channel-mention-gating` | Narrow mention-policy helpers without the broader inbound runtime surface | | `plugin-sdk/channel-location` | Channel location context and formatting helpers | | `plugin-sdk/channel-logging` | Channel logging helpers for inbound drops and typing/ack failures | diff --git a/extensions/feishu/src/media.ts b/extensions/feishu/src/media.ts index e6caf511b77..6497db99955 100644 --- a/extensions/feishu/src/media.ts +++ b/extensions/feishu/src/media.ts @@ -2,7 +2,7 @@ import fs from "node:fs"; import path from "node:path"; import { Readable } from "node:stream"; import type * as Lark from "@larksuiteoapi/node-sdk"; -import { mediaKindFromMime } from "openclaw/plugin-sdk/media-runtime"; +import { mediaKindFromMime } from "openclaw/plugin-sdk/media-mime"; import { withTempDownloadPath } from "openclaw/plugin-sdk/temp-path"; import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime"; import type { ClawdbotConfig } from "../runtime-api.js"; diff --git a/extensions/feishu/src/monitor.comment.test.ts b/extensions/feishu/src/monitor.comment.test.ts index 86711db4143..1c825322409 100644 --- a/extensions/feishu/src/monitor.comment.test.ts +++ b/extensions/feishu/src/monitor.comment.test.ts @@ -1,8 +1,8 @@ import { createInboundDebouncer, resolveInboundDebounceMs, -} from "openclaw/plugin-sdk/channel-inbound"; -import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; +} from "openclaw/plugin-sdk/channel-inbound-debounce"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-detection"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { createNonExitingRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js"; import type { ClawdbotConfig, PluginRuntime, RuntimeEnv } from "../runtime-api.js"; diff --git a/extensions/feishu/src/monitor.reaction.test.ts b/extensions/feishu/src/monitor.reaction.test.ts index 55e696eb121..b07d8543d9c 100644 --- a/extensions/feishu/src/monitor.reaction.test.ts +++ b/extensions/feishu/src/monitor.reaction.test.ts @@ -1,8 +1,8 @@ import { createInboundDebouncer, resolveInboundDebounceMs, -} from "openclaw/plugin-sdk/channel-inbound"; -import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; +} from "openclaw/plugin-sdk/channel-inbound-debounce"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-detection"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { createNonExitingTypedRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js"; import type { ClawdbotConfig, PluginRuntime, RuntimeEnv } from "../runtime-api.js"; diff --git a/extensions/telegram/src/bot-handlers.runtime.ts b/extensions/telegram/src/bot-handlers.runtime.ts index 566d3b8c767..79b0a9c8b94 100644 --- a/extensions/telegram/src/bot-handlers.runtime.ts +++ b/extensions/telegram/src/bot-handlers.runtime.ts @@ -4,7 +4,7 @@ import { shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound"; import { createInboundDebouncer, resolveInboundDebounceMs, -} from "openclaw/plugin-sdk/channel-inbound"; +} from "openclaw/plugin-sdk/channel-inbound-debounce"; import { resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth"; import { resolveCommandAuthorization, diff --git a/extensions/whatsapp/src/auto-reply/monitor.ts b/extensions/whatsapp/src/auto-reply/monitor.ts index 97e4c25fa58..44135be09c4 100644 --- a/extensions/whatsapp/src/auto-reply/monitor.ts +++ b/extensions/whatsapp/src/auto-reply/monitor.ts @@ -1,5 +1,5 @@ import { resolveAccountEntry } from "openclaw/plugin-sdk/account-core"; -import { resolveInboundDebounceMs } from "openclaw/plugin-sdk/channel-inbound"; +import { resolveInboundDebounceMs } from "openclaw/plugin-sdk/channel-inbound-debounce"; import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime"; import { hasControlCommand } from "openclaw/plugin-sdk/command-detection"; import { drainPendingDeliveries } from "openclaw/plugin-sdk/infra-runtime"; diff --git a/extensions/whatsapp/src/inbound/monitor.ts b/extensions/whatsapp/src/inbound/monitor.ts index 6f9621f18a8..ef73d214d70 100644 --- a/extensions/whatsapp/src/inbound/monitor.ts +++ b/extensions/whatsapp/src/inbound/monitor.ts @@ -5,7 +5,8 @@ import type { WAMessage, WASocket, } from "@whiskeysockets/baileys"; -import { createInboundDebouncer, formatLocationText } from "openclaw/plugin-sdk/channel-inbound"; +import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound"; +import { createInboundDebouncer } from "openclaw/plugin-sdk/channel-inbound-debounce"; import { recordChannelActivity } from "openclaw/plugin-sdk/infra-runtime"; import { defaultRuntime } from "openclaw/plugin-sdk/runtime-env"; import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env"; diff --git a/package.json b/package.json index 4a447400496..06596d5f2d6 100644 --- a/package.json +++ b/package.json @@ -637,6 +637,10 @@ "types": "./dist/plugin-sdk/channel-inbound.d.ts", "default": "./dist/plugin-sdk/channel-inbound.js" }, + "./plugin-sdk/channel-inbound-debounce": { + "types": "./dist/plugin-sdk/channel-inbound-debounce.d.ts", + "default": "./dist/plugin-sdk/channel-inbound-debounce.js" + }, "./plugin-sdk/channel-inbound-roots": { "types": "./dist/plugin-sdk/channel-inbound-roots.d.ts", "default": "./dist/plugin-sdk/channel-inbound-roots.js" diff --git a/scripts/lib/plugin-sdk-entrypoints.json b/scripts/lib/plugin-sdk-entrypoints.json index 517698b374f..9d48b1d07df 100644 --- a/scripts/lib/plugin-sdk-entrypoints.json +++ b/scripts/lib/plugin-sdk-entrypoints.json @@ -145,6 +145,7 @@ "channel-contract", "channel-feedback", "channel-inbound", + "channel-inbound-debounce", "channel-inbound-roots", "channel-logging", "channel-location", diff --git a/src/plugin-sdk/channel-inbound-debounce.ts b/src/plugin-sdk/channel-inbound-debounce.ts new file mode 100644 index 00000000000..1295bdd5268 --- /dev/null +++ b/src/plugin-sdk/channel-inbound-debounce.ts @@ -0,0 +1,7 @@ +// Narrow inbound debounce helpers for channel plugins. + +export { + createInboundDebouncer, + resolveInboundDebounceMs, + type InboundDebounceCreateParams, +} from "../auto-reply/inbound-debounce.js"; diff --git a/src/plugin-sdk/media-mime.ts b/src/plugin-sdk/media-mime.ts index 9131dbf3143..9944711e944 100644 --- a/src/plugin-sdk/media-mime.ts +++ b/src/plugin-sdk/media-mime.ts @@ -6,3 +6,4 @@ export { getFileExtension, normalizeMimeType, } from "../media/mime.js"; +export { mediaKindFromMime, type MediaKind } from "../media/constants.js";