Documentation
¶
Overview ¶
Package core runs conversations: it picks the agent, queues prompts, applies the permission policy, tracks cost and takes git checkpoints. It knows nothing about Telegram; the frontend implements UI.
Index ¶
- type ApprovalView
- type Conv
- type Core
- func (c *Core) Agents() []string
- func (c *Core) Answer(id, optionID string) bool
- func (c *Core) ApprovalConv(id string) (Conv, bool)
- func (c *Core) Caps(conv Conv) agent.Caps
- func (c *Core) Config() *config.Config
- func (c *Core) Diff(ctx context.Context, conv Conv, all bool) (string, error)
- func (c *Core) Models(conv Conv) []string
- func (c *Core) NewSession(conv Conv)
- func (c *Core) ResumeSession(conv Conv, id string) (store.SessionRecord, error)
- func (c *Core) Running(conv Conv) (running bool, queued int)
- func (c *Core) Sessions(conv Conv) []store.SessionRecord
- func (c *Core) SetAgent(conv Conv, name string) error
- func (c *Core) SetCwd(conv Conv, dir string) (string, error)
- func (c *Core) SetMode(conv Conv, mode string) error
- func (c *Core) SetModel(conv Conv, model string)
- func (c *Core) SetProject(conv Conv, name string) error
- func (c *Core) SetUI(ui UI)
- func (c *Core) Settings(conv Conv) Settings
- func (c *Core) Stop(conv Conv) (stopped bool, dropped int)
- func (c *Core) Submit(conv Conv, in Input)
- func (c *Core) ToggleVoice(conv Conv) (bool, error)
- func (c *Core) Undo(ctx context.Context, conv Conv) (store.Checkpoint, error)
- func (c *Core) Usage(user int64) (today, month float64)
- type Input
- type Progress
- type Settings
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalView ¶
type ApprovalView interface {
Resolve(outcome string)
}
type Core ¶
type Core struct {
STT stt.Transcriber
TTS tts.Speaker
// contains filtered or unexported fields
}
func (*Core) Answer ¶
Answer delivers the user's choice for approval id. It returns false if the request is no longer pending.
func (*Core) ApprovalConv ¶
ApprovalConv returns the conversation an approval belongs to.
func (*Core) NewSession ¶
func (*Core) ResumeSession ¶
func (*Core) Submit ¶
Submit runs the input now, or queues it if the conversation is busy. While an approval is pending, text input denies it with that text as the reason.
type Input ¶
type Input struct {
User int64
Blocks []agent.Block
Text string // the text part, used for titles and "deny with reason"
}
Input is one user message.
type Settings ¶
type Settings struct {
Agent, Model, Mode, Cwd, Project string
SessionID string
Voice bool
AlwaysAllow []string
TotalCost float64
}
Settings is a conversation's effective configuration.
type UI ¶
type UI interface {
// Reply sends agent Markdown. Long replies may become a file.
Reply(conv Conv, md string)
// Notice sends a short plain-text status line.
Notice(conv Conv, text string)
// Progress starts a compact "working" indicator for one turn.
Progress(conv Conv) Progress
// ShowApproval presents a permission request; the user's choice comes
// back through Core.Answer(id, optionID).
ShowApproval(conv Conv, id string, p agent.Permission) ApprovalView
SendFile(ctx context.Context, conv Conv, path, caption string) error
SendVoice(ctx context.Context, conv Conv, ogg []byte) error
}
UI is implemented by the chat frontend.