hermes/frontend/src/composables/useAgentDisplay.ts
Nico ccee249618 v0.6.42: Hermes chat UI — Vue3/TS/Vite, audio STT/TTS, sidebar rail, MCP event loop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:35:10 +02:00

38 lines
1.5 KiB
TypeScript

import { computed, type Ref } from 'vue';
import { useChatStore } from '../store/chat';
import type { Agent } from './agents';
export function useAgentDisplay(
selectedAgent: Ref<string>,
defaultAgent: Ref<string>,
allAgents: Ref<Agent[]>,
) {
const chatStore = useChatStore();
const defaultAgentName = computed(() => {
const agent = allAgents.value.find(a => a.id === defaultAgent.value);
return agent ? agent.name : defaultAgent.value;
});
const agentDisplayName = computed(() => {
const agent = allAgents.value.find(a => a.id === selectedAgent.value);
return (agent ? agent.name : selectedAgent.value).toUpperCase();
});
const isAgentRunning = computed(() => chatStore.smState === 'AGENT_RUNNING');
const agentStatusDone = computed(() => chatStore.channelState === 'READY' || chatStore.channelState === 'FRESH');
const agentStatus = computed<string | null>(() => {
switch (chatStore.smState) {
case 'CONNECTING': return '⚙️ Connecting…';
case 'AGENT_RUNNING': return '⚙️ Working…';
case 'HANDOVER_PENDING': return '📝 Writing handover…';
case 'HANDOVER_DONE': return '✅ Handover ready';
case 'SWITCHING': return '🔀 Switching…';
default: return null;
}
});
return { defaultAgentName, agentDisplayName, isAgentRunning, agentStatusDone, agentStatus };
}