fix(plugins): load official hosted plugins from bundled resources

This commit is contained in:
2026-09-01 18:20:24 +08:00
parent 52e2a97a12
commit 1530ac7740
23 changed files with 835 additions and 48 deletions

View File

@@ -395,4 +395,58 @@ describe('effective plugin resolver', () => {
})).resolves.toMatchObject({ effectiveSkillIds: ['notes'], toolDefinitions: [], runtimePolicies: [] });
expect(refresh).not.toHaveBeenCalled();
});
it('materializes an acquired code-owned bundled hosted Plugin without Package Store bytes', async () => {
const bundled: CodingPluginDefinition = {
...serverDefinition,
id: 'makelore.web-search',
releaseId: '00000000-0000-4000-8000-000000000204',
provenance: { source: 'bundled', packageRoot: 'web-search' },
skills: [{
id: 'makelore-web-search',
entryPath: 'skills/makelore-web-search/SKILL.md',
grants: ['remote.read'],
}],
};
const getInstalled = vi.fn(async () => null);
const getInstalledRelease = vi.fn(async () => null);
const policy = currentPolicy();
policy.catalog.plugins[0] = { ...policy.catalog.plugins[0], plugin_id: bundled.id };
const effective = createEffectivePluginResolver({
definitions: [bundled],
getAccountBinding: () => binding,
getLibrary: vi.fn(async () => ({
...library(),
items: [{ ...library().items[0], pluginId: bundled.id }],
})),
packageStore: {
readInstalledIndex: vi.fn(async () => []),
getInstalled,
getInstalledRelease,
},
getEnabledPluginIds: vi.fn(async () => [bundled.id]),
policyClient: { getState: () => policy, refresh: vi.fn() },
});
await expect(effective.resolve({
projectId: 'project-a',
projectPath: 'C:/project-a',
assignedSkillIds: ['makelore-web-search'],
role: 'parent',
})).resolves.toMatchObject({
pluginReleaseIds: [bundled.releaseId],
effectiveSkillIds: ['makelore-web-search'],
skillEntries: [{
id: 'makelore-web-search',
entryPath: 'skills/makelore-web-search/SKILL.md',
}],
toolDefinitions: [{ name: 'remote_read' }],
unavailableReasons: [],
});
expect(getInstalled).not.toHaveBeenCalled();
await expect(effective.getSkillSources()).resolves.toEqual([]);
await expect(effective.getInstalledDefinition(bundled.id, bundled.releaseId))
.resolves.toMatchObject({ id: bundled.id, releaseId: bundled.releaseId });
expect(getInstalledRelease).not.toHaveBeenCalled();
});
});