Documentation
¶
Index ¶
- Constants
- Variables
- func BashModelResult(ctx context.Context, ws workspace.Service, workDir string, out BashStreams, ...) (string, error)
- func BashToolDescription() string
- func CombineStdoutStderr(stdout, stderr string) string
- func FormatBashModelText(ctx context.Context, ws workspace.Service, trunc TailTruncation, ...) string
- func ResolveRunTimeout(perCall *float64, configSeconds int) (time.Duration, error)
- func SlashCommandText(stdout, stderr string, exitCode int) string
- func ValidateTimeoutSeconds(timeout *float64) error
- func WriteBashSpill(workDir string, full string) (absPath string, err error)
- type BashStreams
- type TailTruncation
- type TimeoutError
Constants ¶
const ( DefaultMaxLines = 2000 DefaultMaxBytes = 50 * 1024 )
DefaultMaxLines and DefaultMaxBytes match pi coding-agent bash/read truncation.
Variables ¶
var ErrShellCancelled = errors.New("shell cancelled")
ErrShellCancelled marks a shell command stopped by context cancellation.
Functions ¶
func BashModelResult ¶
func BashModelResult(ctx context.Context, ws workspace.Service, workDir string, out BashStreams, runErr error) (string, error)
BashModelResult formats combined output for the bash tool (pi coding-agent semantics).
func BashToolDescription ¶
func BashToolDescription() string
BashToolDescription matches pi coding-agent / durable bash tool description.
func CombineStdoutStderr ¶
CombineStdoutStderr merges process streams in order (stdout then stderr).
func FormatBashModelText ¶
func FormatBashModelText(ctx context.Context, ws workspace.Service, trunc TailTruncation, spillAbs string) string
FormatBashModelText builds model-visible bash output with pi-style truncation hints.
func ResolveRunTimeout ¶
ResolveRunTimeout returns the limit for a command: per-call wins, else configSeconds when > 0.
func SlashCommandText ¶
SlashCommandText formats /shell output (combined streams + optional exit suffix).
func ValidateTimeoutSeconds ¶
ValidateTimeoutSeconds checks per-call timeout (pi bash tool).
Types ¶
type BashStreams ¶
BashStreams is raw subprocess output before pi-style formatting.
type TailTruncation ¶
type TailTruncation struct {
Content string
Truncated bool
TruncatedBy string // "", "lines", or "bytes"
TotalLines int
TotalBytes int
OutputLines int
OutputBytes int
LastLinePartial bool
MaxLines int
MaxBytes int
}
TailTruncation describes pi-style tail truncation of combined shell output.
func TruncateTail ¶
func TruncateTail(content string, maxLines, maxBytes int) TailTruncation
TruncateTail keeps the last maxLines/maxBytes of content (pi truncateTail).
type TimeoutError ¶
type TimeoutError struct {
Seconds float64
}
TimeoutError is returned when a shell command hits its time limit.
func AsTimeoutError ¶
func AsTimeoutError(err error) (*TimeoutError, bool)
AsTimeoutError reports whether err is a TimeoutError.
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string