Documentation
¶
Overview ¶
Package operationruntime owns the provider-neutral capability adapter registry and Agent Operations V1 lifecycle orchestration.
Index ¶
- func EqualJSONObject(left, right []byte) bool
- func IsPossiblePartial(err error) bool
- func NormalizedResult(operation string, result json.RawMessage) json.RawMessage
- func PlanRecord(plan grants.ImmutablePlan) state.PlanRecord
- func RecoveredApprovalCommit(grant grants.Grant) (commit, valid bool)
- type Adapter
- type ClientBoundAdapter
- type Failure
- type Options
- type Outcome
- type PlanCleaner
- type PossiblePartialError
- type Preparation
- type Registry
- type RegistryOptions
- type Runtime
- func (r *Runtime[I, P, A]) Advance(ctx context.Context, operation agentv1.Operation)
- func (r *Runtime[I, P, A]) AdvanceAll(ctx context.Context)
- func (r *Runtime[I, P, A]) Cancel(_ context.Context, client, id string) (agentv1.Operation, error)
- func (r *Runtime[I, P, A]) CancelGrant(grant grants.Grant, client string) error
- func (r *Runtime[I, P, A]) Execute(ctx context.Context, operation agentv1.Operation)
- func (r *Runtime[I, P, A]) FailExecution(operation agentv1.Operation, plan P, executionErr, reconcileErr error)
- func (r *Runtime[I, P, A]) Load(operation agentv1.Operation) (Adapter[I, P, A], P, error)
- func (r *Runtime[I, P, A]) ReconcileInterrupted(ctx context.Context, operation agentv1.Operation)
- func (r *Runtime[I, P, A]) Recover(ctx context.Context)
- func (r *Runtime[I, P, A]) RecoverApproval(operation agentv1.Operation) agentv1.Operation
- func (r *Runtime[I, P, A]) Start(ctx context.Context)
- func (r *Runtime[I, P, A]) Submit(ctx context.Context, client string, request agentv1.SubmitRequest) (agentv1.Operation, bool, error)
- func (r *Runtime[I, P, A]) Succeed(operation agentv1.Operation, plan P, result json.RawMessage, reserved bool, ...)
- func (r *Runtime[I, P, A]) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualJSONObject ¶
EqualJSONObject compares two JSON objects while preserving numeric tokens.
func IsPossiblePartial ¶
IsPossiblePartial reports whether an execution error requires reconciliation.
func NormalizedResult ¶
func NormalizedResult(operation string, result json.RawMessage) json.RawMessage
NormalizedResult gives reconciled operations a stable non-empty result.
func PlanRecord ¶
func PlanRecord(plan grants.ImmutablePlan) state.PlanRecord
PlanRecord converts a canonical immutable plan into the shared state row.
func RecoveredApprovalCommit ¶
RecoveredApprovalCommit reports whether restart recovery must commit a reserved use and whether the recorded authority state is valid.
Types ¶
type Adapter ¶
type Adapter[I, P, A any] interface { Descriptor() capability.Descriptor Decode(target, arguments json.RawMessage) (I, error) Resolve(context.Context, I) (P, error) Authorize(P) A Present(P) agentv1.Presentation Execute(context.Context, P) (Outcome, error) Reconcile(context.Context, P) (Outcome, error) }
Adapter is the provider-neutral operation contract. Providers retain their own concrete input, immutable plan, and authorization request types.
type ClientBoundAdapter ¶
ClientBoundAdapter binds requester-owned external references after the authenticated client is known and before provider resolution begins.
type Options ¶
type Options[I, P, A any] struct { Broker string Operations *agentops.Store Registry *Registry[I, P, A] Authorization *authorization.Coordinator Grants *grants.Store Decide func(policy.Request, policy.DecisionOptions) policy.Decision Project func(A) policy.Request SetClient func(*P, string) InputData func(I) (json.RawMessage, json.RawMessage) PlanData func(P) (json.RawMessage, json.RawMessage) Prepare func(Preparation[P, A]) (authorization.GrantIntent, error) Load func(agentv1.Operation, Adapter[I, P, A]) (P, error) PlanDigest func(grants.Grant) string StoredPlan func(string) (state.PlanRecord, error) ValidateExecution func(grants.Grant) error MapSubmissionError func(error) error DefinitiveFailure func(error) bool ExecutionFailure func(error, error) Failure RecordPolicyRefusal func(agentv1.Operation, P, policy.Decision, string) RecordOutcome func(agentv1.Operation, P, string, string, int) Notifier notify.Notifier ApprovalMessage func(grants.Grant, string) notify.ApprovalMessage OperatorConfigured bool Now func() time.Time AuthorizationGrace time.Duration WorkerInterval time.Duration WorkerConcurrency int NotificationLease time.Duration }
Options supplies provider semantics and shared durable dependencies. The callbacks encode provider plans and presentation; lifecycle transitions stay inside Runtime.
type Outcome ¶
type Outcome struct {
Proven bool
Result json.RawMessage
UpstreamStatus int
}
Outcome is the stable result of execution or reconciliation. Proven must be true before the runtime records a successful operation.
type PlanCleaner ¶
PlanCleaner removes transient provider material when an operation reaches a terminal state without consuming it.
type PossiblePartialError ¶
type PossiblePartialError struct{ Err error }
PossiblePartialError marks a multi-call operation that may have changed upstream state before a later call failed. The runtime reconciles it instead of treating the wrapped error as a definitive refusal.
func (*PossiblePartialError) Error ¶
func (e *PossiblePartialError) Error() string
func (*PossiblePartialError) Unwrap ¶
func (e *PossiblePartialError) Unwrap() error
type Preparation ¶
type Preparation[P, A any] struct { Plan P Auth A Core policy.Request DescriptorName string Client string OperationID string Reason string Decision policy.Decision Direct bool CreatedAt time.Time }
Preparation is the immutable provider plan context selected by the shared lifecycle. The provider encodes it into its v1 plan and canonical grant.
type Registry ¶
type Registry[I, P, A any] struct { // contains filtered or unexported fields }
Registry is an immutable adapter registry keyed by catalog operation name.
func NewRegistry ¶
func NewRegistry[I, P, A any](options RegistryOptions, adapters ...Adapter[I, P, A]) (*Registry[I, P, A], error)
NewRegistry validates adapters against their provider-owned catalog.
func (*Registry[I, P, A]) ValidateCoverage ¶
func (r *Registry[I, P, A]) ValidateCoverage(provider string, descriptors []capability.Descriptor) error
ValidateCoverage ensures every catalog entry advertised as an implemented execution operation has an adapter.
type RegistryOptions ¶
type RegistryOptions struct {
Provider string
Descriptor func(string) (capability.Descriptor, bool)
RequiresAdapter func(capability.Descriptor) bool
}
RegistryOptions supplies provider catalog ownership without teaching the shared registry provider vocabulary.
type Runtime ¶
type Runtime[I, P, A any] struct { // contains filtered or unexported fields }
Runtime drives one provider's generic Agent V1 operation lifecycle.
func (*Runtime[I, P, A]) Advance ¶
Advance synchronizes approval state and dispatches one approved operation.
func (*Runtime[I, P, A]) AdvanceAll ¶
AdvanceAll advances every unfinished operation once.
func (*Runtime[I, P, A]) Cancel ¶
Cancel cancels a pending or approved operation and its approval authority.
func (*Runtime[I, P, A]) CancelGrant ¶
CancelGrant cancels or revokes one requester-owned approval grant.
func (*Runtime[I, P, A]) Execute ¶
Execute consumes authority, executes once, and reconciles ambiguity.
func (*Runtime[I, P, A]) FailExecution ¶
func (r *Runtime[I, P, A]) FailExecution(operation agentv1.Operation, plan P, executionErr, reconcileErr error)
FailExecution records one provider-redacted execution or reconciliation failure.
func (*Runtime[I, P, A]) ReconcileInterrupted ¶
ReconcileInterrupted proves an executing operation after restart without replaying the mutation.
func (*Runtime[I, P, A]) Recover ¶
Recover reconciles executing operations and advances other unfinished work.
func (*Runtime[I, P, A]) RecoverApproval ¶
RecoverApproval repairs an operation interrupted between grant and plan binding.
func (*Runtime[I, P, A]) Submit ¶
func (r *Runtime[I, P, A]) Submit(ctx context.Context, client string, request agentv1.SubmitRequest) (agentv1.Operation, bool, error)
Submit validates, resolves, authorizes, and durably submits an operation.