facts

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package facts is STABLE — local and remote cluster fact collection. It is part of the stable operator path.

Index

Constants

View Source
const LlamaServerDiscoveryScript = `` /* 1891-byte string literal not displayed */

LlamaServerDiscoveryScript is the bash script used to detect a running llama-server process, extract its loaded model from the command line, and report it as a resident model. Works locally and over SSH.

pgrep is trimmed to a single PID with | head -1 to handle multiple instances deterministically. The --model/-m flag is parsed with awk to handle both --model=path and --model path forms and avoid fragile column assumptions.

View Source
const MLXDiscoveryScript = `` /* 1872-byte string literal not displayed */

MLXDiscoveryScript detects a running mlx_lm.server process and queries its OpenAI-compatible /v1/models endpoint to enumerate resident models.

mlx_lm is a Python package (pip install mlx-lm), so python3 is used for JSON parsing — it is always present on any node that can run MLX. The server defaults to port 8080; the script respects an explicit --port argument.

Note: llama-server also defaults to port 8080. On nodes running both, only the first server to bind the port will be reachable; the other probe will return an empty resident-model list rather than an error.

View Source
const OllamaDiscoveryScript = `` /* 1797-byte string literal not displayed */

OllamaDiscoveryScript is the bash script used to robustly discover Ollama state and models across both local and remote nodes.

Variables

This section is empty.

Functions

func DiscoverTools

func DiscoverTools(ctx context.Context) []models.ToolInfo

DiscoverTools probes for installed tools on the local machine. Silent failure allowed — missing tools are simply not reported.

Types

type Collector

type Collector interface {
	Collect(ctx context.Context) (*models.NodeFacts, error)
}

Collector collects facts from a node. Implementations: LocalCollector (direct), RemoteCollector (SSH-based, temporary).

type LocalCollector

type LocalCollector struct {
	Name string
	Role string
}

LocalCollector collects facts from the local machine.

func NewLocalCollector

func NewLocalCollector(name, role string) *LocalCollector

NewLocalCollector creates a collector for the local node.

func (*LocalCollector) Collect

func (c *LocalCollector) Collect(ctx context.Context) (*models.NodeFacts, error)

Collect gathers all facts from the local machine. Tolerates missing values — degrades to partial, never crashes.

type RemoteCollector

type RemoteCollector struct {
	NodeName string
	Role     string
	Hostname string
	Exec     transport.Executor
}

RemoteCollector collects facts from a remote node via SSH. The Executor interface keeps the collection path decoupled from the current transport implementation.

func NewRemoteCollector

func NewRemoteCollector(name, role, hostname string, exec transport.Executor) *RemoteCollector

NewRemoteCollector creates a remote fact collector.

func (*RemoteCollector) Collect

func (c *RemoteCollector) Collect(ctx context.Context) (*models.NodeFacts, error)

Collect gathers facts from the remote node. Maps failures precisely:

  • connect/first-command fail → unreachable
  • subsequent command fail → partial

Jump to

Keyboard shortcuts

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