fix(plugins): load official hosted plugins from bundled resources
This commit is contained in:
1 parent
52e2a97a12
commit
1530ac7740
23 files changed
+835
-48
No files matched your search
@@ -74,20 +74,24 @@ function matchingMetadata() {
|
||||
};
|
||||
}
|
||||
|
||||
async function bundledResourceFixture() {
|
||||
async function bundledResourceFixture({ schemaVersion = 1, includeSdkAssets = true } = {}) {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-bundled-plugin-'));
|
||||
roots.push(root);
|
||||
const projectRoot = path.join(root, 'project');
|
||||
const sourceResources = path.join(projectRoot, 'resources');
|
||||
const pluginRoot = path.join(sourceResources, 'coding-plugins', 'example');
|
||||
const capability = {
|
||||
schemaVersion,
|
||||
pluginId: 'example.plugin',
|
||||
adapterId: 'example-adapter',
|
||||
...(schemaVersion === 2
|
||||
? { runtime: { kind: 'platform_hosted', protocol: 'makelore-hosted.v1' } }
|
||||
: {}),
|
||||
skills: [{ id: 'example', entry: '../skills/example/SKILL.md', grants: [] }],
|
||||
tools: [{ name: 'example_read' }],
|
||||
};
|
||||
await mkdir(path.join(pluginRoot, 'com.makelore'), { recursive: true });
|
||||
await mkdir(path.join(pluginRoot, 'skills', 'example', 'assets'), { recursive: true });
|
||||
await mkdir(path.join(pluginRoot, 'skills', 'example'), { recursive: true });
|
||||
await mkdir(path.join(sourceResources, 'coding-skills', 'agent-browser'), { recursive: true });
|
||||
await writeFile(path.join(pluginRoot, 'plugin.json'), JSON.stringify({
|
||||
name: 'example.plugin',
|
||||
@@ -96,8 +100,11 @@ async function bundledResourceFixture() {
|
||||
}));
|
||||
await writeFile(path.join(pluginRoot, 'com.makelore', 'capability.json'), JSON.stringify(capability));
|
||||
await writeFile(path.join(pluginRoot, 'skills', 'example', 'SKILL.md'), '# Example Skill\n');
|
||||
await writeFile(path.join(pluginRoot, 'skills', 'example', 'assets', 'sdk.ts'), 'export {};\n');
|
||||
await writeFile(path.join(pluginRoot, 'skills', 'example', 'assets', 'sdk.js'), 'export {};\n');
|
||||
if (includeSdkAssets) {
|
||||
await mkdir(path.join(pluginRoot, 'skills', 'example', 'assets'), { recursive: true });
|
||||
await writeFile(path.join(pluginRoot, 'skills', 'example', 'assets', 'sdk.ts'), 'export {};\n');
|
||||
await writeFile(path.join(pluginRoot, 'skills', 'example', 'assets', 'sdk.js'), 'export {};\n');
|
||||
}
|
||||
await writeFile(path.join(sourceResources, 'coding-skills', 'agent-browser', 'SKILL.md'), '# Browser\n');
|
||||
const resourcesDirectory = path.join(root, 'packaged');
|
||||
await cp(sourceResources, path.join(resourcesDirectory, 'resources'), { recursive: true });
|
||||
@@ -206,6 +213,20 @@ describe('final Pi product artifact verification', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('accepts schema-2 hosted plugins whose implementation has no client SDK assets', async () => {
|
||||
const fixture = await bundledResourceFixture({ schemaVersion: 2, includeSdkAssets: false });
|
||||
await expect(verifyBundledCodingPluginResources(fixture)).resolves.toMatchObject({
|
||||
packages: [{
|
||||
id: 'example.plugin',
|
||||
skills: [{ id: 'example', path: 'skills/example/SKILL.md' }],
|
||||
sdkAssets: [],
|
||||
adapterId: 'example.plugin',
|
||||
tools: ['example_read'],
|
||||
}],
|
||||
result: 'pass',
|
||||
});
|
||||
});
|
||||
|
||||
it('proves the packaged Marketplace trust, routes, effective snapshot, and Renderer assets', () => {
|
||||
const artifact = Buffer.from(MARKETPLACE_ARTIFACT_TEXT);
|
||||
|
||||
|
||||
Reference in new issue
Block a user