blob
import "github.com/barevoidco/zelk/core/blob"Package blob defines references to content stored outside the session log, such as large tool outputs, images and oversized provider payloads.
A Ref names content by its SHA-256 digest, so a reference can never silently point at different bytes. Stores write and sync a blob before any event that refers to it. The package sits below both history and event so that history items and event payloads can refer to blobs without importing each other.
Digest
Section titled “Digest”func Digest(data []byte) stringDigest returns the digest of data in the form Ref uses.
FromName
Section titled “FromName”func FromName(name string) (digest string, ok bool)FromName returns the digest of the blob a name refers to. A model reads a saved output with Read by the name “blob:” and its digest; ok is false for any other string, which names a file, and for a name with a malformed digest, which no blob can have. A name is a reference, not a path: a host that checks paths must tell the two apart before it checks one.
ValidateDigest
Section titled “ValidateDigest”func ValidateDigest(d string) errorValidateDigest reports whether d is a digest in the form Ref uses.
type Ref struct { // Digest is "sha256:" followed by 64 lowercase hex digits. Digest string `json:"digest"` Size int64 `json:"size"` MediaType string `json:"media_type"`}Ref refers to content stored outside the log.
NewRef
Section titled “NewRef”func NewRef(data []byte, mediaType string) RefNewRef returns the reference for data with the given media type.
Ref.Validate
Section titled “Ref.Validate”func (r Ref) Validate() errorValidate reports whether the reference is well formed.