You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#122 hardened the streaming renderer in the legacy readline client (src/terminal/client.ts, the attach path) by extracting renderStreamMessage and sanitizing untrusted fields. While reviewing it, the real question surfaced: should that interactive path exist at all, or is it dead weight we're now maintaining a bespoke renderer + sanitizer for?
Current state
TerminalClient (src/terminal/client.ts) does two unrelated jobs, wired into src/cli.ts:
Interactive readline attach — attachSession() + the streaming render loop (renderStreamMessage). This is the oldest of four ways to watch a session stream, and is redundant with all of them:
codeoid-tui (native Rust/Ratatui, recommended cockpit — separate repo)
codeoid tui (in-repo Ink cockpit, already documented as the "legacy fallback")
One-shot request/response commands — ls, new, send, interrupt, approve, destroy. Each connects, sends one message, prints a line, disconnects. Scriptable, pipe-friendly, and with no cockpit equivalent (the cockpits are interactive-only). Worth keeping.
Options
A. Keep as-is (status quo after #122).
Retain codeoid attach and its sanitized renderer. Cost: maintain a bespoke stream renderer + escape sanitizer indefinitely for a path three richer clients already cover.
B. Remove the interactive attach path; keep the one-shot commands. (Proposed)
Delete attachSession(), renderStreamMessage, the SGR/render helpers, and src/tests/terminal-client-render.test.ts. Drop the codeoid attach command or repoint it to codeoid tui. TerminalClient slims to a thin one-shot WS client for the six scriptable commands. Benefit: eliminates the terminal-escape surface by removal rather than by maintaining a sanitizer; less code; one fewer renderer to keep in sync with the wire protocol. Cost / to confirm:
Loses the plain, pipe-friendly, over-SSH "stream one session to stdout" niche (codeoid tui uses the alt-screen and isn't pipe-friendly).
Docs/recipes reference it — the README device-handoff example (laptop$ codeoid attach oracle) and possibly external demo recipes — those need updating.
C. Remove TerminalClient entirely (including the one-shots).
Not recommended: the six one-shot commands have no equivalent and would need rewriting against some WS client. TuiWsClient is coupled to a React dispatch, so this just rebuilds a minimal one-shot client anyway.
Recommendation
Option B. It's the cleanest outcome: the streaming path that motivated #92/#122 goes away, the genuinely useful scriptable commands stay, and the terminal-injection concern is closed by deletion instead of an ongoing sanitization burden.
Loose end (either way)
listSessions() / #formatStatus print session name/workdir with raw console.log and were never sanitized (out of #122's scope). Low risk — a user's own session names — and it's moot for the streaming concern under B.
Context
#122 hardened the streaming renderer in the legacy readline client (
src/terminal/client.ts, theattachpath) by extractingrenderStreamMessageand sanitizing untrusted fields. While reviewing it, the real question surfaced: should that interactive path exist at all, or is it dead weight we're now maintaining a bespoke renderer + sanitizer for?Current state
TerminalClient(src/terminal/client.ts) does two unrelated jobs, wired intosrc/cli.ts:Interactive readline
attach—attachSession()+ the streaming render loop (renderStreamMessage). This is the oldest of four ways to watch a session stream, and is redundant with all of them:codeoid-tui(native Rust/Ratatui, recommended cockpit — separate repo)codeoid tui(in-repo Ink cockpit, already documented as the "legacy fallback")It is also the only part of the file carrying the terminal-escape rendering surface fix: sanitize untrusted output in the legacy readline terminal client (terminal/client.ts) #92 / fix: sanitize untrusted output in the legacy readline terminal client #122 addressed.
One-shot request/response commands —
ls,new,send,interrupt,approve,destroy. Each connects, sends one message, prints a line, disconnects. Scriptable, pipe-friendly, and with no cockpit equivalent (the cockpits are interactive-only). Worth keeping.Options
A. Keep as-is (status quo after #122).
Retain
codeoid attachand its sanitized renderer.Cost: maintain a bespoke stream renderer + escape sanitizer indefinitely for a path three richer clients already cover.
B. Remove the interactive
attachpath; keep the one-shot commands. (Proposed)Delete
attachSession(),renderStreamMessage, the SGR/render helpers, andsrc/tests/terminal-client-render.test.ts. Drop thecodeoid attachcommand or repoint it tocodeoid tui.TerminalClientslims to a thin one-shot WS client for the six scriptable commands.Benefit: eliminates the terminal-escape surface by removal rather than by maintaining a sanitizer; less code; one fewer renderer to keep in sync with the wire protocol.
Cost / to confirm:
codeoid tuiuses the alt-screen and isn't pipe-friendly).laptop$ codeoid attach oracle) and possibly external demo recipes — those need updating.C. Remove
TerminalCliententirely (including the one-shots).Not recommended: the six one-shot commands have no equivalent and would need rewriting against some WS client.
TuiWsClientis coupled to a React dispatch, so this just rebuilds a minimal one-shot client anyway.Recommendation
Option B. It's the cleanest outcome: the streaming path that motivated #92/#122 goes away, the genuinely useful scriptable commands stay, and the terminal-injection concern is closed by deletion instead of an ongoing sanitization burden.
Loose end (either way)
listSessions()/#formatStatusprint session name/workdir with rawconsole.logand were never sanitized (out of #122's scope). Low risk — a user's own session names — and it's moot for the streaming concern under B.Refs
attachrenderersrc/terminal/client.ts,src/cli.ts(7TerminalClientcall sites),src/tui/(the in-repo cockpit)