feat: Extract PolyPilot.Core library for headless operation#513
Open
feat: Extract PolyPilot.Core library for headless operation#513
Conversation
Move all Models (29 files) and Services (45 files) into a new PolyPilot.Core net10.0 class library. The MAUI app becomes a thin UI shell that references Core via ProjectReference. Key changes: - Create PolyPilot.Core.csproj (net10.0) with InternalsVisibleTo for MAUI, GTK, and Tests projects - Move all pure .NET Models and Services to PolyPilot.Core/ - Keep only MAUI-specific services in PolyPilot/ (QrScanner, KeyCommand, Tutorial) - Replace 73 Compile Include links in Tests with ProjectReference - Update GTK project to reference Core and align SDK versions - Update Console project to reference Core instead of direct SDK - Fix structural test paths (PolyPilot/ -> PolyPilot.Core/) All MAUI-specific code (#if MACCATALYST/IOS/ANDROID blocks) compiles out cleanly in the net10.0 Core library. No platform abstractions needed — the existing #if conditional compilation handles it. The orchestration engine, sessions, bridge protocol, persistence, DevTunnel, and multi-agent system can now run headless. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Owner
Author
🔍 Multi-Model Code Review — PR #513 (Re-review v3, after all fixes)SummaryExtracts 74 files (29 Models + 45 Services) from the MAUI app into CI StatusAll Previous Findings — Final Status
What Looks Good ✅
Test Coverage✅ 3134/3134 tests pass — zero failures. Recommended Action✅ Approve — all findings from 3 rounds of review have been addressed. Solution builds clean, full test suite passes. |
PolyPilot.Core sets CopilotSkipCliDownload=true since it's a library. Executable projects need a direct GitHub.Copilot.SDK reference to get the bundled copilot binary in their output directory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All other projects use GitHub.Copilot.SDK 0.2.1. Aligning to avoid potential NU1605 version downgrade warnings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address dead platform #if blocks caused by Core targeting plain net10.0. Multi-target PolyPilot.Core to match the MAUI project's TFMs: net10.0, net10.0-android, net10.0-ios, net10.0-maccatalyst, net10.0-windows (on Windows hosts) This preserves all #if ANDROID/IOS/MACCATALYST/WINDOWS blocks that depend on MAUI APIs (SecureStorage, FileSystem, Connectivity, etc.). Additionally, replace compile-time #if with runtime OperatingSystem.Is*() checks where the code uses only standard .NET APIs: - PlatformHelper: IsDesktop, IsMobile, PlatformName now use runtime checks - LinkHelper.OpenInBackground: runtime macOS detection - CopilotService: Android dir fallback, scanner mobile guard - UsageStatsService: Unix permissions guard Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rence OperatingSystem.IsIOS() returns true on Mac Catalyst (documented .NET behavior). The runtime checks in PlatformHelper and CopilotService must exclude Mac Catalyst explicitly to preserve desktop behavior: - Scanner guard: same pattern Also add conditional FrameworkReference for Microsoft.WindowsDesktop.App on Windows TFM — required by WindowFocusHelper's System.Windows.Automation usage in the #if WINDOWS block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update docs/multi-agent-orchestration.md paths to PolyPilot.Core/ - Remove 6 duplicate NuGet packages from GTK csproj (now transitive via Core) - Add 3 PlatformHelper regression tests (IsDesktop/IsMobile exclusivity, PlatformName known value, PlatformName not unknown on desktop) - Add IsMacOS() fallback in PlatformName for plain macOS processes (Console, Tests) that aren't Mac Catalyst Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Extracts all non-GUI logic from the MAUI app into a
PolyPilot.Core(net10.0) class library so the orchestration engine, sessions, networking, persistence, and multi-agent system can run independently of any UI framework.What moved
PolyPilot.Core/Models/PolyPilot.Core/Services/PolyPilot.Core/Services/Stayed in MAUI: QrScannerService, KeyCommandService, TutorialService (platform-coupled).
Architecture
Key design decisions
PolyPilot.Models/PolyPilot.Servicesstay the same, minimizing churnInternalsVisibleToon Core for MAUI, GTK, and Tests — no visibility changes needed#if MACCATALYST/IOS/ANDROIDblocks handle platform differences naturally in thenet10.0libraryTest results
dotnet build PolyPilot.slnx— full solution buildsdotnet build PolyPilot.Core— net10.0 library builds cleandotnet build PolyPilot -f net10.0-maccatalyst— MAUI app buildsdotnet test— 3154/3155 pass (1 flaky timing test unrelated to changes)