Documentation
¶
Index ¶
- Constants
- func CollectLogs(name, source string) (string, error)
- func Create(name string, providers []string, image, policy string) error
- func Delete(name string) error
- func Download(sandboxName, remotePath, localPath string) error
- func DownloadFile(sandboxName, remotePath, localPath string) error
- func EnsureAvailable() error
- func EnsureGateway() error
- func EnsureProvider(name, providerType string, credentials, config map[string]string) error
- func Exec(sandboxName, command string, timeout time.Duration) (stdout, stderr string, exitCode int, err error)
- func ExecStreamReader(sandboxName, command string, timeout time.Duration, stderrW io.Writer) (io.ReadCloser, *exec.Cmd, context.CancelFunc, error)
- func ExtractOutputFiles(sandboxName, remoteDir, localDir string) ([]string, error)
- func ExtractTranscripts(sandboxName, agentName, outputDir string) error
- func SafeDownload(sandboxName, remoteDir, localDir string) error
- func Upload(sandboxName, localPath, remotePath string) error
Constants ¶
const ( // SandboxWorkspace is the workspace directory inside the sandbox. SandboxWorkspace = "/tmp/workspace" //nolint:gosec // not a credential // SandboxClaudeConfig is the Claude config directory inside the sandbox. SandboxClaudeConfig = "/tmp/claude-config" //nolint:gosec // not a credential )
Variables ¶
This section is empty.
Functions ¶
func CollectLogs ¶ added in v0.5.0
CollectLogs runs `openshell logs <name> --source <source> -n 0` and returns the log output. The -n 0 flag requests all available log lines (no limit). This is a host-side command that talks to the gateway — no SSH needed.
func Create ¶
Create creates a persistent OpenShell sandbox and waits for it to be ready. If providers are given, they are passed as --provider flags. If image is non-empty, it is passed as --from to start the sandbox from a container image. If policy is non-empty, it is applied at creation time via --policy.
func Download ¶ added in v0.8.0
Download copies a file or directory from a sandbox to the local machine. The localPath is always treated as a directory by openshell — for single-file downloads use DownloadFile instead.
func DownloadFile ¶ added in v0.8.0
DownloadFile copies a single file from a sandbox to a specific local path. openshell sandbox download always treats the destination as a directory, so this downloads to the parent directory and renames if the resulting filename differs from the desired local name.
func EnsureAvailable ¶
func EnsureAvailable() error
EnsureAvailable checks that the openshell binary is in PATH.
func EnsureGateway ¶
func EnsureGateway() error
EnsureGateway starts a local gateway if none is active. It is idempotent — if a gateway is already running the command is a no-op.
func EnsureProvider ¶
EnsureProvider creates or updates a provider on the gateway. Credential values may contain ${VAR} references which are expanded from the host environment before being passed to openshell.
Credentials use the bare-key form (--credential KEY) so that secret values never appear on the process command line. The expanded values are injected into the child process environment, where openshell reads them directly. See https://docs.nvidia.com/openshell/latest/sandboxes/manage-providers#bare-key-form
func Exec ¶ added in v0.8.0
func Exec(sandboxName, command string, timeout time.Duration) (stdout, stderr string, exitCode int, err error)
Exec runs a command inside a sandbox and returns stdout, stderr, and exit code.
func ExecStreamReader ¶ added in v0.8.0
func ExecStreamReader(sandboxName, command string, timeout time.Duration, stderrW io.Writer) (io.ReadCloser, *exec.Cmd, context.CancelFunc, error)
ExecStreamReader runs a command inside a sandbox, returning an io.ReadCloser for stdout so the caller can parse structured output. Stderr is forwarded to the given writer. The caller must read stdout to completion, then call cmd.Wait().
func ExtractOutputFiles ¶
ExtractOutputFiles copies all files under a remote directory in the sandbox to a local output directory, preserving relative paths.
func ExtractTranscripts ¶
ExtractTranscripts copies Claude transcript files (.jsonl) from the sandbox to a local output directory.
func SafeDownload ¶ added in v0.8.0
SafeDownload copies a directory from a sandbox to the local machine and then sanitizes the result by removing symlinks and .git/hooks/.
Types ¶
This section is empty.