(
text?: string,
images?: string[],
parentTask?: Task,
options: CreateTaskOptions = {},
configuration: RooCodeSettings = {},
)
| 3019 | // of tasks, each one being a sub task of the previous one until the main |
| 3020 | // task is finished. |
| 3021 | public async createTask( |
| 3022 | text?: string, |
| 3023 | images?: string[], |
| 3024 | parentTask?: Task, |
| 3025 | options: CreateTaskOptions = {}, |
| 3026 | configuration: RooCodeSettings = {}, |
| 3027 | ): Promise<Task> { |
| 3028 | if (configuration) { |
| 3029 | await this.setValues(configuration) |
| 3030 | |
| 3031 | if (configuration.allowedCommands) { |
| 3032 | await vscode.workspace |
| 3033 | .getConfiguration(Package.name) |
| 3034 | .update("allowedCommands", configuration.allowedCommands, vscode.ConfigurationTarget.Global) |
| 3035 | } |
| 3036 | |
| 3037 | if (configuration.deniedCommands) { |
| 3038 | await vscode.workspace |
| 3039 | .getConfiguration(Package.name) |
| 3040 | .update("deniedCommands", configuration.deniedCommands, vscode.ConfigurationTarget.Global) |
| 3041 | } |
| 3042 | |
| 3043 | if (configuration.commandExecutionTimeout !== undefined) { |
| 3044 | await vscode.workspace |
| 3045 | .getConfiguration(Package.name) |
| 3046 | .update( |
| 3047 | "commandExecutionTimeout", |
| 3048 | configuration.commandExecutionTimeout, |
| 3049 | vscode.ConfigurationTarget.Global, |
| 3050 | ) |
| 3051 | } |
| 3052 | |
| 3053 | if (configuration.currentApiConfigName) { |
| 3054 | await this.setProviderProfile(configuration.currentApiConfigName) |
| 3055 | } |
| 3056 | |
| 3057 | // Register custom modes so the CustomModesManager knows about them. |
| 3058 | // setValues writes to global state, but the manager overwrites that |
| 3059 | // when it merges .roomodes + global settings on refresh. Persisting |
| 3060 | // via updateCustomMode ensures modes survive the merge cycle. |
| 3061 | if (configuration.customModes?.length) { |
| 3062 | for (const mode of configuration.customModes) { |
| 3063 | await this.customModesManager.updateCustomMode(mode.slug, mode) |
| 3064 | } |
| 3065 | } |
| 3066 | } |
| 3067 | |
| 3068 | const { |
| 3069 | apiConfiguration, |
| 3070 | enableCheckpoints, |
| 3071 | checkpointTimeout, |
| 3072 | experiments, |
| 3073 | organizationAllowList, |
| 3074 | diffFuzzyThreshold, |
| 3075 | } = await this.getState() |
| 3076 | |
| 3077 | // Single-open-task invariant: always enforce for user-initiated top-level tasks |
| 3078 | if (!parentTask) { |
no test coverage detected