@lesliechan721/aw-plugin-core 0.1.0-beta.7 → 0.1.0-beta.9
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/aw-capabilities.d.ts +27 -0
- package/dist/aw-capabilities.js +106 -0
- package/dist/aw-capabilities.js.map +1 -0
- package/dist/catalog-workspace-resolution.d.ts +3 -0
- package/dist/catalog-workspace-resolution.js +34 -0
- package/dist/catalog-workspace-resolution.js.map +1 -0
- package/dist/generated/{plugin-manifest-v1.d.ts → plugin-manifest-v2.d.ts} +44 -31
- package/dist/generated/{plugin-manifest-v1.js → plugin-manifest-v2.js} +1 -1
- package/dist/generated/plugin-manifest-v2.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest-contract.d.ts +3 -6
- package/dist/manifest-contract.js +54 -63
- package/dist/manifest-contract.js.map +1 -1
- package/dist/manifest-type-contract.d.ts +2 -2
- package/dist/manifest.d.ts +8 -8
- package/dist/manifest.js +9 -7
- package/dist/manifest.js.map +1 -1
- package/dist/plugin-authoring-capabilities.js +4 -3
- package/dist/plugin-authoring-capabilities.js.map +1 -1
- package/dist/plugin-requirements.d.ts +34 -0
- package/dist/plugin-requirements.js +248 -0
- package/dist/plugin-requirements.js.map +1 -0
- package/dist/plugin-script-contract.d.ts +8 -0
- package/dist/plugin-script-contract.js +38 -1
- package/dist/plugin-script-contract.js.map +1 -1
- package/dist/types.d.ts +25 -22
- package/dist/workspace.d.ts +17 -9
- package/dist/workspace.js +299 -138
- package/dist/workspace.js.map +1 -1
- package/package.json +2 -2
- package/schemas/{plugin-manifest-v1.json → plugin-manifest-v2.json} +41 -11
- package/dist/generated/plugin-manifest-v1.js.map +0 -1
- package/dist/plugin-release.d.ts +0 -30
- package/dist/plugin-release.js +0 -187
- package/dist/plugin-release.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const AW_CAPABILITY_IDS: readonly ["aw.plugin-manifest.v2", "aw.plugin-skills.v1", "aw.plugin-build-config.v1", "aw.plugin-config.v1", "aw.plugin-lifecycle.v1", "aw.dynamic-artifacts.v2", "aw.portable-skills.v1", "aw.runtime-imports.v1", "aw.skill-validation.v1", "aw.skill-eval.v2", "aw.plugin-authoring.v1", "aw.catalog-authoring.v1", "aw.catalog-source.v2", "aw.catalog-dev-source.v1", "aw.catalog-publication.v1", "aw.review-publication.v1", "aw.catalog-snapshot.v6", "aw.self-check.v1"];
|
|
2
|
+
export type RegisteredAwCapabilityId = typeof AW_CAPABILITY_IDS[number];
|
|
3
|
+
export type AwCapabilityId = string;
|
|
4
|
+
export interface AwCapabilitySupport {
|
|
5
|
+
supported: boolean;
|
|
6
|
+
missing: AwCapabilityId[];
|
|
7
|
+
}
|
|
8
|
+
export declare function assertAwCapabilityId(value: unknown, fieldName?: string): asserts value is AwCapabilityId;
|
|
9
|
+
export declare function normalizeAwCapabilities(values: readonly unknown[], fieldName?: string): AwCapabilityId[];
|
|
10
|
+
export declare function getAwCapabilityRegistry(): readonly RegisteredAwCapabilityId[];
|
|
11
|
+
export declare function computeAwCapabilitySetDigest(values: readonly unknown[]): string;
|
|
12
|
+
export declare function checkAwCapabilitySupport(required: readonly unknown[], implemented: readonly unknown[]): AwCapabilitySupport;
|
|
13
|
+
export interface AwPluginRequirementsReceiptV1 {
|
|
14
|
+
schemaVersion: 1;
|
|
15
|
+
kind: 'aw-plugin-requirements';
|
|
16
|
+
plugin: {
|
|
17
|
+
name: string;
|
|
18
|
+
version: string;
|
|
19
|
+
};
|
|
20
|
+
requiredCapabilities: AwCapabilityId[];
|
|
21
|
+
digest: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function createAwPluginRequirementsReceipt(plugin: {
|
|
24
|
+
name: string;
|
|
25
|
+
version: string;
|
|
26
|
+
}, requiredCapabilities: readonly unknown[]): AwPluginRequirementsReceiptV1;
|
|
27
|
+
export declare function parseAwPluginRequirementsReceipt(value: unknown): AwPluginRequirementsReceiptV1;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
export const AW_CAPABILITY_IDS = [
|
|
3
|
+
'aw.plugin-manifest.v2',
|
|
4
|
+
'aw.plugin-skills.v1',
|
|
5
|
+
'aw.plugin-build-config.v1',
|
|
6
|
+
'aw.plugin-config.v1',
|
|
7
|
+
'aw.plugin-lifecycle.v1',
|
|
8
|
+
'aw.dynamic-artifacts.v2',
|
|
9
|
+
'aw.portable-skills.v1',
|
|
10
|
+
'aw.runtime-imports.v1',
|
|
11
|
+
'aw.skill-validation.v1',
|
|
12
|
+
'aw.skill-eval.v2',
|
|
13
|
+
'aw.plugin-authoring.v1',
|
|
14
|
+
'aw.catalog-authoring.v1',
|
|
15
|
+
'aw.catalog-source.v2',
|
|
16
|
+
'aw.catalog-dev-source.v1',
|
|
17
|
+
'aw.catalog-publication.v1',
|
|
18
|
+
'aw.review-publication.v1',
|
|
19
|
+
'aw.catalog-snapshot.v6',
|
|
20
|
+
'aw.self-check.v1',
|
|
21
|
+
];
|
|
22
|
+
const CAPABILITY_ID_PATTERN = /^aw\.[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)*\.v[1-9][0-9]*$/u;
|
|
23
|
+
const CAPABILITY_SET_DIGEST_DOMAIN = 'aw-capability-set-v1\0';
|
|
24
|
+
const PLUGIN_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
25
|
+
const STRICT_SEMVER_PATTERN = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|(?:[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))(?:\.(?:0|[1-9][0-9]*|(?:[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/u;
|
|
26
|
+
export function assertAwCapabilityId(value, fieldName = 'capability') {
|
|
27
|
+
if (typeof value !== 'string' || !CAPABILITY_ID_PATTERN.test(value)) {
|
|
28
|
+
throw new Error(`Invalid ${fieldName}: expected an AW capability ID.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function normalizeAwCapabilities(values, fieldName = 'capabilities') {
|
|
32
|
+
const normalized = new Set();
|
|
33
|
+
values.forEach((value, index) => {
|
|
34
|
+
assertAwCapabilityId(value, `${fieldName}[${index}]`);
|
|
35
|
+
normalized.add(value);
|
|
36
|
+
});
|
|
37
|
+
return [...normalized].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
38
|
+
}
|
|
39
|
+
export function getAwCapabilityRegistry() {
|
|
40
|
+
const normalized = normalizeAwCapabilities(AW_CAPABILITY_IDS);
|
|
41
|
+
if (normalized.length !== AW_CAPABILITY_IDS.length) {
|
|
42
|
+
throw new Error('Invalid AW capability registry: capability IDs must be unique.');
|
|
43
|
+
}
|
|
44
|
+
return AW_CAPABILITY_IDS;
|
|
45
|
+
}
|
|
46
|
+
export function computeAwCapabilitySetDigest(values) {
|
|
47
|
+
const canonical = JSON.stringify(normalizeAwCapabilities(values));
|
|
48
|
+
return `sha256:${createHash('sha256').update(CAPABILITY_SET_DIGEST_DOMAIN).update(canonical).digest('hex')}`;
|
|
49
|
+
}
|
|
50
|
+
export function checkAwCapabilitySupport(required, implemented) {
|
|
51
|
+
const supported = new Set(normalizeAwCapabilities(implemented, 'implementedCapabilities'));
|
|
52
|
+
const missing = normalizeAwCapabilities(required, 'requiredCapabilities')
|
|
53
|
+
.filter((capability) => !supported.has(capability));
|
|
54
|
+
return { supported: missing.length === 0, missing };
|
|
55
|
+
}
|
|
56
|
+
export function createAwPluginRequirementsReceipt(plugin, requiredCapabilities) {
|
|
57
|
+
const normalized = normalizeAwCapabilities(requiredCapabilities);
|
|
58
|
+
return {
|
|
59
|
+
schemaVersion: 1,
|
|
60
|
+
kind: 'aw-plugin-requirements',
|
|
61
|
+
plugin,
|
|
62
|
+
requiredCapabilities: normalized,
|
|
63
|
+
digest: computeAwCapabilitySetDigest(normalized),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function assertRecord(value, fieldName) {
|
|
67
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
68
|
+
throw new Error(`Invalid ${fieldName}: expected an object.`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function assertExactKeys(value, keys, fieldName) {
|
|
72
|
+
const extras = Object.keys(value).filter((key) => !keys.includes(key));
|
|
73
|
+
if (extras.length > 0)
|
|
74
|
+
throw new Error(`Invalid ${fieldName}: unknown field ${JSON.stringify(extras[0])}.`);
|
|
75
|
+
}
|
|
76
|
+
export function parseAwPluginRequirementsReceipt(value) {
|
|
77
|
+
assertRecord(value, 'AW plugin requirements receipt');
|
|
78
|
+
assertExactKeys(value, ['schemaVersion', 'kind', 'plugin', 'requiredCapabilities', 'digest'], 'AW plugin requirements receipt');
|
|
79
|
+
if (value.schemaVersion !== 1)
|
|
80
|
+
throw new Error('Invalid AW plugin requirements receipt.schemaVersion: expected 1.');
|
|
81
|
+
if (value.kind !== 'aw-plugin-requirements')
|
|
82
|
+
throw new Error('Invalid AW plugin requirements receipt.kind.');
|
|
83
|
+
assertRecord(value.plugin, 'AW plugin requirements receipt.plugin');
|
|
84
|
+
assertExactKeys(value.plugin, ['name', 'version'], 'AW plugin requirements receipt.plugin');
|
|
85
|
+
if (typeof value.plugin.name !== 'string' || !PLUGIN_NAME_PATTERN.test(value.plugin.name)) {
|
|
86
|
+
throw new Error('Invalid AW plugin requirements receipt.plugin.name.');
|
|
87
|
+
}
|
|
88
|
+
if (typeof value.plugin.version !== 'string' || !STRICT_SEMVER_PATTERN.test(value.plugin.version)) {
|
|
89
|
+
throw new Error('Invalid AW plugin requirements receipt.plugin.version.');
|
|
90
|
+
}
|
|
91
|
+
if (!Array.isArray(value.requiredCapabilities)) {
|
|
92
|
+
throw new Error('Invalid AW plugin requirements receipt.requiredCapabilities: expected an array.');
|
|
93
|
+
}
|
|
94
|
+
const requiredCapabilities = normalizeAwCapabilities(value.requiredCapabilities, 'AW plugin requirements receipt.requiredCapabilities');
|
|
95
|
+
if (typeof value.digest !== 'string' || value.digest !== computeAwCapabilitySetDigest(requiredCapabilities)) {
|
|
96
|
+
throw new Error('Invalid AW plugin requirements receipt.digest.');
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
schemaVersion: 1,
|
|
100
|
+
kind: 'aw-plugin-requirements',
|
|
101
|
+
plugin: { name: value.plugin.name, version: value.plugin.version },
|
|
102
|
+
requiredCapabilities,
|
|
103
|
+
digest: value.digest,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=aw-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aw-capabilities.js","sourceRoot":"","sources":["../src/aw-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,uBAAuB;IACvB,qBAAqB;IACrB,2BAA2B;IAC3B,qBAAqB;IACrB,wBAAwB;IACxB,yBAAyB;IACzB,uBAAuB;IACvB,uBAAuB;IACvB,wBAAwB;IACxB,kBAAkB;IAClB,wBAAwB;IACxB,yBAAyB;IACzB,sBAAsB;IACtB,0BAA0B;IAC1B,2BAA2B;IAC3B,0BAA0B;IAC1B,wBAAwB;IACxB,kBAAkB;CACV,CAAA;AAUV,MAAM,qBAAqB,GAAG,8EAA8E,CAAA;AAC5G,MAAM,4BAA4B,GAAG,wBAAwB,CAAA;AAC7D,MAAM,mBAAmB,GAAG,6BAA6B,CAAA;AACzD,MAAM,qBAAqB,GAAG,iOAAiO,CAAA;AAE/P,MAAM,UAAU,oBAAoB,CAAC,KAAc,EAAE,SAAS,GAAG,YAAY;IAC3E,IAAI,OAAO,KAAK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AM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAA;IACpG,CAAC;IACD,MAAM,oBAAoB,GAAG,uBAAuB,CAClD,KAAK,CAAC,oBAAoB,EAC1B,qDAAqD,CACtD,CAAA;IACD,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,4BAA4B,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC5G,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IACD,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;QAClE,oBAAoB;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { CATALOG_WORKSPACE_MARKER_FILENAME, readCatalogWorkspaceMarker, } from './workspace.js';
|
|
4
|
+
async function startDirectory(value) {
|
|
5
|
+
const resolved = path.resolve(value);
|
|
6
|
+
const stat = await fs.lstat(resolved).catch((error) => {
|
|
7
|
+
if (error.code === 'ENOENT')
|
|
8
|
+
return null;
|
|
9
|
+
throw error;
|
|
10
|
+
});
|
|
11
|
+
if (stat?.isSymbolicLink())
|
|
12
|
+
throw new Error(`Catalog Workspace discovery path must not be a symbolic link: ${resolved}`);
|
|
13
|
+
return stat?.isFile() ? path.dirname(resolved) : resolved;
|
|
14
|
+
}
|
|
15
|
+
export async function findNearestCatalogWorkspaceRoot(options) {
|
|
16
|
+
let current = await startDirectory(options.from);
|
|
17
|
+
for (;;) {
|
|
18
|
+
const markerPath = path.join(current, CATALOG_WORKSPACE_MARKER_FILENAME);
|
|
19
|
+
const markerStat = await fs.lstat(markerPath).catch((error) => {
|
|
20
|
+
if (error.code === 'ENOENT')
|
|
21
|
+
return null;
|
|
22
|
+
throw error;
|
|
23
|
+
});
|
|
24
|
+
if (markerStat) {
|
|
25
|
+
await readCatalogWorkspaceMarker(current);
|
|
26
|
+
return fs.realpath(current);
|
|
27
|
+
}
|
|
28
|
+
const parent = path.dirname(current);
|
|
29
|
+
if (parent === current)
|
|
30
|
+
return null;
|
|
31
|
+
current = parent;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=catalog-workspace-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-workspace-resolution.js","sourceRoot":"","sources":["../src/catalog-workspace-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,gBAAgB,CAAA;AAEvB,KAAK,UAAU,cAAc,CAAC,KAAa;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACpC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAA4B,EAAE,EAAE;QAC3E,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QACxC,MAAM,KAAK,CAAA;IACb,CAAC,CAAC,CAAA;IACF,IAAI,IAAI,EAAE,cAAc,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,iEAAiE,QAAQ,EAAE,CAAC,CAAA;IACxH,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,OAErD;IACC,IAAI,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,SAAS,CAAC;QACR,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAA;QACxE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAA4B,EAAE,EAAE;YACnF,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAA;YACxC,MAAM,KAAK,CAAA;QACb,CAAC,CAAC,CAAA;QACF,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAA;YACzC,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC7B,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACpC,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,IAAI,CAAA;QACnC,OAAO,GAAG,MAAM,CAAA;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This interface was referenced by `
|
|
2
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
3
3
|
* via the `definition` "semver".
|
|
4
4
|
*/
|
|
5
5
|
export type Semver = string;
|
|
6
6
|
/**
|
|
7
|
-
* This interface was referenced by `
|
|
7
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
8
8
|
* via the `definition` "pluginPath".
|
|
9
9
|
*/
|
|
10
10
|
export type PluginPath = string;
|
|
11
11
|
/**
|
|
12
|
-
* This interface was referenced by `
|
|
12
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
13
13
|
* via the `definition` "stringArray".
|
|
14
14
|
*/
|
|
15
15
|
export type StringArray = string[];
|
|
16
|
+
export type Capabilities = string[];
|
|
16
17
|
/**
|
|
17
|
-
* This interface was referenced by `
|
|
18
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
18
19
|
* via the `definition` "lifecycleDefinition".
|
|
19
20
|
*/
|
|
20
21
|
export type LifecycleDefinition = (string | {
|
|
@@ -25,8 +26,8 @@ export type LifecycleDefinition = (string | {
|
|
|
25
26
|
darwin?: ScriptEntry;
|
|
26
27
|
win32?: ScriptEntry;
|
|
27
28
|
});
|
|
28
|
-
export interface
|
|
29
|
-
schemaVersion
|
|
29
|
+
export interface PluginManifestSourceV2 {
|
|
30
|
+
schemaVersion: 2;
|
|
30
31
|
name: string;
|
|
31
32
|
version: Semver;
|
|
32
33
|
description: string;
|
|
@@ -34,7 +35,7 @@ export interface PluginManifestSourceV1 {
|
|
|
34
35
|
* @maxItems 64
|
|
35
36
|
*/
|
|
36
37
|
dependencies?: string[];
|
|
37
|
-
|
|
38
|
+
requires?: Requires;
|
|
38
39
|
skills?: PluginPath;
|
|
39
40
|
slashCommands?: PluginPath;
|
|
40
41
|
mcpServers?: PluginPath;
|
|
@@ -49,16 +50,16 @@ export interface PluginManifestSourceV1 {
|
|
|
49
50
|
config?: Config;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
|
-
* This interface was referenced by `
|
|
53
|
-
* via the `definition` "
|
|
53
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
54
|
+
* via the `definition` "requires".
|
|
54
55
|
*/
|
|
55
|
-
export interface
|
|
56
|
+
export interface Requires {
|
|
56
57
|
aw: {
|
|
57
|
-
|
|
58
|
+
capabilities?: string[];
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
|
-
* This interface was referenced by `
|
|
62
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
62
63
|
* via the `definition` "distributions".
|
|
63
64
|
*/
|
|
64
65
|
export interface Distributions {
|
|
@@ -67,7 +68,7 @@ export interface Distributions {
|
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
|
-
* This interface was referenced by `
|
|
71
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
71
72
|
* via the `definition` "marketplace".
|
|
72
73
|
*/
|
|
73
74
|
export interface Marketplace {
|
|
@@ -81,7 +82,7 @@ export interface Marketplace {
|
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
84
|
-
* This interface was referenced by `
|
|
85
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
85
86
|
* via the `definition` "interface".
|
|
86
87
|
*/
|
|
87
88
|
export interface Interface {
|
|
@@ -90,7 +91,7 @@ export interface Interface {
|
|
|
90
91
|
capabilities?: string[];
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
93
|
-
* This interface was referenced by `
|
|
94
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
94
95
|
* via the `definition` "extensions".
|
|
95
96
|
*/
|
|
96
97
|
export interface Extensions {
|
|
@@ -104,7 +105,7 @@ export interface Extensions {
|
|
|
104
105
|
agents?: Agent[];
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
|
-
* This interface was referenced by `
|
|
108
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
108
109
|
* via the `definition` "instruction".
|
|
109
110
|
*/
|
|
110
111
|
export interface Instruction {
|
|
@@ -115,7 +116,7 @@ export interface Instruction {
|
|
|
115
116
|
agentOverrides?: PlatformOverrides;
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
|
-
* This interface was referenced by `
|
|
119
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
119
120
|
* via the `definition` "platformOverrides".
|
|
120
121
|
*/
|
|
121
122
|
export interface PlatformOverrides {
|
|
@@ -127,7 +128,7 @@ export interface PlatformOverrides {
|
|
|
127
128
|
} | null);
|
|
128
129
|
}
|
|
129
130
|
/**
|
|
130
|
-
* This interface was referenced by `
|
|
131
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
131
132
|
* via the `definition` "permission".
|
|
132
133
|
*/
|
|
133
134
|
export interface Permission {
|
|
@@ -138,7 +139,7 @@ export interface Permission {
|
|
|
138
139
|
agentOverrides?: PlatformOverrides;
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
141
|
-
* This interface was referenced by `
|
|
142
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
142
143
|
* via the `definition` "hook".
|
|
143
144
|
*/
|
|
144
145
|
export interface Hook {
|
|
@@ -148,7 +149,7 @@ export interface Hook {
|
|
|
148
149
|
agentOverrides?: PlatformOverrides;
|
|
149
150
|
}
|
|
150
151
|
/**
|
|
151
|
-
* This interface was referenced by `
|
|
152
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
152
153
|
* via the `definition` "nativeHook".
|
|
153
154
|
*/
|
|
154
155
|
export interface NativeHook {
|
|
@@ -157,7 +158,7 @@ export interface NativeHook {
|
|
|
157
158
|
command: string;
|
|
158
159
|
}
|
|
159
160
|
/**
|
|
160
|
-
* This interface was referenced by `
|
|
161
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
161
162
|
* via the `definition` "agent".
|
|
162
163
|
*/
|
|
163
164
|
export interface Agent {
|
|
@@ -168,14 +169,14 @@ export interface Agent {
|
|
|
168
169
|
agentOverrides?: PlatformOverrides;
|
|
169
170
|
}
|
|
170
171
|
/**
|
|
171
|
-
* This interface was referenced by `
|
|
172
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
172
173
|
* via the `definition` "artifacts".
|
|
173
174
|
*/
|
|
174
175
|
export interface Artifacts {
|
|
175
176
|
targets?: ArtifactTarget[];
|
|
176
177
|
}
|
|
177
178
|
/**
|
|
178
|
-
* This interface was referenced by `
|
|
179
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
179
180
|
* via the `definition` "artifactTarget".
|
|
180
181
|
*/
|
|
181
182
|
export interface ArtifactTarget {
|
|
@@ -202,11 +203,13 @@ export interface ArtifactTarget {
|
|
|
202
203
|
providerPluginId: string;
|
|
203
204
|
providerVersion: Semver;
|
|
204
205
|
source: string;
|
|
206
|
+
requiredCapabilities: Capabilities;
|
|
207
|
+
capabilitySetDigest: string;
|
|
205
208
|
};
|
|
206
209
|
}[];
|
|
207
210
|
}
|
|
208
211
|
/**
|
|
209
|
-
* This interface was referenced by `
|
|
212
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
210
213
|
* via the `definition` "buildConfig".
|
|
211
214
|
*/
|
|
212
215
|
export interface BuildConfig {
|
|
@@ -236,6 +239,7 @@ export interface BuildConfig {
|
|
|
236
239
|
runtimeExports?: {
|
|
237
240
|
name: string;
|
|
238
241
|
source: string;
|
|
242
|
+
requires: RuntimeExportRequires;
|
|
239
243
|
}[];
|
|
240
244
|
buildImports?: {
|
|
241
245
|
plugin: string;
|
|
@@ -257,7 +261,7 @@ export interface BuildConfig {
|
|
|
257
261
|
}[];
|
|
258
262
|
}
|
|
259
263
|
/**
|
|
260
|
-
* This interface was referenced by `
|
|
264
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
261
265
|
* via the `definition` "platformTemplateValue".
|
|
262
266
|
*/
|
|
263
267
|
export interface PlatformTemplateValue {
|
|
@@ -265,7 +269,7 @@ export interface PlatformTemplateValue {
|
|
|
265
269
|
codex: (string | boolean);
|
|
266
270
|
}
|
|
267
271
|
/**
|
|
268
|
-
* This interface was referenced by `
|
|
272
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
269
273
|
* via the `definition` "fileRules".
|
|
270
274
|
*/
|
|
271
275
|
export interface FileRules {
|
|
@@ -273,7 +277,16 @@ export interface FileRules {
|
|
|
273
277
|
exclude: StringArray;
|
|
274
278
|
}
|
|
275
279
|
/**
|
|
276
|
-
* This interface was referenced by `
|
|
280
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
281
|
+
* via the `definition` "runtimeExportRequires".
|
|
282
|
+
*/
|
|
283
|
+
export interface RuntimeExportRequires {
|
|
284
|
+
aw: {
|
|
285
|
+
capabilities: Capabilities;
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
277
290
|
* via the `definition` "importReference".
|
|
278
291
|
*/
|
|
279
292
|
export interface ImportReference {
|
|
@@ -281,7 +294,7 @@ export interface ImportReference {
|
|
|
281
294
|
export: string;
|
|
282
295
|
}
|
|
283
296
|
/**
|
|
284
|
-
* This interface was referenced by `
|
|
297
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
285
298
|
* via the `definition` "scripts".
|
|
286
299
|
*/
|
|
287
300
|
export interface Scripts {
|
|
@@ -306,7 +319,7 @@ export interface Scripts {
|
|
|
306
319
|
};
|
|
307
320
|
}
|
|
308
321
|
/**
|
|
309
|
-
* This interface was referenced by `
|
|
322
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
310
323
|
* via the `definition` "scriptEntry".
|
|
311
324
|
*/
|
|
312
325
|
export interface ScriptEntry {
|
|
@@ -315,7 +328,7 @@ export interface ScriptEntry {
|
|
|
315
328
|
args?: StringArray;
|
|
316
329
|
}
|
|
317
330
|
/**
|
|
318
|
-
* This interface was referenced by `
|
|
331
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
319
332
|
* via the `definition` "config".
|
|
320
333
|
*/
|
|
321
334
|
export interface Config {
|
|
@@ -352,7 +365,7 @@ export interface Config {
|
|
|
352
365
|
};
|
|
353
366
|
}
|
|
354
367
|
/**
|
|
355
|
-
* This interface was referenced by `
|
|
368
|
+
* This interface was referenced by `PluginManifestSourceV2`'s JSON-Schema
|
|
356
369
|
* via the `definition` "configField".
|
|
357
370
|
*/
|
|
358
371
|
export interface ConfigField {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-manifest-v2.js","sourceRoot":"","sources":["../../src/generated/plugin-manifest-v2.ts"],"names":[],"mappings":"AAAA,uFAAuF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './manifest.js';
|
|
2
|
-
export type {
|
|
2
|
+
export type { PluginManifestSourceV2 } from './generated/plugin-manifest-v2.js';
|
|
3
3
|
export * from './workspace.js';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './catalog-workspace-resolution.js';
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAE7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAE7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mCAAmC,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION } from './manifest.js';
|
|
2
|
-
import type { CatalogMarketplaceIdentity, CatalogChannel, CatalogManifestEntry, MarketplaceManifest, MarketplaceSourceMeta, PlatformName, PlatformPluginManifest,
|
|
2
|
+
import type { CatalogMarketplaceIdentity, CatalogChannel, CatalogManifestEntry, MarketplaceManifest, MarketplaceSourceMeta, PlatformName, PlatformPluginManifest, PluginRequirements, PluginManifestSource, NormalizedPluginManifest, PluginMeta } from './types.js';
|
|
3
3
|
export declare const SOURCE_MANIFEST_PATH: string;
|
|
4
4
|
export { SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION };
|
|
5
5
|
export declare const MARKETPLACE_SOURCE_PATH: string;
|
|
6
|
-
export declare const DEFAULT_SOURCE_PLUGIN_AW_MIN_VERSION = "0.0.0";
|
|
7
6
|
export interface StrictSemVer {
|
|
8
7
|
raw: string;
|
|
9
8
|
major: number;
|
|
@@ -64,8 +63,6 @@ export declare function validateMarketplaceSourceMeta(rawValue: unknown): Market
|
|
|
64
63
|
export declare function normalizeCatalogMarketplaceIdentity(rawValue: unknown, fieldName?: string): CatalogMarketplaceIdentity;
|
|
65
64
|
export declare function readMarketplaceSourceMeta(repoRoot: string): Promise<MarketplaceSourceMeta>;
|
|
66
65
|
export interface ValidatePluginManifestOptions {
|
|
67
|
-
compatibilityMode?: 'defaulted' | 'required';
|
|
68
|
-
defaultMinVersion?: string;
|
|
69
66
|
reservedImports?: ReservedImportRegistry;
|
|
70
67
|
}
|
|
71
68
|
export type ReservedImportRegistry = Readonly<Record<string, readonly string[]>>;
|
|
@@ -87,10 +84,10 @@ export declare function normalizeManifestDigestInput(value: PluginManifestSource
|
|
|
87
84
|
export interface NormalizedCatalogManifestBase {
|
|
88
85
|
catalogVersion: string;
|
|
89
86
|
channel: CatalogChannel;
|
|
90
|
-
|
|
87
|
+
requires: PluginRequirements;
|
|
91
88
|
}
|
|
92
89
|
export declare function normalizeCatalogManifestBase(input: Record<string, unknown>, fieldName: string): NormalizedCatalogManifestBase;
|
|
93
90
|
export declare function normalizeCatalogManifestEntries(rawEntries: unknown, base: NormalizedCatalogManifestBase, fieldName: string): CatalogManifestEntry[];
|
|
94
|
-
export declare function createBundleSourceManifest(plugin: PluginMeta): NormalizedPluginManifest;
|
|
91
|
+
export declare function createBundleSourceManifest(plugin: PluginMeta, requiredCapabilities?: readonly string[]): NormalizedPluginManifest;
|
|
95
92
|
export declare function createPlatformManifestBase(plugin: PluginMeta): PlatformPluginManifest;
|
|
96
93
|
export declare function validatePlatformManifestProjection(plugin: PluginMeta, platform: PlatformName, rawManifest: unknown): Promise<PlatformPluginManifest>;
|