49
50
export function readConfiguredMarketplaces(configurationService: IConfigurationService): IConfiguredMarketplaces {
51
>
const userValues = configurationService.getValue<(string | object)[]>(ChatConfiguration.PluginMarketplaces) ?? [];
marketplaceReference.ts
52
>
53
>
// `ChatExtraMarketplaces` is stored as `{ [name]: url-or-shorthand }` when delivered by
54
>
// policy. Convert each entry to the nested IExtraMarketplaceObjectEntry shape so that
55
>
// parseMarketplaceReferences can set displayLabel = name (critical for enabledPlugins keys).
56
>
const extraObj = configurationService.getValue<Record<string, string>>(ChatConfiguration.ExtraMarketplaces) ?? {};
57
>
const extraValues: IExtraMarketplaceObjectEntry[] = Object.entries(extraObj).map(([name, src]) => {
58
const isGithubShorthand = _githubShorthandRe.test(src);
59
return isGithubShorthand
60
? { name, source: { source: 'github' as const, repo: src } }
61
: { name, source: { source: 'git' as const, url: src } };
63
>
64
>
return {
65
>
userValues,
66
>
extraValues,
67
>
effectiveValues: [...userValues, ...extraValues],
68
>
};
69
>
}
70
71
export function parseMarketplaceReferences(values: readonly unknown[]): IMarketplaceReference[] {