media

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package media contains graph-native retained-media and attachment-resolution elements. Large payloads cross only explicit retention or resolution edges; trajectories and ordinary context channels carry bounded opaque handles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Descriptors

func Descriptors() []element.Descriptor

func FactoryRegistrations

func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)

func FetchRequestType

func FetchRequestType() element.Type

func FetchResultType

func FetchResultType() element.Type

func RegisterDescriptors

func RegisterDescriptors(catalog *resolve.Catalog) error

func RegisterFactories

func RegisterFactories(registry *graphruntime.Registry) error

func ReleaseRequestType

func ReleaseRequestType() element.Type

func ReleaseResultType

func ReleaseResultType() element.Type

func ResolveAttachmentDescriptor

func ResolveAttachmentDescriptor() element.Descriptor

ResolveAttachmentDescriptor is an explicit, bounded adapter from an opaque handle to untrusted attachment bytes. It does not parse, narrate, or promote content authority; those are separate graph choices downstream.

func ResolveRequestType

func ResolveRequestType() element.Type

func ResolvedAttachmentType

func ResolvedAttachmentType() element.Type

func ResolverOutcomeType

func ResolverOutcomeType() element.Type

func RetainRequestType

func RetainRequestType() element.Type

func RetainResultType

func RetainResultType() element.Type

func RetainedMediaDescriptor

func RetainedMediaDescriptor() element.Descriptor

RetainedMediaDescriptor owns one bounded retention scope. Retain, fetch, release, and addressed cancellation are separate graph observations. Fetch is intentionally not folded into an ambient service so every raw-byte path remains visible in Graph IR and live traces.

func RetentionMetricsType

func RetentionMetricsType() element.Type

func RetentionOutcomeType

func RetentionOutcomeType() element.Type

func ReturnLeaseRequestType

func ReturnLeaseRequestType() element.Type

func ReturnLeaseResultType

func ReturnLeaseResultType() element.Type

func StoreCancelType

func StoreCancelType() element.Type

Types

type AttachmentHandle

type AttachmentHandle struct {
	Handle         string         `json:"handle"`
	Capability     string         `json:"capability"`
	AttachmentID   string         `json:"attachment_id"`
	Kind           AttachmentKind `json:"kind"`
	Name           string         `json:"name,omitempty"`
	MIMEType       string         `json:"mime_type"`
	SHA256         string         `json:"sha256"`
	Bytes          int            `json:"bytes"`
	Source         string         `json:"source"`
	Scope          string         `json:"scope"`
	SourceRevision uint64         `json:"source_revision"`
	CapturedNS     uint64         `json:"captured_ns,omitempty"`
	Width          int            `json:"width,omitempty"`
	Height         int            `json:"height,omitempty"`
}

AttachmentHandle is immutable, bounded metadata plus the opaque capability needed to resolve or release one retained item. Payload-free runtime tracing never records Capability. Callers must still treat it as a secret.

func (AttachmentHandle) MediaRef

func (handle AttachmentHandle) MediaRef() trajectory.MediaRef

MediaRef is the deliberately capability-free trajectory representation. Resolution capability remains on a separately routed AttachmentHandle.

type AttachmentKind

type AttachmentKind string

AttachmentKind is carried in addition to MIME type so policy can distinguish an image shown by a participant from a file or an opaque future attachment.

const (
	AttachmentImage AttachmentKind = "image"
	AttachmentFile  AttachmentKind = "file"
	AttachmentOther AttachmentKind = "attachment"
)

type BlobLease

type BlobLease struct {
	LeaseID string           `json:"lease_id"`
	Handle  AttachmentHandle `json:"handle"`
	// contains filtered or unexported fields
}

BlobLease is an opaque, read-only view of one retained blob. The backing bytes are unexported and copied exactly once when retention crosses its trust boundary. Open returns a reader that copies only into caller-owned read buffers and observes revocation between reads. The consumer must route a ReturnLeaseRequest after it finishes; eviction and handle release stop new fetches but cannot invalidate an already delivered lease silently.

func (BlobLease) Open

func (lease BlobLease) Open() (io.ReadCloser, error)

Open returns a fresh read-only cursor. It never exposes the backing slice.

func (BlobLease) Size

func (lease BlobLease) Size() (int, error)

Size reports the immutable backing length without exposing its bytes.

type FetchRequest

type FetchRequest struct {
	Handle                 AttachmentHandle `json:"handle"`
	ExpectedSHA256         string           `json:"expected_sha256,omitempty"`
	ExpectedSourceRevision uint64           `json:"expected_source_revision,omitempty"`
}

type FetchResult

type FetchResult struct {
	Kind    ResultKind       `json:"kind"`
	Handle  AttachmentHandle `json:"handle,omitempty"`
	Lease   BlobLease        `json:"lease,omitempty"`
	Code    string           `json:"code,omitempty"`
	Message string           `json:"message,omitempty"`
}

type ReleaseRequest

type ReleaseRequest struct {
	Handle     string `json:"handle"`
	Capability string `json:"capability"`
	Scope      string `json:"scope"`
	Reason     string `json:"reason,omitempty"`
}

type ReleaseResult

type ReleaseResult struct {
	Kind    ResultKind `json:"kind"`
	Handle  string     `json:"handle,omitempty"`
	Code    string     `json:"code,omitempty"`
	Message string     `json:"message,omitempty"`
}

type ResolveAttachmentConfig

type ResolveAttachmentConfig struct {
	MaxPending       int      `json:"max_pending,omitempty"`
	MaxBytes         int      `json:"max_bytes,omitempty"`
	MaxMetadataBytes int      `json:"max_metadata_bytes,omitempty"`
	AllowedMIMETypes []string `json:"allowed_mime_types,omitempty"`
	TerminalMemory   int      `json:"terminal_memory,omitempty"`
}

