Documentation
¶
Index ¶
- type Client
- func (c *Client) AttachSession(ctx context.Context, sessionID string) (pb.Egg_SessionClient, error)
- func (c *Client) Close() error
- func (c *Client) GetConfig(ctx context.Context) (string, error)
- func (c *Client) Kill(ctx context.Context, sessionID string) error
- func (c *Client) List(ctx context.Context) (*pb.ListResponse, error)
- func (c *Client) Resize(ctx context.Context, sessionID string, rows, cols uint32) error
- func (c *Client) SetConfig(ctx context.Context, yamlStr string) error
- func (c *Client) Spawn(ctx context.Context, req *pb.SpawnRequest) (*pb.SpawnResponse, error)
- func (c *Client) Version(ctx context.Context) (string, error)
- type EggConfig
- type EggEnv
- type EggResources
- type Server
- func (s *Server) GetConfig(ctx context.Context, req *pb.GetConfigRequest) (*pb.GetConfigResponse, error)
- func (s *Server) Kill(ctx context.Context, req *pb.KillRequest) (*pb.KillResponse, error)
- func (s *Server) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error)
- func (s *Server) Resize(ctx context.Context, req *pb.ResizeRequest) (*pb.ResizeResponse, error)
- func (s *Server) Run(ctx context.Context) error
- func (s *Server) Session(stream pb.Egg_SessionServer) error
- func (s *Server) SetConfig(ctx context.Context, req *pb.SetConfigRequest) (*pb.SetConfigResponse, error)
- func (s *Server) Spawn(ctx context.Context, req *pb.SpawnRequest) (*pb.SpawnResponse, error)
- func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (*pb.VersionResponse, error)
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the generated gRPC client for the egg.
func (*Client) AttachSession ¶
AttachSession opens a bidirectional stream for PTY I/O.
func (*Client) GetConfig ¶ added in v0.8.0
GetConfig returns the egg's current active config as YAML.
func (*Client) Spawn ¶
func (c *Client) Spawn(ctx context.Context, req *pb.SpawnRequest) (*pb.SpawnResponse, error)
Spawn creates a new PTY session in the egg.
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
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
LoadEggConfig reads and parses an egg.yaml file.
func LoadEggConfigFromYAML ¶ added in v0.8.0
LoadEggConfigFromYAML parses an egg config from a YAML string.
func (*EggConfig) BuildEnv ¶ added in v0.8.0
BuildEnv filters the host environment based on the config.
func (*EggConfig) BuildEnvMap ¶ added in v0.8.0
BuildEnvMap returns the environment as a map for proto SpawnRequest.
func (*EggConfig) ToSandboxConfig ¶ added in v0.8.0
ToSandboxConfig converts the egg config to a sandbox.Config.
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 Server ¶
type Server struct {
pb.UnimplementedEggServer
// contains filtered or unexported fields
}
Server implements the Egg gRPC service — holds PTY fds across wing restarts.
func NewServer ¶
NewServer creates a new egg server. The dir should be ~/.wingthing. The version string is recorded so wings can detect version mismatches.
func (*Server) GetConfig ¶ added in v0.8.0
func (s *Server) GetConfig(ctx context.Context, req *pb.GetConfigRequest) (*pb.GetConfigResponse, error)
GetConfig returns the current active egg config as YAML.
func (*Server) Kill ¶
func (s *Server) Kill(ctx context.Context, req *pb.KillRequest) (*pb.KillResponse, error)
Kill terminates a session.
func (*Server) List ¶
func (s *Server) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error)
List returns all active sessions.
func (*Server) Resize ¶
func (s *Server) Resize(ctx context.Context, req *pb.ResizeRequest) (*pb.ResizeResponse, error)
Resize changes the terminal dimensions of a session.
func (*Server) Session ¶
func (s *Server) Session(stream pb.Egg_SessionServer) error
Session implements the bidirectional PTY I/O stream.
func (*Server) SetConfig ¶ added in v0.8.0
func (s *Server) SetConfig(ctx context.Context, req *pb.SetConfigRequest) (*pb.SetConfigResponse, error)
SetConfig updates the active egg config from YAML. New sessions use the updated config.
func (*Server) Spawn ¶
func (s *Server) Spawn(ctx context.Context, req *pb.SpawnRequest) (*pb.SpawnResponse, error)
Spawn creates a new PTY session. The critical fix: sandbox is created BEFORE the process starts, and the sandbox's Exec() produces the cmd that gets passed to pty.StartWithSize().
func (*Server) Version ¶
func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (*pb.VersionResponse, error)
Version returns the egg's binary version.