harness

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package harness is part of the GoFastr harness.

See docs/harness-architecture.md for the architecture this package implements.

Package harness is the top-level composition of the GoFastr harness. The Harness struct wires every subsystem (engine, providers, tools, mcpclient, skills, context, sessions, memory, hooks, profile, control plane, clients) according to the v0.1 build order in docs/harness-architecture.md.

Boot sequence (per § Lifecycle / boot, 10 steps):

  1. CLI parses flags, picks profile, resolves XDG paths.
  2. Profile loads plugins.
  3. Context reader processes context_sources (TOFU on each).
  4. Skill registry scans paths (TOFU on each SKILL.md).
  5. ToolSources register. MCP servers spawn with sha256 verification.
  6. Credential helper starts.
  7. Control plane starts (Unix socket + optional TCP).
  8. mcpserver stdio mode reads GOFASTR_HARNESS_TOKEN if launched.
  9. Bundled clients start (TUI / web).

10. Engine waits for first SendInput.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Profile is the loaded profile (framework.toml or default.toml).
	Profile *profile.Profile

	// WorkingDir is the repo root (used for AGENTS.md walk-upward).
	WorkingDir string

	// XDGConfig and XDGState are the base config + state directories
	// (`~/.config/gofastr/harness/` and `~/.local/share/gofastr/harness/`).
	XDGConfig string
	XDGState  string

	// SkillSearchPaths overrides the default paths
	// (built-in + user-global + project-local).
	SkillSearchPaths []string

	// Logger is the operational logger.
	Logger *logging.Logger

	// AllowProjectHooks gates project-local hooks (§ TOFU rule 13).
	AllowProjectHooks bool

	// Plugins to register before boot.
	Plugins []plugin.Plugin

	// CredstorePass is the passphrase used to derive the credstore key.
	// In CI, prefer GOFASTR_HARNESS_MACHINE_KEY env var instead.
	CredstorePass string

	// MachineKey overrides passphrase-derived key (CI path).
	MachineKey []byte
}

Config is the input to New.

type Harness

type Harness struct {
	Config Config
	Logger *logging.Logger

	Providers []provider.Provider
	Tools     *tool.Registry
	Skills    *skill.Registry
	Memory    *memory.Store
	Hooks     *hook.Runner
	Sessions  session.Store
	Creds     credstore.Store
	Helper    helper.Helper
	Perms     *permission.Engine
	Context   *xcontext.Reader

	Mux     *multiplex.Mux
	Catalog *resources.Catalog
	// contains filtered or unexported fields
}

Harness is the composed v0.1 system.

func New

func New(cfg Config) (*Harness, error)

New runs the boot sequence and returns a Harness ready to drive sessions.

func (*Harness) AddRequestMiddleware

func (h *Harness) AddRequestMiddleware(_ plugin.RequestMiddleware)

func (*Harness) AddToolMiddleware

func (h *Harness) AddToolMiddleware(_ plugin.ToolMiddleware)

func (*Harness) ClaimSlashCommand

func (h *Harness) ClaimSlashCommand(namespace string) error

func (*Harness) CreateSession

func (h *Harness) CreateSession(prov provider.Provider, model string) ids.SessionID

CreateSession wires a fresh EngineRun bound to the given provider. Returns the SessionID for the caller to attach clients to.

func (*Harness) RegisterProvider

func (h *Harness) RegisterProvider(p plugin.Provider) error

func (*Harness) RegisterToolSource

func (h *Harness) RegisterToolSource(src plugin.ToolSource) error

func (*Harness) Shutdown

func (h *Harness) Shutdown() error

Shutdown releases resources held by the Harness. It tears down every per-session run created by CreateSession (cancelling the persistLoop context, closing the engine bus so subscriptions drain, and unregistering the engine from the mux + catalog) before closing the session store.

func (*Harness) SubscribeEvents

func (h *Harness) SubscribeEvents() <-chan plugin.EventEnvelope

Directories

