diff --git a/cmd/picoclaw/internal/agent/helpers.go b/cmd/picoclaw/internal/agent/helpers.go index 9f234bb4e..2d6fc4c48 100644 --- a/cmd/picoclaw/internal/agent/helpers.go +++ b/cmd/picoclaw/internal/agent/helpers.go @@ -97,6 +97,18 @@ func interactiveMode(agentLoop *agent.AgentLoop, sessionKey string) { } defer rl.Close() + // Listen for outbound messages on the bus (e.g. from the 'message' tool) + // and print them to the console. + go func() { + for outbound := range agentLoop.GetBus().OutboundChan() { + if outbound.Content != "" { + fmt.Printf("\n%s %s\n", internal.Logo, outbound.Content) + // Re-print the prompt to keep it at the bottom + rl.Refresh() + } + } + }() + for { line, err := rl.Readline() if err != nil { @@ -130,6 +142,15 @@ func interactiveMode(agentLoop *agent.AgentLoop, sessionKey string) { } func simpleInteractiveMode(agentLoop *agent.AgentLoop, sessionKey string) { + // Listen for outbound messages on the bus + go func() { + for outbound := range agentLoop.GetBus().OutboundChan() { + if outbound.Content != "" { + fmt.Printf("\n%s %s\n\n%s You: ", internal.Logo, outbound.Content, internal.Logo) + } + } + }() + reader := bufio.NewReader(os.Stdin) for { fmt.Print(fmt.Sprintf("%s You: ", internal.Logo)) diff --git a/pkg/agent/loop_test.go b/pkg/agent/loop_test.go index 90025df3e..b22a5aebc 100644 --- a/pkg/agent/loop_test.go +++ b/pkg/agent/loop_test.go @@ -3693,8 +3693,8 @@ func TestProcessMessage_MessageToolPublishesOutboundWithTurnMetadata(t *testing. if err != nil { t.Fatalf("processMessage() error = %v", err) } - if response == "" { - t.Fatal("expected processMessage() to return a final loop response") + if response != "" { + t.Fatalf("expected empty loop response when tool handles delivery, got %q", response) } select {