feat(plugins): notifications with command buttons (#1974)

Adds API 1.3 `ui.notify(level, title, body, actions) -> result<_, error>`: up to three buttons, each running one of the plugin's declared commands with an optional argument in the balloon's window and dismissing the balloon. An invalid action or an undeclared command fails the call and shows nothing. The plugin `Notification` event carries the actions; SDK `host::notify_with_actions` and `NotificationAction`. Closes #1955.

Co-authored-by: arnaud-ritti <[email protected]>
Цей коміт міститься в:
Arnaud Ritti authored and GitHub committed 2026-11-07 22:35:36 +08:00
1 джерело f3837e0fe7
коміт 112ed773fb
43 files changed
+419 -39

No files matched your search

+8 -1
Переглянути файл
@@ -540,7 +540,14 @@ export function createMemoryPluginsBackend(
if (commandId === "word-count") {
if (!activeFile) throw new IpcError({ kind: "internal", message: "no file is open in the editor" });
const name = activeFile.split("/").pop() ?? activeFile;
emit({ type: "notification", pluginId, level: "info", title: `Word count: ${name}`, body: "(simulated)" });
emit({
type: "notification",
pluginId,
level: "info",
title: `Word count: ${name}`,
body: "(simulated)",
actions: [],
});
return null;
}
throw new IpcError({ kind: "internal", message: `unknown command: ${commandId}` });