Documentation
¶
Overview ¶
ABOUTME: A terminal REPL transport — a second consumer of transport/chatops that ABOUTME: proves the boundary: type a request, answer gates inline, watch it run.
This is a first-class peer to the Slack bot, built from the same core: a chatops.ThreadUI for output + gate rendering, and an inbound loop that routes each stdin line to the Runner (a fresh request, or an answer to a pending gate). It needs no external service, so it's exercised end-to-end in tests via the Dispatcher seam.
Index ¶
Constants ¶
const ( Thread = "cli" Channel = "cli" )
The REPL is one conversation, so it uses one fixed thread/channel identity — the Runner keys every run and command on it, exactly as Slack keys on thread_ts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher interface {
OnMention(ctx context.Context, channel, threadTS, text string)
OnInteraction(threadTS, gateID string, answer chatops.GateAnswer) bool
}
Dispatcher is the slice of *chatops.Runner the REPL drives. Narrowing to an interface keeps the loop testable with a fake — no LLM or pipeline needed.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session holds the terminal transport's output writer and the single pending gate (the one the next input line answers). Bind its ThreadUI into RunnerDeps.NewThreadUI, then call Run with the Runner as the Dispatcher.
func NewSession ¶
NewSession returns a REPL session writing to out (usually os.Stdout).
func (*Session) Run ¶
Run reads input lines and routes each: an answer to a pending gate, a control line (/quit, /exit), or a fresh request. Requests dispatch on a goroutine so the loop stays free to read the gate answers a run will ask for — mirroring the Slack event loop's non-blocking mention handling. Returns when input ends or the user quits.