Versions in this module Expand all Collapse all v0 v0.3.3 Nov 4, 2026 Changes in this version + const BaseCallUnits + const DefaultRankBatch + const DefaultRankPerCandidate + const MaxHostResultBytes + const MaxMemoryBytes + const MaxResponseBytes + const WallUnitInterval + var DefaultCosts = map[string]int64 + func HotScale() float64 + type Candidate struct + Facts json.RawMessage + ReleaseID string + type Diagnostic struct + Column int + File string + Line int + Severity string + Text string + func Compile(files map[string]string, entry string) (js []byte, sourcemap []byte, diagnostics []Diagnostic) + type Engine struct + func NewEngine(logger *slog.Logger) *Engine + func (e *Engine) Close() error + func (e *Engine) LoadJS(id, version, source string, host Host, lim Limits) (*Plugin, error) + func (e *Engine) LoadWASM(id, version string, module []byte, host Host, lim Limits) (*Plugin, error) + type Error struct + Message string + Status Status + Trap bool + func (e *Error) Error() string + type Fault struct + Code string + Message string + func Forbidden(message string) *Fault + func (f *Fault) Error() string + type Host interface + CallHost func(ctx context.Context, name string, args json.RawMessage) (json.RawMessage, error) + type HostFunc func(ctx context.Context, name string, args json.RawMessage) (json.RawMessage, error) + func (f HostFunc) CallHost(ctx context.Context, name string, args json.RawMessage) (json.RawMessage, error) + type Limits struct + Costs map[string]int64 + Deadline time.Duration + MemoryBytes uint64 + PoolSize int + RankBatch time.Duration + RankPerCandidate time.Duration + UnitBudget int64 + type Outcome struct + Duration time.Duration + MemoHits int + SlowCandidates int + Status Status + Trap bool + Units int64 + type Plugin struct + func (p *Plugin) Budgets() (perCandidate, perBatch time.Duration) + func (p *Plugin) Call(ctx context.Context, req Request) (Response, error) + func (p *Plugin) CallDetailed(ctx context.Context, req Request) (Response, Outcome, error) + func (p *Plugin) Close() error + func (p *Plugin) CondBatch(ctx context.Context, cands []Candidate, operator string, value json.RawMessage) ([]bool, Outcome, error) + func (p *Plugin) CondMatch(ctx context.Context, cand Candidate, operator string, value json.RawMessage) (match bool, out Outcome, err error) + func (p *Plugin) HasCondMatch() bool + func (p *Plugin) HasHandle() bool + func (p *Plugin) HasRankKey() bool + func (p *Plugin) ID() string + func (p *Plugin) RankBatch(ctx context.Context, cands []Candidate, config json.RawMessage) (scores []int64, out Outcome, err error) + func (p *Plugin) Stats() Stats + func (p *Plugin) Version() string + type Request struct + Body json.RawMessage + Headers map[string]string + Method string + Path string + Query map[string][]string + type Response struct + Body json.RawMessage + Headers map[string]string + Status int + type Stats struct + Aborted int64 + Calls int64 + Errors int64 + Forbidden int64 + Governance int64 + SlowCandidates int64 + Timeouts int64 + Traps int64 + Units int64 + type Status string + const StatusAborted + const StatusError + const StatusForbidden + const StatusGovernance + const StatusInvalidInput + const StatusOK + const StatusTimeout