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

command

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 17 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"`
	SkillRef       string            `json:"skill_ref,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 is the stable exec_command input contract.

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 describes the actual command runtime. Non-Windows hosts only accept zero values.

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"`
}

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"`
}

type SkillLease added in v0.9.0

type SkillLease struct {
	Name         string
	Root         string
	EnvScope     *envstore.Scope
	SkillDataDir string
	RuntimeEnv   map[string]string
	Release      func()
}

type SkillResolver

type SkillResolver func(ctx context.Context, skillRef string) (SkillLease, 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