Documentation
¶
Index ¶
- func DefaultCacheDirs() []string
- func DefaultDenyPaths() []string
- func ParseFSRules(fs []string, home string) ([]sandbox.Mount, []string, []string)
- type AgentProfile
- type Client
- func (c *Client) AttachSession(ctx context.Context, sessionID string) (pb.Egg_SessionClient, error)
- func (c *Client) Close() error
- func (c *Client) Kill(ctx context.Context, sessionID string) error
- func (c *Client) Resize(ctx context.Context, sessionID string, rows, cols uint32) error
- func (c *Client) Status(ctx context.Context) (*pb.StatusResponse, error)
- type ConfigSnapshot
- type EggConfig
- func DefaultEggConfig() *EggConfig
- func DiscoverEggConfig(cwd string, wingDefault *EggConfig) *EggConfig
- func LoadEggConfig(path string) (*EggConfig, error)
- func LoadEggConfigFromYAML(yamlStr string) (*EggConfig, error)
- func MergeEggConfig(parent, child *EggConfig) *EggConfig
- func ResolveEggConfig(path string) (*EggConfig, error)
- type EggResources
- type EnvField
- type NetworkField
- type RunConfig
- type Server
- func (s *Server) Kill(ctx context.Context, req *pb.KillRequest) (*pb.KillResponse, error)
- func (s *Server) Resize(ctx context.Context, req *pb.ResizeRequest) (*pb.ResizeResponse, error)
- func (s *Server) RunSession(ctx context.Context, rc RunConfig) error
- func (s *Server) Session(stream pb.Egg_SessionServer) error
- func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (*pb.StatusResponse, error)
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCacheDirs ¶ added in v0.22.0
func DefaultCacheDirs() []string
DefaultCacheDirs returns OS-standard cache directories that build tools need. Go, npm, pip, cargo, etc. all write to these. No secrets live here.
func DefaultDenyPaths ¶ added in v0.20.0
func DefaultDenyPaths() []string
DefaultDenyPaths returns paths that should be blocked by default in sandboxed sessions.
Types ¶
type AgentProfile ¶ added in v0.9.8
type AgentProfile struct {
Domains []string // network domains needed (empty = no network)
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 (*Client) AttachSession ¶
AttachSession opens a bidirectional stream for PTY I/O.
type ConfigSnapshot ¶ added in v0.20.0
type ConfigSnapshot struct {
// contains filtered or unexported fields
}
ConfigSnapshot holds copies of agent config files taken before a session.
func SnapshotAgentConfig ¶ added in v0.20.0
func SnapshotAgentConfig(agent string) *ConfigSnapshot
SnapshotAgentConfig reads critical config files for the given agent and saves their contents.
func (*ConfigSnapshot) Restore ¶ added in v0.20.0
func (s *ConfigSnapshot) Restore()
Restore reverts config files to their pre-session state.
type EggConfig ¶ added in v0.8.0
type EggConfig struct {
Base string `yaml:"base,omitempty"`
FS []string `yaml:"fs"`
Network NetworkField `yaml:"network"`
Env EnvField `yaml:"env"`
Resources EggResources `yaml:"resources"`
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 restrictive default config used when no egg.yaml exists. CWD is writable, home is read-only except agent-drilled holes. Sensitive dirs are denied. OS-standard cache dirs are writable so build tools (go, npm, cargo, pip) work out of the box. egg.yaml itself is deny-write so agents can read but not modify their sandbox config.
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. Project configs are resolved through the base chain (additive inheritance) before being returned.
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 MergeEggConfig ¶ added in v0.21.0
MergeEggConfig merges a child config on top of a parent config. - fs: append child to parent; child ro/rw overrides parent deny for same path - network: union (dedup); "*" in either -> ["*"] - env: union (dedup); "*" in either -> ["*"] - resources: child wins per-field (non-zero overrides parent) - shell: child wins if non-empty - dangerously_skip_permissions: OR
func ResolveEggConfig ¶ added in v0.21.0
ResolveEggConfig loads an egg.yaml and resolves its base chain, returning a fully merged config. If base is empty, merges on top of DefaultEggConfig. If base is "none", returns the config as-is (empty slate).
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) IsAllEnv ¶ added in v0.20.0
IsAllEnv returns true if the env config passes all environment variables.
func (*EggConfig) NetworkSummary ¶ added in v0.20.0
NetworkSummary returns a short description of the network config for logging.
func (*EggConfig) ToSandboxConfig ¶ added in v0.8.0
ToSandboxConfig converts the egg config to a sandbox.Config.
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 EnvField ¶ added in v0.20.0
type EnvField []string
EnvField handles YAML unmarshaling of env: string | []string. "*" → ["*"], list → as-is.
type NetworkField ¶ added in v0.20.0
type NetworkField []string
NetworkField handles YAML unmarshaling of network: string | []string. "none" → nil, "*" → ["*"], list → as-is.
func (*NetworkField) UnmarshalYAML ¶ added in v0.20.0
func (n *NetworkField) UnmarshalYAML(value *yaml.Node) error
type RunConfig ¶ added in v0.9.0
type RunConfig struct {
Agent string
CWD string
Shell string
FS []string // "rw:./", "deny:~/.ssh"
Network []string // domain list
Env map[string]string
Rows uint32
Cols uint32
DangerouslySkipPermissions bool
CPULimit time.Duration
MemLimit uint64
MaxFDs uint32
Debug bool
RenderedConfig string // effective egg config as YAML (after merge/resolve)
}
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 ¶
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
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.
func (*Server) Status ¶ added in v0.19.0
func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (*pb.StatusResponse, error)
type Session ¶
type Session struct {
ID string
PID int
Agent string
CWD string
Network string // summary: "none", "*", or comma-separated domains
RenderedConfig string // effective egg config as YAML (after merge/resolve)
StartedAt time.Time
// contains filtered or unexported fields
}
Session holds a single PTY process and its state.