Commit Graph

6 Commits

Author SHA1 Message Date
Teknium
85188e61c3 Merge origin/main into fix/pkg13-ink-leftovers
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)
2026-10-19 12:55:27 -07:00
Teknium
b2bd13c0a9 fix: goal cards repaint when a tool changes the goal mid-turn (CLI, TUI, Desktop)
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)
2026-10-19 03:41:28 -07:00
Teknium
8fa422db49 fix(cli): /queue while a turn runs goes into the gateway's durable FIFO
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
2026-10-19 03:21:33 -07:00
Teknium
36b93a3ef6 fix(cli): read the loop state once per dock poll
/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).
2026-10-15 08:34:12 -07:00
Teknium
cba95563d4 feat(cli): /loop gets a live-work dock row with a ticking countdown
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.
2026-10-15 08:34:12 -07:00
teknium1
43455f5670 feat(cli): live dock shows the standing /goal and queued prompts
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.
2026-09-23 10:05:40 -07:00