]> git.giacomolli.uk - onechat/commit
Serve the agent to a terminal client
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Sat, 7 Nov 2026 02:07:05 +0000 (23:07 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Sat, 7 Nov 2026 02:07:05 +0000 (23:07 -0300)
commit97274864799ac2eea84bf80c9727a810b695db55
treedec2277183864a9ca7ad8f8bc2c2cffe2d4e39b1
parentf59bb67ae1bc2c899ef4f6be9ce2ff6296c7ffcc
Serve the agent to a terminal client

onechat daemon owns the root agent in agent/ in the data directory: its
config, chat, compactor, and loop. It listens on the Unix socket
onechat.sock in the data directory, with mode 0600, and sends each event
to every client as a JSON line: ready with the agent's name on connect,
busy and idle around each turn, each logged message, and errors. A
client sends JSON lines too: send with a message, or interrupt. A slow
client is dropped, so it never stops the agent.

onechat chat is a line-based client without a terminal library. Each
input line is a message, the line /stop interrupts the turn, and the end
of the input ends the client. It shows the replies, the tool calls, and
the first 10 lines of each result as they happen.

The daemon, login, and probe each hold a lock on auth.lock in the data
directory while they run, so only one process reads and refreshes the
tokens. Two processes that refresh one token file rotate the refresh
token of each other and log each other out. The client never reads the
token file.

Issue: 5daf23e
README.rst
auth.go
chat.go [new file with mode: 0644]
daemon.go [new file with mode: 0644]
daemon_test.go [new file with mode: 0644]
main.go
probe.go
turn.go