runner

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunRequest

type RunRequest struct {
	SessionID      uuid.UUID
	ContainerID    string
	Command        string
	Args           []string
	Env            map[string]string // persisted to DB; must NOT contain resolved secrets
	SecretEnv      map[string]string // injected into the container but never persisted
	WorkingDir     string
	TimeoutSeconds int
	Actor          string
	CallbackURL    string // empty = no async callback
	WorkspacePath  string // host path of the session workspace; used for artifact detection
}

type Runner

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

Runner coordinates command execution inside sandbox containers.

func New

func New(db *sqlx.DB, docker *dockerpkg.Client, al *audit.Logger, hook policy.Hook) *Runner

func (*Runner) Execute

func (r *Runner) Execute(ctx context.Context, req RunRequest) (*models.Run, error)

Execute runs a command inside the sandbox container, persists the run record, and emits audit events. Output is buffered and returned in the Run model.

func (*Runner) ExecutePrepared

func (r *Runner) ExecutePrepared(ctx context.Context, req RunRequest, run *models.Run) (*models.Run, error)

ExecutePrepared executes a command for an already-prepared run (created by PrepareAsync). Safe to call from a background goroutine.

func (*Runner) PrepareAsync

func (r *Runner) PrepareAsync(ctx context.Context, req RunRequest) (*models.Run, error)

PrepareAsync creates the pending run DB record and emits the start audit event, then returns immediately. The caller is responsible for submitting the job to a worker (which calls ExecutePrepared). This lets the async endpoint return a run_id to the client before execution begins.

func (*Runner) Stream

func (r *Runner) Stream(ctx context.Context, req RunRequest, stdout, stderr io.Writer) (*models.Run, error)

Stream runs a command and writes stdout/stderr chunks to the provided writers as they arrive. Useful for SSE streaming to the client.

Jump to

Keyboard shortcuts

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