native

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package native is Fort's NativeRuntime (backlog AO-014): it spawns agent CLIs itself — no Multica — normalizes their stdout into runtime.RunEvents, injects stdin for Signal (human-in-the-loop), and tracks exit codes.

The executor is provider-agnostic: a Provider maps an agent name to argv and an optional line parser. DefaultProviders() encodes the AO-002 recon contract for claude/codex/hermes/openclaw (openclaw argv is a best guess — spec 023).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classified added in v0.10.0

type Classified struct {
	Type runtime.EventType
	Data string
}

Classified is one typed event extracted from a provider stdout line.

type Provider

type Provider struct {
	Name string
	// Command builds the argv for a run (argv[0] is the binary).
	Command func(spec runtime.RunSpec) []string
	// Parse optionally normalizes a stdout line into a message. When ok is
	// false the line is emitted as a raw EventStdout.
	Parse func(line string) (msg string, ok bool)
	// Classify optionally turns a stdout line into typed events (spec 030). A
	// line may yield several (text + tool_use blocks). When set it supersedes
	// Parse; ok=false falls through to a raw EventStdout.
	Classify func(line string) ([]Classified, bool)
	// Interactive opts the provider into a stdin PIPE so Signal can inject input
	// mid-run (HITL). Default false: the child gets /dev/null and so an immediate
	// EOF. This matters — a CLI that drains stdin (e.g. `codex exec`, which
	// prints "Reading additional input from stdin...") hangs forever on an open
	// pipe that is never written to nor closed. None of the shipped agent CLIs
	// read their prompt from stdin; they take it as argv.
	Interactive bool
}

Provider describes how to launch one agent CLI headless.

func DefaultProviders

func DefaultProviders() []Provider

DefaultProviders returns the built-in provider set encoding the AO-002 recon contract (docs/notes/runtime-recon.md) for all four agents.

type Runtime

type Runtime struct {

	// EnvAllow, when non-empty, restricts which host environment variables are
	// passed to spawned CLIs (least privilege, AO-041). Empty = pass the full
	// environment (the relaxed default; providers need their own auth keys).
	EnvAllow []string
	// contains filtered or unexported fields
}

Runtime is the native executor.

func New

func New(workRoot string, providers ...Provider) *Runtime

New builds a native runtime rooted at workRoot with the given providers.

func (*Runtime) Dispatch

func (r *Runtime) Dispatch(ctx context.Context, spec runtime.RunSpec) (runtime.Run, error)

Dispatch launches spec via its provider.

func (*Runtime) Name

func (r *Runtime) Name() string

Name implements runtime.Runtime.

Jump to

Keyboard shortcuts

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