Documentation
¶
Overview ¶
Adapted from sailry-code 67ae9fa0. See third_party_licenses/sailry-code-terminal.md.
Portions adapted from ADK-Rust 675c02b6c0df6d632b953a06a5a12d1f814b7780. Copyright 2026 Zavora Technologies Ltd.; Apache-2.0. See third_party_licenses/adk-LICENSE.
Package process owns execution-Node command lifetime and bounded output.
Index ¶
- Constants
- func SandboxSupported() bool
- type Environment
- type Finished
- type Launch
- type Options
- type Service
- func (s *Service) Close() error
- func (s *Service) CloseSession(ctx context.Context, session protocol.SessionID) ([]protocol.ProcessInfo, error)
- func (s *Service) Execute(ctx context.Context, launch Launch) (protocol.ProcessCompletion, error)
- func (s *Service) ExecutePromotable(ctx context.Context, launch Launch, promotion <-chan struct{}) (protocol.Output, error)
- func (s *Service) List(session protocol.SessionID) []protocol.ProcessInfo
- func (s *Service) Page(session protocol.SessionID, id protocol.RequestID, ...) (protocol.ProcessOutputOutputPage, error)
- func (s *Service) Preview(session protocol.SessionID, id protocol.RequestID, head bool) (map[string]any, error)
- func (s *Service) Read(session protocol.SessionID, id protocol.RequestID) (protocol.ProcessSnapshot, error)
- func (s *Service) SandboxTerminal(root string, command, environment []string) ([]string, []string, func(), error)
- func (s *Service) Start(launch Launch) (protocol.ProcessInfo, error)
- func (s *Service) Stop(session protocol.SessionID, id protocol.RequestID) (protocol.ProcessSnapshot, error)
- func (s *Service) StopAll(session protocol.SessionID) []protocol.ProcessInfo
- func (s *Service) Subscribe(session protocol.SessionID) (<-chan []protocol.ProcessInfo, func())
- func (s *Service) Wait(ctx context.Context, session protocol.SessionID, id protocol.RequestID, ...) error
- func (s *Service) Write(session protocol.SessionID, id protocol.RequestID, input string) (uint64, error)
- type Stalled
Constants ¶
const StallWindow = 15 * time.Minute
StallWindow is how long a running background command may stay silent before its session is asked to decide about it.
Variables ¶
This section is empty.
Functions ¶
func SandboxSupported ¶
func SandboxSupported() bool
SandboxSupported reports whether the compiled platform has a workspace sandbox. A missing sandbox launcher still fails execution without broadening access.
Types ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment freezes the Node's startup shell environment, outside tools.
func CaptureEnvironment ¶
func CaptureEnvironment(ctx context.Context) Environment
CaptureEnvironment runs the source's bounded login capture once at Node start. Tool calls reuse this snapshot and never rerun a user's shell profiles.
func NewEnvironment ¶
func NewEnvironment(values []string) Environment
NewEnvironment never starts a shell, so deterministic tests can use fixtures.
func (Environment) Shell ¶
func (environment Environment) Shell() string
func (Environment) TerminalValues ¶
func (environment Environment) TerminalValues() []string
type Finished ¶
type Finished struct {
Snapshot protocol.ProcessSnapshot
ElapsedMs *uint64
Explicit bool
}
Finished is persisted by the existing Node writer before completion publishes.
type Launch ¶
type Launch struct {
ID protocol.RequestID
Session protocol.SessionID
Turn protocol.TurnID
Worktree protocol.WorktreeID
Root string
Profile string
Command string
Access protocol.ProcessAccess
Cwd string
TimeoutMs uint64
Pty bool
Background bool
Scratch string
Inputs string
Environment map[string]string
Release func()
CompletionGate <-chan struct{}
// contains filtered or unexported fields
}
type Options ¶
type Options struct {
Context context.Context
Profile string
Environment Environment
Now func() time.Time
After func(time.Duration) <-chan time.Time
Finished func(context.Context, Finished) error
// Stalled, when set, receives each silent period of a running background
// command once; output starts the next period.
Stalled func(context.Context, Stalled) error
Changed func(protocol.WorktreeID)
CaptureManaged func(string) (string, error)
// Working, when set, brackets every running command.
Working func() func()
Run func(context.Context, Launch, func(protocol.ProcessOutputOutputStream, []byte), <-chan []byte) (protocol.ProcessCompletion, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CloseSession ¶
func (*Service) ExecutePromotable ¶
func (s *Service) ExecutePromotable(ctx context.Context, launch Launch, promotion <-chan struct{}) (protocol.Output, error)
ExecutePromotable returns the original command result, or transfers that same running command to session ownership when the caller's guidance boundary opens. CompletionGate, when supplied, opens after the promoted receipt commits.
func (*Service) Preview ¶
func (s *Service) Preview(session protocol.SessionID, id protocol.RequestID, head bool) (map[string]any, error)
Preview freezes bounded model metadata without changing the command capture. Head is requested only for background snapshots, whose captures own the tail.
func (*Service) SandboxTerminal ¶
func (s *Service) SandboxTerminal(root string, command, environment []string) ([]string, []string, func(), error)
SandboxTerminal wraps a workspace terminal's program in the command sandbox. The returned variables follow the terminal's own environment, and release removes the private state once the terminal has ended.
func (*Service) StopAll ¶
func (s *Service) StopAll(session protocol.SessionID) []protocol.ProcessInfo
func (*Service) Subscribe ¶
func (s *Service) Subscribe(session protocol.SessionID) (<-chan []protocol.ProcessInfo, func())
type Stalled ¶
type Stalled struct {
Snapshot protocol.ProcessSnapshot
ElapsedMs uint64
}
Stalled is one silent period of a still-running background command.
Source Files
¶
- account_linux.go
- account_unix.go
- encoding_unix.go
- environment.go
- environment_unix.go
- group_linux.go
- groups_linux.go
- groups_unix.go
- native.go
- native_unix.go
- output.go
- preview.go
- retained.go
- sandbox.go
- sandbox_linux.go
- sandbox_repositories.go
- sandbox_support.go
- sandbox_terminal_linux.go
- sandbox_toolchains.go
- service.go
- services.go
- types.go