internal

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: Apache-2.0, Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

version.go: Build-time versioning info for TmuxAI (set via -ldflags)

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

Version, Commit, Date are injected at build time.

View Source
var AllowedConfigKeys = []string{
	"max_capture_lines",
	"max_context_size",
	"wait_interval",
	"send_keys_confirm",
	"paste_multiline_confirm",
	"exec_confirm",
	"openrouter.model",
}

AllowedConfigKeys defines the list of configuration keys that users are allowed to modify

Functions

This section is empty.

Types

type AIResponse

type AIResponse struct {
	Message                string
	SendKeys               []string
	ExecCommand            []string
	PasteMultilineContent  string
	RequestAccomplished    bool
	ExecPaneSeemsBusy      bool
	WaitingForUserResponse bool
	NoComment              bool
}

func (*AIResponse) String

func (ai *AIResponse) String() string

type AiClient

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

AiClient represents an AI client for interacting with OpenAI-compatible APIs including Azure OpenAI

func NewAiClient

func NewAiClient(cfg *config.Config) *AiClient

func (*AiClient) ChatCompletion

func (c *AiClient) ChatCompletion(ctx context.Context, messages []Message, model string) (string, error)

ChatCompletion sends a chat completion request to the OpenRouter API

func (*AiClient) GetResponseFromChatMessages

func (c *AiClient) GetResponseFromChatMessages(ctx context.Context, chatMessages []ChatMessage, model string) (string, error)

GetResponseFromChatMessages gets a response from the AI based on chat messages

type CLIInterface

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

func NewCLIInterface

func NewCLIInterface(manager *Manager) *CLIInterface

func (*CLIInterface) Start

func (c *CLIInterface) Start(initMessage string) error

Start starts the CLI interface

type ChatCompletionChoice

type ChatCompletionChoice struct {
	Index   int     `json:"index"`
	Message Message `json:"message"`
}

ChatCompletionChoice represents a choice in the chat completion response

type ChatCompletionRequest

type ChatCompletionRequest struct {
	Model    string    `json:"model,omitempty"`
	Messages []Message `json:"messages"`
}

ChatCompletionRequest represents a request to the chat completion API

type ChatCompletionResponse

type ChatCompletionResponse struct {
	ID      string                 `json:"id"`
	Object  string                 `json:"object"`
	Created int64                  `json:"created"`
	Choices []ChatCompletionChoice `json:"choices"`
}

ChatCompletionResponse represents a response from the chat completion API

type ChatMessage

type ChatMessage struct {
	Content   string
	FromUser  bool
	Timestamp time.Time
}

Message represents a chat message

type CommandExecHistory

type CommandExecHistory struct {
	Command string
	Output  string
	Code    int
}

Parsed only when pane is prepared

type Manager

type Manager struct {
	Config           *config.Config
	AiClient         *AiClient
	Status           string // running, waiting, done
	PaneId           string
	ExecPane         *system.TmuxPaneDetails
	Messages         []ChatMessage
	ExecHistory      []CommandExecHistory
	WatchMode        bool
	OS               string
	SessionOverrides map[string]interface{} // session-only config overrides
	// contains filtered or unexported fields
}

Manager represents the TmuxAI manager agent

func NewManager

func NewManager(cfg *config.Config) (*Manager, error)

NewManager creates a new manager agent

func (*Manager) Countdown

func (m *Manager) Countdown(seconds int)

func (*Manager) ExecWaitCapture

func (m *Manager) ExecWaitCapture(command string) (CommandExecHistory, error)

func (*Manager) FormatConfig

func (m *Manager) FormatConfig() string

FormatConfig returns a nicely formatted string of all config values with session overrides applied

func (*Manager) GetAvailablePane

func (m *Manager) GetAvailablePane() system.TmuxPaneDetails

GetAvailablePane finds an available pane or creates a new one if none are available

func (*Manager) GetConfig

func (m *Manager) GetConfig() *config.Config

func (*Manager) GetExecConfirm

func (m *Manager) GetExecConfirm() bool

func (*Manager) GetMaxCaptureLines

func (m *Manager) GetMaxCaptureLines() int

GetMaxCaptureLines returns the max capture lines value with session override if present

func (*Manager) GetMaxContextSize

func (m *Manager) GetMaxContextSize() int

GetMaxContextSize returns the max context size value with session override if present

func (*Manager) GetOpenRouterModel

func (m *Manager) GetOpenRouterModel() string

func (*Manager) GetPasteMultilineConfirm

func (m *Manager) GetPasteMultilineConfirm() bool

func (*Manager) GetPrompt

func (m *Manager) GetPrompt() string

getPrompt returns the prompt string with color

func (*Manager) GetSendKeysConfirm

func (m *Manager) GetSendKeysConfirm() bool

func (*Manager) GetTmuxPanes

func (m *Manager) GetTmuxPanes() ([]system.TmuxPaneDetails, error)

func (*Manager) GetWaitInterval

func (m *Manager) GetWaitInterval() int

GetWaitInterval returns the wait interval value with session override if present

func (*Manager) InitExecPane

func (m *Manager) InitExecPane()

func (*Manager) IsMessageSubcommand

func (m *Manager) IsMessageSubcommand(content string) bool

checks if the given content is a command

func (*Manager) PrepareExecPane

func (m *Manager) PrepareExecPane()

func (*Manager) PrepareExecPaneWithShell added in v1.1.1

func (m *Manager) PrepareExecPaneWithShell(shell string)

func (*Manager) Println

func (m *Manager) Println(msg string)

func (*Manager) ProcessSubCommand

func (m *Manager) ProcessSubCommand(command string)

processes a command and returns a response

func (*Manager) ProcessUserMessage

func (m *Manager) ProcessUserMessage(ctx context.Context, message string) bool

Main function to process regular user messages Returns true if the request was accomplished and no further processing should happen

func (*Manager) Start

func (m *Manager) Start(initMessage string) error

Start starts the manager agent

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message represents a chat message

Jump to

Keyboard shortcuts

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