Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is set at build time via -ldflags.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the default path for the agent config file.
func RunConnect ¶ added in v0.6.1
func RunConnect(opts ConnectOptions)
RunConnect executes the agent connect workflow.
func SaveConfig ¶
SaveConfig writes the agent config to disk.
Types ¶
type AgentInfoData ¶ added in v0.16.0
type AgentInfoData struct {
Hostname string `json:"hostname"`
OS string `json:"os"`
Platform string `json:"platform"`
PlatformVersion string `json:"platform_version"`
KernelArch string `json:"kernel_arch"`
CPUModelName string `json:"cpu_model_name"`
CPUCountLogical int `json:"cpu_count_logical"`
MemoryTotal uint64 `json:"memory_total"`
DiskTotal uint64 `json:"disk_total"`
DiskFree uint64 `json:"disk_free"`
AgentVersion string `json:"agent_version"`
OpencodeVersion string `json:"opencode_version"`
HostInfo *host.InfoStat `json:"host_info,omitempty"`
CPUInfo *cpuInfoDetail `json:"cpu_info,omitempty"`
MemoryInfo *mem.VirtualMemoryStat `json:"memory_info,omitempty"`
DiskInfo *disk.UsageStat `json:"disk_info,omitempty"`
}
AgentInfoData is the system info payload sent from agent to server.
type Client ¶
type Client struct {
ServerURL string
SandboxID string
TunnelToken string
OpencodeURL string
OpencodeToken string
// contains filtered or unexported fields
}
Client is the cli-agent tunnel client that connects to the server and forwards HTTP requests to a local opencode instance.
type Config ¶
type Config struct {
Server string `json:"server"`
SandboxID string `json:"sandbox_id"`
TunnelToken string `json:"tunnel_token"`
WorkspaceID string `json:"workspace_id"`
Name string `json:"name"`
}
Config holds the local agent's persistent configuration.
func LoadConfig ¶
LoadConfig reads the agent config from disk.
type ConnectOptions ¶ added in v0.6.1
type ConnectOptions struct {
Server string
Code string
Name string
OpencodeURL string
OpencodeURLSet bool // true if --opencode-url was explicitly provided
OpencodeToken string
ConfigPath string
AutoStart bool
OpencodeBin string
OpencodePort int
}
ConnectOptions holds all flags for the connect command.
type OpencodeProcess ¶
type OpencodeProcess struct {
Port int
// contains filtered or unexported fields
}
OpencodeProcess manages a local opencode serve subprocess.
func StartOpencode ¶
func StartOpencode(bin string, port int, password string) (*OpencodeProcess, error)
StartOpencode starts "opencode serve --hostname 127.0.0.1 --port {port}" as a child process. It returns immediately after starting the process.
func (*OpencodeProcess) Stop ¶
func (p *OpencodeProcess) Stop()
Stop sends SIGTERM to the child process, waits briefly, then sends SIGKILL if needed.
func (*OpencodeProcess) WaitReady ¶
WaitReady polls http://localhost:{port}/ every 500ms until a response is received or the timeout expires.