daemon

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// IdleTimeout is the duration after which the daemon will shut down if no requests are received.
	// Change this value to adjust how long the daemon waits before auto-terminating.
	IdleTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func NewSandboxDaemon

func NewSandboxDaemon()

Types

type Client

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

Client talks to a sandbox daemon inside a sandbox pod.

func NewClient

func NewClient(handle *sandbox.SandboxHandle) *Client

NewClient constructs a client for the given sandbox handle.

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, filePath string) error

DeleteFile deletes a file from the sandbox filesystem.

func (*Client) ReadFile

func (c *Client) ReadFile(ctx context.Context, filePath string) (*fileContent, error)

ReadFile reads a file from the sandbox filesystem.

func (*Client) RunBashCommand

func (c *Client) RunBashCommand(ctx context.Context, in *ExecRequest) (*ExecResponse, error)

RunBashCommand executes a bash command inside the sandbox.

func (*Client) RunPythonScript

func (c *Client) RunPythonScript(ctx context.Context, in *ExecRequest) (*ExecResponse, error)

RunPythonScript executes a Python script inside the sandbox.

func (*Client) WriteFile

func (c *Client) WriteFile(ctx context.Context, filePath, content string) (*fileContent, error)

WriteFile writes content to a file in the sandbox filesystem.

type ExecRequest

type ExecRequest struct {
	Command        string            `json:"command,omitempty"`         // for bash
	Args           []string          `json:"args,omitempty"`            // for bash
	Script         string            `json:"script,omitempty"`          // for python
	TimeoutSeconds int               `json:"timeout_seconds,omitempty"` // defaults to 60
	Workdir        string            `json:"workdir,omitempty"`
	Env            map[string]string `json:"env,omitempty"`
}

type ExecResponse

type ExecResponse struct {
	Stdout        string `json:"stdout"`
	Stderr        string `json:"stderr"`
	ExitCode      int    `json:"exit_code"`
	DurationMilli int64  `json:"duration_ms"`
}

Jump to

Keyboard shortcuts

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