poka.sh

Docs

preview.proto reference

<!-- GENERATED by scripts/gen-proto-reference.py from core/proto/preview.proto. Do not edit by hand: change the comment in the proto, then run the script. -->

Generated page. It is built from the comments in core/proto/preview.proto, the one schema that joins parsers, viewers and the hosts (package poka.preview). Change a comment in the proto and run python3 scripts/gen-proto-reference.py; never edit this page by hand. The canonical copy is in poka-interfaces; poka-parsers and poka-viewers vendor it byte for byte.

The schema has 63 messages and 6 enums.

How the messages fit together

  • A host sends a PreviewRequest on a module's stdin.
  • A monolithic module answers with a PreviewResponse.
  • A composed parser answers with one *Ast message instead. The host pipes it to the shared viewer named in the parser's manifest, takes the viewer's HTML and wraps it in an HtmlPreview. Parser and viewer never call each other.

Which viewer takes which AST

AST message Shared viewer
TableAst poka-table-viewer
WorkbookAst poka-workbook-viewer
SlideDeckAst poka-slide-viewer
TextAst poka-text-viewer, poka-code-viewer
TreeAst poka-tree-viewer
Drawing2DAst poka-vector-viewer
Scene3DAst poka-3d-viewer
HexAst poka-hex-viewer
MetadataCardAst poka-metadata-card-viewer
ImageWithMetaAst poka-image-with-meta-viewer
ImagePagesAst poka-image-with-meta-viewer
PdfPageAst poka-pdf-viewer
SvgAst poka-svg-viewer
DiffAst poka-diff-viewer
EbookAst poka-ebook-viewer
ChartAst poka-chart-viewer

poka-3d-viewer is never run by the host: both hosts decode Scene3DAst themselves and hand the meshes to the frontend Three.js viewer.

Messages

PreviewRequest

The request a host writes to a module's stdin, read to EOF and decoded. A monolithic module or a composed parser receives it. A shared viewer does not: it receives the parser's *Ast instead.

Field Type No. Description
file_path string 1 Host path of the file. A module cannot open it; it reads /input/<basename>
max_width int32 2 Target preview size in pixels; the desktop host sends 900 x 650, the web engine 1024 x 1024. A module may ignore it
max_height int32 3 Target preview height in pixels (see max_width)
quality string 4 "low", "medium", "high", "lossless"
params map<string, string> 5 Free-form options; both hosts send it empty today. poka-pdf reads "page", "scale" and "password" (see PdfPageAst).

FileFacts

