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.

Merge branch 'main' into sync/local-main-20261002

rubenluetke10-beepc38de0847b95
diff --cc jarvis/ui/web/agent_chat_routes.py
index 517760f87f,749fda2e74..d88a9e1067
--- a/jarvis/ui/web/agent_chat_routes.py
+++ b/jarvis/ui/web/agent_chat_routes.py
@@@ -93,35 -92,36 +93,65 @@@ HIDDEN_SURFACES: frozenset[str] = froze
router = APIRouter(prefix="/api/agent-chat", tags=["agent-chat"])
+class ChatSelectionBody(BaseModel):
+ provider: str = Field(min_length=1)
+ model: str = ""
+ effort: str = ""
+ account_id: str = ""
+
+
[email protected]("/selection", summary="Remember the model for new Jarvis chats and agents")
+async def save_chat_selection(body: ChatSelectionBody, request: Request) -> dict[str, str]:
+ from jarvis.agent_chat.store import ChatSelection
+
+ provider = body.provider.strip().lower()
+ if not offers("jarvis", provider):
+ raise HTTPException(400, "This provider is not offered on the Jarvis chat")
+ if body.account_id:
+ from jarvis import agent_accounts
+ from jarvis.agent_chat.catalog import provider_row
+
+ account = agent_accounts.resolve(body.account_id)
+ row = provider_row(provider)
+ if account is None or row is None or account.platform != row.agent:
+ raise HTTPException(400, "This subscription account does not belong to the provider")
+ selection = ChatSelection(
+ provider, body.model.strip(), normalize_effort(provider, body.effort), body.account_id
+ )
+ _service(request).store.save_chat_selection(selection)
+ return selection.to_dict()
+
+
+ class VoiceChatBody(BaseModel):
+ #: The Jarvis chat on stage; ``None`` = a blank page (the next call opens a new chat).
+ session_id: str | None = None
+
+
+ class VoiceChatResponse(BaseModel):
+ session_id: str | None
+ fresh: bool
+
+
+ def _voice_chat_answer(svc: AgentChatService) -> VoiceChatResponse:
+ return VoiceChatResponse(session_id=svc.voice_chat_id, fresh=svc.voice_chat_fresh)
+
+
+ @router.get("/voice-chat", summary="The Jarvis chat voice calls continue")
+ async def get_voice_chat(request: Request) -> VoiceChatResponse:
+ return _voice_chat_answer(_service(request))
+
+
+ @router.put("/voice-chat", summary="Continue voice calls in this Jarvis chat")
+ async def put_voice_chat(body: VoiceChatBody, request: Request) -> VoiceChatResponse:
+ """Bind the chat the front page shows: calls file into it and start with its history."""
+ svc = _service(request)
+ try:
+ svc.bind_voice_chat(body.session_id or None)
+ except NoSuchSession as exc:
+ raise HTTPException(status_code=404, detail="no-such-jarvis-chat") from exc
+ return _voice_chat_answer(svc)
+
+
@router.get("/commands", summary="List chat slash commands and their availability")
def list_chat_commands(request: Request, session_id: str | None = None) -> dict[str, Any]:
try:
@@@ -709,17 -704,64 +740,72 @@@ def list_sessions
return {"sessions": out}
+ def _title_jarvis_chats(request: Request, svc: Any, rows: list[dict[str, Any]]) -> None:
+ """Give the Jarvis chats a topic title instead of their first words.
+
+ Only the ``jarvis`` surface — the front page's own history — is retitled;
+ an agent's chat keeps the title its first message gave it. A title the user
+ typed is recognised by the titler and kept.
+ """
+ from jarvis.agent_chat.store import _title_from
+ from jarvis.sessions import chat_titles
+
+ now = int(time.time() * 1000)
+ requests: list[chat_titles.TitleRequest] = []
+ for row in rows:
+ if row.get("surface") != "jarvis":
+ continue
+ sid = str(row["session_id"])
+
+ def load(sid: str = sid) -> list[tuple[str, str]]:
+ texts: list[tuple[str, str]] = []
+ for event in svc.store.list_events(sid):
+ text = str((event.get("payload") or {}).get("text") or "")
+ if event["kind"] == "user_message":
+ texts.append(("user", text))
+ elif event["kind"] == "agent_message":
+ texts.append(("agent", text))
+ elif event["kind"] == "assistant_text":
+ texts.append(("assistant", text))
+ return texts
+
+ updated = int(row.get("updated_ms") or 0)
+ requests.append(chat_titles.TitleRequest(
+ kind=chat_titles.KIND_TYPED,
+ conv_id=sid,
+ version=str(int(row.get("message_count") or 0)),
+ message_count=int(row.get("message_count") or 0),
+ updated_ms=updated,
+ settled=not row.get("running")
+ and now - updated >= chat_titles.TYPED_SETTLE_S * 1000,
+ seed=str(row.get("title") or ""),
+ loader=load,
+ auto_title=_title_from,
+ ))
+ if not requests:
+ return
+ try:
+ titles = chat_titles.titler_for_state(request.app.state).titles_for(requests)
+ except Exception: # noqa: BLE001 - the stored title is a fine answer; logged
+ log.warning("Jarvis chat titles unavailable, keeping the stored ones", exc_info=True)
+ return
+ for row in rows:
+ key = (chat_titles.KIND_TYPED, str(row["session_id"]))
+ if key in titles:
+ row["title"] = titles[key]
+
+
@router.post("/sessions", status_code=201)
-async def create_session(body: CreateSessionBody, request: Request) -> dict[str, Any]:
+def create_session(body: CreateSessionBody, request: Request) -> dict[str, Any]:
svc = _service(request)
+ if body.account_id:
+ from jarvis import agent_accounts
+ from jarvis.agent_chat.catalog import provider_row
+
+ account = agent_accounts.resolve(body.account_id)
+ row = provider_row(body.provider)
+ if account is None or row is None or account.platform != row.agent:
+ raise HTTPException(400, "This subscription account does not belong to the provider")
ladder = ladder_key(body.surface, resolve_runner(body.provider, surface=body.surface))
if body.permission_mode and not is_permission_mode(ladder, body.permission_mode):
raise HTTPException(
diff --cc jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
index e94818a707,3e416d3fd4..dd0d7a5744
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
@@@ -5,7 -5,7 +5,8 @@@ import { ApiKeyForm } from "@/component
import { BrainModelSelector } from "@/components/BrainModelSelector";
import { OpenRouterTtsControls } from "@/components/OpenRouterTtsVoicePicker";
import { RealtimeOptionsControl } from "@/components/RealtimeOptionsControl";
+import { putVoiceMode } from "@/lib/voiceEngineMode";
+ import { LocalVoicePanel } from "@/components/providers/LocalVoicePanel";
import { ProviderLogo } from "@/components/providers/ProviderLogo";
import { useRowGestures } from "@/components/providers/rowGestures";
import { Button } from "@/components/ui/button";
diff --cc jarvis/ui/web/frontend/src/lib/agentChatApi.ts
index 8b04ccecb2,225851c83c..b6762890cf
--- a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
@@@ -66,23 -66,32 +66,48 @@@ export interface AgentChatCatalog
providers: AgentChatProvider[];
default_cwd: string;
shell: string;
+ selection?: ChatSelection | null;
+}
+
+export interface ChatSelection {
+ provider: string;
+ model: string;
+ effort: string;
+ account_id?: string;
+}
+
+export async function saveChatSelection(selection: ChatSelection): Promise<ChatSelection> {
+ return json(await fetch("/api/agent-chat/selection", {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(selection),
+ }), "selection-save-failed");
}
+
+ /** The Jarvis chat voice calls continue (`/api/agent-chat/voice-chat`). */
+ export interface VoiceChatBinding {
+ /** Null while a blank page is open or nothing was bound yet. */
+ session_id: string | null;
+ /** A blank page is open: the next call opens a new chat. */
+ fresh: boolean;
+ }
+
+ /**
+ * Make `sessionId` the chat voice calls continue — its turns are filed into
+ * it and a call starts with its history. `null` = a blank page: the next
+ * call opens a new chat.
+ */
+ export async function bindVoiceChat(sessionId: string | null): Promise<VoiceChatBinding> {
+ return json(await fetch("/api/agent-chat/voice-chat", {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ session_id: sessionId }),
+ }), "voice-chat-bind-failed");
+ }
+
+ export async function fetchVoiceChat(): Promise<VoiceChatBinding> {
+ return json(await fetch("/api/agent-chat/voice-chat", { cache: "no-store" }), "voice-chat-failed");
+ }
/**
* Where a session lives: the front page's typed chat (`jarvis` — the same
diff --cc jarvis/ui/web/frontend/src/store/agentChat.ts
index eb46735e67,0108803c28..0b7f9ba1de
--- a/jarvis/ui/web/frontend/src/store/agentChat.ts
+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts
@@@ -281,11 -279,21 +282,25 @@@ const TIMELINE_CACHE_LIMIT = 24
export function createAgentChatStore(surface: AgentChatSurface, draftNamespace = "") {
const DRAFT_KEY = draftKey(surface) + (draftNamespace ? `:${draftNamespace}` : "");
+ /**
+ * Tell the backend which Jarvis chat is on stage, so a voice call continues
+ * THIS chat — its turns land here and it starts with this chat's history.
+ * `null` = a blank page: the next call opens a new chat. Only the front
+ * page's chat has a voice; the other surfaces never bind.
+ */
+ const bindVoice = (sessionId: string | null) => {
+ if (surface !== "jarvis") return;
+ void bindVoiceChat(sessionId).catch((err: unknown) => {
+ // Not fatal: the composer's voice button binds again before a call.
+ console.info("Voice chat binding failed.", err);
+ });
+ };
+
let catalogRequest = 0;
+ const patchQueues = new Map<string, Promise<void>>();
+ const patchRevisions = new Map<string, number>();
+ let selectionRevision = 0;
+ let selectionWrite: Promise<unknown> = Promise.resolve();
let socket: WebSocket | null = null;
let socketSession: string | null = null;
/** Cancels the reconnect waiting in the shared connect budget. */