@coda-console/protocol 3.4.0 → 3.5.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,10 @@
2
2
 
3
3
  按 semver。协议自己的大版本写在协议名里(如 `coda/run@1`),与 npm 包版本、插件清单的 v2 独立;更早的版本见 git 历史。
4
4
 
5
+ ## 3.5.0 — 2026-11-09
6
+
7
+ - 流程参数的 `agent` 类型:值是一组 Agent 选择,与插件设置的 Agent 组合(`format: coda-agent`)相同:`agent`,以及可选的 `model`、`effort`、`mode`、`options`。不写 `default`;`defaultFrom="session.agent"` 是从会话发起、没给值时取那个会话的 Agent 选择,只用于这种参数(Coda #2303 第 4 步)。
8
+
5
9
  ## 3.4.0 — 2026-11-09
6
10
 
7
11
  - `coda/session@1` 的 `read`:都不带游标时读最新的 `limit` 条;写清 `before` 是这个游标之前最新的 `limit` 条、`more` 表示更早还有没有;消息总按先后排;`after` 与 `before` 不能同时带(Coda #2311)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coda-console/protocol",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Coda 的协议:插件清单的类型(JSON Schema)、通用校验器、协议定义与调用信封、流程方言与 Agent 接入协议",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "stepFailed": "STEP_FAILED",
21
21
  "variables": ["inputs", "run", "github", "vars"],
22
22
  "inputs": {
23
- "types": ["string", "boolean", "number", "branch"],
24
- "sources": {"session.branch": ["branch", "string"]}
23
+ "types": ["string", "boolean", "number", "branch", "agent"],
24
+ "sources": {"session.branch": ["branch", "string"], "session.agent": ["agent"]}
25
25
  }
26
26
  }
@@ -120,7 +120,7 @@
120
120
  {
121
121
  "name": "Input",
122
122
  "superClass": ["Element"],
123
- "description": "运行的一个输入:label 是表单上的名字,defaultFrom 是从会话发起、没给值时从哪里取(在 default 之前)",
123
+ "description": "运行的一个输入:label 是表单上的名字,defaultFrom 是从会话发起、没给值时从哪里取(在 default 之前);type 为 agent 的值是一组 Agent 选择(agent,以及可选的 model、effort、mode、options)",
124
124
  "properties": [
125
125
  {"name": "name", "isAttr": true, "type": "String"},
126
126
  {"name": "type", "isAttr": true, "type": "String"},
@@ -92,13 +92,15 @@
92
92
  "not": {"enum": ["__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__", "__proto__", "constructor", "hasOwnProperty", "isPrototypeOf",
93
93
  "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"]},
94
94
  "description": "name 不合法:须为字母开头的字母、数字、「_」,且不是 JavaScript 对象自带的名字(如 constructor、toString、__proto__):运行按名字记和取输入"},
95
- "type": {"enum": ["string", "boolean", "number", "branch"], "description": "type 只能是 string、boolean、number、branch"},
95
+ "type": {"enum": ["string", "boolean", "number", "branch", "agent"], "description": "type 只能是 string、boolean、number、branch、agent"},
96
96
  "label": {"type": "string", "pattern": "\\S", "maxLength": 40, "description": "label 须为 1–40 个字"},
97
- "defaultFrom": {"enum": ["session.branch"], "description": "defaultFrom 只能是 session.branch"}
97
+ "defaultFrom": {"enum": ["session.branch", "session.agent"], "description": "defaultFrom 只能是 session.branch 或 session.agent"}
98
98
  },
99
99
  "required": ["name"],
100
100
  "allOf": [
101
- {"if": {"required": ["defaultFrom"]}, "then": {"properties": {"type": {"enum": ["branch", "string"], "description": "defaultFrom=\"session.branch\" 只用于 type 为 branch、string 的参数"}}}},
101
+ {"if": {"required": ["defaultFrom"], "properties": {"defaultFrom": {"const": "session.branch"}}}, "then": {"properties": {"type": {"enum": ["branch", "string"], "description": "defaultFrom=\"session.branch\" 只用于 type 为 branch、string 的参数"}}}},
102
+ {"if": {"required": ["defaultFrom"], "properties": {"defaultFrom": {"const": "session.agent"}}}, "then": {"required": ["type"], "description": "defaultFrom=\"session.agent\" 只用于 type 为 agent 的参数", "properties": {"type": {"enum": ["agent"], "description": "defaultFrom=\"session.agent\" 只用于 type 为 agent 的参数"}}}},
103
+ {"if": {"required": ["type"], "properties": {"type": {"const": "agent"}}}, "then": {"not": {"required": ["default"]}, "description": "type 为 agent 的参数不写 default:值是一组 Agent 选择,从会话取用 defaultFrom=\"session.agent\""}},
102
104
  {"if": {"required": ["type"], "properties": {"type": {"const": "number"}}},
103
105
  "then": {"properties": {"default": {"pattern": "^\\s*[-+]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][-+]?\\d+)?\\s*$", "x-number": true, "description": "default 须为数字"}}}}
104
106
  ]