type ResolveRequest

type ResolveRequest struct {
	Handle                 AttachmentHandle `json:"handle"`
	AcceptMIMETypes        []string         `json:"accept_mime_types,omitempty"`
	MaxBytes               int              `json:"max_bytes,omitempty"`
	ExpectedSourceRevision uint64           `json:"expected_source_revision,omitempty"`
}

type ResolvedAttachment

type ResolvedAttachment struct {
	Kind    ResultKind       `json:"kind"`
	Handle  AttachmentHandle `json:"handle,omitempty"`
	Lease   BlobLease        `json:"lease,omitempty"`
	Code    string           `json:"code,omitempty"`
	Message string           `json:"message,omitempty"`
}

ResolvedAttachment stays a media.UntrustedContent reply. A parser or vision element must explicitly turn it into an observer-authority observation; it cannot type-connect to user/system text or executable actions.

type ResolverOutcome

type ResolverOutcome struct {
	Kind       ResultKind `json:"kind"`
	RequestID  string     `json:"request_id,omitempty"`
	Handle     string     `json:"handle,omitempty"`
	Bytes      int        `json:"bytes,omitempty"`
	Code       string     `json:"code,omitempty"`
	Message    string     `json:"message,omitempty"`
	FinishedNS uint64     `json:"finished_ns,omitempty"`
}

type ResultKind

type ResultKind string
const (
	ResultSucceeded ResultKind = "succeeded"
	ResultCanceled  ResultKind = "canceled"
	ResultRefused   ResultKind = "refused"
	ResultFailed    ResultKind = "failed"
	ResultExpired   ResultKind = "expired"
	ResultIgnored   ResultKind = "ignored"
)

type RetainRequest

type RetainRequest struct {
	AttachmentID   string         `json:"attachment_id"`
	Kind           AttachmentKind `json:"kind"`
	Name           string         `json:"name,omitempty"`
	MIMEType       string         `json:"mime_type"`
	Content        []byte         `json:"-"`
	SHA256         string         `json:"sha256,omitempty"`
	Source         string         `json:"source"`
	Scope          string         `json:"scope"`
	SourceRevision uint64         `json:"source_revision"`
	CapturedNS     uint64         `json:"captured_ns,omitempty"`
	Width          int            `json:"width,omitempty"`
	Height         int            `json:"height,omitempty"`
}

RetainRequest is the only payload that introduces raw attachment bytes into the retained-media state. SourceRevision binds the bytes to the observation revision that caused retention; Scope prevents a handle from crossing a deployment-selected retention boundary.

type RetainResult

type RetainResult struct {
	Kind    ResultKind       `json:"kind"`
	Handle  AttachmentHandle `json:"handle,omitempty"`
	Code    string           `json:"code,omitempty"`
	Message string           `json:"message,omitempty"`
}

type RetainedMediaConfig

type RetainedMediaConfig struct {
	Scope            string `json:"scope,omitempty"`
	MaxItems         int    `json:"max_items,omitempty"`
	MaxBytes         int    `json:"max_bytes,omitempty"`
	MaxItemBytes     int    `json:"max_item_bytes,omitempty"`
	MaxMetadataBytes int    `json:"max_metadata_bytes,omitempty"`
	MaxActiveLeases  int    `json:"max_active_leases,omitempty"`
	WindowMS         int64  `json:"window_ms,omitempty"`
	TerminalMemory   int    `json:"terminal_memory,omitempty"`
	CancelMemory     int    `json:"cancel_memory,omitempty"`
}

type RetentionMetrics

type RetentionMetrics struct {
	Retained        uint64 `json:"retained"`
	Resolved        uint64 `json:"resolved"`
	Released        uint64 `json:"released"`
	Evicted         uint64 `json:"evicted"`
	Misses          uint64 `json:"misses"`
	Leases          uint64 `json:"leases"`
	Returned        uint64 `json:"returned_leases"`
	Revoked         uint64 `json:"revoked_leases"`
	ActiveLeases    int    `json:"active_leases"`
	LeasedBytes     int    `json:"leased_bytes"`
	MaxActiveLeases int    `json:"max_active_leases"`
	LiveItems       int    `json:"live_items"`
	LiveBytes       int    `json:"live_bytes"`
	MaxItems        int    `json:"max_items"`
	MaxBytes        int    `json:"max_bytes"`
	WindowMS        int64  `json:"window_ms"`
}

type RetentionOutcome

type RetentionOutcome struct {
	Kind       ResultKind `json:"kind"`
	Operation  string     `json:"operation"`
	RequestID  string     `json:"request_id,omitempty"`
	Handle     string     `json:"handle,omitempty"`
	Crossed    bool       `json:"crossed_boundary,omitempty"`
	Code       string     `json:"code,omitempty"`
	Message    string     `json:"message,omitempty"`
	FinishedNS uint64     `json:"finished_ns,omitempty"`
}

type ReturnLeaseRequest

type ReturnLeaseRequest struct {
	Lease  BlobLease `json:"lease"`
	Reason string    `json:"reason,omitempty"`
}

ReturnLeaseRequest explicitly ends one delivered read lease.

type ReturnLeaseResult

type ReturnLeaseResult struct {
	Kind    ResultKind `json:"kind"`
	LeaseID string     `json:"lease_id,omitempty"`
	Handle  string     `json:"handle,omitempty"`
	Code    string     `json:"code,omitempty"`
	Message string     `json:"message,omitempty"`
}

type StoreCancel

type StoreCancel struct {
	RequestID string `json:"request_id,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL