feat(renderer): support sanitized html fragments#3052
Conversation
69a7338 to
0d7434e
Compare
|
Triage: HOLD pending UX review — labels: This adds an opt-in HTML-fragment renderer for assistant messages (
The asset-mtime cache-bust token ( When you can:
Thanks for the work — this is a reasonable feature and the sanitizer scope looks deliberate. Just needs the deeper renderer pass. |
0d7434e to
a9cd202
Compare
|
Thanks for the review — agreed that this should sit in UX/renderMd hold until the renderer pass is comfortable. I added the requested visual evidence from an isolated local WebUI run. The fixture uses the real
Desktop 1280: Mobile 390: Repro fixture used for the screenshots: A few confirmations:
Local verification after the recut: CI on GitHub is still Happy to split |
- render explicit sanitized assistant HTML fragments - keep html fragment markers inside fenced code source-only - include static file mtimes in WebUI/PWA cache-bust tokens - make fragment cards width-safe on narrow mobile viewports
a9cd202 to
57e0bed
Compare
|
Good catch on the mobile screenshot. That exposed a real narrow-width issue rather than just a screenshot problem. I updated the PR branch with a mobile width-safety fix for the fragment styles:
Updated verification: I also refreshed the mobile evidence image at the same URL: PR shape after the update:
|
|
Replaced the mobile evidence image with a true Chrome DevTools Protocol mobile-emulation capture rather than a plain narrow headless window. Capture settings: Layout metrics from the capture: {
"innerWidth": 390,
"visualViewportWidth": 390,
"dpr": 3,
"docScrollWidth": 390,
"bodyClientWidth": 390,
"msgBody": { "clientWidth": 366, "scrollWidth": 366 },
"card": { "clientWidth": 366, "scrollWidth": 366 },
"grid": { "clientWidth": 332, "scrollWidth": 332, "columns": "332px" }
}Updated mobile image, same URL as before: |


Thinking Path
What Changed
<!-- html-render-start -->/<!-- html-render-end -->./sw.jscache tokens to include selectedstatic/*mtimes, so local frontend hotfixes invalidate mobile/PWA caches even without a package version bump.Why It Matters
ui.jsorstyle.csschanges between package releases.Verification
python3 -m py_compile api/routes.py server.pypython3 -m pytest -q tests/test_renderer_js_behaviour.py tests/test_pwa_manifest_sw.py tests/test_static_asset_compression_and_cache.py106 passedrenderMd()..html-fragment-renderedexists for the marked fragment.#html-fragment-runtime-stylesis injected.htmlcode block remains in<pre><code>and does not render as a live fragment.UI / UX Evidence
Contract Routing
Task type: UI renderer behavior + PWA/mobile cache busting.
Touched areas:
static/ui.jsassistant Markdown rendererstatic/style.csstranscript fragment stylingapi/routes.pyshell/service-worker asset version injectionRelevant public docs:
AGENTS.mdCONTRIBUTING.mddocs/CONTRACTS.mddocs/UIUX-GUIDE.mdScope boundaries:
Risks / Follow-ups
Model Used
custom, modelgpt-5.5.