Skip to main content

Module intent

Module intent 

Source
Expand description

Layout intents applied to a tree: a step-for-step port of the frontend’s tree actions (frontend/layout/lib/layoutTree.ts, with addChildAt and addIntermediateNode from layoutNode.ts), followed by the same balance_node the frontend runs after every action. The frontend applies an action locally as a prediction and srv’s result is the one that is stored, so the two must agree: intent_vectors replays one shared set of random sequences through both. Where the frontend would corrupt the tree (a move into the moved node’s own subtree, a swap of a node with its ancestor) or apply half an action (an invalid resize), srv refuses instead. SPEC_STRONG_REDUCER_AUTHORITY_LAYOUT_2026_06_30.md §4.

Structs§

NodeIds
Mints the ids for the nodes one intent creates, in creation order.
ViewEffect
What an intent does to focus and magnify, as the frontend’s action functions write them. Applied only when the sender didn’t say which pane it has focused (srv’s own placements).

Functions§

apply_intent
Apply intent to root, then normalize it (balance_node). On an error root may be half-edited: callers apply to a copy.
delete_and_balance
The delete intent on a tree whose root stays: unlink the node, then balance (what the frontend does when a move empties a pane).
derive_node_id
The id of the nth node (from 1) an intent creates: the action id with its first eight hex digits replaced by n, or <action id>-<n> when the action id isn’t a UUID. The frontend derives the same ids (deriveNodeId, layoutNode.ts), so the branches both sides create are named alike.
migrate_legacy_minimize
Migrate the pre-display-mode minimize fields to the minimized flag. This is the only place it happens: srv runs it on every tree it loads at bootstrap (heal_loaded_layout) and before every intent, so the window is never given a tree that carries them. Returns how many fields it migrated (0 for a current tree).