feat(F): F-UI-EDIT AgentEditor component + automation API client
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user