[PR #11567] fix(types): plugin trigger types are now correct and safe #13840

Open
opened 2026-02-16 18:18:40 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11567

State: open
Merged: No


What does this PR do?

Fixes #7147

Related to #12042 (@aryasaatvik helped uncover the issue that led to a split)

This PR fixes a long standing issue with the plugin trigger types not being aligned. They are now FULLY correct and resilient to future divergence.

Note

I strongly recommend this be followed up with #12042 which will start the migration from the v1 SDK to v2. It's implemented as a non-breaking change and will align nicely with this one.

How did you verify your code works?

Typescript, baby!

Current State

Here's a great example of how this is currently broken, mess up a plugin hook type and see nothing happen:

opencode – pluginsrcindex ts 2026-01-31 at 11 54 45 PM

After This PR

Everything is happy with the correct plugin trigger types!

opencode – srcpermissionindex ts 2026-01-31 at 11 11 22 PM

And if we break them, incorrect types will propagate errors as the good Anders Hejlsberg intended!

opencode – srcpermissionindex ts 2026-01-31 at 11 11 05 PM
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11567 **State:** open **Merged:** No --- ### What does this PR do? Fixes #7147 Related to #12042 (@aryasaatvik helped uncover the issue that led to a split) This PR fixes a long standing issue with the plugin trigger types not being aligned. They are now FULLY correct and resilient to future divergence. > [!NOTE] > I strongly recommend this be followed up with #12042 which will start the migration from the `v1` SDK to `v2`. It's implemented as a non-breaking change and will align nicely with this one. ### How did you verify your code works? **Typescript, baby!** #### Current State Here's a great example of how this is currently broken, mess up a plugin hook type and see nothing happen: <img width="1503" height="213" alt="opencode – pluginsrcindex ts 2026-01-31 at 11 54 45 PM" src="https://github.com/user-attachments/assets/0bba4164-8aab-43f3-b6d2-b9fa36f1fac8" /> #### After This PR Everything is happy with the correct plugin trigger types! <img width="1628" height="446" alt="opencode – srcpermissionindex ts 2026-01-31 at 11 11 22 PM" src="https://github.com/user-attachments/assets/46bfa3e6-edfa-44b3-a0a7-17859fb73550" /> And if we break them, incorrect types will propagate errors as the good Anders Hejlsberg intended! <img width="1594" height="490" alt="opencode – srcpermissionindex ts 2026-01-31 at 11 11 05 PM" src="https://github.com/user-attachments/assets/1d93a6d8-af3a-42be-9ecc-c4f5e543214b" />
yindo added the pull-request label 2026-02-16 18:18:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13840