executeOnUserInputHooks fires on_user_input when the runtime is about to wait for the user (tool confirmation, elicitation, max iterations, stream stopped). Resolves the agent itself so callsites in code paths without an agent handle (like the elicitation handler) stay short.
(ctx context.Context, sessionID, logContext string)
| 475 | // stream stopped). Resolves the agent itself so callsites in code paths |
| 476 | // without an agent handle (like the elicitation handler) stay short. |
| 477 | func (r *LocalRuntime) executeOnUserInputHooks(ctx context.Context, sessionID, logContext string) { |
| 478 | a := r.CurrentAgent() |
| 479 | if a == nil { |
| 480 | return |
| 481 | } |
| 482 | slog.DebugContext(ctx, "Executing on-user-input hooks", "context", logContext) |
| 483 | r.dispatchHook(ctx, a, hooks.EventOnUserInput, &hooks.Input{ |
| 484 | SessionID: sessionID, |
| 485 | }, nil) |
| 486 | } |
| 487 | |
| 488 | // executeBeforeCompactionHooks fires before a session compaction. The |
| 489 | // hook may veto the compaction (Decision: "block") or supply a custom |
no test coverage detected