Documentation
¶
Overview ¶
Package runtime implements the internal execution engine that backs the public gbash API.
Index ¶
- type Config
- type ExecutionRequest
- type ExecutionResult
- type FileSystemConfig
- func CustomFileSystem(factory gbfs.Factory, workingDir string) FileSystemConfig
- func HostProjectFileSystem(root string, opts HostProjectOptions) FileSystemConfig
- func InMemoryFileSystem() FileSystemConfig
- func MountableFileSystem(opts MountableFileSystemOptions) FileSystemConfig
- func ReadWriteDirectoryFileSystem(root string, opts ReadWriteDirectoryOptions) FileSystemConfig
- func SeededInMemoryFileSystem(files gbfs.InitialFiles) FileSystemConfig
- type HostProjectOptions
- type InteractiveRequest
- type InteractiveResult
- type LogCallback
- type LogEvent
- type LogKind
- type MountableFileSystemOptions
- type Option
- func WithBaseEnv(env map[string]string) Option
- func WithConfig(cfg *Config) Option
- func WithFileSystem(cfg FileSystemConfig) Option
- func WithLogger(callback LogCallback) Option
- func WithNetworkClient(client network.Client) Option
- func WithNetworkConfig(cfg *network.Config) Option
- func WithPolicy(p policy.Policy) Option
- func WithRegistry(registry commands.CommandRegistry) Option
- func WithTracing(cfg TraceConfig) Option
- type ReadWriteDirectoryOptions
- type Runtime
- type Session
- type TraceConfig
- type TraceMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
FileSystem FileSystemConfig
Registry commands.CommandRegistry
Policy policy.Policy
BaseEnv map[string]string
Network *network.Config
NetworkClient network.Client
Tracing TraceConfig
Logger LogCallback
}
type ExecutionRequest ¶
type ExecutionRequest struct {
Name string
Interpreter string
PassthroughArgs []string
ScriptPath string
Script string
Command []string
Args []string
StartupOptions []string
StartupHome string
Env map[string]string
WorkDir string
Timeout time.Duration
ReplaceEnv bool
Interactive bool
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
type ExecutionResult ¶
type FileSystemConfig ¶
FileSystemConfig describes how a runtime session gets its sandbox filesystem and what working directory it should start in.
func CustomFileSystem ¶
func CustomFileSystem(factory gbfs.Factory, workingDir string) FileSystemConfig
CustomFileSystem wires an arbitrary filesystem factory into the runtime.
func HostProjectFileSystem ¶
func HostProjectFileSystem(root string, opts HostProjectOptions) FileSystemConfig
HostProjectFileSystem mounts root as a read-only project tree underneath an in-memory overlay and starts the session in that mounted directory.
func InMemoryFileSystem ¶
func InMemoryFileSystem() FileSystemConfig
InMemoryFileSystem returns the default session filesystem setup.
func MountableFileSystem ¶
func MountableFileSystem(opts MountableFileSystemOptions) FileSystemConfig
MountableFileSystem returns a multi-mount filesystem configuration.
func ReadWriteDirectoryFileSystem ¶
func ReadWriteDirectoryFileSystem(root string, opts ReadWriteDirectoryOptions) FileSystemConfig
ReadWriteDirectoryFileSystem mounts root as the mutable sandbox root.
This mirrors just-bash's direct read-write host filesystem mode: sandbox paths are rooted at "/", and mutations persist back to the host directory.
func SeededInMemoryFileSystem ¶
func SeededInMemoryFileSystem(files gbfs.InitialFiles) FileSystemConfig
SeededInMemoryFileSystem returns an in-memory filesystem preloaded with the provided files.
type HostProjectOptions ¶
HostProjectOptions configures the high-level host-project sandbox helper.
type InteractiveRequest ¶
type InteractiveResult ¶
type InteractiveResult struct {
ExitCode int
}
type LogCallback ¶
type MountableFileSystemOptions ¶
type MountableFileSystemOptions struct {
Base gbfs.Factory
Mounts []gbfs.MountConfig
WorkingDir string
}
MountableFileSystemOptions configures a multi-mount sandbox filesystem.
type Option ¶
Option configures a runtime before initialization.
func WithBaseEnv ¶
func WithConfig ¶
WithConfig overlays non-zero values from cfg onto the runtime config.
func WithFileSystem ¶
func WithFileSystem(cfg FileSystemConfig) Option
func WithLogger ¶
func WithLogger(callback LogCallback) Option
func WithNetworkClient ¶
func WithNetworkConfig ¶
func WithPolicy ¶
func WithRegistry ¶
func WithRegistry(registry commands.CommandRegistry) Option
func WithTracing ¶
func WithTracing(cfg TraceConfig) Option
type ReadWriteDirectoryOptions ¶
type ReadWriteDirectoryOptions struct {
MaxFileReadBytes int64
}
ReadWriteDirectoryOptions configures a host directory mounted as the mutable sandbox root.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) Run ¶
func (r *Runtime) Run(ctx context.Context, req *ExecutionRequest) (*ExecutionResult, error)
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) Exec ¶
func (s *Session) Exec(ctx context.Context, req *ExecutionRequest) (*ExecutionResult, error)
func (*Session) FileSystem ¶
func (s *Session) FileSystem() gbfs.FileSystem
func (*Session) Interact ¶
func (s *Session) Interact(ctx context.Context, req *InteractiveRequest) (*InteractiveResult, error)