On this page

Enable Nexus and open a Rift๏ƒ

Prerequisite: world posture. Nexus hosts the public room surface. The two saved setup lessons give a complete activation path and separate the process-wide Nexus configuration from the configuration consumed by one Rift.

Configuration is not liveness๏ƒ

The Nexus factory returns a fresh, defaulted configuration. nexus.activate(config) installs and finalizes it. The lesson checks is_configured and is_activated separately, including after deactivation.

For a Rift, create a new configuration, choose its space type and name, then pass it to create_rift(...). That configuration is consumed: a second Rift needs a second configuration object. Registration and active state are distinct; the opening lesson explicitly marks the Rift active and inactive.

Choose the room for the job๏ƒ

Start with a static room for inspection. A newly opened Rift has no assigned frames. Opening a room and attaching it to an eligible target are separate operations. The inspection walkthrough connects the setup to a real target.

The Rift owns its room. Give the application ownership of the Rift's lifetime and clean it up when the inspection session ends.

The workflow in code๏ƒ

These are the core steps from the saved example. Use its complete linked script for all class definitions and setup.

 1def main() -> None:
 2    nexus = md.Nexus()
 3
 4    # A rift needs a live nexus underneath it - lesson 08's ladder.
 5    system_config = nexus.create_configuration()
 6    system_config.with_rift_creation_enabled(True)
 7    nexus.activate(system_config)
 8    assert nexus.is_activated is True
 9    print("nexus enabled; rift creation permitted")
10
11    # The per-rift configuration is its own object with its own factory.
12    # Note the shape is identical to every other config in melder: with_*
13    # verbs that mutate and return self, ending in a terminator.
14    rift_config = nexus.create_rift_configuration()
15    assert isinstance(rift_config, md.RiftConfiguration)
16    rift_config.with_space_type("static")
17    rift_config.with_space_name("health")
18    print("rift configuration staged: static room named 'health'")
19
20    # create_rift finalizes the configuration on the way through - the same
21    # courtesy Nexus.activate() extended in lesson 08, and still the opposite
22    # of what Aether does.
23    rift = nexus.create_rift(configuration=rift_config, rift_name="ops")
24    assert isinstance(rift, md.Rift)
25    print("rift opened:", rift.rift_name, "| id:", rift.id)
26
27    # ONE CONFIGURATION, ONE RIFT. The object was consumed by the call.
28    try:
29        nexus.create_rift(configuration=rift_config, rift_name="ops-again")
30        raise AssertionError("expected ValueError: configuration consumed")
31    except ValueError as error:
32        print("second use refused:", error)
33
34    # THE TWO BITS, third appearance. Creation registered it; being
35    # registered is not the same as being live.
36    assert rift.is_registered is True
37    print("after create - registered:", rift.is_registered,
38          "active:", rift.is_active)
39
40    rift.mark_active()
41    assert rift.is_active is True
42    print("after mark_active - registered:", rift.is_registered,
43          "active:", rift.is_active)
44
45    rift.mark_inactive()
46    assert rift.is_active is False
47    assert rift.is_registered is True, "liveness went; registration stayed"
48    print("after mark_inactive - registered:", rift.is_registered,
49          "active:", rift.is_active)
50
51    # The rift owns a concrete room and a gate. The room's kind came from
52    # the configuration; the gate is the entry control (lesson 10 uses it).
53    assert rift.space is not None
54    assert rift.rift_gate is not None
55    print("room:", type(rift.space).__name__,
56          "| gate:", type(rift.rift_gate).__name__)
57
58    # Nexus is the registry - the rift can be found by id and by name.
59    assert nexus.has_rift(rift.id) is True
60    assert rift.id in nexus.list_rift_ids()
61    print("registered with nexus; rift ids:", len(nexus.list_rift_ids()))
62
63    print()
64    print("one configuration, one rift - create_rift consumes it")
65    print("presence and liveness are ALWAYS two bits, whatever they are named")

Runnable examples๏ƒ

All advanced examples ยท Level contents ยท Full contents

Canonical page source