executeSessionStartHooks fires session_start once at the top of RunStream and returns its AdditionalContext as transient system messages. The result is NOT persisted to the session: persisting would pollute the visible transcript and (because session_start fires after the user message has been added
(ctx context.Context, sess *session.Session, a *agent.Agent, events EventSink)
| 144 | // dispatch — there's nothing to "re-inject" because nothing was |
| 145 | // persisted in the first place. |
| 146 | func (r *LocalRuntime) executeSessionStartHooks(ctx context.Context, sess *session.Session, a *agent.Agent, events EventSink) []chat.Message { |
| 147 | return contextMessages(r.dispatchHook(ctx, a, hooks.EventSessionStart, &hooks.Input{ |
| 148 | SessionID: sess.ID, |
| 149 | Source: "startup", |
| 150 | }, events)) |
| 151 | } |
| 152 | |
| 153 | // executeTurnStartHooks fires turn_start before each model call and |
| 154 | // returns its AdditionalContext as transient system messages. Like |
no test coverage detected