@coda-console/plugin-check 0.5.19 → 0.5.20
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// is the extended plugin's own contract, which Coda neither reads nor shapes. A point may instead take what any plugin
|
|
5
5
|
// writes under a key of its `contributes` (`contributes` there, as the resources plugin's `panels`): 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
|
-
import { pointProblem } from '@coda-console/protocol/validate';
|
|
7
|
+
import { pointProblem, valueProblem } from '@coda-console/protocol/validate';
|
|
8
8
|
import { requireCondition as check } from '../../domain/errors.mjs';
|
|
9
9
|
|
|
10
10
|
const code = 'invalid_plugin';
|
|
@@ -80,6 +80,25 @@ export function withDependencies(catalog, id) {
|
|
|
80
80
|
visit(id);
|
|
81
81
|
return order;
|
|
82
82
|
}
|
|
83
|
+
// A channel restriction is the target backend's, never the client's. An unknown channel cannot satisfy an explicit list.
|
|
84
|
+
// The store reads registry metadata; installation reads the package itself. Both use the same schema and rule.
|
|
85
|
+
export function pluginChannelProblem(plugin, channel) {
|
|
86
|
+
if (plugin.coda === undefined) return null;
|
|
87
|
+
const problem = valueProblem('plugin.json#/properties/coda', plugin.coda, 'coda');
|
|
88
|
+
if (problem) return problem;
|
|
89
|
+
const channels = plugin.coda.channels;
|
|
90
|
+
if (!channels || channels.includes(channel)) return null;
|
|
91
|
+
const names = channels.map(value => value === 'preview' ? '预览版' : '正式版').join('或');
|
|
92
|
+
return `此插件仅支持 Coda ${names}后端${channel ? '' : ',当前后端没有发布通道记录'}`;
|
|
93
|
+
}
|
|
94
|
+
// The same dependency closure used by installation, after resolving each dependency to its actual local or source version.
|
|
95
|
+
export function catalogChannelProblem(catalog, id, channel) {
|
|
96
|
+
for (const each of withDependencies(catalog, id)) {
|
|
97
|
+
const plugin = catalog.get(each), problem = plugin && pluginChannelProblem(plugin, channel);
|
|
98
|
+
if (problem) return each === id ? problem : `${each}:${problem}`;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
83
102
|
// The installed plugins that need this one, directly or through another, by ID.
|
|
84
103
|
export function dependents(catalog, installed, id) {
|
|
85
104
|
const found = new Set();
|
|
@@ -132,6 +132,7 @@ export function readPlugin(dir, source) {
|
|
|
132
132
|
const offers = Object.fromEntries(Object.entries(contributes).filter(([key]) => !TYPES.includes(key)));
|
|
133
133
|
return { id, displayName, description: typeof manifest.description === 'string' ? manifest.description : '', version: String(manifest.version ?? ''),
|
|
134
134
|
category: manifestCategory(manifest), source, dir, title: typeof configuration.title === 'string' ? configuration.title : displayName, properties,
|
|
135
|
+
...(manifest.coda !== undefined ? { coda: manifest.coda } : {}),
|
|
135
136
|
...(manifest.main ? { main: posix.normalize(manifest.main) } : {}), ...(activation.includes('onStartupFinished') ? { startup: true } : {}),
|
|
136
137
|
...(required.length ? { required: [...required] } : {}), workflows: files('.coda/workflows'),
|
|
137
138
|
capabilities: [...(contributes.capabilities ?? [])].sort(), services: [...(contributes.services ?? [])],
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { createHash } from 'node:crypto';
|
|
8
8
|
import { normalize } from 'node:path';
|
|
9
9
|
import { requireCondition as check } from '../../domain/errors.mjs';
|
|
10
|
-
import { offerPoint, offeredCommands, offerProblem, withDependencies } from './plugin-extensions.mjs';
|
|
10
|
+
import { catalogChannelProblem, offerPoint, offeredCommands, offerProblem, withDependencies } from './plugin-extensions.mjs';
|
|
11
11
|
|
|
12
12
|
export const COMMIT = /^[0-9a-f]{40}$/;
|
|
13
13
|
const ID = /^[a-z][a-z0-9-]{0,39}$/;
|
|
@@ -168,7 +168,7 @@ export function npmManifest(id, own, skills) {
|
|
|
168
168
|
}
|
|
169
169
|
if (!Object.keys(contributes).length) return { problem: '这个 npm 包读不成插件:package.json 没有 contributes,没有 Skill 目录,也不是写了 mcpName 的 MCP 服务器' };
|
|
170
170
|
return { manifest: { name: id, displayName: own.name, description: typeof own.description === 'string' ? own.description.slice(0, 500) : '',
|
|
171
|
-
version: String(own.version ?? ''), contributes } };
|
|
171
|
+
version: String(own.version ?? ''), ...(own.coda !== undefined ? { coda: own.coda } : {}), contributes } };
|
|
172
172
|
}
|
|
173
173
|
// The packages npm installs for a package from npm, by name with the range it asks for: its dependencies are not pinned
|
|
174
174
|
// (docs/plugins.md「从 npm 安装」), unless it brings an `npm-shrinkwrap.json`, whose versions they then are. Among them the
|
|
@@ -352,7 +352,7 @@ export const manifestId = manifest => manifest?.id ?? manifest?.name;
|
|
|
352
352
|
// rows, the built-in plugins): what it is, the one of its ID installed here, why it cannot be installed, what comes along
|
|
353
353
|
// with it (`siblings`: the other plugins of the same commit, by ID) and what it brings. `manifest`: what is known of it
|
|
354
354
|
// when it does not read as a plugin, its ID `fallback` without a name.
|
|
355
|
-
export function candidate({ path, manifest, plugin, problem, fallback }, { catalog, installed, builtin }, siblings) {
|
|
355
|
+
export function candidate({ path, manifest, plugin, problem, fallback }, { catalog, installed, builtin, channel }, siblings) {
|
|
356
356
|
const id = plugin?.id ?? (typeof manifestId(manifest) === 'string' ? manifestId(manifest) : fallback);
|
|
357
357
|
const row = installed.get(id), along = plugin ? together(plugin, { catalog, installed, siblings }) : [];
|
|
358
358
|
const missing = along.filter(each => each.from === 'missing').map(each => each.id);
|
|
@@ -361,7 +361,7 @@ export function candidate({ path, manifest, plugin, problem, fallback }, { catal
|
|
|
361
361
|
return { path, id, displayName: plugin?.displayName ?? (typeof manifest?.displayName === 'string' ? manifest.displayName : id),
|
|
362
362
|
description: plugin?.description ?? (typeof manifest?.description === 'string' ? manifest.description : ''), version: plugin?.version ?? '',
|
|
363
363
|
installed: row ? row.source ?? builtin.get(id)?.source ?? { kind: 'builtin' } : null,
|
|
364
|
-
problem: problem ?? (plugin ? catalogProblem(plugin, catalog, builtin, installed) ?? offerProblem(plugin, after) : null)
|
|
364
|
+
problem: problem ?? (plugin ? catalogChannelProblem(after, id, channel) ?? catalogProblem(plugin, catalog, builtin, installed) ?? offerProblem(plugin, after) : null)
|
|
365
365
|
?? (missing.length ? `要一起装的 ${missing.join('、')} 不在这台机器上${plugin.source?.kind === 'npm' ? '' : ',也不在这个提交里'}` : null),
|
|
366
366
|
together: along.filter(each => each.from !== 'missing'),
|
|
367
367
|
...(plugin ? { contributes: contributions(plugin, after) } : {}) };
|
package/check/coda/contract.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "8305da8be0fd3109785e00d3acbb3e24de852a78",
|
|
3
3
|
"packages": {
|
|
4
4
|
"@0dep/piso": "5.2.0",
|
|
5
5
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
6
|
-
"@coda-console/protocol": "1.
|
|
6
|
+
"@coda-console/protocol": "1.5.0",
|
|
7
7
|
"yaml": "2.9.1"
|
|
8
8
|
},
|
|
9
9
|
"files": {
|
|
10
10
|
"check/coda/components/plugins/agent-plugins.mjs": "d117702f83c988aa89c2e5ae26aafd6ae3e8ba0829adaeedf9e8640f5f8282be",
|
|
11
|
-
"check/coda/components/plugins/plugin-extensions.mjs": "
|
|
12
|
-
"check/coda/components/plugins/plugin-rules.mjs": "
|
|
13
|
-
"check/coda/components/plugins/plugin-source-rules.mjs": "
|
|
11
|
+
"check/coda/components/plugins/plugin-extensions.mjs": "4d7963185195ba6d21a4e49a66987613d5892210b1eb1dc02cffb7b816407776",
|
|
12
|
+
"check/coda/components/plugins/plugin-rules.mjs": "bf2eecafaf3a3c3a8b4719c3252db30a582fce5f11946926cd6a2bc03920c702",
|
|
13
|
+
"check/coda/components/plugins/plugin-source-rules.mjs": "d894d55a3272df5ef3b108b68820c64aefdf6b69346404b58954f2a3503cb4a5",
|
|
14
14
|
"check/coda/components/plugins/skill-document.mjs": "c5b5e815c42cd836572f7b60e22a46af6ac607fd9df0170fa36f955825636ce6",
|
|
15
15
|
"check/coda/components/prompt-recovery/prompt-recovery.mjs": "f43f21d24c19a58113d3304f9248225b12080ab00ed15eab74bf7b94642732de",
|
|
16
16
|
"check/coda/components/session-config/commands.mjs": "be07377c153f812a648deb60f023269c1f0a49b91cf2e4516f05b7eac09c28de",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coda-console/plugin-check",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.20",
|
|
4
4
|
"description": "Coda 插件的契约检查:扮演 Coda 读清单、启动 Agent 讲 ACP 与 _coda/wait、读面板。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@0dep/piso": "5.2.0",
|
|
26
26
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
27
|
-
"@coda-console/protocol": "1.
|
|
27
|
+
"@coda-console/protocol": "1.5.0",
|
|
28
28
|
"ajv": "8.20.0",
|
|
29
29
|
"yaml": "2.9.1"
|
|
30
30
|
},
|