feat(F): F-UI-EDIT AgentEditor component + automation API client

This commit is contained in:
Agent Zero
2026-08-17 17:30:47 +02:00
parent 158feec374
commit 7ed79d3c1f
2 changed files with 442 additions and 0 deletions
+46
View File
@@ -15,6 +15,9 @@ import type {
AgentTool,
AutomationSettings,
MiniAppDef,
AgentToolInfo,
AgentSkillInfo,
AgentRunFull,
} from '@/types/automation';
// ── Automation Hooks ──
@@ -243,6 +246,49 @@ export function useAgentTools() {
});
}
// ── Agent Editor / Chat / Log / Monitor Hooks ──
export function useAgentToolsFull() {
return useQuery({
queryKey: ['agentToolsFull'],
queryFn: async () => {
const res = await apiGet<AgentToolInfo[] | { items: AgentToolInfo[] }>('/agents/tools');
return Array.isArray(res) ? res : res.items ?? [];
},
});
}
export function useAgentSkills() {
return useQuery({
queryKey: ['agentSkills'],
queryFn: async () => {
const res = await apiGet<AgentSkillInfo[] | { items: AgentSkillInfo[] }>('/agents/skills');
return Array.isArray(res) ? res : res.items ?? [];
},
});
}
export function useAgentRunsFull(agentId: string) {
return useQuery({
queryKey: ['agentRunsFull', agentId],
queryFn: async () => {
const res = await apiGet<AgentRunFull[] | { items: AgentRunFull[] }>(`/agents/${agentId}/runs`);
return Array.isArray(res) ? res : res.items ?? [];
},
enabled: !!agentId,
});
}
export function useRecentAgentRuns(limit = 20) {
return useQuery({
queryKey: ['recentAgentRuns', limit],
queryFn: async () => {
const res = await apiGet<AgentRunFull[] | { items: AgentRunFull[] }>(`/agents/runs/recent?limit=${limit}`);
return Array.isArray(res) ? res : res.items ?? [];
},
});
}
// ── Agent Communication Hooks ──
export function useSendAgentMessage() {