| 580 | } |
| 581 | |
| 582 | func (rt *AgentTaskRuntime) DrainPendingNotifications(scopeID string) []map[string]any { |
| 583 | rt.mu.Lock() |
| 584 | defer rt.mu.Unlock() |
| 585 | notifications := rt.notifications[scopeID] |
| 586 | rt.notifications[scopeID] = nil |
| 587 | out := make([]map[string]any, 0, len(notifications)) |
| 588 | for _, notification := range notifications { |
| 589 | out = append(out, notification.ToMessage()) |
| 590 | } |
| 591 | return out |
| 592 | } |
| 593 | |
| 594 | func (rt *AgentTaskRuntime) consumeMatchingNotifications(scopeID string, taskIDs []string) { |
| 595 | rt.mu.Lock() |