@coda-console/protocol 6.7.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 +13 -0
- package/README.md +2 -3
- package/docs/protocol.md +14 -15
- package/package.json +1 -1
- package/protocol.mjs +1 -2
- package/schemas/plugin/commands.json +2 -2
- package/schemas/plugin/protocol-implementations.json +22 -3
- package/validate.mjs +7 -4
- package/schemas/protocol/v1/executor.json +0 -144
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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
|
+
|
|
10
|
+
## 6.8.0 — 2026-11-17
|
|
11
|
+
|
|
12
|
+
- 这是在 6.7.0 之上的次版本。依据 README「版本」一节:清单的通用键放宽写法、旧写法照旧通过,升次版本(Coda 宿主设计 coda#2749 第 4、5 节与 6.7 节)。
|
|
13
|
+
- `contributes.protocolImplementations` 的每一项除了协议名(文本,这个协议的全部操作由模块实现),也可以是对象 `{ kind, commands }`:`kind` 是协议名;`commands` 至少一项,键是操作名(只按定义里 `operations` 键名的格式校验,在不在定义里由 Coda 装载时查),值是插件目录里的文件(`x-file`);没列在 `commands` 里的操作由模块实现;不允许别的键。上限仍是 100 项。
|
|
14
|
+
- 同一个协议在数组里只能出现一次,文本加对象、两个对象也算重复(原来的 `uniqueItems` 管不到混写)。为此 `x-unique-by` 加写法 `{ key, text: true }`:文本项按它自己的值、对象项按 `key` 属性的值一并查重;`docs/protocol.md` 同步写清两种写法。已有的纯文本写法不受影响。
|
|
15
|
+
- `contributes.commands` 的保留名单改了:宿主 H5 在同一次交付里把 `coda-run`、`coda-event`、`coda-resources` 并成一个 `coda`、删掉旧名(coda#2749 6.7 节第 3 条)。现在插件的命令不能叫 `coda`;`coda-run`、`coda-event`、`coda-resources` 不再保留,可以用。`schemas/plugin/commands.json` 的 `name` 描述同步。
|
|
16
|
+
- 版本判断:不升主版本,升到 6.8.0。`contributes.commands[].name` 虽在稳定面,但稳定面条目没有登记取值(`values`),承诺的只是「这个键存在、可写命令名」;保留名是 Coda 自己占用的命令名,插件写 `coda` 会盖掉宿主工具,本就不是被承诺的用法。三个旧名放开是放宽,只多接受;新增的 `coda` 只会拒掉一个从未被承诺、也没有已知插件在用的名字(样本里没有),三道检查都不受影响。
|
|
17
|
+
|
|
5
18
|
## 6.7.0 — 2026-11-17
|
|
6
19
|
|
|
7
20
|
- 这是在 6.6.0 之上的次版本。依据 README「版本」一节:协议定义是内部面,新增可选字段升次版本,先例见 6.4.0(`deadline`)。
|
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 删除。
|
|
@@ -187,7 +187,19 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
|
|
|
187
187
|
}
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
`contributes.protocols` 是插件拥有的定义,每份都按定义文档 schema 校验;定义里的命名空间必须等于插件 ID。`contributes.protocolImplementations`
|
|
190
|
+
`contributes.protocols` 是插件拥有的定义,每份都按定义文档 schema 校验;定义里的命名空间必须等于插件 ID。`contributes.protocolImplementations` 是插件实现的协议列表,可以包含别的命名空间下的协议(包括 `coda/...`),最多 100 项。每项有两种写法:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
"protocolImplementations": [
|
|
194
|
+
"my-plugin/task@1",
|
|
195
|
+
{"kind": "coda/run@1", "commands": {"cancel": "bin/cancel.sh"}}
|
|
196
|
+
]
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
- 协议名(文本):这个协议的全部操作都由模块实现。
|
|
200
|
+
- `{ "kind": "<协议名>", "commands": { "<操作名>": "<文件>" } }`:`commands` 至少一项,键是操作名(格式同定义里 `operations` 的键,这个操作在不在协议定义里由 Coda 装载时查),值是插件目录里的文件(相对路径,不离开插件目录)。`commands` 里列出的操作由这个文件实现,**没列在 `commands` 里的操作由模块实现**。对象里不能有 `kind`、`commands` 之外的键。命令怎么写、怎么跑由 Coda 的文档讲,这里不重述。
|
|
201
|
+
|
|
202
|
+
同一个协议在数组里只能出现一次,写成文本还是对象都算。
|
|
191
203
|
|
|
192
204
|
`manifestProblem` 校验清单的外壳与通用键(这两个键在其中);别的键由 Coda 的贡献点登记表或某个插件的扩展点声明,按声明方的 schema 校验,本包不管它们的形状。命名空间约束需要插件 ID,单独用:
|
|
193
205
|
|
|
@@ -245,19 +257,6 @@ status:
|
|
|
245
257
|
}
|
|
246
258
|
```
|
|
247
259
|
|
|
248
|
-
## coda/executor@1
|
|
249
|
-
|
|
250
|
-
一台机器上的执行环境。记录格式取自 3.0.0 之前的 `executor`,版本改由协议名表达,spec 不再写 `protocolVersion`:spec 是 `enabled`、`capacity`、`labels` 和可选的 `title`;status 是探测到的标签、能力、容量与占用、`accepting`、观察时间和 `executionFeatures`。空 status `{}` 表示尚未观察到。
|
|
251
|
-
|
|
252
|
-
本协议没有操作:执行环境由持有它的机器自己维护,调用方不能经协议把一份工作交给它。脚本步骤的 `coda:runsOn` 只是对本机执行环境的要求,不符合就一开始失败,不会把步骤交给别台。
|
|
253
|
-
|
|
254
|
-
```json
|
|
255
|
-
{
|
|
256
|
-
"spec": {"enabled": true, "capacity": {"slots": 2}, "labels": ["build-lab"], "title": "Mac mini"},
|
|
257
|
-
"status": {}
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
260
|
## coda/agent@1
|
|
262
261
|
|
|
263
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);
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"type": "object",
|
|
9
9
|
"properties": {
|
|
10
10
|
"name": {
|
|
11
|
-
"description": "命令名:小写字母、数字和「-」,以字母开头,不能是 Coda 自己的 coda
|
|
11
|
+
"description": "命令名:小写字母、数字和「-」,以字母开头,不能是 Coda 自己的 coda",
|
|
12
12
|
"$ref": "common.json#/$defs/id",
|
|
13
|
-
"not": {"
|
|
13
|
+
"not": {"const": "coda"}
|
|
14
14
|
},
|
|
15
15
|
"command": {"$ref": "common.json#/$defs/command"}
|
|
16
16
|
},
|
|
@@ -2,9 +2,28 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://coda.pub/schemas/plugin/v2/protocol-implementations.json",
|
|
4
4
|
"title": "contributes.protocolImplementations:插件实现的协议",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "插件实现哪些协议,写协议名「命名空间/名字@大版本」。可以实现在别的命名空间下定义的协议。每项是文本(这个协议的全部操作由模块实现),或 { kind, commands }(commands 里列出的操作由插件目录里的命令实现,没列的由模块实现)。同一个协议只能出现一次,不论写成文本还是对象。",
|
|
6
6
|
"type": "array",
|
|
7
7
|
"maxItems": 100,
|
|
8
|
-
"
|
|
9
|
-
"items": {
|
|
8
|
+
"x-unique-by": [{"key": "kind", "text": true}],
|
|
9
|
+
"items": {
|
|
10
|
+
"if": {"type": "string"},
|
|
11
|
+
"then": {"$ref": "https://coda.pub/schemas/protocol/v1/definition.json#/$defs/name"},
|
|
12
|
+
"else": {
|
|
13
|
+
"description": "不是协议名时须为 { kind, commands },按命令实现这个协议的部分操作:kind 是协议名,commands 的键是操作名,值是插件目录里的文件",
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"kind": {"$ref": "https://coda.pub/schemas/protocol/v1/definition.json#/$defs/name"},
|
|
17
|
+
"commands": {
|
|
18
|
+
"description": "操作名 → 插件目录里的文件(相对路径,不离开插件目录),至少一项;操作是否在协议定义里由 Coda 装载时查",
|
|
19
|
+
"type": "object",
|
|
20
|
+
"minProperties": 1,
|
|
21
|
+
"propertyNames": {"$ref": "https://coda.pub/schemas/protocol/v1/definition.json#/$defs/operationName"},
|
|
22
|
+
"additionalProperties": {"type": "string", "x-file": {"type": "file"}}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": ["kind", "commands"],
|
|
26
|
+
"additionalProperties": false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
10
29
|
}
|
package/validate.mjs
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
// as Kubernetes extends its OpenAPI with `x-kubernetes-*`:
|
|
11
11
|
// - `x-unique-by`: [name, { part } or { key, nested }] — in an array, each named property of its objects is unique among the
|
|
12
12
|
// items having it, and so is `part`'s first group of each of its texts (a directory's last name), and `key` among the
|
|
13
|
-
// items and those in their `nested` arrays, at every depth (a task's answers and those offered on holding one)
|
|
13
|
+
// items and those in their `nested` arrays, at every depth (a task's answers and those offered on holding one), and with
|
|
14
|
+
// `text: true` a text item counts as the value of `key` itself (an item written as a name or as an object with it);
|
|
14
15
|
// - `x-max-contains`: { match, max } — of an object's values, at most `max` satisfy `match` (`maxContains` of an object);
|
|
15
16
|
// - `x-ref`: { pointer, part?, key?, split?, match? } — the value (or `part`'s first group of it), or each nonempty token
|
|
16
17
|
// separated by `split`, names a key of the object, or an element (with `key`, that property of an element)
|
|
@@ -60,7 +61,8 @@ const META = {
|
|
|
60
61
|
'x-max-contains': { type: 'object', properties: { match: SCHEMA_VALUE, max: { type: 'integer', minimum: 0 } }, required: ['match', 'max'], additionalProperties: false },
|
|
61
62
|
'x-unique-by': { type: 'array', minItems: 1, items: { anyOf: [{ type: 'string' },
|
|
62
63
|
{ type: 'object', properties: { part: { type: 'string' } }, required: ['part'], additionalProperties: false },
|
|
63
|
-
{ type: 'object', properties: { key: { type: 'string' }, nested: { type: 'string' } }, required: ['key', 'nested'], additionalProperties: false }
|
|
64
|
+
{ type: 'object', properties: { key: { type: 'string' }, nested: { type: 'string' } }, required: ['key', 'nested'], additionalProperties: false },
|
|
65
|
+
{ type: 'object', properties: { key: { type: 'string' }, text: { const: true } }, required: ['key', 'text'], additionalProperties: false }] } },
|
|
64
66
|
'x-ref': { type: 'object', properties: { pointer: { type: 'string', pattern: '^(?:\\d+(?:/.*)?|/.*)$' }, part: { type: 'string' }, key: { type: 'string' }, split: { type: 'string' }, match: SCHEMA_VALUE },
|
|
65
67
|
required: ['pointer'], additionalProperties: false },
|
|
66
68
|
'x-placeholders': { type: 'object', properties: { names: { type: 'array', items: { type: 'string' } }, config: SCHEMA_VALUE }, additionalProperties: false },
|
|
@@ -111,14 +113,15 @@ function keywords(ajv) {
|
|
|
111
113
|
return found;
|
|
112
114
|
};
|
|
113
115
|
return function unique(items) {
|
|
114
|
-
for (const { key, part, nested } of by) {
|
|
116
|
+
for (const { key, part, nested, text } of by) {
|
|
115
117
|
const seen = new Set();
|
|
116
118
|
for (const item of every(items, nested)) {
|
|
117
119
|
const value = part ? (typeof item === 'string' ? part.exec(item)?.[1] : undefined)
|
|
120
|
+
: text && typeof item === 'string' ? item
|
|
118
121
|
: item && typeof item === 'object' && Object.hasOwn(item, key) ? item[key] : undefined;
|
|
119
122
|
if (value === undefined) continue;
|
|
120
123
|
const said = JSON.stringify(value);
|
|
121
|
-
if (seen.has(said)) return fail(unique, 'x-unique-by', part ? `不能重复:${value}` : `${key} 不能重复:${value}`, parentSchema);
|
|
124
|
+
if (seen.has(said)) return fail(unique, 'x-unique-by', part || text ? `不能重复:${value}` : `${key} 不能重复:${value}`, parentSchema);
|
|
122
125
|
seen.add(said);
|
|
123
126
|
}
|
|
124
127
|
}
|
|
@@ -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
|
-
}
|