Documentation
¶
Overview ¶
Package interactive prepares an AI client for a terminal session.
It connects the pieces that make a one-shot request feel alive: a spinner that follows the provider's tool activity, and an approval prompt (backed by the Atmos permission system) for providers that run their own tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conversation ¶
type Conversation struct {
// Enabled reports whether follow-up questions can be asked at all.
Enabled func() bool
// Prompt asks for the next question. An empty answer ends the conversation.
Prompt func() (string, error)
}
Conversation continues a one-shot question as a conversation: after each answer it asks whether there is a follow-up and runs another turn with the earlier turns as context.
type Session ¶
type Session struct {
// Progress is the spinner for the request. Start it before sending and Stop it afterwards.
Progress *progress.Progress
// TimeoutManaged is true when the provider enforces the timeout itself, excluding time
// spent at approval prompts. The caller then needs a cancel-only context.
TimeoutManaged bool
}
Session is the interactive state for one request.
func Attach ¶
func Attach(atmosConfig *schema.AtmosConfiguration, client any, message string, timeout time.Duration) (*Session, error)
Attach wires client for interactive use and returns the session.
Providers opt in through the interfaces in the approval package; a client that implements none of them gets only the spinner. The timeout is handed to providers that enforce it themselves.
func (*Session) NewContext ¶
NewContext returns the context for the request. Providers that enforce the timeout themselves get a context without a deadline, so time spent waiting at an approval prompt does not count against it; every other provider gets a deadline.