From 7a2f5a0098d192944825f17d3be457af91d2bed1 Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Santana Date: Wed, 4 Mar 2026 02:31:44 -0500 Subject: [PATCH] Plugin SDK: add full bundled subpath wiring --- docs/tools/plugin.md | 40 ++++- package.json | 128 ++++++++++++++ ...-no-monolithic-plugin-sdk-entry-imports.ts | 11 +- scripts/check-plugin-sdk-exports.mjs | 33 ++++ scripts/release-check.ts | 68 ++++++++ scripts/write-plugin-sdk-entry-dts.ts | 33 ++++ src/plugin-sdk/acpx.ts | 34 ++++ src/plugin-sdk/bluebubbles.ts | 100 +++++++++++ src/plugin-sdk/copilot-proxy.ts | 9 + src/plugin-sdk/device-pair.ts | 8 + src/plugin-sdk/diagnostics-otel.ts | 13 ++ src/plugin-sdk/diffs.ts | 11 ++ src/plugin-sdk/feishu.ts | 71 ++++++++ src/plugin-sdk/google-gemini-cli-auth.ts | 8 + src/plugin-sdk/googlechat.ts | 78 +++++++++ src/plugin-sdk/irc.ts | 70 ++++++++ src/plugin-sdk/llm-task.ts | 5 + src/plugin-sdk/lobster.ts | 14 ++ src/plugin-sdk/matrix.ts | 96 +++++++++++ src/plugin-sdk/mattermost.ts | 85 +++++++++ src/plugin-sdk/memory-core.ts | 5 + src/plugin-sdk/memory-lancedb.ts | 4 + src/plugin-sdk/minimax-portal-auth.ts | 10 ++ src/plugin-sdk/msteams.ts | 108 ++++++++++++ src/plugin-sdk/nextcloud-talk.ts | 92 ++++++++++ src/plugin-sdk/nostr.ts | 19 +++ src/plugin-sdk/open-prose.ts | 4 + src/plugin-sdk/phone-control.ts | 9 + src/plugin-sdk/qwen-portal-auth.ts | 6 + src/plugin-sdk/subpaths.test.ts | 54 ++++++ src/plugin-sdk/synology-chat.ts | 17 ++ src/plugin-sdk/talk-voice.ts | 4 + src/plugin-sdk/test-utils.ts | 8 + src/plugin-sdk/thread-ownership.ts | 5 + src/plugin-sdk/tlon.ts | 28 +++ src/plugin-sdk/twitch.ts | 19 +++ src/plugin-sdk/voice-call.ts | 18 ++ src/plugin-sdk/whatsapp.ts | 1 + src/plugin-sdk/zalo.ts | 94 ++++++++++ src/plugin-sdk/zalouser.ts | 63 +++++++ src/plugins/loader.ts | 161 +++++++++++------- tsconfig.plugin-sdk.dts.json | 32 ++++ tsdown.config.ts | 125 ++++++-------- vitest.config.ts | 93 +++++----- 44 files changed, 1704 insertions(+), 190 deletions(-) create mode 100644 src/plugin-sdk/acpx.ts create mode 100644 src/plugin-sdk/bluebubbles.ts create mode 100644 src/plugin-sdk/copilot-proxy.ts create mode 100644 src/plugin-sdk/device-pair.ts create mode 100644 src/plugin-sdk/diagnostics-otel.ts create mode 100644 src/plugin-sdk/diffs.ts create mode 100644 src/plugin-sdk/feishu.ts create mode 100644 src/plugin-sdk/google-gemini-cli-auth.ts create mode 100644 src/plugin-sdk/googlechat.ts create mode 100644 src/plugin-sdk/irc.ts create mode 100644 src/plugin-sdk/llm-task.ts create mode 100644 src/plugin-sdk/lobster.ts create mode 100644 src/plugin-sdk/matrix.ts create mode 100644 src/plugin-sdk/mattermost.ts create mode 100644 src/plugin-sdk/memory-core.ts create mode 100644 src/plugin-sdk/memory-lancedb.ts create mode 100644 src/plugin-sdk/minimax-portal-auth.ts create mode 100644 src/plugin-sdk/msteams.ts create mode 100644 src/plugin-sdk/nextcloud-talk.ts create mode 100644 src/plugin-sdk/nostr.ts create mode 100644 src/plugin-sdk/open-prose.ts create mode 100644 src/plugin-sdk/phone-control.ts create mode 100644 src/plugin-sdk/qwen-portal-auth.ts create mode 100644 src/plugin-sdk/synology-chat.ts create mode 100644 src/plugin-sdk/talk-voice.ts create mode 100644 src/plugin-sdk/test-utils.ts create mode 100644 src/plugin-sdk/thread-ownership.ts create mode 100644 src/plugin-sdk/tlon.ts create mode 100644 src/plugin-sdk/twitch.ts create mode 100644 src/plugin-sdk/voice-call.ts create mode 100644 src/plugin-sdk/zalo.ts create mode 100644 src/plugin-sdk/zalouser.ts diff --git a/docs/tools/plugin.md b/docs/tools/plugin.md index 60d5aa61c37..f0335da0e7a 100644 --- a/docs/tools/plugin.md +++ b/docs/tools/plugin.md @@ -120,12 +120,32 @@ authoring plugins: - `openclaw/plugin-sdk/imessage` for iMessage channel plugins. - `openclaw/plugin-sdk/whatsapp` for WhatsApp channel plugins. - `openclaw/plugin-sdk/line` for LINE channel plugins. +- `openclaw/plugin-sdk/msteams` for the bundled Microsoft Teams plugin surface. +- Bundled extension-specific subpaths are also available: + `openclaw/plugin-sdk/acpx`, `openclaw/plugin-sdk/bluebubbles`, + `openclaw/plugin-sdk/copilot-proxy`, `openclaw/plugin-sdk/device-pair`, + `openclaw/plugin-sdk/diagnostics-otel`, `openclaw/plugin-sdk/diffs`, + `openclaw/plugin-sdk/feishu`, + `openclaw/plugin-sdk/google-gemini-cli-auth`, `openclaw/plugin-sdk/googlechat`, + `openclaw/plugin-sdk/irc`, `openclaw/plugin-sdk/llm-task`, + `openclaw/plugin-sdk/lobster`, `openclaw/plugin-sdk/matrix`, + `openclaw/plugin-sdk/mattermost`, `openclaw/plugin-sdk/memory-core`, + `openclaw/plugin-sdk/memory-lancedb`, + `openclaw/plugin-sdk/minimax-portal-auth`, + `openclaw/plugin-sdk/nextcloud-talk`, `openclaw/plugin-sdk/nostr`, + `openclaw/plugin-sdk/open-prose`, `openclaw/plugin-sdk/phone-control`, + `openclaw/plugin-sdk/qwen-portal-auth`, `openclaw/plugin-sdk/synology-chat`, + `openclaw/plugin-sdk/talk-voice`, `openclaw/plugin-sdk/test-utils`, + `openclaw/plugin-sdk/thread-ownership`, `openclaw/plugin-sdk/tlon`, + `openclaw/plugin-sdk/twitch`, `openclaw/plugin-sdk/voice-call`, + `openclaw/plugin-sdk/zalo`, and `openclaw/plugin-sdk/zalouser`. Compatibility note: - `openclaw/plugin-sdk` remains supported for existing external plugins. -- New and migrated bundled plugins should use channel subpaths and `core`; use - `compat` only when broader shared helpers are required. +- New and migrated bundled plugins should use channel or extension-specific + subpaths; use `core` for generic surfaces and `compat` only when broader + shared helpers are required. Performance note: @@ -154,13 +174,21 @@ OpenClaw scans, in order: - `~/.openclaw/extensions/*.ts` - `~/.openclaw/extensions/*/index.ts` -4. Bundled extensions (shipped with OpenClaw, **disabled by default**) +4. Bundled extensions (shipped with OpenClaw, mostly disabled by default) - `/extensions/*` -Bundled plugins must be enabled explicitly via `plugins.entries..enabled` -or `openclaw plugins enable `. Installed plugins are enabled by default, -but can be disabled the same way. +Most bundled plugins must be enabled explicitly via +`plugins.entries..enabled` or `openclaw plugins enable `. + +Default-on bundled plugin exceptions: + +- `device-pair` +- `phone-control` +- `talk-voice` +- active memory slot plugin (default slot: `memory-core`) + +Installed plugins are enabled by default, but can be disabled the same way. Hardening notes: diff --git a/package.json b/package.json index 590f2b4e9a4..6c85410074d 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,134 @@ "types": "./dist/plugin-sdk/line.d.ts", "default": "./dist/plugin-sdk/line.js" }, + "./plugin-sdk/msteams": { + "types": "./dist/plugin-sdk/msteams.d.ts", + "default": "./dist/plugin-sdk/msteams.js" + }, + "./plugin-sdk/acpx": { + "types": "./dist/plugin-sdk/acpx.d.ts", + "default": "./dist/plugin-sdk/acpx.js" + }, + "./plugin-sdk/bluebubbles": { + "types": "./dist/plugin-sdk/bluebubbles.d.ts", + "default": "./dist/plugin-sdk/bluebubbles.js" + }, + "./plugin-sdk/copilot-proxy": { + "types": "./dist/plugin-sdk/copilot-proxy.d.ts", + "default": "./dist/plugin-sdk/copilot-proxy.js" + }, + "./plugin-sdk/device-pair": { + "types": "./dist/plugin-sdk/device-pair.d.ts", + "default": "./dist/plugin-sdk/device-pair.js" + }, + "./plugin-sdk/diagnostics-otel": { + "types": "./dist/plugin-sdk/diagnostics-otel.d.ts", + "default": "./dist/plugin-sdk/diagnostics-otel.js" + }, + "./plugin-sdk/diffs": { + "types": "./dist/plugin-sdk/diffs.d.ts", + "default": "./dist/plugin-sdk/diffs.js" + }, + "./plugin-sdk/feishu": { + "types": "./dist/plugin-sdk/feishu.d.ts", + "default": "./dist/plugin-sdk/feishu.js" + }, + "./plugin-sdk/google-gemini-cli-auth": { + "types": "./dist/plugin-sdk/google-gemini-cli-auth.d.ts", + "default": "./dist/plugin-sdk/google-gemini-cli-auth.js" + }, + "./plugin-sdk/googlechat": { + "types": "./dist/plugin-sdk/googlechat.d.ts", + "default": "./dist/plugin-sdk/googlechat.js" + }, + "./plugin-sdk/irc": { + "types": "./dist/plugin-sdk/irc.d.ts", + "default": "./dist/plugin-sdk/irc.js" + }, + "./plugin-sdk/llm-task": { + "types": "./dist/plugin-sdk/llm-task.d.ts", + "default": "./dist/plugin-sdk/llm-task.js" + }, + "./plugin-sdk/lobster": { + "types": "./dist/plugin-sdk/lobster.d.ts", + "default": "./dist/plugin-sdk/lobster.js" + }, + "./plugin-sdk/matrix": { + "types": "./dist/plugin-sdk/matrix.d.ts", + "default": "./dist/plugin-sdk/matrix.js" + }, + "./plugin-sdk/mattermost": { + "types": "./dist/plugin-sdk/mattermost.d.ts", + "default": "./dist/plugin-sdk/mattermost.js" + }, + "./plugin-sdk/memory-core": { + "types": "./dist/plugin-sdk/memory-core.d.ts", + "default": "./dist/plugin-sdk/memory-core.js" + }, + "./plugin-sdk/memory-lancedb": { + "types": "./dist/plugin-sdk/memory-lancedb.d.ts", + "default": "./dist/plugin-sdk/memory-lancedb.js" + }, + "./plugin-sdk/minimax-portal-auth": { + "types": "./dist/plugin-sdk/minimax-portal-auth.d.ts", + "default": "./dist/plugin-sdk/minimax-portal-auth.js" + }, + "./plugin-sdk/nextcloud-talk": { + "types": "./dist/plugin-sdk/nextcloud-talk.d.ts", + "default": "./dist/plugin-sdk/nextcloud-talk.js" + }, + "./plugin-sdk/nostr": { + "types": "./dist/plugin-sdk/nostr.d.ts", + "default": "./dist/plugin-sdk/nostr.js" + }, + "./plugin-sdk/open-prose": { + "types": "./dist/plugin-sdk/open-prose.d.ts", + "default": "./dist/plugin-sdk/open-prose.js" + }, + "./plugin-sdk/phone-control": { + "types": "./dist/plugin-sdk/phone-control.d.ts", + "default": "./dist/plugin-sdk/phone-control.js" + }, + "./plugin-sdk/qwen-portal-auth": { + "types": "./dist/plugin-sdk/qwen-portal-auth.d.ts", + "default": "./dist/plugin-sdk/qwen-portal-auth.js" + }, + "./plugin-sdk/synology-chat": { + "types": "./dist/plugin-sdk/synology-chat.d.ts", + "default": "./dist/plugin-sdk/synology-chat.js" + }, + "./plugin-sdk/talk-voice": { + "types": "./dist/plugin-sdk/talk-voice.d.ts", + "default": "./dist/plugin-sdk/talk-voice.js" + }, + "./plugin-sdk/test-utils": { + "types": "./dist/plugin-sdk/test-utils.d.ts", + "default": "./dist/plugin-sdk/test-utils.js" + }, + "./plugin-sdk/thread-ownership": { + "types": "./dist/plugin-sdk/thread-ownership.d.ts", + "default": "./dist/plugin-sdk/thread-ownership.js" + }, + "./plugin-sdk/tlon": { + "types": "./dist/plugin-sdk/tlon.d.ts", + "default": "./dist/plugin-sdk/tlon.js" + }, + "./plugin-sdk/twitch": { + "types": "./dist/plugin-sdk/twitch.d.ts", + "default": "./dist/plugin-sdk/twitch.js" + }, + "./plugin-sdk/voice-call": { + "types": "./dist/plugin-sdk/voice-call.d.ts", + "default": "./dist/plugin-sdk/voice-call.js" + }, + "./plugin-sdk/zalo": { + "types": "./dist/plugin-sdk/zalo.d.ts", + "default": "./dist/plugin-sdk/zalo.js" + }, + "./plugin-sdk/zalouser": { + "types": "./dist/plugin-sdk/zalouser.d.ts", + "default": "./dist/plugin-sdk/zalouser.js" + }, "./plugin-sdk/account-id": { "types": "./dist/plugin-sdk/account-id.d.ts", "default": "./dist/plugin-sdk/account-id.js" diff --git a/scripts/check-no-monolithic-plugin-sdk-entry-imports.ts b/scripts/check-no-monolithic-plugin-sdk-entry-imports.ts index bde974d5154..9b77ae9cf61 100644 --- a/scripts/check-no-monolithic-plugin-sdk-entry-imports.ts +++ b/scripts/check-no-monolithic-plugin-sdk-entry-imports.ts @@ -2,15 +2,12 @@ import fs from "node:fs"; import path from "node:path"; import { discoverOpenClawPlugins } from "../src/plugins/discovery.js"; -const ROOT_IMPORT_PATTERNS = [ - /\b(?:import|export)\b[\s\S]*?\bfrom\s+["']openclaw\/plugin-sdk["']/, - /\bimport\s+["']openclaw\/plugin-sdk["']/, - /\bimport\s*\(\s*["']openclaw\/plugin-sdk["']\s*\)/, - /\brequire\s*\(\s*["']openclaw\/plugin-sdk["']\s*\)/, -]; +// Match exact monolithic-root specifier in any code path: +// imports/exports, require/dynamic import, and test mocks (vi.mock/jest.mock). +const ROOT_IMPORT_PATTERN = /["']openclaw\/plugin-sdk["']/; function hasMonolithicRootImport(content: string): boolean { - return ROOT_IMPORT_PATTERNS.some((pattern) => pattern.test(content)); + return ROOT_IMPORT_PATTERN.test(content); } function isSourceFile(filePath: string): boolean { diff --git a/scripts/check-plugin-sdk-exports.mjs b/scripts/check-plugin-sdk-exports.mjs index 87d7826945f..03ff9dfde8f 100755 --- a/scripts/check-plugin-sdk-exports.mjs +++ b/scripts/check-plugin-sdk-exports.mjs @@ -51,7 +51,40 @@ const requiredSubpathEntries = [ "imessage", "whatsapp", "line", + "msteams", + "acpx", + "bluebubbles", + "copilot-proxy", + "device-pair", + "diagnostics-otel", + "diffs", + "feishu", + "google-gemini-cli-auth", + "googlechat", + "irc", + "llm-task", + "lobster", + "matrix", + "mattermost", + "memory-core", + "memory-lancedb", + "minimax-portal-auth", + "nextcloud-talk", + "nostr", + "open-prose", + "phone-control", + "qwen-portal-auth", + "synology-chat", + "talk-voice", + "test-utils", + "thread-ownership", + "tlon", + "twitch", + "voice-call", + "zalo", + "zalouser", "account-id", + "keyed-async-queue", ]; const requiredRuntimeShimEntries = ["root-alias.cjs"]; diff --git a/scripts/release-check.ts b/scripts/release-check.ts index 9b2848e8ead..5eb72113cc5 100755 --- a/scripts/release-check.ts +++ b/scripts/release-check.ts @@ -33,6 +33,74 @@ const requiredPathGroups = [ "dist/plugin-sdk/whatsapp.d.ts", "dist/plugin-sdk/line.js", "dist/plugin-sdk/line.d.ts", + "dist/plugin-sdk/msteams.js", + "dist/plugin-sdk/msteams.d.ts", + "dist/plugin-sdk/acpx.js", + "dist/plugin-sdk/acpx.d.ts", + "dist/plugin-sdk/bluebubbles.js", + "dist/plugin-sdk/bluebubbles.d.ts", + "dist/plugin-sdk/copilot-proxy.js", + "dist/plugin-sdk/copilot-proxy.d.ts", + "dist/plugin-sdk/device-pair.js", + "dist/plugin-sdk/device-pair.d.ts", + "dist/plugin-sdk/diagnostics-otel.js", + "dist/plugin-sdk/diagnostics-otel.d.ts", + "dist/plugin-sdk/diffs.js", + "dist/plugin-sdk/diffs.d.ts", + "dist/plugin-sdk/feishu.js", + "dist/plugin-sdk/feishu.d.ts", + "dist/plugin-sdk/google-gemini-cli-auth.js", + "dist/plugin-sdk/google-gemini-cli-auth.d.ts", + "dist/plugin-sdk/googlechat.js", + "dist/plugin-sdk/googlechat.d.ts", + "dist/plugin-sdk/irc.js", + "dist/plugin-sdk/irc.d.ts", + "dist/plugin-sdk/llm-task.js", + "dist/plugin-sdk/llm-task.d.ts", + "dist/plugin-sdk/lobster.js", + "dist/plugin-sdk/lobster.d.ts", + "dist/plugin-sdk/matrix.js", + "dist/plugin-sdk/matrix.d.ts", + "dist/plugin-sdk/mattermost.js", + "dist/plugin-sdk/mattermost.d.ts", + "dist/plugin-sdk/memory-core.js", + "dist/plugin-sdk/memory-core.d.ts", + "dist/plugin-sdk/memory-lancedb.js", + "dist/plugin-sdk/memory-lancedb.d.ts", + "dist/plugin-sdk/minimax-portal-auth.js", + "dist/plugin-sdk/minimax-portal-auth.d.ts", + "dist/plugin-sdk/nextcloud-talk.js", + "dist/plugin-sdk/nextcloud-talk.d.ts", + "dist/plugin-sdk/nostr.js", + "dist/plugin-sdk/nostr.d.ts", + "dist/plugin-sdk/open-prose.js", + "dist/plugin-sdk/open-prose.d.ts", + "dist/plugin-sdk/phone-control.js", + "dist/plugin-sdk/phone-control.d.ts", + "dist/plugin-sdk/qwen-portal-auth.js", + "dist/plugin-sdk/qwen-portal-auth.d.ts", + "dist/plugin-sdk/synology-chat.js", + "dist/plugin-sdk/synology-chat.d.ts", + "dist/plugin-sdk/talk-voice.js", + "dist/plugin-sdk/talk-voice.d.ts", + "dist/plugin-sdk/test-utils.js", + "dist/plugin-sdk/test-utils.d.ts", + "dist/plugin-sdk/thread-ownership.js", + "dist/plugin-sdk/thread-ownership.d.ts", + "dist/plugin-sdk/tlon.js", + "dist/plugin-sdk/tlon.d.ts", + "dist/plugin-sdk/twitch.js", + "dist/plugin-sdk/twitch.d.ts", + "dist/plugin-sdk/voice-call.js", + "dist/plugin-sdk/voice-call.d.ts", + "dist/plugin-sdk/zalo.js", + "dist/plugin-sdk/zalo.d.ts", + "dist/plugin-sdk/zalouser.js", + "dist/plugin-sdk/zalouser.d.ts", + "dist/plugin-sdk/account-id.js", + "dist/plugin-sdk/account-id.d.ts", + "dist/plugin-sdk/keyed-async-queue.js", + "dist/plugin-sdk/keyed-async-queue.d.ts", "dist/build-info.json", ]; const forbiddenPrefixes = ["dist/OpenClaw.app/"]; diff --git a/scripts/write-plugin-sdk-entry-dts.ts b/scripts/write-plugin-sdk-entry-dts.ts index 197b36004a8..7053feb19a8 100644 --- a/scripts/write-plugin-sdk-entry-dts.ts +++ b/scripts/write-plugin-sdk-entry-dts.ts @@ -17,7 +17,40 @@ const entrypoints = [ "imessage", "whatsapp", "line", + "msteams", + "acpx", + "bluebubbles", + "copilot-proxy", + "device-pair", + "diagnostics-otel", + "diffs", + "feishu", + "google-gemini-cli-auth", + "googlechat", + "irc", + "llm-task", + "lobster", + "matrix", + "mattermost", + "memory-core", + "memory-lancedb", + "minimax-portal-auth", + "nextcloud-talk", + "nostr", + "open-prose", + "phone-control", + "qwen-portal-auth", + "synology-chat", + "talk-voice", + "test-utils", + "thread-ownership", + "tlon", + "twitch", + "voice-call", + "zalo", + "zalouser", "account-id", + "keyed-async-queue", ] as const; for (const entry of entrypoints) { const out = path.join(process.cwd(), `dist/plugin-sdk/${entry}.d.ts`); diff --git a/src/plugin-sdk/acpx.ts b/src/plugin-sdk/acpx.ts new file mode 100644 index 00000000000..7a719800227 --- /dev/null +++ b/src/plugin-sdk/acpx.ts @@ -0,0 +1,34 @@ +// Narrow plugin-sdk surface for the bundled acpx plugin. +// Keep this list additive and scoped to symbols used under extensions/acpx. + +export type { AcpRuntimeErrorCode } from "../acp/runtime/errors.js"; +export { AcpRuntimeError } from "../acp/runtime/errors.js"; +export { registerAcpRuntimeBackend, unregisterAcpRuntimeBackend } from "../acp/runtime/registry.js"; +export type { + AcpRuntime, + AcpRuntimeCapabilities, + AcpRuntimeDoctorReport, + AcpRuntimeEnsureInput, + AcpRuntimeEvent, + AcpRuntimeHandle, + AcpRuntimeStatus, + AcpRuntimeTurnInput, + AcpSessionUpdateTag, +} from "../acp/runtime/types.js"; +export type { + OpenClawPluginApi, + OpenClawPluginConfigSchema, + OpenClawPluginService, + OpenClawPluginServiceContext, + PluginLogger, +} from "../plugins/types.js"; +export type { + WindowsSpawnProgram, + WindowsSpawnProgramCandidate, + WindowsSpawnResolution, +} from "./windows-spawn.js"; +export { + applyWindowsSpawnProgramPolicy, + materializeWindowsSpawnProgram, + resolveWindowsSpawnProgramCandidate, +} from "./windows-spawn.js"; diff --git a/src/plugin-sdk/bluebubbles.ts b/src/plugin-sdk/bluebubbles.ts new file mode 100644 index 00000000000..0d9d8f4e4eb --- /dev/null +++ b/src/plugin-sdk/bluebubbles.ts @@ -0,0 +1,100 @@ +// Narrow plugin-sdk surface for the bundled bluebubbles plugin. +// Keep this list additive and scoped to symbols used under extensions/bluebubbles. + +export { resolveAckReaction } from "../agents/identity.js"; +export { + createActionGate, + jsonResult, + readNumberParam, + readReactionParams, + readStringParam, +} from "../agents/tools/common.js"; +export type { HistoryEntry } from "../auto-reply/reply/history.js"; +export { + evictOldHistoryKeys, + recordPendingHistoryEntryIfEnabled, +} from "../auto-reply/reply/history.js"; +export { resolveControlCommandGate } from "../channels/command-gating.js"; +export { logAckFailure, logInboundDrop, logTypingFailure } from "../channels/logging.js"; +export { + BLUEBUBBLES_ACTION_NAMES, + BLUEBUBBLES_ACTIONS, +} from "../channels/plugins/bluebubbles-actions.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { + resolveBlueBubblesGroupRequireMention, + resolveBlueBubblesGroupToolPolicy, +} from "../channels/plugins/group-mentions.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + promptAccountId, +} from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export { + applyAccountNameToChannelSection, + migrateBaseNameToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export { collectBlueBubblesStatusIssues } from "../channels/plugins/status-issues/bluebubbles.js"; +export type { + BaseProbeResult, + ChannelAccountSnapshot, + ChannelMessageActionAdapter, + ChannelMessageActionName, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export type { DmPolicy, GroupPolicy } from "../config/types.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export type { ParsedChatTarget } from "../imessage/target-parsing-helpers.js"; +export { + parseChatAllowTargetPrefixes, + parseChatTargetPrefixesOrThrow, + resolveServicePrefixedAllowTarget, + resolveServicePrefixedTarget, +} from "../imessage/target-parsing-helpers.js"; +export { stripMarkdown } from "../line/markdown-to-line.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export { + DM_GROUP_ACCESS_REASON, + readStoreAllowFromForDmPolicy, + resolveDmGroupAccessWithLists, +} from "../security/dm-policy-shared.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { isAllowedParsedChatSender } from "./allow-from.js"; +export { readBooleanParam } from "./boolean-param.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export { buildProbeChannelStatusSummary } from "./status-helpers.js"; +export { extractToolSend } from "./tool-send.js"; +export { normalizeWebhookPath } from "./webhook-path.js"; +export { + beginWebhookRequestPipelineOrReject, + createWebhookInFlightLimiter, + readWebhookBodyOrReject, +} from "./webhook-request-guards.js"; +export { + registerWebhookTargetWithPluginRoute, + resolveWebhookTargets, + resolveWebhookTargetWithAuthOrRejectSync, +} from "./webhook-targets.js"; diff --git a/src/plugin-sdk/copilot-proxy.ts b/src/plugin-sdk/copilot-proxy.ts new file mode 100644 index 00000000000..80a83010c1d --- /dev/null +++ b/src/plugin-sdk/copilot-proxy.ts @@ -0,0 +1,9 @@ +// Narrow plugin-sdk surface for the bundled copilot-proxy plugin. +// Keep this list additive and scoped to symbols used under extensions/copilot-proxy. + +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { + OpenClawPluginApi, + ProviderAuthContext, + ProviderAuthResult, +} from "../plugins/types.js"; diff --git a/src/plugin-sdk/device-pair.ts b/src/plugin-sdk/device-pair.ts new file mode 100644 index 00000000000..a2df85772c4 --- /dev/null +++ b/src/plugin-sdk/device-pair.ts @@ -0,0 +1,8 @@ +// Narrow plugin-sdk surface for the bundled device-pair plugin. +// Keep this list additive and scoped to symbols used under extensions/device-pair. + +export { approveDevicePairing, listDevicePairing } from "../infra/device-pairing.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { resolveGatewayBindUrl } from "../shared/gateway-bind-url.js"; +export { resolveTailnetHostWithRunner } from "../shared/tailscale-status.js"; +export { runPluginCommandWithTimeout } from "./run-command.js"; diff --git a/src/plugin-sdk/diagnostics-otel.ts b/src/plugin-sdk/diagnostics-otel.ts new file mode 100644 index 00000000000..cb5038f4c42 --- /dev/null +++ b/src/plugin-sdk/diagnostics-otel.ts @@ -0,0 +1,13 @@ +// Narrow plugin-sdk surface for the bundled diagnostics-otel plugin. +// Keep this list additive and scoped to symbols used under extensions/diagnostics-otel. + +export type { DiagnosticEventPayload } from "../infra/diagnostic-events.js"; +export { emitDiagnosticEvent, onDiagnosticEvent } from "../infra/diagnostic-events.js"; +export { registerLogTransport } from "../logging/logger.js"; +export { redactSensitiveText } from "../logging/redact.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { + OpenClawPluginApi, + OpenClawPluginService, + OpenClawPluginServiceContext, +} from "../plugins/types.js"; diff --git a/src/plugin-sdk/diffs.ts b/src/plugin-sdk/diffs.ts new file mode 100644 index 00000000000..918536230d7 --- /dev/null +++ b/src/plugin-sdk/diffs.ts @@ -0,0 +1,11 @@ +// Narrow plugin-sdk surface for the bundled diffs plugin. +// Keep this list additive and scoped to symbols used under extensions/diffs. + +export type { OpenClawConfig } from "../config/config.js"; +export { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js"; +export type { + AnyAgentTool, + OpenClawPluginApi, + OpenClawPluginConfigSchema, + PluginLogger, +} from "../plugins/types.js"; diff --git a/src/plugin-sdk/feishu.ts b/src/plugin-sdk/feishu.ts new file mode 100644 index 00000000000..959f8af124a --- /dev/null +++ b/src/plugin-sdk/feishu.ts @@ -0,0 +1,71 @@ +// Narrow plugin-sdk surface for the bundled feishu plugin. +// Keep this list additive and scoped to symbols used under extensions/feishu. + +export type { HistoryEntry } from "../auto-reply/reply/history.js"; +export { + buildPendingHistoryContextFromMap, + clearHistoryEntriesIfEnabled, + DEFAULT_GROUP_HISTORY_LIMIT, + recordPendingHistoryEntryIfEnabled, +} from "../auto-reply/reply/history.js"; +export type { ReplyPayload } from "../auto-reply/types.js"; +export { logTypingFailure } from "../channels/logging.js"; +export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { + addWildcardAllowFrom, + promptSingleChannelSecretInput, +} from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export type { + BaseProbeResult, + ChannelGroupContext, + ChannelMeta, + ChannelOutboundAdapter, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixContext } from "../channels/reply-prefix.js"; +export { createTypingCallbacks } from "../channels/typing.js"; +export type { OpenClawConfig as ClawdbotConfig, OpenClawConfig } from "../config/config.js"; +export { + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + resolveOpenProviderRuntimeGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { DmPolicy, GroupToolPolicyConfig } from "../config/types.js"; +export type { SecretInput } from "../config/types.secrets.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { createDedupeCache } from "../infra/dedupe.js"; +export { installRequestBodyLimitGuard } from "../infra/http-body.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { AnyAgentTool, OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAgentId } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { buildAgentMediaPayload } from "./agent-media-payload.js"; +export { readJsonFileWithFallback } from "./json-store.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export { createPersistentDedupe } from "./persistent-dedupe.js"; +export { + buildBaseChannelStatusSummary, + createDefaultChannelRuntimeState, +} from "./status-helpers.js"; +export { withTempDownloadPath } from "./temp-path.js"; +export { + createFixedWindowRateLimiter, + createWebhookAnomalyTracker, + WEBHOOK_ANOMALY_COUNTER_DEFAULTS, + WEBHOOK_RATE_LIMIT_DEFAULTS, +} from "./webhook-memory-guards.js"; +export { applyBasicWebhookRequestGuards } from "./webhook-request-guards.js"; diff --git a/src/plugin-sdk/google-gemini-cli-auth.ts b/src/plugin-sdk/google-gemini-cli-auth.ts new file mode 100644 index 00000000000..213f78cfc96 --- /dev/null +++ b/src/plugin-sdk/google-gemini-cli-auth.ts @@ -0,0 +1,8 @@ +// Narrow plugin-sdk surface for the bundled google-gemini-cli-auth plugin. +// Keep this list additive and scoped to symbols used under extensions/google-gemini-cli-auth. + +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export { isWSL2Sync } from "../infra/wsl.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { OpenClawPluginApi, ProviderAuthContext } from "../plugins/types.js"; +export { buildOauthProviderAuthResult } from "./provider-auth-result.js"; diff --git a/src/plugin-sdk/googlechat.ts b/src/plugin-sdk/googlechat.ts new file mode 100644 index 00000000000..e7b96355608 --- /dev/null +++ b/src/plugin-sdk/googlechat.ts @@ -0,0 +1,78 @@ +// Narrow plugin-sdk surface for the bundled googlechat plugin. +// Keep this list additive and scoped to symbols used under extensions/googlechat. + +export { + createActionGate, + jsonResult, + readNumberParam, + readReactionParams, + readStringParam, +} from "../agents/tools/common.js"; +export type { ChannelDock } from "../channels/dock.js"; +export { resolveMentionGatingWithBypass } from "../channels/mention-gating.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { resolveGoogleChatGroupRequireMention } from "../channels/plugins/group-mentions.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + promptAccountId, +} from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export { + applyAccountNameToChannelSection, + migrateBaseNameToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export type { + ChannelAccountSnapshot, + ChannelMessageActionAdapter, + ChannelMessageActionName, + ChannelStatusIssue, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { getChatChannelMeta } from "../channels/registry.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { DmPolicy, GoogleChatAccountConfig, GoogleChatConfig } from "../config/types.js"; +export { isSecretRef } from "../config/types.secrets.js"; +export { GoogleChatConfigSchema } from "../config/zod-schema.providers-core.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export { missingTargetError } from "../infra/outbound/target-errors.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export { resolveDmGroupAccessWithLists } from "../security/dm-policy-shared.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { resolveInboundRouteEnvelopeBuilderWithRuntime } from "./inbound-envelope.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export { extractToolSend } from "./tool-send.js"; +export { resolveWebhookPath } from "./webhook-path.js"; +export type { WebhookInFlightLimiter } from "./webhook-request-guards.js"; +export { + beginWebhookRequestPipelineOrReject, + createWebhookInFlightLimiter, + readJsonWebhookBodyOrReject, +} from "./webhook-request-guards.js"; +export { + registerWebhookTargetWithPluginRoute, + resolveWebhookTargets, + resolveWebhookTargetWithAuthOrReject, +} from "./webhook-targets.js"; diff --git a/src/plugin-sdk/irc.ts b/src/plugin-sdk/irc.ts new file mode 100644 index 00000000000..9706c552450 --- /dev/null +++ b/src/plugin-sdk/irc.ts @@ -0,0 +1,70 @@ +// Narrow plugin-sdk surface for the bundled irc plugin. +// Keep this list additive and scoped to symbols used under extensions/irc. + +export { resolveControlCommandGate } from "../channels/command-gating.js"; +export { logInboundDrop } from "../channels/logging.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js"; +export { addWildcardAllowFrom, promptAccountId } from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export type { BaseProbeResult } from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { getChatChannelMeta } from "../channels/registry.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { + BlockStreamingCoalesceConfig, + DmConfig, + DmPolicy, + GroupPolicy, + GroupToolPolicyBySenderConfig, + GroupToolPolicyConfig, + MarkdownConfig, +} from "../config/types.js"; +export { normalizeResolvedSecretInputString } from "../config/types.secrets.js"; +export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js"; +export { + BlockStreamingCoalesceSchema, + DmConfigSchema, + DmPolicySchema, + GroupPolicySchema, + MarkdownConfigSchema, + ReplyRuntimeConfigSchemaShape, + requireOpenAllowFrom, +} from "../config/zod-schema.core.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { + readStoreAllowFromForDmPolicy, + resolveEffectiveAllowFromLists, +} from "../security/dm-policy-shared.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export type { OutboundReplyPayload } from "./reply-payload.js"; +export { + createNormalizedOutboundDeliverer, + formatTextWithAttachmentLinks, + resolveOutboundMediaUrls, +} from "./reply-payload.js"; +export { createLoggerBackedRuntime } from "./runtime.js"; +export { buildBaseAccountStatusSnapshot, buildBaseChannelStatusSummary } from "./status-helpers.js"; diff --git a/src/plugin-sdk/llm-task.ts b/src/plugin-sdk/llm-task.ts new file mode 100644 index 00000000000..164a28f0440 --- /dev/null +++ b/src/plugin-sdk/llm-task.ts @@ -0,0 +1,5 @@ +// Narrow plugin-sdk surface for the bundled llm-task plugin. +// Keep this list additive and scoped to symbols used under extensions/llm-task. + +export { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js"; +export type { AnyAgentTool, OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/lobster.ts b/src/plugin-sdk/lobster.ts new file mode 100644 index 00000000000..436acdf4d45 --- /dev/null +++ b/src/plugin-sdk/lobster.ts @@ -0,0 +1,14 @@ +// Narrow plugin-sdk surface for the bundled lobster plugin. +// Keep this list additive and scoped to symbols used under extensions/lobster. + +export { + applyWindowsSpawnProgramPolicy, + materializeWindowsSpawnProgram, + resolveWindowsSpawnProgramCandidate, +} from "./windows-spawn.js"; +export type { + AnyAgentTool, + OpenClawPluginApi, + OpenClawPluginToolContext, + OpenClawPluginToolFactory, +} from "../plugins/types.js"; diff --git a/src/plugin-sdk/matrix.ts b/src/plugin-sdk/matrix.ts new file mode 100644 index 00000000000..fca8773e9b3 --- /dev/null +++ b/src/plugin-sdk/matrix.ts @@ -0,0 +1,96 @@ +// Narrow plugin-sdk surface for the bundled matrix plugin. +// Keep this list additive and scoped to symbols used under extensions/matrix. + +export { + createActionGate, + jsonResult, + readNumberParam, + readReactionParams, + readStringParam, +} from "../agents/tools/common.js"; +export type { ReplyPayload } from "../auto-reply/types.js"; +export { resolveAllowlistMatchByCandidates } from "../channels/allowlist-match.js"; +export { mergeAllowlist, summarizeMapping } from "../channels/allowlists/resolve-utils.js"; +export { resolveControlCommandGate } from "../channels/command-gating.js"; +export type { NormalizedLocation } from "../channels/location.js"; +export { formatLocationText, toLocationContext } from "../channels/location.js"; +export { logInboundDrop, logTypingFailure } from "../channels/logging.js"; +export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js"; +export { formatAllowlistMatchMeta } from "../channels/plugins/allowlist-match.js"; +export { + buildChannelKeyCandidates, + resolveChannelEntryMatch, +} from "../channels/plugins/channel-config.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + promptSingleChannelSecretInput, +} from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export { applyAccountNameToChannelSection } from "../channels/plugins/setup-helpers.js"; +export type { + BaseProbeResult, + ChannelDirectoryEntry, + ChannelGroupContext, + ChannelMessageActionAdapter, + ChannelMessageActionContext, + ChannelMessageActionName, + ChannelOutboundAdapter, + ChannelResolveKind, + ChannelResolveResult, + ChannelToolSend, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export { createTypingCallbacks } from "../channels/typing.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { + DmPolicy, + GroupPolicy, + GroupToolPolicyConfig, + MarkdownTableMode, +} from "../config/types.js"; +export type { SecretInput } from "../config/types.secrets.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export { issuePairingChallenge } from "../pairing/pairing-challenge.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime, RuntimeLogger } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export type { PollInput } from "../polls.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { + readStoreAllowFromForDmPolicy, + resolveDmGroupAccessWithLists, +} from "../security/dm-policy-shared.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export { formatResolvedUnresolvedNote } from "./resolution-notes.js"; +export { runPluginCommandWithTimeout } from "./run-command.js"; +export { createLoggerBackedRuntime } from "./runtime.js"; +export { buildProbeChannelStatusSummary } from "./status-helpers.js"; diff --git a/src/plugin-sdk/mattermost.ts b/src/plugin-sdk/mattermost.ts new file mode 100644 index 00000000000..7afe2890d7b --- /dev/null +++ b/src/plugin-sdk/mattermost.ts @@ -0,0 +1,85 @@ +// Narrow plugin-sdk surface for the bundled mattermost plugin. +// Keep this list additive and scoped to symbols used under extensions/mattermost. + +export { formatInboundFromLabel } from "../auto-reply/envelope.js"; +export type { HistoryEntry } from "../auto-reply/reply/history.js"; +export { + buildPendingHistoryContextFromMap, + clearHistoryEntriesIfEnabled, + DEFAULT_GROUP_HISTORY_LIMIT, + recordPendingHistoryEntryIfEnabled, +} from "../auto-reply/reply/history.js"; +export { listSkillCommandsForAgents } from "../auto-reply/skill-commands.js"; +export type { ReplyPayload } from "../auto-reply/types.js"; +export type { ChatType } from "../channels/chat-type.js"; +export { resolveControlCommandGate } from "../channels/command-gating.js"; +export { logInboundDrop, logTypingFailure } from "../channels/logging.js"; +export { resolveAllowlistMatchSimple } from "../channels/plugins/allowlist-match.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; +export type { ChannelOnboardingAdapter } from "../channels/plugins/onboarding-types.js"; +export { + promptAccountId, + promptSingleChannelSecretInput, +} from "../channels/plugins/onboarding/helpers.js"; +export { + applyAccountNameToChannelSection, + migrateBaseNameToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export type { + BaseProbeResult, + ChannelAccountSnapshot, + ChannelGroupContext, + ChannelMessageActionAdapter, + ChannelMessageActionName, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export { createTypingCallbacks } from "../channels/typing.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js"; +export { + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { BlockStreamingCoalesceConfig, DmPolicy, GroupPolicy } from "../config/types.js"; +export type { SecretInput } from "../config/types.secrets.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { + BlockStreamingCoalesceSchema, + DmPolicySchema, + GroupPolicySchema, + MarkdownConfigSchema, + requireOpenAllowFrom, +} from "../config/zod-schema.core.js"; +export { createDedupeCache } from "../infra/dedupe.js"; +export { rawDataToString } from "../infra/ws.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { + DEFAULT_ACCOUNT_ID, + normalizeAccountId, + resolveThreadSessionKeys, +} from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { + DM_GROUP_ACCESS_REASON, + readStoreAllowFromForDmPolicy, + resolveDmGroupAccessWithLists, + resolveEffectiveAllowFromLists, +} from "../security/dm-policy-shared.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { buildAgentMediaPayload } from "./agent-media-payload.js"; +export { loadOutboundMediaFromUrl } from "./outbound-media.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; diff --git a/src/plugin-sdk/memory-core.ts b/src/plugin-sdk/memory-core.ts new file mode 100644 index 00000000000..b715c1f50ca --- /dev/null +++ b/src/plugin-sdk/memory-core.ts @@ -0,0 +1,5 @@ +// Narrow plugin-sdk surface for the bundled memory-core plugin. +// Keep this list additive and scoped to symbols used under extensions/memory-core. + +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/memory-lancedb.ts b/src/plugin-sdk/memory-lancedb.ts new file mode 100644 index 00000000000..840ed95982c --- /dev/null +++ b/src/plugin-sdk/memory-lancedb.ts @@ -0,0 +1,4 @@ +// Narrow plugin-sdk surface for the bundled memory-lancedb plugin. +// Keep this list additive and scoped to symbols used under extensions/memory-lancedb. + +export type { OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/minimax-portal-auth.ts b/src/plugin-sdk/minimax-portal-auth.ts new file mode 100644 index 00000000000..2f6ab59e124 --- /dev/null +++ b/src/plugin-sdk/minimax-portal-auth.ts @@ -0,0 +1,10 @@ +// Narrow plugin-sdk surface for the bundled minimax-portal-auth plugin. +// Keep this list additive and scoped to symbols used under extensions/minimax-portal-auth. + +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { + OpenClawPluginApi, + ProviderAuthContext, + ProviderAuthResult, +} from "../plugins/types.js"; +export { generatePkceVerifierChallenge, toFormUrlEncoded } from "./oauth-utils.js"; diff --git a/src/plugin-sdk/msteams.ts b/src/plugin-sdk/msteams.ts new file mode 100644 index 00000000000..28f5e10a4c0 --- /dev/null +++ b/src/plugin-sdk/msteams.ts @@ -0,0 +1,108 @@ +// Narrow plugin-sdk surface for the bundled msteams plugin. +// Keep this list additive and scoped to symbols used under extensions/msteams. + +export type { ChunkMode } from "../auto-reply/chunk.js"; +export type { HistoryEntry } from "../auto-reply/reply/history.js"; +export { + buildPendingHistoryContextFromMap, + clearHistoryEntriesIfEnabled, + DEFAULT_GROUP_HISTORY_LIMIT, + recordPendingHistoryEntryIfEnabled, +} from "../auto-reply/reply/history.js"; +export { isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; +export type { ReplyPayload } from "../auto-reply/types.js"; +export { mergeAllowlist, summarizeMapping } from "../channels/allowlists/resolve-utils.js"; +export { resolveControlCommandGate } from "../channels/command-gating.js"; +export { logInboundDrop, logTypingFailure } from "../channels/logging.js"; +export { resolveMentionGating } from "../channels/mention-gating.js"; +export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js"; +export { + formatAllowlistMatchMeta, + resolveAllowlistMatchSimple, +} from "../channels/plugins/allowlist-match.js"; +export { + buildChannelKeyCandidates, + normalizeChannelSlug, + resolveChannelEntryMatchWithFallback, + resolveNestedAllowlistDecision, +} from "../channels/plugins/channel-config.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; +export { buildMediaPayload } from "../channels/plugins/media-payload.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, +} from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export type { + BaseProbeResult, + ChannelDirectoryEntry, + ChannelGroupContext, + ChannelMessageActionName, + ChannelOutboundAdapter, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export { createTypingCallbacks } from "../channels/typing.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js"; +export { resolveToolsBySender } from "../config/group-policy.js"; +export { + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, +} from "../config/runtime-group-policy.js"; +export type { + DmPolicy, + GroupPolicy, + GroupToolPolicyConfig, + MarkdownTableMode, + MSTeamsChannelConfig, + MSTeamsConfig, + MSTeamsReplyStyle, + MSTeamsTeamConfig, +} from "../config/types.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { MSTeamsConfigSchema } from "../config/zod-schema.providers-core.js"; +export { DEFAULT_WEBHOOK_MAX_BODY_BYTES } from "../infra/http-body.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export type { SsrFPolicy } from "../infra/net/ssrf.js"; +export { isPrivateIpAddress } from "../infra/net/ssrf.js"; +export { detectMime, extensionForMime, getFileExtension } from "../media/mime.js"; +export { extractOriginalFilename } from "../media/store.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { + readStoreAllowFromForDmPolicy, + resolveDmGroupAccessWithLists, + resolveEffectiveAllowFromLists, +} from "../security/dm-policy-shared.js"; +export { formatDocsLink } from "../terminal/links.js"; +export { sleep } from "../utils.js"; +export { loadWebMedia } from "../web/media.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { keepHttpServerTaskAlive } from "./channel-lifecycle.js"; +export { withFileLock } from "./file-lock.js"; +export { readJsonFileWithFallback, writeJsonFileAtomically } from "./json-store.js"; +export { loadOutboundMediaFromUrl } from "./outbound-media.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export { + buildHostnameAllowlistPolicyFromSuffixAllowlist, + isHttpsUrlAllowedByHostnameSuffixAllowlist, + normalizeHostnameSuffixAllowlist, +} from "./ssrf-policy.js"; +export { + buildBaseChannelStatusSummary, + createDefaultChannelRuntimeState, +} from "./status-helpers.js"; diff --git a/src/plugin-sdk/nextcloud-talk.ts b/src/plugin-sdk/nextcloud-talk.ts new file mode 100644 index 00000000000..7d66c5e66be --- /dev/null +++ b/src/plugin-sdk/nextcloud-talk.ts @@ -0,0 +1,92 @@ +// Narrow plugin-sdk surface for the bundled nextcloud-talk plugin. +// Keep this list additive and scoped to symbols used under extensions/nextcloud-talk. + +export { logInboundDrop } from "../channels/logging.js"; +export { resolveMentionGatingWithBypass } from "../channels/mention-gating.js"; +export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js"; +export { + buildChannelKeyCandidates, + normalizeChannelSlug, + resolveChannelEntryMatchWithFallback, + resolveNestedAllowlistDecision, +} from "../channels/plugins/channel-config.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + promptAccountId, + promptSingleChannelSecretInput, +} from "../channels/plugins/onboarding/helpers.js"; +export { applyAccountNameToChannelSection } from "../channels/plugins/setup-helpers.js"; +export type { ChannelGroupContext, ChannelSetupInput } from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { + BlockStreamingCoalesceConfig, + DmConfig, + DmPolicy, + GroupPolicy, + GroupToolPolicyConfig, +} from "../config/types.js"; +export type { SecretInput } from "../config/types.secrets.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js"; +export { + BlockStreamingCoalesceSchema, + DmConfigSchema, + DmPolicySchema, + GroupPolicySchema, + MarkdownConfigSchema, + ReplyRuntimeConfigSchemaShape, + requireOpenAllowFrom, +} from "../config/zod-schema.core.js"; +export { + isRequestBodyLimitError, + readRequestBodyWithLimit, + requestBodyErrorToText, +} from "../infra/http-body.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { + readStoreAllowFromForDmPolicy, + resolveDmGroupAccessWithCommandGate, +} from "../security/dm-policy-shared.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { + listConfiguredAccountIds, + resolveAccountWithDefaultFallback, +} from "./account-resolution.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export { createPersistentDedupe } from "./persistent-dedupe.js"; +export type { OutboundReplyPayload } from "./reply-payload.js"; +export { + createNormalizedOutboundDeliverer, + formatTextWithAttachmentLinks, + resolveOutboundMediaUrls, +} from "./reply-payload.js"; +export { createLoggerBackedRuntime } from "./runtime.js"; diff --git a/src/plugin-sdk/nostr.ts b/src/plugin-sdk/nostr.ts new file mode 100644 index 00000000000..1eee82f518a --- /dev/null +++ b/src/plugin-sdk/nostr.ts @@ -0,0 +1,19 @@ +// Narrow plugin-sdk surface for the bundled nostr plugin. +// Keep this list additive and scoped to symbols used under extensions/nostr. + +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export { readJsonBodyWithLimit, requestBodyErrorToText } from "../infra/http-body.js"; +export { isBlockedHostnameOrIp } from "../infra/net/ssrf.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js"; +export { + collectStatusIssuesFromLastError, + createDefaultChannelRuntimeState, +} from "./status-helpers.js"; +export { createFixedWindowRateLimiter } from "./webhook-memory-guards.js"; diff --git a/src/plugin-sdk/open-prose.ts b/src/plugin-sdk/open-prose.ts new file mode 100644 index 00000000000..1973404f2a8 --- /dev/null +++ b/src/plugin-sdk/open-prose.ts @@ -0,0 +1,4 @@ +// Narrow plugin-sdk surface for the bundled open-prose plugin. +// Keep this list additive and scoped to symbols used under extensions/open-prose. + +export type { OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/phone-control.ts b/src/plugin-sdk/phone-control.ts new file mode 100644 index 00000000000..394ff9c88ee --- /dev/null +++ b/src/plugin-sdk/phone-control.ts @@ -0,0 +1,9 @@ +// Narrow plugin-sdk surface for the bundled phone-control plugin. +// Keep this list additive and scoped to symbols used under extensions/phone-control. + +export type { + OpenClawPluginApi, + OpenClawPluginCommandDefinition, + OpenClawPluginService, + PluginCommandContext, +} from "../plugins/types.js"; diff --git a/src/plugin-sdk/qwen-portal-auth.ts b/src/plugin-sdk/qwen-portal-auth.ts new file mode 100644 index 00000000000..33d03ae394b --- /dev/null +++ b/src/plugin-sdk/qwen-portal-auth.ts @@ -0,0 +1,6 @@ +// Narrow plugin-sdk surface for the bundled qwen-portal-auth plugin. +// Keep this list additive and scoped to symbols used under extensions/qwen-portal-auth. + +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { OpenClawPluginApi, ProviderAuthContext } from "../plugins/types.js"; +export { generatePkceVerifierChallenge, toFormUrlEncoded } from "./oauth-utils.js"; diff --git a/src/plugin-sdk/subpaths.test.ts b/src/plugin-sdk/subpaths.test.ts index 9065712d235..061230bb7ca 100644 --- a/src/plugin-sdk/subpaths.test.ts +++ b/src/plugin-sdk/subpaths.test.ts @@ -2,11 +2,52 @@ import * as compatSdk from "openclaw/plugin-sdk/compat"; import * as discordSdk from "openclaw/plugin-sdk/discord"; import * as imessageSdk from "openclaw/plugin-sdk/imessage"; import * as lineSdk from "openclaw/plugin-sdk/line"; +import * as msteamsSdk from "openclaw/plugin-sdk/msteams"; import * as signalSdk from "openclaw/plugin-sdk/signal"; import * as slackSdk from "openclaw/plugin-sdk/slack"; import * as whatsappSdk from "openclaw/plugin-sdk/whatsapp"; import { describe, expect, it } from "vitest"; +const bundledExtensionSubpathLoaders = [ + { id: "acpx", load: () => import("openclaw/plugin-sdk/acpx") }, + { id: "bluebubbles", load: () => import("openclaw/plugin-sdk/bluebubbles") }, + { id: "copilot-proxy", load: () => import("openclaw/plugin-sdk/copilot-proxy") }, + { id: "device-pair", load: () => import("openclaw/plugin-sdk/device-pair") }, + { id: "diagnostics-otel", load: () => import("openclaw/plugin-sdk/diagnostics-otel") }, + { id: "diffs", load: () => import("openclaw/plugin-sdk/diffs") }, + { id: "feishu", load: () => import("openclaw/plugin-sdk/feishu") }, + { + id: "google-gemini-cli-auth", + load: () => import("openclaw/plugin-sdk/google-gemini-cli-auth"), + }, + { id: "googlechat", load: () => import("openclaw/plugin-sdk/googlechat") }, + { id: "irc", load: () => import("openclaw/plugin-sdk/irc") }, + { id: "llm-task", load: () => import("openclaw/plugin-sdk/llm-task") }, + { id: "lobster", load: () => import("openclaw/plugin-sdk/lobster") }, + { id: "matrix", load: () => import("openclaw/plugin-sdk/matrix") }, + { id: "mattermost", load: () => import("openclaw/plugin-sdk/mattermost") }, + { id: "memory-core", load: () => import("openclaw/plugin-sdk/memory-core") }, + { id: "memory-lancedb", load: () => import("openclaw/plugin-sdk/memory-lancedb") }, + { + id: "minimax-portal-auth", + load: () => import("openclaw/plugin-sdk/minimax-portal-auth"), + }, + { id: "nextcloud-talk", load: () => import("openclaw/plugin-sdk/nextcloud-talk") }, + { id: "nostr", load: () => import("openclaw/plugin-sdk/nostr") }, + { id: "open-prose", load: () => import("openclaw/plugin-sdk/open-prose") }, + { id: "phone-control", load: () => import("openclaw/plugin-sdk/phone-control") }, + { id: "qwen-portal-auth", load: () => import("openclaw/plugin-sdk/qwen-portal-auth") }, + { id: "synology-chat", load: () => import("openclaw/plugin-sdk/synology-chat") }, + { id: "talk-voice", load: () => import("openclaw/plugin-sdk/talk-voice") }, + { id: "test-utils", load: () => import("openclaw/plugin-sdk/test-utils") }, + { id: "thread-ownership", load: () => import("openclaw/plugin-sdk/thread-ownership") }, + { id: "tlon", load: () => import("openclaw/plugin-sdk/tlon") }, + { id: "twitch", load: () => import("openclaw/plugin-sdk/twitch") }, + { id: "voice-call", load: () => import("openclaw/plugin-sdk/voice-call") }, + { id: "zalo", load: () => import("openclaw/plugin-sdk/zalo") }, + { id: "zalouser", load: () => import("openclaw/plugin-sdk/zalouser") }, +] as const; + describe("plugin-sdk subpath exports", () => { it("exports compat helpers", () => { expect(typeof compatSdk.emptyPluginConfigSchema).toBe("function"); @@ -42,4 +83,17 @@ describe("plugin-sdk subpath exports", () => { expect(typeof lineSdk.processLineMessage).toBe("function"); expect(typeof lineSdk.createInfoCard).toBe("function"); }); + + it("exports Microsoft Teams helpers", () => { + expect(typeof msteamsSdk.resolveControlCommandGate).toBe("function"); + expect(typeof msteamsSdk.loadOutboundMediaFromUrl).toBe("function"); + }); + + it("resolves bundled extension subpaths", async () => { + for (const { id, load } of bundledExtensionSubpathLoaders) { + const mod = await load(); + expect(typeof mod).toBe("object"); + expect(mod, `subpath ${id} should resolve`).toBeTruthy(); + } + }); }); diff --git a/src/plugin-sdk/synology-chat.ts b/src/plugin-sdk/synology-chat.ts new file mode 100644 index 00000000000..dcce2ea760b --- /dev/null +++ b/src/plugin-sdk/synology-chat.ts @@ -0,0 +1,17 @@ +// Narrow plugin-sdk surface for the bundled synology-chat plugin. +// Keep this list additive and scoped to symbols used under extensions/synology-chat. + +export { setAccountEnabledInConfigSection } from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { + isRequestBodyLimitError, + readRequestBodyWithLimit, + requestBodyErrorToText, +} from "../infra/http-body.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export { registerPluginHttpRoute } from "../plugins/http-registry.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js"; +export type { FixedWindowRateLimiter } from "./webhook-memory-guards.js"; +export { createFixedWindowRateLimiter } from "./webhook-memory-guards.js"; diff --git a/src/plugin-sdk/talk-voice.ts b/src/plugin-sdk/talk-voice.ts new file mode 100644 index 00000000000..3ee313ec42f --- /dev/null +++ b/src/plugin-sdk/talk-voice.ts @@ -0,0 +1,4 @@ +// Narrow plugin-sdk surface for the bundled talk-voice plugin. +// Keep this list additive and scoped to symbols used under extensions/talk-voice. + +export type { OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/test-utils.ts b/src/plugin-sdk/test-utils.ts new file mode 100644 index 00000000000..78307f694a6 --- /dev/null +++ b/src/plugin-sdk/test-utils.ts @@ -0,0 +1,8 @@ +// Narrow plugin-sdk surface for the bundled test-utils plugin. +// Keep this list additive and scoped to symbols used under extensions/test-utils. + +export { removeAckReactionAfterReply, shouldAckReaction } from "../channels/ack-reactions.js"; +export type { ChannelAccountSnapshot, ChannelGatewayContext } from "../channels/plugins/types.js"; +export type { OpenClawConfig } from "../config/config.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { RuntimeEnv } from "../runtime.js"; diff --git a/src/plugin-sdk/thread-ownership.ts b/src/plugin-sdk/thread-ownership.ts new file mode 100644 index 00000000000..48d72fa5d35 --- /dev/null +++ b/src/plugin-sdk/thread-ownership.ts @@ -0,0 +1,5 @@ +// Narrow plugin-sdk surface for the bundled thread-ownership plugin. +// Keep this list additive and scoped to symbols used under extensions/thread-ownership. + +export type { OpenClawConfig } from "../config/config.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/tlon.ts b/src/plugin-sdk/tlon.ts new file mode 100644 index 00000000000..fe41eba5687 --- /dev/null +++ b/src/plugin-sdk/tlon.ts @@ -0,0 +1,28 @@ +// Narrow plugin-sdk surface for the bundled tlon plugin. +// Keep this list additive and scoped to symbols used under extensions/tlon. + +export type { ReplyPayload } from "../auto-reply/types.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export type { ChannelOnboardingAdapter } from "../channels/plugins/onboarding-types.js"; +export { promptAccountId } from "../channels/plugins/onboarding/helpers.js"; +export { applyAccountNameToChannelSection } from "../channels/plugins/setup-helpers.js"; +export type { + ChannelAccountSnapshot, + ChannelOutboundAdapter, + ChannelSetupInput, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { createDedupeCache } from "../infra/dedupe.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export type { LookupFn, SsrFPolicy } from "../infra/net/ssrf.js"; +export { isBlockedHostnameOrIp, SsrFBlockedError } from "../infra/net/ssrf.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { createLoggerBackedRuntime } from "./runtime.js"; diff --git a/src/plugin-sdk/twitch.ts b/src/plugin-sdk/twitch.ts new file mode 100644 index 00000000000..bd315b02c9a --- /dev/null +++ b/src/plugin-sdk/twitch.ts @@ -0,0 +1,19 @@ +// Narrow plugin-sdk surface for the bundled twitch plugin. +// Keep this list additive and scoped to symbols used under extensions/twitch. + +export type { ReplyPayload } from "../auto-reply/types.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js"; +export type { BaseProbeResult, ChannelStatusIssue } from "../channels/plugins/types.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { formatDocsLink } from "../terminal/links.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; diff --git a/src/plugin-sdk/voice-call.ts b/src/plugin-sdk/voice-call.ts new file mode 100644 index 00000000000..da8a1f12613 --- /dev/null +++ b/src/plugin-sdk/voice-call.ts @@ -0,0 +1,18 @@ +// Narrow plugin-sdk surface for the bundled voice-call plugin. +// Keep this list additive and scoped to symbols used under extensions/voice-call. + +export { + TtsAutoSchema, + TtsConfigSchema, + TtsModeSchema, + TtsProviderSchema, +} from "../config/zod-schema.core.js"; +export type { GatewayRequestHandlerOptions } from "../gateway/server-methods/types.js"; +export { + isRequestBodyLimitError, + readRequestBodyWithLimit, + requestBodyErrorToText, +} from "../infra/http-body.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { sleep } from "../utils.js"; diff --git a/src/plugin-sdk/whatsapp.ts b/src/plugin-sdk/whatsapp.ts index eaa9a890e8b..20869bbdce8 100644 --- a/src/plugin-sdk/whatsapp.ts +++ b/src/plugin-sdk/whatsapp.ts @@ -1,5 +1,6 @@ export type { ChannelMessageActionName } from "../channels/plugins/types.js"; export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export type { OpenClawConfig } from "../config/config.js"; export type { ResolvedWhatsAppAccount } from "../web/accounts.js"; export type { PluginRuntime } from "../plugins/runtime/types.js"; export type { OpenClawPluginApi } from "../plugins/types.js"; diff --git a/src/plugin-sdk/zalo.ts b/src/plugin-sdk/zalo.ts new file mode 100644 index 00000000000..07237369d2e --- /dev/null +++ b/src/plugin-sdk/zalo.ts @@ -0,0 +1,94 @@ +// Narrow plugin-sdk surface for the bundled zalo plugin. +// Keep this list additive and scoped to symbols used under extensions/zalo. + +export { jsonResult, readStringParam } from "../agents/tools/common.js"; +export type { ReplyPayload } from "../auto-reply/types.js"; +export type { ChannelDock } from "../channels/dock.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + promptAccountId, + promptSingleChannelSecretInput, +} from "../channels/plugins/onboarding/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export { + applyAccountNameToChannelSection, + migrateBaseNameToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export type { + BaseProbeResult, + BaseTokenResolution, + ChannelAccountSnapshot, + ChannelMessageActionAdapter, + ChannelMessageActionName, + ChannelStatusIssue, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { + resolveDefaultGroupPolicy, + resolveOpenProviderRuntimeGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { GroupPolicy, MarkdownTableMode } from "../config/types.js"; +export type { SecretInput } from "../config/types.secrets.js"; +export { + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "../config/types.secrets.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export { createDedupeCache } from "../infra/dedupe.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { formatAllowFromLowercase, isNormalizedSenderAllowed } from "./allow-from.js"; +export { + resolveDirectDmAuthorizationOutcome, + resolveSenderCommandAuthorizationWithRuntime, +} from "./command-auth.js"; +export { resolveChannelAccountConfigBasePath } from "./config-paths.js"; +export { evaluateSenderGroupAccess } from "./group-access.js"; +export type { SenderGroupAccessDecision } from "./group-access.js"; +export { resolveInboundRouteEnvelopeBuilderWithRuntime } from "./inbound-envelope.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export type { OutboundReplyPayload } from "./reply-payload.js"; +export { resolveOutboundMediaUrls, sendMediaWithLeadingCaption } from "./reply-payload.js"; +export { buildTokenChannelStatusSummary } from "./status-helpers.js"; +export { chunkTextForOutbound } from "./text-chunking.js"; +export { extractToolSend } from "./tool-send.js"; +export { + createFixedWindowRateLimiter, + createWebhookAnomalyTracker, + WEBHOOK_ANOMALY_COUNTER_DEFAULTS, + WEBHOOK_RATE_LIMIT_DEFAULTS, +} from "./webhook-memory-guards.js"; +export { resolveWebhookPath } from "./webhook-path.js"; +export { + applyBasicWebhookRequestGuards, + readJsonWebhookBodyOrReject, +} from "./webhook-request-guards.js"; +export type { + RegisterWebhookPluginRouteOptions, + RegisterWebhookTargetOptions, +} from "./webhook-targets.js"; +export { + registerWebhookTarget, + registerWebhookTargetWithPluginRoute, + resolveSingleWebhookTarget, + resolveWebhookTargets, +} from "./webhook-targets.js"; diff --git a/src/plugin-sdk/zalouser.ts b/src/plugin-sdk/zalouser.ts new file mode 100644 index 00000000000..3109802fbb3 --- /dev/null +++ b/src/plugin-sdk/zalouser.ts @@ -0,0 +1,63 @@ +// Narrow plugin-sdk surface for the bundled zalouser plugin. +// Keep this list additive and scoped to symbols used under extensions/zalouser. + +export type { ReplyPayload } from "../auto-reply/types.js"; +export { mergeAllowlist, summarizeMapping } from "../channels/allowlists/resolve-utils.js"; +export type { ChannelDock } from "../channels/dock.js"; +export { resolveMentionGatingWithBypass } from "../channels/mention-gating.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export type { + ChannelOnboardingAdapter, + ChannelOnboardingDmPolicy, +} from "../channels/plugins/onboarding-types.js"; +export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + promptAccountId, +} from "../channels/plugins/onboarding/helpers.js"; +export { + applyAccountNameToChannelSection, + migrateBaseNameToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export type { + BaseProbeResult, + ChannelAccountSnapshot, + ChannelDirectoryEntry, + ChannelGroupContext, + ChannelMessageActionAdapter, + ChannelStatusIssue, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export { createTypingCallbacks } from "../channels/typing.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { + resolveDefaultGroupPolicy, + resolveOpenProviderRuntimeGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { GroupToolPolicyConfig, MarkdownTableMode } from "../config/types.js"; +export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { AnyAgentTool, OpenClawPluginApi } from "../plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { formatAllowFromLowercase } from "./allow-from.js"; +export { resolveSenderCommandAuthorization } from "./command-auth.js"; +export { resolveChannelAccountConfigBasePath } from "./config-paths.js"; +export { loadOutboundMediaFromUrl } from "./outbound-media.js"; +export { createScopedPairingAccess } from "./pairing-access.js"; +export type { OutboundReplyPayload } from "./reply-payload.js"; +export { resolveOutboundMediaUrls, sendMediaWithLeadingCaption } from "./reply-payload.js"; +export { formatResolvedUnresolvedNote } from "./resolution-notes.js"; +export { chunkTextForOutbound } from "./text-chunking.js"; diff --git a/src/plugins/loader.ts b/src/plugins/loader.ts index 953592d1b59..c735249c7ad 100644 --- a/src/plugins/loader.ts +++ b/src/plugins/loader.ts @@ -88,44 +88,108 @@ const resolvePluginSdkAliasFile = (params: { const resolvePluginSdkAlias = (): string | null => resolvePluginSdkAliasFile({ srcFile: "root-alias.cjs", distFile: "root-alias.cjs" }); -const resolvePluginSdkAccountIdAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "account-id.ts", distFile: "account-id.js" }); -}; +const pluginSdkScopedAliasEntries = [ + { subpath: "core", srcFile: "core.ts", distFile: "core.js" }, + { subpath: "compat", srcFile: "compat.ts", distFile: "compat.js" }, + { subpath: "telegram", srcFile: "telegram.ts", distFile: "telegram.js" }, + { subpath: "discord", srcFile: "discord.ts", distFile: "discord.js" }, + { subpath: "slack", srcFile: "slack.ts", distFile: "slack.js" }, + { subpath: "signal", srcFile: "signal.ts", distFile: "signal.js" }, + { subpath: "imessage", srcFile: "imessage.ts", distFile: "imessage.js" }, + { subpath: "whatsapp", srcFile: "whatsapp.ts", distFile: "whatsapp.js" }, + { subpath: "line", srcFile: "line.ts", distFile: "line.js" }, + { subpath: "msteams", srcFile: "msteams.ts", distFile: "msteams.js" }, + { subpath: "acpx", srcFile: "acpx.ts", distFile: "acpx.js" }, + { subpath: "bluebubbles", srcFile: "bluebubbles.ts", distFile: "bluebubbles.js" }, + { + subpath: "copilot-proxy", + srcFile: "copilot-proxy.ts", + distFile: "copilot-proxy.js", + }, + { subpath: "device-pair", srcFile: "device-pair.ts", distFile: "device-pair.js" }, + { + subpath: "diagnostics-otel", + srcFile: "diagnostics-otel.ts", + distFile: "diagnostics-otel.js", + }, + { subpath: "diffs", srcFile: "diffs.ts", distFile: "diffs.js" }, + { subpath: "feishu", srcFile: "feishu.ts", distFile: "feishu.js" }, + { + subpath: "google-gemini-cli-auth", + srcFile: "google-gemini-cli-auth.ts", + distFile: "google-gemini-cli-auth.js", + }, + { subpath: "googlechat", srcFile: "googlechat.ts", distFile: "googlechat.js" }, + { subpath: "irc", srcFile: "irc.ts", distFile: "irc.js" }, + { subpath: "llm-task", srcFile: "llm-task.ts", distFile: "llm-task.js" }, + { subpath: "lobster", srcFile: "lobster.ts", distFile: "lobster.js" }, + { subpath: "matrix", srcFile: "matrix.ts", distFile: "matrix.js" }, + { subpath: "mattermost", srcFile: "mattermost.ts", distFile: "mattermost.js" }, + { subpath: "memory-core", srcFile: "memory-core.ts", distFile: "memory-core.js" }, + { + subpath: "memory-lancedb", + srcFile: "memory-lancedb.ts", + distFile: "memory-lancedb.js", + }, + { + subpath: "minimax-portal-auth", + srcFile: "minimax-portal-auth.ts", + distFile: "minimax-portal-auth.js", + }, + { + subpath: "nextcloud-talk", + srcFile: "nextcloud-talk.ts", + distFile: "nextcloud-talk.js", + }, + { subpath: "nostr", srcFile: "nostr.ts", distFile: "nostr.js" }, + { subpath: "open-prose", srcFile: "open-prose.ts", distFile: "open-prose.js" }, + { + subpath: "phone-control", + srcFile: "phone-control.ts", + distFile: "phone-control.js", + }, + { + subpath: "qwen-portal-auth", + srcFile: "qwen-portal-auth.ts", + distFile: "qwen-portal-auth.js", + }, + { + subpath: "synology-chat", + srcFile: "synology-chat.ts", + distFile: "synology-chat.js", + }, + { subpath: "talk-voice", srcFile: "talk-voice.ts", distFile: "talk-voice.js" }, + { subpath: "test-utils", srcFile: "test-utils.ts", distFile: "test-utils.js" }, + { + subpath: "thread-ownership", + srcFile: "thread-ownership.ts", + distFile: "thread-ownership.js", + }, + { subpath: "tlon", srcFile: "tlon.ts", distFile: "tlon.js" }, + { subpath: "twitch", srcFile: "twitch.ts", distFile: "twitch.js" }, + { subpath: "voice-call", srcFile: "voice-call.ts", distFile: "voice-call.js" }, + { subpath: "zalo", srcFile: "zalo.ts", distFile: "zalo.js" }, + { subpath: "zalouser", srcFile: "zalouser.ts", distFile: "zalouser.js" }, + { subpath: "account-id", srcFile: "account-id.ts", distFile: "account-id.js" }, + { + subpath: "keyed-async-queue", + srcFile: "keyed-async-queue.ts", + distFile: "keyed-async-queue.js", + }, +] as const; -const resolvePluginSdkCoreAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "core.ts", distFile: "core.js" }); -}; - -const resolvePluginSdkCompatAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "compat.ts", distFile: "compat.js" }); -}; - -const resolvePluginSdkTelegramAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "telegram.ts", distFile: "telegram.js" }); -}; - -const resolvePluginSdkDiscordAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "discord.ts", distFile: "discord.js" }); -}; - -const resolvePluginSdkSlackAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "slack.ts", distFile: "slack.js" }); -}; - -const resolvePluginSdkSignalAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "signal.ts", distFile: "signal.js" }); -}; - -const resolvePluginSdkIMessageAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "imessage.ts", distFile: "imessage.js" }); -}; - -const resolvePluginSdkWhatsAppAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "whatsapp.ts", distFile: "whatsapp.js" }); -}; - -const resolvePluginSdkLineAlias = (): string | null => { - return resolvePluginSdkAliasFile({ srcFile: "line.ts", distFile: "line.js" }); +const resolvePluginSdkScopedAliasMap = (): Record => { + const aliasMap: Record = {}; + for (const entry of pluginSdkScopedAliasEntries) { + const resolved = resolvePluginSdkAliasFile({ + srcFile: entry.srcFile, + distFile: entry.distFile, + }); + if (resolved) { + aliasMap[`openclaw/plugin-sdk/${entry.subpath}`] = resolved; + } + } + return aliasMap; }; export const __testing = { @@ -504,30 +568,9 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi return jitiLoader; } const pluginSdkAlias = resolvePluginSdkAlias(); - const pluginSdkAccountIdAlias = resolvePluginSdkAccountIdAlias(); - const pluginSdkCoreAlias = resolvePluginSdkCoreAlias(); - const pluginSdkCompatAlias = resolvePluginSdkCompatAlias(); - const pluginSdkTelegramAlias = resolvePluginSdkTelegramAlias(); - const pluginSdkDiscordAlias = resolvePluginSdkDiscordAlias(); - const pluginSdkSlackAlias = resolvePluginSdkSlackAlias(); - const pluginSdkSignalAlias = resolvePluginSdkSignalAlias(); - const pluginSdkIMessageAlias = resolvePluginSdkIMessageAlias(); - const pluginSdkWhatsAppAlias = resolvePluginSdkWhatsAppAlias(); - const pluginSdkLineAlias = resolvePluginSdkLineAlias(); const aliasMap = { ...(pluginSdkAlias ? { "openclaw/plugin-sdk": pluginSdkAlias } : {}), - ...(pluginSdkCoreAlias ? { "openclaw/plugin-sdk/core": pluginSdkCoreAlias } : {}), - ...(pluginSdkCompatAlias ? { "openclaw/plugin-sdk/compat": pluginSdkCompatAlias } : {}), - ...(pluginSdkTelegramAlias ? { "openclaw/plugin-sdk/telegram": pluginSdkTelegramAlias } : {}), - ...(pluginSdkDiscordAlias ? { "openclaw/plugin-sdk/discord": pluginSdkDiscordAlias } : {}), - ...(pluginSdkSlackAlias ? { "openclaw/plugin-sdk/slack": pluginSdkSlackAlias } : {}), - ...(pluginSdkSignalAlias ? { "openclaw/plugin-sdk/signal": pluginSdkSignalAlias } : {}), - ...(pluginSdkIMessageAlias ? { "openclaw/plugin-sdk/imessage": pluginSdkIMessageAlias } : {}), - ...(pluginSdkWhatsAppAlias ? { "openclaw/plugin-sdk/whatsapp": pluginSdkWhatsAppAlias } : {}), - ...(pluginSdkLineAlias ? { "openclaw/plugin-sdk/line": pluginSdkLineAlias } : {}), - ...(pluginSdkAccountIdAlias - ? { "openclaw/plugin-sdk/account-id": pluginSdkAccountIdAlias } - : {}), + ...resolvePluginSdkScopedAliasMap(), }; jitiLoader = createJiti(import.meta.url, { interopDefault: true, diff --git a/tsconfig.plugin-sdk.dts.json b/tsconfig.plugin-sdk.dts.json index c3efae99617..7e2b76d745e 100644 --- a/tsconfig.plugin-sdk.dts.json +++ b/tsconfig.plugin-sdk.dts.json @@ -21,8 +21,40 @@ "src/plugin-sdk/imessage.ts", "src/plugin-sdk/whatsapp.ts", "src/plugin-sdk/line.ts", + "src/plugin-sdk/msteams.ts", "src/plugin-sdk/account-id.ts", "src/plugin-sdk/keyed-async-queue.ts", + "src/plugin-sdk/acpx.ts", + "src/plugin-sdk/bluebubbles.ts", + "src/plugin-sdk/copilot-proxy.ts", + "src/plugin-sdk/device-pair.ts", + "src/plugin-sdk/diagnostics-otel.ts", + "src/plugin-sdk/diffs.ts", + "src/plugin-sdk/feishu.ts", + "src/plugin-sdk/google-gemini-cli-auth.ts", + "src/plugin-sdk/googlechat.ts", + "src/plugin-sdk/irc.ts", + "src/plugin-sdk/llm-task.ts", + "src/plugin-sdk/lobster.ts", + "src/plugin-sdk/matrix.ts", + "src/plugin-sdk/mattermost.ts", + "src/plugin-sdk/memory-core.ts", + "src/plugin-sdk/memory-lancedb.ts", + "src/plugin-sdk/minimax-portal-auth.ts", + "src/plugin-sdk/nextcloud-talk.ts", + "src/plugin-sdk/nostr.ts", + "src/plugin-sdk/open-prose.ts", + "src/plugin-sdk/phone-control.ts", + "src/plugin-sdk/qwen-portal-auth.ts", + "src/plugin-sdk/synology-chat.ts", + "src/plugin-sdk/talk-voice.ts", + "src/plugin-sdk/test-utils.ts", + "src/plugin-sdk/thread-ownership.ts", + "src/plugin-sdk/tlon.ts", + "src/plugin-sdk/twitch.ts", + "src/plugin-sdk/voice-call.ts", + "src/plugin-sdk/zalo.ts", + "src/plugin-sdk/zalouser.ts", "src/types/**/*.d.ts" ], "exclude": ["node_modules", "dist", "src/**/*.test.ts"] diff --git a/tsdown.config.ts b/tsdown.config.ts index a69be542d08..b0c2d49c676 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -4,6 +4,53 @@ const env = { NODE_ENV: "production", }; +const pluginSdkEntrypoints = [ + "index", + "core", + "compat", + "telegram", + "discord", + "slack", + "signal", + "imessage", + "whatsapp", + "line", + "msteams", + "acpx", + "bluebubbles", + "copilot-proxy", + "device-pair", + "diagnostics-otel", + "diffs", + "feishu", + "google-gemini-cli-auth", + "googlechat", + "irc", + "llm-task", + "lobster", + "matrix", + "mattermost", + "memory-core", + "memory-lancedb", + "minimax-portal-auth", + "nextcloud-talk", + "nostr", + "open-prose", + "phone-control", + "qwen-portal-auth", + "synology-chat", + "talk-voice", + "test-utils", + "thread-ownership", + "tlon", + "twitch", + "voice-call", + "zalo", + "zalouser", + "account-id", + "keyed-async-queue", +] as const; + export default defineConfig([ { entry: "src/index.ts", @@ -48,83 +95,13 @@ export default defineConfig([ fixedExtension: false, platform: "node", }, - { - entry: "src/plugin-sdk/index.ts", + ...pluginSdkEntrypoints.map((entry) => ({ + entry: `src/plugin-sdk/${entry}.ts`, outDir: "dist/plugin-sdk", env, fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/core.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/compat.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/telegram.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/discord.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/slack.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/signal.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/imessage.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/whatsapp.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/line.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, - { - entry: "src/plugin-sdk/account-id.ts", - outDir: "dist/plugin-sdk", - env, - fixedExtension: false, - platform: "node", - }, + platform: "node" as const, + })), { entry: "src/extensionAPI.ts", env, diff --git a/vitest.config.ts b/vitest.config.ts index 2094476eff1..658437187f5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -8,55 +8,60 @@ const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true"; const isWindows = process.platform === "win32"; const localWorkers = Math.max(4, Math.min(16, os.cpus().length)); const ciWorkers = isWindows ? 2 : 3; +const pluginSdkSubpaths = [ + "account-id", + "core", + "compat", + "telegram", + "discord", + "slack", + "signal", + "imessage", + "whatsapp", + "line", + "msteams", + "acpx", + "bluebubbles", + "copilot-proxy", + "device-pair", + "diagnostics-otel", + "diffs", + "feishu", + "google-gemini-cli-auth", + "googlechat", + "irc", + "llm-task", + "lobster", + "matrix", + "mattermost", + "memory-core", + "memory-lancedb", + "minimax-portal-auth", + "nextcloud-talk", + "nostr", + "open-prose", + "phone-control", + "qwen-portal-auth", + "synology-chat", + "talk-voice", + "test-utils", + "thread-ownership", + "tlon", + "twitch", + "voice-call", + "zalo", + "zalouser", + "keyed-async-queue", +] as const; export default defineConfig({ resolve: { // Keep this ordered: the base `openclaw/plugin-sdk` alias is a prefix match. alias: [ - { - find: "openclaw/plugin-sdk/account-id", - replacement: path.join(repoRoot, "src", "plugin-sdk", "account-id.ts"), - }, - { - find: "openclaw/plugin-sdk/core", - replacement: path.join(repoRoot, "src", "plugin-sdk", "core.ts"), - }, - { - find: "openclaw/plugin-sdk/compat", - replacement: path.join(repoRoot, "src", "plugin-sdk", "compat.ts"), - }, - { - find: "openclaw/plugin-sdk/telegram", - replacement: path.join(repoRoot, "src", "plugin-sdk", "telegram.ts"), - }, - { - find: "openclaw/plugin-sdk/discord", - replacement: path.join(repoRoot, "src", "plugin-sdk", "discord.ts"), - }, - { - find: "openclaw/plugin-sdk/slack", - replacement: path.join(repoRoot, "src", "plugin-sdk", "slack.ts"), - }, - { - find: "openclaw/plugin-sdk/signal", - replacement: path.join(repoRoot, "src", "plugin-sdk", "signal.ts"), - }, - { - find: "openclaw/plugin-sdk/imessage", - replacement: path.join(repoRoot, "src", "plugin-sdk", "imessage.ts"), - }, - { - find: "openclaw/plugin-sdk/whatsapp", - replacement: path.join(repoRoot, "src", "plugin-sdk", "whatsapp.ts"), - }, - { - find: "openclaw/plugin-sdk/line", - replacement: path.join(repoRoot, "src", "plugin-sdk", "line.ts"), - }, - { - find: "openclaw/plugin-sdk/keyed-async-queue", - replacement: path.join(repoRoot, "src", "plugin-sdk", "keyed-async-queue.ts"), - }, + ...pluginSdkSubpaths.map((subpath) => ({ + find: `openclaw/plugin-sdk/${subpath}`, + replacement: path.join(repoRoot, "src", "plugin-sdk", `${subpath}.ts`), + })), { find: "openclaw/plugin-sdk", replacement: path.join(repoRoot, "src", "plugin-sdk", "index.ts"),