spawn

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupOrphanedSessions added in v0.12.0

func CleanupOrphanedSessions(liveSessions map[string]bool) int

CleanupOrphanedSessions kills aimux tmux sessions whose agent process is no longer running. liveSessions is the set of tmux session names with a known live agent. Any aimux-* session not in that set is killed.

func ContainerName added in v0.11.0

func ContainerName(provider, dir string) string

ContainerName returns the container name for a given provider and directory.

func KillTmuxSession added in v0.12.0

func KillTmuxSession(name string)

KillTmuxSession kills a single tmux session by name. No-op if the session doesn't exist.

func Launch

func Launch(cmd *exec.Cmd, providerName, dir, sessionMgr, shell, envPrefix string) error

Launch runs a pre-built exec.Cmd in the specified session manager (tmux or iTerm2). The provider name and directory are used to derive the tmux session name. The shell parameter specifies the login shell to use (e.g., "/bin/zsh"); use config.ResolveShell(). The envPrefix is prepended to the command (e.g., OTEL env vars).

func LaunchInContainer added in v0.11.0

func LaunchInContainer(cmd *exec.Cmd, providerName, dir, shell, envPrefix string, opts ContainerOpts) error

LaunchInContainer creates a container, then launches the agent inside it via tmux. The container runs `sleep infinity` and the agent command is executed inside it via `podman exec`. The tmux session wraps the podman exec so the user can attach/detach normally.

Flow: podman create → podman start → tmux new-session "podman exec ... agent"

func ListAimuxTmuxSessions added in v0.12.0

func ListAimuxTmuxSessions() []string

ListAimuxTmuxSessions returns the names of all tmux sessions with the "aimux-" prefix. Returns nil (not an error) when tmux is not installed or no sessions exist.

func TmuxSessionName

func TmuxSessionName(provider, dir string) string

TmuxSessionName returns the tmux session name for a given provider and directory. Format: aimux-<provider>-<basename(dir)> with spaces replaced by hyphens.

Types

type ContainerOpts added in v0.11.0

type ContainerOpts struct {
	Engine string // "podman" or "docker", defaults to "podman"
	Image  string // container image, defaults to "fedora:41"
}

ContainerOpts configures container-based agent launch.

type LaunchOpts added in v0.11.0

type LaunchOpts struct {
	Provider       string        // which agent: claude, codex, gemini
	Dir            string        // working directory
	Model          string        // model override
	Mode           string        // permission mode
	Prompt         string        // initial prompt
	Runtime        string        // "local" or "container"
	Execution      string        // "local" or "hybrid"
	Shell          string        // e.g. "/bin/zsh"
	SessionManager string        // "tmux" or "direct"
	OTELEnabled    bool          // whether to inject OTEL env vars
	OTELEndpoint   string        // for building env prefix
	ContainerOpts  ContainerOpts // container engine/image if Runtime == "container"
}

LaunchOpts carries all axes needed to launch an agent session. Zero values for new fields default to safe values: Runtime="local", Execution="local", Shell=$SHELL, SessionManager="tmux".

type LaunchResult added in v0.11.0

type LaunchResult struct {
	TmuxSession string `json:"tmux_session,omitempty"`
	PID         int    `json:"pid,omitempty"`
}

LaunchResult carries information about a successfully launched session.

Jump to

Keyboard shortcuts

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