Skip to main content
xbot
切换暗/亮/自动模式 切换暗/亮/自动模式 切换暗/亮/自动模式 返回首页

plugin.json manifest 文件的完整参考,基于 plugin/plugin.goPluginManifest)与 plugin/manifest.go(验证逻辑)。

顶层字段

字段JSON Key类型必填说明
IDidstring全局唯一插件标识。必须匹配 ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$(防止路径穿越/注入)。推荐反向 DNS 命名。
Namenamestring人类可读的插件名称。
Versionversionstring严格 semver MAJOR.MINOR.PATCH(如 "1.0.0")。
Descriptiondescriptionstring插件功能简述。
Authorauthorstring插件作者或组织。
Homepagehomepagestring源码或文档 URL。
Runtimeruntimestring执行环境:"native""stdio""grpc"(stdio 的历史别名)、"wasm""script"。空值默认 "native"
Entryentrystring入口。script 运行时:要执行的命令(如 "bash my-script.sh");stdio 运行时:启动插件进程的命令。默认/回退——平台专属 entry 优先。
EntryWindowsentry_windowsstringWindows 专属入口覆盖。
EntryDarwinentry_darwinstringmacOS 专属入口覆盖。
EntryLinuxentry_linuxstringLinux 专属入口覆盖。
Executableexecutablestring启动插件进程的命令(gRPC 运行时)。设置后优先于 entry
Argsargsstring[]传给 executable 的命令行参数。
ActivationEventsactivation_eventsstring[]触发插件激活的事件。格式:"onStart""onTool:<name>""onHook:<event>""onCommand:<cmd>"。空 → 默认 ["onStart"]
Permissionspermissionsstring[]所需能力。manifest 中允许 "*" 通配符。未知权限校验失败。
Contributescontributesobject声明插件提供的能力(见下文)。
Dependenciesdependenciesarray依赖的其他插件。目前仅做格式校验;版本解析是未来工作。
Webwebobject前端 ESM 插件模块声明(v2 Web 插件运行时)。
TimeouttimeoutstringGo duration 字符串("30s""1m""500ms")。最大 5 分钟。零/空 → DefaultPluginTimeout(30s)。

验证:stdio/grpc 运行时插件必须提供非空 entryexecutable

web 对象(WebPluginDecl

字段JSON Key类型说明
Entryentrystring前端模块路径,相对插件 web/ 目录(如 "index.js")。托管于 /plugins/<id>/web/<entry>
ContributescontributesJSON不透明 JSON,原样透传给前端运行时。前端是贡献点语义的唯一权威校验门(形状、权限↔能力对应、ID 唯一性)。后端仅做传输层检查。

dependencies[] 对象(PluginDependency

字段JSON Key类型说明
IDidstring所需插件的唯一标识。必须是合法插件 ID。
Versionversionstring版本约束。接受宽松 semver 格式("^1.0.0"">=1.0.0""~1.0.0""1.x""*")。

contributes 对象(PluginContributes

字段JSON Key类型说明
Toolstoolsarray工具贡献点。每项:{ name(必填), description(必填), input_schema(object)}
HookshooksarrayHook 订阅。每项:{ event(必填,必须是合法 hook 事件), matcher(工具名模式,"" = 全部)}
ContextEnricherscontext_enrichersarray每项:{ name, description }
Commandscommandsarray斜杠命令。每项:{ name(如 "/deploy"), description }
Cronscronsarray定时任务(见下文)。
Themesthemesarray每项:{ id, file }file 相对插件目录(如 "themes/dracula.json")。
Overlaysoverlaysarray全屏覆盖层。每项:{ id, description }
Configurationconfigurationobject用户可配置设置(见下文)。
UIuiarrayWidget 槽位保留(见下文)。

crons[] 对象(CronContribution

字段JSON Key类型说明
Messagemessagestring触发时发送给 agent 的消息。
CronExprcron_exprstringCron 表达式(可选)。
EverySecondsevery_secondsint间隔秒数(可选)。
Atatstring绝对时间点(可选)。
DelaySecondsdelay_secondsint相对延迟秒数(可选)。

configuration 对象(ConfigurationContribution

字段JSON Key类型说明
Titletitlestring配置分区的人类可读标题。
Propertiespropertiesmap属性 key → ConfigProperty 的映射。

用户在 ~/.xbot/plugins/<id>/config.json 中覆盖这些设置。manifest 的 default 值作为合并配置的种子。

configuration.properties.*ConfigProperty

字段JSON Key类型说明
TypetypestringJSON schema 类型:"string""number""boolean""select""multiselect"
Labellabelstring显示名。为空时回退到属性 key。
Descriptiondescriptionstring属性用途说明。
Defaultdefaultany无用户配置时的默认值。
Optionsoptionsarrayselect/multiselect 的可选项。每项:{ label, value }
Sectionsectionstring在设置 UI 中将属性归入命名分组。
Secretsecretbool敏感值,UI 中以掩码显示。
Placeholderplaceholderstring文本输入框提示。
Requiredrequiredbool值必须设置。
Minimumminimumfloatnumber 类型的包含下界。
Maximummaximumfloatnumber 类型的包含上界。

ui[] 对象(UISlotContribution

字段JSON Key类型说明
IDidstring插件内唯一 widget ID。用作运行时更新的 key。
Slotslotstring目标区域:titleBarLefttitleBarRightstatusBarLeftstatusBarRightinfoBarfootertoolHint
Prioritypriorityint区域内排序(越小越靠前/左)。默认 100。
Descriptiondescriptionstring该 widget 显示内容的人类可读说明。
RefreshIntervalrefresh_intervalstring建议轮询间隔(如 "30s")。仅建议——优先使用推送式 UpdateWidget
Triggerstriggersstring[]触发即时脚本运行的 hook 匹配器。格式:"EventName:Matcher"(如 "PostToolUse:Shell*")。仅 script 运行时生效。
Syncsyncboolhook 触发器同步运行(在 hook goroutine 内联执行)。默认 false(异步)。
Interactiveinteractiveboolwidget 支持用户操作(v2)。默认 false。

ui[] 验证规则

  • 需要 "ui.contribute" 权限(或 "*")。
  • 每插件最多 10 个 widget。
  • 插件内 widget ID 必须唯一。
  • 非法 slot 名校验失败。

校验和验证

plugin.json 旁的 plugin.sha256 可存放 manifest 的 SHA256。通过 LoadManifestWithOptions(dir, {VerifyChecksum: true}) 启用验证。接受 "hash""hash filename"(GNU coreutils)格式。

发现机制

插件通过扫描目录(默认 ~/.xbot/plugins~/.xbot/plugins/builtin)下包含合法 plugin.json 的子目录被发现。非法 manifest 记录警告并跳过。