(taskIDs []string, scopeID string)
| 688 | } |
| 689 | |
| 690 | func (rt *AgentTaskRuntime) snapshot(taskIDs []string, scopeID string) map[string]any { |
| 691 | rt.mu.Lock() |
| 692 | defer rt.mu.Unlock() |
| 693 | var tasks []map[string]any |
| 694 | var pending []string |
| 695 | var missing []string |
| 696 | for _, id := range taskIDs { |
| 697 | record := rt.getTaskLocked(id, scopeID, true) |
| 698 | if record == nil { |
| 699 | missing = append(missing, id) |
| 700 | continue |
| 701 | } |
| 702 | tasks = append(tasks, serializeTaskPayload(record.ToMap())) |
| 703 | if !isStableTask(record) { |
| 704 | pending = append(pending, id) |
| 705 | } |
| 706 | } |
| 707 | return map[string]any{ |
| 708 | "tasks": tasks, |
| 709 | "timeout": false, |
| 710 | "pending_task_ids": pending, |
| 711 | "missing_task_ids": missing, |
| 712 | "expired_task_ids": []string{}, |
| 713 | "inaccessible_task_ids": []string{}, |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | func isStableTask(record *AgentTaskRecord) bool { |
| 718 | if record == nil { |
no test coverage detected