diff --git a/frontend/src/composables/transcript-debug/useTranscriptDebug.ts b/frontend/src/composables/transcript-debug/useTranscriptDebug.ts index 171e4f3..985cb9b 100644 --- a/frontend/src/composables/transcript-debug/useTranscriptDebug.ts +++ b/frontend/src/composables/transcript-debug/useTranscriptDebug.ts @@ -254,6 +254,12 @@ export function useTranscriptDebug() { await fetchSessions() } + // Refresh agent session state (hookHistory, status, etc.) from server + const targetAgent = entry?.agent || selectedAgent.value + if (targetAgent) { + await sessionStore.refreshAgentState(targetAgent) + } + // Load the target session's transcript (skip for __new__ — no transcript yet) selectedSessionId.value = transcriptSessionId if (transcriptSessionId === '__new__') { diff --git a/frontend/src/stores/session-state.ts b/frontend/src/stores/session-state.ts index 43ee0cd..e4e2057 100644 --- a/frontend/src/stores/session-state.ts +++ b/frontend/src/stores/session-state.ts @@ -1,5 +1,6 @@ import { defineStore } from 'pinia' import { ref, computed } from 'vue' +import { terminalApiUrl } from '../config/endpoints' // ── Types (mirror server/services/session-state.ts) ── @@ -210,6 +211,16 @@ export const useSessionState = defineStore('session-state', () => { }) } + async function refreshAgentState(agent: string) { + try { + const res = await fetch(terminalApiUrl(`/session-state/${agent}`)) + if (!res.ok) return + const state = await res.json() as AgentSessionState + agents.value = { ...agents.value, [agent]: state } + lastUpdate.value = Date.now() + } catch { /* silent — WS patches will catch up */ } + } + function setConnected(value: boolean) { connected.value = value } @@ -229,6 +240,7 @@ export const useSessionState = defineStore('session-state', () => { hasErrors, visibleNotifications, handleMessage, + refreshAgentState, respondApproval, respondPlanApproval, setConnected,