Skip to content

Conversation

@ulivz
Copy link
Member

@ulivz ulivz commented Sep 10, 2025

Summary

Refactored the Tool Renderer system to address type safety issues, data structure inconsistencies, and configuration complexity. This PR replaces the complex condition-based renderer selection with a standardized transformer system.

Key Improvements:

  1. Type Safety: Replaced any/string parameters with strongly-typed StandardToolResult and RendererData union types
  2. Data Standardization: Unified data formats for each renderer type (ImageData, FileData, DiffData, etc.)
  3. Simplified Configuration: Replaced mixed static/dynamic/content-detection system with clean transformer functions
  4. Backward Compatibility: Added StandardRenderer adapter to work with existing renderer components
  5. Reduced Complexity: Eliminated complex data transformation chains and fallback logic

Technical Changes:

  • Created @/common/utils/tool-renderers/types.ts with standardized type definitions
  • Implemented transformer functions for each tool type (file, diff, command, search, etc.)
  • Added StandardRenderer component as adapter between new and legacy systems
  • Updated ToolHandler to generate standardized results alongside legacy format
  • Maintained existing renderer components for gradual migration

Migration Path:

  • New tool results use standardized format when available
  • Falls back to legacy renderer system for compatibility
  • Enables gradual migration of individual renderers to new system

Checklist

  • Added or updated necessary tests (Optional).
  • Updated documentation to align with changes (Optional).
  • Verified no breaking changes, or prepared solutions for any occurring breaking changes (Optional).
  • My change does not involve the above items.

- Replace complex condition-based renderer selection with type-safe transformer system
- Create standardized data formats for each renderer type (ImageData, FileData, etc.)
- Implement transformer functions for consistent data conversion
- Add StandardRenderer adapter for backward compatibility
- Maintain existing renderer components while enabling gradual migration
- Improve type safety and reduce runtime errors
- Simplify renderer configuration and eliminate dynamic content detection
@netlify
Copy link

netlify bot commented Sep 10, 2025

Deploy Preview for agent-tars-docs ready!

Name Link
🔨 Latest commit 728f641
🔍 Latest deploy log https://app.netlify.com/projects/agent-tars-docs/deploys/68c0db68ef396c00087c159a
😎 Deploy Preview https://deploy-preview-1455--agent-tars-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

2 participants