executeTurnStartHooks fires turn_start before each model call and returns its AdditionalContext as transient system messages. Like session_start the result is never persisted, but turn_start runs every iteration so its content is recomputed each turn — the right semantics for fast-changing context l
(ctx context.Context, sess *session.Session, a *agent.Agent, events EventSink)
| 157 | // semantics for fast-changing context like the current date or the |
| 158 | // contents of a prompt file the user might be editing mid-session. |
| 159 | func (r *LocalRuntime) executeTurnStartHooks(ctx context.Context, sess *session.Session, a *agent.Agent, events EventSink) []chat.Message { |
| 160 | return contextMessages(r.dispatchHook(ctx, a, hooks.EventTurnStart, &hooks.Input{ |
| 161 | SessionID: sess.ID, |
| 162 | }, events)) |
| 163 | } |
| 164 | |
| 165 | // Reason values reported in [hooks.Input.Reason] when [hooks.EventTurnEnd] |
| 166 | // fires. The runtime guarantees that turn_end runs once per turn that |
no test coverage detected