(observations []map[string]any, limit int)
| 448 | } |
| 449 | |
| 450 | func 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 | |
| 473 | func (s *SubAgent) buildSystemPrompt() string { |
| 474 | if override, _ := s.ExtraContext["system_prompt_override"].(string); strings.TrimSpace(override) != "" { |
no test coverage detected