AX Agent UI와 응답 마감 엔진을 claw-code 기준으로 1차 재구성
Some checks failed
Release Gate / gate (push) Has been cancelled

사이드바, 메시지 축, 빈 상태, 컴포저를 더 얇고 밀도 높은 구조로 재배치하고 보조 상태 스트립 노출을 줄였습니다.

반응형 폭 계산을 다시 조정해 창 크기 변화에서도 메시지와 컴포저가 같은 중심선으로 자연스럽게 줄어들게 했습니다.

응답 취소와 오류 마감은 AxAgentExecutionEngine의 FinalizeExecutionContent로 공통화해 전송과 재생성의 후처리 경로를 맞췄습니다.

검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ 경고 0 오류 0
This commit is contained in:
2026-04-05 14:19:07 +09:00
parent f53f35bbed
commit 22eebc13d9
5 changed files with 112 additions and 90 deletions

View File

@@ -16,6 +16,7 @@ public sealed class AxAgentExecutionEngine
ExecutionMode Mode,
IReadOnlyList<string> PromptStack,
List<ChatMessage> Messages);
public sealed record FinalizedContent(string Content, bool Cancelled, string? FailureReason);
public sealed record SessionMutationResult(
ChatConversation CurrentConversation,
ChatConversation UpdatedConversation);
@@ -162,6 +163,22 @@ public sealed class AxAgentExecutionEngine
return normalized;
}
public FinalizedContent FinalizeExecutionContent(string? currentContent, Exception? error = null, bool cancelled = false)
{
if (cancelled)
{
var content = string.IsNullOrWhiteSpace(currentContent) ? "(취소됨)" : currentContent!;
return new FinalizedContent(content, true, "사용자가 작업을 중단했습니다.");
}
if (error != null)
{
return new FinalizedContent($"⚠ 오류: {error.Message}", false, error.Message);
}
return new FinalizedContent(currentContent ?? string.Empty, false, null);
}
public SessionMutationResult AppendExecutionEvent(
ChatSessionStateService session,
ChatStorageService storage,

View File

@@ -406,7 +406,7 @@
<!-- 축소 아이콘 바 (사이드바 닫힘 시 표시) -->
<ColumnDefinition x:Name="IconBarColumn" Width="0"/>
<!-- 사이드바 (열림 시 표시) -->
<ColumnDefinition x:Name="SidebarColumn" Width="256" MinWidth="0"/>
<ColumnDefinition x:Name="SidebarColumn" Width="220" MinWidth="0"/>
<ColumnDefinition Width="*"/>
<!-- 미리보기 스플리터 -->
<ColumnDefinition x:Name="SplitterColumn" Width="0"/>
@@ -477,7 +477,7 @@
BorderThickness="0,0,1,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="52"/>
<RowDefinition Height="48"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
@@ -487,18 +487,18 @@
</Grid.RowDefinitions>
<!-- 헤더 -->
<Grid Grid.Row="0" Margin="14,0">
<Grid Grid.Row="0" Margin="12,0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Border Background="{DynamicResource HintBackground}" CornerRadius="7"
<Border Background="{DynamicResource HintBackground}" CornerRadius="6"
BorderBrush="{DynamicResource BorderColor}"
BorderThickness="1"
Width="24" Height="24">
<TextBlock Text="&#xE8BD;" FontFamily="Segoe MDL2 Assets" FontSize="12"
Width="22" Height="22">
<TextBlock Text="&#xE8BD;" FontFamily="Segoe MDL2 Assets" FontSize="11"
Foreground="{DynamicResource AccentColor}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<TextBlock Text="AX Agent" FontSize="13.5" FontWeight="SemiBold"
<TextBlock Text="AX Agent" FontSize="13" FontWeight="SemiBold"
Foreground="{DynamicResource PrimaryText}"
VerticalAlignment="Center" Margin="9,0,0,0"/>
VerticalAlignment="Center" Margin="8,0,0,0"/>
</StackPanel>
</Grid>
@@ -507,8 +507,8 @@
<StackPanel>
<Border x:Name="SidebarNewChatTrigger"
Background="Transparent"
CornerRadius="8"
Padding="9,7"
CornerRadius="7"
Padding="8,6"
Cursor="Hand"
MouseEnter="SidebarNewChatTrigger_MouseEnter"
MouseLeave="SidebarNewChatTrigger_MouseLeave"
@@ -523,7 +523,7 @@
Foreground="{DynamicResource SecondaryText}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="새 대화"
Foreground="{DynamicResource PrimaryText}"
FontSize="11" Margin="7,0,0,0" VerticalAlignment="Center"/>
FontSize="10.8" Margin="7,0,0,0" VerticalAlignment="Center"/>
<TextBlock x:Name="SidebarNewChatShortcutHint"
Grid.Column="2"
Text="Ctrl+N"
@@ -536,8 +536,8 @@
<Border x:Name="SidebarSearchTrigger"
Background="Transparent"
CornerRadius="8"
Padding="9,7"
CornerRadius="7"
Padding="8,6"
Cursor="Hand"
MouseEnter="SidebarSearchTrigger_MouseEnter"
MouseLeave="SidebarSearchTrigger_MouseLeave"
@@ -552,7 +552,7 @@
Foreground="{DynamicResource SecondaryText}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="검색"
Foreground="{DynamicResource PrimaryText}"
FontSize="11" Margin="7,0,0,0" VerticalAlignment="Center"/>
FontSize="10.8" Margin="7,0,0,0" VerticalAlignment="Center"/>
<TextBlock x:Name="SidebarSearchShortcutHint"
Grid.Column="2"
Text="Ctrl+K"
@@ -921,7 +921,7 @@
<Border x:Name="AgentProgressBar" Grid.Row="2" Visibility="Collapsed"
Background="{DynamicResource HintBackground}"
BorderBrush="{DynamicResource SeparatorColor}" BorderThickness="0,0,0,1"
Padding="12,3,12,3">
Padding="10,2,10,2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@@ -1181,10 +1181,10 @@
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
Background="{DynamicResource LauncherBackground}"
Padding="24,14,24,8">
Padding="18,10,18,6">
<StackPanel x:Name="MessagePanel"
Margin="0,0,0,20"
MaxWidth="880"
Margin="0,0,0,14"
MaxWidth="840"
HorizontalAlignment="Center">
<StackPanel.RenderTransform>
<TranslateTransform/>
@@ -1196,8 +1196,8 @@
<Grid x:Name="EmptyState" Grid.Row="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
MaxWidth="880"
Margin="24,8,24,8">
MaxWidth="840"
Margin="18,8,18,8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="16"/>
@@ -1208,24 +1208,24 @@
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,10,0,2">
<Border x:Name="EmptyIcon" CornerRadius="18" Width="54" Height="54"
HorizontalAlignment="Center" Margin="0,0,0,14"
<Border x:Name="EmptyIcon" CornerRadius="14" Width="44" Height="44"
HorizontalAlignment="Center" Margin="0,0,0,12"
Background="{DynamicResource ItemBackground}"
BorderBrush="{DynamicResource BorderColor}"
BorderThickness="1">
<TextBlock Text="&#xE8BD;" FontFamily="Segoe MDL2 Assets" FontSize="30"
<TextBlock Text="&#xE8BD;" FontFamily="Segoe MDL2 Assets" FontSize="22"
Foreground="{DynamicResource AccentColor}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<TextBlock x:Name="EmptyStateTitle" Text="작업을 시작하세요" FontSize="20" FontWeight="SemiBold"
<TextBlock x:Name="EmptyStateTitle" Text="작업을 시작하세요" FontSize="18" FontWeight="SemiBold"
Foreground="{DynamicResource PrimaryText}" HorizontalAlignment="Center"/>
<TextBlock x:Name="EmptyStateDesc" Text="프롬프트를 입력하거나 아래 작업 유형을 선택하면 됩니다"
FontSize="12" Foreground="{DynamicResource SecondaryText}"
FontSize="11.5" Foreground="{DynamicResource SecondaryText}"
HorizontalAlignment="Center"
TextAlignment="Center"
Width="340"
Margin="0,8,0,0"/>
Width="320"
Margin="0,6,0,0"/>
</StackPanel>
<ScrollViewer x:Name="TopicPresetScrollViewer"
@@ -1560,9 +1560,9 @@
<!-- ── 입력 바 ── -->
<Border x:Name="ComposerShell" Grid.Row="4"
Margin="18,0,18,20"
Margin="18,0,18,16"
Width="Auto"
MaxWidth="820"
MaxWidth="760"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<StackPanel HorizontalAlignment="Stretch">
@@ -1571,9 +1571,9 @@
Background="{DynamicResource LauncherBackground}"
BorderBrush="{DynamicResource BorderColor}"
BorderThickness="1"
CornerRadius="14"
Padding="10,8,10,8"
Margin="0,0,0,6">
CornerRadius="12"
Padding="9,7,9,7"
Margin="0,0,0,5">
<Border.Effect>
<DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="0.05"/>
</Border.Effect>
@@ -1628,7 +1628,7 @@
<StackPanel x:Name="DraftQueuePanel"
Visibility="Collapsed"
Margin="0,0,0,8"/>
<Border x:Name="InputGlowBorder" CornerRadius="16" Opacity="0"
<Border x:Name="InputGlowBorder" CornerRadius="14" Opacity="0"
Margin="-3" IsHitTestVisible="False">
<Border.BorderBrush>
<LinearGradientBrush x:Name="RainbowBrush" StartPoint="0,0" EndPoint="1,1">
@@ -1651,10 +1651,10 @@
<!-- 실제 입력 영역 -->
<Border x:Name="InputBorder"
Background="{DynamicResource LauncherBackground}"
CornerRadius="12" Padding="6"
CornerRadius="10" Padding="5"
BorderBrush="{DynamicResource BorderColor}" BorderThickness="1">
<Border.Effect>
<DropShadowEffect BlurRadius="14" ShadowDepth="0" Opacity="0.06"/>
<DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="0.04"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
@@ -1665,12 +1665,11 @@
</Grid.RowDefinitions>
<!-- Row 0: 모델 셀렉터 + 템플릿 버튼 -->
<Grid Grid.Row="0" Margin="2,0,2,2">
<Grid Grid.Row="0" Margin="1,0,1,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button x:Name="BtnModelSelector"
Style="{StaticResource OutlineHoverBtn}"
@@ -1688,7 +1687,7 @@
VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBlock x:Name="ModelLabel" FontSize="11.5"
Foreground="{DynamicResource SecondaryText}"
MaxWidth="360"
MaxWidth="300"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"/>
<TextBlock Text="&#xE70D;" FontFamily="Segoe MDL2 Assets" FontSize="8"
@@ -1698,13 +1697,14 @@
</Button>
<Border x:Name="TokenUsageCard"
Grid.Column="2"
Margin="5,0,5,0"
Padding="5,2"
Margin="4,0,0,0"
Padding="4,2"
CornerRadius="7"
BorderBrush="{DynamicResource BorderColor}"
BorderThickness="1"
Background="{DynamicResource ItemBackground}"
VerticalAlignment="Center">
VerticalAlignment="Center"
Visibility="Collapsed">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@@ -1772,7 +1772,7 @@
</Border>
<Button x:Name="BtnTemplateSelector"
Style="{StaticResource OutlineHoverBtn}"
Grid.Column="3"
Grid.Column="2"
HorizontalAlignment="Right"
Margin="0"
MinHeight="24"

View File

@@ -8460,16 +8460,17 @@ public partial class ChatWindow : Window
}
catch (OperationCanceledException)
{
assistantContent = string.IsNullOrWhiteSpace(assistantContent) ? "(취소됨)" : assistantContent;
draftCancelled = true;
draftFailure = "사용자가 작업을 중단했습니다.";
var finalized = _chatEngine.FinalizeExecutionContent(assistantContent, cancelled: true);
assistantContent = finalized.Content;
draftCancelled = finalized.Cancelled;
draftFailure = finalized.FailureReason;
}
catch (Exception ex)
{
var errMsg = $"⚠ 오류: {ex.Message}";
assistantContent = errMsg;
var finalized = _chatEngine.FinalizeExecutionContent(assistantContent, ex);
assistantContent = finalized.Content;
ShowToast("실패한 요청은 작업 요약에서 다시 시도할 수 있습니다.", "\uE783", 2600);
draftFailure = ex.Message;
draftFailure = finalized.FailureReason;
}
finally
{
@@ -8735,20 +8736,18 @@ public partial class ChatWindow : Window
sb.AppendLine("You are AX Copilot Agent. You can read, write, and edit files using the provided tools.");
sb.AppendLine($"Today's date: {DateTime.Now:yyyy년 M월 d일} ({DateTime.Now:yyyy-MM-dd}, {DateTime.Now:dddd}).");
sb.AppendLine("Available skills: excel_create (.xlsx), docx_create (.docx), csv_create (.csv), markdown_create (.md), html_create (.html), script_create (.bat/.ps1), document_review (품질 검증), format_convert (포맷 변환).");
sb.AppendLine("Only present a step-by-step execution plan when the user explicitly asks for a plan or when the session is already in plan mode.");
sb.AppendLine("For ordinary Cowork requests, proceed directly with the work instead of stopping for plan approval.");
sb.AppendLine("Only present a step-by-step plan when the user explicitly asks for a plan or when the task is too ambiguous to execute safely.");
sb.AppendLine("For ordinary Cowork requests, proceed directly with the work and focus on producing the real artifact.");
sb.AppendLine("After creating files, summarize what was created and include the actual output path.");
sb.AppendLine("Do not stop after a single step. Continue autonomously until the request is completed or a concrete blocker (permission denial, missing dependency, hard error) is encountered.");
sb.AppendLine("When adapting external references, rewrite names/structure/comments to AX Copilot style. Avoid clone-like outputs.");
sb.AppendLine("IMPORTANT: When creating documents with dates, always use today's actual date above. Never use placeholder or fictional dates.");
sb.AppendLine("IMPORTANT: When asked to create a document with multiple sections (reports, proposals, analyses, etc.), you MUST:");
sb.AppendLine(" 1. First, plan the document: decide the exact sections (headings), their order, and key points for each section based on the topic.");
sb.AppendLine(" 2. Call document_plan with sections_hint = your planned section titles (comma-separated). Example: sections_hint=\"회사 개요, 사업 현황, 재무 분석, SWOT, 전략 제언, 결론\"");
sb.AppendLine(" This ensures the document structure matches YOUR plan, not a generic template.");
sb.AppendLine(" 3. Then immediately call html_create (or docx_create/file_write) using the scaffold from document_plan.");
sb.AppendLine(" 4. Write actual detailed content for EVERY section — no skipping, no placeholders, no minimal content.");
sb.AppendLine(" 5. Do NOT call html_create directly without document_plan for multi-section documents.");
sb.AppendLine(" 6. Do not finish with a plan only. The task is complete only after the document file has actually been created or updated.");
sb.AppendLine("IMPORTANT: For reports, proposals, analyses, and manuals with multiple sections:");
sb.AppendLine(" 1. Decide the document structure internally first.");
sb.AppendLine(" 2. Use document_plan only when it improves the actual output, not as a mandatory user-facing approval step.");
sb.AppendLine(" 3. Then immediately create the real output file with html_create, docx_create, markdown_create, or file_write.");
sb.AppendLine(" 4. Fill every section with real content. Do not stop at an outline or plan only.");
sb.AppendLine(" 5. The task is complete only after the actual document file has been created or updated.");
// 문서 품질 검증 루프
sb.AppendLine("\n## Document Quality Review");
@@ -8854,10 +8853,10 @@ public partial class ChatWindow : Window
sb.AppendLine("3. ANALYZE: Use grep (with context_lines=2) + file_read to deeply understand the code you'll modify.");
sb.AppendLine(" - Always check callers/references: grep for function/class names to find all usage points.");
sb.AppendLine(" - Read test files related to the code you're changing to understand expected behavior.");
sb.AppendLine("4. PLAN: Present your analysis + impact assessment. List ALL files that will be modified.");
sb.AppendLine("4. PLAN: Build an internal execution outline and impact assessment before editing.");
sb.AppendLine(" - Present the outline explicitly only when the user asks for a plan or the change is clearly high risk.");
sb.AppendLine(" - Explain WHY each change is needed and what could break.");
sb.AppendLine(" - If you touch shared services, interfaces, models, controllers, view-models, app startup, or dependency registration, treat it as a high-impact change.");
sb.AppendLine(" - Wait for user approval before proceeding.");
sb.AppendLine(" - If you touch shared services, interfaces, models, controllers, view-models, app startup, or dependency registration, treat it as a high-impact change and call out the impact clearly.");
sb.AppendLine("5. IMPLEMENT: Apply changes using file_edit (preferred — shows diff). Use file_write only for new files.");
sb.AppendLine(" - Make the MINIMUM changes needed. Don't refactor unrelated code.");
sb.AppendLine(" - Prefer file_edit with replace_all=false for precision edits.");
@@ -9258,7 +9257,18 @@ public partial class ChatWindow : Window
if (ConversationStatusStrip != null && ConversationStatusStripLabel != null)
{
if (string.Equals(status.StripKind, "permission_waiting", StringComparison.OrdinalIgnoreCase))
var showCompactStrip = !string.Equals(_activeTab, "Chat", StringComparison.OrdinalIgnoreCase)
&& (string.Equals(status.StripKind, "permission_waiting", StringComparison.OrdinalIgnoreCase)
|| string.Equals(status.StripKind, "failed_run", StringComparison.OrdinalIgnoreCase)
|| string.Equals(status.StripKind, "permission_denied", StringComparison.OrdinalIgnoreCase)
|| string.Equals(status.StripKind, "queue_blocked", StringComparison.OrdinalIgnoreCase));
if (!showCompactStrip)
{
ConversationStatusStrip.Visibility = Visibility.Collapsed;
ConversationStatusStripLabel.Text = "";
}
else if (string.Equals(status.StripKind, "permission_waiting", StringComparison.OrdinalIgnoreCase))
{
ConversationStatusStrip.Visibility = Visibility.Visible;
ConversationStatusStrip.Background = BrushFromHex("#FFF7ED");
@@ -9266,14 +9276,6 @@ public partial class ChatWindow : Window
ConversationStatusStripLabel.Foreground = BrushFromHex("#C2410C");
ConversationStatusStripLabel.Text = status.StripText;
}
else if (string.Equals(status.StripKind, "running", StringComparison.OrdinalIgnoreCase))
{
ConversationStatusStrip.Visibility = Visibility.Visible;
ConversationStatusStrip.Background = BrushFromHex("#DBEAFE");
ConversationStatusStrip.BorderBrush = BrushFromHex("#93C5FD");
ConversationStatusStripLabel.Foreground = BrushFromHex("#1D4ED8");
ConversationStatusStripLabel.Text = status.StripText;
}
else if (string.Equals(status.StripKind, "failed_run", StringComparison.OrdinalIgnoreCase)
|| string.Equals(status.StripKind, "permission_denied", StringComparison.OrdinalIgnoreCase))
{
@@ -9299,14 +9301,6 @@ public partial class ChatWindow : Window
ConversationStatusStripLabel.Foreground = BrushFromHex("#B45309");
ConversationStatusStripLabel.Text = status.StripText;
}
else if (string.Equals(status.StripKind, "background", StringComparison.OrdinalIgnoreCase))
{
ConversationStatusStrip.Visibility = Visibility.Visible;
ConversationStatusStrip.Background = BrushFromHex("#EFF6FF");
ConversationStatusStrip.BorderBrush = BrushFromHex("#BFDBFE");
ConversationStatusStripLabel.Foreground = BrushFromHex("#1D4ED8");
ConversationStatusStripLabel.Text = status.StripText;
}
else
{
ConversationStatusStrip.Visibility = Visibility.Collapsed;
@@ -9323,8 +9317,10 @@ public partial class ChatWindow : Window
|| BtnQuickRunningFilter == null || BtnQuickHotSort == null)
return;
var hasQuickSignal = _runningConversationCount > 0
|| _spotlightConversationCount > 0;
var allowQuickStrip = !string.Equals(_activeTab, "Chat", StringComparison.OrdinalIgnoreCase);
var hasQuickSignal = allowQuickStrip
&& (_runningConversationCount > 0
|| _spotlightConversationCount > 0);
ConversationQuickStrip.Visibility = hasQuickSignal
? Visibility.Visible
@@ -10993,12 +10989,11 @@ public partial class ChatWindow : Window
}
catch (OperationCanceledException)
{
assistantContent = string.IsNullOrWhiteSpace(assistantContent) ? "(취소됨)" : assistantContent;
assistantContent = _chatEngine.FinalizeExecutionContent(assistantContent, cancelled: true).Content;
}
catch (Exception ex)
{
var errMsg = $"⚠ 오류: {ex.Message}";
assistantContent = errMsg;
assistantContent = _chatEngine.FinalizeExecutionContent(assistantContent, ex).Content;
ShowToast("실패한 요청은 작업 요약에서 다시 시도할 수 있습니다.", "\uE783", 2600);
}
finally
@@ -11039,16 +11034,16 @@ public partial class ChatWindow : Window
if (viewportWidth < 200)
return false;
// claw-code처럼 창이 줄어들면 메시지 축과 컴포저가 함께 자연스럽게 줄어들도록,
// 남는 본문 폭을 기준으로 상한만 두고 반응형 폭을 다시 계산합니다.
var contentWidth = Math.Max(360, viewportWidth - 48);
var messageWidth = Math.Clamp(contentWidth * 0.9, 360, 920);
var composerWidth = Math.Clamp(contentWidth * 0.82, 360, 820);
// claw-code처럼 메시지 축과 입력축이 같은 중심선을 공유하도록,
// 본문 폭 상한을 조금 더 낮추고 창 폭 변화에 더 부드럽게 반응시킵니다.
var contentWidth = Math.Max(340, viewportWidth - 32);
var messageWidth = Math.Clamp(contentWidth * 0.86, 340, 840);
var composerWidth = Math.Clamp(contentWidth * 0.78, 340, 760);
if (contentWidth < 760)
{
messageWidth = Math.Clamp(contentWidth - 8, 340, 820);
composerWidth = Math.Clamp(contentWidth - 28, 332, 760);
messageWidth = Math.Clamp(contentWidth - 10, 332, 760);
composerWidth = Math.Clamp(contentWidth - 20, 328, 700);
}
var changed = false;