feat: collapse tool results and add headless Chrome fetcher

Backend:
- Add unified URL fetcher with fallback chain: curl → wget → native Go → headless Chrome
- Implement JS-rendered page detection for sites like docs.rs
- Add chromedp dependency for headless browser support
- Log fetch method on server startup

Frontend:
- Store tool results in structured ToolCall.result field instead of message content
- Show tool results collapsed by default in ToolCallDisplay
- Add expandable results section with truncation for large outputs
- Add Message.hidden flag for internal messages (tool context)
- Separate visibleMessages (UI) from allMessages (API) to fix infinite loop
- Fix tool result messages not being sent to model

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 23:52:57 +01:00
parent 15084fb3ca
commit c0ef31e5f4
12 changed files with 930 additions and 137 deletions

View File

@@ -62,6 +62,10 @@ func main() {
Handler: r,
}
// Initialize fetcher and log the method being used
fetcher := api.GetFetcher()
log.Printf("URL fetcher method: %s (headless Chrome: %v)", fetcher.Method(), fetcher.HasChrome())
// Graceful shutdown handling
go func() {
log.Printf("Server starting on port %s", *port)