contextMessages converts a context-providing hook's AdditionalContext into a one-element transient system-message slice ready to thread through [session.Session.GetMessages]. Returns nil for empty results so callers can pass it straight to [slices.Concat] without a guard.
(result *hooks.Result)
| 213 | // through [session.Session.GetMessages]. Returns nil for empty results |
| 214 | // so callers can pass it straight to [slices.Concat] without a guard. |
| 215 | func contextMessages(result *hooks.Result) []chat.Message { |
| 216 | if result == nil || result.AdditionalContext == "" { |
| 217 | return nil |
| 218 | } |
| 219 | return []chat.Message{{ |
| 220 | Role: chat.MessageRoleSystem, |
| 221 | Content: result.AdditionalContext, |
| 222 | }} |
| 223 | } |
| 224 | |
| 225 | // executeSessionEndHooks fires session_end when the run loop exits. |
| 226 | func (r *LocalRuntime) executeSessionEndHooks(ctx context.Context, sess *session.Session, a *agent.Agent) { |
no outgoing calls
no test coverage detected