Fix infinite iteration loop and update CLI to display outbound tool messages.
This commit is contained in:
parent
eee5b0c444
commit
89bff787fe
2 changed files with 23 additions and 2 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue