engine

package
v0.139.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPolicy

func DefaultPolicy() models.Policy

DefaultPolicy returns the baseline placement policy.

func RankScores

func RankScores(estimates []models.Estimate, weights models.ScoringWeights) []models.ResolverScore

RankScores derives deterministic resolver scores from estimates and weights.

func Score

func Score(estimate models.Estimate, weights models.ScoringWeights) float64

Score returns weighted utility (maximize accuracy, minimize cost/latency).

Types

type Orchestrator

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

Orchestrator is the default placement orchestrator implementation.

func NewOrchestrator

func NewOrchestrator(registry *resolvers.Registry, policies PlacementPolicy) *Orchestrator

NewOrchestrator constructs a policy-aware placement orchestrator.

func (*Orchestrator) Run

func (o *Orchestrator) Run(ctx context.Context, input RunInput) (models.Run, error)

type PlacementOrchestrator

type PlacementOrchestrator interface {
	Run(ctx context.Context, input RunInput) (models.Run, error)
}

PlacementOrchestrator executes placement resolvers under policy constraints.

type PlacementPolicy

type PlacementPolicy interface {
	Resolve(ctx context.Context, input PolicyResolveInput) (models.Policy, error)
}

PlacementPolicy resolves effective run policy with precedence-aware overrides.

type PolicyResolveInput

type PolicyResolveInput struct {
	OrgID           string         `json:"org_id"`
	UserID          string         `json:"user_id"`
	PerRunOverride  *models.Policy `json:"per_run_override"`
	RegisteredOrder []string       `json:"registered_order"`
}

PolicyResolveInput captures precedence context for policy resolution.

type RunInput

type RunInput struct {
	RunID              string                     `json:"run_id"`
	AgreementID        string                     `json:"agreement_id"`
	CreatedByUserID    string                     `json:"created_by_user_id"`
	OrgID              string                     `json:"org_id"`
	UserID             string                     `json:"user_id"`
	PolicyOverride     *models.Policy             `json:"policy_override"`
	DocumentBytes      []byte                     `json:"document_bytes"`
	DocumentPageCount  int                        `json:"document_page_count"`
	FieldDefinitions   []models.FieldDefinition   `json:"field_definitions"`
	ExistingPlacements []models.ExistingPlacement `json:"existing_placements"`
	NativeFormFields   []models.NativeFormField   `json:"native_form_fields"`
}

RunInput captures a placement execution request.

type StaticPolicyResolver

type StaticPolicyResolver struct {
	System models.Policy            `json:"system"`
	Org    map[string]models.Policy `json:"org"`
	User   map[string]models.Policy `json:"user"`
}

StaticPolicyResolver provides in-memory system/org/user policy overlays.

func NewStaticPolicyResolver

func NewStaticPolicyResolver(system models.Policy) *StaticPolicyResolver

NewStaticPolicyResolver creates a policy resolver with baseline defaults.

func (*StaticPolicyResolver) Resolve

func (*StaticPolicyResolver) SetOrgPolicy

func (r *StaticPolicyResolver) SetOrgPolicy(orgID string, policy models.Policy)

func (*StaticPolicyResolver) SetUserPolicy

func (r *StaticPolicyResolver) SetUserPolicy(userID string, policy models.Policy)

Jump to

Keyboard shortcuts

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