chat

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectSnapshot added in v0.13.0

func CollectSnapshot(registry *diagnose.ToolRegistry) string

CollectSnapshot runs baseline diagnostic tools concurrently and returns a compact text summary. Failures are silently skipped.

func Run

func Run(verbose bool, modelPin string) error

Run starts the interactive chat REPL. If modelPin is non-empty, only that model is used (no failover).

Types

type ChatIO added in v0.13.0

type ChatIO interface {
	OnThinkingStart(round int)
	OnThinkingDone(round int, elapsed time.Duration)
	OnReasoning(text string)
	OnToolStart(name, argsDisplay string)
	OnToolDone(name, argsDisplay string, elapsed time.Duration, resultLen int, isErr bool)
	OnToolOutput(result string)
	// ApproveShell is called when exec_shell is requested.
	// Returns (approved, editedCmd). editedCmd replaces the original if non-empty.
	ApproveShell(command string) (approved bool, editedCmd string)
}

ChatIO abstracts the I/O layer for chat conversations. Terminal implementations provide interactive approval and live progress display. Remote implementations route output via streaming callbacks.

type ChatSession added in v0.13.0

type ChatSession struct {
	// contains filtered or unexported fields
}

ChatSession manages a multi-turn chat conversation with history.

func NewChatSession added in v0.13.0

func NewChatSession(cfg SessionConfig) *ChatSession

NewChatSession creates a chat session with the given configuration.

func (*ChatSession) HandleMessage added in v0.13.0

func (s *ChatSession) HandleMessage(ctx context.Context, input string) (reply string, usage aiclient.Usage, err error)

HandleMessage processes one user message through the conversation. On error, the user message is rolled back from history.

type SessionConfig added in v0.13.0

type SessionConfig struct {
	FC          *aiclient.FailoverClient
	Registry    *diagnose.ToolRegistry
	ToolTimeout time.Duration
	IO          ChatIO
	AllowShell  bool
	Language    string
	Snapshot    string
	MCPIdentity string
}

SessionConfig configures a new ChatSession.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL