@coda-console/protocol 6.8.0 → 6.9.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 +5 -0
- package/README.md +2 -3
- package/docs/protocol.md +1 -14
- package/package.json +1 -1
- package/protocol.mjs +1 -2
- package/schemas/protocol/v1/executor.json +0 -144
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
版本规矩见 README 的[「版本」一节](README.md#版本)。协议自己的大版本写在协议名里(如 `coda/run@1`),与 npm 包版本、插件清单的 v2 独立;更早的版本见 git 历史。
|
|
4
4
|
|
|
5
|
+
## 6.9.0 — 2026-11-18
|
|
6
|
+
|
|
7
|
+
- 这是在 6.8.0 之上的次版本。依据 README「版本」一节:协议定义是内部面,删改升次版本,先例见 6.4.0(删去 `coda/run@1` 的 `answer`)。
|
|
8
|
+
- 不兼容:删掉 `coda/executor@1`(执行器子系统退役:步骤只在本机跑,这种记录已经没有读者;Coda 宿主设计 coda#2749 第 11 节)。删去 `schemas/protocol/v1/executor.json` 与导出 `EXECUTOR_PROTOCOL`,`CORE_PROTOCOLS` 由六项变五项(`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/card@1`),README 与 `docs/protocol.md` 的介绍和测试同步。别的协议没有引用它。流程里的 `coda:runsOn` 与插件清单不受影响。
|
|
9
|
+
|
|
5
10
|
## 6.8.0 — 2026-11-17
|
|
6
11
|
|
|
7
12
|
- 这是在 6.7.0 之上的次版本。依据 README「版本」一节:清单的通用键放宽写法、旧写法照旧通过,升次版本(Coda 宿主设计 coda#2749 第 4、5 节与 6.7 节)。
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Coda 与插件之间的约定,Coda 和插件都引用它,独立演进:
|
|
|
4
4
|
|
|
5
5
|
- **插件清单的类型**(`schemas/plugin/`):插件目录 `package.json` 里 `contributes` 的每个键是一种类型,各有一份 JSON Schema(draft 2020-12,`$id` 为 `https://coda.pub/schemas/plugin/v2/<文件>`)。`plugin.json` 是整份清单,只列通用键(`configuration`、`extensionPoints`、`extensions`、`services`、`setup`、`environment`、`path`、`endpoints`、`views`、`protocols`、`protocolImplementations`);`setting.json` 是一项设置的声明。其余键由 Coda 的贡献点登记表或某个插件的扩展点声明:Coda 自己的(`agents`、`composerModes`、`modelProviders` 等)的 schema 仍放在这里作公开数据(如 `agents.json`、`composer-modes.json`),由登记它的 provider 引用;扩展点可以带自己的 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
|
-
- **协议定义与调用**(`schemas/protocol/`、`protocol.mjs`、`docs/protocol.md`):协议是 `命名空间/名字@大版本` + spec/status 的 JSON Schema + 操作;插件在 `contributes.protocols` 里定义自己命名空间下的协议,在 `contributes.protocolImplementations` 里声明实现哪些协议。调用是 `{ record, operation, input, requestId, parent, awaited }`,回答是 `{ result }` 或 `{ run }`;`coda/run@1`、`coda/
|
|
7
|
+
- **协议定义与调用**(`schemas/protocol/`、`protocol.mjs`、`docs/protocol.md`):协议是 `命名空间/名字@大版本` + spec/status 的 JSON Schema + 操作;插件在 `contributes.protocols` 里定义自己命名空间下的协议,在 `contributes.protocolImplementations` 里声明实现哪些协议。调用是 `{ record, operation, input, requestId, parent, awaited }`,回答是 `{ result }` 或 `{ run }`;`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/card@1` 是五个核心协议。
|
|
8
8
|
- **流程方言**(`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` 负责跨节点检查。
|
|
9
9
|
- **Agent 接入扩展**(`schemas/agent/`、`agent.mjs`、`docs/agent-protocol.md`):Coda 怎样用 ACP 接 Agent,以及 Coda 加的扩展(会话指令、插话、`_coda/wait`、执行失败、工具调用的审核、配置探测)。
|
|
10
10
|
|
|
@@ -50,7 +50,7 @@ pointProblem(panelsSchema, manifest.contributes.panels, 'contributes.panels', 'p
|
|
|
50
50
|
|
|
51
51
|
```js
|
|
52
52
|
import {
|
|
53
|
-
RUN_PROTOCOL,
|
|
53
|
+
RUN_PROTOCOL, AGENT_PROTOCOL, SESSION_PROTOCOL, ENVIRONMENT_PROTOCOL, CARD_PROTOCOL, CORE_PROTOCOLS,
|
|
54
54
|
definitionProblem, ownedProtocolsProblem, runStatusProblem,
|
|
55
55
|
invocationRequestProblem, invocationResponseProblem,
|
|
56
56
|
parseProtocolName, formatProtocolName, protocolShortName,
|
|
@@ -131,7 +131,6 @@ 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`**:执行器,一台机器上的执行环境。spec 是配置意图,status 是持有端观察到的事实;没有操作。
|
|
135
134
|
- **`coda/agent@1`**:Agent 资源,复数名 `agents`;spec 照 Coda 的 Agent 资源(`agent`、`title`、`plugin?`、`defaultModel`、`models`、`modes` 等),`plugin` 是提供 Agent 程序的插件、不是记录的 provider;status 为空对象;操作 `spawn`(`run: true`)开一个子会话。
|
|
136
135
|
- **`coda/session@1`**:插件提供的外部会话。spec 是标题、容器和可选的环境引用;status 是 `head` 游标、参与者(可带头像 `avatar`)与 `post` 收不收语音(`accepts`);操作 `read`(`safe`)与 `draft`(`idempotent`)是立即结果,`post` 开运行;撤回、编辑、表情是用 `about` 指向旧消息的新消息。
|
|
137
136
|
- **`coda/environment@1`**:插件提供的只读外部环境。spec 带 `actions`;操作 `list` 列目录、`read` 读文件(一次至多 1 MiB)。
|
package/docs/protocol.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- 协议定义文档的 JSON Schema 与校验:`schemas/protocol/v1/definition.json`、`@coda-console/protocol/protocol`;
|
|
8
8
|
- 统一调用信封:`schemas/protocol/v1/request.json`、`response.json`;
|
|
9
|
-
-
|
|
9
|
+
- 五个核心协议:`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/card@1`;
|
|
10
10
|
- 插件清单里的 `contributes.protocols` 与 `contributes.protocolImplementations`。
|
|
11
11
|
|
|
12
12
|
`executor` 与 `execution` 两个旧对象协议和 `@coda-console/protocol/executor` 在 3.0.0 删除。
|
|
@@ -257,19 +257,6 @@ status:
|
|
|
257
257
|
}
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
## coda/executor@1
|
|
261
|
-
|
|
262
|
-
一台机器上的执行环境。记录格式取自 3.0.0 之前的 `executor`,版本改由协议名表达,spec 不再写 `protocolVersion`:spec 是 `enabled`、`capacity`、`labels` 和可选的 `title`;status 是探测到的标签、能力、容量与占用、`accepting`、观察时间和 `executionFeatures`。空 status `{}` 表示尚未观察到。
|
|
263
|
-
|
|
264
|
-
本协议没有操作:执行环境由持有它的机器自己维护,调用方不能经协议把一份工作交给它。脚本步骤的 `coda:runsOn` 只是对本机执行环境的要求,不符合就一开始失败,不会把步骤交给别台。
|
|
265
|
-
|
|
266
|
-
```json
|
|
267
|
-
{
|
|
268
|
-
"spec": {"enabled": true, "capacity": {"slots": 2}, "labels": ["build-lab"], "title": "Mac mini"},
|
|
269
|
-
"status": {}
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
260
|
## coda/agent@1
|
|
274
261
|
|
|
275
262
|
一台机器上装着的 Agent 程序,记录格式照 Coda 的 Agent 资源 spec。复数名是 `agents`。记录的 provider 是写记录的一方,即编排(现在是 `coda`),不是提供 Agent 程序的插件;那个插件写在 `spec.plugin`。
|
package/package.json
CHANGED
package/protocol.mjs
CHANGED
|
@@ -11,13 +11,12 @@ export const PROTOCOL_DEFINITION = read('definition.json');
|
|
|
11
11
|
export const INVOCATION_REQUEST = read('request.json');
|
|
12
12
|
export const INVOCATION_RESPONSE = read('response.json');
|
|
13
13
|
export const RUN_PROTOCOL = read('run.json');
|
|
14
|
-
export const EXECUTOR_PROTOCOL = read('executor.json');
|
|
15
14
|
export const AGENT_PROTOCOL = read('agent.json');
|
|
16
15
|
export const SESSION_PROTOCOL = read('session.json');
|
|
17
16
|
export const ENVIRONMENT_PROTOCOL = read('environment.json');
|
|
18
17
|
export const CARD_PROTOCOL = read('card.json');
|
|
19
18
|
export const CORE_PROTOCOLS = Object.freeze(Object.fromEntries(
|
|
20
|
-
[RUN_PROTOCOL,
|
|
19
|
+
[RUN_PROTOCOL, AGENT_PROTOCOL, SESSION_PROTOCOL, ENVIRONMENT_PROTOCOL, CARD_PROTOCOL].map(protocol => [protocol.name, protocol])));
|
|
21
20
|
|
|
22
21
|
const ajv = newAjv({ ownProperties: true, addUsedSchema: false, strict: false });
|
|
23
22
|
const definitionCheck = ajv.compile(PROTOCOL_DEFINITION);
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "coda/executor@1",
|
|
3
|
-
"title": "执行器",
|
|
4
|
-
"description": "一台机器上执行脚本步骤的环境:记录它的配置意图(spec)与持有端观察到的事实(status);没有操作。",
|
|
5
|
-
"spec": {
|
|
6
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"$defs": {
|
|
9
|
-
"resourceName": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"pattern": "^(?:slots|group:(?!host$(?![\\s\\S]))[^\\s\\u0000-\\u001f\\u007f]{1,100})$(?![\\s\\S])",
|
|
12
|
-
"description": "slots 对应 host;其他本机命名组用 group:<原名>,不将不同组折叠为 slots"
|
|
13
|
-
},
|
|
14
|
-
"resourceAmounts": {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"propertyNames": {"$ref": "#/$defs/resourceName"},
|
|
17
|
-
"maxProperties": 128,
|
|
18
|
-
"additionalProperties": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},
|
|
19
|
-
"description": "可报告多个独立资源的容量"
|
|
20
|
-
},
|
|
21
|
-
"userLabels": {
|
|
22
|
-
"type": "array",
|
|
23
|
-
"items": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"minLength": 1,
|
|
26
|
-
"maxLength": 40,
|
|
27
|
-
"pattern": "^[a-z0-9][a-z0-9._-]*$(?![\\s\\S])",
|
|
28
|
-
"not": {
|
|
29
|
-
"pattern": "^(darwin|linux|win32|aix|android|freebsd|openbsd|sunos|cygwin|netbsd|haiku|arm|arm64|ia32|x64|loong64|mips|mipsel|ppc|ppc64|riscv64|s390|s390x|gui)$|^(xcode|ios|node)-"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"maxItems": 64,
|
|
33
|
-
"uniqueItems": true,
|
|
34
|
-
"description": "用户自定义标签,不占用 OS、架构、gui 与 xcode-/ios-/node- 探测命名空间"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"properties": {
|
|
38
|
-
"enabled": {"type": "boolean"},
|
|
39
|
-
"capacity": {"$ref": "#/$defs/resourceAmounts"},
|
|
40
|
-
"labels": {"$ref": "#/$defs/userLabels"},
|
|
41
|
-
"title": {"type": "string", "minLength": 1, "maxLength": 200}
|
|
42
|
-
},
|
|
43
|
-
"required": ["enabled", "capacity", "labels"],
|
|
44
|
-
"additionalProperties": false,
|
|
45
|
-
"description": "执行器配置意图,由持有端维护"
|
|
46
|
-
},
|
|
47
|
-
"status": {
|
|
48
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
49
|
-
"type": "object",
|
|
50
|
-
"$defs": {
|
|
51
|
-
"resourceName": {
|
|
52
|
-
"type": "string",
|
|
53
|
-
"pattern": "^(?:slots|group:(?!host$(?![\\s\\S]))[^\\s\\u0000-\\u001f\\u007f]{1,100})$(?![\\s\\S])"
|
|
54
|
-
},
|
|
55
|
-
"resourceAmounts": {
|
|
56
|
-
"type": "object",
|
|
57
|
-
"propertyNames": {"$ref": "#/$defs/resourceName"},
|
|
58
|
-
"maxProperties": 128,
|
|
59
|
-
"additionalProperties": {"type": "integer", "minimum": 0, "maximum": 9007199254740991}
|
|
60
|
-
},
|
|
61
|
-
"labels": {
|
|
62
|
-
"type": "array",
|
|
63
|
-
"items": {"type": "string", "minLength": 1, "maxLength": 40, "pattern": "^[a-z0-9][a-z0-9._-]*$(?![\\s\\S])"},
|
|
64
|
-
"maxItems": 64,
|
|
65
|
-
"uniqueItems": true
|
|
66
|
-
},
|
|
67
|
-
"reason": {
|
|
68
|
-
"type": "object",
|
|
69
|
-
"properties": {
|
|
70
|
-
"code": {"type": "string", "minLength": 1, "maxLength": 128},
|
|
71
|
-
"message": {"type": "string", "minLength": 1, "maxLength": 4096}
|
|
72
|
-
},
|
|
73
|
-
"required": ["code", "message"],
|
|
74
|
-
"additionalProperties": false
|
|
75
|
-
},
|
|
76
|
-
"timestamp": {
|
|
77
|
-
"type": "string",
|
|
78
|
-
"minLength": 1,
|
|
79
|
-
"maxLength": 40,
|
|
80
|
-
"pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d{1,9})?Z$(?![\\s\\S])"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"properties": {
|
|
84
|
-
"detectedLabels": {"$ref": "#/$defs/labels"},
|
|
85
|
-
"capabilities": {
|
|
86
|
-
"type": "object",
|
|
87
|
-
"properties": {
|
|
88
|
-
"os": {"type": "string", "minLength": 1, "maxLength": 40},
|
|
89
|
-
"arch": {"type": "string", "minLength": 1, "maxLength": 40},
|
|
90
|
-
"nodeVersion": {"type": "string", "minLength": 1, "maxLength": 128},
|
|
91
|
-
"xcode": {
|
|
92
|
-
"type": "object",
|
|
93
|
-
"properties": {"version": {"type": "string", "minLength": 1, "maxLength": 128}, "build": {"type": "string", "minLength": 1, "maxLength": 128}},
|
|
94
|
-
"required": ["version", "build"],
|
|
95
|
-
"additionalProperties": false
|
|
96
|
-
},
|
|
97
|
-
"simulatorRuntimes": {
|
|
98
|
-
"type": "array",
|
|
99
|
-
"items": {
|
|
100
|
-
"type": "object",
|
|
101
|
-
"properties": {"id": {"type": "string", "minLength": 1, "maxLength": 256}, "version": {"type": "string", "minLength": 1, "maxLength": 128}, "available": {"type": "boolean"}},
|
|
102
|
-
"required": ["id", "version", "available"],
|
|
103
|
-
"additionalProperties": false
|
|
104
|
-
},
|
|
105
|
-
"maxItems": 256
|
|
106
|
-
},
|
|
107
|
-
"graphicalSession": {"type": ["boolean", "null"]}
|
|
108
|
-
},
|
|
109
|
-
"required": ["os", "arch", "nodeVersion", "graphicalSession"],
|
|
110
|
-
"additionalProperties": false
|
|
111
|
-
},
|
|
112
|
-
"capacity": {"$ref": "#/$defs/resourceAmounts"},
|
|
113
|
-
"occupied": {"$ref": "#/$defs/resourceAmounts"},
|
|
114
|
-
"available": {"$ref": "#/$defs/resourceAmounts"},
|
|
115
|
-
"accepting": {"type": "boolean"},
|
|
116
|
-
"reason": {"$ref": "#/$defs/reason"},
|
|
117
|
-
"observedAt": {"$ref": "#/$defs/timestamp"},
|
|
118
|
-
"observedRevision": {"type": "string", "minLength": 1, "maxLength": 2048},
|
|
119
|
-
"executionFeatures": {
|
|
120
|
-
"type": "object",
|
|
121
|
-
"properties": {
|
|
122
|
-
"multiResource": {"const": false},
|
|
123
|
-
"multiUnit": {"const": false},
|
|
124
|
-
"exclusive": {"type": "boolean"},
|
|
125
|
-
"noResources": {"type": "boolean"},
|
|
126
|
-
"namedResources": {"type": "boolean"},
|
|
127
|
-
"context": {"type": "boolean"}
|
|
128
|
-
},
|
|
129
|
-
"required": ["multiResource", "multiUnit", "exclusive"],
|
|
130
|
-
"additionalProperties": false
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
"required": [],
|
|
134
|
-
"additionalProperties": false,
|
|
135
|
-
"anyOf": [
|
|
136
|
-
{"maxProperties": 0},
|
|
137
|
-
{
|
|
138
|
-
"required": ["detectedLabels", "capabilities", "capacity", "occupied", "available", "accepting", "observedAt", "observedRevision", "executionFeatures"]
|
|
139
|
-
}
|
|
140
|
-
],
|
|
141
|
-
"description": "空对象表示未知;非空为持有端最近观察到的事实,不是在线或预留保证"
|
|
142
|
-
},
|
|
143
|
-
"operations": {}
|
|
144
|
-
}
|