@coda-console/plugin-check 0.5.28 → 0.5.30

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/README.md CHANGED
@@ -18,11 +18,12 @@ plugins/codex-accounts/ Codex 多账号:管理登录、自动续期与账号
18
18
  plugins/cursor/ Cursor:在运行机的 cursor-agent acp 与 Coda 之间转发,送入会话指令
19
19
  plugins/git/ Git 源与快照:本机仓库 provider、运行关联的工作树/提交快照、临时 ref 回收与只读 smart HTTP v2
20
20
  plugins/host/ 宿主资源:Xcode 构建、Apple 模拟器与项目要求排队的命令共用这台机器的一组名额(组 host、持锁执行 run-held、host-sim),面板「构建与模拟器名额」
21
+ plugins/scheduler/ 执行调度:为本机 execution 选择可用运行器,本机优先、按名额选择、安全改派与取消;政策和排队原因见插件 README
21
22
  plugins/magpie/ Magpie:把本机的 Magpie 网关作为模型服务提供给 Pi 等插件,安装时装好 Magpie 并让网关常驻
22
23
  plugins/network-log/ 网络记录:默认关闭,按需开启建连等待与定时探测采集;关闭后仍可查看历史
23
24
  plugins/review/ PR 生命流程:会话开的 PR 先跑项目的检查、再交叉评审,你批准后合并、部署与发布;也是写 PR 流程的样例
24
25
  plugins/testbed/ 测试机:长插在 Mac 上的 iPhone、iPad 只经 use-testbed 使用,排到后装 App、交给会话操作、用完切黑屏;依赖宿主资源
25
- plugins/composer/ 输入框模式:交接到新会话、子会话、! 执行命令、Ultra 与 /loop 循环;Ultra 模板设置为 composer.templates
26
+ plugins/composer/ 输入框模式与开发流程:Ultra 用 develop 委派代码修改,主 Agent 审查,设备验收后检查、批准、合并与部署;名单引用 composer.templates
26
27
  templates/agent/ 最小的 Agent 插件:手写 ACP 的回声 Agent,演示会话指令、插话、Agent 活动与自主轮次
27
28
  templates/panel/ 最小的面板插件:一张卡片、一条进度条、一个按钮
28
29
  bin/、check/ 契约检查(仓库根的 package.json 就是它,@coda-console/plugin-check);check/coda/ 是 Coda 同步来的规则副本,不要手改
