Skip to content

feat: add show_user tool, refactor FSRead, and improve Agent event handling - #556

Merged
tusharmath merged 15 commits into
mainfrom
user-tool
Mar 19, 2025
Merged

feat: add show_user tool, refactor FSRead, and improve Agent event handling#556
tusharmath merged 15 commits into
mainfrom
user-tool

Conversation

@tusharmath

@tusharmath tusharmath commented Mar 19, 2025

Copy link
Copy Markdown
Collaborator

Overview

This PR introduces a new markdown rendering tool for terminal display, refactors FSRead to use infrastructure services, and implements a custom merge strategy for agent subscription events to properly combine event lists when merging agents.

Purpose

These changes improve the user experience by enabling properly formatted terminal output, enhance code consistency through infrastructure dependency injection, and fix event handling when merging agents. The PR also adds comprehensive documentation on tool description best practices.

Implementation

  1. Show User Tool:

    • Added termimad dependency for terminal markdown rendering
    • Created new ShowUser tool to render markdown in the terminal
    • Implemented ToolRegistry struct to centralize tool registration
  2. FSRead Refactor:

    • Modified FSRead to accept infrastructure as a generic parameter
    • Updated to use the infrastructure's file read service
    • Added improved output formatting with TitleFormat
    • Adjusted tests to work with the new implementation
  3. Agent Subscription Event Merging:

    • Implemented custom merge_subscription function
    • Updated agent merge behavior to properly combine subscription events
    • Enhanced tests to verify correct merging of events
  4. Documentation:

    • Added documentation on tool description best practices
    • Created tool description improvement plan

Testing

  • Unit tests have been updated for the refactored FSRead
  • New tests added for ShowUser tool functionality
  • Enhanced tests for agent subscription event merging
  • Manual testing of markdown display in various terminal environments

Related Issues

This PR addresses the need for better terminal output formatting and resolves potential issues with agent subscription event handling during merges.

Changelog

New Features:

  • Added ShowUser tool for rendering markdown in the terminal
  • Implemented centralized ToolRegistry for better organization

Refactoring:

  • Updated FSRead to use infrastructure's file read service
  • Improved output formatting with TitleFormat

Fixes:

  • Fixed agent subscription event merging to properly combine events

Documentation:

  • Added comprehensive tool description best practices
  • Created tool description improvement plan

Suggested Reviewers

  • Frontend/UX team members for the terminal markdown rendering
  • Infrastructure team members for the FSRead refactoring
  • Anyone familiar with agent event handling for the subscription merging changes

@tusharmath tusharmath changed the title Add show_user tool for terminal markdown rendering feat: add show_user tool for terminal markdown rendering Mar 19, 2025
@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Mar 19, 2025
tusharmath and others added 3 commits March 19, 2025 15:56
Implement a new tool that renders markdown content in the terminal with proper formatting using termimad library. This includes:

- Adding termimad dependency to workspace and forge_app crate
- Creating new ToolRegistry struct to centralize tool registration
- Implementing show_user tool with full markdown rendering capabilities
- Updating tool_service to use the new registry
- Adding documentation in docs/show-user-tool.md

Co-authored-by: Forge <forge@antinomy.ai>
tusharmath and others added 2 commits March 19, 2025 15:56
Refactored FSRead tool to use the infrastructure's file read service instead
of directly using tokio::fs. This change improves consistency with other
file system tools and enables better testability through dependency injection.

* Modified FSRead to accept infrastructure as a generic parameter
* Updated tool registry to pass infrastructure to FSRead
* Added improved output formatting with TitleFormat
* Adjusted tests to work with the new implementation

Co-authored-by: Forge <forge@antinomy.ai>
@tusharmath tusharmath changed the title feat: add show_user tool for terminal markdown rendering feat: Add ShowUser tool, refactor FSRead, and improve Agent event handling Mar 19, 2025
@github-actions github-actions Bot added the type: chore Routine tasks like conversions, reorganization, and maintenance work. label Mar 19, 2025
tusharmath and others added 7 commits March 19, 2025 16:02
Renamed 'claude-tool-description-best-practices.md' to 'tool-guidelines.md' for a more concise and generic filename that better reflects its purpose.

Co-authored-by: Forge <forge@antinomy.ai>
- Add documentation about default user visibility behavior
- Specify requirements for displaying content to users
- Update PLAN mode documentation with new file path conventions

Co-authored-by: Forge <forge@antinomy.ai>
Add the display tool to the default agent configuration, enabling user information display capabilities in the standard setup.

Co-authored-by: Forge <forge@antinomy.ai>
Changed the execute_tool method signature to directly return ToolResult instead of Option<ToolResult>,
simplifying the code flow and removing unnecessary Option unwrapping.

Co-authored-by: Forge <forge@antinomy.ai>
Add a new Agent property 'hide_content' that controls whether an agent's output is displayed in the console. This replaces the previous approach of checking agent ID suffixes.

- Add hide_content field to Agent struct with proper serialization options
- Update Orchestrator to use hide_content flag for filtering messages
- Remove worker ID suffix check in UI output handling
- Update configuration in forge.yaml files to use the new property
- Add tests for merging hide_content property

Co-authored-by: Forge <forge@antinomy.ai>
@tusharmath tusharmath changed the title feat: Add ShowUser tool, refactor FSRead, and improve Agent event handling feat: add show_user tool, refactor FSRead, and improve Agent event handling Mar 19, 2025
tusharmath and others added 2 commits March 19, 2025 19:39
- Fix comment in orchestrator regarding hide_content behavior
- Simplify UI message handling by removing redundant comment
- Update title-generation agent ID format for consistency
- Remove outdated tool description improvement plan document

Co-authored-by: Forge <forge@antinomy.ai>
@tusharmath
tusharmath merged commit 3d57248 into main Mar 19, 2025
@amitksingh1490
amitksingh1490 deleted the user-tool branch October 1, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: chore Routine tasks like conversions, reorganization, and maintenance work. type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant