The TUI is a client of the daemon, and its own harness is gone¶
TUI decision 100 · accepted · 2026-09-20
Phase 2 of troupe/docs/brief-daemon.md. Everything under lib/troupe/agent, llm, session, tools, tool, mcp, watch, workspace, config, plus workflow.ex, memory.ex, reaper.ex, paths.ex, codec's siblings and the Troupe facade — some 10,000 lines that had drifted from troupe-remote/apps/troupe_core — are deleted, and troupe_core, troupe_gateway and troupe_protocol come in as sparse git dependencies pinned to one troupe-remote commit in mix.exs, the same three applications the worker pod and troupe-daemon run. A session is created in the daemon: the one already answering on this machine, found the way any client finds it (Troupe.Protocol.Daemon), or the Troupe.Gateway.Daemon tree this VM starts under Troupe.Client.Daemons when nothing answers — embedded, but reached over its loopback WebSocket all the same, because embedding saves a process and must not save a protocol. Troupe.Client.Local is replaced by Troupe.Client.Daemon, and Troupe.Remote.Worker — the socket, journal, translation and backpressure a worker pod's session already had — serves a daemon session unchanged bar a fixed token in place of a plane-minted one (plane_url: nil). Fleet calls go through one Troupe.Protocol.Client in Troupe.Client.Daemon.Link. mix troupe.xref still holds the UI to Troupe.Client, and Troupe.Client is now two protocol clients and no in-process API. Process names that collided with the harness's moved: Troupe.Client.Registry, Troupe.Client.Events, Troupe.TUI.Application; Troupe.LLM.Message's two readers became Troupe.Client.Message. Three of the brief's phase 2 items are deliberately not as written. (1) The TUI reaches the embedded daemon over the socket, not through Gateway.Connection in-process: one code path for both cases is worth one hop over loopback. (2) Troupe.Remote.Translate stays: it was the adapter between the protocol's vocabulary and the model's, and with the local vocabulary's only other producer deleted it is the one place the wire becomes the screen, for a daemon session and a pod's alike; rewriting the 1,700-line model to fold protocol events natively is a refactor with no behaviour to show, and remote_translate_test.exs pins the seam. (3) The suite is 92 tests, not 420: 32 files were tests of the harness — tool semantics, the dispatcher's branches, memory, workflows, watch markers, the model catalog — and their subjects live in troupe_core now with suites of their own, or are phase 3 work; FINAL_REPORT.md names every dropped test. What replaced them, daemon_client_test.exs, drives the embedded daemon through the protocol: creation, a streamed transcript, an approval round trip, a second attach, settings, the TUI rendering and answering y.
Governs: clients/tui/lib/troupe/client.ex