MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / latestAssistantText

Function latestAssistantText

agent/subagent.go:429–448  ·  view source on GitHub ↗
(messages []map[string]any)

Source from the content-addressed store, hash-verified

427}
428
429func latestAssistantText(messages []map[string]any) string {
430 for i := len(messages) - 1; i >= 0; i-- {
431 message := messages[i]
432 if stringFromAny(message["role"]) != "assistant" {
433 continue
434 }
435 var parts []string
436 for _, block := range contentBlocks(message["content"]) {
437 if stringFromAny(block["type"]) == "text" {
438 if text := strings.TrimSpace(stringFromAny(block["text"])); text != "" {
439 parts = append(parts, text)
440 }
441 }
442 }
443 if len(parts) > 0 {
444 return strings.TrimSpace(strings.Join(parts, "\n\n"))
445 }
446 }
447 return ""
448}
449
450func formatRecentSubagentObservations(observations []map[string]any, limit int) []string {
451 if limit <= 0 || len(observations) == 0 {

Callers 1

partialTimeoutTextMethod · 0.85

Calls 2

stringFromAnyFunction · 0.70
contentBlocksFunction · 0.70

Tested by

no test coverage detected