Documentation
¶
Overview ¶
Package participation owns the shared Network participation contract.
Index ¶
- Constants
- Variables
- func ObserveResolved(ctx context.Context, resolver Resolver, observation ResolvedObservation) error
- func OwnerKey(owner OwnerRef) string
- func ValidateOwner(owner OwnerRef) error
- func ValidateOwnerKey(value string) error
- func ValidateSpec(spec Spec) error
- type AuthorityFunc
- type AuthorityScope
- type AvailabilityFunc
- type Bounds
- type BoundsRequest
- type ChannelExistsFunc
- type ChannelStrategy
- type Intent
- type IntentResolver
- type Limits
- type LiveSupportFunc
- type Mode
- type OwnerKind
- type OwnerRef
- type Request
- type ResolveInput
- type ResolvedObservation
- type ResolvedObserver
- type Resolver
- type ResolverOptions
- type Source
- type Spec
- type Status
- type WorkspaceCoordinationFunc
Constants ¶
const SpecVersion = "network-participation/v1"
Variables ¶
var ( ErrChannelUnknown = errors.New("network_channel_unknown") ErrStrategyInvalid = errors.New("network_strategy_invalid") ErrStrategyChannelConflict = errors.New("network_strategy_channel_conflict") ErrAuthorityDenied = errors.New("network_participation_permission_denied") ErrBoundsExceedCeiling = errors.New("network_bounds_exceed_ceiling") ErrLoopRequiresLive = errors.New("loop_requires_live") ErrLiveUnsupported = errors.New("network_live_unsupported") ErrNotParticipating = errors.New("not_participating") )
Functions ¶
func ObserveResolved ¶
func ObserveResolved( ctx context.Context, resolver Resolver, observation ResolvedObservation, ) error
ObserveResolved publishes a committed snapshot when the resolver supports observations.
func ValidateOwner ¶
ValidateOwner verifies that an execution owner has a supported kind and stable identity.
func ValidateOwnerKey ¶
ValidateOwnerKey verifies a canonical kind-prefixed budget-owner identity.
func ValidateSpec ¶
ValidateSpec verifies that an immutable participation snapshot is complete and internally consistent.
Types ¶
type AuthorityFunc ¶
type AuthorityScope ¶
AuthorityScope carries the concrete channel grant delegated to one child execution.
type Bounds ¶
type Bounds struct {
MaxWakes int `json:"max_wakes" yaml:"max_wakes" toml:"max_wakes"`
MaxWakeWallTime string `json:"max_wake_wall_time" yaml:"max_wake_wall_time" toml:"max_wake_wall_time"`
MaxTotalWallTime string `json:"max_total_wall_time" yaml:"max_total_wall_time" toml:"max_total_wall_time"`
MaxInputTokens int64 `json:"max_input_tokens" yaml:"max_input_tokens" toml:"max_input_tokens"`
MaxOutputTokens int64 `json:"max_output_tokens" yaml:"max_output_tokens" toml:"max_output_tokens"`
MaxWakeDepth int `json:"max_wake_depth" yaml:"max_wake_depth" toml:"max_wake_depth"`
CoalesceWindow string `json:"coalesce_window" yaml:"coalesce_window" toml:"coalesce_window"`
}
func ResolveBounds ¶
func ResolveBounds(request *BoundsRequest, defaults Bounds, limits Limits) (Bounds, error)
type BoundsRequest ¶
type BoundsRequest struct {
MaxWakes *int `json:"max_wakes,omitempty" yaml:"max_wakes,omitempty" toml:"max_wakes,omitempty"`
MaxWakeWallTime *string `json:"max_wake_wall_time,omitempty" yaml:"max_wake_wall_time,omitempty" toml:"max_wake_wall_time,omitempty"`
MaxTotalWallTime *string `json:"max_total_wall_time,omitempty" yaml:"max_total_wall_time,omitempty" toml:"max_total_wall_time,omitempty"`
MaxInputTokens *int64 `json:"max_input_tokens,omitempty" yaml:"max_input_tokens,omitempty" toml:"max_input_tokens,omitempty"`
MaxOutputTokens *int64 `json:"max_output_tokens,omitempty" yaml:"max_output_tokens,omitempty" toml:"max_output_tokens,omitempty"`
MaxWakeDepth *int `json:"max_wake_depth,omitempty" yaml:"max_wake_depth,omitempty" toml:"max_wake_depth,omitempty"`
CoalesceWindow *string `json:"coalesce_window,omitempty" yaml:"coalesce_window,omitempty" toml:"coalesce_window,omitempty"`
}
type ChannelExistsFunc ¶
type ChannelStrategy ¶
type ChannelStrategy string
const ( StrategyNamed ChannelStrategy = "named" StrategyRun ChannelStrategy = "run" StrategyLoopRun ChannelStrategy = "loop_run" )
type IntentResolver ¶
type IntentResolver interface {
Resolver
SelectIntent(ctx context.Context, in ResolveInput) (Intent, error)
ResolveIntent(ctx context.Context, in ResolveInput, intent Intent) (Spec, error)
}
IntentResolver exposes the selected intent so pre-resolve policy observes the same input as resolution.
type Limits ¶
type LiveSupportFunc ¶
type LiveSupportFunc func(ctx context.Context, in ResolveInput) (bool, error)
type OwnerRef ¶
type OwnerRef struct {
WorkspaceID string `json:"workspace_id"`
Kind OwnerKind `json:"kind"`
ID string `json:"id"`
}
func OwnerRefFromKey ¶
OwnerRefFromKey reconstructs a public owner reference at an internal owner-key boundary.
type Request ¶
type Request struct {
Mode *Mode `json:"mode,omitempty" yaml:"mode,omitempty" toml:"mode,omitempty"`
ChannelStrategy *ChannelStrategy `json:"channel_strategy,omitempty" yaml:"channel_strategy,omitempty" toml:"channel_strategy,omitempty"`
ChannelID *string `json:"channel_id,omitempty" yaml:"channel_id,omitempty" toml:"channel_id,omitempty"`
Bounds *BoundsRequest `json:"bounds,omitempty" yaml:"bounds,omitempty" toml:"bounds,omitempty"`
}
func CloneRequest ¶
CloneRequest returns a deep copy of one unresolved participation intent.
func NormalizeIntent ¶
NormalizeIntent validates and canonicalizes persisted execution intent without resolving omitted live bounds against runtime defaults. Resolution remains the single place that fills defaults and enforces ceilings.
type ResolveInput ¶
type ResolvedObservation ¶
ResolvedObservation binds one committed snapshot to its durable owner.
type ResolvedObserver ¶
type ResolvedObserver interface {
ObserveParticipationResolved(ctx context.Context, observation ResolvedObservation) error
}
ResolvedObserver receives one immutable snapshot only after its owner commits.
type Resolver ¶
type Resolver interface {
Resolve(ctx context.Context, in ResolveInput) (Spec, error)
}
func NewResolver ¶
func NewResolver(options ResolverOptions) (Resolver, error)
type ResolverOptions ¶
type ResolverOptions struct {
Defaults Bounds
Limits Limits
Availability AvailabilityFunc
ChannelExists ChannelExistsFunc
WorkspaceCoordination WorkspaceCoordinationFunc
LiveSupport LiveSupportFunc
Authority AuthorityFunc
}
type Source ¶
type Source string
const ( SourceExplicitRequest Source = "explicit_request" SourceTaskProfile Source = "task_profile" SourceWorkspaceCoordination Source = "workspace_coordination" SourceLoopDefinition Source = "loop_definition" SourceAutomationJob Source = "automation_job" SourceBuiltInLocal Source = "built_in_local" )
type Spec ¶
type Spec struct {
Version string `json:"version"`
Mode Mode `json:"mode"`
WorkspaceID string `json:"workspace_id,omitempty"`
ChannelStrategy ChannelStrategy `json:"channel_strategy,omitempty"`
ChannelID string `json:"channel_id,omitempty"`
Source Source `json:"source"`
Bounds Bounds `json:"bounds,omitzero"`
}