Skip to content

Conversation

@nielpattin
Copy link

Add optional askPermission to plugin ToolContext

Summary

  • Plugins can now call ctx.askPermission() to request user confirmation before sensitive operations
  • Made the property optional to avoid breaking existing plugins

Details

This hooks into the existing Permission.ask() system so plugins get the same permission UX as built-in tools.

Example usage in a plugin:

execute: async (ctx, input) => {
  if (ctx.askPermission) {
    await ctx.askPermission({
      tool: "dangerous-tool",
      message: `About to delete ${input.path}`,
    })
  }
  // proceed with operation
}

Testing

  • Existing plugins (without askPermission) still work
  • New plugins can opt-in to permission prompts

Checklist

  • Types are backward compatible (optional property)
  • No breaking changes for existing plugins

Demo:

(Ignore the skill tool mention, it's just a plugin that use the same format as the native skill support)

WindowsTerminal_roeVGaFi3l.mp4

Used locally on nielpattin/opencode-skillful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant