Documentation
¶
Overview ¶
Package tui provides the interactive terminal UI for kvit-coder-ui.
Index ¶
- Constants
- func ExtractImageRefs(input string, exists func(string) bool) []string
- func PollProcsToInbox(procDir, inboxDir string) (int, error)
- func ReadClipboardImage() (data []byte, ext string, err error)
- func SaveClipboardTemp(data []byte, ext string) (string, error)
- func StageClipboardImage() (string, error)
- type Options
- type UI
Constants ¶
const StateName = "kcu-state.json"
StateName is the file in ~/.kvit-coder where kvit-coder-ui remembers the model and effort last chosen, so the next start opens on them.
Variables ¶
This section is empty.
Functions ¶
func ExtractImageRefs ¶
ExtractImageRefs returns the image files an input line refers to: @paths, quoted drag-drop paths, and bare paths that exist on disk with an image extension. The text is left untouched — the model sees "@shot.png" and the pixels together. Paths are deduplicated, order kept.
func PollProcsToInbox ¶
PollProcsToInbox moves due background-process events into the session inbox directory, so they wait for the next turn the same way steering does. It is the turn-boundary half of what the agent does every iteration: the agent polls the registry and pushes into memory (which dies with the turn), while the UI — the only thing alive between turns — polls and delivers into files (which survive until the next turn drains them).
Calling Events marks what it returns as reported (ReportedOffset, LastEventAt), so an event materialized here is not reported again by the next turn's first poll, and one the agent already reported in-turn is not repeated here. A missing proc directory means no processes, not an error.
func ReadClipboardImage ¶
ReadClipboardImage returns raw image bytes from the system clipboard, plus a file extension for them. It probes the platform helpers in order — Wayland, X11, then (on WSL) Windows via interop — and reports plainly when none has an image, which is the common case over SSH.
func SaveClipboardTemp ¶
SaveClipboardTemp stores pasted bytes where the agent will find them. The agent copies -image files into the session on arrival, so plain temp is enough here — the UI does not need the session directory.
func StageClipboardImage ¶
StageClipboardImage reads the clipboard and stages it as a file, returning the staged path for the UI to attach to the next turn.
Types ¶
type Options ¶
type Options struct {
// Version is the build stamped into the binary by scripts/build.sh, shown
// in the banner so a session says which build produced it.
Version string
CommitHash string
CommitDate string
AgentPath string
ConfigPath string
SessionName string
SessionMgr *session.Manager
Config *config.Config
// Yolo passes --yolo to every turn: read and write anywhere, no prompts.
Yolo bool
// Structured passes --structured to every turn, so the turn ends with a
// report this front end draws as a card. It is on by default here and off
// in a bare "kvit-coder -p", which keeps a scripted run's output the shape
// it was written against.
Structured bool
// InitialModelSet/InitialModel select the startup row, from -m/--model:
// a :mN, index, id, name or wire id, with optional :effort ("m3:xhigh").
// Unset means the configured default.
InitialModelSet bool
InitialModel int
// InitialEffortSet/InitialEffort override the startup row's effort, from
// -e/--effort or the :effort suffix in InitialModel. Unset means the
// entry default. Zero values select the default with its default
// effort, so Options{Config: cfg} behaves as before.
InitialEffortSet bool
InitialEffort string
// StatePath is kcu-state.json, where the model and effort last chosen
// are kept so the next start opens on them. Empty keeps nothing, which
// is what tests want.
StatePath string
// OpenSetup opens :setup before the first prompt (kcu -setup).
OpenSetup bool
}
Options contains configuration for the UI