notifyError fires both notification(level=error) and on_error in one call. They're always emitted together (an error is always also a user-facing notification), so collapsing them into one call expresses intent more directly than firing two events at every callsite.
(ctx context.Context, a *agent.Agent, sessionID, message string)
| 249 | // user-facing notification), so collapsing them into one call expresses |
| 250 | // intent more directly than firing two events at every callsite. |
| 251 | func (r *LocalRuntime) notifyError(ctx context.Context, a *agent.Agent, sessionID, message string) { |
| 252 | r.notify(ctx, a, hooks.EventNotification, sessionID, "error", message) |
| 253 | r.notify(ctx, a, hooks.EventOnError, sessionID, "error", message) |
| 254 | } |
| 255 | |
| 256 | // notifyMaxIterations fires both notification(level=warning) and |
| 257 | // on_max_iterations. Same rationale as [notifyError]: the two are |
no test coverage detected