@rivus/agent-kit/discovery
detectAgents, versionFromOutput, ProbeRecipe — anywhere, with a platform
Functions
detectAgents()
function detectAgents(platform: DiscoveryPlatform, options?: DetectAgentsOptions): Promise<Installation[]>;Detects each agent from its probe recipe: its command on PATH, its application, configuration and MCP paths,
its version (by running the version probe) and its login state (see authProbe). Agents are probed
concurrently; every probe command has a time limit and runs without a shell. A check that fails is reported in the installation's
problems, and detection goes on. Throws capability-unsupported when a requested agent has no recipe; an abort
rejects with signal.reason and stops the running commands.
Parameters
platform
DiscoveryPlatform
options?
Returns
Promise<Installation[]>
versionFromOutput()
function versionFromOutput(output: CommandOutput): Version | undefined;Reads a version from a command that exited with 0 and printed something to standard output. Standard error is ignored, because agents print warnings there.
Parameters
output
Returns
Version | undefined
Interfaces
AuthReading
What one login check says. method names how the agent is logged in, such as api-key.
Properties
loggedIn
readonly loggedIn: boolean;method?
readonly method?: string;CommandOutput
What a probe command left behind: its exit code and output. Probes that timed out or did not start have none.
Properties
code
readonly code: number | null;stderr
readonly stderr: string;stdout
readonly stdout: string;DetectAgentsOptions
Properties
agents?
readonly agents?: readonly string[];Agents to detect, by id or alias; defaults to every agent in providers.discovery, in table order.
authProbe?
readonly authProbe?: "files" | "commands";Where login state comes from. files (the default) reads only credential files and environment variables, so
it works offline and changes nothing. commands also runs each agent's login status command, whose answer wins;
see each recipe's auth.command.sideEffects for what that can do.
providers?
readonly providers?: readonly Provider[];signal?
readonly signal?: AbortSignal;timeoutMs?
readonly timeoutMs?: number;Time limit of each probe command; defaults to 5 seconds.
versionProbe?
readonly versionProbe?: boolean;Whether to run each agent's version probe; defaults to true. With false nothing is run (unless authProbe
is commands), so detection has no side effects, and no agent is runnable: at most found. See each recipe's
version.sideEffects for what a probe can do.
Installation
What detection found out about one agent on this machine.
Properties
agent
readonly agent: string;appPath?
readonly appPath?: string;The first application path that exists.
auth
readonly auth: AuthState;command?
readonly command?: string;The resolved path of the agent's command on PATH.
displayName
readonly displayName: string;evidence
readonly evidence: readonly Evidence[];Every observation behind status, in probe order: command, version, application, configuration, MCP.
kind
readonly kind: InstallationKind;problems
readonly problems: readonly ProbeProblem[];Checks that could not complete.
status
readonly status: DetectionStatus;version?
readonly version?: Version;warnings
readonly warnings: readonly string[];The recipe's caveats about its own facts, and caveats about this run, such as a Windows shim it did not run.
ProbeRecipe
How discovery detects one agent. A recipe is data plus pure parsers; detectAgents does the IO. Built-in recipes
are assembled by the shell; a caller supplies its own through provider descriptors, and /testing has the
conformance checks a recipe must pass.
Properties
agent
readonly agent: string;appBundleIds?
readonly appBundleIds?: readonly string[];macOS bundle ids the application must carry, for an app name another product shares. A bundle whose
Contents/Info.plist is XML and names another id does not count; one whose id cannot be read counts by its path.
appPaths
readonly appPaths: readonly ProbePath[];Application paths; the first that exists is the agent's application.
auth?
readonly auth?: AuthProbe;commands
readonly commands: readonly string[];Executable names looked up on PATH, in order; the first found is the agent's command.
configPaths
readonly configPaths: readonly ProbePath[];Agent-owned state, session or credential paths; exclude homes and files that installers can create.
displayName
readonly displayName: string;For a built-in agent, the display name catalog gives it.
home?
readonly home?: HomeRule;The home rule of an agent that catalog does not know, for paths under its own AgentHome.
kind
readonly kind: InstallationKind;mcpConfigPaths
readonly mcpConfigPaths: readonly ProbePath[];Recipe authors must list only agent-owned MCP state, excluding shared, installer-writable configuration.
specificationVersion
readonly specificationVersion: "discovery-v1";version?
readonly version?: VersionProbe;Without a version probe, the agent is at most found.
warnings
readonly warnings: readonly string[];Caveats about the recipe's facts, such as which of them upstream sources do not confirm.
Type Aliases
ProbePath
type ProbePath =
| string
| {
agentHome: CodingAgentId;
path?: string;
};A path a probe checks: ~ or ~/… under the user's home directory, an absolute path, or path (/-separated,
relative) under the AgentHome of agentHome, which follows that agent's override variable.
ProbeProblem
type ProbeProblem = StatFailed | CommandFailed | CredentialFileFailed;A check that could not complete. Detection goes on; the problem is reported with the installation.
ProbeRecipes
type ProbeRecipes = ServiceTable<ProbeRecipe>;Probe recipes by agent id; supplied to detectAgents.