Repository navigation
feat(rooms): rooms in the TUI, like a Slack channel, with members that talk like teammates - #1957
Merged
Merged
Conversation
A join_room frame follows the room like follow_room. On the user's first visit it logs a join post that the first max_members members answer with a welcome.
The Rooms port lists, joins, posts to and leaves rooms over the daemon chat's thread. A plain chat dials a sessionless thread to a running daemon on first use, one that never starts the daemon nor reports a placement. A reconnect follows the joined room again without a welcome.
The rows, title and keys come from the caller, so the room switcher reuses the agent switcher's dropdown.
The Room indicator reads Room: - or Room: #name and switches with composer.status_bar.indicators.room. A left click on any actionable indicator activates it like Enter on the focused one.
Picking a room in the Room dropdown joins it and shows it in place of the conversation: a channel header, each message under its author and time, grouped like Slack, joins and room notes as quiet lines, and who is working below. The composer posts to the room with the room's trigger table, and ! commands stay in the composer. No room brings the chat back untouched. A new trigger table now forgets the menu loaded under the old one.
The serve worker names its runs itself, so a member waiting for a RUN_FINISHED of its input's run id never saw its turn end. The first run that starts while a turn waits becomes the turn's run, and refusals still match the input.
The built-ins (main, explore, general-purpose, plan) join a room only by name, also once init seeded their files. SubagentInfo marks them as BuiltIn.
Each member sits in the pinned header with a presence dot and idle, working or waiting for approval, as a Slack sidebar shows who is around.
A room's mode sets the agent mode its members' workers start in, and defaults to auto-with-judge, since nobody watches a member's own chat. A judge decides the gated calls, and only a call it escalates waits for the user. The posts a member missed are quoted in its turn, so neither the member nor its judge reads another member's words as the user's request.
6 tasks
A clear_room frame empties the log through the daemon, tells the room's followers with room_cleared, so an open room view empties, and makes each member read the room from its start again. Without a daemon the command clears the log where it runs. Members keep their own sessions.
- The room view redraws only when its width changes, so typing in a room no longer renders every post through the Markdown renderer again. - The rooms frame names live once in the rooms domain, shared by the daemon, the TUI and the CLI. - Clearing a room drops the posts its members held. A run already going still answers. - infer rooms clear clears the log here only when no daemon listens. A daemon that listens but does not answer keeps its log, and the command fails. - A room refuses a post with an image instead of dropping the image. - Rooms.Leave goes through Thread.unfollowRoom, and the router and the first-visit welcome share RoomsRouterConfig.EffectiveMaxMembers.
A fresh room routed only @mentions, so "Hi all" reached nobody until the user set rooms.router.model. The router now defaults to the clef decision model on ollama_cloud. Without an ollama_cloud key a post that pings nobody still logs and tells the author to ping a member, and pings route as before. The local gateway now starts with DECISIONS_ENABLED=true by default, since the router needs it. An empty router.model keeps @mentions-only routing.
The room header reads "# public · 6 members · 48.2k tokens · $0.031": every member's session plus the router's decisions. - A member keeps the session totals its worker's terminal event reports (usage and result.cost) and sends them with every room_activity and in the room status. Totals that drop mean the session rolled over, so the old session's spend carries over. - A routed post records the decision model's input tokens as router_tokens, kept in the room log. - roomsdomain.Spent adds both up, and the room view shows it once the room spent anything. The cost shows only when the model has a price.
After a fresh infer init neither judge.model nor agent.model is set, so a headless worker refused auto-with-judge at startup, and every room member crashed with "the session worker exited before it answered", although each runs on its agent file's model. The agent loop already resolves the judge as judge.model, then the session's current model, then agent.model. The headless startup check now leaves it to that, since a headless run always selects a model before its first turn. A session with no model at all still fails every gated call closed. The judge's tokens are recorded under the model that judged instead of an empty one. tools.safety.approval_behaviour: judge keeps its config-load check.
Inside a room these wiped the chat hidden under it and said "Session cleared", while the room stayed as it was. A room is read by other people too, so it is never cleared from the chat. The configured new_session key, /clear and /new now clear nothing there and say how to empty the room on purpose, with infer rooms clear, or to pick No room to clear your own chat.
A post that pinged nobody went to every member the router passed, or to all of them when the decision model judged it room-wide, so a question like "What's the current weather?" got six answers and six runs. A room's new pickup setting decides how one member takes it: - offer (default): the post goes to the best match first. Its turn says it may answer, or reply exactly PASS. A PASS notes "<member> passed it on - offered to <next>." and offers the post to the next best, up to router.max_members members, and the room says so when nobody takes it. - top: the best match alone gets it, with no way to pass it on. The room-wide predicate is gone. A greeting is offered like any post, and @ALL stays the one way to reach every member. RouteSummary reads "Offered to researcher (0.94), then tester (0.81)." for an offered post.
8 tasks
The header added each member's whole session to the router's tokens, so two one-line welcomes read "417k tokens · $1.01": the two sessions' 18 turns since they started, direct chats included, while the welcomes cost 70.6k tokens and $0.085. The member half never reset with infer rooms clear, it went to 0 on a daemon restart, and a rollover was only guessed at. - A headless run's RUN_FINISHED result carries runTokens and runCost, what the session spent between the run's start and its end, a run that suspended on an approval included. - Every room post carries usage: routing it for the user's, the member's turn for its answer or the note of a failure or a pass. The header adds up the log, so a cleared room starts over and a restart loses nothing. - The member's running totals, the rollover guess and the usage on room_activity and member status are gone. - A room member's worker makes no next-step suggestion, which nobody read but which cost every turn another model call.
8 tasks
When every member scored below min_confidence, fallback top offered the post to its single most relevant member, so a PASS had nobody to go to: "Can someone else tell me a joke?" was offered to writer (0.24), writer passed, and the room said nobody picked it up. The fallback now lines the ranked members up like any offer, up to max_members in a room whose pickup is offer, and the top match alone with top.
…tory The serve worker recorded every run input into the project's shared arrow-up history. A room member's worker gets the turn the room composed, so arrow-up in the chat recalled "You are writer, chatting in #public..." instead of the user's last message. A subagent's worker recorded its parent agent's task the same way. A worker started for a room (INFER_INVOKED_BY=room) or by an agent (INFER_INVOKED_BY=agent) now leaves the history alone, and still lists it.
…turns A plain chat in a room kept "Lost infer daemon" on its status line after the reconnect followed the room again. The sessionless thread now posts that the room is back, next to where it posts that the daemon was lost. The rooms client also decodes a reply before it returns it. List and Post read the value and filled it in one return statement, an order the Go spec leaves open.
A run that fails ends on RUN_ERROR, which carries no result, so the spend a member read from it was always zero. The failure note now says so in the code and the docs instead of promising a number that never arrives. The docs also say that routing a post counts its tokens without a cost.
Every new post and activity change redrew the room by rendering the markdown of every post in its log. A member's message is now kept by its post id and rendered again only for a new width, a new snapshot or a cleared log. The unused RoomView.Room is gone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1954. Part of #1943.
The chat TUI enters the rooms the daemon hosts, and a room reads like a Slack channel. The members talk like teammates there.
TUI
Room: -/Room: #publicstatus indicator (composer.status_bar.indicators.room, defaulttrue). Enter on the focused indicator or a mouse click opens a dropdown with No room first, then every room and its member count.48.2k tokens · $0.031, what the posts in its log cost: the members' turns, and the tokens of routing, which carry no cost) and each member's presence (○ idle,● working,◐ waiting for approval)roomtrigger table ofcomposer.yamland the placeholderMessage #public.!and!!, and a message with an image, stay in the composer until you leave the room, and/works as usual.Rooms (daemon)
Members talk like teammates. The turn tells a member to answer what a post asks and to keep greetings and small talk to one short line.
@allreaches every member with no router model. It is the one way to reach them all.One member picks up a request. A post that pings nobody, a greeting included, goes to one member at a time, the best match first, as a room's new
pickupsays:offer(default): the offered member answers it or replies exactlyPASS. APASSnotes<member> passed it on - offered to <next>.and offers the post to the next best, up tomax_members, and the room says so when nobody takes it.top: the best match alone gets it, with no way to pass it on.RouteSummaryreadsOffered to researcher (0.94), then tester (0.81).The router runs on
ollama_cloud/clef:27bby default. A fresh room routed only @mentions, so "Hi all" reached nobody untilrooms.router.modelwas set. Without anollama_cloudkey, a post that pings nobody is still logged and its author is told to ping a member. The cli-managed gateway now starts withDECISIONS_ENABLED=trueby default. An emptyrouter.modelkeeps @mentions-only routing.Welcome on the first visit. A new
join_roomframe follows the room likefollow_room. The first time the user ever enters a room, it logs akind: joinpost, and the firstmax_membersmembers welcome them.Members run in Auto+Judge. A room's
modesets the agent mode its members' workers start in,auto-with-judgeby default, since nobody watches a member's own chat. A judge decides the gated tool calls, and only a call it escalates still waits for the user.mode: standardkeeps a human on every approval. The judge isjudge.model, else the model the member runs on, so a freshinfer initworks.Missed posts are quoted. The posts a member missed are quoted in its turn as context, so neither the member nor its judge reads another member's words as the user's request.
What a room spent. Every post carries
usage(tokens,cost): the tokens of routing it for the user's post, which carry no cost, and the member's turn for its answer or the room's note that it passed a post on. The turn's spend comes from the newrunTokensandrunCostin a headless run'sRUN_FINISHEDresult, what the session spent during the run, an approval pause included. A turn that fails ends onRUN_ERROR, which reports no spend, so its note carries none.roomsdomain.Spentadds up the log, so a cleared room starts over, a daemon restart loses nothing, and chats with a member directly stay out. A room member's worker makes no next-step suggestion, which nobody read.infer rooms clear <room>empties a room's log. It goes through a running daemon, whose newclear_roomframe tells the followers withroom_cleared, so an open room view empties. Each member then reads the room from its start again. Without a daemon the command clears the log where it runs. Members keep their own sessions."*"seats the user's own agents. The built-ins (main,explore,general-purpose,plan) join a room only by name, also onceinfer initseeded their files.SubagentInfocarriesBuiltIn.The room status, snapshot and posted shapes live in the rooms domain and are shared by the host, the CLI and the TUI.
Posted.RouteSummaryis shared too.Fixes found while verifying
RUN_FINISHEDof its input's run id stayed "working" forever. The first run that starts while a turn waits now becomes the turn's run. Registry refusals still match the input.@menu kept the old order after a trigger-table switch.SetTriggerSourcesnow forgets the menu it loaded.infer init. A headless worker refusedauto-with-judgewithoutjudge.modeloragent.model, although the loop's judge falls back to the session's model. That startup check is gone, and the judge's tokens count under the model that judged.tools.safety.approval_behaviour: judgekeeps its config-load check.Ctrl+L,/clearand/newnow clear nothing inside a room, which other people read too, and point toinfer rooms clear <room>or No room.Fixes from the review
#public is back.ListandPostread the value and filled it in one return statement, an order the Go spec leaves open. They now decode first.Verification
go test -raceforinternal/rooms/...,internal/presentation/...,cmd/rooms/...,cmd/chat/...,internal/container/...andconfig/..., plus the pre-commit gate on every commit.FakeRooms. Room mode means entering and leaving, the trigger table, posting,!refused, an unreachable daemon and a failed join.Roomsadapter (list, join, post, leave, streaming, re-follow after a reconnect, the sessionless thread and its room-is-back status),@all, the pickup (offered to the best match only, passed on, nobody taking it,top), what each post cost and a run's own spend, the suggestion skip for room workers, the first-visit welcome, worker-named runs andFirstVisit.INFER_GATEWAY_MOCK, tmux) covered:hi @allanswered by both members!lsrefusedollama_cloud/clef:27band members onollama_cloud/glm-5.3-flash, over six user agents:pickup. The pickup itself is covered by tests, not yet by a real run.Cross-repo impact
join_roominstead offollow_roomto get the welcome, and renderkind: joinposts.It should also empty its room view on
room_cleared, whichinfer rooms clearsends to every follower, and can show what a room spent from theusageof the posts in its log.@all, thepickupof a request, the clef router default, the first-visit welcome, membermode, what a room spent andinfer rooms clear.