-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
What
Plugins can now request permission from users before performing sensitive operations via ctx.askPermission().
Why
Currently, plugins have no way to prompt users for confirmation before destructive actions (file deletions, external API calls, etc). This makes it risky to use plugins in automated or YOLO mode.
With this change, plugin authors can:
- Request explicit user consent before dangerous operations
- Provide clear descriptions of what will happen
- Respect the user's permission preferences
Changes
packages/plugin/src/tool.ts- Added optionalaskPermissiontoToolContexttypepackages/opencode/src/tool/registry.ts- Injects permission wrapper into plugin context
Backward Compatibility
The property is optional (askPermission?:), so existing plugins continue to work without modification.
Plugins that want to use this feature can check for its existence:
if (ctx.askPermission) {
await ctx.askPermission({
tool: "my-plugin",
message: "Delete all temp files?",
})
}Demo: PR: 6042
(Ignore the skill tool mention, it's just a plugin that use the same format as the native skill support)
WindowsTerminal_roeVGaFi3l.mp4
Metadata
Metadata
Assignees
Labels
discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion