@coda-console/plugin-check 0.7.6 → 0.8.1

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,31 @@
1
+ // What the composer takes of plugins (components/plugins/contribution-points.mjs): the modes a composer can be put in
2
+ // (docs/plugins.md「输入框模式」, schemas/composer-modes.json), defined as this module loads.
3
+ // Descriptions only: nothing here imports a component, for the plugins read with them are read before any is made.
4
+ import { defineContributionPoint } from '../plugins/contribution-points.mjs';
5
+ import { SCHEMAS } from '@coda-console/protocol/validate';
6
+ import { setting } from '../plugins/plugin-rules.mjs';
7
+
8
+ // Each mode with the composers that offer it (`in`, a session's by default), whether it leaves after acceptance (`once`),
9
+ // and declarative parameters.
10
+ const MODE_PLACES = ['session', 'new'];
11
+ const composerModes = (modes = []) => modes.map((m, i) => ({ id: m.id, title: m.title.trim(), icon: m.icon,
12
+ ...(m.hint ? { hint: m.hint.trim() } : {}), ...(m.placeholder ? { placeholder: m.placeholder.trim() } : {}),
13
+ ...(m.sendLabel ? { sendLabel: m.sendLabel.trim() } : {}), once: m.once === true, ...(m.trigger ? { trigger: m.trigger } : {}),
14
+ in: m.in ? MODE_PLACES.filter(place => m.in.includes(place)) : ['session'],
15
+ ...(m.parameters !== undefined ? { parameters: parametersOf(m.parameters, `contributes.composerModes[${i}].parameters`), schema: structuredClone(m.parameters) } : {}) }));
16
+ // A mode's parameters as read: each a setting, in the order written, which the clients show them in (JSON's objects keep
17
+ // none of their own there); what it cannot go without, `required`.
18
+ function parametersOf(value, where) {
19
+ const ordered = fields => Object.fromEntries(Object.entries(fields).map(([name, spec], i) => [name, { ...spec, order: spec.order ?? i }]));
20
+ const properties = Object.fromEntries(Object.entries(value.properties).map(([name, p], i) => {
21
+ const read = setting(p, `${where}.properties.${name}`);
22
+ return [name, { ...read, ...(p.presets ? { presets: structuredClone(p.presets) } : {}), ...(read.rows ? { rows: { ...read.rows, columns: ordered(read.rows.columns) } } : {}), order: read.order ?? i }];
23
+ }));
24
+ return { properties, ...(value.required?.length ? { required: [...value.required] } : {}) };
25
+ }
26
+
27
+ // A mode's name and the character typed to enter one are one plugin's: the composer finds it by them. Confirmed as
28
+ // declared: the clients show them from this.
29
+ defineContributionPoint({ key: 'composerModes', schema: SCHEMAS['composer-modes.json'], read: raw => raw?.length ? { composerModes: composerModes(raw) } : {},
30
+ claim: plugin => (plugin.composerModes ?? []).flatMap(m => [`输入框模式 /${m.id}`, ...(m.trigger ? [`输入框里打 ${m.trigger} 进入的模式`] : [])]),
31
+ confirm: plugin => plugin.composerModes?.length ? { composerModes: plugin.composerModes.map(({ schema: _, ...mode }) => mode) } : {} });
@@ -0,0 +1,25 @@
1
+ // The keys of `contributes` Coda's own components take (docs/plugins.md「插件对外贡献」), as VS Code's contribution points:
2
+ // each a point the component that reads it registers, saying what a plugin may write under it (`schema`, a JSON Schema
3
+ // checked in the whole manifest, @coda-console/protocol's contributionProblem), what a plugin's value of it is on the plugin (`read`, given
4
+ // the value written, none when it writes none), what of it only one plugin may declare (`claim`, of the plugin read), and
5
+ // what installing it confirms of it (`confirm`), how a plugin drawing no icon of its own is drawn (`icon`, of the plugin
6
+ // read, none when it says nothing), and why one from elsewhere than Coda's own may not bring what it does (`builtinOnly`,
7
+ // of the plugin read, none when it may). The plugins' base knows none of the keys: it asks the point a key names.
8
+ // A component defines its points as its module loads (components/workflows/contributions.mjs); what puts Coda together
9
+ // loads those before any plugin is read (application/contributions.mjs), as the wait kinds are (kernel/wait-kinds.mjs).
10
+ export class ContributionPoints {
11
+ constructor(points = []) {
12
+ this.points = new Map();
13
+ for (const point of points) this.register(point);
14
+ }
15
+ register(point) {
16
+ if (this.points.has(point.key)) throw new Error(`contributes.${point.key} 登记了两次`);
17
+ this.points.set(point.key, point);
18
+ }
19
+ get(key) { return this.points.get(key) ?? null; }
20
+ values() { return this.points.values(); }
21
+ }
22
+
23
+ // Coda's: the one table the components define their points in.
24
+ export const CONTRIBUTION_POINTS = new ContributionPoints();
25
+ export const defineContributionPoint = point => CONTRIBUTION_POINTS.register(point);
@@ -0,0 +1,15 @@
1
+ // What Git and the repository sources take of plugins (components/plugins/contribution-points.mjs): the commands that answer
2
+ // Git for an address (docs/plugins.md「Git 凭据」, adapters/git-credential.mjs) and the one that lists repositories to choose
3
+ // from (「仓库来源」, repositories.mjs), defined as this module loads.
4
+ // Descriptions only: nothing here imports a component, for the plugins read with them are read before any is made.
5
+ import { defineContributionPoint } from './contribution-points.mjs';
6
+ import { SCHEMAS } from '@coda-console/protocol/validate';
7
+
8
+ // Git's credentials for an address are one plugin's. Clients do not list them in the confirmation yet: only one Coda ships
9
+ // may bring them.
10
+ defineContributionPoint({ key: 'gitCredentials', schema: SCHEMAS['git-credentials.json'], read: (raw = []) => ({ gitCredentials: raw.map(c => ({ url: c.url, command: c.command })) }),
11
+ claim: plugin => (plugin.gitCredentials ?? []).map(c => `${c.url} 的 Git 凭据`),
12
+ builtinOnly: plugin => plugin.gitCredentials?.length ? '只有 Coda 自带的插件能提供 Git 凭据' : null });
13
+ // Nor the command that lists repositories to choose from.
14
+ defineContributionPoint({ key: 'repositories', schema: SCHEMAS['repositories.json'], read: raw => raw ? { repositories: { command: raw.command } } : {},
15
+ builtinOnly: plugin => plugin.repositories ? '只有 Coda 自带的插件能提供仓库列表' : null });
@@ -0,0 +1,9 @@
1
+ // What the model services take of plugins (components/plugins/contribution-points.mjs, model-services.mjs): the services a
2
+ // plugin provides (docs/plugins.md「模型服务」, schemas/model-providers.json), each with the setting its key is, defined as
3
+ // this module loads.
4
+ // Descriptions only: nothing here imports a component, for the plugins read with them are read before any is made.
5
+ import { defineContributionPoint } from './contribution-points.mjs';
6
+ import { SCHEMAS } from '@coda-console/protocol/validate';
7
+
8
+ defineContributionPoint({ key: 'modelProviders', schema: SCHEMAS['model-providers.json'], read: raw => raw?.length ? { modelProviders: raw.map(p => ({ id: p.id, title: p.title.trim(), api: p.api, url: p.url,
9
+ ...(p.key ? { key: /^\$\{config:([^}]+)\}$/.exec(p.key)[1] } : {}) })) } : {} });
@@ -0,0 +1,15 @@
1
+ // How a plugin's icons are read and shown (docs/plugins.md「插件页」): its own, and those of what it brings drawn the same way
2
+ // (an agent's, components/session-config/contributions.mjs).
3
+ import { readFileSync } from 'node:fs';
4
+ import { join, normalize } from 'node:path';
5
+
6
+ // An icon file, read once with the plugin (its schema says it is a PDF in the plugin's directory): both clients draw it as
7
+ // they drew the brand artwork they shipped with.
8
+ const icon = (dir, path) => readFileSync(join(dir, normalize(path))).toString('base64');
9
+ // The PDFs an icon names (an agent's, or a plugin's own drawn the same way), read: light, dark when there is one, and
10
+ // whether it is drawn in the text colour.
11
+ export const iconFiles = (dir, spec) => ({ light: icon(dir, spec.light), ...(spec.dark !== undefined ? { dark: icon(dir, spec.dark) } : {}), template: spec.template === true });
12
+ // An icon as the clients are given it: PDFs as data, light and dark, and whether they take the text's color; a symbol on
13
+ // a colour as it is.
14
+ const pdf = data => data ? `data:application/pdf;base64,${data}` : null;
15
+ export const shownIcon = icon => icon.symbol ? { symbol: icon.symbol, color: icon.color } : { light: pdf(icon.light), dark: pdf(icon.dark), template: icon.template };
@@ -16,13 +16,12 @@ import { settings as agentSettings } from '../session-config/commands.mjs';
16
16
  import { requireCondition as check, ContractError } from '../../domain/errors.mjs';
