mova-whale-terminal
The groupant beside tools/whale/src/terminal.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | Forward approximant |
| ast | partial | syntax.json |
| composition | partial | Composition |
| cost | partial | Cost |
| descriptant | present | Descriptant |
| invariant | partial | Invariant |
| tests | finite evidence | tests.md |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
Model text
Descriptant
The narrow interface of a Whale's private terminal and its real implementation: TerminalConfig (path of a mova-terminal profile whose animal is the Whale, poll interval), TerminalLease (ROOT/holder.lock for the whole run), Question/Answer, AskError (limit, timeout, failed, unavailable), PrivateTerminal, MovaTerminal (thin adapter over mova-terminal), NoTerminal and FakeTerminal. Source: tools/whale/src/terminal.rs.
Forward approximant
TerminalConfig::load -> terminal::Profile::load (absolute path, poll 100..60000 ms). TerminalLease::take(profile): create root, exclusive try_lease on ROOT/holder.lock or refuse. MovaTerminal::ask(q): terminal::ask(profile, q.text) (Failed on refusal: nothing sent); loop: terminal::answer -> Ok(answer, elapsed, terminal id); terminal::observe screen contains LIMIT_TEXT -> Limit (pending, never re-sent); elapsed > answer_timeout_seconds -> Timeout; sleep poll. NoTerminal: Unavailable. FakeTerminal: by subject, Limit after n answers.
Invariant
One Whale holder per terminal root for a whole run; the adapter sends at most one task per ask and never re-sends; the screen is only read; answers are text, never executed.
Cost
One mova-terminal ask plus one answer read and one screen observation per poll interval until answer, limit or timeout.
Composition
Parent: whale-workers; used by paper.rs and main.rs; depends on mova-terminal (tools/terminal), whose session is held by crab-tmux-worker.
behavior_complement
Not done: starting or holding a session, choosing the model, abandoning a pending question (an operator does it with mova-terminal abandon), retries, limit detection beyond the LIMIT_TEXT phrases on the screen. Evidence status: source-derived model with finite checks, not a proof.
reverse_reconstruction
From the Whale journal (terminal question id, answer hash) and the terminal's own journal (reserved, sent, answered) one recovers which question each answer belongs to; the session's internal reasoning is not recoverable. No unique inverse is claimed.
Epoch 2026-11-04 (learning Whales)
MovaTerminal::ask counts an answer only when its file exists and the pane is idle again (round 1 on 2026-11-04 sent its next question while the LLM was still working and the terminal refused it as not idle).
Epoch 2026-11-04 (batched questions, replay)
Question::items carries a round's batched questions; Answer::missing lists items a terminal had no answer for. Replay answers from recorded state and paper run roots (by normalized term or sentence text) for measurement; it never starts or asks anything.
tests.md
Command: cargo test --manifest-path tools/whale/Cargo.toml --offline --locked with MOVA_OCTOPUS_TEST_MODEL=$MOVA_DATA/download/0/0.4/en.bin (paper/terminal/reader tests: fixture paper with a fake terminal, pod config gates, lease exclusivity, licence admissibility; Mova-only dry run on five CC BY 4.0 papers, two byte-identical runs; 2026-11-04)
Negative controls 2026-11-04: appending answers to the description, asking on after a usage limit, and a lease that does not lock each turn the tests red; restored afterwards. These are finite fixtures and a Mova-only dry run; no live terminal or teacher; not a proof.
2026-11-04: cargo test --manifest-path tools/whale/Cargo.toml --offline --locked with MOVA_OCTOPUS_TEST_MODEL=$MOVA_DATA/download/0/0.4/en.bin; tests/terminal_adapter.rs (3 tests: answer, usage limit, a full Whale run) against a fake bash LLM in a real tmux server on a private socket, tmux required, never a model (2026-11-04) Negative control 2026-11-04: ignoring the limit text makes the limit test wait out the timeout and fail; restored afterwards.
2026-11-04: tests/terminal_adapter.rs an_answer_counts_only_when_the_terminal_is_idle_again (fake LLM writes the answer, works 1.5 s, then idles); negative control: returning on the answer file alone turns it red; restored.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/tools/whale/src/terminal.rs.groupant/