# @ferret/assets: API (continued)

### LibraryItemType

*type* · `packages/assets/src/library.ts:8`

```ts
type LibraryItemType = 'texture' | 'material' | 'character' | 'clips' | 'model' | 'fmdl' | 'sound' | 'module' | 'flipbook' | 'volume'
```

### LibraryTier

*type* · `packages/assets/src/library.ts:10`

```ts
type LibraryTier = 'desktop' | 'mobile' | 'low'
```

### MapSlot

*type* · `packages/assets/src/library.ts:67`

```ts
type MapSlot = 'baseColor' | 'normal' | 'orm' | 'emissive' | 'opacity'
```

### MaskChannel

*type* · `packages/assets/src/library.ts:180`

```ts
type MaskChannel = 'r' | 'g' | 'b' | 'a' | 'rgb'
```

Which channel of a mask picture a colour layer reads: one channel, or `rgb` (each colour channel mixed by its own channel of the picture).

### ModelBundler

*type* · `packages/assets/src/model-pack.ts:32`

```ts
type ModelBundler = (entry: string, files: Map<string, Uint8Array>) => Promise<{ code: string }>
```

`bundle(entry, files)`: one ES module of a file of the folder (what `ferret build` bundles a game with)

### ModelFunctionKind

*type* · `packages/assets/src/model.ts:104`

```ts
type ModelFunctionKind = typeof MODEL_FUNCTION_KINDS[number]
```

### ModelLoader

*type* · `packages/assets/src/model-resolve.ts:26`

