TUI Handling Internals¶
This doc set explains how houmao-server performs server-owned live TUI tracking. It is intentionally about the internal watch plane: discovery, polling, parsing, and tracked-state authority.
The key architectural boundary is:
houmao-serverowns thesrc/houmao/server/tui/watch-plane module: discovery, polling, parsing, host-side lifecycle, and terminal-keyed live lookup.houmao.shared_tui_trackingowns tracker semantics for raw-snapshot reduction, detector/profile resolution, and tracker-ownedsurface/turn/last_turn.- The supervised child
cao-serverstill exists for CAO-compatible control routes, but it is no longer in the parsing or live-state authority path. - Live tracker state is memory-primary. On restart, the server rebuilds watch authority from registration records plus current tmux liveness instead of replaying old tracker snapshots from disk.
- The public tracked-state contract is now centered on
diagnostics, foundationalsurfaceobservables, currentturn, and stickylast_turn, while lifecycle authority and settle timing remain internal tracker machinery.
Module Map¶
../../../../src/houmao/server/service.py: top-level wiring, registration route handling, alias maps, and the poll cycle entrypoint../../../../src/houmao/server/tui/registry.py: registration-backed discovery and metadata enrichment../../../../src/houmao/server/tui/transport.py: tmux pane resolution and capture../../../../src/houmao/server/tui/process.py: live process-tree inspection for supported TUI detection../../../../src/houmao/server/tui/parser.py: official parser adapter over the shared shadow parser stack../../../../src/houmao/server/tui/tracking.py: in-memory tracked state, internal settle/anchor machinery, public simplified turn mapping, stability, and recent transitions../../../../src/houmao/server/tui/supervisor.py: reconcile loop and per-session watch workerstui_tracking_module.md: package-level ownership and module map forsrc/houmao/server/tui/../../../../src/houmao/server/models.py: public route payloads for tracked state, history, and registration../../../../src/houmao/shared_tui_tracking/models.py: canonical type definitions (Tristate,TurnPhase,TrackedDiagnosticsAvailability, etc.)../../../../src/houmao/shared_tui_tracking/public_state.py: canonical mapping functions (diagnostics_availability(),turn_phase_from_signals())../../../../src/houmao/shared_tui_tracking/detectors.py: shared detector/profile contracts and compatibility exports../../../../src/houmao/shared_tui_tracking/apps/claude_code/: Claude Code detector/profile implementations../../../../src/houmao/shared_tui_tracking/apps/codex_tui/: Codex interactive TUI detector/profile implementations and temporal hint logic../../../../src/houmao/shared_tui_tracking/apps/unsupported_tool/: fallback detector/profile implementation
Public Surface Versus Internal Authority¶
The public Houmao-owned routes for the tracker are still terminal-keyed:
POST /houmao/launches/registerGET /houmao/terminals/{terminal_id}/stateGET /houmao/terminals/{terminal_id}/history
Internally, the tracker is not keyed by terminal_id. The authoritative identity is HoumaoTrackedSessionIdentity, whose primary key is tracked_session_id and whose compatibility alias set includes the terminal id. terminal_id remains the public lookup token, but route resolution goes through an alias map held by houmao-server instead of making terminal id the internal watch authority.
Reading Order¶
tui_tracking_module.mdregistration_and_discovery.mdprobe_parse_track_pipeline.mdlive_state_model.mdsupervisor_and_lifecycle.md
Primary Source References¶
../../../../src/houmao/server/app.py../../../../src/houmao/server/service.py../../../../src/houmao/server/tui/registry.py../../../../src/houmao/server/tui/transport.py../../../../src/houmao/server/tui/process.py../../../../src/houmao/server/tui/parser.py../../../../src/houmao/server/tui/tracking.py../../../../src/houmao/server/tui/supervisor.py../../../../src/houmao/shared_tui_tracking/models.py../../../../src/houmao/shared_tui_tracking/public_state.py../../../../src/houmao/shared_tui_tracking/detectors.py../../../../src/houmao/shared_tui_tracking/apps/codex_tui/