mirror of
https://git.openapi.site/https://github.com/desirecore/registry.git
synced 2026-12-06 03:39:05 +08:00
45 lines
1.6 KiB
JavaScript
45 lines
1.6 KiB
JavaScript
/** 作者 release 使用受审的新契约;普通条目仍由已发布 global Schema 校验。 */
|
|
export const AUTHORED_ENTRY_SCHEMA_FILENAME = 'registry-entry.v4.3.schema.json'
|
|
|
|
export function isAuthoredRegistryEntry(entry) {
|
|
return entry?.type === 'web-bundle' || (entry !== null && typeof entry === 'object' && Object.hasOwn(entry, 'appRelease'))
|
|
}
|
|
|
|
export function isApplicationEntry(entry) {
|
|
return ['docker-app', 'native-app', 'artifact', 'web-bundle'].includes(entry?.type)
|
|
}
|
|
|
|
/** Add the scoped MCP connection contract without replacing the published schema fingerprint. */
|
|
export function withMcpDataDirectory(schema) {
|
|
const connection = schema?.definitions?.connection
|
|
if (!connection?.properties) return schema
|
|
return {
|
|
...schema,
|
|
definitions: {
|
|
...schema.definitions,
|
|
connection: {
|
|
...connection,
|
|
properties: {
|
|
...connection.properties,
|
|
workdirStrategy: {
|
|
enum: ['per-directory', 'excel-allow-dir'],
|
|
description: 'Opt into confirmed Agent workdirs using independent processes or native Excel allow-dir options.',
|
|
},
|
|
requiresDataDirectory: {
|
|
const: true,
|
|
description: 'Require explicit user consent for the MCP data folders.',
|
|
},
|
|
},
|
|
allOf: [
|
|
...(connection.allOf ?? []),
|
|
{ if: { required: ['workdirStrategy'] }, then: { required: ['requiresDataDirectory'] } },
|
|
{
|
|
if: { required: ['requiresDataDirectory'] },
|
|
then: { properties: { transport: { const: 'stdio' } } },
|
|
},
|
|
],
|
|
},
|
|
},
|
|
}
|
|
}
|