MCPcopy Index your code
hub / github.com/docker/docker-agent / contextMessages

Function contextMessages

pkg/runtime/hooks.go:215–223  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

213// through [session.Session.GetMessages]. Returns nil for empty results
214// so callers can pass it straight to [slices.Concat] without a guard.
215func 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.
226func (r *LocalRuntime) executeSessionEndHooks(ctx context.Context, sess *session.Session, a *agent.Agent) {

Calls

no outgoing calls

Tested by

no test coverage detected