@coda-console/protocol 2.6.0 → 3.1.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.
@@ -1,89 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://coda.pub/schemas/executor/v1/common.json",
4
- "title": "运行器协议共享静态定义",
5
- "definitions": {
6
- "opaqueId": {"type": "string", "minLength": 1, "maxLength": 2048, "description": "适配层给出的不透明标识;不解析或拼接机器路由"},
7
- "resourceRef": {
8
- "type": "object",
9
- "properties": {"kind": {"type": "string", "minLength": 1, "maxLength": 128}, "id": {"$ref": "common.json#/definitions/opaqueId"}},
10
- "required": ["kind", "id"],
11
- "additionalProperties": false
12
- },
13
- "executorRef": {
14
- "type": "object",
15
- "properties": {"kind": {"const": "executor"}, "id": {"$ref": "common.json#/definitions/opaqueId"}},
16
- "required": ["kind", "id"],
17
- "additionalProperties": false
18
- },
19
- "snapshotRef": {
20
- "type": "object",
21
- "properties": {"kind": {"const": "sourceSnapshot"}, "id": {"$ref": "common.json#/definitions/opaqueId"}},
22
- "required": ["kind", "id"],
23
- "additionalProperties": false
24
- },
25
- "repositoryRef": {
26
- "type": "object",
27
- "properties": {"kind": {"const": "gitSource"}, "id": {"$ref": "common.json#/definitions/opaqueId"}},
28
- "required": ["kind", "id"],
29
- "additionalProperties": false
30
- },
31
- "labels": {
32
- "type": "array",
33
- "items": {"type": "string", "minLength": 1, "maxLength": 40, "pattern": "^[a-z0-9][a-z0-9._-]*$(?![\\s\\S])"},
34
- "maxItems": 64,
35
- "uniqueItems": true
36
- },
37
- "userLabels": {
38
- "type": "array",
39
- "items": {
40
- "type": "string",
41
- "minLength": 1,
42
- "maxLength": 40,
43
- "pattern": "^[a-z0-9][a-z0-9._-]*$(?![\\s\\S])",
44
- "not": {
45
- "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)-"
46
- }
47
- },
48
- "maxItems": 64,
49
- "uniqueItems": true,
50
- "description": "用户自定义标签,不占用 OS、架构、gui 与 xcode-/ios-/node- 探测命名空间"
51
- },
52
- "resourceName": {
53
- "type": "string",
54
- "pattern": "^(?:slots|group:(?!host$(?![\\s\\S]))[^\\s\\u0000-\\u001f\\u007f]{1,100})$(?![\\s\\S])",
55
- "description": "slots 对应 host;其他本机命名组用 group:<原名>,不将不同组折叠为 slots"
56
- },
57
- "resourceAmounts": {
58
- "type": "object",
59
- "propertyNames": {"$ref": "common.json#/definitions/resourceName"},
60
- "maxProperties": 128,
61
- "additionalProperties": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},
62
- "description": "可报告多个独立资源的容量;每个请求仍至多申请一个资源的一单位"
63
- },
64
- "reason": {
65
- "type": "object",
66
- "properties": {
67
- "code": {"type": "string", "minLength": 1, "maxLength": 128},
68
- "message": {"type": "string", "minLength": 1, "maxLength": 4096}
69
- },
70
- "required": ["code", "message"],
71
- "additionalProperties": false
72
- },
73
- "timestamp": {
74
- "type": "string",
75
- "minLength": 1,
76
- "maxLength": 40,
77
- "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])",
78
- "description": "UTC 时间文字;schema 检查形状,真实日历时间由写入方保证"
79
- },
80
- "assignmentId": {"type": "string", "minLength": 1, "maxLength": 256, "description": "每次绑定生成的新 token,与 executor 同次 CAS 更新"},
81
- "workingDirectory": {
82
- "type": "string",
83
- "minLength": 1,
84
- "maxLength": 4096,
85
- "pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])(?!.*(?:^|/)\\.\\.(?:/|$)).+$",
86
- "description": "工作根下的相对路径;拒绝绝对路径、反斜线和 .. 段,真实落点与符号链接仍须执行方检查"
87
- }
88
- }
89
- }
@@ -1,246 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://coda.pub/schemas/executor/v1/execution.json",
4
- "title": "execution:一次执行尝试的请求与完整结果",
5
- "type": "object",
6
- "properties": {
7
- "spec": {
8
- "type": "object",
9
- "properties": {
10
- "protocolVersion": {"const": 1},
11
- "run": {"$ref": "common.json#/definitions/resourceRef"},
12
- "step": {"type": "string", "minLength": 1, "maxLength": 256},
13
- "attempt": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
14
- "source": {
15
- "oneOf": [
16
- {"type": "null"},
17
- {
18
- "type": "object",
19
- "properties": {"snapshot": {"$ref": "common.json#/definitions/snapshotRef"}},
20
- "required": ["snapshot"],
21
- "additionalProperties": false
22
- },
23
- {
24
- "type": "object",
25
- "properties": {
26
- "repository": {"$ref": "common.json#/definitions/repositoryRef"},
27
- "commit": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$(?![\\s\\S])"}
28
- },
29
- "required": ["repository", "commit"],
30
- "additionalProperties": false
31
- }
32
- ]
33
- },
34
- "requirements": {
35
- "type": "object",
36
- "properties": {"labels": {"$ref": "common.json#/definitions/labels"}},
37
- "required": ["labels"],
38
- "additionalProperties": false
39
- },
40
- "placement": {
41
- "type": "object",
42
- "properties": {
43
- "locality": {"enum": ["local", "any"], "default": "any"},
44
- "executor": {"$ref": "common.json#/definitions/executorRef"}
45
- },
46
- "additionalProperties": false,
47
- "description": "生产者的硬约束,不是调度绑定;省略等同 any。指定 executor 与 locality 必须同时满足,不能隐式回退"
48
- },
49
- "resources": {
50
- "type": "object",
51
- "propertyNames": {"$ref": "common.json#/definitions/resourceName"},
52
- "maxProperties": 1,
53
- "additionalProperties": {"const": 1},
54
- "description": "空对象表示不占资源;否则只申请一个资源的一单位,不接受多单位或资源向量"
55
- },
56
- "exclusiveResources": {
57
- "type": "array",
58
- "items": {"$ref": "common.json#/definitions/resourceName"},
59
- "maxItems": 1,
60
- "uniqueItems": true,
61
- "default": [],
62
- "description": "空数组或独占申请的那一个资源;执行方核对与 resources 的键一致,不换算成容量数字"
63
- },
64
- "context": {
65
- "type": "object",
66
- "properties": {
67
- "workflow": {
68
- "type": "object",
69
- "properties": {
70
- "name": {"type": "string", "minLength": 1, "maxLength": 256},
71
- "job": {"type": "string", "minLength": 1, "maxLength": 256},
72
- "runId": {"$ref": "common.json#/definitions/opaqueId"},
73
- "runAttempt": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
74
- "sha": {"type": "string", "pattern": "^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})?$(?![\\s\\S])"},
75
- "ref": {"type": "string", "maxLength": 1024},
76
- "repository": {"type": "string", "maxLength": 2048}
77
- },
78
- "required": ["name", "job", "runId", "runAttempt", "sha", "ref", "repository"],
79
- "additionalProperties": false
80
- },
81
- "plugin": {
82
- "type": "object",
83
- "properties": {
84
- "id": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,39}$(?![\\s\\S])"},
85
- "version": {"type": "string", "minLength": 1, "maxLength": 128}
86
- },
87
- "required": ["id", "version"],
88
- "additionalProperties": false
89
- },
90
- "audience": {"const": "user"},
91
- "outputNames": {"type": "array", "maxItems": 64, "uniqueItems": true,
92
- "items": {"type": "string", "minLength": 1, "maxLength": 128}}
93
- },
94
- "additionalProperties": false,
95
- "description": "可信生产者给出的运行上下文与输出声明;不是环境快照或授权凭证,本机路径和密文不进入此字段"
96
- },
97
- "task": {
98
- "oneOf": [
99
- {
100
- "type": "object",
101
- "properties": {
102
- "script": {"type": "string", "minLength": 1, "maxLength": 65536},
103
- "shell": {"type": "string", "minLength": 1, "maxLength": 4096}
104
- },
105
- "required": ["script", "shell"],
106
- "additionalProperties": false
107
- },
108
- {
109
- "type": "object",
110
- "properties": {
111
- "command": {"type": "string", "minLength": 1, "maxLength": 4096},
112
- "args": {"type": "array", "items": {"type": "string", "minLength": 0, "maxLength": 16384}, "maxItems": 256}
113
- },
114
- "required": ["command", "args"],
115
- "additionalProperties": false
116
- }
117
- ]
118
- },
119
- "workingDirectory": {"$ref": "common.json#/definitions/workingDirectory", "default": "."},
120
- "env": {
121
- "type": "object",
122
- "propertyNames": {"pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$(?![\\s\\S])"},
123
- "maxProperties": 128,
124
- "additionalProperties": {"type": "string", "minLength": 0, "maxLength": 16384}
125
- },
126
- "timeoutMs": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
127
- "cancelGraceMs": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},
128
- "cancel": {"type": "boolean", "default": false},
129
- "executor": {
130
- "oneOf": [{"type": "null"}, {"$ref": "common.json#/definitions/executorRef"}],
131
- "description": "scheduler 写入的顶层单值绑定,与 assignmentId 同次 CAS 更新,不参与补充合并"
132
- },
133
- "assignmentId": {"oneOf": [{"type": "null"}, {"$ref": "common.json#/definitions/assignmentId"}]}
134
- },
135
- "required": ["protocolVersion", "run", "attempt", "source", "requirements", "resources", "task", "env", "executor", "assignmentId"],
136
- "additionalProperties": false,
137
- "allOf": [
138
- {
139
- "if": {"properties": {"resources": {"maxProperties": 0}}},
140
- "then": {"properties": {"exclusiveResources": {"maxItems": 0}}}
141
- },
142
- {
143
- "if": {"properties": {"executor": {"type": "null"}}},
144
- "then": {"properties": {"assignmentId": {"type": "null"}}},
145
- "else": {"properties": {"assignmentId": {"$ref": "common.json#/definitions/assignmentId"}}}
146
- }
147
- ],
148
- "description": "一次执行尝试;绑定后任务、源码和需求冻结,取消为单向意图"
149
- },
150
- "status": {
151
- "type": "object",
152
- "properties": {
153
- "phase": {"enum": ["queued", "preparing", "running", "finished"]},
154
- "reason": {"$ref": "common.json#/definitions/reason"},
155
- "assignmentId": {"oneOf": [{"type": "null"}, {"$ref": "common.json#/definitions/assignmentId"}]},
156
- "startedAt": {"$ref": "common.json#/definitions/timestamp"},
157
- "finishedAt": {"$ref": "common.json#/definitions/timestamp"},
158
- "executionRun": {"$ref": "common.json#/definitions/resourceRef"},
159
- "admission": {"oneOf": [{"type": "null"}, {
160
- "type": "object",
161
- "properties": {
162
- "resource": {"$ref": "common.json#/definitions/resourceName"},
163
- "lease": {"$ref": "common.json#/definitions/opaqueId"},
164
- "slots": {
165
- "type": "array",
166
- "items": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},
167
- "maxItems": 4096,
168
- "minItems": 1,
169
- "uniqueItems": true
170
- }
171
- },
172
- "required": ["lease", "slots"],
173
- "additionalProperties": false
174
- }], "description": "无资源请求为 null;占资源须有真实 lease 与名额,resource 省略表示 slots。执行方按请求核对,不用 null 绕过准入"},
175
- "outcome": {"enum": ["succeeded", "failed", "cancelled", "rejected"]},
176
- "exitCode": {"type": ["integer", "null"]},
177
- "outputs": {
178
- "type": "object",
179
- "maxProperties": 64,
180
- "propertyNames": {"type": "string", "minLength": 1, "maxLength": 128},
181
- "additionalProperties": {"type": "string", "minLength": 0, "maxLength": 4096}
182
- },
183
- "summary": {"type": "string", "minLength": 0, "maxLength": 4096},
184
- "outputTail": {"type": "string", "minLength": 0, "maxLength": 16384},
185
- "logs": {
186
- "type": "array",
187
- "items": {
188
- "type": "object",
189
- "properties": {
190
- "ref": {"$ref": "common.json#/definitions/resourceRef"},
191
- "cursor": {"type": "string", "minLength": 1, "maxLength": 2048}
192
- },
193
- "required": ["ref"],
194
- "additionalProperties": false
195
- },
196
- "maxItems": 64
197
- },
198
- "artifacts": {
199
- "type": "array",
200
- "items": {
201
- "type": "object",
202
- "properties": {
203
- "ref": {"$ref": "common.json#/definitions/resourceRef"},
204
- "name": {"type": "string", "minLength": 1, "maxLength": 256},
205
- "sha256": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[0-9a-fA-F]{64}$"},
206
- "size": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},
207
- "mediaType": {"type": "string", "minLength": 1, "maxLength": 256}
208
- },
209
- "required": ["ref", "name"],
210
- "additionalProperties": false
211
- },
212
- "maxItems": 64
213
- }
214
- },
215
- "required": [],
216
- "additionalProperties": false,
217
- "anyOf": [{"maxProperties": 0}, {"required": ["phase", "assignmentId"]}],
218
- "allOf": [
219
- {
220
- "if": {"properties": {"phase": {"const": "finished"}}, "required": ["phase"]},
221
- "then": {"required": ["outcome", "finishedAt"]},
222
- "else": {"not": {"anyOf": [{"required": ["outcome"]}, {"required": ["exitCode"]}, {"required": ["finishedAt"]}]}}
223
- },
224
- {
225
- "if": {"properties": {"phase": {"enum": ["preparing", "running"]}}, "required": ["phase"]},
226
- "then": {"properties": {"assignmentId": {"$ref": "common.json#/definitions/assignmentId"}}}
227
- },
228
- {
229
- "if": {"properties": {"phase": {"const": "running"}}, "required": ["phase"]},
230
- "then": {"required": ["startedAt", "executionRun", "admission"]}
231
- },
232
- {
233
- "if": {"properties": {"outcome": {"enum": ["succeeded", "failed"]}}, "required": ["outcome"]},
234
- "then": {"properties": {"assignmentId": {"$ref": "common.json#/definitions/assignmentId"}}, "required": ["startedAt"]}
235
- },
236
- {
237
- "if": {"properties": {"outcome": {"const": "rejected"}}, "required": ["outcome"]},
238
- "then": {"not": {"required": ["startedAt"]}, "properties": {"exitCode": {"type": "null"}}}
239
- }
240
- ],
241
- "description": "空对象表示未知;绑定后由执行方完整回传,按 assignmentId 区分旧回答"
242
- }
243
- },
244
- "required": ["spec", "status"],
245
- "additionalProperties": false
246
- }
@@ -1,98 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://coda.pub/schemas/executor/v1/executor.json",
4
- "title": "executor:运行器配置意图与持有端事实",
5
- "type": "object",
6
- "properties": {
7
- "spec": {
8
- "type": "object",
9
- "properties": {
10
- "protocolVersion": {"const": 1},
11
- "enabled": {"type": "boolean"},
12
- "capacity": {"$ref": "common.json#/definitions/resourceAmounts"},
13
- "labels": {"$ref": "common.json#/definitions/userLabels"},
14
- "title": {"type": "string", "minLength": 1, "maxLength": 200}
15
- },
16
- "required": ["protocolVersion", "enabled", "capacity", "labels"],
17
- "additionalProperties": false,
18
- "description": "运行器配置意图;无 target,由持有端维护"
19
- },
20
- "status": {
21
- "type": "object",
22
- "properties": {
23
- "detectedLabels": {"$ref": "common.json#/definitions/labels"},
24
- "capabilities": {
25
- "type": "object",
26
- "properties": {
27
- "os": {"type": "string", "minLength": 1, "maxLength": 40},
28
- "arch": {"type": "string", "minLength": 1, "maxLength": 40},
29
- "nodeVersion": {"type": "string", "minLength": 1, "maxLength": 128},
30
- "xcode": {
31
- "type": "object",
32
- "properties": {
33
- "version": {"type": "string", "minLength": 1, "maxLength": 128},
34
- "build": {"type": "string", "minLength": 1, "maxLength": 128}
35
- },
36
- "required": ["version", "build"],
37
- "additionalProperties": false
38
- },
39
- "simulatorRuntimes": {
40
- "type": "array",
41
- "items": {
42
- "type": "object",
43
- "properties": {
44
- "id": {"type": "string", "minLength": 1, "maxLength": 256},
45
- "version": {"type": "string", "minLength": 1, "maxLength": 128},
46
- "available": {"type": "boolean"}
47
- },
48
- "required": ["id", "version", "available"],
49
- "additionalProperties": false
50
- },
51
- "maxItems": 256
52
- },
53
- "graphicalSession": {"type": ["boolean", "null"]}
54
- },
55
- "required": ["os", "arch", "nodeVersion", "graphicalSession"],
56
- "additionalProperties": false
57
- },
58
- "capacity": {"$ref": "common.json#/definitions/resourceAmounts"},
59
- "occupied": {"$ref": "common.json#/definitions/resourceAmounts"},
60
- "available": {"$ref": "common.json#/definitions/resourceAmounts"},
61
- "accepting": {"type": "boolean"},
62
- "reason": {"$ref": "common.json#/definitions/reason"},
63
- "observedAt": {"$ref": "common.json#/definitions/timestamp"},
64
- "observedRevision": {"$ref": "common.json#/definitions/opaqueId"},
65
- "executionFeatures": {
66
- "type": "object",
67
- "properties": {
68
- "multiResource": {"const": false}, "multiUnit": {"const": false}, "exclusive": {"type": "boolean"},
69
- "noResources": {"type": "boolean"}, "namedResources": {"type": "boolean"}, "context": {"type": "boolean"}
70
- },
71
- "required": ["multiResource", "multiUnit", "exclusive"],
72
- "additionalProperties": false
73
- }
74
- },
75
- "required": [],
76
- "additionalProperties": false,
77
- "anyOf": [
78
- {"maxProperties": 0},
79
- {
80
- "required": [
81
- "detectedLabels",
82
- "capabilities",
83
- "capacity",
84
- "occupied",
85
- "available",
86
- "accepting",
87
- "observedAt",
88
- "observedRevision",
89
- "executionFeatures"
90
- ]
91
- }
92
- ],
93
- "description": "空对象表示未知;非空为持有端完整事实,不是在线或预留保证"
94
- }
95
- },
96
- "required": ["spec", "status"],
97
- "additionalProperties": false
98
- }