diff --git a/chat/bun.lock b/chat/bun.lock index e3687965..19ffb901 100644 --- a/chat/bun.lock +++ b/chat/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "chat", diff --git a/lib/httpapi/server.go b/lib/httpapi/server.go index b97f8da9..0a49f5b0 100644 --- a/lib/httpapi/server.go +++ b/lib/httpapi/server.go @@ -326,6 +326,7 @@ func (s *Server) StartSnapshotLoop(ctx context.Context) { // Send initial prompt when agent becomes stable for the first time if !s.conversation.InitialPromptSent && convertStatus(currentStatus) == AgentStatusStable { + if err := s.conversation.SendMessage(FormatMessage(s.agentType, s.conversation.InitialPrompt)...); err != nil { s.logger.Error("Failed to send initial prompt", "error", err) } else { diff --git a/lib/msgfmt/message_box.go b/lib/msgfmt/message_box.go index ce4eeeec..32aa55d7 100644 --- a/lib/msgfmt/message_box.go +++ b/lib/msgfmt/message_box.go @@ -70,8 +70,8 @@ func removeOpencodeMessageBox(msg string) string { // ┃ ┃ // We only check for the first ┃ and then an empty line above it - as sometimes the full input block does not load within a snapshot, // this leads to displaying a bunch of newlines. - for i := len(lines) - 1; i >= 1; i-- { - if strings.TrimSpace(lines[i-1]) == "" && + for i := len(lines) - 1; i >= 2; i-- { + if strings.ReplaceAll(lines[i-2], " ", "") != "┃┃" && strings.ReplaceAll(lines[i], " ", "") == "┃┃" { lines = lines[:i-1] break diff --git a/lib/msgfmt/testdata/format/opencode/partial_render/expected.txt b/lib/msgfmt/testdata/format/opencode/partial_render/expected.txt new file mode 100644 index 00000000..88828916 --- /dev/null +++ b/lib/msgfmt/testdata/format/opencode/partial_render/expected.txt @@ -0,0 +1,12 @@ + █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ + █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ + ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ + v0.6.8 + + /new new session ctrl+x n + /help show help ctrl+x h + /share share session ctrl+x s + /models list models ctrl+x m + + + Grok Code is free for a limited time \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/partial_render/msg.txt b/lib/msgfmt/testdata/format/opencode/partial_render/msg.txt new file mode 100644 index 00000000..5a5c02f0 --- /dev/null +++ b/lib/msgfmt/testdata/format/opencode/partial_render/msg.txt @@ -0,0 +1,604 @@ + █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ + █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ + ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ + v0.6.8 + + /new new session ctrl+x n + /help show help ctrl+x h + /share share session ctrl+x s + /models list models ctrl+x m + + + Grok Code is free for a limited time + + + ┃ ┃ + + ┃ ┃ + enter send + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + opencode v0.6.8 ~/Documents/work/agentapi tab ┃ BUILD AGENT \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/partial_render/user.txt b/lib/msgfmt/testdata/format/opencode/partial_render/user.txt new file mode 100644 index 00000000..e69de29b