fix(plugin): prevent duplicate plugin function initialization
Fixes #6596 If in plugin file you have two exports: export const YourPlugin: Plugin = async () => { ... } export default YourPlugin
// When imported: const mod = await import(plugin) Object.entries(mod) // Returns: [["YourPlugin", fn], ["default", fn]] // Both point to the SAME function reference
So the plugin function fn gets called twice in the loop, creating two separate hook instances. The seen Set now catches this by checking if we've already processed that exact function reference.
Im building an opencode plugin and noticed the issue, in the video you can see i run bun run dev with the fix and when running oc alias for opencode it calls plugin twice.
https://github.com/user-attachments/assets/d25e123a-dfc4-4b6b-9681-352bbba2bf09