From 96a140a83c21143ee489f99c1b5c8c370bd42f99 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Mon, 27 Jul 2026 15:19:33 +0200 Subject: [PATCH] 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 --- pkg/agent/core.go | 9 +++++++++ pkg/agent/types.go | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/pkg/agent/core.go b/pkg/agent/core.go index 1e19dcb..baaf280 100644 --- a/pkg/agent/core.go +++ b/pkg/agent/core.go @@ -607,6 +607,15 @@ func (s *agent) InjectSystemEvent(content string) { s.Queue("\n" + content + "\n") } +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) diff --git a/pkg/agent/types.go b/pkg/agent/types.go index 2192968..d6e2367 100644 --- a/pkg/agent/types.go +++ b/pkg/agent/types.go @@ -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.