-
Notifications
You must be signed in to change notification settings - Fork 64
[codex] Improve Companion runtime console #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
35910b8
Improve Companion runtime console
Telli 99dbc5e
Address Companion runtime console review feedback
Telli 459807e
Clear stale session timeline on detail load failure
Telli 1c38c83
Tighten Companion review cleanup
Telli 85d04ab
Handle pre-open dialog cancellation
Telli 8fa4153
Make confirmation dialog await cancellation aware
Telli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/OpenClaw.Companion/Services/IConfirmationDialogService.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace OpenClaw.Companion.Services; | ||
|
|
||
| public interface IConfirmationDialogService | ||
| { | ||
| Task<bool> ConfirmAsync(string title, string message, string confirmText, string cancelText, CancellationToken cancellationToken); | ||
| } | ||
|
|
||
| public sealed class DenyConfirmationDialogService : IConfirmationDialogService | ||
| { | ||
| public Task<bool> ConfirmAsync(string title, string message, string confirmText, string cancelText, CancellationToken cancellationToken) | ||
| => Task.FromResult(false); | ||
| } |
107 changes: 107 additions & 0 deletions
107
src/OpenClaw.Companion/Services/WindowConfirmationDialogService.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| using Avalonia.Controls; | ||
| using Avalonia.Layout; | ||
| using Avalonia.Threading; | ||
|
|
||
| namespace OpenClaw.Companion.Services; | ||
|
|
||
| public sealed class WindowConfirmationDialogService(Window owner) : IConfirmationDialogService | ||
| { | ||
| public async Task<bool> ConfirmAsync( | ||
| string title, | ||
| string message, | ||
| string confirmText, | ||
| string cancelText, | ||
| CancellationToken cancellationToken) | ||
| { | ||
| if (cancellationToken.IsCancellationRequested) | ||
| return false; | ||
|
|
||
| var dialog = new Window | ||
| { | ||
| Title = title, | ||
| Width = 420, | ||
| SizeToContent = SizeToContent.Height, | ||
| WindowStartupLocation = WindowStartupLocation.CenterOwner, | ||
| CanResize = false | ||
| }; | ||
|
|
||
| var result = false; | ||
| var confirmButton = new Button | ||
| { | ||
| Content = confirmText, | ||
| MinWidth = 96, | ||
| HorizontalContentAlignment = HorizontalAlignment.Center | ||
| }; | ||
| var cancelButton = new Button | ||
| { | ||
| Content = cancelText, | ||
| MinWidth = 96, | ||
| HorizontalContentAlignment = HorizontalAlignment.Center | ||
| }; | ||
|
|
||
| confirmButton.Click += (_, _) => | ||
| { | ||
| result = true; | ||
| dialog.Close(); | ||
| }; | ||
| cancelButton.Click += (_, _) => | ||
| { | ||
| result = false; | ||
| dialog.Close(); | ||
| }; | ||
|
|
||
| dialog.Content = new StackPanel | ||
| { | ||
| Margin = new Avalonia.Thickness(20), | ||
| Spacing = 16, | ||
| Children = | ||
| { | ||
| new TextBlock | ||
| { | ||
| Text = message, | ||
| TextWrapping = Avalonia.Media.TextWrapping.Wrap | ||
| }, | ||
| new StackPanel | ||
| { | ||
| Orientation = Orientation.Horizontal, | ||
| HorizontalAlignment = HorizontalAlignment.Right, | ||
| Spacing = 8, | ||
| Children = { cancelButton, confirmButton } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| var cancellationRequested = false; | ||
| dialog.Opened += (_, _) => | ||
| { | ||
| if (cancellationRequested) | ||
| dialog.Close(); | ||
| }; | ||
|
|
||
| using var cancellationRegistration = cancellationToken.Register(() => | ||
| Dispatcher.UIThread.Post(() => | ||
| { | ||
| result = false; | ||
| cancellationRequested = true; | ||
| if (dialog.IsVisible) | ||
| dialog.Close(); | ||
| })); | ||
|
|
||
| if (cancellationToken.IsCancellationRequested) | ||
| return false; | ||
|
|
||
| try | ||
| { | ||
| await dialog.ShowDialog(owner).WaitAsync(cancellationToken); | ||
| } | ||
| catch (OperationCanceledException) | ||
| { | ||
| result = false; | ||
| if (dialog.IsVisible) | ||
| dialog.Close(); | ||
| return false; | ||
| } | ||
|
|
||
| return result && !cancellationToken.IsCancellationRequested; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <Styles xmlns="https://github.com/avaloniaui"> | ||
| <Style Selector="TextBlock.page-title"> | ||
| <Setter Property="FontSize" Value="22" /> | ||
| <Setter Property="FontWeight" Value="SemiBold" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="TextBlock.section-title"> | ||
| <Setter Property="FontSize" Value="15" /> | ||
| <Setter Property="FontWeight" Value="SemiBold" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="TextBlock.muted"> | ||
| <Setter Property="Opacity" Value="0.68" /> | ||
| <Setter Property="FontSize" Value="12" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Border.section-card"> | ||
| <Setter Property="Padding" Value="14" /> | ||
| <Setter Property="CornerRadius" Value="8" /> | ||
| <Setter Property="BorderThickness" Value="1" /> | ||
| <Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseLowBrush}" /> | ||
| <Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Border.metric-card"> | ||
| <Setter Property="Padding" Value="12" /> | ||
| <Setter Property="CornerRadius" Value="8" /> | ||
| <Setter Property="BorderThickness" Value="1" /> | ||
| <Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseLowBrush}" /> | ||
| <Setter Property="MinHeight" Value="84" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Border.badge"> | ||
| <Setter Property="CornerRadius" Value="10" /> | ||
| <Setter Property="Padding" Value="8,3" /> | ||
| <Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumBrush}" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="TextBox.monospace"> | ||
| <Setter Property="FontFamily" Value="Consolas, Menlo, monospace" /> | ||
| <Setter Property="FontSize" Value="12" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Button.primary"> | ||
| <Setter Property="FontWeight" Value="SemiBold" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Button.danger"> | ||
| <Setter Property="Background" Value="#a61f1f" /> | ||
| <Setter Property="Foreground" Value="White" /> | ||
| <Setter Property="BorderBrush" Value="#a61f1f" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Border.empty-state"> | ||
| <Setter Property="Padding" Value="24" /> | ||
| <Setter Property="CornerRadius" Value="8" /> | ||
| <Setter Property="BorderThickness" Value="1" /> | ||
| <Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseLowBrush}" /> | ||
| </Style> | ||
|
|
||
| <Style Selector="Border.error-banner"> | ||
| <Setter Property="Padding" Value="10" /> | ||
| <Setter Property="CornerRadius" Value="8" /> | ||
| <Setter Property="Background" Value="#3a1515" /> | ||
| <Setter Property="BorderBrush" Value="#ff453a" /> | ||
| <Setter Property="BorderThickness" Value="1" /> | ||
| </Style> | ||
|
|
||
|
|
||
| <Style Selector="Border.error-banner TextBlock"> | ||
| <Setter Property="Foreground" Value="White" /> | ||
| </Style> | ||
| </Styles> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.