How to use @opencode-ai/plugin types? Incorrect export map in package.json #1109

Closed
opened 2026-02-16 17:29:29 -05:00 by yindo · 6 comments
Owner

Originally created by @ericc-ch on GitHub (Aug 4, 2025).

Originally assigned to: @thdxr on GitHub.

Hey I'm really excited since the new plugin feature just released

But how should I use the types?

Image

The docs says to just import it from the package, so my instinct is to just bun i -D @opencode-ai/plugin

But it's throwing this error

Image

since the export map points to ./src/index.ts

Image
Originally created by @ericc-ch on GitHub (Aug 4, 2025). Originally assigned to: @thdxr on GitHub. Hey I'm really excited since the new plugin feature just released But how should I use the types? <img width="803" height="386" alt="Image" src="https://github.com/user-attachments/assets/2069cd9e-c182-46e8-bf34-c78466c2b7dc" /> The docs says to just import it from the package, so my instinct is to just `bun i -D @opencode-ai/plugin` But it's throwing this error <img width="1165" height="253" alt="Image" src="https://github.com/user-attachments/assets/3fb7ca11-7f78-4b9e-a20f-5363743b27bb" /> since the export map points to `./src/index.ts` <img width="645" height="493" alt="Image" src="https://github.com/user-attachments/assets/7c1ecb48-2e53-484f-8e00-ef4fe0aca8dd" />
yindo closed this issue 2026-02-16 17:29:29 -05:00
Author
Owner

@ericc-ch commented on GitHub (Aug 4, 2025):

If this is a bug, I've made a PR here

https://github.com/sst/opencode/pull/1608

@ericc-ch commented on GitHub (Aug 4, 2025): If this is a bug, I've made a PR here https://github.com/sst/opencode/pull/1608
Author
Owner

@ericc-ch commented on GitHub (Aug 4, 2025):

Apparently the params typing is also broken for me

Image Image

is it because these 3 are re-exported from another package? I think re-exports should work just fine. It shows app: App yet there's no autocomplete whatsoever.

Image

Edit: Is it because it is re-exported but neither bun or @opencode-ai/sdk is listed as dependencies?

Image
@ericc-ch commented on GitHub (Aug 4, 2025): Apparently the params typing is also broken for me <img width="785" height="389" alt="Image" src="https://github.com/user-attachments/assets/9c7d2eda-6e79-4fd6-a2e6-ec8095d075cf" /> <img width="785" height="389" alt="Image" src="https://github.com/user-attachments/assets/0fb6b7c0-dd10-4f48-b207-e7e23226005d" /> is it because these 3 are re-exported from another package? I think re-exports should work just fine. It shows `app: App` yet there's no autocomplete whatsoever. <img width="1236" height="437" alt="Image" src="https://github.com/user-attachments/assets/7027c8c9-f626-4408-87a6-44e349c57e65" /> --- Edit: Is it because it is re-exported but neither `bun` or `@opencode-ai/sdk` is listed as dependencies? <img width="609" height="551" alt="Image" src="https://github.com/user-attachments/assets/6c587ce3-4f4b-4d5d-8a44-1775c5f15d49" />
Author
Owner

@ericc-ch commented on GitHub (Aug 4, 2025):

I managed to get it working after installing

bun i -D @opencode-ai/sdk @types/bun

Image

Should we add it to package.json deps?

@ericc-ch commented on GitHub (Aug 4, 2025): I managed to get it working after installing `bun i -D @opencode-ai/sdk @types/bun` <img width="806" height="183" alt="Image" src="https://github.com/user-attachments/assets/b06867bc-6b70-4736-8e0a-fce32e11cb6f" /> Should we add it to `package.json` deps?
Author
Owner

@ericc-ch commented on GitHub (Aug 4, 2025):

@thdxr the types from opencode works now, but $ from bun is still not working (this is after updating to 0.3.129)

Image
@ericc-ch commented on GitHub (Aug 4, 2025): @thdxr the types from opencode works now, but `$` from bun is still not `working` (this is after updating to 0.3.129) <img width="655" height="235" alt="Image" src="https://github.com/user-attachments/assets/31c8a20a-d617-4e83-94ac-4c87fb5c8dbc" />
Author
Owner

@thdxr commented on GitHub (Aug 4, 2025):

ah need to think about this one - this type comes from bun types need to see if we can re-export it

@thdxr commented on GitHub (Aug 4, 2025): ah need to think about this one - this type comes from bun types need to see if we can re-export it
Author
Owner

@ericc-ch commented on GitHub (Aug 5, 2025):

everything's fixed now. thanks!
now the hard part is writing actual plugins lol

cheers!

@ericc-ch commented on GitHub (Aug 5, 2025): everything's fixed now. thanks! now the hard part is writing actual plugins lol cheers!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1109