6.2 KiB
Asset Management
Domain: asset runtime surface Function: normative
This chapter defines the runtime-facing asset model of PROMETEU.
1 Scope
PROMETEU asset management is bank-centric.
Assets are:
- cold bytes stored in the cartridge;
- described by cartridge metadata;
- materialized into host-managed banks;
- separate from VM heap ownership.
This chapter describes the runtime contract currently visible in the codebase. It is not a full tooling pipeline specification.
2 Core Principles
- asset residency is explicit;
- asset memory belongs to the machine, not to the VM heap;
- banks and slots are hardware/runtime concepts;
- loading and activation are explicit operations;
- asset memory does not participate in GC.
3 Cartridge Asset Artifact
The runtime currently consumes one primary cartridge asset artifact:
assets.pa: autocontained asset artifact.
assets.pa carries, inside the same binary:
- fixed binary prelude;
- JSON header;
- payload bytes.
The JSON header carries:
asset_table: metadata entries describing asset content;preload: optional initial residency requests consumed during cartridge initialization.
This chapter describes the runtime-facing asset contract. It does not define the Studio packer workflow or the shipper pipeline that publishes the cartridge.
3.1 assets.pa v1 envelope
assets.pa v1 is structured as:
[fixed binary prelude]
[json header]
[binary payload region]
The fixed binary prelude contains, at minimum:
magicschema_versionheader_lenpayload_offset
It may additionally include:
flagsreservedheader_checksum
3.2 Header and payload contract
The runtime loads:
asset_tablefrom the JSON header and keeps it live during cartridge execution;preloadfrom the JSON header and consumes it only during boot.
Payload bytes are addressed from the payload region using offsets relative to payload_offset, not relative to the start of the whole file.
4 Asset Table
Current runtime-facing asset metadata includes:
AssetEntry {
asset_id
asset_name
bank_type
offset
size
decoded_size
codec
metadata
}
This table describes content identity and storage layout, not live residency.
offset is relative to the start of the payload region inside assets.pa.
5 Banks and Slots
The current runtime exposes bank types:
TILESSOUNDS
Assets are loaded into explicit slots identified by bank context plus index.
Conceptual slot reference:
SlotRef { bank_type, index }
This prevents ambiguity between graphics and audio residency.
6 Load Lifecycle
The runtime asset manager exposes a staged lifecycle:
PENDINGLOADINGREADYCOMMITTEDCANCELEDERROR
High-level flow:
- request load of an asset into a slot;
- resolve the asset entry from live
asset_table; - open the payload slice in
assets.pa; - perform read/decode/materialization work;
- mark the load
READY; - explicitly
commit; - activate the resident asset in the slot.
The canonical payload paths are:
ROM -> open_slice -> CODEX/decode -> BankROM -> open_slice -> temporary in-memory blob -> CODEX/decode -> Bank
open_slice is the runtime-facing concept for opening a limited view over a payload slice. The runtime must not require the whole assets.pa payload to remain resident in RAM as its baseline operating mode.
OP_MODE selects between direct slice consumption and temporary materialization in memory.
For v1:
OP_MODEis derived fromcodec/CODEX;- explicit per-asset hinting is not part of the baseline contract.
The runtime does not treat asset installation as implicit side effect.
7 Residency and Ownership
Asset banks are host/runtime-owned memory.
Therefore:
- VM heap does not own asset residency;
- GC does not scan asset bank memory;
- shutting down a cartridge can release bank residency independently of VM heap behavior.
- the runtime must not keep the full
assets.papayload resident in RAM as a baseline requirement.
8 Bank Telemetry
The runtime surfaces bank and slot statistics such as:
- total bytes;
- used bytes;
- free bytes;
- inflight bytes;
- slot occupancy;
- resident asset identity per slot.
These metrics support debugging, telemetry, and certification-oriented inspection.
9 Preload
preload is stored in the JSON header of assets.pa.
These preload entries are consumed during cartridge initialization so the asset manager can establish initial residency before normal execution flow.
Lifecycle rule:
preloadis boot-time input only;- it does not need to remain live after initialization completes.
10 Relationship to Other Specs
13-cartridge.mddefines the cartridge package and the requirement thatassets.pacarries its own asset header.16-host-abi-and-syscalls.mddefines the syscall boundary used to manipulate assets.03-memory-stack-heap-and-allocation.mddefines the distinction between VM heap memory and host-owned memory.
11 Syscall Surface and Status Policy
asset follows status-first policy.
Fault boundary:
Trap: structural ABI misuse (type/arity/capability/shape mismatch);status: operational failure;Panic: internal invariant break only.
11.1 MVP syscall shape
asset.load(name, kind, slot) -> (status:int, handle:int)asset.status(handle) -> status:intasset.commit(handle) -> status:intasset.cancel(handle) -> status:int
Rules:
handleis valid only whenloadstatus isOK;- failed
loadreturnshandle = 0; commitandcancelmust not be silent no-op for unknown/invalid handle state.- slot validation, kind mismatch, and residency/lifecycle rejection remain in
assetstatus space and are not delegated tobank.
11.2 Minimum status tables
asset.load request statuses:
0=OK3=ASSET_NOT_FOUND4=SLOT_KIND_MISMATCH5=SLOT_INDEX_INVALID6=BACKEND_ERROR
asset.status lifecycle statuses:
0=PENDING1=LOADING2=READY3=COMMITTED4=CANCELED5=ERROR6=UNKNOWN_HANDLE
asset.commit and asset.cancel operation statuses:
0=OK1=UNKNOWN_HANDLE2=INVALID_STATE