The merge introduces a research tool surface gating mechanism: shared availability helpers in core and engine, applied to the executor and triage agent so research prompts and tool exposure are gated behind experimental-feature flags, with tests covering the new logic. Fusion-Task-Id: FN-3706
25 lines
717 B
TypeScript
25 lines
717 B
TypeScript
import type { Settings } from "./types.js";
|
|
|
|
const LEGACY_EXPERIMENTAL_FEATURE_ALIASES: Record<string, string> = {
|
|
devServer: "devServerView",
|
|
};
|
|
|
|
export function isExperimentalFeatureEnabled(
|
|
settings: Pick<Settings, "experimentalFeatures"> | undefined,
|
|
key: string,
|
|
): boolean {
|
|
const features = settings?.experimentalFeatures;
|
|
if (!features) return false;
|
|
|
|
const canonicalKey = LEGACY_EXPERIMENTAL_FEATURE_ALIASES[key] ?? key;
|
|
if (features[canonicalKey] === true) return true;
|
|
|
|
for (const [legacyKey, aliasCanonical] of Object.entries(LEGACY_EXPERIMENTAL_FEATURE_ALIASES)) {
|
|
if (aliasCanonical === canonicalKey && features[legacyKey] === true) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|