capability

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package capability resolves flow-node names into runnable action.AnyAction values at flow-execution time.

Three resolution backends are supported, tried in this order:

  1. Static — the caller-supplied registry (in-process actions).
  2. Remote — HTTP/JSON or exec-based proxies declared in the .flow manifest via :remote= and :exec= modifiers.
  3. WASM — WebAssembly modules loaded via wazero, declared via :wasm= in the manifest.

Static lookups always win: an in-process action shadows a manifest-declared remote with the same name. This lets callers override individual capabilities during development without editing the .flow manifest.

Manifest syntax (all modifiers are colon-separated, in any order):

agent.orchestrator:remote="http://10.0.0.5:9001/solve":timeout=30s@Prompt hint
tools.ripgrep:exec="rg --json":timeout=10s@Search files
skills.lint:wasm="./skills/lint.wasm":timeout=15s@Lint Go code

The annotation (everything after the first unquoted '@') is stripped by the parser and is never passed to the runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Name    string
	Kind    Kind
	Target  string // URL, shell command, or wasm file path
	Timeout string // raw duration string; parsed by the resolver
}

Binding is a single manifest-declared capability. Name is the node identifier used in the pipeline (e.g. "agent.orchestrator"); the remaining fields describe how to reach it.

func ParseBindings

func ParseBindings(manifest string) []Binding

ParseBindings scans a raw .flow manifest for capability declarations.

Recognised modifiers:

:remote="http://host:port/path"   -> HTTP binding
:exec="cmd arg1 arg2"             -> exec binding
:wasm="./skills/foo.wasm"         -> WASM binding
:timeout="30s"                    -> per-binding timeout hint

Only the tail atom of each pipeline line is examined; head atoms inherit their bindings from their own declaration lines. Duplicate names are resolved last-wins.

type Kind

type Kind uint8

Kind identifies the resolution backend for a declared capability.

const (
	KindHTTP Kind = iota + 1 // JSON over HTTP POST
	KindExec                 // subprocess: stdin JSON -> stdout JSON
	KindWASM                 // wazero module: stdin JSON -> stdout JSON
)

func (Kind) String

func (k Kind) String() string

type Resolver

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

func NewResolver

func NewResolver(ctx context.Context, registry *flow.MapRegistry, manifest string) (*Resolver, error)

NewResolver now takes ctx so WASM compilation can be cancelled.

func (*Resolver) Bindings

func (r *Resolver) Bindings() []Binding

func (*Resolver) Close

func (r *Resolver) Close() error

func (*Resolver) Install

func (r *Resolver) Install()

func (*Resolver) Resolve

func (r *Resolver) Resolve(name string) (action.AnyAction, bool)

Jump to

Keyboard shortcuts

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