@coda-console/protocol 6.2.0 → 6.4.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 +16 -0
- package/README.md +4 -4
- package/docs/agent-protocol.md +1 -1
- package/docs/protocol.md +17 -77
- package/package.json +1 -1
- package/schemas/protocol/v1/card.json +1 -1
- package/schemas/protocol/v1/definition.json +3 -2
- package/schemas/protocol/v1/executor.json +2 -137
- package/schemas/protocol/v1/request.json +3 -2
- package/schemas/protocol/v1/run.json +1 -29
- package/workflow/moddle.json +2 -11
- package/workflow/structure.json +3 -17
- package/workflow/values.json +1 -14
- package/schemas/protocol/v1/remote-caller.json +0 -336
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
版本规矩见 README 的[「版本」一节](README.md#版本)。协议自己的大版本写在协议名里(如 `coda/run@1`),与 npm 包版本、插件清单的 v2 独立;更早的版本见 git 历史。
|
|
4
4
|
|
|
5
|
+
## 6.4.0 — 2026-11-16
|
|
6
|
+
|
|
7
|
+
- 这是在 6.3.0 之上的次版本。依据 README「版本」一节:协议定义是内部面,删改升次版本,先例见 6.3.0(#59)、6.2.0(#58)。
|
|
8
|
+
- 统一调用的请求信封(`schemas/protocol/v1/request.json`)加可选字段 `deadline`:调用方给的截止时刻,绝对时刻的毫秒时间戳(自 1970 年起的毫秒数,正整数),与调用内核 `@coda-console/kernel` 定时器的 `due` 同一表示;持有方到点触发处理函数的取消,不带时持有方从收到请求起按操作定义里的 `timeout` 算,操作没写就用宿主的默认期限。`invocationRequestProblem` 不带照样通过,带了必须是正整数,字符串、负数、零、小数、null 报问题。可选字段,旧请求不受影响(Coda 宿主设计 coda#2749 6.4)。
|
|
9
|
+
- 操作定义(`schemas/protocol/v1/definition.json`)加可选字段 `timeout`:这个操作的默认期限,毫秒数,正整数;调用方没给 `deadline` 时,持有方从收到请求起按它算,不写就用宿主的默认期限,具体数由宿主定,协议不规定。`definitionProblem` 认它,0、负数、小数、字符串、null 报问题。可选字段,已有定义不受影响。
|
|
10
|
+
- 不兼容:`coda/run@1` 删去操作 `answer`(连同它的输入、结果格式与测试);它没有实现也没有调用方,卡片的回答已改走调用内核(coda#2749 6.1)。现在 `coda/run@1` 只有 `cancel`,`idempotent` 的核心操作只剩 `coda/session@1 draft`。`coda/card@1` 的说明不再写「回答走运行的 `answer`」。
|
|
11
|
+
|
|
12
|
+
## 6.3.0 — 2026-11-15
|
|
13
|
+
|
|
14
|
+
- 这是在 6.2.0 之上的次版本(6.2.0 见下)。
|
|
15
|
+
- 不兼容:删去 Coda A3-3-0(coda#2641)已经删掉的能力的声明。依据 README「版本」一节:协议定义与流程方言是内部面,删改升次版本(6.2.0 是 failure.json 加 `auth_required`,见 #58)。
|
|
16
|
+
- 流程方言删去 `coda:reportTo`、`coda:reportOn`(moddle、取值校验与「reportOn 必须配 reportTo」、结构校验里的分支)和 `coda:placement`(`PlacementProperties`);写了它们的流程读时按认不出的属性拒绝。定时开始事件的 `coda:scope` 及其只写在定时开始事件上的约束不变。
|
|
17
|
+
- `coda/executor@1` 删去操作 `execute`(连同它的 `$defs`:源码快照 `git/snapshot@1`、`source` 输入等),现在没有操作;spec、status、`EXECUTOR_PROTOCOL` 与 `CORE_PROTOCOLS` 里的登记不变。
|
|
18
|
+
- 删去 `schemas/protocol/v1/remote-caller.json`(记录的远端入口,含 `file_ticket`)与 `docs/protocol.md` 里的对应正文。
|
|
19
|
+
- `coda/session@1` 的 `post`、`draft`,以及 `coda:runsOn`、`coda:source`、`group`、`hold-group`、`coda/run@1` 都保留;`coda:runsOn` 的说明改成:对本机执行环境的要求,不符合就一开始失败,不会把步骤交给别台。
|
|
20
|
+
|
|
5
21
|
## 6.2.0 — 2026-11-14
|
|
6
22
|
|
|
7
23
|
- Agent 的执行失败类别(`schemas/agent/failure.json`)加 `kind: auth_required`:Agent 的登录凭据失效(OAuth 令牌过期或被撤销),须用户重新登录才能继续;可带可选的 `login`(1 到 200 字,指出要重新登录的账号或登录方式),不带 `input`、`retryAfterMs`、`resetAt`,带了也不检查。`docs/agent-protocol.md` 的「执行失败」写清三类的用途:`service_unavailable` 会自己好,Coda 退避后在同一会话续;`quota_exhausted` 到恢复时间再续;`auth_required` 提醒用户重新登录,登录后续;额度不足与要重新登录两类本轮内不即时重试、也不进入服务故障重试,之后的续跑由 Coda 在同一会话里决定;并写明什么时候该报它、什么时候不该报(API key 配错、权限不足仍是普通错误)。握手阶段回 -32000 的「未登录」不变。新增类别与可选字段,旧插件不受影响(Coda #2642)。
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Coda 与插件之间的约定,Coda 和插件都引用它,独立演进:
|
|
|
22
22
|
|
|
23
23
|
输入字段有 `text`、`secret` 与多选 `choices`。`choices` 的 `options` 是选项表,每项 `{ id, label, detail?, disabled? }`(`id` 一行、1–64 个字、前后不带空白、表中不重复,`label` 一行、1–80 个字、前后不带空白,`detail` 一行不超过 200 字,`disabled` 为 true 的列出但不能勾),1–32 项,至少一项能勾;`default` 是初始勾上的选项 id,每个须是 options 里能勾的一项,不写就是都不勾;两者都可写表达式在任务打开时读,读出(或直接写下)的是 JSON 数组或它的文字。`required`(默认 true)要求至少勾一项。答复是勾中项的 id 组成的数组,按 options 的顺序,在答复的 `values.<id>` 里(其余输入是文字,它是数组),流程读 `=<任务>.values.<id>`,是 FEEL 列表;它不认识机器或别的什么,选项的意思由给出它的步骤定(如 `check-setting` 的 `machines`)。
|
|
24
24
|
|
|
25
|
-
脚本步骤的 **工作副本** 由 `coda:source` 声明:这一步在哪个工作副本目录里跑,写本机上的绝对路径,可以写 FEEL 表达式。它只用于 `coda:checkout="false"`
|
|
25
|
+
脚本步骤的 **工作副本** 由 `coda:source` 声明:这一步在哪个工作副本目录里跑,写本机上的绝对路径,可以写 FEEL 表达式。它只用于 `coda:checkout="false"` 的步骤:在那个目录里就地跑,不检出提交。
|
|
26
26
|
|
|
27
27
|
定义和运行时共用这一份 schema。`x-deferred` 包住一个 schema:读定义时,文字先检查 FEEL,表达式或含 `{{ … }}` 的模板留到打开任务后查;运行时只按包住的 schema 严格检查,不再把结果当表达式。只有内容属性使用它,`type`、`id`、布尔值、枚举和 `maxLength` 不放宽。另有 `x-length`(沿用 Coda 的 UTF-16 长度,可用 `{ "property": "maxLength" }` 读取同一对象的上限)、`x-json`(解析 JSON 文字或检查 JSON 值,按序列化后的 UTF-8 字节数限制大小)、`x-among`(`{ property, key, match? }`:数组的每一项是同一对象里 `property`(数组或它的 JSON 文字)某一项的 `key`,且那一项合乎 `match`;`property` 还是定义里的表达式时不查);`absolute-path`、`https-url`、`link-url` 三个 format 按本机路径与 URL 解析器检查;`link-url` 接受 https 网址或 `action=download-manifest` 且 `url` 解码后为 https 网址的 `itms-services:` 安装链接。已有的 `x-ref` 增加 `key`(按数组元素的属性引用)和 `split`(逐个检查分隔后的名字)。这些操作都不改写输入。
|
|
28
28
|
|
|
@@ -61,7 +61,7 @@ protocolShortName('coda/run@1'); // 'coda-1run-21'
|
|
|
61
61
|
definitionProblem(RUN_PROTOCOL); // null,或说明
|
|
62
62
|
ownedProtocolsProblem(manifest); // contributes.protocols 只能在自己的命名空间下
|
|
63
63
|
runStatusProblem({ state: 'completed', result: null }, { state: 'working' }); // 终态不能再变
|
|
64
|
-
invocationRequestProblem({ record: { kind: 'coda/
|
|
64
|
+
invocationRequestProblem({ record: { kind: 'coda/session@1', id: 'chat-1' }, operation: 'post', input: { text: 'hi' },
|
|
65
65
|
requestId: 'r1', parent: { kind: 'coda/run@1', id: 'caller-run' }, awaited: true });
|
|
66
66
|
invocationResponseProblem({ run: { kind: 'coda/run@1', id: 'run-1' } });
|
|
67
67
|
```
|
|
@@ -131,7 +131,7 @@ agentValueProblem('review.json', review, '工具的审核');
|
|
|
131
131
|
命名空间 `coda` 保留给核心协议。
|
|
132
132
|
|
|
133
133
|
- **`coda/run@1`**:被调用方自己的运行记录。spec 记录调用的记录、操作、输入、请求 ID、父引用和是否被等待;status 是 `working`、`input-required`、`completed`、`failed`、`canceled`,后三个是终态。`completed`/`failed` 必带 `result`,`failed` 的 `result` 约定为 `{ code, message }`(`code: "unknown"` 表示结局不明),`canceled` 可带取消前的话和留下的东西;另有可选的 `progress` 和等输入时的 `awaiting`。操作是 `cancel`。
|
|
134
|
-
- **`coda/executor@1
|
|
134
|
+
- **`coda/executor@1`**:执行器,一台机器上的执行环境。spec 是配置意图,status 是持有端观察到的事实;没有操作。
|
|
135
135
|
- **`coda/agent@1`**:Agent 资源,复数名 `agents`;spec 照 Coda 的 Agent 资源(`agent`、`title`、`plugin?`、`defaultModel`、`models`、`modes` 等),`plugin` 是提供 Agent 程序的插件、不是记录的 provider;status 为空对象;操作 `spawn`(`run: true`)开一个子会话。
|
|
136
136
|
- **`coda/session@1`**:插件提供的外部会话。spec 是标题、容器和可选的环境引用;status 是 `head` 游标、参与者(可带头像 `avatar`)与 `post` 收不收语音(`accepts`);操作 `read`(`safe`)与 `draft`(`idempotent`)是立即结果,`post` 开运行;撤回、编辑、表情是用 `about` 指向旧消息的新消息。
|
|
137
137
|
- **`coda/environment@1`**:插件提供的只读外部环境。spec 带 `actions`;操作 `list` 列目录、`read` 读文件(一次至多 1 MiB)。
|
|
@@ -164,7 +164,7 @@ Coda 与检查包都钉一个确切版本。对第三方的兼容承诺只覆盖
|
|
|
164
164
|
|
|
165
165
|
协议自己的大版本写在协议名里(`coda/run@1`);同一大版本只加可选字段和新操作,改含义或删东西升大版本,新旧可并存。
|
|
166
166
|
|
|
167
|
-
3.0.0 删除了 `executor` 与 `execution
|
|
167
|
+
3.0.0 删除了 `executor` 与 `execution`;这是不兼容变更,旧代码须改用 `@coda-console/protocol/protocol` 与 `coda/run@1`。
|
|
168
168
|
|
|
169
169
|
改协议就在这里开 PR,说明写清动了哪个类型、旧插件受不受影响;发布后 Coda 与检查包各自升依赖。
|
|
170
170
|
|
package/docs/agent-protocol.md
CHANGED
|
@@ -444,7 +444,7 @@ Coda 封装的 Agent 会自己长出新能力:上游 Agent 升级、服务端
|
|
|
444
444
|
|
|
445
445
|
## 远端入口
|
|
446
446
|
|
|
447
|
-
本节是 Agent 会话的旧入口,随所有机器上的 grok-bot 0.4.0
|
|
447
|
+
本节是 Agent 会话的旧入口,随所有机器上的 grok-bot 0.4.0 卸载一起退役。
|
|
448
448
|
|
|
449
449
|
绑定码与转交请求的形状分别见 [remote-code.json](../schemas/agent/remote-code.json)、[remote.json](../schemas/agent/remote.json)。
|
|
450
450
|
|
package/docs/protocol.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- 六个核心协议:`coda/run@1`、`coda/executor@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/card@1`;
|
|
10
10
|
- 插件清单里的 `contributes.protocols` 与 `contributes.protocolImplementations`。
|
|
11
11
|
|
|
12
|
-
`executor` 与 `execution` 两个旧对象协议和 `@coda-console/protocol/executor` 在 3.0.0
|
|
12
|
+
`executor` 与 `execution` 两个旧对象协议和 `@coda-console/protocol/executor` 在 3.0.0 删除。
|
|
13
13
|
|
|
14
14
|
## 名字
|
|
15
15
|
|
|
@@ -73,7 +73,7 @@ protocolShortName('coda/run@1'); // 'coda-1run-21'
|
|
|
73
73
|
| `plural` | 复数名(见「复数名」),可选;不写就是短名 |
|
|
74
74
|
| `spec` | 记录的 spec 的 JSON Schema,必填 |
|
|
75
75
|
| `status` | 记录的 status 的 JSON Schema,必填 |
|
|
76
|
-
| `operations` | 操作名 → `{ description?, input, result, safe?, idempotent? }` 或 `{ description?, input, run: true }`,必填;不定义操作写 `{}` |
|
|
76
|
+
| `operations` | 操作名 → `{ description?, input, result, safe?, idempotent?, timeout? }` 或 `{ description?, input, run: true, timeout? }`,必填;不定义操作写 `{}` |
|
|
77
77
|
|
|
78
78
|
`spec`、`status`、`input`、`result` 都是 JSON Schema draft 2020-12,只引用自己文档里的 `#/$defs/...`,不引用别的文件。`input` 必有。操作的输出二选一:
|
|
79
79
|
|
|
@@ -84,6 +84,8 @@ protocolShortName('coda/run@1'); // 'coda-1run-21'
|
|
|
84
84
|
|
|
85
85
|
`idempotent: true` 也只能和 `result` 一起写,不能和 `run` 一起写,表示可以改状态、但重发做的是同一件事的立即结果操作,比如把草稿设成某一段:调用双方和 `safe` 一样,都不按 `requestId` 留请求和回答。两者是 HTTP 的 safe 与 idempotent 之分:`safe` 只读,`idempotent` 可以改状态。`safe` 已含 `idempotent`,两个不同时写。
|
|
86
86
|
|
|
87
|
+
`timeout` 可选,是这个操作的默认期限:毫秒数,正整数。调用方没给截止时刻(请求信封的 `deadline`,见「调用信封」)时,持有方从收到请求起按它算;不写就用宿主的默认期限,具体数由宿主定。
|
|
88
|
+
|
|
87
89
|
```json
|
|
88
90
|
{
|
|
89
91
|
"name": "my-plugin/task@1",
|
|
@@ -133,15 +135,15 @@ definitionProblem(definition, { namespace: 'my-plugin' }); // 同时核对命名
|
|
|
133
135
|
|
|
134
136
|
## 调用信封
|
|
135
137
|
|
|
136
|
-
记录引用 `{ kind, id }` 的 `kind` 是协议名,如 `coda/run@1`、`coda/
|
|
138
|
+
记录引用 `{ kind, id }` 的 `kind` 是协议名,如 `coda/run@1`、`coda/session@1`、`git/source@1`;`id` 是记录的不透明 ID。Coda 自己还没定义成协议的东西(会话、流程运行等)暂用它现有的资源种类名,如 `threads`、`workflow-runs`,等后续定义成协议再改用协议名。
|
|
137
139
|
|
|
138
140
|
一次调用是:
|
|
139
141
|
|
|
140
142
|
```json
|
|
141
143
|
{
|
|
142
|
-
"record": {"kind": "coda/
|
|
143
|
-
"operation": "
|
|
144
|
-
"input": {"
|
|
144
|
+
"record": {"kind": "coda/session@1", "id": "chat-1"},
|
|
145
|
+
"operation": "post",
|
|
146
|
+
"input": {"text": "构建通过了"},
|
|
145
147
|
"requestId": "request-1",
|
|
146
148
|
"parent": {"kind": "coda/run@1", "id": "caller-run"},
|
|
147
149
|
"awaited": true
|
|
@@ -150,6 +152,8 @@ definitionProblem(definition, { namespace: 'my-plugin' }); // 同时核对命名
|
|
|
150
152
|
|
|
151
153
|
`parent` 是发起这次调用的一方(调用方的运行、会话或其他记录),`awaited` 表示调用方是否在等它。被调用方建运行时把这两项照抄进 `coda/run@1` 的 spec。
|
|
152
154
|
|
|
155
|
+
可选的 `deadline` 是调用方给的截止时刻:绝对时刻的毫秒时间戳,即自 1970 年起的毫秒数,正整数,与调用内核(`@coda-console/kernel`)定时器的 `due` 是同一种表示。持有方到点就触发处理函数的取消。不带 `deadline` 时,持有方从收到请求起按操作定义里的 `timeout`(毫秒数)算;操作没写 `timeout` 就用宿主的默认期限。
|
|
156
|
+
|
|
153
157
|
回答二选一:
|
|
154
158
|
|
|
155
159
|
```json
|
|
@@ -225,16 +229,14 @@ status:
|
|
|
225
229
|
|
|
226
230
|
操作 `cancel` 的输入是空对象,立即返回空结果;是否真的停下看 status。
|
|
227
231
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
`cancel` 和 `answer` 都交给运行的持有者处理:被调用方按 `spec.record.kind` 找到持有这条运行的一方。
|
|
232
|
+
`cancel` 交给运行的持有者处理:被调用方按 `spec.record.kind` 找到持有这条运行的一方。
|
|
231
233
|
|
|
232
234
|
```json
|
|
233
235
|
{
|
|
234
236
|
"spec": {
|
|
235
|
-
"record": {"kind": "coda/
|
|
236
|
-
"operation": "
|
|
237
|
-
"input": {"
|
|
237
|
+
"record": {"kind": "coda/session@1", "id": "chat-1"},
|
|
238
|
+
"operation": "post",
|
|
239
|
+
"input": {"text": "构建通过了"},
|
|
238
240
|
"requestId": "request-1",
|
|
239
241
|
"parent": {"kind": "coda/run@1", "id": "parent-run"},
|
|
240
242
|
"awaited": true
|
|
@@ -247,7 +249,7 @@ status:
|
|
|
247
249
|
|
|
248
250
|
一台机器上的执行环境。记录格式取自 3.0.0 之前的 `executor`,版本改由协议名表达,spec 不再写 `protocolVersion`:spec 是 `enabled`、`capacity`、`labels` 和可选的 `title`;status 是探测到的标签、能力、容量与占用、`accepting`、观察时间和 `executionFeatures`。空 status `{}` 表示尚未观察到。
|
|
249
251
|
|
|
250
|
-
|
|
252
|
+
本协议没有操作:执行环境由持有它的机器自己维护,调用方不能经协议把一份工作交给它。脚本步骤的 `coda:runsOn` 只是对本机执行环境的要求,不符合就一开始失败,不会把步骤交给别台。
|
|
251
253
|
|
|
252
254
|
```json
|
|
253
255
|
{
|
|
@@ -451,68 +453,6 @@ status:
|
|
|
451
453
|
}
|
|
452
454
|
```
|
|
453
455
|
|
|
454
|
-
### 记录的远端入口
|
|
455
|
-
|
|
456
|
-
外部会话里的一位参与者(如跑在别处的 Grok Bot)以这条 `coda/session@1` 记录的身份调 Coda。令牌只通往这条记录,不是设备凭据,不能进入其他接口。
|
|
457
|
-
Coda 直接处理请求,不经 Agent 进程;调用信封的 `parent` 是 `{ kind: "coda/session@1", id: <记录 ID> }`,见[调用信封](#调用信封)。请求不能另指定调用方。
|
|
458
|
-
形状见 [remote-caller.json](../schemas/protocol/v1/remote-caller.json):顶层校验调用正文,`$defs` 给出绑定、各方法结果及错误;`date-parse` 格式同旧入口,按 `Date.parse` 能否读出时间校验。
|
|
459
|
-
|
|
460
|
-
#### 绑定
|
|
461
|
-
|
|
462
|
-
Provider 为自己 provide 的记录向 Coda 申请一次性绑定码,只能为自己的记录申请,且须实现 `coda/session@1`。插件侧的 API 由 Coda 定义。
|
|
463
|
-
回 `{ code, expiresAt, addresses }`:码 10 分钟有效,`expiresAt` 是到期时间;`addresses` 同旧入口,是这台后端在 tailnet 里的入口(`http://<节点地址>:8080`),不在 tailnet 时为空。
|
|
464
|
-
远端以 `POST /v1/remote-caller/bind`、正文 `{ code }` 换得 `{ token, record }`,`record` 是记录 ID。无需凭据,每分钟最多 30 次,码成功兑换后失效。
|
|
465
|
-
同一条记录再绑定,新令牌取代旧的;幂等请求归记录,不随令牌更换重置。
|
|
466
|
-
|
|
467
|
-
#### 调用
|
|
468
|
-
|
|
469
|
-
`POST /v1/remote-caller`,头 `Authorization: Bearer <token>`,正文 `{ method, params }`,成功回 `{ result }`。调用正文至多 256 KiB;绑定正文同旧入口至多 4 KiB,`code` 为 1 到 128 个字符。
|
|
470
|
-
`params` 是对象;只有 `hello` 可省略,等同 `{}`。
|
|
471
|
-
|
|
472
|
-
| method | params | result |
|
|
473
|
-
| --- | --- | --- |
|
|
474
|
-
| `hello` | `{}` | `{ record, machine, tools, workflows }`:记录 ID、所在机器 ID、可用的只读工具名数组、工单白名单 |
|
|
475
|
-
| `tool` | `{ name, arguments }` | 同名 MCP 工具的回答,原样放进 `result` |
|
|
476
|
-
| `file_ticket` | `{ workflow, project?, inputs, requestId }` | `{ run, reused? }`;`run` 为 `{ kind: "workflow-runs", id }`,按运行主键复用时带 `reused: true` |
|
|
477
|
-
|
|
478
|
-
`tool.name` 只收 `machines`、`machine_diagnostics`、`read_thread`、`read_tool_call`、`workflow_list`、`workflow_status`;`arguments` 是参数对象。
|
|
479
|
-
参数与回答照 Coda 的同名 MCP 工具,见[搜索与 Agent 工具](https://github.com/coda-console/coda/blob/main/docs/peers.md#搜索与-agent-工具)和[流程文档](https://github.com/coda-console/coda/blob/main/docs/workflows.md),这里不复制它们的 schema。
|
|
480
|
-
`hello.tools` 只列本机可用的上述工具。查工单用 `workflow_status`,不另设方法。
|
|
481
|
-
|
|
482
|
-
工单白名单是 `{ project, workflow }` 的列表,存在 Coda 侧、由用户给定;怎么配置由 Coda 定义,`hello.workflows` 返回这份列表,没有就返回 `[]`。
|
|
483
|
-
`project` 是这台机器上登记的目录 ID,`workflow` 是流程名。`file_ticket` 省略 `project` 时,按 `workflow` 在白名单里找唯一一项;没有匹配就拒绝,多项匹配就要求填写 `project`。
|
|
484
|
-
写了 `project` 时须与白名单的目录 ID 精确匹配。`inputs` 是流程输入对象,按流程自己的输入契约校验。
|
|
485
|
-
Coda 以记录为 `parent`、`awaited: true` 发起流程;入口不额外出批准卡片,需要批准由流程决定。
|
|
486
|
-
|
|
487
|
-
`requestId` 是 1 到 200 个字符的不透明字符串,按调用方记录区分。同一记录、同一 `requestId`、同一内容重发,返回首次受理的同一结果,不重复开运行;换内容则报冲突。
|
|
488
|
-
内容按受理时确定的 `project`、`workflow` 和 `inputs` 比较;省略项目的重试沿用首次受理的项目。重试仍须通过记录有效性和当前白名单检查。
|
|
489
|
-
不同 `requestId` 报同一问题,由流程的[运行主键](https://github.com/coda-console/coda/blob/main/docs/workflows.md#运行主键)复用未结束的运行,回原运行和 `reused: true`;不改原运行的调用方,不接管它的结果通知。
|
|
490
|
-
|
|
491
|
-
#### 结果交付
|
|
492
|
-
|
|
493
|
-
运行结束(成功或失败)时,照流程的[通知规则](https://github.com/coda-console/coda/blob/main/docs/workflows.md#通知)把结论交给调用方;取消不通知,第一版不推中途状态。
|
|
494
|
-
调用方是 Coda 会话时,给它追加一条叫醒的消息;调用方是 `coda/session@1` 记录时,对这条记录调一次 `post`。这是同一条规则在两种会话上的交付。
|
|
495
|
-
发送者照 `post` 的规定是 `self`,不冒充 Bot;输入的 `text` 是运行的结论:成功用结束事件的输出,没有声明输出时沿用流程通知的步骤输出;失败写失败的步骤和原因。
|
|
496
|
-
`post` 信封的 `requestId` 由运行 ID 与轮次派生,同一运行每轮只发一次,交付重试使用同一个值;不按每次提工单的 `requestId` 各发一条。
|
|
497
|
-
|
|
498
|
-
#### 拒绝
|
|
499
|
-
|
|
500
|
-
HTTP 错误正文是 `{ error: { code, message } }`,`message` 是给人看的原因,`code` 用下划线命名:
|
|
501
|
-
|
|
502
|
-
| HTTP | code | 原因 |
|
|
503
|
-
| --- | --- | --- |
|
|
504
|
-
| 400 | `invalid_input` | JSON、方法或参数不合契约;项目有歧义;流程输入不合法 |
|
|
505
|
-
| 401 | `unauthorized` | 调用令牌缺失、无效或已被新令牌取代 |
|
|
506
|
-
| 401 | `unauthorized` | 绑定码不存在、过期或已用过 |
|
|
507
|
-
| 403 | `forbidden` | 工具不在六个允许的名字中,或流程不在记录的白名单中 |
|
|
508
|
-
| 409 | `invalid_state` | 记录不存在、已删除,或它的 Provider 已不实现 `coda/session@1`;兑换绑定码时也检查 |
|
|
509
|
-
| 409 | `request_conflict` | 同一记录的 `requestId` 用了不同内容 |
|
|
510
|
-
| 413 | `invalid_input` | 正文超过对应入口的上限 |
|
|
511
|
-
| 429 | `rate_limited` | 绑定超过每分钟 30 次 |
|
|
512
|
-
| 503 | `unavailable` | 允许的工具暂不可用,或流程尚未受理就暂时无法发起 |
|
|
513
|
-
|
|
514
|
-
不在允许列表的工具名回 403,其他正文校验错误回 400。工具自身的业务错误仍按 MCP 工具回答放在 `result` 里;已受理运行的失败经运行状态和结果交付报告,不改成 HTTP 错误。
|
|
515
|
-
|
|
516
456
|
## coda/environment@1
|
|
517
457
|
|
|
518
458
|
插件提供的外部环境,比如别家 Agent 自带的云主机。本版本只读。
|
|
@@ -535,7 +475,7 @@ status 是 `{ state: "available"|"unreachable", reason? }`。
|
|
|
535
475
|
|
|
536
476
|
## coda/card@1
|
|
537
477
|
|
|
538
|
-
会话向用户或上层 Agent 要的一个输入。复数名是 `cards`。由提出它的会话所在的后端持有;持有方可以按自己的表读穿给出,不另存。运行等它时,`coda/run@1` 的 `status.awaiting`
|
|
478
|
+
会话向用户或上层 Agent 要的一个输入。复数名是 `cards`。由提出它的会话所在的后端持有;持有方可以按自己的表读穿给出,不另存。运行等它时,`coda/run@1` 的 `status.awaiting` 指向这条记录。卡片自己没有操作。
|
|
539
479
|
|
|
540
480
|
spec:
|
|
541
481
|
|
|
@@ -548,7 +488,7 @@ spec:
|
|
|
548
488
|
| `answers` | 谁能答:`user` 只有用户,`any` 上层 Agent 也能代答 |
|
|
549
489
|
| `shown` | 代答的 Agent 要看的内容,对象;`answers` 为 `user` 时不写 |
|
|
550
490
|
|
|
551
|
-
spec 不带答案的 schema
|
|
491
|
+
spec 不带答案的 schema:答案的形状由卡片种类定,持有者在收到答案时校验。
|
|
552
492
|
|
|
553
493
|
status:
|
|
554
494
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coda/card@1",
|
|
3
3
|
"title": "卡片",
|
|
4
|
-
"description": "会话向用户或上层 Agent 要的一个输入。由提出它的会话所在的后端持有;运行等它时,status.awaiting
|
|
4
|
+
"description": "会话向用户或上层 Agent 要的一个输入。由提出它的会话所在的后端持有;运行等它时,status.awaiting 指向这条记录。持有方可以按自己的表读穿给出,不另存。",
|
|
5
5
|
"plural": "cards",
|
|
6
6
|
"spec": {
|
|
7
7
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://coda.pub/schemas/protocol/v1/definition.json",
|
|
4
4
|
"title": "协议定义",
|
|
5
|
-
"description": "一个协议的名字、记录格式与操作。名字是「命名空间/名字@大版本」;spec、status 与每个操作的输入、结果都是 JSON Schema(draft 2020-12),只引用定义自身的 $defs。操作要么立刻返回结果(result),要么返回运行引用(run: true);只读的立即结果可标 safe: true,可改状态但重发做同一件事的立即结果可标 idempotent: true
|
|
5
|
+
"description": "一个协议的名字、记录格式与操作。名字是「命名空间/名字@大版本」;spec、status 与每个操作的输入、结果都是 JSON Schema(draft 2020-12),只引用定义自身的 $defs。操作要么立刻返回结果(result),要么返回运行引用(run: true);只读的立即结果可标 safe: true,可改状态但重发做同一件事的立即结果可标 idempotent: true。操作可写 timeout 给出默认期限。",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"name": {"$ref": "#/$defs/name"},
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"result": {"$ref": "#/$defs/schema"},
|
|
54
54
|
"run": {"const": true, "description": "返回运行引用,而不是立即结果"},
|
|
55
55
|
"safe": {"const": true, "description": "只读、没有副作用:调用双方都不按 requestId 留请求和回答,重发就再做一次"},
|
|
56
|
-
"idempotent": {"const": true, "description": "可改状态,但重发做的是同一件事:调用双方都不按 requestId 留请求和回答,重发就再做一次"}
|
|
56
|
+
"idempotent": {"const": true, "description": "可改状态,但重发做的是同一件事:调用双方都不按 requestId 留请求和回答,重发就再做一次"},
|
|
57
|
+
"timeout": {"type": "integer", "minimum": 1, "description": "这个操作的默认期限,毫秒数,正整数:调用方没给截止时刻(请求的 deadline)时,持有方从收到请求起按它算;不写就用宿主的默认期限"}
|
|
57
58
|
},
|
|
58
59
|
"required": ["input"],
|
|
59
60
|
"additionalProperties": false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coda/executor@1",
|
|
3
3
|
"title": "执行器",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "一台机器上执行脚本步骤的环境:记录它的配置意图(spec)与持有端观察到的事实(status);没有操作。",
|
|
5
5
|
"spec": {
|
|
6
6
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
7
|
"type": "object",
|
|
@@ -140,140 +140,5 @@
|
|
|
140
140
|
],
|
|
141
141
|
"description": "空对象表示未知;非空为持有端最近观察到的事实,不是在线或预留保证"
|
|
142
142
|
},
|
|
143
|
-
"operations": {
|
|
144
|
-
"execute": {
|
|
145
|
-
"description": "接下一份执行工作,返回执行器自己开出的运行引用。",
|
|
146
|
-
"input": {
|
|
147
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
148
|
-
"type": "object",
|
|
149
|
-
"$defs": {
|
|
150
|
-
"opaqueId": {"type": "string", "minLength": 1, "maxLength": 2048},
|
|
151
|
-
"resourceRef": {
|
|
152
|
-
"type": "object",
|
|
153
|
-
"properties": {"kind": {"type": "string", "minLength": 1, "maxLength": 128}, "id": {"$ref": "#/$defs/opaqueId"}},
|
|
154
|
-
"required": ["kind", "id"],
|
|
155
|
-
"additionalProperties": false
|
|
156
|
-
},
|
|
157
|
-
"snapshotRef": {
|
|
158
|
-
"type": "object",
|
|
159
|
-
"properties": {"kind": {"const": "git/snapshot@1"}, "id": {"$ref": "#/$defs/opaqueId"}},
|
|
160
|
-
"required": ["kind", "id"],
|
|
161
|
-
"additionalProperties": false
|
|
162
|
-
},
|
|
163
|
-
"repositoryRef": {
|
|
164
|
-
"type": "object",
|
|
165
|
-
"properties": {"kind": {"const": "git/source@1"}, "id": {"$ref": "#/$defs/opaqueId"}},
|
|
166
|
-
"required": ["kind", "id"],
|
|
167
|
-
"additionalProperties": false
|
|
168
|
-
},
|
|
169
|
-
"labels": {
|
|
170
|
-
"type": "array",
|
|
171
|
-
"items": {"type": "string", "minLength": 1, "maxLength": 40, "pattern": "^[a-z0-9][a-z0-9._-]*$(?![\\s\\S])"},
|
|
172
|
-
"maxItems": 64,
|
|
173
|
-
"uniqueItems": true
|
|
174
|
-
},
|
|
175
|
-
"resourceName": {
|
|
176
|
-
"type": "string",
|
|
177
|
-
"pattern": "^(?:slots|group:(?!host$(?![\\s\\S]))[^\\s\\u0000-\\u001f\\u007f]{1,100})$(?![\\s\\S])"
|
|
178
|
-
},
|
|
179
|
-
"workingDirectory": {
|
|
180
|
-
"type": "string",
|
|
181
|
-
"minLength": 1,
|
|
182
|
-
"maxLength": 4096,
|
|
183
|
-
"pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])(?!.*(?:^|/)\\.\\.(?:/|$)).+$",
|
|
184
|
-
"description": "工作根下的相对路径;拒绝绝对路径、反斜线和 .. 段,真实落点与符号链接仍须执行方检查"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"properties": {
|
|
188
|
-
"source": {
|
|
189
|
-
"oneOf": [
|
|
190
|
-
{"type": "null"},
|
|
191
|
-
{"type": "object", "properties": {"snapshot": {"$ref": "#/$defs/snapshotRef"}}, "required": ["snapshot"], "additionalProperties": false},
|
|
192
|
-
{
|
|
193
|
-
"type": "object",
|
|
194
|
-
"properties": {
|
|
195
|
-
"repository": {"$ref": "#/$defs/repositoryRef"},
|
|
196
|
-
"commit": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$(?![\\s\\S])"}
|
|
197
|
-
},
|
|
198
|
-
"required": ["repository", "commit"],
|
|
199
|
-
"additionalProperties": false
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
},
|
|
203
|
-
"requirements": {
|
|
204
|
-
"type": "object",
|
|
205
|
-
"properties": {"labels": {"$ref": "#/$defs/labels"}},
|
|
206
|
-
"required": ["labels"],
|
|
207
|
-
"additionalProperties": false
|
|
208
|
-
},
|
|
209
|
-
"resources": {
|
|
210
|
-
"type": "object",
|
|
211
|
-
"propertyNames": {"$ref": "#/$defs/resourceName"},
|
|
212
|
-
"maxProperties": 1,
|
|
213
|
-
"additionalProperties": {"const": 1},
|
|
214
|
-
"description": "空对象表示不占资源;否则只申请一个资源的一单位"
|
|
215
|
-
},
|
|
216
|
-
"exclusiveResources": {
|
|
217
|
-
"type": "array",
|
|
218
|
-
"items": {"$ref": "#/$defs/resourceName"},
|
|
219
|
-
"maxItems": 1,
|
|
220
|
-
"uniqueItems": true,
|
|
221
|
-
"default": [],
|
|
222
|
-
"description": "空数组或独占申请的那一个资源,须与 resources 的键一致"
|
|
223
|
-
},
|
|
224
|
-
"context": {
|
|
225
|
-
"type": "object",
|
|
226
|
-
"properties": {
|
|
227
|
-
"workflow": {
|
|
228
|
-
"type": "object",
|
|
229
|
-
"properties": {
|
|
230
|
-
"name": {"type": "string", "minLength": 1, "maxLength": 256},
|
|
231
|
-
"job": {"type": "string", "minLength": 1, "maxLength": 256},
|
|
232
|
-
"runId": {"$ref": "#/$defs/opaqueId"},
|
|
233
|
-
"runAttempt": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
|
|
234
|
-
"sha": {"type": "string", "pattern": "^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})?$(?![\\s\\S])"},
|
|
235
|
-
"ref": {"type": "string", "maxLength": 1024},
|
|
236
|
-
"repository": {"type": "string", "maxLength": 2048}
|
|
237
|
-
},
|
|
238
|
-
"required": ["name", "job", "runId", "runAttempt", "sha", "ref", "repository"],
|
|
239
|
-
"additionalProperties": false
|
|
240
|
-
},
|
|
241
|
-
"plugin": {
|
|
242
|
-
"type": "object",
|
|
243
|
-
"properties": {"id": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,39}$(?![\\s\\S])"}, "version": {"type": "string", "minLength": 1, "maxLength": 128}},
|
|
244
|
-
"required": ["id", "version"],
|
|
245
|
-
"additionalProperties": false
|
|
246
|
-
},
|
|
247
|
-
"audience": {"const": "user"},
|
|
248
|
-
"outputNames": {"type": "array", "maxItems": 64, "uniqueItems": true, "items": {"type": "string", "minLength": 1, "maxLength": 128}}
|
|
249
|
-
},
|
|
250
|
-
"additionalProperties": false,
|
|
251
|
-
"description": "可信生产者给出的运行上下文与输出声明;不是环境快照或授权凭证"
|
|
252
|
-
},
|
|
253
|
-
"task": {
|
|
254
|
-
"oneOf": [
|
|
255
|
-
{"type": "object", "properties": {"script": {"type": "string", "minLength": 1, "maxLength": 65536}, "shell": {"type": "string", "minLength": 1, "maxLength": 4096}}, "required": ["script", "shell"], "additionalProperties": false},
|
|
256
|
-
{"type": "object", "properties": {"command": {"type": "string", "minLength": 1, "maxLength": 4096}, "args": {"type": "array", "items": {"type": "string", "minLength": 0, "maxLength": 16384}, "maxItems": 256}}, "required": ["command", "args"], "additionalProperties": false}
|
|
257
|
-
]
|
|
258
|
-
},
|
|
259
|
-
"workingDirectory": {"$ref": "#/$defs/workingDirectory", "default": "."},
|
|
260
|
-
"env": {
|
|
261
|
-
"type": "object",
|
|
262
|
-
"propertyNames": {"pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$(?![\\s\\S])"},
|
|
263
|
-
"maxProperties": 128,
|
|
264
|
-
"additionalProperties": {"type": "string", "minLength": 0, "maxLength": 16384}
|
|
265
|
-
},
|
|
266
|
-
"timeoutMs": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
|
|
267
|
-
"cancelGraceMs": {"type": "integer", "minimum": 0, "maximum": 9007199254740991}
|
|
268
|
-
},
|
|
269
|
-
"required": ["source", "requirements", "resources", "task", "env"],
|
|
270
|
-
"additionalProperties": false,
|
|
271
|
-
"allOf": [
|
|
272
|
-
{"if": {"properties": {"resources": {"maxProperties": 0}}}, "then": {"properties": {"exclusiveResources": {"maxItems": 0}}}}
|
|
273
|
-
],
|
|
274
|
-
"description": "一次执行工作的输入;取消走 coda/run@1 的 cancel 操作,不写在输入里"
|
|
275
|
-
},
|
|
276
|
-
"run": true
|
|
277
|
-
}
|
|
278
|
-
}
|
|
143
|
+
"operations": {}
|
|
279
144
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://coda.pub/schemas/protocol/v1/request.json",
|
|
4
4
|
"title": "统一调用请求",
|
|
5
|
-
"description": "对一条记录的一次操作:记录引用、操作名、输入、请求 ID
|
|
5
|
+
"description": "对一条记录的一次操作:记录引用、操作名、输入、请求 ID、发起方引用、是否被等待和可选的截止时刻。同一个请求 ID 重发只做一次;被调用方建运行时照抄 parent 与 awaited。",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"$defs": {
|
|
8
8
|
"reference": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"input": true,
|
|
23
23
|
"requestId": {"type": "string", "minLength": 1, "maxLength": 2048},
|
|
24
24
|
"parent": {"$ref": "#/$defs/reference", "description": "发起这次调用的一方:调用方的运行、会话或其他记录"},
|
|
25
|
-
"awaited": {"type": "boolean", "description": "调用方是否在等它"}
|
|
25
|
+
"awaited": {"type": "boolean", "description": "调用方是否在等它"},
|
|
26
|
+
"deadline": {"type": "integer", "minimum": 1, "description": "调用方给的截止时刻:绝对时刻的毫秒时间戳(自 1970 年起的毫秒数,正整数),与调用内核定时器的 due 同一表示;持有方到点触发处理函数的取消。不带时由持有方按操作定义里的 timeout 或默认期限处理"}
|
|
26
27
|
},
|
|
27
28
|
"required": ["record", "operation", "input", "requestId", "parent", "awaited"],
|
|
28
29
|
"additionalProperties": false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coda/run@1",
|
|
3
3
|
"title": "运行",
|
|
4
|
-
"description": "被调用方为一次调用开出的运行记录,由被调用方持有和写入。调用方 watch 这条记录取结果;状态到 completed、failed、canceled 后不再改变。等输入时 status.awaiting 指向一条 coda/card@1;
|
|
4
|
+
"description": "被调用方为一次调用开出的运行记录,由被调用方持有和写入。调用方 watch 这条记录取结果;状态到 completed、failed、canceled 后不再改变。等输入时 status.awaiting 指向一条 coda/card@1;cancel 按 spec.record.kind 交给运行的持有者。",
|
|
5
5
|
"spec": {
|
|
6
6
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
7
|
"type": "object",
|
|
@@ -70,34 +70,6 @@
|
|
|
70
70
|
"description": "请求取消;立即回答空结果,实际是否停止看状态。",
|
|
71
71
|
"input": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "maxProperties": 0, "additionalProperties": false},
|
|
72
72
|
"result": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "maxProperties": 0, "additionalProperties": false}
|
|
73
|
-
},
|
|
74
|
-
"answer": {
|
|
75
|
-
"description": "回答运行在等的那张卡片(status.awaiting),交给运行的持有者处理;立即回答,运行接着怎样看 status。答案里可能有密钥原文,所以标 idempotent:调用双方都不按 requestId 保存这次调用,重复提交由持有者按卡片挡住。",
|
|
76
|
-
"idempotent": true,
|
|
77
|
-
"input": {
|
|
78
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
79
|
-
"type": "object",
|
|
80
|
-
"$defs": {
|
|
81
|
-
"reference": {
|
|
82
|
-
"type": "object",
|
|
83
|
-
"properties": {
|
|
84
|
-
"kind": {"type": "string", "minLength": 1, "maxLength": 128},
|
|
85
|
-
"id": {"type": "string", "minLength": 1, "maxLength": 2048}
|
|
86
|
-
},
|
|
87
|
-
"required": ["kind", "id"],
|
|
88
|
-
"additionalProperties": false
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"properties": {
|
|
92
|
-
"card": {"$ref": "#/$defs/reference", "description": "须等于 status.awaiting"},
|
|
93
|
-
"answer": {"type": "object", "description": "回答卡片时提交的内容,形状由卡片种类定"},
|
|
94
|
-
"answeredBy": {"type": "string", "minLength": 1, "maxLength": 2048, "description": "代答的会话;用户答时不写"},
|
|
95
|
-
"attachments": {"type": "array", "maxItems": 20, "items": {"type": "string", "minLength": 1, "maxLength": 100}, "description": "随答案带的上传文件 ID"}
|
|
96
|
-
},
|
|
97
|
-
"required": ["card", "answer"],
|
|
98
|
-
"additionalProperties": false
|
|
99
|
-
},
|
|
100
|
-
"result": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": {"state": {"type": "string"}}, "additionalProperties": false}
|
|
101
73
|
}
|
|
102
74
|
}
|
|
103
75
|
}
|
package/workflow/moddle.json
CHANGED
|
@@ -47,18 +47,11 @@
|
|
|
47
47
|
{"name": "action", "isAttr": true, "type": "String"}
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
|
-
{
|
|
51
|
-
"name": "PlacementProperties",
|
|
52
|
-
"isAbstract": true,
|
|
53
|
-
"extends": ["bpmn:Process", "bpmn:ScriptTask", "bpmn:SubProcess"],
|
|
54
|
-
"description": "local 将脚本限制在发起端;any 允许符合要求的执行器。上层 local 不可被子节点放宽;显式执行器绑定仍须满足此约束",
|
|
55
|
-
"properties": [{"name": "placement", "isAttr": true, "type": "String"}]
|
|
56
|
-
},
|
|
57
50
|
{
|
|
58
51
|
"name": "RunsOnProperties",
|
|
59
52
|
"isAbstract": true,
|
|
60
53
|
"extends": ["bpmn:ScriptTask", "bpmn:SubProcess"],
|
|
61
|
-
"description": "脚本步骤要在哪里跑(同 GitHub 的 runs-on):标签如 linux,x64
|
|
54
|
+
"description": "脚本步骤要在哪里跑(同 GitHub 的 runs-on):标签如 linux,x64,是对本机执行环境的要求,不符合就一开始失败,不会把步骤交给别台;写在子流程上对其中每个脚本步骤生效",
|
|
62
55
|
"properties": [
|
|
63
56
|
{"name": "runsOn", "isAttr": true, "type": "String"}
|
|
64
57
|
]
|
|
@@ -88,10 +81,8 @@
|
|
|
88
81
|
"name": "StartEventProperties",
|
|
89
82
|
"isAbstract": true,
|
|
90
83
|
"extends": ["bpmn:StartEvent"],
|
|
91
|
-
"description": "计时器开始事件的:
|
|
84
|
+
"description": "计时器开始事件的:scope 是 project(默认,每个有它的项目各跑)或 machine(整台机器一次)",
|
|
92
85
|
"properties": [
|
|
93
|
-
{"name": "reportTo", "isAttr": true, "type": "String"},
|
|
94
|
-
{"name": "reportOn", "isAttr": true, "type": "String"},
|
|
95
86
|
{"name": "scope", "isAttr": true, "type": "String"}
|
|
96
87
|
]
|
|
97
88
|
},
|
package/workflow/structure.json
CHANGED
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
|
-
"description": "coda:
|
|
206
|
+
"description": "coda:scope 只写在定时开始事件上",
|
|
207
207
|
"schema": {
|
|
208
208
|
"properties": {
|
|
209
209
|
"position": {
|
|
@@ -215,22 +215,8 @@
|
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
"when": {
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
"required": [
|
|
221
|
-
"reportTo"
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"required": [
|
|
226
|
-
"reportOn"
|
|
227
|
-
]
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"required": [
|
|
231
|
-
"scope"
|
|
232
|
-
]
|
|
233
|
-
}
|
|
218
|
+
"required": [
|
|
219
|
+
"scope"
|
|
234
220
|
]
|
|
235
221
|
}
|
|
236
222
|
},
|
package/workflow/values.json
CHANGED
|
@@ -30,12 +30,6 @@
|
|
|
30
30
|
"retry": {"type": "string", "pattern": "^[1-5]$", "description": "coda:retry 是失败后最多再试几次,须为 1 到 5 的整数"}
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"PlacementProperties": {
|
|
34
|
-
"type": "object",
|
|
35
|
-
"properties": {
|
|
36
|
-
"placement": {"enum": ["local", "any"], "description": "coda:placement 只能是 local 或 any;local 限制为发起端,不能隐式回退或被子节点放宽"}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
33
|
"RunsOnProperties": {
|
|
40
34
|
"type": "object",
|
|
41
35
|
"properties": {
|
|
@@ -66,15 +60,8 @@
|
|
|
66
60
|
"StartEventProperties": {
|
|
67
61
|
"type": "object",
|
|
68
62
|
"properties": {
|
|
69
|
-
"reportTo": {"type": "string",
|
|
70
|
-
"anyOf": [{"pattern": "^\\s*=\\s*vars(?:\\.[A-Za-z0-9_-]+)+\\s*$"},
|
|
71
|
-
{"pattern": "^\\s*(?:coda://threads/|coda\\+space://[^/#]+/threads/)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(?:#(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}|command:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))?\\s*$"}],
|
|
72
|
-
"description": "coda:reportTo 写会话引用(coda://threads/<会话 UUID>),或只读插件设置的表达式,如 =vars.maintenance.reportTo"},
|
|
73
|
-
"reportOn": {"enum": ["failure", "always"], "description": "coda:reportOn 只能是 failure、always"},
|
|
74
63
|
"scope": {"enum": ["project", "machine"], "description": "coda:scope 只能是 project、machine"}
|
|
75
|
-
}
|
|
76
|
-
"if": {"required": ["reportOn"]},
|
|
77
|
-
"then": {"required": ["reportTo"], "description": "写了 coda:reportOn 就要写 coda:reportTo(结果交给谁)"}
|
|
64
|
+
}
|
|
78
65
|
},
|
|
79
66
|
"EndEventProperties": {
|
|
80
67
|
"type": "object",
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/protocol/v1/remote-caller.json",
|
|
4
|
-
"title": "记录的远端入口",
|
|
5
|
-
"description": "POST /v1/remote-caller 的正文;绑定、回答与错误见 $defs。记录归属、参与者、白名单、幂等与 HTTP 状态由 Coda 检查,见 docs/protocol.md「记录的远端入口」。",
|
|
6
|
-
"$defs": {
|
|
7
|
-
"id": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"minLength": 1,
|
|
10
|
-
"maxLength": 2048
|
|
11
|
-
},
|
|
12
|
-
"codeResult": {
|
|
13
|
-
"type": "object",
|
|
14
|
-
"properties": {
|
|
15
|
-
"code": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"minLength": 1,
|
|
18
|
-
"maxLength": 128
|
|
19
|
-
},
|
|
20
|
-
"expiresAt": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"format": "date-parse",
|
|
23
|
-
"description": "绑定码到期时间,申请后 10 分钟"
|
|
24
|
-
},
|
|
25
|
-
"addresses": {
|
|
26
|
-
"type": "array",
|
|
27
|
-
"items": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"description": "后端的 tailnet 入口;不在 tailnet 时为空"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"required": [
|
|
34
|
-
"code",
|
|
35
|
-
"expiresAt",
|
|
36
|
-
"addresses"
|
|
37
|
-
],
|
|
38
|
-
"additionalProperties": false
|
|
39
|
-
},
|
|
40
|
-
"bindRequest": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"properties": {
|
|
43
|
-
"code": {
|
|
44
|
-
"type": "string",
|
|
45
|
-
"minLength": 1,
|
|
46
|
-
"maxLength": 128
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"required": [
|
|
50
|
-
"code"
|
|
51
|
-
],
|
|
52
|
-
"additionalProperties": false
|
|
53
|
-
},
|
|
54
|
-
"bindResult": {
|
|
55
|
-
"type": "object",
|
|
56
|
-
"properties": {
|
|
57
|
-
"token": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"minLength": 1
|
|
60
|
-
},
|
|
61
|
-
"record": {
|
|
62
|
-
"$ref": "#/$defs/id"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"required": [
|
|
66
|
-
"token",
|
|
67
|
-
"record"
|
|
68
|
-
],
|
|
69
|
-
"additionalProperties": false
|
|
70
|
-
},
|
|
71
|
-
"workflow": {
|
|
72
|
-
"type": "object",
|
|
73
|
-
"properties": {
|
|
74
|
-
"project": {
|
|
75
|
-
"$ref": "#/$defs/id"
|
|
76
|
-
},
|
|
77
|
-
"workflow": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"minLength": 1,
|
|
80
|
-
"maxLength": 200
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"required": [
|
|
84
|
-
"project",
|
|
85
|
-
"workflow"
|
|
86
|
-
],
|
|
87
|
-
"additionalProperties": false
|
|
88
|
-
},
|
|
89
|
-
"helloResult": {
|
|
90
|
-
"type": "object",
|
|
91
|
-
"properties": {
|
|
92
|
-
"record": {
|
|
93
|
-
"$ref": "#/$defs/id"
|
|
94
|
-
},
|
|
95
|
-
"machine": {
|
|
96
|
-
"$ref": "#/$defs/id"
|
|
97
|
-
},
|
|
98
|
-
"tools": {
|
|
99
|
-
"type": "array",
|
|
100
|
-
"items": {
|
|
101
|
-
"enum": [
|
|
102
|
-
"machines",
|
|
103
|
-
"machine_diagnostics",
|
|
104
|
-
"read_thread",
|
|
105
|
-
"read_tool_call",
|
|
106
|
-
"workflow_list",
|
|
107
|
-
"workflow_status"
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
"uniqueItems": true
|
|
111
|
-
},
|
|
112
|
-
"workflows": {
|
|
113
|
-
"type": "array",
|
|
114
|
-
"items": {
|
|
115
|
-
"$ref": "#/$defs/workflow"
|
|
116
|
-
},
|
|
117
|
-
"uniqueItems": true
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
"required": [
|
|
121
|
-
"record",
|
|
122
|
-
"machine",
|
|
123
|
-
"tools",
|
|
124
|
-
"workflows"
|
|
125
|
-
],
|
|
126
|
-
"additionalProperties": false
|
|
127
|
-
},
|
|
128
|
-
"helloRequest": {
|
|
129
|
-
"type": "object",
|
|
130
|
-
"properties": {
|
|
131
|
-
"method": {
|
|
132
|
-
"const": "hello"
|
|
133
|
-
},
|
|
134
|
-
"params": {
|
|
135
|
-
"type": "object",
|
|
136
|
-
"properties": {},
|
|
137
|
-
"required": [],
|
|
138
|
-
"additionalProperties": false
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
"required": [
|
|
142
|
-
"method"
|
|
143
|
-
],
|
|
144
|
-
"additionalProperties": false
|
|
145
|
-
},
|
|
146
|
-
"toolRequest": {
|
|
147
|
-
"type": "object",
|
|
148
|
-
"properties": {
|
|
149
|
-
"method": {
|
|
150
|
-
"const": "tool"
|
|
151
|
-
},
|
|
152
|
-
"params": {
|
|
153
|
-
"type": "object",
|
|
154
|
-
"properties": {
|
|
155
|
-
"name": {
|
|
156
|
-
"enum": [
|
|
157
|
-
"machines",
|
|
158
|
-
"machine_diagnostics",
|
|
159
|
-
"read_thread",
|
|
160
|
-
"read_tool_call",
|
|
161
|
-
"workflow_list",
|
|
162
|
-
"workflow_status"
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
"arguments": {
|
|
166
|
-
"type": "object",
|
|
167
|
-
"description": "参数同 Coda 的同名 MCP 工具"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
"required": [
|
|
171
|
-
"name",
|
|
172
|
-
"arguments"
|
|
173
|
-
],
|
|
174
|
-
"additionalProperties": false
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
"required": [
|
|
178
|
-
"method",
|
|
179
|
-
"params"
|
|
180
|
-
],
|
|
181
|
-
"additionalProperties": false
|
|
182
|
-
},
|
|
183
|
-
"ticketRequest": {
|
|
184
|
-
"type": "object",
|
|
185
|
-
"properties": {
|
|
186
|
-
"method": {
|
|
187
|
-
"const": "file_ticket"
|
|
188
|
-
},
|
|
189
|
-
"params": {
|
|
190
|
-
"type": "object",
|
|
191
|
-
"properties": {
|
|
192
|
-
"workflow": {
|
|
193
|
-
"type": "string",
|
|
194
|
-
"minLength": 1,
|
|
195
|
-
"maxLength": 200
|
|
196
|
-
},
|
|
197
|
-
"project": {
|
|
198
|
-
"$ref": "#/$defs/id"
|
|
199
|
-
},
|
|
200
|
-
"inputs": {
|
|
201
|
-
"type": "object"
|
|
202
|
-
},
|
|
203
|
-
"requestId": {
|
|
204
|
-
"type": "string",
|
|
205
|
-
"minLength": 1,
|
|
206
|
-
"maxLength": 200
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
"required": [
|
|
210
|
-
"workflow",
|
|
211
|
-
"inputs",
|
|
212
|
-
"requestId"
|
|
213
|
-
],
|
|
214
|
-
"additionalProperties": false
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
"required": [
|
|
218
|
-
"method",
|
|
219
|
-
"params"
|
|
220
|
-
],
|
|
221
|
-
"additionalProperties": false
|
|
222
|
-
},
|
|
223
|
-
"ticketResult": {
|
|
224
|
-
"type": "object",
|
|
225
|
-
"properties": {
|
|
226
|
-
"run": {
|
|
227
|
-
"type": "object",
|
|
228
|
-
"properties": {
|
|
229
|
-
"kind": {
|
|
230
|
-
"const": "workflow-runs"
|
|
231
|
-
},
|
|
232
|
-
"id": {
|
|
233
|
-
"$ref": "#/$defs/id"
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
"required": [
|
|
237
|
-
"kind",
|
|
238
|
-
"id"
|
|
239
|
-
],
|
|
240
|
-
"additionalProperties": false
|
|
241
|
-
},
|
|
242
|
-
"reused": {
|
|
243
|
-
"const": true
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
"required": [
|
|
247
|
-
"run"
|
|
248
|
-
],
|
|
249
|
-
"additionalProperties": false
|
|
250
|
-
},
|
|
251
|
-
"toolResult": {
|
|
252
|
-
"description": "Coda 同名 MCP 工具的回答,不在本协议复制 schema"
|
|
253
|
-
},
|
|
254
|
-
"helloResponse": {
|
|
255
|
-
"type": "object",
|
|
256
|
-
"properties": {
|
|
257
|
-
"result": {
|
|
258
|
-
"$ref": "#/$defs/helloResult"
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
"required": [
|
|
262
|
-
"result"
|
|
263
|
-
],
|
|
264
|
-
"additionalProperties": false
|
|
265
|
-
},
|
|
266
|
-
"toolResponse": {
|
|
267
|
-
"type": "object",
|
|
268
|
-
"properties": {
|
|
269
|
-
"result": {
|
|
270
|
-
"$ref": "#/$defs/toolResult"
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
"required": [
|
|
274
|
-
"result"
|
|
275
|
-
],
|
|
276
|
-
"additionalProperties": false
|
|
277
|
-
},
|
|
278
|
-
"ticketResponse": {
|
|
279
|
-
"type": "object",
|
|
280
|
-
"properties": {
|
|
281
|
-
"result": {
|
|
282
|
-
"$ref": "#/$defs/ticketResult"
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
"required": [
|
|
286
|
-
"result"
|
|
287
|
-
],
|
|
288
|
-
"additionalProperties": false
|
|
289
|
-
},
|
|
290
|
-
"error": {
|
|
291
|
-
"type": "object",
|
|
292
|
-
"properties": {
|
|
293
|
-
"error": {
|
|
294
|
-
"type": "object",
|
|
295
|
-
"properties": {
|
|
296
|
-
"code": {
|
|
297
|
-
"enum": [
|
|
298
|
-
"invalid_input",
|
|
299
|
-
"unauthorized",
|
|
300
|
-
"forbidden",
|
|
301
|
-
"invalid_state",
|
|
302
|
-
"request_conflict",
|
|
303
|
-
"rate_limited",
|
|
304
|
-
"unavailable"
|
|
305
|
-
]
|
|
306
|
-
},
|
|
307
|
-
"message": {
|
|
308
|
-
"type": "string",
|
|
309
|
-
"minLength": 1
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
"required": [
|
|
313
|
-
"code",
|
|
314
|
-
"message"
|
|
315
|
-
],
|
|
316
|
-
"additionalProperties": false
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
"required": [
|
|
320
|
-
"error"
|
|
321
|
-
],
|
|
322
|
-
"additionalProperties": false
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
"oneOf": [
|
|
326
|
-
{
|
|
327
|
-
"$ref": "#/$defs/helloRequest"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"$ref": "#/$defs/toolRequest"
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
"$ref": "#/$defs/ticketRequest"
|
|
334
|
-
}
|
|
335
|
-
]
|
|
336
|
-
}
|