Docs: web panel API

Plugin contract (docs/WEB_PANEL.md) and changelog for the v93 web panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 15:52:13 -08:00
commit 6918e6736f
2 changed files with 331 additions and 0 deletions

View file

@ -0,0 +1,43 @@
# 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 never takes focus from another program. It takes the foreground 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.