Documentation
¶
Overview ¶
Package exec provides shared workspace-bound terminal and code execution. It must not import pkg/capability (capability/core and agent tools call into this package).
Index ¶
- Constants
- type Config
- type Result
- func RunCode(ctx context.Context, cfg Config, language, code, filename, workdir string, ...) (Result, error)
- func RunEntrypoint(ctx context.Context, cfg Config, entrypoint, source string, stdin []byte, ...) (Result, error)
- func RunTerminal(ctx context.Context, cfg Config, command, workdir string) (Result, error)
Constants ¶
View Source
const ( // DefaultTimeout limits run_terminal and run_code when unset. DefaultTimeout = 60 * time.Second // MaxCodeBytes rejects run_code source above this size. MaxCodeBytes = 256 << 10 // MaxJSONBytes is the function JSON in/out limit (64KiB). MaxJSONBytes = 64 << 10 // DefaultMaxOutput truncates combined output beyond this byte count. DefaultMaxOutput = 8192 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Workspace is the absolute workspace root.
Workspace string
// Env performs filesystem and process operations; nil uses env.Default().
Env env.ExecutionEnv
// Timeout limits execution; zero uses DefaultTimeout.
Timeout time.Duration
// MaxOutput truncates Output; zero uses DefaultMaxOutput.
MaxOutput int
}
Config bounds execution to a workspace root and an ExecutionEnv (OS or sandbox).
type Result ¶
Result holds process output from a terminal or code run.
func RunCode ¶
func RunCode(ctx context.Context, cfg Config, language, code, filename, workdir string, stdin []byte) (Result, error)
RunCode writes source under .flowbot-run and invokes a language interpreter. stdin is optional process standard input passed through ExecOptions.
func RunEntrypoint ¶ added in v0.99.0
func RunEntrypoint(ctx context.Context, cfg Config, entrypoint, source string, stdin []byte, processEnv []string) (Result, error)
RunEntrypoint writes entrypoint at workspace root (main.py|main.sh|main.go), optional go.mod for go, and runs with stdin + env vars. It does not use .flowbot-run.
Click to show internal directories.
Click to hide internal directories.