Resolves the hermes_cli/cli_tui_mixin.py conflict from #141501 landing: main moved _Panel to
hermes_cli/cli_panel.py and this branch moved the wrap helpers to hermes_cli/cli_tui_wrap.py.
Keep both moves: import _Panel and the wrap helpers, define neither here.
Refs #134889 (N8)
A plugin tool that adds criteria to (or parks) the active /goal wrote the row,
but every surface kept painting the pre-tool snapshot until the turn ended:
Desktop's criteria list, the Ink goal bar and the CLI dock's subgoal count all
sat stale through the rest of the turn (40 s in the live probe).
- gateway: every local-viewer tool completion republishes session.control.update,
gated on the snapshot revision (LiveSession.control_revision) so an ordinary
tool publishes nothing. Generic instead of a tool-name allowlist: any tool
that writes the goal/loop/heartbeat rows is covered.
- legacy tui_gateway (dashboard chat): the same revision-gated publish in
_on_tool_complete.
- classic CLI: GatewayAgent forwards session.control.update to the CLI, which
marks its mirrored goal/loop managers stale; the dock re-reads them once on
its next poll (GoalManager gains refresh() like LoopManager).
- Ink TUI: the goal bar counts subgoals and gates like the CLI dock does, so a
mid-turn criteria change is visible there at all.
Fixes the case reported in #115779 (salvaged by approach: generic revision gate
in place of the PR's tool-name allowlist).
Co-authored-by: Patryk Kopycinski <patryk.kopycinski@elastic.co>
(cherry picked from commit f461c2e420c1ed2af06d7822352dca4b1f8edba3)
The classic CLI held a busy-time /queue prompt in its own _pending_input.
That put it outside session_admissions and the restart contract, so an
owner restart or a disconnect (N2) lost or failed it.
Now /queue <prompt> typed while a turn runs is an ordinary queued
admission (prompt.submit {queued: true}), the way Ink and Desktop queue
busy input. The owner commits it when it accepts it, keeps it across a
restart and runs it once, in FIFO order. The CLI keeps no copy it could
send again. It records only which admissions it queued, so when the owner
starts one the idle tick paints it as the user's turn and
run_conversation pumps that admission without a second submit.
/queue list, edit, rm and clear read and change the owner's queue
(prompt.receipt, prompt.replace_queued, prompt.cancel). The live-work
dock shows the owner's published pending list. /queue move refuses to
reorder an owner row, because the FIFO runs rows in the order they were
sent. A refused submit is reported, and nothing is held locally. While
the session is idle, /queue still queues locally: the next turn
submits it at once.
Refs #134889 (N5)
Refs #134889 only
/loop stop on the input thread sets the manager's state to None; a has_loop() check
followed by a second state read on the spinner thread could raise and stop dock
updates for the session (review finding).
The CLI printed a one-shot gray '↻ Loop: next in 45m.' after each wakeup that never
changed. The dock (goal / subagents / processes / queue) now carries a loop row:
cadence, runs, a countdown that steps per minute (seconds in the last minute) so an
idle prompt repaints at most once a minute, and the prompt; paused loops show their
reason. The collapsed heading gets a '↻ loop next in Xm' badge. The stale one-shot line
is dropped when the dock is up.
The classic CLI dock above the status bar painted subagents and background
processes only. A standing /goal (and whether it is active, parked or
paused) was visible only as a "⊙ goal N/M" status-bar segment, and prompts
waiting in /queue could not be seen at all while the agent worked.
The dock now paints the goal's status line on its top row and a Queue block
(count, first three previews, +N more) on its bottom rows, closest to the
input they will be sent from; F7's summary line carries "goal active|parked|
paused" and "N queued". Goal state comes only from the GoalManager the CLI
already holds for the current session, so the 1 Hz dock refresh never opens
state.db and never shows a previous session's goal after /new.
/queue now dispatches inline while the agent runs, honouring its
busy_policy="dispatch": typed mid-run it was queued as the raw command, so
"/queue X" only re-enqueued X after the turn and /queue list|rm|edit could
not inspect the queue until it had drained.