Expand description
Snapcompact frame rendering.
Rasterizes pre-normalized conversation text onto a size-wide bitmap
(height hugs the rows the text actually needs) using one of the bundled
public-domain pixel fonts, then encodes it as PNG:
5x8— X.org BDF font (legacy shape).8x8— unscii-8 hex font (Latin-1 subset), the square cell that won the snapcompactSQuADevals.6x12/8x13— X.org misc BDF fonts (higher-density eval winners).silver— bundled TrueType font for CJK and other non-Latin text.
Shape controls, all eval-validated in packages/snapcompact:
- variant —
sentcycles glyph ink through six hues at sentence boundaries;bwprints plain black ink (best for Anthropic readers). - lineRepeat — prints every text line N times; copies after the first sit on a pale highlight band. Redundancy coding: two looks per glyph at half the density (“8x8r” shapes).
- cellWidth/cellHeight — target cell size. When it differs from the font’s natural cell, glyphs are rasterized at native size and the canvas is Lanczos3-resampled to the target (anisotropic stretch, e.g. the OpenAI-optimal “6x6u” shape), producing an anti-aliased RGB frame.
- stretch —
falsedisables resampling: glyphs print at natural size on the requested cell box while staying indexed (e.g. 8x13 glyphs on an 8x16 pitch, the “8on16” shapes).true/unset keeps the auto rule above. - columns —
2flows pre-wrapped\n-separated lines down two newspaper columns (the “doc” shapes); word wrap and pagination happen in the TypeScript caller. - dim spans —
U+000E/U+000Fin the text toggle dim gray ink on/off without occupying a cell; the TypeScript serializer wraps tool output in them so archived conversation reads louder than archived tool noise. - line breaks —
U+2588(FULL BLOCK) fills its entire cell with pitch black ink regardless of variant or dim state; the TypeScript normalizer folds newline runs to it so line structure survives whitespace collapse at a one-cell cost.
Text normalization, frame chunking, provider shape selection, and archive
management live in packages/snapcompact/src/snapcompact.ts; this module
is only the hot text -> PNG bytes path.
Structs§
- Snapcompact
Render Options - Shape options for one snapcompact frame.
Enums§
- Snapcompact
Error - Renderer error type.
Functions§
- render_
snapcompact_ png - Render one snapcompact frame on a libuv worker: print pre-normalized text
onto a
size-wide bitmap and encode it as PNG. - snapcompact_
supported_ chars - Return the subset of
charsthat the named snapcompact font can render.