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)
| 546 | // AdditionalContext is returned as a transient system message that |
| 547 | // callers splice into the conversation for that turn only. |
| 548 | func (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 |
no test coverage detected