@coda-console/plugin-check 0.8.23 → 0.8.24
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/check/coda/adapters/plugin-command.mjs +5 -4
- package/check/coda/adapters/plugin-modules.mjs +5 -4
- package/check/coda/adapters/plugin-test-host.d.mts +12 -2
- package/check/coda/adapters/plugin-test-host.mjs +13 -11
- package/check/coda/builtin.json +178 -30
- package/check/coda/components/plugins/plugin-extensions.mjs +12 -4
- package/check/coda/components/plugins/plugin-rules.mjs +41 -4
- package/check/coda/components/plugins/plugin-source-rules.mjs +6 -2
- package/check/coda/contract.json +10 -10
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The one runner of a plugin's commands (docs/plugins.md「命令的约定」):
|
|
1
|
+
// The one runner of a plugin's commands (docs/plugins.md「命令的约定」): the operations its commands implement
|
|
2
2
|
// (components/plugins/plugin-host.mjs `startCommand`), its resources' readings and actions,
|
|
3
3
|
// their logins and installers, its setup; and, bounded the same way, the programs Coda runs for a plugin itself (Git taking a
|
|
4
4
|
// plugin from its repository, components/plugins/plugin-sources.mjs; a repository's listing; what a plugin tells agents).
|
|
@@ -54,10 +54,11 @@ export const runBounded = (program, args, options) => startBounded(program, args
|
|
|
54
54
|
export const fileCommand = file => `./'${posix.normalize(file).replaceAll("'", "'\\''")}'`;
|
|
55
55
|
// What a command implementing an operation is told of its call in its environment, as a module's handler is in its `ctx`
|
|
56
56
|
// (docs/plugins.md「用命令实现操作」): its record (`ctx.record`, its key only of one its plugin holds here), its ID (`ctx.id`)
|
|
57
|
-
// and, when it has one, its deadline (`ctx.deadline`, milliseconds).
|
|
58
|
-
export const callEnv = ({ id, record, deadline }) => ({ CODA_RECORD_KIND: record.kind, CODA_RECORD_ID: record.id,
|
|
57
|
+
// and, when it has one, its deadline (`ctx.deadline`, milliseconds); made from a page, who is before it (`ctx.caller`, JSON).
|
|
58
|
+
export const callEnv = ({ id, record, deadline, caller }) => ({ CODA_RECORD_KIND: record.kind, CODA_RECORD_ID: record.id,
|
|
59
59
|
...(record.key === undefined ? {} : { CODA_RECORD_KEY: record.key }), CODA_CALL_ID: id,
|
|
60
|
-
...(deadline === null || deadline === undefined ? {} : { CODA_DEADLINE: String(deadline) })
|
|
60
|
+
...(deadline === null || deadline === undefined ? {} : { CODA_DEADLINE: String(deadline) }),
|
|
61
|
+
...(caller ? { CODA_CALLER: JSON.stringify(caller) } : {}) });
|
|
61
62
|
// A query's ID, as its handler is given it (`ctx.id`, adapters/plugin-modules.mjs): of its caller and its request's.
|
|
62
63
|
export const queryId = request => derivedUUID('query', request.parent, request.requestId);
|
|
63
64
|
|
|
@@ -42,10 +42,11 @@ export function pluginModules({ send }) {
|
|
|
42
42
|
// What a handler of a call is given beside its input (coda#2749 3.1): the call's ID, its record, its `signal`, which goes
|
|
43
43
|
// off as the backend calls it off, its `deadline` (milliseconds on the backend's clock, or none), `query`, queries made
|
|
44
44
|
// under it, and `spawn`, processes started for it, the backend's request `under` which the call came; a doing call's
|
|
45
|
-
// handler (`run`, `resume`), `call` too, doing calls it makes (`doingOf`).
|
|
45
|
+
// handler (`run`, `resume`), `call` too, doing calls it makes, and, made from a page, `caller`, who is before it (`doingOf`).
|
|
46
46
|
const contextOf = ({ id, record, deadline }, signal, { querying, spawnFor }, under) =>
|
|
47
47
|
({ id, record, signal, deadline, query: querying.within(signal, deadline), spawn: spawnFor(under, signal) });
|
|
48
|
-
const doingOf = (call, signal, made, under) => ({ ...contextOf(call, signal, made, under), call: made.calling.within(signal, call.deadline, under)
|
|
48
|
+
const doingOf = (call, signal, made, under) => ({ ...contextOf(call, signal, made, under), call: made.calling.within(signal, call.deadline, under),
|
|
49
|
+
...(call.caller ? { caller: call.caller } : {}) });
|
|
49
50
|
// The processes the modules started through the backend (`spawn`), by the key this host gave each, until they have
|
|
50
51
|
// exited or the host stops.
|
|
51
52
|
const processes = new Map();
|
|
@@ -398,7 +399,7 @@ export function pluginModules({ send }) {
|
|
|
398
399
|
} finally { cancels.delete(id); }
|
|
399
400
|
},
|
|
400
401
|
// A doing call of a protocol the plugin implements (docs/plugins.md「做事的操作」), as the backend hosts it
|
|
401
|
-
// (components/plugins/hosted-calls.mjs): `call` is `{ id, ref, record, operation, input, deadline }`, `ref` the call's on the call
|
|
402
|
+
// (components/plugins/hosted-calls.mjs): `call` is `{ id, ref, record, operation, input, deadline, caller? }`, `ref` the call's on the call
|
|
402
403
|
// kernel (`{ from, id }`), which the doing calls its handler makes are made by. Its handler is given
|
|
403
404
|
// besides `progress`, said to the backend as it comes, and `ask`, answered as the backend passes the answer on (one at
|
|
404
405
|
// a time, as the backend has it: components/plugins/hosted-calls.mjs `question`). It ends with the call's outcome (`ending`). Not handled, nothing was done.
|
|
@@ -421,7 +422,7 @@ export function pluginModules({ send }) {
|
|
|
421
422
|
});
|
|
422
423
|
},
|
|
423
424
|
// A doing call left by a host process that ended before its handler did (coda#2749 3.6), handed to its operation's
|
|
424
|
-
// `resume` in this one: `call` is `{ id, ref, record, operation, input, deadline, progress, canceled, halted }`, `halted`
|
|
425
|
+
// `resume` in this one: `call` is `{ id, ref, record, operation, input, deadline, caller?, progress, canceled, halted }`, `halted`
|
|
425
426
|
// why its `ctx.signal` has gone off already (asked to be cancelled, or past its deadline, as `cancel`'s reason
|
|
426
427
|
// crosses), or none. `resume` is given the call as `Interrupted` and a `ctx` as a query's handler is with `call`, and ends it as
|
|
427
428
|
// `run` does; with none, null, for the backend to end it as it does then. Its `ctx.call` makes calls as the call's, as `run`'s
|
|
@@ -45,6 +45,9 @@ export interface CallOptions {
|
|
|
45
45
|
onProgress?(value: Json): void;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** Who is before the page that made a doing call: Coda's own client on this machine, or a device, with its name if known. */
|
|
49
|
+
export type Caller = { local: true } | { device: string; name?: string };
|
|
50
|
+
|
|
48
51
|
/** What a handler of a call is given beside its input. A handler of a query, and `resume`, have no `progress` nor `ask`. */
|
|
49
52
|
export interface Context {
|
|
50
53
|
/** This call's ID, the host's, unique: the same for the same caller's same request. */
|
|
@@ -75,6 +78,11 @@ export interface Context {
|
|
|
75
78
|
* made before the process ended, its outcome waited on again.
|
|
76
79
|
*/
|
|
77
80
|
call?: Coda['call'];
|
|
81
|
+
/**
|
|
82
|
+
* A doing call's, made from a plugin's page: who is before that page, as Coda knows it, never as the page says. None
|
|
83
|
+
* for a call a module (`coda.call`), a command (`coda call`) or a flow makes.
|
|
84
|
+
*/
|
|
85
|
+
caller?: Caller;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
/** Its return value is the result; what it throws, the failure (`coda.error`, or anything else as `handler_error`). */
|
|
@@ -283,7 +291,7 @@ export interface TestPlugin {
|
|
|
283
291
|
* or `{ kind, commands }`, the operations in `commands` each implemented by a file of the plugin's (its path from `path`),
|
|
284
292
|
* the rest its module's. Such a command is run as Coda runs it, its call in its environment as its `ctx` has it
|
|
285
293
|
* (`CODA_RECORD_KIND`, `CODA_RECORD_ID`, `CODA_RECORD_KEY` of a record the plugin holds, `CODA_CALL_ID`, `CODA_DEADLINE`
|
|
286
|
-
* when it has one), but with no token: `coda progress`, `coda ask`, `coda query` and `coda self` in it are not answered
|
|
294
|
+
* when it has one, `CODA_CALLER`, the `caller` as JSON, when it has one), but with no token: `coda progress`, `coda ask`, `coda query` and `coda self` in it are not answered
|
|
287
295
|
* by the test host.
|
|
288
296
|
*/
|
|
289
297
|
protocolImplementations?: (string | ProtocolImplementation)[];
|
|
@@ -298,6 +306,8 @@ export interface TestCallOptions extends QueryOptions {
|
|
|
298
306
|
onProgress?(value: Json): void;
|
|
299
307
|
/** Answers a doing call's question (`ctx.ask`); without it, the question fails. */
|
|
300
308
|
answer?(question: Json): Json | Promise<Json>;
|
|
309
|
+
/** A doing call's: made from a page this caller is before (`ctx.caller`, `CODA_CALLER`); without it, as a module's call. */
|
|
310
|
+
caller?: Caller;
|
|
301
311
|
}
|
|
302
312
|
|
|
303
313
|
export interface TestHost {
|
|
@@ -320,7 +330,7 @@ export interface TestHost {
|
|
|
320
330
|
* `ctx.deadline`) or none: `canceled`, or the deadline past by the host's clock, its `ctx.signal` has gone off already
|
|
321
331
|
* (`AbortError`, `TimeoutError`); its result, or its failure; with no `resume`, an `interrupted` failure of unknown effect.
|
|
322
332
|
*/
|
|
323
|
-
resume(record: Ref, operation: string, call?: { id?: string; input?: Json; progress?: Json | null; canceled?: boolean; deadline?: number | null }): Promise<Json>;
|
|
333
|
+
resume(record: Ref, operation: string, call?: { id?: string; input?: Json; progress?: Json | null; canceled?: boolean; deadline?: number | null; caller?: Caller }): Promise<Json>;
|
|
324
334
|
/** Writes the plugin's settings again, as the backend does: `coda.settings.get` gives them, and `onChange` is told. */
|
|
325
335
|
setSettings(settings: Json): Promise<void>;
|
|
326
336
|
/** Delivers an event to the module as Coda does: to its handlers of the name (`coda.on`) now. */
|
|
@@ -316,8 +316,8 @@ export function createTestHost({ plugin = {}, call = null, clock = new Clock(),
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
// A run of the plugin's command `file` implementing an operation, as the backend runs one (components/plugins/plugin-host.mjs
|
|
319
|
-
// `startCommand`): `sh -c` from the plugin's directory, the call's input as JSON on its standard input, its record, ID
|
|
320
|
-
// deadline in its environment (`callEnv`); cancelled (`cancel`), its group asked to end, and made to once the grace has
|
|
319
|
+
// `startCommand`): `sh -c` from the plugin's directory, the call's input as JSON on its standard input, its record, ID,
|
|
320
|
+
// deadline and caller in its environment (`callEnv`); cancelled (`cancel`), its group asked to end, and made to once the grace has
|
|
321
321
|
// passed on the host's clock; the host closing kills it at once.
|
|
322
322
|
const commanded = (file, call, cancel) => startPluginCommand(fileCommand(file), { cwd: described.path, env: { ...process.env, ...callEnv(call) },
|
|
323
323
|
clock, timeoutMs: Infinity, signal: ending.signal, cancel, input: JSON.stringify(call.input), start: unregistered, label: `${described.id} · ${file}` });
|
|
@@ -342,10 +342,11 @@ export function createTestHost({ plugin = {}, call = null, clock = new Clock(),
|
|
|
342
342
|
// input checked as the operation has it, its deadline its `timeout` from now or the operation's own, or none; called
|
|
343
343
|
// off with `signal`, or past its deadline, its handler's `ctx.signal` goes off (`AbortError`, `TimeoutError`) and its
|
|
344
344
|
// handler ends it still. Its result as the module's outcome says (`outcomeOf`); failed, thrown with its code; cancelled,
|
|
345
|
-
// thrown as `canceled`. Each progress is given to `onProgress`, each question to `answer`, which answers it.
|
|
346
|
-
|
|
345
|
+
// thrown as `canceled`. Each progress is given to `onProgress`, each question to `answer`, which answers it. `caller`, who
|
|
346
|
+
// is before the page that made it (`ctx.caller`, `CODA_CALLER`), or none, as for a call not made from a page.
|
|
347
|
+
async function run(record, operation, input, found, { signal, timeout, onProgress, answer, caller }) {
|
|
347
348
|
const name = `${record.kind}/${operation}`, at = timeout ?? found.timeout;
|
|
348
|
-
const call = { id: randomUUID(), record: recordFor(record), operation, input, deadline: at ? clock.now() + at : null };
|
|
349
|
+
const call = { id: randomUUID(), record: recordFor(record), operation, input, deadline: at ? clock.now() + at : null, ...(caller ? { caller } : {}) };
|
|
349
350
|
try { checkInput(found, name, input); checkRequest(call); } catch (error) { throw Object.assign(error, { effects: 'none' }); }
|
|
350
351
|
const command = commandOf(manifest, record.kind, operation);
|
|
351
352
|
if (command) return ended(found, name, await commandRun(command, call, signal));
|
|
@@ -374,10 +375,11 @@ export function createTestHost({ plugin = {}, call = null, clock = new Clock(),
|
|
|
374
375
|
coda,
|
|
375
376
|
// Calls the plugin's module (or, for another's record, `call`) as a caller would: its result, or a failure with its
|
|
376
377
|
// `code`, `effects` and `retryAfterMs`. A query given up on with `signal` fails as an `AbortError`, past `timeout` as a
|
|
377
|
-
// `timeout`; a doing call of a protocol the plugin implements ends as its handler ends it (`run`)
|
|
378
|
-
|
|
378
|
+
// `timeout`; a doing call of a protocol the plugin implements ends as its handler ends it (`run`), made from a page
|
|
379
|
+
// when it has a `caller`.
|
|
380
|
+
call(record, operation, input = {}, { signal = null, timeout = null, onProgress = null, answer = null, caller = null } = {}) {
|
|
379
381
|
const found = operationOf(record?.kind, operation);
|
|
380
|
-
if (found && !found.safe && implemented.includes(record.kind)) return run(record, operation, input, found, { signal, timeout, onProgress, answer });
|
|
382
|
+
if (found && !found.safe && implemented.includes(record.kind)) return run(record, operation, input, found, { signal, timeout, onProgress, answer, caller });
|
|
381
383
|
return query(record, operation, input, { signal, deadline: timeout ? clock.now() + timeout : null });
|
|
382
384
|
},
|
|
383
385
|
// A query of the module's own (`coda self <名字>`, docs/plugins.md「只给自己用的查询」), handed to what it registered with
|
|
@@ -397,15 +399,15 @@ export function createTestHost({ plugin = {}, call = null, clock = new Clock(),
|
|
|
397
399
|
},
|
|
398
400
|
// A doing call of a protocol the plugin implements, left by a process of the plugin's that ended before its handler did,
|
|
399
401
|
// handed to its operation's `resume` as the backend hands it (coda#2749 3.6), with the call's `deadline` (`ctx.deadline`),
|
|
400
|
-
// or none: asked to be cancelled (`canceled`), or past its deadline, its `ctx.signal` gone off already as an
|
|
402
|
+
// or none, and its `caller` (`ctx.caller`), or none: asked to be cancelled (`canceled`), or past its deadline, its `ctx.signal` gone off already as an
|
|
401
403
|
// `AbortError` or a `TimeoutError`; its result, or its failure, as `call`'s; with no `resume`, interrupted, of unknown
|
|
402
404
|
// effect, as the backend ends it then.
|
|
403
|
-
async resume(record, operation, { id = randomUUID(), input = {}, progress = null, canceled = false, deadline = null } = {}) {
|
|
405
|
+
async resume(record, operation, { id = randomUUID(), input = {}, progress = null, canceled = false, deadline = null, caller = null } = {}) {
|
|
404
406
|
const found = operationOf(record?.kind, operation), name = `${record?.kind}/${operation}`;
|
|
405
407
|
if (!found || found.safe || !implemented.includes(record.kind)) throw refused('not_found', `插件没有实现做事的操作 ${name}`);
|
|
406
408
|
const halted = canceled ? { name: 'AbortError' } : deadline !== null && deadline <= clock.now() ? { name: 'TimeoutError' } : null;
|
|
407
409
|
const call = { id, record: recordFor(record), operation, input, deadline, progress, canceled,
|
|
408
|
-
...(halted ? { halted } : {}) }, at = ++next;
|
|
410
|
+
...(caller ? { caller } : {}), ...(halted ? { halted } : {}) }, at = ++next;
|
|
409
411
|
const said = await new Promise((resolve, reject) => {
|
|
410
412
|
waiting.set(at, { resolve, reject });
|
|
411
413
|
modules.receive({ id: at, method: 'resume', params: { plugin: described, call } });
|
package/check/coda/builtin.json
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"approve-command"
|
|
26
26
|
],
|
|
27
27
|
"gitCredentials": [],
|
|
28
|
-
"endpoints": [],
|
|
29
28
|
"views": [],
|
|
30
29
|
"dependencies": [],
|
|
31
30
|
"extensionPoints": {},
|
|
@@ -57,7 +56,6 @@
|
|
|
57
56
|
"ask-user"
|
|
58
57
|
],
|
|
59
58
|
"gitCredentials": [],
|
|
60
|
-
"endpoints": [],
|
|
61
59
|
"views": [],
|
|
62
60
|
"dependencies": [],
|
|
63
61
|
"extensionPoints": {},
|
|
@@ -89,7 +87,6 @@
|
|
|
89
87
|
"change-setting"
|
|
90
88
|
],
|
|
91
89
|
"gitCredentials": [],
|
|
92
|
-
"endpoints": [],
|
|
93
90
|
"views": [],
|
|
94
91
|
"dependencies": [],
|
|
95
92
|
"extensionPoints": {},
|
|
@@ -124,7 +121,6 @@
|
|
|
124
121
|
"commands": [],
|
|
125
122
|
"capabilities": [],
|
|
126
123
|
"gitCredentials": [],
|
|
127
|
-
"endpoints": [],
|
|
128
124
|
"views": [
|
|
129
125
|
{
|
|
130
126
|
"id": "changes",
|
|
@@ -191,7 +187,6 @@
|
|
|
191
187
|
}
|
|
192
188
|
],
|
|
193
189
|
"gitCredentials": [],
|
|
194
|
-
"endpoints": [],
|
|
195
190
|
"views": [],
|
|
196
191
|
"offers": {
|
|
197
192
|
"resources": [
|
|
@@ -242,7 +237,6 @@
|
|
|
242
237
|
],
|
|
243
238
|
"capabilities": [],
|
|
244
239
|
"gitCredentials": [],
|
|
245
|
-
"endpoints": [],
|
|
246
240
|
"views": [],
|
|
247
241
|
"dependencies": [
|
|
248
242
|
"space"
|
|
@@ -254,7 +248,7 @@
|
|
|
254
248
|
"id": "github",
|
|
255
249
|
"displayName": "GitHub",
|
|
256
250
|
"description": "登录账号,推送时自动选对账号",
|
|
257
|
-
"version": "1.
|
|
251
|
+
"version": "1.13.0",
|
|
258
252
|
"category": "模型与账号",
|
|
259
253
|
"icon": {
|
|
260
254
|
"symbol": "arrow.triangle.pull",
|
|
@@ -304,12 +298,6 @@
|
|
|
304
298
|
"repositories": {
|
|
305
299
|
"command": "exec \"$CODA_NODE\" \"$CODA_PLUGIN_PATH/scripts/repositories.mjs\""
|
|
306
300
|
},
|
|
307
|
-
"endpoints": [
|
|
308
|
-
{
|
|
309
|
-
"id": "accounts",
|
|
310
|
-
"command": "exec node \"$CODA_PLUGIN_PATH/scripts/endpoint.mjs\""
|
|
311
|
-
}
|
|
312
|
-
],
|
|
313
301
|
"views": [
|
|
314
302
|
{
|
|
315
303
|
"id": "accounts",
|
|
@@ -1281,6 +1269,183 @@
|
|
|
1281
1269
|
]
|
|
1282
1270
|
}
|
|
1283
1271
|
}
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
"name": "github/account@1",
|
|
1275
|
+
"title": "GitHub 账号",
|
|
1276
|
+
"description": "这台机器上登录的 GitHub 账号,按试用顺序,带登录状态与提交署名",
|
|
1277
|
+
"spec": {
|
|
1278
|
+
"type": "object",
|
|
1279
|
+
"required": [
|
|
1280
|
+
"login",
|
|
1281
|
+
"order"
|
|
1282
|
+
],
|
|
1283
|
+
"properties": {
|
|
1284
|
+
"login": {
|
|
1285
|
+
"type": "string"
|
|
1286
|
+
},
|
|
1287
|
+
"order": {
|
|
1288
|
+
"type": "integer",
|
|
1289
|
+
"minimum": 0
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
"additionalProperties": false
|
|
1293
|
+
},
|
|
1294
|
+
"status": {
|
|
1295
|
+
"type": "object",
|
|
1296
|
+
"required": [
|
|
1297
|
+
"state",
|
|
1298
|
+
"signature",
|
|
1299
|
+
"unreadable"
|
|
1300
|
+
],
|
|
1301
|
+
"properties": {
|
|
1302
|
+
"state": {
|
|
1303
|
+
"enum": [
|
|
1304
|
+
"ok",
|
|
1305
|
+
"invalid",
|
|
1306
|
+
"absent",
|
|
1307
|
+
"unknown"
|
|
1308
|
+
]
|
|
1309
|
+
},
|
|
1310
|
+
"signature": {
|
|
1311
|
+
"type": [
|
|
1312
|
+
"object",
|
|
1313
|
+
"null"
|
|
1314
|
+
],
|
|
1315
|
+
"required": [
|
|
1316
|
+
"name",
|
|
1317
|
+
"email"
|
|
1318
|
+
],
|
|
1319
|
+
"properties": {
|
|
1320
|
+
"name": {
|
|
1321
|
+
"type": "string"
|
|
1322
|
+
},
|
|
1323
|
+
"email": {
|
|
1324
|
+
"type": "string"
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
"additionalProperties": false
|
|
1328
|
+
},
|
|
1329
|
+
"unreadable": {
|
|
1330
|
+
"type": "boolean"
|
|
1331
|
+
}
|
|
1332
|
+
},
|
|
1333
|
+
"additionalProperties": false
|
|
1334
|
+
},
|
|
1335
|
+
"operations": {
|
|
1336
|
+
"move": {
|
|
1337
|
+
"description": "在试用顺序里上移(-1)或下移(1)一位",
|
|
1338
|
+
"input": {
|
|
1339
|
+
"type": "object",
|
|
1340
|
+
"required": [
|
|
1341
|
+
"by"
|
|
1342
|
+
],
|
|
1343
|
+
"properties": {
|
|
1344
|
+
"by": {
|
|
1345
|
+
"enum": [
|
|
1346
|
+
-1,
|
|
1347
|
+
1
|
|
1348
|
+
]
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
"additionalProperties": false
|
|
1352
|
+
},
|
|
1353
|
+
"result": {
|
|
1354
|
+
"type": "object",
|
|
1355
|
+
"additionalProperties": false
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
"name": "github/owner@1",
|
|
1362
|
+
"title": "GitHub owner",
|
|
1363
|
+
"description": "记下的 owner 与它的仓库用来推送和署名的账号",
|
|
1364
|
+
"spec": {
|
|
1365
|
+
"type": "object",
|
|
1366
|
+
"required": [
|
|
1367
|
+
"owner",
|
|
1368
|
+
"login",
|
|
1369
|
+
"manual"
|
|
1370
|
+
],
|
|
1371
|
+
"properties": {
|
|
1372
|
+
"owner": {
|
|
1373
|
+
"type": "string"
|
|
1374
|
+
},
|
|
1375
|
+
"login": {
|
|
1376
|
+
"type": "string"
|
|
1377
|
+
},
|
|
1378
|
+
"manual": {
|
|
1379
|
+
"type": "boolean"
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
"additionalProperties": false
|
|
1383
|
+
},
|
|
1384
|
+
"status": {
|
|
1385
|
+
"type": "object",
|
|
1386
|
+
"additionalProperties": false
|
|
1387
|
+
},
|
|
1388
|
+
"operations": {
|
|
1389
|
+
"assign": {
|
|
1390
|
+
"description": "改用另一个已登录的账号",
|
|
1391
|
+
"input": {
|
|
1392
|
+
"type": "object",
|
|
1393
|
+
"required": [
|
|
1394
|
+
"login"
|
|
1395
|
+
],
|
|
1396
|
+
"properties": {
|
|
1397
|
+
"login": {
|
|
1398
|
+
"type": "string"
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
"additionalProperties": false
|
|
1402
|
+
},
|
|
1403
|
+
"result": {
|
|
1404
|
+
"type": "object",
|
|
1405
|
+
"additionalProperties": false
|
|
1406
|
+
},
|
|
1407
|
+
"idempotent": true
|
|
1408
|
+
},
|
|
1409
|
+
"forget": {
|
|
1410
|
+
"description": "删掉记录,下次用到时重新试出",
|
|
1411
|
+
"input": {
|
|
1412
|
+
"type": "object",
|
|
1413
|
+
"additionalProperties": false
|
|
1414
|
+
},
|
|
1415
|
+
"result": {
|
|
1416
|
+
"type": "object",
|
|
1417
|
+
"additionalProperties": false
|
|
1418
|
+
},
|
|
1419
|
+
"idempotent": true
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
],
|
|
1424
|
+
"protocolImplementations": [
|
|
1425
|
+
{
|
|
1426
|
+
"kind": "github/account@1",
|
|
1427
|
+
"commands": {
|
|
1428
|
+
"move": "scripts/ops/move.mjs"
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
"kind": "github/owner@1",
|
|
1433
|
+
"commands": {
|
|
1434
|
+
"assign": "scripts/ops/assign.mjs",
|
|
1435
|
+
"forget": "scripts/ops/forget.mjs"
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
],
|
|
1439
|
+
"records": [
|
|
1440
|
+
{
|
|
1441
|
+
"kind": "github/account@1",
|
|
1442
|
+
"command": "scripts/records/accounts.mjs",
|
|
1443
|
+
"every": 300000
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
"kind": "github/owner@1",
|
|
1447
|
+
"command": "scripts/records/owners.mjs",
|
|
1448
|
+
"every": 60000
|
|
1284
1449
|
}
|
|
1285
1450
|
],
|
|
1286
1451
|
"offers": {
|
|
@@ -1345,7 +1510,6 @@
|
|
|
1345
1510
|
"commands": [],
|
|
1346
1511
|
"capabilities": [],
|
|
1347
1512
|
"gitCredentials": [],
|
|
1348
|
-
"endpoints": [],
|
|
1349
1513
|
"views": [],
|
|
1350
1514
|
"dependencies": [],
|
|
1351
1515
|
"extensionPoints": {},
|
|
@@ -1417,7 +1581,6 @@
|
|
|
1417
1581
|
"commands": [],
|
|
1418
1582
|
"capabilities": [],
|
|
1419
1583
|
"gitCredentials": [],
|
|
1420
|
-
"endpoints": [],
|
|
1421
1584
|
"views": [],
|
|
1422
1585
|
"dependencies": [],
|
|
1423
1586
|
"extensionPoints": {},
|
|
@@ -1453,7 +1616,6 @@
|
|
|
1453
1616
|
"commands": [],
|
|
1454
1617
|
"capabilities": [],
|
|
1455
1618
|
"gitCredentials": [],
|
|
1456
|
-
"endpoints": [],
|
|
1457
1619
|
"views": [
|
|
1458
1620
|
{
|
|
1459
1621
|
"id": "panels",
|
|
@@ -1761,7 +1923,6 @@
|
|
|
1761
1923
|
"secret-request"
|
|
1762
1924
|
],
|
|
1763
1925
|
"gitCredentials": [],
|
|
1764
|
-
"endpoints": [],
|
|
1765
1926
|
"views": [],
|
|
1766
1927
|
"dependencies": [],
|
|
1767
1928
|
"extensionPoints": {},
|
|
@@ -1818,7 +1979,6 @@
|
|
|
1818
1979
|
"commands": [],
|
|
1819
1980
|
"capabilities": [],
|
|
1820
1981
|
"gitCredentials": [],
|
|
1821
|
-
"endpoints": [],
|
|
1822
1982
|
"views": [],
|
|
1823
1983
|
"dependencies": [],
|
|
1824
1984
|
"extensionPoints": {},
|
|
@@ -1865,7 +2025,6 @@
|
|
|
1865
2025
|
"commands": [],
|
|
1866
2026
|
"capabilities": [],
|
|
1867
2027
|
"gitCredentials": [],
|
|
1868
|
-
"endpoints": [],
|
|
1869
2028
|
"views": [],
|
|
1870
2029
|
"dependencies": [
|
|
1871
2030
|
"tailnet"
|
|
@@ -1903,7 +2062,6 @@
|
|
|
1903
2062
|
],
|
|
1904
2063
|
"capabilities": [],
|
|
1905
2064
|
"gitCredentials": [],
|
|
1906
|
-
"endpoints": [],
|
|
1907
2065
|
"views": [],
|
|
1908
2066
|
"dependencies": [],
|
|
1909
2067
|
"extensionPoints": {
|
|
@@ -1954,7 +2112,6 @@
|
|
|
1954
2112
|
"commands": [],
|
|
1955
2113
|
"capabilities": [],
|
|
1956
2114
|
"gitCredentials": [],
|
|
1957
|
-
"endpoints": [],
|
|
1958
2115
|
"views": [
|
|
1959
2116
|
{
|
|
1960
2117
|
"id": "session",
|
|
@@ -2064,7 +2221,6 @@
|
|
|
2064
2221
|
"commands": [],
|
|
2065
2222
|
"capabilities": [],
|
|
2066
2223
|
"gitCredentials": [],
|
|
2067
|
-
"endpoints": [],
|
|
2068
2224
|
"views": [],
|
|
2069
2225
|
"offers": {
|
|
2070
2226
|
"resources": [
|
|
@@ -2149,7 +2305,6 @@
|
|
|
2149
2305
|
"commands": [],
|
|
2150
2306
|
"capabilities": [],
|
|
2151
2307
|
"gitCredentials": [],
|
|
2152
|
-
"endpoints": [],
|
|
2153
2308
|
"views": [],
|
|
2154
2309
|
"offers": {
|
|
2155
2310
|
"resources": [
|
|
@@ -2209,7 +2364,6 @@
|
|
|
2209
2364
|
"commands": [],
|
|
2210
2365
|
"capabilities": [],
|
|
2211
2366
|
"gitCredentials": [],
|
|
2212
|
-
"endpoints": [],
|
|
2213
2367
|
"views": [],
|
|
2214
2368
|
"offers": {
|
|
2215
2369
|
"resources": [
|
|
@@ -2602,7 +2756,6 @@
|
|
|
2602
2756
|
}
|
|
2603
2757
|
}
|
|
2604
2758
|
],
|
|
2605
|
-
"endpoints": [],
|
|
2606
2759
|
"views": [],
|
|
2607
2760
|
"dependencies": [
|
|
2608
2761
|
"github"
|
|
@@ -2662,7 +2815,6 @@
|
|
|
2662
2815
|
"commands": [],
|
|
2663
2816
|
"capabilities": [],
|
|
2664
2817
|
"gitCredentials": [],
|
|
2665
|
-
"endpoints": [],
|
|
2666
2818
|
"views": [],
|
|
2667
2819
|
"offers": {
|
|
2668
2820
|
"resources": [
|
|
@@ -2740,7 +2892,6 @@
|
|
|
2740
2892
|
"commands": [],
|
|
2741
2893
|
"capabilities": [],
|
|
2742
2894
|
"gitCredentials": [],
|
|
2743
|
-
"endpoints": [],
|
|
2744
2895
|
"views": [],
|
|
2745
2896
|
"offers": {
|
|
2746
2897
|
"resources": [
|
|
@@ -2835,7 +2986,6 @@
|
|
|
2835
2986
|
"commands": [],
|
|
2836
2987
|
"capabilities": [],
|
|
2837
2988
|
"gitCredentials": [],
|
|
2838
|
-
"endpoints": [],
|
|
2839
2989
|
"views": [],
|
|
2840
2990
|
"dependencies": [],
|
|
2841
2991
|
"extensionPoints": {},
|
|
@@ -3000,7 +3150,6 @@
|
|
|
3000
3150
|
"review-commit"
|
|
3001
3151
|
],
|
|
3002
3152
|
"gitCredentials": [],
|
|
3003
|
-
"endpoints": [],
|
|
3004
3153
|
"views": [],
|
|
3005
3154
|
"dependencies": [
|
|
3006
3155
|
"github"
|
|
@@ -3035,7 +3184,6 @@
|
|
|
3035
3184
|
"commands": [],
|
|
3036
3185
|
"capabilities": [],
|
|
3037
3186
|
"gitCredentials": [],
|
|
3038
|
-
"endpoints": [],
|
|
3039
3187
|
"views": [],
|
|
3040
3188
|
"offers": {
|
|
3041
3189
|
"resources": [
|
|
@@ -98,7 +98,7 @@ export function implementsMissing(plugin, plugins, defined) {
|
|
|
98
98
|
}
|
|
99
99
|
// This Coda's API Level (docs/plugins.md「兼容」): what it offers plugins, counted. A manifest's `engines.coda` names the least
|
|
100
100
|
// a plugin needs; one naming none needs 0, which any Coda has.
|
|
101
|
-
export const API_LEVEL =
|
|
101
|
+
export const API_LEVEL = 2;
|
|
102
102
|
// The API Level a package's registry metadata asks for in its `engines`: a positive integer, or its digits as text (what
|
|
103
103
|
// npm's registry may make of one); undefined when it asks for none, null when it is anything else. A manifest read from
|
|
104
104
|
// its directory has the schema's shape (plugin-rules.mjs readPlugin).
|
|
@@ -108,12 +108,17 @@ export function wantedLevel(engines) {
|
|
|
108
108
|
if (Number.isInteger(value) && value >= 1) return value;
|
|
109
109
|
return typeof value === 'string' && /^[1-9][0-9]{0,8}$/.test(value) ? Number(value) : null;
|
|
110
110
|
}
|
|
111
|
+
// The keys of `contributes` Coda once read and no longer does: a manifest still writing one was made for what Coda took away.
|
|
112
|
+
const RETIRED_CONTRIBUTES = ['endpoints', 'groups', 'events'];
|
|
113
|
+
// Those of them `contributes` writes, a manifest's or a version's registry metadata: what either is read with as its `retired`.
|
|
114
|
+
export const retiredContributes = contributes => RETIRED_CONTRIBUTES.filter(key => Object.hasOwn(contributes ?? {}, key));
|
|
111
115
|
// Whether a plugin runs on this machine (docs/plugins.md「兼容」): the one judgment reading a source, installing, the store and
|
|
112
116
|
// the catalog take. Null when it does; else what it needs (`need`), what is missing (`missing`) and why, as the user is
|
|
113
117
|
// told (`error`). `host`: this machine — its API Level (`level`), its backend's channel, the catalog beside the plugin and
|
|
114
118
|
// Coda's own protocols (`defined`, as usesMissing takes them). A Level above this Coda's is Coda's to catch up with
|
|
115
|
-
// (`coda`); short of that, a channel it is not for,
|
|
116
|
-
// that is not here, is the plugin's to update (`update`): Coda no longer offers what it
|
|
119
|
+
// (`coda`); short of that, a channel it is not for, a key of `contributes` Coda retired, or a protocol or permission group
|
|
120
|
+
// it uses or a protocol it implements that is not here, is the plugin's to update (`update`): Coda no longer offers what it
|
|
121
|
+
// was made for.
|
|
117
122
|
export function compatibility(plugin, { catalog = new Map(), defined = () => null, ...here }) {
|
|
118
123
|
const own = ownIncompatibility(plugin, here);
|
|
119
124
|
if (own) return own;
|
|
@@ -124,10 +129,13 @@ export function compatibility(plugin, { catalog = new Map(), defined = () => nul
|
|
|
124
129
|
: coda ? `本机的 Coda 已不提供协议 ${protocol},插件需要更新` : `${used ? '用到' : '实现'}的协议 ${protocol} 不在这台机器上,也不随它一起装`;
|
|
125
130
|
return { need: 'update', missing, error };
|
|
126
131
|
}
|
|
127
|
-
// What of that a plugin answers by itself, whatever else is here: the API Level it needs, the channels it is for
|
|
132
|
+
// What of that a plugin answers by itself, whatever else is here: the API Level it needs, the channels it is for, the keys of
|
|
133
|
+
// `contributes` Coda retired it still writes (`retired`).
|
|
128
134
|
export function ownIncompatibility(plugin, { level = API_LEVEL, channel = null }) {
|
|
129
135
|
const wanted = plugin.engines?.coda ?? 0;
|
|
130
136
|
if (wanted > level) return { need: 'coda', missing: { level: wanted }, error: `这个版本要 Coda API Level ≥ ${wanted}(本机 ${level}),请先升级 Coda` };
|
|
137
|
+
const retired = plugin.retired?.[0];
|
|
138
|
+
if (retired) return { need: 'update', missing: { contribution: retired }, error: `本机的 Coda 已不提供 contributes.${retired},插件需要更新` };
|
|
131
139
|
const channelProblem = pluginChannelProblem(plugin, channel);
|
|
132
140
|
return channelProblem ? { need: 'update', missing: { channel }, error: channelProblem } : null;
|
|
133
141
|
}
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
// gives), and that its settings are named under it.
|
|
10
10
|
// A secret (`writeOnly`) is a text written and never read back, kept in a file beside the database and given to the
|
|
11
11
|
// plugin's processes as that file's path (`CODA_PLUGIN_SECRETS`).
|
|
12
|
-
import { readFileSync, readdirSync, existsSync } from 'node:fs';
|
|
12
|
+
import { readFileSync, readdirSync, existsSync, statSync } from 'node:fs';
|
|
13
13
|
import { join, normalize, posix } from 'node:path';
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
15
|
import { requireCondition as check, ContractError } from '../../domain/errors.mjs';
|
|
16
|
-
import { isDuration } from '../../domain/duration.mjs';
|
|
16
|
+
import { durationMs, isDuration } from '../../domain/duration.mjs';
|
|
17
17
|
import { AGENT_ID } from '../../domain/values.mjs';
|
|
18
18
|
import { THREAD_ENV, TOKEN_ENV } from '../../domain/session-env.mjs';
|
|
19
19
|
import { iconFiles } from './plugin-icons.mjs';
|
|
20
|
-
import { checkCatalog, extensionsFor } from './plugin-extensions.mjs';
|
|
20
|
+
import { checkCatalog, extensionsFor, retiredContributes } from './plugin-extensions.mjs';
|
|
21
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';
|
|
@@ -33,6 +33,8 @@ const PACKAGE_ROOT = fileURLToPath(new URL('../../../', import.meta.url));
|
|
|
33
33
|
// contribution point's (contribution-points.mjs), or for a point another plugin declares to take it (the resources
|
|
34
34
|
// plugin's `panels`), refused when neither does.
|
|
35
35
|
export const CONTRIBUTES = TYPES;
|
|
36
|
+
// The shortest a kind's records are given again by its command on their own (`contributes.records`' `every`).
|
|
37
|
+
const EVERY_LEAST = 60_000;
|
|
36
38
|
export const MODEL_PROVIDER = /^[a-z][a-z0-9-]{0,39}\/[a-z][a-z0-9-]{0,39}$/;
|
|
37
39
|
// How many model services a setting of several may name.
|
|
38
40
|
const MODEL_PROVIDERS_AT_MOST = 20;
|
|
@@ -114,6 +116,7 @@ export function readPlugin(dir, source, points = CONTRIBUTION_POINTS) {
|
|
|
114
116
|
const contributes = manifest.contributes ?? {}, configuration = contributes.configuration ?? {};
|
|
115
117
|
const protocolsProblem = ownedProtocolsProblem({ id, contributes: { protocols: contributes.protocols } });
|
|
116
118
|
check(!protocolsProblem, 'invalid_plugin', protocolsProblem);
|
|
119
|
+
const records = recordCommands(contributes, dir), self = selfCommands(contributes, dir), retired = retiredContributes(contributes);
|
|
117
120
|
const properties = Object.fromEntries(Object.entries(configuration.properties ?? {}).map(([key, value]) => {
|
|
118
121
|
check(key.split('.')[0] === id, 'invalid_plugin', `设置名须以「${id}.」开头:${key}`);
|
|
119
122
|
return [key, setting(value, key)];
|
|
@@ -131,6 +134,7 @@ export function readPlugin(dir, source, points = CONTRIBUTION_POINTS) {
|
|
|
131
134
|
...(manifest.coda !== undefined ? { coda: manifest.coda } : {}),
|
|
132
135
|
// The API Level it needs (plugin-extensions.mjs compatibility).
|
|
133
136
|
...(manifest.engines?.coda !== undefined ? { engines: { coda: manifest.engines.coda } } : {}),
|
|
137
|
+
...(retired.length ? { retired } : {}),
|
|
134
138
|
// The permission groups of others' protocols it uses (docs/plugins.md「用到的权限」), by protocol: checked against the
|
|
135
139
|
// catalog it is installed into, and whenever the catalog is read (plugin-extensions.mjs compatibility).
|
|
136
140
|
...(manifest.uses && Object.keys(manifest.uses).length ? { uses: structuredClone(manifest.uses) } : {}),
|
|
@@ -138,13 +142,14 @@ export function readPlugin(dir, source, points = CONTRIBUTION_POINTS) {
|
|
|
138
142
|
...(required.length ? { required: [...required] } : {}), workflows: files('.coda/workflows'),
|
|
139
143
|
services: [...(contributes.services ?? [])],
|
|
140
144
|
...read,
|
|
141
|
-
endpoints: (contributes.endpoints ?? []).map(e => ({ id: e.id, command: e.command })),
|
|
142
145
|
// The entry as one path in its directory (`./view/a.html`, `view//a.html` are `view/a.html`): the clients load it by that.
|
|
143
146
|
views: (contributes.views ?? []).map(v => ({ id: v.id, title: v.title, entry: posix.normalize(v.entry), ...(v.in?.length ? { in: [...v.in] } : {}),
|
|
144
147
|
...(v.icon ? { icon: v.icon } : {}), ...(v.handles?.length ? { handles: [...v.handles] } : {}), ...(v.readout ? { readout: v.readout } : {}),
|
|
145
148
|
...(v.checkout ? { checkout: v.checkout } : {}), ...(v.frame ? { frame: v.frame } : {}), ...(v.provides?.length ? { provides: [...v.provides] } : {}) })),
|
|
146
149
|
...(contributes.protocols?.length ? { protocols: structuredClone(contributes.protocols) } : {}),
|
|
147
150
|
...(contributes.protocolImplementations?.length ? { protocolImplementations: implementations(contributes.protocolImplementations) } : {}),
|
|
151
|
+
...(records.length ? { records } : {}),
|
|
152
|
+
...(Object.keys(self).length ? { self } : {}),
|
|
148
153
|
...(Object.keys(offers).length ? { offers } : {}),
|
|
149
154
|
dependencies: [...dependencies], extensionPoints: extensionPoints(contributes.extensionPoints, dir),
|
|
150
155
|
extensions: Object.entries(contributes.extensions ?? {}).map(([key, value]) => { const [plugin, point] = key.split('/'); return { plugin, point, command: value.command }; }),
|
|
@@ -290,6 +295,38 @@ export function pluginEnv({ catalog, installed, id, stateDir = () => null, setti
|
|
|
290
295
|
// (docs/plugins.md「用命令实现操作」). The test host (adapters/plugin-test-host.mjs) reads a manifest's with it too.
|
|
291
296
|
export const implementations = entries => entries
|
|
292
297
|
.map(entry => typeof entry === 'string' ? { kind: entry, commands: {} } : { kind: entry.kind, commands: { ...entry.commands } });
|
|
298
|
+
// A manifest's `contributes.records` as Coda keeps it (docs/plugins.md「命令写记录」), each `{ kind, command, every? }`, `every`
|
|
299
|
+
// in milliseconds: the kinds its commands give the records of, each one it implements (`protocolImplementations`, as only
|
|
300
|
+
// a plugin implementing a kind holds its records), given again no oftener than EVERY_LEAST. The file is one it runs itself (`runnable`).
|
|
301
|
+
function recordCommands(contributes, dir) {
|
|
302
|
+
const implemented = new Set(implementations(contributes.protocolImplementations ?? []).map(entry => entry.kind));
|
|
303
|
+
return (contributes.records ?? []).map(({ kind, command, every }, i) => {
|
|
304
|
+
const where = `contributes.records 第 ${i + 1} 项(${kind})`;
|
|
305
|
+
check(implemented.has(kind), 'invalid_plugin', `contributes.records 第 ${i + 1} 项的种类 ${kind} 不在这个插件的 protocolImplementations 里`);
|
|
306
|
+
let ms = null;
|
|
307
|
+
if (every !== undefined) {
|
|
308
|
+
try { ms = durationMs(every); } catch { ms = NaN; }
|
|
309
|
+
check(Number.isSafeInteger(ms), 'invalid_plugin', `${where}的 every ${every} 不是能用的时长`);
|
|
310
|
+
}
|
|
311
|
+
runnable(dir, command, where);
|
|
312
|
+
check(ms === null || ms >= EVERY_LEAST, 'invalid_plugin', `${where}的 every ${every} 短于 PT1M`);
|
|
313
|
+
return { kind, command, ...(ms === null ? {} : { every: ms }) };
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
// A manifest's `contributes.self` as Coda keeps it (docs/plugins.md「只给自己用的查询」): by name, the file in its directory
|
|
317
|
+
// that answers its own query of that name, before its module (plugin-host.mjs `querySelf`); each one it runs itself (`runnable`).
|
|
318
|
+
function selfCommands(contributes, dir) {
|
|
319
|
+
const self = { ...contributes.self };
|
|
320
|
+
for (const [name, command] of Object.entries(self)) runnable(dir, command, `contributes.self「${name}」`);
|
|
321
|
+
return self;
|
|
322
|
+
}
|
|
323
|
+
// A file of a plugin's that Coda runs itself (adapters/plugin-command.mjs fileCommand), there in its directory as the schema
|
|
324
|
+
// checks: executable, starting with `#!`; refused naming `where` it is written.
|
|
325
|
+
function runnable(dir, command, where) {
|
|
326
|
+
const path = join(dir, command);
|
|
327
|
+
check(statSync(path).mode & 0o111, 'invalid_plugin', `${where}的 ${command} 不可执行`);
|
|
328
|
+
check(readFileSync(path).subarray(0, 2).toString('latin1') === '#!', 'invalid_plugin', `${where}的 ${command} 不以 #! 开头`);
|
|
329
|
+
}
|
|
293
330
|
// The file in its directory that implements an operation of a protocol the plugin implements (`protocolImplementations`'
|
|
294
331
|
// `commands`), or null: its module's, or not the plugin's at all.
|
|
295
332
|
export function commandOf(plugin, kind, operation) {
|
|
@@ -319,7 +319,8 @@ export function catalogAfter(plugin, { catalog, siblings }) {
|
|
|
319
319
|
// What installing it brings, as the confirmation lists it: every command it runs, word for word (those it plugs into
|
|
320
320
|
// another plugin's points too, which that plugin runs — those it writes for a point under a key of `contributes`, where
|
|
321
321
|
// the point says, the catalog beside it (`catalog`) declaring it —, those it puts on every session's PATH, those
|
|
322
|
-
// answering clients' requests, those implementing operations of its protocols (by kind, operation and file),
|
|
322
|
+
// answering clients' requests, those implementing operations of its protocols (by kind, operation and file), those giving
|
|
323
|
+
// the records of its kinds and answering its own queries, and the one that makes each
|
|
323
324
|
// machine ready for it, run as it is installed or updated), what a component's contribution point confirms (its
|
|
324
325
|
// `confirm`: its agents and the commands it puts on sessions' PATH, the Agent Skills it lays into projects, the MCP
|
|
325
326
|
// servers their agents start and what it tells every agent; the groups it brings, what it calls its capabilities; the
|
|
@@ -335,9 +336,12 @@ export function contributions(plugin, catalog = new Map(), defined = () => null)
|
|
|
335
336
|
// directories it puts on their PATH.
|
|
336
337
|
...(plugin.environment?.length ? { environment: plugin.environment.map(({ name, value }) => ({ name, value })) } : {}),
|
|
337
338
|
...(plugin.path?.length ? { path: plugin.path } : {}),
|
|
338
|
-
...(plugin.endpoints?.length ? { endpoints: plugin.endpoints.map(e => ({ id: e.id, command: e.command })) } : {}),
|
|
339
339
|
// The files in its directory the backend runs as Coda calls an operation of a protocol it implements (docs/plugins.md「用命令实现操作」).
|
|
340
340
|
...(operationCommands(plugin).length ? { operations: operationCommands(plugin) } : {}),
|
|
341
|
+
// The files it runs to give the records of a kind it implements (docs/plugins.md「命令写记录」), by kind, and those
|
|
342
|
+
// answering its own queries (docs/plugins.md「只给自己用的查询」), by name.
|
|
343
|
+
...(plugin.records?.length ? { records: plugin.records.map(({ kind, command }) => ({ kind, command })) } : {}),
|
|
344
|
+
...(plugin.self ? { self: Object.entries(plugin.self).map(([name, command]) => ({ name, command })) } : {}),
|
|
341
345
|
// Its module the plugin host runs (docs/plugins.md「插件宿主」): code of its own in Coda's Node on this machine.
|
|
342
346
|
...(plugin.main ? { main: plugin.main } : {}),
|
|
343
347
|
// The pages it opens in the clients, by name, with where they stay and their icon there: they run in the client's
|
package/check/coda/contract.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "ca6267e229bcf0c622187c6cd300022d59505203",
|
|
3
3
|
"packages": {
|
|
4
4
|
"@0dep/piso": "5.2.0",
|
|
5
5
|
"@agentclientprotocol/sdk": "2.6.0",
|
|
6
|
-
"@coda-console/protocol": "6.
|
|
6
|
+
"@coda-console/protocol": "6.15.0",
|
|
7
7
|
"ajv": "8.20.0",
|
|
8
8
|
"yaml": "2.9.1"
|
|
9
9
|
},
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"check/coda/adapters/provider-api.mjs": "70441ea2a417ede13e04113ec254496883be3186f291ef5ee65834f35009eb9e",
|
|
17
17
|
"check/coda/adapters/call-limit.mjs": "7e86d95ff7b0a88955015904ec91ae55e78fad816d06f710d6e62af53ccbdeab",
|
|
18
18
|
"check/coda/adapters/clock.mjs": "79733b9ac3807b3da147fe8b782318a1cb42d1d51b9c8b81a507c13c7a8025fd",
|
|
19
|
-
"check/coda/adapters/plugin-command.mjs": "
|
|
19
|
+
"check/coda/adapters/plugin-command.mjs": "47bd580f7142780933315f64d4562d23a61f996b3f411cfb583333261b590ee8",
|
|
20
20
|
"check/coda/adapters/plugin-events.mjs": "8d63b55e333d3943d8c189d10439d5804372fbd831958491c93943f98cd078be",
|
|
21
|
-
"check/coda/adapters/plugin-modules.mjs": "
|
|
21
|
+
"check/coda/adapters/plugin-modules.mjs": "a7b0dbface89d5b2b16885ab8b0bd87ff9b53ce31faee7c69d609ba7b53b83eb",
|
|
22
22
|
"check/coda/adapters/plugin-stream-services.mjs": "1e92eb3dd9d844d4f2773a60bc2941aae3c9cda10d9e96e31de9f09f51e672e5",
|
|
23
|
-
"check/coda/adapters/plugin-test-host.d.mts": "
|
|
24
|
-
"check/coda/adapters/plugin-test-host.mjs": "
|
|
23
|
+
"check/coda/adapters/plugin-test-host.d.mts": "1a147a97f7e7391693a5a0acf79ce202d4d3afa8f3b580e6f379d0f10dfdf6ce",
|
|
24
|
+
"check/coda/adapters/plugin-test-host.mjs": "8c6e832eaeacaf95ac7d4a0e5594f907f609085155c830854ba3a390be085648",
|
|
25
25
|
"check/coda/adapters/process-relay.mjs": "5d379bd7ad07138d69c7accbe769d71294843399539bdf1fab8b6a1ddf13b9d8",
|
|
26
26
|
"check/coda/components/composers/contributions.mjs": "43d3e15fb1f63b7b5c20716030d9537613809ed5cc2fb466a3678bfa308f9f92",
|
|
27
27
|
"check/coda/components/concurrency-groups/schemas.mjs": "3c422044c637dee10565fb1b8bdc75b9c6a31e3b600ed223b7e5e345e1baf092",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"check/coda/components/plugins/contribution-points.mjs": "2dade9fe4f3fa2b4e89f49a1ac4378ab2621e5ac542eb175967091f04568b45c",
|
|
30
30
|
"check/coda/components/plugins/git-contributions.mjs": "532917cd3ec45e12535e9e6c206ae14fa598bebc789ab0c8f15609d1699fa1cd",
|
|
31
31
|
"check/coda/components/plugins/model-contributions.mjs": "018a7157954b2326887ba1a780b37d3beb33338e41a28936b313562c2939d563",
|
|
32
|
-
"check/coda/components/plugins/plugin-extensions.mjs": "
|
|
32
|
+
"check/coda/components/plugins/plugin-extensions.mjs": "ac1858346d94e41a2dcb030033d40df6c1f222b5de0759eb1f28d8db47c8097b",
|
|
33
33
|
"check/coda/components/plugins/plugin-icons.mjs": "ec29cadce4948ecacabfe911a2ceb45414b96e28971358acbc4e952bedc78e1a",
|
|
34
|
-
"check/coda/components/plugins/plugin-rules.mjs": "
|
|
35
|
-
"check/coda/components/plugins/plugin-source-rules.mjs": "
|
|
34
|
+
"check/coda/components/plugins/plugin-rules.mjs": "32cf0a3956a646e0c18cea62da4c0969af9f4c6f60ab1a4970937163a13a878a",
|
|
35
|
+
"check/coda/components/plugins/plugin-source-rules.mjs": "d3bf278c4fb35e99f602ea81419dff0ad0c2753ee20e6e3b648d2fecf82da44f",
|
|
36
36
|
"check/coda/components/plugins/process-contributions.mjs": "6d39a904f52956b87c04351398f79a4fc34981fa01453195bd7a3b9f2c5d237b",
|
|
37
37
|
"check/coda/components/plugins/skill-document.mjs": "153ad3c096c7c9b7774bcf7dcc0ba603c962ee1ac8697c8a71e3f2c9ba9c92e6",
|
|
38
38
|
"check/coda/components/prompt-recovery/prompt-recovery.mjs": "25477742af8a9134ae343af6ab702926692bdd8dd07844f3cba47e8b702c0e49",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"check/coda/resources/plugins/resources/panels/panels.mjs": "37ffc6a4ede3e4612cd13cf1a973a90892f8ce7e8a0f055e7cfe86313aae5224",
|
|
55
55
|
"check/coda/resources/plugins/resources/panels/rules.mjs": "a433d4e84138937297ec31a8912aab7bd48bba4b66da3a10978edb1367613c96",
|
|
56
56
|
"check/coda/resources/plugins/resources/panels/sign-in.mjs": "6eb016ef9a7f8aa03e0f4b2fa35ce139b8b1ff0deb4ec6e6a34139aed4f2841a",
|
|
57
|
-
"check/coda/builtin.json": "
|
|
57
|
+
"check/coda/builtin.json": "0eb63a693c912f7e339cda0b76b85110f881784b92c7788c8ea6d0a1c7468ade"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coda-console/plugin-check",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.24",
|
|
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": "2.6.0",
|
|
27
|
-
"@coda-console/protocol": "6.
|
|
27
|
+
"@coda-console/protocol": "6.15.0",
|
|
28
28
|
"ajv": "8.20.0",
|
|
29
29
|
"yaml": "2.9.1"
|
|
30
30
|
},
|