@coda-console/protocol 6.17.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 CHANGED
@@ -2,6 +2,13 @@
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
+
5
12
  ## 6.17.0 — 2026-11-20
6
13
 
7
14
  - 这是在 6.16.0 之上的次版本。依据 README「版本」一节:核心协议是内部面,新增协议升次版本;`stable/` 不动。新增核心协议 `coda/resource@1`(`schemas/protocol/v1/resource.json`,导出 `RESOURCE_PROTOCOL`,加入 `CORE_PROTOCOLS`,复数名 `resource-types`),插件用命令写这种记录,见 Coda 文档「资源」。
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`、`extensionPoints`、`extensions`、`services`、`setup`、`environment`、`path`、`views`、`protocols`、`protocolImplementations`、`records`、`self`);`setting.json` 是一项设置的声明。其余键由 Coda 的贡献点登记表或某个插件的扩展点声明:Coda 自己的(`agents`、`composerModes`、`modelProviders` 等)的 schema 仍放在这里作公开数据(如 `agents.json`、`composer-modes.json`),由登记它的 provider 引用;扩展点可以带自己的 schema(`extensionPoints.<名>.schema`,声明它的插件目录里的一个文件),写给它的东西合乎那份 schema 才对。
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,8 +44,8 @@ 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
- // 写给别的插件扩展点的东西,按那个扩展点的 schema(已读出的对象);给出写它的插件目录时连同它点名的文件一起查。
48
- pointProblem(panelsSchema, manifest.contributes.panels, 'contributes.panels', 'plugin');
47
+ // 一个独立的值,按给定的 schema(已读出的对象)校验;给出插件目录时连同值里点名的文件一起查。
48
+ pointProblem(valueSchema, value, 'contributes.panels', 'plugin');
49
49
  ```
50
50
 
51
51
  ```js
@@ -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
- 扩展点的 schema 和这里的并列:可以 `$ref` 协议的 schema(`common.json#/$defs/line40`),可以用五个关键字;它自己写的 `$id` 不算数,指针只指它校验的那份值里的位置。
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
 
@@ -152,7 +152,7 @@ agentValueProblem('review.json', review, '工具的审核');
152
152
 
153
153
  Coda 与检查包都钉一个确切版本。对第三方的兼容承诺只覆盖**稳定面**:第三方实际在用的清单键和页面接口,定义在随 npm 包发布的 [`stable/manifest.json`](stable/manifest.json) 与 [`stable/view.json`](stable/view.json)。稳定面只增不减;要改变或删除承诺,先标弃用,保留过渡时间,不能直接移除定义或破坏现有用法。
154
154
 
155
- 其余都是**内部面**,不承诺兼容,删改升次版本。包括未列入稳定面的清单键、扩展点、模块的 `coda` 对象、`CODA_*` 环境变量、Agent 接入协议、协议定义与流程方言,以及 `coda-view://service/…`。新增可选字段、新类型、放宽限制升次版本。主版本只留给稳定面的不兼容改动;按稳定面只增不减的规矩,这不该发生,真要发生须先标弃用、留过渡时间。协议名里的版本(如 `coda/run@1`)与 npm 包版本、schema 的 `$id` 独立。
155
+ 其余都是**内部面**,不承诺兼容,删改升次版本。包括未列入稳定面的清单键、模块的 `coda` 对象、`CODA_*` 环境变量、Agent 接入协议、协议定义与流程方言,以及 `coda-view://service/…`。新增可选字段、新类型、放宽限制升次版本。主版本只留给稳定面的不兼容改动;按稳定面只增不减的规矩,这不该发生,真要发生须先标弃用、留过渡时间。协议名里的版本(如 `coda/run@1`)与 npm 包版本、schema 的 `$id` 独立。
156
156
 
157
157
  两份数据各有从 1 起的整数 `revision`。每项清单以 `path` 标识;`.` 分隔固定键,`[]` 表示数组项,`*` 表示插件自行命名的键。例如 `contributes.configuration.properties.*.additionalProperties.properties.*.format`。`values` 是承诺接受的取值,而非完整枚举。页面文件的成员、事件、根类名、CSS 变量分别列出;`open.targets` 只承诺 `{ view, args }`,`toolbar.fields/kinds` 只承诺列出的字段和种类。
