Skip to content

Conversation

bhouston
Copy link
Member

@bhouston bhouston commented Mar 4, 2025

Closes #63\n\n## Overview\nThis PR refactors the toolAgent.ts file into several smaller, focused modules to improve maintainability and testability:\n\n- config.ts: Extracted configuration-related code\n- messageUtils.ts: Extracted message handling utilities\n- toolExecutor.ts: Extracted tool execution logic\n- tokenTracking.ts: Enhanced the existing TokenTracker with more utilities\n- toolAgent/index.ts: Simplified main file that orchestrates the components\n- types.ts: Consolidated all type definitions\n\n## Benefits\n- Improved maintainability with smaller, focused files\n- Better testability through isolated components\n- Clearer responsibilities with each module having a single purpose\n- Easier onboarding for new developers\n- Simpler future extensions with a modular design\n\n## Implementation\n- Extracted types to a separate file\n- Extracted configuration\n- Moved utility functions to their respective files\n- Refactored the main toolAgent function to use the new modules\n- Added backward compatibility layer in the original toolAgent.ts\n- Added documentation in README.md\n\n## Testing\nAll existing tests pass, demonstrating backward compatibility.

@bhouston bhouston merged commit a9bcdd4 into main Mar 4, 2025
1 check passed
Copy link

sentry-io bot commented Mar 4, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AI_InvalidToolArgumentsError: Invalid arguments for tool subAgent: Type validation failed: Value: {"description":"Update config test file to match new default config values","goal":"Update the /Users/benhouston/Coding/Business/mycoder/packages/cli/tests/settings/config.test.ts fi... toolAgent(index.ts) View Issue
  • ‼️ AI_APICallError: The security token included in the request is invalid. toolAgent(index.ts) View Issue
  • ‼️ AI_RetryError: Failed after 3 attempts. Last error: Too many tokens, please wait before trying again. toolAgent(index.ts) View Issue
  • ‼️ Error: 400 The last message of deepseek-reasoner must be a user message, or an assistant message with prefix mode on (refer to https://api-docs.deepseek.com/guides/chat_prefix_completion). Object.doGenerate(config.ts) View Issue

Did you find this useful? React with a 👍 or 👎

Copy link

🎉 This PR is included in version mycoder-agent-v1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version mycoder-v1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bhouston bhouston deleted the feature/refactor-tool-agent branch March 12, 2025 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor toolAgent.ts into modular components

1 participant