[PR #9910] feat: add dialog API for plugins #13270

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

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

State: open
Merged: No


Closes #9911

What does this PR do?

Plugins currently can't interact with users beyond tool outputs. This adds a dialog API letting plugins create native interactive dialogs (select, confirm, alert, prompt) with full keyboard support.

Changes

  • packages/opencode/src/dialog/index.ts - Core dialog module
  • packages/opencode/src/server/routes/dialog.ts - Dialog reply endpoint
  • packages/opencode/src/plugin/index.ts - Exposes dialog.show() to plugins
  • packages/plugin/src/index.ts - Plugin-side types and hooks
  • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx - UI handlers

Example plugin

dialog-test.ts

Screenshots

image image image image

How did you verify your code works?

Ran the opencode tests against changes.
Built mock plugins that called the newly implemented dialog api & tested in build

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9910 **State:** open **Merged:** No --- Closes #9911 ### What does this PR do? Plugins currently can't interact with users beyond tool outputs. This adds a dialog API letting plugins create native interactive dialogs (select, confirm, alert, prompt) with full keyboard support. ### Changes - `packages/opencode/src/dialog/index.ts` - Core dialog module - `packages/opencode/src/server/routes/dialog.ts` - Dialog reply endpoint - `packages/opencode/src/plugin/index.ts` - Exposes `dialog.show()` to plugins - `packages/plugin/src/index.ts` - Plugin-side types and hooks - `packages/opencode/src/cli/cmd/tui/routes/session/index.tsx` - UI handlers ### Example plugin [dialog-test.ts](https://gist.github.com/ShamanicArts/b2ae98c0f51ff2e6f7cebc93fa37978f) ### Screenshots <img width="666" height="750" alt="image" src="https://github.com/user-attachments/assets/58010223-ec8c-45d9-b93d-f7efc0f8dfd2" /> <img width="690" height="759" alt="image" src="https://github.com/user-attachments/assets/4362067e-3396-4c0c-810e-476779168b23" /> <img width="679" height="313" alt="image" src="https://github.com/user-attachments/assets/51ef3f07-9aac-46b7-81b7-847461f586a3" /> <img width="543" height="224" alt="image" src="https://github.com/user-attachments/assets/eb981259-9420-45b6-9f30-e2231843bd7e" /> ### How did you verify your code works? Ran the opencode tests against changes. Built mock plugins that called the newly implemented dialog api & tested in build
yindo added the pull-request label 2026-02-16 18:18:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13270