operator

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package operator shares typed request adapters between HTTP and dashboard transports. Every read retains the optimizer's current caller and scope checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivateInput

type ActivateInput struct {
	ActivationRouteInput
	VersionID     string `json:"version_id"`
	VersionDigest string `json:"version_digest"`
	DecisionID    string `json:"decision_id"`
}

ActivateInput names immutable version and decision evidence for a route change.

type ActivationRouteInput

type ActivationRouteInput struct {
	AgentID            string          `json:"agent_id"`
	Channel            string          `json:"channel,omitempty"`
	Kind               opt.HarnessKind `json:"kind,omitempty"`
	ExpectedGeneration int64           `json:"expected_generation" optional:"true"`
	Reason             string          `json:"reason"`
}

ActivationRouteInput identifies the production route and its reviewed generation. The command ID is derived from the transport key, never from payload fields.

type ActivationsInput

type ActivationsInput struct {
	PageInput
	AgentID string          `json:"agent_id" query:"agent_id"`
	Channel string          `json:"channel,omitempty" query:"channel" optional:"true"`
	Kind    opt.HarnessKind `json:"kind,omitempty" query:"kind" optional:"true"`
}

ActivationsInput identifies the route whose immutable history is requested.

type CapabilitiesInput

type CapabilitiesInput struct {
	ExperimentID string `json:"experiment_id,omitempty" query:"experiment_id" optional:"true"`
}

CapabilitiesInput optionally selects a frozen experiment for readiness checks.

type CatalogInput

type CatalogInput struct {
	PageInput
	Kind opt.CatalogKind `json:"kind,omitempty" query:"kind" optional:"true"`
}

CatalogInput filters approved creation references without requesting snapshots.

type ChildInput

type ChildInput struct {
	ExperimentID string `json:"experiment_id" path:"experiment_id"`
	ID           string `json:"id" path:"id"`
}

ChildInput binds a child detail to its original parent experiment.

type Commands

type Commands struct{ Optimizer *opt.Optimizer }

Commands adapts lifecycle requests to durable optimizer commands.

func (Commands) Activate

func (c Commands) Activate(ctx context.Context, in ActivateInput, key string) (*opt.Activation, error)

Activate records a reviewed route change. Retries return its immutable receipt, not a new generation or a claim that this receipt is still the current route.

func (Commands) Cancel

func (c Commands) Cancel(ctx context.Context, in LifecycleInput, key string) (opt.Experiment, error)

Cancel invalidates pending work while retaining original accounting evidence.

func (Commands) Create

func (c Commands) Create(ctx context.Context, in CreateInput, key string) (opt.Experiment, error)

Create saves a host-frozen draft using the separate transport command identity.

func (Commands) Deactivate

func (c Commands) Deactivate(ctx context.Context, in ActivationRouteInput, key string) (*opt.Activation, error)

Deactivate disables the current route without requiring its old evidence to remain available. A retry cannot disable a subsequently restored generation.

func (Commands) Resume

func (c Commands) Resume(ctx context.Context, in LifecycleInput, key string) (opt.Experiment, error)

Resume queues a paused experiment after the original requester's current grants.

func (Commands) Retain

func (c Commands) Retain(ctx context.Context, in RetainInput, key string) (opt.Experiment, error)

Retain closes a pending review while preserving measured evidence and routes.

func (Commands) RetryLesson

func (c Commands) RetryLesson(ctx context.Context, in RetryLessonInput, key string) (opt.Publication, error)

RetryLesson queues another bounded delivery cycle without calling Fabriq.

func (Commands) RevokeLesson

func (c Commands) RevokeLesson(ctx context.Context, in RevokeLessonInput, key string) (opt.Lesson, error)

RevokeLesson withdraws local eligibility and queues remote revocation atomically.

func (Commands) Rollback

func (c Commands) Rollback(ctx context.Context, in RollbackInput, key string) (*opt.Activation, error)

Rollback rechecks current authority, evidence and compatibility before restoring a historical version. Its receipt key shares the activation command namespace.

func (Commands) Start

func (c Commands) Start(ctx context.Context, in LifecycleInput, key string) (opt.Experiment, error)

Start queues a frozen draft without executing trial or controller work.

type CreateInput

type CreateInput struct {
	Selection opt.CreationSelection `json:"selection"`
}

CreateInput accepts catalog choices, never executable bundles or host policy.

type ErrorResponse

type ErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Status  int    `json:"-"`
}

ErrorResponse contains public failure codes, never provider or storage text. Status is transport metadata and is omitted from response bodies.

func Failure

func Failure(err error) ErrorResponse

Failure maps a non-nil service error to a stable public response. Unknown failures remain unavailable; callers must not infer that a command was undone.

type ExperimentPageInput

type ExperimentPageInput struct {
	PageInput
	ID string `json:"id" path:"id"`
}

ExperimentPageInput selects a bounded child collection of one experiment.

type ExperimentsInput

type ExperimentsInput struct {
	PageInput
	AgentID string    `json:"agent_id,omitempty" query:"agent_id" optional:"true"`
	State   opt.State `json:"state,omitempty" query:"state" optional:"true"`
}

ExperimentsInput filters the experiment collection.

type IDInput

type IDInput struct {
	ID string `json:"id" path:"id"`
}

IDInput identifies one resource in the caller's exact scope.

type LessonsInput

