types

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package types defines internal enums and value types for the Pasture daemon and CLI. These types are not part of the public API surface but are shared across internal packages.

Internal packages import pkg/protocol directly for public convergence types (D11: no internal/types/aliases.go).

Index

Constants

This section is empty.

Variables

View Source
var AllAuditTrailBackends = []AuditTrailBackend{BackendMemory, BackendSqlite}

AllAuditTrailBackends is the ordered slice of all valid AuditTrailBackend values.

AllBumpKinds is the ordered slice of all valid BumpKind values.

AllDomains is the ordered slice of all valid Domain values.

View Source
var AllOutputFormats = []OutputFormat{OutputJSON, OutputText}

AllOutputFormats is the ordered slice of all valid OutputFormat values.

AllReviewAxes is the ordered slice of all valid ReviewAxis values.

AllRoleIds is the ordered slice of all valid RoleId values.

AllSeverityLevels is the ordered slice of all valid SeverityLevel values.

View Source
var AllVoteTypes = []VoteType{VoteAccept, VoteRevise}

AllVoteTypes is the ordered slice of all valid VoteType values.

Functions

This section is empty.

Types

type AuditTrailBackend

type AuditTrailBackend string

AuditTrailBackend specifies the audit trail storage backend for pastured.

const (
	BackendMemory AuditTrailBackend = "memory"
	BackendSqlite AuditTrailBackend = "sqlite"
)

func (AuditTrailBackend) IsValid

func (b AuditTrailBackend) IsValid() bool

IsValid reports whether b is a known AuditTrailBackend value.

type BumpKind

type BumpKind string

BumpKind specifies the semver component to increment in pasture-release.

const (
	BumpMajor BumpKind = "major"
	BumpMinor BumpKind = "minor"
	BumpPatch BumpKind = "patch"
)

func (BumpKind) IsValid

func (k BumpKind) IsValid() bool

IsValid reports whether k is a known BumpKind value.

type Domain

type Domain string

Domain classifies a phase into a high-level lifecycle domain. Values match schema.xml <enum name="DomainType"> entries.

const (
	DomainUser Domain = "user"
	DomainPlan Domain = "plan"
	DomainImpl Domain = "impl"
)

func (Domain) IsValid

func (d Domain) IsValid() bool

IsValid reports whether d is a known Domain value.

type EpochState

type EpochState struct {
	EpochId           string                  `json:"epochId"`
	CurrentPhase      protocol.PhaseId        `json:"currentPhase"`
	CurrentRole       RoleId                  `json:"currentRole"`
	CompletedPhases   []protocol.PhaseId      `json:"completedPhases"`
	ReviewVotes       map[ReviewAxis]VoteType `json:"reviewVotes"`
	BlockerCount      int                     `json:"blockerCount"`
	TransitionHistory []TransitionRecord      `json:"transitionHistory"`
	// ReviewCycles tracks per-slice review-fix cycle history.
	// Key: slice task ID. Value: ordered list of review rounds for that slice.
	ReviewCycles       map[string][]ReviewCycleRecord `json:"reviewCycles,omitempty"`
	LastError          *string                        `json:"lastError,omitempty"`
	ActiveSessionCount int                            `json:"activeSessionCount"`
}

EpochState holds the runtime state of a single epoch workflow.

Tracks the current phase, completed phases, review votes, blocker count, current role, and full transition history. Mutable — updated by signal handlers within EpochWorkflow.

type OutputFormat

type OutputFormat string

OutputFormat specifies the CLI output format for pasture-msg commands.

const (
	OutputJSON OutputFormat = "json"
	OutputText OutputFormat = "text"
)

func (OutputFormat) IsValid

func (f OutputFormat) IsValid() bool

IsValid reports whether f is a known OutputFormat value.

type PhaseAdvanceSignal

type PhaseAdvanceSignal struct {
	ToPhase      protocol.PhaseId `json:"toPhase"`
	TriggeredBy  string           `json:"triggeredBy"`
	ConditionMet string           `json:"conditionMet"`
}

PhaseAdvanceSignal is the payload for the advance_phase Temporal signal.

Sent by pasture-msg (or any authorized caller) to transition the epoch workflow to a new phase. TriggeredBy identifies who or what sent the signal (e.g. a role name or external trigger). ConditionMet describes the transition condition from the protocol table that was satisfied.

type QueryStateResult

type QueryStateResult struct {
	CurrentPhase         protocol.PhaseId        `json:"currentPhase"`
	CurrentRole          RoleId                  `json:"currentRole"`
	TransitionHistory    []TransitionRecord      `json:"transitionHistory"`
	Votes                map[ReviewAxis]VoteType `json:"votes"`
	LastError            *string                 `json:"lastError,omitempty"`
	AvailableTransitions []protocol.PhaseId      `json:"availableTransitions"`
	ActiveSessionCount   int                     `json:"activeSessionCount"`
}

QueryStateResult is a serialization-safe snapshot of epoch state returned by the full_state Temporal query. Designed for CLI consumers (pasture-msg).

AvailableTransitions lists the target PhaseIds reachable from the current phase given the current vote/blocker state.

type RegisterSessionSignal

type RegisterSessionSignal struct {
	EpochId      string `json:"epochId"`
	SessionId    string `json:"sessionId"`
	Role         string `json:"role"`
	ModelHarness string `json:"modelHarness"`
	Model        string `json:"model"`
}

RegisterSessionSignal is the payload for the register_session Temporal signal.

Registers a Claude Code session with the active epoch for observability and permission tracking. Duplicate session_id registrations are silently ignored (idempotent). ModelHarness identifies the runtime harness (e.g. "claude-code").

type ReviewAxis

type ReviewAxis string

ReviewAxis identifies a semantic dimension of a code review vote. Values are lowercase wire-format strings used in JSON and Temporal serialization.

const (
	AxisCorrectness ReviewAxis = "correctness"
	AxisTestQuality ReviewAxis = "test_quality"
	AxisElegance    ReviewAxis = "elegance"
)

func (ReviewAxis) IsValid

func (a ReviewAxis) IsValid() bool

IsValid reports whether a is a known ReviewAxis value.

type ReviewCycleRecord

type ReviewCycleRecord struct {
	// SliceId is the Beads task ID of the slice being reviewed.
	SliceId string `json:"sliceId"`
	// Round is the 1-based review cycle number for this slice (max 3).
	Round int `json:"round"`
	// Votes maps each reviewer axis to its vote for this round.
	Votes map[ReviewAxis]VoteType `json:"votes"`
	// FindingCounts maps severity level to the number of findings.
	FindingCounts map[SeverityLevel]int `json:"findingCounts"`
	// Timestamp records when the review round completed.
	Timestamp time.Time `json:"timestamp"`
}

ReviewCycleRecord tracks the state of a single review-fix cycle for one slice.

The supervisor creates one record per (slice, round) pair. It captures which reviewers participated, their votes, and the count of findings by severity. This enables the supervisor to enforce the max-3-cycles constraint and determine whether a clean exit was reached via IsCleanExit().

func (ReviewCycleRecord) IsCleanExit

func (r ReviewCycleRecord) IsCleanExit() bool

IsCleanExit returns true if the review cycle is clean: all 3 axes voted ACCEPT AND there are 0 BLOCKERs and 0 IMPORTANTs. This is the single authoritative check for the Ride the Wave workflow.

type ReviewVoteSignal

type ReviewVoteSignal struct {
	Axis       ReviewAxis `json:"axis"`
	Vote       VoteType   `json:"vote"`
	ReviewerId string     `json:"reviewerId"`
}

ReviewVoteSignal is the payload for the submit_vote Temporal signal.

ReviewerId must be the unique identifier for the reviewer agent submitting the vote. Axis and Vote use their wire-format string values for Temporal JSON round-trip safety.

type RoleId

type RoleId string

RoleId identifies an agent role within the protocol. Values match schema.xml <role id="..."> elements.

const (
	RoleEpoch      RoleId = "epoch"
	RoleArchitect  RoleId = "architect"
	RoleReviewer   RoleId = "reviewer"
	RoleSupervisor RoleId = "supervisor"
	RoleWorker     RoleId = "worker"
)

func (RoleId) IsValid

func (r RoleId) IsValid() bool

IsValid reports whether r is a known RoleId value.

type SeverityLevel

type SeverityLevel string

SeverityLevel classifies the severity of a code review finding. Used as the key type for ReviewCycleRecord.FindingCounts to prevent stringly-typed map access.

const (
	SeverityBlocker   SeverityLevel = "blocker"
	SeverityImportant SeverityLevel = "important"
	SeverityMinor     SeverityLevel = "minor"
)

func (SeverityLevel) IsValid

func (s SeverityLevel) IsValid() bool

IsValid reports whether s is a known SeverityLevel value.

type SliceProgressSignal

type SliceProgressSignal struct {
	SliceId    string `json:"sliceId"`
	LeafTaskId string `json:"leafTaskId"`
	StageName  string `json:"stageName"`
	Completed  bool   `json:"completed"`
}

SliceProgressSignal is the payload for the slice_progress Temporal signal.

Sent by a SliceWorkflow to its parent EpochWorkflow to report per-leaf-task progress. Completed is true when the leaf task finishes, false for in-progress heartbeat events.

type TransitionRecord

type TransitionRecord struct {
	FromPhase    protocol.PhaseId `json:"fromPhase"`
	ToPhase      protocol.PhaseId `json:"toPhase"`
	Timestamp    time.Time        `json:"timestamp"`
	TriggeredBy  string           `json:"triggeredBy"`
	ConditionMet string           `json:"conditionMet"`
	Success      bool             `json:"success"`
}

TransitionRecord is an immutable audit entry for a single phase transition.

Success is true for a completed phase advance, false for a failed attempt (e.g. constraint violation). All programmatic success/failure checks MUST use this boolean field, not any string prefix in ConditionMet.

type VoteType

type VoteType string

VoteType represents a binary review vote. Values match schema.xml <enum name="VoteType"> entries.

const (
	VoteAccept VoteType = "ACCEPT"
	VoteRevise VoteType = "REVISE"
)

func (VoteType) IsValid

func (v VoteType) IsValid() bool

IsValid reports whether v is a known VoteType value.

Jump to

Keyboard shortcuts

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