Documentation
¶
Overview ¶
Package media implements content-addressed storage, magic-byte format detection, per-modality size limits, and lightweight message-block descriptors for multimodal inputs (images, PDFs, and audio).
Index ¶
- Constants
- Variables
- func BlockFromDescriptor(desc api.Media) (message.Block, error)
- func CanonicalMIME(mime string) string
- func CheckSize(mod Modality, size int64) error
- func FormatViewSummary(path, mime string, size int64, pages string) string
- func MaxBytesForModality(mod Modality) int64
- func OmittedPlaceholder(mod Modality, desc api.Media) string
- func ParsePages(raw string) (string, error)
- func UnavailablePlaceholder(mod Modality, desc api.Media) string
- type Info
- type Modality
- type Store
Constants ¶
const ( MaxImageBytes int64 = 20 << 20 // 20 MiB MaxPDFBytes int64 = 32 << 20 // 32 MiB MaxAudioBytes int64 = 25 << 20 // 25 MiB MaxUploadBytes = MaxPDFBytes )
Per-modality payload size caps enforced at ingestion time.
const ( ExtraSHA256 = api.MediaExtraSHA256 ExtraByteSize = api.MediaExtraByteSize ExtraDisplayName = api.MediaExtraDisplayName ExtraPages = api.MediaExtraPages )
Extras keys persisted inside loom media block Extras maps so checkpoints and timelines never store raw binary or base64 payloads.
Variables ¶
Functions ¶
func BlockFromDescriptor ¶
BlockFromDescriptor constructs a lightweight loom media block carrying only descriptor metadata in Extras (never raw binary or base64 bytes).
func CanonicalMIME ¶
CanonicalMIME normalizes equivalent MIME spellings (such as audio/wave -> audio/wav).
func FormatViewSummary ¶
FormatViewSummary builds the compact metadata text returned for a viewed media file.
func MaxBytesForModality ¶
MaxBytesForModality returns the byte-size cap for mod.
func OmittedPlaceholder ¶
OmittedPlaceholder formats the fallback text placeholder used when historical media is unsupported by the current model.
func ParsePages ¶
ParsePages validates and normalizes an optional PDF page range specification such as "1-10", "3", or "1-3, 5, 8-10". An empty input returns "", nil.
Types ¶
type Modality ¶
type Modality string
Modality identifies a multimodal input kind matching loom profile modalities.
const ( ModalityImage Modality = Modality(profile.ModalityImage) ModalityPDF Modality = Modality(profile.ModalityPDF) ModalityAudio Modality = Modality(profile.ModalityAudio) )
func DescriptorFromBlock ¶
DescriptorFromBlock extracts a media descriptor and modality from a loom block. It returns ok=true for any ImageBlock, AudioBlock, or PDF DocumentBlock.
func ModalityForMIME ¶
ModalityForMIME maps a supported MIME type to its modality.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages immutable, content-addressed media blobs under <session-dir>/media/<sha256>.
func (*Store) LinkAllFrom ¶
LinkAllFrom hardlinks all content-addressed media blobs from srcDir into s.dir in O(1), falling back to copying if the source and destination reside on different filesystems. Missing srcDir is a no-op.