@clowder-ai/plugin-contract 0.1.0-beta.11 → 0.1.0-beta.13
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/dist/codegen/generate-contract.d.ts +4 -0
- package/dist/codegen/generate-contract.d.ts.map +1 -1
- package/dist/codegen/generate-contract.js +171 -17
- package/dist/codegen/generate-contract.js.map +1 -1
- package/dist/conformance/runner.d.ts.map +1 -1
- package/dist/conformance/runner.js +2 -0
- package/dist/conformance/runner.js.map +1 -1
- package/dist/generated/contract.generated.d.ts +418 -8
- package/dist/generated/contract.generated.d.ts.map +1 -1
- package/dist/generated/contract.generated.js +1 -1
- package/dist/generated/contract.generated.js.map +1 -1
- package/dist/validation/catalog.d.ts +21 -0
- package/dist/validation/catalog.d.ts.map +1 -0
- package/dist/validation/catalog.js +140 -0
- package/dist/validation/catalog.js.map +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/manifest.d.ts.map +1 -1
- package/dist/validation/manifest.js +104 -0
- package/dist/validation/manifest.js.map +1 -1
- package/dist/wire/grants.d.ts +1 -1
- package/dist/wire/grants.js +1 -1
- package/dist/wire/signal-byte-bounds.d.ts +3 -3
- package/fixtures/behavior/messaging/adversarial-invariants.json +85 -0
- package/fixtures/manifest/invalid/icon-package-escape.json +22 -0
- package/fixtures/manifest/valid/localized-product-metadata.json +27 -0
- package/package.json +3 -1
- package/src/schemas/behavior-fixture.schema.json +262 -2
- package/src/schemas/catalog.schema.json +91 -0
- package/src/schemas/manifest.schema.json +388 -3
- package/src/schemas/plugin-metadata.schema.json +62 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const Ajv2020 = require('ajv/dist/2020');
|
|
4
|
+
const addFormats = require('ajv-formats');
|
|
5
|
+
const pluginMetadataSchema = require('@clowder-ai/plugin-contract/schemas/plugin-metadata');
|
|
6
|
+
const catalogSchema = require('@clowder-ai/plugin-contract/schemas/catalog');
|
|
7
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
8
|
+
addFormats(ajv);
|
|
9
|
+
ajv.addSchema(pluginMetadataSchema, pluginMetadataSchema['$id']);
|
|
10
|
+
const validateSchema = ajv.compile(catalogSchema);
|
|
11
|
+
function semanticError(instancePath, schemaPath, keyword, message) {
|
|
12
|
+
return { valid: false, errors: [{ instancePath, schemaPath, keyword, message }] };
|
|
13
|
+
}
|
|
14
|
+
function parseSemVer(value) {
|
|
15
|
+
const buildIndex = value.indexOf('+');
|
|
16
|
+
const withoutBuild = buildIndex === -1 ? value : value.slice(0, buildIndex);
|
|
17
|
+
const prereleaseIndex = withoutBuild.indexOf('-');
|
|
18
|
+
const core = prereleaseIndex === -1 ? withoutBuild : withoutBuild.slice(0, prereleaseIndex);
|
|
19
|
+
const prerelease = prereleaseIndex === -1 ? '' : withoutBuild.slice(prereleaseIndex + 1);
|
|
20
|
+
const [major, minor, patch] = core.split('.');
|
|
21
|
+
return {
|
|
22
|
+
numbers: [major, minor, patch],
|
|
23
|
+
prerelease: prerelease === '' ? [] : prerelease.split('.'),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function compareAscii(left, right) {
|
|
27
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
28
|
+
}
|
|
29
|
+
function compareNumericIdentifier(left, right) {
|
|
30
|
+
const lengthDelta = left.length - right.length;
|
|
31
|
+
return lengthDelta === 0 ? compareAscii(left, right) : lengthDelta;
|
|
32
|
+
}
|
|
33
|
+
function compareSemVer(left, right) {
|
|
34
|
+
const a = parseSemVer(left);
|
|
35
|
+
const b = parseSemVer(right);
|
|
36
|
+
for (let index = 0; index < a.numbers.length; index += 1) {
|
|
37
|
+
const delta = compareNumericIdentifier(a.numbers[index], b.numbers[index]);
|
|
38
|
+
if (delta !== 0)
|
|
39
|
+
return delta;
|
|
40
|
+
}
|
|
41
|
+
if (a.prerelease.length === 0 || b.prerelease.length === 0) {
|
|
42
|
+
return a.prerelease.length === b.prerelease.length ? 0 : a.prerelease.length === 0 ? 1 : -1;
|
|
43
|
+
}
|
|
44
|
+
const length = Math.max(a.prerelease.length, b.prerelease.length);
|
|
45
|
+
for (let index = 0; index < length; index += 1) {
|
|
46
|
+
const aPart = a.prerelease[index];
|
|
47
|
+
const bPart = b.prerelease[index];
|
|
48
|
+
if (aPart === undefined || bPart === undefined)
|
|
49
|
+
return aPart === undefined ? -1 : 1;
|
|
50
|
+
if (aPart === bPart)
|
|
51
|
+
continue;
|
|
52
|
+
const aNumeric = /^[0-9]+$/.test(aPart);
|
|
53
|
+
const bNumeric = /^[0-9]+$/.test(bPart);
|
|
54
|
+
if (aNumeric && bNumeric)
|
|
55
|
+
return compareNumericIdentifier(aPart, bPart);
|
|
56
|
+
if (aNumeric !== bNumeric)
|
|
57
|
+
return aNumeric ? -1 : 1;
|
|
58
|
+
return compareAscii(aPart, bPart);
|
|
59
|
+
}
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
/** Validate repository-owned discovery truth without creating Host inventory state. */
|
|
63
|
+
export function validatePluginCatalog(value) {
|
|
64
|
+
if (!validateSchema(value)) {
|
|
65
|
+
return {
|
|
66
|
+
valid: false,
|
|
67
|
+
errors: (validateSchema.errors ?? []).map((error) => ({
|
|
68
|
+
instancePath: error.instancePath,
|
|
69
|
+
schemaPath: error.schemaPath,
|
|
70
|
+
keyword: error.keyword,
|
|
71
|
+
message: error.message ?? 'catalog validation failed',
|
|
72
|
+
})),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const catalog = value;
|
|
76
|
+
const pluginIds = new Set();
|
|
77
|
+
let priorPluginId;
|
|
78
|
+
for (const [pluginIndex, plugin] of catalog.plugins.entries()) {
|
|
79
|
+
if (pluginIds.has(plugin.pluginId)) {
|
|
80
|
+
return semanticError(`/plugins/${pluginIndex}/pluginId`, '#/$defs/CatalogPluginEntry/uniquePluginIds', 'uniquePluginIds', 'pluginId must be declared at most once per catalog');
|
|
81
|
+
}
|
|
82
|
+
if (priorPluginId !== undefined && compareAscii(priorPluginId, plugin.pluginId) >= 0) {
|
|
83
|
+
return semanticError(`/plugins/${pluginIndex}/pluginId`, '#/properties/plugins/deterministicOrder', 'deterministicOrder', 'catalog plugins must be sorted by pluginId');
|
|
84
|
+
}
|
|
85
|
+
pluginIds.add(plugin.pluginId);
|
|
86
|
+
priorPluginId = plugin.pluginId;
|
|
87
|
+
let priorKeyword;
|
|
88
|
+
for (const [keywordIndex, keyword] of (plugin.keywords ?? []).entries()) {
|
|
89
|
+
if (priorKeyword !== undefined && compareAscii(priorKeyword, keyword) >= 0) {
|
|
90
|
+
return semanticError(`/plugins/${pluginIndex}/keywords/${keywordIndex}`, '#/$defs/CatalogPluginEntry/deterministicKeywordOrder', 'deterministicKeywordOrder', 'catalog keywords must be unique and sorted by ASCII code point');
|
|
91
|
+
}
|
|
92
|
+
priorKeyword = keyword;
|
|
93
|
+
}
|
|
94
|
+
const versions = new Set();
|
|
95
|
+
let priorVersion;
|
|
96
|
+
for (const [versionIndex, version] of plugin.versions.entries()) {
|
|
97
|
+
if (versions.has(version.version)) {
|
|
98
|
+
return semanticError(`/plugins/${pluginIndex}/versions/${versionIndex}/version`, '#/$defs/CatalogPluginVersion/uniqueVersions', 'uniqueVersions', 'version must be declared at most once per plugin');
|
|
99
|
+
}
|
|
100
|
+
if (version.artifact.version !== version.version) {
|
|
101
|
+
return semanticError(`/plugins/${pluginIndex}/versions/${versionIndex}/artifact/version`, '#/$defs/CatalogPluginVersion/artifactVersionMatches', 'artifactVersionMatches', 'artifact version must exactly match the catalog version');
|
|
102
|
+
}
|
|
103
|
+
const unscopedPackageName = version.artifact.packageName.slice(version.artifact.packageName.indexOf('/') + 1);
|
|
104
|
+
const expectedTarballUrl = `https://registry.npmjs.org/${version.artifact.packageName}/-/` +
|
|
105
|
+
`${unscopedPackageName}-${version.version}.tgz`;
|
|
106
|
+
if (version.artifact.tarballUrl !== expectedTarballUrl) {
|
|
107
|
+
return semanticError(`/plugins/${pluginIndex}/versions/${versionIndex}/artifact/tarballUrl`, '#/$defs/NpmArtifact/packageVersionTarball', 'packageVersionTarball', 'npm tarball URL must exactly match the declared package name and version');
|
|
108
|
+
}
|
|
109
|
+
if (priorVersion !== undefined && compareSemVer(priorVersion, version.version) <= 0) {
|
|
110
|
+
return semanticError(`/plugins/${pluginIndex}/versions/${versionIndex}/version`, '#/$defs/CatalogPluginVersion/descendingOrder', 'descendingOrder', 'catalog versions must be in descending semantic-version order');
|
|
111
|
+
}
|
|
112
|
+
versions.add(version.version);
|
|
113
|
+
priorVersion = version.version;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return { valid: true, catalog, errors: [] };
|
|
117
|
+
}
|
|
118
|
+
export function listCatalogPlugins(catalog) {
|
|
119
|
+
return catalog.plugins;
|
|
120
|
+
}
|
|
121
|
+
export function searchCatalogPlugins(catalog, query) {
|
|
122
|
+
const normalized = query.trim().toLocaleLowerCase('en-US');
|
|
123
|
+
if (normalized === '')
|
|
124
|
+
return catalog.plugins;
|
|
125
|
+
return catalog.plugins.filter((plugin) => {
|
|
126
|
+
const descriptions = typeof plugin.description === 'string'
|
|
127
|
+
? [plugin.description]
|
|
128
|
+
: [plugin.description.default, ...Object.values(plugin.description.translations)];
|
|
129
|
+
return [plugin.pluginId, plugin.name, ...descriptions, ...(plugin.keywords ?? [])].some((field) => field.toLocaleLowerCase('en-US').includes(normalized));
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function getCatalogPlugin(catalog, pluginId, version) {
|
|
133
|
+
const plugin = catalog.plugins.find((entry) => entry.pluginId === pluginId);
|
|
134
|
+
if (plugin === undefined)
|
|
135
|
+
return undefined;
|
|
136
|
+
return version === undefined
|
|
137
|
+
? plugin.versions[0]
|
|
138
|
+
: plugin.versions.find((entry) => entry.version === version);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/validation/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQ5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,OAAO,GACX,OAAO,CAAC,eAAe,CAAC,CAAC;AAC3B,MAAM,UAAU,GAA+B,OAAO,CAAC,aAAa,CAAC,CAAC;AACtE,MAAM,oBAAoB,GAAG,OAAO,CAClC,qDAAqD,CAC3B,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,6CAA6C,CAA4B,CAAC;AA8BxG,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5D,UAAU,CAAC,GAAG,CAAC,CAAC;AAChB,GAAG,CAAC,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,KAAK,CAAW,CAAC,CAAC;AAC3E,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAElD,SAAS,aAAa,CACpB,YAAoB,EACpB,UAAkB,EAClB,OAAe,EACf,OAAe;IAEf,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACpF,CAAC;AAOD,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,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AC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { validateMessagingSemantics, type SemanticValidationError, type SemanticValidationResult, } from './messaging-semantic.js';
|
|
2
2
|
export { MESSAGING_ROW_METHODS, validateMessagingRowInput, validateMessagingRowResult, type MessagingRowInputByMethod, type MessagingRowMethod, type MessagingRowResultByMethod, type MessagingRowValidationError, type MessagingRowValidationResult, } from './messaging-wire.js';
|
|
3
3
|
export { validateManifest, type ManifestValidationError, type ManifestValidationResult, } from './manifest.js';
|
|
4
|
+
export { getCatalogPlugin, listCatalogPlugins, searchCatalogPlugins, validatePluginCatalog, type CatalogValidationError, type CatalogValidationResult, } from './catalog.js';
|
|
4
5
|
export { SIGNAL_PAYLOAD_MAX_ENCODED_BYTES, validateDeclaredEventsPublishInput, validateEventsPublishInput, validateEventsPublishResult, validateSignalDeclaration, type SignalSchemaCatalog, type SignalValidationError, type SignalValidationResult, } from './signals.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,cAAc,CAAC"}
|
package/dist/validation/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { validateMessagingSemantics, } from './messaging-semantic.js';
|
|
2
2
|
export { MESSAGING_ROW_METHODS, validateMessagingRowInput, validateMessagingRowResult, } from './messaging-wire.js';
|
|
3
3
|
export { validateManifest, } from './manifest.js';
|
|
4
|
+
export { getCatalogPlugin, listCatalogPlugins, searchCatalogPlugins, validatePluginCatalog, } from './catalog.js';
|
|
4
5
|
export { SIGNAL_PAYLOAD_MAX_ENCODED_BYTES, validateDeclaredEventsPublishInput, validateEventsPublishInput, validateEventsPublishResult, validateSignalDeclaration, } from './signals.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAG3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,GAM3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,GAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,GAI1B,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAG3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,GAM3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,GAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,GAGtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,GAI1B,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/validation/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/validation/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAqCzE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,wBAAwB,GAChC;IACE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACrD,CAAC;AAoBN;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAwNzE"}
|
|
@@ -2,12 +2,20 @@ import { createRequire } from 'node:module';
|
|
|
2
2
|
const require = createRequire(import.meta.url);
|
|
3
3
|
const Ajv2020 = require('ajv/dist/2020');
|
|
4
4
|
const addFormats = require('ajv-formats');
|
|
5
|
+
const pluginMetadataSchema = require('@clowder-ai/plugin-contract/schemas/plugin-metadata');
|
|
5
6
|
const manifestSchema = require('@clowder-ai/plugin-contract/schemas/manifest');
|
|
6
7
|
const signalSchema = require('@clowder-ai/plugin-contract/schemas/signals');
|
|
7
8
|
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
8
9
|
addFormats(ajv);
|
|
10
|
+
ajv.addSchema(pluginMetadataSchema, pluginMetadataSchema['$id']);
|
|
9
11
|
ajv.addSchema(signalSchema, signalSchema['$id']);
|
|
10
12
|
const validateSchema = ajv.compile(manifestSchema);
|
|
13
|
+
function semanticError(instancePath, schemaPath, keyword, message) {
|
|
14
|
+
return {
|
|
15
|
+
valid: false,
|
|
16
|
+
errors: [{ instancePath, schemaPath, keyword, message }],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
11
19
|
/**
|
|
12
20
|
* Validates an untrusted plugin manifest against the contract-owned schema.
|
|
13
21
|
*
|
|
@@ -34,6 +42,102 @@ export function validateManifest(value) {
|
|
|
34
42
|
}
|
|
35
43
|
declaredTypes.add(declaration.type);
|
|
36
44
|
}
|
|
45
|
+
const featureIds = new Set();
|
|
46
|
+
for (const [index, feature] of manifest.features.entries()) {
|
|
47
|
+
if (featureIds.has(feature.id)) {
|
|
48
|
+
return semanticError(`/features/${index}/id`, '#/$defs/PluginFeature/uniqueFeatureIds', 'uniqueFeatureIds', 'feature id must be declared at most once per manifest');
|
|
49
|
+
}
|
|
50
|
+
featureIds.add(feature.id);
|
|
51
|
+
}
|
|
52
|
+
const configuration = manifest.configuration ?? [];
|
|
53
|
+
const configByKey = new Map();
|
|
54
|
+
for (const [index, field] of configuration.entries()) {
|
|
55
|
+
if (configByKey.has(field.key)) {
|
|
56
|
+
return semanticError(`/configuration/${index}/key`, '#/$defs/ConfigurationField/uniqueConfigurationKeys', 'uniqueConfigurationKeys', 'configuration key must be declared at most once per manifest');
|
|
57
|
+
}
|
|
58
|
+
configByKey.set(field.key, field);
|
|
59
|
+
if (field.kind === 'select') {
|
|
60
|
+
const optionValues = new Set();
|
|
61
|
+
for (const [optionIndex, option] of (field.options ?? []).entries()) {
|
|
62
|
+
if (optionValues.has(option.value)) {
|
|
63
|
+
return semanticError(`/configuration/${index}/options/${optionIndex}/value`, '#/$defs/ConfigurationOption/uniqueOptionValues', 'uniqueOptionValues', 'select option values must be unique within one configuration field');
|
|
64
|
+
}
|
|
65
|
+
optionValues.add(option.value);
|
|
66
|
+
}
|
|
67
|
+
if (field.default !== undefined && !optionValues.has(field.default)) {
|
|
68
|
+
return semanticError(`/configuration/${index}/default`, '#/$defs/ConfigurationField/defaultDeclaredBySelect', 'defaultDeclaredBySelect', 'select default must equal one of the declared option values');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const contributions = manifest.contributions ?? [];
|
|
73
|
+
const contributionByKey = new Map();
|
|
74
|
+
for (const [index, contribution] of contributions.entries()) {
|
|
75
|
+
const key = `${contribution.type}\0${contribution.id}`;
|
|
76
|
+
if (contributionByKey.has(key)) {
|
|
77
|
+
return semanticError(`/contributions/${index}/id`, '#/$defs/StaticContribution/uniqueContributionKeys', 'uniqueContributionKeys', 'contribution type/id must be declared at most once per manifest');
|
|
78
|
+
}
|
|
79
|
+
contributionByKey.set(key, contribution);
|
|
80
|
+
if ('environment' in contribution && contribution.environment !== undefined) {
|
|
81
|
+
for (const [environmentName, binding] of Object.entries(contribution.environment)) {
|
|
82
|
+
const field = configByKey.get(binding.key);
|
|
83
|
+
if (field === undefined) {
|
|
84
|
+
return semanticError(`/contributions/${index}/environment/${environmentName}/key`, '#/$defs/EnvironmentBinding/declaredConfigurationKey', 'declaredConfigurationKey', 'environment binding must reference a declared configuration key');
|
|
85
|
+
}
|
|
86
|
+
if ((binding.source === 'secret' && field.kind !== 'secret') ||
|
|
87
|
+
(binding.source === 'config' && field.kind === 'secret')) {
|
|
88
|
+
return semanticError(`/contributions/${index}/environment/${environmentName}/source`, '#/$defs/EnvironmentBinding/sourceMatchesConfigurationKind', 'sourceMatchesConfigurationKind', 'secret bindings must reference secret fields and config bindings must not');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (contribution.type === 'webhook' && contribution.verificationSecretRef !== undefined) {
|
|
93
|
+
const secret = configByKey.get(contribution.verificationSecretRef);
|
|
94
|
+
if (secret?.kind !== 'secret') {
|
|
95
|
+
return semanticError(`/contributions/${index}/verificationSecretRef`, '#/$defs/WebhookContribution/declaredSecretReference', 'declaredSecretReference', 'webhook verificationSecretRef must reference a declared secret field');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const referenceOwners = new Map();
|
|
100
|
+
for (const [featureIndex, feature] of manifest.features.entries()) {
|
|
101
|
+
for (const [contributionIndex, reference] of (feature.contributions ?? []).entries()) {
|
|
102
|
+
const key = `${reference.type}\0${reference.id}`;
|
|
103
|
+
if (!contributionByKey.has(key)) {
|
|
104
|
+
return semanticError(`/features/${featureIndex}/contributions/${contributionIndex}`, '#/$defs/ContributionReference/declaredContribution', 'declaredContribution', 'feature contribution must reference a declared contribution with the same type and id');
|
|
105
|
+
}
|
|
106
|
+
const existingOwner = referenceOwners.get(key);
|
|
107
|
+
if (existingOwner !== undefined) {
|
|
108
|
+
return semanticError(`/features/${featureIndex}/contributions/${contributionIndex}`, '#/$defs/ContributionReference/singleFeatureOwner', 'singleFeatureOwner', `a static contribution must have exactly one feature reference; already owned by ${existingOwner}`);
|
|
109
|
+
}
|
|
110
|
+
referenceOwners.set(key, feature.id);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const [key, contribution] of contributionByKey) {
|
|
114
|
+
if (!referenceOwners.has(key)) {
|
|
115
|
+
const index = contributions.indexOf(contribution);
|
|
116
|
+
return semanticError(`/contributions/${index}`, '#/$defs/StaticContribution/featureOwnerRequired', 'featureOwnerRequired', 'every static contribution must be owned by one feature resource reference');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (const [index, contribution] of contributions.entries()) {
|
|
120
|
+
const owner = referenceOwners.get(`${contribution.type}\0${contribution.id}`);
|
|
121
|
+
if (contribution.type === 'connector') {
|
|
122
|
+
const identityKey = `identity\0${contribution.identityRef}`;
|
|
123
|
+
if (!contributionByKey.has(identityKey)) {
|
|
124
|
+
return semanticError(`/contributions/${index}/identityRef`, '#/$defs/ConnectorContribution/declaredIdentityReference', 'declaredIdentityReference', 'connector identityRef must reference a declared identity contribution');
|
|
125
|
+
}
|
|
126
|
+
if (referenceOwners.get(identityKey) !== owner) {
|
|
127
|
+
return semanticError(`/contributions/${index}/identityRef`, '#/$defs/ConnectorContribution/sameFeatureOwner', 'sameFeatureOwner', 'connector identityRef must reference an identity owned by the same feature');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (contribution.type === 'ui' && contribution.kind === 'slot-item') {
|
|
131
|
+
const commandKey = `ui\0${contribution.command}`;
|
|
132
|
+
const command = contributionByKey.get(commandKey);
|
|
133
|
+
if (command?.type !== 'ui' || command.kind !== 'command') {
|
|
134
|
+
return semanticError(`/contributions/${index}/command`, '#/$defs/UiSlotItemContribution/declaredCommandReference', 'declaredCommandReference', 'UI slot command must reference a declared UI command contribution');
|
|
135
|
+
}
|
|
136
|
+
if (referenceOwners.get(commandKey) !== owner) {
|
|
137
|
+
return semanticError(`/contributions/${index}/command`, '#/$defs/UiSlotItemContribution/sameFeatureOwner', 'sameFeatureOwner', 'UI slot command must reference a command owned by the same feature');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
37
141
|
return {
|
|
38
142
|
valid: true,
|
|
39
143
|
manifest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/validation/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,OAAO,GAGO,OAAO,CAAC,eAAe,CAAC,CAAC;AAC7C,MAAM,UAAU,GAA+B,OAAO,CAAC,aAAa,CAAC,CAAC;AACtE,MAAM,cAAc,GAAG,OAAO,CAAC,8CAA8C,CAG5E,CAAC;AACF,MAAM,YAAY,GAAG,OAAO,CAAC,6CAA6C,CAGzE,CAAC;AAqCF,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5D,UAAU,CAAC,GAAG,CAAC,CAAC;AAChB,GAAG,CAAC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAW,CAAC,CAAC;AAC3D,MAAM,cAAc,G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,EACzD,0BAA0B,EAC1B,mEAAmE,CACpE,CAAC;gBACJ,CAAC;gBACD,IAAI,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,CAAC;oBAC9C,OAAO,aAAa,CAClB,kBAAkB,KAAK,UAAU,EACjC,iDAAiD,EACjD,kBAAkB,EAClB,oEAAoE,CACrE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,KAAK,EAAE,IAAI;YACX,QAAQ;YACR,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,CAAC,cAAc,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACpD,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,4BAA4B;SACvD,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
package/dist/wire/grants.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import type { Capability } from '../generated/contract.generated.js';
|
|
15
15
|
/**
|
|
16
16
|
* Maximum number of items in effectiveGrants.
|
|
17
|
-
* Derived from the 17-value Capability enum — a plugin cannot hold
|
|
17
|
+
* Derived from the signed 17-value M0 Capability enum — a plugin cannot hold
|
|
18
18
|
* more capabilities than exist.
|
|
19
19
|
*/
|
|
20
20
|
export declare const MAX_GRANT_ITEMS: 17;
|
package/dist/wire/grants.js
CHANGED
|
@@ -17,7 +17,7 @@ import { L0_CAPABILITIES, L1_CAPABILITIES, L2_CAPABILITIES, } from '../generated
|
|
|
17
17
|
// ---------------------------------------------------------------------------
|
|
18
18
|
/**
|
|
19
19
|
* Maximum number of items in effectiveGrants.
|
|
20
|
-
* Derived from the 17-value Capability enum — a plugin cannot hold
|
|
20
|
+
* Derived from the signed 17-value M0 Capability enum — a plugin cannot hold
|
|
21
21
|
* more capabilities than exist.
|
|
22
22
|
*/
|
|
23
23
|
export const MAX_GRANT_ITEMS = 17;
|
|
@@ -66,14 +66,14 @@ export declare function eventsPublishStandardErrorEnvelopes(): ({
|
|
|
66
66
|
arm: string;
|
|
67
67
|
id: null;
|
|
68
68
|
error: {
|
|
69
|
-
code: -
|
|
69
|
+
code: -32602 | -32700 | -32600 | -32601 | -32603;
|
|
70
70
|
message: "Parse error" | "Invalid Request" | "Method not found" | "Invalid params" | "Internal error";
|
|
71
71
|
};
|
|
72
72
|
} | {
|
|
73
73
|
arm: string;
|
|
74
74
|
id: string;
|
|
75
75
|
error: {
|
|
76
|
-
code: -
|
|
76
|
+
code: -32602 | -32700 | -32600 | -32601 | -32603;
|
|
77
77
|
message: "Parse error" | "Invalid Request" | "Method not found" | "Invalid params" | "Internal error";
|
|
78
78
|
};
|
|
79
79
|
})[];
|
|
@@ -81,7 +81,7 @@ export declare function eventsPublishStandardErrorNPlusOneWitnesses(): {
|
|
|
81
81
|
id: string;
|
|
82
82
|
arm: string;
|
|
83
83
|
error: {
|
|
84
|
-
code: -
|
|
84
|
+
code: -32602 | -32700 | -32600 | -32601 | -32603;
|
|
85
85
|
message: "Parse error" | "Invalid Request" | "Method not found" | "Invalid params" | "Internal error";
|
|
86
86
|
};
|
|
87
87
|
}[];
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
{
|
|
11
11
|
"id": "raw-thread-id-rejection",
|
|
12
12
|
"invariant": "Plugins cannot address threads by raw threadId.",
|
|
13
|
+
"execution": {
|
|
14
|
+
"plane": "wire-admission",
|
|
15
|
+
"method": "messaging.send",
|
|
16
|
+
"verdictOracle": { "kind": "json-rpc-error", "code": -32602, "sideEffects": "behavior-expectation" }
|
|
17
|
+
},
|
|
13
18
|
"given": {
|
|
14
19
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
15
20
|
"grants": ["messaging.send"],
|
|
@@ -40,6 +45,11 @@
|
|
|
40
45
|
{
|
|
41
46
|
"id": "system-audience-dual-rejection",
|
|
42
47
|
"invariant": "Drafts cannot express the host-only system audience.",
|
|
48
|
+
"execution": {
|
|
49
|
+
"plane": "wire-admission",
|
|
50
|
+
"method": "messaging.send",
|
|
51
|
+
"verdictOracle": { "kind": "json-rpc-error", "code": -32602, "sideEffects": "behavior-expectation" }
|
|
52
|
+
},
|
|
43
53
|
"given": {
|
|
44
54
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
45
55
|
"grants": ["messaging.send"],
|
|
@@ -73,6 +83,11 @@
|
|
|
73
83
|
{
|
|
74
84
|
"id": "cross-instance-handle-rejection",
|
|
75
85
|
"invariant": "A message handle issued to one plugin instance cannot authorize another.",
|
|
86
|
+
"execution": {
|
|
87
|
+
"plane": "plugin-to-host-wire",
|
|
88
|
+
"method": "messaging.appendElements",
|
|
89
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
90
|
+
},
|
|
76
91
|
"given": {
|
|
77
92
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
78
93
|
"grants": ["messaging.appendElements"],
|
|
@@ -103,6 +118,11 @@
|
|
|
103
118
|
{
|
|
104
119
|
"id": "origin-forgery-rejection",
|
|
105
120
|
"invariant": "A thread-handle send may only declare the caller's own plugin origin.",
|
|
121
|
+
"execution": {
|
|
122
|
+
"plane": "plugin-to-host-wire",
|
|
123
|
+
"method": "messaging.send",
|
|
124
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
125
|
+
},
|
|
106
126
|
"given": {
|
|
107
127
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
108
128
|
"grants": ["messaging.send"],
|
|
@@ -135,6 +155,11 @@
|
|
|
135
155
|
{
|
|
136
156
|
"id": "base-revision-conflict-zero-change",
|
|
137
157
|
"invariant": "A stale baseRevision produces CONFLICT and no mutation.",
|
|
158
|
+
"execution": {
|
|
159
|
+
"plane": "plugin-to-host-wire",
|
|
160
|
+
"method": "messaging.appendElements",
|
|
161
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
162
|
+
},
|
|
138
163
|
"given": {
|
|
139
164
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
140
165
|
"grants": ["messaging.appendElements"],
|
|
@@ -165,6 +190,11 @@
|
|
|
165
190
|
{
|
|
166
191
|
"id": "stale-cursor-snapshot-roundtrip",
|
|
167
192
|
"invariant": "A stale cursor reports stale and snapshot catch-up supplies an exact resume point.",
|
|
193
|
+
"execution": {
|
|
194
|
+
"plane": "plugin-to-host-wire",
|
|
195
|
+
"method": "messaging.read",
|
|
196
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
197
|
+
},
|
|
168
198
|
"given": {
|
|
169
199
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
170
200
|
"grants": ["message.event.subscribe"],
|
|
@@ -189,6 +219,11 @@
|
|
|
189
219
|
{
|
|
190
220
|
"id": "cross-subscription-ack-rejection",
|
|
191
221
|
"invariant": "Ack tokens are subscription-local and cannot cross subscriptions.",
|
|
222
|
+
"execution": {
|
|
223
|
+
"plane": "plugin-to-host-wire",
|
|
224
|
+
"method": "messaging.ack",
|
|
225
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
226
|
+
},
|
|
192
227
|
"given": {
|
|
193
228
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
194
229
|
"grants": ["message.event.subscribe"],
|
|
@@ -214,6 +249,11 @@
|
|
|
214
249
|
{
|
|
215
250
|
"id": "reply-to-cross-thread-leakage",
|
|
216
251
|
"invariant": "replyTo cannot reference a message from another thread.",
|
|
252
|
+
"execution": {
|
|
253
|
+
"plane": "plugin-to-host-wire",
|
|
254
|
+
"method": "messaging.send",
|
|
255
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
256
|
+
},
|
|
217
257
|
"given": {
|
|
218
258
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
219
259
|
"grants": ["messaging.send"],
|
|
@@ -247,6 +287,11 @@
|
|
|
247
287
|
{
|
|
248
288
|
"id": "epistemic-status-upgrade-rejection",
|
|
249
289
|
"invariant": "Derived content cannot claim a stronger epistemic status than its source.",
|
|
290
|
+
"execution": {
|
|
291
|
+
"plane": "plugin-to-host-wire",
|
|
292
|
+
"method": "messaging.appendElements",
|
|
293
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
294
|
+
},
|
|
250
295
|
"given": {
|
|
251
296
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
252
297
|
"grants": ["messaging.appendElements"],
|
|
@@ -277,6 +322,10 @@
|
|
|
277
322
|
{
|
|
278
323
|
"id": "preset-l2-rejected",
|
|
279
324
|
"invariant": "First-party presets are derived from L1 and cannot silently grant L2 capabilities.",
|
|
325
|
+
"execution": {
|
|
326
|
+
"plane": "host-control",
|
|
327
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
328
|
+
},
|
|
280
329
|
"given": {
|
|
281
330
|
"caller": { "pluginInstanceId": "first-party-plugin" },
|
|
282
331
|
"grants": ["messaging.send"],
|
|
@@ -298,6 +347,10 @@
|
|
|
298
347
|
{
|
|
299
348
|
"id": "preset-visible-revocable",
|
|
300
349
|
"invariant": "A first-party L1 preset remains visible and independently revocable.",
|
|
350
|
+
"execution": {
|
|
351
|
+
"plane": "host-control",
|
|
352
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
353
|
+
},
|
|
301
354
|
"given": {
|
|
302
355
|
"caller": { "pluginInstanceId": "first-party-plugin" },
|
|
303
356
|
"grants": ["messaging.send"],
|
|
@@ -318,6 +371,11 @@
|
|
|
318
371
|
{
|
|
319
372
|
"id": "whisper-target-beyond-default-empty-grant-rejected",
|
|
320
373
|
"invariant": "The default whisper target grant is empty; messaging.send alone cannot add a target.",
|
|
374
|
+
"execution": {
|
|
375
|
+
"plane": "plugin-to-host-wire",
|
|
376
|
+
"method": "messaging.send",
|
|
377
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
378
|
+
},
|
|
321
379
|
"given": {
|
|
322
380
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
323
381
|
"grants": ["messaging.send"],
|
|
@@ -351,6 +409,11 @@
|
|
|
351
409
|
{
|
|
352
410
|
"id": "append-without-grant-rejected",
|
|
353
411
|
"invariant": "A valid message handle does not bypass the messaging.appendElements grant.",
|
|
412
|
+
"execution": {
|
|
413
|
+
"plane": "plugin-to-host-wire",
|
|
414
|
+
"method": "messaging.appendElements",
|
|
415
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
416
|
+
},
|
|
354
417
|
"given": {
|
|
355
418
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
356
419
|
"grants": [],
|
|
@@ -381,6 +444,11 @@
|
|
|
381
444
|
{
|
|
382
445
|
"id": "denied-on-message-rejected",
|
|
383
446
|
"invariant": "The Host cannot deliver an onMessage envelope without an explicit scoped L2 grant.",
|
|
447
|
+
"execution": {
|
|
448
|
+
"plane": "host-to-plugin-delivery",
|
|
449
|
+
"method": "host.messaging.deliver",
|
|
450
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
451
|
+
},
|
|
384
452
|
"given": {
|
|
385
453
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
386
454
|
"grants": [],
|
|
@@ -408,6 +476,10 @@
|
|
|
408
476
|
{
|
|
409
477
|
"id": "permission-matrix-complete",
|
|
410
478
|
"invariant": "The loopback policy matrix covers every signed capability and presets only L1 for first-party plugins.",
|
|
479
|
+
"execution": {
|
|
480
|
+
"plane": "host-control",
|
|
481
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
482
|
+
},
|
|
411
483
|
"given": {
|
|
412
484
|
"caller": { "pluginInstanceId": "policy-auditor" },
|
|
413
485
|
"grants": [],
|
|
@@ -448,6 +520,10 @@
|
|
|
448
520
|
{
|
|
449
521
|
"id": "delete-replay-events-preserves-canonical-messages",
|
|
450
522
|
"invariant": "Deleting the replay transport buffer cannot delete canonical messages or threads.",
|
|
523
|
+
"execution": {
|
|
524
|
+
"plane": "host-control",
|
|
525
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
526
|
+
},
|
|
451
527
|
"given": {
|
|
452
528
|
"caller": { "pluginInstanceId": "host-retention" },
|
|
453
529
|
"grants": ["message.event.subscribe"],
|
|
@@ -474,6 +550,11 @@
|
|
|
474
550
|
{
|
|
475
551
|
"id": "snapshot-without-grant-rejected",
|
|
476
552
|
"invariant": "A subscription identifier cannot bypass the message.event.subscribe grant for snapshots.",
|
|
553
|
+
"execution": {
|
|
554
|
+
"plane": "wire-admission",
|
|
555
|
+
"method": "messaging.snapshot",
|
|
556
|
+
"verdictOracle": { "kind": "json-rpc-error", "code": -32602, "sideEffects": "behavior-expectation" }
|
|
557
|
+
},
|
|
477
558
|
"given": {
|
|
478
559
|
"caller": { "pluginInstanceId": "plugin-a" },
|
|
479
560
|
"grants": [],
|
|
@@ -498,6 +579,10 @@
|
|
|
498
579
|
{
|
|
499
580
|
"id": "foreign-replay-delete-rejected",
|
|
500
581
|
"invariant": "A caller cannot delete another plugin instance's subscription replay buffer.",
|
|
582
|
+
"execution": {
|
|
583
|
+
"plane": "host-control",
|
|
584
|
+
"verdictOracle": { "kind": "behavior-expectation" }
|
|
585
|
+
},
|
|
501
586
|
"given": {
|
|
502
587
|
"caller": { "pluginInstanceId": "plugin-b" },
|
|
503
588
|
"grants": ["message.event.subscribe"],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginId": "com.example.icon-escape",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"contractVersion": "0.1.0-beta.13",
|
|
5
|
+
"name": "Icon escape fixture",
|
|
6
|
+
"description": "Legacy description remains accepted.",
|
|
7
|
+
"icon": {
|
|
8
|
+
"type": "svg",
|
|
9
|
+
"src": "../outside.svg"
|
|
10
|
+
},
|
|
11
|
+
"features": [
|
|
12
|
+
{
|
|
13
|
+
"id": "main",
|
|
14
|
+
"name": "Main",
|
|
15
|
+
"resources": [],
|
|
16
|
+
"capabilities": []
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"runtime": {
|
|
20
|
+
"transport": "builtin"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginId": "com.example.localized-metadata",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"contractVersion": "0.1.0-beta.13",
|
|
5
|
+
"name": "Localized metadata fixture",
|
|
6
|
+
"description": {
|
|
7
|
+
"default": "Describe this plugin for agents and people.",
|
|
8
|
+
"translations": {
|
|
9
|
+
"zh-CN": "向 Agent 和用户介绍这个插件。"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"icon": {
|
|
13
|
+
"type": "svg",
|
|
14
|
+
"src": "assets/icon.svg"
|
|
15
|
+
},
|
|
16
|
+
"features": [
|
|
17
|
+
{
|
|
18
|
+
"id": "main",
|
|
19
|
+
"name": "Main",
|
|
20
|
+
"resources": [],
|
|
21
|
+
"capabilities": []
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"runtime": {
|
|
25
|
+
"transport": "builtin"
|
|
26
|
+
}
|
|
27
|
+
}
|