fix: embedding migration, worker error handling, path traversal security, response mismatches (unread-count, plugins, manifests), frontend type safety

This commit is contained in:
Agent Zero
2026-07-24 14:23:28 +02:00
parent c3c5233e58
commit 7b4a2c0791
10 changed files with 161 additions and 31 deletions
+26 -3
View File
@@ -6,6 +6,17 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { apiGet, apiPatch, apiDelete } from './client';
import { PaginatedResponse } from './types';
// ── Types matching backend schemas ──
export interface NotificationItem {
id: string;
type: string;
title: string;
body?: string | null;
read_at?: string | null;
created_at?: string | null;
}
export interface NotificationTypeItem {
type_key: string;
plugin_name: string;
@@ -16,17 +27,29 @@ export interface NotificationTypeItem {
is_enabled: boolean;
}
export interface UnreadCountResponse {
count: number;
}
export interface NotificationPreferenceItem {
type_key: string;
is_enabled: boolean;
}
export function useNotifications() {
return useQuery({
queryKey: ['notifications'],
queryFn: () => apiGet<PaginatedResponse<any>>('/notifications'),
queryFn: () => apiGet<PaginatedResponse<NotificationItem>>('/notifications'),
});
}
export function useUnreadNotificationCount() {
return useQuery({
queryKey: ['notifications', 'unread-count'],
queryFn: () => apiGet<number>('/notifications/unread-count'),
queryFn: async () => {
const data = await apiGet<UnreadCountResponse>('/notifications/unread-count');
return data.count;
},
});
}
@@ -60,7 +83,7 @@ export function useNotificationTypes() {
export function useNotificationPreferences() {
return useQuery({
queryKey: ['notification-preferences'],
queryFn: () => apiGet<{ items: { type_key: string; is_enabled: boolean }[] }>('/notifications/preferences'),
queryFn: () => apiGet<{ items: NotificationPreferenceItem[] }>('/notifications/preferences'),
});
}