Skip to content

Commit 7a9abbb

Browse files
35C4n0rjohnstcn
andauthored
feat: fix opencode message box parsing (#137)
Co-authored-by: Cian Johnston <public@cianjohnston.ie>
1 parent 0811a14 commit 7a9abbb

File tree

6 files changed

+620
-2
lines changed

6 files changed

+620
-2
lines changed

chat/bun.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"lockfileVersion": 1,
3+
"configVersion": 0,
34
"workspaces": {
45
"": {
56
"name": "chat",

lib/httpapi/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ func (s *Server) StartSnapshotLoop(ctx context.Context) {
326326

327327
// Send initial prompt when agent becomes stable for the first time
328328
if !s.conversation.InitialPromptSent && convertStatus(currentStatus) == AgentStatusStable {
329+
329330
if err := s.conversation.SendMessage(FormatMessage(s.agentType, s.conversation.InitialPrompt)...); err != nil {
330331
s.logger.Error("Failed to send initial prompt", "error", err)
331332
} else {

lib/msgfmt/message_box.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func removeOpencodeMessageBox(msg string) string {
7070
// ┃ ┃
7171
// 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,
7272
// this leads to displaying a bunch of newlines.
73-
for i := len(lines) - 1; i >= 1; i-- {
74-
if strings.TrimSpace(lines[i-1]) == "" &&
73+
for i := len(lines) - 1; i >= 2; i-- {
74+
if strings.ReplaceAll(lines[i-2], " ", "") != "┃┃" &&
7575
strings.ReplaceAll(lines[i], " ", "") == "┃┃" {
7676
lines = lines[:i-1]
7777
break
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
2+
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
3+
▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀
4+
v0.6.8
5+
6+
/new new session ctrl+x n
7+
/help show help ctrl+x h
8+
/share share session ctrl+x s
9+
/models list models ctrl+x m
10+
11+
12+
Grok Code is free for a limited time

0 commit comments

Comments
 (0)