From 89b340c64f74489cd4c21899fc18235df90330c5 Mon Sep 17 00:00:00 2001 From: busya Date: Fri, 3 Jul 2026 15:35:22 +0300 Subject: [PATCH] =?UTF-8?q?fix(agent):=20debug=20panel=20copyDebugInfo=20?= =?UTF-8?q?=E2=80=94=20full=20state=20snapshot=20(was=209=20fields,=20now?= =?UTF-8?q?=20all=20model=20atoms)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously copyDebugInfo() only exported 9 hand-picked fields (conversation_id, thread_id, connection/streaming state, user, env, message count, truncated tool calls, error). The debug panel was missing LLM health (status, retry, banner), confirmation/HITL state (pending_tool, args, risk), queue position, message previews, full tool call objects, and UI flags (sidebar, debug panel, cancelled). Now: - Full model snapshot with all fields - active_tool_calls_full — complete ToolCall objects - last_message_preview — first 200 chars of last message - LLM status, banner dismiss, retry countdown - HITL confirmation state (pending_tool_name, args, risk, level) - Conversations count, queue position, user_cancelled flag - Visual debug panel grid: 5-column layout with new rows for LLM health, confirmation, queue, sidebar, convs_count --- .../src/lib/components/agent/AgentChat.svelte | 124 +++++++++++++++--- 1 file changed, 109 insertions(+), 15 deletions(-) diff --git a/frontend/src/lib/components/agent/AgentChat.svelte b/frontend/src/lib/components/agent/AgentChat.svelte index 3048886c..3180d9ba 100644 --- a/frontend/src/lib/components/agent/AgentChat.svelte +++ b/frontend/src/lib/components/agent/AgentChat.svelte @@ -287,18 +287,49 @@ } async function copyDebugInfo() { + const lastMsg = model.messages.at(-1); const payload = { + // ── Identifiers ── conversation_id: model.currentConversationId, pending_thread_id: model.pendingThreadId, - connection_state: model.connectionState, - streaming_state: model.streamingState, user_id: model.userId, environment_id: model.envId, - messages: model.messages.length, - active_tool_calls: model.activeToolCalls.map((tc) => ({ - tool: tc.tool, - status: tc.status, - })), + // ── Connection & Streaming ── + connection_state: model.connectionState, + streaming_state: model.streamingState, + agent_phase: model.agentPhase, + // ── Messages ── + messages_count: model.messages.length, + last_message_id: lastMsg?.id ?? null, + last_message_role: lastMsg?.role ?? null, + last_message_preview: lastMsg?.text?.slice(0, 200) ?? null, + // ── Streaming buffer ── + partial_text_length: model.partialText.length, + partial_tokens_count: model.partialTokens.length, + // ── Tool calls (full objects) ── + active_tool_calls: model.activeToolCalls.length, + active_tool_calls_full: model.activeToolCalls, + // ── HITL / Confirmation ── + confirmation_message: model.confirmationMessage, + pending_tool_name: model.pendingToolName, + pending_tool_args: model.pendingToolArgs, + pending_confirmation_risk: model.pendingConfirmationRisk, + pending_risk_level: model.pendingRiskLevel, + // ── LLM health ── + llm_status: model.llmStatus, + llm_banner_dismissed: model.llmBannerDismissed, + llm_retry_countdown: model.llmRetryCountdown, + llm_banner_message: model.llmBannerMessage, + // ── Conversation list ── + conversations_count: model.conversations.length, + conversations_has_next: model.conversationsHasNext, + // ── UI state ── + is_debug_panel_open: model.isDebugPanelOpen, + is_conversation_sidebar_open: model.isConversationSidebarOpen, + is_loading_history: model.isLoadingHistory, + queue_position: model.queuePosition, + user_cancelled: model._userCancelled, + // ── Error ── error: model.error, }; try { @@ -415,23 +446,29 @@ {#if model.isDebugPanelOpen} -
+
+
conv_id -
{model.conversationIdLabel}
+
{model.conversationIdLabel || "null"}
thread_id
{model.pendingThreadIdLabel}
-
- state -
{model.connectionState} / {model.streamingState}
-
env / user
{model.envIdLabel} / {model.userIdLabel}
+
+ phase +
{model.agentPhase}
+
+
+ state +
{model.connectionState} / {model.streamingState}
+
+
messages
{model.messageCountLabel}
@@ -441,12 +478,69 @@
{model.lastMessageIdLabel}
- tools + tools (active)
{model.activeToolCalls.length}
+
+ queue +
{model.queuePosition}
+
+
+ partial_tokens +
{model.partialTokens.length}
+
+ +
+ llm_status +
{model.llmStatus}
+
+
+ llm_retry +
{model.llmRetryCountdown}s
+
+
+ banner_dismissed +
{String(model.llmBannerDismissed)}
+
+
+ sidebar +
{String(model.isConversationSidebarOpen)}
+
+
+ convs_count +
{model.conversations.length}
+
+ + {#if model.pendingToolName} +
+ pending_tool +
{model.pendingToolName}
+
+
+ risk +
{model.pendingConfirmationRisk || model.pendingRiskLevel || "—"}
+
+
+ confirm_msg +
{model.confirmationMessage?.slice(0, 60) || "—"}
+
+ {:else} +
+ pending_tool +
+
+
+ pending_thread +
{model.pendingThreadId ? model.pendingThreadId.slice(0, 12) : "—"}
+
+
+ cancelled +
{String(model._userCancelled)}
+
+ {/if}
error -
{model.error || "none"}
+
{model.error?.slice(0, 80) || "none"}
{/if}