@coda-console/plugin-check 0.8.27 → 0.8.28
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 +25 -20
- package/bin/check.mjs +3 -3
- package/check/coda/adapters/plugin-modules.mjs +2 -7
- package/check/coda/adapters/plugin-test-host.d.mts +0 -2
- package/check/coda/api-surface.txt +0 -1
- package/check/coda/builtin.json +1 -264
- package/check/coda/components/plugins/plugin-extensions.mjs +2 -2
- package/check/coda/components/plugins/plugin-rules.mjs +3 -3
- package/check/coda/components/plugins/plugin-source-rules.mjs +1 -1
- package/check/coda/contract.json +8 -11
- package/check/index.mjs +2 -4
- package/check/leftovers.mjs +1 -1
- package/check/manifest.mjs +7 -9
- package/check/module.mjs +0 -1
- package/check/report.mjs +1 -1
- package/package.json +4 -3
- package/templates/resource/package.json +13 -10
- package/templates/resource/scripts/act.mjs +20 -0
- package/templates/resource/scripts/{resources.mjs → resource.mjs} +10 -5
- package/check/coda/resources/plugins/resources/panels/panels.mjs +0 -313
- package/check/coda/resources/plugins/resources/panels/rules.mjs +0 -232
- package/check/coda/resources/plugins/resources/panels/sign-in.mjs +0 -122
- package/check/panel.mjs +0 -78
- package/templates/resource/scripts/mark.mjs +0 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Coda 的公开插件仓库,和给插件作者用的契约检查。Agent 插件(Codex、Claude、Kimi、Grok、OpenCode 与 Codex 多账号)和 PR 生命流程也在这里维护,用户在 Coda 的商店里安装。
|
|
4
4
|
|
|
5
5
|
Coda 是一个多 Agent 客户端(Mac、iPhone 与运行在你机器上的后端)。Agent 与资源页上的资源都以插件接入:
|
|
6
|
-
插件是一个目录,清单就是它的 `package.json`(`contributes.agents`、`contributes.
|
|
6
|
+
插件是一个目录,清单就是它的 `package.json`(`contributes.agents`、`contributes.records` 等,照 VS Code 扩展的写法);
|
|
7
7
|
Agent 讲 [ACP](https://agentclientprotocol.com),外加 Coda 的 Agent 活动报告 `_coda/wait`,见 [接入协议](https://github.com/coda-console/coda-protocol/blob/main/docs/agent-protocol.md)。
|
|
8
8
|
插件清单的类型、它们的 schema 与接入协议都在协议包 `@coda-console/protocol`([coda-console/coda-protocol](https://github.com/coda-console/coda-protocol))里;本仓库文中与代码注释说的 `docs/agent-protocol.md` 指那里的那份。
|
|
9
9
|
|
|
@@ -28,7 +28,7 @@ plugins/token-board/ Token 消耗榜:看本机的 Token 用量,可选向
|
|
|
28
28
|
plugins/testbed/ 测试机:长插在 Mac 上的 iPhone、iPad 只经 use-testbed 使用,排到后装 App、交给会话操作、用完切黑屏;依赖宿主资源
|
|
29
29
|
plugins/composer/ 输入框模式与开发流程:监督开发(一个需求一条需求分支,主 Agent 把一块块改动合进需求分支,用户批准一次)与需求交付;Ultra 名单引用 composer.templates
|
|
30
30
|
templates/agent/ 最小的 Agent 插件:手写 ACP 的回声 Agent,演示会话指令、插话、Agent 活动与自主轮次
|
|
31
|
-
templates/resource/
|
|
31
|
+
templates/resource/ 最小的资源插件:一条记录命令、一条 `act` 命令,一个资源、两个读数、一个按钮
|
|
32
32
|
templates/module/ 带模块的插件:自己的协议(一个查询、一个做事的操作、一个事件),模块登记操作、写记录、发布并订阅事件,附测试
|
|
33
33
|
bin/、check/ 契约检查(仓库根的 package.json 就是它,@coda-console/plugin-check);check/coda/ 是 Coda 同步来的规则副本,不要手改
|
|
34
34
|
test/ 检查包的测试;test/plugins/ 是各插件的测试(插件目录里只放运行要用的文件)
|
|
@@ -417,7 +417,7 @@ Dependabot(`.github/dependabot.yml`)每周为它们各开一个 PR,连同
|
|
|
417
417
|
|
|
418
418
|
1. **仓库**填 `coda-console/coda-plugins`(或 `https://github.com/coda-console/coda-plugins`);**版本**留空是默认分支,也可以填分支、标签或完整的提交号。
|
|
419
419
|
2. **读取**:Coda 拉取那个提交,把仓库根与两层以内 `package.json` 带 `contributes` 的目录各列成一个插件——这个仓库里是 `plugins/` 下的各个插件与三个模板。已装的外部插件(如商店里装的 `@coda-console/<id>`)可以用这里的同名插件替换;Coda 真正自带的插件(Coda 资源目录里的那些)的 ID 外部不能占用,装不了同名的。
|
|
420
|
-
3. 选一个,确认里逐条列出它会运行的命令(Agent 的 `command
|
|
420
|
+
3. 选一个,确认里逐条列出它会运行的命令(Agent 的 `command`、资源的记录命令与 `act` 等命令),确认就是批准:这些命令以你的账户在空间里每台机器上运行,Coda 不做隔离,只装你信任的来源。
|
|
421
421
|
|
|
422
422
|
**Coda 只认提交**:安装时钉在读取到的那个提交上,每台机器各自取同一个提交。「检查更新」用记下的仓库与版本再读一次,提交变了才有更新;
|
|
423
423
|
上一个提交留着,可以回退。清单里的 `version` 只作显示,不参与比较——改了行为就把它加一,方便人看。这个仓库不打标签、不发 release;发 npm 的方式见下面的「npm 发布」。
|
|
@@ -442,7 +442,7 @@ Agent 模板里 Agent 的 `id` 不随目录名变,按需自己改。
|
|
|
442
442
|
- `name` 是包名;另写 `id` 时以它为 Coda 插件 ID,否则以 `name` 为 ID。ID 只能用小写字母、数字和 `-`,以字母开头,至多 40 个字符。
|
|
443
443
|
本仓库的包名是 `@coda-console/<id>`,设置名与 Agent ID 仍使用原来的插件 ID。可以与已装的外部插件同名(用别的来源替换它);不能与 Coda 自带的插件(Coda 资源目录里的那些)同名:这是安装时的规矩,Coda 拒绝装与自带插件同 ID 的外部插件。契约检查不因同 ID 判失败,`manifest.name` 只提示一句「Coda 也自带这个 ID」。
|
|
444
444
|
- `displayName`、`description`、`version` 显示在安装确认与插件页。
|
|
445
|
-
- `contributes` 只能有 Coda 认识的贡献:`agents`、`
|
|
445
|
+
- `contributes` 只能有 Coda 认识的贡献:`agents`、`records`、`protocolImplementations`、`configuration`、`capabilities`、`instructions`、`extensionPoints`、`extensions`、`commands`、`services`、`setup`;读不懂的键一律报错,不会被悄悄忽略。
|
|
446
446
|
- `setup` 是插件的设置动作:`{ "command": "…" }`,一行、不超过 4000 字(与资源命令同样的规则),没有别的键。
|
|
447
447
|
|
|
448
448
|
**从仓库安装的限制**:带 npm 依赖(`dependencies`、`optionalDependencies`)就要把 `package-lock.json` 一起提交,Coda 在插件的版本目录里
|
|
@@ -460,7 +460,7 @@ Agent 模板里 Agent 的 `id` 不随目录名变,按需自己改。
|
|
|
460
460
|
| `modes` | 可省:`title`、`unset`、`note` 是模式选择的标题与说明;`auto`、`full` 是这个 Agent 的「自动审批」「全部放行」各是哪个 ACP 模式 |
|
|
461
461
|
| `skillsDir`、`configFiles`、`setupHint` | 可省:Agent 在工作副本里找 skills 的目录;它读模型列表的配置文件(变了 Coda 重读);用不了时给用户的一句话 |
|
|
462
462
|
|
|
463
|
-
Agent
|
|
463
|
+
Agent 进程的环境是会话的环境再加插件进程的那组变量(资源的记录命令与 act 命令、放在会话 `PATH` 上的命令也一样;继承来的同名变量先去掉,一个插件的进程拿不到别的插件的):
|
|
464
464
|
`CODA_NODE`(Coda 后端自己的 Node,插件自带的入口用它运行,不在 Agent 的 `PATH` 上)、`CODA_PLUGIN_PATH`(插件目录,从仓库装的是它钉住的版本目录)、
|
|
465
465
|
`CODA_PLUGIN_STATE`(插件在这台机器上的状态目录,跨会话、跨版本保留)、`CODA_PLUGIN_SETTINGS`(插件设置的 JSON)、
|
|
466
466
|
`CODA_PLUGIN_EXTENSIONS`(别的插件接在它扩展点上的东西,没有就不设)、`CODA_PLUGIN_DEPENDENCIES`(它依赖的插件的目录,没有就不设)、
|
|
@@ -481,22 +481,27 @@ Agent 进程的环境是会话的环境再加插件进程的那组变量(资
|
|
|
481
481
|
- Coda 关会话是对 Agent 的进程组发 SIGTERM,0.8 秒后 SIGKILL:收到 SIGTERM 要尽快退出。
|
|
482
482
|
- 一轮之外的审批与提问 Coda 一律拒绝,除非正有活动在 `handling`(那是一轮自主轮次)。
|
|
483
483
|
|
|
484
|
-
**资源**(`
|
|
485
|
-
`
|
|
484
|
+
**资源**(`coda/resource@1`,例子见 `templates/resource`):插件写资源记录,资源页只读记录、调操作。清单里两处:
|
|
485
|
+
`contributes.records` 里 `{ "kind": "coda/resource@1", "command": "scripts/resource.mjs" }`(可选 `every`,不短于 `PT1M`,按周期重跑),
|
|
486
|
+
`contributes.protocolImplementations` 里 `{ "kind": "coda/resource@1", "commands": { "act": "scripts/act.mjs" } }`(`act`、`sign-in`、`install` 有哪个写哪个)。
|
|
487
|
+
`contributes.resources`、`contributes.panels` 已退役:清单里还写着的插件,Coda 判「需要更新」,检查报 `manifest.retired`。
|
|
488
|
+
|
|
489
|
+
- **记录命令**:Coda 以插件身份在插件目录里运行它(`{}` 在标准输入,`CODA_RECORD_KIND`,30 秒),标准输出是这个插件在这台机器上这一类的整组记录
|
|
490
|
+
`[{ key, spec }]`,每条不超过 64 KiB,key 不重复;`spec.type` 等于 `key`,`spec.title`(类型名,如「CPU」「Claude」:资源页上只写它,不写插件)与 `spec.resources`,至多 50 个资源。
|
|
491
|
+
命令失败(非零退出,原因写在标准错误的最后一行)时 Coda 保留上一份记录,资源页写「更新失败:原因」。
|
|
492
|
+
- **资源**:
|
|
486
493
|
|
|
487
494
|
| 字段 | 内容 |
|
|
488
495
|
| --- | --- |
|
|
489
496
|
| `name` | 可省:资源的名字(账号、磁盘、设备),一行不超过 80 字;类型只有一个资源时不写 |
|
|
490
497
|
| `identity` | 可省:它是哪个外部身份(如 `codex:<哈希>`):几台机器、几个插件说同一个身份时资源页只显示一行 |
|
|
491
|
-
| `values` |
|
|
498
|
+
| `values` | 必写,至多 8 个读数,每个可选 `label`(只有一个读数时不写)、`value`、`fraction`(0–1,**还剩多少**,不知道就不写)、`time`(ISO 8601,如额度何时恢复),`value` 与 `fraction` 至少有一个 |
|
|
492
499
|
| `error` | 可省:哪里不对,一行不超过 80 字 |
|
|
493
|
-
| `
|
|
500
|
+
| `buttons` | 必写,至多 8 个按钮,每个 `label` 和 `action`(调 `act` 操作)、`view`(插件的视图)或 `url`(`https://` 网页)之一,可选 `args`(序列化后不超过 4096 字节)、`disabled`、`confirm` |
|
|
494
501
|
|
|
495
502
|
`name` 与 `values` 至少有一个。没有副标题、说明行或整段文字:资源页上只有类型名、名字、读数与按钮,要说明的写进插件自己的文档或视图。
|
|
496
|
-
|
|
497
|
-
命令的环境是后端的环境(不带会话 ID)加上插件进程的那组变量(同上),`PATH` 最前面是 Coda 后端的 `node`;`CODA_GROUPS_STATE`
|
|
498
|
-
(`{now, groups}`);动作另有 `CODA_PANEL_ARGS`(按钮的 `args`)。
|
|
499
|
-
动作至多跑 10 分钟,成功后 Coda 立即重读这个类型。之前的写法 `contributes.panels`(`{ "items": [...] }`,卡片与说明行)Coda 仍读,当作资源显示、说明文字丢掉;新插件写 `resources`。
|
|
503
|
+
- **`act` 命令**:点按钮(并确认)后 Coda 运行它,`{ action, args }` 在标准输入里,至多 10 分钟;成功就在标准输出写 `{}`,失败退出 1、原因写在标准错误的最后一行;不认识的动作要让调用失败。
|
|
504
|
+
- 命令的环境是后端的环境(不带会话 ID)加上插件进程的那组变量(同上),`PATH` 最前面是 Coda 后端的 `node`;`CODA_GROUPS_STATE` 是这一刻这个后端各并发组的占用与排队(`{now, groups}`)。
|
|
500
505
|
|
|
501
506
|
## npm 发布
|
|
502
507
|
|
|
@@ -525,7 +530,7 @@ npm 包设置里的 Publishing access 保持 npm 的默认设置,不另行收
|
|
|
525
530
|
|
|
526
531
|
## 契约检查
|
|
527
532
|
|
|
528
|
-
扮演 Coda 去读一个插件目录:清单对 Coda 的类型 schema 校验,流程按 Coda 的流程方言读,Agent 照 Coda 的样子启动、说 Coda
|
|
533
|
+
扮演 Coda 去读一个插件目录:清单对 Coda 的类型 schema 校验,流程按 Coda 的流程方言读,Agent 照 Coda 的样子启动、说 Coda 说的话,写资源记录的插件,它的记录命令照宿主的样子跑一次,输出照协议校验。
|
|
529
534
|
插件写的合乎它用到的类型就对:清单的通用键只在协议包 `@coda-console/protocol`([coda-console/coda-protocol](https://github.com/coda-console/coda-protocol))的 schema 里,
|
|
530
535
|
`agents`、`skills`、`mcpServers` 等业务键由 Coda 里读它的一方登记成贡献点(schema 与读法,`check/coda/application/contributions.mjs` 先于读清单加载),都由 Coda 自己用的同一个校验器判,
|
|
531
536
|
检查包不另写规则。`check/coda/` 是 Coda 文件的原样副本(见[契约副本](#契约副本)),检查包手写的只有怎样扮演 Coda、怎样判。
|
|
@@ -539,11 +544,11 @@ node bin/check.mjs <插件目录> [--agent <id>] [--manifest] [--live] [--prompt
|
|
|
539
544
|
npx github:coda-console/coda-plugins#<提交> <插件目录>
|
|
540
545
|
```
|
|
541
546
|
|
|
542
|
-
插件自己的测试用检查包的出口:`@coda-console/plugin-check/test-host`(`createTestHost`,Coda 自己的 `coda`、`ctx`
|
|
547
|
+
插件自己的测试用检查包的出口:`@coda-console/plugin-check/test-host`(`createTestHost`,Coda 自己的 `coda`、`ctx` 构造)、`@coda-console/plugin-check/resources`(`resourceRecords`、`resourceRecordsProblem`,见下)与 `@coda-console/plugin-check/types`(类型),不必直接依赖协议包。
|
|
543
548
|
|
|
544
549
|
写 `coda/resource@1` 记录的插件(`contributes.records` 里有这一种)握手一级还会照宿主的样子跑一次它的记录命令(插件目录里、`{}` 在标准输入、`CODA_RECORD_KIND`、30 秒),
|
|
545
550
|
输出照协议的 schema 与宿主的上限校验:是 `[{ key, spec }]`、key 不重复、`spec.type` 等于 `key`、每条不超过 64 KiB、按钮的 `args` 序列化后不超过 4096 字节;规则 `resource.read`、`resource.output`。
|
|
546
|
-
记录里的动作(`act`、`sign-in`、`install
|
|
551
|
+
记录里的动作(`act`、`sign-in`、`install`)不运行。插件自己的测试从 `@coda-console/plugin-check/resources` 导入(不要按文件路径导 `check/resources.mjs`):
|
|
547
552
|
`await resourceRecords(插件目录, { env })` 跑清单里 `coda/resource@1` 的记录命令,返回它打印的记录,不合则抛出原因(`env` 是测试给的进程环境,不给就用本进程的,`CODA_PLUGIN_PATH` 为插件目录);
|
|
548
553
|
`resourceRecordsProblem(输出)` 判手头已有的输出,返回 `null` 或哪里不对。
|
|
549
554
|
记录命令读不到数据时的规则:Coda 在命令失败(非零退出)时保留上一份记录、资源页显示「更新失败:原因」,所以只有「重新登录才能恢复」的错才打印带 `error` 和 `signIn` 的记录(凭据缺失、过期、无效,认证文件读不了或内容坏了;有登录却没有 CLI 也算,登录入口会装它);没登录、没账号不是错,照常打印有效记录、带 `signIn`;其余读失败(网络、超时、5xx、响应读不懂、本地登记损坏、查询失败)一律以非零退出,原因写在标准错误的最后一行,不要打印一条只有错误的记录去顶掉上一份好读数。
|
|
@@ -551,9 +556,9 @@ npx github:coda-console/coda-plugins#<提交> <插件目录>
|
|
|
551
556
|
|
|
552
557
|
| 级 | 要不要登录 | 查什么 |
|
|
553
558
|
| --- | --- | --- |
|
|
554
|
-
| 清单(总是) | 不要 | `package.json` 的通用键对协议 schema 校验(`manifestProblem`),再照 Coda 读成插件(`readPlugin`:登记的贡献点各按自己的 schema 查、读,ID、设置名在 ID 之下);其余写给别的插件扩展点的键,要有 Coda
|
|
559
|
+
| 清单(总是) | 不要 | `package.json` 的通用键对协议 schema 校验(`manifestProblem`),再照 Coda 读成插件(`readPlugin`:登记的贡献点各按自己的 schema 查、读,ID、设置名在 ID 之下);其余写给别的插件扩展点的键,要有 Coda 自带的或旁边依赖的插件声明这个类型。清单还写着退役的 `contributes.resources`、`contributes.panels` 的,照 Coda 的判断(`ownIncompatibility`)算失败(`manifest.retired`)。`.coda/workflows/` 里的每个流程(含能力)按协议的流程方言读(`workflowProblem`):不是 BPMN、认不出的 `coda:` 属性或元素、没有的动作或动作不接受的参数都算失败。另有只提醒的:分类、版本、图标页面太小、旧的 Agent ID `claude`。还算 `engines.coda` 该写几(读 `check/coda/api-surface.txt`):清单的键、`contributes.<键>`、`uses` 的协议与权限组、自己协议定义里的键,以及插件目录里 `.mjs`/`.js`(不含 `node_modules`)的 `coda.<成员>`、`ctx.<成员>` 与页面里的 `window.coda.<成员>`;要的 Level 取最大的,清单写的 `engines.coda` 比清单、`uses`、定义的项小算失败,比文本扫出的项小只提醒,没写只提醒并给出该写的值。用到的试行面(`trial` 的权限组、模块接口)列在「说明」里,一行一项 |
|
|
555
560
|
| 模块(有 `main`;`--manifest` 不跑) | 不要 | 清单之后、握手之前:用 `createTestHost({ plugin, settings })` 起 Coda 自己的 `coda`(状态目录是临时的),`import(main)` 后调 `activate(host.coda)`,10 秒没完成或抛错算失败(带堆栈第一行);`host.registered()` 与清单两个方向对:清单的 `protocolImplementations` 写了、定义里有、又不由 `commands` 实现的操作,模块没 `coda.handle` 算失败,模块登记了定义里没有的操作也算失败(Coda 自己的协议里 `codaOnly` 的操作只由 Coda 回答,不要求登记);`coda.on` 订了不在自己事件组里的名字,测试宿主当场抛 `forbidden`:按被拒的事件名在已知的协议定义(Coda 自己的、自己的、依赖的)里查它归谁,查到了(它的组不在 `uses` 里)算失败,另有无关的依赖缺定义也一样;查不到,而 `uses` 里有协议的定义不在本地(依赖没放在旁边),归属可能取决于缺的定义,报「未完成核对」,不判插件错;`coda.get`/`coda.list` 遇到测试宿主没有的记录类型,先按已知定义判断:协议有定义却没有记录(只含事件)、或 `uses` 没给读记录的权限(`usesRefusal`,如只申请了事件组)算失败;有记录又已获授权的,测试宿主登记不了别的插件的记录类型(登记进自己的协议会让模块也能发它的事件),报「未完成核对」,之后的调用没有核对;协议在 `uses` 里而定义不在本地的同样报「未完成核对」。`activate` 成功之后才调模块导出的 `deactivate`(抛错、或与 `activate` 一样 10 秒没完成都算失败);`activate` 失败、超时或「未完成核对」时不调,只靠 `host.close()` 收掉模块起的进程(`deactivate` 之后同样收)。`activate` 最终抛出的错,检查包用包了一层的 `coda` 认出它是哪个成员出的:成员是测试宿主没有后端的几个之一(`coda.watch`、`coda.services.register`、`coda.tell`、`coda.api`、`coda.environment`、`coda.protocols.resolve`、`coda.protocols.upload`、`coda.pluginSetup.retry`),错误又正是测试宿主为这个成员答的那一条(错误码与固定说法都对上)时不算失败:「说明」里写明模块一级只验到这里,登记不与清单比对,模块一级报「未完成核对」(清单写的协议没有定义时同样);别的都算激活失败:同一成员的别的错(回调、筛选条件不合法等),别的成员的错,包括回 `unsupported` 的(比如 `coda.query` 调非只读操作) |
|
|
556
|
-
| 握手(默认) | 不要 | `sh -c` 启动 `command`(环境是 Coda 的 `pluginEnv` 给的:`CODA_NODE`、`CODA_PLUGIN_PATH`、临时的 `CODA_PLUGIN_STATE`、设置默认值的 `CODA_PLUGIN_SETTINGS`;依赖的插件在旁边(同一个父目录里同名的目录)时 `CODA_PLUGIN_DEPENDENCIES` 给它的目录,Coda 自带的不在这里、不给),发与 Coda 相同的 `initialize`,要求 `protocolVersion` 为 1;能力声明的 `_meta.coda` 与顶层插话声明交协议 schema 校验;检查会话指令能力(`sessionCapabilities.systemPrompt`,没声明也通过,由 Coda 在第一轮送入);声明了的 `session/new` 带会话指令,给出会话与当前模型,配置选项的 `_meta.coda.default` 交协议校验;错误里声明的执行失败也查协议 schema,回 -32000 记为未登录、跳过后面的检查(不算失败);像 Coda 一样对进程组发 SIGTERM,5 秒内要退出(超过 0.8 秒提醒);另起一个进程,关掉标准输入后 5 秒内不退出只提醒;声明了配置探测(`_meta.coda.probe`)的,再另起进程发带探测标记的 `session/new`(要给非空的 `sessionId`;标记不是 `true` 的要回 -32602):逐个模型用 `category: model` 的配置项切换(只有 `models` 的用 `session/set_model`),每次要返回该模型完整的配置、思考档位在它自己的选项里并能设回(标了 `_meta.coda.default` 的设回那一项),不存在的模型与配置项要报错,`session/prompt` 要回 -32602,声明了 `session/close` 的另开一个虚拟会话关掉,要回 `{}`、之后它的请求回 -32002,探测期间不干活;断线后新进程的 `session/load`、`session/resume` 要回 -32002,`session/list`(带探测的 `cwd`,沿 `nextCursor` 翻完;每页、每个会话条目合 ACP schema,`sessionId` 非空,`nextCursor` 只能是字符串或 null;重复的游标或超过 100
|
|
561
|
+
| 握手(默认) | 不要 | `sh -c` 启动 `command`(环境是 Coda 的 `pluginEnv` 给的:`CODA_NODE`、`CODA_PLUGIN_PATH`、临时的 `CODA_PLUGIN_STATE`、设置默认值的 `CODA_PLUGIN_SETTINGS`;依赖的插件在旁边(同一个父目录里同名的目录)时 `CODA_PLUGIN_DEPENDENCIES` 给它的目录,Coda 自带的不在这里、不给),发与 Coda 相同的 `initialize`,要求 `protocolVersion` 为 1;能力声明的 `_meta.coda` 与顶层插话声明交协议 schema 校验;检查会话指令能力(`sessionCapabilities.systemPrompt`,没声明也通过,由 Coda 在第一轮送入);声明了的 `session/new` 带会话指令,给出会话与当前模型,配置选项的 `_meta.coda.default` 交协议校验;错误里声明的执行失败也查协议 schema,回 -32000 记为未登录、跳过后面的检查(不算失败);像 Coda 一样对进程组发 SIGTERM,5 秒内要退出(超过 0.8 秒提醒);另起一个进程,关掉标准输入后 5 秒内不退出只提醒;声明了配置探测(`_meta.coda.probe`)的,再另起进程发带探测标记的 `session/new`(要给非空的 `sessionId`;标记不是 `true` 的要回 -32602):逐个模型用 `category: model` 的配置项切换(只有 `models` 的用 `session/set_model`),每次要返回该模型完整的配置、思考档位在它自己的选项里并能设回(标了 `_meta.coda.default` 的设回那一项),不存在的模型与配置项要报错,`session/prompt` 要回 -32602,声明了 `session/close` 的另开一个虚拟会话关掉,要回 `{}`、之后它的请求回 -32002,探测期间不干活;断线后新进程的 `session/load`、`session/resume` 要回 -32002,`session/list`(带探测的 `cwd`,沿 `nextCursor` 翻完;每页、每个会话条目合 ACP schema,`sessionId` 非空,`nextCursor` 只能是字符串或 null;重复的游标或超过 100 页算失败)不列出这个虚拟会话,没声明的跳过。写 `coda/resource@1` 记录的,记录命令跑一次(30 秒),输出照协议的 schema 与宿主的上限校验 |
|
|
557
562
|
| 一轮(`--live`) | 要 | 声明了会话指令的经 `systemPrompt` 送入,没声明的在第一轮前加契约的 `instructionsBlock`;第一轮问会话指令里的检查词(一个随机词),回复里要有它;再发一轮提示词(默认「只回复 ok」)收到 `stopReason`;每条 `session/update` 先过 ACP SDK 的 schema,工具审核、用量与默认选项标记再过协议 schema;`_coda/wait` 用协议的 `agentMessageProblem` 校验形状,另查会话归属、登记与终态(子 Agent 不带 `childSessionId`、定时不带 `at` 只提醒);扩展形状问题按现有规则报告协议返回的「位置:说明」;远端绑定码请求先查协议参数再查本会话归属;执行失败的形状交协议校验,重试预算照 Coda 策略;审批与提问一律回拒绝,在一轮之外发来的算失败;再发一轮并 `session/cancel`,30 秒内要结束,读到取消后还在做事或拖过 5 秒才答复却不回 `cancelled` 算失败(见下);有自主轮次的也取消一次;声明插话的,答复用协议的 `agentResultProblem` 校验,一轮结束后插话要回 `promptRequired` 且不自己另开一轮,一轮进行中插话要回 `injected` 或 `promptRequired`(`injected` 的那一轮照常回 `stopReason`);声明 `loadSession` 的,新开进程 `session/load`(声明了的同样带会话指令)要成功,随后在新进程里再跑一轮也要收到 `stopReason` |
|
|
558
563
|
|
|
559
564
|
**取消后的 `stopReason` 怎么判**:检查发 `session/cancel` 时紧跟一个只会得到 -32601 的探测请求(`_codaCheck/barrier`)。Agent 按顺序读,
|
|
@@ -562,7 +567,7 @@ npx github:coda-console/coda-plugins#<提交> <插件目录>
|
|
|
562
567
|
答复先于读到取消写出(取消送到前这一轮已经结束),或读到取消时已经做完、随即答复的(如 Codex 做完后等标题时被取消),只记一条说明。
|
|
563
568
|
|
|
564
569
|
`--manifest` 只查清单(什么也不运行);`--agent <id>` 只查一个 Agent。退出码:0 通过,1 有失败,2 用法不对。
|
|
565
|
-
|
|
570
|
+
资源的 `act`、`sign-in`、`install` 命令与插件的设置动作(`contributes.setup`)不运行(可能改动东西、装软件);Coda 自己的 MCP 服务器不给(`mcpServers` 为空)。
|
|
566
571
|
检查给的会话指令不是 Coda 的全文,是一段替身加一句检查词。
|
|
567
572
|
|
|
568
573
|
在自己插件仓库的 CI 里:
|
|
@@ -575,7 +580,7 @@ npx github:coda-console/coda-plugins#<提交> <插件目录>
|
|
|
575
580
|
|
|
576
581
|
## 契约副本
|
|
577
582
|
|
|
578
|
-
Coda
|
|
583
|
+
Coda 主仓库不公开。它的插件规则(读清单、插件进程的环境、ACP 与 `_coda/wait` 的约定等,按 Coda `backend/src/` 下的路径放在 `check/coda/`)、
|
|
579
584
|
它自带的插件(`check/coda/builtin.json`)都是 Coda 的原样副本,由 Coda 的部署流程 `sync-plugin-check`
|
|
580
585
|
(脚本 `scripts/plugin-contract.mjs`)同步:它在分支 `sync/coda` 上给这里开 PR。**不要手改**;规则要改先改 Coda。
|
|
581
586
|
`check/coda/contract.json` 记着同步自哪个提交、每个文件的 sha256 和副本用到的包的版本,CI 用它核对:
|
package/bin/check.mjs
CHANGED
|
@@ -15,11 +15,11 @@ const USAGE = `用法:coda-plugin-check <插件目录> [--agent <id>] [--manif
|
|
|
15
15
|
|
|
16
16
|
清单(总是查) package.json 能不能被 Coda 读懂,从仓库安装的限制(带 npm 依赖要有 package-lock.json);engines.coda 够不够用到的各项(算出该写几);列出用到的试行面
|
|
17
17
|
模块(有 main) 用 Coda 自己的 coda(测试宿主)加载 main、调 activate(10 秒内要完成);模块登记的操作与清单的 protocolImplementations 两个方向对一遍;coda.on 只能订自己事件组里的事件
|
|
18
|
-
握手(默认查) 照 Coda 的样子启动每个 Agent,发 initialize、session/new(声明了的带 systemPrompt,没声明的在第一轮送入指令);SIGTERM 后 5
|
|
18
|
+
握手(默认查) 照 Coda 的样子启动每个 Agent,发 initialize、session/new(声明了的带 systemPrompt,没声明的在第一轮送入指令);SIGTERM 后 5 秒内要退出(关标准输入后不退出只提醒);跑一次资源记录命令,核对输出合 coda/resource@1
|
|
19
19
|
一轮(--live) 每个 Agent 先问会话指令里的检查词,再发一轮提示词(默认「只回复 ok」)、再发一轮并取消(读到取消后要回 cancelled)、核对 _coda/wait;
|
|
20
20
|
声明插话的,一轮结束后与一轮进行中各插话一次;声明 loadSession 的再开进程 session/load,并在新进程里再跑一轮
|
|
21
21
|
|
|
22
|
-
--agent <id> 只查这一个 Agent
|
|
22
|
+
--agent <id> 只查这一个 Agent(资源记录不读)
|
|
23
23
|
--manifest 只查清单,什么也不运行
|
|
24
24
|
--live 查一轮:会真的发提示词,可能要登录、花额度
|
|
25
25
|
--prompt "…" 一轮用的提示词
|
|
@@ -45,7 +45,7 @@ const { values, positionals } = options;
|
|
|
45
45
|
if (values.help) { console.log(USAGE); process.exit(0); }
|
|
46
46
|
if (positionals.length !== 1 || (values.manifest && values.live)) { console.error(USAGE); process.exit(2); }
|
|
47
47
|
|
|
48
|
-
// Detached agents and
|
|
48
|
+
// Detached agents and record commands, and temporary directories, go with the checker (check/leftovers.mjs).
|
|
49
49
|
for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => process.exit(130));
|
|
50
50
|
const dir = resolve(positionals[0]);
|
|
51
51
|
const { report, plugin } = await checkPlugin(dir, { agent: values.agent ?? null, manifestOnly: !!values.manifest, live: !!values.live, prompt: values.prompt });
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// (a notice: an event it subscribes to, adapters/plugin-events.mjs), and `output`, `exited`
|
|
13
13
|
// of a process it started (adapters/process-relay.mjs). To it: `post { instance, message }`, `change { instance,
|
|
14
14
|
// collection, type, id, object }`, `unwatch { watch }`, `cancel { id }` of a `query` or a `question`, `progress { run,
|
|
15
|
-
// value }` of a `run`, `drained`, `kill` of a process, and the requests `
|
|
15
|
+
// value }` of a `run`, `drained`, `kill` of a process, and the requests `settings`
|
|
16
16
|
// (the plugin's own, as they are now), `watch { collection, selector }`, `tell { session, text }`, `part { part, method,
|
|
17
17
|
// args }`, `provider { method, args }`, `serviceRegister { id, port, secret }`, `serviceUnregister { id }`, `query { record,
|
|
18
18
|
// operation, input, timeout, deadline }`, `emit { name, data, subject, project }`, `call { record, operation, input, id, timeout, deadline, under, progress }`, `spawn { under, process, command, args, cwd, env, name }`, each with the
|
|
@@ -198,14 +198,13 @@ export function pluginModules({ send }) {
|
|
|
198
198
|
return entry.value;
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
-
// What a plugin's module is given: this plugin's own
|
|
201
|
+
// What a plugin's module is given: this plugin's own; and the parts
|
|
202
202
|
// others provide, each asking the backend under its name. `token`: this plugin's for this host process, brought with
|
|
203
203
|
// every request it asks (`asks`).
|
|
204
204
|
function codaFor(plugin, provided, token) {
|
|
205
205
|
const views = new Map(), protocols = new Map(), operations = new Map();
|
|
206
206
|
const asks = (method, params, signal = null, progress = null) => ask(method, { ...params, token }, signal, progress);
|
|
207
207
|
const services = pluginServices(asks);
|
|
208
|
-
const environment = (project = null, options = {}) => asks('environment', { of: options?.plugin ?? null, project });
|
|
209
208
|
// The listeners of `settings.onChange`: this plugin's own settings only, told as they are written.
|
|
210
209
|
const settingsChanges = new Set();
|
|
211
210
|
// The events it publishes and those it subscribes to (adapters/plugin-events.mjs).
|
|
@@ -277,10 +276,6 @@ export function pluginModules({ send }) {
|
|
|
277
276
|
if (!response.ok) throw new Error(value?.error?.message ?? `Coda 回答 ${response.status}`);
|
|
278
277
|
return value;
|
|
279
278
|
},
|
|
280
|
-
// What Coda gives every process of the plugin's (docs/plugins.md「插件进程的环境」), for one the module starts itself
|
|
281
|
-
// (Node's child_process, as a VS Code extension starts its language server); `{ plugin }`, another installed plugin's,
|
|
282
|
-
// for a command of its the module runs.
|
|
283
|
-
environment,
|
|
284
279
|
// This plugin's own settings (docs/plugins.md「设置」): as they are now, asked of the backend each time, and told to
|
|
285
280
|
// `onChange` as they are written, while the module runs. Secrets are not among them.
|
|
286
281
|
settings: Object.freeze({
|
|
@@ -297,8 +297,6 @@ export interface Coda {
|
|
|
297
297
|
tell(session: string, text: string): Promise<{ told: boolean }>;
|
|
298
298
|
/** Trial. This machine's Coda API as its clients reach it (the path after `/v1/`): GET without a body, POST with one; the answer is JSON. */
|
|
299
299
|
api(path: string, body?: Json): Promise<Json>;
|
|
300
|
-
/** Trial. What Coda gives every process of the plugin's, for one the module starts itself; `plugin` is another installed plugin's, for a command of its the module runs. */
|
|
301
|
-
environment(project?: string | null, options?: { plugin?: string }): Promise<Record<string, string>>;
|
|
302
300
|
/** Trial. Runs an installed plugin's environment setup again, asked as this plugin; the test host's fails (`unsupported`). */
|
|
303
301
|
pluginSetup: Readonly<{ retry(plugin: string): Promise<Json> }>;
|
|
304
302
|
}
|
package/check/coda/builtin.json
CHANGED
|
@@ -1638,270 +1638,7 @@
|
|
|
1638
1638
|
}
|
|
1639
1639
|
],
|
|
1640
1640
|
"dependencies": [],
|
|
1641
|
-
"extensionPoints": {
|
|
1642
|
-
"resources": {
|
|
1643
|
-
"description": "资源页上的资源类型:插件在 contributes.resources 里声明,由资源插件读取、执行动作与登录",
|
|
1644
|
-
"contributes": "resources",
|
|
1645
|
-
"title": "资源",
|
|
1646
|
-
"commands": {
|
|
1647
|
-
"command": "读取",
|
|
1648
|
-
"actions.*.command": "动作",
|
|
1649
|
-
"signIn.command": "登录",
|
|
1650
|
-
"signIn.installed": "安装检查",
|
|
1651
|
-
"signIn.install": "安装"
|
|
1652
|
-
},
|
|
1653
|
-
"schema": {
|
|
1654
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
1655
|
-
"title": "contributes.resources:资源页上的资源类型",
|
|
1656
|
-
"description": "资源类型的数组:每个类型一条读取命令,它打印的 { resources } 由资源页按类型名画出来(docs/plugins.md「资源」)",
|
|
1657
|
-
"type": "array",
|
|
1658
|
-
"x-unique-by": [
|
|
1659
|
-
"id"
|
|
1660
|
-
],
|
|
1661
|
-
"items": {
|
|
1662
|
-
"type": "object",
|
|
1663
|
-
"properties": {
|
|
1664
|
-
"id": {
|
|
1665
|
-
"$ref": "common.json#/$defs/name"
|
|
1666
|
-
},
|
|
1667
|
-
"title": {
|
|
1668
|
-
"description": "类型名,如 Claude、GitHub、CPU、内存:资源页上只写它,同名的类型合成一处",
|
|
1669
|
-
"$ref": "common.json#/$defs/line40"
|
|
1670
|
-
},
|
|
1671
|
-
"command": {
|
|
1672
|
-
"$ref": "common.json#/$defs/command"
|
|
1673
|
-
},
|
|
1674
|
-
"kind": {
|
|
1675
|
-
"description": "种类名:声明后这类资源成为可引用种类,读数由这台电脑写成后端目录库里的记录;小写字母、数字和「-」,全空间唯一",
|
|
1676
|
-
"type": "string",
|
|
1677
|
-
"maxLength": 63,
|
|
1678
|
-
"pattern": "^[a-z][a-z0-9-]{0,62}$"
|
|
1679
|
-
},
|
|
1680
|
-
"report": {
|
|
1681
|
-
"description": "定时读这类资源并上报的间隔:ISO 8601 时长,最短 PT1M(分钟、小时、天或周);只在写了 kind 时有意义,不写就只在打开页面、刷新或动作后读到时上报",
|
|
1682
|
-
"type": "string",
|
|
1683
|
-
"maxLength": 200,
|
|
1684
|
-
"pattern": "^P(?!$)(?:(?!0+W)\\d+W)?(?:(?!0+D)\\d+D)?(?:T(?!0*H?0*M?$)(?:\\d+H)?(?:\\d+M)?)?$"
|
|
1685
|
-
},
|
|
1686
|
-
"maxAge": {
|
|
1687
|
-
"description": "读数不重读还能再显示多久:ISO 8601 时长,如 PT5M(周、天与时分秒,不用年和月)",
|
|
1688
|
-
"type": "string",
|
|
1689
|
-
"maxLength": 200,
|
|
1690
|
-
"pattern": "^P(?!$)(?:\\d+W)?(?:\\d+D)?(?:T(?=\\d)(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
|
|
1691
|
-
},
|
|
1692
|
-
"hidden": {
|
|
1693
|
-
"description": "默认不显示:在资源页的「显示的资源」里打开才读、才显示",
|
|
1694
|
-
"type": "boolean"
|
|
1695
|
-
},
|
|
1696
|
-
"actions": {
|
|
1697
|
-
"description": "动作名 → { command, confirm }:资源上的按钮执行的命令,和执行前问的话",
|
|
1698
|
-
"type": "object",
|
|
1699
|
-
"propertyNames": {
|
|
1700
|
-
"$ref": "common.json#/$defs/name"
|
|
1701
|
-
},
|
|
1702
|
-
"additionalProperties": {
|
|
1703
|
-
"type": "object",
|
|
1704
|
-
"properties": {
|
|
1705
|
-
"command": {
|
|
1706
|
-
"$ref": "common.json#/$defs/command"
|
|
1707
|
-
},
|
|
1708
|
-
"confirm": {
|
|
1709
|
-
"$ref": "#/$defs/question"
|
|
1710
|
-
}
|
|
1711
|
-
},
|
|
1712
|
-
"required": [
|
|
1713
|
-
"command"
|
|
1714
|
-
],
|
|
1715
|
-
"additionalProperties": false
|
|
1716
|
-
}
|
|
1717
|
-
},
|
|
1718
|
-
"signIn": {
|
|
1719
|
-
"description": "从 Coda 登录:command 打印一个链接,在任一设备上确认;installed 查装没装好,install 装上它",
|
|
1720
|
-
"type": "object",
|
|
1721
|
-
"properties": {
|
|
1722
|
-
"command": {
|
|
1723
|
-
"$ref": "common.json#/$defs/command"
|
|
1724
|
-
},
|
|
1725
|
-
"installed": {
|
|
1726
|
-
"$ref": "common.json#/$defs/command"
|
|
1727
|
-
},
|
|
1728
|
-
"install": {
|
|
1729
|
-
"$ref": "common.json#/$defs/command"
|
|
1730
|
-
},
|
|
1731
|
-
"input": {
|
|
1732
|
-
"description": "登录页给出授权码要贴回来时写 authorizationCode:贴的交给 command 的标准输入",
|
|
1733
|
-
"const": "authorizationCode"
|
|
1734
|
-
},
|
|
1735
|
-
"note": {
|
|
1736
|
-
"$ref": "#/$defs/question"
|
|
1737
|
-
}
|
|
1738
|
-
},
|
|
1739
|
-
"required": [
|
|
1740
|
-
"command"
|
|
1741
|
-
],
|
|
1742
|
-
"additionalProperties": false,
|
|
1743
|
-
"if": {
|
|
1744
|
-
"required": [
|
|
1745
|
-
"install"
|
|
1746
|
-
]
|
|
1747
|
-
},
|
|
1748
|
-
"then": {
|
|
1749
|
-
"description": "写了 install 就要写 installed:Coda 才知道装没装好",
|
|
1750
|
-
"required": [
|
|
1751
|
-
"installed"
|
|
1752
|
-
]
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
},
|
|
1756
|
-
"required": [
|
|
1757
|
-
"id",
|
|
1758
|
-
"title",
|
|
1759
|
-
"command"
|
|
1760
|
-
],
|
|
1761
|
-
"additionalProperties": false,
|
|
1762
|
-
"if": {
|
|
1763
|
-
"required": [
|
|
1764
|
-
"report"
|
|
1765
|
-
]
|
|
1766
|
-
},
|
|
1767
|
-
"then": {
|
|
1768
|
-
"required": [
|
|
1769
|
-
"kind"
|
|
1770
|
-
],
|
|
1771
|
-
"description": "report 只在写了 kind 时有意义"
|
|
1772
|
-
}
|
|
1773
|
-
},
|
|
1774
|
-
"$defs": {
|
|
1775
|
-
"question": {
|
|
1776
|
-
"description": "不超过 200 字,可以分行",
|
|
1777
|
-
"type": "string",
|
|
1778
|
-
"maxLength": 200,
|
|
1779
|
-
"pattern": "^(?=[\\s\\S]*\\S)[^\\u0000]*$"
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
},
|
|
1784
|
-
"panels": {
|
|
1785
|
-
"description": "旧的资源页面板:插件在 contributes.panels 里声明,资源页把它当作资源显示;新插件写 contributes.resources",
|
|
1786
|
-
"contributes": "panels",
|
|
1787
|
-
"title": "面板",
|
|
1788
|
-
"commands": {
|
|
1789
|
-
"command": "读取",
|
|
1790
|
-
"actions.*.command": "动作",
|
|
1791
|
-
"signIn.command": "登录",
|
|
1792
|
-
"signIn.installed": "安装检查",
|
|
1793
|
-
"signIn.install": "安装"
|
|
1794
|
-
},
|
|
1795
|
-
"schema": {
|
|
1796
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
1797
|
-
"title": "contributes.panels:资源页上的面板",
|
|
1798
|
-
"description": "面板的数组:每个面板一条读取命令,它打印的 { items } 由资源页画出来(docs/plugins.md「面板」)",
|
|
1799
|
-
"type": "array",
|
|
1800
|
-
"x-unique-by": [
|
|
1801
|
-
"id"
|
|
1802
|
-
],
|
|
1803
|
-
"items": {
|
|
1804
|
-
"type": "object",
|
|
1805
|
-
"properties": {
|
|
1806
|
-
"id": {
|
|
1807
|
-
"$ref": "common.json#/$defs/name"
|
|
1808
|
-
},
|
|
1809
|
-
"title": {
|
|
1810
|
-
"$ref": "common.json#/$defs/line40"
|
|
1811
|
-
},
|
|
1812
|
-
"command": {
|
|
1813
|
-
"$ref": "common.json#/$defs/command"
|
|
1814
|
-
},
|
|
1815
|
-
"maxAge": {
|
|
1816
|
-
"description": "读数不重读还能再显示多久:ISO 8601 时长,如 PT5M(周、天与时分秒,不用年和月)",
|
|
1817
|
-
"type": "string",
|
|
1818
|
-
"maxLength": 200,
|
|
1819
|
-
"pattern": "^P(?!$)(?:\\d+W)?(?:\\d+D)?(?:T(?=\\d)(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
|
|
1820
|
-
},
|
|
1821
|
-
"actions": {
|
|
1822
|
-
"description": "动作名 → { command, confirm }:面板上的按钮执行的命令,和执行前问的话",
|
|
1823
|
-
"type": "object",
|
|
1824
|
-
"propertyNames": {
|
|
1825
|
-
"$ref": "common.json#/$defs/name"
|
|
1826
|
-
},
|
|
1827
|
-
"additionalProperties": {
|
|
1828
|
-
"type": "object",
|
|
1829
|
-
"properties": {
|
|
1830
|
-
"command": {
|
|
1831
|
-
"$ref": "common.json#/$defs/command"
|
|
1832
|
-
},
|
|
1833
|
-
"confirm": {
|
|
1834
|
-
"$ref": "#/$defs/question"
|
|
1835
|
-
}
|
|
1836
|
-
},
|
|
1837
|
-
"required": [
|
|
1838
|
-
"command"
|
|
1839
|
-
],
|
|
1840
|
-
"additionalProperties": false
|
|
1841
|
-
}
|
|
1842
|
-
},
|
|
1843
|
-
"signIn": {
|
|
1844
|
-
"description": "从 Coda 登录:command 打印一个链接,在任一设备上确认;installed 查装没装好,install 装上它",
|
|
1845
|
-
"type": "object",
|
|
1846
|
-
"properties": {
|
|
1847
|
-
"command": {
|
|
1848
|
-
"$ref": "common.json#/$defs/command"
|
|
1849
|
-
},
|
|
1850
|
-
"installed": {
|
|
1851
|
-
"$ref": "common.json#/$defs/command"
|
|
1852
|
-
},
|
|
1853
|
-
"install": {
|
|
1854
|
-
"$ref": "common.json#/$defs/command"
|
|
1855
|
-
},
|
|
1856
|
-
"input": {
|
|
1857
|
-
"description": "登录页给出授权码要贴回来时写 authorizationCode:贴的交给 command 的标准输入",
|
|
1858
|
-
"const": "authorizationCode"
|
|
1859
|
-
},
|
|
1860
|
-
"note": {
|
|
1861
|
-
"$ref": "#/$defs/question"
|
|
1862
|
-
}
|
|
1863
|
-
},
|
|
1864
|
-
"required": [
|
|
1865
|
-
"command"
|
|
1866
|
-
],
|
|
1867
|
-
"additionalProperties": false,
|
|
1868
|
-
"if": {
|
|
1869
|
-
"required": [
|
|
1870
|
-
"install"
|
|
1871
|
-
]
|
|
1872
|
-
},
|
|
1873
|
-
"then": {
|
|
1874
|
-
"description": "写了 install 就要写 installed:Coda 才知道装没装好",
|
|
1875
|
-
"required": [
|
|
1876
|
-
"installed"
|
|
1877
|
-
]
|
|
1878
|
-
}
|
|
1879
|
-
},
|
|
1880
|
-
"displaySetting": {
|
|
1881
|
-
"description": "本插件声明的布尔值表格设置的键,用来逐项选择面板显示哪些数值",
|
|
1882
|
-
"type": "string",
|
|
1883
|
-
"maxLength": 80,
|
|
1884
|
-
"pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"
|
|
1885
|
-
}
|
|
1886
|
-
},
|
|
1887
|
-
"required": [
|
|
1888
|
-
"id",
|
|
1889
|
-
"title",
|
|
1890
|
-
"command"
|
|
1891
|
-
],
|
|
1892
|
-
"additionalProperties": false
|
|
1893
|
-
},
|
|
1894
|
-
"$defs": {
|
|
1895
|
-
"question": {
|
|
1896
|
-
"description": "不超过 200 字,可以分行",
|
|
1897
|
-
"type": "string",
|
|
1898
|
-
"maxLength": 200,
|
|
1899
|
-
"pattern": "^(?=[\\s\\S]*\\S)[^\\u0000]*$"
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
},
|
|
1641
|
+
"extensionPoints": {},
|
|
1905
1642
|
"extensions": []
|
|
1906
1643
|
},
|
|
1907
1644
|
{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// may plug into a point one of them declares for it (`contributes.extensionPoints` there, `contributes.extensions` here).
|
|
3
3
|
// Coda checks the names and hands each plugin what is plugged into its points, as declared: what passes between the two
|
|
4
4
|
// is the extended plugin's own contract, which Coda neither reads nor shapes. A point may instead take what any plugin
|
|
5
|
-
// writes under a key of its `contributes` (`contributes` there
|
|
5
|
+
// writes under a key of its `contributes` (`contributes` there): of the schema the point
|
|
6
6
|
// declares, kept as written, for the declaring plugin to read, only the commands in it listed where installing confirms them.
|
|
7
7
|
import { CORE_PROTOCOLS } from '@coda-console/protocol/protocol';
|
|
8
8
|
import { pointProblem, valueProblem } from '@coda-console/protocol/validate';
|
|
@@ -109,7 +109,7 @@ export function wantedLevel(engines) {
|
|
|
109
109
|
return typeof value === 'string' && /^[1-9][0-9]{0,8}$/.test(value) ? Number(value) : null;
|
|
110
110
|
}
|
|
111
111
|
// The keys of `contributes` Coda once read and no longer does: a manifest still writing one was made for what Coda took away.
|
|
112
|
-
const RETIRED_CONTRIBUTES = ['endpoints', 'groups', 'events'];
|
|
112
|
+
const RETIRED_CONTRIBUTES = ['endpoints', 'groups', 'events', 'resources', 'panels'];
|
|
113
113
|
// Those of them `contributes` writes, a manifest's or a version's registry metadata: what either is read with as its `retired`.
|
|
114
114
|
export const retiredContributes = contributes => RETIRED_CONTRIBUTES.filter(key => Object.hasOwn(contributes ?? {}, key));
|
|
115
115
|
// Whether a plugin runs on this machine (docs/plugins.md「兼容」): the one judgment reading a source, installing, the store and
|
|
@@ -27,8 +27,8 @@ const ID = /^[a-z][a-z0-9-]{0,39}$/;
|
|
|
27
27
|
// Plugins that ship with Coda, as VS Code's built-in extensions ship with it: updated with Coda itself.
|
|
28
28
|
export const BUILTIN_DIR = fileURLToPath(new URL('../../resources/plugins/', import.meta.url));
|
|
29
29
|
// What the plugins' base reads of `contributes` itself, the general types schemas/plugin.json names; any other key is a
|
|
30
|
-
// contribution point's (contribution-points.mjs), or for a point another plugin declares to take it
|
|
31
|
-
//
|
|
30
|
+
// contribution point's (contribution-points.mjs), or for a point another plugin declares to take it, refused when
|
|
31
|
+
// neither does.
|
|
32
32
|
export const CONTRIBUTES = TYPES;
|
|
33
33
|
// The shortest a kind's records are given again by its command on their own (`contributes.records`' `every`).
|
|
34
34
|
const EVERY_LEAST = 60_000;
|
|
@@ -232,7 +232,7 @@ export function publishedFrom(repository) {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
// ---- Its processes ----
|
|
235
|
-
// What Coda gives each process it runs for a plugin (docs/plugins.md「插件进程的环境」) — its agents',
|
|
235
|
+
// What Coda gives each process it runs for a plugin (docs/plugins.md「插件进程的环境」) — its agents', the steps
|
|
236
236
|
// of its workflows, the commands it puts on sessions' PATH —, beside the environment the process runs in: Coda's own Node,
|
|
237
237
|
// the plugin's directory and its state on this backend (`stateDir(id)`, none without one), its settings as they apply
|
|
238
238
|
// (`settings`), what installed plugins plug into its points and where the plugins it depends on are, whose files (an npm
|
|
@@ -352,7 +352,7 @@ export function contributions(plugin, catalog = new Map(), defined = () => null)
|
|
|
352
352
|
...(v.checkout ? { checkout: v.checkout } : {}), ...(v.provides ? { provides: v.provides } : {}) })) } : {}),
|
|
353
353
|
...Object.assign({}, ...[...CONTRIBUTION_POINTS.values()].map(point => point.confirm?.(plugin))),
|
|
354
354
|
extensions: plugin.extensions.map(e => ({ plugin: e.plugin, point: e.point, command: e.command })),
|
|
355
|
-
// What it writes for points under keys of `contributes
|
|
355
|
+
// What it writes for points under keys of `contributes`: by point, how many and the
|
|
356
356
|
// commands in them, each with what it is for.
|
|
357
357
|
...(offers.length ? { offers } : {}),
|
|
358
358
|
...(plugin.setup ? { setup: { command: plugin.setup.command } } : {}),
|
package/check/coda/contract.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "b5d62fd390b27f300bb43d6c5b6bb6bb133a8515",
|
|
3
3
|
"apiLevel": 6,
|
|
4
4
|
"packages": {
|
|
5
5
|
"@0dep/piso": "5.2.0",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"check/coda/adapters/clock.mjs": "79733b9ac3807b3da147fe8b782318a1cb42d1d51b9c8b81a507c13c7a8025fd",
|
|
20
20
|
"check/coda/adapters/plugin-command.mjs": "47bd580f7142780933315f64d4562d23a61f996b3f411cfb583333261b590ee8",
|
|
21
21
|
"check/coda/adapters/plugin-events.mjs": "5b6b98063a2a2f3d112908ad9fdc08119ec1bd577ca765811799ef6d1030dfe4",
|
|
22
|
-
"check/coda/adapters/plugin-modules.mjs": "
|
|
22
|
+
"check/coda/adapters/plugin-modules.mjs": "9a86b356897864a9f0dabc5ec73deaf0c54e4913e538cd5f759f4a1959213cc9",
|
|
23
23
|
"check/coda/adapters/plugin-stream-services.mjs": "1e92eb3dd9d844d4f2773a60bc2941aae3c9cda10d9e96e31de9f09f51e672e5",
|
|
24
|
-
"check/coda/adapters/plugin-test-host.d.mts": "
|
|
24
|
+
"check/coda/adapters/plugin-test-host.d.mts": "c86b3244f3f5d58fe5f25b50c2e7bd00983d72b841ca4a978f10d4dfa6ceae87",
|
|
25
25
|
"check/coda/adapters/plugin-test-host.mjs": "7c8e5ee46792181bfd3b2f4d67d1ac6844c64c2af678655308cfdeb5ecf84c42",
|
|
26
26
|
"check/coda/adapters/process-relay.mjs": "5d379bd7ad07138d69c7accbe769d71294843399539bdf1fab8b6a1ddf13b9d8",
|
|
27
27
|
"check/coda/components/composers/contributions.mjs": "43d3e15fb1f63b7b5c20716030d9537613809ed5cc2fb466a3678bfa308f9f92",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"check/coda/components/plugins/contribution-points.mjs": "2dade9fe4f3fa2b4e89f49a1ac4378ab2621e5ac542eb175967091f04568b45c",
|
|
31
31
|
"check/coda/components/plugins/git-contributions.mjs": "532917cd3ec45e12535e9e6c206ae14fa598bebc789ab0c8f15609d1699fa1cd",
|
|
32
32
|
"check/coda/components/plugins/model-contributions.mjs": "018a7157954b2326887ba1a780b37d3beb33338e41a28936b313562c2939d563",
|
|
33
|
-
"check/coda/components/plugins/plugin-extensions.mjs": "
|
|
33
|
+
"check/coda/components/plugins/plugin-extensions.mjs": "31ce03ceec14ef36cb5db5a197e444567286de43a2162eec3af7d005697daa63",
|
|
34
34
|
"check/coda/components/plugins/plugin-icons.mjs": "ec29cadce4948ecacabfe911a2ceb45414b96e28971358acbc4e952bedc78e1a",
|
|
35
|
-
"check/coda/components/plugins/plugin-rules.mjs": "
|
|
36
|
-
"check/coda/components/plugins/plugin-source-rules.mjs": "
|
|
35
|
+
"check/coda/components/plugins/plugin-rules.mjs": "546785b38813791ea6cd423952178d880524184cc782003bba7f3387787c1fd5",
|
|
36
|
+
"check/coda/components/plugins/plugin-source-rules.mjs": "2ed213f001929a54b05237e7bce4bf561f20068f552234ef74648c1ec53e3d09",
|
|
37
37
|
"check/coda/components/plugins/process-contributions.mjs": "6d39a904f52956b87c04351398f79a4fc34981fa01453195bd7a3b9f2c5d237b",
|
|
38
38
|
"check/coda/components/plugins/skill-document.mjs": "153ad3c096c7c9b7774bcf7dcc0ba603c962ee1ac8697c8a71e3f2c9ba9c92e6",
|
|
39
39
|
"check/coda/components/prompt-recovery/prompt-recovery.mjs": "25477742af8a9134ae343af6ab702926692bdd8dd07844f3cba47e8b702c0e49",
|
|
@@ -57,10 +57,7 @@
|
|
|
57
57
|
"check/coda/kernel/project-protocol.mjs": "69874b2b226f111b156724454c968e829018f1caac0a02883f13e1f980482739",
|
|
58
58
|
"check/coda/kernel/thread-protocol.mjs": "58bbd66c0058552f26c1b4ed08231e9afd142f2b7a9f50ed6bd66cbfe8f579e1",
|
|
59
59
|
"check/coda/kernel/usage-protocol.mjs": "4bd07a4d4c63c75e5328ef7e907bfa4e83af430f7f04a08cf8eb883a23ddc51f",
|
|
60
|
-
"check/coda/
|
|
61
|
-
"check/coda/
|
|
62
|
-
"check/coda/resources/plugins/resources/panels/sign-in.mjs": "6eb016ef9a7f8aa03e0f4b2fa35ce139b8b1ff0deb4ec6e6a34139aed4f2841a",
|
|
63
|
-
"check/coda/builtin.json": "d42d66c67aa3a9dee8239146ef797617d6502b45f48e0557a7db899e12a5737c",
|
|
64
|
-
"check/coda/api-surface.txt": "babddd7c7fb1b897874d86deed1d42f07ded67b2fff60e75a9c0b8c4749581ea"
|
|
60
|
+
"check/coda/builtin.json": "a69fb8a1978b7cdb602f76cfae487e9b683026cf5c35a92c83fdd1b23b4eec83",
|
|
61
|
+
"check/coda/api-surface.txt": "7b21d96b9ccb36cf6dbbc04904ceb39299acc4e05488815297660b1e1c5caca3"
|
|
65
62
|
}
|
|
66
63
|
}
|