(taskEvent TaskUiEvent)
| 587 | } |
| 588 | if coreEngine, ok := r.Engine.(*agent.CoreExecutionEngine); ok && coreEngine != nil && coreEngine.LastState != nil { |
| 589 | return coreEngine.LastState |
| 590 | } |
| 591 | return r.CurrentState |
| 592 | } |
| 593 | |
| 594 | func (r *UiRuntime) appendTranscriptEntry(kind, text string) { |
| 595 | if kind == "user" { |
| 596 | text = strings.TrimSpace(text) |
| 597 | } |
| 598 | if text == "" || strings.TrimSpace(text) == "" { |
| 599 | return |
| 600 | } |
| 601 | entries := r.Frame.TranscriptEntries |
| 602 | if len(entries) > 0 && entries[len(entries)-1]["kind"] == kind && kind == "assistant" { |
| 603 | entries[len(entries)-1]["text"] = stringFromAny(entries[len(entries)-1]["text"]) + text |
| 604 | r.Frame.TranscriptEntries = entries |
| 605 | return |
| 606 | } |
| 607 | r.Frame.TranscriptEntries = append(entries, map[string]any{"kind": kind, "text": text}) |
| 608 | } |
| 609 | |
| 610 | func (r *UiRuntime) recordTaskActivity(taskEvent TaskUiEvent) { |
| 611 | record := taskEvent.Record |
| 612 | activity := map[string]any{ |
| 613 | "task_id": taskEvent.TaskID, |
| 614 | "worker_label": firstNonEmpty(stringFromAny(record["worker_label"]), taskEvent.TaskID), |
no test coverage detected