Skip to content

Conversation

@telnet2
Copy link
Owner

@telnet2 telnet2 commented Dec 5, 2025

No description provided.

joohwi-bd and others added 3 commits December 4, 2025 20:39
Add ability to capture console.log/error/warn/debug calls to log files
in TUI mode. This is useful for debugging since stdout/stderr are not
visible when the TUI is running.

Changes:
- Add captureConsole option to Log.init() and Log.captureConsole() fn
- Add restoreConsole() to restore original console methods
- Enable console capture in TUI thread, worker, attach, and spawn cmds
- Console output is logged with service="console" in the log file
Add console.error logging for JSON parse failures that were previously
silently caught:
- SSE JSON parse errors (with url, eventName, rawData)
- SSE connection errors (with url, attempt, error)
- API error response JSON parse failures (with url, status, rawBody)

Logs use [SDK] prefix and are captured to log file in TUI mode via
captureConsole.

Also adds patch-generated.ts script that automatically re-applies these
patches after SDK regeneration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit fixes multiple issues preventing proper TUI integration:

## User Message Display (handlers_message.go)
- Change event type from `message.created` to `message.updated`
  (TUI only listens for `message.updated`, not `message.created`)
- Add `message.part.updated` events for user message parts
- Add required `sessionID` and `messageID` fields to TextPart and FilePart
  (TUI stores parts by messageID - without it, parts can't be associated)

## Text Streaming (stream.go)
- Fix accumulated vs delta detection: use `strings.HasPrefix` instead of
  length comparison to correctly identify streaming mode
- Publish `message.part.updated` event for first text chunk
  (was only calling callback, not publishing event)
- Fix tool call tracking to use Index-based lookup (eino streaming model)
- Accumulate tool arguments as deltas, not replace

## Message Processing (loop.go)
- Reload messages after tool execution to include tool results
- Skip empty messages (no parts) in completion requests
- Add debug logging for message building

## Tool Execution (tools.go, registry.go)
- Add debug logging for tool execution flow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@telnet2 telnet2 merged commit 04b5559 into main Dec 5, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants