kernel

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxListExecutionsLimit = 200

MaxListExecutionsLimit caps the page size a caller can request.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteStepRequest added in v0.6.0

type CompleteStepRequest struct {
	Result json.RawMessage `json:"result"`
	Lease  domain.Lease    `json:"-"`
}

type Config added in v0.6.0

type Config struct {
	DispatchMaxAttempts      int
	DispatchBaseDelay        time.Duration
	DispatchMaxDelay         time.Duration
	DispatchTimeout          time.Duration
	DispatchConcurrency      int
	DispatchLeaseTimeout     time.Duration
	DefaultApprovalTimeout   time.Duration
	ExecutionDeadlineTimeout time.Duration
	ExecutionCleanupInterval time.Duration
	ExecutionRetention       time.Duration
	LeaderLockKey            string
	ReplicaID                string
}

func DefaultConfig added in v0.6.0

func DefaultConfig() Config

type DenyApprovalRequest added in v0.6.0

type DenyApprovalRequest struct {
	DecidedBy string `json:"decided_by"`
	Rationale string `json:"rationale,omitempty"`
}

type Deps

type Deps struct {
	Events      store.EventStore
	Steps       store.StepStore
	Executions  store.ExecutionStore
	Agents      store.AgentStore
	Approvals   store.ApprovalStore
	Queue       store.JobQueue
	Locker      store.Locker
	UnitOfWork  store.UnitOfWork
	Policy      policy.Engine
	Dispatcher  *dispatcher.Dispatcher
	RateLimiter ratelimit.Limiter
	Logger      *slog.Logger
	Observer    *observe.Observer
}

type FailStepRequest added in v0.6.0

type FailStepRequest struct {
	Error json.RawMessage `json:"error"`
	Lease domain.Lease    `json:"-"`
}

type GrantApprovalRequest added in v0.6.0

type GrantApprovalRequest struct {
	DecidedBy string `json:"decided_by"`
	Rationale string `json:"rationale,omitempty"`
}

type Kernel

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

func New added in v0.6.0

func New(cfg Config, d Deps) *Kernel

func (*Kernel) CancelExecution

func (k *Kernel) CancelExecution(ctx context.Context, id uuid.UUID) error

func (*Kernel) CancelExpiredExecutions added in v0.6.0

func (k *Kernel) CancelExpiredExecutions(ctx context.Context, now time.Time) error

func (*Kernel) Cleanup added in v0.6.0

func (k *Kernel) Cleanup(ctx context.Context, retain time.Duration, now time.Time) error

func (*Kernel) CompleteExecution added in v0.6.0

func (k *Kernel) CompleteExecution(ctx context.Context, execID uuid.UUID, lease domain.Lease, output json.RawMessage) error

func (*Kernel) CompleteStep added in v0.6.0

func (k *Kernel) CompleteStep(ctx context.Context, stepID string, req CompleteStepRequest) (domain.StepDecision, error)

func (*Kernel) CreateExecution

func (k *Kernel) CreateExecution(ctx context.Context, agentID string, input json.RawMessage, agentVersion string) (domain.Execution, error)

func (*Kernel) DeleteAgent added in v0.6.0

func (k *Kernel) DeleteAgent(ctx context.Context, id string) error

func (*Kernel) DenyApproval added in v0.6.0

func (k *Kernel) DenyApproval(ctx context.Context, id uuid.UUID, req DenyApprovalRequest) error

func (*Kernel) Deps added in v0.6.0

func (k *Kernel) Deps() Deps

func (*Kernel) DrainDispatches added in v0.18.0

func (k *Kernel) DrainDispatches(ctx context.Context) error

func (*Kernel) EnqueueReDrive added in v0.6.0

func (k *Kernel) EnqueueReDrive(ctx context.Context, execID uuid.UUID) error

func (*Kernel) ExpireApprovals added in v0.6.0

func (k *Kernel) ExpireApprovals(ctx context.Context, now time.Time) error

func (*Kernel) FailExecution added in v0.6.0

func (k *Kernel) FailExecution(ctx context.Context, execID uuid.UUID, lease domain.Lease, reason string) error

func (*Kernel) FailStep added in v0.6.0

func (k *Kernel) FailStep(ctx context.Context, stepID string, req FailStepRequest) (domain.StepDecision, error)

func (*Kernel) GetAgent added in v0.6.0

func (k *Kernel) GetAgent(ctx context.Context, id string) (domain.Agent, error)

func (*Kernel) GetApproval added in v0.6.0

func (k *Kernel) GetApproval(ctx context.Context, id uuid.UUID) (domain.Approval, error)

func (*Kernel) GetEvents

func (k *Kernel) GetEvents(ctx context.Context, id uuid.UUID, afterSeq int64, limit int) ([]domain.Event, error)

func (*Kernel) GetExecution

func (k *Kernel) GetExecution(ctx context.Context, id uuid.UUID) (domain.Execution, error)

func (*Kernel) GetStep added in v0.6.0

func (k *Kernel) GetStep(ctx context.Context, stepID string) (domain.Step, error)

func (*Kernel) GrantApproval added in v0.6.0

func (k *Kernel) GrantApproval(ctx context.Context, id uuid.UUID, req GrantApprovalRequest) error

func (*Kernel) Heartbeat added in v0.7.0

func (k *Kernel) Heartbeat(ctx context.Context, execID uuid.UUID, lease domain.Lease) error

func (*Kernel) ListAgents added in v0.6.0

func (k *Kernel) ListAgents(ctx context.Context) ([]domain.Agent, error)

func (*Kernel) ListExecutions

func (k *Kernel) ListExecutions(ctx context.Context, filter domain.ExecutionFilter) (domain.ExecutionPage, error)

func (*Kernel) ListPendingApprovals added in v0.6.0

func (k *Kernel) ListPendingApprovals(ctx context.Context) ([]domain.Approval, error)

func (*Kernel) ListSteps added in v0.6.0

func (k *Kernel) ListSteps(ctx context.Context, execID uuid.UUID) ([]domain.Step, error)

func (*Kernel) LoadPolicyBundle added in v0.6.0

func (k *Kernel) LoadPolicyBundle(ctx context.Context, agentID string, bundle string) error

func (*Kernel) RegisterAgent added in v0.6.0

func (k *Kernel) RegisterAgent(ctx context.Context, agent domain.Agent) error

func (*Kernel) RunDispatcher added in v0.18.0

func (k *Kernel) RunDispatcher(ctx context.Context) error

RunDispatcher logs store errors and backs off rather than returning them.

func (*Kernel) SubmitStep added in v0.6.0

func (k *Kernel) SubmitStep(ctx context.Context, execID uuid.UUID, req SubmitStepRequest) (domain.StepDecision, error)

func (*Kernel) TestPolicy added in v0.19.0

func (k *Kernel) TestPolicy(ctx context.Context, agentID string, req PolicyTestRequest) (policy.Report, error)

type PolicyTestRequest added in v0.19.0

type PolicyTestRequest struct {
	Bundle      string        `json:"bundle,omitempty"`       // empty: the agent's stored bundle
	Cases       []policy.Case `json:"cases,omitempty"`        // ignored when ExecutionID is set
	ExecutionID *uuid.UUID    `json:"execution_id,omitempty"` // replay this execution's steps
}

type SubmitStepRequest added in v0.6.0

type SubmitStepRequest struct {
	Kind        domain.StepKind `json:"kind"`
	Target      string          `json:"target"`
	Args        json.RawMessage `json:"args"`
	Idempotency string          `json:"idempotency,omitempty"`
	Lease       domain.Lease    `json:"-"`
}

Jump to

Keyboard shortcuts

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