Documentation
¶
Index ¶
- Constants
- Variables
- func CopyOpenCodeProbeEnvironment(env []string) ([]string, error)
- func IsNotFound(err error) bool
- func OpenCodeProbeEnvironment() []string
- func OpenCodeRootIdentity(root string) string
- type Detector
- func (detector Detector) Detect(ctx context.Context) ([]domain.DetectedClient, error)
- func (detector Detector) DetectTargetsWithVersionProbe(ctx context.Context, targets []domain.ClientID) ([]domain.DetectedClient, error)
- func (detector Detector) DetectWithVersionProbe(ctx context.Context) ([]domain.DetectedClient, error)
- type ProbeEvidence
- type ProbeTarget
Constants ¶
const IsolatedOpenCodeProbeTimeout = 30 * time.Second
IsolatedOpenCodeProbeTimeout allows cold native startup without permitting callers to extend the isolated probe's finite budget.
const OpenCodeProbeTimeout = 10 * time.Second
Variables ¶
Functions ¶
func CopyOpenCodeProbeEnvironment ¶
CopyOpenCodeProbeEnvironment validates and canonicalizes an independent copy. Case-equivalent duplicates are rejected on all platforms to keep snapshots portable. An empty PATH is valid and never replaced with ambient PATH.
func IsNotFound ¶
func OpenCodeProbeEnvironment ¶
func OpenCodeProbeEnvironment() []string
OpenCodeProbeEnvironment captures only process-launch variables. It does not inspect HOME, provider, config, or credential variables. New pins this copy.
func OpenCodeRootIdentity ¶
OpenCodeRootIdentity resolves existing ancestors even when the selected config root has not been created yet. Ordinary directory creation preserves it.
Types ¶
type Detector ¶
type Detector struct {
HomeDir string
WorkingDir string
GOOS string
Environment map[string]string
SystemApplicationsDir string
WindowsProgramFiles []string
LinuxApplicationDirs []string
LookPath func(string) (string, error)
Lstat func(string) (fs.FileInfo, error)
ReadDir func(string) ([]os.DirEntry, error)
EvalSymlinks func(string) (string, error)
ProbeVersionWithEnvironment func(context.Context, string, []string) (string, error)
// An explicitly injected legacy probe overrides the OS probe. It cannot
// carry a profile environment, so clients requiring one remain unprobed.
// Use ProbeVersionWithEnvironment and leave ProbeVersion nil for those clients.
ProbeVersion func(context.Context, string) (string, error)
VersionTimeout time.Duration
TargetedVersionTimeout time.Duration
// Registry supplies the client adapters that know where each client keeps
// its surfaces. It is injected by the composition root and never defaulted
// to "every client": that would link every adapter into any binary that
// merely detects clients.
Registry *clients.Registry
}
func NewOS ¶
NewOS builds the detector for the machine it runs on. The registry stays unset on purpose - only the composition root decides which clients a binary knows about, so it assigns Registry before the detector is used.
func (Detector) DetectTargetsWithVersionProbe ¶
func (Detector) DetectWithVersionProbe ¶
func (detector Detector) DetectWithVersionProbe(ctx context.Context) ([]domain.DetectedClient, error)
DetectWithVersionProbe is reserved for explicit lifecycle resolution that needs the installed client version to bind signed Directory evidence. Detect itself is strictly observational and never executes a discovered binary.
type ProbeEvidence ¶
type ProbeEvidence struct {
opencodehost.VersionEvidence
Reason string
}
func ProbeIsolatedOpenCodeTarget ¶
func ProbeIsolatedOpenCodeTarget(ctx context.Context, target ProbeTarget) (ProbeEvidence, error)
ProbeIsolatedOpenCodeTarget uses private HOME, XDG and temporary roots and an empty OpenCode configuration. It accepts the same strict launch environment and native executable authority as ProbeOpenCodeTarget. No caller-provided config or credential overrides are accepted, and cleanup follows process Wait.
func ProbeOpenCodeTarget ¶
func ProbeOpenCodeTarget(ctx context.Context, target ProbeTarget) (ProbeEvidence, error)
ProbeOpenCodeTarget supports native executable bytes and bounded symlinks to native bytes only. Scripts/npm shims are deliberately unverified and are not executed. Runtime authority is checked both sides of the version invocation.
type ProbeTarget ¶
type ProbeTarget struct {
Executable string `json:"-"`
Environment []string `json:"-"`
Timeout time.Duration `json:"-"`
}
ProbeTarget never selects an executable from PATH. Timeout may shorten the selected probe's fixed maximum. Environment contains one PATH and no config.
func (ProbeTarget) Clone ¶
func (t ProbeTarget) Clone() ProbeTarget