fix(plugins): load official hosted plugins from bundled resources
This commit is contained in:
@@ -444,7 +444,7 @@ export class EffectivePluginResolver {
|
||||
// this seam is exclusively for immutable user-installed package roots.
|
||||
return Object.freeze(definitions.flatMap(({ definition, installed, unavailableReason }) => (
|
||||
!installed || unavailableReason || blockedMarketplacePlugins.has(definition.id)
|
||||
|| definition.acquisitionMode !== 'user_acquired'
|
||||
|| definition.provenance.source !== 'marketplace'
|
||||
? []
|
||||
: definition.skills.map((skill) => ({
|
||||
id: skill.id,
|
||||
@@ -464,11 +464,20 @@ export class EffectivePluginResolver {
|
||||
pluginId: string,
|
||||
releaseId?: string | null,
|
||||
): Promise<CodingPluginDefinition | null> {
|
||||
const records = await this.definitionRecords();
|
||||
const bundled = records.find(({ definition }) => (
|
||||
definition.id === pluginId
|
||||
&& definition.provenance.source === 'bundled'
|
||||
&& definition.releaseId === releaseId
|
||||
));
|
||||
if (bundled) {
|
||||
return bundled.installed && !bundled.unavailableReason ? bundled.definition : null;
|
||||
}
|
||||
if (releaseId && this.options.packageStore) {
|
||||
const installed = await this.options.packageStore.getInstalledRelease(pluginId, releaseId);
|
||||
return installed && !installed.unavailableReason ? installed.definition : null;
|
||||
}
|
||||
const record = (await this.definitionRecords()).find(({ definition }) => definition.id === pluginId);
|
||||
const record = records.find(({ definition }) => definition.id === pluginId);
|
||||
return record?.installed && !record.unavailableReason ? record.definition : null;
|
||||
}
|
||||
|
||||
@@ -491,6 +500,7 @@ export class EffectivePluginResolver {
|
||||
}
|
||||
for (const definition of [...records.values()].map(({ definition }) => definition)) {
|
||||
if (definition.acquisitionMode !== 'user_acquired') continue;
|
||||
if (definition.provenance.source === 'bundled') continue;
|
||||
let installed = (this.options.installedDefinitions ?? []).some(({ id }) => id === definition.id);
|
||||
let unavailableReason: PluginUnavailableReasonCode | undefined;
|
||||
if (installedIds.has(definition.id)) {
|
||||
|
||||
Reference in New Issue
Block a user