a867592367
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>
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
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,
|
|
}));
|
|
}
|