Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(missions): surface tool approval requests

Ruben Lütke99b215e745ad
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx b/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx
index 6734ae816b..5b049f31d5 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx
+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx
@@ -9,6 +9,7 @@ import { cleanup, render } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { useWebSocket } from "@/hooks/useWebSocket";
+import { useI18nStore } from "@/i18n";
import { useEventStore } from "@/store/events";
/** Minimal mock for WebSocket (mirrors __tests__/ws.test.ts). */
@@ -74,7 +75,8 @@ describe("useWebSocket VoiceBootStatus handling", () => {
protocol: "http:",
host: "localhost:5173",
};
- useEventStore.setState({ voiceReady: false });
+ useEventStore.setState({ voiceReady: false, toasts: [] });
+ useI18nStore.getState().setUi("en", { push: false });
});
afterEach(() => {
@@ -102,6 +104,25 @@ describe("useWebSocket VoiceBootStatus handling", () => {
expect(useEventStore.getState().voiceReady).toBe(false);
});
+
+ it("surfaces a mission tool approval request globally without arguments", async () => {
+ render(<Harness />);
+ await Promise.resolve();
+
+ MockWebSocket.last!.deliver(
+ envelope("ActionApprovalRequired", {
+ mission_id: "mission-42",
+ tool_name: "gmail/send_message",
+ args_preview: "private content must not enter the toast",
+ }),
+ );
+
+ const [toast] = useEventStore.getState().toasts;
+ expect(toast.kind).toBe("warning");
+ expect(toast.message).toContain("gmail/send_message");
+ expect(toast.message).toContain("mission-42");
+ expect(toast.message).not.toContain("private content");
+ });
});
describe("useWebSocket connection state (welcome-gated + warming)", () => {
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
index 523fa62d52..9be48b049d 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
@@ -259,6 +259,29 @@ export function useWebSocket(): void {
}
}
+ if (env.event_name === "ActionApprovalRequired") {
+ const p = env.payload as {
+ mission_id?: unknown;
+ tool_name?: unknown;
+ };
+ if (
+ typeof p.mission_id === "string" &&
+ p.mission_id.length > 0 &&
+ typeof p.tool_name === "string" &&
+ p.tool_name.length > 0
+ ) {
+ pushToast(
+ "warning",
+ translate("mission_tool_approvals.toast_pending")
+ .replace("{tool}", p.tool_name)
+ .replace("{mission}", p.mission_id),
+ );
+ window.dispatchEvent(
+ new CustomEvent("jarvis:mission-tool-approval", { detail: p }),
+ );
+ }
+ }
+
if (env.event_name === "AchievementUnlocked") {
const p = env.payload as {
achievement_id?: string;
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 2c235c6162..266eeecce1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2287,6 +2287,7 @@
"pending": "ausstehend",
"select_mission": "Wähle eine Mission aus, um Tool-Anfragen des Supervisors zu prüfen.",
"loading": "Freigaben werden geladen…",
+ "toast_pending": "Freigabe für {tool} in Mission {mission} erforderlich. Öffne Missionen, um sie zu prüfen.",
"load_error": "Freigaben konnten nicht geladen werden.",
"retry": "Erneut versuchen",
"empty_title": "Keine Aktion wartet",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 55b56e1ded..5cb91cbf55 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2288,6 +2288,7 @@
"pending": "pending",
"select_mission": "Select a mission to review supervisor tool requests.",
"loading": "Loading approvals…",
+ "toast_pending": "Approval needed for {tool} in mission {mission}. Open Missions to review it.",
"load_error": "Approvals could not be loaded.",
"retry": "Retry",
"empty_title": "No action waiting",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index dc86e8d409..109ad91a8a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2287,6 +2287,7 @@
"pending": "pendientes",
"select_mission": "Selecciona una misión para revisar las solicitudes de herramientas del supervisor.",
"loading": "Cargando aprobaciones…",
+ "toast_pending": "Se necesita aprobación para {tool} en la misión {mission}. Abre Misiones para revisarla.",
"load_error": "No se pudieron cargar las aprobaciones.",
"retry": "Reintentar",
"empty_title": "No hay acciones en espera",