Skip to content

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

@aryasaatvik

Description

@aryasaatvik

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions