test: verify packaged game audio and skill-only resources

This commit is contained in:
2026-09-21 12:57:05 +08:00
parent 09e0ce5cf3
commit 938c4b1ed3
3 changed files with 42 additions and 13 deletions

View File

@@ -37,7 +37,7 @@ const MARKETPLACE_ARTIFACT_TEXT = [
'plugin-marketplace\\/install\\/', 'plugin-marketplace\\/update\\/',
'effectiveSkillIds', 'pluginReleaseIds',
'/api/coding/plugin-marketplace/catalog', '/api/coding/plugin-marketplace/library',
'为你的智能体添加插件,拓展更多能力。', 'acquire', 'install_stable', 'enable_project', '/project-config/plugins',
'plugin-tab-available', 'plugin-tab-installed', 'acquire', 'install_stable', 'enable_project', '/project-config/plugins',
].join('\n');
async function createAsarFixture(source: string, archive: string) {
@@ -76,7 +76,7 @@ function matchingMetadata() {
};
}
async function bundledResourceFixture({ schemaVersion = 1, includeSdkAssets = true } = {}) {
async function bundledResourceFixture({ schemaVersion = 1, includeSdkAssets = true, includeTools = true } = {}) {
const root = await mkdtemp(path.join(tmpdir(), 'makelore-bundled-plugin-'));
roots.push(root);
const projectRoot = path.join(root, 'project');
@@ -90,7 +90,7 @@ async function bundledResourceFixture({ schemaVersion = 1, includeSdkAssets = tr
? { runtime: { kind: 'platform_hosted', protocol: 'makelore-hosted.v1' } }
: {}),
skills: [{ id: 'example', entry: '../skills/example/SKILL.md', grants: [] }],
tools: [{ name: 'example_read' }],
tools: includeTools ? [{ name: 'example_read' }] : [],
};
await mkdir(path.join(pluginRoot, 'com.makelore'), { recursive: true });
await mkdir(path.join(pluginRoot, 'skills', 'example'), { recursive: true });
@@ -243,6 +243,26 @@ describe('final Pi product artifact verification', () => {
});
});
it('accepts the shipped skill-only scaffold without an adapter', async () => {
const fixture = await bundledResourceFixture({ schemaVersion: 2, includeSdkAssets: false });
const scaffold = path.resolve('resources/coding-plugins/project-scaffold');
await cp(scaffold, path.join(fixture.projectRoot, 'resources/coding-plugins/project-scaffold'), { recursive: true });
await cp(scaffold, path.join(fixture.resourcesDirectory, 'resources/coding-plugins/project-scaffold'), { recursive: true });
const result = await verifyBundledCodingPluginResources({
...fixture,
appAsarContents: Buffer.concat([fixture.appAsarContents, Buffer.from(' makelore.project-scaffold')]),
});
expect(result.packages).toEqual(expect.arrayContaining([
expect.objectContaining({ id: 'makelore.project-scaffold', tools: [] }),
]));
expect(result.catalog.adapters).toEqual(['example.plugin']);
});
it('still rejects a hosted plugin missing its tool catalog', async () => {
const fixture = await bundledResourceFixture({ schemaVersion: 2, includeSdkAssets: false, includeTools: false });
await expect(verifyBundledCodingPluginResources(fixture)).rejects.toThrow('adapter/tool catalog is invalid');
});
it('proves the packaged Marketplace trust, routes, effective snapshot, and Renderer assets', () => {
const artifact = Buffer.from(MARKETPLACE_ARTIFACT_TEXT);
@@ -405,7 +425,7 @@ describe('final Pi product artifact verification', () => {
'makelore-device-package.v1 /api/coding/device-packages device-parent-workers',
'/api/coding/plugin-marketplace plugin-marketplace\\/install\\/ plugin-marketplace\\/update\\/',
'effectiveSkillIds pluginReleaseIds',
'/api/coding/plugin-marketplace/catalog /api/coding/plugin-marketplace/library 为你的智能体添加插件,拓展更多能力。 acquire install_stable enable_project /project-config/plugins',
'/api/coding/plugin-marketplace/catalog /api/coding/plugin-marketplace/library plugin-tab-available plugin-tab-installed acquire install_stable enable_project /project-config/plugins',
].join('\n'));
const appAsar = path.join(root, 'app.asar');
await createAsarFixture(source, appAsar);
@@ -424,7 +444,7 @@ describe('final Pi product artifact verification', () => {
'makelore.game-audio /api/plugins/v1/hosted/game-audio/generations',
'/api/coding/plugin-marketplace plugin-marketplace\\/install\\/ plugin-marketplace\\/update\\/',
'effectiveSkillIds pluginReleaseIds',
'/api/coding/plugin-marketplace/catalog /api/coding/plugin-marketplace/library 为你的智能体添加插件,拓展更多能力。 acquire enable_project /project-config/plugins',
'/api/coding/plugin-marketplace/catalog /api/coding/plugin-marketplace/library plugin-tab-available plugin-tab-installed acquire enable_project /project-config/plugins',
].join('\n'));
const staleAsar = path.join(root, 'stale.asar');
await createAsarFixture(staleSource, staleAsar);