@coda-console/protocol 1.9.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/docs/agent-protocol.md +15 -5
- package/package.json +1 -1
- package/schemas/agent/display.json +13 -0
- package/schemas/plugin/agents.json +1 -1
- package/schemas/plugin/capabilities.json +1 -1
- package/schemas/plugin/commands.json +1 -1
- package/schemas/plugin/common.json +1 -1
- package/schemas/plugin/composer-modes.json +30 -13
- package/schemas/plugin/configuration.json +1 -1
- package/schemas/plugin/endpoints.json +1 -1
- package/schemas/plugin/environment.json +1 -1
- package/schemas/plugin/events.json +1 -1
- package/schemas/plugin/executors.json +1 -1
- package/schemas/plugin/extension-points.json +1 -1
- package/schemas/plugin/extensions.json +1 -1
- package/schemas/plugin/git-credentials.json +1 -1
- package/schemas/plugin/groups.json +1 -1
- package/schemas/plugin/instructions.json +1 -1
- package/schemas/plugin/mcp-servers.json +1 -1
- package/schemas/plugin/model-providers.json +1 -1
- package/schemas/plugin/path.json +1 -1
- package/schemas/plugin/plugin.json +1 -1
- package/schemas/plugin/repositories.json +1 -1
- package/schemas/plugin/services.json +1 -1
- package/schemas/plugin/setting.json +2 -2
- package/schemas/plugin/setup.json +1 -1
- package/schemas/plugin/skills.json +1 -1
- package/schemas/plugin/views.json +1 -1
- package/validate.mjs +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Coda 与插件之间的约定,Coda 和插件都引用它,独立演进:
|
|
4
4
|
|
|
5
|
-
- **插件清单的类型**(`schemas/plugin/`):插件目录 `package.json` 里 `contributes` 的每个键是一种类型,各有一份 JSON Schema(draft 2020-12,`$id` 为 `https://coda.pub/schemas/plugin/
|
|
5
|
+
- **插件清单的类型**(`schemas/plugin/`):插件目录 `package.json` 里 `contributes` 的每个键是一种类型,各有一份 JSON Schema(draft 2020-12,`$id` 为 `https://coda.pub/schemas/plugin/v2/<文件>`)。`plugin.json` 是整份清单,`setting.json` 是一项设置的声明。插件写的合乎它用到的类型就对;写给别的插件扩展点的键由那个插件声明,扩展点可以带自己的 schema(`extensionPoints.<名>.schema`,声明它的插件目录里的一个文件),写给它的东西合乎那份 schema 才对。
|
|
6
6
|
- **通用校验器**(`validate.mjs`):用 Ajv 对清单做 schema 校验。JSON Schema 说不了的只用五个通用关键字(`x-unique-by`、`x-max-contains`、`x-ref`、`x-placeholders`、`x-file`,照 Kubernetes 的 `x-kubernetes-*`),每个在哪里写都是同一个意思,写法见文件开头。校验器不随功能变长:类型加字段就是改 schema。
|
|
7
7
|
- **流程方言**(`workflow/`):项目和插件的流程(`.coda/workflows/*.bpmn`,BPMN 2.0)在 Coda 的命名空间 `https://coda.pub/schema/bpmn/1.0` 里能写什么。`moddle.json` 是 `coda:` 属性与元素(bpmn-moddle 的描述格式),`values.json` 是每个值能写什么(每个 `coda:` 类型的属性组成的对象的 JSON Schema,一个元素里同种 `coda:` 元素成组的 schema),`actions.json` 是 `coda:action` 的各个动作和它们接受的参数,`dialect.json` 是流程种类、Coda 自己发的事件、步骤失败的错误码、表达式能读的运行变量和运行的输入能是哪些类型。`workflow.mjs` 用它们读一份流程:方言里没有的、值不合 schema 的都拒绝,说法是「位置:schema 对那里的说明」。值的 schema 用清单的那几个关键字,另加三个:`x-feel`(是 FEEL:「=」开头是表达式,否则文字里的 `{{ … }}` 是,按这份流程里的名字读得通)、`x-duration`(ISO 8601 时长,不为负)、`x-number`(文字换算成数字是个有限的数)。`structure.json` 声明流程结构规则,`structure.mjs` 负责跨节点检查。
|
|
8
8
|
- **Agent 接入扩展**(`schemas/agent/`、`agent.mjs`、`docs/agent-protocol.md`):Coda 怎样用 ACP 接 Agent,以及 Coda 加的扩展(会话指令、插话、`_coda/wait`、执行失败、工具调用的审核)。
|
|
@@ -30,7 +30,7 @@ import { manifestProblem, pointProblem, valueProblem, TYPES, SCHEMAS } from '@co
|
|
|
30
30
|
|
|
31
31
|
// 整份清单;给出插件目录时,连同它点名的文件一起查(x-file)。合乎类型返回 null,否则是一句说明:哪里、schema 怎么说。
|
|
32
32
|
const problem = manifestProblem(JSON.parse(readFileSync('plugin/package.json', 'utf8')), 'plugin');
|
|
33
|
-
//
|
|
33
|
+
// 某个类型里的一部分,如输入框模式声明的参数。
|
|
34
34
|
valueProblem('composer-modes.json#/$defs/parameters', parameters, '插件给出的参数');
|
|
35
35
|
// 写给别的插件扩展点的东西,按那个扩展点的 schema(已读出的对象);给出写它的插件目录时连同它点名的文件一起查。
|
|
36
36
|
pointProblem(panelsSchema, manifest.contributes.panels, 'contributes.panels', 'plugin');
|
|
@@ -63,6 +63,14 @@ fieldsProblem(JSON.parse(fieldsJSON), 'ask');
|
|
|
63
63
|
|
|
64
64
|
设置的 `items.anyOf` 选项可附带 `workflowKind`(`check`、`premerge`、`deploy`、`preview`、`release`)。全局设置显示全部选项;项目设置只显示该项目有的流程类别,未写此字段的选项始终显示。宿主负责按项目提供可选项,流程执行时仍需按运行的提交判断可用操作。
|
|
65
65
|
|
|
66
|
+
## 输入框模式
|
|
67
|
+
|
|
68
|
+
从 2.0.0 起,`contributes.composerModes` 可写 `once: true`:这个模式里发出的一条被收下后,它从输入框退出。`once` 是可选布尔值。模式不再接受 `agent`,工具栏始终使用输入框自己的执行者;旧清单须删除模式级的 `agent` 字段。
|
|
69
|
+
|
|
70
|
+
模式的对象数组参数(`type: array` 且 `items.type: object`)可写 `"presets": { "from": "composer.templates", "by": "template" }`。`from` 是表格设置 ID,`by` 是分组列,两者都是必填字符串,不接受其他字段。此字段只用于模式参数,不用于普通设置。Coda 按输入框所在目录读取设置,以分组列首次出现的顺序显示预设;选中时一次性填入该组的行,只取项中声明的列,之后可普通编辑。进入模式时填入第一组,设置为空则不填。
|
|
71
|
+
|
|
72
|
+
插件 schema 的 `$id` 命名空间随此不兼容变更升为 `https://coda.pub/schemas/plugin/v2/`;直接写绝对 `$ref` 的调用方须同步更新。Agent 接入和流程方言的 schema 命名空间不变。
|
|
73
|
+
|
|
66
74
|
## Agent 接入扩展
|
|
67
75
|
|
|
68
76
|
从 1.9.0 起,[Agent 协议正文](docs/agent-protocol.md#可执行的形状定义)引用 `schemas/agent/` 的可执行定义:
|
package/docs/agent-protocol.md
CHANGED
|
@@ -27,6 +27,7 @@ ACP 的消息、内容块、会话指令和能力由 ACP SDK 校验,这里只
|
|
|
27
27
|
| 工具更新的 `_meta.coda.review` | [review.json](../schemas/agent/review.json);已知风险值见 `$defs/risk` |
|
|
28
28
|
| 用量更新的 `_meta.coda` | [usage.json](../schemas/agent/usage.json) |
|
|
29
29
|
| 配置选项的 `_meta.coda.default` | [default.json](../schemas/agent/default.json)(传入 `_meta.coda` 对象) |
|
|
30
|
+
| 模型、模式、配置项及其选项的 `_meta.coda.shortName` | [display.json](../schemas/agent/display.json)(传入 `_meta.coda` 对象) |
|
|
30
31
|
|
|
31
32
|
`@coda-console/protocol/agent` 导出 `agentMessageProblem(method, params)`、`agentResultProblem(method, result)`、
|
|
32
33
|
`agentCapabilitiesProblem(meta, party = 'agent')` 和 `agentValueProblem(ref, value, where)`,合法返回 `null`,
|
|
@@ -105,6 +106,11 @@ ACP 只允许在一轮(`session/prompt`)进行时交互。Agent 在两轮之
|
|
|
105
106
|
`clientCapabilities.session.configOptions.boolean` 里声明接受开关型。会话设置里按配置项 ID 给的值,每轮开始前设给 Agent;当前模型没有这一项就不设。
|
|
106
107
|
Coda 设过、会话设置里又去掉的(用户选回「Agent 默认」),切回 Agent 标了 `_meta.coda.default` 的那一项,没标就切回 Coda 第一次设它之前、
|
|
107
108
|
同一模型下 Agent 报的值,两样都不知道就不改。Agent 自己改的 Coda 不去改回;用户在会话里用命令改的(如 Codex 的 `/fast`)记进会话设置。名字与说明照 Agent 给的显示。
|
|
109
|
+
模型、模式、配置项及其选项可在 `_meta.coda.shortName` 声明紧凑显示名([display.json](../schemas/agent/display.json)),
|
|
110
|
+
适用于 `configOptions` 的项与叶子选项,以及 `availableModels`、`availableModes` 的项。例如
|
|
111
|
+
`{ "value": "read-only", "name": "Ask for approval", "_meta": { "coda": { "shortName": "审批" } } }`。
|
|
112
|
+
工具栏优先短名,再取完整 `name`,最后取 ID;选择面板和辅助功能保留完整名称。短名由插件声明,客户端不猜测或改写模型 ID,
|
|
113
|
+
不影响设置、分组与执行;插件应保留版本、上下文变体等辨认所需的信息。没声明时保持原有显示。
|
|
108
114
|
- **未登录**:Agent 在 `initialize`、`session/new` 或 `session/load` 回错误 -32000(ACP 的 `auth_required`)时,Coda 告诉用户这个 Agent 未登录,
|
|
109
115
|
到「资源」里添加(面板的登录(Coda 的 docs/plugins.md「面板的登录」));Coda 不调用 `authenticate`,也不按错误文字猜。
|
|
110
116
|
- **Agent 版本**:`initialize` 结果的 `agentInfo`(ACP 的 `name`、`version`)填**实际运行的那个 Agent**:包装了别家 CLI 或 SDK 的插件,
|
|
@@ -409,7 +415,7 @@ Bot 需要随时进到自己的会话里来:说话、调 Coda 的工具、开
|
|
|
409
415
|
|
|
410
416
|
只给 Agent 声明了 `agentCapabilities._meta.coda.remote` 的会话提供 MCP 工具 `new_session`;
|
|
411
417
|
会话启动时生成工具列表,其他会话不列出它,直接调用也拒绝。
|
|
412
|
-
Bot
|
|
418
|
+
Bot 是工作的发起者:批准后开的是普通根会话,首条任务的回复权归发起会话;独立会话身份与回复对象分开记录。
|
|
413
419
|
|
|
414
420
|
参数为 `agent`、`prompt`、`requestId`、`turn`、`project`,以及可选的 `model`、`effort`、`mode`、`options`、`checkout`、`title`。
|
|
415
421
|
`agent` 是 Agent 的 ID,或用户给的 Agent 链接 `coda://agents/<UUID>?…`,原样照填:Coda 从链接取 Agent 与它所在的机器,
|
|
@@ -426,13 +432,17 @@ Agent、模型、强度、审批档位、其他配置、标题和任务全文;
|
|
|
426
432
|
不在调用里等用户,卡片的提醒、归档失效沿用会话授权卡片。
|
|
427
433
|
|
|
428
434
|
允许后在目标目录建根会话(`shared` 用原目录,`worktree` 从卡片写明的默认分支新建工作树),第一条消息就是 `prompt`,审批档位保留卡片批准的参数,不跟随 Bot;标题固定为批准的标题。
|
|
429
|
-
没有 parent
|
|
430
|
-
|
|
435
|
+
没有 parent,但首条任务建立发起会话的一次调用(沿用 `send` 的会话间回复机制)。任务完成或失败后,结果自动送回并唤醒发起会话;
|
|
436
|
+
这次任务引发的后续沿用补交规则。用户在新会话里另发的消息仍回复用户。PR 事件的 `coda.session` 仍采用新会话自己的 Agent 与配置。
|
|
437
|
+
会话数据的 `initiatedBy` 保存 `{threadId, title, reference}`,表示「由哪个会话发起」,不附带旧上下文;回复关系由首条任务的调用保存。
|
|
431
438
|
`reference` 是发起会话的 `coda://threads/…`。两端客户端尚未显示这个来源字段。
|
|
432
439
|
|
|
433
440
|
决定以一条 Coda 通知唤醒发起会话:允许为「已开出:标题(Coda 的 docs/coda://threads/<新会话 ID>)」,拒绝为「用户拒绝了:<标题>」,
|
|
434
|
-
|
|
435
|
-
|
|
441
|
+
允许通知同时说明任务结果会自动送回并唤醒发起会话,不必轮询或等待。已决定请求的工具重试返回这句结果,仍保留应交的通知。
|
|
442
|
+
目标若声明外部生命周期,则首条消息附带发起会话地址与原 `requestId`,目标按委派约定用 `send` 的 `replyTo` 明确回传;自主发言不自动作为结果。
|
|
443
|
+
其他机器上的创建走状态层转发的普通首次发送接口;发送前持久化允许决定、提交标识与回复调用,卡片进入 `submitting`。
|
|
444
|
+
目标用固定会话标识创建,并在接受首条任务的同一事务里建立回话;发起机器取认证身份,不信任请求正文提供的机器。
|
|
445
|
+
结果通过现有跨机投递返回,即使任务在创建回执到达前完成也能交回;重复投递不重复唤醒。
|
|
436
446
|
目标暂不可达或应答丢失时,使用原提交标识与允许决定重试恢复同一次创建,不再接受拒绝或其他提交;
|
|
437
447
|
工具重试返回「用户已批准,正在确认新会话;结果会作为新消息告诉你。」,收到创建结果后才通知已开出。
|
|
438
448
|
目标明确拒绝(例如批准前目录已删除)则结算为失败,通知「未能开出:<标题>(<原因>)」;
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://coda.pub/schemas/agent/v1/display.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "_meta.coda 须为对象",
|
|
6
|
+
"properties": {
|
|
7
|
+
"shortName": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"pattern": "\\S",
|
|
10
|
+
"description": "shortName 须为非空白文本,用于紧凑位置的显示,不改变选项 ID"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/agents.json",
|
|
4
4
|
"title": "contributes.agents:插件带来的 Agent",
|
|
5
5
|
"description": "每个是一个讲 ACP(加 Coda 的等待项)的程序:它是谁、客户端怎么画它、Coda 怎么启动它。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/capabilities.json",
|
|
4
4
|
"title": "contributes.capabilities:插件带来的能力",
|
|
5
5
|
"description": "能力名的数组,每个是 .coda/capabilities/<名>.bpmn;只能被调用(workflow_run、callActivity),没有触发器。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/commands.json",
|
|
4
4
|
"title": "contributes.commands:放在会话与步骤 PATH 最前的命令",
|
|
5
5
|
"description": "命令名 → 由 sh 运行的一行命令(带上参数)。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/common.json",
|
|
4
4
|
"title": "插件清单里共用的写法",
|
|
5
5
|
"$defs": {
|
|
6
6
|
"id": {"description": "小写字母、数字和「-」,以字母开头,至多 40 个字符", "type": "string", "pattern": "^[a-z][a-z0-9-]{0,39}$"},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/composer-modes.json",
|
|
4
4
|
"title": "contributes.composerModes:输入框模式",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "输入框能处在的模式:显示什么(图标、标题、发出去是什么、占位与发送按钮),发出的一条被收下后是否退出(once),工具栏始终使用输入框自己的执行者,在哪些输入框里能进(in:session 会话的、new 新任务的),参数(写法同设置)。打字进入的(trigger,如 !)没有参数,发出的就是会话的。",
|
|
6
6
|
"type": "array",
|
|
7
7
|
"maxItems": 10,
|
|
8
8
|
"items": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"hint": {"$ref": "common.json#/$defs/line200"},
|
|
15
15
|
"placeholder": {"$ref": "common.json#/$defs/line40"},
|
|
16
16
|
"sendLabel": {"$ref": "common.json#/$defs/line20"},
|
|
17
|
-
"
|
|
17
|
+
"once": {"description": "true:这个模式里发出的一条被收下后,它从输入框退出", "type": "boolean"},
|
|
18
18
|
"trigger": {"description": "trigger 是一个标点:!#$%&*+:;=?^|~ 之一", "type": "string", "pattern": "^[!#$%&*+:;=?^|~]$"},
|
|
19
19
|
"in": {"description": "它出现的输入框:session、new,不重复", "type": "array", "minItems": 1, "uniqueItems": true, "items": {"enum": ["session", "new"]}},
|
|
20
20
|
"parameters": {"$ref": "#/$defs/parameters"}
|
|
@@ -25,15 +25,8 @@
|
|
|
25
25
|
{
|
|
26
26
|
"if": {"required": ["trigger"]},
|
|
27
27
|
"then": {
|
|
28
|
-
"description": "打字进入的模式(trigger
|
|
29
|
-
"not": {"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"if": {"properties": {"agent": {"const": "own"}}, "required": ["agent"]},
|
|
34
|
-
"then": {
|
|
35
|
-
"description": "开新会话的模式(agent: own)要从会话里发出,不能在 new 里",
|
|
36
|
-
"properties": {"in": {"description": "开新会话的模式(agent: own)要从会话里发出,不能在 new 里", "not": {"contains": {"const": "new"}}}}
|
|
28
|
+
"description": "打字进入的模式(trigger)没有参数",
|
|
29
|
+
"not": {"required": ["parameters"]}
|
|
37
30
|
}
|
|
38
31
|
}
|
|
39
32
|
]
|
|
@@ -51,8 +44,32 @@
|
|
|
51
44
|
"maxProperties": 20,
|
|
52
45
|
"propertyNames": {"description": "参数名只用字母和数字,以小写字母开头", "pattern": "^[a-z][A-Za-z0-9]{0,39}$"},
|
|
53
46
|
"additionalProperties": {
|
|
47
|
+
"properties": {
|
|
48
|
+
"presets": {
|
|
49
|
+
"description": "按表格设置的分组列填入预设,只用于项是对象的数组参数",
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"from": {"type": "string"},
|
|
53
|
+
"by": {"type": "string"}
|
|
54
|
+
},
|
|
55
|
+
"required": ["from", "by"],
|
|
56
|
+
"additionalProperties": false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"unevaluatedProperties": false,
|
|
54
60
|
"allOf": [
|
|
55
|
-
{
|
|
61
|
+
{
|
|
62
|
+
"if": {"required": ["presets"]},
|
|
63
|
+
"then": {
|
|
64
|
+
"description": "presets 只用于 type: array 且 items.type: object 的参数",
|
|
65
|
+
"properties": {
|
|
66
|
+
"type": {"const": "array"},
|
|
67
|
+
"items": {"type": "object", "properties": {"type": {"const": "object"}}, "required": ["type"]}
|
|
68
|
+
},
|
|
69
|
+
"required": ["type", "items"]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{"$ref": "setting.json#/$defs/setting"},
|
|
56
73
|
{
|
|
57
74
|
"description": "参数不能是密文",
|
|
58
75
|
"not": {"properties": {"writeOnly": {"const": true}}, "required": ["writeOnly"]},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/configuration.json",
|
|
4
4
|
"title": "contributes.configuration:插件的设置",
|
|
5
5
|
"description": "照 VS Code 的 contributes.configuration:properties 是设置名 → 声明(setting.json),设置名以「<插件 ID>.」开头;required 是缺了就不能用的设置。",
|
|
6
6
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/endpoints.json",
|
|
4
4
|
"title": "contributes.endpoints:客户端发给插件的请求",
|
|
5
5
|
"description": "id → 回答它的一行命令(请求从标准输入给);checks 是它检查的本插件设置,客户端在那项设置旁提供「检查」,一项设置至多一个端点。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/environment.json",
|
|
4
4
|
"title": "contributes.environment:给项目里启动的东西的环境变量",
|
|
5
5
|
"description": "变量名 → 值,不超过 100 个。值里可以写 ${config:<本插件的单值设置>}(不能是密文:密文从 CODA_PLUGIN_SECRETS 给的文件读)、${CODA_PLUGIN_PATH}、${CODA_PLUGIN_STATE}。PATH 由 contributes.path 给;Coda 自己的变量与 shell 的钩子不归插件。",
|
|
6
6
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/events.json",
|
|
4
4
|
"title": "contributes.events:插件发布的事件",
|
|
5
5
|
"description": "流程订阅的事件名;starts(默认开)是否开始订阅它的流程,否则只送到在跑的运行;ends 是否结束它的主体(如 PR 关闭)。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/executors.json",
|
|
4
4
|
"title": "contributes.executors:给这台机器脚本步骤的执行环境",
|
|
5
5
|
"description": "照 GitHub 的 container hooks:叫什么、有哪些标签(coda:runsOn 那样写),以及 hook——步骤的执行器为作业的每一部分调用的一行命令。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/extension-points.json",
|
|
4
4
|
"title": "contributes.extensionPoints:插件声明的扩展点",
|
|
5
5
|
"description": "扩展点名 → 声明。只写 description 的,别的插件用 contributes.extensions 接一条命令;写了 contributes 的,任何插件在它的 contributes 里用这个键写的东西归它,原样交给声明它的插件读,合乎它的 schema 才装得上。",
|
|
6
6
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/extensions.json",
|
|
4
4
|
"title": "contributes.extensions:接在别的插件扩展点上的命令",
|
|
5
5
|
"description": "「插件 ID/扩展点名」→ { command };那个插件须写在 extensionDependencies 里。",
|
|
6
6
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/git-credentials.json",
|
|
4
4
|
"title": "contributes.gitCredentials:为一个 https 主机回答 Git 凭据",
|
|
5
5
|
"description": "url 是 https:// 加小写主机名(可带端口,不带路径);command 作为 Git 的凭据助手运行。只有 Coda 自带的插件装得上(安装时的规则)。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/groups.json",
|
|
4
4
|
"title": "contributes.groups:并发组",
|
|
5
5
|
"description": "有名字、有容量的锁:name 是任何进程都能拿的组名,capacity 是本插件的一项整数设置,说同时放进几个。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/instructions.json",
|
|
4
4
|
"title": "contributes.instructions:写给 Agent 的几句话",
|
|
5
5
|
"description": "装了这个插件的项目里,每个会话的指令都带上它:不超过 200 字。",
|
|
6
6
|
"type": "string",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/mcp-servers.json",
|
|
4
4
|
"title": "contributes.mcpServers:给 Agent 的 MCP 服务器",
|
|
5
5
|
"description": "服务器名 → { command, args, env },照 Claude Code 的 .mcp.json:Agent 在本机启动、经标准输入输出说话的程序(stdio),不经 shell。command 与 args 里可以写 ${CODA_PLUGIN_PATH}、${CODA_PLUGIN_STATE}、${CODA_NODE};设置经 env 交给它(写法同 contributes.environment)。",
|
|
6
6
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/model-providers.json",
|
|
4
4
|
"title": "contributes.modelProviders:插件提供的模型服务",
|
|
5
5
|
"description": "别的插件用 coda-model-provider 的设置按「插件/id」选它:叫什么、讲哪种接口、在哪(地址里可以写本插件的单值设置 ${config:…})、Key 是本插件的哪个密文。",
|
|
6
6
|
"type": "array",
|
package/schemas/plugin/path.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/path.json",
|
|
4
4
|
"title": "contributes.path:放上 PATH 的目录",
|
|
5
5
|
"description": "插件目录里的目录(相对路径),或它在后端的状态目录 ${CODA_PLUGIN_STATE} 下的目录(setup 可以建它)。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/plugin.json",
|
|
4
4
|
"title": "插件清单(插件目录的 package.json)",
|
|
5
5
|
"description": "照 VS Code 扩展的 package.json 写;Coda 读的是下面这些键,其余是 npm 的,不管。contributes 的每个键是一种类型,各有自己的 schema;不是 Coda 的键,是写给别的插件的扩展点的(它们声明的类型),由那个扩展点的 schema 校验。",
|
|
6
6
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/repositories.json",
|
|
4
4
|
"title": "contributes.repositories:列出这台能访问的仓库",
|
|
5
5
|
"description": "一行命令,打印仓库供客户端选。只有 Coda 自带的插件装得上(安装时的规则)。",
|
|
6
6
|
"$ref": "common.json#/$defs/commandHolder"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/services.json",
|
|
4
4
|
"title": "contributes.services:开启随包服务",
|
|
5
5
|
"description": "随后端包的独立服务的 ID;没有已安装插件开启的服务不运行。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/setting.json",
|
|
4
4
|
"title": "一项设置的声明",
|
|
5
5
|
"description": "插件用 JSON Schema 声明设置,Coda 读的是其中一部分:单个值;多选(items.anyOf 的常量);多个模型服务;一列行;表格(additionalProperties 是每一项)。表格的每一项是单个值、Agent 组合或几列;一列是单个值或 Agent 组合。格式只认 coda-agent(新会话用什么启动)、coda-agent-match(表格的行名:哪些会话)、duration(ISO 8601 时长)、coda-repo、coda-directory、coda-model-provider(别的插件提供的模型服务)、coda-model-url(模型服务的地址,Key 与接口写在同组的 modelKey、modelApi)。writeOnly 是密文:只写不读,放在数据库旁的文件里。",
|
|
6
6
|
"$ref": "#/$defs/setting",
|
|
7
|
+
"unevaluatedProperties": false,
|
|
7
8
|
"$defs": {
|
|
8
9
|
"base": {
|
|
9
10
|
"type": "object",
|
|
@@ -72,7 +73,6 @@
|
|
|
72
73
|
"additionalProperties": true,
|
|
73
74
|
"propertyNames": true
|
|
74
75
|
},
|
|
75
|
-
"unevaluatedProperties": false,
|
|
76
76
|
"allOf": [
|
|
77
77
|
{
|
|
78
78
|
"if": {"properties": {"writeOnly": {"const": true}}, "required": ["writeOnly"]},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/setup.json",
|
|
4
4
|
"title": "contributes.setup:准备运行环境",
|
|
5
5
|
"description": "用户安装或更新插件后运行的一行命令。",
|
|
6
6
|
"$ref": "common.json#/$defs/commandHolder"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/skills.json",
|
|
4
4
|
"title": "contributes.skills:插件带来的 Agent Skill",
|
|
5
5
|
"description": "插件目录里的目录,每个有自己的 SKILL.md;Agent 按目录名找到它,所以目录名不重复。",
|
|
6
6
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/
|
|
3
|
+
"$id": "https://coda.pub/schemas/plugin/v2/views.json",
|
|
4
4
|
"title": "contributes.views:客户端为插件打开的页面",
|
|
5
5
|
"description": "插件目录里的 HTML,客户端在沙箱里开:在哪常驻(side 会话旁、page 一页),图标,接管打开的引用种类(handles,像 VS Code 的自定义编辑器),读数(readout)与只给哪种工作位置的会话(checkout)。",
|
|
6
6
|
"type": "array",
|
package/validate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// A plugin is right when what it writes is of the types it names: each key of a manifest's `contributes` is a type with a
|
|
2
|
-
// JSON Schema of its own (schemas/plugin/, `https://coda.pub/schemas/plugin/
|
|
2
|
+
// JSON Schema of its own (schemas/plugin/, `https://coda.pub/schemas/plugin/v2/…`), and a key that is no type of Coda's is
|
|
3
3
|
// one a plugin's extension point declares, for that plugin to read: of the schema that point names, a file of the declaring
|
|
4
4
|
// plugin's (`extensionPoints.<point>.schema`), when it names one. Checking one is checking it against those schemas,
|
|
5
5
|
// nothing else: a field joins a type by joining its schema, never by a rule here. Coda checks a plugin with this module
|
|
@@ -28,7 +28,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
28
28
|
import Ajv2020 from 'ajv/dist/2020.js';
|
|
29
29
|
|
|
30
30
|
export const SCHEMA_DIR = fileURLToPath(new URL('./schemas/plugin/', import.meta.url));
|
|
31
|
-
const BASE = 'https://coda.pub/schemas/plugin/
|
|
31
|
+
const BASE = 'https://coda.pub/schemas/plugin/v2/';
|
|
32
32
|
// The schemas, by file name.
|
|
33
33
|
export const SCHEMAS = Object.fromEntries(readdirSync(SCHEMA_DIR).filter(file => file.endsWith('.json')).sort()
|
|
34
34
|
.map(file => [file, JSON.parse(readFileSync(join(SCHEMA_DIR, file), 'utf8'))]));
|