feat(reports): draw_page adds a report in pen strokes (Hershey text + SVG) as a new page #65
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/62-ink-reports"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #62
The AI (the chat, or an agent over MCP) can now write a report onto a new page as pen strokes: Markdown text drawn in a Hershey single-stroke font, and sketches and charts it writes as SVG, inline in fenced
```svgblocks, drawn as their outlines. On the tablet it's ink like anything written there. Full write-up:docs/ink-reports.md.Screenshots
All taken at
781c7f5in the mock app (scripts/screenshotslibrary, Chromium), the chat's drawn-page drafts over the app's own template drawings (Templates.svg/1, the same table of rulesInk.Reportwrites on). Sample is the report Markdown at the end of this description; long is it plus 20 more bullet rows, so it runs onto page 2 (2.3 pages on Lines medium).Text just above the rules, zoomed 2× (from the full-size shots below; each row's baseline 5 px above its rule, so the ink stops 2–3 px short of it): Lines medium page 1, Lines medium page 2 (the template repeating 1872 down), Lines large page 3, Lines small, Checklist.
Full size, 1404 px wide (the draft's full-size popover, 1:1 with the tablet's pixels), sample on each lined template:
Desktop, 1440×900 (the popover as it opens):
Phone, 390×844:
Page 2 of the long report (popover scrolled to the second page's top), desktop on each template, and Lines medium on the phone:
The draft card in the chat, desktop:
What's in it
Ink.Hershey: Futura Light (Roman Simplex) for body text, Futura Medium (Roman Duplex) for headings and bold, italics slanted. Font data vendored unchanged inpriv/hershey/(futural.jhf,futuram.jhf) with the distribution'shershey.txtand a README carrying its required acknowledgements. Read at compile time; no new deps. ASCII only: accents come off, smart quotes/dashes/bullets fold to ASCII, the rest is?.Ink.Path: SVG path data, every command (M L H V C S Q T A Z, absolute and relative), curves and arcs flattened (the spec's endpoint-to-center arc conversion, out-of-range radii scaled up).Ink.SVG:path,line,polyline,polygon,rect(rounded too),circle,ellipse,text/tspan(in Hershey, byfont-sizeandtext-anchor);transforms (matrix, translate, scale, rotate with a center, skewX/Y) nested throughgandsvg; presentation attributes andstyle=""inherited;display/visibility. Parsed with:xmerl(OTP, added toextra_applications); a DOCTYPE or entity declaration refuses the drawing, so nothing is fetched or expanded. The viewBox is scaled into its place in the flow (the text width, or the svg'swidthin page pixels if it asks for less, at most 1400 tall), centered.Ink.Report: lays the Markdown (viaLines.Markdown, as typed pages read it) and the drawings out on a row grid from the template'sTypedPages.Layoutsmargins, wrapping at its width. On a lined template the rows are its own rules (Templates.rules/1: Lines small 52, medium 78.75, large 96.94, Checklist 97.4 px, measured from the rM2 template images), starting on the rule nearest where typed text would and, past a page's last rule, carrying on from the next page's first (the template repeats every 1872); a title or drawing that would straddle the page edge starts on the next page; elsewhere 70 px; produces finelinerStrokes and the page's transcription.Lines.Writer.ink_page/2: a v6.rmpage of one layer of line items, as the tablet writes a drawn page (no root text). rmscene reads it cleanly.draw_pagein the chat's tools (drafts, previewed and approved likeadd_page, card titled "New drawn page draft") and inAgentToolsfor keys that may write (adds straight away), on the sameTypedPagesadd/commit path (kind: :drawn; newpage_drafts.kindcolumn, reversible migration). The chat's system prompt and the MCP instructions name it.:drawnsource, the Markdown with each drawing replaced by its labels, so search finds it. A:drawntext stays current like a manual edit (an AI run doesn't replace it) andTranscribeWorkerskips the page without calling the provider.When it doesn't fit on one page
It carries on down the same page, as a page the tablet scrolls does (the app's renderer already grows the canvas to the content, and the draft card already fades long pages with "View the whole page"). That keeps one draft, one commit, one transcription, and "a new page at the end" stays true. The cap is 4 pages' height (7488 px); longer is refused with a message asking to shorten it or split it over more than one
draw_pagecall. Markdown is capped at 60,000 characters (3× typed pages', for the SVG). Written down indocs/ink-reports.md.Checks
mix precommit: 1067 passed, 1 excluded (live LanguageTool); 46 new tests: Hershey parsing/metrics/folding, path commands and arcs, every SVG shape, transforms, styles, colors, fitting, refusals, report layout (grid, wrapping, markers, formats inside a word, drawings centered and labelled, the 4-page cap),ink_pageround trips, drafting/adding/agentdraw_page/transcription source, worker skip.FINELINER_2.781c7f5: the sample and a 2.3-page report on Lines small, medium, large and Checklist, popover at full size (1404), 1440×900 and 390×844, and the chat card, no JS errors (screenshots above). Measured on the full-size shots (inkgap.py): on every text row, pages 1 to 3 of all four templates, the ink stops 2 to 3 clear pixels above its rule (descenders aside)..contentfiles don't re-encode byte for byte, soPageMoverefuses to plan any add there, a typed control draft included (same error). The add path is covered bytyped_pages_test.exsagainst the stub cloud (page 3 lands, same bytes uploaded,:drawntranscription current).4500c30, Jeremy's drift report):test/rm_analyzer/typed_pages/ruled_reports_test.exsdrafts a 21-row report on Lines small, medium, large and Checklist and asserts rows 0, 10 and 20 land within 2 px of their rules; it failed on85e7ccf(rows 70 apart everywhere).mix precommit: 1080 passed, 1 excluded.bced797, Nye's F29): rows past the last rule used to keep the pitch over the page edge (18–37 px off page 2's rules on medium/large/Checklist). Now covered by the ruled-reports test (row 20 is on page 2 for large and Checklist) and threeInk.Reporttests (carry-on, drawing and title not straddling); all fail without the fix.mix precommit: 1083 passed, 1 excluded.c4862fa):ruled_reports_test.exsnow takes the rules fromTemplates.rules/1, the table the app draws the templates from, and a new test per template draws#and##titles, bullets at both levels, both checkboxes, a wrapped line and the line after a drawing, twice over onto later pages, and checks each row's letters end within 2 px of a rule (8 tests).page_previewcomponent of a 2.3-page report in Chromium at 1404, 1354, 607, 342 (2×) and 300 px wide, every template rule down every page is within 1 page px (or ¾ of a device pixel) of where the page's own coordinates put it, on all four templates: the repeated template isn't stretched and doesn't drift.Ink.Report@rule_lift5 (page px, rM2 1404 wide), puts each row's baseline 5 above its rule on every lined template. Half the 3 px pen line, half the 1 px rule and round letters' dip below the baseline take 3, leaving a 2–3 px visible gap; a 2 px baseline lift (c8b9806) still touched in the renders. Descenders still cross the rule.ruled_reports_test.exsnow expects every row kind's baseline 5 px (±1) above its rule on pages 1 to 3 of each template; it fails onc4862fa(8 of 8).mix precommit: 1087 passed, 1 excluded.docs/verification.md).Sample report Markdown