Roo-Code/src/shared/__tests__/experiments.spec.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

51 lines
1.6 KiB
TypeScript

// npx vitest run src/shared/__tests__/experiments.spec.ts
import type { ExperimentId } from "@roo-code/types"
import { EXPERIMENT_IDS, experimentConfigsMap, experiments as Experiments } from "../experiments"
describe("experiments", () => {
describe("PREVENT_FOCUS_DISRUPTION", () => {
it("is configured correctly", () => {
expect(EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION).toBe("preventFocusDisruption")
expect(experimentConfigsMap.PREVENT_FOCUS_DISRUPTION).toMatchObject({
enabled: false,
})
})
})
describe("isEnabled", () => {
it("returns false when experiment is not enabled", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: false,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
subagent: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(false)
})
it("returns true when experiment is enabled", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: true,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
subagent: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(true)
})
it("returns false when experiment is not present", () => {
const experiments: Record<ExperimentId, boolean> = {
preventFocusDisruption: false,
imageGeneration: false,
runSlashCommand: false,
customTools: false,
subagent: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(false)
})
})
})