@coda-console/protocol 5.8.0 → 5.10.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 CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  按 semver。协议自己的大版本写在协议名里(如 `coda/run@1`),与 npm 包版本、插件清单的 v2 独立;更早的版本见 git 历史。
4
4
 
5
+ ## 5.10.0 — 2026-11-10
6
+
7
+ - 视图(`contributes.views` 的每项)加可选的 `provides`:作为附件来源时能交回的 part 类型,与 `coda/session@1` status 的 `accepts` 的键同一套,现在只有 `audio`。写了的视图出现在外部会话输入框的「+」里,只列会话 accepts 里有的类型;交回的方式由 Coda 客户端的视图桥定(Coda #2398)。
8
+
9
+ ## 5.9.0 — 2026-11-10
10
+
11
+ - 流程方言的脚本步骤加 `coda:source`:这一步在哪个工作副本目录里跑(本机绝对路径,可写 FEEL 表达式),只用于 `coda:checkout="false"` 的步骤,须与它同时写。本机就地跑、不检出;交给别的执行环境时,调用方给这个目录所在的工作副本拍快照(含未提交、未跟踪的改动,不含忽略的文件),对方检出快照并在对应的子目录里跑,用的是 `coda/executor@1` 的 `execute` 输入里已有的 `source.snapshot` 与 `workingDirectory`,执行器协议不改(Coda #2078 B2 前置)。
12
+
5
13
  ## 5.8.0 — 2026-11-10
6
14
 
7
15
  - `coda/session@1` 的 status 加可选的 `activity: { participant, text }`:参与者正在做什么,单行、至多 200 字符;停下时删掉,不是消息,不进 `read`,不推进 `head`。
package/README.md CHANGED
@@ -16,6 +16,8 @@ Coda 与插件之间的约定,Coda 和插件都引用它,独立演进:
16
16
 
17
17
  流程方言的 **卡片字段**由 `workflow/fields.json` 定义:七种字段各能写哪些属性、必填项、文字长度与单行限制、路径与网址、视图参数、输入框与密钥选项;`values.json` 的 `Field` 引用它,`Fields` 声明读出 JSON 字段列表的表达式,`UserTask.children` 限定最多 12 个静态字段、id 不重复,以及全部字段已知时答复的 `fields` 只能引用输入字段(含按住出现的答复)。
18
18
 
19
+ 脚本步骤的 **工作副本** 由 `coda:source` 声明:这一步在哪个工作副本目录里跑,写本机上的绝对路径,可以写 FEEL 表达式。它只用于 `coda:checkout="false"` 的步骤:在本机跑就在那个目录里就地跑,不检出提交;交给别的执行环境时,由调用方给这个目录所在的工作副本拍快照(含未提交、未跟踪的改动,不含忽略的文件),对方检出快照、在对应的子目录里跑。协议里 `coda/executor@1` 的 `execute` 输入已有 `source.snapshot` 与 `workingDirectory`,交给别台时就用这两项,执行器协议本身不改。
20
+
19
21
  定义和运行时共用这一份 schema。`x-deferred` 包住一个 schema:读定义时,文字先检查 FEEL,表达式或含 `{{ … }}` 的模板留到打开任务后查;运行时只按包住的 schema 严格检查,不再把结果当表达式。只有内容属性使用它,`type`、`id`、布尔值、枚举和 `maxLength` 不放宽。另有 `x-length`(沿用 Coda 的 UTF-16 长度,可用 `{ "property": "maxLength" }` 读取同一对象的上限)、`x-json`(解析 JSON 文字或检查 JSON 值,按序列化后的 UTF-8 字节数限制大小);`absolute-path`、`https-url`、`link-url` 三个 format 按本机路径与 URL 解析器检查;`link-url` 接受 https 网址或 `action=download-manifest` 且 `url` 解码后为 https 网址的 `itms-services:` 安装链接。已有的 `x-ref` 增加 `key`(按数组元素的属性引用)和 `split`(逐个检查分隔后的名字)。这些操作都不改写输入。
20
22
 
21
23
  `fieldProblem(field, where)` 检查一个已求值的字段;`fieldsProblem(fields, where)` 检查展开并应用 `host`/`dir` 后的数组,复用同一份字段 schema、数量和唯一性规则。两者合法时返回 `null`,否则返回「位置:说明」;`where` 是调用方给出的完整位置。schema 的 `default` 仅作标注:默认值填充、去空白、域名转小写、`args` 解析后的保留、表达式求值、动态字段展开和用户答复的处理仍由 Coda 完成。`coda:fields` 的 `host`/`dir` 是可能被覆盖或忽略的备用值,定义时只检查 FEEL,合并后才检查实际字段。动态字段展开后,答复的输入引用仍须由 Coda 检查。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coda-console/protocol",
3
- "version": "5.8.0",
3
+ "version": "5.10.0",
4
4
  "description": "Coda 的协议:插件清单的类型(JSON Schema)、通用校验器、协议定义与调用信封、流程方言与 Agent 接入协议",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://coda.pub/schemas/plugin/v2/views.json",
4
4
  "title": "contributes.views:客户端为插件打开的页面",
5
- "description": "插件目录里的 HTML,客户端在沙箱里开:在哪常驻(side 会话旁、page 一页),图标,接管打开的引用种类(handles,像 VS Code 的自定义编辑器),读数(readout),只给哪种工作位置的会话(checkout)与占位(frame:document 由客户端整页滚动、横向锁死,canvas 铺满视图、自己滚动)。",
5
+ "description": "插件目录里的 HTML,客户端在沙箱里开:在哪常驻(side 会话旁、page 一页),图标,接管打开的引用种类(handles,像 VS Code 的自定义编辑器),读数(readout),只给哪种工作位置的会话(checkout)与占位(frame:document 由客户端整页滚动、横向锁死,canvas 铺满视图、自己滚动),以及作为附件来源能交回的内容(provides)。",
6
6
  "type": "array",
7
7
  "maxItems": 10,
8
8
  "items": {
@@ -22,7 +22,14 @@
22
22
  },
23
23
  "readout": {"description": "读数:workflow-runs、machines、changes", "enum": ["workflow-runs", "machines", "changes"]},
24
24
  "checkout": {"description": "只给哪种工作位置的会话:worktree", "enum": ["worktree"]},
25
- "frame": {"description": "它怎么占位:document 由客户端整页滚动、横向锁死;canvas 铺满视图、自己滚动;不写暂与 canvas 相同", "enum": ["document", "canvas"]}
25
+ "frame": {"description": "它怎么占位:document 由客户端整页滚动、横向锁死;canvas 铺满视图、自己滚动;不写暂与 canvas 相同", "enum": ["document", "canvas"]},
26
+ "provides": {
27
+ "description": "作为附件来源时能交回的 part 类型,与会话 status.accepts 的键同一套(以后 accepts 加类型时两处一起加);写了的视图出现在外部会话输入框的「+」里,只列会话 accepts 里有的类型",
28
+ "type": "array",
29
+ "minItems": 1,
30
+ "uniqueItems": true,
31
+ "items": {"enum": ["audio"]}
32
+ }
26
33
  },
27
34
  "required": ["id", "title", "entry"],
28
35
  "additionalProperties": false
@@ -28,13 +28,14 @@
28
28
  "name": "ScriptTaskProperties",
29
29
  "isAbstract": true,
30
30
  "extends": ["bpmn:ScriptTask", "bpmn:ServiceTask"],
31
- "description": "脚本步骤(scriptTask)的:audience、group 运行时占的并发组、timeout 与 cancelTimeout(分钟)、workingDirectory、checkout、retry 网络失败时再跑几次(1 到 5)。写在 serviceTask 上只为提示脚本步骤要写成 scriptTask",
31
+ "description": "脚本步骤(scriptTask)的:audience、group 运行时占的并发组、timeout 与 cancelTimeout(分钟)、workingDirectory、source 在哪个工作副本目录里跑(本机绝对路径,可写表达式;只用于 checkout=\"false\")、checkout、retry 网络失败时再跑几次(1 到 5)。写在 serviceTask 上只为提示脚本步骤要写成 scriptTask",
32
32
  "properties": [
33
33
  {"name": "audience", "isAttr": true, "type": "String"},
34
34
  {"name": "group", "isAttr": true, "type": "String"},
35
35
  {"name": "timeout", "isAttr": true, "type": "Real"},
36
36
  {"name": "cancelTimeout", "isAttr": true, "type": "Real"},
37
37
  {"name": "workingDirectory", "isAttr": true, "type": "String"},
38
+ {"name": "source", "isAttr": true, "type": "String"},
38
39
  {"name": "checkout", "isAttr": true, "type": "String"},
39
40
  {"name": "retry", "isAttr": true, "type": "String"}
40
41
  ]
@@ -263,7 +263,7 @@
263
263
  ]
