Skip to content

Refactor tray voice code into OpenClaw.Tray.Shared#5

Merged
NichUK merged 4 commits intofeature/voice-modefrom
codex/fix-pr120-ci
Apr 3, 2026
Merged

Refactor tray voice code into OpenClaw.Tray.Shared#5
NichUK merged 4 commits intofeature/voice-modefrom
codex/fix-pr120-ci

Conversation

@NichUK
Copy link
Copy Markdown
Owner

@NichUK NichUK commented Apr 3, 2026

Move voice-mode test-targeted logic out of the WinUI app and into a dedicated shared project so tray tests no longer need to reference OpenClaw.Tray.WinUI directly.

This restores the original CI assumption that the tray test project can be built on its own without transitively building a Windows App SDK application with an implicit architecture. It also keeps the voice/chat extraction scoped away from the broader OpenClaw.Shared library, which remains general-purpose and non-tray-specific.

The new OpenClaw.Tray.Shared project now contains the shared voice/chat surface used by both the tray app and tray tests, including voice transport helpers, provider catalog loading, cloud TTS support, chat coordination, and the web chat DOM bridge. The WinUI app retains the UI shell pieces, including DispatcherQueueAdapter and the app-level icon path helper.

As a follow-up cleanup during the extraction, split the previous IconHelper into AppIconHelper in the WinUI project and VoiceTrayIconHelper in the shared tray project so the new shared library stays focused on voice-related behavior rather than wider tray infrastructure.

Move voice-mode test-targeted logic out of the WinUI app and into a dedicated shared project so tray tests no longer need to reference OpenClaw.Tray.WinUI directly.

This restores the original CI assumption that the tray test project can be built on its own without transitively building a Windows App SDK application with an implicit architecture. It also keeps the voice/chat extraction scoped away from the broader OpenClaw.Shared library, which remains general-purpose and non-tray-specific.

The new OpenClaw.Tray.Shared project now contains the shared voice/chat surface used by both the tray app and tray tests, including voice transport helpers, provider catalog loading, cloud TTS support, chat coordination, and the web chat DOM bridge. The WinUI app retains the UI shell pieces, including DispatcherQueueAdapter and the app-level icon path helper.

As a follow-up cleanup during the extraction, split the previous IconHelper into AppIconHelper in the WinUI project and VoiceTrayIconHelper in the shared tray project so the new shared library stays focused on voice-related behavior rather than wider tray infrastructure.
Copilot AI review requested due to automatic review settings April 3, 2026 15:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors tray voice/chat functionality into a new OpenClaw.Tray.Shared project so the tray test project can build/run without referencing the WinUI (Windows App SDK) application, while keeping WinUI-specific UI shell concerns in OpenClaw.Tray.WinUI.

Changes:

  • Introduced OpenClaw.Tray.Shared and moved/shared voice transport logic, voice capture math, voice provider route resolution, conversation event contracts, and web chat DOM bridge into it.
  • Updated tray tests to call shared logic directly (removing reflection-based access to WinUI internals) and updated project references accordingly.
  • Split icon helpers into AppIconHelper (WinUI app/status icons) and VoiceTrayIconHelper (voice tray state icons) and updated WinUI windows to use the new helper.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/OpenClaw.Tray.Tests/VoiceServiceTransportTests.cs Switches tests from reflection into direct calls to shared transport/capture helpers.
tests/OpenClaw.Tray.Tests/VoiceProviderCatalogServiceTests.cs Updates tests to use VoiceTrayIconHelper and shared catalog service.
tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj Replaces WinUI project reference with OpenClaw.Tray.Shared.
src/OpenClaw.Tray.WinUI/Windows/WebChatWindow.xaml.cs Uses AppIconHelper for window icon; uses shared DOM bridge.
src/OpenClaw.Tray.WinUI/Windows/VoiceRepeaterWindow.xaml.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/Windows/VoiceModeWindow.xaml.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/Windows/StatusDetailWindow.xaml.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/Windows/SettingsWindow.xaml.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/Windows/NotificationHistoryWindow.xaml.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/Windows/ActivityStreamWindow.xaml.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/Services/Voice/VoiceSpeechToTextRouteFactory.cs Delegates STT route selection to shared resolver.
src/OpenClaw.Tray.WinUI/Services/Voice/VoiceService.cs Delegates transport decision helpers to shared logic; moves conversation events out.
src/OpenClaw.Tray.WinUI/Services/Voice/VoiceCaptureService.cs Delegates math helpers to shared VoiceCaptureMath.
src/OpenClaw.Tray.WinUI/Services/Voice/DispatcherQueueAdapter.cs Adds WinUI-specific IUiDispatcher implementation in WinUI project.
src/OpenClaw.Tray.WinUI/OpenClaw.Tray.WinUI.csproj References new OpenClaw.Tray.Shared project.
src/OpenClaw.Tray.WinUI/Helpers/AppIconHelper.cs New WinUI-only helper for status/app icon path resolution.
src/OpenClaw.Tray.WinUI/Dialogs/QuickSendDialog.cs Uses AppIconHelper for window icon.
src/OpenClaw.Tray.WinUI/App.xaml.cs Uses AppIconHelper and VoiceTrayIconHelper for tray icon selection.
src/OpenClaw.Tray.Shared/Windows/WebChatVoiceDomBridge.cs Makes DOM bridge public for shared consumption.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceSpeechToTextRouteResolver.cs New shared STT route resolver.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceSpeechToTextRouteKind.cs Exposes route kind enum publicly from shared.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceServiceTransportLogic.cs New shared transport/decision helpers previously tested via reflection.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceProviderCatalogService.cs Uses shared STT route resolver; removes WinUI factory dependency.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceConversationEvents.cs New shared conversation/transcript event args and direction enum.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceCloudTextToSpeechClient.cs Minor using reorder while moving into shared.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceChatCoordinator.cs Ensures cloned turns include Mode after event args extraction.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceChatContracts.cs Removes WinUI-specific dispatcher adapter from shared contracts.
src/OpenClaw.Tray.Shared/Services/Voice/VoiceCaptureMath.cs New shared capture math utilities used by WinUI + tests.
src/OpenClaw.Tray.Shared/OpenClaw.Tray.Shared.csproj Adds new shared project definition and dependencies.
src/OpenClaw.Tray.Shared/Helpers/VoiceTrayIconHelper.cs Renames/splits icon helper to voice-only tray icon generation.
moltbot-windows-hub.slnx Adds OpenClaw.Tray.Shared to the solution.
Comments suppressed due to low confidence (1)

src/OpenClaw.Tray.Shared/Helpers/VoiceTrayIconHelper.cs:75

  • GetBaseAppIconPath() always returns an openclaw.ico path without checking that it exists, and CreateVoiceTrayBitmap immediately constructs new Icon(GetBaseAppIconPath(), ...) which will throw if the icon file can't be found. To avoid runtime failures in environments where Assets aren't present (or during mispackaged builds), add an existence check and a fallback strategy before constructing the Icon.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

NichUK and others added 3 commits April 3, 2026 16:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@NichUK NichUK merged commit 88caa1a into feature/voice-mode Apr 3, 2026
@NichUK NichUK deleted the codex/fix-pr120-ci branch April 3, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants