egg

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentProfile added in v0.9.8

type AgentProfile struct {
	Network    sandbox.NetworkNeed
	EnvVars    []string // required env var names (merged from host)
	WriteDirs  []string // relative to $HOME, need write access
	WriteRegex []string // dirs needing UseRegex (e.g. ".claude" covers .claude.json)
}

AgentProfile declares what an agent needs from the host system. The sandbox merges these into the egg config automatically so users don't need to know agent internals (e.g. where Claude stores config).

func Profile added in v0.9.8

func Profile(agent string) AgentProfile

Profile returns the agent profile for the given agent name. Unknown agents get a restrictive default (no network, no extra dirs).

type Client

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

Client wraps the generated gRPC client for a single egg process.

func Dial

func Dial(socketPath, tokenPath string) (*Client, error)

Dial connects to an egg's Unix socket and reads its auth token.

func (*Client) AttachSession

func (c *Client) AttachSession(ctx context.Context, sessionID string) (pb.Egg_SessionClient, error)

AttachSession opens a bidirectional stream for PTY I/O.

func (*Client) Close

func (c *Client) Close() error

Close closes the gRPC connection.

func (*Client) Kill

func (c *Client) Kill(ctx context.Context, sessionID string) error

Kill terminates the session.

func (*Client) Resize

func (c *Client) Resize(ctx context.Context, sessionID string, rows, cols uint32) error

Resize changes terminal dimensions.

type EggConfig added in v0.8.0

type EggConfig struct {
	Isolation                  string       `yaml:"isolation"`
	Mounts                     []string     `yaml:"mounts"` // "~/repos:rw" or "~/repos" (default rw)
	Deny                       []string     `yaml:"deny"`   // paths to mask
	Resources                  EggResources `yaml:"resources"`
	Env                        EggEnv       `yaml:"env"`
	Shell                      string       `yaml:"shell"`
	DangerouslySkipPermissions bool         `yaml:"dangerously_skip_permissions"`
}

EggConfig holds the sandbox and environment configuration for egg sessions.

func DefaultEggConfig added in v0.8.0

func DefaultEggConfig() *EggConfig

DefaultEggConfig returns the permissive default config used when no egg.yaml exists.

func DiscoverEggConfig added in v0.8.0

func DiscoverEggConfig(cwd string, wingDefault *EggConfig) *EggConfig

DiscoverEggConfig looks for egg.yaml in the given directory, falls back to the wing default, then to built-in defaults.

func LoadEggConfig added in v0.8.0

func LoadEggConfig(path string) (*EggConfig, error)

LoadEggConfig reads and parses an egg.yaml file.

func LoadEggConfigFromYAML added in v0.8.0

func LoadEggConfigFromYAML(yamlStr string) (*EggConfig, error)

LoadEggConfigFromYAML parses an egg config from a YAML string.

func (*EggConfig) BuildEnv added in v0.8.0

func (c *EggConfig) BuildEnv() []string

BuildEnv filters the host environment based on the config.

func (*EggConfig) BuildEnvMap added in v0.8.0

func (c *EggConfig) BuildEnvMap() map[string]string

BuildEnvMap returns the environment as a map for proto SpawnRequest.

func (*EggConfig) ToSandboxConfig added in v0.8.0

func (c *EggConfig) ToSandboxConfig() sandbox.Config

ToSandboxConfig converts the egg config to a sandbox.Config.

func (*EggConfig) YAML added in v0.8.0

func (c *EggConfig) YAML() (string, error)

YAML returns the config serialized as YAML.

type EggEnv added in v0.8.0

type EggEnv struct {
	AllowAll bool     `yaml:"allow_all"`
	Allow    []string `yaml:"allow"` // explicit allowlist
}

EggEnv configures environment variable handling.

type EggResources added in v0.8.0

type EggResources struct {
	CPU    string `yaml:"cpu"`    // duration: "300s"
	Memory string `yaml:"memory"` // size: "2GB"
	MaxFDs uint32 `yaml:"max_fds"`
}

EggResources configures resource limits for sandboxed processes.

func (*EggResources) CPUDuration added in v0.8.0

func (r *EggResources) CPUDuration() time.Duration

CPUDuration parses the CPU field as a duration.

func (*EggResources) MemBytes added in v0.8.0

func (r *EggResources) MemBytes() uint64

MemBytes parses the Memory field as bytes (supports GB, MB suffixes).

type RunConfig added in v0.9.0

type RunConfig struct {
	Agent     string
	CWD       string
	Isolation string
	Shell     string
	Mounts    []string // "~/repos:rw" format
	Deny      []string
	Env       map[string]string
	Rows      uint32
	Cols      uint32

	DangerouslySkipPermissions bool
	CPULimit                   time.Duration
	MemLimit                   uint64
	MaxFDs                     uint32
}

RunConfig holds everything needed to start a single egg session.

type Server

type Server struct {
	pb.UnimplementedEggServer
	// contains filtered or unexported fields
}

Server implements the Egg gRPC service — wraps a SINGLE process. Each egg is its own child process with its own socket/PID/token in ~/.wingthing/eggs/<session-id>/.

func NewServer

func NewServer(dir string) (*Server, error)

NewServer creates a new per-session egg server. dir is the session directory: ~/.wingthing/eggs/<session-id>/

func (*Server) Kill

func (s *Server) Kill(ctx context.Context, req *pb.KillRequest) (*pb.KillResponse, error)

Kill terminates the session.

func (*Server) Resize

func (s *Server) Resize(ctx context.Context, req *pb.ResizeRequest) (*pb.ResizeResponse, error)

Resize changes the terminal dimensions.

func (*Server) RunSession added in v0.9.0

func (s *Server) RunSession(ctx context.Context, rc RunConfig) error

RunSession is the core lifecycle: create sandbox, start agent in PTY, serve gRPC, exit when done.

func (*Server) Session

func (s *Server) Session(stream pb.Egg_SessionServer) error

Session implements the bidirectional PTY I/O stream.

type Session

type Session struct {
	ID        string
	PID       int
	Agent     string
	CWD       string
	Isolation string
	StartedAt time.Time
	// contains filtered or unexported fields
}

Session holds a single PTY process and its state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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