plugin hook types not aligned with runtime triggers and missing v2 sdk #4633

Open
opened 2026-02-16 17:44:52 -05:00 by yindo · 1 comment
Owner

Originally created by @aryasaatvik on GitHub (Jan 10, 2026).

Originally assigned to: @thdxr on GitHub.

Summary

The current @opencode-ai/plugin package imports types from @opencode-ai/sdk (v1), which uses nested path/body/query parameters. The v2 SDK introduced flattened parameters and new permission types (PermissionRequest with reply: once/always/reject), but there is no way for plugins to access these v2 types.

Use Case

When building plugins that need to:

  1. Use the v2 SDK flattened API (sessionID instead of path.id, no body wrapper)
  2. Access the new PermissionRequest type for permission hooks
  3. Import FilePart from the v2 SDK for tool attachments

Currently plugins must import from @opencode-ai/sdk directly and manually align types, which is error-prone and defeats the purpose of the plugin package.

Proposed Solution

Add v2 subpath exports to @opencode-ai/plugin:

  • @opencode-ai/plugin/v2 - Plugin types importing from @opencode-ai/sdk/v2
  • @opencode-ai/plugin/v2/tool - Tool definition with v2 FilePart

This allows plugins to migrate incrementally while maintaining backward compatibility with v1.

Related

PR: #7639

Originally created by @aryasaatvik on GitHub (Jan 10, 2026). Originally assigned to: @thdxr on GitHub. ## Summary The current @opencode-ai/plugin package imports types from @opencode-ai/sdk (v1), which uses nested path/body/query parameters. The v2 SDK introduced flattened parameters and new permission types (PermissionRequest with reply: once/always/reject), but there is no way for plugins to access these v2 types. ## Use Case When building plugins that need to: 1. Use the v2 SDK flattened API (sessionID instead of path.id, no body wrapper) 2. Access the new PermissionRequest type for permission hooks 3. Import FilePart from the v2 SDK for tool attachments Currently plugins must import from @opencode-ai/sdk directly and manually align types, which is error-prone and defeats the purpose of the plugin package. ## Proposed Solution Add v2 subpath exports to @opencode-ai/plugin: - @opencode-ai/plugin/v2 - Plugin types importing from @opencode-ai/sdk/v2 - @opencode-ai/plugin/v2/tool - Tool definition with v2 FilePart This allows plugins to migrate incrementally while maintaining backward compatibility with v1. ## Related PR: #7639
Author
Owner

@github-actions[bot] commented on GitHub (Jan 10, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7147: Plugin package not using latest SDK types

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 10, 2026): This issue might be a duplicate of existing issues. Please check: - #7147: Plugin package not using latest SDK types Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4633