Documentation
¶
Index ¶
- Constants
- func CleanupSessions(cmdExec cmd.Executor) error
- type Pty
- type PtyFactory
- type TmuxSession
- func (t *TmuxSession) Attach() (chan struct{}, error)
- func (t *TmuxSession) CapturePaneContent() (string, error)
- func (t *TmuxSession) CapturePaneContentWithOptions(start, end string) (string, error)
- func (t *TmuxSession) Close() error
- func (t *TmuxSession) Detach()
- func (t *TmuxSession) DetachSafely() error
- func (t *TmuxSession) DoesSessionExist() bool
- func (t *TmuxSession) GetPTY() *os.File
- func (t *TmuxSession) GetPanePID() (int, error)
- func (t *TmuxSession) GetSanitizedName() string
- func (t *TmuxSession) HasUpdated() (updated bool, hasPrompt bool)
- func (t *TmuxSession) IsPaneDead() bool
- func (t *TmuxSession) ListWindows() ([]WindowInfo, error)
- func (t *TmuxSession) RespawnPane(workDir string) error
- func (t *TmuxSession) Restore() error
- func (t *TmuxSession) SendKeys(keys string) error
- func (t *TmuxSession) SendTextViaTmux(text string) error
- func (t *TmuxSession) SetDetachedSize(width, height int) error
- func (t *TmuxSession) Start(workDir string) error
- func (t *TmuxSession) TapDAndEnter() error
- func (t *TmuxSession) TapEnter() error
- type WindowInfo
Constants ¶
const ProgramAider = "aider"
const ProgramClaude = "claude"
const ProgramGemini = "gemini"
const TmuxPrefix = "hivemind_"
Variables ¶
This section is empty.
Functions ¶
func CleanupSessions ¶
CleanupSessions kills all tmux sessions that start with "session-"
Types ¶
type Pty ¶
type Pty struct{}
Pty starts a "real" pseudo-terminal (PTY) using the creack/pty package.
type PtyFactory ¶
func MakePtyFactory ¶
func MakePtyFactory() PtyFactory
type TmuxSession ¶
type TmuxSession struct {
// AppendArgs holds additional arguments appended to the program's argument list
// during Start(). Each element is a separate arg — no shell splitting is done.
// Set this before calling Start().
AppendArgs []string
// ProgressFunc is called with (stage, description) during Start() to report progress.
ProgressFunc func(stage int, desc string)
// contains filtered or unexported fields
}
TmuxSession represents a managed tmux session
func NewTmuxSession ¶
func NewTmuxSession(name string, program string, skipPermissions bool) *TmuxSession
NewTmuxSession creates a new TmuxSession with the given name and program.
func NewTmuxSessionWithDeps ¶
func NewTmuxSessionWithDeps(name string, program string, skipPermissions bool, ptyFactory PtyFactory, cmdExec cmd.Executor) *TmuxSession
NewTmuxSessionWithDeps creates a new TmuxSession with provided dependencies for testing.
func (*TmuxSession) Attach ¶
func (t *TmuxSession) Attach() (chan struct{}, error)
func (*TmuxSession) CapturePaneContent ¶
func (t *TmuxSession) CapturePaneContent() (string, error)
CapturePaneContent captures the content of the tmux pane
func (*TmuxSession) CapturePaneContentWithOptions ¶
func (t *TmuxSession) CapturePaneContentWithOptions(start, end string) (string, error)
CapturePaneContentWithOptions captures the pane content with additional options start and end specify the starting and ending line numbers (use "-" for the start/end of history)
func (*TmuxSession) Close ¶
func (t *TmuxSession) Close() error
Close terminates the tmux session and cleans up resources
func (*TmuxSession) Detach ¶
func (t *TmuxSession) Detach()
Detach disconnects from the current tmux session. It panics if detaching fails. At the moment, there's no way to recover from a failed detach.
func (*TmuxSession) DetachSafely ¶
func (t *TmuxSession) DetachSafely() error
DetachSafely disconnects from the current tmux session without panicking
func (*TmuxSession) DoesSessionExist ¶
func (t *TmuxSession) DoesSessionExist() bool
func (*TmuxSession) GetPTY ¶
func (t *TmuxSession) GetPTY() *os.File
GetPTY returns the master PTY file descriptor for direct I/O.
func (*TmuxSession) GetPanePID ¶
func (t *TmuxSession) GetPanePID() (int, error)
func (*TmuxSession) GetSanitizedName ¶
func (t *TmuxSession) GetSanitizedName() string
GetSanitizedName returns the tmux session name used for tmux commands.
func (*TmuxSession) HasUpdated ¶
func (t *TmuxSession) HasUpdated() (updated bool, hasPrompt bool)
HasUpdated checks if the tmux pane content has changed since the last tick. It also returns true if the tmux pane has a prompt for aider or claude code.
func (*TmuxSession) IsPaneDead ¶ added in v0.2.2
func (t *TmuxSession) IsPaneDead() bool
IsPaneDead returns true if the tmux pane has exited (the program finished) but the session is still alive due to remain-on-exit.
func (*TmuxSession) ListWindows ¶ added in v0.2.1
func (t *TmuxSession) ListWindows() ([]WindowInfo, error)
ListWindows returns all windows in this tmux session. Claude Code's tmux spawn backend creates sub-agents as additional windows (index > 0) in the same session, so window count minus one equals sub-agent count.
func (*TmuxSession) RespawnPane ¶ added in v0.2.2
func (t *TmuxSession) RespawnPane(workDir string) error
RespawnPane restarts a dead pane with the user's default shell in the given working directory. This allows the user to manually restart the agent (e.g. claude -r) after it exits.
func (*TmuxSession) Restore ¶
func (t *TmuxSession) Restore() error
Restore attaches to an existing session and restores the window size
func (*TmuxSession) SendKeys ¶
func (t *TmuxSession) SendKeys(keys string) error
func (*TmuxSession) SendTextViaTmux ¶ added in v0.2.2
func (t *TmuxSession) SendTextViaTmux(text string) error
SendTextViaTmux sends literal text to the tmux session using `tmux send-keys -l`, then presses Enter. This goes through tmux's server directly rather than through the client PTY, making it more reliable for delivering prompts to programs.
func (*TmuxSession) SetDetachedSize ¶
func (t *TmuxSession) SetDetachedSize(width, height int) error
SetDetachedSize set the width and height of the session while detached. This makes the tmux output conform to the specified shape.
func (*TmuxSession) Start ¶
func (t *TmuxSession) Start(workDir string) error
Start creates and starts a new tmux session, then attaches to it. Program is the command to run in the session (ex. claude). workdir is the git worktree directory.
func (*TmuxSession) TapDAndEnter ¶
func (t *TmuxSession) TapDAndEnter() error
TapDAndEnter sends 'D' followed by an enter keystroke to the tmux pane.
func (*TmuxSession) TapEnter ¶
func (t *TmuxSession) TapEnter() error
TapEnter sends an enter keystroke to the tmux pane.
type WindowInfo ¶ added in v0.2.1
WindowInfo holds metadata about a single tmux window.