Documentation
¶
Index ¶
- func GetTermFitHeight(lines int) int
- func GetTerminalHeight() int
- func GetTerminalWidth() int
- func NewSSEErrWriter(sse *SSEOutput) stdio.Writer
- func NewSSEWriter(sse *SSEOutput) stdio.Writer
- func TerminalSupportsTrueColor() bool
- type FileOutput
- type Output
- type SSEOutput
- func (s *SSEOutput) Close()
- func (s *SSEOutput) Write(args ...interface{})
- func (s *SSEOutput) WriteCommandEvent(content string, errMsg string)
- func (s *SSEOutput) WriteDiffEvent(before, after string)
- func (s *SSEOutput) WriteErrorEvent(content string, code string)
- func (s *SSEOutput) WriteReasoningPayload(content string)
- func (s *SSEOutput) WriteRequestEvent(id string, reqType string, purpose string)
- func (s *SSEOutput) WriteStatusEvent(status string)
- func (s *SSEOutput) WriteToolCallEvent(function string, description string)
- func (s *SSEOutput) Writef(format string, args ...interface{})
- func (s *SSEOutput) Writeln(args ...interface{})
- type StdOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTermFitHeight ¶
func GetTerminalHeight ¶
func GetTerminalHeight() int
GetTerminalHeight returns the height of the terminal using a robust fallback chain: 1. Direct TTY query via golang.org/x/term (most reliable) 2. Tmux pane height (if inside tmux) 3. LINES environment variable 4. tput lines command 5. Default fallback of 24
func GetTerminalWidth ¶
func GetTerminalWidth() int
GetTerminalWidth returns the width of the terminal using a robust fallback chain: 1. Direct TTY query via golang.org/x/term (most reliable) 2. Tmux pane width (if inside tmux) 3. COLUMNS environment variable 4. tput cols command 5. Default fallback of 80
func NewSSEErrWriter ¶ added in v1.16.16
NewSSEErrWriter creates an stdio.Writer that emits "command" SSE events as errors.
func NewSSEWriter ¶ added in v1.16.16
NewSSEWriter creates an stdio.Writer that emits "command" SSE events as output.
func TerminalSupportsTrueColor ¶
func TerminalSupportsTrueColor() bool
TerminalSupportsTrueColor detects if the terminal supports true color (24-bit) Returns true if COLORTERM is set to "truecolor" or "24bit"
Types ¶
type FileOutput ¶
type FileOutput struct {
// contains filtered or unexported fields
}
FileOutput is a renderer that writes output to a file
func NewFileOutput ¶
func NewFileOutput(filename string) (*FileOutput, error)
NewFileOutput creates a new instance of FileOutput
func (*FileOutput) Close ¶
func (fr *FileOutput) Close()
Close closes the file renderer and its underlying file
func (*FileOutput) GetFilename ¶
func (fr *FileOutput) GetFilename() string
GetFilename returns the name of the file being written to
func (*FileOutput) Write ¶
func (fr *FileOutput) Write(args ...interface{})
func (*FileOutput) Writef ¶
func (fr *FileOutput) Writef(format string, args ...interface{})
Writef writes formatted output to the file
func (*FileOutput) Writeln ¶
func (fr *FileOutput) Writeln(args ...interface{})
type Output ¶
type Output interface {
Writeln(args ...interface{})
Writef(format string, args ...interface{})
Write(args ...interface{})
Close()
}
Output defines the interface for output formatting.
type SSEOutput ¶ added in v1.16.16
type SSEOutput struct {
// contains filtered or unexported fields
}
SSEOutput is an implementation of Output that sends data via Server-Sent Events.
func NewSSEOutput ¶ added in v1.16.16
func NewSSEOutput(w http.ResponseWriter) (*SSEOutput, error)
NewSSEOutput creates a new SSEOutput from an http.ResponseWriter. It returns an error if the writer does not support the http.Flusher interface.
func (*SSEOutput) Close ¶ added in v1.16.16
func (s *SSEOutput) Close()
Close gracefully terminates the SSE stream with the standard [DONE] sentinel.
func (*SSEOutput) Write ¶ added in v1.16.16
func (s *SSEOutput) Write(args ...interface{})
Write outputs the unformatted arguments as a content delta.
func (*SSEOutput) WriteCommandEvent ¶ added in v1.16.16
WriteCommandEvent emits REPL command output. The error field is omitted on success.
Success: data: {"type":"command","data":{"content":"..."}}
Error: data: {"type":"command","data":{"content":"","error":"..."}}
func (*SSEOutput) WriteDiffEvent ¶ added in v1.16.16
WriteDiffEvent emits a raw diff to the client so it can render the changes interactively.
data: {"type":"diff","data":{"before":"...","after":"..."}}
func (*SSEOutput) WriteErrorEvent ¶ added in v1.16.16
WriteErrorEvent emits a system or agent-level error with a machine-readable code.
data: {"type":"error","data":{"content":"...","code":"..."}}
func (*SSEOutput) WriteReasoningPayload ¶ added in v1.16.16
WriteReasoningPayload sends chain-of-thought chunks using the 'reasoning_content' delta key, compatible with DeepSeek/extended OpenAI streaming schemas.
func (*SSEOutput) WriteRequestEvent ¶ added in v1.16.16
WriteRequestEvent emits a request that the server has paused and needs user input. This is typically used for tool confirmations or "ask user" prompts.
data: {"type":"request","data":{"id":"...","type":"...","purpose":"..."}}
func (*SSEOutput) WriteStatusEvent ¶ added in v1.16.16
WriteStatusEvent emits a status lifecycle notification.
data: {"type":"status","data":{"content":"<status>"}}
func (*SSEOutput) WriteToolCallEvent ¶ added in v1.16.16
WriteToolCallEvent emits a tool invocation event. The content is a structured object containing the function name and its description. it shouldn't expose the arguments of the function to the web client
data: {"type":"tool_call","data":{"content":{"function":"...","description":"..."}}}