feat(opencode): add isReadOnly and isDestructive flags to tool interface#20297
Open
AndresCdo wants to merge 3 commits intoanomalyco:devfrom
Open
feat(opencode): add isReadOnly and isDestructive flags to tool interface#20297AndresCdo wants to merge 3 commits intoanomalyco:devfrom
AndresCdo wants to merge 3 commits intoanomalyco:devfrom
Conversation
Add optional isReadOnly and isDestructive metadata to Tool.Def interface. Applied to 11 built-in tools: Read-only: read, glob, grep, list, webfetch, codesearch Destructive: write, edit, apply_patch, multiedit Neutral: todowrite (isReadOnly: false) These flags enable permission systems and auto-approval classifiers to make smarter decisions without analyzing tool behavior at runtime. Closes anomalyco#20296
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #20296
Type of change
What does this PR do?
Adds optional
isReadOnlyandisDestructivemetadata flags to theTool.Definterface. These flags enable the permission system, auto-approval classifiers, and UI to make smarter decisions about tool behavior without analyzing tool internals at runtime.Annotated 11 built-in tools:
Tools not annotated:
bash(dynamic — can be read-only or destructive depending on command),task,websearch,skill,lsp,plan_exit,plan_enter,question,invalid,batch— these have complex or context-dependent behavior.How did you verify your code works?
bun typecheckpasses (zero errors in changed files)Screenshots / recordings
Not a UI change.
Checklist