(text?: string, images?: string[])
| 255 | } |
| 256 | |
| 257 | public async sendMessage(text?: string, images?: string[]) { |
| 258 | const currentTask = this.sidebarProvider.getCurrentTask() |
| 259 | |
| 260 | // In headless/sandbox flows the webview may not be launched, so routing |
| 261 | // through invoke=sendMessage drops the message. Deliver directly to the |
| 262 | // task ask-response channel instead. |
| 263 | if (!this.sidebarProvider.viewLaunched) { |
| 264 | if (!currentTask) { |
| 265 | this.log("[API#sendMessage] no current task in headless mode; message dropped") |
| 266 | return |
| 267 | } |
| 268 | |
| 269 | await currentTask.submitUserMessage(text ?? "", images) |
| 270 | return |
| 271 | } |
| 272 | |
| 273 | await this.sidebarProvider.postMessageToWebview({ type: "invoke", invoke: "sendMessage", text, images }) |
| 274 | } |
| 275 | |
| 276 | public deleteQueuedMessage(messageId: string) { |
| 277 | const currentTask = this.sidebarProvider.getCurrentTask() |
no test coverage detected