Appearance
官方插件模板
Workova 提供三类官方模板,覆盖最常见的插件开发场景。每个模板均包含完整的 manifest 和最小可运行代码。
模板一览
| 模板 | 类型 | 适用场景 |
|---|---|---|
tool-local-helper | tool | 命令型插件:固定回复、本地脚本、外部工具封装 |
channel-dingtalk-webhook | channel | 渠道接入:钉钉机器人 Webhook 收发消息 |
openclaw-compatible-channel | channel | 迁移场景:已有 OpenClaw 插件快速接入 |
tool-local-helper
最简单的工具插件模板,包含一个固定回复命令和一个进程调用命令。
manifest 结构:
json
{
"id": "tool-local-helper",
"name": "本地工具助手",
"version": "1.0.0",
"kind": "tool",
"capabilities": ["tool:command"],
"config_schema": {
"type": "object",
"properties": {
"welcome_text": {
"type": "string",
"title": "欢迎语",
"default": "您好!"
},
"workspace_root": {
"type": "string",
"title": "工作区目录",
"default": "."
}
}
},
"commands": [
{
"name": "hello",
"type": "template",
"description": "返回欢迎信息",
"response_template": "{{config.welcome_text}}"
},
{
"name": "list-files",
"type": "process",
"description": "列出目录文件",
"program": "bash",
"args": ["-c", "ls -la {{config.workspace_root}}"],
"timeout_seconds": 10
}
]
}channel-dingtalk-webhook
钉钉 Webhook 渠道插件模板,包含完整的生命周期脚本和消息格式示例。
目录结构:
text
channel-dingtalk-webhook/
plugin.manifest.json
scripts/
lifecycle.js # 生命周期脚本(validate/receive/send)
message-examples.json # 各类消息格式示例manifest 核心配置:
json
{
"id": "channel-dingtalk-webhook",
"name": "钉钉 Webhook",
"version": "1.0.0",
"kind": "channel",
"capabilities": ["channel:dingtalk"],
"config_schema": {
"type": "object",
"properties": {
"webhook_url": {
"type": "string",
"title": "Webhook 地址"
},
"secret": {
"type": "string",
"title": "签名密钥",
"secret": true,
"widget": "password"
}
},
"required": ["webhook_url"]
},
"entrypoints": {
"channel_adapter": {
"mode": "managed_webhook",
"supported_channels": ["dingtalk"],
"lifecycle": {
"install": "scripts/lifecycle.js",
"validate": "scripts/lifecycle.js",
"receive": "scripts/lifecycle.js",
"send": "scripts/lifecycle.js",
"health": "scripts/lifecycle.js"
}
}
}
}TIP
模板中的 scripts/lifecycle.js 通过 WORKOVA_PLUGIN_ACTION 环境变量判断当前执行的生命周期阶段,在同一个脚本中处理所有事件。
openclaw-compatible-channel
适用于已有 OpenClaw 风格插件的迁移场景。使用 openclaw.plugin.json 格式声明:
json
{
"id": "china-channels",
"version": "0.1.0",
"channels": ["dingtalk", "feishu"]
}Workova 自动将其规范化为原生格式(kind: channel、compatibilityMode: openclaw)。
INFO
OpenClaw 兼容模式作为过渡方案,建议在功能稳定后逐步迁移为 Workova 原生 plugin.manifest.json,以获得完整的配置表单和生命周期支持。
使用方式
方式一:复制完整目录
将模板目录复制到插件目录后,修改 id、name、description 等字段:
bash
cp -r templates/tool-local-helper .agents/plugins/my-tool然后验证识别:
bash
workova plugin:validate --input '{"path": ".agents/plugins/my-tool"}'
workova plugin:list方式二:仅复制 manifest
如果只需系统先识别插件,可仅复制 plugin.manifest.json,脚本和资源后续补充:
bash
mkdir -p .agents/plugins/my-tool
cp templates/tool-local-helper/plugin.manifest.json .agents/plugins/my-tool/选择建议
| 需求 | 推荐模板 |
|---|---|
| 第一次开发插件 | tool-local-helper |
| 接入钉钉/飞书等消息平台 | channel-dingtalk-webhook |
| 迁移已有 OpenClaw 插件 | openclaw-compatible-channel |
| 接入 Telegram/Discord | 参考 channel-dingtalk-webhook 修改 mode 和 supported_channels |
相关文档
- 插件快速上手 — 从零创建第一个插件
- 插件完整指南 — 渠道插件开发和完整能力说明
- Manifest 参数说明 — 所有字段的完整定义