feat: inject mode changes into engine conversation history
Engine.InjectMessage() appends messages to history without triggering a turn. When permission mode or incognito changes, the notification is injected as a user+assistant pair so the model sees it as context. Fixes: model now knows permissions changed and will retry tool calls instead of remembering old denials from previous mode.
This commit is contained in:
@@ -107,6 +107,13 @@ func (e *Engine) History() []message.Message {
|
||||
return e.history
|
||||
}
|
||||
|
||||
// InjectMessage appends a message to conversation history without triggering a turn.
|
||||
// Used for system notifications (permission mode changes, incognito toggles) that
|
||||
// the model should see as context in subsequent turns.
|
||||
func (e *Engine) InjectMessage(msg message.Message) {
|
||||
e.history = append(e.history, msg)
|
||||
}
|
||||
|
||||
// Usage returns cumulative token usage.
|
||||
func (e *Engine) Usage() message.Usage {
|
||||
return e.usage
|
||||
|
||||
Reference in New Issue
Block a user