Files
DeepSeek-TUI/docs
Hunter Bown 66360ded8b feat(tui): per-session control socket (#5533) (#5831)
* feat(tui): per-session control socket with message/interrupt/relaunch/status verbs

Config-gated [control_socket] table (off by default) binds
<sessions-dir>/<session-id>/control.sock (0600) per running session,
speaking a newline-framed JSON-RPC. Verbs: message (structured
user message through the composer dispatch path; queued under load),
interrupt (the extracted Esc cancel body, shared with the Esc key path),
relaunch (seam: dispatches the /relaunch slash-command path — no
mechanics duplicated here), status (turn/goal snapshot answered by the
socket thread). Wiring: run_event_loop constructs SessionControl and
reconciles/updates/drains once per iteration; the socket runs on
background threads with bounded reads (1 MiB) and 5 s dispatch
timeouts. Unix-only; non-unix parses the key but refuses to bind.

Signed-off-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>

* fix(tui): back off control-socket bind retries after a refused takeover

A second live process holding a session's socket made the per-frame
reconcile retry the connect-probe and warn-log every iteration. Retries
now back off (5 s in prod, 200 ms under test) keyed on the session id,
so switching sessions is never delayed by another session's refusal.

Signed-off-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>

* fix(tui): make accepted control-socket connections blocking on BSD platforms

The listener is nonblocking, and on macOS/FreeBSD an accepted socket
inherits O_NONBLOCK from the listener (Linux accepted sockets are
blocking). The connection handler assumes blocking reads, so on macOS a
large request hit EAGAIN mid-frame, the handler dropped the connection,
and the client's in-flight write failed with BrokenPipe — the
oversized-request test failed exactly this way on macOS CI. Setting the
accepted stream back to blocking (a no-op on Linux) makes the handler's
bounded-read model hold on every platform.

Signed-off-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>

* fix(tui): cfg-gate unix-only control-socket items for Windows builds

The Windows CI gate (cargo test --no-run) denies unused imports and dead
code under -D warnings. On non-unix targets the socket transport does not
exist, so its imports, timing constants, and request/response types are
unreachable there. Split the io/atomic imports and gate the five socket
timing constants with cfg(unix), and mark the six protocol types
(Request, Method, MessageParams, EmptyParams, ControlCommand,
ResponseResult) with a scoped allow: they stay reachable in the portable
protocol/parsing tests and on unix builds, and are only unreachable in
the plain Windows lib build. The dead-code budget file is untouched.

Signed-off-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>

* docs(tui): reference the filed issue #5533 in the control-socket module doc

The module doc still carried the pre-filing placeholder numbering; the
issue is filed as #5533 and the changelog/PR text already use it.

Signed-off-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>

* fix(config): remove syntax errors in tests for control socket

---------

Signed-off-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>
Co-authored-by: M-Maciej <130112810+M-Maciej@users.noreply.github.com>
Co-authored-by: CodeWhale Bot <bot@codewhale.net>
2026-09-02 17:19:46 +00:00
..