xonecas.io
60255
Zn

Zoea-Nova / commit 3a95faa

fix: tests

xonecas2026-02-09 3a95faa5f99d5829c413aa776be2906c8a4516d6 parent 3dd1fc3

228 files changed

This diff is too big to show in full. The first 1000 lines are below, and every file is listed with its counts.

internal/constants/constants.go+3−1
@@ -24,7 +24,9 @@ Context is limited - use search tools for older information.
2424 Use session_id in ALL game tools that require authentication. Your session_id is shown in the Account Details section above.
2525
2626 ### EVERY TURN:
27-The game runs on 10-second ticks. Plan ahead. Use your tool calls efficiently.`
27+The game runs on 10-second ticks. Plan ahead. Use your tool calls efficiently.
28+
29+Check get_notifications regularly for game events and important updates.`
2830
2931 // BroadcastSectionTemplate is the template for commander broadcasts.
3032 // Placeholder: {broadcast_content}
internal/core/account_test.go+12−2
@@ -403,14 +403,24 @@ func TestMysis_MultipleMyses_SeparateAccounts(t *testing.T) {
403403 s, cleanup := setupAccountTest(t)
404404 defer cleanup()
405405
406+ // Create actual mysis records in database
407+ stored1, err := s.CreateMysis("mysis1", "mock", "test-model", 0.7)
408+ if err != nil {
409+ t.Fatalf("CreateMysis(mysis1) error: %v", err)
410+ }
411+ stored2, err := s.CreateMysis("mysis2", "mock", "test-model", 0.7)
412+ if err != nil {
413+ t.Fatalf("CreateMysis(mysis2) error: %v", err)
414+ }
415+
406416 m1 := &Mysis{
407- id: "mysis-1",
417+ id: stored1.ID,
408418 name: "mysis1",
409419 store: s,
410420 }
411421
412422 m2 := &Mysis{
413- id: "mysis-2",
423+ id: stored2.ID,
414424 name: "mysis2",
415425 store: s,
416426 }
internal/core/mysis.go+22−6
@@ -547,13 +547,10 @@ func (m *Mysis) Stop() error {
547547 // The source parameter indicates whether this is a direct or broadcast message.
548548 func (m *Mysis) SendMessageFrom(content string, source store.MemorySource, senderID string) error {
549549 a := m
550- a.turnMu.Lock()
551- defer a.turnMu.Unlock()
552550
551+ // Check state BEFORE storing message to fail fast if mysis can't accept messages
553552 a.mu.RLock()
554553 state := a.state
555- p := a.provider
556- mcpProxy := a.mcpProxy
557554 a.mu.RUnlock()
558555
559556 if err := validateCanAcceptMessage(state); err != nil {
@@ -566,7 +563,8 @@ func (m *Mysis) SendMessageFrom(content string, source store.MemorySource, sende
566563 role = store.MemoryRoleSystem
567564 }
568565
569- // Store the message (skip empty internal trigger messages from run loop)
566+ // Store the message BEFORE acquiring turnMu (skip empty internal trigger messages from run loop)
567+ // This ensures instant storage and immediate UI feedback, while turn processing happens later
570568 if content != "" {
571569 if err := a.store.AddMemory(a.id, role, source, content, "", senderID); err != nil {
572570 return fmt.Errorf("store message: %w", err)
@@ -577,7 +575,7 @@ func (m *Mysis) SendMessageFrom(content string, source store.MemorySource, sende
577575 a.encouragementCount = 0
578576 a.mu.Unlock()
579577
580- // Emit message event
578+ // Emit message event - UI will refresh and show the message immediately
581579 a.bus.Publish(Event{
582580 Type: EventMysisMessage,
583581 MysisID: a.id,
@@ -587,6 +585,24 @@ func (m *Mysis) SendMessageFrom(content string, source store.MemorySource, sende
587585 })
588586 }
589587
588+ // Now acquire turnMu for LLM processing - this may wait if another turn is in progress
589+ a.turnMu.Lock()
590+ defer a.turnMu.Unlock()
591+
592+ // Re-read state after acquiring lock (may have changed while waiting)
593+ a.mu.RLock()
594+ state = a.state
595+ p := a.provider
596+ mcpProxy := a.mcpProxy
597+ a.mu.RUnlock()
598+
599+ // Validate again after acquiring lock - state may have changed while waiting
600+ if err := validateCanAcceptMessage(state); err != nil {
601+ // Message is already stored, but we can't process it
602+ // This is okay - the message will remain in history but won't trigger LLM response
603+ return err
604+ }
605+
590606 // If mysis is idle, auto-start it (direct messages should wake idle myses)
591607 // Note: Empty content means this is an internal trigger from run() loop
592608 if state == MysisStateIdle && content != "" {
internal/core/mysis_test.go+4−0
@@ -11,6 +11,7 @@ import (
1111 "time"
1212
1313 "github.com/xonecas/zoea-nova/internal/constants"
14+ "github.com/xonecas/zoea-nova/internal/mcp"
1415 "github.com/xonecas/zoea-nova/internal/provider"
1516 "github.com/xonecas/zoea-nova/internal/store"
1617 )
@@ -1460,6 +1461,9 @@ func TestExecuteToolCall_ErrorPaths(t *testing.T) {
14601461 s, bus, cleanup := setupMysisTest(t)
14611462 defer cleanup()
14621463
1464+ // Create a shared MCP proxy for tests that need it
1465+ proxy := mcp.NewProxy(nil)
1466+
14631467 t.Run("nil_mcp_proxy", func(t *testing.T) {
14641468 stored, _ := s.CreateMysis("nil-proxy-test", "mock", "test-model", 0.7)
14651469 mock := provider.NewMock("mock", "response")
internal/core/mysis_tools_test.go+3−1
@@ -8,6 +8,7 @@ import (
88 "testing"
99 "time"
1010
11+ "github.com/xonecas/zoea-nova/internal/mcp"
1112 "github.com/xonecas/zoea-nova/internal/provider"
1213 "github.com/xonecas/zoea-nova/internal/store"
1314 )
@@ -330,7 +331,8 @@ func TestMysisToolRetryExhaustionSetsErrored(t *testing.T) {
330331
331332 go mysis.SendMessage("Trigger upstream retry", store.MemorySourceDirect)
332333
333- deadline := time.Now().Add(4 * time.Second)
334+ // Wait for retry exhaustion: 3 retries with delays 2s, 5s, 10s = 17s minimum
335+ deadline := time.Now().Add(20 * time.Second)
334336 for time.Now().Before(deadline) {
335337 if mysis.State() == MysisStateErrored {
336338 break
internal/core/notifications_test.go+1−0
@@ -7,6 +7,7 @@ import (
77 "time"
88
99 "github.com/xonecas/zoea-nova/internal/config"
10+ "github.com/xonecas/zoea-nova/internal/mcp"
1011 "github.com/xonecas/zoea-nova/internal/provider"
1112 "github.com/xonecas/zoea-nova/internal/store"
1213 )
internal/core/state_machine_test.go+1−1
@@ -40,7 +40,7 @@ func setupStateMachineTest(t *testing.T) (*Commander, func()) {
4040 }
4141
4242 cmd := NewCommander(s, reg, bus, cfg, "")
43- cmd// SetMCP removed - each mysis creates own client
43+ // SetMCP removed - each mysis creates own client
4444
4545 cleanup := func() {
4646 cmd.StopAll()
internal/core/tick_integration_test.go+1−0
@@ -6,6 +6,7 @@ import (
66 "time"
77
88 "github.com/xonecas/zoea-nova/internal/config"
9+ "github.com/xonecas/zoea-nova/internal/mcp"
910 "github.com/xonecas/zoea-nova/internal/provider"
1011 "github.com/xonecas/zoea-nova/internal/store"
1112 )
internal/integration/broadcast_sender_test.go+1−1
@@ -35,7 +35,7 @@ func setupIntegrationCommander(t *testing.T) (*core.Commander, *store.Store, fun
3535 },
3636 }
3737
38- cmd := core.NewCommander(s, reg, bus, cfg)
38+ cmd := core.NewCommander(s, reg, bus, cfg, "")
3939
4040 cleanup := func() {
4141 bus.Close()
internal/integration/mysis_creation_zen_nano_test.go+1−1
@@ -76,7 +76,7 @@ func TestCreateMysisWithZenNano(t *testing.T) {
7676
7777 // Step 5: Create commander (EXACT production code)
7878 bus := core.NewEventBus(100)
79- commander := core.NewCommander(s, registry, bus, cfg)
79+ commander := core.NewCommander(s, registry, bus, cfg, "")
8080
8181 // Step 6: Attempt to create mysis with zen-nano (EXACT user action)
8282 mysis, err := commander.CreateMysis("test-nano", "zen-nano")
internal/integration/zen_nano_failure_test.go+1−1
@@ -91,7 +91,7 @@ func TestZenNanoWithProductionConfig(t *testing.T) {
9191 defer s.Close()
9292
9393 bus := core.NewEventBus(100)
94- commander := core.NewCommander(s, registry, bus, cfg)
94+ commander := core.NewCommander(s, registry, bus, cfg, "")
9595
9696 // Step 8: Create mysis (what happens when user completes TUI flow)
9797 mysis, err := commander.CreateMysis("test-zen", "zen-nano")
internal/tui/app.go+6−8
@@ -303,9 +303,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
303303 m.sendingMode = InputModeNone
304304 m.input.Reset()
305305 }
306- if m.view == ViewFocus && msg.mysisID == m.focusID {
307- m.loadMysisLogs()
308- }
306+ // Don't refresh logs here - EventMysisMessage and EventMysisResponse handle that
309307
310308 case broadcastResult:
311309 // Broadcast finished - clear all loading states
@@ -743,9 +741,8 @@ func (m Model) handleInputKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
743741 // Note: m.sending NOT set here - SendMessageAsync returns immediately
744742 // Network indicator shows activity, but input is ready for next message
745743 cmd = m.sendMessageAsync(targetID, value)
746- if m.view == ViewFocus {
747- m.loadMysisLogs()
748- }
744+ // Don't call loadMysisLogs() here - message storage now happens instantly
745+ // and EventMysisMessage will trigger the refresh via handleEvent()
749746
750747 case InputModeNewMysis:
751748 // Multi-stage flow: name → provider
@@ -1030,8 +1027,9 @@ func (m *Model) updateViewportContent() {
10301027 panelContentWidth := conversationWidth - 2 // -2 for scrollbar
10311028
10321029 var lines []string
1033- // Render logs in reverse order (newest first) so bottom of scroll shows newest
1034- for i := len(m.logs) - 1; i >= 0; i-- {
1030+ // Render logs in chronological order (oldest first, newest last)
1031+ // Bottom of viewport shows newest messages (normal chat behavior)
1032+ for i := 0; i < len(m.logs); i++ {
10351033 entryLines := renderLogEntryImpl(m.logs[i], panelContentWidth, m.verboseJSON, m.currentTick)
10361034 lines = append(lines, entryLines...)
10371035 }
internal/tui/focus_test.go+8−18
@@ -201,14 +201,9 @@ func TestRenderLogEntryToolWithJSON(t *testing.T) {
201201
202202 output := strings.Join(lines, "\n")
203203
204- // Should have tree structure
205- if !strings.Contains(output, "├─") && !strings.Contains(output, "└─") {
206- t.Error("Expected tree box characters in tool JSON output")
207- }
208-
209- // Should contain field names
210- if !strings.Contains(output, "ship_id") || !strings.Contains(output, "cargo") {
211- t.Error("Expected JSON field names in tree output")
204+ // Tool results now show "✓ Success" for non-error JSON
205+ if !strings.Contains(output, "Success") {
206+ t.Error("Expected 'Success' in tool result output")
212207 }
213208 }
214209
@@ -231,19 +226,14 @@ func TestRenderLogEntryToolWithPrefixedJSON(t *testing.T) {
231226
232227 output := strings.Join(lines, "\n")
233228
234- // Should have tree structure (JSON should be detected despite prefix)
235- if !strings.Contains(output, "├─") && !strings.Contains(output, "└─") {
236- t.Error("Expected tree box characters in prefixed tool JSON output")
237- }
238-
239- // Should contain field names from JSON
240- if !strings.Contains(output, "max_myses") || !strings.Contains(output, "states") {
241- t.Error("Expected JSON field names in tree output")
229+ // Tool results now show "✓ Success" for non-error JSON
230+ if !strings.Contains(output, "Success") {
231+ t.Error("Expected 'Success' in tool result output")
242232 }
243233
244- // Should NOT contain the call ID prefix in the tree
234+ // Should NOT contain the call ID prefix
245235 if strings.Contains(output, "call_59orhh05:") {
246- t.Error("Tool call ID prefix should be stripped from JSON tree")
236+ t.Error("Tool call ID prefix should be stripped")
247237 }
248238 }
249239 func TestRenderFocusViewWithScrollbar(t *testing.T) {
internal/tui/golden_test.go+0−48
@@ -488,54 +488,6 @@ func TestFocusViewWithViewport(t *testing.T) {
488488 }
489489
490490 // TestJSONTree tests JSON tree rendering
491-func TestJSONTree(t *testing.T) {
492- defer setupGoldenTest(t)()
493-
494- tests := []struct {
495- name string
496- jsonStr string
497- verbose bool
498- maxWidth int
499- }{
500- {
501- name: "simple_object",
502- jsonStr: `{"name": "mysis-1", "state": "running", "id": "abc123"}`,
503- verbose: false,
504- maxWidth: 80,
505- },
506- {
507- name: "array_truncation",
508- jsonStr: `[{"id":0},{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9}]`,
509- verbose: false,
510- maxWidth: 80,
511- },
512- {
513- name: "verbose_mode",
514- jsonStr: `[{"id":0},{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9}]`,
515- verbose: true,
516- maxWidth: 80,
517- },
518- }
519-
520- for _, tt := range tests {
521- t.Run(tt.name, func(t *testing.T) {
522- output, err := renderJSONTree(tt.jsonStr, tt.verbose, tt.maxWidth)
523- if err != nil {
524- t.Fatalf("Failed to render JSON tree: %v", err)
525- }
526-
527- t.Run("ANSI", func(t *testing.T) {
528- golden.RequireEqual(t, []byte(output))
529- })
530-
531- t.Run("Stripped", func(t *testing.T) {
532- stripped := stripANSIForGolden(output)
533- golden.RequireEqual(t, []byte(stripped))
534- })
535- })
536- }
537-}
538-
539491 // TestScrollbar tests scrollbar rendering
540492 func TestScrollbar(t *testing.T) {
541493 defer setupGoldenTest(t)()
internal/tui/input_reset_test.go+1−1
@@ -334,7 +334,7 @@ func setupTestModelWithSlowProvider(t *testing.T) (Model, func()) {
334334 },
335335 }
336336
337- commander := core.NewCommander(s, reg, bus, cfg)
337+ commander := core.NewCommander(s, reg, bus, cfg, "")
338338
339339 model := New(commander, s, eventCh, false, cfg)
340340 model.width = 80
internal/tui/json_content_test.go+0−537
@@ -1,537 +0,0 @@
1-package tui
2-
3-import (
4- "encoding/json"
5- "strings"
6- "testing"
7- "time"
8-
9- "github.com/charmbracelet/x/exp/golden"
10-)
11-
12-// TestJSONContentInToolResults tests tool results that contain JSON.
13-func TestJSONContentInToolResults(t *testing.T) {
14- defer setupGoldenTest(t)()
15-
16- tests := []struct {
17- name string
18- content string
19- verbose bool
20- }{
21- {
22- name: "simple_json_object",
23- content: `{"status": "success", "ore_collected": 42}`,
24- verbose: false,
25- },
26- {
27- name: "json_array",
28- content: `[{"id": 1, "type": "asteroid"}, {"id": 2, "type": "station"}]`,
29- verbose: false,
30- },
31- {
32- name: "nested_json",
33- content: `{"ship": {"id": "abc123", "cargo": {"ore": 10, "fuel": 50}}}`,
34- verbose: false,
35- },
36- {
37- name: "json_with_tool_call_prefix",
38- content: `call_abc123:{"status": "success", "message": "Mining complete"}`,
39- verbose: false,
40- },
41- }
42-
43- for _, tt := range tests {
44- t.Run(tt.name, func(t *testing.T) {
45- entry := LogEntry{
46- Role: "tool",
47- Source: "tool",
48- Content: tt.content,
49- Reasoning: "",
50- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
51- }
52-
53- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
54-
55- t.Run("ANSI", func(t *testing.T) {
56- golden.RequireEqual(t, []byte(output))
57- })
58-
59- t.Run("Stripped", func(t *testing.T) {
60- stripped := stripANSIForGolden(output)
61- golden.RequireEqual(t, []byte(stripped))
62- })
63- })
64- }
65-}
66-
67-// TestJSONContentWithNestedJSON tests content that contains JSON strings (double-encoding scenario).
68-func TestJSONContentWithNestedJSON(t *testing.T) {
69- defer setupGoldenTest(t)()
70-
71- tests := []struct {
72- name string
73- content string
74- verbose bool
75- }{
76- {
77- name: "json_with_escaped_json_string",
78- content: func() string {
79- // Create a JSON object with a field containing JSON as a string
80- inner := map[string]interface{}{"status": "ok"}
81- innerJSON, _ := json.Marshal(inner)
82- outer := map[string]interface{}{
83- "response": string(innerJSON),
84- "code": 200,
85- }
86- outerJSON, _ := json.Marshal(outer)
87- return string(outerJSON)
88- }(),
89- verbose: false,
90- },
91- {
92- name: "json_array_with_json_strings",
93- content: func() string {
94- // Array where each element is a JSON string
95- arr := []string{
96- `{"type": "error", "msg": "failed"}`,
97- `{"type": "success", "msg": "ok"}`,
98- }
99- arrJSON, _ := json.Marshal(arr)
100- return string(arrJSON)
101- }(),
102- verbose: false,
103- },
104- }
105-
106- for _, tt := range tests {
107- t.Run(tt.name, func(t *testing.T) {
108- entry := LogEntry{
109- Role: "tool",
110- Source: "tool",
111- Content: tt.content,
112- Reasoning: "",
113- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
114- }
115-
116- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
117-
118- t.Run("ANSI", func(t *testing.T) {
119- golden.RequireEqual(t, []byte(output))
120- })
121-
122- t.Run("Stripped", func(t *testing.T) {
123- stripped := stripANSIForGolden(output)
124- golden.RequireEqual(t, []byte(stripped))
125- })
126- })
127- }
128-}
129-
130-// TestJSONContentInAssistantMessages tests assistant messages that include JSON examples.
131-func TestJSONContentInAssistantMessages(t *testing.T) {
132- defer setupGoldenTest(t)()
133-
134- tests := []struct {
135- name string
136- role string
137- content string
138- verbose bool
139- }{
140- {
141- name: "assistant_with_json_in_text",
142- role: "assistant",
143- content: `I found the following data: {"ore": 42, "fuel": 50}. Should I proceed?`,
144- verbose: false,
145- },
146- {
147- name: "assistant_with_json_code_block",
148- role: "assistant",
149- content: "Here's the status:\n```json\n{\"status\": \"running\", \"health\": 100}\n```\nLooks good!",
150- verbose: false,
151- },
152- {
153- name: "user_with_json_example",
154- role: "user",
155- content: `Please parse this: {"command": "mine", "target": "asteroid_1"}`,
156- verbose: false,
157- },
158- }
159-
160- for _, tt := range tests {
161- t.Run(tt.name, func(t *testing.T) {
162- entry := LogEntry{
163- Role: tt.role,
164- Source: "direct",
165- Content: tt.content,
166- Reasoning: "",
167- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
168- }
169-
170- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
171-
172- t.Run("ANSI", func(t *testing.T) {
173- golden.RequireEqual(t, []byte(output))
174- })
175-
176- t.Run("Stripped", func(t *testing.T) {
177- stripped := stripANSIForGolden(output)
178- golden.RequireEqual(t, []byte(stripped))
179- })
180- })
181- }
182-}
183-
184-// TestJSONContentMixedWithText tests mixed content with JSON and text.
185-func TestJSONContentMixedWithText(t *testing.T) {
186- defer setupGoldenTest(t)()
187-
188- tests := []struct {
189- name string
190- content string
191- verbose bool
192- }{
193- {
194- name: "text_before_json",
195- content: `Mining successful! Result: {"ore": 10, "location": "asteroid_42"}`,
196- verbose: false,
197- },
198- {
199- name: "json_with_text_after",
200- content: `{"status": "complete"} - Operation finished successfully`,
201- verbose: false,
202- },
203- {
204- name: "multiple_json_snippets",
205- content: `First: {"a": 1} and second: {"b": 2} both valid`,
206- verbose: false,
207- },
208- }
209-
210- for _, tt := range tests {
211- t.Run(tt.name, func(t *testing.T) {
212- entry := LogEntry{
213- Role: "tool",
214- Source: "tool",
215- Content: tt.content,
216- Reasoning: "",
217- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
218- }
219-
220- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
221-
222- t.Run("ANSI", func(t *testing.T) {
223- golden.RequireEqual(t, []byte(output))
224- })
225-
226- t.Run("Stripped", func(t *testing.T) {
227- stripped := stripANSIForGolden(output)
228- golden.RequireEqual(t, []byte(stripped))
229- })
230- })
231- }
232-}
233-
234-// TestJSONContentMalformed tests malformed JSON in content.
235-func TestJSONContentMalformed(t *testing.T) {
236- defer setupGoldenTest(t)()
237-
238- tests := []struct {
239- name string
240- content string
241- verbose bool
242- }{
243- {
244- name: "incomplete_json_object",
245- content: `{"status": "running", "ore":`,
246- verbose: false,
247- },
248- {
249- name: "invalid_json_syntax",
250- content: `{invalid: json, missing: "quotes"}`,
251- verbose: false,
252- },
253- {
254- name: "json_with_trailing_comma",
255- content: `{"a": 1, "b": 2,}`,
256- verbose: false,
257- },
258- {
259- name: "looks_like_json_but_not",
260- content: `{this looks like json but isn't valid}`,
261- verbose: false,
262- },
263- }
264-
265- for _, tt := range tests {
266- t.Run(tt.name, func(t *testing.T) {
267- entry := LogEntry{
268- Role: "tool",
269- Source: "tool",
270- Content: tt.content,
271- Reasoning: "",
272- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
273- }
274-
275- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
276-
277- t.Run("ANSI", func(t *testing.T) {
278- golden.RequireEqual(t, []byte(output))
279- })
280-
281- t.Run("Stripped", func(t *testing.T) {
282- stripped := stripANSIForGolden(output)
283- golden.RequireEqual(t, []byte(stripped))
284- })
285- })
286- }
287-}
288-
289-// TestJSONContentVeryLarge tests very large JSON objects.
290-func TestJSONContentVeryLarge(t *testing.T) {
291- defer setupGoldenTest(t)()
292-
293- tests := []struct {
294- name string
295- content string
296- verbose bool
297- }{
298- {
299- name: "large_array_verbose_off",
300- content: func() string {
301- items := make([]map[string]interface{}, 100)
302- for i := 0; i < 100; i++ {
303- items[i] = map[string]interface{}{
304- "id": i,
305- "value": i * 100,
306- "name": "item_" + string(rune('A'+i%26)),
307- }
308- }
309- jsonBytes, _ := json.Marshal(items)
310- return string(jsonBytes)
311- }(),
312- verbose: false,
313- },
314- {
315- name: "large_array_verbose_on",
316- content: func() string {
317- items := make([]map[string]interface{}, 20)
318- for i := 0; i < 20; i++ {
319- items[i] = map[string]interface{}{
320- "id": i,
321- "value": i * 100,
322- }
323- }
324- jsonBytes, _ := json.Marshal(items)
325- return string(jsonBytes)
326- }(),
327- verbose: true,
328- },
329- {
330- name: "deeply_nested_json",
331- content: func() string {
332- // Create deeply nested structure: 10 levels deep
333- var data interface{} = "deepest"
334- for i := 0; i < 10; i++ {
335- data = map[string]interface{}{
336- "level": i,
337- "next": data,
338- }
339- }
340- jsonBytes, _ := json.Marshal(data)
341- return string(jsonBytes)
342- }(),
343- verbose: false,
344- },
345- {
346- name: "wide_object_many_fields",
347- content: func() string {
348- obj := make(map[string]interface{}, 50)
349- for i := 0; i < 50; i++ {
350- key := "field_" + string(rune('a'+i%26)) + string(rune('0'+i/26))
351- obj[key] = i * 10
352- }
353- jsonBytes, _ := json.Marshal(obj)
354- return string(jsonBytes)
355- }(),
356- verbose: false,
357- },
358- }
359-
360- for _, tt := range tests {
361- t.Run(tt.name, func(t *testing.T) {
362- entry := LogEntry{
363- Role: "tool",
364- Source: "tool",
365- Content: tt.content,
366- Reasoning: "",
367- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
368- }
369-
370- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
371-
372- t.Run("ANSI", func(t *testing.T) {
373- golden.RequireEqual(t, []byte(output))
374- })
375-
376- t.Run("Stripped", func(t *testing.T) {
377- stripped := stripANSIForGolden(output)
378- golden.RequireEqual(t, []byte(stripped))
379- })
380- })
381- }
382-}
383-
384-// TestJSONContentEdgeCases tests edge cases in JSON rendering.
385-func TestJSONContentEdgeCases(t *testing.T) {
386- defer setupGoldenTest(t)()
387-
388- tests := []struct {
389- name string
390- content string
391- verbose bool
392- }{
393- {
394- name: "empty_json_object",
395- content: `{}`,
396- verbose: false,
397- },
398- {
399- name: "empty_json_array",
400- content: `[]`,
401- verbose: false,
402- },
403- {
404- name: "json_with_null_values",
405- content: `{"a": null, "b": null, "c": 123}`,
406- verbose: false,
407- },
408- {
409- name: "json_with_boolean_values",
410- content: `{"enabled": true, "disabled": false, "count": 0}`,
411- verbose: false,
412- },
413- {
414- name: "json_with_very_long_string",
415- content: `{"description": "` + strings.Repeat("a", 500) + `"}`,
416- verbose: false,
417- },
418- {
419- name: "json_with_unicode_characters",
420- content: `{"emoji": "🚀⬡⬥", "text": "Hello 世界"}`,
421- verbose: false,
422- },
423- {
424- name: "json_single_value",
425- content: `"just a string"`,
426- verbose: false,
427- },
428- {
429- name: "json_single_number",
430- content: `42`,
431- verbose: false,
432- },
433- }
434-
435- for _, tt := range tests {
436- t.Run(tt.name, func(t *testing.T) {
437- entry := LogEntry{
438- Role: "tool",
439- Source: "tool",
440- Content: tt.content,
441- Reasoning: "",
442- Timestamp: time.Date(2026, 2, 6, 12, 0, 0, 0, time.UTC),
443- }
444-
445- output := strings.Join(renderLogEntryImpl(entry, 80, tt.verbose, 42000), "\n")
446-
447- t.Run("ANSI", func(t *testing.T) {
448- golden.RequireEqual(t, []byte(output))
449- })
450-
451- t.Run("Stripped", func(t *testing.T) {
452- stripped := stripANSIForGolden(output)
453- golden.RequireEqual(t, []byte(stripped))
454- })
455- })
456- }
457-}
458-
459-// TestDoubleParsingIssue specifically tests the double-parsing scenario.
460-func TestDoubleParsingIssue(t *testing.T) {
461- // This test demonstrates the potential double-parsing issue:
462- // When tool result content is already JSON, and we try to parse it again,
463- // what happens?
464-
465- t.Run("tool_result_already_parsed", func(t *testing.T) {
466- // Simulate what happens when content is JSON
467- jsonContent := `{"status": "success", "data": {"ore": 42}}`
468-
469- // First parse (what renderJSONTree does)
470- tree1, err1 := renderJSONTree(jsonContent, false, 80)
471- if err1 != nil {
472- t.Fatalf("First parse failed: %v", err1)
473- }
474-
475- // Second parse (if we accidentally parse the tree output)
476- _, err2 := renderJSONTree(tree1, false, 80)
477- if err2 == nil {
478- t.Error("Second parse should fail - tree output is not valid JSON")
479- }
480-
481- // Verify tree1 is NOT valid JSON
482- var dummy interface{}
483- if json.Unmarshal([]byte(tree1), &dummy) == nil {
484- t.Error("Tree output should not be valid JSON (contains Unicode box chars)")
485- }
486- })
487-
488- t.Run("tool_result_with_call_prefix", func(t *testing.T) {
489- // Test the tool call ID prefix stripping
490- content := `call_abc123:{"status": "success"}`
491-
492- // The isJSON function should detect this as JSON
493- if !isJSON(content) {
494- t.Error("isJSON should detect tool result with call prefix")
495- }
496-
497- // renderJSONTree does NOT strip the prefix - that's done in renderLogEntryImpl
498- // So calling it directly with the prefix should fail
499- _, err := renderJSONTree(content, false, 80)
500- if err == nil {
501- t.Error("renderJSONTree should fail on content with call prefix (prefix stripping is done in renderLogEntryImpl)")
502- }
503-
504- // The prefix is stripped in renderLogEntryImpl before calling renderJSONTree
505- // Let's verify the logic in focus.go lines 330-334 works
506- if idx := strings.Index(content, ":"); idx > 0 && strings.HasPrefix(content, "call_") {
507- jsonContent := content[idx+1:]
508- _, err2 := renderJSONTree(jsonContent, false, 80)
509- if err2 != nil {
510- t.Errorf("Stripped content should parse: %v", err2)
511- }
512- }
513- })
514-
515- t.Run("nested_json_string_not_double_parsed", func(t *testing.T) {
516- // Create JSON with a field containing JSON as a STRING (escaped)
517- inner := `{"nested": "value"}`
518- innerEscaped, _ := json.Marshal(inner) // This escapes it: "\"nested\": \"value\"}"
519- outer := `{"data": ` + string(innerEscaped) + `}`
520-
521- tree, err := renderJSONTree(outer, false, 80)
522- if err != nil {
523- t.Fatalf("Parse failed: %v", err)
524- }
525-
526- // The tree should show "data" field with an escaped JSON STRING value
527- // NOT a parsed nested object
528- if strings.Contains(tree, `├─"nested"`) {
529- t.Error("Nested JSON string should NOT be parsed as object - it's a string value")
530- }
531-
532- // It should show the escaped string
533- if !strings.Contains(tree, `"data"`) {
534- t.Error("Should show outer 'data' field")
535- }
536- })
537-}
internal/tui/json_tree.go+0−406
@@ -1,406 +0,0 @@
1-package tui
2-
3-import (
4- "encoding/json"
5- "fmt"
6- "sort"
7- "strings"
8-
9- "github.com/charmbracelet/lipgloss"
10-)
11-
12-const (
13- // Tree box-drawing characters
14- treeEdge = "├─"
15- treeLast = "└─"
16- treeVert = "│ "
17- treeSpace = " "
18-
19- // Truncation limits
20- arrayTruncateThreshold = 6 // Show first 3 and last 3 if array has more than this
21- arrayShowFirst = 3
22- arrayShowLast = 3
23-)
24-
25-// renderJSONTree renders JSON as a Unicode tree structure with smart truncation.
26-// If verbose is true, all items are shown. Otherwise, arrays with more than 6 items
27-// show first 3, "[x more]", and last 3.
28-// maxWidth constrains the width of rendered lines (0 = no limit).
29-func renderJSONTree(jsonStr string, verbose bool, maxWidth int) (string, error) {
30- var data interface{}
31- if err := json.Unmarshal([]byte(jsonStr), &data); err != nil {
32- return "", fmt.Errorf("invalid JSON: %w", err)
33- }
34-
35- var lines []string
36- renderValue(data, "", true, verbose, maxWidth, &lines)
37- return strings.Join(lines, "\n"), nil
38-}
39-
40-// renderValue recursively renders a JSON value as tree lines
41-func renderValue(value interface{}, prefix string, isLast bool, verbose bool, maxWidth int, lines *[]string) {
42- switch v := value.(type) {
43- case map[string]interface{}:
44- renderObject(v, prefix, isLast, verbose, maxWidth, lines)
45- case []interface{}:
46- renderArray(v, prefix, isLast, verbose, maxWidth, lines)
47- default:
48- // Primitive value - wrap if needed
49- valueStr := fmt.Sprintf("%v", v)
50- if maxWidth > 0 {
51- prefixWidth := lipgloss.Width(prefix)
52- availableWidth := maxWidth - prefixWidth
53- if availableWidth < 10 {
54- availableWidth = 10
55- }
56- if lipgloss.Width(valueStr) > availableWidth {
57- // Truncate long values
58- valueStr = truncateToWidth(valueStr, availableWidth-3) + "..."
59- }
60- }
61- *lines = append(*lines, prefix+valueStr)
62- }
63-}
64-
65-// renderObject renders a JSON object
66-func renderObject(obj map[string]interface{}, prefix string, isLast bool, verbose bool, maxWidth int, lines *[]string) {
67- if len(obj) == 0 {
68- // Empty object - show nothing (or could show "(empty)")
69- return
70- }
71-
72- // No opening brace - just render content directly
73-
74- // Get keys in deterministic order (sorted)
75- keys := make([]string, 0, len(obj))
76- for k := range obj {
77- keys = append(keys, k)
78- }
79- sort.Strings(keys)
80-
81- for i, key := range keys {
82- isLastField := i == len(keys)-1
83- fieldPrefix := prefix
84- if isLast {
85- fieldPrefix += treeSpace
86- } else {
87- fieldPrefix += treeVert
88- }
89-
90- var connector string
91- if isLastField {
92- connector = treeLast
93- } else {
94- connector = treeEdge
95- }
96-
97- keyStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("214")) // Orange for keys
98- valuePrefix := fieldPrefix + connector + keyStyle.Render(fmt.Sprintf("%q: ", key))
99-
100- val := obj[key]
101- switch v := val.(type) {
102- case map[string]interface{}:
103- // Nested object - no braces
104- if len(v) == 0 {
105- // Empty nested object - show label only
106- *lines = append(*lines, valuePrefix+"(empty)")
107- } else {
108- *lines = append(*lines, valuePrefix)
109- childPrefix := fieldPrefix + treeSpace
110- renderObjectContent(v, childPrefix, isLastField, verbose, maxWidth, lines)
111- }
112- case []interface{}:
113- // Nested array - no brackets
114- if len(v) == 0 {
115- // Empty array - show label only
116- *lines = append(*lines, valuePrefix+"(empty)")
117- } else {
118- *lines = append(*lines, valuePrefix)
119- childPrefix := fieldPrefix + treeSpace
120- renderArrayContent(v, childPrefix, isLastField, verbose, maxWidth, lines)
121- }
122- default:
123- // Primitive value - wrap if needed
124- valueStr := fmt.Sprintf("%v", v)
125- if maxWidth > 0 {
126- prefixWidth := lipgloss.Width(valuePrefix)
127- availableWidth := maxWidth - prefixWidth
128- if availableWidth < 10 {
129- availableWidth = 10
130- }
131- if lipgloss.Width(valueStr) > availableWidth {
132- // Truncate long values
133- valueStr = truncateToWidth(valueStr, availableWidth-3) + "..."
134- }
Cut short: this commit's diff is over 1000 lines.
internal/tui/json_tree_test.go+0−94
Cut short: this commit's diff is over 1000 lines.
internal/tui/message_frame_test.go+6−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/broadcast_from_other/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/broadcast_from_other/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/broadcast_from_self/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/broadcast_from_self/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/broadcast_legacy_no_sender/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/broadcast_legacy_no_sender/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/direct_message/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestBroadcastLabels/direct_message/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusView/narrow_terminal/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusView/narrow_terminal/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusView/with_all_roles/ANSI.golden+6−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusView/with_all_roles/Stripped.golden+6−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusView/with_scrollbar/ANSI.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusView/with_scrollbar/Stripped.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/all_role_types/ANSI.golden+6−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/all_role_types/Stripped.golden+6−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/cjk_logs/ANSI.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/cjk_logs/Stripped.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/huge_json_tool_result/ANSI.golden+28−28
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/huge_json_tool_result/Stripped.golden+28−28
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/many_logs_100_entries/ANSI.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/many_logs_100_entries/Stripped.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/narrow_focus_view/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/narrow_focus_view/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/unicode_emoji_logs/ANSI.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/unicode_emoji_logs/Stripped.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/very_long_log_entry/ANSI.golden+9−9
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/very_long_log_entry/Stripped.golden+9−9
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/very_long_reasoning/ANSI.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewEdgeCases/very_long_reasoning/Stripped.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewWithViewport/with_scroll_indicator/ANSI.golden+25−12
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewWithViewport/with_scroll_indicator/Stripped.golden+25−12
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewWithViewport/with_scrollbar/ANSI.golden+25−12
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestFocusViewWithViewport/with_scrollbar/Stripped.golden+25−12
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/empty_json_array/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/empty_json_array/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/empty_json_object/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/empty_json_object/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_single_number/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_single_number/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_single_value/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_single_value/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_boolean_values/ANSI.golden+0−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_boolean_values/Stripped.golden+0−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_null_values/ANSI.golden+0−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_null_values/Stripped.golden+0−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_unicode_characters/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_unicode_characters/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_very_long_string/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentEdgeCases/json_with_very_long_string/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInAssistantMessages/assistant_with_json_code_block/ANSI.golden+0−7
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInAssistantMessages/assistant_with_json_code_block/Stripped.golden+0−7
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInAssistantMessages/assistant_with_json_in_text/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInAssistantMessages/assistant_with_json_in_text/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInAssistantMessages/user_with_json_example/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInAssistantMessages/user_with_json_example/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/json_array/ANSI.golden+0−8
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/json_array/Stripped.golden+0−8
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/json_with_tool_call_prefix/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/json_with_tool_call_prefix/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/nested_json/ANSI.golden+0−7
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/nested_json/Stripped.golden+0−7
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/simple_json_object/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentInToolResults/simple_json_object/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/incomplete_json_object/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/incomplete_json_object/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/invalid_json_syntax/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/invalid_json_syntax/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/json_with_trailing_comma/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/json_with_trailing_comma/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/looks_like_json_but_not/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMalformed/looks_like_json_but_not/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMixedWithText/json_with_text_after/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMixedWithText/json_with_text_after/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMixedWithText/multiple_json_snippets/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMixedWithText/multiple_json_snippets/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMixedWithText/text_before_json/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentMixedWithText/text_before_json/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/deeply_nested_json/ANSI.golden+0−22
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/deeply_nested_json/Stripped.golden+0−22
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/large_array_verbose_off/ANSI.golden+0−27
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/large_array_verbose_off/Stripped.golden+0−27
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/large_array_verbose_on/ANSI.golden+0−62
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/large_array_verbose_on/Stripped.golden+0−62
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/wide_object_many_fields/ANSI.golden+0−52
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentVeryLarge/wide_object_many_fields/Stripped.golden+0−52
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentWithNestedJSON/json_array_with_json_strings/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentWithNestedJSON/json_array_with_json_strings/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentWithNestedJSON/json_with_escaped_json_string/ANSI.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONContentWithNestedJSON/json_with_escaped_json_string/Stripped.golden+0−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONTree/array_truncation/ANSI.golden+0−13
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONTree/array_truncation/Stripped.golden+0−13
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONTree/simple_object/ANSI.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONTree/simple_object/Stripped.golden+0−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONTree/verbose_mode/ANSI.golden+0−20
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestJSONTree/verbose_mode/Stripped.golden+0−20
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/tool_with_json/ANSI.golden+1−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/tool_with_json/Stripped.golden+1−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/tool_with_prefixed_json/ANSI.golden+1−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/tool_with_prefixed_json/Stripped.golden+1−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/with_reasoning/ANSI.golden+3−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/with_reasoning/Stripped.golden+3−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/with_reasoning_truncation/ANSI.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestLogEntry/with_reasoning_truncation/Stripped.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_message_long/ANSI.golden+3−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_message_long/Stripped.golden+3−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_message_short/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_message_short/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_with_reasoning_verbose_off/ANSI.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_with_reasoning_verbose_off/Stripped.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_with_reasoning_verbose_on/ANSI.golden+6−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/assistant_with_reasoning_verbose_on/Stripped.golden+6−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/swarm_broadcast_long/ANSI.golden+3−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/swarm_broadcast_long/Stripped.golden+3−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/swarm_broadcast_short/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/swarm_broadcast_short/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/system_message_long/ANSI.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/system_message_long/Stripped.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/system_message_short/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/system_message_short/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/tool_call_json_tree_verbose_off/ANSI.golden+1−14
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/tool_call_json_tree_verbose_off/Stripped.golden+1−14
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/tool_call_json_tree_verbose_on/ANSI.golden+1−14
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/tool_call_json_tree_verbose_on/Stripped.golden+1−14
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/tool_call_short/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/tool_call_short/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_broadcast_self_long/ANSI.golden+3−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_broadcast_self_long/Stripped.golden+3−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_broadcast_self_short/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_broadcast_self_short/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_direct_long/ANSI.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_direct_long/Stripped.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_direct_short/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestMessageFrameLayout/user_direct_short/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/empty_reasoning/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/empty_reasoning/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/four_lines_triggers_truncation/ANSI.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/four_lines_triggers_truncation/Stripped.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/single_line/ANSI.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/single_line/Stripped.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/single_word/ANSI.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/single_word/Stripped.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/three_lines_exact_threshold/ANSI.golden+4−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/three_lines_exact_threshold/Stripped.golden+4−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/very_long_reasoning/ANSI.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/very_long_reasoning/Stripped.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/very_long_reasoning_verbose/ANSI.golden+11−11
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningContentLengths/very_long_reasoning_verbose/Stripped.golden+11−11
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/narrow_terminal/ANSI.golden+4−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/narrow_terminal/Stripped.golden+4−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/non_verbose_mode_with_timestamp/ANSI.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/non_verbose_mode_with_timestamp/Stripped.golden+5−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/short_reasoning_no_truncation/ANSI.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/short_reasoning_no_truncation/Stripped.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/verbose_mode_with_timestamp/ANSI.golden+3−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/verbose_mode_with_timestamp/Stripped.golden+3−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/zero_timestamp/ANSI.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestReasoningWithTimestamp/zero_timestamp/Stripped.golden+2−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestScrollbar/at_bottom/ANSI.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestScrollbar/at_top/ANSI.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestScrollbar/middle/ANSI.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestScrollbar/no_scroll/ANSI.golden+10−10
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/empty_after_prefix/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/empty_after_prefix/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/invalid_json_args/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/invalid_json_args/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/malformed_no_prefix/ANSI.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/malformed_no_prefix/Stripped.golden+1−1
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/single_field_incomplete/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/single_field_incomplete/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/two_fields_incomplete/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/two_fields_incomplete/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/unicode_in_tool_args/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/unicode_in_tool_args/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/very_long_tool_arguments/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsEdgeCases/very_long_tool_arguments/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/complex_nested_json/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/complex_nested_json/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/empty_tool_arguments/ANSI.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/empty_tool_arguments/Stripped.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/long_tool_name/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/long_tool_name/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/multiple_tool_calls/ANSI.golden+3−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/multiple_tool_calls/Stripped.golden+3−4
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/single_tool_call/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/single_tool_call/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_narrow_width/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_narrow_width/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_verbose_mode/ANSI.golden+1−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_verbose_mode/Stripped.golden+1−5
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_very_narrow_width/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_very_narrow_width/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_array_params/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_array_params/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_number_params/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_number_params/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_object_params/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_object_params/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_string_params/ANSI.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsRendering/tool_call_with_string_params/Stripped.golden+1−2
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/multiple_tools_with_long_reasoning/ANSI.golden+7−8
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/multiple_tools_with_long_reasoning/Stripped.golden+7−8
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/single_tool_with_reasoning/ANSI.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/single_tool_with_reasoning/Stripped.golden+2−3
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/single_tool_with_reasoning_verbose/ANSI.golden+3−7
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/single_tool_with_reasoning_verbose/Stripped.golden+3−7
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/tool_with_multiline_reasoning/ANSI.golden+5−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/testdata/TestToolCallsWithReasoning/tool_with_multiline_reasoning/Stripped.golden+5−6
Cut short: this commit's diff is over 1000 lines.
internal/tui/tui_test.go+1−1
Cut short: this commit's diff is over 1000 lines.