插件 SDK 以Documentation Index
Fetch the complete documentation index at: https://openclaw.zhcndoc.com/llms.txt
Use this file to discover all available pages before exploring further.
openclaw/plugin-sdk/ 下的一组窄子路径形式暴露。
本页按用途整理了常用子路径。生成的 200+ 子路径完整列表位于 scripts/lib/plugin-sdk-entrypoints.json;
保留的 bundled-plugin helper 子路径也会出现在其中,但除非文档页面明确推广,否则它们都属于实现细节。
维护者可以使用 pnpm plugins:boundary-report:summary 审核当前启用的保留 helper 子路径;未使用的保留 helper 导出会让 CI 报告失败,而不会继续作为公共 SDK 中沉睡的兼容性债务存在。
有关插件编写指南,请参见 Plugin SDK overview。
插件入口
| 子路径 | 主要导出 |
|---|---|
plugin-sdk/plugin-entry | definePluginEntry |
plugin-sdk/core | defineChannelPluginEntry, createChatChannelPlugin, createChannelPluginBase, defineSetupPluginEntry, buildChannelConfigSchema, buildJsonChannelConfigSchema |
plugin-sdk/config-schema | OpenClawSchema |
plugin-sdk/provider-entry | defineSingleProviderPluginEntry |
plugin-sdk/testing | 面向旧版插件测试的广泛兼容桶;新的扩展测试更推荐使用更聚焦的测试子路径 |
plugin-sdk/plugin-test-api | 用于直接插件注册单元测试的最小 OpenClawPluginApi mock 构建器 |
plugin-sdk/agent-runtime-test-contracts | 原生 agent-runtime 适配器契约夹具,用于认证档案、交付抑制、fallback 分类、tool hook、prompt overlay、schema 和 transcript repair |
plugin-sdk/channel-test-helpers | channel 账号生命周期、目录、发送配置、运行时 mock、hook、bundled channel 入口、信封时间戳、配对回复和通用 channel 契约测试 helper |
plugin-sdk/channel-target-testing | 共享的 channel 目标解析错误场景测试套件 |
plugin-sdk/plugin-test-contracts | 插件注册、包清单、公共产物、运行时 API、导入副作用和直接导入契约 helper |
plugin-sdk/plugin-test-runtime | 插件运行时、注册表、provider 注册、setup 向导和运行时任务流测试夹具 |
plugin-sdk/provider-test-contracts | provider 运行时、认证、发现、onboard、目录、媒体能力、replay 策略、实时 STT 直播音频、web-search/fetch 和向导契约 helper |
plugin-sdk/provider-http-test-mocks | 用于测试 plugin-sdk/provider-http 的可选 Vitest HTTP/auth mocks |
plugin-sdk/test-env | 测试环境、fetch/network、可释放 HTTP 服务器、入站请求、live-test、临时文件系统和时间控制夹具 |
plugin-sdk/test-fixtures | 通用 CLI、sandbox、skill、agent-message、system-event、模块重载、bundled plugin 路径、终端、分块、auth-token 和 typed-case 测试夹具 |
plugin-sdk/test-node-mocks | 供在 Vitest vi.mock("node:*") 工厂内部使用的聚焦版 Node 内置 mock helper |
plugin-sdk/migration | 迁移 provider 项目 helper,例如 createMigrationItem、原因常量、项目状态标记、脱敏 helper 和 summarizeMigrationItems |
plugin-sdk/migration-runtime | 运行时迁移 helper,例如 copyMigrationFileItem、withCachedMigrationConfigRuntime 和 writeMigrationReport |
Channel 子路径
Channel 子路径
| 子路径 | 主要导出 |
|---|---|
plugin-sdk/channel-core | defineChannelPluginEntry, defineSetupPluginEntry, createChatChannelPlugin, createChannelPluginBase |
plugin-sdk/config-schema | 根 openclaw.json 的 Zod schema 导出(OpenClawSchema) |
plugin-sdk/channel-setup | createOptionalChannelSetupSurface, createOptionalChannelSetupAdapter, createOptionalChannelSetupWizard,以及 DEFAULT_ACCOUNT_ID、createTopLevelChannelDmPolicy、setSetupChannelEnabled、splitSetupEntries |
plugin-sdk/setup | 共享的 setup 向导 helper、allowlist 提示、setup 状态构建器 |
plugin-sdk/setup-runtime | createPatchedAccountSetupAdapter, createEnvPatchedAccountSetupAdapter, createSetupInputPresenceValidator, noteChannelLookupFailure, noteChannelLookupSummary, promptResolvedAllowFrom, splitSetupEntries, createAllowlistSetupWizardProxy, createDelegatedSetupWizardProxy |
plugin-sdk/setup-adapter-runtime | createEnvPatchedAccountSetupAdapter |
plugin-sdk/setup-tools | formatCliCommand, detectBinary, extractArchive, resolveBrewExecutable, formatDocsLink, CONFIG_DIR |
plugin-sdk/account-core | 多账号配置/动作门控 helper、默认账号回退 helper |
plugin-sdk/account-id | DEFAULT_ACCOUNT_ID、账号 ID 规范化 helper |
plugin-sdk/account-resolution | 账号查找 + 默认回退 helper |
plugin-sdk/account-helpers | 窄范围账号列表/账号动作 helper |
plugin-sdk/channel-pairing | createChannelPairingController |
plugin-sdk/channel-reply-pipeline | createChannelReplyPipeline, resolveChannelSourceReplyDeliveryMode |
plugin-sdk/channel-config-helpers | createHybridChannelConfigAdapter, resolveChannelDmAccess, resolveChannelDmAllowFrom, resolveChannelDmPolicy, normalizeChannelDmPolicy, normalizeLegacyDmAliases |
plugin-sdk/channel-config-schema | 共享 channel config schema 基元以及 Zod 和直接 JSON/TypeBox 构建器 |
plugin-sdk/bundled-channel-config-schema | 仅供已维护的 bundled plugins 使用的 bundled OpenClaw channel config schemas |
plugin-sdk/channel-config-schema-legacy | bundled-channel config schemas 的已弃用兼容别名 |
plugin-sdk/telegram-command-config | 带 bundled-contract 回退的 Telegram 自定义命令规范化/验证 helper |
plugin-sdk/command-gating | 窄范围命令授权门控 helper |
plugin-sdk/channel-policy | resolveChannelGroupRequireMention |
plugin-sdk/channel-lifecycle | createAccountStatusSink, createChannelRunQueue, draft stream 生命周期/终结 helper |
plugin-sdk/inbound-envelope | 共享入站 route + envelope 构建器 helper |
plugin-sdk/inbound-reply-dispatch | 共享入站记录并分发 helper |
plugin-sdk/messaging-targets | 目标解析/匹配 helper |
plugin-sdk/outbound-media | 共享出站媒体加载 helper |
plugin-sdk/outbound-send-deps | 面向 channel adapter 的轻量出站发送依赖查找 |
plugin-sdk/outbound-runtime | 出站交付、身份、发送委托、会话、格式化和 payload 规划 helper |
plugin-sdk/poll-runtime | 窄范围 poll 规范化 helper |
plugin-sdk/thread-bindings-runtime | 线程绑定生命周期和 adapter helper |
plugin-sdk/agent-media-payload | 旧版 agent 媒体 payload 构建器 |
plugin-sdk/conversation-runtime | conversation/thread 绑定、配对和已配置绑定 helper |
plugin-sdk/runtime-config-snapshot | 运行时 config 快照 helper |
plugin-sdk/runtime-group-policy | 运行时 group-policy 解析 helper |
plugin-sdk/channel-status | 共享 channel status 快照/摘要 helper |
plugin-sdk/channel-config-primitives | 窄范围 channel config-schema 基元 |
plugin-sdk/channel-config-writes | channel config 写入授权 helper |
plugin-sdk/channel-plugin-common | 共享 channel plugin prelude 导出 |
plugin-sdk/allowlist-config-edit | allowlist config 编辑/读取 helper |
plugin-sdk/group-access | 共享 group-access 决策 helper |
plugin-sdk/direct-dm | 共享 direct-DM 认证/守卫 helper |
plugin-sdk/discord | 已弃用的 Discord 兼容门面,适用于已发布的 @openclaw/discord@2026.3.13 和受跟踪的 owner 兼容性;新的插件应使用通用 channel SDK 子路径 |
plugin-sdk/telegram-account | 已弃用的 Telegram 账号解析兼容门面,适用于受跟踪的 owner 兼容性;新的插件应使用注入式运行时 helper 或通用 channel SDK 子路径 |
plugin-sdk/zalouser | 已弃用的 Zalo Personal 兼容门面,适用于仍导入 sender 命令授权的已发布 Lark/Zalo 包;新的插件应使用 plugin-sdk/command-auth |
plugin-sdk/interactive-runtime | 语义消息呈现、交付和旧版 interactive reply helper。参见 Message Presentation |
plugin-sdk/channel-inbound | 用于入站 debounce、mention 匹配、mention-policy helper 和 envelope helper 的兼容桶 |
plugin-sdk/channel-inbound-debounce | 窄范围入站 debounce helper |
plugin-sdk/channel-mention-gating | 不包含更宽泛 inbound runtime 表面的窄范围 mention-policy、mention marker 和 mention text helper |
plugin-sdk/channel-envelope | 窄范围入站 envelope 格式化 helper |
plugin-sdk/channel-location | channel 位置上下文和格式化 helper |
plugin-sdk/channel-logging | 用于入站丢弃以及 typing/ack 失败的 channel 日志 helper |
plugin-sdk/channel-send-result | 回复结果类型 |
plugin-sdk/channel-actions | channel 消息动作 helper,以及为兼容插件保留的已弃用原生 schema helper |
plugin-sdk/channel-route | 共享路由规范化、基于解析器的目标解析、thread-id 字符串化、去重/压缩 route key、parsed-target 类型,以及 route/target 比较 helper |
plugin-sdk/channel-targets | 目标解析 helper;路由比较调用方应使用 plugin-sdk/channel-route |
plugin-sdk/channel-contract | channel 契约类型 |
plugin-sdk/channel-feedback | 反馈/反应接线 |
plugin-sdk/channel-secret-runtime | 窄范围 secret 契约 helper,例如 collectSimpleChannelFieldAssignments、getChannelSurface、pushAssignment 和 secret target 类型 |
Provider 子路径
Provider 子路径
| 子路径 | 主要导出 |
|---|---|
plugin-sdk/provider-entry | defineSingleProviderPluginEntry |
plugin-sdk/lmstudio | 支持的 LM Studio provider 门面,用于 setup、目录发现和运行时模型准备 |
plugin-sdk/lmstudio-runtime | 支持的 LM Studio 运行时门面,用于本地服务器默认值、模型发现、请求头和已加载模型 helper |
plugin-sdk/provider-setup | 精选的本地/自托管 provider setup helper |
plugin-sdk/self-hosted-provider-setup | 聚焦的 OpenAI 兼容自托管 provider setup helper |
plugin-sdk/cli-backend | CLI 后端默认值 + watchdog 常量 |
plugin-sdk/provider-auth-runtime | 用于 provider 插件的运行时 API key 解析 helper |
plugin-sdk/provider-auth-api-key | API key 上手/写入档案 helper,例如 upsertApiKeyProfile |
plugin-sdk/provider-auth-result | 标准 OAuth 认证结果构建器 |
plugin-sdk/provider-auth-login | 面向 provider 插件的共享交互式登录 helper |
plugin-sdk/provider-env-vars | provider 认证环境变量查找 helper |
plugin-sdk/provider-auth | createProviderApiKeyAuthMethod, ensureApiKeyFromOptionEnvOrPrompt, upsertAuthProfile, upsertApiKeyProfile, writeOAuthCredentials |
plugin-sdk/provider-model-shared | ProviderReplayFamily、buildProviderReplayFamilyHooks、normalizeModelCompat、共享 replay 策略构建器、provider 端点 helper,以及模型 ID 规范化 helper,例如 normalizeNativeXaiModelId |
plugin-sdk/provider-catalog-runtime | provider 目录增强运行时钩子,以及用于契约测试的 plugin-provider 注册表缝合点 |
plugin-sdk/provider-catalog-shared | findCatalogTemplate, buildSingleProviderApiKeyCatalog, buildManifestModelProviderConfig, supportsNativeStreamingUsageCompat, applyProviderNativeStreamingUsageCompat |
plugin-sdk/provider-http | 通用 provider HTTP/端点能力 helper、provider HTTP 错误,以及音频转录 multipart form helper |
plugin-sdk/provider-web-fetch-contract | 窄范围 web-fetch 配置/选择契约 helper,例如 enablePluginInConfig 和 WebFetchProviderPlugin |
plugin-sdk/provider-web-fetch | web-fetch provider 注册/缓存 helper |
plugin-sdk/provider-web-search-config-contract | 适用于不需要插件启用接线的 provider 的窄范围 web-search 配置/凭据 helper |
plugin-sdk/provider-web-search-contract | 窄范围 web-search 配置/凭据契约 helper,例如 createWebSearchProviderContractFields、enablePluginInConfig、resolveProviderWebSearchPluginConfig,以及作用域凭据 setter/getter |
plugin-sdk/provider-web-search | web-search provider 注册/缓存/运行时 helper |
plugin-sdk/provider-tools | ProviderToolCompatFamily、buildProviderToolCompatFamilyHooks、Gemini schema 清理 + 诊断,以及 xAI 兼容 helper,例如 resolveXaiModelCompatPatch / applyXaiModelCompat |
plugin-sdk/provider-usage | fetchClaudeUsage 等 |
plugin-sdk/provider-stream | ProviderStreamFamily、buildProviderStreamFamilyHooks、composeProviderStreamWrappers、流包装器类型,以及共享的 Anthropic/Bedrock/DeepSeek V4/Google/Kilocode/Moonshot/OpenAI/OpenRouter/Z.A.I/MiniMax/Copilot 包装器 helper |
plugin-sdk/provider-transport-runtime | 原生 provider 传输 helper,例如受保护的 fetch、传输消息转换,以及可写传输事件流 |
plugin-sdk/provider-onboard | onboard 配置补丁 helper |
plugin-sdk/global-singleton | 进程本地单例/映射/缓存 helper |
plugin-sdk/group-activation | 窄范围组激活模式和命令解析 helper |
认证与安全子路径
认证与安全子路径
| 子路径 | 主要导出 |
|---|---|
plugin-sdk/command-auth | resolveControlCommandGate,命令注册表 helper(包括动态参数菜单格式化),发送方授权 helper |
plugin-sdk/command-status | 命令/帮助消息构建器,例如 buildCommandsMessagePaginated 和 buildHelpMessage |
plugin-sdk/approval-auth-runtime | 审批者解析以及同聊天动作授权 helper |
plugin-sdk/approval-client-runtime | 原生 exec 审批档案/过滤 helper |
plugin-sdk/approval-delivery-runtime | 原生审批能力/交付适配器 |
plugin-sdk/approval-gateway-runtime | 共享审批网关解析 helper |
plugin-sdk/approval-handler-adapter-runtime | 用于热 channel 入口点的轻量原生审批适配器加载 helper |
plugin-sdk/approval-handler-runtime | 更广泛的审批处理器运行时 helper;当更窄的适配器/网关分界足够时,优先使用它们 |
plugin-sdk/approval-native-runtime | 原生审批目标 + 账号绑定 helper |
plugin-sdk/approval-reply-runtime | exec/plugin 审批回复 payload helper |
plugin-sdk/approval-runtime | exec/plugin 审批 payload helper、原生审批路由/运行时 helper,以及结构化审批展示 helper,例如 formatApprovalDisplayPath |
plugin-sdk/reply-dedupe | 窄范围入站回复去重重置 helper |
plugin-sdk/channel-contract-testing | 无广泛 testing 桶的窄范围 channel 契约测试 helper |
plugin-sdk/command-auth-native | 原生命令认证、动态参数菜单格式化以及原生会话目标 helper |
plugin-sdk/command-detection | 共享命令检测 helper |
plugin-sdk/command-primitives-runtime | 用于热 channel 路径的轻量命令文本谓词 |
plugin-sdk/command-surface | 命令正文规范化和命令表面 helper |
plugin-sdk/allow-from | formatAllowFromLowercase |
plugin-sdk/channel-secret-runtime | 面向 channel/plugin secret 表面的窄范围 secret 契约收集 helper |
plugin-sdk/secret-ref-runtime | 面向 secret 契约/config 解析的窄范围 coerceSecretRef 和 SecretRef 类型 helper |
plugin-sdk/security-runtime | 共享信任、DM 门控、外部内容、敏感文本脱敏、常量时间 secret 比较和 secret 收集 helper |
plugin-sdk/ssrf-policy | 主机 allowlist 和私有网络 SSRF 策略 helper |
plugin-sdk/ssrf-dispatcher | 无广泛 infra 运行时面的窄范围 pinned-dispatcher helper |
plugin-sdk/ssrf-runtime | pinned-dispatcher、SSRF 保护的 fetch、SSRF 错误和 SSRF 策略 helper |
plugin-sdk/secret-input | secret 输入解析 helper |
plugin-sdk/webhook-ingress | webhook 请求/目标 helper 以及原始 websocket/body 强制转换 |
plugin-sdk/webhook-request-guards | 请求体大小/超时 helper |
运行时与存储子路径
运行时与存储子路径
能力与测试子路径
能力与测试子路径
| 子路径 | 主要导出 |
|---|---|
plugin-sdk/media-runtime | 共享媒体 fetch/转换/存储 helper、基于 ffprobe 的视频尺寸探测,以及媒体 payload 构建器 |
plugin-sdk/media-store | 窄范围媒体存储 helper,例如 saveMediaBuffer |
plugin-sdk/media-generation-runtime | 共享媒体生成失败切换 helper、候选项选择和缺失模型提示 |
plugin-sdk/media-understanding | 媒体理解 provider 类型以及面向 provider 的图像/音频 helper 导出 |
plugin-sdk/text-runtime | 共享文本/markdown/日志 helper,例如 assistant 可见文本剥离、markdown 渲染/分块/表格 helper、脱敏 helper、directive-tag helper 和安全文本工具 |
plugin-sdk/text-chunking | 出站文本分块 helper |
plugin-sdk/speech | 语音 provider 类型以及面向 provider 的 directive、注册表、校验、OpenAI 兼容 TTS 构建器和语音 helper 导出 |
plugin-sdk/speech-core | 共享语音 provider 类型、注册表、directive、规范化和语音 helper 导出 |
plugin-sdk/realtime-transcription | 实时转录 provider 类型、注册表 helper 和共享 WebSocket 会话 helper |
plugin-sdk/realtime-voice | 实时语音 provider 类型和注册表 helper |
plugin-sdk/image-generation | 图像生成 provider 类型,以及图像资产/data URL helper 和 OpenAI 兼容图像 provider 构建器 |
plugin-sdk/image-generation-core | 共享图像生成类型、失败切换、认证和注册表 helper |
plugin-sdk/music-generation | 音乐生成 provider/请求/结果类型 |
plugin-sdk/music-generation-core | 共享音乐生成类型、失败切换 helper、provider 查找和 model-ref 解析 |
plugin-sdk/video-generation | 视频生成 provider/请求/结果类型 |
plugin-sdk/video-generation-core | 共享视频生成类型、失败切换 helper、provider 查找和 model-ref 解析 |
plugin-sdk/webhook-targets | webhook 目标注册表和路由安装 helper |
plugin-sdk/webhook-path | webhook 路径规范化 helper |
plugin-sdk/web-media | 共享远程/本地媒体加载 helper |
plugin-sdk/zod | 重新导出的 zod,供 plugin SDK 消费者使用 |
plugin-sdk/testing | 面向旧版插件测试的宽兼容桶。新的扩展测试应改为导入更聚焦的 SDK 子路径,例如 plugin-sdk/agent-runtime-test-contracts、plugin-sdk/plugin-test-runtime、plugin-sdk/channel-test-helpers、plugin-sdk/test-env 或 plugin-sdk/test-fixtures |
plugin-sdk/plugin-test-api | 用于直接插件注册单元测试的最小 createTestPluginApi helper,无需导入仓库测试 helper 桥接层 |
plugin-sdk/agent-runtime-test-contracts | 原生 agent-runtime 适配器契约夹具,用于认证、交付、fallback、tool-hook、prompt-overlay、schema 和 transcript projection 测试 |
plugin-sdk/channel-test-helpers | 面向 channel 的测试 helper,涵盖通用动作/setup/status 契约、目录断言、账号启动生命周期、send-config 线程、运行时 mock、状态问题、出站交付和 hook 注册 |
plugin-sdk/channel-target-testing | 面向 channel 测试的共享目标解析错误场景套件 |
plugin-sdk/plugin-test-contracts | 插件包、注册、公共产物、直接导入、运行时 API 和导入副作用契约 helper |
plugin-sdk/provider-test-contracts | provider 运行时、认证、发现、onboard、目录、向导、媒体能力、重放策略、实时 STT 直播音频、web-search/fetch 和流契约 helper |
plugin-sdk/provider-http-test-mocks | 用于测试 plugin-sdk/provider-http 的可选 Vitest HTTP/auth mocks |
plugin-sdk/test-fixtures | 通用 CLI 运行时捕获、sandbox 上下文、skill writer、agent-message、system-event、模块重载、bundled plugin 路径、终端文本、分块、auth-token 和 typed-case 夹具 |
plugin-sdk/test-node-mocks | 供在 Vitest vi.mock("node:*") 工厂内部使用的聚焦版 Node 内置 mock helper |
Memory 子路径
Memory 子路径
| 子路径 | 主要导出 |
|---|---|
plugin-sdk/memory-core | 面向 manager/config/file/CLI helper 的 bundled memory-core helper 接口面 |
plugin-sdk/memory-core-engine-runtime | 内存索引/搜索运行时门面 |
plugin-sdk/memory-core-host-engine-foundation | Memory host foundation engine 导出 |
plugin-sdk/memory-core-host-engine-embeddings | Memory host embedding 契约、注册表访问、本地 provider,以及通用批量/远程 helper |
plugin-sdk/memory-core-host-engine-qmd | Memory host QMD engine 导出 |
plugin-sdk/memory-core-host-engine-storage | Memory host 存储引擎导出 |
plugin-sdk/memory-core-host-multimodal | Memory host 多模态 helper |
plugin-sdk/memory-core-host-query | Memory host 查询 helper |
plugin-sdk/memory-core-host-secret | Memory host secret helper |
plugin-sdk/memory-core-host-events | Memory host 事件日志 helper |
plugin-sdk/memory-core-host-status | Memory host 状态 helper |
plugin-sdk/memory-core-host-runtime-cli | Memory host CLI 运行时 helper |
plugin-sdk/memory-core-host-runtime-core | Memory host 核心运行时 helper |
plugin-sdk/memory-core-host-runtime-files | Memory host 文件/运行时 helper |
plugin-sdk/memory-host-core | 面向供应商中立的 memory host 核心运行时 helper 别名 |
plugin-sdk/memory-host-events | 面向供应商中立的 memory host 事件日志 helper 别名 |
plugin-sdk/memory-host-files | 面向供应商中立的 memory host 文件/运行时 helper 别名 |
plugin-sdk/memory-host-markdown | 面向内存相关插件的共享 managed-markdown helper |
plugin-sdk/memory-host-search | 面向 search-manager 访问的活动内存运行时门面 |
plugin-sdk/memory-host-status | 面向供应商中立的 memory host 状态 helper 别名 |
保留的 bundled-helper 子路径
保留的 bundled-helper 子路径
当前没有保留的 bundled-helper SDK 子路径。owner 专用 helper 位于对应的插件包内部,而可复用的 host 契约则使用通用 SDK 子路径,例如
plugin-sdk/gateway-runtime、
plugin-sdk/security-runtime 和 plugin-sdk/plugin-config-runtime。