@coda-console/protocol 6.16.0 → 6.18.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 +11 -0
- package/README.md +7 -6
- package/docs/protocol.md +50 -11
- package/package.json +1 -1
- package/protocol.mjs +2 -1
- package/schemas/plugin/plugin.json +4 -7
- package/schemas/protocol/v1/resource.json +138 -0
- package/validate.mjs +9 -12
- package/schemas/plugin/extension-points.json +0 -67
- package/schemas/plugin/extensions.json +0 -13
- package/schemas/plugin/self.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
版本规矩见 README 的[「版本」一节](README.md#版本)。协议自己的大版本写在协议名里(如 `coda/run@1`),与 npm 包版本、插件清单的 v2 独立;更早的版本见 git 历史。
|
|
4
4
|
|
|
5
|
+
## 6.18.0 — 2026-11-20
|
|
6
|
+
|
|
7
|
+
- 这是在 6.17.0 之上的次版本。依据 README「版本」一节:这三个键都不在 `stable/manifest.json`,是内部面,删内部键升次版本;`stable-grows` 与 `test/stable.test.mjs` 不受影响(Coda 宿主设计 coda#2749 H9-C)。
|
|
8
|
+
- 不兼容:删掉清单 `contributes.extensionPoints`、`contributes.extensions`、`contributes.self` 三个类型:删去 `schemas/plugin/extension-points.json`、`extensions.json`、`self.json` 与 `plugin.json` 里的三处引用,`TYPES` 少这三项。`extensionDependencies` 是独立的顶层键,不动。
|
|
9
|
+
- 原因:H9-C 删旧槽位(扩展点)、删预留(`contributes.self` 的命令形式,只留模块的 `coda.self.handle`)。`plugin.json` 的说明同改:`contributes` 里只有 Coda 认得的键。
|
|
10
|
+
- 这三个键已退役,由 Coda 宿主判「需要更新」,协议 schema 不再定义它们:写了它们的清单,`manifestProblem` 与别的不认识的键一样放过,不查形状(先例见 6.14.0、6.15.0 删 `events`、`endpoints`);schema 只做静态校验,「需要更新」是宿主读到退役键时的诊断,两件事分开。
|
|
11
|
+
|
|
12
|
+
## 6.17.0 — 2026-11-20
|
|
13
|
+
|
|
14
|
+
- 这是在 6.16.0 之上的次版本。依据 README「版本」一节:核心协议是内部面,新增协议升次版本;`stable/` 不动。新增核心协议 `coda/resource@1`(`schemas/protocol/v1/resource.json`,导出 `RESOURCE_PROTOCOL`,加入 `CORE_PROTOCOLS`,复数名 `resource-types`),插件用命令写这种记录,见 Coda 文档「资源」。
|
|
15
|
+
|
|
5
16
|
## 6.16.0 — 2026-11-20
|
|
6
17
|
|
|
7
18
|
- 这是在 6.15.0 之上的次版本。依据 README「版本」一节:Agent 接入协议是内部面,新增 schema 与文档小节升次版本;`stable/` 不动,`stable-grows` 与 `test/stable.test.mjs` 不受影响(每轮 Token 用量采集,coda#1824)。
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Coda 与插件之间的约定,Coda 和插件都引用它,独立演进:
|
|
4
4
|
|
|
5
|
-
- **插件清单的类型**(`schemas/plugin/`):插件目录 `package.json` 里 `contributes` 的每个键是一种类型,各有一份 JSON Schema(draft 2020-12,`$id` 为 `https://coda.pub/schemas/plugin/v2/<文件>`)。`plugin.json` 是整份清单,只列通用键(`configuration`、`
|
|
5
|
+
- **插件清单的类型**(`schemas/plugin/`):插件目录 `package.json` 里 `contributes` 的每个键是一种类型,各有一份 JSON Schema(draft 2020-12,`$id` 为 `https://coda.pub/schemas/plugin/v2/<文件>`)。`plugin.json` 是整份清单,只列通用键(`configuration`、`services`、`setup`、`environment`、`path`、`views`、`protocols`、`protocolImplementations`、`records`);`setting.json` 是一项设置的声明。其余键由 Coda 的贡献点登记表声明:Coda 自己的(`agents`、`composerModes`、`modelProviders` 等)的 schema 仍放在这里作公开数据(如 `agents.json`、`composer-modes.json`),由登记它的 provider 引用;`contributes` 里只有 Coda 认得的键。
|
|
6
6
|
- **通用校验器**(`validate.mjs`):用 Ajv 对清单做 schema 校验。JSON Schema 说不了的只用五个通用关键字(`x-unique-by`、`x-max-contains`、`x-ref`、`x-placeholders`、`x-file`,照 Kubernetes 的 `x-kubernetes-*`),每个在哪里写都是同一个意思,写法见文件开头。校验器不随功能变长:类型加字段就是改 schema。
|
|
7
7
|
- **协议定义与调用**(`schemas/protocol/`、`protocol.mjs`、`docs/protocol.md`):协议是 `命名空间/名字@大版本` + spec/status 的 JSON Schema + 操作;插件在 `contributes.protocols` 里定义自己命名空间下的协议,在 `contributes.protocolImplementations` 里声明实现哪些协议;定义可写 `streams` 声明只读记录流,可写 `events` 声明事件(载荷格式与 `starts`、`ends`;只有事件的协议可以不写 `spec`、`status`、`operations`,`protocolHasRecords` 判断一份定义有没有记录),可写 `permissions` 把操作、流、事件与记录的读取分成权限组,插件在清单根的 `uses` 里按组申请。调用是 `{ record, operation, input, requestId, parent, awaited }`,回答是 `{ result }` 或 `{ run }`;`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/card@1` 是五个核心协议。
|
|
8
8
|
- **流程方言**(`workflow/`):项目和插件的流程(`.coda/workflows/*.bpmn`,BPMN 2.0)在 Coda 的命名空间 `https://coda.pub/schema/bpmn/1.0` 里能写什么。`moddle.json` 是 `coda:` 属性与元素(bpmn-moddle 的描述格式),`values.json` 是每个值能写什么(每个 `coda:` 类型的属性组成的对象的 JSON Schema,一个元素里同种 `coda:` 元素成组的 schema),`actions.json` 是 `coda:action` 的各个动作和它们接受的参数,`dialect.json` 是 Coda 自己发的事件、步骤失败的错误码、表达式能读的运行变量和运行的输入能是哪些类型。`workflow.mjs` 用它们读一份流程:方言里没有的、值不合 schema 的都拒绝,说法是「位置:schema 对那里的说明」。值的 schema 用清单的那几个关键字,另加三个:`x-feel`(是 FEEL:「=」开头是表达式,否则文字里的 `{{ … }}` 是,按这份流程里的名字读得通)、`x-duration`(ISO 8601 时长,不为负)、`x-number`(文字换算成数字是个有限的数)。`structure.json` 声明流程结构规则,`structure.mjs` 负责跨节点检查。
|
|
@@ -44,13 +44,13 @@ const problem = manifestProblem(manifest, 'plugin');
|
|
|
44
44
|
contributionProblem(SCHEMAS['agents.json'], manifest, 'agents', 'plugin');
|
|
45
45
|
// 某个类型里的一部分,如输入框模式声明的参数。
|
|
46
46
|
valueProblem('composer-modes.json#/$defs/parameters', parameters, '插件给出的参数');
|
|
47
|
-
//
|
|
48
|
-
pointProblem(
|
|
47
|
+
// 一个独立的值,按给定的 schema(已读出的对象)校验;给出插件目录时连同值里点名的文件一起查。
|
|
48
|
+
pointProblem(valueSchema, value, 'contributes.panels', 'plugin');
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
```js
|
|
52
52
|
import {
|
|
53
|
-
RUN_PROTOCOL, AGENT_PROTOCOL, SESSION_PROTOCOL, ENVIRONMENT_PROTOCOL, CARD_PROTOCOL, CORE_PROTOCOLS,
|
|
53
|
+
RUN_PROTOCOL, AGENT_PROTOCOL, SESSION_PROTOCOL, ENVIRONMENT_PROTOCOL, CARD_PROTOCOL, RESOURCE_PROTOCOL, CORE_PROTOCOLS,
|
|
54
54
|
definitionProblem, ownedProtocolsProblem, runStatusProblem,
|
|
55
55
|
invocationRequestProblem, invocationResponseProblem,
|
|
56
56
|
parseProtocolName, formatProtocolName, protocolShortName,
|
|
@@ -81,7 +81,7 @@ optionsProblem([{ id: 'release', name: '发布正式版', default: false, inputs
|
|
|
81
81
|
// CODA_FIELDS 是同一份 fields.json,也可从 @coda-console/protocol/workflow/fields.json 导入。
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
给 `pointProblem` 的 schema 和这里的并列:可以 `$ref` 协议的 schema(`common.json#/$defs/line40`),可以用五个关键字;它自己写的 `$id` 不算数,指针只指它校验的那份值里的位置。
|
|
85
85
|
|
|
86
86
|
`TYPES` 是清单 schema 自己校验的通用键(4.0.0 起不含 `agents` 等 Coda 业务键),`SCHEMAS` 是 `schemas/plugin/` 里的全部 schema(按文件名),包括业务键的。协议定义的 schema 在 `schemas/protocol/v1/`,由 `@coda-console/protocol/protocol` 导出。
|
|
87
87
|
|
|
@@ -136,6 +136,7 @@ agentValueProblem('review.json', review, '工具的审核');
|
|
|
136
136
|
- **`coda/agent@1`**:Agent 资源,复数名 `agents`;spec 照 Coda 的 Agent 资源(`agent`、`title`、`plugin?`、`defaultModel`、`models`、`modes` 等),`plugin` 是提供 Agent 程序的插件、不是记录的 provider;status 为空对象;操作 `spawn`(`run: true`)开一个子会话。
|
|
137
137
|
- **`coda/session@1`**:插件提供的外部会话。spec 是标题、容器和可选的环境引用;status 是 `head` 游标、参与者(可带头像 `avatar`)与 `post` 收不收语音(`accepts`);操作 `read`(`safe`)与 `draft`(`idempotent`)是立即结果,`post` 开运行;撤回、编辑、表情是用 `about` 指向旧消息的新消息。
|
|
138
138
|
- **`coda/environment@1`**:插件提供的只读外部环境。spec 带 `actions`;操作 `list` 列目录、`read` 读文件(一次至多 1 MiB)。
|
|
139
|
+
- **`coda/resource@1`**:插件持有的一种资源类型在一台机器上的现状,复数名 `resource-types`;一条记录是一台机器上一个插件的一个资源类型,`key` 是类型 ID。spec 是 `{ type, title, resources, signIn? }`;status 是 `{}`;操作 `act`、`sign-in`、`install`。
|
|
139
140
|
|
|
140
141
|
统一调用是 `{ record: {kind,id}, operation, input, requestId, parent: {kind,id}, awaited }`,回答恰为 `{ result }` 或 `{ run: {kind,id} }` 之一。同一 `requestId` 重发只做一次;慢操作返回运行引用,调用方 watch 运行记录取结果,没有推送或回写。
|
|
141
142
|
|
|
@@ -151,7 +152,7 @@ agentValueProblem('review.json', review, '工具的审核');
|
|
|
151
152
|
|
|
152
153
|
Coda 与检查包都钉一个确切版本。对第三方的兼容承诺只覆盖**稳定面**:第三方实际在用的清单键和页面接口,定义在随 npm 包发布的 [`stable/manifest.json`](stable/manifest.json) 与 [`stable/view.json`](stable/view.json)。稳定面只增不减;要改变或删除承诺,先标弃用,保留过渡时间,不能直接移除定义或破坏现有用法。
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
其余都是**内部面**,不承诺兼容,删改升次版本。包括未列入稳定面的清单键、模块的 `coda` 对象、`CODA_*` 环境变量、Agent 接入协议、协议定义与流程方言,以及 `coda-view://service/…`。新增可选字段、新类型、放宽限制升次版本。主版本只留给稳定面的不兼容改动;按稳定面只增不减的规矩,这不该发生,真要发生须先标弃用、留过渡时间。协议名里的版本(如 `coda/run@1`)与 npm 包版本、schema 的 `$id` 独立。
|
|
155
156
|
|
|
156
157
|
两份数据各有从 1 起的整数 `revision`。每项清单以 `path` 标识;`.` 分隔固定键,`[]` 表示数组项,`*` 表示插件自行命名的键。例如 `contributes.configuration.properties.*.additionalProperties.properties.*.format`。`values` 是承诺接受的取值,而非完整枚举。页面文件的成员、事件、根类名、CSS 变量分别列出;`open.targets` 只承诺 `{ view, args }`,`toolbar.fields/kinds` 只承诺列出的字段和种类。
|
|
157
158
|
|
package/docs/protocol.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
- 协议定义文档的 JSON Schema 与校验:`schemas/protocol/v1/definition.json`、`@coda-console/protocol/protocol`;
|
|
8
8
|
- 统一调用信封:`schemas/protocol/v1/request.json`、`response.json`;
|
|
9
|
-
-
|
|
10
|
-
- 插件清单里的 `contributes.protocols`、`contributes.protocolImplementations
|
|
9
|
+
- 六个核心协议:`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/card@1`、`coda/resource@1`;
|
|
10
|
+
- 插件清单里的 `contributes.protocols`、`contributes.protocolImplementations` 与 `contributes.records`。
|
|
11
11
|
|
|
12
12
|
`executor` 与 `execution` 两个旧对象协议和 `@coda-console/protocol/executor` 在 3.0.0 删除。
|
|
13
13
|
|
|
@@ -251,7 +251,7 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
|
|
|
251
251
|
}
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1` 的分组如下,都标 `trial`(还不在稳定面里)。`coda/session@1` 的 `draft` 是客户端输入框的击键流,不分组,不对插件开放:
|
|
254
|
+
`coda/run@1`、`coda/agent@1`、`coda/session@1`、`coda/environment@1`、`coda/resource@1` 的分组如下,都标 `trial`(还不在稳定面里)。`coda/session@1` 的 `draft` 是客户端输入框的击键流,不分组,不对插件开放:
|
|
255
255
|
|
|
256
256
|
| 协议 | 组 | 说明 | 管什么 |
|
|
257
257
|
| --- | --- | --- | --- |
|
|
@@ -262,6 +262,8 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
|
|
|
262
262
|
| `coda/session@1` | `read` | 读取外部会话的标题、参与者与消息 | 读记录、`read` |
|
|
263
263
|
| | `post` | 以你的身份往外部会话里发消息 | `post` |
|
|
264
264
|
| `coda/environment@1` | `read` | 浏览并读取外部环境里的目录与文件 | 读记录、`list`、`read` |
|
|
265
|
+
| `coda/resource@1` | `read` | 查看资源类型与它们的读数 | 读记录 |
|
|
266
|
+
| | `act` | 做资源上的动作、登录和安装 | `act`、`sign-in`、`install` |
|
|
265
267
|
|
|
266
268
|
插件申请权限写在清单根的 `uses`(见「插件清单」)。
|
|
267
269
|
|
|
@@ -306,13 +308,7 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
|
|
|
306
308
|
- `every`:可选,定时重跑的间隔,ISO 8601 风格:周 `W`、天 `D`、时 `H`、分 `M`、秒 `S`(如 `PT5M`、`PT90S`、`P1W1D`),只有秒能带小数点,不收年、月;不短于 `PT1M`;不写就不定时。下限 schema 表达不了,由 Coda 判。
|
|
307
309
|
- 不许别的键。命令怎么跑、打印什么由 Coda 的文档讲,这里不重述。
|
|
308
310
|
|
|
309
|
-
`contributes
|
|
310
|
-
|
|
311
|
-
```json
|
|
312
|
-
"self": {"operation": "bin/self-operation.sh"}
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
插件用到别的协议的权限,写在清单根的 `uses`,不放进 `contributes`(Coda 把不认识的 `contributes` 键当扩展点,旧版本会因此拒装)。键是带大版本的协议名,值是权限组名的数组,至少一项、不重复:
|
|
311
|
+
插件用到别的协议的权限,写在清单根的 `uses`,不放进 `contributes`(`contributes` 里只有 Coda 认得的键)。键是带大版本的协议名,值是权限组名的数组,至少一项、不重复:
|
|
316
312
|
|
|
317
313
|
```json
|
|
318
314
|
{
|
|
@@ -331,7 +327,7 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
|
|
|
331
327
|
|
|
332
328
|
这里只查形状;Coda 当前的 API Level 与兼容判定由 Coda 实现。
|
|
333
329
|
|
|
334
|
-
`manifestProblem` 校验清单的外壳与通用键(这两个键在其中);别的键由 Coda
|
|
330
|
+
`manifestProblem` 校验清单的外壳与通用键(这两个键在其中);别的键由 Coda 的贡献点登记表声明,按登记方的 schema 校验,本包不管它们的形状。命名空间约束需要插件 ID,单独用:
|
|
335
331
|
|
|
336
332
|
```js
|
|
337
333
|
import { ownedProtocolsProblem } from '@coda-console/protocol/protocol';
|
|
@@ -606,6 +602,49 @@ status 是 `{ state: "available"|"unreachable", reason? }`。
|
|
|
606
602
|
}
|
|
607
603
|
```
|
|
608
604
|
|
|
605
|
+
## coda/resource@1
|
|
606
|
+
|
|
607
|
+
插件持有的一种资源类型在一台机器上的现状,复数名是 `resource-types`。一条记录是一台机器上一个插件的一个资源类型,`key` 是类型 ID;记录由插件的记录命令写,资源页只读记录、调操作。整条记录编码后不超过 64 KiB,schema 不另设字节上限,由 Coda 在写入时查。`status` 是 `{}`,不用。
|
|
608
|
+
|
|
609
|
+
spec:
|
|
610
|
+
|
|
611
|
+
| 字段 | 含义 |
|
|
612
|
+
| --- | --- |
|
|
613
|
+
| `type` | 必填,类型 ID,和 `key` 相同(读别家记录的页面拿不到 `key`);schema 比不了两者,由 Coda 查 |
|
|
614
|
+
| `title` | 必填,类型名,一行,至多 40 字 |
|
|
615
|
+
| `resources` | 必填,至多 50 项;没登录的类型写空数组 |
|
|
616
|
+
| `signIn` | 可选,`{ installed, installable, input?, note? }`:没写就是不能从 Coda 登录;`installed` 是登录用的程序装好了没有,`installable` 是有没有 `install` 命令,`input` 只认 `authorizationCode`(登录页给出授权码要贴回来),`note` 是登录前的一句话,至多 200 字 |
|
|
617
|
+
|
|
618
|
+
`resources` 每项 `{ name?, identity?, values, error?, buttons }`:`name`(至多 80 字)与非空 `values` 至少有一样;`identity` 至多 200 字,只用来比较;`error` 一行,至多 80 字。
|
|
619
|
+
|
|
620
|
+
- `values` 至多 8 项,每项 `{ label?, value?, fraction?, time? }`:`value`(至多 80 字)与数值 `fraction`(0–1)至少有一样;`time` 是 ISO 8601 时间。
|
|
621
|
+
- `buttons` 至多 8 项,每项 `{ label, action | view | url, args?, confirm?, disabled? }`,`action`、`view`、`url` 三选一:`action` 调 `act` 操作,`view` 打开本插件的视图,`url` 只认 https(至多 2000 字),不带 `args` 与 `confirm`。`args` 是 JSON 对象,序列化后至多 4096 字节;JSON Schema 说不了字节数,schema 不查,由宿主在写记录和收 `act` 调用时检查。`action`、`view` 有没有对应的动作与视图 schema 查不了:不认识的动作由 `act` 失败,不认识的视图由页面打开时失败。
|
|
622
|
+
|
|
623
|
+
三个操作都是立即结果 `{}`,不分 `safe`:
|
|
624
|
+
|
|
625
|
+
| 操作 | 输入 | 期限 | 说明 |
|
|
626
|
+
| --- | --- | --- | --- |
|
|
627
|
+
| `act` | `{ action, args }` | 10 分钟 | 做按钮上的动作,由插件的命令按 `action` 分派;`args` 必填,没有参数的按钮传 `{}` |
|
|
628
|
+
| `sign-in` | `{}` | 15 分钟 | 进度 `{ url, code? }` 报登录链接(和设备码);`signIn.input` 为 `authorizationCode` 时提问 `{ input: "authorizationCode" }`,回答 `{ code }` |
|
|
629
|
+
| `install` | `{}` | 10 分钟 | 装上登录要用的程序 |
|
|
630
|
+
|
|
631
|
+
```json
|
|
632
|
+
{
|
|
633
|
+
"key": "claude",
|
|
634
|
+
"spec": {
|
|
635
|
+
"type": "claude",
|
|
636
|
+
"title": "Claude",
|
|
637
|
+
"resources": [{
|
|
638
|
+
"name": "leavan",
|
|
639
|
+
"values": [{"label": "5 小时", "value": "80%", "fraction": 0.8, "time": "2026-11-20T08:00:00.000Z"}],
|
|
640
|
+
"buttons": [{"label": "移除", "action": "remove", "args": {"id": "a1"}, "confirm": "确定移除?"}]
|
|
641
|
+
}],
|
|
642
|
+
"signIn": {"installed": true, "installable": false, "input": "authorizationCode"}
|
|
643
|
+
},
|
|
644
|
+
"status": {}
|
|
645
|
+
}
|
|
646
|
+
```
|
|
647
|
+
|
|
609
648
|
## coda/card@1
|
|
610
649
|
|
|
611
650
|
会话向用户或上层 Agent 要的一个输入。复数名是 `cards`。由提出它的会话所在的后端持有;持有方可以按自己的表读穿给出,不另存。运行等它时,`coda/run@1` 的 `status.awaiting` 指向这条记录。卡片自己没有操作。
|
package/package.json
CHANGED
package/protocol.mjs
CHANGED
|
@@ -15,8 +15,9 @@ export const AGENT_PROTOCOL = read('agent.json');
|
|
|
15
15
|
export const SESSION_PROTOCOL = read('session.json');
|
|
16
16
|
export const ENVIRONMENT_PROTOCOL = read('environment.json');
|
|
17
17
|
export const CARD_PROTOCOL = read('card.json');
|
|
18
|
+
export const RESOURCE_PROTOCOL = read('resource.json');
|
|
18
19
|
export const CORE_PROTOCOLS = Object.freeze(Object.fromEntries(
|
|
19
|
-
[RUN_PROTOCOL, AGENT_PROTOCOL, SESSION_PROTOCOL, ENVIRONMENT_PROTOCOL, CARD_PROTOCOL].map(protocol => [protocol.name, protocol])));
|
|
20
|
+
[RUN_PROTOCOL, AGENT_PROTOCOL, SESSION_PROTOCOL, ENVIRONMENT_PROTOCOL, CARD_PROTOCOL, RESOURCE_PROTOCOL].map(protocol => [protocol.name, protocol])));
|
|
20
21
|
|
|
21
22
|
const ajv = newAjv({ ownProperties: true, addUsedSchema: false, strict: false });
|
|
22
23
|
const definitionCheck = ajv.compile(PROTOCOL_DEFINITION);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://coda.pub/schemas/plugin/v2/plugin.json",
|
|
4
4
|
"title": "插件清单(插件目录的 package.json)",
|
|
5
|
-
"description": "照 VS Code 扩展的 package.json 写;Coda 读的是下面这些键,其余是 npm 的,不管。contributes 下这里只写通用键,各有自己的 schema;其余键由 Coda
|
|
5
|
+
"description": "照 VS Code 扩展的 package.json 写;Coda 读的是下面这些键,其余是 npm 的,不管。contributes 下这里只写通用键,各有自己的 schema;其余键由 Coda 的贡献点登记表声明,由登记它的 provider 的 schema 校验。",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"id": {"$ref": "common.json#/$defs/id", "description": "插件 ID:小写字母、数字和「-」,以字母开头,至多 40 个字符;不写就用 name"},
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"activationEvents": {"description": "宿主什么时候加载 main:onStartupFinished(后端一启动),不重复", "type": "array", "items": {"enum": ["onStartupFinished"]}, "uniqueItems": true},
|
|
31
31
|
"extensionDependencies": {"description": "需要先装的插件的 ID,不重复", "type": "array", "items": {"$ref": "common.json#/$defs/id"}, "uniqueItems": true},
|
|
32
32
|
"uses": {
|
|
33
|
-
"description": "插件用到的别的协议的权限:协议名(带大版本,如 coda/thread@1)→ 权限组名的数组,至少一项、不重复。没声明的调用被宿主拒绝。放在清单根上而不是 contributes 里:Coda
|
|
33
|
+
"description": "插件用到的别的协议的权限:协议名(带大版本,如 coda/thread@1)→ 权限组名的数组,至少一项、不重复。没声明的调用被宿主拒绝。放在清单根上而不是 contributes 里:contributes 里只有 Coda 认得的键,不认识的键 Coda 判无效。组在不在该协议的定义里由 Coda 对照目录查,这里只管形状",
|
|
34
34
|
"type": "object",
|
|
35
35
|
"maxProperties": 100,
|
|
36
36
|
"propertyNames": {"$ref": "https://coda.pub/schemas/protocol/v1/definition.json#/$defs/name"},
|
|
@@ -49,12 +49,10 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"contributes": {
|
|
52
|
-
"description": "插件带来的东西:每个键一种类型。这里只列通用键;其余键由 Coda
|
|
52
|
+
"description": "插件带来的东西:每个键一种类型。这里只列通用键;其余键由 Coda 的贡献点登记表声明,contributes 里只有 Coda 认得的键",
|
|
53
53
|
"type": "object",
|
|
54
54
|
"properties": {
|
|
55
55
|
"configuration": {"$ref": "configuration.json"},
|
|
56
|
-
"extensionPoints": {"$ref": "extension-points.json"},
|
|
57
|
-
"extensions": {"$ref": "extensions.json"},
|
|
58
56
|
"services": {"$ref": "services.json"},
|
|
59
57
|
"setup": {"$ref": "setup.json"},
|
|
60
58
|
"environment": {"$ref": "environment.json"},
|
|
@@ -62,8 +60,7 @@
|
|
|
62
60
|
"views": {"$ref": "views.json"},
|
|
63
61
|
"protocols": {"$ref": "protocols.json"},
|
|
64
62
|
"protocolImplementations": {"$ref": "protocol-implementations.json"},
|
|
65
|
-
"records": {"$ref": "records.json"}
|
|
66
|
-
"self": {"$ref": "self.json"}
|
|
63
|
+
"records": {"$ref": "records.json"}
|
|
67
64
|
},
|
|
68
65
|
"propertyNames": {"description": "contributes 的键:字母和数字,以小写字母开头", "pattern": "^[a-z][A-Za-z0-9]{0,39}$"}
|
|
69
66
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "coda/resource@1",
|
|
3
|
+
"title": "资源",
|
|
4
|
+
"description": "插件持有的一种资源类型在一台机器上的现状:一条记录是一台机器上一个插件的一个资源类型,key 是类型 ID。记录由插件的记录命令写,资源页只读记录、调操作;资源上的动作、登录、安装是这条记录上的操作,由插件的命令实现。整条记录(编码后)不超过 64 KiB,由 Coda 在写入时查。",
|
|
5
|
+
"plural": "resource-types",
|
|
6
|
+
"spec": {
|
|
7
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"type": {"$ref": "#/$defs/name", "description": "类型 ID,必须和记录的 key 相同(读别家记录的页面拿不到 key,靠它认类型);schema 比不了两者,由 Coda 在写入时查"},
|
|
11
|
+
"title": {"type": "string", "$ref": "#/$defs/line", "maxLength": 40, "description": "类型名,如 Claude、GitHub:资源页上只写它,一行,不超过 40 字"},
|
|
12
|
+
"resources": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"maxItems": 50,
|
|
15
|
+
"items": {"$ref": "#/$defs/resource"},
|
|
16
|
+
"description": "这个类型下的资源,如账号;没登录的类型写空数组"
|
|
17
|
+
},
|
|
18
|
+
"signIn": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"description": "能从 Coda 登录:没写就是不能。登录是操作 sign-in,装上是操作 install",
|
|
21
|
+
"properties": {
|
|
22
|
+
"installed": {"type": "boolean", "description": "要登录的程序装好了没有"},
|
|
23
|
+
"installable": {"type": "boolean", "description": "Coda 能不能替它装上,即插件有没有 install 命令"},
|
|
24
|
+
"input": {"const": "authorizationCode", "description": "登录页给出授权码要贴回来时写 authorizationCode:登录命令会提问 { input: \"authorizationCode\" }"},
|
|
25
|
+
"note": {"$ref": "#/$defs/question", "description": "登录前给人看的一句话,不超过 200 字,可以分行"}
|
|
26
|
+
},
|
|
27
|
+
"required": ["installed", "installable"],
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["type", "title", "resources"],
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"$defs": {
|
|
34
|
+
"name": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$", "description": "小写字母、数字和「-」,以字母开头,至多 64 个字符"},
|
|
35
|
+
"line": {"type": "string", "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$", "description": "一行,不能只有空白"},
|
|
36
|
+
"question": {"type": "string", "maxLength": 200, "pattern": "^(?=[\\s\\S]*\\S)[^\\u0000]*$", "description": "不超过 200 字,可以分行"},
|
|
37
|
+
"resource": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"description": "一个资源,如一个账号:name 与非空 values 至少有一样",
|
|
40
|
+
"properties": {
|
|
41
|
+
"name": {"type": "string", "$ref": "#/$defs/line", "maxLength": 80, "description": "资源的名字,如账号名"},
|
|
42
|
+
"identity": {"type": "string", "$ref": "#/$defs/line", "maxLength": 200, "description": "它在外面是谁,如账号的 ID:只用来比较,同一台上相同的合成一行"},
|
|
43
|
+
"values": {"type": "array", "maxItems": 8, "items": {"$ref": "#/$defs/value"}, "description": "读数,至多 8 个"},
|
|
44
|
+
"error": {"type": "string", "$ref": "#/$defs/line", "maxLength": 80, "description": "这个资源哪里不对,一行"},
|
|
45
|
+
"buttons": {"type": "array", "maxItems": 8, "items": {"$ref": "#/$defs/button"}, "description": "按钮,至多 8 个"}
|
|
46
|
+
},
|
|
47
|
+
"required": ["values", "buttons"],
|
|
48
|
+
"anyOf": [
|
|
49
|
+
{"required": ["name"]},
|
|
50
|
+
{"properties": {"values": {"type": "array", "minItems": 1}}}
|
|
51
|
+
],
|
|
52
|
+
"additionalProperties": false
|
|
53
|
+
},
|
|
54
|
+
"value": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"description": "一个读数:叫什么、读出什么、还剩多少(0–1,不知道就不写,不画成空)、随读数来的时刻(如额度什么时候恢复);value 与 fraction 至少有一样",
|
|
57
|
+
"properties": {
|
|
58
|
+
"label": {"type": "string", "$ref": "#/$defs/line", "maxLength": 80},
|
|
59
|
+
"value": {"type": "string", "$ref": "#/$defs/line", "maxLength": 80},
|
|
60
|
+
"fraction": {"type": "number", "minimum": 0, "maximum": 1},
|
|
61
|
+
"time": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])(T([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?(Z|[+-]([01]\\d|2[0-3]):[0-5]\\d)?)?$",
|
|
64
|
+
"description": "ISO 8601 时间"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"anyOf": [{"required": ["value"]}, {"required": ["fraction"]}],
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
"button": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"description": "一个按钮,action、view、url 三选一:action 是调 act 操作做这个动作;view 是打开本插件的一个视图;url 是在设备上打开一个网页,只认 https,不带 args 与 confirm。action 与 view 有没有对应的动作和视图,schema 查不了:不认识的 action 由 act 失败,不认识的 view 由页面打开时失败",
|
|
73
|
+
"properties": {
|
|
74
|
+
"label": {"type": "string", "$ref": "#/$defs/line", "maxLength": 80},
|
|
75
|
+
"action": {"$ref": "#/$defs/name"},
|
|
76
|
+
"view": {"$ref": "#/$defs/name"},
|
|
77
|
+
"url": {"type": "string", "maxLength": 2000, "pattern": "^https://\\S+$"},
|
|
78
|
+
"args": {"$ref": "#/$defs/args"},
|
|
79
|
+
"confirm": {"$ref": "#/$defs/question", "description": "执行前问的话"},
|
|
80
|
+
"disabled": {"type": "boolean"}
|
|
81
|
+
},
|
|
82
|
+
"required": ["label"],
|
|
83
|
+
"oneOf": [
|
|
84
|
+
{"required": ["action"], "not": {"anyOf": [{"required": ["view"]}, {"required": ["url"]}]}},
|
|
85
|
+
{"required": ["view"], "not": {"anyOf": [{"required": ["action"]}, {"required": ["url"]}]}},
|
|
86
|
+
{"required": ["url"], "not": {"anyOf": [{"required": ["action"]}, {"required": ["view"]}, {"required": ["args"]}, {"required": ["confirm"]}]}}
|
|
87
|
+
],
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
},
|
|
90
|
+
"args": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"description": "按钮带给动作或视图的参数:JSON 对象,序列化后不超过 4096 字节。JSON Schema 说不了字节数,由宿主在写记录时检查"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"status": {
|
|
97
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
98
|
+
"type": "object",
|
|
99
|
+
"additionalProperties": false,
|
|
100
|
+
"description": "不用,写空对象"
|
|
101
|
+
},
|
|
102
|
+
"operations": {
|
|
103
|
+
"act": {
|
|
104
|
+
"description": "做按钮上的一个动作:action 是动作名,args 是按钮带的参数(没有就传 {}),由插件的命令分派;不认识的动作让调用失败。期限 10 分钟。",
|
|
105
|
+
"input": {
|
|
106
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"action": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$"},
|
|
110
|
+
"args": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"description": "按钮带的参数,没有就传 {}:JSON 对象,序列化后不超过 4096 字节。JSON Schema 说不了字节数,由宿主在收调用时检查"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": ["action", "args"],
|
|
116
|
+
"additionalProperties": false
|
|
117
|
+
},
|
|
118
|
+
"result": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false},
|
|
119
|
+
"timeout": 600000
|
|
120
|
+
},
|
|
121
|
+
"sign-in": {
|
|
122
|
+
"description": "从 Coda 登录:命令起程序,用进度 { url, code? } 报登录链接(和设备码,有就带)。记录的 signIn.input 为 authorizationCode 时,用户在登录页拿到授权码要贴回来:命令提问 { input: \"authorizationCode\" },回答是 { code }。期限 15 分钟。",
|
|
123
|
+
"input": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false},
|
|
124
|
+
"result": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false},
|
|
125
|
+
"timeout": 900000
|
|
126
|
+
},
|
|
127
|
+
"install": {
|
|
128
|
+
"description": "装上登录要用的程序;记录的 signIn.installable 为 true 才有。期限 10 分钟。",
|
|
129
|
+
"input": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false},
|
|
130
|
+
"result": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false},
|
|
131
|
+
"timeout": 600000
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"permissions": {
|
|
135
|
+
"read": {"title": "查看资源类型与它们的读数", "trial": true, "read": true},
|
|
136
|
+
"act": {"title": "做资源上的动作、登录和安装", "trial": true, "operations": ["act", "sign-in", "install"]}
|
|
137
|
+
}
|
|
138
|
+
}
|
package/validate.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
// A plugin is right when what it writes is of the types it names: each key of a manifest's `contributes` is a type with a
|
|
2
2
|
// JSON Schema of its own. The manifest's schema names only the general ones (schemas/plugin/,
|
|
3
3
|
// `https://coda.pub/schemas/plugin/v2/…`); every other key is one Coda's registry of contribution points declares, with a
|
|
4
|
-
// schema of its provider's (those of Coda's own still kept here, by file)
|
|
5
|
-
//
|
|
6
|
-
// when it
|
|
7
|
-
// schema, never by a rule here. Coda checks a plugin with this module when it reads one, and coda-plugins' contract check
|
|
8
|
-
// does where a plugin is written.
|
|
4
|
+
// schema of its provider's (those of Coda's own still kept here, by file). Checking one is checking it against those
|
|
5
|
+
// schemas, nothing else: a field joins a type by joining its schema, never by a rule here. Coda checks a plugin with this
|
|
6
|
+
// module when it reads one, and coda-plugins' contract check does where a plugin is written.
|
|
9
7
|
// What JSON Schema cannot say of one value alone it says with five keywords, each meaning one thing wherever it is written,
|
|
10
8
|
// as Kubernetes extends its OpenAPI with `x-kubernetes-*`:
|
|
11
9
|
// - `x-unique-by`: [name, { part } or { key, nested }] — in an array, each named property of its objects is unique among the
|
|
@@ -54,8 +52,8 @@ const unescape = step => step.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
|
54
52
|
const escape = step => String(step).replace(/~/g, '~0').replace(/\//g, '~1');
|
|
55
53
|
const fail = (validate, keyword, message, parentSchema) => { validate.errors = [{ keyword, message, params: {}, parentSchema }]; return false; };
|
|
56
54
|
|
|
57
|
-
// What each keyword is written with, checked where a schema using it is compiled: one written wrong is refused there, as
|
|
58
|
-
//
|
|
55
|
+
// What each keyword is written with, checked where a schema using it is compiled: one written wrong is refused there, as a schema
|
|
56
|
+
// given to `pointProblem` is (x-file `schema`), not where a value is checked against it.
|
|
59
57
|
const SCHEMA_VALUE = { type: ['object', 'boolean'] };
|
|
60
58
|
const META = {
|
|
61
59
|
'x-max-contains': { type: 'object', properties: { match: SCHEMA_VALUE, max: { type: 'integer', minimum: 0 } }, required: ['match', 'max'], additionalProperties: false },
|
|
@@ -208,7 +206,7 @@ const validator = file => {
|
|
|
208
206
|
if (!compiled.has(file)) compiled.set(file, ajv.getSchema(`${BASE}${file}`));
|
|
209
207
|
return compiled.get(file);
|
|
210
208
|
};
|
|
211
|
-
// The schema
|
|
209
|
+
// The schema `pointProblem` is given, compiled once by what it says, under an ID of its own beside these (whatever `$id`
|
|
212
210
|
// it wrote), so that it builds on them as they build on one another (`common.json#/$defs/line40`): its validator, and the
|
|
213
211
|
// schema as compiled, for what it says of a failing value. One that answers later (`$async`) is refused.
|
|
214
212
|
const points = new Map();
|
|
@@ -290,7 +288,7 @@ export function described(error, { roots = true, schemas = [], required = 'objec
|
|
|
290
288
|
}
|
|
291
289
|
// What is wrong, said once: the first error, by its place and what the schema says of the value there.
|
|
292
290
|
// What a whole type says of itself is too much for a key it lacks or one written twice: those say only what is wrong.
|
|
293
|
-
// `schemas`: those besides these the value was checked against (
|
|
291
|
+
// `schemas`: those besides these the value was checked against (one given to `pointProblem`).
|
|
294
292
|
// `style: 'description'` uses schema wording for every keyword. `required: 'property'` names and describes the
|
|
295
293
|
// missing property; `schemaBase` resolves its references. `leadingDot` retains relative paths with an empty base.
|
|
296
294
|
export function explain(errors, base = '', schemas = [], { style = 'keyword', required = 'object', schemaBase, leadingDot = false } = {}) {
|
|
@@ -321,9 +319,8 @@ export function valueProblem(ref, value, where) {
|
|
|
321
319
|
if (!validate) throw new Error(`没有这个 schema:${ref}`);
|
|
322
320
|
return validate.call({ dir: null }, value) ? null : explain(validate.errors, where);
|
|
323
321
|
}
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
// directory, for the files it names. The schema sees the value alone: its pointers name places in it.
|
|
322
|
+
// A stand-alone `value` (under `where`, as `contributes.panels`), checked against the `schema` given (an object already
|
|
323
|
+
// read): null, or what is wrong. `dir`: the plugin's directory, for the files the value names. The schema sees the value alone: its pointers name places in it.
|
|
327
324
|
export function pointProblem(schema, value, where, dir = null) {
|
|
328
325
|
const point = declared(schema);
|
|
329
326
|
return point.validate.call({ dir }, value) ? null : explain(point.validate.errors, where, [point.schema]);
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/v2/extension-points.json",
|
|
4
|
-
"title": "contributes.extensionPoints:插件声明的扩展点",
|
|
5
|
-
"description": "扩展点名 → 声明。只写 description 的,别的插件用 contributes.extensions 接一条命令;写了 contributes 的,任何插件在它的 contributes 里用这个键写的东西归它,原样交给声明它的插件读,合乎它的 schema 才装得上。",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"propertyNames": {"$ref": "common.json#/$defs/id"},
|
|
8
|
-
"additionalProperties": {
|
|
9
|
-
"type": "object",
|
|
10
|
-
"properties": {
|
|
11
|
-
"description": {"$ref": "common.json#/$defs/line200"},
|
|
12
|
-
"contributes": {
|
|
13
|
-
"description": "别的插件在 contributes 里用的键:字母和数字,以小写字母开头,不能是 Coda 自己的类型",
|
|
14
|
-
"type": "string",
|
|
15
|
-
"pattern": "^[a-z][A-Za-z0-9]{0,39}$",
|
|
16
|
-
"not": {
|
|
17
|
-
"enum": [
|
|
18
|
-
"configuration",
|
|
19
|
-
"capabilities",
|
|
20
|
-
"instructions",
|
|
21
|
-
"agents",
|
|
22
|
-
"extensionPoints",
|
|
23
|
-
"extensions",
|
|
24
|
-
"groups",
|
|
25
|
-
"events",
|
|
26
|
-
"commands",
|
|
27
|
-
"gitCredentials",
|
|
28
|
-
"repositories",
|
|
29
|
-
"services",
|
|
30
|
-
"setup",
|
|
31
|
-
"skills",
|
|
32
|
-
"environment",
|
|
33
|
-
"path",
|
|
34
|
-
"endpoints",
|
|
35
|
-
"mcpServers",
|
|
36
|
-
"views",
|
|
37
|
-
"modelProviders",
|
|
38
|
-
"executors",
|
|
39
|
-
"protocols",
|
|
40
|
-
"protocolImplementations",
|
|
41
|
-
"composerModes",
|
|
42
|
-
"records",
|
|
43
|
-
"self"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"title": {"$ref": "common.json#/$defs/line20"},
|
|
48
|
-
"commands": {
|
|
49
|
-
"description": "每样东西里哪里是命令(以「.」连接的键名或「*」)→ 安装确认里怎么叫它(不超过 40 字)",
|
|
50
|
-
"type": "object",
|
|
51
|
-
"propertyNames": {"pattern": "^(\\*|[A-Za-z][A-Za-z0-9]{0,39})(\\.(\\*|[A-Za-z][A-Za-z0-9]{0,39})){0,7}$"},
|
|
52
|
-
"additionalProperties": {"$ref": "common.json#/$defs/line40"}
|
|
53
|
-
},
|
|
54
|
-
"schema": {
|
|
55
|
-
"description": "别的插件在这个键下写的东西的 JSON Schema(draft 2020-12):本插件目录里的 .json 文件,至多 256 KiB。它和协议的类型并列,可以引用它们(common.json#/$defs/line40)、用协议的五个关键字;指针只指它自己校验的那份值里的位置",
|
|
56
|
-
"type": "string",
|
|
57
|
-
"pattern": "\\.json$",
|
|
58
|
-
"x-file": {"type": "file", "maxBytes": 262144, "schema": true}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"required": ["description"],
|
|
62
|
-
"additionalProperties": false,
|
|
63
|
-
"if": {"required": ["contributes"]},
|
|
64
|
-
"then": {"description": "写了 contributes 的扩展点也写 title", "required": ["title"]},
|
|
65
|
-
"else": {"description": "只有写了 contributes 的扩展点才写 title、commands 与 schema", "not": {"anyOf": [{"required": ["title"]}, {"required": ["commands"]}, {"required": ["schema"]}]}}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/v2/extensions.json",
|
|
4
|
-
"title": "contributes.extensions:接在别的插件扩展点上的命令",
|
|
5
|
-
"description": "「插件 ID/扩展点名」→ { command };那个插件须写在 extensionDependencies 里。",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"propertyNames": {
|
|
8
|
-
"description": "须写成「插件 ID/扩展点名」,插件是 extensionDependencies 里的一个",
|
|
9
|
-
"pattern": "^[a-z][a-z0-9-]{0,39}/[a-z][a-z0-9-]{0,39}$",
|
|
10
|
-
"x-ref": {"pointer": "/extensionDependencies", "part": "^([^/]+)/"}
|
|
11
|
-
},
|
|
12
|
-
"additionalProperties": {"$ref": "common.json#/$defs/commandHolder"}
|
|
13
|
-
}
|
package/schemas/plugin/self.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://coda.pub/schemas/plugin/v2/self.json",
|
|
4
|
-
"title": "contributes.self:只给自己用的查询",
|
|
5
|
-
"description": "名字 → 插件目录里的文件(相对路径,不离开插件目录),由命令回答插件自己的页面与进程的 self 查询;同一个名字写了命令就交给命令,没有再找模块。至多 50 个。",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"maxProperties": 50,
|
|
8
|
-
"propertyNames": {"$ref": "https://coda.pub/schemas/protocol/v1/definition.json#/$defs/operationName"},
|
|
9
|
-
"additionalProperties": {"type": "string", "x-file": {"type": "file"}}
|
|
10
|
-
}
|