feat(js/plugins/middleware): implemented filesystem middleware#5051
feat(js/plugins/middleware): implemented filesystem middleware#5051pavelgj wants to merge 8 commits intopj/gm-middleware-skillsfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new filesystem middleware for Genkit, providing tools for listing, reading, writing, and editing files within a restricted root directory. The review identified several critical issues regarding concurrency and protocol compliance. Specifically, the use of a shared messageQueue in the middleware factory creates a race condition where messages from different requests could be mixed or lost. Additionally, the error handling in the tool execution hook fails to return a required tool response, which would likely cause API errors in subsequent LLM calls. There is also a bug in the search_and_replace tool where special characters in the replacement string could lead to file corruption; a suggestion was provided to use a replacement function to treat the content as a literal.
…e functional replacement in search-and-replace
No description provided.