Help us shape the future of Go! Take the 2026 Go Developer Survey

taskstate

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion     = 1
	FinalReviewPass   = "pass"
	FinalReviewFailed = "failed"
)
View Source
const (
	StepPending    = "pending"
	StepInProgress = "in_progress"
	StepCompleted  = "completed"
)

Variables

View Source
var ErrTaskNotFound = errors.New("task not found")

Functions

This section is empty.

Types

type Condition

type Condition struct {
	ID        string    `json:"id"`
	Text      string    `json:"text"`
	CreatedAt time.Time `json:"created_at"`
}

type Event

type Event struct {
	Type      string    `json:"type"`
	Summary   string    `json:"summary"`
	CreatedAt time.Time `json:"created_at"`
}

type EvolutionBinding added in v0.7.6

type EvolutionBinding struct {
	EvolutionID string    `json:"evolution_id"`
	OnSuccess   string    `json:"on_success"`
	OnFailure   string    `json:"on_failure"`
	BoundAt     time.Time `json:"bound_at"`
}

type EvolutionContextItem added in v0.7.6

type EvolutionContextItem struct {
	EvolutionID    string   `json:"evolution_id"`
	Type           string   `json:"type"`
	Statement      string   `json:"statement"`
	Scope          string   `json:"scope,omitempty"`
	Project        string   `json:"project,omitempty"`
	Device         string   `json:"device,omitempty"`
	Status         string   `json:"status"`
	Guided         bool     `json:"guided,omitempty"`
	ReviewRevision string   `json:"review_revision,omitempty"`
	EvidenceRefs   []string `json:"evidence_refs,omitempty"`
}

type FinalReview

type FinalReview struct {
	Status         string    `json:"status"`
	Summary        string    `json:"summary"`
	VerifiedFacts  []string  `json:"verified_facts,omitempty"`
	OpenRisks      []string  `json:"open_risks,omitempty"`
	MissingChecks  []string  `json:"missing_checks,omitempty"`
	ReviewRevision string    `json:"review_revision"`
	ReviewedAt     time.Time `json:"reviewed_at"`
}

type FinalReviewInput

type FinalReviewInput struct {
	Status        string   `json:"status"`
	Summary       string   `json:"summary"`
	VerifiedFacts []string `json:"verified_facts,omitempty"`
	OpenRisks     []string `json:"open_risks,omitempty"`
	MissingChecks []string `json:"missing_checks,omitempty"`
}

type MatchRule

type MatchRule struct {
	Keywords []string `json:"keywords,omitempty"`
	Devices  []string `json:"devices,omitempty"`
	Type     string   `json:"type,omitempty"`
}

type Phase

type Phase string
const (
	PhaseCheck    Phase = "check"
	PhaseExecute  Phase = "execute"
	PhaseVerify   Phase = "verify"
	PhaseCloseout Phase = "closeout"
)

type Status

type Status string
const (
	StatusActive    Status = "active"
	StatusBlocked   Status = "blocked"
	StatusCompleted Status = "completed"
)

type Store

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

func New

func New(root string) (*Store, error)

func (*Store) BatchCheckpoint

func (s *Store) BatchCheckpoint(id string, completedStepIDs []string, currentStepID, summary string) (Task, error)

func (*Store) BindEvolution added in v0.7.6

func (s *Store) BindEvolution(id string, binding EvolutionBinding) (Task, error)

func (*Store) Block

func (s *Store) Block(id, summary string) (Task, error)

func (*Store) Checkpoint

func (s *Store) Checkpoint(id, stepID, status, summary string) (Task, error)

func (*Store) Complete

func (s *Store) Complete(id string) (Task, error)

func (*Store) Create

func (s *Store) Create(title, goal string, conditionTexts []string, steps []TaskStepInput, sourceTemplates []TemplateReference) (Task, error)

func (*Store) CreateWithContext added in v0.7.6

func (s *Store) CreateWithContext(title, goal, project, device string, conditionTexts []string, steps []TaskStepInput, sourceTemplates []TemplateReference, initialBindings ...EvolutionBinding) (Task, error)

func (*Store) Delete

func (s *Store) Delete(id string) (Task, error)

func (*Store) FinalReview

func (s *Store) FinalReview(id string, input FinalReviewInput) (Task, error)

func (*Store) Get

func (s *Store) Get(id string) (Task, error)