158
158
 
package/docs/protocol.md CHANGED
@@ -7,7 +7,7 @@
7
7
  - 协议定义文档的 JSON Schema 与校验:`schemas/protocol/v1/definition.json`、`@coda-console/protocol/protocol`;
8
8
  - 统一调用信封:`schemas/protocol/v1/request.json`、`response.json`;
9
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` 与 `contributes.self`。
10
+ - 插件清单里的 `contributes.protocols`、`contributes.protocolImplementations` 与 `contributes.records`。
11
11
 
12
12
  `executor` 与 `execution` 两个旧对象协议和 `@coda-console/protocol/executor` 在 3.0.0 删除。
13
13
 
@@ -308,13 +308,7 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
308
308
  - `every`:可选,定时重跑的间隔,ISO 8601 风格:周 `W`、天 `D`、时 `H`、分 `M`、秒 `S`(如 `PT5M`、`PT90S`、`P1W1D`),只有秒能带小数点,不收年、月;不短于 `PT1M`;不写就不定时。下限 schema 表达不了,由 Coda 判。
309
309
  - 不许别的键。命令怎么跑、打印什么由 Coda 的文档讲,这里不重述。
310
310
 
311
- `contributes.self` 声明由命令回答的「只给自己用的查询」:名字(格式同操作名)→ 插件目录里的文件(相对路径,不离开插件目录),至多 50 个。
312
-
313
- ```json
314
- "self": {"operation": "bin/self-operation.sh"}
315
- ```
316
-
317
- 插件用到别的协议的权限,写在清单根的 `uses`,不放进 `contributes`(Coda 把不认识的 `contributes` 键当扩展点,旧版本会因此拒装)。键是带大版本的协议名,值是权限组名的数组,至少一项、不重复:
311
+ 插件用到别的协议的权限,写在清单根的 `uses`,不放进 `contributes`(`contributes` 里只有 Coda 认得的键)。键是带大版本的协议名,值是权限组名的数组,至少一项、不重复:
318
312
 
319
313
  ```json
320
314
  {
@@ -333,7 +327,7 @@ invocationResponseProblem(response); // 恰好有 result 或 run 之一
333
327
 
334
328
  这里只查形状;Coda 当前的 API Level 与兼容判定由 Coda 实现。
335
329
 
336
- `manifestProblem` 校验清单的外壳与通用键(这两个键在其中);别的键由 Coda 的贡献点登记表或某个插件的扩展点声明,按声明方的 schema 校验,本包不管它们的形状。命名空间约束需要插件 ID,单独用:
330
+ `manifestProblem` 校验清单的外壳与通用键(这两个键在其中);别的键由 Coda 的贡献点登记表声明,按登记方的 schema 校验,本包不管它们的形状。命名空间约束需要插件 ID,单独用:
337
331
 
338
332
  ```js
339
333
  import { ownedProtocolsProblem } from '@coda-console/protocol/protocol';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coda-console/protocol",
3
- "version": "6.17.0",
3
+ "version": "6.18.0",
4
4
  "description": "Coda 的协议:插件清单的类型(JSON Schema)、通用校验器、协议定义与调用信封、流程方言与 Agent 接入协议",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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 的贡献点登记表或某个插件的扩展点声明,由声明它的一方的 schema 校验。",
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 把 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
  }
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), or one a plugin's extension point declares, for
5
- // that plugin to read: of the schema that point names, a file of the declaring plugin's (`extensionPoints.<point>.schema`),
6
- // when it names one. Checking one is checking it against those schemas, nothing else: a field joins a type by joining its
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 an
58
- // extension point's schema is (x-file `schema`), not where a value is checked against it.
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 an extension point declares, compiled once by what it says, under an ID of its own beside these (whatever `$id`
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 (an extension point's).
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
- // What a plugin writes for another's extension point (`value`, under `where`, as `contributes.panels`), checked against the
325
- // schema that point declares (the declaring plugin's file, read): null, or what is wrong. `dir`: the writing plugin's
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
- }
@@ -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
- }