orca.ai/pkg/sandbox/sandbox.go
大森 6b94476347 Initial commit: Orca Agent Framework
Core features:
- Microkernel architecture with Actor model
- Session management with JSONL persistence
- Tool system (5 built-in tools)
- Skill system with SKILL.md parsing
- Sandbox security execution
- Ollama integration with gemma4:e4b
- Prompt-based tool calling (compatible with native function calling)
- REPL interface

11 packages, all tests passing
2026-05-08 00:55:48 +08:00

29 lines
1.1 KiB
Go

// Package sandbox provides a secure execution environment for running commands.
//
// The sandbox restricts resource usage (timeout, output size, working directory)
// and environment variable access to prevent runaway or malicious commands.
// This is the execution backend used by the Tool system's built-in exec tool.
package sandbox
import (
"context"
)
// Result holds the output and exit status of a sandboxed command execution.
type Result struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
}
// Sandbox defines the interface for command execution environments.
//
// Implementations may use OS processes (os/exec), containers, or other
// isolation mechanisms. The context controls cancellation and timeouts.
type Sandbox interface {
// Execute runs a command with the given arguments inside the sandbox.
// The context can be used to set timeouts or cancel the execution.
// Returns the combined output, error output, and exit code.
Execute(ctx context.Context, cmd string, args ...string) (*Result, error)
}