bootstrap

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveConfigPath

func ResolveConfigPath(flag, envKey string, defaults ...string) (string, error)

Types

type App

type App struct {
	Name    string
	Version string
	Port    string
	WorkDir string
	Actions []action.AnyAction
	// contains filtered or unexported fields
}

func New

func New(name, version string) *App

func (*App) Mount

func (a *App) Mount(actions ...action.AnyAction) *App

func (*App) Run

func (a *App) Run()

func (*App) WithActions

func (a *App) WithActions(fn func(context.Context) ([]action.AnyAction, error)) *App

WithActions is the universal escape hatch. Use it for anything that does not have a dedicated With* helper, including domain services you build by hand.

func (*App) WithConsole

func (a *App) WithConsole(opts ...ConsoleOption) *App

func (*App) WithFlows

func (a *App) WithFlows(dir string) *App

WithFlows compiles every *.nflow file in dir into a named action.

Two passes:

  1. Read all flow sources and install any :exec= / :remote= / :wasm= capability bindings so their short names resolve when the compiler reads the sources.
  2. Compile each flow into a named action whose Name is the file stem.

Load WithFlows last so its nodes see every other loader's actions.

func (*App) WithFlowsFolder

func (a *App) WithFlowsFolder(root string) *App

WithFlowsFolder scans a directory for .nflow files that declare @action and registers each one as a callable action, plus three meta-tools (flow.list, flow.inspect, flow.run).

Registration is deferred to the assembly phase, so the flows see the final action set produced by every other With* call.

func (*App) WithLibraries

func (a *App) WithLibraries(libs ...action.Library) *App

func (*App) WithLibrary

func (a *App) WithLibrary(lib action.Library) *App

func (*App) WithLoader

func (a *App) WithLoader(l Loader) *App

type Assembly

type Assembly struct {
	Actions []action.AnyAction
}

type ConsoleOption

type ConsoleOption func(*console.Config)

func WithConsoleBasePath

func WithConsoleBasePath(path string) ConsoleOption

func WithConsoleExecute

func WithConsoleExecute() ConsoleOption

func WithConsoleTitle

func WithConsoleTitle(title string) ConsoleOption

type ExecutionAuditRecord

type ExecutionAuditRecord struct {
	Timestamp  time.Time `json:"timestamp"`
	Action     string    `json:"action"`
	Success    bool      `json:"success"`
	Error      string    `json:"error,omitempty"`
	Payload    any       `json:"payload"`
	Result     any       `json:"result,omitempty"`
	DurationMs int64     `json:"duration_ms"`
	Assertions []string  `json:"assertions,omitempty"`
}

type Loader

type Loader func(*Assembly) error

Loader contributes actions to the running assembly. Loaders run in declaration order during Run().

The bootstrap package defines the shape but owns none of the concrete loaders. Ecosystem packages (ai/flow/bootstrap, ai/llm/bootstrap, jumalu/bootstrap) provide their own. This keeps the flow bootstrap free of any direct dependency on ai or jumalu.

A Loader must append to asm.Actions and must not replace the slice:

func MyLoader(...) bootstrap.Loader {
    return func(asm *bootstrap.Assembly) error {
        asm.Actions = append(asm.Actions, myActions...)
        return nil
    }
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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