fix(plugins): make official plugins project-wide

This commit is contained in:
2026-09-05 13:19:13 +08:00
parent 5e0a091955
commit e0de7aa28c
6 changed files with 121 additions and 17 deletions

View File

@@ -7,6 +7,8 @@ import {
} from '../../electron/coding-plugins/effective-resolver';
import {
DATA_SERVICE_PLUGIN_DEFINITION,
GAME_RESOURCE_BUNDLED_RELEASE_ID,
GAME_RESOURCE_PLUGIN_ID,
PROJECT_SCAFFOLD_BUNDLED_RELEASE_ID,
PROJECT_SCAFFOLD_PLUGIN_ID,
type CodingPluginDefinition,
@@ -450,11 +452,11 @@ describe('effective plugin resolver', () => {
expect(refresh).not.toHaveBeenCalled();
});
it('materializes an acquired code-owned bundled hosted Plugin without Package Store bytes', async () => {
it('materializes an acquired code-owned bundled hosted Plugin without Package Store bytes or Agent assignment', async () => {
const bundled: CodingPluginDefinition = {
...serverDefinition,
id: 'makelore.game-resource',
releaseId: '00000000-0000-4000-8000-000000000105',
id: GAME_RESOURCE_PLUGIN_ID,
releaseId: GAME_RESOURCE_BUNDLED_RELEASE_ID,
provenance: { source: 'bundled', packageRoot: 'game-resource' },
skills: [{
id: 'game-resource',
@@ -485,7 +487,7 @@ describe('effective plugin resolver', () => {
await expect(effective.resolve({
projectId: 'project-a',
projectPath: 'C:/project-a',
assignedSkillIds: ['game-resource'],
assignedSkillIds: [],
role: 'parent',
})).resolves.toMatchObject({
pluginReleaseIds: [bundled.releaseId],
@@ -504,6 +506,38 @@ describe('effective plugin resolver', () => {
expect(getInstalledRelease).not.toHaveBeenCalled();
});
it('materializes the system-included Data Service after project enablement without Agent assignment', async () => {
const policy = currentPolicy();
policy.catalog.plugins[0] = {
...policy.catalog.plugins[0],
plugin_id: DATA_SERVICE_PLUGIN_DEFINITION.id,
capabilities: DATA_SERVICE_PLUGIN_DEFINITION.operations.map(({ capabilityId, operation }) => ({
capability_id: capabilityId,
operations: [{
operation,
billing: { mode: 'included' as const, entitlement_scope: null, notice: 'Included' },
}],
})),
};
const effective = createEffectivePluginResolver({
definitions: [DATA_SERVICE_PLUGIN_DEFINITION],
getAccountBinding: () => binding,
getEnabledPluginIds: vi.fn(async () => [DATA_SERVICE_PLUGIN_DEFINITION.id]),
policyClient: { getState: () => policy, refresh: vi.fn() },
});
await expect(effective.resolve({
projectId: 'project-a',
projectPath: 'C:/project-a',
assignedSkillIds: [],
role: 'parent',
})).resolves.toMatchObject({
effectiveSkillIds: ['data-service'],
skillEntries: [{ id: 'data-service', entryPath: 'skills/data-service/SKILL.md' }],
unavailableReasons: [],
});
});
it('materializes the project-wide Scaffold Skill after project enablement without Agent assignment', async () => {
const scaffoldLibrary = {
...library(),