diff --git a/lib/msgfmt/message_box.go b/lib/msgfmt/message_box.go index a09a852..13efaf1 100644 --- a/lib/msgfmt/message_box.go +++ b/lib/msgfmt/message_box.go @@ -63,17 +63,17 @@ func removeCodexInputBox(msg string) string { func removeOpencodeMessageBox(msg string) string { lines := strings.Split(msg, "\n") - // Check the last 3 lines for // - // ┃ ┃ - // ┃ > ┃ - // ┃ ┃ - // 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 >= 2; i-- { - if strings.ReplaceAll(lines[i-2], " ", "") != "┃┃" && - strings.ReplaceAll(lines[i], " ", "") == "┃┃" { - lines = lines[:i-1] + // ┃ + // ┃ + // ┃ + // ┃ Build Anthropic Claude Sonnet 4 + // ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + // tab switch agent ctrl+p commands + // + for i := len(lines) - 1; i >= 4; i-- { + if strings.HasPrefix(strings.TrimSpace(lines[i]), "╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀") { + lines = lines[:i-4] break } } diff --git a/lib/msgfmt/testdata/format/opencode/first_message/expected.txt b/lib/msgfmt/testdata/format/opencode/first_message/expected.txt index 8882891..a2f238e 100644 --- a/lib/msgfmt/testdata/format/opencode/first_message/expected.txt +++ b/lib/msgfmt/testdata/format/opencode/first_message/expected.txt @@ -1,12 +1,10 @@ - █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ - █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ - ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ - v0.6.8 + ▄ + █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ + █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ + ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ + 1.0.98 - /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 + Commands ctrl+p + List sessions ctrl+x l + Switch model ctrl+x m + Switch agent tab \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/first_message/msg.txt b/lib/msgfmt/testdata/format/opencode/first_message/msg.txt index 7b797b1..5766f58 100644 --- a/lib/msgfmt/testdata/format/opencode/first_message/msg.txt +++ b/lib/msgfmt/testdata/format/opencode/first_message/msg.txt @@ -1,604 +1,25 @@ - █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ - █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ - ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ - 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 + ▄ + █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ + █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ + ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ + 1.0.98 - 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 + Commands ctrl+p + List sessions ctrl+x l + Switch model ctrl+x m + Switch agent tab + + + ┃ + ┃ + ┃ + ┃ Build Anthropic Claude Sonnet 4 + ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + tab switch agent ctrl+p commands + + + + + opencode v1.0.98 ~/Documents/work/agentapi \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/partial_render/expected.txt b/lib/msgfmt/testdata/format/opencode/partial_render/expected.txt deleted file mode 100644 index 8882891..0000000 --- a/lib/msgfmt/testdata/format/opencode/partial_render/expected.txt +++ /dev/null @@ -1,12 +0,0 @@ - █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ - █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ - ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ - 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 deleted file mode 100644 index 5a5c02f..0000000 --- a/lib/msgfmt/testdata/format/opencode/partial_render/msg.txt +++ /dev/null @@ -1,604 +0,0 @@ - █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ - █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ - ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ - 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 deleted file mode 100644 index e69de29..0000000 diff --git a/lib/msgfmt/testdata/format/opencode/second_message/expected.txt b/lib/msgfmt/testdata/format/opencode/second_message/expected.txt index 8767a12..401b193 100644 --- a/lib/msgfmt/testdata/format/opencode/second_message/expected.txt +++ b/lib/msgfmt/testdata/format/opencode/second_message/expected.txt @@ -1,14 +1,15 @@ - ┃ - ┃ Shell Check git remote URLs to identify repository - ┃ - ┃ $ git remote -v - ┃ origin https://github.com/35C4n0r/agentapi (fetch) - ┃ origin https://github.com/35C4n0r/agentapi (push) - ┃ upstream https://github.com/coder/agentapi.git (fetch) - ┃ upstream https://github.com/coder/agentapi.git (push) - ┃ - - - This is the 35C4n0r/agentapi repository, which is a fork of - coder/agentapi. - Build claude-sonnet-4-20250514 (09:19 PM) \ No newline at end of file + This is the agentapi repository. Based on the codebase structure and documentation, it's a Go HTTP API server that controls various coding agents (like Claude Code, Aider, Goose, etc.) through + terminal emulation. + + The main purpose of this repository is to: + + - Run coding agents in an in-memory terminal emulator + - Provide a unified HTTP API to interact with different agent types + - Parse terminal output into structured messages + - Include a Next.js web chat UI for interacting with agents + - Support multiple agent types with different message formats + + The project supports agents like Claude Code, Aider, Goose, Codex, Gemini, and others, providing a standardized interface to communicate with them through HTTP endpoints and a web-based chat + interface. + + Build claude-sonnet-4-20250514 \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/second_message/msg.txt b/lib/msgfmt/testdata/format/opencode/second_message/msg.txt index 2350003..1823b96 100644 --- a/lib/msgfmt/testdata/format/opencode/second_message/msg.txt +++ b/lib/msgfmt/testdata/format/opencode/second_message/msg.txt @@ -1,1185 +1,33 @@ - ┃ ┃ - ┃ Which repo is this ? ┃ - ┃ jkmr (09:19 PM) ┃ - ┃ ┃ + ┃ + ┃ Which repo is this ? + ┃ jkmr 2:19:24 PM + ┃ + + This is the agentapi repository. Based on the codebase structure and documentation, it's a Go HTTP API server that controls various coding agents (like Claude Code, Aider, Goose, etc.) through + terminal emulation. + + The main purpose of this repository is to: + + - Run coding agents in an in-memory terminal emulator + - Provide a unified HTTP API to interact with different agent types + - Parse terminal output into structured messages + - Include a Next.js web chat UI for interacting with agents + - Support multiple agent types with different message formats + + The project supports agents like Claude Code, Aider, Goose, Codex, Gemini, and others, providing a standardized interface to communicate with them through HTTP endpoints and a web-based chat + interface. + + Build claude-sonnet-4-20250514 + + + + ┃ - ┃ Shell Check git remote URLs to identify repository ┃ - ┃ $ git remote -v - ┃ origin https://github.com/35C4n0r/agentapi (fetch) - ┃ origin https://github.com/35C4n0r/agentapi (push) - ┃ upstream https://github.com/coder/agentapi.git (fetch) - ┃ upstream https://github.com/coder/agentapi.git (push) ┃ + ┃ Build Anthropic Claude Sonnet 4 + ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + tab switch agent ctrl+p commands - - This is the 35C4n0r/agentapi repository, which is a fork of - coder/agentapi. - Build claude-sonnet-4-20250514 (09:19 PM) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ┃ ┃ - ┃ > ┃ - ┃ ┃ - enter send Anthropic Claude Sonnet 4 - - opencode v0.6.8 ~/Documents/work/agentapi:feat-opencode tab ┃ BUILD AGENT \ No newline at end of file + opencode v1.0.98 ~/Documents/work/agentapi \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/thinking/expected.txt b/lib/msgfmt/testdata/format/opencode/thinking/expected.txt deleted file mode 100644 index cbc0e92..0000000 --- a/lib/msgfmt/testdata/format/opencode/thinking/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ - Generating... - Build claude-sonnet-4-20250514 (09:23 PM) \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/thinking/msg.txt b/lib/msgfmt/testdata/format/opencode/thinking/msg.txt deleted file mode 100644 index 57bc242..0000000 --- a/lib/msgfmt/testdata/format/opencode/thinking/msg.txt +++ /dev/null @@ -1,1185 +0,0 @@ - ┃ ┃ - ┃ Which repo is this ? ┃ - ┃ jkmr (09:23 PM) ┃ - ┃ ┃ - - - Generating... - Build claude-sonnet-4-20250514 (09:23 PM) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ┃ ┃ - ┃ > ┃ - ┃ ┃ - working esc interrupt Anthropic Claude Sonnet 4 - - opencode v0.6.8 ~/Documents/work/agentapi:feat-opencode tab ┃ BUILD AGENT \ No newline at end of file diff --git a/lib/msgfmt/testdata/format/opencode/thinking/user.txt b/lib/msgfmt/testdata/format/opencode/thinking/user.txt deleted file mode 100644 index c7d3776..0000000 --- a/lib/msgfmt/testdata/format/opencode/thinking/user.txt +++ /dev/null @@ -1 +0,0 @@ -Which repo is this ? \ No newline at end of file