Roo-Code/src/shared/experiments.ts
Ruslan Andreev 0ead5bb238 feat: introduce subagent functionality with tool integration
- Added new tool parameters for subagent including "description" and "subagent_type".
- Implemented filtering logic to include/exclude the subagent tool based on experiment settings.
- Enhanced localization for subagent tool in multiple languages.
- Updated UI components to display subagent status and progress.
- Introduced subagent-specific tool restrictions in the backend logic.

This commit lays the groundwork for running subagents in the background for research or sub-tasks, enhancing the overall functionality of the toolset.
2026-03-02 10:51:13 +03:00

37 lines
1.3 KiB
TypeScript

import type { AssertEqual, Equals, Keys, Values, ExperimentId, Experiments } from "@roo-code/types"
export const EXPERIMENT_IDS = {
PREVENT_FOCUS_DISRUPTION: "preventFocusDisruption",
IMAGE_GENERATION: "imageGeneration",
RUN_SLASH_COMMAND: "runSlashCommand",
CUSTOM_TOOLS: "customTools",
SUBAGENT: "subagent",
} as const satisfies Record<string, ExperimentId>
type _AssertExperimentIds = AssertEqual<Equals<ExperimentId, Values<typeof EXPERIMENT_IDS>>>
type ExperimentKey = Keys<typeof EXPERIMENT_IDS>
interface ExperimentConfig {
enabled: boolean
}
export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
PREVENT_FOCUS_DISRUPTION: { enabled: false },
IMAGE_GENERATION: { enabled: false },
RUN_SLASH_COMMAND: { enabled: false },
CUSTOM_TOOLS: { enabled: false },
SUBAGENT: { enabled: false },
}
export const experimentDefault = Object.fromEntries(
Object.entries(experimentConfigsMap).map(([_, config]) => [
EXPERIMENT_IDS[_ as keyof typeof EXPERIMENT_IDS] as ExperimentId,
config.enabled,
]),
) as Record<ExperimentId, boolean>
export const experiments = {
get: (id: ExperimentKey): ExperimentConfig | undefined => experimentConfigsMap[id],
isEnabled: (experimentsConfig: Experiments, id: ExperimentId) => experimentsConfig[id] ?? experimentDefault[id],
} as const