feat(ui): rework work console — single Session tab, right-aligned header, turns x/y

- Merge "Actions" + "Session" into one state-aware Session tab: review controls
  on top, then merge/worktree management, then child outcomes — each gated on the
  current state, with an empty-state hint when there's nothing to manage. This is
  the home the real merge/diff work (task 09eb5d52) will slot into.
- Move the model · turns · diff info block to the right of the title bar.
- Show turns as current/max using the resolved turn budget (task → list → global).
- Output terminal now fills the console body cleanly: clip the console to its
  rounded corners and inset the embedded terminal instead of clipping its bottom.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 20:18:36 +02:00
parent 99c6bf4478
commit ac9bae9546
3 changed files with 130 additions and 92 deletions

View File

@@ -133,23 +133,42 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
EditableTitle, EditableDescription, Subtasks.Select(s => (s.Title, s.Done)));
// ── Work console (redesign) ────────────────────────────────────────
// Two tabs: Output (live log) and Session (review + merge/worktree +
// outcomes, each section gated on the relevant state).
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsOutputTab))]
[NotifyPropertyChangedFor(nameof(IsActionsTab))]
[NotifyPropertyChangedFor(nameof(IsSessionTab))]
private string _selectedTab = "output";
public bool IsOutputTab => SelectedTab == "output";
public bool IsActionsTab => SelectedTab == "actions";
public bool IsSessionTab => SelectedTab == "session";
[RelayCommand]
private void SelectTab(string? tab) => SelectedTab = tab ?? "output";
public string TurnsText => $"{Turns} turns";
// Merge/worktree controls only matter once there's a worktree to manage
// (standalone task), or a planning parent / improvement parent with children.
public bool ShowMergeSection =>
WorktreePath != null || Task?.IsPlanningParent == true || HasChildOutcomes;
// Nothing to manage yet (idle/queued/running standalone): show a hint.
public bool ShowSessionEmpty =>
!IsWaitingForReview && !ShowMergeSection && !HasChildOutcomes;
private void NotifySessionSections()
{
OnPropertyChanged(nameof(ShowMergeSection));
OnPropertyChanged(nameof(ShowSessionEmpty));
}
public string TurnsText => $"{Turns}/{EffectiveMaxTurns}";
public string DiffAddText => $"+{DiffAdditions}";
public string DiffDelText => $"-{DiffDeletions}";
// Resolved turn budget: per-task override → list default → global default.
public int EffectiveMaxTurns =>
TaskMaxTurns is decimal t ? (int)t : (_listMaxTurns ?? _globalMaxTurns);
public bool ShowRoadblock => IsFailed || IsCancelled;
public string RoadblockMessage =>
IsFailed ? "The session ended with an error." :
@@ -201,6 +220,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
OnPropertyChanged(nameof(IsAgentSectionEnabled));
OnPropertyChanged(nameof(ShowRoadblock));
OnPropertyChanged(nameof(RoadblockMessage));
NotifySessionSections();
}
[ObservableProperty] private string? _model;
@@ -223,7 +243,13 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
private string? _listAgentName;
partial void OnTaskModelSelectionChanged(string? value) { RecomputeModelBadge(); QueueAgentSave(); }
partial void OnTaskMaxTurnsChanged(decimal? value) { RecomputeTurnsBadge(); QueueAgentSave(); }
partial void OnTaskMaxTurnsChanged(decimal? value)
{
RecomputeTurnsBadge();
OnPropertyChanged(nameof(EffectiveMaxTurns));
OnPropertyChanged(nameof(TurnsText));
QueueAgentSave();
}
private void RecomputeModelBadge()
{
@@ -460,6 +486,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
{
RecomputeCanMergeAll();
ReviewCombinedDiffCommand.NotifyCanExecuteChanged();
NotifySessionSections();
};
PrepLog.CollectionChanged += (_, _) => OnPropertyChanged(nameof(ShowPrepEmptyState));
@@ -637,6 +664,8 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
RecomputeModelBadge();
RecomputeTurnsBadge();
RecomputeAgentBadge();
OnPropertyChanged(nameof(EffectiveMaxTurns));
OnPropertyChanged(nameof(TurnsText));
}
finally
{
@@ -1113,8 +1142,11 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
{
OpenDiffCommand.NotifyCanExecuteChanged();
OpenWorktreeCommand.NotifyCanExecuteChanged();
NotifySessionSections();
}
partial void OnTaskChanged(TaskRowViewModel? value) => NotifySessionSections();
[RelayCommand]
private void CloseDetails() => CloseDetail?.Invoke();

View File

@@ -26,8 +26,9 @@
</Style>
</UserControl.Styles>
<!-- Outer terminal card — Padding="0" so header/strip span edge-to-edge -->
<Border Classes="terminal" Padding="0">
<!-- Outer terminal card — Padding="0" so header/strip span edge-to-edge;
ClipToBounds keeps tab content inside the rounded corners (no bottom clip). -->
<Border Classes="terminal" Padding="0" ClipToBounds="True">
<DockPanel LastChildFill="True">
<!-- ── Title bar ── -->
@@ -42,9 +43,11 @@
<Ellipse Classes="dot-green" />
</StackPanel>
<!-- Info header: model · turns · +add -del -->
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6"
HorizontalAlignment="Center" VerticalAlignment="Center">
<!-- Right cluster: info header (model · turns · diff) + status chip -->
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="12"
Margin="0,0,8,0" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
<TextBlock Classes="meta" Text="{Binding Model}"
Foreground="{DynamicResource TextMuteBrush}" />
<TextBlock Classes="meta" Text="·"
@@ -57,8 +60,7 @@
<TextBlock Classes="diff-del" Text="{Binding DiffDelText}" />
</StackPanel>
<!-- Status chips (LIVE / DONE / FAILED) -->
<Panel Grid.Column="2" Margin="0,0,8,0" VerticalAlignment="Center">
<Panel VerticalAlignment="Center">
<Border Classes="live-chip pulsing"
IsVisible="{Binding IsRunning}">
<StackPanel Orientation="Horizontal" Spacing="5" VerticalAlignment="Center">
@@ -84,6 +86,8 @@
</Border>
</Panel>
</StackPanel>
</Grid>
<!-- ── Roadblock band ── -->
@@ -124,11 +128,6 @@
Content="Output"
Command="{Binding SelectTabCommand}"
CommandParameter="output" />
<Button Classes="tab-btn"
Classes.active="{Binding IsActionsTab}"
Content="Actions"
Command="{Binding SelectTabCommand}"
CommandParameter="actions" />
<Button Classes="tab-btn"
Classes.active="{Binding IsSessionTab}"
Content="Session"
@@ -140,18 +139,50 @@
<!-- ── Tab body ── -->
<Grid>
<!-- Output: embedded SessionTerminalView -->
<!-- Output: embedded terminal, inset so it reads as its own card -->
<islands:SessionTerminalView
IsVisible="{Binding IsOutputTab}"
Margin="10,8,10,10"
Entries="{Binding Log}"
Label="{Binding SessionLabel}"
IsRunning="{Binding IsRunning}"
IsDone="{Binding IsDone}"
IsFailed="{Binding IsFailed}" />
<!-- Actions: merge-target + worktree controls -->
<ScrollViewer IsVisible="{Binding IsActionsTab}" Padding="14,10">
<StackPanel Spacing="10">
<!-- Session: review (top) + merge/worktree + outcomes — each gated on state -->
<ScrollViewer IsVisible="{Binding IsSessionTab}" Padding="14,10">
<StackPanel Spacing="14">
<!-- Review controls -->
<StackPanel Spacing="8" IsVisible="{Binding IsWaitingForReview}">
<TextBlock Classes="section-label" Text="REVIEW" />
<TextBlock Classes="field-label" Text="Feedback" />
<TextBox Text="{Binding ReviewFeedback, Mode=TwoWay}"
AcceptsReturn="True"
TextWrapping="Wrap"
MinHeight="60"
MaxHeight="180"
PlaceholderText="Optional feedback for the next run…"
Padding="8"
Background="{DynamicResource Surface2Brush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="1"
CornerRadius="8" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Classes="btn accent" Content="Approve"
Command="{Binding ApproveReviewCommand}" />
<Button Classes="btn" Content="Reject"
Command="{Binding RejectReviewCommand}" />
<Button Classes="btn" Content="Park"
Command="{Binding ParkReviewCommand}" />
<Button Classes="btn" Content="Cancel"
Command="{Binding CancelReviewCommand}" />
</StackPanel>
</StackPanel>
<!-- Merge & worktree management -->
<StackPanel Spacing="10" IsVisible="{Binding ShowMergeSection}">
<TextBlock Classes="section-label" Text="MERGE &amp; WORKTREE" />
<StackPanel Spacing="4">
<TextBlock Classes="field-label" Text="Merge target" />
<ComboBox ItemsSource="{Binding MergeTargetBranches}"
@@ -181,42 +212,10 @@
IsVisible="{Binding MergeAllError,
Converter={x:Static ObjectConverters.IsNotNull}}" />
</StackPanel>
</ScrollViewer>
<!-- Session: review block + child outcomes -->
<ScrollViewer IsVisible="{Binding IsSessionTab}" Padding="14,10">
<StackPanel Spacing="10">
<!-- Review block -->
<StackPanel Spacing="8" IsVisible="{Binding IsWaitingForReview}">
<TextBlock Classes="section-label" Text="REVIEW" Margin="0,0,0,2" />
<TextBlock Classes="field-label" Text="Feedback" />
<TextBox Text="{Binding ReviewFeedback, Mode=TwoWay}"
AcceptsReturn="True"
TextWrapping="Wrap"
MinHeight="60"
MaxHeight="180"
PlaceholderText="Optional feedback for the next run…"
Padding="8"
Background="{DynamicResource Surface2Brush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="1"
CornerRadius="8" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Classes="btn accent" Content="Approve"
Command="{Binding ApproveReviewCommand}" />
<Button Classes="btn" Content="Reject"
Command="{Binding RejectReviewCommand}" />
<Button Classes="btn" Content="Park"
Command="{Binding ParkReviewCommand}" />
<Button Classes="btn" Content="Cancel"
Command="{Binding CancelReviewCommand}" />
</StackPanel>
</StackPanel>
<!-- Child outcomes -->
<StackPanel Spacing="6" IsVisible="{Binding HasChildOutcomes}">
<TextBlock Classes="section-label" Text="OUTCOMES" Margin="0,0,0,2" />
<TextBlock Classes="section-label" Text="OUTCOMES" />
<ItemsControl ItemsSource="{Binding ChildOutcomes}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:ChildOutcomeRowViewModel">
@@ -236,6 +235,13 @@
</ItemsControl>
</StackPanel>
<!-- Empty state: nothing to manage yet -->
<TextBlock IsVisible="{Binding ShowSessionEmpty}"
Classes="meta"
Foreground="{DynamicResource TextMuteBrush}"
TextWrapping="Wrap"
Text="Nothing to manage yet — review and merge controls appear here once the run finishes." />
</StackPanel>
</ScrollViewer>

View File

@@ -4,7 +4,7 @@
xmlns:loc="using:ClaudeDo.Ui.Localization"
x:Class="ClaudeDo.Ui.Views.Islands.SessionTerminalView"
x:Name="Root">
<Border Classes="terminal" Margin="18,8,18,0">
<Border Classes="terminal" Margin="0">
<DockPanel LastChildFill="True">
<!-- ── Terminal header bar ── -->