Per-format facts for the file-information panel (#182): what a parser knows about the file it just read, as a short list of key/value pairs shown beside the preview. The keys are the parser's own ("Units", "Entities", "Sheets"); hint is an optional qualifier or unit ("mm", "1-based"). One entry shape serves both the format-specific facts a parser adds and the file's own facts the host gathers (name, size, extension, dates, the previewing handler, the parse time) — the host fills those itself and asks no parser.

Additive and open-ended: a parser adds only the entries its format genuinely knows, and omits the rest. No entry is ever invented; an empty FileFacts is correct for a parser that cannot fill it.

Field Type No. Description
entries repeated FactEntry 1 The facts, in display order
integrity repeated IntegrityCheck 2 What the parser found wrong with the file's own structure (#354): a length the file declares that the bytes present contradict. Additive; empty for the ~1400 parsers that check nothing, which is the same as "nothing found". The host lists these next to its own content check.

FactEntry

One fact. value is already stringified for reading.

Field Type No. Description
key string 1 Display label, e.g. "Units", "Entities", "Sheets"
value string 2 The fact, as text
hint string 3 Optional qualifier/unit, e.g. "mm"; empty = none

IntegrityCheck

One structural check a parser made against the file's own declarations (#354). Strictly about the FILE, never about the preview: the truncated flags on TableAst / TextAst / TreeAst mean "the preview was capped" and must not be reported here. A parser that reads only a prefix of a large file (a read cap) must not report what lies past the cap as missing. Only what the file itself states is compared: a header's record count, an entry's offset and size, a declared element count.

Field Type No. Description
kind IntegrityKind 1 Which check made the finding
severity IntegritySeverity 2 How the host presents it
detail string 3 One sentence for reading, with the numbers compared

ImagePreview

A decoded raster image that the frontend shows directly.

Field Type No. Description
data bytes 1 Raw image bytes (PNG/JPEG/WebP)
format string 2 "png", "jpeg", "webp"
width int32 3 Pixels
height int32 4 Pixels
metadata map<string, string> 5 Optional extra key/value pairs about the image

TextPreview

Plain or syntax-highlighted text.

Field Type No. Description
content string 1 The text
language string 2 For syntax highlighting hint

SvgPreview

Inline SVG markup, shown in an isolated frame.

Field Type No. Description
content string 1 Raw SVG markup

HtmlPreview

HTML shown in a sandboxed frame. When a parser is paired with a viewer, the host wraps the viewer's HTML output in this message.

Field Type No. Description
content string 1 Raw HTML (will be injected into a styled container)
facts FileFacts 2 Per-format facts for the file-information panel (#182); additive. A result that ends in HTML describes the file here: a monolithic parser fills it directly, and the host fills it from the parser's Ast when a paired viewer (poka-tree-viewer, poka-workbook-viewer, poka-vector-viewer) produced the HTML. Empty = the format states none.

PdfPreview

A PDF document.

Field Type No. Description
data bytes 1 Raw PDF bytes. poka-pages and poka-compressed return the PDF they hold this way; the host routes these bytes to poka-pdf as it would a dropped .pdf (poka-parsers#450): the host runs poka-pdf on them and draws the page.
facts FileFacts 2 Per-format facts for the file-information panel (#182); additive. A PDF parser puts the page count from the document's page tree here (the root /Pages node's /Count). Empty = the parser could not read it.

ModelPreview

A 3D model for the frontend viewer: either the file on disk or bytes the module generated.

Field Type No. Description
format string 1 For pass-through formats (the file on disk is already the mesh, e.g. poka-stl / poka-obj / poka-glb), leave data empty and the host will use the original file path so the frontend can load via Tauri's asset protocol. For generated meshes (e.g. poka-step tessellating BREP to STL), put the encoded bytes in data with the matching format; the host materializes them to a temp file and hands that path to the frontend. "stl", "obj", "glb"
mtl string 2 Optional MTL content (OBJ companion material)
data bytes 3 Optional generated-mesh bytes

DwgEntity

A parsed 2D/3D CAD vector entity. Despite the Dwg* naming (kept for historical reasons), this shape describes any structured CAD drawing — both .dwg (poka-dwg) and .dxf (poka-dxf) emit it, and the same Three.js viewer in the host renders both.

nums is a flat, kind-specific coordinate list:

Line:        [x1, y1, z1, x2, y2, z2]
Circle:      [cx, cy, cz, r]
Arc:         [cx, cy, cz, r, start_angle_rad, end_angle_rad]
LwPolyline:  [x1, y1, x2, y2, ...]           (planar, z = 0)
Polyline3D:  [x1, y1, z1, x2, y2, z2, ...]
Point:       [x, y, z]
Ellipse:     [cx, cy, cz, ax, ay, az, ratio, start_param, end_param]
Solid:       [x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4]
Ray / XLine: [bx, by, bz, dx, dy, dz]

Keeping it flat avoids a oneof-per-shape explosion and matches the JSON-ish shape the Three.js viewer wants to walk.

Field Type No. Description
kind string 1 "Line", "Circle", "Arc", "LwPolyline", "Polyline3D", "Text"
layer string 2 Layer name; empty when the format has none
color uint32 3 AutoCAD Color Index (0..=256)
closed bool 4 Polyline variants only
nums repeated double 5 Text: [x, y, z, height, rotation_degrees]
text string 6 Text/MText content (empty for geometry kinds)

DwgDrawing

A CAD drawing for the host's Three.js CAD viewer, as a list of DwgEntity.

Field Type No. Description
version string 1 "R2000", "R2013", ...
entities repeated DwgEntity 2 The drawing's entities
min_x double 3 Axis-aligned bounds over all entities — cached so the viewer can frame the camera without walking the list twice. Identical units to nums.
min_y double 4 Bounds: see min_x
max_x double 5 Bounds: see min_x
max_y double 6 Bounds: see min_x
facts FileFacts 7 Per-format facts for the file-information panel (#182); additive.

ProgressUpdate

A progress report (TYPE_PROGRESS). No host or module in the four repositories sets or reads it today.

Field Type No. Description
percent int32 1 Completion, in percent
status_message string 2 Short text describing the current step
partial_data optional bytes 3 Optional partial result

DataChunk

One piece of a result returned in several parts (TYPE_CHUNK). No host or module in the four repositories sets or reads it today.

Field Type No. Description
chunk_index int32 1 Position of this chunk
total_chunks int32 2 How many chunks make up the result
chunk_data bytes 3 This chunk's bytes
is_final bool 4 True on the last chunk

ErrorResponse

A module's failure. The host reports it as an ExtensionError result with the same code, message and recoverable flag.

Field Type No. Description
error_code int32 1 A code the module chooses
error_message string 2 Text shown to the user
is_recoverable bool 3 Passed on as the result's recoverable flag

PreviewResponse

What a monolithic module writes to its stdout: exactly one arm of response, with type saying which. A composed parser answers with an *Ast instead, except to ask for tabs, when it sends this message with type TYPE_MULTIVIEW.

Field Type No. Description
type ResponseType 1 Which arm of response is set
image ImagePreview (oneof response) 2 A decoded raster image
progress ProgressUpdate (oneof response) 3 A progress report (unused)
error ErrorResponse (oneof response) 4 A failure
chunk DataChunk (oneof response) 5 One piece of a larger result (unused)
text TextPreview (oneof response) 6 Plain or highlighted text
svg SvgPreview (oneof response) 7 Inline SVG
html HtmlPreview (oneof response) 8 HTML for the sandboxed frame
model ModelPreview (oneof response) 9 A 3D model file or generated mesh bytes
dwg DwgDrawing (oneof response) 10 A CAD drawing
scene3d Scene3DAst (oneof response) 11 interactive packed meshes (poka-3d-viewer path)
multiview MultiView (oneof response) 12 several named views over one file (tabs)
pdf PdfPreview (oneof response) 13 raw PDF bytes; the host routes them to poka-pdf

MultiView

A file that has several distinct representations (e.g. an InstalSystem .isproj → 3D model / 2D plan / project data) emits this; the frontend renders a tab bar and dispatches each view through its normal renderer.

Field Type No. Description
items repeated MultiViewItem 1 The tabs, in the parser's order

MultiViewItem

One tab of a MultiView: a title and one view.

Field Type No. Description
title string 1 tab label, e.g. "3D model"
scene3d Scene3DAst (oneof view) 2 Shown as it is
svg SvgPreview (oneof view) 3 Shown as it is
html HtmlPreview (oneof view) 4 Shown as it is
dwg DwgDrawing (oneof view) 5 Shown as it is
viewer_input bytes (oneof view) 6 An encoded *Ast for the viewer the parser's manifest names (a TreeAst for poka-tree-viewer, a Drawing2DAst for poka-vector-viewer). The host runs that viewer on these bytes and shows its HTML in this tab, so a paired parser can give one file several tabs: a 3D model beside its tree, or one drawing per page. Only a parser paired with a viewer other than poka-3d-viewer may send one, in a PreviewResponse whose type is TYPE_MULTIVIEW (SPEC.md §4 in poka-parsers); anywhere else the tab is dropped.

TableAst

Format-agnostic tabular data: shared by CSV, DBF, SQLite, Avro records, etc. Cells are pre-stringified at the parser; type hints (Numeric, Date, …) are optional per-column and inform viewer styling but never parsing.

Decoded by poka-table-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
total_rows uint64 3 True row count (may exceed rows.len())
columns repeated TableColumn 4 Column headers
rows repeated TableRow 5 Preview-limited subset of total_rows
truncated bool 6 True iff total_rows > rows.len()
source_format string 7 Free-form, e.g. "CSV (comma)", "dBase III"
facts FileFacts 8 Per-format facts and integrity checks for the file-information panel (#182, #354); additive. truncated above is the preview cap, not a defect: a damaged file says so in facts.integrity instead.

TableColumn

A column header with an optional type hint.

Field Type No. Description
name string 1 Column title
type_hint string 2 Optional, e.g. "Numeric", "Date", "TEXT"

TableRow

One row, already stringified.

Field Type No. Description
cells repeated string 1 One string per column

WorkbookAst

A spreadsheet document with more than one sheet: Apple Numbers, and any future format where one file holds several named grids. TableAst stays the single-grid shape that CSV, DBF, parquet and the rest emit; a workbook is its own message so those parsers and viewers are untouched.

preview_image carries the document's own rendered thumbnail when it has one (Numbers packages ship a preview.jpg of the first sheet). The viewer shows it beside the sheet tabs; it is not a substitute for the grids.

Decoded by poka-workbook-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form, e.g. "Apple Numbers (6 sheets)"
sheets repeated WorkbookSheet 4 The workbook's sheets
preview_image bytes 5 Optional rendered thumbnail
preview_image_format string 6 "jpeg" / "png", empty when no image
facts FileFacts 7 Per-format facts for the file-information panel (#182); additive.

WorkbookSheet

One named sheet, holding one or more tables.

Field Type No. Description
name string 1 Sheet tab label, e.g. "Budget"
tables repeated TableAst 2 A sheet can hold several tables
looks repeated TableLook 3 Optional: how each table looked where it was saved, parallel to tables (looks[i] dresses tables[i]). Missing or shorter means plain. It lives here rather than on TableAst so the hundred-odd parsers that build TableAst literals are untouched.

TableLook

A spreadsheet's own formatting: a palette of cell styles, the cells that wear one or carry a note (the formula behind a computed value), column widths and merged ranges. Rows and columns index the TableAst's rows and cells, from 0.

Field Type No. Description
styles repeated CellStyle 1 Palette; CellLook.style is 1-based, 0 = plain
cells repeated CellLook 2 Sparse: only cells with a style or a note
column_widths_pt repeated float 3 Parallel to columns; 0 = the viewer decides
merges repeated CellRange 4 Merged cell ranges

CellLook

The style and note of one cell.

Field Type No. Description
row uint32 1 Row, from 0
col uint32 2 Column, from 0
style uint32 3 Index into TableLook.styles + 1; 0 = plain
note string 4 Shown on hover, e.g. "=SUM(A1:A9)"

CellRange

A rectangle of cells.

Field Type No. Description
row uint32 1 Top-left cell
col uint32 2 Left column, from 0
rows uint32 3 Extent, at least 1
cols uint32 4 Width in columns, at least 1

CellStyle

How one cell is drawn: font, colours, alignment and borders.

Field Type No. Description
bold bool 1 Bold text
italic bool 2 Italic text
underline bool 3 Underlined text
strike bool 4 Struck-through text
color string 5 "#rrggbb"; empty = default text colour
background string 6 "#rrggbb"; empty = no fill
align string 7 "left" | "center" | "right"; empty = general
valign string 8 "top" | "middle" | "bottom"; empty = bottom
font_size_pt float 9 0 = default
font_family string 10 Empty = default
wrap bool 11 Wrap long text inside the cell
border_top CellBorder 12 Top edge
border_right CellBorder 13 Right edge
border_bottom CellBorder 14 Bottom edge
border_left CellBorder 15 Left edge

CellBorder

One edge of a cell.

Field Type No. Description
style string 1 "thin" | "medium" | "thick" | "dashed" | "dotted" | "double"; empty = none
color string 2 "#rrggbb"; empty = black

SlideDeckAst

A slide deck: Keynote today. Each slide carries the text on it, with the title kept apart so a viewer can lay a slide out as a slide rather than as a paragraph of everything at once.

Slides do not carry their own rendered image — an iWork package ships one thumbnail for the document, in preview_image, and nothing per slide. x/y/width/height on a text block are fractions of the slide, and are all zero when the parser could not resolve a shape's geometry; a viewer treats that as "lay it out yourself".

Decoded by poka-slide-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form, e.g. "Apple Keynote"
slides repeated DeckSlide 4 The slides, in deck order
preview_image bytes 5 Optional rendered thumbnail of the deck
preview_image_format string 6 "jpeg" / "png", empty when no image

DeckSlide

One slide.

Field Type No. Description
name string 1 e.g. "Slide 3"
title string 2 Title text, empty when the slide has none
body repeated SlideText 3 Everything else on the slide, in order
notes repeated string 4 Presenter notes, when the deck has them

SlideText

A block of text on a slide, with its position.

Field Type No. Description
text string 1 The text
x float 2 Fractions of the slide, 0 when unknown
y float 3 Fraction of the slide, 0 when unknown
width float 4 Fraction of the slide, 0 when unknown
height float 5 Fraction of the slide, 0 when unknown

TextAst

Long-form text: shared by BSP entity dumps, future code/log previews, CFG/INI files that don't fit a tree, anything where the content is one piece of formatted text rather than rows or a hierarchy.

Decoded by poka-text-viewer, poka-code-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
content string 3 The text (preview-limited; see truncated)
language string 4 Optional, e.g. "rust" / "json" / "" (plain)
total_lines uint64 5 True line count (may exceed content's lines)
truncated bool 6 True iff content was capped
source_format string 7 Free-form header line, e.g. "Quake 1 BSP · 47 entities"
facts FileFacts 8 Per-format facts for the file-information panel (#182); additive. A document parser puts pages, words, author and title here instead of in source_format. truncated above is the preview cap, not a defect.

TreeNode

Hierarchical data: directory trees (zip / 7z / tar / iso / cfb), XML hierarchies (vtk, gpx, kml, ipynb cells), Blender scene graphs, anything where nesting carries meaning.

TreeNode is recursive — proto3 allows this; prost generates Vec<TreeNode> for children. Cycles are not supported (it's a tree, not a graph).

Field Type No. Description
name string 1 Display label, e.g. "src/", "Worksheet.xml", "Cube.001"
kind string 2 Optional category, e.g. "directory", "stream", "Mesh"
info string 3 Optional right-aligned info, e.g. "3.4 MB", "12 vertices"
children repeated TreeNode 4 Empty for leaves

TreeAst

A hierarchy of TreeNode, with an optional thumbnail and summary card.

Decoded by poka-tree-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
root TreeNode 3 Children of root are the top-level entries
total_nodes uint64 4 Across the full tree before any truncation
truncated bool 5 True iff some subtrees were capped
source_format string 6 Free-form header line
thumbnail bytes 7 Optional page thumbnail, shown above the tree. Container formats often carry one — every ODF package has Thumbnails/thumbnail.png — and for a document or template "what does it look like" is the first question a preview answers. Raw image bytes; thumbnail_media_type says what they are. Empty means no thumbnail, which is not an error.
thumbnail_media_type string 8 e.g. "image/png"; empty = sniff
card repeated MetadataSection 9 Optional summary card, shown above the tree: the few facts a reader wants first, when the tree is the whole record (a vCard's name, organisation, e-mail, phone and address; poka-parsers#242). One section per card, titled (a file of several contacts has several). Empty means no card, which is not an error.
facts FileFacts 10 Per-format facts for the file-information panel (#182); additive.

Drawing2DAst

Pure 2D vector geometry: shared by map-shaped formats (gpx, kml, geojson) and any future extension whose primary preview is a flat drawing.

Not the same as DwgDrawing — that targets the host's Three.js CAD viewer (layers, ACI palette, 3D Polyline3D, real-unit pan/zoom). Drawing2DAst targets poka-vector-viewer, which renders inline SVG. Pick Drawing2DAst when the drawing is flat geometry; pick DwgDrawing when the drawing is CAD entities that benefit from the CAD viewer chrome.

Decoded by poka-vector-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form header line, e.g. "GPX · 1 track · 247 points"
entities repeated Vector2DEntity 4 The drawing primitives
min_x double 5 Optional precomputed axis-aligned bounds. If all four are zero, the viewer recomputes from entities. Same coordinate space as the entity coordinates (lon/lat for GPS, drawing units for CAD); the viewer fits to view.
min_y double 6 Bounds: see min_x
max_x double 7 Bounds: see min_x
max_y double 8 Bounds: see min_x
y_up bool 9 True for engineering coords (y grows upward); false for screen/raster (y grows downward, the SVG default). Map data is y-up.
paint_in_order bool 10 True when the entities are a picture painted back to front, as in a metafile or a diagram: the viewer then draws them in the order given, on white paper, since the file's own colours were chosen for it. False keeps the layered order (polygons, lines, circles, points, labels) that maps and tracks want.
units optional string 11 Physical units the coordinates are in, as a human string, when the source records them (DXF $INSUNITS, a Gerber MO command, an IFC unit assignment). The viewer shows measurements as "drawing units" when this is empty. Additive: parsers that don't set it are unchanged.
facts FileFacts 12 Per-format facts for the file-information panel (#182); additive.

Vector2DEntity

One drawing primitive. kind selects how the coordinate fields are read:

"point":    nums = [x, y]
"polyline": nums = [x1, y1, x2, y2, ...]
"circle":   nums = [cx, cy, r]
"polygon":  rings carry the outer boundary plus any holes; nums unused
"text":     nums = [x, y] anchor point; `text` carries the string
"image":    nums = [x0, y0, x1, y1] corners; `image_data` carries the raster

Style fields are optional; the viewer applies a default per kind if a field is empty/zero. stroke_width is in screen pixels, not source units.

Field Type No. Description
kind string 1 Selects how the other fields are read: point, polyline, circle, polygon, text or image
nums repeated double 2 Coordinates; the layout depends on kind (see above)
rings repeated PolygonRing 3 The boundary and holes of a polygon; read only for kind polygon
stroke string 4 CSS color (e.g. "#ffd166"); empty = default per kind
fill string 5 CSS color; empty = none (stroke-only)
stroke_width double 6 Screen pixels; 0 = default (1.2)
fill_opacity double 7 0..1; 0 = default for kind
text string 8 Only read for kind "text". A drawing whose labels carry the meaning — a circuit diagram, a floor plan, a Visio chart — is unreadable without them, so the label is an entity rather than a count in the caption. The label itself; empty = nothing drawn
text_height double 9 Cap height in SOURCE units (scales with the drawing); 0 = viewer's default size
text_anchor string 10 "start" | "middle" | "end"; empty = "start"
image_data bytes 11 Only read for kind "image": a raster placed in the drawing, with nums = [x0, y0, x1, y1], two opposite corners in source units. A metafile (WPG, CGM, WMF) mixes bitmaps with its vectors; dropping them loses half the picture.
image_format string 12 "png" | "jpeg"
layer optional string 13 The entity's layer/segment name when the source carries one (DXF group code 8, a CGM segment, a Visio layer). Additive: empty when the format has no layer concept or the parser does not fill it, and the viewer then treats every entity as unlayered.

PolygonRing

One closed boundary of a polygon: its outer edge, or a hole.

Field Type No. Description
pts repeated double 1 [x1, y1, x2, y2, ...] — closed implicitly

Scene3DAst

3D scene geometry: meshes of indexed triangles. Consumed by poka-3d-viewer which software-rasterises a single auto-framed view and returns it as PNG-in-HTML. Format-specific parsers (poka-stl, poka-obj, poka-ply, ...) emit this AST instead of carrying their own renderer.

Coordinate system: right-handed, Y-up. Vertices in source units; the viewer auto-fits the camera from min_*/max_* so absolute scale is irrelevant. Triangle winding is CCW (front-facing).

Materials, textures and named cameras are optional (fields 11-13, and Mesh3D 8-9): a parser that sets none of them gets the v1 behaviour — flat color_rgba, auto-framed camera. Still not carried: animations, lights, scene-graph transforms.

Decoded by poka-3d-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 e.g. "STL (binary) · 12 540 tris"
meshes repeated Mesh3D 4 The meshes
min_x double 5 Axis-aligned bounds across all meshes. Left at zero if the parser couldn't compute them — the viewer then falls back to scanning verts.
min_y double 6 Bounds: see min_x
min_z double 7 Bounds: see min_x
max_x double 8 Bounds: see min_x
max_y double 9 Bounds: see min_x
max_z double 10 Bounds: see min_x
materials repeated Material3D 11 Referenced 1-based by Mesh3D.material, so 0 can mean "none".
textures repeated Texture3D 12 Referenced 1-based by Material3D.base_color_texture.
cameras repeated Camera3D 13 Viewpoints saved in the source file, in its order. The viewer offers them alongside its own auto-framed view; empty = auto-frame only.
environment_texture uint32 14 Sky: an equirectangular image, 1-based into textures (0 = none), turned about the up axis. A camera may name its own.
environment_rotation_deg float 15 Rotation of the sky about the up axis, in degrees
lights repeated Light3D 16 Light sources placed in the scene. The viewer draws them as markers and may light with them; it keeps its own lighting either way.
units optional string 17 Physical units the vertices are in, as a human string, when the source records them (IFC unit assignment, STEP). Empty means unspecified. Additive: parsers that don't set it are unchanged.
facts FileFacts 18 Per-format facts for the file-information panel (#182); additive.

Light3D

A light source, in the scene's coordinates. No direction is carried: a spot or area light is placed, not aimed.

Field Type No. Description
name string 1 Display label
kind LightKind 2 Point, spot, area or directional
x double 3 Position
y double 4 Position
z double 5 Position
color_rgba uint32 6 sRGB 0xRRGGBBAA
intensity_cd float 7 luminous intensity, candela; 0 = not recorded
range float 8 falloff distance, scene units; 0 = unbounded

Material3D

A surface appearance, metallic-roughness PBR. Scalars are optional so "not recorded" (viewer default) is distinct from 0 (mirror-smooth, non-metal).

Field Type No. Description
name string 1 Display label
base_color_rgba uint32 2 sRGB 0xRRGGBBAA; 0 = neutral grey
base_color_texture uint32 3 1-based into Scene3DAst.textures; 0 = none
roughness optional float 4 0..1
metallic optional float 5 0..1
opacity optional float 6 0..1; 1 = opaque
uv_scale_u float 7 Texture repeats per UV unit. 0 = 1. The UVs a CAD tool writes are often in model units, with the tiling stored on the material instead.
uv_scale_v float 8 As uv_scale_u, for the vertical direction

Texture3D

An embedded image in a format a browser decodes natively.

Field Type No. Description
name string 1 Display label
media_type string 2 "image/png" or "image/jpeg"
data bytes 3 The encoded image

Camera3D

A named viewpoint, in the scene's coordinates (right-handed, Y-up).

Field Type No. Description
name string 1 Display label
eye_x double 2 Where the camera is
eye_y double 3 Where the camera is
eye_z double 4 Where the camera is
target_x double 5 The point it looks at
target_y double 6 The point it looks at
target_z double 7 The point it looks at
horizontal_fov_deg float 8 0 = viewer default
environment_texture uint32 9 This view's own sky (as Scene3DAst.environment_*); 0 = the scene's.
environment_rotation_deg float 10 Rotation of this view's sky, in degrees

Mesh3D

One mesh = packed positions + indices into them. Per-vertex normals are optional; the viewer computes flat per-triangle normals when missing. Positions are [x0, y0, z0, x1, y1, z1, ...] — flat for proto efficiency (avoids the per-vertex message overhead of a repeated Vec3 shape).

Field Type No. Description
positions repeated float 1 length = 3 * vertex_count
indices repeated uint32 2 length = 3 * triangle_count; empty = positions are unindexed soup
normals repeated float 3 length = 3 * vertex_count, or empty
name string 4 Display label (e.g. "Cube.001"); blank for nameless meshes
color_rgba uint32 5 Optional flat color, 0xRRGGBBAA; viewer uses a default neutral grey when 0.
colors repeated uint32 6 Optional per-vertex colors, 0xRRGGBBAA, one per vertex (length = vertex_count) or empty. A scanned point cloud carries its colour here; color_rgba cannot, being one value for the whole mesh. When both are set these win.
primitive PrimitiveKind 7 What the positions describe. A point cloud has no triangles, and a viewer must not read its positions as a triangle soup — which is what happened while the only signal was the mesh's name matching /point cloud/.
uvs repeated float 8 Texture coordinates, [u0, v0, u1, v1, ...]: length = 2 * vertex_count, or empty. OpenGL convention: v = 0 is the image's bottom row. Sources whose v = 0 is the top row (Unreal, DirectX) flip it: v' = 1 - v.
material uint32 9 1-based index into Scene3DAst.materials; 0 = draw with color_rgba.

HexAst

---------- Hex dump: universal fallback for unrecognised binaries ----------

poka-hex-viewer renders these as a classic 16-byte-per-row dump with an address gutter and ASCII sidebar. content is a leading slice of the file; the parser is responsible for capping it (memory_mb in the manifest is the upper bound).

Decoded by poka-hex-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 full file size; may exceed content.len
content bytes 3 up to N bytes from the file
base_offset uint64 4 address shown for content[0]; usually 0
source_format string 5 e.g. "octet-stream · first 4 KB"

MetadataSection

---------- Metadata card / spec sheet ----------

Ordered key/value pairs grouped into sections. For formats whose primary preview value is structured metadata, not row/tree/text data (SQLite headers, KTX properties, font tables, EXIF, ICC profiles).

MetadataSection / MetadataEntry are intentionally reused by ImageWithMetaAst below — a single rendering of the metadata side panel works for both viewers.

Field Type No. Description
title string 1 empty = ungrouped
entries repeated MetadataEntry 2 The section's key/value pairs

MetadataEntry

One key/value pair of a metadata section.

Field Type No. Description
key string 1 Label
value string 2 The value, as text
hint string 3 optional secondary text (units, type)

MetadataCardAst

A spec sheet of titled key/value sections, optionally with a description and an audio or video player.

Decoded by poka-metadata-card-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form header line
description string 4 optional intro line, e.g. "SQLite 3 · 12 tables"
sections repeated MetadataSection 5 The card's sections
media_kind string 6 When the file's content is directly browser-playable (audio/video), the parser sets this to "audio" or "video" and the viewer renders an <audio>/<video> element pointing at the original file via the host's Tauri asset URL substitution. Empty = info-card only. "" | "audio" | "video"
media_mime string 7 Optional MIME hint for the source element (e.g. "audio/flac", "audio/aiff"). Leave empty to let the browser sniff.
facts FileFacts 8 Per-format facts and integrity checks for the file-information panel (#182, #354); additive. A card whose file is damaged (a truncated MP4) says so in facts.integrity instead of in a section of the card.

ImageWithMetaAst

---------- Image + structured metadata side panel ----------

For formats where the visual preview matters AND the metadata is rich enough to warrant its own column: DICOM, NIfTI, RAW, PSD, FITS, and the PNG, JPEG, GIF and WebP previews. image_data is the image the module decoded: raw RGBA pixels (image_format "rgba"), which the viewer draws on a canvas so no browser codec is involved (poka-parsers#451), or, for the parsers not yet moved to that, a PNG, JPEG or WebP the module wrote.

Decoded by poka-image-with-meta-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form header line
image_data bytes 4 The decoded image. For "rgba": width × height × 4 bytes, rows top to bottom, 8-bit sRGB samples with straight (not premultiplied) alpha.
image_format string 5 "rgba" | "png" | "jpeg" | "webp"
width uint32 6 Pixels of image_data (after any downscale)
height uint32 7 Pixels of image_data (after any downscale)
sections repeated MetadataSection 8 Metadata shown beside the image

Reserved field numbers: 15, 16, 17.

ImagePagesAst

Several pages of one image file (a multi-page TIFF; poka-parsers#242), each an ImageWithMetaAst, shown by poka-image-with-meta-viewer as tabs, or the frames of an animation, which it plays. The field numbers are 15 to 17, which ImageWithMetaAst reserves, so a viewer can take either message: bytes of a plain ImageWithMetaAst decode here as no pages, and bytes of this message never set an ImageWithMetaAst field. Page 1 carries the file's own sections (structure, page count); later pages carry only their own.

Decoded by poka-image-with-meta-viewer.

Field Type No. Description
pages repeated ImageWithMetaAst 15 The pages, in order
frame_delays_ms repeated uint32 16 Set when the pages are the frames of one animation (GIF, APNG, animated WebP; poka-parsers#451) rather than the pages of a document: one delay per page, in milliseconds as the file declares it, and the viewer plays the frames in order instead of showing tabs. Empty for pages.
plays uint32 17 How many times the animation plays: 0 is for ever. Read only with frame_delays_ms.

PdfPageAst

---------- PDF page ----------

One page of a PDF, rendered in wasm by poka-pdf (poka-parsers#450), or the module's request for the document's open password. Only the page asked for is rendered: the viewer posts {type:'poka:pdf:render', page, scale} or {type:'poka:pdf:password', password, page} to the host, which runs the parser again with PreviewRequest.params "page" (1-based), "scale" (pixels per PDF point) and "password". The host keeps a password in memory for the open file only; the module never writes it out, logs it or echoes it back.

It reuses two existing shapes: the pixels and the document's metadata are an ImageWithMetaAst, and each text run is a SlideText whose box is in fractions of the page.

Decoded by poka-pdf-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form header line, e.g. "PDF 1.7"
page_count uint32 4 Pages in the document; 0 when unknown (a password is needed)
page_number uint32 5 1-based number of the page rendered; 0 when none was
page_width float 6 The page as shown (crop box, after /Rotate), in points
page_height float 7 See page_width
scale float 8 Pixels per point in page
page ImageWithMetaAst 9 The rendered page: image_format "rgba" (straight RGBA, 8 bits a channel, rows top to bottom, width × height × 4 bytes), width and height in pixels, and the document's metadata in sections. Unset when no page was rendered.
text repeated SlideText 10 The page's text, one run per line segment of glyphs in drawing order, with x, y (top left), width and height as fractions of the page. Empty when the page has no text the module could map to Unicode.
password PdfPasswordRequest 11 Set when the module needs the open password
facts FileFacts 12 Per-format facts for the file-information panel (#182)
note string 13 What was limited, e.g. the scale lowered to the pixel budget; empty = nothing

PdfPasswordRequest

The module's request for a PDF's open password (a password-protected file, poka-parsers#450). The viewer shows a prompt and answers with {type:'poka:pdf:password'}.

Field Type No. Description
incorrect bool 1 True when a password was given and did not open the file

SvgAst

---------- SVG document (poka-parsers#452) ----------

One SVG drawn by the wasm module three ways, which the viewer switches between. Each way reuses an existing message as it is:

vector: the flattened picture as a Drawing2DAst of filled "polygon"
        entities (curves flattened, strokes outlined, even-odd fills and
        clip paths resolved to non-zero polygons), plus "image" entities
        for embedded rasters; y down, paint_in_order, bounds = the
        picture's width and height.
image:  pixels rendered in wasm at the size the request asked for
        (max_width × max_height, keeping the picture's aspect), as PNG.
source: the file's text, decoded to UTF-8.

A way the module could not produce is left unset and notes says why; notes also lists what a way leaves out (text with no bundled font, gradients drawn flat in vector mode).

Decoded by poka-svg-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 Free-form header line, e.g. "SVG · 120 × 80"
vector Drawing2DAst 4 Vector mode
image ImageWithMetaAst 5 Image mode
source TextAst 6 Source mode
notes repeated string 7 What was not drawn, and why; shown with every mode
sections repeated MetadataSection 8 The card: size, viewBox, title, description, counts
facts FileFacts 9 Per-format facts for the file-information panel

DiffLine

---------- Unified diff ----------

One AST covers single-file and multi-file diffs (patches across many files). Hunks carry their original @@ -A,B +C,D @@ coordinates plus the contextual section header git emits.

Field Type No. Description
kind string 1 Single character marker: " " context, "+" added, "-" removed, "\" no-newline.
content string 2 The line's text

DiffHunk

One hunk of a diff, with its original @@ coordinates.

Field Type No. Description
from_start int32 1 First line in the old file
from_count int32 2 Lines the hunk covers in the old file
to_start int32 3 First line in the new file
to_count int32 4 Lines the hunk covers in the new file
header string 5 e.g. "fn process_event(...)" — section header git infers
lines repeated DiffLine 6 The hunk's lines

DiffFile

The changes to one file.

Field Type No. Description
from_path string 1 Path in the old version
to_path string 2 Path in the new version
hunks repeated DiffHunk 3 The file's hunks

DiffAst

A unified diff or patch: one or more files, each with hunks.

Decoded by poka-diff-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 e.g. "unified diff · 3 files · +47 −12"
files repeated DiffFile 4 The files changed

EbookChapter

---------- E-book preview ----------

Shape shared by mobi / epub / azw3 / fb2 / similar long-form-text container formats. Carries a cover image (parsers do the bytes → PNG/JPEG hop), structured bibliographic metadata, and one or more chapter excerpts as plain text (parsers strip the underlying XHTML).

Reuses MetadataSection / MetadataEntry from the metadata-card viewer so any structured extra fields (ISBN, publisher, language, dates, rights, subjects, etc.) render with the same grid layout the user already recognises.

Field Type No. Description
title string 1 e.g. "Chapter 1: An Unexpected Party"
content string 2 plain text — parser strips HTML

EbookAst

An e-book: cover, bibliographic data and chapter excerpts.

Decoded by poka-ebook-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 e.g. "MOBI · Amazon Kindle"
cover_data bytes 4 Cover image — empty if the parser couldn't extract one.
cover_format string 5 "png" | "jpeg" | "gif" | "webp"
title string 6 Bibliographic fields. Renderer puts these in a left/right column next to the cover. Empty strings just collapse.
author string 7 Author, empty when unknown
description string 8 Blurb or summary, empty when none
sections repeated MetadataSection 9 Additional bibliographic data (ISBN, publisher, language, date, rights, subjects). Free-form per-format.
chapters repeated EbookChapter 10 First N chapters in reading order. Parser caps content size (~15 KB per chapter is typical) so the wire payload stays bounded.
more_chapters bool 11 True iff there were more chapters in the source than chapters.len().

ChartAst

---------- Charts ----------

Numeric series over time, for simulation results (.eso) and weather (.epw, .wea). poka-chart-viewer draws each chart as inline SVG, so the preview needs no script. A chart file usually has more to it than its series, so the card and the table it would otherwise show ride along: sections is drawn above the charts as a metadata card and table below them, each only when set.

A separate message rather than series inside TableAst: TableAst is built as a struct literal by a hundred-odd parsers, and a new field there would touch every one of them.

The parser owns the point budget. A long series (8,760 hourly values or more) is cut into a fixed number of buckets, and each point is then a bucket: y is its mean and y_min/y_max its extremes, which the viewer draws as a band. source_points says how many values went in.

Decoded by poka-chart-viewer.

Field Type No. Description
filename string 1 Name of the previewed file
file_size uint64 2 Size of the previewed file, in bytes
source_format string 3 e.g. "EnergyPlus ESO · 36 variables"
charts repeated Chart 4 The charts, in order
sections repeated MetadataSection 5 Optional card above the charts
table TableAst 6 Optional table below the charts

Chart

One chart: a titled set of line series, or a heat map.

Field Type No. Description
title string 1 e.g. "Dry-bulb temperature"
kind ChartKind 2 Which of series or heatmap is drawn
x_label string 3 e.g. "Day of year"
x_unit string 4 e.g. "d"; empty = none
y_label string 5 e.g. "Temperature"; a heat map's rows
y_unit string 6 e.g. "°C"; a heat map's values
series repeated ChartSeries 7 CHART_LINE
heatmap ChartHeatmap 8 CHART_HEATMAP
x_ticks repeated AxisTick 9 Labelled marks along the x axis (months, environment starts). Empty = the viewer picks round numbers. major marks draw a stronger line.
note string 10 Optional line under the chart

ChartSeries

One line (or band) of a line chart.

Field Type No. Description
name string 1 Legend label, e.g. "Direct normal"
x repeated double 2 X values
y repeated double 3 Parallel to x: the value, or the bucket mean
y_min repeated double 4 Parallel to x when the series was downsampled, else empty. A bucket's extremes; the viewer shades between them.
y_max repeated double 5 Upper extreme of each bucket; see y_min
source_points uint64 6 Values before downsampling; 0 = len(x)
color string 7 "#rrggbb"; empty = the viewer's palette

ChartHeatmap

A rows × cols grid of values, e.g. hour of day × day of year. Row 0 is drawn at the top; the chart's x axis runs along the columns (its x_ticks values are column indices) and its y axis down the rows. NaN is a cell with no value. y_unit on the chart is the unit of the values.

Field Type No. Description
rows uint32 1 Number of rows
cols uint32 2 Number of columns
values repeated double 3 Row-major, rows * cols
row_ticks repeated AxisTick 4 Values are row indices

AxisTick

A labelled mark on an axis.

Field Type No. Description
value double 1 Where the mark sits
label string 2 Its label
major bool 3 Draw a stronger line

Enums

IntegrityKind

Value No. Meaning
INTEGRITY_UNSPECIFIED 0
INTEGRITY_TRUNCATED 1 The file ends before data its header declares
INTEGRITY_DECLARED_SIZE_MISMATCH 2 A declared total size disagrees with the real size
INTEGRITY_ENTRY_PAST_EOF 3 A container entry's offset + size runs past the end
INTEGRITY_TRAILING_DATA 4 Bytes after the format's logical end; always INFO

IntegritySeverity

INFO is the zero value on purpose: a check that forgets its severity informs, it never warns. Trailing data is INFO, never WARNING (many formats legitimately append after their logical end, e.g. the data descriptor that ends a streamed ZIP entry).

Value No. Meaning
SEVERITY_INFO 0
SEVERITY_WARNING 1

ResponseType

Value No. Meaning
TYPE_UNSPECIFIED 0
TYPE_IMAGE 1
TYPE_METADATA 2
TYPE_PROGRESS 3
TYPE_ERROR 4
TYPE_CHUNK 5
TYPE_TEXT 6
TYPE_SVG 7
TYPE_HTML 8
TYPE_MODEL 9
TYPE_DWG 10
TYPE_SCENE3D 11
TYPE_PDF 12
TYPE_MULTIVIEW 13

LightKind

Value No. Meaning
LIGHT_POINT 0
LIGHT_SPOT 1
LIGHT_AREA 2
LIGHT_DIRECTIONAL 3

PrimitiveKind

Value No. Meaning
PRIMITIVE_TRIANGLES 0 The default: indexed or soup triangles
PRIMITIVE_POINTS 1 Positions are points; indices are empty
PRIMITIVE_LINES 2 Line segments: indices hold vertex pairs

ChartKind

Value No. Meaning
CHART_LINE 0 One line (or band) per series
CHART_HEATMAP 1 A grid of cells: heatmap is read, not series