Documentation
¶
Overview ¶
Package teamcontrol persists operator control intent for Coding Teams.
Index ¶
- Variables
- type Action
- type Command
- type Entry
- type InterruptedDisposition
- type Limits
- type ListOptions
- type Mutation
- type Page
- type Record
- type ResolvedTarget
- type Revision
- type State
- type Store
- func (s *Store) Begin(ctx context.Context, teamID team.ID, commandID team.CommandID, ...) (Record, error)
- func (s *Store) Complete(ctx context.Context, teamID team.ID, commandID team.CommandID, ...) (Record, error)
- func (s *Store) CompletePending(ctx context.Context, teamID team.ID, commandID team.CommandID, ...) (Record, error)
- func (s *Store) Dir() string
- func (s *Store) Get(ctx context.Context, teamID team.ID, commandID team.CommandID) (Record, error)
- func (s *Store) List(ctx context.Context, teamID team.ID, options ListOptions) (Page, error)
- func (s *Store) Pending(ctx context.Context, teamID team.ID, limit int) ([]Record, error)
- func (s *Store) Revision(ctx context.Context, teamID team.ID) (Revision, error)
- func (s *Store) Submit(ctx context.Context, command Command, expected Revision) (Record, error)
- type Target
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalid means an API value or durable record is malformed. ErrInvalid = errors.New("coding team control: invalid value") // ErrNotFound means a command or Team journal does not exist. ErrNotFound = errors.New("coding team control: not found") // ErrConflict means the expected revision is stale. ErrConflict = errors.New("coding team control: revision conflict") // ErrIdempotency means a mutation ID was reused for different semantics. ErrIdempotency = errors.New("coding team control: idempotency conflict") // ErrCorrupt means a durable journal cannot be replayed safely. ErrCorrupt = errors.New("coding team control: corrupt journal") // ErrUnsafeFile means a journal violates the private-file contract. ErrUnsafeFile = errors.New("coding team control: unsafe filesystem object") // ErrLimit means an input or durable journal exceeds configured bounds. ErrLimit = errors.New("coding team control: limit exceeded") // ErrLocked means another process owns the journal writer lock. ErrLocked = errors.New("coding team control: journal is locked") // ErrUnsupported means the platform cannot enforce the journal contract. ErrUnsupported = errors.New("coding team control: unsupported platform") // ErrAmbiguous means stable identity did not resolve to exactly one live execution. ErrAmbiguous = errors.New("coding team control: ambiguous target") )
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action identifies one operator control operation.
const ( ActionMessage Action = "message" ActionFollowUp Action = "follow_up" ActionInterruptAttempt Action = "interrupt_attempt" ActionCancelTask Action = "cancel_task" ActionRetryTask Action = "retry_task" ActionCancelTeam Action = "cancel_team" ActionResolveApproval Action = "resolve_approval" ActionResolveQuestion Action = "resolve_question" ActionRejectQuestion Action = "reject_question" )
Supported operator control actions.
type Command ¶
type Command struct {
ID team.CommandID `json:"id"`
Action Action `json:"action"`
Target Target `json:"target"`
Text string `json:"text,omitempty"`
Payload ai.JSON `json:"payload,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Command is immutable operator intent.
type Entry ¶
type Entry struct {
Command Command `json:"command"`
State State `json:"state"`
Resolved *ResolvedTarget `json:"resolved,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
Entry is the latest durable state of one operator command.
type InterruptedDisposition ¶
type InterruptedDisposition string
InterruptedDisposition describes safe restart handling for an applying entry.
const ( DispositionNone InterruptedDisposition = "none" DispositionReconcile InterruptedDisposition = "reconcile" DispositionDeliveryUnknown InterruptedDisposition = "delivery_unknown" )
Interrupted command dispositions.
func ClassifyInterrupted ¶
func ClassifyInterrupted(entry Entry) InterruptedDisposition
ClassifyInterrupted returns the only safe automatic handling for an applying entry.
type Limits ¶
type Limits struct {
MaxFileBytes int64
MaxRecordBytes int
MaxRecords int
MaxTextBytes int
MaxListResults int
}
Limits bound a private control journal.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns production control-journal bounds.
type ListOptions ¶
ListOptions selects a bounded transition page after an exclusive revision.
type Mutation ¶
type Mutation struct {
ID team.CommandID `json:"id"`
ExpectedRevision Revision `json:"expected_revision"`
}
Mutation identifies one idempotent control-journal transition.
type ResolvedTarget ¶
type ResolvedTarget struct {
TeamID team.ID `json:"team_id"`
MemberID team.MemberID `json:"member_id,omitempty"`
TaskID team.TaskID `json:"task_id,omitempty"`
AttemptID team.AttemptID `json:"attempt_id,omitempty"`
ContinuationID continuation.ID `json:"continuation_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
OwnerGeneration uint64 `json:"owner_generation,omitempty"`
}
ResolvedTarget is the exact execution identity selected before a side effect.
func ResolveCommand ¶
func ResolveCommand(group team.Team, resources teamstate.Snapshot, command Command) (ResolvedTarget, error)
ResolveCommand validates its domain target and resolves live actions to one execution.
func ResolveTarget ¶
func ResolveTarget(group team.Team, resources teamstate.Snapshot, target Target) (ResolvedTarget, error)
ResolveTarget deterministically binds stable operator identity to one live execution.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists one strict append-only operator control journal per Team.
func (*Store) Begin ¶
func (s *Store) Begin( ctx context.Context, teamID team.ID, commandID team.CommandID, mutation Mutation, resolved ResolvedTarget, ) (Record, error)
Begin persists the exact execution identity before an external side effect.
func (*Store) Complete ¶
func (s *Store) Complete( ctx context.Context, teamID team.ID, commandID team.CommandID, mutation Mutation, state State, errorCode string, ) (Record, error)
Complete durably records one terminal result after applying or reconciling a command.
func (*Store) CompletePending ¶
func (s *Store) CompletePending( ctx context.Context, teamID team.ID, commandID team.CommandID, mutation Mutation, state State, errorCode string, ) (Record, error)
CompletePending records a command that could not resolve to an exact live execution. No external side effect has started, so only rejected and stale are valid terminal states and Resolved remains empty.
func (*Store) Pending ¶
Pending returns bounded current pending/applying commands in creation order.
type Target ¶
type Target struct {
TeamID team.ID `json:"team_id"`
MemberID team.MemberID `json:"member_id,omitempty"`
TaskID team.TaskID `json:"task_id,omitempty"`
ExpectedAttemptID team.AttemptID `json:"expected_attempt_id,omitempty"`
OwnerGeneration uint64 `json:"owner_generation,omitempty"`
}
Target carries stable logical identity supplied by the operator.