chain-rdeveloper portal
build

Documents & PDF export

An agent or a skill can hand the user a document: a structured report shown in the reply as a card and downloadable as a PDF.

The document

DocumentSpec (svc-ai app/documents/spec.py) is the one definition:

FieldNotes
subtitle, summaryoptional text
key_findings, sources, open_questionslists of short lines
bodyMarkdown, ≤ 60,000 chars; citations by source id ([S3]), renumbered [1]… with sources built from them (answer_sources.renumber_document), or [n] into a sources list the model wrote when it cites no ids; images as ![alt](https://…) (see Images)
confidencelow / medium / high

The fence carries one more field the model never writes: images, the stored copies of the images the body shows (StoredDocument, see Images). It is not in the tool's schema, and a fence without images is byte for byte what it was before images existed.

Every field is bounded and stripped of control characters, null counts as absent, and unknown keys are ignored, so a skill's own outputs validate as they are. It is the same shape as the built-in report skills' REPORT_FIELDS (svc-core system_resources/skillsets.py).

How one is made

  • render_document — a built-in svc-ai tool, bound to every agent like the other render tools. It validates a document and returns it as a ``` `document ``` fence. An invalid document gets the problem back as text, never an exception.

  • The graph's artifact guard (svc-ai agents/graph.py) owns what reaches the user. Synthesis and the evaluator are shown a one-line note in place of each document and told not to copy it. After evaluation, every ``` `document ``` fence the model wrote is removed, and the fences the tool produced are attached. A document in a reply is therefore exactly what the tool validated, and a fence the model made up without the tool never reaches anyone.

  • A reply carries one set of documents (_reply_documents). Each document is recorded with the pass that rendered it and its source (GraphState.documents). The reply gets the documents of the latest pass that rendered any, one per title, with a skill's document step ahead of a model's own render_document call.

    • Why: a revision re-runs the skill graph and renders the document again, and within one pass the agent, the skill's document step and synthesis can each render it. Research brief in a chat once came back with five PDF cards.

    • A pass that rendered nothing (a revision that only fixed the text) keeps the previous pass's documents.

    • Synthesis and the evaluator are shown notes for the attached documents only.

    • Pinned by svc-ai tests/documents/test_reply_documents.py, which runs the real graph through two failed quality checks.

  • A skill's tool node can call render_document deterministically. Its fence reaches the reply the same way (_operation_artifacts). The built-in Research brief and Summarise a document skills end in one, binding each field to the writer node's structured output. A field the node did not produce stays an unbound {node.field} placeholder, and the tool treats that as absent.

How it becomes a PDF

svc-core renders only what it has stored. It never renders content a client posts:

RouteRenders
GET /app/skills/{id}/runs/{run_id}/document.pdf?index=na completed run's n-th document fence, or, with none, its outputs laid out (report fields as the report, any other output as a ## Heading section), or its answer; only the run's owner
GET /app/dashboards/{id}/widgets/{widget_id}/document.pdf?index=nan automation tile's latest answer: its n-th document fence, or, with the tile's PDF on and none in the answer, the answer laid out under the tile's title; anyone who may open the board (a built-in board's included)

