engine

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package engine wires the deterministic router to native execution and the state store (backlog AO-015): a submitted task auto-routes, is persisted with its matched rule, and runs natively with zero manual assignment. Run events stream into the append-only event log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine routes and dispatches tasks.

func New

func New(r *router.Router, rt runtime.Runtime, st *store.Store, workRoot string) *Engine

New builds an engine.

func (*Engine) AcceptRef added in v0.13.0

func (e *Engine) AcceptRef(ctx context.Context, t task.Task) (string, string, error)

AcceptRef persists the routed run and returns its identity before provider startup completes. The accepted run is dispatched exactly once on a detached context; any startup failure lands on that already-visible run.

func (*Engine) Cancel added in v0.13.0

func (e *Engine) Cancel(runID string) error

Cancel stops a live run through the runtime contract and waits until its terminal state and events are persisted. Unknown/already-finished runs are a no-op so a completion racing an operator interrupt remains harmless.

func (*Engine) Route

func (e *Engine) Route(t task.Task) router.RouteDecision

Route returns the routing decision for a task without dispatching it (powers `fort route --dry-run`).

func (*Engine) Submit

func (e *Engine) Submit(ctx context.Context, t task.Task) (string, error)

Submit routes and dispatches a task, returning the run id immediately. It satisfies inbox.Submitter; callers that need the resolved machine use SubmitRef.

func (*Engine) SubmitAndWait

func (e *Engine) SubmitAndWait(ctx context.Context, t task.Task) (store.Run, error)

SubmitAndWait submits a task and blocks until its run terminates, returning the final run row.

func (*Engine) SubmitRef

func (e *Engine) SubmitRef(ctx context.Context, t task.Task) (string, string, error)

SubmitRef is Submit that also returns the resolved machine (spec 022). It persists the route decision and a run row, starts native execution, and streams events into the store on a goroutine.

func (*Engine) UsePlacer

func (e *Engine) UsePlacer(p Placer)

UsePlacer enables deterministic machine placement (spec 022). With no placer the engine dispatches to the local runtime exactly as before.

func (*Engine) Wait added in v0.8.0

func (e *Engine) Wait(runID string)

Wait blocks until the run's events are fully persisted, then returns. It returns immediately for an unknown or already-finished run. Exposed so control.Planner can block on a planner run without polling (spec 026).

type Placer

type Placer interface {
	Place(agent, pin string) (machine string, err error)
}

Placer chooses the machine that will run an agent (spec 022). Like the router it is a pure, deterministic function of its inputs — zero model calls — so the full dispatch path stays model-free. core/machines.Registry implements it; cmd/fort injects it in multi-machine mode.

Jump to

Keyboard shortcuts

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