RynthCore/Changelog/2026-11-07-web-panel.md
Daniel Wallace 537a40a430 WebPanel final-review fix: truthful browser fallback, focus gate, docs
- Creation-failure fallback sets OpenedInBrowser and says "opened" only
  when the system browser actually opened; otherwise chat says the
  browser did not open. Harness check CreateFailureBrowserFails.
- FocusPage follows the same in-process foreground rule as
  SetForegroundWindow (Show and controller creation). Harness check
  NoFocusFromAnotherProcess; posted-key checks report UNVERIFIED when
  another process holds the foreground.
- PermissionRequested: SavesInProfile = false.
- WEB_PANEL.md: allowlist empty-entry rule, GetState -4, AOT renumber
  caveat, softened focus claim (also in the Changelog).
- Formatting: ChatCommandReplyTests brace, /rc layout comment,
  PluginContract blank line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:09:14 -08:00

3 KiB

In-game web panel: plugin API v93

Branch up/web-panel, from upstream main 418d80b. Not deployed. The API number 93 is provisional (upstream may take 93 first; it renumbers on merge). CoreCLR engine only.

What changed

  • Four new function slots at the end of the plugin API table (WebPanelOpenFn, WebPanelNavigateFn, WebPanelCloseFn, WebPanelGetStateFn), and SDK wrappers on RynthCoreHost: HasWebPanel, OpenWebPanel(WebPanelOptions), NavigateWebPanel, CloseWebPanel, GetWebPanelState. Types are in RynthCore.PluginSdk/WebPanelTypes.cs. No call blocks its caller.
  • WebPanel/WebPanelHost.cs (engine): one WebView2 panel over the game window, on its own STA thread, with an unowned popup window, a caption bar with a close box, a remembered size and place, and Escape / Alt+F4 / X to close.
  • Navigation allowlist (WebPanelUrlPolicy): https only, default port, no user info, exact host or *.suffix (*.x.com does not match x.com: list both). Off-list navigations, pop-ups and custom-scheme launches never load in the panel; an absolute http(s) URL goes to the system browser, anything else is dropped.
  • Per-world, per-key WebView2 profile (WebPanelProfile): the plugin's key is lower-cased and hashed, and the world is added.
  • /rc webpanel [status|close]: a redacted one-line report, and a close.
  • engine.json "WebPanel": false: kill switch. OpenWebPanel then answers Unavailable.
  • RynthCore.PluginSdk.targets already raised a shared-SDK release build's RynthPluginMinEngineApi below 88 to the SDK's API; that is now 93 for every such plugin. Plugins that must run on older cores declare 88 or higher.
  • tools\WebPanelHarness: an offline 32-bit harness for the host (see the doc).
  • Docs: docs/WEB_PANEL.md is the plugin contract.

How it behaves

  • The panel is designed never to take focus from another program; confirm in game. It takes the foreground (and page focus) only if the foreground window already belongs to the game, and it hides while another program is in front.
  • Logs and chat never carry a URL's query, fragment or user info (the launch code rides in the query).
  • Failures: the panel fails only when the WebView2 browser process or the main renderer exits, or the renderer is reported unresponsive 3 times in 30 s. Other process failures are logged. RuntimeMissing / CreateFailed fall back to the system browser when the plugin asked for it (the default). Page permission ClipboardRead is allowed only for allowlisted origins; the rest are denied.
  • The NativeAOT engine flavour has no web panel: the slots stay zero and HasWebPanel is false.

Tests

tools/WebPanelTests: URL allowlist and redaction, window visibility and layout, profile folder, the ABI glue. tools/WebPanelHarness: the host in a collectible load context against real WebView2 (needs a desktop, the WebView2 runtime and the x86 .NET 10 runtime; not part of Run-AllTests.ps1). Checks that need another program in the foreground report UNVERIFIED and are owner in-game checks.

Not yet tested in game.