type LessonsInput struct {
	PageInput
	Domain        string            `json:"domain,omitempty" query:"domain" optional:"true"`
	EvidenceClass opt.EvidenceClass `json:"evidence_class,omitempty" query:"evidence_class" optional:"true"`
	EligibleOnly  bool              `json:"eligible_only,omitempty" query:"eligible_only" optional:"true"`
}

LessonsInput filters locally retained learning records.

type LifecycleInput

type LifecycleInput struct {
	ID               string `json:"id" path:"id"`
	ExpectedRevision int64  `json:"expected_revision"`
}

LifecycleInput contains command payload fields. The idempotency key comes separately from the REST header or dashboard envelope, never from this body.

type PageInput

type PageInput struct {
	Limit  int    `json:"limit,omitempty" query:"limit" optional:"true"`
	Cursor string `json:"cursor,omitempty" query:"cursor" optional:"true"`
}

PageInput carries the opaque continuation returned by the preceding page.

type PublicationsInput

type PublicationsInput struct {
	PageInput
	ExperimentID string                   `json:"experiment_id,omitempty" query:"experiment_id" optional:"true"`
	LessonID     string                   `json:"lesson_id,omitempty" query:"lesson_id" optional:"true"`
	Operation    opt.PublicationOperation `json:"operation,omitempty" query:"operation" optional:"true"`
	PendingOnly  bool                     `json:"pending_only,omitempty" query:"pending_only" optional:"true"`
}

PublicationsInput filters durable delivery records independently of remote indexes.

type Reader

type Reader struct{ Optimizer *opt.Optimizer }

Reader adapts operator requests without owning workers or persistence. A nil Optimizer reports unavailable, including for empty collections.

func (Reader) Activations

Activations reads history for an explicit execution or controller route.

func (Reader) Candidate

func (r Reader) Candidate(ctx context.Context, in ChildInput) (opt.Candidate, error)

Candidate reads a child bound to its authorized parent experiment.

func (Reader) Candidates

Candidates reads accepted and rejected proposals.

func (Reader) Capabilities

func (r Reader) Capabilities(ctx context.Context, in CapabilitiesInput) (opt.CapabilitySnapshot, error)

Capabilities reads current integration checks without starting external work.

func (Reader) Catalog

Catalog reads currently authorized host choices using a bound continuation.

func (Reader) Comparison

Comparison reads the recorded decision and bounded original evaluations.

func (Reader) Events

Events continues the durable event sequence using its opaque cursor.

func (Reader) Experiment

func (r Reader) Experiment(ctx context.Context, in IDInput) (opt.Experiment, error)

Experiment reads the frozen experiment and current lifecycle state.

func (Reader) Experiments

Experiments reads an authorized collection with current resource grants.

func (Reader) Lesson

func (r Reader) Lesson(ctx context.Context, in IDInput) (opt.Lesson, error)

Lesson reads a local lesson including its revocation state.

func (Reader) Lessons

Lessons reads local eligibility and revocation state.

func (Reader) Publications

Publications reads the retained publication outbox and acknowledgment state.

func (Reader) Trial

func (r Reader) Trial(ctx context.Context, in ChildInput) (opt.Trial, error)

Trial reads a child bound to its authorized parent experiment.

func (Reader) Trials

Trials reads original trial attempts without replaying execution.

func (Reader) Version

func (r Reader) Version(ctx context.Context, in IDInput) (opt.HarnessVersion, error)

Version reads one immutable version.

func (Reader) Versions

Versions reads immutable versions visible to the current caller.

type RetainInput

type RetainInput struct {
	ID               string `json:"id"`
	ExpectedRevision int64  `json:"expected_revision"`
	DecisionID       string `json:"decision_id"`
	Reason           string `json:"reason"`
}

RetainInput identifies the measured decision and the reviewer's reason. The command key comes separately from the transport envelope.

type RetryLessonInput

type RetryLessonInput struct {
	ID                 string `json:"id" path:"id"`
	LocalRevision      int64  `json:"local_revision"`
	ExpectedGeneration int64  `json:"expected_generation"`
	Reason             string `json:"reason"`
}

RetryLessonInput identifies the local outbox payload and last delivery attempt. The transport supplies the command key separately from these payload fields.

type RevokeLessonInput

type RevokeLessonInput struct {
	ID               string `json:"id" path:"id"`
	ExpectedRevision int64  `json:"expected_revision"`
	Reason           string `json:"reason"`
}

RevokeLessonInput withdraws a lesson at its current local revision.

type RollbackInput

type RollbackInput struct {
	ActivationRouteInput
	TargetID string `json:"target_id"`
}

RollbackInput selects an existing activation for current policy revalidation.

type TrialsInput

type TrialsInput struct {
	PageInput
	ID        string         `json:"id" path:"id"`
	VersionID string         `json:"version_id,omitempty" query:"version_id" optional:"true"`
	Split     opt.Split      `json:"split,omitempty" query:"split" optional:"true"`
	State     opt.TrialState `json:"state,omitempty" query:"state" optional:"true"`
}

TrialsInput selects original attempts for one experiment.

type VersionsInput

type VersionsInput struct {
	PageInput
	AgentID string          `json:"agent_id,omitempty" query:"agent_id" optional:"true"`
	Kind    opt.HarnessKind `json:"kind,omitempty" query:"kind" optional:"true"`
}

VersionsInput filters immutable versions by owner and purpose.

Jump to

Keyboard shortcuts

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