概述
本页面覆盖插件打包(package.json 元数据)、清单(openclaw.plugin.json)、setup 入口点和配置 Schema 的参考内容。
核心 API
package.json 的 openclaw 字段
| 字段 | 类型 | 说明 |
|---|
extensions | string[] | 入口文件(相对于包根目录) |
setupEntry | string | 轻量级 setup-only 入口(可选) |
channel | object | Channel 目录元数据 |
providers | string[] | 本插件注册的 Provider ID |
install | object | 安装提示(npmSpec/localPath/defaultChoice 等) |
startup | object | 启动行为标志 |
openclaw.channel 关键字段
| 字段 | 说明 |
|---|
id | 规范 channel ID |
label | 主要 channel 标签 |
blurb | 简短描述 |
markdownCapable | 标记为 markdown 能力 channel |
exposure | 可见性控制(configured/setup/docs) |
quickstartAllowFrom | 加入标准 quickstart allowFrom 流程 |
openclaw.install 关键字段
| 字段 | 说明 |
|---|
clawhubSpec | ClawHub 规范(优先) |
npmSpec | npm 规范(回退) |
expectedIntegrity | npm dist 完整性校验(sha512-…) |
minHostVersion | 最低 OpenClaw 版本要求 |
Setup Entry
setup-entry.ts 是轻量级替代 index.ts 的文件,在以下情况加载:
- channel 被禁用但需要 setup/onboarding 界面
- channel 已启用但未配置
- 启用了延迟加载(
deferConfiguredChannelFullLoadUntilAfterListen)
配置 Schema 构建
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
import { buildJsonChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
使用示例
{
"name": "@myorg/openclaw-my-channel",
"version": "1.0.0",
"type": "module",
"openclaw": {
"extensions": ["./index.ts"],
"setupEntry": "./setup-entry.ts",
"channel": {
"id": "my-channel",
"label": "My Channel",
"blurb": "Short description."
}
}
}
// setup-entry.ts
import { defineSetupPluginEntry } from "openclaw/plugin-sdk/channel-core";
import { myChannelPlugin } from "./src/channel.js";
export default defineSetupPluginEntry(myChannelPlugin);
Setup Wizard
import type { ChannelSetupWizard } from "openclaw/plugin-sdk/channel-setup";
const setupWizard: ChannelSetupWizard = {
channel: "my-channel",
status: {
configuredLabel: "Connected",
unconfiguredLabel: "Not configured",
resolveConfigured: ({ cfg }) => Boolean(cfg.channels?.["my-channel"]?.token),
},
credentials: [{ inputKey: "token", credentialLabel: "Bot token", ... }],
};
相关页面
- concepts/plugin-sdk-overview — 注册 API 与子路径参考
- concepts/plugin-sdk-entrypoints — 入口点定义
- concepts/plugin-manifest — 完整清单 Schema 参考
- concepts/plugin-building — 插件构建快速上手