mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
refactor(experiments): improve type safety for experiment configuration
Change ExperimentId type to be value-based rather than key-based Make experiment record types more strict with proper typing Pass full experiment config object instead of single boolean flag Update type definitions and usages across codebase
This commit is contained in:
@@ -45,6 +45,7 @@ import {
|
||||
experimentConfigs,
|
||||
experiments as Experiments,
|
||||
experimentDefault,
|
||||
ExperimentId,
|
||||
} from "../../shared/experiments"
|
||||
import { CustomSupportPrompts, supportPrompt } from "../../shared/support-prompt"
|
||||
|
||||
@@ -360,7 +361,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
task,
|
||||
images,
|
||||
undefined,
|
||||
Experiments.isEnabled(experiments, EXPERIMENT_IDS.DIFF_STRATEGY),
|
||||
experiments,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -388,7 +389,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
undefined,
|
||||
undefined,
|
||||
historyItem,
|
||||
Experiments.isEnabled(experiments, EXPERIMENT_IDS.DIFF_STRATEGY),
|
||||
experiments,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1222,7 +1223,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
const updatedExperiments = {
|
||||
...((await this.getGlobalState("experiments")) ?? experimentDefault),
|
||||
...message.values,
|
||||
}
|
||||
} as Record<ExperimentId, boolean>
|
||||
|
||||
await this.updateGlobalState("experiments", updatedExperiments)
|
||||
|
||||
@@ -2132,7 +2133,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
this.getGlobalState("enhancementApiConfigId") as Promise<string | undefined>,
|
||||
this.getGlobalState("autoApprovalEnabled") as Promise<boolean | undefined>,
|
||||
this.customModesManager.getCustomModes(),
|
||||
this.getGlobalState("experiments") as Promise<Record<string, boolean> | undefined>,
|
||||
this.getGlobalState("experiments") as Promise<Record<ExperimentId, boolean> | undefined>,
|
||||
])
|
||||
|
||||
let apiProvider: ApiProvider
|
||||
|
||||
Reference in New Issue
Block a user