# Debug commands of @ferret/assets, @ferret/levels, @ferret/editor, @ferret/fmdl-import, @ferret/physics-atomic

Call with `world.commands.execute(name, args)`; `world.commands.list()` on the running game is the authority. Read from the sources of these packages.

- `assets.live` — the models asked for at run time and their state: {} -> [{ ref, state }]
- `assets.require` — bring a file to the device now (any reference scheme): {ref, priority?, sha256?} -> { size }
- `assets.status` — is a reference on the device: {ref} -> missing | queued | loading | cached | failed
- `catalog.levels` — the levels of the open catalogs: {check?} -> [{ id, name, tags, package, state: cached | missing | unknown, bytes? }]; check reads the package index of each level to fill state and bytes
- `catalog.open` — register a catalog and its levels: {url, prefix?, allowUnsigned?} -> { id, version, stale, unsigned, levels }
- `catalog.refresh` — ask the servers again: {} -> [{ id, changed, stale }]
- `catalog.travel` — travel into a level of an open catalog: {id, transition?} -> { warnings }
- `fmdl.actors` — the actors on the stage: name, model, place
- `fmdl.appear` — put a model on the stage: {model, name?, at?: [x, y, z]}
- `fmdl.describe` — what a model is, its docks, motions (with parameters), size and physics: {model} or {actor}
- `fmdl.dock` — dock two docks: {a: "actor#dock", b: "actor#dock", joint?: {kind: fixed|hinge|ball|bond, axis?, limits?, breakForce?}, place?: boolean}; the second is put at the first's dock
- `fmdl.docked` — the pairs docked now
- `fmdl.docks` — the docks of an actor and of what is included in it, with their descriptions, places and who holds them: {actor}
- `fmdl.docks.restore` — make the docked pairs of a save true: {fmdlDocks}
- `fmdl.docks.save` — the docked pairs as JSON, for a level or a saved game
- `fmdl.models` — find models by words: {text?, kind?, tag?, abstract?}; best match first, with their summaries
- `fmdl.undock` — take a pair apart, or everything an actor or a dock holds: {a, b?}
- `fmdl.vanish` — take an actor away: {actor}
- `levels.prefetch` — start bringing a level to the device in the background: {id, inSeconds?} -> state
- `lib.item` — one item file: {id (or id@version)} -> the item
- `lib.list` — the library items: {type?, tags?, text?, rubric?} -> [{ id, uid, type, name, rubric, tags, description?, package, versions, preview }]; a rubric takes in all rubrics beneath it
- `lib.material` — make a library material and keep it by name in the scene: {id (or id@version), variant?, name?} -> { name }
- `lib.module` — run a ready-made package of the library (a module item) and list what it exports: {id (or id@version)} -> { id, package, exports }
- `lib.open` — open the asset library catalog: {url?} -> { id, version, items }
- `lib.rubrics` — the tree of the library: {under?} -> [{ path, name, description, count, own, children }]; count is the items in the rubric and beneath it
- `lib.spawn` — put a library character in the world: {id (or id@version), tier?, position?, yaw?, name?} -> { name, clips }
- `library.accept` — accept a submission of the incoming area into the library (moderators only): {id} -> { status, uid, package, version, items }
- `library.add` — add a package to the library: {url (a .ferret or .fmdl: a /files/ path of the page, or any URL), rubric?, uid? (to update an asset: the uid the library gave at the first submission), description? (ENGLISH ONLY)} -> { status: published | unchanged | incoming, uid, package, version?, items, id? }; the library issues the uid and the version (1.0.0, then 1.1.0 ...); moderator items go straight in, items of any other account wait in incoming for the moderator (an update sent while the earlier one waits replaces it); signs in as the person (the account service)
- `library.find` — find library items by keywords (several words allowed; ENGLISH ONLY: translate the user’s words into English first, the library has no other language): {q, type?, rubric?, tags?, limit? (default 50, at most 200), offset?} -> cards [{ id, uid, type, name, tags, rubric, description?, preview (url), size, versions }]; a generous set of candidates, no ranking promises: read the cards and pick; refer to an item as id@version (a reference without a version means 1.0.0, never the latest)
- `library.get` — bring one item of the library to the device now (its package, files and preview): {id (or id@version; none = 1.0.0), tier?} -> { id, uid, type, package, version (the library's: 1.0.0, 1.1.0 ...), versions }
- `library.incoming` — what waits in the incoming area of the library (moderators only): {} -> [{ id, uid, by, package, version, items }]
- `library.place` — put a static model of the library in the world: {id (or id@version; none = 1.0.0), position?, yaw?, tier?} -> { name, state }
- `library.reject` — reject a submission of the incoming area (moderators only): {id} -> { status, id }
- `occlusion.state` — meshes with occlusion queries: -> {supported, meshes}
- `pkg.catalog` — build catalog.json from the open packages (packed, hashed, signed with signKey): {catalogId, version, base, ids?, engine?, levels?, signKey?} -> the catalog
- `pkg.code` — may the package's code run: {id?, origin? (it comes from the game's own site), trusted?} -> {allowed, reason?}
- `pkg.compact` — write a project (.fprj) again without the copies its saves left behind: {id?} -> {before, after}
- `pkg.deps` — dependencies of a package and whether each is open and fits its version range: {id?}
- `pkg.info` — what a package is: id, version, kind, levels, assets, behaviours, dependencies, code, signed, encrypted, size: {id?}
- `pkg.keys` — make a key: {kind: "signing" (a pair: publicKey, privateKey, keyId) | "encryption" (a 32-byte key)}. Keep the private and encryption keys secret
- `pkg.level` — travel to a level of a package (default: the one the package starts in): {id?, level?}
- `pkg.list` — the open packages
- `pkg.loaded` — the packages whose code runs on this page, in load order: [{id, version, code, commands, behaviours}]
- `pkg.open` — open a .ferret file (a url) or a package folder (a url ending in /) and register its levels: {url, password? | key?, prefix?}. An encrypted package opens locked without a password or key
- `pkg.pack` — build the .ferret of a package as it is now: {id?, name? (file name), password? | key? (seal it; an encrypted package is sealed again with its own unless decrypt), decrypt?, signKey? (private key from pkg.keys)}
- `pkg.publish` — pkg.catalog and lay the files out for a server: packages named by their hash (immutable, cache forever) and catalog.json (mutable); needs a host that can write: {same as pkg.catalog} -> {files, bytes}
- `pkg.require` — run the code of a package (its dependencies first), once per page: {id, range?} -> {id, version, commands, behaviours}; refused when the package may not run code (pkg.code says why)
- `pkg.save` — keep the changes made to a package (the editor's saves go to a draft): a folder writes its changed files, a project (.fprj) gets them appended after its last byte, any other .ferret is packed again, unsigned: {id?}
- `pkg.unlock` — give the password or key of an encrypted package: {id?, password | key}
- `pkg.validate` — check the package: manifest, files, sha256, no code where there should be none, every level and what it refers to, dependencies: {id?, checksums?} -> {ok, issues}
- `pkg.verify` — the signature: is there one, does it match the manifest and every file, is its key trusted: {id?, trusted? (key ids), checksums?}
- `prefetch.status` — the background downloads and the bandwidth estimate: {} -> { rate, jobs }
- `snapshot.enable` — turn snapshot rendering on or off: {on?} -> wanted
- `snapshot.invalidate` — record a new snapshot: -> true
- `snapshot.state` — snapshot rendering: -> {supported, wanted, active, waiting, records, invalidations}
- `stream.cache` — the persistent cache: {} -> usage and packages; {clear: true, pkg?} empties it (all, or one package)
- `stream.cells` — the streamed level's cells and their state: {} -> { cells: {id: state}, bundles: {id: state} }
- `stream.debug` — show or hide the streamed level's cells as coloured boxes (grey missing, yellow loading, blue stand-in, green loaded, red failed): {on?} -> shown
- `stream.memory` — bytes of resident streamed cells against the budget: {} -> { resident, cap, pinned }
- `stream.plan` — what fetching these references would download: {refs: [{ref, size?}]} -> { bytes, files, cached }
- `stream.status` — the asset store now: files queued / loading / done / failed and the bytes held: {} -> { queued, loading, done, failed, bytes }
- `travel.preview` — run a registered transition against a fake travel without travelling: {name, seconds?, bytes?, files?, fail?, cached?} -> {name, fellBack, updates, ended}
- `travel.transitions` — the names of the transitions the game registered (and the engine's bar)
- `visibility.state` — the grid cell and the groups drawn: {} -> { cell, shown, hiddenGroups }
- `edit.anim.graph` — read an animation graph of the level: {name?} (without a name: the list of graph names)
- `edit.anim.initial` — the state the graph starts in: {graph, state}
- `edit.anim.param` — declare a graph parameter: {graph, name, kind:"float"|"bool"|"trigger"|null} (null drops it)
- `edit.anim.remove` — remove an animation graph: {name}
- `edit.anim.set` — add or replace a whole animation graph: {name, graph:{params?, states, initial, transitions?}}
- `edit.anim.state.remove` — remove a state: {graph, state, withTransitions?}. Refused while a transition or the initial state still uses it, unless withTransitions drops those transitions
- `edit.anim.state.set` — add or change a state: {graph, state, motion:{clip}|{blend1d:{param,points}}|{blend2d:{x,y,points}}, speed?, loop?}
- `edit.anim.transition.add` — add a transition: {graph, from ("*" for any), to, when?:[conditions], duration?, interruptible?, index? (the first matching transition wins)}
- `edit.anim.transition.remove` — remove a transition: {graph, index}
- `edit.anim.transition.set` — change a transition: {graph, index, to?, from?, when?, duration?, interruptible?} (null removes a field)
- `edit.chemistry.get` — the level's chemistry block (physics.chemistry): sets, species, reactions, aqueous, standard, phases
- `edit.chemistry.option` — set a list or flag of the chemistry block: {key: "sets"|"aqueous"|"standard"|"phases", value} (sets: names of standard species sets; aqueous: true or {recombination?, dissolution?}; standard: true or a list of families; phases: true or {substances?, rate?, liquidReactions?}, melting and boiling); null removes it
- `edit.chemistry.reaction.remove` — remove a reaction of the level: {name}
- `edit.chemistry.reaction.set` — add or change a reaction of the level: {name, reaction:{equation, A, Ea, orders?, phase?, catalysts?}} or {name, reaction:{reactants, products, A, Ea, ...}}
- `edit.chemistry.species.remove` — remove a species of the level: {name}
- `edit.chemistry.species.set` — add or change a species of the level: {name, species:{formula?, phase?, Hf (J/mol), S?, cp, cpT?, charge?}}
- `edit.clip.close` — close the open clip, dropping unsaved changes
- `edit.clip.get` — the open clip: {} -> the clip JSON; {summary: true} -> counts only; {bone} -> that bone's tracks
- `edit.clip.history` — the labels of the changes made so far
- `edit.clip.info` — change duration, loop, fps or name: {duration?, loop?, fps?, name?}
- `edit.clip.key.copy` — copy the pose at a time to another: {from, to, bone?} (one bone, or every bone with a key at `from`)
- `edit.clip.key.remove` — remove a key: {bone, time, channel?: rotation|position}
- `edit.clip.key.set` — set a key: {bone, time, rotation:[x,y,z,w] | euler:[x,y,z deg] | position:[x,y,z], interp?: step|linear|smooth, absolute?} (a change from rest unless absolute)
- `edit.clip.mirror` — mirror left and right (bones named _l/_r swap, middle bones flip): {time?} (that pose only; else the whole clip)
- `edit.clip.new` — start a clip: {skeleton, name, duration? (s, default 1), loop?, fps?, base? (a library clip id whose keys are copied)} -> summary
- `edit.clip.notify.remove` — remove notifies of a name: {name, time?}
- `edit.clip.notify.set` — put a notify on the clip: {name, time}
- `edit.clip.open` — open a saved or library clip: {id} -> summary
- `edit.clip.pose.hold` — put a weapon in the hands at a time: {time, grip: {point, axis, radius, spacing?} (in the frame of the holding hand: the grip of a socket), position: [x,y,z] (the middle of the grip, skeleton frame), direction: [x,y,z] (the blade), edge?: [x,y,z] (the way the edge should lead, for a grip with an edge), edgeWeight?, side?: r|l, roll? (degrees, or "auto": the wrists bent least and the hands moved least from the pose of the clip there), both?, poleMain?, poleOff?, interp?} -> { error, stretched }
- `edit.clip.pose.holdRun` — hold a weapon at many times at once: {holds: [the arguments of edit.clip.pose.hold, one per time], loop?, step?}; the turns of the hands left "auto" or absent are chosen for the whole run (wrists bent least, hands moving least between the times) -> { results: [{ time, error, stretched, roll }] }
- `edit.clip.pose.ik` — set keys by solving a limb to a target at a time: {chain:[root, middle, end], target: [x,y,z] | {bone, offset?}, pole?: same, time, endRotation?, weight?, interp?} -> { error, stretched }; positions are in the skeleton frame, an offset is in the frame of its bone
- `edit.clip.preview` — show the open clip on a body: {body?, time?} (a pose) or {body?, play: true, loop?}
- `edit.clip.redo` — redo
- `edit.clip.retime` — change the timing: {scale} (every time times it) or {curve: [[old, new], ...]} (straight lines between the pairs)
- `edit.clip.save` — save the open clip: {} -> { saved, clip }; the host writes it where its clips live
- `edit.clip.undo` — undo the last clip change
- `edit.clip.validate` — check the open clip: {} -> { ok, issues: [{level, path, message}], skipped }
- `edit.close` — stop editing and go back to the level as saved (discards the draft)
- `edit.collider.remove` — drop a collision override: {node}
- `edit.collider.set` — make a glTF node (and its meshes) solid or walk-through: {node, collide}
- `edit.colliders.missing` — meshes of the open level that do not collide and are large enough to matter: {minSize? (metres, default 1)}
- `edit.data.set` — set a key of the free data (handed to the game, never read by the engine); null removes it: {key, value}
- `edit.diff` — what the draft changes compared to the saved manifest, as patch operations
- `edit.entity.add` — add a manifest entity: {entity:{id, behaviour?, node?, transform?, params?, tags?}}
- `edit.entity.duplicate` — copy a manifest entity to a new id, moved by an offset: {id, newId, offset?}
- `edit.entity.remove` — remove a manifest entity: {id}
- `edit.entity.set` — change a manifest entity: {id, behaviour?, node?, params? (merged; null removes a key), transform? (merged), tags?}
- `edit.get` — read the draft manifest, or a part of it: {path?} as a JSON pointer such as /entities/0/params
- `edit.history` — the edits made so far, oldest first
- `edit.material.get` — one address: {scope?, uid, material?} -> {uid, via, meshes, materials, ambiguous?, looks: the draft's look per material, now: what the scene shows per material}
- `edit.material.list` — the addresses a material look can use in the open level: {scope?: "type" (default: the models, all their instances) | "instance" (single objects), filter? (regex over the uid), limit? (200)} -> {entries:[{uid (a model is listed by its best uid; its other names, the placement key, the library id and the glTF mesh name, work as addresses too), via (where the uid comes from: extras, model, library, mesh | extras, entity, actor, path), meshes, materials:[glTF material names], ambiguous? (more than one thing answers: a write is refused), look (the draft has one)}], total, truncated, unresolved: [uids of the draft nothing answers to]}
- `edit.material.remove` — take a look off, back to what the file made: {scope?, uid, material? (none: every look of that uid)}
- `edit.material.set` — change the look of one material of a model or of one object, live (no reload, undo/redo, saved by edit.save into the manifest's materialLooks): {scope?: "type" (default: the model, all instances) | "instance" (one object, over the type's look), uid (from edit.material.list), material (the glTF material name inside that model), values:{baseColor?:[r,g,b(,a)] linear 0..1, metallic?, roughness? 0..1, emissive?:[r,g,b], emissiveStrength?, normalScale?, alpha?:{mode:"opaque"|"mask"|"blend", cutoff?}, doubleSided?, maps?:{baseColor?, normal?, orm?, emissive?, opacity?: a file of the level, a URL or ferret://}}}. Values are merged into the look there; a null value takes that one off. An address that more than one thing answers to is refused. With an orm (or metallic/roughness) map on the material, metallic and roughness multiply the channel of that map, as in glTF
- `edit.navmesh.info` — the NavMesh of the level: {polygons, settings, file, rebuilt (changed since the last save)}
- `edit.navmesh.rebuild` — build the NavMesh again from the solid meshes of the level: {agentRadius?, agentHeight?, maxClimb?, maxSlope?, cellSize?} (merged into the settings of the level; null drops one). Saved as navmesh.bin by edit.save
- `edit.open` — open a level for editing: {level}. Loads its manifest as a draft; returns a summary
- `edit.patch` — raw JSON-pointer operations on the draft: {ops:[{op:"add"|"replace"|"remove", path, value?}], label?}. Checked like every edit
- `edit.physics.constraint.remove` — remove a link: {id}
- `edit.physics.constraint.set` — add or change a link between two bodies: {id?, type:"rod"|"rope"|"spring"|"ball"|"hinge"|"fixed", a, b (node names), length?, stiffness?, damping?, maxForce?, anchor?:[x,y,z], axis?:[x,y,z], limits?:[min,max] radians}; the same id replaces
- `edit.physics.fracture.remove` — drop the pieces of a body: {node}
- `edit.physics.fracture.set` — make a body break into authored pieces: {node, pieces:[node names], material?, toughness? (impulse it takes before it breaks)}
- `edit.physics.get` — the level's physics block, or a summary: {summary?} counts materials, constraints, fractured bodies and the capabilities
- `edit.physics.material.remove` — remove a material: {name}
- `edit.physics.material.set` — add or change a material: {name, values:{density?, friction?, kineticFriction?, restitution?, rollingFriction?, ...}}
- `edit.physics.set` — set a key of the physics block: {key, value} (capabilities, gravity, combine, pairs, or a capability's values); a null value removes it
- `edit.redo` — redo the edit that was undone
- `edit.reload` — reload the open level from the draft (after edit commands with live off)
- `edit.save` — write the draft to the level's manifest.json (through the editor's save hook). Refused while the draft is invalid
- `edit.spawn.add` — add a spawn point: {id, position:[x,y,z], yaw?}
- `edit.spawn.human` — put a person on a spawn point: {id, code} (a @ferret/humans share code from humans.code); {id, code: null} takes the person off
- `edit.spawn.remove` — remove a spawn point: {id}
- `edit.spawn.set` — change a spawn point: {id, position?, yaw?}
- `edit.streaming.cell` — add, replace or (cell null) remove a streaming cell: {id, cell:{bounds:[minX,minY,minZ,maxX,maxY,maxZ], file, size?, priority?, lod?}}
- `edit.streaming.field` — change one streaming setting: {key: loadRadius|unloadRadius|lodRadius|cell|texturesProgressive, value} (null removes an optional one)
- `edit.streaming.set` — set the streaming block (PLAN-STREAMING.md 4.1) as a whole, or null to remove it: {streaming}
- `edit.tags.set` — set the free tags (the chooser of the game reads them), or null to remove: {tags}
- `edit.undo` — undo the last edit
- `edit.validate` — check the draft: the schema problems, what the loader could not wire on the last load, and render-side reads of fields the snapshot does not declare
- `edit.zone.add` — add a zone: {name, shape:{kind:"box"|"cylinder"|"polygon", ...}, priority?, tags?}
- `edit.zone.remove` — remove a zone: {name}
- `edit.zone.set` — change a zone: {name, shape?, priority?, tags?}
- `fmdl.edit.check` — everything wrong with the draft, as ferret fmdl check sees it, the chain and the includes resolved
- `fmdl.edit.child` — make a child of the open model: {id, summary?, kind?, name?, version?
- `fmdl.edit.close` — close a session, discarding what was not saved
- `fmdl.edit.describe` — change the description: {fields: {summary?, kind?, tags?, purpose?, text?, ...; null removes}
- `fmdl.edit.diff` — the files that differ from what was opened
- `fmdl.edit.dock` — add, change or remove a dock: {name, dock?: {node, frame?: {position, rotation}, description}, remove?: true
- `fmdl.edit.get` — read the draft model.json or a part of it: {path? (a JSON pointer such as /docks/bond)
- `fmdl.edit.include` — add or change an include, or remove it: {name, include?: {id, version, at, fuse?, overrides?}, remove?: true
- `fmdl.edit.material` — add, change or remove a material: {name, material?: {gltf?, render?, physical}, remove?: true
- `fmdl.edit.motion` — add, change or remove a motion: {name, motion?: {description, params?, requires?: {forms}}, program?: text of the motion file, remove?: true
- `fmdl.edit.moving` — add, change or remove a moving part: {name, part?: {node, kind: hinge|slider|rotor, axis, pivot, limits?, rest?, link?}, remove?: true
- `fmdl.edit.open` — open a model for editing: {model}. Its parents and included models are found through the loader
- `fmdl.edit.pack` — pack the draft into a .fmdl as ferret fmdl pack does (levels measured, mass computed, description written): returns its size and what was written
- `fmdl.edit.parent` — set the parent: {id, version (a range such as ^1.0.0)} or {id: null} to make the model a root
- `fmdl.edit.part` — add, change or remove a part: {name, part?: {node, material?, role?, description?}, remove?: true
- `fmdl.edit.patch` — JSON-pointer operations on model.json: {ops: [{op: add|replace|remove, path, value?}], label?
- `fmdl.edit.physics` — change the physics, merged by key (null removes): {patch: {mass?, charge?, bindingEnergy?, collision?, bodies?, joints?, modules?}
- `fmdl.edit.redo` — redo the last undone change
- `fmdl.edit.resolve` — the resolved model of the draft (the parents merged, the includes resolved): {summary?: true gives the short form
- `fmdl.edit.run` — run a motion of the draft in the host's world: {motion: "<model>/<name>" or "<name>", args?
- `fmdl.edit.save` — pack and hand the model to the host (a file, the library): {session?}
- `fmdl.edit.sessions` — the sessions open and which one is current
- `fmdl.edit.undo` — undo the last change
- `fmdl.edit.use` — make a session the current one: {session}
- `atomic.add` — add an atom: {name, nuclide? | Z, A?, electrons?, position?}
- `atomic.atom` — the levels, energies and place of an atom: {name}
- `atomic.binding` — the binding energy of a nuclide, MeV: {nuclide}
- `atomic.dock` — bond two atoms: {a, b}
- `atomic.energy` — the energy account of the atoms: each kind and the total, J
- `atomic.excite` — put an electron on a level: {atom, electron?, n}
- `atomic.fireNeutron` — send a neutron at a nucleus: {toward, mev?, outcome?: fission|capture}
- `atomic.firePhoton` — send a photon: {toward?: atom, nm? | energy?, at?, dir?}
- `atomic.heat` — give a molecule heat, J: {molecule, joules}
- `atomic.info` — what is in the atomic capability
- `atomic.lines` — the lines of a one-electron atom: {Z?, to?, upTo?} wavelengths in nm
- `atomic.undock` — pull a bond apart (the energy comes from outside): {a, b}
