Documentation
¶
Index ¶
- Constants
- Variables
- func Command(ctx context.Context, shell, command string) (*exec.Cmd, error)
- func DefaultShell() string
- func KeyBytes(name string) string
- func KillAll()
- func ResolveShell(ctx context.Context, shell string) string
- func ScrubEnv(env []string) []string
- func SetMarkers(sessionID, model string)
- func ShellName(shell string) string
- func Spill(output string) string
- func UnsetSecretEnv()
- func WithShell(ctx context.Context, shell string) context.Context
- func WithWorkingDir(ctx context.Context, dir string) context.Context
- func WorkingDir(ctx context.Context) string
- type Options
- type Result
Constants ¶
View Source
const ( KeyEnter = "\r" KeyEsc = "\x1b" KeyTab = "\t" KeyBS = "\x7f" KeyUp = "\x1b[A" KeyDown = "\x1b[B" KeyRight = "\x1b[C" KeyLeft = "\x1b[D" )
Variables ¶
View Source
var ChildMarkers = []string{"K_BRAIN=1", "K_BRAIN=1"}
View Source
var SecretEnvVars = []string{"K_BRAIN_BACKEND_TOKEN", "K_BRAIN_COMPUTER_TOKEN"}
SecretEnvVars are credentials handed to K-brain processes by their parent. They authenticate callers of the backend API (or of the computer helper) and must never reach commands the agent runs.
Functions ¶
func Command ¶ added in v0.107.6
Command shares quoting, encoding and exit status handling across process tools.
func DefaultShell ¶
func DefaultShell() string
func ResolveShell ¶ added in v0.107.6
ResolveShell keeps explicit per-tool selection ahead of the session and platform default.
func SetMarkers ¶
func SetMarkers(sessionID, model string)
func UnsetSecretEnv ¶ added in v0.107.13
func UnsetSecretEnv()
UnsetSecretEnv removes SecretEnvVars from this process's environment, so every child started afterwards inherits an environment without them. Call it once the values have been read.
func WithWorkingDir ¶ added in v0.103.0
func WorkingDir ¶ added in v0.103.0
Types ¶
type Options ¶
type Options struct {
Command string
Dir string
Shell string
Timeout time.Duration
Interactive bool
InactivityTimeout time.Duration
OnOutput func(chunk string)
// OnUpdate receives a bounded tail snapshot when output changes.
OnUpdate func(outputTail string)
OnAwaitInput func(secLeft int)
Keys <-chan []byte
Env []string
Sandbox *sandbox.Policy
}
Click to show internal directories.
Click to hide internal directories.