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

Method sendMessage

src/extension/api.ts:257–274  ·  view source on GitHub ↗
(text?: string, images?: string[])

Source from the content-addressed store, hash-verified

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()

Callers 1

constructorMethod · 0.95

Calls 4

postMessageToWebviewMethod · 0.80
getCurrentTaskMethod · 0.65
logMethod · 0.65
submitUserMessageMethod · 0.65

Tested by

no test coverage detected