MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / startNewTask

Method startNewTask

src/extension/api.ts:170–211  ·  view source on GitHub ↗
({
		configuration,
		text,
		images,
		newTab,
	}: {
		configuration: RooCodeSettings
		text?: string
		images?: string[]
		newTab?: boolean
	})

Source from the content-addressed store, hash-verified

168 }
169
170 public async startNewTask({
171 configuration,
172 text,
173 images,
174 newTab,
175 }: {
176 configuration: RooCodeSettings
177 text?: string
178 images?: string[]
179 newTab?: boolean
180 }) {
181 let provider: ClineProvider
182
183 if (newTab) {
184 await vscode.commands.executeCommand("workbench.action.files.revert")
185 await vscode.commands.executeCommand("workbench.action.closeAllEditors")
186
187 provider = await openClineInNewTab({ context: this.context, outputChannel: this.outputChannel })
188 this.registerListeners(provider)
189 } else {
190 await vscode.commands.executeCommand(`${Package.name}.SidebarProvider.focus`)
191
192 provider = this.sidebarProvider
193 }
194
195 await provider.removeClineFromStack()
196 await provider.postStateToWebview()
197 await provider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
198 await provider.postMessageToWebview({ type: "invoke", invoke: "newChat", text, images })
199
200 const options: CreateTaskOptions = {
201 consecutiveMistakeLimit: Number.MAX_SAFE_INTEGER,
202 }
203
204 const task = await provider.createTask(text, images, undefined, options, configuration)
205
206 if (!task) {
207 throw new Error("Failed to create task due to policy restrictions")
208 }
209
210 return task.taskId
211 }
212
213 public async resumeTask(taskId: string): Promise<void> {
214 await vscode.commands.executeCommand(`${Package.name}.SidebarProvider.focus`)

Callers 1

constructorMethod · 0.95

Calls 7

registerListenersMethod · 0.95
openClineInNewTabFunction · 0.90
executeCommandMethod · 0.80
removeClineFromStackMethod · 0.80
postMessageToWebviewMethod · 0.80
postStateToWebviewMethod · 0.65
createTaskMethod · 0.65

Tested by

no test coverage detected