Skip to main content

Module dream_exec

Module dream_exec 

Source
Expand description

Apply, reject and revert a personal-memory dream (docs/specs/SPEC_DREAMS_BACKGROUND_MEMORY_ORGANIZING_2026_11_27.md §2.6, §9; build step 3). The plan, what each file must be like and what to do to it, is memory::dream_apply; this runs it.

Each file write is the ordinary versioned write, with the version recorded first and the label dream set here by srv (a caller can never name it: source_for_caller), so the drift detector finds the file matching its latest version and records nothing, history and diff show the dream’s change as a version, and a revert is one more version. A removal deletes the file and its mirror row; the memory record notes it at the next reconcile, as it does a file the agent removed. Global Memory is not here: its entries are rows, not files.

The plan is checked before anything runs and each file again just before it is touched. A step whose file is already as the step leaves it is not run again, so an apply or a revert that stops half way (an I/O error) is finished by running it again. An operation is noted as applied as soon as its files are done; a half-applied dream cannot be rejected.

Enums§

Ran 🔒
How an apply or a revert ended.

Constants§

REMOVED 🔒
The sentinel an operation that only removed files notes as the version it wrote (it wrote none).

Functions§

decision_lock 🔒
One decision about a dream at a time. The RPC engine runs requests at once (two windows, a double click), and an apply that is checked as ready, writes files and only then moves the dream must not meet a reject that sees no applied operation yet: the files would change under a rejected dream, which a revert (it needs applied) cannot undo. The guard is held to the end of the apply, reject or revert.
dream_apply_impl 🔒
Apply a ready dream, whole or not at all. Stale when a file is not as the pass read it: nothing is changed.
dream_reject_impl 🔒
Reject a ready dream: nothing is written. A half-applied dream cannot be rejected.
dream_revert_impl 🔒
Revert an applied dream: each file back as the pass read it, as new versions (revert), while each file is still what the dream left. Stale names a file that was edited since: nothing is changed.
guard 🔒
live_hash 🔒
The hash of a live memory file, None when it does not exist. Never the mirror: the files are what apply changes.
load 🔒
load_any 🔒
A dream of either kind, for a decision that writes no files.
move_to 🔒
Move the dream, or say why not. A false answer means another call moved it first.
note_for 🔒
What an applied operation notes: the version that wrote its file, else that it only removed files.
place 🔒
The owner and the folder a dream’s files are in.
publish 🔒
put 🔒
Write content as file’s next version and into the folder; returns the version’s id.
read_heads 🔒
Every file the operations name, as it is now.
run_step 🔒
Run one step after checking its file once more.
run_steps 🔒
Run steps, one operation’s steps after another’s. after_op is told as each operation’s steps finish.
take_away 🔒
Remove file and its mirror row. A file already gone is not an error.