@coda-console/protocol 6.25.0 → 6.26.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/CHANGELOG.md +6 -0
- package/README.md +2 -0
- package/docs/agent-protocol.md +3 -1
- package/package.json +1 -1
- package/schemas/agent/elicitation-denial.json +33 -0
- package/workflow/moddle.json +3 -2
- package/workflow/values.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
版本规矩见 README 的[「版本」一节](README.md#版本)。协议自己的大版本写在协议名里(如 `coda/run@1`),与 npm 包版本、插件清单的 v2 独立;更早的版本见 git 历史。
|
|
4
4
|
|
|
5
|
+
## 6.26.0 — 2026-11-24
|
|
6
|
+
|
|
7
|
+
- 这是在 6.25.0 之上的次版本。依据 README「版本」一节:流程方言与 Agent 接入协议是内部面,只加可选属性与约定,升次版本;`stable/` 不动,清单 schema 没改。6.25.0 下合法的流程仍合法。
|
|
8
|
+
- 流程属性 `coda:questionDenial`(字符串):写了它,运行期间,持有这个运行或它的子运行里没结束的 agent 任务的会话向用户提问时,宿主当场拒绝,把这段文字回给 Agent;不写就不拦。权限审批、链接表单、密钥卡、请用户操作桌面、指给用户的流程任务都不拦。父子运行都声明时:从会话所持任务所在的运行开始往上找,用离它最近的一段;子运行没声明,就沿用祖先的声明。写了就须非空白,1–2000 个字符(以 `workflow/values.json` 里的定义为准),空串与全空白读流程时报错(不想拦就不写)。README 的流程方言补这条。
|
|
9
|
+
- Agent 接入协议:宿主因流程声明(`coda:questionDenial`)拦下轮内的 `elicitation/create` 表单时,回 `action: decline` 且必须带 `_meta.coda.reason`;Agent 插件见到 reason 就把这段文字原样交给模型。没带 reason 的 `decline` 语义不变,仍是用户拒绝;轮次限制无条件,拦截只适用于轮内 form,轮次之外的表单照旧回 `cancel`。`docs/agent-protocol.md` 补 `_meta.coda.reason`,新增 `schemas/agent/elicitation-denial.json`(`reason` 须为非空字符串,只出现在 `decline` 的表单结果里,不带 reason 的普通 `decline` 仍合法),登记在文中的 schema 索引表,`agentValueProblem('elicitation-denial.json', result)` 可校验。
|
|
10
|
+
|
|
5
11
|
## 6.25.0 — 2026-11-24
|
|
6
12
|
|
|
7
13
|
- 这是在 6.24.0 之上的次版本。依据 README「版本」一节:协议定义是内部面,只加可选的键和类型字段,升次版本;`stable/` 不动,清单 schema 没改。三处都是只增:6.24.0 下合法的定义仍合法。
|
package/README.md
CHANGED
|
@@ -16,6 +16,8 @@ Coda 与插件之间的约定,Coda 和插件都引用它,独立演进:
|
|
|
16
16
|
|
|
17
17
|
流程方言的 **挂点**是流程之间互相找到的方式:被调用的流程在自己的 extensionElements 里写 `<coda:join hook name? detail? default? order?/>` 加入一个挂点(`hook` 是小写字母开头的名字,一个流程每个挂点只加入一次),`name`、`detail` 是它作为勾选项时的名字与说明,`default` 是否默认勾上(只写 true 或 false:挂点的列表在任何运行之外读出),`order` 是整数,小的在前;`inputs` 是它要从卡片拿的自己的文字参数(`coda:input`,type 为 string,逗号或空格分隔,最多 4 个,读流程时检查),`joinInputNames(join)` 读出这些名字。宿主用动作 `hook-joiners` 列出一个挂点的加入者(勾选项形状,带上各自的 `inputs`,可直接给 `coda:optionList`),用 `run-workflows` 的 `hook`(必写)调用它们,`only` 只调用勾中的几个。挂点名是普通字符串,传哪些参数、怎么选由声明它的宿主写在自己的说明里。流程属性 `coda:mergedOnly` 说它是否只运行已合并进默认分支的提交,不写为 false(任何提交都能跑)。
|
|
18
18
|
|
|
19
|
+
流程方言的 **拦下提问**由流程属性 `coda:questionDenial` 声明(字符串):写了它,这个运行进行期间,持有这个运行或它的子运行里没结束的 agent 任务的会话,向用户提问时,宿主当场拒绝,把这段文字回给 Agent(表单回 `decline`,文字放在 `_meta.coda.reason`,见 [Agent 接入协议](docs/agent-protocol.md));不写就不拦。父子运行都声明时:从会话所持任务所在的运行开始往上找,用离它最近的一段;子运行没声明,就沿用祖先的声明。它自己的要求:非空白,1–2000 个字符(以 `workflow/values.json` 里的定义为准),空串或全空白读流程时报错,不想拦就别写。权限审批、链接表单、密钥卡、请用户操作桌面、指给用户的流程任务(`coda:assignee="user"`),都不拦。
|
|
20
|
+
|
|
19
21
|
流程方言的 **勾选项**写在答复(外层的 `coda:choice`)里:`coda:option` 是一项,`coda:optionList` 的 `value` 是一个表达式,任务打开时读出一组勾选项(列表或它的 JSON),在它写的位置展开,两者按写的顺序排。`<coda:options>` 不是它的写法(那个名字是答复自己的勾选项集合)。定义里每个 `coda:optionList` 算一项;打开后的整组由 `workflow/options.json` 定义:每项是 `{ id, name, detail?, default?, inputs? }`(`default` 为布尔值,没有 `shown`),最多 12 项,id 不重复;`inputs` 是勾上这一项时卡片上出现的文字输入,每个 `{ id, label }`,一项最多 4 个、id 不重复,几项带同一个 id 时卡上只出一个。`optionsProblem(options, where)` 检查一个答复打开后的整组(静态项已求值、各组已展开),合法时返回 `null`,否则返回「位置:说明」;表达式求值与展开仍由 Coda 完成。
|
|
20
22
|
|
|
21
23
|
流程方言的 **卡片字段**由 `workflow/fields.json` 定义:九种字段各能写哪些属性、必填项、文字长度与单行限制、路径与网址、视图参数、输入框与密钥选项、多选的选项表、一组客户端操作;`values.json` 的 `Field` 引用它,`Fields` 声明读出 JSON 字段列表的表达式,`UserTask.children` 限定最多 12 个静态字段、id 不重复,以及全部字段已知时答复的 `fields` 只能引用输入字段(含按住出现的答复)。
|
package/docs/agent-protocol.md
CHANGED
|
@@ -31,6 +31,7 @@ ACP 的消息、内容块、会话指令和能力由 ACP SDK 校验,这里只
|
|
|
31
31
|
| `session/prompt` 答复的 `usage` | [prompt-usage.json](../schemas/agent/prompt-usage.json) |
|
|
32
32
|
| 配置选项的 `_meta.coda.default` | [default.json](../schemas/agent/default.json)(传入 `_meta.coda` 对象) |
|
|
33
33
|
| 模型、模式、配置项及其选项的 `_meta.coda.shortName` | [display.json](../schemas/agent/display.json)(传入 `_meta.coda` 对象) |
|
|
34
|
+
| `elicitation/create` 表单结果的 `_meta.coda.reason`(宿主拦下表单时) | [elicitation-denial.json](../schemas/agent/elicitation-denial.json)(传入整个结果对象,如 `{"action":"decline","_meta":…}`) |
|
|
34
35
|
|
|
35
36
|
`@coda-console/protocol/agent` 导出 `agentMessageProblem(method, params)`、`agentResultProblem(method, result)`、
|
|
36
37
|
`agentCapabilitiesProblem(meta, party = 'agent')` 和 `agentValueProblem(ref, value, where)`,合法返回 `null`,
|
|
@@ -67,7 +68,7 @@ Coda 是 ACP 的客户端。每个会话的 Agent 进程由一个会话托管进
|
|
|
67
68
|
| `_coda/session/compact` | Coda → Agent | [压缩上下文](#压缩上下文):请 Agent 压缩这个会话的上下文;只对声明支持的 Agent 发,两轮之间也发 |
|
|
68
69
|
| `session/set_config_option`、`session/set_mode`、`session/set_model` | Coda → Agent | 模型、推理强度与模式 |
|
|
69
70
|
| `session/update` | Agent → Coda | 回复、思考、工具调用(可带它的[审核](#工具调用的审核))、计划、用量(可带给流程的[数据](#用量里的数据))、可用命令、会话信息;只收本会话与它的子会话的 |
|
|
70
|
-
| `session/request_permission`、`elicitation/create`(`mode: form` 或 `mode: url`) | Agent → Coda |
|
|
71
|
+
| `session/request_permission`、`elicitation/create`(`mode: form` 或 `mode: url`) | Agent → Coda | 审批与提问,作为卡片交给用户;只在一轮里受理(轮次限制无条件,见[规则](#规则)第 3 条);拦截只适用于轮内 `mode: form` 表单:若被流程声明拦下(`coda:questionDenial`),不展示卡片,当场回 `decline` 并带 `_meta.coda.reason`(见下文「宿主当场拒绝表单」) |
|
|
71
72
|
| `_coda/unrecognized` | Agent → Coda | [没适配的东西](#没适配的东西):入口报上游发来、它没按登记处理的输出,以及模型能用、它没登记的原生工具;用户因此没看到的在会话里记一条说明,都计入遥测 |
|
|
72
73
|
| `_coda/remote/code`、`_coda/remote` | Agent → Coda、Coda → Agent | [远端入口](#远端入口):Agent 要绑定码;Coda 转交远端来的请求 |
|
|
73
74
|
| `$/cancel_request` | Agent → Coda | 撤回它发出、还没得到回答的审批或提问:卡片失效,Coda 回 `cancelled`(表单回 `cancel`),之后用户的回答不再转交 |
|
|
@@ -79,6 +80,7 @@ ACP 只允许在一轮(`session/prompt`)进行时交互。Agent 在两轮之
|
|
|
79
80
|
- **表单**:`requestedSchema` 是标准 JSON Schema,Coda 按它展示并校验回答;单选、多选用
|
|
80
81
|
`enum` 或 `oneOf`/`anyOf` 的 `{const, title}`,不认私有键。
|
|
81
82
|
- **链接**(`mode: url`):带 `url` 与 `elicitationId`,没有要填的字段;Coda 展示链接,用户打开、办完后确认,回 `{action}`(`accept`、`decline` 或 `cancel`)。
|
|
83
|
+
- **宿主当场拒绝表单**:流程可以声明运行期间拦下会话向用户的提问(流程属性 `coda:questionDenial`,见 README 的流程方言)。被拦的 `elicitation/create` 表单,Coda 不展示卡片,回 `{action: "decline"}`,且**必须**在结果的 `_meta.coda.reason` 里带一段文字(拦它的流程写的):`{"action":"decline","_meta":{"coda":{"reason":"……"}}}`。Agent 插件见到 `_meta.coda.reason` 就把这段文字原样交给模型(作为这次提问的结果),不改写、不丢弃;`reason` 须为非空字符串,只出现在 `action: "decline"` 的结果里([elicitation-denial.json](../schemas/agent/elicitation-denial.json));没有 `_meta.coda.reason` 的 `decline` 仍合法,语义不变,仍是用户拒绝。轮次之外的表单照旧回 `cancel`(见上文),不在此例。审批、链接(`mode: url`)不被这样拦。
|
|
82
84
|
- **模型的分组**:`category: model` 的配置项可以按来源分组,用 ACP 选择型配置项的分组写法:`options` 是一组 `{ group, name, options }`,
|
|
83
85
|
如 Agent 自己的模型一组、它接的每个模型服务一组(模型服务(Coda 的 docs/plugins.md「模型服务」))。Coda 记下每个模型所在组的 `name`,两端选模型时按组分段、
|
|
84
86
|
以组名为段标题,组内与输入框上只写模型的 `name`;不分组的照旧列成一串。模型 ID 在各组之间不重复,设模型照旧按 ID。
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://coda.pub/schemas/agent/v1/elicitation-denial.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "表单结果须为对象",
|
|
6
|
+
"properties": {
|
|
7
|
+
"_meta": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"description": "_meta 须为对象",
|
|
10
|
+
"properties": {
|
|
11
|
+
"coda": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"description": "_meta.coda 须为对象",
|
|
14
|
+
"properties": {
|
|
15
|
+
"reason": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1,
|
|
18
|
+
"description": "reason 须为非空字符串,只出现在 action 为 decline 的表单结果里;普通 decline 不带它"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"if": {
|
|
26
|
+
"required": ["_meta"],
|
|
27
|
+
"properties": {"_meta": {"type": "object", "required": ["coda"], "properties": {"coda": {"type": "object", "required": ["reason"]}}}}
|
|
28
|
+
},
|
|
29
|
+
"then": {
|
|
30
|
+
"required": ["action"],
|
|
31
|
+
"properties": {"action": {"const": "decline", "description": "action 须为 decline:_meta.coda.reason 只出现在 decline 的表单结果里"}}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/workflow/moddle.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"name": "ProcessProperties",
|
|
11
11
|
"isAbstract": true,
|
|
12
12
|
"extends": ["bpmn:Process"],
|
|
13
|
-
"description": "流程本身:concurrency 并发、key 未结束运行的业务键、title 运行在卡片上的名字(同 GitHub 的 run-name)、dispatch 能否手动发起、inline Agent 用 workflow_run 发起时等它结束再回答、subagents 为 false 时会话 Agent 的原生子 Agent 不能发起、agents 生命周期流程跟随哪些 Agent 的会话(ID,逗号或空格分隔,不写是全部)、autoRun 事件(如 PR)来时会话与目录都没设「自动运行」的,按它决定起不起运行:true、false 或 =vars.<插件>.<设置>(不写为起)、mergedOnly 只运行已合并进默认分支的提交(不写为 false
|
|
13
|
+
"description": "流程本身:concurrency 并发、key 未结束运行的业务键、title 运行在卡片上的名字(同 GitHub 的 run-name)、dispatch 能否手动发起、inline Agent 用 workflow_run 发起时等它结束再回答、subagents 为 false 时会话 Agent 的原生子 Agent 不能发起、agents 生命周期流程跟随哪些 Agent 的会话(ID,逗号或空格分隔,不写是全部)、autoRun 事件(如 PR)来时会话与目录都没设「自动运行」的,按它决定起不起运行:true、false 或 =vars.<插件>.<设置>(不写为起)、mergedOnly 只运行已合并进默认分支的提交(不写为 false:任何提交都能跑)、questionDenial 运行期间持有这个运行(或它的子运行)里没结束的 agent 任务的会话向用户提问时,宿主当场拒绝并把这段文字回给 Agent(有值才启用;父子运行都声明时,从会话所持任务所在的运行开始往上找,用离它最近的一段,子运行没声明就沿用祖先的声明;权限审批、链接表单、密钥卡、请用户操作桌面与指给用户的流程任务(`coda:assignee=\"user\"`)不拦)",
|
|
14
14
|
"properties": [
|
|
15
15
|
{"name": "concurrency", "isAttr": true, "type": "String"},
|
|
16
16
|
{"name": "key", "isAttr": true, "type": "String"},
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
{"name": "inline", "isAttr": true, "type": "Boolean"},
|
|
20
20
|
{"name": "subagents", "isAttr": true, "type": "Boolean"},
|
|
21
21
|
{"name": "agents", "isAttr": true, "type": "String"},
|
|
22
|
-
{"name": "autoRun", "isAttr": true, "type": "String"}, {"name": "mergedOnly", "isAttr": true, "type": "Boolean"}
|
|
22
|
+
{"name": "autoRun", "isAttr": true, "type": "String"}, {"name": "mergedOnly", "isAttr": true, "type": "Boolean"},
|
|
23
|
+
{"name": "questionDenial", "isAttr": true, "type": "String"}
|
|
23
24
|
]
|
|
24
25
|
},
|
|
25
26
|
{
|
package/workflow/values.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"key": {"type": "string", "pattern": "\\S", "maxLength": 4000, "x-feel": {"names": ["inputs", "github", "vars"]}, "description": "coda:key 须为 1–4000 个字符"},
|
|
12
12
|
"title": {"type": "string", "pattern": "\\S", "maxLength": 200, "x-feel": true, "description": "coda:title 须为 1–200 个字符"},
|
|
13
13
|
"mergedOnly": {"type": "boolean", "description": "coda:mergedOnly 只能是 true 或 false"},
|
|
14
|
+
"questionDenial": {"type": "string", "pattern": "\\S", "maxLength": 2000, "description": "coda:questionDenial 须为 1–2000 个字符(不想拦提问就不写)"},
|
|
14
15
|
"agents": {"type": "string", "pattern": "^[\\s,]*[a-z][a-z0-9-]{0,39}(?:[\\s,]+[a-z][a-z0-9-]{0,39})*[\\s,]*$",
|
|
15
16
|
"description": "coda:agents 写 Agent 的 ID,用逗号或空格分隔(小写字母、数字和「-」,以字母开头,至多 40 个字符),不能为空"},
|
|
16
17
|
"autoRun": {"type": "string", "anyOf": [{"enum": ["true", "false"]}, {"pattern": "^\\s*=\\s*vars(\\.[A-Za-z_][A-Za-z0-9_-]*)+\\s*$"}], "x-feel": {"names": ["vars"]},
|