feat(skill-runtime): restore admin config and manifest keyword routing

Recover skill runtime policy/admin services and Skill Router v2 helpers so
admins can toggle manifest routing and inspect the platform skill catalog.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-13 13:59:59 +08:00
parent e90a2da6cb
commit a867592367
8 changed files with 470 additions and 4 deletions
+30
View File
@@ -0,0 +1,30 @@
import { buildManifestRoutesFromCatalog } from './chat-skills.mjs';
import { listPlatformSkillCatalog } from './skills-registry.mjs';
export function buildPublicSkillRuntimeConfig(config, h5Root = process.cwd()) {
const routerV2Enabled = Boolean(config?.router?.v2Enabled);
const manifestRoutingEnabled = routerV2Enabled && Boolean(config?.router?.manifestRoutingEnabled);
const catalog = listPlatformSkillCatalog(h5Root);
const manifestRoutes = manifestRoutingEnabled ? buildManifestRoutesFromCatalog(catalog) : [];
return {
routerV2Enabled,
manifestRoutingEnabled,
manifestRoutes,
manifestSkillCount: catalog.filter((item) => item.manifest?.trigger?.keywords?.length).length,
};
}
export function buildSkillRuntimeCatalogSummary(h5Root = process.cwd()) {
const catalog = listPlatformSkillCatalog(h5Root);
return catalog.map((item) => ({
name: item.name,
dirName: item.dirName,
description: item.description,
version: item.version ?? null,
executors: item.executors ?? ['goose'],
hasManifest: Boolean(item.manifest),
triggerKeywords: item.manifest?.trigger?.keywords ?? [],
routerPromptKey: item.manifest?.router?.promptKey ?? null,
routerPriority: item.manifest?.router?.priority ?? 0,
}));
}