// Local terminal streams for the client, per runtime.
//
// - node: process.stdin/stdout/stderr are already TTY streams (setRawMode,
// columns/rows, 'resize') — use them directly.
// - bare: bare's process stdio isn't raw-mode capable; construct bare-tty
// ReadStream/WriteStream on fds 0/1/2, which expose the same TTY surface
// (setRawMode, columns/rows, 'resize') that ShellClient relies on.
//
// `#node:tty` maps to bare-tty on bare and node's tty on node; we only touch it
// on the bare branch.
import process from '#node:process'
import tty from '#node:tty'
export function localStdio () {
const isBare = typeof globalThis.Bare !== 'undefined'
if (!isBare) {
return { stdin: process.stdin, stdout: process.stdout, stderr: process.stderr }
}
return {
stdin: new tty.ReadStream(0),
stdout: new tty.WriteStream(1),
stderr: new tty.WriteStream(2)
}
}