Return True when stdout is a real terminal. Used to auto-disable streaming output when ``openkb query`` is piped, redirected to a file, or run as a subprocess — streaming output emits interleaved tool-call lines that are noisy for non-interactive callers, and the non-streaming branc
()
| 1078 | |
| 1079 | |
| 1080 | def _stream_to_tty() -> bool: |
| 1081 | """Return True when stdout is a real terminal. |
| 1082 | |
| 1083 | Used to auto-disable streaming output when ``openkb query`` is piped, |
| 1084 | redirected to a file, or run as a subprocess — streaming output emits |
| 1085 | interleaved tool-call lines that are noisy for non-interactive callers, |
| 1086 | and the non-streaming branch returns just the final answer string. |
| 1087 | """ |
| 1088 | return sys.stdout.isatty() |
| 1089 | |
| 1090 | |
| 1091 | @cli.command() |