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.

fix(chat): the composer survives a backend older than the bundle

rubenluetke10-beep0888bed63584
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index d41cd0bb47..d77aef9782 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -139,7 +139,9 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
const modelList = useMemo(() => {
if (!provider) return [];
const live = liveModels[provider.id];
- return provider.models_source === "live" && live && live.length ? live : provider.curated_models;
+ return provider.models_source === "live" && live && live.length
+ ? live
+ : (provider.curated_models ?? []);
}, [provider, liveModels]);
const modelGroups = useMemo<ComboboxGroup[]>(() => {
@@ -165,7 +167,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
if (!provider) return [];
const model = modelList.find((m) => m.id === draft.model);
if (model && Array.isArray(model.efforts)) return model.efforts;
- return provider.effort_levels;
+ return provider.effort_levels ?? [];
}, [provider, modelList, draft.model]);
useEffect(() => {
@@ -190,10 +192,10 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
);
const permissionModes = useMemo(
- () => (provider ? provider.permission_modes.filter((m) => m.id !== "plan") : []),
+ () => (provider?.permission_modes ?? []).filter((m) => m.id !== "plan"),
[provider],
);
- const hasPlan = Boolean(provider?.permission_modes.some((m) => m.id === "plan"));
+ const hasPlan = Boolean((provider?.permission_modes ?? []).some((m) => m.id === "plan"));
const planOn = draft.permissionMode === "plan";
const permissionGroups = useMemo<ComboboxGroup[]>(
() => [
@@ -207,7 +209,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
// While Plan is on, the permission pill shows the mode Build would return to.
const permissionValue = planOn ? draft.buildMode || provider?.default_permission_mode || "" : draft.permissionMode;
const permissionDescription =
- provider?.permission_modes.find((m) => m.id === draft.permissionMode)?.description ?? "";
+ (provider?.permission_modes ?? []).find((m) => m.id === draft.permissionMode)?.description ?? "";
const canSend = connected && Boolean(value.trim()) && !running && !busy && Boolean(provider?.connected);
const placeholder = connected
diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.ts
index 811e95afe7..10e13e72be 100644
--- a/jarvis/ui/web/frontend/src/store/agentChat.ts
+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts
@@ -241,10 +241,25 @@ export const useAgentChatStore = create<AgentChatStore>((set, get) => {
loadCatalog: async () => {
try {
- const [catalog, connections] = await Promise.all([
+ const [raw, connections] = await Promise.all([
fetchAgentChatCatalog(),
fetchAgentConnections().catch(() => [] as AgentConnectionRow[]),
]);
+ // A backend older than this bundle (the app not yet restarted after
+ // an update) may lack the newer arrays; an empty ladder is honest,
+ // a crash is not.
+ const catalog: AgentChatCatalog = {
+ ...raw,
+ providers: (raw.providers ?? []).map((p) => ({
+ ...p,
+ curated_models: Array.isArray(p.curated_models) ? p.curated_models : [],
+ effort_levels: Array.isArray(p.effort_levels) ? p.effort_levels : [],
+ permission_modes: Array.isArray(p.permission_modes) ? p.permission_modes : [],
+ default_permission_mode: p.default_permission_mode ?? "",
+ default_effort: p.default_effort ?? "",
+ default_model: p.default_model ?? "",
+ })),
+ };
set({ catalog, connections, catalogError: null });
// Settle the draft: an empty or unknown provider becomes the active
// sub-agent (else the first connected one); blank picks take the