/rc webpanel status|close

Status prints one redacted line (WebPanelApi.Describe plus the address space);
close closes the live panel. Neither opens a URL. WebPanelHost.Describe now
reports visible/focused/in-browser instead of raw flags; the stacked test-hook
summaries are put back on their own members. ChatCommandReplyTests covers the verb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 15:40:46 -08:00
commit bfb87aba04
4 changed files with 31 additions and 2 deletions

View file

@ -200,6 +200,7 @@ internal static class ChatCommandReplies
V("vitals", "Usage: /rc vitals (the old vitals HUD is gone: /rv plates self)", NoArgs, "hud"),
V("layout", "Usage: /rc layout [status] | default | reset [confirm]", LayoutArgs),
V("uicost", UiCostUsage, null),
V("webpanel", "Usage: /rc webpanel [status|close] (status is a redacted one-line report; it never opens a URL)", Words("", "status", "close")),
};
/// <summary>/rc uicost: the UI frame cost breakdown (ImGui/UiCost.cs).</summary>

View file

@ -651,6 +651,13 @@ internal static class RynthCoreChatCommands
return;
}
// /rc layout [status] | default | reset [confirm]: this client's panel layout (UI/PanelLayout).
// /rc webpanel [status|close]: diagnostics for the in-game web panel. It never opens a URL
// (an arbitrary-URL command would be a phishing vector); every URL in the line is redacted.
if (IsVerb(sub, "webpanel", out string webPanelArgs))
{
HandleWebPanelCommand(webPanelArgs);
return;
}
if (IsVerb(sub, "layout", out string layoutArgs))
{
HandleLayoutCommand(layoutArgs);
@ -1722,6 +1729,24 @@ internal static class RynthCoreChatCommands
/// 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.
/// </summary>
private static void HandleWebPanelCommand(string args)
{
string a = args.Trim().ToLowerInvariant();
if (a == "close")
{
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}).");
return;
}
Reply(WebPanel.WebPanelApi.Describe() + "; address space " + AddressSpace.Describe());
}
private static void HandleLayoutCommand(string args)
{
UI.LayoutCommand cmd = UI.PanelLayoutPolicy.ParseCommand(args);

View file

@ -222,7 +222,7 @@ internal sealed unsafe class WebPanelHost
string thread = _thread == null ? "not started" : _threadDone ? "stopped" : "running";
string status = ((WebPanelStatusCode)_status).ToString();
return $"web panel: thread {thread}{(_shuttingDown ? " (shut down)" : "")}, handle {_live}, {status}, error {_error}, " +
$"http {_http}, navigations {_navCount}, environments {_environmentCount}, flags {_flags}, browser pid {_browserPid}, url {WebPanelUrlPolicy.Redact(_liveUrl)}";
$"http {_http}, navigations {_navCount}, environments {_environmentCount}, visible {((_flags & StateVisible) != 0 ? "yes" : "no")}, focused {((_flags & StateFocused) != 0 ? "yes" : "no")}, in browser {((_flags & StateOpenedInBrowser) != 0 ? "yes" : "no")}, browser pid {_browserPid}, url {WebPanelUrlPolicy.Redact(_liveUrl)}";
}
}
@ -266,9 +266,9 @@ internal sealed unsafe class WebPanelHost
internal bool ThreadRunningForTests { get { lock (_sync) return _thread != null && !_threadDone && _thread.IsAlive; } }
internal bool PostForTests(Action<CoreWebView2?> a) => Post(() => a(_web));
internal bool PanelOpenForTests => _open;
/// <summary>A failure arriving late for <paramref name="handle"/> (the harness passes a superseded one).</summary>
/// <summary>A renderer-unresponsive report, as WebView2 would raise it (counting against UnresponsiveLimit).</summary>
internal bool UnresponsiveForTests() => Post(() => HandleProcessFailed(CoreWebView2ProcessFailedKind.RenderProcessUnresponsive));
/// <summary>A failure arriving late for <paramref name="handle"/> (the harness passes a superseded one).</summary>
internal bool FailForTests(int handle) => Post(() => Fail(handle, WebPanelCode.ProcessFailed, "synthetic (harness)", allowFallback: false));
// ============================ panel thread ============================

View file

@ -115,6 +115,9 @@ internal static class Program
("layout", "layout", "layout frob"),
("layout", "layout reset confirm", "layout reset now"),
("layout", "layout default", "layout default now"),
("webpanel", "webpanel status", "webpanel open"),
("webpanel", "webpanel", "webpanel frob"),
("webpanel", "webpanel close", "webpanel close now"),
};
private static void EveryVerbValidAndInvalid()