Skip to content

settings_catalog

The settings of MuJoCo Mojo as SensAI's docs agent reads them: one entry for each setting, in words.

The settings are described only on their fields, each with a title, a description, a default and sometimes a list of choices, which is also what the settings panel shows. This reads them off the settings schema instead of from a page that would have to be kept in step with the code. A setting is found by the section or key prefix it sits under (dojo, dojo.sensai), or by words in its key, label or description.

A secret setting is listed too, marked as one the settings panel does not show: a schema carries a field's description and default, never the value it holds, and the panel's omission is exactly why a user may need to be told the setting exists.

Setting

Bases: BaseModel

One setting, as its key, the label the settings panel gives it, the values it takes, its default and what it does.

key instance-attribute

Python
key: str

The dotted key, such as dojo.chime_enabled.

label instance-attribute

Python
label: str

The name the settings panel shows for it.

kind instance-attribute

Python
kind: str

The values it takes, in words.

choices class-attribute instance-attribute

Python
choices: dict[str, str] = Field(default_factory=dict)

What each value means, for a setting that takes one of a few.

secret class-attribute instance-attribute

Python
secret: bool = False

Whether it holds a secret, which the settings panel does not show.

section property

Python
section: str

The first part of the key, which is the section of the settings panel it is in.

text

Python
text() -> str

The setting written out for the agent to read.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/settings_catalog.py
Python
def text(self) -> str:
    """The setting written out for the agent to read."""
    lines = [
        self.key,
        f"  panel label: {self.label}",
        f"  value: {self.kind}; default {self.default}",
    ]
    if self.secret:
        lines.append(
            "  the settings panel does not show this one, because it holds a secret"
        )
    lines.append(f"  {self.description}")
    lines += [f"  `{value}`: {meaning}" for value, meaning in self.choices.items()]
    return "\n".join(lines)

settings_from_schema

Python
settings_from_schema(
    schema: dict[str, Any],
) -> tuple[Setting, ...]

The settings a JSON Schema of the settings describes, in the order the schema lists them.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/settings_catalog.py
Python
def settings_from_schema(schema: dict[str, Any]) -> tuple[Setting, ...]:
    """The settings a JSON Schema of the settings describes, in the order the schema lists them."""
    defs = schema.get("$defs", {})
    return tuple(_leaves(_resolve(schema, defs), defs))

settings cached

Python
settings() -> tuple[Setting, ...]

Every setting of this install.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/settings_catalog.py
Python
@cache
def settings() -> tuple[Setting, ...]:
    """Every setting of this install."""
    return settings_from_schema(
        MujocoMojoSettings.model_json_schema(
            schema_generator=GenerateJsonSchemaWithDefaults
        )
    )

read_from

Python
read_from(
    found: Sequence[Setting], section: str = ""
) -> str

What read_settings answers for the settings in found.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/settings_catalog.py
Python
def read_from(found: Sequence[Setting], section: str = "") -> str:
    """What `read_settings` answers for the settings in `found`."""
    link = f"{docs_url('user-guides/features/dojo/dojo.md')}#settings"
    how = _HOW_TO_CHANGE.format(link=link)
    query = section.strip().strip("`.").lower()
    if not query:
        return f"{_outline(found)}\n\n{how}"
    hits = _under(found, query) or _matching(found, section)
    if not hits:
        return f"No setting matches that. {_outline(found)}"
    return f"{_written(hits)}\n\n{how}"

read_settings

Python
read_settings(section: str = '') -> str

The settings of this install, written out: all of a section (dojo, dojo.sensai), or the ones that match some words. With no section, the list of sections.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/settings_catalog.py
Python
def read_settings(section: str = "") -> str:
    """The settings of this install, written out: all of a section (`dojo`, `dojo.sensai`), or the ones that match some words. With no section, the list of sections."""
    return read_from(settings(), section)