fix(coding): remediate ML-07 plugin authority

This commit is contained in:
2026-08-27 20:40:58 +08:00
parent 9407c67df2
commit cf13aa7eba
29 changed files with 1008 additions and 214 deletions

View File

@@ -2,7 +2,6 @@ import path from 'node:path';
import { atomicWriteJson, readJsonFile, type JsonFileWriter } from '../coding-projects/atomic-json';
import { readCodingProjectConfigV2 } from '../coding-projects/project-config';
import {
BUNDLED_CODING_PLUGIN_DEFINITIONS,
DATA_SERVICE_PLUGIN_ID,
} from '../../shared/coding-plugins';
@@ -98,7 +97,7 @@ function knownPluginIdSet(
): Set<string> {
const source = typeof value === 'function'
? value()
: value ?? BUNDLED_CODING_PLUGIN_DEFINITIONS.map(({ id }) => id);
: value ?? [DATA_SERVICE_PLUGIN_ID];
return new Set(source.map((id) => id.trim()).filter(Boolean));
}
@@ -193,6 +192,7 @@ interface ReadSelectionResult {
export class ProjectPluginService {
private readonly mutationTails = new Map<string, Promise<unknown>>();
private readonly managedInputRevisions = new Map<string, number>();
private readonly legacySelections = new Map<string, readonly string[]>();
constructor(private readonly options: ProjectPluginServiceOptions = {}) {}
@@ -211,6 +211,7 @@ export class ProjectPluginService {
const result = await this.readFile(filePath);
const knownIds = knownPluginIdSet(this.options.knownPluginIds);
if (result.file) {
this.legacySelections.delete(project);
const enabledPluginIds = result.file.enabledPluginIds;
return {
projectPath: project,
@@ -225,7 +226,11 @@ export class ProjectPluginService {
};
}
const legacyProjectedPluginIds = await this.legacyProjectedPluginIds(project);
let legacyProjectedPluginIds = this.legacySelections.get(project);
if (!legacyProjectedPluginIds) {
legacyProjectedPluginIds = Object.freeze(await this.legacyProjectedPluginIds(project));
this.legacySelections.set(project, legacyProjectedPluginIds);
}
const enabledPluginIds = [...legacyProjectedPluginIds];
return {
projectPath: project,