WebPanel fix round 1: close reply by code, loader PE check, no-open scan, drop Core.xml

- RynthCoreChatCommands: each method keeps its own summary; /rc webpanel close answers by the Close code (closing / already closed / could not close); verb added to the class header list.
- Build-Installer.ps1: Assert-PeMachine throws unless Runtime\WebView2Loader.dll is x86 (0x14C).
- ChatCommandReplyTests: HandleWebPanelCommand has no Open(, Navigate( or ShellExecute.
- Engine csproj: Microsoft.Web.WebView2.Core.xml is not copied (with the other dropped WebView2 copies).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 15:47:57 -08:00
commit 4e30b16bf5
4 changed files with 42 additions and 9 deletions

View file

@ -108,6 +108,9 @@ namespace RynthCore.Engine.Compatibility;
/// <item><c>/rc uicost [on|off|&lt;ms&gt;|now|status]</c> - the UI frame cost breakdown
/// (<see cref="ImGuiBackend.UiCost"/>): timing on or off, the slow-frame threshold, and (now, or
/// alone) which parts of the UI frame took the time over the last seconds. Also Settings &gt; Diagnostics.</item>
/// <item><c>/rc webpanel [status|close]</c> - the in-game web panel (<see cref="WebPanel.WebPanelApi"/>):
/// status is one redacted line (state, handle, visible/focused, browser pid, free address space);
/// close closes the panel. It never opens a URL.</item>
/// </list>
/// </summary>
internal static class RynthCoreChatCommands
@ -1723,12 +1726,6 @@ internal static class RynthCoreChatCommands
ReplyLines(UI.Data.Discord.ChatDiscord.HandleCommand(verb));
}
/// <summary>
/// /rc layout: which panel layout this client uses and its files (UI/PanelLayout: the character's own,
/// or the PC-wide default and why); default makes this character's the default for new characters;
/// reset asks, reset confirm copies the default over this character's. Those two answer when their
/// files are written (from the UI writer), or at once with why they can't run.
/// </summary>
/// <summary>
/// /rc webpanel [status|close]. Status: one redacted line (WebPanelApi.Describe plus the address
/// space). Close: closes the live panel (WebPanelApi.Close does not block). Nothing here opens a URL.
@ -1741,12 +1738,21 @@ internal static class RynthCoreChatCommands
int handle = WebPanel.WebPanelApi.LiveHandle;
if (handle <= 0) { Reply("web panel: nothing to close."); return; }
int rc = WebPanel.WebPanelApi.Close(handle);
Reply($"web panel: close requested (handle {handle}, code {rc}).");
// 1 = closing, 0 = already closed (the WebPanelCode values); anything else is a refusal or error.
if (rc == 1) Reply("web panel: closing.");
else if (rc == 0) Reply("web panel: already closed.");
else Fail($"web panel: could not close (code {rc}).");
return;
}
Reply(WebPanel.WebPanelApi.Describe() + "; address space " + AddressSpace.Describe());
}
/// <summary>
/// /rc layout: which panel layout this client uses and its files (UI/PanelLayout: the character's own,
/// or the PC-wide default and why); default makes this character's the default for new characters;
/// reset asks, reset confirm copies the default over this character's. Those two answer when their
/// files are written (from the UI writer), or at once with why they can't run.
/// </summary>
private static void HandleLayoutCommand(string args)
{
UI.LayoutCommand cmd = UI.PanelLayoutPolicy.ParseCommand(args);

View file

@ -69,6 +69,8 @@
<Target Name="DropWebView2UiCopies" AfterTargets="ResolveAssemblyReferences" Condition="'$(EngineHost)' == 'coreclr'">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)' == 'Microsoft.Web.WebView2.WinForms' Or '%(Filename)' == 'Microsoft.Web.WebView2.Wpf'" />
<!-- The Core wrapper's XML doc file is not needed at run time. -->
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)%(Extension)' == 'Microsoft.Web.WebView2.Core.xml'" />
</ItemGroup>
</Target>