Documentation
¶
Index ¶
- func BuildBaseEnv(extraEnv map[string]string) []string
- func BuildRunEnv(baseEnv []string, extraEnv []string, modelEnv map[string]string) []string
- func LerosMCPTokenEnvVar() string
- func NormalizeMCPServerConfig(cfg agent.MCPServerConfig) agent.MCPServerConfig
- func ResolveRunWorkDir(workDir string) (string, error)
- func RunCLICommand(ctx context.Context, cliPath string, args []string, extraEnv []string) error
- func ScanJSONLines(r io.Reader, visit func(line string) bool)
- type CmdProcess
- type Process
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBaseEnv ¶
BuildBaseEnv 返回当前环境并附加额外的环境变量。
func BuildRunEnv ¶
BuildRunEnv 为 CLI 进程组装环境变量条目。
func LerosMCPTokenEnvVar ¶
func LerosMCPTokenEnvVar() string
LerosMCPTokenEnvVar returns the env var name used for CLI MCP bearer token registration.
func NormalizeMCPServerConfig ¶
func NormalizeMCPServerConfig(cfg agent.MCPServerConfig) agent.MCPServerConfig
NormalizeMCPServerConfig fills defaults for an MCP server registration.
func ResolveRunWorkDir ¶
ResolveRunWorkDir returns the configured run workdir.
func RunCLICommand ¶
RunCLICommand runs a CLI command with a bounded timeout.
Types ¶
type CmdProcess ¶
type CmdProcess struct {
// contains filtered or unexported fields
}
CmdProcess 实现 os/exec.Cmd 的 Process 接口。
func NewCmdProcess ¶
func NewCmdProcess(cmd *exec.Cmd, done <-chan struct{}) *CmdProcess
NewCmdProcess 将 cmd 和调用方拥有的 Wait 完成信号包装为 Process。 调用方必须保持 cmd.Wait() 的唯一所有权,并在 Wait 返回后关闭 done。
func (*CmdProcess) Stop ¶
func (p *CmdProcess) Stop() error
Stop 优雅地终止子进程,不调用 cmd.Wait 或 cmd.Process.Wait。
关闭流程:
- 发送 SIGTERM 请求子进程自行清理
- 等待 gracefulShutdownTimeout
- 超时则强制 SIGKILL
Stop 是幂等的,多次调用安全。
Click to show internal directories.
Click to hide internal directories.