@coda-console/plugin-check 0.5.16 → 0.5.18
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,7 +18,7 @@ plugins/codex-accounts/ Codex 多账号:管理登录、自动续期与账号
|
|
|
18
18
|
plugins/cursor/ Cursor:在运行机的 cursor-agent acp 与 Coda 之间转发,送入会话指令
|
|
19
19
|
plugins/host/ 宿主资源:Xcode 构建、Apple 模拟器与项目要求排队的命令共用这台机器的一组名额(组 host、持锁执行 run-held、host-sim),面板「构建与模拟器名额」
|
|
20
20
|
plugins/magpie/ Magpie:把本机的 Magpie 网关作为模型服务提供给 Pi 等插件,安装时装好 Magpie 并让网关常驻
|
|
21
|
-
plugins/network-log/
|
|
21
|
+
plugins/network-log/ 网络记录:默认关闭,按需开启建连等待与定时探测采集;关闭后仍可查看历史
|
|
22
22
|
plugins/review/ PR 生命流程:会话开的 PR 先跑项目的检查、再交叉评审,你批准后合并、部署与发布;也是写 PR 流程的样例
|
|
23
23
|
plugins/testbed/ 测试机:长插在 Mac 上的 iPhone、iPad 只经 use-testbed 使用,排到后装 App、交给会话操作、用完切黑屏;依赖宿主资源
|
|
24
24
|
plugins/ultra/ Ultra:输入框的 Ultra 模式,主 Agent 主动把能并行的活按名单派给子会话,汇总后验证;名单与模板在模式参数和设置里
|
|
@@ -399,7 +399,7 @@ gh workflow run publish.yml --repo coda-console/coda-plugins --ref main
|
|
|
399
399
|
|
|
400
400
|
## 契约检查
|
|
401
401
|
|
|
402
|
-
扮演 Coda 去读一个插件目录:清单对 Coda 的类型 schema
|
|
402
|
+
扮演 Coda 去读一个插件目录:清单对 Coda 的类型 schema 校验,流程按 Coda 的流程方言读,Agent 照 Coda 的样子启动、说 Coda 说的话,面板由 Coda 的资源插件模块读一次。
|
|
403
403
|
插件写的合乎它用到的类型就对:清单的写法只在协议包 `@coda-console/protocol`([coda-console/coda-protocol](https://github.com/coda-console/coda-protocol))的 schema 里,由 Coda 自己用的同一个校验器判,
|
|
404
404
|
检查包不另写规则,Coda 加字段只是改 schema。`check/coda/` 是 Coda 文件的原样副本(见[契约副本](#契约副本)),检查包手写的只有怎样扮演 Coda、怎样判。
|
|
405
405
|
只在装到一台机器上才知道的(仓库里扫不扫得到、npm 锁文件、和那台已装插件冲突)是那台 Coda 安装时说的,不是插件类型的问题,检查不跑。
|
|
@@ -414,7 +414,7 @@ npx github:coda-console/coda-plugins#<提交> <插件目录>
|
|
|
414
414
|
|
|
415
415
|
| 级 | 要不要登录 | 查什么 |
|
|
416
416
|
| --- | --- | --- |
|
|
417
|
-
| 清单(总是) | 不要 | `package.json` 对 Coda 的类型 schema 校验(`manifestProblem`),再照 Coda 读成插件(`readPlugin`:ID、设置名在 ID 之下);写给别的插件扩展点的键,要有 Coda
|
|
417
|
+
| 清单(总是) | 不要 | `package.json` 对 Coda 的类型 schema 校验(`manifestProblem`),再照 Coda 读成插件(`readPlugin`:ID、设置名在 ID 之下);写给别的插件扩展点的键,要有 Coda 自带的或旁边依赖的插件声明这个类型。面板写法按资源插件给扩展点 `panels` 带的 schema 查。`.coda/workflows/` 里的每个流程(含能力)按协议的流程方言读(`workflowProblem`):不是 BPMN、认不出的 `coda:` 属性或元素、没有的动作或动作不接受的参数都算失败。另有只提醒的:分类、版本、图标页面太小、旧的 Agent ID `claude` |
|
|
418
418
|
| 握手(默认) | 不要 | `sh -c` 启动 `command`(环境是 Coda 的 `pluginEnv` 给的:`CODA_NODE`、`CODA_PLUGIN_PATH`、临时的 `CODA_PLUGIN_STATE`、设置默认值的 `CODA_PLUGIN_SETTINGS`;依赖的插件在旁边(同一个父目录里同名的目录)时 `CODA_PLUGIN_DEPENDENCIES` 给它的目录,Coda 自带的不在这里、不给),发与 Coda 相同的 `initialize`,要求 `protocolVersion` 为 1、声明会话指令(`sessionCapabilities.systemPrompt`,没声明算失败);`session/new` 带会话指令,给出会话与当前模型,回 -32000 记为未登录、跳过后面的检查(不算失败);像 Coda 一样对进程组发 SIGTERM,5 秒内要退出(超过 0.8 秒提醒);另起一个进程,关掉标准输入后 5 秒内不退出只提醒。面板由 Coda 资源插件的 `Panels` 读一次(30 秒),输出合格式 |
|
|
419
419
|
| 一轮(`--live`) | 要 | 第一轮问会话指令里的检查词(一个随机词),回复里要有它;再发一轮提示词(默认「只回复 ok」)收到 `stopReason`;每条 `session/update` 过 ACP SDK 的 schema;`_coda/wait` 按 Coda 的 `validWait` 与协议的规则核对(子 Agent 不带 `childSessionId`、定时不带 `at` 只提醒);审批与提问一律回拒绝,在一轮之外发来的算失败;再发一轮并 `session/cancel`,30 秒内要结束,读到取消后还在做事或拖过 5 秒才答复却不回 `cancelled` 算失败(见下);有自主轮次的也取消一次;声明插话的,一轮结束后插话要回 `promptRequired` 且不自己另开一轮,一轮进行中插话要回 `injected` 或 `promptRequired`(`injected` 的那一轮照常回 `stopReason`);声明 `loadSession` 的,新开进程 `session/load`(同样带会话指令)要成功,随后在新进程里再跑一轮也要收到 `stopReason` |
|
|
420
420
|
|
|
@@ -14,6 +14,7 @@ export function agentDeclarations(raw = [], dir) {
|
|
|
14
14
|
id: agent.id, displayName: agent.displayName,
|
|
15
15
|
icon: { light: icon(dir, agent.icon.light), ...(agent.icon.dark !== undefined ? { dark: icon(dir, agent.icon.dark) } : {}), template: agent.icon.template === true },
|
|
16
16
|
command: agent.command,
|
|
17
|
+
...(agent.lifecycle !== undefined ? { lifecycle: agent.lifecycle } : {}),
|
|
17
18
|
modes: Object.fromEntries(MODES.filter(key => agent.modes?.[key] !== undefined).map(key => [key, agent.modes[key]])),
|
|
18
19
|
...(agent.skillsDir !== undefined ? { skillsDir: normalize(agent.skillsDir) } : {}),
|
|
19
20
|
configFiles: [...(agent.configFiles ?? [])],
|
|
@@ -60,7 +60,8 @@ function setting(value, where) {
|
|
|
60
60
|
if (value.items.modelApis) out.modelApis = [...new Set(value.items.modelApis)];
|
|
61
61
|
} else if (value.type === 'array' && value.items.type === 'object') out.rows = setting(value.items, `${where}.items`);
|
|
62
62
|
else if (value.type === 'array') out.options = value.items.anyOf.map(option => ({ value: option.const,
|
|
63
|
-
...(option.title ? { title: option.title } : {}), ...(option.description ? { description: option.description } : {})
|
|
63
|
+
...(option.title ? { title: option.title } : {}), ...(option.description ? { description: option.description } : {}),
|
|
64
|
+
...(option.workflowKind ? { workflowKind: option.workflowKind } : {}) }));
|
|
64
65
|
else if (value.type === 'object' && value.properties) {
|
|
65
66
|
out.columns = Object.fromEntries(Object.entries(value.properties).map(([name, column]) => [name, setting(column, `${where}.properties.${name}`)]));
|
|
66
67
|
if (value.required?.length) out.required = [...value.required];
|
package/check/coda/contract.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "7a6850681534da5b80d166865fbc2f5ba356b3b6",
|
|
3
3
|
"packages": {
|
|
4
4
|
"@0dep/piso": "5.2.0",
|
|
5
5
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
6
|
-
"@coda-console/protocol": "1.
|
|
6
|
+
"@coda-console/protocol": "1.4.0",
|
|
7
7
|
"yaml": "2.9.1"
|
|
8
8
|
},
|
|
9
9
|
"files": {
|
|
10
|
-
"check/coda/components/plugins/agent-plugins.mjs": "
|
|
10
|
+
"check/coda/components/plugins/agent-plugins.mjs": "d117702f83c988aa89c2e5ae26aafd6ae3e8ba0829adaeedf9e8640f5f8282be",
|
|
11
11
|
"check/coda/components/plugins/plugin-extensions.mjs": "91badae3de3c5a015d83d425def2593ffcd451576fb5f07309888f09d3157b52",
|
|
12
|
-
"check/coda/components/plugins/plugin-rules.mjs": "
|
|
12
|
+
"check/coda/components/plugins/plugin-rules.mjs": "eb4ba82ea871c03116a4edfe84ef6e423d15a17bcd66c56e732af6255f9624dd",
|
|
13
13
|
"check/coda/components/plugins/plugin-source-rules.mjs": "4eedfd024c0824b1fed78be106f1a2827ffc3dd35ac0c69b8b0c61a59af42efd",
|
|
14
14
|
"check/coda/components/plugins/skill-document.mjs": "c5b5e815c42cd836572f7b60e22a46af6ac607fd9df0170fa36f955825636ce6",
|
|
15
15
|
"check/coda/components/prompt-recovery/prompt-recovery.mjs": "f43f21d24c19a58113d3304f9248225b12080ab00ed15eab74bf7b94642732de",
|
package/check/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
// The contract check of one plugin directory: the manifest, then each agent's handshake (and with `live`, a
|
|
2
|
-
// panel's reading. The manifest is checked against Coda's schemas of its types
|
|
3
|
-
// a plugin is written.
|
|
1
|
+
// The contract check of one plugin directory: the manifest and its workflows, then each agent's handshake (and with `live`, a
|
|
2
|
+
// turn) and each panel's reading. The manifest is checked against Coda's schemas of its types and its workflows against Coda's
|
|
3
|
+
// dialect of BPMN (both the protocol's), the rest by Coda's own code (check/coda/), run where a plugin is written.
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import { checkAgent } from './agent.mjs';
|
|
6
6
|
import { checkManifest } from './manifest.mjs';
|
|
7
7
|
import { checkPanel } from './panel.mjs';
|
|
8
|
+
import { checkWorkflows } from './workflows.mjs';
|
|
8
9
|
import { Report } from './report.mjs';
|
|
9
10
|
|
|
10
11
|
// `agent`: only this agent of the plugin; `manifestOnly`: nothing is run; `live`: one turn each with `prompt`.
|
|
@@ -12,6 +13,7 @@ export async function checkPlugin(dir, { agent: only = null, manifestOnly = fals
|
|
|
12
13
|
const pluginDir = resolve(dir), report = new Report();
|
|
13
14
|
const plugin = checkManifest(pluginDir, report.scope('manifest'));
|
|
14
15
|
if (!plugin) return { report, plugin };
|
|
16
|
+
await checkWorkflows(plugin, report.scope('manifest'));
|
|
15
17
|
const agents = only ? plugin.agents.filter(a => a.id === only) : plugin.agents;
|
|
16
18
|
if (only && !agents.length) report.scope('manifest').fail('options.agent', `清单里没有能检查的 Agent ${only}`);
|
|
17
19
|
if (manifestOnly) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The plugin's workflows (and capabilities: workflows too), at the manifest level: each `.coda/workflows/<name>.bpmn` read
|
|
2
|
+
// with Coda's dialect of BPMN, as the protocol has it (@coda-console/protocol/workflow) and Coda reads it: not BPMN, a coda:
|
|
3
|
+
// attribute or element the dialect does not have, an action it does not have or a parameter the action does not take, is
|
|
4
|
+
// a workflow Coda does not take. What each value may be Coda checks as it reads one; this check does not yet (coda#2027).
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { workflowProblem } from '@coda-console/protocol/workflow';
|
|
8
|
+
|
|
9
|
+
export async function checkWorkflows({ plugin }, say) {
|
|
10
|
+
for (const name of plugin.workflows) {
|
|
11
|
+
const problem = await workflowProblem(readFileSync(join(plugin.dir, '.coda/workflows', `${name}.bpmn`), 'utf8'), name);
|
|
12
|
+
if (problem) say.fail('manifest.workflows', problem);
|
|
13
|
+
else say.pass('manifest.workflows', `流程 ${name}:合乎 Coda 的流程方言`);
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coda-console/plugin-check",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.18",
|
|
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.
|
|
27
|
+
"@coda-console/protocol": "1.4.0",
|
|
28
28
|
"ajv": "8.20.0",
|
|
29
29
|
"yaml": "2.9.1"
|
|
30
30
|
},
|