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

Function formatRecentSubagentObservations

agent/subagent.go:450–471  ·  view source on GitHub ↗
(observations []map[string]any, limit int)

Source from the content-addressed store, hash-verified

448}
449
450func formatRecentSubagentObservations(observations []map[string]any, limit int) []string {
451 if limit <= 0 || len(observations) == 0 {
452 return nil
453 }
454 start := len(observations) - limit
455 if start < 0 {
456 start = 0
457 }
458 out := make([]string, 0, len(observations)-start)
459 for _, observation := range observations[start:] {
460 toolName := "tool"
461 if tc, ok := observation["call"].(coretools.ToolCall); ok && tc.Name != "" {
462 toolName = tc.Name
463 }
464 content := strings.TrimSpace(stringFromAny(observation["content"]))
465 if content == "" {
466 content = "(empty result)"
467 }
468 out = append(out, fmt.Sprintf("- %s: %s", toolName, TruncateResult(strings.Split(content, "\n")[0], 240)))
469 }
470 return out
471}
472
473func (s *SubAgent) buildSystemPrompt() string {
474 if override, _ := s.ExtraContext["system_prompt_override"].(string); strings.TrimSpace(override) != "" {

Callers 1

partialTimeoutTextMethod · 0.85

Calls 2

TruncateResultFunction · 0.85
stringFromAnyFunction · 0.70

Tested by

no test coverage detected