fix(vscode): wire native notifications from runtime events
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { NotificationPayload, NotificationsAPI } from '@openchamber/ui/lib/api/types';
|
||||
import { sendBridgeMessage } from './bridge';
|
||||
|
||||
type NotifyResponse = { shown?: boolean };
|
||||
|
||||
export const createVSCodeNotificationsAPI = (): NotificationsAPI => ({
|
||||
async notifyAgentCompletion(payload?: NotificationPayload): Promise<boolean> {
|
||||
try {
|
||||
const response = await sendBridgeMessage<NotifyResponse>('notifications:notify', { payload });
|
||||
return Boolean(response?.shown);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
async canNotify(): Promise<boolean> {
|
||||
try {
|
||||
return await sendBridgeMessage<boolean>('notifications:can-notify');
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user