Path Synopsis
Package client is part of the GoFastr harness.
Package client is part of the GoFastr harness.
tui
Package tui is part of the GoFastr harness.
Package tui is part of the GoFastr harness.
web
Package web is part of the GoFastr harness.
Package web is part of the GoFastr harness.
Package context is part of the GoFastr harness.
Package context is part of the GoFastr harness.
Package control is part of the GoFastr harness.
Package control is part of the GoFastr harness.
auth
Package auth implements the capability-token model: claim set, internal JWT-like encoding (no third-party dep), revocation list, and the issuance flow with TTY/notification confirmation.
Package auth implements the capability-token model: claim set, internal JWT-like encoding (no third-party dep), revocation list, and the issuance flow with TTY/notification confirmation.
conformance
Package conformance is the cross-transport parity test framework.
Package conformance is the cross-transport parity test framework.
inproc
Package inproc is part of the GoFastr harness.
Package inproc is part of the GoFastr harness.
mcpserver
Package mcpserver will expose the harness engine as an MCP server.
Package mcpserver will expose the harness engine as an MCP server.
multiplex
Package multiplex is part of the GoFastr harness.
Package multiplex is part of the GoFastr harness.
resources
Package resources is part of the GoFastr harness.
Package resources is part of the GoFastr harness.
rest
Package rest is part of the GoFastr harness.
Package rest is part of the GoFastr harness.
ws
Package ws will implement the WebSocket transport for the control plane.
Package ws will implement the WebSocket transport for the control plane.
Package engine is part of the GoFastr harness.
Package engine is part of the GoFastr harness.
Package hook is part of the GoFastr harness.
Package hook is part of the GoFastr harness.
Package ids is part of the GoFastr harness.
Package ids is part of the GoFastr harness.
internal
clock
Package clock provides a swap-able clock for tests.
Package clock provides a swap-able clock for tests.
ulid
Package ulid is part of the GoFastr harness.
Package ulid is part of the GoFastr harness.
Package logging is part of the GoFastr harness.
Package logging is part of the GoFastr harness.
Package mcpclient implements the MCP client (consumer side) the harness uses to talk to external MCP servers.
Package mcpclient implements the MCP client (consumer side) the harness uses to talk to external MCP servers.
Package memory is part of the GoFastr harness.
Package memory is part of the GoFastr harness.
Package plugin is part of the GoFastr harness.
Package plugin is part of the GoFastr harness.
Package profile is part of the GoFastr harness.
Package profile is part of the GoFastr harness.
Package provider is part of the GoFastr harness.
Package provider is part of the GoFastr harness.
copilot
Package copilot implements the GitHub Copilot Provider.
Package copilot implements the GitHub Copilot Provider.
credstore
Package credstore implements credential storage.
Package credstore implements credential storage.
failover
Package failover composes a chain of Providers with a circuit-breaker per upstream.
Package failover composes a chain of Providers with a circuit-breaker per upstream.
helper
Package helper is part of the GoFastr harness.
Package helper is part of the GoFastr harness.
internal/openai
Package openai is an internal OpenAI-compatible adapter used by the OpenRouter and ZAI providers (both speak the same wire shape).
Package openai is an internal OpenAI-compatible adapter used by the OpenRouter and ZAI providers (both speak the same wire shape).
openrouter
Package openrouter is part of the GoFastr harness.
Package openrouter is part of the GoFastr harness.
routing
Package routing will implement RoutingProvider: a Provider that composes {router, executors[]} so a single turn can use a cheap model for routing and an expensive model for execution.
Package routing will implement RoutingProvider: a Provider that composes {router, executors[]} so a single turn can use a cheap model for routing and an expensive model for execution.
zai
Package zai is part of the GoFastr harness.
Package zai is part of the GoFastr harness.
Package secrets locates and loads the repo-local .harness-secrets/env file.
Package secrets locates and loads the repo-local .harness-secrets/env file.
Package session is part of the GoFastr harness.
Package session is part of the GoFastr harness.
sqlite
Package sqlite is part of the GoFastr harness.
Package sqlite is part of the GoFastr harness.
Package skill is part of the GoFastr harness.
Package skill is part of the GoFastr harness.
skillmd
Package skillmd is part of the GoFastr harness.
Package skillmd is part of the GoFastr harness.
Package slash is part of the GoFastr harness.
Package slash is part of the GoFastr harness.
Package tool is part of the GoFastr harness.
Package tool is part of the GoFastr harness.
builtins
Package builtins is part of the GoFastr harness.
Package builtins is part of the GoFastr harness.
pack
Package pack is part of the GoFastr harness.
Package pack is part of the GoFastr harness.
permission
Package permission is part of the GoFastr harness.
Package permission is part of the GoFastr harness.
Package tracing is part of the GoFastr harness.
Package tracing is part of the GoFastr harness.

Jump to

Keyboard shortcuts

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