@coda-console/protocol 0.0.0 → 1.1.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.
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/common.json",
4
+ "title": "插件清单里共用的写法",
5
+ "$defs": {
6
+ "id": {"description": "小写字母、数字和「-」,以字母开头,至多 40 个字符", "type": "string", "pattern": "^[a-z][a-z0-9-]{0,39}$"},
7
+ "name": {"description": "小写字母、数字和「-」,以字母开头,至多 64 个字符", "type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$"},
8
+ "line10": {"description": "不超过 10 字的一行", "type": "string", "maxLength": 10, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
9
+ "line20": {"description": "不超过 20 字的一行", "type": "string", "maxLength": 20, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
10
+ "line40": {"description": "不超过 40 字的一行", "type": "string", "maxLength": 40, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
11
+ "line100": {"description": "不超过 100 字的一行", "type": "string", "maxLength": 100, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
12
+ "line200": {"description": "不超过 200 字的一行", "type": "string", "maxLength": 200, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
13
+ "line1000": {"description": "不超过 1000 字的一行", "type": "string", "maxLength": 1000, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
14
+ "line4096": {"description": "不超过 4096 字的一行", "type": "string", "maxLength": 4096, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
15
+ "command": {"description": "一行命令,由 sh 运行,不超过 4000 字", "type": "string", "maxLength": 4000, "pattern": "^(?=.*\\S)[^\\u0000\\r\\n]*$"},
16
+ "symbol": {"description": "SF Symbol 的名字", "type": "string", "maxLength": 100, "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$"},
17
+ "commandHolder": {
18
+ "description": "{ command }:command 是一行命令",
19
+ "type": "object",
20
+ "properties": {"command": {"$ref": "#/$defs/command"}},
21
+ "required": ["command"],
22
+ "additionalProperties": false
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,79 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/composer-modes.json",
4
+ "title": "contributes.composerModes:输入框模式",
5
+ "description": "输入框能处在的模式:显示什么(图标、标题、发出去是什么、占位与发送按钮),发出的给谁(agent:session 会话的 Agent,own 为它另选的、开新会话跑,off 不显示),在哪些输入框里能进(in:session 会话的、new 新任务的),参数(写法同设置)。打字进入的(trigger,如 !)没有参数,发出的就是会话的。",
6
+ "type": "array",
7
+ "maxItems": 10,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "id": {"$ref": "common.json#/$defs/id"},
12
+ "title": {"$ref": "common.json#/$defs/line40"},
13
+ "icon": {"$ref": "common.json#/$defs/symbol"},
14
+ "hint": {"$ref": "common.json#/$defs/line200"},
15
+ "placeholder": {"$ref": "common.json#/$defs/line40"},
16
+ "sendLabel": {"$ref": "common.json#/$defs/line20"},
17
+ "agent": {"description": "agent 只能是 session、own、off", "enum": ["session", "own", "off"]},
18
+ "trigger": {"description": "trigger 是一个标点:!#$%&*+:;=?^|~ 之一", "type": "string", "pattern": "^[!#$%&*+:;=?^|~]$"},
19
+ "in": {"description": "它出现的输入框:session、new,不重复", "type": "array", "minItems": 1, "uniqueItems": true, "items": {"enum": ["session", "new"]}},
20
+ "parameters": {"$ref": "#/$defs/parameters"}
21
+ },
22
+ "required": ["id", "title", "icon"],
23
+ "additionalProperties": false,
24
+ "allOf": [
25
+ {
26
+ "if": {"required": ["trigger"]},
27
+ "then": {
28
+ "description": "打字进入的模式(trigger)没有参数,也不另选 Agent",
29
+ "not": {"anyOf": [{"required": ["parameters"]}, {"properties": {"agent": {"const": "own"}}, "required": ["agent"]}]}
30
+ }
31
+ },
32
+ {
33
+ "if": {"properties": {"agent": {"const": "own"}}, "required": ["agent"]},
34
+ "then": {
35
+ "description": "开新会话的模式(agent: own)要从会话里发出,不能在 new 里",
36
+ "properties": {"in": {"description": "开新会话的模式(agent: own)要从会话里发出,不能在 new 里", "not": {"contains": {"const": "new"}}}}
37
+ }
38
+ }
39
+ ]
40
+ },
41
+ "x-unique-by": ["id", "trigger"],
42
+ "$defs": {
43
+ "parameters": {
44
+ "description": "模式的参数:{ type: object, properties, required? },1–20 个,每个写法同设置,不能是密文",
45
+ "type": "object",
46
+ "properties": {
47
+ "type": {"const": "object"},
48
+ "properties": {
49
+ "type": "object",
50
+ "minProperties": 1,
51
+ "maxProperties": 20,
52
+ "propertyNames": {"description": "参数名只用字母和数字,以小写字母开头", "pattern": "^[a-z][A-Za-z0-9]{0,39}$"},
53
+ "additionalProperties": {
54
+ "allOf": [
55
+ {"$ref": "setting.json"},
56
+ {
57
+ "description": "参数不能是密文",
58
+ "not": {"properties": {"writeOnly": {"const": true}}, "required": ["writeOnly"]},
59
+ "properties": {
60
+ "additionalProperties": {
61
+ "properties": {"properties": {"additionalProperties": {"not": {"properties": {"writeOnly": {"const": true}}, "required": ["writeOnly"]}}}}
62
+ }
63
+ }
64
+ }
65
+ ]
66
+ }
67
+ },
68
+ "required": {
69
+ "description": "required 是本模式的参数名,不重复",
70
+ "type": "array",
71
+ "uniqueItems": true,
72
+ "items": {"description": "required 是本模式的参数名,不重复", "type": "string", "x-ref": {"pointer": "2/properties"}}
73
+ }
74
+ },
75
+ "required": ["type", "properties"],
76
+ "additionalProperties": false
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/configuration.json",
4
+ "title": "contributes.configuration:插件的设置",
5
+ "description": "照 VS Code 的 contributes.configuration:properties 是设置名 → 声明(setting.json),设置名以「<插件 ID>.」开头;required 是缺了就不能用的设置。",
6
+ "type": "object",
7
+ "properties": {
8
+ "title": {"type": "string"},
9
+ "properties": {
10
+ "description": "设置名 → 声明;单值设置是一组,至多一个模型地址(coda-model-url):检查可用模型按组找它",
11
+ "type": "object",
12
+ "propertyNames": {"description": "设置名是插件 ID 加「.」再加字母和数字", "pattern": "^[a-z][a-z0-9-]*(\\.[a-z][A-Za-z0-9]*)+$"},
13
+ "additionalProperties": {"$ref": "setting.json"},
14
+ "x-max-contains": {"match": {"properties": {"format": {"const": "coda-model-url"}}, "required": ["format"]}, "max": 1}
15
+ },
16
+ "required": {
17
+ "description": "contributes.configuration.required 是本插件声明过的设置名,不重复",
18
+ "type": "array",
19
+ "uniqueItems": true,
20
+ "items": {"description": "contributes.configuration.required 是本插件声明过的设置名,不重复", "type": "string", "x-ref": {"pointer": "2/properties"}}
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/endpoints.json",
4
+ "title": "contributes.endpoints:客户端发给插件的请求",
5
+ "description": "id → 回答它的一行命令(请求从标准输入给);checks 是它检查的本插件设置,客户端在那项设置旁提供「检查」,一项设置至多一个端点。",
6
+ "type": "array",
7
+ "maxItems": 20,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "id": {"$ref": "common.json#/$defs/id"},
12
+ "command": {"$ref": "common.json#/$defs/command"},
13
+ "checks": {"description": "checks 是本插件声明的一项设置", "type": "string", "x-ref": {"pointer": "/contributes/configuration/properties"}}
14
+ },
15
+ "required": ["id", "command"],
16
+ "additionalProperties": false
17
+ },
18
+ "x-unique-by": ["id", "checks"]
19
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/environment.json",
4
+ "title": "contributes.environment:给项目里启动的东西的环境变量",
5
+ "description": "变量名 → 值,不超过 100 个。值里可以写 ${config:<本插件的单值设置>}(不能是密文:密文从 CODA_PLUGIN_SECRETS 给的文件读)、${CODA_PLUGIN_PATH}、${CODA_PLUGIN_STATE}。PATH 由 contributes.path 给;Coda 自己的变量与 shell 的钩子不归插件。",
6
+ "type": "object",
7
+ "maxProperties": 100,
8
+ "propertyNames": {
9
+ "description": "变量名只用字母、数字和「_」,不以数字开头,也不能是 PATH、ZDOTDIR、BASH_ENV 或 CODA_、BASH_FUNC_ 开头的",
10
+ "pattern": "^(?!(PATH|ZDOTDIR|BASH_ENV|CODA_.*|BASH_FUNC_.*)$)[A-Za-z_][A-Za-z0-9_]*$"
11
+ },
12
+ "additionalProperties": {
13
+ "description": "不超过 4096 字的文字;${…} 只能是 config:<本插件的单值设置>、CODA_PLUGIN_PATH 或 CODA_PLUGIN_STATE;密文不进环境变量,插件的进程从 CODA_PLUGIN_SECRETS 给的文件读",
14
+ "type": "string",
15
+ "maxLength": 4096,
16
+ "pattern": "^[^\\u0000]*$",
17
+ "x-placeholders": {
18
+ "names": ["CODA_PLUGIN_PATH", "CODA_PLUGIN_STATE"],
19
+ "config": {"properties": {"type": {"enum": ["string", "number", "integer", "boolean"]}, "writeOnly": {"const": false}}, "required": ["type"]}
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/events.json",
4
+ "title": "contributes.events:插件发布的事件",
5
+ "description": "流程订阅的事件名;starts(默认开)是否开始订阅它的流程,否则只送到在跑的运行;ends 是否结束它的主体(如 PR 关闭)。",
6
+ "type": "array",
7
+ "maxItems": 50,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "name": {
12
+ "description": "事件名是「<域>.<名>」:小写字母、数字和「_」,以字母开头,不超过 100 个字符;域不能是 Coda 自己的 workflow、session、user",
13
+ "type": "string",
14
+ "pattern": "^(?!(workflow|session|user)\\.)(?=.{3,100}$)[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
15
+ },
16
+ "starts": {"type": "boolean"},
17
+ "ends": {"type": "boolean"}
18
+ },
19
+ "required": ["name"],
20
+ "additionalProperties": false
21
+ },
22
+ "x-unique-by": ["name"]
23
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/executors.json",
4
+ "title": "contributes.executors:给这台机器脚本步骤的执行环境",
5
+ "description": "照 GitHub 的 container hooks:叫什么、有哪些标签(coda:runsOn 那样写),以及 hook——步骤的执行器为作业的每一部分调用的一行命令。",
6
+ "type": "array",
7
+ "maxItems": 10,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "id": {"$ref": "common.json#/$defs/id"},
12
+ "title": {"$ref": "common.json#/$defs/line40"},
13
+ "labels": {
14
+ "description": "1–10 个标签(小写字母、数字与 . _ -),数组或逗号分隔,如 linux,x64",
15
+ "oneOf": [
16
+ {"type": "array", "minItems": 1, "maxItems": 10, "items": {"type": "string", "pattern": "^\\s*[a-z0-9][a-z0-9._-]{0,39}\\s*$"}},
17
+ {"type": "string", "pattern": "^\\s*[a-z0-9][a-z0-9._-]{0,39}\\s*(,\\s*[a-z0-9][a-z0-9._-]{0,39}\\s*){0,9}$"}
18
+ ]
19
+ },
20
+ "command": {"$ref": "common.json#/$defs/command"}
21
+ },
22
+ "required": ["id", "title", "labels", "command"],
23
+ "additionalProperties": false
24
+ },
25
+ "x-unique-by": ["id"]
26
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/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
+ "composerModes"
40
+ ]
41
+ }
42
+ },
43
+ "title": {"$ref": "common.json#/$defs/line20"},
44
+ "commands": {
45
+ "description": "每样东西里哪里是命令(以「.」连接的键名或「*」)→ 安装确认里怎么叫它(不超过 40 字)",
46
+ "type": "object",
47
+ "propertyNames": {"pattern": "^(\\*|[A-Za-z][A-Za-z0-9]{0,39})(\\.(\\*|[A-Za-z][A-Za-z0-9]{0,39})){0,7}$"},
48
+ "additionalProperties": {"$ref": "common.json#/$defs/line40"}
49
+ },
50
+ "schema": {
51
+ "description": "别的插件在这个键下写的东西的 JSON Schema(draft 2020-12):本插件目录里的 .json 文件,至多 256 KiB。它和协议的类型并列,可以引用它们(common.json#/$defs/line40)、用协议的五个关键字;指针只指它自己校验的那份值里的位置",
52
+ "type": "string",
53
+ "pattern": "\\.json$",
54
+ "x-file": {"type": "file", "maxBytes": 262144, "schema": true}
55
+ }
56
+ },
57
+ "required": ["description"],
58
+ "additionalProperties": false,
59
+ "if": {"required": ["contributes"]},
60
+ "then": {"description": "写了 contributes 的扩展点也写 title", "required": ["title"]},
61
+ "else": {"description": "只有写了 contributes 的扩展点才写 title、commands 与 schema", "not": {"anyOf": [{"required": ["title"]}, {"required": ["commands"]}, {"required": ["schema"]}]}}
62
+ }
63
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/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
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/git-credentials.json",
4
+ "title": "contributes.gitCredentials:为一个 https 主机回答 Git 凭据",
5
+ "description": "url 是 https:// 加小写主机名(可带端口,不带路径);command 作为 Git 的凭据助手运行。只有 Coda 自带的插件装得上(安装时的规则)。",
6
+ "type": "array",
7
+ "items": {
8
+ "type": "object",
9
+ "properties": {
10
+ "url": {"description": "https:// 加小写主机名(可带端口,不带路径)", "type": "string", "pattern": "^https://[a-z0-9.-]+(:\\d+)?$"},
11
+ "command": {"$ref": "common.json#/$defs/command"}
12
+ },
13
+ "required": ["url", "command"],
14
+ "additionalProperties": false
15
+ },
16
+ "x-unique-by": ["url"]
17
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/groups.json",
4
+ "title": "contributes.groups:并发组",
5
+ "description": "有名字、有容量的锁:name 是任何进程都能拿的组名,capacity 是本插件的一项整数设置,说同时放进几个。",
6
+ "type": "array",
7
+ "items": {
8
+ "type": "object",
9
+ "properties": {
10
+ "name": {"description": "组名:1–100 个非空白字符", "type": "string", "pattern": "^\\S{1,100}$"},
11
+ "capacity": {
12
+ "description": "capacity 是本插件声明的一项整数设置",
13
+ "type": "string",
14
+ "x-ref": {"pointer": "/contributes/configuration/properties", "match": {"properties": {"type": {"const": "integer"}}, "required": ["type"]}}
15
+ }
16
+ },
17
+ "required": ["name", "capacity"],
18
+ "additionalProperties": false
19
+ },
20
+ "x-unique-by": ["name"]
21
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/instructions.json",
4
+ "title": "contributes.instructions:写给 Agent 的几句话",
5
+ "description": "装了这个插件的项目里,每个会话的指令都带上它:不超过 200 字。",
6
+ "type": "string",
7
+ "maxLength": 200,
8
+ "pattern": "\\S"
9
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/mcp-servers.json",
4
+ "title": "contributes.mcpServers:给 Agent 的 MCP 服务器",
5
+ "description": "服务器名 → { command, args, env },照 Claude Code 的 .mcp.json:Agent 在本机启动、经标准输入输出说话的程序(stdio),不经 shell。command 与 args 里可以写 ${CODA_PLUGIN_PATH}、${CODA_PLUGIN_STATE}、${CODA_NODE};设置经 env 交给它(写法同 contributes.environment)。",
6
+ "type": "object",
7
+ "maxProperties": 20,
8
+ "propertyNames": {"description": "服务器名只用小写字母、数字和「-」,以字母开头,至多 40 个字符,不能是 Coda 自己的 coda", "$ref": "common.json#/$defs/id", "not": {"const": "coda"}},
9
+ "additionalProperties": {
10
+ "description": "一个服务器:由 Agent 在本机启动、经标准输入输出说话的程序(stdio),写 command 与 args;远程的(http、sse)现在不支持",
11
+ "type": "object",
12
+ "properties": {
13
+ "type": {"description": "现在只支持由 Agent 在本机启动的服务器(stdio)", "const": "stdio"},
14
+ "command": {"$ref": "#/$defs/word"},
15
+ "args": {"description": "不超过 100 项", "type": "array", "maxItems": 100, "items": {"$ref": "#/$defs/word"}},
16
+ "env": {"$ref": "environment.json"}
17
+ },
18
+ "required": ["command"],
19
+ "additionalProperties": false
20
+ },
21
+ "$defs": {
22
+ "word": {
23
+ "description": "一行不超过 4096 字的文字;${…} 只能是 CODA_PLUGIN_PATH、CODA_PLUGIN_STATE 或 CODA_NODE,设置经 env 交给它",
24
+ "type": "string",
25
+ "maxLength": 4096,
26
+ "pattern": "^[^\\u0000\\r\\n]+$",
27
+ "x-placeholders": {"names": ["CODA_PLUGIN_PATH", "CODA_PLUGIN_STATE", "CODA_NODE"]}
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/model-providers.json",
4
+ "title": "contributes.modelProviders:插件提供的模型服务",
5
+ "description": "别的插件用 coda-model-provider 的设置按「插件/id」选它:叫什么、讲哪种接口、在哪(地址里可以写本插件的单值设置 ${config:…})、Key 是本插件的哪个密文。",
6
+ "type": "array",
7
+ "maxItems": 10,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "id": {"$ref": "common.json#/$defs/id"},
12
+ "title": {"$ref": "common.json#/$defs/line40"},
13
+ "api": {
14
+ "description": "接口:openai-completions、openai-responses、anthropic-messages",
15
+ "enum": ["openai-completions", "openai-responses", "anthropic-messages"]
16
+ },
17
+ "url": {
18
+ "description": "一行地址,只能引用本插件的单值设置(${config:<设置名>},不能是密文)",
19
+ "type": "string",
20
+ "maxLength": 4096,
21
+ "pattern": "^[^\\u0000\\r\\n]+$",
22
+ "x-placeholders": {"config": {"properties": {"type": {"enum": ["string", "number", "integer"]}, "writeOnly": {"const": false}}, "required": ["type"]}}
23
+ },
24
+ "key": {
25
+ "description": "key 是 ${config:<本插件的密文设置>}",
26
+ "type": "string",
27
+ "pattern": "^\\$\\{config:[^}]+\\}$",
28
+ "x-ref": {
29
+ "pointer": "/contributes/configuration/properties",
30
+ "part": "^\\$\\{config:([^}]+)\\}$",
31
+ "match": {"properties": {"writeOnly": {"const": true}}, "required": ["writeOnly"]}
32
+ }
33
+ }
34
+ },
35
+ "required": ["id", "title", "api", "url"],
36
+ "additionalProperties": false
37
+ },
38
+ "x-unique-by": ["id"]
39
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/path.json",
4
+ "title": "contributes.path:放上 PATH 的目录",
5
+ "description": "插件目录里的目录(相对路径),或它在后端的状态目录 ${CODA_PLUGIN_STATE} 下的目录(setup 可以建它)。",
6
+ "type": "array",
7
+ "maxItems": 20,
8
+ "items": {
9
+ "type": "string",
10
+ "minLength": 1,
11
+ "pattern": "^[^\\u0000:\\n]*$",
12
+ "if": {"pattern": "^\\$\\{CODA_PLUGIN_STATE\\}"},
13
+ "then": {"description": "${CODA_PLUGIN_STATE} 下的目录:不离开它", "pattern": "^\\$\\{CODA_PLUGIN_STATE\\}(/(?!(.*/)?\\.\\.(/|$))[^$]*)?$"},
14
+ "else": {"description": "插件目录里的目录(相对路径,不离开插件目录)", "pattern": "^(?!/)(?!(.*/)?\\.\\.(/|$))(?!\\.?/*$)[^$]*$", "x-file": {"type": "directory"}}
15
+ }
16
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/plugin.json",
4
+ "title": "插件清单(插件目录的 package.json)",
5
+ "description": "照 VS Code 扩展的 package.json 写;Coda 读的是下面这些键,其余是 npm 的,不管。contributes 的每个键是一种类型,各有自己的 schema;不是 Coda 的键,是写给别的插件的扩展点的(它们声明的类型),由那个扩展点的 schema 校验。",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {"$ref": "common.json#/$defs/id", "description": "插件 ID:小写字母、数字和「-」,以字母开头,至多 40 个字符;不写就用 name"},
9
+ "name": {"type": "string"},
10
+ "categories": {"description": "分类:文本的数组,第一个是插件页里归的类", "type": "array", "items": {"type": "string"}},
11
+ "main": {"description": "插件宿主运行的模块:插件目录里的 .js 或 .mjs 文件", "type": "string", "pattern": "\\.m?js$", "x-file": {"type": "file"}},
12
+ "activationEvents": {"description": "宿主什么时候加载 main:onStartupFinished(后端一启动),不重复", "type": "array", "items": {"enum": ["onStartupFinished"]}, "uniqueItems": true},
13
+ "extensionDependencies": {"description": "需要先装的插件的 ID,不重复", "type": "array", "items": {"$ref": "common.json#/$defs/id"}, "uniqueItems": true},
14
+ "contributes": {
15
+ "description": "插件带来的东西:每个键一种类型",
16
+ "type": "object",
17
+ "properties": {
18
+ "configuration": {"$ref": "configuration.json"},
19
+ "capabilities": {"$ref": "capabilities.json"},
20
+ "instructions": {"$ref": "instructions.json"},
21
+ "agents": {"$ref": "agents.json"},
22
+ "extensionPoints": {"$ref": "extension-points.json"},
23
+ "extensions": {"$ref": "extensions.json"},
24
+ "groups": {"$ref": "groups.json"},
25
+ "events": {"$ref": "events.json"},
26
+ "commands": {"$ref": "commands.json"},
27
+ "gitCredentials": {"$ref": "git-credentials.json"},
28
+ "repositories": {"$ref": "repositories.json"},
29
+ "services": {"$ref": "services.json"},
30
+ "setup": {"$ref": "setup.json"},
31
+ "skills": {"$ref": "skills.json"},
32
+ "environment": {"$ref": "environment.json"},
33
+ "path": {"$ref": "path.json"},
34
+ "endpoints": {"$ref": "endpoints.json"},
35
+ "mcpServers": {"$ref": "mcp-servers.json"},
36
+ "views": {"$ref": "views.json"},
37
+ "modelProviders": {"$ref": "model-providers.json"},
38
+ "executors": {"$ref": "executors.json"},
39
+ "composerModes": {"$ref": "composer-modes.json"}
40
+ },
41
+ "propertyNames": {"description": "contributes 的键:字母和数字,以小写字母开头", "pattern": "^[a-z][A-Za-z0-9]{0,39}$"}
42
+ }
43
+ },
44
+ "if": {"properties": {"activationEvents": {"minItems": 1}}, "required": ["activationEvents"]},
45
+ "then": {"required": ["main"], "description": "写了 activationEvents 的插件须有 main"}
46
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/repositories.json",
4
+ "title": "contributes.repositories:列出这台能访问的仓库",
5
+ "description": "一行命令,打印仓库供客户端选。只有 Coda 自带的插件装得上(安装时的规则)。",
6
+ "$ref": "common.json#/$defs/commandHolder"
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://coda.pub/schemas/plugin/v1/services.json",
4
+ "title": "contributes.services:开启随包服务",
5
+ "description": "随后端包的独立服务的 ID;没有已安装插件开启的服务不运行。",
6
+ "type": "array",
7
+ "uniqueItems": true,
8
+ "items": {"$ref": "common.json#/$defs/name"}
9
+ }