@@ -59,8 +60,8 @@ Coda 插件页的「商店」列出 Coda 自带的插件,以及 npm 上 `@coda
59
60
 
60
61
  | 插件 | npm 依赖(与 Coda 后端同版本) | 运行机上另要 |
61
62
  | --- | --- | --- |
62
- | `codex` | `@agentclientprotocol/codex-acp` 1.12.0、`@openai/codex` 0.162.1;`overrides` 让 codex-acp 用同一个 `@openai/codex` | — |
63
- | `claude` | `@agentclientprotocol/sdk` 1.4.0、`@anthropic-ai/claude-agent-sdk` 0.3.296(平台二进制是 SDK 自己的可选依赖) | — |
63
+ | `codex` | `@agentclientprotocol/codex-acp` 1.12.0、`@openai/codex` 0.165.0;`overrides` 让 codex-acp 用同一个 `@openai/codex` | — |
64
+ | `claude` | `@agentclientprotocol/sdk` 1.4.0、`@anthropic-ai/claude-agent-sdk` 0.3.312(平台二进制是 SDK 自己的可选依赖) | — |
64
65
  | `codex-accounts` | `proper-lockfile` 4.1.2;用依赖插件 `codex` 的 Codex CLI | 无;依赖 `codex` 插件 |
65
66
  | `kimi` | 无 | Kimi CLI 2.1.1 及以上(设置动作安装或升级;面板可从 Coda 安装、登录) |
66
67
  | `grok` | 无 | Grok CLI 1.0.52 及以上(设置动作安装或升级;面板可从 Coda 安装、登录) |
@@ -239,6 +240,24 @@ Codex 调用 `clock.sleep` 时,会话底部显示一个后台等待项(例
239
240
  Codex 没有只取消单个 sleep 的接口,因此等待项不提供单独的停止按钮。正常结束、插话唤醒、整轮取消或失败都会了结等待,
240
241
  子 Agent 的等待归它自己的会话。
241
242
 
243
+ ### Codex 权限默认值与 Coda 工具
244
+
245
+ 从 codex 插件 1.9.0 起,未指定模式的会话默认「完全访问」(`agent-full-access`):Codex 原生轮次使用
246
+ `approvalPolicy: never`、`dangerFullAccess`,不再叠加 Codex 自己的文件与网络沙箱或自动审核。
247
+ 显式的 `INITIAL_AGENT_MODE`、Coda 保存或用户选择的模式仍优先;更新不强改已有会话的选择。
248
+ 这遵循「Agent 与它委派的流程命令统一由 Coda 约束」的方向。风险是 Codex 自身不再提供第二层隔离,
249
+ 实际能访问的文件、网络与执行命令取决于 Coda 的权限约束和运行机权限;离开 Coda 单独运行这个入口,也会得到该默认值。
250
+
251
+ 另一个独立变化是:Coda 通过 ACP 注入的保留名 `coda`、使用当前 Node 和 `src/adapters/mcp-shim.mjs`
252
+ 传输形状的 stdio MCP,设置 `default_tools_approval_mode = "approve"`。包括 `workflow_run` 发起批准卡在内的
253
+ Coda 工具调用直接到达 Coda,即使用户显式选了 Codex 自动审批模式,也不会先被 Codex 自动审核拦下。
254
+ 放行的是发起请求,Coda 的命令约束、流程审批及必须本人答复的卡片照常执行;这不是批准所请求的命令。
255
+ 其他 MCP 服务、同名 HTTP 服务,以及 codex-acp 去重时选用的已有原生配置服务不获得该例外。
256
+ 风险是 Coda 工具不再经过 Codex 的额外风险判断,因此依赖可信 ACP 宿主保留 `coda` 名称并由 Coda 正确执行权限边界。
257
+
258
+ 每台运行机在「设置 › 插件」更新 Codex 后,新启动的 Agent 进程才加载这些行为;正在运行的进程不变。
259
+ 已有会话保存了人工/自动审批模式时仍沿用,需要改变的在会话里手动选择「完全访问」。
260
+
242
261
  ### Codex 自动审核
243
262
 
244
263
  Codex 在运行一条命令或工具调用之前,可能先让自动审核判断风险、决定放不放行(codex-acp 报成一个叫「Guardian Review」的工具调用)。
@@ -486,7 +505,7 @@ CI 先装各插件的依赖再跑全部测试,`plugins/*` 只查清单:真
486
505
 
487
506
  MIT,见 [LICENSE](LICENSE)。各插件的品牌图形归各自权利人所有,来源写在插件的 `icons/README.md`。
488
507
 
489
- `plugins/codex/agent/` 里的 `relay.mjs`、`titles.mjs`、`network.mjs`、`process-exit.mjs`、`options.mjs`、`subagents.mjs`、`instructions.mjs`、`steering.mjs`、`providers.mjs`、`sleep.mjs` 在加载时给锁定版本的
508
+ `plugins/codex/agent/` 里的 `relay.mjs`、`titles.mjs`、`network.mjs`、`process-exit.mjs`、`options.mjs`、`subagents.mjs`、`instructions.mjs`、`steering.mjs`、`providers.mjs`、`sleep.mjs`、`mcp-policy.mjs` 在加载时给锁定版本的
490
509
  [codex-acp](https://github.com/agentclientprotocol/codex-acp)(Apache-2.0,Copyright 2025 JetBrains s.r.o.)打补丁,补丁里含 codex-acp 构建产物的原文片段。
491
510
  这些片段按 [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) 使用,许可全文也随 npm 包装在 `node_modules/@agentclientprotocol/codex-acp/LICENSE`;
492
511
  codex-acp 本身作为 npm 依赖安装,不在本仓库里。
@@ -1,4 +1,5 @@
1
1
  // The plugin host's local API. Controllers consume accepted objects serially per ID; they choose their own actions.
2
+ import { checkCreationReadOnly } from '../components/protocols/creation.mjs';
2
3
  export function providerAPI({ call, watch, connection, report = console.error }) {
3
4
  const observe = (kind, fn, scope = 'available') => watch(`provider:${kind}`, fn, { scope });
4
5
  return {
@@ -8,7 +9,7 @@ export function providerAPI({ call, watch, connection, report = console.error })
8
9
  return { resource, url: `${api.url}${path}`, headers: { authorization: `Bearer ${api.token}` } };
9
10
  },
10
11
  define: definition => call('define', [definition]),
11
- put: object => call('put', [object]),
12
+ put: async object => { checkCreationReadOnly(object); return call('put', [object]); },
12
13
  update: (kind, id, spec, revision) => call('update', [kind, id, spec, revision]),
13
14
  setStatus: (kind, id, status, revision) => call('setStatus', [kind, id, status, revision]),
14
15
  delete: (kind, id) => call('delete', [kind, id]),
@@ -589,7 +589,7 @@
589
589
  {
590
590
  "id": "session",
591
591
  "displayName": "会话生命周期",
592
- "description": "所有会话共用:存续期间管理空闲进程和任务转交,归档宽限后收尾,按设置回收托管工作树,限定同时执行的子会话。停用后不自动执行这些政策。",
592
+ "description": "所有会话共用:存续期间管理空闲进程和任务转交,归档宽限后收尾,按设置回收托管工作树,限定同时执行的子会话。停用后不执行生命周期政策;归档宽限后的 Agent 停止仍由 Coda 保障。",
593
593
  "version": "1.0.0",
594
594
  "category": "工作流程",
595
595
  "source": {
@@ -608,7 +608,7 @@
608
608
  "session.archiveGrace": {
609
609
  "type": "string",
610
610
  "format": "duration",
611
- "description": "所有会话从归档起算,期间取消归档就回到会话存续;收尾暂未完成时也按此间隔重试。",
611
+ "description": "所有会话从归档起算,期间取消归档就回到会话存续。Agent 停止期限在归档时保存,停用插件也生效;生命周期收尾暂未完成时也按此间隔重试。",
612
612
  "title": "归档后多久收尾",
613
613
  "order": 2,
614
614
  "default": "PT10M"
@@ -1034,15 +1034,15 @@
1034
1034
  {
1035
1035
  "id": "composer",
1036
1036
  "displayName": "输入框模式",
1037
- "description": "输入框的五种模式:交接到新会话、创建子会话、打 ! 执行命令、Ultra 协调模式,以及按周期重复任务的循环模式。Ultra 的主 Agent 负责决策、调度和验收,非微小任务交给 Coda 子会话执行。",
1038
- "version": "2.1.0",
1037
+ "description": "输入框可同时开启的五种模式:交接到新会话、从任意会话创建子会话、打 ! 执行命令、Ultra 协调模式,以及按周期重复任务的循环模式。Ultra 按需求交付,通过关联的开发流程委派功能,主 Agent 亲自审查、判断达标,统一验收与批准后按序合并、部署并在真实环境验证。",
1038
+ "version": "3.3.0",
1039
1039
  "category": "工作流程",
1040
1040
  "source": {
1041
1041
  "kind": "builtin",
1042
1042
  "package": "@coda-console/composer",
1043
1043
  "tag": "latest",
1044
- "version": "2.1.0",
1045
- "integrity": "sha512-vFT4hELREpRSTWXmxAyNCAvlWi6MjiXxBj15tyGUMopGLQqY7NzJj8M81kbY0XzoBqXm96wEzPlDZL6IfuRspg==",
1044
+ "version": "3.3.0",
1045
+ "integrity": "sha512-jpMDDngcUrMPCKhkvhGdqhhpzLYJgsdRFj9e7wl+c4J10j0dOjfmbczyDWqrugIozolXXJfHDxCfYoTKaRPvtw==",
1046
1046
  "repo": "https://github.com/coda-console/coda-plugins.git",
1047
1047
  "path": "plugins/composer"
1048
1048
  },
@@ -1051,7 +1051,7 @@
1051
1051
  "properties": {
1052
1052
  "composer.templates": {
1053
1053
  "type": "array",
1054
- "description": "进入 Ultra 时可选的名单,一行一个子 Agent:同一个模板名的几行是一个模板,排第一的模板是进入时的默认。默认没有模板,子 Agent 名单为空时沿用当前会话的 Agent 和模型。",
1054
+ "description": "进入 Ultra 时可选的名单,一行一个执行者:同一个模板名的几行是一个模板,排第一的模板是进入时的默认。默认没有模板,执行者名单为空时沿用当前会话的 Agent 和模型。",
1055
1055
  "title": "模板",
1056
1056
  "rows": {
1057
1057
  "type": "object",
@@ -1082,7 +1082,11 @@
1082
1082
  }
1083
1083
  },
1084
1084
  "main": "main.mjs",
1085
- "workflows": [],
1085
+ "startup": true,
1086
+ "workflows": [
1087
+ "deliver",
1088
+ "develop"
1089
+ ],
1086
1090
  "capabilities": [],
1087
1091
  "services": [],
1088
1092
  "groups": [],
@@ -1095,27 +1099,56 @@
1095
1099
  "id": "handoff",
1096
1100
  "title": "交接到新会话",
1097
1101
  "icon": "arrow.right.square",
1098
- "hint": "新会话承接这里的上下文,共享当前工作目录及其中的文件;这个会话保留,仍可继续使用。",
1102
+ "hint": "新会话承接这里的上下文,共享当前工作目录;可选择执行者,留空沿用输入框的执行者。可与其他模式同时开启,发送后退出交接模式。",
1099
1103
  "placeholder": "接下来要完成什么?",
1100
1104
  "sendLabel": "交接",
1101
- "agent": "own",
1105
+ "once": true,
1102
1106
  "in": [
1103
1107
  "session"
1104
- ]
1108
+ ],
1109
+ "parameters": {
1110
+ "properties": {
1111
+ "agent": {
1112
+ "type": "object",
1113
+ "format": "coda-agent",
1114
+ "description": "留空沿用输入框的执行者。",
1115
+ "title": "Agent",
1116
+ "order": 0
1117
+ }
1118
+ }
1119
+ },
1120
+ "schema": {
1121
+ "type": "object",
1122
+ "properties": {
1123
+ "agent": {
1124
+ "title": "Agent",
1125
+ "description": "留空沿用输入框的执行者。",
1126
+ "type": "object",
1127
+ "format": "coda-agent"
1128
+ }
1129
+ }
1130
+ }
1105
1131
  },
1106
1132
  {
1107
1133
  "id": "subagent",
1108
1134
  "title": "子会话",
1109
1135
  "icon": "arrow.triangle.branch",
1110
- "hint": "承接父会话近期上下文,沿用父会话工作目录;只启动子会话,不向父 Agent 发送这段要求。",
1136
+ "hint": "从当前会话创建子会话,承接近期上下文并沿用工作目录;子会话也可继续创建子会话。可选择执行者和回报对象,发送后退出本模式。",
1111
1137
  "placeholder": "描述交给子会话的任务…",
1112
1138
  "sendLabel": "启动子会话",
1113
- "agent": "own",
1139
+ "once": true,
1114
1140
  "in": [
1115
1141
  "session"
1116
1142
  ],
1117
1143
  "parameters": {
1118
1144
  "properties": {
1145
+ "agent": {
1146
+ "type": "object",
1147
+ "format": "coda-agent",
1148
+ "description": "留空沿用输入框的执行者。",
1149
+ "title": "Agent",
1150
+ "order": 0
1151
+ },
1119
1152
  "replyTo": {
1120
1153
  "type": "string",
1121
1154
  "enum": [
@@ -1132,13 +1165,19 @@
1132
1165
  ],
1133
1166
  "title": "回报对象",
1134
1167
  "default": "parent",
1135
- "order": 0
1168
+ "order": 1
1136
1169
  }
1137
1170
  }
1138
1171
  },
1139
1172
  "schema": {
1140
1173
  "type": "object",
1141
1174
  "properties": {
1175
+ "agent": {
1176
+ "title": "Agent",
1177
+ "description": "留空沿用输入框的执行者。",
1178
+ "type": "object",
1179
+ "format": "coda-agent"
1180
+ },
1142
1181
  "replyTo": {
1143
1182
  "title": "回报对象",
1144
1183
  "type": "string",
@@ -1166,7 +1205,7 @@
1166
1205
  "hint": "在会话工作目录执行,命令和结果作为这条消息发给 Agent。",
1167
1206
  "placeholder": "输入要执行的命令…",
1168
1207
  "sendLabel": "执行",
1169
- "agent": "off",
1208
+ "once": false,
1170
1209
  "trigger": "!",
1171
1210
  "in": [
1172
1211
  "session",
@@ -1177,23 +1216,18 @@
1177
1216
  "id": "ultra",
1178
1217
  "title": "Ultra",
1179
1218
  "icon": "square.stack.3d.up",
1180
- "hint": "节省主 Agent 的 Token,非微小任务交给子会话执行",
1219
+ "hint": "通过开发流程委派代码修改,主 Agent 亲自审查与验收;可与其他模式同时开启,点 × 退出。",
1181
1220
  "placeholder": "要完成什么?",
1182
- "agent": "session",
1221
+ "once": false,
1183
1222
  "in": [
1184
1223
  "session",
1185
1224
  "new"
1186
1225
  ],
1187
1226
  "parameters": {
1188
1227
  "properties": {
1189
- "template": {
1190
- "type": "string",
1191
- "title": "模板",
1192
- "order": 0
1193
- },
1194
1228
  "subagents": {
1195
1229
  "type": "array",
1196
- "title": "子 Agent",
1230
+ "title": "执行者",
1197
1231
  "rows": {
1198
1232
  "type": "object",
1199
1233
  "columns": {
@@ -1213,19 +1247,19 @@
1213
1247
  "who"
1214
1248
  ]
1215
1249
  },
1216
- "order": 1
1250
+ "presets": {
1251
+ "from": "composer.templates",
1252
+ "by": "template"
1253
+ },
1254
+ "order": 0
1217
1255
  }
1218
1256
  }
1219
1257
  },
1220
1258
  "schema": {
1221
1259
  "type": "object",
1222
1260
  "properties": {
1223
- "template": {
1224
- "title": "模板",
1225
- "type": "string"
1226
- },
1227
1261
  "subagents": {
1228
- "title": "子 Agent",
1262
+ "title": "执行者",
1229
1263
  "type": "array",
1230
1264
  "items": {
1231
1265
  "type": "object",
@@ -1243,6 +1277,10 @@
1243
1277
  "required": [
1244
1278
  "who"
1245
1279
  ]
1280
+ },
1281
+ "presets": {
1282
+ "from": "composer.templates",
1283
+ "by": "template"
1246
1284
  }
1247
1285
  }
1248
1286
  }
@@ -1252,10 +1290,10 @@
1252
1290
  "id": "loop",
1253
1291
  "title": "循环",
1254
1292
  "icon": "clock.arrow.2.circlepath",
1255
- "hint": "按周期把同一句话再发给 Agent,每轮做完才开始计时,7 天后自动结束",
1293
+ "hint": "按周期把同一句话再发给 Agent,每轮做完才开始计时,7 天后自动结束;可与其他模式同时开启,发送后退出循环模式。",
1256
1294
  "placeholder": "每轮要做什么?",
1257
1295
  "sendLabel": "开始循环",
1258
- "agent": "session",
1296
+ "once": true,
1259
1297
  "in": [
1260
1298
  "session"
1261
1299
  ],
@@ -1332,7 +1370,9 @@
1332
1370
  }
1333
1371
  ],
1334
1372
  "agents": [],
1335
- "dependencies": [],
1373
+ "dependencies": [
1374
+ "github"
1375
+ ],
1336
1376
  "extensionPoints": {},
1337
1377
  "extensions": [],
1338
1378
  "defaultInstalled": true
@@ -1341,14 +1381,14 @@
1341
1381
  "id": "grok",
1342
1382
  "displayName": "Grok",
1343
1383
  "description": "Grok Agent:适配运行机上 Grok CLI 的 ACP 与审批模式;资源页的「Grok」面板显示账号与额度,可从 Coda 安装和登录。",
1344
- "version": "1.3.3",
1384
+ "version": "1.4.0",
1345
1385
  "category": "Agent",
1346
1386
  "source": {
1347
1387
  "kind": "builtin",
1348
1388
  "package": "@coda-console/grok",
1349
1389
  "tag": "latest",
1350
- "version": "1.3.3",
1351
- "integrity": "sha512-59h5Kp3IjPerRjQJKnZNY1EnVJ+PBSnWK+U7ZfeYe6HeCDMVXmSaXhj1xmg2HY8xMRUGo4O8GqzYYHa5MntH+Q==",
1390
+ "version": "1.4.0",
1391
+ "integrity": "sha512-acq1OH9zrCN1qyfEpJpj0rJwwepzJkKsUM2E22Rh7Bk0IXpqkdbSnX8PYJsADCc6pRpjK0/P8ecYKK9146AZ1Q==",
1352
1392
  "repo": "https://github.com/coda-console/coda-plugins.git",
1353
1393
  "path": "plugins/grok"
1354
1394
  },
@@ -0,0 +1,35 @@
1
+ const string = { type: 'string', minLength: 1 };
2
+ const object = (properties, required = Object.keys(properties)) => ({ type: 'object', properties, required, additionalProperties: false });
3
+ const array = items => ({ type: 'array', items });
4
+ const values = { type: 'object' };
5
+ const mode = { type: 'string', pattern: '^[a-z][a-z0-9-]{0,39}/[a-z][a-z0-9-]{0,39}$' };
6
+ const agent = object({ agent: string, settings: values });
7
+ // Defaults live on the selected branch, so AJV applies `open` to thread targets only.
8
+ export const target = {
9
+ type: 'object', properties: { kind: { enum: ['message', 'thread', 'loop'] } }, required: ['kind'],
10
+ allOf: [
11
+ { if: { properties: { kind: { const: 'message' } } }, then: object({ kind: { const: 'message' }, thread: string, run: { type: 'boolean' } }, ['kind', 'thread']) },
12
+ { if: { properties: { kind: { const: 'thread' } } }, then: object({ kind: { const: 'thread' }, agent: object({ agent: string, model: string, effort: string, mode: string, options: values }, ['agent']), settings: values,
13
+ checkout: object({ kind: { enum: ['original', 'worktree', 'handoff'] }, baseRef: string }, ['kind']),
14
+ handoffSource: string, parentThreadId: string, replyTo: { enum: ['parent', 'sender'] }, run: { type: 'boolean' }, open: { type: 'boolean', default: true } }, ['kind']) },
15
+ { if: { properties: { kind: { const: 'loop' } } }, then: object({ kind: { const: 'loop' }, thread: string,
16
+ every: { type: 'string', pattern: '^P(?:(?:0|1)D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?)?$' } }) },
17
+ ],
18
+ };
19
+ const snapshotMode = object({ mode, values, sent: { type: 'integer', minimum: 0 }, changedSinceSent: { type: 'boolean' } });
20
+ export const composerType = { kind: 'composers', participants: () => [],
21
+ spec: { ...object({ thread: string, project: string, modes: array(object({ mode, values })) }, ['modes']),
22
+ oneOf: [{ required: ['thread'], not: { required: ['project'] } }, { required: ['project'], not: { required: ['thread'] } }] },
23
+ status: object({ modes: array(object({ mode, sent: { type: 'integer', minimum: 0 }, changedSinceSent: { type: 'boolean' }, presets: { type: 'object', additionalProperties: array(object({ name: {}, values: array(values) })) } })) }) };
24
+ const tell = array({ type: 'string', minLength: 1, maxLength: 4000, pattern: '^[^\\u0000]*\\S[^\\u0000]*$' });
25
+ const targets = array(target), divert = { type: 'boolean' };
26
+ export const submissionType = { kind: 'submissions',
27
+ participants: object => object.spec.modes.map(({ mode }) => { const [plugin, key] = mode.split('/'); return { plugin, key }; }),
28
+ spec: object({ composer: string, thread: { type: ['string', 'null'] }, projectId: string, text: { type: 'string', minLength: 1, maxLength: 100000 },
29
+ attachments: { ...array(string), maxItems: 20, uniqueItems: true }, quotes: { ...array({ type: 'string', maxLength: 20000 }), maxItems: 20 },
30
+ agent, modes: array(snapshotMode), defaultTarget: target, tell, targets, divert },
31
+ ['composer', 'thread', 'projectId', 'text', 'attachments', 'quotes', 'agent', 'modes', 'defaultTarget']),
32
+ contributions: { tell: { merge: 'append', schema: tell }, targets: { merge: 'append', schema: targets }, divert: { merge: 'or', schema: divert } },
33
+ status: object({ clearedDraftRevision: { type: ['integer', 'null'], minimum: 0 },
34
+ results: array(object({ target, requestId: string, inputId: { type: ['string', 'null'], minLength: 1 },
35
+ state: { enum: ['done', 'refused'] }, thread: string, code: string, message: string }, ['target', 'requestId', 'inputId', 'state'])) }) };
@@ -18,7 +18,7 @@ import { isDuration } from '../../domain/duration.mjs';
18
18
  import { AGENT_ID } from '../../domain/values.mjs';
19
19
  import { agentDeclarations } from './agent-plugins.mjs';
20
20
  import { checkCatalog, extensionsFor } from './plugin-extensions.mjs';
21
- import { manifestProblem, TYPES, valueProblem } from '@coda-console/protocol/validate';
21
+ import { manifestProblem, TYPES } from '@coda-console/protocol/validate';
22
22
  import { claims, COMMIT, INTEGRITY, NPM_VERSION, npmPluginId, repoAddress, sourcePath } from './plugin-source-rules.mjs';
23
23
  import { readSkillDocument } from './skill-document.mjs';
24
24
  import { executorLabels } from '../workflows/executor-labels.mjs';
@@ -78,12 +78,11 @@ const TELL_LIMIT = 4000;
78
78
  export const checkTold = text => check(typeof text === 'string' && text.trim() && text.length <= TELL_LIMIT && !text.includes('\0'), 'invalid_input',
79
79
  `要告诉的话须为不超过 ${TELL_LIMIT} 字的文字`);
80
80
  // The modes a composer can be put in (docs/plugins.md「输入框模式」, schemas/composer-modes.json), each with the composers
81
- // that offer it (`in`, a session's by default) and whom what is sent is for (`agent`, the session's by default); its
82
- // parameters read as settings are, and as written (JSON Schema), which its hooks are given (components/composer-modes).
81
+ // that offer it (`in`, a session's by default), whether it leaves after acceptance (`once`), and declarative parameters.
83
82
  const MODE_PLACES = ['session', 'new'];
84
83
  const composerModes = (modes = []) => modes.map((m, i) => ({ id: m.id, title: m.title.trim(), icon: m.icon,
85
84
  ...(m.hint ? { hint: m.hint.trim() } : {}), ...(m.placeholder ? { placeholder: m.placeholder.trim() } : {}),
86
- ...(m.sendLabel ? { sendLabel: m.sendLabel.trim() } : {}), agent: m.agent ?? 'session', ...(m.trigger ? { trigger: m.trigger } : {}),
85
+ ...(m.sendLabel ? { sendLabel: m.sendLabel.trim() } : {}), once: m.once === true, ...(m.trigger ? { trigger: m.trigger } : {}),
87
86
  in: m.in ? MODE_PLACES.filter(place => m.in.includes(place)) : ['session'],
88
87
  ...(m.parameters !== undefined ? { parameters: parametersOf(m.parameters, `contributes.composerModes[${i}].parameters`), schema: structuredClone(m.parameters) } : {}) }));
89
88
  // A mode's parameters as read: each a setting, in the order written, which the clients show them in (JSON's objects keep
@@ -92,17 +91,10 @@ function parametersOf(value, where) {
92
91
  const ordered = fields => Object.fromEntries(Object.entries(fields).map(([name, spec], i) => [name, { ...spec, order: spec.order ?? i }]));
93
92
  const properties = Object.fromEntries(Object.entries(value.properties).map(([name, p], i) => {
94
93
  const read = setting(p, `${where}.properties.${name}`);
95
- return [name, { ...read, ...(read.rows ? { rows: { ...read.rows, columns: ordered(read.rows.columns) } } : {}), order: read.order ?? i }];
94
+ return [name, { ...read, ...(p.presets ? { presets: structuredClone(p.presets) } : {}), ...(read.rows ? { rows: { ...read.rows, columns: ordered(read.rows.columns) } } : {}), order: read.order ?? i }];
96
95
  }));
97
96
  return { properties, ...(value.required?.length ? { required: [...value.required] } : {}) };
98
97
  }
99
- // Parameters a mode's hook gives while it runs, checked against the same schema a manifest's are.
100
- export function modeParameters(value, where) {
101
- const problem = valueProblem('composer-modes.json#/$defs/parameters', value, where);
102
- check(!problem, 'invalid_plugin', problem);
103
- return parametersOf(value, where);
104
- }
105
-
106
98
  // The category it is listed under (docs/plugins.md「商店」): the first of its manifest's `categories`, as VS Code's are
107
99
  // written; empty when it names none.
108
100
  export const manifestCategory = manifest => Array.isArray(manifest?.categories) && typeof manifest.categories[0] === 'string' ? manifest.categories[0].trim().slice(0, 32) : '';
@@ -0,0 +1,18 @@
1
+ // Holder-owned envelope fields. Sequence orders originals across kinds on one holder; time is only for display.
2
+ import { requireCondition as check } from '../../domain/errors.mjs';
3
+
4
+ export const creationProperties = {
5
+ createdAt: { type: 'string' },
6
+ creationSequence: { type: 'integer', minimum: 1, maximum: Number.MAX_SAFE_INTEGER },
7
+ };
8
+
9
+ export function creationOf(object) {
10
+ const { createdAt, creationSequence } = object;
11
+ check(typeof createdAt === 'string' && Number.isFinite(Date.parse(createdAt))
12
+ && Number.isSafeInteger(creationSequence) && creationSequence > 0, 'invalid_input', '协议对象缺少有效的创建信息');
13
+ return { createdAt, creationSequence };
14
+ }
15
+
16
+ export function checkCreationReadOnly(object) {
17
+ check(Object.keys(creationProperties).every(key => !Object.hasOwn(object, key)), 'invalid_input', '创建信息由持有方写入,只读');
18
+ }
@@ -63,6 +63,7 @@ export function mergeContributions(type, spec, answers) {
63
63
  validate(type.base, spec, `${type.kind}.spec`);
64
64
  checkParticipants(answers);
65
65
  const replies = structuredClone(answers);
66
+ for (const reply of replies) if (reply.value === null) reply.value = {};
66
67
  for (const { plugin, key, value } of replies) validate(type.answer, value, `插件 ${plugin}(${key})的补充`);
67
68
  const result = structuredClone(spec);
68
69
  for (const { value } of replies.sort((a, b) => compare(a.plugin, b.plugin) || compare(a.key, b.key))) {
@@ -51,11 +51,16 @@ export function modeMark(value) {
51
51
  return { id: value.id, title: text(value.title, '模式名', 40), icon: text(value.icon, '模式图标', 100) };
52
52
  }
53
53
 
54
+ export function modeMarks(value) {
55
+ check(Array.isArray(value), 'invalid_input', '输入框模式须为数组');
56
+ return value.map(modeMark);
57
+ }
58
+
54
59
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
55
60
  export function firstMessage(value) {
56
61
  object(value, '首次发送');
57
62
  keys(value, ['requestId', 'projectId', 'title', 'agent', 'checkout', 'settings', 'text', 'attachments', 'quotes', 'handoffSource', 'parentThreadId',
58
- 'replyTo', 'threadId', 'extensionParent', 'mode', 'initiatedBy']);
63
+ 'replyTo', 'threadId', 'extensionParent', 'modes', 'initiatedBy']);
59
64
  const initiatedBy = value.initiatedBy === undefined ? {} : (() => {
60
65
  const source = object(value.initiatedBy, '发起会话');
61
66
  keys(source, ['threadId', 'title']);
@@ -116,7 +121,7 @@ export function firstMessage(value) {
116
121
  settings: settings(value.settings),
117
122
  text: message,
118
123
  ...(passages.length ? { quotes: passages } : {}),
119
- ...(value.mode === undefined ? {} : { mode: modeMark(value.mode) }),
124
+ ...(value.modes === undefined ? {} : { modes: modeMarks(value.modes) }),
120
125
  }, attachments(value.attachments));
121
126
  }
122
127
 
@@ -1,24 +1,26 @@
1
1
  {
2
- "commit": "76b1759d9058652bc11eb1f2b62e574fc5c61f21",
2
+ "commit": "d130f12302569c26fe123bfa1db2891c2079e00b",
3
3
  "packages": {
4
4
  "@0dep/piso": "5.2.0",
5
5
  "@agentclientprotocol/sdk": "1.4.0",
6
- "@coda-console/protocol": "1.10.0",
6
+ "@coda-console/protocol": "2.0.0",
7
7
  "ajv": "8.20.0",
8
8
  "yaml": "2.9.1"
9
9
  },
10
10
  "files": {
11
+ "check/coda/components/protocols/creation.mjs": "d061194dafc615fff490869e90d252deb2429a12a3d5e046a886212ec3afede4",
11
12
  "check/coda/components/protocols/provider-definition.mjs": "98327f1900f84109fd5493d2de8f683eb020754245f3049869ca3b30468821f9",
12
- "check/coda/components/protocols/types.mjs": "c214787505f3b493eae8c89da79a3e7ea89e54945424ce227bea1fbcf35e826e",
13
- "check/coda/adapters/provider-api.mjs": "33f69042b3437b436fc5c1ceddacf99fff2fa849834bcb065e5d9ae35a2fa7ec",
13
+ "check/coda/components/protocols/types.mjs": "94bb3f30a3fcbe50e5a5c286fa84f4bd80951932adb582046a7820622415a229",
14
+ "check/coda/adapters/provider-api.mjs": "8a2b5d7b4a3766f9e28270bd355f4b4081d3069b4cedad120671995bea160253",
14
15
  "check/coda/adapters/admission-api.mjs": "47524434710b250e5aa4c5b41fefe40684186a88f33ccf5a4fa44f8b0dd3a45a",
16
+ "check/coda/components/composers/schemas.mjs": "5a78aa58cfe8c1aed1ed165bf373798664abc5b4e97d2d0ad6393e4e72960335",
15
17
  "check/coda/components/plugins/agent-plugins.mjs": "d117702f83c988aa89c2e5ae26aafd6ae3e8ba0829adaeedf9e8640f5f8282be",
16
18
  "check/coda/components/plugins/plugin-extensions.mjs": "4d7963185195ba6d21a4e49a66987613d5892210b1eb1dc02cffb7b816407776",
17
- "check/coda/components/plugins/plugin-rules.mjs": "bf2eecafaf3a3c3a8b4719c3252db30a582fce5f11946926cd6a2bc03920c702",
19
+ "check/coda/components/plugins/plugin-rules.mjs": "2169dd2a9abb104dc786ac5a3c9d3eac163a383742c24f7caae72634fbba12d1",
18
20
  "check/coda/components/plugins/plugin-source-rules.mjs": "d894d55a3272df5ef3b108b68820c64aefdf6b69346404b58954f2a3503cb4a5",
19
21
  "check/coda/components/plugins/skill-document.mjs": "c5b5e815c42cd836572f7b60e22a46af6ac607fd9df0170fa36f955825636ce6",
20
22
  "check/coda/components/prompt-recovery/prompt-recovery.mjs": "f43f21d24c19a58113d3304f9248225b12080ab00ed15eab74bf7b94642732de",
21
- "check/coda/components/session-config/commands.mjs": "9114c880704253dce4f6b049ab10b2265067db4224916605a3209ff8d347fcac",
23
+ "check/coda/components/session-config/commands.mjs": "2e4c80b0280db32fe220fa360f18a8e66f12e6a16e3e7bce545c762c9c6340e1",
22
24
  "check/coda/components/workflows/executor-labels.mjs": "dceca6ae60c0a4f3c3cc72a6c84f1489831790774c93caab96e4ddb493bc89e1",
23
25
  "check/coda/domain/agent-protocol.mjs": "769cc10dc21b3cef7718f94272aaef2d17d4882d42617b408cb47357abfc3bcb",
24
26
  "check/coda/domain/duration.mjs": "15dd64ef9b02342ad521c66e5968a569432a89dc7568d11afd3e6f3fe37e104b",
@@ -31,6 +33,6 @@
31
33
  "check/coda/resources/plugins/resources/panels/panels.mjs": "9e25cfbc16ed9f68101fc7bfc34b8056c13a29d2368c5561e65e333233eb921e",
32
34
  "check/coda/resources/plugins/resources/panels/rules.mjs": "8418ed83b796f18047c154d8dea8dca7d98244af8ddfe3ddf188520c59324ee8",
33
35
  "check/coda/resources/plugins/resources/panels/sign-in.mjs": "1271a24e33b1b882a1fb9bee03b8e240db8b9bee1b5208f0e1c84499cfb1be7e",
34
- "check/coda/builtin.json": "cb4cb30ea2ae9abd67627761c2931811228a4d9084da308c3c4d5dd3519533f0"
36
+ "check/coda/builtin.json": "2fed14cedcc18ccb781c44724091d1d769f7c6c2dea959afcad1b58ae6a773aa"
35
37
  }
36
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coda-console/plugin-check",
3
- "version": "0.5.28",
3
+ "version": "0.5.30",
4
4
  "description": "Coda 插件的契约检查:扮演 Coda 读清单、启动 Agent 讲 ACP 与 _coda/wait、读面板。",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@0dep/piso": "5.2.0",
26
26
  "@agentclientprotocol/sdk": "1.4.0",
27
- "@coda-console/protocol": "1.10.0",
27
+ "@coda-console/protocol": "2.0.0",
28
28
  "ajv": "8.20.0",
29
29
  "yaml": "2.9.1"
30
30
  },