Commit Graph

3 Commits

Author SHA1 Message Date
Pascal 0dbaeaf6c7 webui: incremental MDAST transform caching for streaming performance
Replace full AST re-transformation with per-block caching strategy.
Previously, each streaming chunk triggered processor.run() on the entire
document (12 rehype/remark plugins including KaTeX and highlight.js).

Now transforms individual MDAST nodes and caches results by position hash.
In append-only streaming mode, stable blocks are reused directly from cache,
only the unstable trailing block is re-transformed.

- Add SvelteMap FIFO cache (5000 blocks, evicts oldest 1000 on overflow)
- Add getMdastNodeHash() for MDAST node fingerprinting by position
- Add isAppendMode() to detect streaming append patterns
- Add transformMdastNode() for single-node transformation with cache lookup
- Remove stringifyProcessedNode() (dead code after refactor)

Reduces streaming complexity from O(N × transforms) to O(1) for stable blocks.
Targets 200K token contexts without UI degradation on mobile devices.
2026-02-01 19:44:16 +01:00
Aleksander Grygier 2aa704b821 refactor: Cleanup 2026-01-29 11:44:08 +01:00
Aleksander Grygier 1b7f576baf refactor: Components 2026-01-27 10:26:14 +01:00
Renamed from tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte (Browse further)