feat(webui): complete bang commands and literal output (NAN-291) (#6173)

* feat(webui): complete direct bang shell commands

Reuse the gateway user-shell side channel, retain failed drafts without reconnect replay, and preserve literal output across live delivery and history. Highlight the bang prefix before and after sending.

NAN-291

* fix(clients): preserve literal shell output through display metadata
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-26 23:35:26 +08:00
1 parent f23a6d1485
commit 7e5dcb79e0
43 files changed
+805 -100

No files matched your search

+10 -4
View File
@@ -259,13 +259,15 @@ async def test_gateway_webui_bootstrap_message_and_thread_hydration(tmp_path: Pa
await ws.send(json.dumps({
"type": "message",
"chat_id": chat_id,
"content": "!printf shell-ok",
"content": "!echo shell-ok",
"webui": True,
"user_shell": True,
"turn_id": "shell-turn",
}))
shell = await _recv_until(ws, "message")
assert "shell-ok" in shell["text"]
assert shell["text"].splitlines()[0] == "shell-ok"
assert "Exit code: 0" in shell["text"]
assert shell["render_as"] == "text"
assert shell["turn_id"] == "shell-turn"
await _recv_until(ws, "turn_end")
@@ -286,8 +288,12 @@ async def test_gateway_webui_bootstrap_message_and_thread_hydration(tmp_path: Pa
]
assert "/model" in contents
assert any("Current model: `custom/smoke-model`" in text for text in contents)
assert "!printf shell-ok" in contents
assert any("shell-ok" in text for text in contents)
assert "!echo shell-ok" in contents
assert shell["text"] in contents
[shell_history] = [event for event in thread["events"] if event.get("event") == "message"
and event.get("turn_id") == "shell-turn"]
assert shell_history["text"] == shell["text"]
assert shell_history["render_as"] == shell["render_as"]
finally:
_stop_gateway(process)