Skip to main content

Module reader

Module reader 

Source
Expand description

Reading run bundles from disk: manifest discovery, full bundle loads, and artifact resolution. Malformed bundles are skipped, matching the TypeScript store’s listRunBundles behavior.

Structs§

BundlePaths
LoadedBundle

Functions§

artifact_placeholder
Compact placeholder for an artifact reference, matching the TypeScript viewer: «artifact 12.3KB artifacts/sha256/…».
contained_path
Resolve a bundle file to its canonical path, requiring the target to stay inside the bundle after following symlinks. The lexical check above rejects .. and absolute components, but a plain-looking name can still be a symlink pointing outside the bundle.
list_bundles
List all readable bundles in a runs directory, newest first (by startedAt, then run id, matching the TypeScript store).
parse_ndjson
Parse NDJSON, skipping blank lines and a trailing partial line (a writer may be mid-append when we read).
read_artifact_checked
Read an artifact file, refusing paths that escape the bundle directory and files whose actual size exceeds max_bytes (the size declared by the reference is untrusted).
read_bundle
read_contained
Read a bundle document, refusing targets that resolve outside the bundle.
read_declared_artifact_checked
Read a remotely requested artifact only when both its declared path and canonical target stay under the artifact directory named by the manifest.
read_manifest
read_manifest_value
Read and validate the manifest, returning both the raw JSON document (views must carry the manifest verbatim, including fields this build does not know) and the typed projection.
resolve_artifacts
Resolve $artifact references in a value by inlining artifact file contents (up to max_bytes per artifact) from the bundle directory. References that escape the bundle directory or exceed the limit are replaced by placeholders.
with_artifact_placeholders
Replace $artifact references with compact placeholders for previews, mirroring the TypeScript viewer’s withArtifactPlaceholders.