Documentation
¶
Overview ¶
version.go: Build-time versioning info for TmuxAI (set via -ldflags)
Index ¶
- Variables
- type AIResponse
- type AiClient
- func (c *AiClient) ChatCompletion(ctx context.Context, messages []Message, model string) (string, error)
- func (c *AiClient) GetResponseFromChatMessages(ctx context.Context, chatMessages []ChatMessage, model string) (string, error)
- func (c *AiClient) Response(ctx context.Context, messages []Message, model string) (string, error)
- type CLIInterface
- type ChatCompletionChoice
- type ChatCompletionRequest
- type ChatCompletionResponse
- type ChatMessage
- type CommandExecHistory
- type Manager
- func (m *Manager) Countdown(seconds int)
- func (m *Manager) ExecWaitCapture(command string) (CommandExecHistory, error)
- func (m *Manager) FormatConfig() string
- func (m *Manager) GetAvailablePane() system.TmuxPaneDetails
- func (m *Manager) GetAzureOpenAIAPIKey() string
- func (m *Manager) GetAzureOpenAIDeploymentName() string
- func (m *Manager) GetConfig() *config.Config
- func (m *Manager) GetExecConfirm() bool
- func (m *Manager) GetMaxCaptureLines() int
- func (m *Manager) GetMaxContextSize() int
- func (m *Manager) GetModel() string
- func (m *Manager) GetOpenAIAPIKey() string
- func (m *Manager) GetOpenAIBaseURL() string
- func (m *Manager) GetOpenAIModel() string
- func (m *Manager) GetOpenRouterModel() string
- func (m *Manager) GetPasteMultilineConfirm() bool
- func (m *Manager) GetPrompt() string
- func (m *Manager) GetSendKeysConfirm() bool
- func (m *Manager) GetTmuxPanes() ([]system.TmuxPaneDetails, error)
- func (m *Manager) GetWaitInterval() int
- func (m *Manager) InitExecPane()
- func (m *Manager) IsMessageSubcommand(content string) bool
- func (m *Manager) PrepareExecPane()
- func (m *Manager) PrepareExecPaneWithShell(shell string)
- func (m *Manager) Println(msg string)
- func (m *Manager) ProcessSubCommand(command string)
- func (m *Manager) ProcessUserMessage(ctx context.Context, message string) bool
- func (m *Manager) Start(initMessage string) error
- type Message
- type Response
- type ResponseContent
- type ResponseError
- type ResponseInput
- type ResponseOutputItem
- type ResponseRequest
- type ResponseUsage
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "none" Date = "unknown" )
Version, Commit, Date are injected at build time.
var AllowedConfigKeys = []string{
"max_capture_lines",
"max_context_size",
"wait_interval",
"send_keys_confirm",
"paste_multiline_confirm",
"exec_confirm",
"openrouter.model",
"openai.api_key",
"openai.model",
"openai.base_url",
"azure_openai.api_key",
"azure_openai.deployment_name",
"azure_openai.api_base",
"azure_openai.api_version",
}
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 (*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 ¶
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 ¶
Message represents a chat message
type CommandExecHistory ¶
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 ¶
NewManager creates a new manager agent
func (*Manager) ExecWaitCapture ¶
func (m *Manager) ExecWaitCapture(command string) (CommandExecHistory, error)
func (*Manager) FormatConfig ¶
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) GetAzureOpenAIAPIKey ¶ added in v1.1.3
GetAzureOpenAIAPIKey returns the Azure OpenAI API key value with session override if present
func (*Manager) GetAzureOpenAIDeploymentName ¶ added in v1.1.3
GetAzureOpenAIDeploymentName returns the Azure OpenAI deployment name value with session override if present
func (*Manager) GetExecConfirm ¶
func (*Manager) GetMaxCaptureLines ¶
GetMaxCaptureLines returns the max capture lines value with session override if present
func (*Manager) GetMaxContextSize ¶
GetMaxContextSize returns the max context size value with session override if present
func (*Manager) GetModel ¶ added in v1.1.3
GetModel returns the appropriate model based on configuration priority Priority: OpenAI > Azure > OpenRouter
func (*Manager) GetOpenAIAPIKey ¶ added in v1.1.3
GetOpenAIAPIKey returns the OpenAI API key value with session override if present
func (*Manager) GetOpenAIBaseURL ¶ added in v1.1.3
GetOpenAIBaseURL returns the OpenAI base URL value with session override if present
func (*Manager) GetOpenAIModel ¶ added in v1.1.3
GetOpenAIModel returns the OpenAI model value with session override if present
func (*Manager) GetOpenRouterModel ¶
func (*Manager) GetPasteMultilineConfirm ¶
func (*Manager) GetSendKeysConfirm ¶
func (*Manager) GetTmuxPanes ¶
func (m *Manager) GetTmuxPanes() ([]system.TmuxPaneDetails, error)
func (*Manager) GetWaitInterval ¶
GetWaitInterval returns the wait interval value with session override if present
func (*Manager) InitExecPane ¶
func (m *Manager) InitExecPane()
func (*Manager) IsMessageSubcommand ¶
checks if the given content is a command
func (*Manager) PrepareExecPane ¶
func (m *Manager) PrepareExecPane()
func (*Manager) PrepareExecPaneWithShell ¶ added in v1.1.1
func (*Manager) ProcessSubCommand ¶
processes a command and returns a response
func (*Manager) ProcessUserMessage ¶
Main function to process regular user messages Returns true if the request was accomplished and no further processing should happen
type Response ¶ added in v1.1.3
type Response struct {
ID string `json:"id"`
Object string `json:"object"`
CreatedAt int64 `json:"created_at"`
Model string `json:"model"`
Output []ResponseOutputItem `json:"output"`
OutputText string `json:"output_text,omitempty"`
Error *ResponseError `json:"error,omitempty"`
Usage *ResponseUsage `json:"usage,omitempty"`
}
Response represents a response from the Responses API
type ResponseContent ¶ added in v1.1.3
type ResponseContent struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Annotations []interface{} `json:"annotations,omitempty"`
}
ResponseContent represents content in the Responses API
type ResponseError ¶ added in v1.1.3
type ResponseError struct {
Message string `json:"message"`
Type string `json:"type"`
Code string `json:"code,omitempty"`
}
ResponseError represents an error in the Responses API
type ResponseInput ¶ added in v1.1.3
type ResponseInput interface{}
ResponseInput represents the input for the Responses API
type ResponseOutputItem ¶ added in v1.1.3
type ResponseOutputItem struct {
ID string `json:"id"`
Type string `json:"type"` // "message", "reasoning", "function_call", etc.
Status string `json:"status,omitempty"` // "completed", "in_progress", etc.
Content []ResponseContent `json:"content,omitempty"`
Role string `json:"role,omitempty"` // "assistant", "user", etc.
Summary []interface{} `json:"summary,omitempty"`
}
ResponseOutputItem represents an output item in the Responses API
type ResponseRequest ¶ added in v1.1.3
type ResponseRequest struct {
Model string `json:"model"`
Input ResponseInput `json:"input"`
Instructions string `json:"instructions,omitempty"`
Tools []interface{} `json:"tools,omitempty"`
PreviousResponseID string `json:"previous_response_id,omitempty"`
Store bool `json:"store,omitempty"`
Include []string `json:"include,omitempty"`
Text map[string]interface{} `json:"text,omitempty"` // for structured outputs
}
ResponseRequest represents a request to the Responses API