MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / mapPluginSummary

Function mapPluginSummary

packages/codex-native-api/src/codex_app_client.ts:2952–2994  ·  view source on GitHub ↗
(
  raw: CodexAppPluginSummary | null | undefined,
  context: {
    marketplaceName?: string | null;
    marketplacePath?: string | null;
    marketplaceDisplayName?: string | null;
  } = {},
)

Source from the content-addressed store, hash-verified

2950}
2951
2952function mapPluginSummary(
2953 raw: CodexAppPluginSummary | null | undefined,
2954 context: {
2955 marketplaceName?: string | null;
2956 marketplacePath?: string | null;
2957 marketplaceDisplayName?: string | null;
2958 } = {},
2959): ProviderPluginSummary | null {
2960 const id = normalizeNullableString(raw?.id);
2961 const name = normalizeNullableString(raw?.name);
2962 if (!id || !name) {
2963 return null;
2964 }
2965 const sourceType = normalizeNullableString((raw?.source as any)?.type);
2966 const defaultPrompts = Array.isArray(raw?.interface?.defaultPrompt)
2967 ? raw.interface.defaultPrompt.map((entry) => normalizeNullableString(entry)).filter(Boolean) as string[]
2968 : [];
2969 return {
2970 id,
2971 name,
2972 installed: raw?.installed !== false,
2973 enabled: raw?.enabled !== false,
2974 installPolicy: normalizeNullableString(raw?.installPolicy) ?? 'AVAILABLE',
2975 authPolicy: normalizeNullableString(raw?.authPolicy) ?? 'ON_USE',
2976 marketplaceName: normalizeNullableString(context.marketplaceName) ?? 'unknown',
2977 marketplacePath: normalizeNullableString(context.marketplacePath),
2978 marketplaceDisplayName: normalizeNullableString(context.marketplaceDisplayName),
2979 displayName: normalizeNullableString(raw?.interface?.displayName),
2980 shortDescription: normalizeNullableString(raw?.interface?.shortDescription),
2981 longDescription: normalizeNullableString(raw?.interface?.longDescription),
2982 category: normalizeNullableString(raw?.interface?.category),
2983 capabilities: Array.isArray(raw?.interface?.capabilities)
2984 ? raw.interface.capabilities.map((entry) => String(entry ?? '').trim()).filter(Boolean)
2985 : [],
2986 developerName: normalizeNullableString(raw?.interface?.developerName),
2987 brandColor: normalizeNullableString(raw?.interface?.brandColor),
2988 defaultPrompts,
2989 websiteUrl: normalizeNullableString(raw?.interface?.websiteUrl),
2990 sourceType,
2991 sourcePath: normalizeNullableString((raw?.source as any)?.path),
2992 sourceRemoteMarketplaceName: normalizeNullableString((raw?.source as any)?.marketplaceName),
2993 };
2994}
2995
2996function mapPluginSkillSummary(raw: CodexAppPluginSkillSummary): ProviderPluginSkillSummary | null {
2997 const name = normalizeNullableString(raw?.name);

Callers 2

mapPluginMarketplaceFunction · 0.70
mapPluginDetailFunction · 0.70

Calls 1

normalizeNullableStringFunction · 0.70

Tested by

no test coverage detected