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

Method enqueueLocked

agent/task_runtime.go:729–757  ·  view source on GitHub ↗
(record *AgentTaskRecord, summary, result string)

Source from the content-addressed store, hash-verified

727}
728
729func (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
759func (rt *AgentTaskRuntime) getTaskLocked(taskID, scopeID string, forceScopeCheck bool) *AgentTaskRecord {
760 record := rt.records[taskID]

Callers 5

ImportSnapshotMethod · 0.95
StopTaskMethod · 0.95
finishMethod · 0.95
finishReusableIdleMethod · 0.95
scheduleIdleTTLLockedMethod · 0.95

Calls 2

EmitTaskEventMethod · 0.65
ToMapMethod · 0.45

Tested by

no test coverage detected