func (*Store) List

func (s *Store) List(status Status, limit int) ([]Task, error)

func (*Store) Resume

func (s *Store) Resume(id, summary string) (Task, error)

func (*Store) Root

func (s *Store) Root() string

func (*Store) SetEvolutionCandidates added in v0.7.6

func (s *Store) SetEvolutionCandidates(id, reviewRevision string, items []EvolutionContextItem) (Task, error)

func (*Store) SetGuidanceContext added in v0.7.6

func (s *Store) SetGuidanceContext(id string, items []EvolutionContextItem) (Task, error)

type Task

type Task struct {
	SchemaVersion         int                    `json:"schema_version"`
	ID                    string                 `json:"id"`
	Title                 string                 `json:"title"`
	Goal                  string                 `json:"goal"`
	Project               string                 `json:"project,omitempty"`
	Device                string                 `json:"device,omitempty"`
	Status                Status                 `json:"status"`
	Phase                 Phase                  `json:"phase"`
	Conditions            []Condition            `json:"conditions"`
	Template              *TemplateSelection     `json:"template,omitempty"` // 仅用于读取旧任务状态。
	SourceTemplates       []TemplateReference    `json:"source_templates,omitempty"`
	Steps                 []TaskStep             `json:"steps,omitempty"`
	Events                []Event                `json:"events"`
	Blocker               string                 `json:"blocker,omitempty"`
	Summary               string                 `json:"summary,omitempty"`
	GuidanceContext       []EvolutionContextItem `json:"guidance_context,omitempty"`
	EvolutionGuidanceSeen []string               `json:"evolution_guidance_seen,omitempty"`
	EvolutionCandidates   []EvolutionContextItem `json:"evolution_candidates,omitempty"`
	EvolutionBindings     []EvolutionBinding     `json:"evolution_bindings,omitempty"`
	FinalReview           *FinalReview           `json:"final_review,omitempty"`
	CreatedAt             time.Time              `json:"created_at"`
	UpdatedAt             time.Time              `json:"updated_at"`
	CompletedAt           *time.Time             `json:"completed_at,omitempty"`
}

type TaskStep

type TaskStep struct {
	ID        string    `json:"id"`
	Title     string    `json:"title"`
	Phase     Phase     `json:"phase"`
	Status    string    `json:"status"`
	UpdatedAt time.Time `json:"updated_at"`
}

type TaskStepInput

type TaskStepInput struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Phase Phase  `json:"phase,omitempty"`
}

type Template

type Template struct {
	ID                   string         `json:"id"`
	Version              string         `json:"version"`
	Title                string         `json:"title"`
	Description          string         `json:"description,omitempty"`
	SourceEvolutionID    string         `json:"source_evolution_id,omitempty"`
	Status               TemplateStatus `json:"status"`
	Match                MatchRule      `json:"match,omitempty"`
	CompletionConditions []string       `json:"completion_conditions"`
	Steps                []TemplateStep `json:"steps"`
	AllowLongTemplate    bool           `json:"allow_long_template,omitempty"`
	LongTemplateReason   string         `json:"long_template_reason,omitempty"`
	Hash                 string         `json:"hash,omitempty"`
	PublishedAt          *time.Time     `json:"published_at,omitempty"`
	RetiredAt            *time.Time     `json:"retired_at,omitempty"`
}

type TemplateCandidate

type TemplateCandidate struct {
	ID      string `json:"id"`
	Version string `json:"version"`
	Score   int    `json:"score"`
	Reason  string `json:"reason"`
}

type TemplateReference

type TemplateReference struct {
	ID                string `json:"id"`
	Version           string `json:"version"`
	Hash              string `json:"hash,omitempty"`
	SourceEvolutionID string `json:"source_evolution_id,omitempty"`
}

type TemplateSelection

type TemplateSelection struct {
	ID             string              `json:"id"`
	Version        string              `json:"version"`
	Hash           string              `json:"hash"`
	SelectedReason string              `json:"selected_reason"`
	Candidates     []TemplateCandidate `json:"candidates,omitempty"`
}

type TemplateStatus

type TemplateStatus string
const (
	TemplateActive  TemplateStatus = "active"
	TemplateRetired TemplateStatus = "retired"
)

type TemplateStep

type TemplateStep struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Phase Phase  `json:"phase"`
}

Jump to

Keyboard shortcuts

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