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

Method executeUserPromptSubmitHooks

pkg/runtime/hooks.go:548–560  ·  view source on GitHub ↗

executeUserPromptSubmitHooks fires user_prompt_submit once per user message, after the prompt has been added to the session and before the first model call of the turn. A terminating verdict (decision="block" / continue=false / exit 2) stops the run loop; AdditionalContext is returned as a transient

(ctx context.Context, sess *session.Session, a *agent.Agent, prompt string, events EventSink)

Source from the content-addressed store, hash-verified

546// AdditionalContext is returned as a transient system message that
547// callers splice into the conversation for that turn only.
548func (r *LocalRuntime) executeUserPromptSubmitHooks(ctx context.Context, sess *session.Session, a *agent.Agent, prompt string, events EventSink) (stop bool, message string, contextMsgs []chat.Message) {
549 result := r.dispatchHook(ctx, a, hooks.EventUserPromptSubmit, &hooks.Input{
550 SessionID: sess.ID,
551 Prompt: prompt,
552 }, events)
553 if result == nil {
554 return false, "", nil
555 }
556 if !result.Allowed {
557 return true, result.Message, nil
558 }
559 return false, "", contextMessages(result)
560}
561
562// executeUserSteeringMessagesSubmitHooks fires
563// user_steering_messages_submit each time the runtime drains the

Callers 1

runStreamLoopMethod · 0.95

Calls 2

dispatchHookMethod · 0.95
contextMessagesFunction · 0.85

Tested by

no test coverage detected