fix: vendor marked UMD build so window.marked is defined (issue #244)

This commit is contained in:
iris 2026-05-22 15:43:00 +02:00 committed by Mara
parent b283768f26
commit 9b9277db78
5 changed files with 2928 additions and 16 deletions

View file

@ -102,7 +102,7 @@ hive-fr0nt/ shared frontend-assets crate (browser only).
backfill + SSE subscribe-buffer-snapshot-
dedupe dance. Pages register a kind→renderer
map; the terminal owns the lifecycle.
assets/marked.min.js vendored marked v4.0.2 UMD bundle. Per-agent
assets/marked.umd.js vendored marked v4.0.2 UMD bundle. Per-agent
terminal uses the global `marked.parse` for
markdown bodies on send / recv / ask / answer
/ assistant text rows.

View file

@ -6,7 +6,7 @@ event kind today. Source of truth lives in
`renderRichToolUse`, `renderToolResult`, `renderTaskEvent`,
`mdNode`, `detailsOpenMd`, `fmtArgsGeneric`) +
`hive-fr0nt/assets/terminal.css` (the shared `.live .<class>`
styling) + `hive-fr0nt/assets/marked.min.js` (markdown).
styling) + `hive-fr0nt/assets/marked.umd.js` (markdown).
## Layout contract

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -32,11 +32,16 @@
pub const BASE_CSS: &str = include_str!("../assets/base.css");
pub const TERMINAL_CSS: &str = include_str!("../assets/terminal.css");
pub const TERMINAL_JS: &str = include_str!("../assets/terminal.js");
/// Vendored [marked](https://github.com/markedjs/marked) v4.0.2 UMD bundle.
/// Exposes a global `marked` with `.parse(src, opts)` returning HTML. Used
/// by the per-agent terminal to render message bodies (`send` / `recv` /
/// `ask` / `answer` / assistant text) with basic markdown — paragraphs,
/// lists, fenced + inline code, bold/italic, links. Vendored rather than
/// CDN-loaded so the per-agent page works on operator machines without
/// internet egress (the container itself never fetches it).
pub const MARKED_JS: &str = include_str!("../assets/marked.min.js");
/// Vendored [marked](https://github.com/markedjs/marked) v4.0.2 **UMD**
/// bundle (`lib/marked.umd.js`). The UMD wrapper assigns a browser global
/// `window.marked` with `.parse(src, opts)` / `.setOptions(...)`. Used by
/// the per-agent terminal and the dashboard file-preview flyout to render
/// markdown (paragraphs, lists, fenced + inline code, bold/italic, links).
/// Vendored rather than CDN-loaded so the pages work on operator machines
/// without internet egress (the container itself never fetches it).
///
/// NB: must be the **UMD** build, not `marked.min.js` / `lib/marked.cjs` —
/// those are CommonJS (`exports.parse = …`, no wrapper) and throw
/// `exports is not defined` in a `<script>` tag, leaving `window.marked`
/// undefined and markdown silently falling back to raw text (issue #244).
pub const MARKED_JS: &str = include_str!("../assets/marked.umd.js");