MCPcopy Create free account
hub / github.com/astercloud/aster / handleMessage

Method handleMessage

pkg/desktop/desktop.go:320–345  ·  view source on GitHub ↗

handleMessage handles messages from the frontend

(msg *FrontendMessage)

Source from the content-addressed store, hash-verified

318
319// handleMessage handles messages from the frontend
320func (a *App) handleMessage(msg *FrontendMessage) (*BackendResponse, error) {
321 switch msg.Type {
322 case MsgTypeChat:
323 return a.handleChat(msg)
324 case MsgTypeCancel:
325 return a.handleCancel(msg)
326 case MsgTypeApproval:
327 return a.handleApproval(msg)
328 case MsgTypeGetStatus:
329 return a.handleGetStatus(msg)
330 case MsgTypeGetHistory:
331 return a.handleGetHistory(msg)
332 case MsgTypeClearHistory:
333 return a.handleClearHistory(msg)
334 case MsgTypeSetConfig:
335 return a.handleSetConfig(msg)
336 case MsgTypeGetConfig:
337 return a.handleGetConfig(msg)
338 default:
339 return &BackendResponse{
340 ID: msg.ID,
341 Success: false,
342 Error: fmt.Sprintf("unknown message type: %s", msg.Type),
343 }, nil
344 }
345}
346
347func (a *App) handleChat(msg *FrontendMessage) (*BackendResponse, error) {
348 var payload ChatPayload

Callers 1

Calls 8

handleChatMethod · 0.95
handleCancelMethod · 0.95
handleApprovalMethod · 0.95
handleGetStatusMethod · 0.95
handleGetHistoryMethod · 0.95
handleClearHistoryMethod · 0.95
handleSetConfigMethod · 0.95
handleGetConfigMethod · 0.95

Tested by 1