summaryrefslogtreecommitdiff
path: root/makima/frontend/src/lib
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-22 01:26:53 +0000
committerGitHub <noreply@github.com>2026-01-22 01:26:53 +0000
commitb61a907bac09a7649ca3f6d850e771b3b75c7015 (patch)
treea7794d5b29bc165b6d76596d6e53cf75158d3a64 /makima/frontend/src/lib
parentb84b3f782d3a3d6bf7ed8040fd72907ca19db8c6 (diff)
downloadsoryu-b61a907bac09a7649ca3f6d850e771b3b75c7015.tar.gz
soryu-b61a907bac09a7649ca3f6d850e771b3b75c7015.zip
Add daemon restart feature from settings (#18)
* Add daemon restart feature from settings This adds the ability to restart a connected daemon from the settings page. The feature includes: - Backend: RestartDaemon command added to DaemonCommand enum - Backend: New POST /api/v1/mesh/daemons/{id}/restart endpoint - Backend: Daemon gracefully shuts down tasks and exits with code 42 (can be used by process managers like systemd to detect restart requests) - Frontend: restartDaemon() API function - Frontend: Restart button in Connected Daemons section of settings - Frontend: Confirmation dialog before restart to prevent accidental restarts When a daemon receives the restart command, it: 1. Gracefully shuts down all running Claude processes (5s timeout) 2. Exits with code 42 to signal restart requested 3. The daemon can be restarted by a process manager or manually Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/frontend/src/lib')
-rw-r--r--makima/frontend/src/lib/api.ts23
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
// =============================================================================