diff options
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index 86ff06c..efa72a2 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1087,6 +1087,29 @@ export async function getDaemon(id: string): Promise<Daemon> { return res.json(); } +/** Response from the restart daemon endpoint */ +export interface RestartDaemonResponse { + success: boolean; + daemonId: string; + message: string; +} + +/** + * Restart a connected daemon. + * Sends a restart command to the daemon, which will gracefully terminate + * and restart. Any running tasks will be interrupted. + */ +export async function restartDaemon(id: string): Promise<RestartDaemonResponse> { + const res = await authFetch(`${API_BASE}/api/v1/mesh/daemons/${id}/restart`, { + method: "POST", + }); + if (!res.ok) { + const errorData = await res.json().catch(() => ({})); + throw new Error(errorData.message || `Failed to restart daemon: ${res.statusText}`); + } + return res.json(); +} + // ============================================================================= // Mesh Chat Types for Task Orchestration // ============================================================================= |
