from enum import IntEnum, auto from dataclasses import dataclass class TokenType(IntEnum): """Every token in the stream carries a type label. The runtime uses this to dispatch tokens to the correct decoder, cache, or scheduler queue — enabling a unified token pipeline for video, audio, motion, metadata, and subtitles. """ VISUAL = auto() AUDIO = auto() MOTION = auto() SCENE = auto() CAMERA = auto() OBJECT = auto() TEXTURE = auto() RESIDUAL = auto() METADATA = auto() SUBTITLE = auto() @dataclass class TypedTokenBatch: """A chunk of tokens with type and layer metadata.""" chunk_index: int token_type: TokenType layer_index: int tokens: list[int] frame_count: int = 0