add React() for emoji reactions on assistant messages

New method on the Core interface that appends a lightweight user
message to session history without triggering a model turn. The
agent sees the reaction as context on its next turn.

Used by the 9P react file: echo emoji > s/{id}/react
This commit is contained in:
Levi Neely 2026-07-27 15:19:33 +02:00
parent 273a31c5f1
commit 96a140a83c
2 changed files with 15 additions and 0 deletions

View File

@ -607,6 +607,15 @@ func (s *agent) InjectSystemEvent(content string) {
s.Queue("<detached-process-result>\n" + content + "\n</detached-process-result>")
}
func (s *agent) React(emoji string) {
if s.session == nil {
return
}
msg := "[reacted " + emoji + " to your previous response]"
s.session.appendUserMessage(msg)
s.emit(Event{Role: "user", Content: msg})
}
func (s *agent) AgentName() string {
v := s.agentName
s.log.Debug("AgentName() = %q", v)

View File

@ -167,6 +167,12 @@ type Core interface {
// context and emits it on the event bus. The agent sees it on its next
// turn; it appears in the chat log immediately.
InjectSystemEvent(content string)
// React records an emoji reaction to the most recent assistant response.
// The reaction is appended to session history as a lightweight user message
// and emitted to the chat bus, but does NOT trigger a new agent turn.
// The agent sees it as context on its next turn.
React(emoji string)
}
// DetachedInfo describes a detached process for external consumers.