import type { Agent, AgentKeyCreated, HeartbeatRun } from "@paperclip/shared"; import { api } from "./client"; export interface OrgNode { id: string; name: string; role: string; status: string; reports: OrgNode[]; } export const agentsApi = { list: (companyId: string) => api.get(`/companies/${companyId}/agents`), org: (companyId: string) => api.get(`/companies/${companyId}/org`), get: (id: string) => api.get(`/agents/${id}`), create: (companyId: string, data: Record) => api.post(`/companies/${companyId}/agents`, data), update: (id: string, data: Record) => api.patch(`/agents/${id}`, data), pause: (id: string) => api.post(`/agents/${id}/pause`, {}), resume: (id: string) => api.post(`/agents/${id}/resume`, {}), terminate: (id: string) => api.post(`/agents/${id}/terminate`, {}), createKey: (id: string, name: string) => api.post(`/agents/${id}/keys`, { name }), invoke: (id: string) => api.post(`/agents/${id}/heartbeat/invoke`, {}), wakeup: ( id: string, data: { source?: "timer" | "assignment" | "on_demand" | "automation"; triggerDetail?: "manual" | "ping" | "callback" | "system"; reason?: string | null; payload?: Record | null; idempotencyKey?: string | null; }, ) => api.post(`/agents/${id}/wakeup`, data), };