Help us shape the future of Go! Take the 2026 Go Developer Survey

command

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolExecCommand    = "exec_command"
	ToolSessionObserve = "session_observe"
	ToolSessionAct     = "session_act"
)
View Source
const MaxOutputBytes = maxCommandOutputBytes

MaxOutputBytes is the public exec/session output contract limit used by schema generation.

Variables

This section is empty.

Functions

func AddRuntimeProperties

func AddRuntimeProperties(_ map[string]any)

func Description

func Description() string

func InputSchema added in v0.8.2

func InputSchema(name string) (map[string]any, bool)

func OutputSchema added in v0.8.2

func OutputSchema(name string) (map[string]any, bool)

func WorkdirDescription

func WorkdirDescription() string

Types

type CommandContext

type CommandContext func() (context.Context, error)

type ConfigProvider

type ConfigProvider func() config.Config

type ExecRequest added in v0.8.2

type ExecRequest struct {
	RuntimeOptions
	Cmd            string            `json:"cmd"`
	Workdir        string            `json:"workdir,omitempty"`
	Skill          string            `json:"skill,omitempty"`
	SkillEnv       string            `json:"skill_env,omitempty"`
	Env            map[string]string `json:"env,omitempty"`
	TimeoutMS      *int              `json:"timeout_ms,omitempty"`
	ExecutionMode  string            `json:"execution_mode,omitempty"`
	YieldTimeMS    *int              `json:"yield_time_ms,omitempty"`
	MaxOutputBytes *int              `json:"max_output_bytes,omitempty"`
	Stdin          string            `json:"stdin,omitempty"`
	TTY            bool              `json:"tty,omitempty"`
}

ExecRequest 是 exec_command 进入命令核心后的稳定输入契约。 可选整数使用指针保留“未提供”和“显式提供 0”的区别,例如 yield_time_ms=0。

type Result

type Result = toolcore.Result

type RuntimeOptions added in v0.8.2

type RuntimeOptions struct {
	Runtime         string `json:"runtime,omitempty"`
	WSLDistribution string `json:"wsl_distribution,omitempty"`
}

RuntimeOptions 描述命令实际执行环境。非 Windows 主机只接受零值。

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(configProvider ConfigProvider, ws *workspace.Workspace, envs *envstore.Store, resolveSkill SkillResolver, commandContext CommandContext) *Service

func (*Service) Act

func (s *Service) Act(request SessionActRequest) (Result, error)

func (*Service) BeginClose added in v0.8.1

func (s *Service) BeginClose()

BeginClose 先关闭新的 command reservation 入口。 Runtime 会在取消共享 commandCtx 之前等待 startup 窗口排空,避免半启动进程被抢占。

func (*Service) Close

func (s *Service) Close() error

func (*Service) CommandEnv

func (s *Service) CommandEnv(skillName string, extra map[string]string) ([]string, error)

func (*Service) Exec

func (svc *Service) Exec(ctx context.Context, request ExecRequest) (Result, error)

func (*Service) InternalCommandEnv

func (s *Service) InternalCommandEnv(extra map[string]string) ([]string, error)

func (*Service) Observe

func (s *Service) Observe(request SessionObserveRequest) (Result, error)

func (*Service) WaitForStarts added in v0.8.1

func (s *Service) WaitForStarts() error

type SessionActRequest added in v0.8.2

type SessionActRequest struct {
	Action         string `json:"action,omitempty"`
	SessionID      string `json:"session_id,omitempty"`
	Chars          string `json:"chars,omitempty"`
	MaxOutputBytes *int   `json:"max_output_bytes,omitempty"`
}

SessionActRequest 是 session_act 的强类型输入。

type SessionObserveRequest added in v0.8.2

type SessionObserveRequest struct {
	Action         string `json:"action,omitempty"`
	SessionID      string `json:"session_id,omitempty"`
	MaxOutputBytes *int   `json:"max_output_bytes,omitempty"`
}

SessionObserveRequest 是 session_observe 的强类型输入。

type SkillResolver

type SkillResolver func(skill string) (string, error)

type ToolError

type ToolError = toolcore.ToolError

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL