workflow

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RequiredWorkflowSkillName = "openase-platform"

Variables

View Source
var (
	ErrProjectNotFound                    = errors.New("project not found")
	ErrWorkflowNotFound                   = errors.New("workflow not found")
	ErrStatusNotFound                     = errors.New("workflow status not found in project")
	ErrAgentNotFound                      = errors.New("workflow agent not found in project")
	ErrWorkflowNameConflict               = errors.New("workflow name already exists in this project")
	ErrWorkflowHarnessPathConflict        = errors.New("workflow harness path already exists in this project")
	ErrWorkflowConflict                   = errors.New("workflow conflict")
	ErrPickupStatusConflict               = errors.New("workflow pickup status conflict")
	ErrWorkflowStatusBindingOverlap       = errors.New("workflow pickup and finish statuses must not overlap")
	ErrWorkflowReferencedByTickets        = errors.New("workflow cannot be deleted because tickets still reference it")
	ErrWorkflowReferencedByScheduledJobs  = errors.New("workflow cannot be deleted because scheduled jobs still reference it")
	ErrWorkflowInUse                      = errors.New("workflow is still referenced by project or tickets")
	ErrWorkflowReplacementRequired        = errors.New("workflow references must be replaced before purge")
	ErrWorkflowActiveAgentRuns            = errors.New("workflow has active agent runs")
	ErrWorkflowHistoricalAgentRuns        = errors.New("workflow has historical agent runs")
	ErrWorkflowReplacementInvalid         = errors.New("workflow replacement is invalid")
	ErrWorkflowReplacementNotFound        = errors.New("replacement workflow not found")
	ErrWorkflowReplacementProjectMismatch = errors.New("replacement workflow must belong to the same project")
	ErrWorkflowReplacementInactive        = errors.New("replacement workflow must be active")
	ErrSkillInvalid                       = errors.New("skill is invalid")
	ErrSkillNotFound                      = errors.New("skill not found")
)

Functions

func IsRequiredWorkflowSkillName added in v0.4.0

func IsRequiredWorkflowSkillName(raw string) bool

func RequiredWorkflowPlatformAccessAllowed added in v0.4.0

func RequiredWorkflowPlatformAccessAllowed() []string

func RequiredWorkflowSkillNames added in v0.4.0

func RequiredWorkflowSkillNames() []string

Types

type BuildHarnessTemplateDataInput

type BuildHarnessTemplateDataInput struct {
	WorkflowID         uuid.UUID
	TicketID           uuid.UUID
	AgentID            *uuid.UUID
	Workspace          string
	Timestamp          time.Time
	OpenASEVersion     string
	TicketURL          string
	Platform           HarnessPlatformData
	Machine            HarnessMachineData
	AccessibleMachines []HarnessAccessibleMachineData
}

type CreateInput

type CreateInput struct {
	ProjectID             uuid.UUID
	AgentID               uuid.UUID
	Name                  string
	Type                  Type
	RoleSlug              string
	RoleName              string
	RoleDescription       string
	PlatformAccessAllowed []string
	SkillNames            []string
	CreatedBy             string
	HarnessPath           *string
	HarnessContent        string
	Hooks                 map[string]any
	MaxConcurrent         int
	MaxRetryAttempts      int
	TimeoutMinutes        int
	StallTimeoutMinutes   int
	IsActive              bool
	PickupStatusIDs       StatusBindingSet
	FinishStatusIDs       StatusBindingSet
}

type CreateSkillBundleInput

type CreateSkillBundleInput struct {
	ProjectID uuid.UUID
	Name      string
	Files     []SkillBundleFileInput
	CreatedBy string
	Enabled   *bool
}

type CreateSkillInput

type CreateSkillInput struct {
	ProjectID   uuid.UUID
	Name        string
	Content     string
	Description string
	CreatedBy   string
	Enabled     *bool
}

type HarnessAccessibleMachineData

type HarnessAccessibleMachineData struct {
	Name        string
	Host        string
	Description string
	Labels      []string
	Resources   map[string]any
	SSHUser     string
}

type HarnessAgentData

type HarnessAgentData struct {
	ID                    string
	Name                  string
	Provider              string
	AdapterType           string
	Model                 string
	TotalTicketsCompleted int
}

type HarnessDocument

type HarnessDocument struct {
	WorkflowID uuid.UUID `json:"workflow_id"`
	Path       string    `json:"path"`
	Content    string    `json:"content"`
	Version    int       `json:"version"`
}

type HarnessMachineData

type HarnessMachineData struct {
	Name          string
	Host          string
	Description   string
	Labels        []string
	Resources     map[string]any
	WorkspaceRoot string
}

type HarnessPlatformData

type HarnessPlatformData struct {
	APIURL     string
	AgentToken string
	ProjectID  string
	TicketID   string
}

type HarnessProjectData

type HarnessProjectData struct {
	ID          string
	Name        string
	Slug        string
	Description string
	Status      string
	Workflows   []HarnessProjectWorkflowData
	Statuses    []HarnessProjectStatusData
	Machines    []HarnessProjectMachineData
	Updates     []HarnessProjectUpdateThreadData
}

type HarnessProjectMachineData

type HarnessProjectMachineData struct {
	Name        string
	Host        string
	Description string
	Labels      []string
	Status      string
	Resources   map[string]any
}

type HarnessProjectStatusData

type HarnessProjectStatusData struct {
	ID    string
	Name  string
	Stage string
	Color string
}

type HarnessProjectUpdateCommentData

type HarnessProjectUpdateCommentData struct {
	ID           string
	BodyMarkdown string
	CreatedBy    string
	CreatedAt    string
	UpdatedAt    string
}

type HarnessProjectUpdateThreadData

type HarnessProjectUpdateThreadData struct {
	ID             string
	Status         string
	Title          string
	BodyMarkdown   string
	CreatedBy      string
	CreatedAt      string
	UpdatedAt      string
	LastActivityAt string
	CommentCount   int
	Comments       []HarnessProjectUpdateCommentData
}

type HarnessProjectWorkflowData

type HarnessProjectWorkflowData struct {
	Name            string
	Type            string
	RoleName        string
	RoleDescription string
	PickupStatus    string
	FinishStatus    string
	PickupStatuses  []HarnessProjectStatusData
	FinishStatuses  []HarnessProjectStatusData
	HarnessPath     string
	HarnessContent  string
	Skills          []string
	MaxConcurrent   int
	CurrentActive   int
	RecentTickets   []HarnessProjectWorkflowTicketData
}

type HarnessProjectWorkflowTicketData

type HarnessProjectWorkflowTicketData struct {
	Identifier        string
	Title             string
	Status            string
	Priority          string
	Type              string
	AttemptCount      int
	ConsecutiveErrors int
	RetryPaused       bool
	PauseReason       string
	CreatedAt         string
	StartedAt         string
	CompletedAt       string
}

type HarnessRepoData

type HarnessRepoData struct {
	Name          string
	URL           string
	Path          string
	Branch        string
	DefaultBranch string
	Labels        []string
}

type HarnessTemplateData

type HarnessTemplateData struct {
	Ticket             HarnessTicketData
	Project            HarnessProjectData
	Repos              []HarnessRepoData
	AllRepos           []HarnessRepoData
	Agent              HarnessAgentData
	Machine            HarnessMachineData
	AccessibleMachines []HarnessAccessibleMachineData
	Attempt            int
	MaxAttempts        int
	Workspace          string
	Timestamp          string
	OpenASEVersion     string
	Workflow           HarnessWorkflowData
	Platform           HarnessPlatformData
}

type HarnessTicketData

type HarnessTicketData struct {
	ID               string
	Identifier       string
	Title            string
	Description      string
	Status           string
	Priority         string
	Type             string
	CreatedBy        string
	CreatedAt        string
	AttemptCount     int
	MaxAttempts      int
	BudgetUSD        float64
	ExternalRef      string
	ParentIdentifier string
	URL              string
	Links            []HarnessTicketLinkData
	Dependencies     []HarnessTicketDependencyData
}

type HarnessTicketDependencyData

type HarnessTicketDependencyData struct {
	Identifier string
	Title      string
	Type       string
	Status     string
}

type HarnessTicketLinkData

type HarnessTicketLinkData struct {
	Type   string
	URL    string
	Title  string
	Status string
}

type HarnessVariableGroup

type HarnessVariableGroup struct {
	Name      string                    `json:"name"`
	Variables []HarnessVariableMetadata `json:"variables"`
}

type HarnessVariableMetadata

type HarnessVariableMetadata struct {
	Path        string `json:"path"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Example     string `json:"example,omitempty"`
}

type HarnessWorkflowData

type HarnessWorkflowData struct {
	Name         string
	Type         string
	RoleName     string
	PickupStatus string
	FinishStatus string
}

type MaterializeRuntimeSnapshotInput

type MaterializeRuntimeSnapshotInput struct {
	WorkspaceRoot string
	AdapterType   string
	Snapshot      RuntimeSnapshot
}

type MaterializedRuntimeSnapshot

type MaterializedRuntimeSnapshot struct {
	SkillsDir         string
	WorkflowVersionID uuid.UUID
	SkillVersionIDs   []uuid.UUID
}

type Optional

type Optional[T any] struct {
	Set   bool
	Value T
}

type RefreshSkillsInput

type RefreshSkillsInput struct {
	ProjectID     uuid.UUID
	WorkspaceRoot string
	AdapterType   string
	WorkflowID    *uuid.UUID
}

type RefreshSkillsResult

type RefreshSkillsResult struct {
	SkillsDir      string   `json:"skills_dir"`
	InjectedSkills []string `json:"injected_skills"`
}

type ReplaceWorkflowReferencesInput

type ReplaceWorkflowReferencesInput struct {
	WorkflowID            uuid.UUID
	ReplacementWorkflowID uuid.UUID
}

type ReplaceWorkflowReferencesResult

type ReplaceWorkflowReferencesResult struct {
	WorkflowID            uuid.UUID                       `json:"workflow_id"`
	ReplacementWorkflowID uuid.UUID                       `json:"replacement_workflow_id"`
	TicketCount           int                             `json:"ticket_count"`
	ScheduledJobCount     int                             `json:"scheduled_job_count"`
	Tickets               []WorkflowTicketReference       `json:"tickets"`
	ScheduledJobs         []WorkflowScheduledJobReference `json:"scheduled_jobs"`
}

type ResolveRecordedRuntimeSnapshotInput

type ResolveRecordedRuntimeSnapshotInput struct {
	WorkflowID        uuid.UUID
	WorkflowVersionID *uuid.UUID
	SkillVersionIDs   []uuid.UUID
}

type RuntimeSkillFileSnapshot

type RuntimeSkillFileSnapshot struct {
	Path         string
	Content      []byte
	IsExecutable bool
}

type RuntimeSkillSnapshot

type RuntimeSkillSnapshot struct {
	SkillID    uuid.UUID
	Name       string
	VersionID  uuid.UUID
	Version    int
	Content    string
	Files      []RuntimeSkillFileSnapshot
	IsRequired bool
}

type RuntimeSnapshot

type RuntimeSnapshot struct {
	Workflow RuntimeWorkflowSnapshot
	Skills   []RuntimeSkillSnapshot
}

type RuntimeWorkflowSnapshot

type RuntimeWorkflowSnapshot struct {
	WorkflowID            uuid.UUID
	VersionID             uuid.UUID
	Version               int
	Path                  string
	Content               string
	Name                  string
	Type                  Type
	RoleSlug              string
	RoleName              string
	RoleDescription       string
	PickupStatusIDs       []uuid.UUID
	FinishStatusIDs       []uuid.UUID
	PlatformAccessAllowed []string
}

type Skill

type Skill struct {
	ID             uuid.UUID              `json:"id"`
	Name           string                 `json:"name"`
	Description    string                 `json:"description"`
	Path           string                 `json:"path"`
	CurrentVersion int                    `json:"current_version"`
	IsBuiltin      bool                   `json:"is_builtin"`
	IsEnabled      bool                   `json:"is_enabled"`
	CreatedBy      string                 `json:"created_by"`
	CreatedAt      time.Time              `json:"created_at"`
	BoundWorkflows []SkillWorkflowBinding `json:"bound_workflows"`
}

type SkillBundle

type SkillBundle struct {
	Name             string            `json:"name"`
	Description      string            `json:"description"`
	Files            []SkillBundleFile `json:"files"`
	FileCount        int               `json:"file_count"`
	SizeBytes        int64             `json:"size_bytes"`
	BundleHash       string            `json:"bundle_hash"`
	Manifest         map[string]any    `json:"manifest"`
	EntrypointPath   string            `json:"entrypoint_path"`
	EntrypointSHA256 string            `json:"entrypoint_sha256"`
	EntrypointBody   string            `json:"entrypoint_body"`
}

type SkillBundleFile

type SkillBundleFile struct {
	Path         string `json:"path"`
	FileKind     string `json:"file_kind"`
	MediaType    string `json:"media_type"`
	Encoding     string `json:"encoding"`
	IsExecutable bool   `json:"is_executable"`
	SizeBytes    int64  `json:"size_bytes"`
	SHA256       string `json:"sha256"`
	Content      []byte `json:"-"`
}

type SkillBundleFileInput

type SkillBundleFileInput struct {
	Path         string
	Content      []byte
	IsExecutable bool
	MediaType    string
}

type SkillDetail

type SkillDetail struct {
	Skill      `json:",inline"`
	Content    string            `json:"content"`
	BundleHash string            `json:"bundle_hash"`
	FileCount  int               `json:"file_count"`
	Files      []SkillBundleFile `json:"files"`
	History    []VersionSummary  `json:"history"`
}

type SkillRecord

type SkillRecord struct {
	ID               uuid.UUID
	ProjectID        uuid.UUID
	Name             string
	Description      string
	CurrentVersionID *uuid.UUID
	IsBuiltin        bool
	IsEnabled        bool
	CreatedBy        string
	CreatedAt        time.Time
	UpdatedAt        time.Time
	ArchivedAt       *time.Time
}

type SkillVersionRecord

type SkillVersionRecord struct {
	ID              uuid.UUID
	SkillID         uuid.UUID
	Version         int
	CreatedBy       string
	CreatedAt       time.Time
	ContentMarkdown string
	BundleHash      string
	FileCount       int
}

type SkillWorkflowBinding

type SkillWorkflowBinding struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	HarnessPath string    `json:"harness_path"`
}

type StatusBindingSet

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

func MustStatusBindingSet

func MustStatusBindingSet(ids ...uuid.UUID) StatusBindingSet

func ParseStatusBindingSet

func ParseStatusBindingSet(fieldName string, raw []uuid.UUID) (StatusBindingSet, error)

func (StatusBindingSet) Contains

func (s StatusBindingSet) Contains(id uuid.UUID) bool

func (StatusBindingSet) IDs

func (s StatusBindingSet) IDs() []uuid.UUID

func (StatusBindingSet) Len

func (s StatusBindingSet) Len() int

func (StatusBindingSet) Overlaps

func (s StatusBindingSet) Overlaps(other StatusBindingSet) bool

func (StatusBindingSet) Single

func (s StatusBindingSet) Single() (uuid.UUID, bool)

type Type

type Type = TypeLabel

func ParseType

func ParseType(raw string) (Type, error)

type TypeLabel

type TypeLabel string
const (
	TypeCoding        TypeLabel = "coding"
	TypeTest          TypeLabel = "test"
	TypeDoc           TypeLabel = "doc"
	TypeSecurity      TypeLabel = "security"
	TypeDeploy        TypeLabel = "deploy"
	TypeRefineHarness TypeLabel = "refine-harness"
	TypeCustom        TypeLabel = "custom"
)

func MustParseTypeLabel

func MustParseTypeLabel(raw string) TypeLabel

func ParseTypeLabel

func ParseTypeLabel(raw string) (TypeLabel, error)

func (TypeLabel) NormalizedKey

func (t TypeLabel) NormalizedKey() string

func (TypeLabel) String

func (t TypeLabel) String() string

type UpdateHarnessInput

type UpdateHarnessInput struct {
	WorkflowID uuid.UUID
	Content    string
	EditedBy   string
}

type UpdateInput

type UpdateInput struct {
	WorkflowID            uuid.UUID
	AgentID               Optional[uuid.UUID]
	Name                  Optional[string]
	Type                  Optional[Type]
	RoleName              Optional[string]
	RoleDescription       Optional[string]
	PlatformAccessAllowed Optional[[]string]
	EditedBy              string
	HarnessPath           Optional[string]
	Hooks                 Optional[map[string]any]
	MaxConcurrent         Optional[int]
	MaxRetryAttempts      Optional[int]
	TimeoutMinutes        Optional[int]
	StallTimeoutMinutes   Optional[int]
	IsActive              Optional[bool]
	PickupStatusIDs       Optional[StatusBindingSet]
	FinishStatusIDs       Optional[StatusBindingSet]
}

type UpdateSkillBindingsInput

type UpdateSkillBindingsInput struct {
	SkillID     uuid.UUID
	WorkflowIDs []uuid.UUID
}

type UpdateSkillBundleInput

type UpdateSkillBundleInput struct {
	SkillID      uuid.UUID
	Files        []SkillBundleFileInput
	Content      string
	Description  string
	ReplaceEntry bool
}

type UpdateSkillInput

type UpdateSkillInput struct {
	SkillID     uuid.UUID
	Content     string
	Description string
}

type UpdateWorkflowSkillsInput

type UpdateWorkflowSkillsInput struct {
	WorkflowID uuid.UUID
	Skills     []string
}

type VersionSummary

type VersionSummary struct {
	ID        uuid.UUID `json:"id"`
	Version   int       `json:"version"`
	CreatedBy string    `json:"created_by"`
	CreatedAt time.Time `json:"created_at"`
}

type Workflow

type Workflow struct {
	ID                    uuid.UUID      `json:"id"`
	ProjectID             uuid.UUID      `json:"project_id"`
	AgentID               *uuid.UUID     `json:"agent_id"`
	Name                  string         `json:"name"`
	Type                  Type           `json:"type"`
	RoleSlug              string         `json:"role_slug"`
	RoleName              string         `json:"role_name"`
	RoleDescription       string         `json:"role_description"`
	PlatformAccessAllowed []string       `json:"platform_access_allowed"`
	HarnessPath           string         `json:"harness_path"`
	Hooks                 map[string]any `json:"hooks"`
	MaxConcurrent         int            `json:"max_concurrent"`
	MaxRetryAttempts      int            `json:"max_retry_attempts"`
	TimeoutMinutes        int            `json:"timeout_minutes"`
	StallTimeoutMinutes   int            `json:"stall_timeout_minutes"`
	Version               int            `json:"version"`
	IsActive              bool           `json:"is_active"`
	PickupStatusIDs       []uuid.UUID    `json:"pickup_status_ids"`
	FinishStatusIDs       []uuid.UUID    `json:"finish_status_ids"`
}

type WorkflowAgentRunReference

type WorkflowAgentRunReference struct {
	ID               uuid.UUID `json:"id"`
	TicketID         uuid.UUID `json:"ticket_id"`
	TicketIdentifier string    `json:"ticket_identifier"`
	TicketTitle      string    `json:"ticket_title"`
	Status           string    `json:"status"`
	CreatedAt        time.Time `json:"created_at"`
}

type WorkflowBlockingReferences

type WorkflowBlockingReferences struct {
	ActiveAgentRuns     []WorkflowAgentRunReference `json:"active_agent_runs"`
	HistoricalAgentRuns []WorkflowAgentRunReference `json:"historical_agent_runs"`
}

type WorkflowClassification

type WorkflowClassification struct {
	Family     WorkflowFamily `json:"family"`
	Confidence float64        `json:"confidence"`
	Reasons    []string       `json:"reasons"`
}

type WorkflowClassificationInput

type WorkflowClassificationInput struct {
	RoleSlug          string
	TypeLabel         TypeLabel
	WorkflowName      string
	PickupStatusNames []string
	FinishStatusNames []string
	SkillNames        []string
	HarnessPath       string
	HarnessContent    string
}

type WorkflowDetail

type WorkflowDetail struct {
	Workflow
	HarnessContent string `json:"harness_content"`
}

type WorkflowFamily

type WorkflowFamily string
const (
	WorkflowFamilyPlanning    WorkflowFamily = "planning"
	WorkflowFamilyDispatcher  WorkflowFamily = "dispatcher"
	WorkflowFamilyCoding      WorkflowFamily = "coding"
	WorkflowFamilyReview      WorkflowFamily = "review"
	WorkflowFamilyTest        WorkflowFamily = "test"
	WorkflowFamilyDocs        WorkflowFamily = "docs"
	WorkflowFamilyDeploy      WorkflowFamily = "deploy"
	WorkflowFamilySecurity    WorkflowFamily = "security"
	WorkflowFamilyHarness     WorkflowFamily = "harness"
	WorkflowFamilyEnvironment WorkflowFamily = "environment"
	WorkflowFamilyResearch    WorkflowFamily = "research"
	WorkflowFamilyReporting   WorkflowFamily = "reporting"
	WorkflowFamilyUnknown     WorkflowFamily = "unknown"
)

type WorkflowImpactAnalysis

type WorkflowImpactAnalysis struct {
	WorkflowID            uuid.UUID                     `json:"workflow_id"`
	CanRetire             bool                          `json:"can_retire"`
	CanReplaceReferences  bool                          `json:"can_replace_references"`
	CanPurge              bool                          `json:"can_purge"`
	Summary               WorkflowImpactSummary         `json:"summary"`
	ReplaceableReferences WorkflowReplaceableReferences `json:"replaceable_references"`
	BlockingReferences    WorkflowBlockingReferences    `json:"blocking_references"`
}

type WorkflowImpactConflict

type WorkflowImpactConflict struct {
	Err    error
	Impact WorkflowImpactAnalysis
}

func (*WorkflowImpactConflict) Error

func (e *WorkflowImpactConflict) Error() string

func (*WorkflowImpactConflict) Unwrap

func (e *WorkflowImpactConflict) Unwrap() error

type WorkflowImpactSummary

type WorkflowImpactSummary struct {
	TicketCount               int `json:"ticket_count"`
	ScheduledJobCount         int `json:"scheduled_job_count"`
	ActiveAgentRunCount       int `json:"active_agent_run_count"`
	HistoricalAgentRunCount   int `json:"historical_agent_run_count"`
	ReplaceableReferenceCount int `json:"replaceable_reference_count"`
	BlockingReferenceCount    int `json:"blocking_reference_count"`
}

type WorkflowReplaceableReferences

type WorkflowReplaceableReferences struct {
	Tickets       []WorkflowTicketReference       `json:"tickets"`
	ScheduledJobs []WorkflowScheduledJobReference `json:"scheduled_jobs"`
}

type WorkflowScheduledJobReference

type WorkflowScheduledJobReference struct {
	ID        uuid.UUID `json:"id"`
	Name      string    `json:"name"`
	IsEnabled bool      `json:"is_enabled"`
}

type WorkflowTicketReference

type WorkflowTicketReference struct {
	ID           uuid.UUID  `json:"id"`
	Identifier   string     `json:"identifier"`
	Title        string     `json:"title"`
	StatusID     uuid.UUID  `json:"status_id"`
	StatusName   string     `json:"status_name"`
	CurrentRunID *uuid.UUID `json:"current_run_id,omitempty"`
}

type WorkflowVersionRecord

type WorkflowVersionRecord struct {
	ID                    uuid.UUID
	WorkflowID            uuid.UUID
	Version               int
	ContentMarkdown       string
	Name                  string
	Type                  Type
	RoleSlug              string
	RoleName              string
	RoleDescription       string
	PickupStatusIDs       []uuid.UUID
	FinishStatusIDs       []uuid.UUID
	HarnessPath           string
	Hooks                 map[string]any
	PlatformAccessAllowed []string
	MaxConcurrent         int
	MaxRetryAttempts      int
	TimeoutMinutes        int
	StallTimeoutMinutes   int
	IsActive              bool
	ContentHash           string
	CreatedBy             string
	CreatedAt             time.Time
}

Jump to

Keyboard shortcuts

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