harnessprobe

package
v0.6.1017-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package harnessprobe describes the host-run harness behind an adapter name on this machine: whether its executable resolves (from the operator policy's harness.<name>.path, PATH, or the adapter's well-known install locations), which release it is, and whether the endpoint the policy points it at is one the run's proxy would let through. It reads, and executes nothing but the harness's own version flag; it writes nothing.

`agentry doctor --adapter <name>` renders these facts as checks, and the desktop's first-run wizard reads them for its Coding agent step: one probe, two callers, the way the two clients already share the policy and install code. The wording of a warning lives here for the same reason: two renderings of one fact would drift.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	// BaseURL is the policy's value, with any userinfo redacted; a client
	// may show it.
	BaseURL string `json:"baseUrl"`
	// HostPort is what the proxy would see in the CONNECT; "" when the
	// URL did not parse.
	HostPort string `json:"hostPort,omitempty"`
	// Valid is false when BaseURL did not parse as a URL with a host.
	Valid bool `json:"valid"`
	// Allowed is true when HostPort is listed in model.proxyAllow.
	Allowed bool `json:"allowed"`
}

Endpoint is harness.<name>.baseUrl held against model.proxyAllow.

type Result

type Result struct {
	// Adapter is the name that was asked about.
	Adapter string `json:"adapter"`
	// Known is false when no adapter of that name is registered.
	Known bool `json:"known"`
	// Host is true for a harness that runs as a process on this machine
	// (claude, codex); false for a containerised adapter (docker-agent).
	Host bool `json:"host"`
	// Executable is the program name the adapter resolves on PATH.
	Executable string `json:"executable,omitempty"`
	// DisplayName is the product's name for a person ("Claude Code").
	DisplayName string `json:"displayName,omitempty"`
	// InstallURL is the vendor's page for getting the harness, for a
	// client to show when Found is false.
	InstallURL string `json:"installUrl,omitempty"`
	// MCPCommand is the documented line that registers agentry-mcp with
	// this host, for a client to show and copy, never to run.
	MCPCommand string `json:"mcpCommand,omitempty"`
	// Path is the executable that resolved: it exists, though it may not
	// run (then VersionError says so). "" when Found is false.
	Path string `json:"path,omitempty"`
	// PathFromPolicy is true when Path came from harness.<name>.path —
	// Source == SourcePolicy, kept because the desktop reads this field
	// today (agentry-desktop internal/run/harness.go); drop it once the
	// desktop reads Source.
	PathFromPolicy bool `json:"pathFromPolicy,omitempty"`
	// Source says where Path was found: the policy, PATH, or one of the
	// adapter's well-known install locations. "" when Found is false.
	Source Source `json:"source,omitempty"`
	// Found is true when an executable resolved.
	Found bool `json:"found"`
	// Reason says why Known or Found is false, in the run's own words.
	Reason string `json:"reason,omitempty"`
	// Version is the first line the harness printed on stdout for its
	// version flag; "" when it could not be read.
	Version string `json:"version,omitempty"`
	// VersionError is why Version could not be read: the process failed
	// to start, exited non-zero (its stderr follows), or ran past the
	// deadline.
	VersionError string `json:"versionError,omitempty"`
	// WrittenAgainst is the release this adapter was written against; a
	// different installed release is a warning, never a refusal.
	WrittenAgainst string `json:"writtenAgainst,omitempty"`
	// VersionMatches is true when Version contains WrittenAgainst, or
	// the adapter names no release.
	VersionMatches bool `json:"versionMatches"`
	// Warnings are the sentences a client shows for what is true but
	// not blocking: the version could not be read, or is not the one the
	// adapter was written against. Empty when Found is false.
	Warnings []string `json:"warnings,omitempty"`
	// Endpoint is the check of harness.<name>.baseUrl against the model
	// proxy allowlist; nil when the policy sets no base URL.
	Endpoint *Endpoint `json:"endpoint,omitempty"`
}

Result is what the probe found. Zero values mean "not applicable": a Result whose Known is false names an adapter the registry does not have (Reason says so); one whose Host is false is a containerised adapter, whose readiness is its image, not an executable.

func Probe

func Probe(ctx context.Context, pol *policy.Policy, name string) Result

Probe describes the harness behind adapter name under policy pol (nil means no policy: no path override, no endpoint check). The version read honours ctx's deadline, or defaultTimeout when it has none.

type Source

type Source string

Source says where a harness executable was found. The values are wire values: doctor prints them and the desktop's Coding agent step reads them from the probe's JSON.

const (
	// SourcePolicy is the operator policy's harness.<name>.path.
	SourcePolicy Source = "policy"
	// SourcePath is the process's PATH.
	SourcePath Source = "PATH"
	// SourceKnown is one of the adapter's well-known install locations — the
	// native installer's directory, or a desktop app's bundled build — which a
	// PATH-less GUI launch never sees.
	SourceKnown Source = "known location"
)

func Find

func Find(pol *policy.Policy, name string) (path string, source Source, err error)

Find resolves the executable behind adapter name: the policy's harness.<name>.path when set (an unusable one is an error, never a fallback — the operator said where it is), else PATH, else the adapter's well-known locations in order. It reads and runs nothing but os.Stat. The engine and the probe both use it, so `agentry run` finds exactly what `agentry doctor` reported (and what the desktop's wizard showed).

func FindExecutable

func FindExecutable(pol *policy.Policy, name, command string) (string, Source, error)

FindExecutable is Find for the engine, which holds the plan's command name as well as the adapter's: when the adapter is not registered as a host harness in this build, the lookup is the same rule over that command name alone (no well-known locations, which only an adapter can name), so the run and the probe never word a refusal differently.

Jump to

Keyboard shortcuts

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