-
Notifications
You must be signed in to change notification settings - Fork 73
feat: initial fsWrite chat message #1026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
switch (toolUse.name) { | ||
case 'fsRead': | ||
case 'listDirectory': | ||
// no need to write tool result for listDir and fsRead into chat stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can I know the reason, Why ? May be I am missing some context here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are sending it before running the tool above, but actually it might make more sense to move it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should send the tool use with the list of paths before we run it, so we tell the user what we're doing before we're actually doing it.
I can see us update a spinner to a checkmark here upon completion.
But we don't have to repeat the tool output (the list of files, the status of the edit) unless there is an error.
const fileName = path.basename(input.path) | ||
// TODO: right now diff changes is coupled with fsWrite class, we should move it to shared utils | ||
const fsWrite = new FsWrite(this.#features) | ||
const diffChanges = await fsWrite.getDiffChanges(input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a static, but even better would be in a shared util like you mentioned so the representation is not coupled with the tool itself.
header: { | ||
...header, | ||
// TODO: this is specific to fsWrite tool, modify for other tools as needed | ||
fileList: { ...header?.fileList, fileTreeTitle: '', hideFileCount: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is only this line going to be modified for other tools or all of it? If so, just wondering if it makes sense to pull this out to a different file so that its easy to understand which tools have which interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to separating this logic out.
header: { | ||
...header, | ||
// TODO: this is specific to fsWrite tool, modify for other tools as needed | ||
fileList: { ...header?.fileList, fileTreeTitle: '', hideFileCount: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to separating this logic out.
// no need to write tool result for listDir and fsRead into chat stream | ||
if (toolUse.name !== 'fsRead' && toolUse.name !== 'listDirectory') { | ||
await chatResultStream.writeResultBlock({ body: toolResultMessage(toolUse, result) }) | ||
switch (toolUse.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of future MCP support, I think this tool specific branching should be isolated from the core logic. This also won't scale well as we add more tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the suggestions to separating out the tool specific logic from the main controller, but that can be done as a follow-up once we have all the tools in there.
Problem
Initial FsWrite tool message implementation
Solution
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.