17
17
  import { isDuration } from '../../domain/duration.mjs';
18
18
  import { AGENT_ID } from '../../domain/values.mjs';
19
- import { agentDeclarations, iconFiles } from './agent-plugins.mjs';
19
+ import { iconFiles } from './plugin-icons.mjs';
20
20
  import { checkCatalog, extensionsFor } from './plugin-extensions.mjs';
21
- import { manifestProblem, TYPES } from '@coda-console/protocol/validate';
21
+ import { contributionProblem, manifestProblem, TYPES } from '@coda-console/protocol/validate';
22
22
  import { ownedProtocolsProblem } from '@coda-console/protocol/protocol';
23
23
  import { claims, COMMIT, INTEGRITY, NPM_VERSION, npmPluginId, repoAddress, sourcePath } from './plugin-source-rules.mjs';
24
- import { readSkillDocument } from './skill-document.mjs';
25
- import { executorLabels } from '../workflows/executor-labels.mjs';
24
+ import { CONTRIBUTION_POINTS } from './contribution-points.mjs';
26
25
 
27
26
  const ID = /^[a-z][a-z0-9-]{0,39}$/;
28
27
  // The domains of the events Coda publishes itself; a plugin's are of a domain of its own (schemas/events.json).
@@ -32,8 +31,9 @@ export const BUILTIN_DIR = fileURLToPath(new URL('../../resources/plugins/', imp
32
31
  // The package the backend runs from (the runtime clone's, or the release's), whose npm dependencies may be built-in plugins
33
32
  // too (dependencyPlugins).
34
33
  const PACKAGE_ROOT = fileURLToPath(new URL('../../../', import.meta.url));
35
- // What a plugin may contribute to Coda itself, the types schemas/plugin.json names; anything else in `contributes` is for
36
- // a point another plugin declares to take it (the resources plugin's `panels`), refused when none does.
34
+ // What the plugins' base reads of `contributes` itself, the general types schemas/plugin.json names; any other key is a
35
+ // contribution point's (contribution-points.mjs), or for a point another plugin declares to take it (the resources
36
+ // plugin's `panels`), refused when neither does.
37
37
  export const CONTRIBUTES = TYPES;
38
38
  export const MODEL_PROVIDER = /^[a-z][a-z0-9-]{0,39}\/[a-z][a-z0-9-]{0,39}$/;
39
39
  // How many model services a setting of several may name.
@@ -47,7 +47,7 @@ const ROWS_AT_MOST = 50;
47
47
  // (`rows`), a row of named columns (`columns`), or a table whose entries all share one declaration (`entries`, its row
48
48
  // names `coda-agent-match` when `keys` says so). Option labels and descriptions are kept when there is one for each option.
49
49
  // Its default is a value of it, checked as any value is (checkValue).
50
- function setting(value, where) {
50
+ export function setting(value, where) {
51
51
  const labels = list => Array.isArray(list) && value.enum && list.length === value.enum.length && list.every(d => typeof d === 'string');
52
52
  const out = { type: value.type, ...(value.format ? { format: value.format } : {}), ...(value.enum ? { enum: value.enum } : {}),
53
53
  ...(labels(value.enumItemLabels) ? { enumItemLabels: value.enumItemLabels } : {}), ...(labels(value.enumDescriptions) ? { enumDescriptions: value.enumDescriptions } : {}),
@@ -78,30 +78,13 @@ function setting(value, where) {
78
78
  const TELL_LIMIT = 4000;
79
79
  export const checkTold = text => check(typeof text === 'string' && text.trim() && text.length <= TELL_LIMIT && !text.includes('\0'), 'invalid_input',
80
80
  `要告诉的话须为不超过 ${TELL_LIMIT} 字的文字`);
81
- // The modes a composer can be put in (docs/plugins.md「输入框模式」, schemas/composer-modes.json), each with the composers
82
- // that offer it (`in`, a session's by default), whether it leaves after acceptance (`once`), and declarative parameters.
83
- const MODE_PLACES = ['session', 'new'];
84
- const composerModes = (modes = []) => modes.map((m, i) => ({ id: m.id, title: m.title.trim(), icon: m.icon,
85
- ...(m.hint ? { hint: m.hint.trim() } : {}), ...(m.placeholder ? { placeholder: m.placeholder.trim() } : {}),
86
- ...(m.sendLabel ? { sendLabel: m.sendLabel.trim() } : {}), once: m.once === true, ...(m.trigger ? { trigger: m.trigger } : {}),
87
- in: m.in ? MODE_PLACES.filter(place => m.in.includes(place)) : ['session'],
88
- ...(m.parameters !== undefined ? { parameters: parametersOf(m.parameters, `contributes.composerModes[${i}].parameters`), schema: structuredClone(m.parameters) } : {}) }));
89
- // A mode's parameters as read: each a setting, in the order written, which the clients show them in (JSON's objects keep
90
- // none of their own there); what it cannot go without, `required`.
91
- function parametersOf(value, where) {
92
- const ordered = fields => Object.fromEntries(Object.entries(fields).map(([name, spec], i) => [name, { ...spec, order: spec.order ?? i }]));
93
- const properties = Object.fromEntries(Object.entries(value.properties).map(([name, p], i) => {
94
- const read = setting(p, `${where}.properties.${name}`);
95
- return [name, { ...read, ...(p.presets ? { presets: structuredClone(p.presets) } : {}), ...(read.rows ? { rows: { ...read.rows, columns: ordered(read.rows.columns) } } : {}), order: read.order ?? i }];
96
- }));
97
- return { properties, ...(value.required?.length ? { required: [...value.required] } : {}) };
98
- }
99
81
  // Its icon (docs/plugins.md「插件页」): a symbol on a system colour as written, or its PDFs read as an agent's are; one that
100
- // draws none and brings one agent is drawn as that agent. Nothing else: the clients draw its category's.
101
- export function pluginIcon(declared, agents, dir) {
82
+ // draws none is drawn as the first contribution point read with it says (its `icon`, of the plugin read: the one agent it
83
+ // brings). Nothing else: the clients draw its category's.
84
+ export function pluginIcon(declared, dir) {
102
85
  if (declared?.symbol) return { symbol: declared.symbol, color: declared.color };
103
86
  if (declared) return iconFiles(dir, declared);
104
- return agents.length === 1 ? agents[0].icon : null;
87
+ return null;
105
88
  }
106
89
  // The README a plugin's page shows (docs/plugins.md「插件页」), as npm and GitHub find it in its directory; null without one.
107
90
  const README = /^readme(\.md|\.markdown)?$/i;
@@ -114,13 +97,19 @@ export const manifestCategory = manifest => Array.isArray(manifest?.categories)
114
97
  // A plugin as its directory declares it. `id` is the one its manifest says (for a package whose name cannot be one: a scoped
115
98
  // package's, docs/plugins.md「插件的内容」), else its package name; a package from npm's without one, whatever npm calls it,
116
99
  // the ID its name gives (docs/plugins.md「从 npm 安装」): its package.json is not changed, for what it imports of itself.
117
- export function readPlugin(dir, source) {
100
+ // A key a component defined a point for (components/plugins/contribution-points.mjs) is that point's to check, with its
101
+ // schema, and to read, put on the plugin; the general ones are read here. `points`: the points read with, Coda's unless a test says.
102
+ export function readPlugin(dir, source, points = CONTRIBUTION_POINTS) {
118
103
  let manifest;
119
104
  try { manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')); }
120
105
  catch (e) { throw new ContractError('invalid_plugin', `${dir} 没有可读的 package.json:${e.message}`); }
121
106
  check(manifest && typeof manifest === 'object' && !Array.isArray(manifest), 'invalid_plugin', 'package.json 须为对象');
122
107
  const problem = manifestProblem(manifest, dir);
123
108
  check(!problem, 'invalid_plugin', problem);
109
+ for (const point of points.values()) if (manifest.contributes?.[point.key] !== undefined) {
110
+ const wrong = contributionProblem(point.schema, manifest, point.key, dir);
111
+ check(!wrong, 'invalid_plugin', wrong);
112
+ }
124
113
  const named = manifest.id !== undefined;
125
114
  let id = named ? manifest.id : manifest.name;
126
115
  if (!named && source?.package && typeof manifest.name === 'string') try { id = npmPluginId(manifest.name); } catch {}
@@ -136,42 +125,30 @@ export function readPlugin(dir, source) {
136
125
  const required = configuration.required ?? [], activation = manifest.activationEvents ?? [], dependencies = manifest.extensionDependencies ?? [];
137
126
  const displayName = typeof manifest.displayName === 'string' ? manifest.displayName : id;
138
127
  // What it writes under keys of `contributes` that are none of Coda's: for the points other plugins declare (checkCatalog).
139
- const offers = Object.fromEntries(Object.entries(contributes).filter(([key]) => !TYPES.includes(key)));
140
- const agents = agentDeclarations(contributes.agents, dir), icon = pluginIcon(manifest.icon, agents, dir);
128
+ const offers = Object.fromEntries(Object.entries(contributes).filter(([key]) => !CONTRIBUTES.includes(key) && !points.get(key)));
129
+ const read = Object.assign({}, ...[...points.values()].map(point => point.read(contributes[point.key], dir)));
130
+ const icon = pluginIcon(manifest.icon, dir) ?? [...points.values()].map(point => point.icon?.(read)).find(Boolean);
141
131
  return { id, displayName, description: typeof manifest.description === 'string' ? manifest.description : '', version: String(manifest.version ?? ''),
142
132
  category: manifestCategory(manifest), ...(icon ? { icon } : {}), ...(readmeFile(dir) ? { readme: true } : {}),
143
133
  source, dir, title: typeof configuration.title === 'string' ? configuration.title : displayName, properties,
144
134
  ...(manifest.coda !== undefined ? { coda: manifest.coda } : {}),
145
135
  ...(manifest.main ? { main: posix.normalize(manifest.main) } : {}), ...(activation.includes('onStartupFinished') ? { startup: true } : {}),
146
136
  ...(required.length ? { required: [...required] } : {}), workflows: files('.coda/workflows'),
147
- capabilities: [...(contributes.capabilities ?? [])].sort(), services: [...(contributes.services ?? [])],
148
- groups: (contributes.groups ?? []).map(g => ({ name: g.name, capacity: g.capacity })),
149
- commands: (contributes.commands ?? []).map(c => ({ name: c.name, command: c.command })),
150
- ...(contributes.events?.length ? { events: contributes.events.map(e => ({ name: e.name, starts: e.starts !== false, ...(e.ends ? { ends: true } : {}) })) } : {}),
151
- gitCredentials: (contributes.gitCredentials ?? []).map(c => ({ url: c.url, command: c.command })),
137
+ services: [...(contributes.services ?? [])],
138
+ ...read,
152
139
  endpoints: (contributes.endpoints ?? []).map(e => ({ id: e.id, command: e.command, ...(e.checks ? { checks: e.checks } : {}) })),
153
140
  // The entry as one path in its directory (`./view/a.html`, `view//a.html` are `view/a.html`): the clients load it by that.
154
141
  views: (contributes.views ?? []).map(v => ({ id: v.id, title: v.title, entry: posix.normalize(v.entry), ...(v.in?.length ? { in: [...v.in] } : {}),
155
142
  ...(v.icon ? { icon: v.icon } : {}), ...(v.handles?.length ? { handles: [...v.handles] } : {}), ...(v.readout ? { readout: v.readout } : {}),
156
143
  ...(v.checkout ? { checkout: v.checkout } : {}), ...(v.frame ? { frame: v.frame } : {}) })),
157
- ...(contributes.composerModes?.length ? { composerModes: composerModes(contributes.composerModes) } : {}),
158
144
  ...(contributes.protocols?.length ? { protocols: structuredClone(contributes.protocols) } : {}),
159
145
  ...(contributes.protocolImplementations?.length ? { protocolImplementations: [...contributes.protocolImplementations] } : {}),
160
146
  ...(Object.keys(offers).length ? { offers } : {}),
161
- agents,
162
147
  dependencies: [...dependencies], extensionPoints: extensionPoints(contributes.extensionPoints, dir),
163
148
  extensions: Object.entries(contributes.extensions ?? {}).map(([key, value]) => { const [plugin, point] = key.split('/'); return { plugin, point, command: value.command }; }),
164
- ...(contributes.instructions ? { instructions: contributes.instructions.trim() } : {}), ...(contributes.setup ? { setup: { command: contributes.setup.command } } : {}),
165
- ...(contributes.skills?.length ? { skills: skills(contributes.skills, dir) } : {}),
149
+ ...(contributes.setup ? { setup: { command: contributes.setup.command } } : {}),
166
150
  ...(Object.keys(contributes.environment ?? {}).length ? { environment: Object.entries(contributes.environment).map(([name, value]) => ({ name, value })) } : {}),
167
- ...(contributes.path?.length ? { path: contributes.path.map(entry => pathEntry(entry)) } : {}),
168
- ...(contributes.mcpServers && Object.keys(contributes.mcpServers).length ? { mcpServers: Object.entries(contributes.mcpServers).map(([name, server]) => ({ name,
169
- command: server.command, args: [...(server.args ?? [])], env: Object.entries(server.env ?? {}).map(([variable, value]) => ({ name: variable, value })) })) } : {}),
170
- ...(contributes.modelProviders?.length ? { modelProviders: contributes.modelProviders.map(p => ({ id: p.id, title: p.title.trim(), api: p.api, url: p.url,
171
- ...(p.key ? { key: /^\$\{config:([^}]+)\}$/.exec(p.key)[1] } : {}) })) } : {}),
172
- ...(contributes.executors?.length ? { executors: contributes.executors.map(e => ({ id: e.id, title: e.title.trim(),
173
- labels: executorLabels(e.labels, `执行环境 ${e.id} 的 labels`, 'invalid_plugin'), command: e.command })) } : {}),
174
- ...(contributes.repositories ? { repositories: { command: contributes.repositories.command } } : {}) };
151
+ ...(contributes.path?.length ? { path: contributes.path.map(entry => pathEntry(entry)) } : {}) };
175
152
  }
176
153
  // Its extension points (schemas/extension-points.json), each with what it says of itself: the schema of what others write for
177
154
  // one, read from its file.
@@ -228,18 +205,6 @@ export function mcpValues(plugin, settings, state, base) {
228
205
  return [{ name: server.name, command, args, env: Object.entries(env).map(([name, value]) => ({ name, value })) }];
229
206
  });
230
207
  }
231
- // The Agent Skills it brings (docs/plugins.md「Skills」): directories of its own, each with its SKILL.md, named after the
232
- // directory as the agents find them. They are laid into the working copy of each project it applies to.
233
- export const SKILL = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
234
- function skills(raw, dir) {
235
- return raw.map(path => {
236
- const relative = normalize(path).replace(/\/+$/, ''), name = relative.split('/').at(-1);
237
- const skill = { name, path: join(dir, relative) };
238
- // Descriptions are for browsing only; a missing or unreadable document is explained when opened.
239
- try { skill.description = readSkillDocument({ dir, skills: [skill] }, name).description; } catch { /* Keep the declaration. */ }
240
- return skill;
241
- });
242
- }
243
208
  // The plugins Coda ships: those in `dir`, which come from nowhere else, and its npm dependencies that are plugins
244
209
  // (`dependencies`), each with where it comes from, which a version from that same place may stand in for (docs/plugins.md
245
210
  // 「内置插件的来源」).
@@ -8,6 +8,7 @@ import { createHash } from 'node:crypto';
8
8
  import { normalize } from 'node:path';
9
9
  import { requireCondition as check } from '../../domain/errors.mjs';
10
10
  import { catalogChannelProblem, offerPoint, offeredCommands, offerProblem, withDependencies } from './plugin-extensions.mjs';
11
+ import { CONTRIBUTION_POINTS } from './contribution-points.mjs';
11
12
 
12
13
  export const COMMIT = /^[0-9a-f]{40}$/;
13
14
  const ID = /^[a-z][a-z0-9-]{0,39}$/;
@@ -253,26 +254,26 @@ export function builtinProblem(id, source, builtin, installed) {
253
254
  if (fromElsewhere(row.source) && !sameSource(copy.source, row.source)) return null;
254
255
  return `与内置插件 ${id} 同名${copy.source?.repo || copy.source?.package ? ',来源不同' : ''},请先卸载内置插件再安装`;
255
256
  }
256
- // What only one plugin may declare, as said to the user: an agent (sessions name it by its ID alone), a concurrency group
257
- // (any process takes it by its name), Git's credentials for an address, opening a kind of reference (a view's `handles`),
258
- // a composer mode's name and the character typed to enter one (the composer finds it by them)
259
- // and a key of `contributes` a point takes. A command, as a Skill or a variable, is a
260
- // project's: one two plugins of a project bring is neither's there (components/plugins/plugins.mjs launch).
261
- export const claims = plugin => [...plugin.agents.map(a => `Agent ${a.id}`), ...plugin.groups.map(g => `组 ${g.name}`),
262
- ...(plugin.gitCredentials ?? []).map(c => `${c.url} 的 Git 凭据`), ...(plugin.views ?? []).flatMap(v => (v.handles ?? []).map(kind => `打开 ${kind} 引用`)),
263
- ...(plugin.composerModes ?? []).flatMap(m => [`输入框模式 /${m.id}`, ...(m.trigger ? [`输入框里打 ${m.trigger} 进入的模式`] : [])]),
257
+ // What only one plugin may declare, as said to the user: what a component's contribution point says (its `claim`: an
258
+ // agent, which sessions name by its ID alone; a concurrency group, which any process takes by its name; Git's credentials
259
+ // for an address; a composer mode's name and the character typed to enter one), opening a kind of reference (a view's
260
+ // `handles`) and a key of `contributes` a point takes. A command, as a Skill or a variable, is a project's: one two plugins
261
+ // of a project bring is neither's there (components/plugins/plugins.mjs launch).
262
+ export const claims = plugin => [...[...CONTRIBUTION_POINTS.values()].flatMap(point => point.claim?.(plugin) ?? []),
263
+ ...(plugin.views ?? []).flatMap(v => (v.handles ?? []).map(kind => `打开 ${kind} 引用`)),
264
264
  ...Object.values(plugin.extensionPoints ?? {}).filter(p => p.contributes).map(p => `扩展点 contributes.${p.contributes}`)];
265
265
  // Why a plugin cannot sit beside those this machine has (`catalog`: built-in and installed, by ID; `builtin`: the plugins
266
- // Coda ships, by ID), or null: an installed built-in one's ID from another source (builtinProblem), or an agent, a group
267
- // or Git's credentials for an address another plugin declares. What it needs of the others — the plugins it depends on,
266
+ // Coda ships, by ID), or null: an installed built-in one's ID from another source (builtinProblem), what a component's
267
+ // contribution point lets only a built-in plugin bring (its `builtinOnly`, of the plugin read: why, none when it brings none
268
+ // of it), or what only one plugin may declare (claims) another plugin declares. What it needs of the others — the plugins it depends on,
268
269
  // the points it plugs into or writes for (plugin-extensions.mjs offerProblem) — is checked once all of them are there.
269
270
  export function catalogProblem(plugin, catalog, builtin, installed) {
270
271
  const named = builtinProblem(plugin.id, plugin.source, builtin, installed);
271
272
  if (named) return named;
272
- // Clients do not list a plugin's Git credentials in the confirmation yet: only one Coda ships may bring them.
273
- if (plugin.gitCredentials?.length && plugin.source?.kind !== 'builtin') return '只有 Coda 自带的插件能提供 Git 凭据';
274
- // Nor the command that lists repositories to choose from.
275
- if (plugin.repositories && plugin.source?.kind !== 'builtin') return '只有 Coda 自带的插件能提供仓库列表';
273
+ if (plugin.source?.kind !== 'builtin') for (const point of CONTRIBUTION_POINTS.values()) {
274
+ const only = point.builtinOnly?.(plugin);
275
+ if (only) return only;
276
+ }
276
277
  const own = claims(plugin), twice = own.find((claim, i) => own.indexOf(claim) !== i);
277
278
  if (twice) return `${twice} 在插件里声明了两次`;
278
279
  for (const claim of own) {
@@ -310,41 +311,34 @@ export function catalogAfter(plugin, { catalog, siblings }) {
310
311
  // another plugin's points too, which that plugin runs — those it writes for a point under a key of `contributes`, where
311
312
  // the point says, the catalog beside it (`catalog`) declaring it —, those it puts on every session's PATH, those
312
313
  // answering clients' requests, and the one that makes each
313
- // machine ready for it, run as it is installed or updated), the groups it brings,
314
- // what it calls its workflows and capabilities, how many settings, and what it tells every agent.
314
+ // machine ready for it, run as it is installed or updated), what a component's contribution point confirms (its
315
+ // `confirm`: its agents and the commands it puts on sessions' PATH, the Agent Skills it lays into projects, the MCP
316
+ // servers their agents start and what it tells every agent; the groups it brings, what it calls its capabilities; the
317
+ // modes it puts the composer in), what it calls its workflows and how many settings.
315
318
  export function contributions(plugin, catalog = new Map()) {
316
319
  const offers = Object.entries(plugin.offers ?? {}).flatMap(([key, raw]) => {
317
320
  const found = offerPoint(new Map([...catalog, [plugin.id, plugin]]), key);
318
321
  return found ? [{ plugin: found.plugin.id, point: found.point, title: found.declared.title, ...offeredCommands(raw, found.declared) }] : [];
319
322
  });
320
323
  return {
321
- // The Agent Skills it lays into the projects it applies to, by name; the variables it gives what starts there, each
322
- // with its value as written, and the directories it puts on their PATH.
323
- ...(plugin.skills?.length ? { skills: plugin.skills.map(s => s.name),
324
- skillDescriptions: Object.fromEntries(plugin.skills.filter(s => s.description).map(s => [s.name, s.description])) } : {}),
324
+ // The variables it gives what starts in the projects it applies to, each with its value as written, and the
325
+ // directories it puts on their PATH.
325
326
  ...(plugin.environment?.length ? { environment: plugin.environment.map(({ name, value }) => ({ name, value })) } : {}),
326
327
  ...(plugin.path?.length ? { path: plugin.path } : {}),
327
- agents: plugin.agents.map(a => ({ id: a.id, displayName: a.displayName, command: a.command })),
328
- commands: plugin.commands.map(c => ({ name: c.name, command: c.command })),
329
328
  ...(plugin.endpoints?.length ? { endpoints: plugin.endpoints.map(e => ({ id: e.id, command: e.command, ...(e.checks ? { checks: e.checks } : {}) })) } : {}),
330
- // The MCP servers its projects' agents start, word for word: what they run and the variables they are given as written.
331
- ...(plugin.mcpServers?.length ? { mcpServers: plugin.mcpServers.map(({ name, command, args, env }) => ({ name, command, args, env })) } : {}),
332
329
  // Its module the plugin host runs (docs/plugins.md「插件宿主」): code of its own in Coda's Node on this machine.
333
330
  ...(plugin.main ? { main: plugin.main } : {}),
334
331
  // The pages it opens in the clients, by name, with where they stay and their icon there: they run in the client's
335
332
  // sandbox, not as commands here.
336
333
  ...(plugin.views?.length ? { views: plugin.views.map(v => ({ id: v.id, title: v.title, ...(v.in ? { in: v.in } : {}), ...(v.icon ? { icon: v.icon } : {}), ...(v.handles ? { handles: v.handles } : {}), ...(v.readout ? { readout: v.readout } : {}),
337
334
  ...(v.checkout ? { checkout: v.checkout } : {}) })) } : {}),
338
- groups: plugin.groups.map(g => ({ name: g.name, capacity: g.capacity })),
339
- // The modes it puts the composer in, as declared: the clients show them from this.
340
- ...(plugin.composerModes?.length ? { composerModes: plugin.composerModes.map(({ schema: _, ...mode }) => mode) } : {}),
335
+ ...Object.assign({}, ...[...CONTRIBUTION_POINTS.values()].map(point => point.confirm?.(plugin))),
341
336
  extensions: plugin.extensions.map(e => ({ plugin: e.plugin, point: e.point, command: e.command })),
342
337
  // What it writes for points under keys of `contributes` (the resources plugin's panels): by point, how many and the
343
338
  // commands in them, each with what it is for.
344
339
  ...(offers.length ? { offers } : {}),
345
340
  ...(plugin.setup ? { setup: { command: plugin.setup.command } } : {}),
346
- workflows: plugin.workflows, capabilities: plugin.capabilities, settings: Object.keys(plugin.properties).length,
347
- ...(plugin.instructions ? { instructions: plugin.instructions } : {}),
341
+ workflows: plugin.workflows, settings: Object.keys(plugin.properties).length,
348
342
  // What each machine installs for it from npm, as read from its repository (components/plugins/plugin-sources.mjs inspect).
349
343
  ...(plugin.npm?.length ? { npm: plugin.npm } : {}),
350
344
  };
@@ -1,11 +1,5 @@
1
1
  import Ajv2020 from 'ajv/dist/2020.js';
2
2
  import { parseProtocolName } from '@coda-console/protocol/protocol';
3
- import { AGENTS, GROUPS, THREADS } from '../../domain/resource-kinds.mjs';
4
-
5
- // The resource kinds an invocation may name until the resource is a protocol of its own (docs/plugins.md「调用」): `threads`,
6
- // `agents`, `groups`. Only Coda's own core operations use these; a plugin defines protocols under its namespace.
7
- const KINDS = new Set([AGENTS, GROUPS, THREADS]);
8
- export const resourceKind = value => KINDS.has(value);
9
3
 
10
4
  // Only JSON Schema rules: no coercion, custom keywords or executable constraints. Only the type's schemas
11
5
  // supply defaults. An absent field without a declared default stays absent.
@@ -28,7 +22,7 @@ export function validate(check, value, who) {
28
22
  export class ProtocolTypes {
29
23
  constructor() { this.types = new Map(); }
30
24
  register({ kind, spec, status, operations = {}, contributions = {}, participants = () => [] }, registered = () => {}, replace = false) {
31
- if (!(parseProtocolName(kind) || resourceKind(kind)) || (this.types.has(kind) && !replace)) throw new TypeError(`协议名无效或已登记:${kind}`);
25
+ if (!parseProtocolName(kind) || (this.types.has(kind) && !replace)) throw new TypeError(`协议名无效或已登记:${kind}`);
32
26
  if (spec?.type !== 'object' || status?.type !== 'object') throw new TypeError(`${kind}: spec 与 status 须为对象 schema`);
33
27
  if (typeof participants !== 'function' || !object(contributions)) throw new TypeError(`${kind}: 需要 participants 与 contributions`);
34
28
  // Each operation is an input and either an immediate result or a run reference, as the protocol package defines them.
@@ -0,0 +1,55 @@
1
+ // What sessions take of plugins (components/plugins/contribution-points.mjs): the agents a plugin brings (schemas/agents.json),
2
+ // what it tells every agent (instructions), the Agent Skills it lays into projects (skills), the commands it puts on their
3
+ // PATH (commands) and the MCP servers their agents start (mcpServers), defined as this module loads.
4
+ // Descriptions only: nothing here imports a component, for the plugins read with them are read before any is made.
5
+ import { join, normalize } from 'node:path';
6
+ import { defineContributionPoint } from '../plugins/contribution-points.mjs';
7
+ import { SCHEMAS } from '@coda-console/protocol/validate';
8
+ import { iconFiles } from '../plugins/plugin-icons.mjs';
9
+ import { readSkillDocument } from '../plugins/skill-document.mjs';
10
+
11
+ const MODES = ['title', 'unset', 'note', 'auto', 'full'];
12
+ // `contributes.agents` of the plugin in `dir`, as its schema has them: who each is, how the clients draw it, and how Coda
13
+ // starts its process (components/plugins/agent-plugins.mjs).
14
+ export function agentDeclarations(raw = [], dir) {
15
+ return raw.map(agent => ({
16
+ id: agent.id, displayName: agent.displayName,
17
+ icon: iconFiles(dir, agent.icon),
18
+ command: agent.command,
19
+ ...(agent.lifecycle !== undefined ? { lifecycle: agent.lifecycle } : {}),
20
+ modes: Object.fromEntries(MODES.filter(key => agent.modes?.[key] !== undefined).map(key => [key, agent.modes[key]])),
21
+ ...(agent.skillsDir !== undefined ? { skillsDir: normalize(agent.skillsDir) } : {}),
22
+ configFiles: [...(agent.configFiles ?? [])],
23
+ ...(agent.setupHint !== undefined ? { setupHint: agent.setupHint } : {}),
24
+ }));
25
+ }
26
+ // The Agent Skills it brings (docs/plugins.md「Skills」): directories of its own, each with its SKILL.md, named after the
27
+ // directory as the agents find them. They are laid into the working copy of each project it applies to.
28
+ export const SKILL = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
29
+ function skills(raw, dir) {
30
+ return raw.map(path => {
31
+ const relative = normalize(path).replace(/\/+$/, ''), name = relative.split('/').at(-1);
32
+ const skill = { name, path: join(dir, relative) };
33
+ // Descriptions are for browsing only; a missing or unreadable document is explained when opened.
34
+ try { skill.description = readSkillDocument({ dir, skills: [skill] }, name).description; } catch { /* Keep the declaration. */ }
35
+ return skill;
36
+ });
37
+ }
38
+
39
+ // An agent is one plugin's: sessions name it by its ID alone. A plugin that draws no icon of its own and brings one agent
40
+ // is drawn as that agent.
41
+ defineContributionPoint({ key: 'agents', schema: SCHEMAS['agents.json'], read: (raw, dir) => ({ agents: agentDeclarations(raw, dir) }),
42
+ claim: plugin => plugin.agents.map(a => `Agent ${a.id}`), icon: plugin => plugin.agents.length === 1 ? plugin.agents[0].icon : null,
43
+ confirm: plugin => ({ agents: plugin.agents.map(a => ({ id: a.id, displayName: a.displayName, command: a.command })) }) });
44
+ defineContributionPoint({ key: 'instructions', schema: SCHEMAS['instructions.json'], read: raw => raw ? { instructions: raw.trim() } : {},
45
+ confirm: plugin => plugin.instructions ? { instructions: plugin.instructions } : {} });
46
+ // Confirmed by name, each with what its SKILL.md says it is for.
47
+ defineContributionPoint({ key: 'skills', schema: SCHEMAS['skills.json'], read: (raw, dir) => raw?.length ? { skills: skills(raw, dir) } : {},
48
+ confirm: plugin => plugin.skills?.length ? { skills: plugin.skills.map(s => s.name),
49
+ skillDescriptions: Object.fromEntries(plugin.skills.filter(s => s.description).map(s => [s.name, s.description])) } : {} });
50
+ defineContributionPoint({ key: 'commands', schema: SCHEMAS['commands.json'], read: (raw = []) => ({ commands: raw.map(c => ({ name: c.name, command: c.command })) }),
51
+ confirm: plugin => ({ commands: plugin.commands.map(c => ({ name: c.name, command: c.command })) }) });
52
+ // Confirmed word for word: what they run and the variables they are given as written.
53
+ defineContributionPoint({ key: 'mcpServers', schema: SCHEMAS['mcp-servers.json'], read: raw => raw && Object.keys(raw).length ? { mcpServers: Object.entries(raw).map(([name, server]) => ({ name,
54
+ command: server.command, args: [...(server.args ?? [])], env: Object.entries(server.env ?? {}).map(([variable, value]) => ({ name: variable, value })) })) } : {},
55
+ confirm: plugin => plugin.mcpServers?.length ? { mcpServers: plugin.mcpServers.map(({ name, command, args, env }) => ({ name, command, args, env })) } : {} });
@@ -0,0 +1,17 @@
1
+ // What workflows take of plugins (components/plugins/contribution-points.mjs): the capabilities a plugin's workflows
2
+ // stand for (schemas/capabilities.json), its concurrency groups (schemas/groups.json), the events it publishes
3
+ // (schemas/events.json) and its execution environments (schemas/executors.json), defined as this module loads.
4
+ // Descriptions only: nothing here imports a component, for the plugins read with them are read before any is made.
5
+ import { defineContributionPoint } from '../plugins/contribution-points.mjs';
6
+ import { SCHEMAS } from '@coda-console/protocol/validate';
7
+ import { executorLabels } from './executor-labels.mjs';
8
+
9
+ defineContributionPoint({ key: 'capabilities', schema: SCHEMAS['capabilities.json'], read: (raw = []) => ({ capabilities: [...raw].sort() }),
10
+ confirm: plugin => ({ capabilities: plugin.capabilities }) });
11
+ // A group is one plugin's: any process takes it by its name.
12
+ defineContributionPoint({ key: 'groups', schema: SCHEMAS['groups.json'], read: (raw = []) => ({ groups: raw.map(g => ({ name: g.name, capacity: g.capacity })) }),
13
+ claim: plugin => plugin.groups.map(g => `组 ${g.name}`),
14
+ confirm: plugin => ({ groups: plugin.groups.map(g => ({ name: g.name, capacity: g.capacity })) }) });
15
+ defineContributionPoint({ key: 'events', schema: SCHEMAS['events.json'], read: raw => raw?.length ? { events: raw.map(e => ({ name: e.name, starts: e.starts !== false, ...(e.ends ? { ends: true } : {}) })) } : {} });
16
+ defineContributionPoint({ key: 'executors', schema: SCHEMAS['executors.json'], read: raw => raw?.length ? { executors: raw.map(e => ({ id: e.id, title: e.title.trim(),
17
+ labels: executorLabels(e.labels, `执行环境 ${e.id} 的 labels`, 'invalid_plugin'), command: e.command })) } : {} });
@@ -1,38 +1,44 @@
1
1
  {
2
- "commit": "411ace9a8c2372fce2ed3a4d2fa7ce3357b93da0",
2
+ "commit": "3ba483979a98c03e4d4150a5f06d1c57c380263a",
3
3
  "packages": {
4
4
  "@0dep/piso": "5.2.0",
5
5
  "@agentclientprotocol/sdk": "1.4.0",
6
- "@coda-console/protocol": "3.5.0",
6
+ "@coda-console/protocol": "4.0.0",
7
7
  "ajv": "8.20.0",
8
8
  "yaml": "2.9.1"
9
9
  },
10
10
  "files": {
11
+ "check/coda/application/contributions.mjs": "7460dc676171e24802b165a72e83ec72c4115f5ed169abcad08963bd2d9d251f",
11
12
  "check/coda/components/protocols/creation.mjs": "2b4a400d3064af4b5106077dc783c567910fef3c47b2d52af3f0d838c5accf19",
12
- "check/coda/components/protocols/types.mjs": "b101452e2638b1dd27e103e58f6c56ee2e19d598840d8f59c4bb8e06687bf4da",
13
+ "check/coda/components/protocols/types.mjs": "a2fccd146283b56e0d1e23c0979f88e84a045326576597379cbbcf2f4a96271e",
13
14
  "check/coda/adapters/provider-api.mjs": "a584316c3e0dafa19667f4288c54b8f894b49de72d9f62098d592b9084dec482",
14
15
  "check/coda/adapters/admission-api.mjs": "461b5a8a1ad73d7afed5db308813d02324e29c643b8e773ad127d4bdb00fb524",
16
+ "check/coda/components/composers/contributions.mjs": "43d3e15fb1f63b7b5c20716030d9537613809ed5cc2fb466a3678bfa308f9f92",
15
17
  "check/coda/components/composers/schemas.mjs": "6d497f58147756e789f9a566b2366f2fe36c0c72310421fb02508bf24a04f2c0",
16
- "check/coda/components/plugins/agent-plugins.mjs": "7ca5c0303c6fedffa7b0bcd90546273356ebc410b101f203f2ee8e7503063403",
18
+ "check/coda/components/plugins/contribution-points.mjs": "2d464bdde95e31143ee4dd9799a377730b7dad4a8c75b6dd6c150f83418cd275",
19
+ "check/coda/components/plugins/git-contributions.mjs": "532917cd3ec45e12535e9e6c206ae14fa598bebc789ab0c8f15609d1699fa1cd",
20
+ "check/coda/components/plugins/model-contributions.mjs": "018a7157954b2326887ba1a780b37d3beb33338e41a28936b313562c2939d563",
17
21
  "check/coda/components/plugins/plugin-extensions.mjs": "4d7963185195ba6d21a4e49a66987613d5892210b1eb1dc02cffb7b816407776",
18
- "check/coda/components/plugins/plugin-rules.mjs": "5c6aeb7025337098f33844b743faaaa4cf122c343c3a897d755b00098a5d4938",
19
- "check/coda/components/plugins/plugin-source-rules.mjs": "cdbe62cc3264469ec91ef7b8ff011a4b8313210f02bd44feb6bfb19eb4624fb9",
22
+ "check/coda/components/plugins/plugin-icons.mjs": "ec29cadce4948ecacabfe911a2ceb45414b96e28971358acbc4e952bedc78e1a",
23
+ "check/coda/components/plugins/plugin-rules.mjs": "f6e54f37532e48689c2d0cb8a247cdee77fc4d225d59d64fd5283609657e2600",
24
+ "check/coda/components/plugins/plugin-source-rules.mjs": "375bd284d4c29278d9ad0a476b743a378cca40be550fc68c6e86a78ffcd60a39",
20
25
  "check/coda/components/plugins/skill-document.mjs": "153ad3c096c7c9b7774bcf7dcc0ba603c962ee1ac8697c8a71e3f2c9ba9c92e6",
21
26
  "check/coda/components/prompt-recovery/prompt-recovery.mjs": "f43f21d24c19a58113d3304f9248225b12080ab00ed15eab74bf7b94642732de",
22
27
  "check/coda/components/session-config/commands.mjs": "b8505802e25590435bf48d741522d85c8b185e8f2ae190d49e53eebd35a1d453",
28
+ "check/coda/components/session-config/contributions.mjs": "27152924fb6c0b3519f31cd863516ff527d512d5b400ecc4fbfa6feb0e4eb60e",
29
+ "check/coda/components/workflows/contributions.mjs": "824c9b29584821b5e75bad00f02f21adc5031369db4ee9a4a5a836dfd44f98f5",
23
30
  "check/coda/components/workflows/executor-labels.mjs": "dceca6ae60c0a4f3c3cc72a6c84f1489831790774c93caab96e4ddb493bc89e1",
24
31
  "check/coda/domain/agent-protocol.mjs": "769cc10dc21b3cef7718f94272aaef2d17d4882d42617b408cb47357abfc3bcb",
25
32
  "check/coda/domain/duration.mjs": "15dd64ef9b02342ad521c66e5968a569432a89dc7568d11afd3e6f3fe37e104b",
26
33
  "check/coda/domain/errors.mjs": "8319c6759c5b16b692f5e0a6208d066e43882c571da1075bff8698761020daef",
27
34
  "check/coda/domain/resource-admission.mjs": "775b1d7067f9d8487a3504d737f3f4bea31adf77af3357ed42e313805e5188e7",
28
35
  "check/coda/domain/plugin-services.mjs": "940a72a14da980188a32c790c7f341d3ec0062a6e87ef1ebc9ef051798ea0a75",
29
- "check/coda/domain/resource-kinds.mjs": "32d020457484823ce8c2ce1c6ec10cef9d6dabafc4d0c640b4084a8339622930",
30
36
  "check/coda/domain/values.mjs": "01cc72b8d9c09e3fe16c93ec332ca01148bba859b1c672586d9d07444d7816c4",
31
37
  "check/coda/kernel/agent-failures.mjs": "cbc215e2403d86f0acc765c2077197e0b529fc01e213db465c388361238ea8ce",
32
38
  "check/coda/resources/plugins/resources/panels/command.mjs": "606f28bf87f87dded9df2db892bc7624c770d795ffab88f2409998346920ae42",
33
39
  "check/coda/resources/plugins/resources/panels/panels.mjs": "4862dccd91c29db76caf1033ffeab743c7943befaca7406a56467c470b90a1b8",
34
40
  "check/coda/resources/plugins/resources/panels/rules.mjs": "d5b12f3e0e5040224314e5d2de2bd49f5b1ed24ea205590ff99a54e8b4e96d7f",
35
41
  "check/coda/resources/plugins/resources/panels/sign-in.mjs": "1271a24e33b1b882a1fb9bee03b8e240db8b9bee1b5208f0e1c84499cfb1be7e",
36
- "check/coda/builtin.json": "c28aa014d8f7db50a1f58cde4315183c53aa1c09ce4c4d4a3878c06de446539b"
42
+ "check/coda/builtin.json": "a92e59edb50e444394daef8160ed9bc9d593fccc57d09df7b4ec4f9997850624"
37
43
  }
38
44
  }
@@ -1,12 +1,14 @@
1
1
  // The manifest level: whether the plugin is of the types it names (Coda's docs/plugins.md「插件的内容」, #1917). Its
2
2
  // package.json is checked against the schemas of Coda's types (the protocol, @coda-console/protocol) by the checker Coda runs
3
- // itself, and then read as Coda reads it: its ID, and its settings named under it. What Coda says only where it installs one — the repository it comes from, its npm
3
+ // itself, and then read as Coda reads it, with the contribution points Coda's components define (check/coda/application/
4
+ // contributions.mjs, loaded first: without them their keys are no type): its ID, and its settings named under it. What Coda says only where it installs one — the repository it comes from, its npm
4
5
  // lock, the plugins of that machine beside it — is that machine's to say, not a question of the plugin's types: the checker
5
6
  // does not run it. The plugins Coda ships (check/coda/builtin.json) and those beside this one in its directory's parent
6
7
  // stand in for what it depends on, for the levels after this one.
7
8
  import { existsSync, readFileSync, realpathSync } from 'node:fs';
8
9
  import { dirname, join } from 'node:path';
9
10
  import { inflateSync } from 'node:zlib';
11
+ import './coda/application/contributions.mjs';
10
12
  import shipped from './coda/builtin.json' with { type: 'json' };
11
13
  import { manifestProblem } from '@coda-console/protocol/validate';
12
14
  import { offerProblem } from './coda/components/plugins/plugin-extensions.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coda-console/plugin-check",
3
- "version": "0.7.6",
3
+ "version": "0.8.1",
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": "3.5.0",
27
+ "@coda-console/protocol": "4.0.0",
28
28
  "ajv": "8.20.0",
29
29
  "yaml": "2.9.1"
30
30
  },