[PR #3604] opentui: feat: Implement POST /tui/toast-show #10707

Closed
opened 2026-02-16 18:15:26 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: Yes


Bonus: refactor: Instead of using sdk.event.on("string"), use sdk.event.on(TuiEvent.<EventName>.type) for better type safety and discoverability.

@rekram1-node I manually updated the types in types.gen.ts to include duration. I think I was exhaustive (I grepped codebase for variant:), so I don't think a regen is needed.

Example:

bun dev spawn --port 9090
curl -X 'POST' \
  'http://localhost:9090/tui/show-toast' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Test Toast",
  "message": "This is a test toast of type error",
  "variant": "error",
  "duration": 3000
}'

title is optional
duration is optional, defaults to 5000, as before

image

Appearance of toast without title is unchanged

image
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3604 **State:** closed **Merged:** Yes --- Bonus: refactor: Instead of using `sdk.event.on("string")`, use `sdk.event.on(TuiEvent.<EventName>.type)` for better type safety and discoverability. @rekram1-node I manually updated the types in `types.gen.ts` to include `duration`. I think I was exhaustive (I grepped codebase for `variant:`), so I don't think a regen is needed. ## Example: ``` bun dev spawn --port 9090 ``` ``` curl -X 'POST' \ 'http://localhost:9090/tui/show-toast' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "title": "Test Toast", "message": "This is a test toast of type error", "variant": "error", "duration": 3000 }' ``` **title is optional** **duration is optional, defaults to 5000, as before** <img width="968" height="318" alt="image" src="https://github.com/user-attachments/assets/2962f513-3fe0-4d6b-bed1-3ae6ba44626f" /> ### Appearance of toast without title is unchanged <img width="814" height="182" alt="image" src="https://github.com/user-attachments/assets/6866c768-831a-490f-b621-f74a33b7c52e" />
yindo added the pull-request label 2026-02-16 18:15:26 -05:00
yindo closed this issue 2026-02-16 18:15:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10707