264
264
  },
265
265
  {
266
- "description": "coda:action 的步骤由 Coda 执行,不写脚本与 coda:audience、coda:group、coda:timeout、coda:checkout、coda:retry 等(要为一段占组用 hold-group)",
266
+ "description": "coda:action 的步骤由 Coda 执行,不写脚本与 coda:audience、coda:group、coda:timeout、coda:source、coda:checkout、coda:retry 等(要为一段占组用 hold-group)",
267
267
  "schema": {
268
268
  "allOf": [
269
269
  {
@@ -301,6 +301,11 @@
301
301
  "workingDirectory"
302
302
  ]
303
303
  },
304
+ {
305
+ "required": [
306
+ "source"
307
+ ]
308
+ },
304
309
  {
305
310
  "required": [
306
311
  "checkout"
@@ -330,6 +335,27 @@
330
335
  "bpmn:ServiceTask"
331
336
  ]
332
337
  },
338
+ {
339
+ "description": "写了 coda:source 的步骤在它给的工作副本目录里就地跑,不检出提交,须同时写 coda:checkout=\"false\"",
340
+ "schema": {
341
+ "required": [
342
+ "checkout"
343
+ ],
344
+ "properties": {
345
+ "checkout": {
346
+ "const": "false"
347
+ }
348
+ }
349
+ },
350
+ "on": [
351
+ "bpmn:ScriptTask"
352
+ ],
353
+ "when": {
354
+ "required": [
355
+ "source"
356
+ ]
357
+ }
358
+ },
333
359
  {
334
360
  "description": "callActivity 的 calledElement 写要调用的能力或流程名(小写字母、数字和「-」,以字母开头)",
335
361
  "schema": {
@@ -24,6 +24,8 @@
24
24
  "group": {"type": "string", "pattern": "^\\S{1,100}$", "description": "coda:group 须为 1–100 个非空白字符的组名"},
25
25
  "timeout": {"type": "number", "exclusiveMinimum": 0, "maximum": 1440, "description": "coda:timeout 须为 0–1440 之间的分钟数"},
26
26
  "cancelTimeout": {"type": "number", "exclusiveMinimum": 0, "maximum": 1440, "description": "coda:cancelTimeout 须为 0–1440 之间的分钟数"},
27
+ "source": {"type": "string", "pattern": "\\S", "x-feel": true,
28
+ "description": "coda:source 算出来须为这台机器上的绝对目录(可写表达式)"},
27
29
  "checkout": {"enum": ["true", "false"], "description": "coda:checkout 只能是 true 或 false"},
28
30
  "retry": {"type": "string", "pattern": "^[1-5]$", "description": "coda:retry 是失败后最多再试几次,须为 1 到 5 的整数"}
29
31
  }