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

desktopruntime

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = 1
View Source
const WindowsCoreStartTimeout = 60 * time.Second

WindowsCoreStartTimeout 是 Windows Core 从启动请求到健康端点可用的统一预算。 Scheduled Task、DPAPI 恢复和 Runtime/Plugin 初始化都可能发生在冷启动路径中; 更新、迁移和安装器必须复用同一预算,避免外层更短的健康检查提前误判并触发回滚。

Variables

This section is empty.

Functions

func ActiveCoreBinary added in v0.9.0

func ActiveCoreBinary(runtimeRoot string, manifest Manifest) string

ActiveCoreBinary 返回当前真正承载 Core 的 generation 二进制。 旧布局没有 active-version.json 时回退 manifest.agentdock_binary,保持迁移兼容。

func DefaultRuntimeRoot added in v0.7.3

func DefaultRuntimeRoot() string

DefaultRuntimeRoot 只由 macOS App 内置后台服务使用;其他平台继续要求调用方显式传入。

func DispatchControlRequest

func DispatchControlRequest(ctx context.Context, request desktopcontrol.Request, runtimeStatus ControlRuntimeStatus) (any, error)

DispatchControlRequest 是后台核心的本地控制 API。这里只暴露桌面日常管理能力, 安装、卸载和提权仍由系统安装器负责。

func OpenCoreLog added in v0.8.2

func OpenCoreLog(runtimeRoot string) (io.WriteCloser, error)

func PathForBinary

func PathForBinary(binaryPath string) string

func PrepareCoreEnvironment

func PrepareCoreEnvironment(runtimeRoot string) error

func RunConfigCommand

func RunConfigCommand(ctx context.Context, args []string, stdout, stderr io.Writer) error

func RunServiceCommand

func RunServiceCommand(ctx context.Context, args []string, stdout, stderr io.Writer) error

func RunTunnelCommand

func RunTunnelCommand(ctx context.Context, args []string, stdout, stderr io.Writer) error

func Save

func Save(path string, manifest Manifest) error

func SelectInteractiveTaskSessionID added in v0.9.0

func SelectInteractiveTaskSessionID(sessions []InteractiveSession, expectedUserSID string, currentSessionID int, currentUserSID string, consoleSessionID uint32) (int, error)

SelectInteractiveTaskSessionID 把 InteractiveToken 任务钉到确定的用户会话。 规则必须与 launch-windows-process.ps1 / 兼容垫片里的实现保持一致: UAC 提权会保留原 Session ID,优先用调用方已验证会话,避免 RDP 被重定向到 console。

Types

type ConfigUpdateRequest

type ConfigUpdateRequest struct {
	RuntimeRoot             string
	Port                    int
	LogLevel                string
	OAuthAccessTokenTTL     string
	MCPAppsMode             agentconfig.MCPAppsMode
	BrowserEnabled          bool
	BrowserCDPURL           string
	BrowserReuseExistingCDP bool
	ACPEnabled              bool
	ACPProfiles             []agentconfig.ACPProfile
	ACPDefaultProfile       string
}

ConfigUpdateRequest 是桌面端保存日常运行设置时使用的结构化请求。

type ControlRuntimeStatus added in v0.8.0

type ControlRuntimeStatus struct {
	NexusConnected bool
}

type InteractiveSession added in v0.9.0

type InteractiveSession struct {
	SessionID uint32
	State     int
	UserSID   string
}

type Manifest

type Manifest struct {
	SchemaVersion               int    `json:"schema_version"`
	InstallRoot                 string `json:"install_root,omitempty"`
	AgentDockHome               string `json:"agentdock_home,omitempty"`
	AgentDockDefaultDir         string `json:"agentdock_default_dir,omitempty"`
	AgentDockBinary             string `json:"agentdock_binary"`
	TrayBinary                  string `json:"tray_binary,omitempty"`
	AgentDockLauncher           string `json:"agentdock_launcher,omitempty"`
	AgentDockTaskName           string `json:"agentdock_task_name,omitempty"`
	PrivilegeMode               string `json:"privilege_mode,omitempty"`
	CloudflaredBinary           string `json:"cloudflared_binary,omitempty"`
	CloudflaredLauncher         string `json:"cloudflared_launcher,omitempty"`
	StartupValueName            string `json:"startup_value_name,omitempty"`
	TrayStartupValueName        string `json:"tray_startup_value_name,omitempty"`
	CloudflaredStartupValueName string `json:"cloudflared_startup_value_name,omitempty"`
	Host                        string `json:"host"`
	Port                        int    `json:"port"`
	LocalMCPURL                 string `json:"local_mcp_url"`
	TunnelMode                  string `json:"tunnel_mode"`
	PublicURL                   string `json:"public_url,omitempty"`
	InstallChannel              string `json:"install_channel"`
}

func Load

func Load(path string) (Manifest, error)

func LoadForBinary

func LoadForBinary(binaryPath string) (Manifest, error)

func (Manifest) HealthURL

func (manifest Manifest) HealthURL() string

func (Manifest) UsesScheduledTask

func (manifest Manifest) UsesScheduledTask() bool

func (Manifest) Validate

func (manifest Manifest) Validate() error

type ServiceStatus

type ServiceStatus struct {
	Running        bool `json:"running"`
	Healthy        bool `json:"healthy"`
	StartupEnabled bool `json:"startup_enabled"`
	NexusConnected bool `json:"nexus_connected"`
}

ServiceStatus 是桌面端和 CLI 共享的结构化运行状态。 生命周期操作统一返回 JSON,避免桌面端继续解析 PowerShell 文本。

type TunnelConfigureRequest

type TunnelConfigureRequest struct {
	RuntimeRoot string
	Mode        string
	ServerURL   string
	TokenFile   string
}

type TunnelStatus

type TunnelStatus struct {
	Mode             string `json:"mode"`
	Running          bool   `json:"running"`
	Ready            bool   `json:"ready"`
	StartupEnabled   bool   `json:"startup_enabled"`
	PublicURL        string `json:"public_url,omitempty"`
	DependencyState  string `json:"dependency_state,omitempty"`
	ComponentVersion string `json:"component_version,omitempty"`
}

TunnelStatus 是桌面端和 CLI 共享的结构化 Tunnel 状态。

func TunnelStatusForRuntime added in v1.0.0

func TunnelStatusForRuntime(ctx context.Context, runtimeRoot string) (TunnelStatus, error)

TunnelStatusForRuntime exposes the same local-only snapshot used by the CLI. It never downloads components or mutates Tunnel configuration.

Jump to

Keyboard shortcuts

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