Every route calls svc-ai POST /documents/pdf (classified in NON_LLM_ENDPOINTS: no model, nothing metered), which validates the document again (StoredDocument), loads the stored copies of its images from MinIO, and renders it with app/documents/pdf.py. The footer on every page names the record: the skill, version and run; the agent, conversation and message; or the board, the tile, what answered and when (the answer's own generated_at, not the cache time a refresh moves when it claims the tile). svc-core fits text from outputs to the limits (truncating a long body with a note), since outputs were never written to fit them.

A dashboard tile's document (21 October 2026)

An automation tile whose agent called render_document showed the card and no download: "The PDF is available once the reply is saved", which a tile never is. Its images were alt text, and a document longer than the tile's 20,000-character cap was cut through and silently vanished. Now:

  • The tile's pdf setting (AutomationWidget, off by default; migration 101 switched it on for the tiles whose latest answer already held a document). On, an agent is asked to finish with one render_document call titled after the tile, and every refresh can be downloaded — the agent's document, else the answer laid out (documents.widget_document, as a skill run's answer is). A model target has no tools, so its PDF is always its answer. Off, the tile never holds a document, whatever the agent did.

  • What a tile stores (widgets._shape_output): its prose capped, and at most one document fence after it, whole, and only from an agent with the PDF on. A fence a model wrote itself is dropped: svc-ai's model engine has no artifact guard, so it was never one render_document validated.

  • The images are served by GET /app/dashboards/{id}/widgets/{widget_id}/images/{asset}, only one the tile's own document names (image_response).

The response frame of a streamed agent turn now carries message_id, so a document in a fresh reply downloads without reloading the conversation.

The renderer

reportlab, with no HTML engine and no network access. markdown-it parses the body with raw HTML disabled (app/documents/markdown.py, the one parser the renderer and the tool share), and the renderer writes all the reportlab markup itself, after escaping every piece of document text. That matters because reportlab's own paragraph markup can load images from file paths, so model text must never become markup. An image is drawn only from the stored bytes the route hands the renderer, as a figure with a caption ("alt text — Image: host", the host linked); any other image reads "Image not available: alt text" — or "Image not available" with no alt text, where it read "[image]", which looked like a placeholder left in (pdf.unavailable_image, and fe-core's card says the same, unavailableImage). Only http(s) links become link annotations; javascript:, file: and relative links stay plain text. Supported: headings (each kept on the page with what follows it), paragraphs, nested lists, block quotes, code blocks, tables (header row repeated across pages, images fitted to their column), rules, bold / italic / strike / inline code, images, and visuals (see Visuals).

Fonts: DejaVu Sans when installed (the svc-ai image installs fonts-dejavu-core and fonts-dejavu-extra), which covers Latin, Greek and Cyrillic scripts and common symbols. Without it, Helvetica covers Western European text. CJK scripts are not covered by either and render as boxes.

Visuals (29 October 2026)

A chart, plot, network graph, map or diagram in a document is the fence its render tool returns, put in the body where it belongs. Until 29 October 2026 the PDF printed such a fence as its JSON or Mermaid source, in monospace: the renderer turned every fenced block into code. fe-core's card already drew them (RichMarkdown), so the page and its PDF disagreed.

Drawn as vector graphics (app/documents/visuals/, reportlab's Drawing, no new dependency). Each kind is one registered class (registry.Visual: read, title, credit, layout), the kinds a VisualKind Literal pinned to the render tools. pdf._Builder._blocks sends a fence whose first info word is exactly a kind to visuals.render.prepare, which reads and lays it out before the visual joins the story and returns a figure — its title, the drawing, any credit — or a note: "Chart not shown — it has no data." No fence is printed as its source. An unexpected failure is a note and a warning naming the kind and the exception type, never the content.

  • Charts read as fe-core's ChartContent reads them (x_key default name, series fallbacks, multibar as grouped, any other type as bars) and drawn as recharts draws them: a dashed grid, bars rounded at their far end (negative values below zero), lines without dots, areas at 15%, pies with "name (N%)" labels; crowded category labels turned and thinned; a legend below.

  • Plots: scatter, line (points in the order given) and histogram, with exact ports of fe-core's _histBins and _linearRegression and JS toFixed's rounding (text.js_to_fixed); axes from zero, as recharts'.

  • Network graphs: fe-core's layout ported operation for operation — the seeded generator, the 300-step force simulation, the id-hash colours — so a graph has the same shape in the chat and the PDF (pinned to the TypeScript's own output under node). Up to 200 force-laid nodes, three such graphs a document.

  • Maps (29 October 2026): the fence's GeoJSON over Natural Earth's public-domain country and lake outlines, packed in the image (visuals/maps/data/natural_earth.bin, about 445 KB, built by dev/build_natural_earth.py; source, licence and digest in NATURAL_EARTH.md), since a PDF fetches no tiles. The view is fe-core's: the fence's center and zoom (13 by default), else fitted to the features with 24 px of padding (a continuous zoom: print has no tiles to snap to). A lone point is shown at zoom 6, in its country: Leaflet zooms to the street, where tiles show what is around it, and a PDF has none. Outlines at 1:110m for a view 30° across or wider, at 1:50m down to 2°, and none below that, where they would mislead: the map is then drawn on the plain grey fe-core shows without tiles. Shapes and points styled as fe-core's _mapStyle and pointToLayer style them, holes filled even-odd, everything cut to the frame before it is drawn (maps/clip.py), named points labelled where a label overlaps nothing, named lines and areas in a legend, a scale bar for views under 30° of latitude, and "Outlines: Natural Earth" under any map that draws them. At most 2,000 features and 50,000 points.

  • Diagrams (29 October 2026, AB5 and AB6): Mermaid read and laid out in Python, with no browser (visuals/mermaid/). Each type is one registered Diagram; mermaid/vocabulary.py holds the seven types offered (MermaidType, one canonical first word each) and every first word read (MermaidKeyword, Mermaid's other names too), both checked against the registry at import. Drawn: flowcharts (flowchart, graph: every bracket shape and v11's @{ shape: … }, every link operator with o / x / < ends, extra dashes for length and both kinds of link text, chains and &, subgraphs with direction, classDef / class / style / linkStyle), state diagrams ([*] per scope, composites, concurrent regions, choice / fork / join, descriptions, notes), class diagrams (three compartments, generics, static members underlined, the eight relations with cardinalities and labels, namespaces, notes) and ER diagrams (attribute tables, crow's feet, identifying and not, aliases, Mermaid's word cardinalities), sequence diagrams (participants and actors, box groups, create / destroy, every arrow, activations, notes, loop / alt / opt / par / critical / break / rect, autonumber, the participants repeated at the foot), pie charts (drawn by the chart drawer, in the chart palette; showData puts each value after its label) and Gantt charts (dateFormat in dayjs's tokens with ISO 8601 beside it, axisFormat in d3's directives, durations, after / until resolved — tasks waiting on each other, or naming no task, are refused with their line — excludes pushing a duration past excluded days as Mermaid's fixTaskDates does, sections, done / active / crit / milestone, dates above and below, no "today" line). Any other type is a note ("'gitGraph' is not a diagram type the PDF draws"), and a diagram that cannot be read says where ("line 4: 'end' cannot be a node id").

    • render_mermaid offers exactly these seven types (the user's choice) and reads every diagram with the same code before returning its fence (visual.check): another type is refused with the types offered, unreadable source with the line at fault, so the model can fix it. The field description, the tool's description and the rendering hint's table name the types from the vocabulary. svc-core's scenario validator (artifacts.Mermaid.TYPES) is pinned to MermaidKeyword.

    • Laid out as dagre lays out Mermaid's (mermaid/layered.py): cycles broken depth first in declaration order, every edge twice as long so a label has a row of its own, ranks by longest path then shortened, dummies on long edges, barycentre sweeps keeping the fewest crossings, Brandes–Köpf for x (ported step for step), and d3's curveBasis through each edge's bends. Nothing iterates in hash order: a diagram draws the same in every process.

    • Clusters (mermaid/compound.py) are laid out inside first and placed as one large node, so a subgraph's box never overlaps anything outside it. An edge across a box enters through a port on its border, placed in the cluster's own layout beside the edge's inner end, so it reaches that end through the cluster's rows. Ranks need no sizes, so each level is ranked, its clusters laid out with their ports, then the level arranged. A subgraph keeps its own direction only when no edge crosses its border, as Mermaid's does.

    • Drawn in Mermaid's default theme (mermaid/look.py), which fe-core's light mode uses: lavender nodes, yellow subgraphs, grey labels on the edges, each shape and marker its own registered class (shapes.py, markers.py) and edges cut at a shape's own outline. Labels wrap at 170 pt (a rhombus's at 110 pt), at most eight lines.

    • Fitted to the page: drawn at its natural size and scaled down, never up. A left-to-right diagram that would be drawn below 60% is laid out top to bottom when that draws it larger (a long pipeline is otherwise unreadable across a page); one below 30% is a note ("too large to draw legibly"). At most 150 nodes and 300 edges.

    • Split across pages (AB6): a layout says where it may be cut (Layout.breaks: between a flowchart's rows — where no node, cluster, label or loop reaches across — and between a sequence diagram's or a Gantt chart's rows) and what to repeat at the top of each later page (Layout.header: a sequence diagram's participants, a Gantt chart's dates). Such a diagram is scaled to the width alone; one taller than a page is cut at the lowest break that fits (VisualFlowable.split), and a part that starts at the top of a frame draws the header first. Each part draws only the shapes that reach into its window, so a page holds its own text, not every other page's clipped out of sight. A diagram that fits on one page is moved there whole, never split. The heading and title kept with it are counted with its first rows only (pdf._KeepTogether): reportlab's own group started a new page for any group taller than the space left.

  • Colours are fe-core's palette (pinned to RichMarkdown.tsx). A fence's colours are model text, read by our own parser (visuals/colors.py), never handed to reportlab's toColor.

  • Fitted (VisualFlowable): laid out again in a narrower list item or quote, at most half a page tall, kept on one page with its title and the heading above it. At most 40 visuals a document.

Every PDF route reaches the same renderer, so a skill run or a dashboard tile laid out from its answer draws its visuals too.

Made with checked visuals. render_document re-makes each visual fence in the body with that visual's own tool (answer_artifacts.remake_body_fences, read from markdown-it's tokens so a fence in a list item or a quote stays in place; a copied visual note becomes its fence first). One the tool refuses is removed, and the tool's reply says which and why ("Visuals: 1 of 2 kept. Not kept — fix each and call render_document again: - chart (line 7): …"). The body's description and the rendering hint tell the model to call the render tool and put its fence in the body (spec.VISUALS_IN_BODY), and not to repeat a document's visuals in the reply; the artifact guard does not restore into the reply a visual the reply's document carries (answer_artifacts.visual_fences_in).

Images

A document can show images: the body links them as ![alt](https://…). They are fetched once, when the document is made, never when it is downloaded or viewed, so the PDF stays a rendering of the stored record, the renderer stays free of I/O, and the model learns which images failed while it can still do something about it.

When the document is made

render_document (now async) embeds each distinct image the body links, after validating and renumbering it (app/documents/images.py, DocumentImageEmbedder):

  1. A stock-photo library's file is refused before any fetch (image_sources.STOCK_PHOTO_HOSTS, is_stock_photo, with subdomains; ImageProblem.stock_photo, 28 October 2026, the user's decision). Its preview is licensed for sale and watermarked: an illusions PDF had embedded iStock's. The model is told to use an open-licence image, Wikimedia Commons first, as DocumentSpec.body and the rendering hint also say.

  2. The link is rewritten where its host renders files to a raster (image_sources.py, a registry of one class per host family). Today: Wikimedia. Any link to a Commons or Wikipedia file — its page (/wiki/File:…, a media-viewer #/media/File:…), Special:FilePath, an original upload or a thumbnail on upload.wikimedia.org — is fetched from Special:FilePath/<name>?width=1280, which Wikimedia answers with a raster from its own cache: an SVG drawn as a PNG, a large photo scaled down. The link the model wrote stays the image's key and its credit.

  3. It is fetched with svc-ai's hardened UrlFetcher: https only, every redirect hop re-resolved to a public address, a byte cap. Under the run's web policy: render_document, like url_fetch, declares inherits_web_policy, so registry.run_tool_config gives it the agent's web_search allowlist and blocklist wherever it is built — the agent's own tools, synthesis, planner-added tools and a skill's tool node (which also now applies to a skill's url_fetch step).

  4. It is checked by its bytes: PNG, JPEG, GIF or WebP (formats.ACCEPTED_FORMATS, the vocabulary prompts render). An SVG, a web page and any other format are refused, each with its own reason. Pillow opens it with that format's decoder only, and a picture over 40 million pixels is refused before it is decoded.

  5. It is re-encoded: EXIF orientation applied, the first frame of an animation, transparency flattened onto white (line art would vanish on a dark card), the long edge capped at 1,600 px, and every byte of metadata (camera, GPS) dropped. A JPEG stays a JPEG; anything else becomes a PNG, or a JPEG when the PNG would be over 2 MiB. What is stored is never the file a site served.

  6. It is stored once in the knowledge bucket at document-images/<sha256 of those bytes>, the image's asset id (app/util/document_images.py, byte-identical in svc-core and svc-ai and held so by tools/test_shared_modules.py).

The fence records each image that made it: {src, asset, media_type, width, height}, where src is the link as markdown-it normalised it. An image that did not is left out and drawn as its alt text. The tool's reply to the model ends with what happened — Images: 8 of 10 embedded., then each failure with its reason (not an https link, outside the web policy, the site did not return it (HTTP 404), a web page rather than an image file, an SVG, …) and how to fix it: link each image file itself, or use web_search with search type images. The artifact guard takes only the fence, so the report reaches the model and never the user. A re-render with the same title supersedes the earlier one (_reply_documents).

A Wikimedia file that is not there is looked up (ImageSource.find_missing, 20 October 2026). On the first live run, CHAINR Bot guessed file names partly from memory, and 6 of 10 were wrong: Café_Wall_illusion.svg for Café_Wall_Illusion.svg (names are case-sensitive), Spinning_dancer.gif for Spinning_Dancer.gif, and Penrose_stairs.svg, which does not exist. It then spent its rounds searching and guessing paths, and never rendered again. Now a 404 from a host that can say what was meant asks it, through the same fetcher and web policy:

  • Wikimedia asks Commons' file search for the name's stem, pictures only (filetype:bitmap|drawing: the words alone also find PDFs, scans and videos). The first certain match is fetched instead (_closest):

    1. the one result with the same name — compared case-folded, accents dropped, and runs of space, _ and - treated as one (image_sources.same_name_key). So the first two above embed;

    2. else the first with the same name in another format (Rubin_vase.svg → Rubin vase.png, same_stem_key);

    3. else the first whose name holds every word of the name, when it has at least two (name_words: camelCase split, so Hermann_grid.svg → HermannGrid.svg). One word ("Penrose") is too many pictures' name.

  • The document then links the file it shows. The outcome carries the file's page (found_as), the tool relinks the body to it (EmbedReport.apply, markdown.relink_images, code left alone) and keys the stored copy by that link, so the caption's credit opens the real file, with its author and licence. The report tells the model each one (Hermann_grid.svg → …/File:HermannGrid.svg).

  • Anything less certain is offered back, never swapped in: the report adds close matches: https://commons.wikimedia.org/wiki/File:Penrosetreppe.svg, … (up to three), and the model picks one in its next call. When no picture has every word, a second search for any of them supplies the suggestions ("Moving snakes illusion" has no picture; "Rotating snakes illusion.svg" is offered). A match that cannot be fetched is offered too.

  • A lookup that fails or is outside the policy leaves a plain 404.

Why it swaps in now (20 October 2026): the second live run linked Hermann_grid.svg, Rubin_vase.svg and Moving_snakes_illusion.svg, none of which exists. The report offered close matches three passes running, and gpt-oss took none; the quality check then had it ask the person for image links (see human-in-the-loop.md#when-an-agent-may-ask-and-what-20-october-2026). The report's last line now also says to name, in the answer, any image that still could not be found.

Images go in one call, and a Wikimedia file needs no search. The prompt asks the model to put every image in one render_document call, to link a Wikimedia file by name (https://commons.wikimedia.org/wiki/File:<name>) — the lookup above finds the file of that name or the closest matches — and to search only for images it cannot name, one images search serving several. An earlier wording ("find every image's link first") made CHAINR Bot run a text search per illusion; five searches in, it had none left and asked the person which illusions to include. The report's last line asks for one more call to fix what failed.

Within a run each link is fetched once: a revision, synthesis or a skill's document step rendering the same document reads the run's cache (images.CONFIG_KEY, beside the source registry in run_config). Failures that might pass on a second try (unreachable, out of time, not stored) are not remembered. At most 20 images a document (MAX_DOCUMENT_IMAGES, a constant so a stored document validates the same everywhere), 4 fetched at once, 10 s each and 30 s for all of them. Nothing raises: every image ends with an outcome. Logs carry counts and problem names, never a link or alt text.

When it is shown

  • The PDF. svc-ai's route loads each named copy from MinIO and draws it only when its bytes hash to its id and are a PNG or JPEG (images.load_for_pdf); anything missing or unreadable is the alt text.

  • The document card. "Read full text" draws the same copies, served by svc-core, never the original link, so an image's site never learns who is reading — the pattern citation icons follow (/favicons):

    RouteServes
    GET /app/skills/{id}/runs/{run_id}/images/{asset}an image a document in a completed run's answer names; only the run's owner

    Each serves only an asset a document in that record names, re-checks the bytes against the id, and sends them as untrusted content (app/util/untrusted_image.py: CSP: default-src 'none'; sandbox, nosniff, private, max-age=86400); the URL has no extension, so Cloudflare does not cache it. 404 for an image the record does not name or that is not stored, 503 when storage cannot be read.

  • Only an answer's documents. Both conversation routes (the PDF too) now serve only assistant messages: only those went through the artifact guard. A fence a person typed into their own message is text.

Settings (svc-ai): DOCUMENT_IMAGES_ENABLED (off: every image stays its alt text), DOCUMENT_IMAGE_MAX_BYTES (8 MiB fetched), DOCUMENT_IMAGE_MAX_STORED_BYTES (2 MiB), DOCUMENT_IMAGE_MAX_PIXELS (40,000,000), DOCUMENT_IMAGE_MAX_EDGE_PX (1600), DOCUMENT_IMAGE_FETCH_TIMEOUT_S (10), DOCUMENT_IMAGE_BUDGET_S (30), DOCUMENT_IMAGE_CONCURRENCY (4), DOCUMENT_IMAGE_WIKIMEDIA_WIDTH (1280, one of Wikimedia's standard thumbnail widths).

Images in an answer

An answer's own images (outside a document) are loaded from where they live, as they always were — but made to render:

  • Links are tidied as the answer ships (source_ledger.tidy_answer, at each exit: the quality check's draft and the batch and stream results). A target a model wrapped in brackets, ![x]([https://…]), is unwrapped (markdown.unwrap_link_targets; render_document does the same to a body), and an image whose host renders its files to a picture is linked to that rendering (markdown.tidy_answer_links): a Wikimedia file page is HTML, and an <img> of it draws nothing. Code is left alone.

  • Citation markers are never rewritten inside a target, in svc-ai (answer_sources, source_ledger) or fe-core (processCitations): ![x]([S2]) had become ![x]([2](#cite-2)).

  • fe-core (DocumentImages.tsx, AnswerImage): a link that is not an http(s) URL, or an image that will not load, shows its alt text, never a broken picture; images load lazily and fit their column.

  • An image only from what the run saw (28 October 2026, agents/answer_artifacts.drop_unseen_images, before the quality check reads the draft): an image outside code whose address no tool result, retrieved evidence, earlier turn or the person's words held is removed (graph._seen_by_the_run). Both chart answers of the first capabilities run showed ![](https://i.imgur.com/…), made up. An image or link to no web address goes too (drop_dead_links): run 5's illusions answer linked sandbox:/mnt/data/Five_Famous_Optical_Illusions.pdf.

Known limits

  • Lifecycle. Stored copies are content-addressed and kept: shared by hash, never deleted with the conversation or run that named them. Reads are gated by a record the caller owns naming the id. A job deleting copies no record names is the follow-up.

  • Data export holds the fence (links and asset ids), not the bytes.

  • Chat answers outside a document still load images from their own site (repaired as above, not stored).

  • Direct model chat has no artifact guard (engines/model.py): a fence a model writes there is stored as written. It can only name copies whose hash is already known, and each is verified on serve.

  • Evaluations that script web tools still fetch a document's images.

  • Not handled: internationalised host names in an image link (the two Markdown parsers encode them differently) and localised Wikimedia namespaces (Datei:); both fall back to the alt text.

Pinned by svc-ai tests/documents/test_images.py (normalising, embedding, the run cache, the web policy, the tool, the route, the Wikimedia lookup), test_image_sources.py (adapters, the same-name rule, link repairs), test_pdf_images.py (the stored shape, figures in paragraphs, lists, tables, links and bold, any aspect ratio, headings kept with their figure), tests/agents/test_answer_sources.py (markers in targets, tidy_answer) and tests/util/test_document_images.py; svc-core tests/test_documents.py and tests/test_document_images.py; fe-core components/document/DocumentImages.test.tsx, processCitations.test.ts and the contract test.

fe-core

  • objects/Document.ts — the type, and extractDocuments, which lifts every document fence out of content before the Markdown pre-processors (citations, maths) run, leaving a numbered placeholder. The placeholder number is the index the download routes use.

  • components/document — DocumentCard (title, confidence as EVIDENCE_CONFIDENCE, summary, first findings, source and image counts, full text on request, Download PDF) and DocumentDownloadProvider. Whoever renders the content provides the download and where the record's document images are served (imageUrl): a saved answer (ChatPanel), a completed skill run's Result section, an automation tile (AutomationWidgetBody, which with the tile's PDF on and no document in the answer shows a Download PDF of the answer instead). With no provider (a reply still streaming), the card says the PDF is available once the reply is saved, and every image is its alt text.

  • DownloadPdfButton — a record's PDF download with its busy and failed states: the skill run page's, and a PDF tile's whose answer holds no document.

  • DocumentImages.tsx — inside a document's full text, RichMarkdown's img draws DocumentFigure: the stored copy matched by link (findDocumentImage, on the decoded NFC form, since svc-ai's and react-markdown's parsers both percent-encode), captioned "Image: host"; its alt text, with no request, when the image was not embedded, the record is not saved, or the copy will not load. Outside a document an image is drawn as written.

  • The skill run page's Download PDF action is on every completed run that has outputs or an answer.

This is separate from util/pdfExport, which prints a chat message exactly as the browser drew it.