Skip to main content
插件 SDK 包含位于 openclaw/plugin-sdk/ 下的精简公共子路径和仅供代码仓库使用的 bundled helper。本页面汇总了这两类内容,并明确标注 private-local 条目。以下三个文件定义了边界:
  • scripts/lib/plugin-sdk-entrypoints.json:维护的入口点清单,构建时会对其进行编译。
  • scripts/lib/plugin-sdk-private-local-only-subpaths.json:从类型化、文档化 SDK 中排除的内部子路径。生产环境条目仍作为仅限 JavaScript 的宿主运行时导出项,为单独发布的官方插件提供支持;仅供测试使用的条目则保持不导出。
  • scripts/lib/plugin-sdk-entries.mts:派生的公共/私有导出元数据、受支持的 bundled 外观接口以及插件自有的公共接口面。
维护人员使用 pnpm plugin-sdk:surface 审核公共导出数量,并使用 pnpm plugins:boundary-report:summary 检查兼容性队列。 有关插件编写指南,请参见 Plugin SDK overview

插件入口

兼容性和私有本地辅助工具

只有后期窗口中已弃用的子路径仍会导出。2026 年 7 月的别名和未使用的子路径已被删除,而仅供 bundled 使用的辅助工具已从公共包中移除,并在下方标记为 private-local。维护的列表是 scripts/lib/plugin-sdk-deprecated-public-subpaths.json;CI 会拒绝 bundled 对这些仅用于兼容性的子路径的导入。广泛的领域级 barrel plugin-sdk/agent-runtimeplugin-sdk/channel-lifecycleplugin-sdk/conversation-runtimeplugin-sdk/hook-runtimeplugin-sdk/media-runtimeplugin-sdk/plugin-runtimeplugin-sdk/security-runtime 同样已弃用,建议改用专注于具体功能的子路径。 OpenClaw 基于 Vitest 的测试辅助子路径仅限仓库本地使用,不再作为包导出:agent-runtime-test-contractschannel-contract-testingchannel-target-testingchannel-test-helpersplugin-state-test-runtimeplugin-test-apiplugin-test-contractsplugin-test-runtimeprovider-http-test-mocksprovider-test-contractsreply-payload-testingsqlite-runtime-testingtest-envtest-fixturestest-livetest-live-authtest-media-generationtest-media-understandingtest-node-mockstesting。私有的捆绑辅助工具接口 ssrf-runtime-internal 同样仅限仓库本地使用。

Bundled 插件辅助模块子路径

仅供 Bundled 使用的辅助模块在 2026 年 7 月的清理之后为 private-local。 包契约防护机制会将仍保持公开、直到通用契约取代它们之前受支持的 bundled 外观接口归类为支持项。这些外观接口不建议用于新代码;请参见下方各行的说明。
较晚窗口的 Channel 兼容性子路径仅在其 registry 日期之前保持公开。7 月别名(例如 direct-DM 访问、reply-options、配对路径和 Channel runtime 分支)已被移除;仅限 Bundled 的辅助模块为私有本地模块。
Provider usage 快照通常会报告一个或多个 quota windows,每个都带有标签、已使用百分比和可选的重置时间。对于显示余额或账户状态文本、而不是可重置 quota windows 的 Provider,应返回带空 windows 数组的 summary,而不是伪造百分比。OpenClaw 会在状态输出中显示该 summary 文本;仅当 usage 端点失败或返回了不可用的 usage 数据时,才使用 error
当插件必须只接受本机时,请使用 isLoopbackHost(host)。它接受 localhost127.0.0.0/8 范围内的 IPv4 loopback 字面量、::1、带括号的 IPv6,以及 IPv4 映射的 IPv6 loopback 字面量。它会解析 IP 字面量,而不是匹配文本前缀,因此诸如 127.0.0.1.evil.com 的 DNS 名称不会被视为 loopback。仅当 RFC 1918 地址等私有网络 Host 也有效时,才使用 isPrivateOrLoopbackHost(host)
保留的 Bundled 辅助模块 SDK 子路径是面向 Bundled 插件代码的窄范围、特定所有者表面。 它们会被纳入 SDK inventory,以确保包构建和别名保持确定性,但并非通用的插件开发 API。新的可复用 Host 契约应使用通用 SDK 子路径,例如 plugin-sdk/gateway-runtimeplugin-sdk/ssrf-runtime

相关内容