text string
}{
{
- name: "reply as it is",
- event: Event{Kind: "reply", Text: "Done."},
- text: "Done.",
+ name: "reply as it is",
+ event: Event{
+ Kind: "reply",
+ Text: "Done.",
+ },
+ text: "Done.",
},
{
- name: "own user message not shown",
- event: Event{Kind: "user", Text: "typed", Source: terminalSource},
- text: "",
+ name: "own user message not shown",
+ event: Event{
+ Kind: "user",
+ Text: "typed",
+ Source: terminalSource,
+ },
+ text: "",
},
{
- name: "user message of another source marked",
- event: Event{Kind: "user", Text: "from the phone", Source: "telegram"},
- text: "[telegram] from the phone",
+ name: "user message of another source marked",
+ event: Event{
+ Kind: "user",
+ Text: "from the phone",
+ Source: "telegram",
+ },
+ text: "[telegram] from the phone",
},
{
- name: "start of a subagent",
- event: Event{Kind: "subagent", Text: "GreenOtter"},
- text: "[GreenOtter] started",
+ name: "start of a subagent",
+ event: Event{
+ Kind: "subagent",
+ Text: "GreenOtter",
+ },
+ text: "[GreenOtter] started",
},
{
- name: "report of a subagent whole",
- event: Event{Kind: "work", Text: "[GreenOtter]\nThere are 3 files.\n\nFull chat: zoom(\"GreenOtter\")", Source: "GreenOtter", Status: subagentFinished},
- text: "[GreenOtter]\nThere are 3 files.\n\nFull chat: zoom(\"GreenOtter\")",
+ name: "report of a subagent whole",
+ event: Event{
+ Kind: "work",
+ Text: "[GreenOtter]\nThere are 3 files.\n\nFull chat: zoom(\"GreenOtter\")",
+ Source: "GreenOtter",
+ Status: subagentFinished,
+ },
+ text: "[GreenOtter]\nThere are 3 files.\n\nFull chat: zoom(\"GreenOtter\")",
},
{
- name: "long result cut",
- event: Event{Kind: "echo", Text: strings.Repeat("line\n", 12)},
- text: "[result] " + strings.Repeat("line\n", 9) + "line\n[2 more lines]",
+ name: "long result cut",
+ event: Event{
+ Kind: "echo",
+ Text: strings.Repeat("line\n", 12),
+ },
+ text: "[result] " + strings.Repeat("line\n", 9) + "line\n[2 more lines]",
},
}
Kind: "work",
Text: "[BlueBird]\n" + text,
})
+
require.Equal(t, text+"\n[BlueBird]\n"+text+"\n", out.String())
}
Kind: "reply",
Text: text,
})
+
require.Zero(t, terminalColumns(out))
contents, err := os.ReadFile(out.Name())
Event{Kind: "busy"},
Event{Kind: "idle"},
)
+
require.Equal(t, "[working]\n\x1b[1mfirst next\x1b[0m\n\x1b[1mlast\x1b[0m\n[BlueBird]\n\x1b[1mReport\x1b[0m\n"+
"[tool] **raw tool**\n[result] **raw result**\n[error] **raw error**\n**raw notice**\n[telegram] **raw input**\n"+
"[connected to **raw agent**]\n[BlueBird] started\n[working]\n[done]\n> ", out.String())
Kind: "reply",
Text: strings.Repeat("a", 81),
})
+
require.Equal(t, strings.Repeat("a", 80)+"\na\n> ", out.String())
require.NoError(t, unix.IoctlSetWinsize(fd, unix.TIOCSWINSZ, &unix.Winsize{Col: 40}))
require.Equal(t, 40, terminalColumns(&out))
Text: "Idle error",
},
)
+
require.Equal(t, "[connected to Example]\n> "+
"\r\x1b[2KIdle notice\n> "+
"\r\x1b[2K\x1b[1mIdle report\x1b[0m\n> "+
Text: "Idle again",
},
)
+
require.Equal(t, "[connected to Example]\nIdle notice\n[working]\nBusy notice\n**Answer**\n[done]\nIdle again\n", out.String())
}