```ts
type ModelLoader = ((id: string, range: string) => Promise<ModelSource | null> | ModelSource | null) & { /** the files of a package that is not a model (a texture package the `ferret://` maps of a model name), found like a model; a loader without it leaves such maps to the player's own reader */ files?: (id: string, range: string) => Promise<PackageFiles | null> | PackageFiles | null; }
```

Finds the package of a model by its id and a version range (the highest version that fits), or `null` when there is none.

### ModelResponse

*type* · `packages/assets/src/model.ts:49`

```ts
type ModelResponse = false | { class: string; [parameter: string]: string | number | boolean }
```

how a material answers a moving medium (`@ferret/physics-response`): one of its classes with the class's parameters, or `false` for no response

### ModelTier

*type* · `packages/assets/src/model.ts:18`

```ts
type ModelTier = 'desktop' | 'mobile' | 'low'
```

### ModelValueType

*type* · `packages/assets/src/model.ts:107`

```ts
type ModelValueType = typeof MODEL_VALUE_TYPES[number]
```

### NodeEdit

*type* · `packages/assets/src/model.ts:42`

```ts
type NodeEdit = | { op: 'replace'; node: string; from: string | Record<string, string>; levels?: number[] } | { op: 'add'; node: string; parent: string; from: string | Record<string, string>; levels?: number[] } | { op: 'hide'; node: string; levels?: number[] } | { op: 'material'; node: string; material: string; levels?: number[] }
```

### PackageInput

*type* · `packages/assets/src/package.ts:522`

```ts
type PackageInput = Blob | Uint8Array | ArrayBuffer | string | ByteSource | PackageSource
```

### PackageKind

*type* · `packages/assets/src/package.ts:13`

```ts
type PackageKind = 'game' | 'levels' | 'assets' | 'library' | 'project' | 'model'
```

### ProgramOutput

*type* · `packages/assets/src/material-program.ts:48`

```ts
type ProgramOutput = typeof PROGRAM_OUTPUTS[number]
```

### ProgramSpace

*type* · `packages/assets/src/material-program.ts:42`

```ts
type ProgramSpace = typeof PROGRAM_SPACES[number]
```

### Quat

*type* · `packages/assets/src/model.ts:33`

```ts
type Quat = [number, number, number, number]
```

### SoundBus

*type* · `packages/assets/src/library.ts:381`

```ts
type SoundBus = 'music' | 'sfx' | 'ambient' | 'voice'
```

### StoreStatus

*type* · `packages/assets/src/store.ts:52`

```ts
type StoreStatus = 'missing' | 'queued' | 'loading' | 'cached' | 'failed'
```

### StreamFailure

*type* · `packages/assets/src/stream-error.ts:4`

```ts
type StreamFailure = 'network' | 'http' | 'timeout' | 'integrity' | 'origin' | 'aborted' | 'size' | 'build'
```

### StreamPriority

*type* · `packages/assets/src/store.ts:11`

```ts
type StreamPriority = 'high' | 'normal' | 'low' | 'idle'
```

### TextureChannel

*type* · `packages/assets/src/library.ts:36`

```ts
type TextureChannel = 'basecolor' | 'normal' | 'orm' | 'emissive' | 'height' | 'data'
```

`data`: any other linear map (a mask, a grey, an opacity map) that is not a colour, a normal or a packed ORM

### TextureCodec

*type* · `packages/assets/src/library.ts:40`

```ts
type TextureCodec = 'etc1s' | 'uastc'
```

The two Basis Universal codecs a KTX2 map can be in: `etc1s` (small, for colour that passes the check of tools/asset-lib/ktx2-encode.mjs) and `uastc` (big, near the source).

### Vec3

*type* · `packages/assets/src/model.ts:32`

```ts
type Vec3 = [number, number, number]
```

### ZipLimits

*type* · `packages/assets/src/zip.ts:93`

```ts
type ZipLimits = typeof ZIP_LIMITS
```

## Constants

### AUTHOR_MARKER

*const* · `packages/assets/src/model-describe.ts:17`

```ts
const AUTHOR_MARKER: "<!-- author -->"
```

### CATALOG_FORMAT

*const* · `packages/assets/src/catalog.ts:12`

```ts
const CATALOG_FORMAT: 1
```

### CATALOG_ZIP_LIMITS

*const* · `packages/assets/src/zip.ts:99`

```ts
const CATALOG_ZIP_LIMITS: { maxEntries: number; maxEntryBytes: number; maxTotalBytes: number; maxJsonBytes: number; }
```

The limits for the packages of a signed catalog (`openCatalogPackage`): what the signature vouches for is not a hostile package, and a big level (a streamed
town of thousands of cells, a castle's 400 MB scene) is the reason for the catalog. Every file is still checked against its hash, a file is read whole
(so it is capped at 1 GiB) and the declared sizes are still checked against what a deflate stream can give. Packages opened any other way keep `ZIP_LIMITS`.

### CHARACTER_KINDS

*const* · `packages/assets/src/library.ts:14`

```ts
const CHARACTER_KINDS: readonly CharacterKind[]
```

### DEFAULT_REF_VERSION

*const* · `packages/assets/src/catalog.ts:53`

```ts
const DEFAULT_REF_VERSION: "1.0.0"
```

The version a reference without a version means: the version of the move to the server, never "the latest".

### DESCRIPTION_FILE

*const* · `packages/assets/src/model.ts:15`

```ts
const DESCRIPTION_FILE: "description.json"
```

### DESCRIPTION_MD

*const* · `packages/assets/src/model.ts:16`

```ts
const DESCRIPTION_MD: "description.md"
```

### DOCKING_ROLES

*const* · `packages/assets/src/package.ts:44`

```ts
const DOCKING_ROLES: readonly ["player", "camera", "input", "net", "presence", "voice", "account", "currency", "hud", "menu", "entry", "exit", "transition", "save"]
```

The roles of a parent game: a mechanism a game has at most once, that a docked level may bring (`has`) or borrow (`needs`).
Confirmed by the owner 2026-11-18; the list may grow.

### ELECTRON_VOLT

*const* · `packages/assets/src/model-physics.ts:19`

```ts
const ELECTRON_VOLT: 1.602176634e-19
```

One electron-volt in joules (the binding energies of nuclei are told in MeV).

### FMDL_FORMAT

*const* · `packages/assets/src/model.ts:13`

```ts
const FMDL_FORMAT: 1
```

### GAME_TIERS

*const* · `packages/assets/src/package.ts:38`

```ts
const GAME_TIERS: readonly ["desktop", "mobile", "low"]
```

### KTX2_BYTES_PER_TEXEL

*const* · `packages/assets/src/ktx2.ts:39`

```ts
const KTX2_BYTES_PER_TEXEL: Record<Ktx2Target, number>
```

video memory per texel (RGBA unless noted; BC1, ETC1 and PVRTC 4 bpp carry no alpha and take half a byte)

### KTX2_FILES

*const* · `packages/assets/src/ktx2.ts:20`

```ts
const KTX2_FILES: readonly ["babylon.ktx2Decoder.js", "msc_basis_transcoder.js", "msc_basis_transcoder.wasm", "zstddec.wasm", "uastc_astc.wasm", "uastc_bc7.wasm", "uastc_r8_unorm.wasm", "uastc_rg8_unorm.wasm", "uastc_rgba8_srgb_v2.wasm", "uastc_rgba8_unorm_v2.wasm"]
```

the files `ktx2/` holds, as the build copies them (tools/build.mjs, tools/modules/build.mjs, the game builds)

### LIBRARY_ITEM_TYPES

*const* · `packages/assets/src/library.ts:9`

```ts
const LIBRARY_ITEM_TYPES: readonly LibraryItemType[]
```

### LIBRARY_TIERS

*const* · `packages/assets/src/library.ts:11`

```ts
const LIBRARY_TIERS: readonly LibraryTier[]
```

### MANIFEST_FILE

*const* · `packages/assets/src/package.ts:12`

```ts
const MANIFEST_FILE: "ferret.json"
```

### MAP_SLOTS

*const* · `packages/assets/src/library.ts:68`

```ts
const MAP_SLOTS: readonly MapSlot[]
```

### MASK_CHANNELS

*const* · `packages/assets/src/library.ts:181`

```ts
const MASK_CHANNELS: readonly MaskChannel[]
```

### MODEL_FILE

*const* · `packages/assets/src/model.ts:14`

```ts
const MODEL_FILE: "model.json"
```

### MODEL_FUNCTION_KINDS

*const* · `packages/assets/src/model.ts:103`

```ts
const MODEL_FUNCTION_KINDS: readonly ["pure", "world", "lasting", "action"]
```

### MODEL_TIERS

*const* · `packages/assets/src/model.ts:19`

```ts
const MODEL_TIERS: readonly ModelTier[]
```

### MODEL_VALUE_TYPES

*const* · `packages/assets/src/model.ts:106`

```ts
const MODEL_VALUE_TYPES: readonly ["num", "bool", "str", "vec3", "entity", "list", "any"]
```

the types of the game language

### PACKAGE_EXTENSIONS

*const* · `packages/assets/src/package.ts:20`

```ts
const PACKAGE_EXTENSIONS: Partial<Record<PackageKind, string>>
```

The file name extension a kind goes by. `.fex` is a finished game, `.fprj` a project in development, `.fmdl` a model
 and `.level` a level for a parent game; all are `.ferret` packages. A name ending in `.fex`, `.fprj`, `.fmdl` or `.level`
must carry the matching kind; other names (`.ferret`) are not checked, so a package of kind `levels` kept under `.ferret` stays valid.

### PACKAGE_FORMAT

*const* · `packages/assets/src/package.ts:11`

```ts
const PACKAGE_FORMAT: 1
```

### PROGRAM_OPS

*const* · `packages/assets/src/material-program.ts:10`

```ts
const PROGRAM_OPS: Record<string, { args: [number, number]; k?: "texture" | "values" | "param" | "mask" | "transform" | undefined; }>
```

The operations of a node. Inputs of the surface take no arguments.

### PROGRAM_OUTPUTS

*const* · `packages/assets/src/material-program.ts:47`

```ts
const PROGRAM_OUTPUTS: readonly ["baseColor", "metallic", "roughness", "specular", "normal", "occlusion", "emissive", "opacity", "opacityMask"]
```

### PROGRAM_SPACES

*const* · `packages/assets/src/material-program.ts:41`

```ts
const PROGRAM_SPACES: readonly ["world", "local", "tangent", "view"]
```

### PROPULSOR_KINDS

*const* · `packages/assets/src/model.ts:53`

```ts
const PROPULSOR_KINDS: readonly ["ducted-fan", "rotor", "propeller", "nozzle", "exhaust"]
```

### PROVIDED_NAMES

*const* · `packages/assets/src/package.ts:140`

```ts
const PROVIDED_NAMES: readonly ["capabilities", "kinds", "flowSources", "forms", "commands", "levelKeys"]
```

The `provides` lists that are plain names.

### RESPONSE_CLASSES

*const* · `packages/assets/src/model.ts:52`

```ts
const RESPONSE_CLASSES: readonly ["rigid", "elastic", "membrane", "granular", "flake", "liquid-surface", "bed", "stone", "floating", "heat"]
```

the classes of the response of a material; `@ferret/physics-response` has the same list (its test compares the two)

### RUBRIC_PATH

*const* · `packages/assets/src/library.ts:1019`

```ts
const RUBRIC_PATH: RegExp
```

a rubric path: lower case words joined by `/` (`vehicles/aircraft/bombers`); the first word is the top of the tree

### SEAL_OVERHEAD

*const* · `packages/assets/src/security.ts:174`

```ts
const SEAL_OVERHEAD: number
```

What a sealed file adds to its size.

### SPEED_OF_LIGHT

*const* · `packages/assets/src/model-physics.ts:16`

```ts
const SPEED_OF_LIGHT: 299792458
```

The speed of light, m/s: the mass of a binding energy is E / c^2.

### TEXTURE_CHANNELS

*const* · `packages/assets/src/library.ts:37`

```ts
const TEXTURE_CHANNELS: readonly TextureChannel[]
```

### TEXTURE_CODECS

*const* · `packages/assets/src/library.ts:41`

```ts
const TEXTURE_CODECS: readonly TextureCodec[]
```

### ZIP_LIMITS

*const* · `packages/assets/src/zip.ts:92`

```ts
const ZIP_LIMITS: { maxEntries: number; maxEntryBytes: number; maxTotalBytes: number; maxJsonBytes: number; }
```

Limits that keep a hostile package from exhausting memory: a zip bomb is a few kilobytes that inflate to
gigabytes, or a directory of millions of entries. An engine cap, checked on the declared sizes when the directory is read and on
the real output while a file inflates. Change them before reading (a game with huge cooked files may raise `maxEntryBytes`).

