(record *AgentTaskRecord, summary, result string)
| 727 | } |
| 728 | |
| 729 | func (rt *AgentTaskRuntime) enqueueLocked(record *AgentTaskRecord, summary, result string) { |
| 730 | notification := TaskNotification{ |
| 731 | NotificationID: uuid.NewString()[:12], |
| 732 | TaskID: record.TaskID, ParentTaskID: record.ParentTaskID, ParentScopeID: record.ParentScopeID, |
| 733 | Status: record.Status, Summary: summary, Result: result, |
| 734 | Usage: map[string]int{"input_tokens": record.InputTokens, "output_tokens": record.OutputTokens}, |
| 735 | } |
| 736 | rt.notifications[record.ParentScopeID] = append(rt.notifications[record.ParentScopeID], notification) |
| 737 | if rt.taskEventSink != nil { |
| 738 | eventType := "task_snapshot_updated" |
| 739 | if _, terminal := terminalTaskStatuses[record.Status]; terminal { |
| 740 | eventType = "task_summary_available" |
| 741 | } |
| 742 | rt.taskEventSink.EmitTaskEvent(TaskUIEvent{ |
| 743 | Type: eventType, |
| 744 | TaskID: record.TaskID, |
| 745 | Record: record.ToMap(), |
| 746 | Summary: summary, |
| 747 | ResultText: result, |
| 748 | }) |
| 749 | } |
| 750 | for _, waiter := range rt.waiters[record.TaskID] { |
| 751 | select { |
| 752 | case waiter <- struct{}{}: |
| 753 | default: |
| 754 | } |
| 755 | } |
| 756 | rt.waiters[record.TaskID] = nil |
| 757 | } |
| 758 | |
| 759 | func (rt *AgentTaskRuntime) getTaskLocked(taskID, scopeID string, forceScopeCheck bool) *AgentTaskRecord { |
| 760 | record := rt.records[taskID] |
no test coverage detected