feat(web-search): wire hosted plugin composition

This commit is contained in:
2026-09-01 02:39:16 +08:00
parent 68cb2e73be
commit 60e6a8eeb3
9 changed files with 361 additions and 6 deletions

View File

@@ -45,6 +45,12 @@ const MARKETPLACE_ARTIFACT_MARKERS = Object.freeze({
'makelore.game-resource',
'/api/plugins/v1/hosted/game-resource/generations',
]),
webSearchRuntime: Object.freeze([
'makelore.web-search',
'/api/plugins/v1/hosted/web-search/searches',
'plugin_receipt_unavailable',
'receipt_unavailable',
]),
mainRoutes: Object.freeze([
'/api/coding/plugin-marketplace',
'plugin-marketplace\\/install\\/',
@@ -61,12 +67,14 @@ const MARKETPLACE_ARTIFACT_MARKERS = Object.freeze({
'我的插件',
]),
});
const FORBIDDEN_MEOWA_ARTIFACT_MARKERS = Object.freeze([
const FORBIDDEN_PROVIDER_AUTHORITY_MARKERS = Object.freeze([
'MEOWA_API_KEY',
'MEOWA_API_URL',
'MEOWA_GAME_ASSETS_SHARED_SECRET',
'/api/coding/meowa-game-assets',
'https://api.meowa.ai',
'WEB_SEARCH_OPENAI_API_KEY',
'https://api.openai.com/v1/responses',
]);
const CODE_OWNED_PLUGIN_SIGNING_KEYS_SOURCE_MARKER = 'makelore.plugin-trust.code-owned.v1';
const PI_AI_PROVIDER_PREFIX = 'pi-runtime/node_modules/@earendil-works/pi-ai/dist/providers/';
@@ -309,11 +317,11 @@ export function verifyMarketplaceClientArtifact(appAsarContents, productionTrust
if (missing.length > 0) {
throw new Error(`Packaged app.asar does not contain Marketplace contract markers: ${missing.join(', ')}`);
}
const forbidden = FORBIDDEN_MEOWA_ARTIFACT_MARKERS.filter((marker) => (
const forbidden = FORBIDDEN_PROVIDER_AUTHORITY_MARKERS.filter((marker) => (
appAsarContents.includes(Buffer.from(marker))
));
if (forbidden.length > 0) {
throw new Error(`Packaged app.asar still contains legacy Meowa client authority: ${forbidden.join(', ')}`);
throw new Error(`Packaged app.asar still contains provider authority: ${forbidden.join(', ')}`);
}
const hasEmptyCodeOwnedTrust = /(?:CODE_OWNED_PLUGIN_SIGNING_KEYS\s*=\s*)?Object\.freeze\(\s*\{\}\s*(?:as\s+[^)]*)?\)/u.test(productionTrustSource);
if (!hasEmptyCodeOwnedTrust
@@ -327,6 +335,7 @@ export function verifyMarketplaceClientArtifact(appAsarContents, productionTrust
schema2SkillOnly: true,
schema2PlatformHosted: true,
legacyMeowaClientAuthorityAbsent: true,
webSearchProviderAuthorityAbsent: true,
productionTrust: 'official-key-absent-fail-closed',
libraryInstallAndEffectiveRoutes: true,
rendererAssets: true,