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:
@@ -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,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user