| 317 | } |
| 318 | |
| 319 | func (r *UiRuntime) ApplyUIEvent(event UiEvent) { |
| 320 | switch event.Type { |
| 321 | case "assistant_delta": |
| 322 | r.appendTranscriptEntry("assistant", event.Content) |
| 323 | r.markDirty() |
| 324 | case "thinking_delta": |
| 325 | if event.Content != "" { |
| 326 | r.Frame.InputPlaceholder = "Agent is thinking..." |
| 327 | r.markDirty() |
| 328 | } |
| 329 | case "tool_call_started": |
| 330 | r.recordInlineActivity("tool_call", FormatToolCallEntry(event)) |
| 331 | case "tool_call_finished": |
| 332 | r.recordInlineActivity("tool_result", FormatToolResultEntry(event)) |
| 333 | case "ui_warning": |
| 334 | if event.Content != "" { |
| 335 | r.Frame.Warnings = append(r.Frame.Warnings, event.Content) |
| 336 | r.markDirty() |
| 337 | } |
| 338 | case "ui_fatal": |
| 339 | if event.Content != "" { |
| 340 | r.Frame.Errors = append(r.Frame.Errors, event.Content) |
| 341 | r.markDirty() |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | func (r *UiRuntime) DrainTaskEvents() { |
| 347 | updated := false |