sandbox: single config, no named profiles
Removed the named sandbox concept. One config file: sandbox.yaml (installed to ~/.config/ollie/sandbox.yaml). Removed sandbox-remote.yaml, moved restricted.yaml to doc/ as a sample. Removed the 'sandbox' arg from tool dispatch.
This commit is contained in:
parent
d06183c8d5
commit
b01dbdfba8
|
|
@ -57,7 +57,6 @@ func ExecuteTool(ctx context.Context, info toolsrv.ToolInfo, args json.RawMessag
|
|||
// Extract dispatch-level flags from args
|
||||
bypassed := false
|
||||
timeout := cfg.Timeout // 0 = no timeout; caller sets default
|
||||
sandboxName := "default"
|
||||
|
||||
var argMap map[string]interface{}
|
||||
if err := json.Unmarshal(args, &argMap); err == nil {
|
||||
|
|
@ -82,12 +81,7 @@ func ExecuteTool(ctx context.Context, info toolsrv.ToolInfo, args json.RawMessag
|
|||
}
|
||||
delete(argMap, "timeout")
|
||||
}
|
||||
if s, ok := argMap["sandbox"]; ok {
|
||||
if v, ok := s.(string); ok && v != "" {
|
||||
sandboxName = v
|
||||
}
|
||||
delete(argMap, "sandbox")
|
||||
}
|
||||
delete(argMap, "sandbox") // ignored, single config
|
||||
args, _ = json.Marshal(argMap)
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +109,7 @@ func ExecuteTool(ctx context.Context, info toolsrv.ToolInfo, args json.RawMessag
|
|||
bypassCode := fmt.Sprintf("cat <<'OLLIE_EOF' | %s\n%s\nOLLIE_EOF", toolPath, stdinData)
|
||||
result, err = executeBypassDirect(ctx, bypassCode, cwd, cfg.Env, timeout, false)
|
||||
} else {
|
||||
result, err = executeSandboxed(ctx, toolPath, stdinData, cwd, cfg.Env, timeout, sandboxName, cfg.Yolo, cfg.Output, cfg.Started)
|
||||
result, err = executeSandboxed(ctx, toolPath, stdinData, cwd, cfg.Env, timeout, cfg.Yolo, cfg.Output, cfg.Started)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -130,13 +124,13 @@ func ExecuteTool(ctx context.Context, info toolsrv.ToolInfo, args json.RawMessag
|
|||
}
|
||||
|
||||
// executeSandboxed runs a tool script inside the sandbox.
|
||||
func executeSandboxed(ctx context.Context, toolPath, stdinData, cwd string, envExtra map[string]string, timeout int, sandboxName string, yolo bool, streamOut io.Writer, started chan *os.Process) (string, error) {
|
||||
func executeSandboxed(ctx context.Context, toolPath, stdinData, cwd string, envExtra map[string]string, timeout int, yolo bool, streamOut io.Writer, started chan *os.Process) (string, error) {
|
||||
var sandboxCfg *sandbox.Config
|
||||
if !yolo {
|
||||
cfgPath := filepath.Join(paths.CfgDir(), "sandbox", sandboxName+".yaml")
|
||||
cfgPath := filepath.Join(paths.CfgDir(), "sandbox.yaml")
|
||||
f, err := os.Open(cfgPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("sandbox %q not found: %w", sandboxName, err)
|
||||
return "", fmt.Errorf("sandbox config not found: %w", err)
|
||||
}
|
||||
defer f.Close()
|
||||
var loadErr error
|
||||
|
|
|
|||
|
|
@ -50,9 +50,6 @@ type AdvancedConfig struct {
|
|||
AddExec bool `yaml:"add_exec"`
|
||||
}
|
||||
|
||||
// defaultSandbox is the sandbox config used when none is specified
|
||||
const defaultSandbox = "default"
|
||||
|
||||
// EnvFunc looks up an environment variable by name.
|
||||
type EnvFunc func(string) string
|
||||
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
# Default sandbox config for ollie-remote.
|
||||
# Simpler than local — only needs project execution access.
|
||||
filesystem:
|
||||
ro:
|
||||
- "/etc"
|
||||
- "/proc"
|
||||
- "/sys"
|
||||
- "/dev"
|
||||
- "{HOME}/.ssh/known_hosts"
|
||||
- "{HOME}/.gitconfig"
|
||||
- "{HOME}/.netrc"
|
||||
rw:
|
||||
- "/dev/null"
|
||||
- "/dev/zero"
|
||||
- "/dev/urandom"
|
||||
- "/dev/random"
|
||||
rox:
|
||||
- "/usr"
|
||||
- "/lib"
|
||||
- "/lib64"
|
||||
- "/bin"
|
||||
- "/sbin"
|
||||
- "{HOME}/bin"
|
||||
- "{HOME}/go/bin"
|
||||
- "{HOME}/.cargo/bin"
|
||||
- "{HOME}/.local/bin"
|
||||
- "{HOME}/.nvm"
|
||||
- "{HOME}/.pyenv"
|
||||
- "{XDG_CONFIG_HOME}/ollie/tools"
|
||||
rwx:
|
||||
- "{CWD}"
|
||||
- "{TMPDIR}"
|
||||
- "/tmp"
|
||||
- "{HOME}/.cache"
|
||||
- "{HOME}/go"
|
||||
- "{HOME}/.cargo"
|
||||
- "{HOME}/.npm"
|
||||
env:
|
||||
- PATH
|
||||
- HOME
|
||||
- TMPDIR
|
||||
- GOPATH
|
||||
- GOBIN
|
||||
- XDG_CONFIG_HOME
|
||||
- XDG_DATA_HOME
|
||||
- SSH_AUTH_SOCK
|
||||
network:
|
||||
unrestricted: true
|
||||
general:
|
||||
best_effort: true
|
||||
4
justfile
4
justfile
|
|
@ -126,9 +126,7 @@ install-data:
|
|||
install -m644 data/prompts/agent-theo.md {{cfg}}/prompts/agent-theo.md
|
||||
install -m644 data/prompts/user-preferences.md {{cfg}}/prompts/user-preferences.md
|
||||
# Sandbox
|
||||
mkdir -p {{cfg}}/sandbox
|
||||
install -m644 cmd/toolsrv/internal/sandbox/default.yaml {{cfg}}/sandbox/default.yaml
|
||||
install -m644 cmd/toolsrv/internal/sandbox/restricted.yaml {{cfg}}/sandbox/restricted.yaml
|
||||
install -m644 cmd/toolsrv/internal/sandbox/sandbox.yaml {{cfg}}/sandbox.yaml
|
||||
# Skills
|
||||
mkdir -p {{cfg}}/skills/acme-api {{cfg}}/skills/agent-kb {{cfg}}/skills/duckduckgo-search {{cfg}}/skills/github-cli {{cfg}}/skills/rc-shell \
|
||||
{{cfg}}/skills/web-dev-browser-screencapture {{cfg}}/skills/write-skills
|
||||
|
|
|
|||
Loading…
Reference in New Issue