fix(plugin): restore permission ask hook - #39442
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that are worth noting: Related PRs (Not Duplicates)
No duplicate PRs found |
|
We are very keen to see this PR land. This hook is the missing primitive for building genuinely useful permission-review plugins rather than either prompting for everything or blindly auto-approving everything. That feels especially timely now that OpenAI is pushing Luna more explicitly as a request-approval/review model: a cheaper second model reviews proposed actions, allows low-risk requests, and leaves higher-risk actions for the user. OpenCode cannot cleanly implement comparable features in plugins while The overall shape of this patch looks right to us: static We did notice two implementation details that seem worth tightening before merge:
Neither point changes our strong support for the PR or the API direction. We would really like this capability available: it is a small hook with disproportionately useful consequences for safer, lower-friction OpenCode workflows. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Fixes #7006
Type of change
What does this PR do?
Restores the declared
permission.askplugin hook before OpenCode prompts the user. Plugins can allow or deny requests that static rules resolve toask; plugin failures fall back to the normal prompt.This rebases the approach from #30509 onto the current Effect/LayerNode service shape and credits @yohi's original implementation. The hook receives the current v2
PermissionRequesttype and a copy of mutable request data.How did you verify your code works?
Checklist