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

@@ -69,7 +69,8 @@ const MARKETPLACE_ARTIFACT_MARKERS = Object.freeze({
renderer: Object.freeze([
'/api/coding/plugin-marketplace/catalog',
'/api/coding/plugin-marketplace/library',
'为你的智能体添加插件,拓展更多能力。',
'plugin-tab-available',
'plugin-tab-installed',
'acquire',
'install_stable',
'enable_project',
@@ -645,17 +646,18 @@ export async function verifyBundledCodingPluginResources({
if (packagedCapability.schemaVersion === 1 && sdkAssetPaths.length === 0) {
throw new Error(`Packaged schema-1 coding plugin has no SDK assets: ${packageName}`);
}
const adapterId = packagedCapability.schemaVersion === 2
const skillOnly = packagedCapability.schemaVersion === 2 && packagedCapability.runtime?.kind === 'skill_only';
const adapterId = skillOnly ? null : packagedCapability.schemaVersion === 2
? packagedCapability.pluginId
: packagedCapability.adapterId;
const tools = Array.isArray(packagedCapability.tools) ? packagedCapability.tools : [];
const toolNames = tools.map((tool) => tool?.name);
if (typeof adapterId !== 'string' || adapterId.length === 0 || tools.length === 0
if ((skillOnly ? tools.length !== 0 : typeof adapterId !== 'string' || adapterId.length === 0 || tools.length === 0)
|| toolNames.some((name) => typeof name !== 'string' || name.length === 0)
|| new Set(toolNames).size !== toolNames.length) {
throw new Error(`Packaged coding plugin adapter/tool catalog is invalid: ${packageName}`);
}
catalogMarkers.push(packagedManifest.name, adapterId, ...toolNames);
catalogMarkers.push(packagedManifest.name, ...(adapterId ? [adapterId] : []), ...toolNames);
packages.push({
id: packagedManifest.name,
version: packagedManifest.version,
@@ -690,7 +692,7 @@ export async function verifyBundledCodingPluginResources({
root: BUNDLED_CODING_PLUGIN_RESOURCE_ROOT,
packages,
catalog: {
adapters: [...new Set(packages.map(({ adapterId }) => adapterId))],
adapters: [...new Set(packages.map(({ adapterId }) => adapterId).filter(Boolean))],
tools: [...new Set(packages.flatMap(({ tools }) => tools))],
packagedInAsar: true,
},