feat: Adds optional read-only response to confirm_ask #3929
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As proposed in #3928
This changes the existing
confirm_askprompt from:Add file to the chat? (Y)es/(N)o/(D)on't ask again [Yes]:To
Add file to the chat? (Y)es/(N)o/(R)ead-only/(D)on't ask again [Yes]:It also lays the groundwork for the extension of the
confirm_askmethod to accept conditional/other responses in various contexts through the use of the string response type. This does produce a touch of code sprawl as there's a need to test for whether thereturn_stringparameter is set in certain situations. Very open to feedback about how best to implement this.The key points of the implementation are:
show_readonlyparameter to theconfirm_askmethod inaider/io.pyto control when the "Read-only" option appearsreturn_stringparameter to control the return typecheck_for_file_mentionsto use the new string return valuesThe implementation ensures that:
Also note that this PR includes an unrelated edit that was flagged by the commit hook. This import is not used and caused the commit hook to fail.
-451,8 @@ def test_tool_output_color_handling(self): from rich.text import TextPlease do not hesitate to provide critical feedback!
Warm regards,
Finn