概述

本页面覆盖插件打包(package.json 元数据)、清单(openclaw.plugin.json)、setup 入口点和配置 Schema 的参考内容。

核心 API

package.json 的 openclaw 字段

字段类型说明
extensionsstring[]入口文件(相对于包根目录)
setupEntrystring轻量级 setup-only 入口(可选)
channelobjectChannel 目录元数据
providersstring[]本插件注册的 Provider ID
installobject安装提示(npmSpec/localPath/defaultChoice 等)
startupobject启动行为标志

openclaw.channel 关键字段

字段说明
id规范 channel ID
label主要 channel 标签
blurb简短描述
markdownCapable标记为 markdown 能力 channel
exposure可见性控制(configured/setup/docs)
quickstartAllowFrom加入标准 quickstart allowFrom 流程

openclaw.install 关键字段

字段说明
clawhubSpecClawHub 规范(优先)
npmSpecnpm 规范(回退)
expectedIntegritynpm 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 — 插件构建快速上手