fix(vscode): wire native notifications from runtime events

This commit is contained in:
Bohdan Triapitsyn
2026-02-24 13:18:48 +02:00
parent 5ab9b1a96e
commit 69c5bbf99a
7 changed files with 192 additions and 28 deletions
+32
View File
@@ -79,6 +79,16 @@ type ApiProxyResponsePayload = {
bodyBase64: string;
};
type NotificationBridgePayload = {
title?: string;
body?: string;
tag?: string;
};
type NotificationsNotifyRequestPayload = {
payload?: NotificationBridgePayload;
};
interface FileEntry {
name: string;
path: string;
@@ -2792,6 +2802,28 @@ export async function handleBridgeMessage(message: BridgeRequest, ctx?: BridgeCo
}
}
case 'notifications:can-notify': {
return { id, type, success: true, data: true };
}
case 'notifications:notify': {
const request = (payload || {}) as NotificationsNotifyRequestPayload;
const notification = request.payload || {};
const title = typeof notification.title === 'string' ? notification.title.trim() : '';
const body = typeof notification.body === 'string' ? notification.body.trim() : '';
const message = title && body
? `${title}: ${body}`
: title || body;
if (!message) {
return { id, type, success: true, data: { shown: false } };
}
void vscode.window.showInformationMessage(message);
return { id, type, success: true, data: { shown: true } };
}
// ============== Git Operations ==============
case 'api:git/check': {